Browse Source

tweak notify layout/display

Andrew Dolgov 11 years ago
parent
commit
95437e9e07
4 changed files with 33 additions and 42 deletions
  1. 1 1
      index.php
  2. 14 30
      js/functions.js
  3. 1 1
      prefs.php
  4. 17 10
      tt-rss.css

+ 1 - 1
index.php

@@ -138,7 +138,7 @@
 	</div>
 </div>
 
-<div id="notify" class="notify"><span id="notify_body">&nbsp;</span></div>
+<div id="notify" class="notify" style="display : none"></div>
 <div id="cmdline" style="display : none"></div>
 <div id="headlines-tmp" style="display : none"></div>
 

+ 14 - 30
js/functions.js

@@ -1,8 +1,8 @@
-var notify_silent = false;
 var loading_progress = 0;
 var sanity_check_done = false;
 var init_params = {};
 var _label_base_index = -1024;
+var notify_hide_timerid = false;
 
 Ajax.Base.prototype.initialize = Ajax.Base.prototype.initialize.wrap(
 	function (callOriginal, options) {
@@ -147,42 +147,28 @@ function param_unescape(arg) {
 		return unescape(arg);
 }
 
-var notify_hide_timerid = false;
 
 function hide_notify() {
-	var n = $("notify");
-	if (n) {
-		n.style.display = "none";
-	}
-}
-
-function notify_silent_next() {
-	notify_silent = true;
+	Element.hide('notify');
 }
 
 function notify_real(msg, no_hide, n_type) {
 
-	if (notify_silent) {
-		notify_silent = false;
-		return;
-	}
-
 	var n = $("notify");
-	var nb = $("notify_body");
 
-	if (!n || !nb) return;
+	if (!n) return;
 
 	if (notify_hide_timerid) {
 		window.clearTimeout(notify_hide_timerid);
 	}
 
 	if (msg == "") {
-		if (n.style.display == "block") {
+		if (Element.visible(n)) {
 			notify_hide_timerid = window.setTimeout("hide_notify()", 0);
 		}
 		return;
 	} else {
-		n.style.display = "block";
+		Element.show(n);
 	}
 
 	/* types:
@@ -194,33 +180,31 @@ function notify_real(msg, no_hide, n_type) {
 
 	*/
 
-	msg = __(msg);
+	msg = "<span class=\"msg\"> " + __(msg) + "</span>";
 
 	if (n_type == 1) {
 		n.className = "notify";
 	} else if (n_type == 2) {
 		n.className = "notify progress";
-		msg = "<img src='images/indicator_white.gif'> " + msg;
+		msg = "<span><img src='images/indicator_white.gif'></span>" + msg;
+		no_hide = true;
 	} else if (n_type == 3) {
 		n.className = "notify error";
-		msg = "<img src='images/sign_excl.svg'> " + msg;
+		msg = "<span><img src='images/sign_excl.svg'></span>" + msg;
 	} else if (n_type == 4) {
 		n.className = "notify info";
-		msg = "<img src='images/sign_info.svg'> " + msg;
-	}
-
-	if (no_hide) {
-		msg += " <span>(<a href='#' onclick=\"notify('')\">" +
-			__("close") + "</a>)</span>";
+		msg = "<span><img src='images/sign_info.svg'></span>" + msg;
 	}
 
+	msg += " <span><img src=\"images/close_notify.svg\" class=\"close\" title=\"" +
+		__("Click to close") + "\" onclick=\"notify('')\"></span>";
 
 //	msg = "<img src='images/live_com_loading.gif'> " + msg;
 
-	nb.innerHTML = msg;
+	n.innerHTML = msg;
 
 	if (!no_hide) {
-		notify_hide_timerid = window.setTimeout("hide_notify()", 3000);
+		notify_hide_timerid = window.setTimeout("hide_notify()", 5*1000);
 	}
 }
 

+ 1 - 1
prefs.php

@@ -93,7 +93,7 @@
 
 <body id="ttrssPrefs" class="claro">
 
-<div id="notify" class="notify"><span id="notify_body">&nbsp;</span></div>
+<div id="notify" class="notify" style="display : none"></div>
 <div id="cmdline" style="display : none"></div>
 
 <div id="overlay">

+ 17 - 10
tt-rss.css

@@ -132,14 +132,12 @@ a:hover {
 }
 
 #notify {
-	top : 25px;
+	bottom : 10px;
 	right : 10px;
 	border-width : 1px;
 	border-style : solid;
 	position : absolute;	
-	display : none;
-	float : right;
-	font-size : 11px;
+	font-size : 12px;
 	z-index : 99;
 	padding : 5px;
 	min-width : 200px;
@@ -148,7 +146,21 @@ a:hover {
 
 #notify img {
 	vertical-align : middle;
-	margin-right : 4px;
+	max-height : 14px;
+}
+
+#notify span.msg {
+	width : 100%;
+}
+
+#notify span.close {
+	text-align : right;
+}
+
+#notify span {
+	display : table-cell;
+	vertical-align : middle;
+	padding : 4px;
 }
 
 .notify {
@@ -171,11 +183,6 @@ a:hover {
 	border-color : #ff0000;
 }
 
-.notify.error span:hover {
-	color : red;
-	cursor : pointer;
-}
-
 .hl.Unread div.hlTitle {
 	font-weight : bold;
 }