Browse Source

add special class for sys-message icon; move last visible id stuff to model

Andrew Dolgov 6 months ago
parent
commit
64cb551d85

+ 20 - 23
js/tt-irc.js

@@ -400,7 +400,7 @@ const Message = function(data, chan) {
 						break;
 				case MSGT_SYSTEM:
 						formatted_message = `<span class="timestamp" title="${self.formatted_ts(true)}">${self.formatted_ts()}</span>
-							<span class='lt'>&#10070;</span>
+							<span class='sys-icon'>&#10070;</span>
 							<span class='sys-message'>${tmp_message}</span>`;
 
 						break;
@@ -418,7 +418,7 @@ const Message = function(data, chan) {
 
 					} else {
 						formatted_message = `<span class="timestamp" title="${self.formatted_ts(true)}">${self.formatted_ts()}</span>
-							<span class='lt'>&#10070;</span>
+							<span class='sys-icon'>&#10070;</span>
 							<span class="sys-message">${tmp_message}</span>`;
 					}
 
@@ -669,6 +669,22 @@ function Model() {
 		return false;
 	};
 
+	self.saveLastVisibleId = function() {
+		const chan = self.activeChannel();
+
+		if (chan) {
+			const last_row = chan.displayLines()
+				.filter((msg) => { return msg.id() != 0 })
+				.last();
+
+			if (last_row) {
+				const last_id = last_row.id();
+				console.log(chan.title(), 'last visible id', last_id);
+				chan.last_visible_id(last_id);
+			}
+		}
+	};
+
 	self.getInstanceConnection = function() {
 		const conns = self.connections();
 		for (let i = 0; i < conns.length; i++) {
@@ -2021,19 +2037,7 @@ function change_tab(elem, event) {
 
 	if (event) event.stopPropagation();
 
-	const current = model.activeChannel();
-
-	if (current) {
-		const last_row = current.displayLines()
-			.filter((msg) => { return msg.id() != 0 })
-			.last();
-
-		if (last_row) {
-			const last_id = last_row.id();
-			console.log('last visible id', last_id);
-			current.last_visible_id(last_id);
-		}
-	}
+	model.saveLastVisibleId();
 
 	$("#tabs").removeClass("active");
 
@@ -2703,14 +2707,7 @@ function set_window_active(active) {
 	} else {
 		$('body').removeClass("active");
 
-		const channel = model.activeChannel();
-
-		if (channel) {
-			const id = $("#log-list li:visible:last").attr('rowid');
-			console.log('last visible id', id);
-
-			channel.last_visible_id(id);
-		}
+		model.saveLastVisibleId();
 	}
 
 	PluginHost.run(PluginHost.HOOK_WINDOW_ACTIVE, active);

+ 1 - 1
themes/darkly/theme.css

@@ -1 +1 @@
[email protected] "bootstrap.css";body.main #content{background:#333;border-color:#333}body.main a{color:#65c1b9}body.main #log a:visited,body.main #log a[data-visited="true"]{color:#6e9e96}body.main #tabs-list{font-size:14px}body.main #tabs-list li.selected{background:#333;border-color:#333}body.main #tabs-list li .conn-img{background:#dc9656;border-color:#dc9656}body.main #tabs-list li .conn-img.connected{background:#65c1b9;border-color:#65c1b9}body.main #tabs-list li.selected .conn-img,body.main #tabs-list li.selected .close-img,body.main #tabs-list li .conn-img,body.main #tabs-list li .close-img{color:#fff;text-shadow:none}body.main #tabs-list li.selected div{color:#fff;text-shadow:none}body.main #nick{color:#ccc}body.main #content #log{background:#181818;border-color:#333;font-size:14px}body.main #content #log .row .message{color:#eee}body.main #content #log .row:not(.LV){border-color:#333}body.main #content #log .row:nth-child(even){background:#181818}body.main #content #log div.row.HL,body.main #content #log body.main div#log .row.HL:nth-child(even){background:#222;border-color:#333}body.main #content #log div.row.HL .message{color:#f7ca88}body.main #content #log .row .timestamp{color:#ba8baf}body.main #content #log .row .sys-message{color:#7cafc2}body.main #content #log .gt,body.main #content #log .lt{color:#65c1b9}body.main div#content #topic-input-real,body.main div#content #input-prompt,body.main div#content #topic-input{background:#181818;color:#fff;font-size:14px}body.main #userlist span.user-img.voice{background:#f39c12;border-color:#f39c12}body.main #userlist span.user-img.op{background:#7cafc2;border-color:#7cafc2}body.main #userlist span.user-img{background:#ccc;border-color:#ccc}body.main ::-webkit-scrollbar{width:4px}body.main ::-webkit-scrollbar-thumb{background-color:rgba(255,255,255,0.5)}body.main ::-webkit-scrollbar-track{background-color:rgba(255,255,255,0.2)}
[email protected] "bootstrap.css";body.main #content{background:#333;border-color:#333}body.main a{color:#65C1B9}body.main #log a:visited,body.main #log a[data-visited="true"]{color:#6E9E96}body.main #tabs-list{font-size:14px}body.main #tabs-list li.selected{background:#333;border-color:#333}body.main #tabs-list li .conn-img{background:#DC9656;border-color:#DC9656}body.main #tabs-list li .conn-img.connected{background:#65C1B9;border-color:#65C1B9}body.main #tabs-list li.selected .conn-img,body.main #tabs-list li.selected .close-img,body.main #tabs-list li .conn-img,body.main #tabs-list li .close-img{color:white;text-shadow:none}body.main #tabs-list li.selected div{color:white;text-shadow:none}body.main #nick{color:#ccc}body.main #content #log{background:#181818;border-color:#333;font-size:14px}body.main #content #log .row .message{color:#eee}body.main #content #log .row:not(.LV){border-color:#333}body.main #content #log .row:nth-child(even){background:#181818}body.main #content #log div.row.HL,body.main #content #log body.main div#log .row.HL:nth-child(even){background:#222;border-color:#333}body.main #content #log div.row.HL .message{color:#F7CA88}body.main #content #log .row .timestamp{color:#BA8BAF}body.main #content #log .row .sys-message{color:#7CAFC2}body.main #content #log .sys-icon,body.main #content #log .gt,body.main #content #log .lt{color:#65C1B9}body.main div#content #topic-input-real,body.main div#content #input-prompt,body.main div#content #topic-input{background:#181818;color:white;font-size:14px}body.main #userlist span.user-img.voice{background:#F39C12;border-color:#F39C12}body.main #userlist span.user-img.op{background:#7CAFC2;border-color:#7CAFC2}body.main #userlist span.user-img{background:#ccc;border-color:#ccc}body.main ::-webkit-scrollbar{width:4px}body.main ::-webkit-scrollbar-thumb{background-color:rgba(255,255,255,0.5)}body.main ::-webkit-scrollbar-track{background-color:rgba(255,255,255,0.2)}

+ 2 - 1
themes/darkly/theme.less

@@ -89,7 +89,8 @@ body.main {
 		.row .sys-message {
 			color : #7CAFC2;
 		}
-		
+	
+		.sys-icon,	
 		.gt,
 		.lt {
 			color : @link-fg;

+ 1 - 1
themes/solarized/theme.css

@@ -1 +1 @@
[email protected] "../darkly/bootstrap.css";body.main{background:#073642;color:#eee8d5}body.main div#content #topic-input-real,body.main div#content #input-prompt,body.main div#content #topic-input{background:#073642;color:#eee8d5}body.main div#header{color:#eee8d5}body.main #main a{color:#b58900}body.main #log{background:#083e4b;color:#eee8d5;border-color:#0a5062}body.main #log span.gt,body.main #log span.lt{color:#2aa198}body.main #log span.message a:visited,body.main #log span.message a[data-visited="true"]{color:#4f3c00}body.main #log span.message{color:#eee8d5}body.main #log span.sys-message{color:#859900}body.main #log .row.HL,body.main #log .row.HL:nth-child(even){background-color:#b58900;border-color:#002b36}body.main #log .row .timestamp{color:#cb4b16}body.main #log .row.HL *{color:black}body.main #log .row:not(.LV){border-color:#002b36}body.main div#sidebar{background:#002b36}body.main #userlist span.user-img.voice{background:#B58917}body.main #userlist span.user-img.op{background:#CB4B21}body.main #userlist ul#userlist-list li{color:#eee8d5}body.main #userlist span.user-img,body.main #tabs-list span.conn-img{border-color:#002b36;background:#2AA198}body.main #nick,body.main #tabs-list li{color:#eee8d5}body.main #input-prompt,body.main #topic #topic-input{color:#eee8d5;border-color:#0a5062}body.main #tabs-list{color:#dfd4b1}body.main #tabs-list span.conn-img.connected{background:#1DA17A}body.main #tabs-list li.selected{border-color:#0a5062;background:#002b36}body.main #tabs-list li.selected .close-img,body.main #tabs-list li.selected div{color:#eee8d5}body.main #main .emoticons-popup li{background:#073642;border-color:#0a5062}body.main #content{border-color:#0a5062;background:#002b36}
[email protected] "../darkly/bootstrap.css";body.main{background:#073642;color:#eee8d5}body.main div#content #topic-input-real,body.main div#content #input-prompt,body.main div#content #topic-input{background:#073642;color:#eee8d5}body.main div#header{color:#eee8d5}body.main #main a{color:#b58900}body.main #log{background:#083e4b;color:#eee8d5;border-color:#0a5062}body.main #log span.sys-icon,body.main #log span.gt,body.main #log span.lt{color:#2aa198}body.main #log span.message a:visited,body.main #log span.message a[data-visited="true"]{color:#4f3c00}body.main #log span.message{color:#eee8d5}body.main #log span.sys-message{color:#859900}body.main #log .row.HL,body.main #log .row.HL:nth-child(even){background-color:#b58900;border-color:#002b36}body.main #log .row .timestamp{color:#cb4b16}body.main #log .row.HL *{color:black}body.main #log .row:not(.LV){border-color:#002b36}body.main div#sidebar{background:#002b36}body.main #userlist span.user-img.voice{background:#B58917}body.main #userlist span.user-img.op{background:#CB4B21}body.main #userlist ul#userlist-list li{color:#eee8d5}body.main #userlist span.user-img,body.main #tabs-list span.conn-img{border-color:#002b36;background:#2AA198}body.main #nick,body.main #tabs-list li{color:#eee8d5}body.main #input-prompt,body.main #topic #topic-input{color:#eee8d5;border-color:#0a5062}body.main #tabs-list{color:#dfd4b1}body.main #tabs-list span.conn-img.connected{background:#1DA17A}body.main #tabs-list li.selected{border-color:#0a5062;background:#002b36}body.main #tabs-list li.selected .close-img,body.main #tabs-list li.selected div{color:#eee8d5}body.main #main .emoticons-popup li{background:#073642;border-color:#0a5062}body.main #content{border-color:#0a5062;background:#002b36}

+ 1 - 0
themes/solarized/theme.less

@@ -31,6 +31,7 @@ body.main {
 		color : @fg-main;
 		border-color : @bg-border;
 
+		span.sys-icon,
 		span.gt,
 		span.lt {
 			color : #2aa198;

+ 1 - 1
themes/solarized_light/theme.css

@@ -1 +1 @@
-body.main{background:#fdf6e3;color:#002b36}body.main div#content #topic-input-real,body.main div#content #input-prompt,body.main div#content #topic-input{background:#fdf6e3;color:#002b36}body.main div#header{color:#002b36}body.main #main a{color:#268bd2}body.main #log{background:#fdf6e3;color:#002b36;border-color:#c9b67a}body.main #log span.gt,body.main #log span.lt{color:#2aa198}body.main #log span.message a:visited,body.main #log span.message a[data-visited="true"]{color:#16527c}body.main #log span.message{color:#002b36}body.main #log span.sys-message{color:#859900}body.main #log .row.HL,body.main #log .row.HL:nth-child(even){background-color:#2aa198;border-color:#eee8d5}body.main #log .row .timestamp{color:#cb4b16}body.main #log .row.HL *{color:white}body.main #log .row:not(.LV){border-color:#eee8d5}body.main div#sidebar{background:#eee8d5}body.main #userlist span.user-img.voice{background:#B58917}body.main #userlist span.user-img.op{background:#CB4B21}body.main #userlist ul#userlist-list li{color:#002b36}body.main #userlist span.user-img,body.main #tabs-list span.conn-img{border-color:#eee8d5;background:#2AA198}body.main #nick,body.main #tabs-list li{color:#002b36}body.main #input-prompt,body.main #topic #topic-input{color:#002b36;border-color:#c9b67a}body.main #tabs-list{color:#005469}body.main #tabs-list span.conn-img.connected{background:#1DA17A}body.main #tabs-list li.selected{border-color:#c9b67a;background:#eee8d5}body.main #tabs-list li.selected .close-img,body.main #tabs-list li.selected div{color:#002b36}body.main #main .emoticons-popup li{background:#fdf6e3;border-color:#c9b67a}body.main #content{border-color:#c9b67a;background:#eee8d5}
+body.main{background:#fdf6e3;color:#002b36}body.main div#content #topic-input-real,body.main div#content #input-prompt,body.main div#content #topic-input{background:#fdf6e3;color:#002b36}body.main div#header{color:#002b36}body.main #main a{color:#268bd2}body.main #log{background:#fdf6e3;color:#002b36;border-color:#c9b67a}body.main #log span.sys-icon,body.main #log span.gt,body.main #log span.lt{color:#2aa198}body.main #log span.message a:visited,body.main #log span.message a[data-visited="true"]{color:#16527c}body.main #log span.message{color:#002b36}body.main #log span.sys-message{color:#859900}body.main #log .row.HL,body.main #log .row.HL:nth-child(even){background-color:#2aa198;border-color:#eee8d5}body.main #log .row .timestamp{color:#cb4b16}body.main #log .row.HL *{color:white}body.main #log .row:not(.LV){border-color:#eee8d5}body.main div#sidebar{background:#eee8d5}body.main #userlist span.user-img.voice{background:#B58917}body.main #userlist span.user-img.op{background:#CB4B21}body.main #userlist ul#userlist-list li{color:#002b36}body.main #userlist span.user-img,body.main #tabs-list span.conn-img{border-color:#eee8d5;background:#2AA198}body.main #nick,body.main #tabs-list li{color:#002b36}body.main #input-prompt,body.main #topic #topic-input{color:#002b36;border-color:#c9b67a}body.main #tabs-list{color:#005469}body.main #tabs-list span.conn-img.connected{background:#1DA17A}body.main #tabs-list li.selected{border-color:#c9b67a;background:#eee8d5}body.main #tabs-list li.selected .close-img,body.main #tabs-list li.selected div{color:#002b36}body.main #main .emoticons-popup li{background:#fdf6e3;border-color:#c9b67a}body.main #content{border-color:#c9b67a;background:#eee8d5}

+ 1 - 0
themes/solarized_light/theme.less

@@ -29,6 +29,7 @@ body.main {
 		color : @fg-main;
 		border-color : @bg-border;
 
+		span.sys-icon,
 		span.gt,
 		span.lt {
 			color : #2aa198;