]> git.wh0rd.org - tt-rss.git/blobdiff - prefs.js
rework article view header
[tt-rss.git] / prefs.js
index f6917f681f39a02480cf66d6fcd02fad4a53e072..55f3abe6703326ddd1a37765495170e0b7d2918c 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -125,7 +125,7 @@ function infobox_callback() {
                        if (shadow) {
                                shadow.style.display = "block";
                        } else {
-                               box.style.display = "block";
+                               box.style.display = "block";                            
                        }
                }
        }
@@ -486,13 +486,16 @@ function removeSelectedLabels() {
 
        if (sel_rows.length > 0) {
 
-               notify("Removing selected labels...");
-
-               xmlhttp.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+
-                       param_escape(sel_rows.toString()), true);
-               xmlhttp.onreadystatechange=labellist_callback;
-               xmlhttp.send(null);
+               var ok = confirm("Remove selected labels?");
 
+               if (ok) {
+                       notify("Removing selected labels...");
+       
+                       xmlhttp.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+
+                               param_escape(sel_rows.toString()), true);
+                       xmlhttp.onreadystatechange=labellist_callback;
+                       xmlhttp.send(null);
+               }
        } else {
                notify("Please select some labels first.");
        }
@@ -509,12 +512,16 @@ function removeSelectedUsers() {
 
        if (sel_rows.length > 0) {
 
-               notify("Removing selected users...");
+               var ok = confirm("Remove selected users?");
 
-               xmlhttp.open("GET", "backend.php?op=pref-users&subop=remove&ids="+
-                       param_escape(sel_rows.toString()), true);
-               xmlhttp.onreadystatechange=userlist_callback;
-               xmlhttp.send(null);
+               if (ok) {
+                       notify("Removing selected users...");
+       
+                       xmlhttp.open("GET", "backend.php?op=pref-users&subop=remove&ids="+
+                               param_escape(sel_rows.toString()), true);
+                       xmlhttp.onreadystatechange=userlist_callback;
+                       xmlhttp.send(null);
+               }
 
        } else {
                notify("Please select some labels first.");
@@ -532,13 +539,16 @@ function removeSelectedFilters() {
 
        if (sel_rows.length > 0) {
 
-               notify("Removing selected filters...");
-
-               xmlhttp.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+
-                       param_escape(sel_rows.toString()), true);
-               xmlhttp.onreadystatechange=filterlist_callback;
-               xmlhttp.send(null);
+               var ok = confirm("Remove selected filters?");
 
+               if (ok) {
+                       notify("Removing selected filters...");
+       
+                       xmlhttp.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+
+                               param_escape(sel_rows.toString()), true);
+                       xmlhttp.onreadystatechange=filterlist_callback;
+                       xmlhttp.send(null);
+               }
        } else {
                notify("Please select some filters first.");
        }
@@ -556,12 +566,17 @@ function removeSelectedFeeds() {
 
        if (sel_rows.length > 0) {
 
-               notify("Removing selected feeds...");
+               var ok = confirm("Remove selected feeds?");
 
-               xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
-                       param_escape(sel_rows.toString()), true);
-               xmlhttp.onreadystatechange=feedlist_callback;
-               xmlhttp.send(null);
+               if (ok) {
+
+                       notify("Removing selected feeds...");
+       
+                       xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
+                               param_escape(sel_rows.toString()), true);
+                       xmlhttp.onreadystatechange=feedlist_callback;
+                       xmlhttp.send(null);
+               }
 
        } else {
 
@@ -582,12 +597,16 @@ function removeSelectedFeedCats() {
 
        if (sel_rows.length > 0) {
 
-               notify("Removing selected categories...");
+               var ok = confirm("Remove selected categories?");
 
-               xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=removeCats&ids="+
-                       param_escape(sel_rows.toString()), true);
-               xmlhttp.onreadystatechange=feedlist_callback;
-               xmlhttp.send(null);
+               if (ok) {
+                       notify("Removing selected categories...");
+       
+                       xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=removeCats&ids="+
+                               param_escape(sel_rows.toString()), true);
+                       xmlhttp.onreadystatechange=feedlist_callback;
+                       xmlhttp.send(null);
+               }
 
        } else {
 
@@ -674,7 +693,7 @@ function feedEditSave() {
 
        active_feed = false;
 
-       notify("");
+       notify("Saving feed...");
 
        xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editSave&id=" +
                feed + "&l=" + param_escape(link) + "&t=" + param_escape(title) +
@@ -685,6 +704,28 @@ function feedEditSave() {
 
 }
 
+function feedCatEditSave() {
+
+       if (!xmlhttp_ready(xmlhttp)) {
+               printLockingError();
+               return
+       }
+
+       notify("Saving category...");
+
+       var cat_title = document.getElementById("iedit_title").value;
+
+       xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=saveCat&id=" +
+               param_escape(active_feed_cat) + "&title=" + param_escape(cat_title), 
+               true);
+       xmlhttp.onreadystatechange=feedlist_callback;
+       xmlhttp.send(null);
+
+       active_feed_cat = false;
+
+}
+
+
 function labelTest() {
 
        var sqlexp = document.getElementById("iedit_expr").value;
@@ -783,7 +824,7 @@ function labelEditSave() {
                return;
        }
 
-       notify("");
+       notify("Saving label...");
 
        active_label = false;
 
@@ -820,7 +861,7 @@ function userEditSave() {
 
        active_user = false;
 
-       notify("");
+       notify("Saving user...");
 
        xmlhttp.open("GET", "backend.php?op=pref-users&subop=editSave&id=" +
                user + "&l=" + param_escape(login) + "&al=" + param_escape(level),
@@ -867,7 +908,7 @@ function filterEditSave() {
                "&m=" + param_escape(v_match) + "&fid=" + param_escape(feed_id) + 
                "&aid=" + param_escape(action_id), true);
 
-       notify("");
+       notify("Saving filter...");
 
        xmlhttp.onreadystatechange=filterlist_callback;
        xmlhttp.send(null); 
@@ -924,15 +965,18 @@ function resetSelectedUserPass() {
                return;
        }
 
-       notify("Resetting password for selected user...");
-
-       var id = rows[0];
-
-       xmlhttp.open("GET", "backend.php?op=pref-users&subop=resetPass&id=" +
-               param_escape(id), true);
-       xmlhttp.onreadystatechange=userlist_callback;
-       xmlhttp.send(null);
+       var ok = confirm("Reset password of selected user?");
 
+       if (ok) {
+               notify("Resetting password for selected user...");
+       
+               var id = rows[0];
+       
+               xmlhttp.open("GET", "backend.php?op=pref-users&subop=resetPass&id=" +
+                       param_escape(id), true);
+               xmlhttp.onreadystatechange=userlist_callback;
+               xmlhttp.send(null);
+       }
 }
 
 function selectedUserDetails() {
@@ -978,16 +1022,17 @@ function selectedFeedDetails() {
                return;
        }
 
-       if (rows.length > 1) {
-               notify("Please select one feed.");
-               return;
-       }
+//     if (rows.length > 1) {
+//             notify("Please select one feed.");
+//             return;
+//     }
 
-       var id = rows[0];
+//     var id = rows[0];
 
        notify("");
 
-       xmlhttp.open("GET", "backend.php?op=feed-details&id=" + id, true);
+       xmlhttp.open("GET", "backend.php?op=feed-details&id=" + 
+               param_escape(rows.toString()), true);
        xmlhttp.onreadystatechange=infobox_callback;
        xmlhttp.send(null);
 
@@ -1159,6 +1204,8 @@ function selectTab(id) {
 
        active_tab = id;
 
+       setCookie('ttrss_pref_acttab', active_tab);
+
 }
 
 function init() {
@@ -1172,8 +1219,10 @@ function init() {
                                "to function properly. Your browser doesn't seem to support it.";
                        return;
                }
-       
-               selectTab("genConfig");
+
+               active_tab = getCookie("ttrss_pref_acttab");
+               if (!active_tab) active_tab = "genConfig";
+               selectTab(active_tab);
        
                document.onkeydown = hotkey_handler;
                notify("");
@@ -1221,3 +1270,7 @@ function categorizeSelectedFeeds() {
        }
 
 }
+
+function validatePrefsReset() {
+       return confirm("Reset to defaults?");
+}