]> git.wh0rd.org - tt-rss.git/blobdiff - js/functions.js
css cleanup; remove auxDlg; add separate prefs.css
[tt-rss.git] / js / functions.js
index 4840bcbe11be33818ba5bcdc5dbadb52f5dfa98e..7da9abfbd636589861593ccca843ad4f625197d6 100644 (file)
@@ -2,6 +2,7 @@ var notify_silent = false;
 var loading_progress = 0;
 var sanity_check_done = false;
 var init_params = {};
+var _label_base_index = -1024;
 
 Ajax.Base.prototype.initialize = Ajax.Base.prototype.initialize.wrap(
        function (callOriginal, options) {
@@ -193,30 +194,29 @@ function notify_real(msg, no_hide, n_type) {
 
        */
 
-       if (typeof __ != 'undefined') {
-               msg = __(msg);
-       }
+       msg = __(msg);
 
        if (n_type == 1) {
                n.className = "notify";
        } else if (n_type == 2) {
-               n.className = "notifyProgress";
-               msg = "<img src='"+getInitParam("sign_progress")+"'> " + msg;
+               n.className = "notify progress";
+               msg = "<img src='images/indicator_white.gif'> " + msg;
        } else if (n_type == 3) {
-               n.className = "notifyError";
-               msg = "<img src='"+getInitParam("sign_excl")+"'> " + msg;
+               n.className = "notify error";
+               msg = "<img src='images/sign_excl.svg'> " + msg;
        } else if (n_type == 4) {
-               n.className = "notifyInfo";
-               msg = "<img src='"+getInitParam("sign_info")+"'> " + msg;
+               n.className = "notify info";
+               msg = "<img src='images/sign_info.svg'> " + msg;
        }
 
-//     msg = "<img src='images/live_com_loading.gif'> " + msg;
-
        if (no_hide) {
-               msg += " (<a href='#' onclick=\"notify('')\">X</a>)";
+               msg += " <span>(<a href='#' onclick=\"notify('')\">" +
+                       __("close") + "</a>)</span>";
        }
 
 
+//     msg = "<img src='images/live_com_loading.gif'> " + msg;
+
        nb.innerHTML = msg;
 
        if (!no_hide) {
@@ -717,15 +717,6 @@ function hotkey_prefix_timeout() {
        }
 }
 
-function hideAuxDlg() {
-       try {
-               Element.hide('auxDlg');
-       } catch (e) {
-               exception_error("hideAuxDlg", e);
-       }
-}
-
-
 function uploadIconHandler(rc) {
        try {
                switch (rc) {
@@ -1216,20 +1207,31 @@ function quickAddFilter() {
                        var lh = dojo.connect(dialog, "onLoad", function(){
                                dojo.disconnect(lh);
 
-                               var title = $("PTITLE-FULL-" + getActiveArticleId());
+                               var query = "op=rpc&method=getlinktitlebyid&id=" + getActiveArticleId();
 
-                               if (title || getActiveFeedId() || activeFeedIsCat()) {
-                                       if (title) title = title.innerHTML;
+                               new Ajax.Request("backend.php", {
+                               parameters: query,
+                               onComplete: function(transport) {
+                                       var reply = JSON.parse(transport.responseText);
 
-                                       console.log(title + " " + getActiveFeedId());
+                                       var title = false;
 
-                                       var feed_id = activeFeedIsCat() ? 'CAT:' + parseInt(getActiveFeedId()) :
-                                               getActiveFeedId();
+                                       if (reply && reply) title = reply.title;
 
-                                       var rule = { reg_exp: title, feed_id: feed_id, filter_type: 1 };
+                                       if (title || getActiveFeedId() || activeFeedIsCat()) {
+
+                                               console.log(title + " " + getActiveFeedId());
+
+                                               var feed_id = activeFeedIsCat() ? 'CAT:' + parseInt(getActiveFeedId()) :
+                                                       getActiveFeedId();
+
+                                               var rule = { reg_exp: title, feed_id: feed_id, filter_type: 1 };
+
+                                               addFilterRule(null, dojo.toJson(rule));
+                                       }
+
+                               } });
 
-                                       addFilterRule(null, dojo.toJson(rule));
-                               }
                        });
                }
 
@@ -1327,6 +1329,8 @@ function backend_sanity_check_callback(transport) {
                                for (k in params) {
                                        var v = params[k];
                                        console.log("IP: " + k + " => " + v);
+
+                                       if (k == "label_base_index") _label_base_index = parseInt(v);
                                }
                        }
 
@@ -1975,3 +1979,13 @@ function htmlspecialchars_decode (string, quote_style) {
 
   return string;
 }
+
+
+function label_to_feed_id(label) {
+       return _label_base_index - 1 - Math.abs(label);
+}
+
+function feed_to_label_id(feed) {
+       return _label_base_index - 1 + Math.abs(feed);
+}
+