]> git.wh0rd.org - tt-rss.git/blobdiff - prefs.js
reenable piggie (refs #42)
[tt-rss.git] / prefs.js
index ee53cf27aff5879a562621b97ccb694ee14d97ce..83621b6d418b2ea88bbf47f881bf68a6bcfdc64b 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -4,7 +4,6 @@ var active_tab = false;
 var init_params = new Array();
 
 var caller_subop = false;
-var sanity_check_done = false;
 var hotkey_prefix = false;
 var hotkey_prefix_pressed = false;
 
@@ -12,6 +11,9 @@ var color_picker_active = false;
 var selection_disabled = false;
 var mouse_is_down = false;
 
+var db = false;
+var store = false;
+
 function feedlist_callback2(transport) {
 
        try {   
@@ -465,7 +467,7 @@ function removeSelectedUsers() {
        
                if (sel_rows.length > 0) {
        
-                       var ok = confirm(__("Remove selected users?"));
+                       var ok = confirm(__("Remove selected users? Neither default admin nor your account will be removed."));
        
                        if (ok) {
                                notify_progress("Removing selected users...");
@@ -544,7 +546,7 @@ function removeSelectedFeeds() {
                                var query = "?op=pref-feeds&subop=remove&ids="+
                                        param_escape(sel_rows.toString());
 
-                               debug(query);
+                               console.log(query);
 
                                new Ajax.Request("backend.php", {
                                        parameters: query,
@@ -605,7 +607,7 @@ function purgeSelectedFeeds() {
                        var query = "?op=rpc&subop=purge&ids="+
                                param_escape(sel_rows.toString()) + "&days=" + pr;
 
-                       debug(query);
+                       console.log(query);
 
                        new Ajax.Request("prefs.php",   {
                                parameters: query,
@@ -951,7 +953,7 @@ function editSelectedFeeds() {
 
 function piggie(enable) {
        if (enable) {
-               debug("I LOVEDED IT!");
+               console.log("I LOVEDED IT!");
                var piggie = $("piggie");
 
                Element.show(piggie);
@@ -1050,7 +1052,7 @@ function selectTab(id, noupdate, subop) {
 
                if (!noupdate) {
 
-                       debug("selectTab: " + id + "(NU: " + noupdate + ")");
+                       console.log("selectTab: " + id + "(NU: " + noupdate + ")");
        
                        notify_progress("Loading, please wait...");
        
@@ -1105,62 +1107,6 @@ function selectTab(id, noupdate, subop) {
        }
 }
 
-function backend_sanity_check_callback2(transport) {
-
-       try {
-
-               if (sanity_check_done) {
-                       fatalError(11, "Sanity check request received twice. This can indicate "+
-                     "presence of Firebug or some other disrupting extension. "+
-                               "Please disable it and try again.");
-                       return;
-               }
-
-               if (!transport.responseXML) {
-                       fatalError(3, "Sanity Check: Received reply is not XML", 
-                               transport.responseText);
-                       return;
-               }
-
-               var reply = transport.responseXML.firstChild.firstChild;
-
-               if (!reply) {
-                       fatalError(3, "Sanity Check: Invalid RPC reply", transport.responseText);
-                       return;
-               }
-
-               var error_code = reply.getAttribute("error-code");
-       
-               if (error_code && error_code != 0) {
-                       return fatalError(error_code, reply.getAttribute("error-msg"));
-               }
-
-               debug("sanity check ok");
-
-               var params = reply.nextSibling;
-
-               if (params) {
-                       debug('reading init-params...');
-                       var param = params.firstChild;
-
-                       while (param) {
-                               var k = param.getAttribute("key");
-                               var v = param.getAttribute("value");
-                               debug(k + " => " + v);
-                               init_params[k] = v;                                     
-                               param = param.nextSibling;
-                       }
-               }
-
-               sanity_check_done = true;
-
-               init_second_stage();
-
-       } catch (e) {
-               exception_error("backend_sanity_check_callback", e);
-       }
-}
-
 function init_second_stage() {
 
        try {
@@ -1206,7 +1152,7 @@ function init() {
        
                if (getURLParam('debug')) {
                        Element.show("debug_output");
-                       debug('debug mode activated');
+                       console.log('debug mode activated');
                }
 
                loading_set_progress(30);
@@ -1216,7 +1162,7 @@ function init() {
                new Ajax.Request("backend.php", {
                        parameters: query,
                        onComplete: function(transport) { 
-                               backend_sanity_check_callback2(transport);
+                               backend_sanity_check_callback(transport);
                        } });
 
        } catch (e) {
@@ -1232,7 +1178,7 @@ function validatePrefsReset() {
 
                        var query = Form.serialize("pref_prefs_form");
                        query = query + "&subop=reset-config";
-                       debug(query);
+                       console.log(query);
 
                        new Ajax.Request("backend.php", {
                                parameters: query,
@@ -1370,7 +1316,7 @@ function pref_hotkey_handler(e) {
                } 
 
                if (!hotkeys_enabled) {
-                       debug("hotkeys disabled");
+                       console.log("hotkeys disabled");
                        return;
                }
 
@@ -1387,7 +1333,7 @@ function pref_hotkey_handler(e) {
                        cmdline.innerHTML = keychar;
                        Element.show(cmdline);
 
-                       debug("KP: PREFIX=" + keycode + " CHAR=" + keychar);
+                       console.log("KP: PREFIX=" + keycode + " CHAR=" + keychar);
                        return;
                }
 
@@ -1410,7 +1356,7 @@ function pref_hotkey_handler(e) {
                        if (keycode == 68 && shift_key) { // d
                                if (!Element.visible("debug_output")) {
                                        Element.show("debug_output");
-                                       debug('debug mode activated');
+                                       console.log('debug mode activated');
                                } else {
                                        Element.hide("debug_output");
                                }
@@ -1510,8 +1456,7 @@ function pref_hotkey_handler(e) {
                }
 
                if ($("piggie")) {
-       
-                       if (seq.match("807371717369")) {
+                       if (seq.match("8073717369")) {
                                seq = "";
                                piggie(true);
                        } else {
@@ -1520,9 +1465,9 @@ function pref_hotkey_handler(e) {
                }
 
                if (hotkey_prefix) {
-                       debug("KP: PREFIX=" + hotkey_prefix + " CODE=" + keycode + " CHAR=" + keychar);
+                       console.log("KP: PREFIX=" + hotkey_prefix + " CODE=" + keycode + " CHAR=" + keychar);
                } else {
-                       debug("KP: CODE=" + keycode + " CHAR=" + keychar);
+                       console.log("KP: CODE=" + keycode + " CHAR=" + keychar);
                }
 
        } catch (e) {
@@ -1672,6 +1617,42 @@ function pubRegenKey() {
        return false;
 }
 
+function opmlRegenKey() {
+
+       try {
+               var ok = confirm(__("Replace current OPML publishing address with a new one?"));
+       
+               if (ok) {
+       
+                       notify_progress("Trying to change address...", true);
+       
+                       var query = "?op=rpc&subop=regenOPMLKey";
+       
+                       new Ajax.Request("backend.php", {
+                               parameters: query,
+                               onComplete: function(transport) {
+                                               var new_link = transport.responseXML.getElementsByTagName("link")[0];
+       
+                                               var e = $('pub_opml_url');
+       
+                                               if (new_link) {
+                                                       e.href = new_link.firstChild.nodeValue;
+                                                       e.innerHTML = new_link.firstChild.nodeValue;
+       
+                                                       new Effect.Highlight(e);
+
+                                                       notify('');
+       
+                                               } else {
+                                                       notify_error("Could not change feed URL.");
+                                               }
+                               } });
+               }
+       } catch (e) {
+               exception_error("opmlRegenKey", e);
+       }
+       return false;
+}
 function validatePrefsSave() {
        try {
 
@@ -1681,7 +1662,7 @@ function validatePrefsSave() {
 
                        var query = Form.serialize("pref_prefs_form");
                        query = query + "&subop=save-config";
-                       debug(query);
+                       console.log(query);
 
                        new Ajax.Request("backend.php", {
                                parameters: query,