1 var init_params = new Array();
3 var hotkey_prefix = false;
4 var hotkey_prefix_pressed = false;
8 function notify_callback2(transport, sticky) {
9 notify_info(transport.responseText, sticky);
12 function updateFeedList() {
14 const user_search = $("feed_search");
16 if (user_search) { search = user_search.value; }
18 new Ajax.Request("backend.php", {
19 parameters: "?op=pref-feeds&search=" + param_escape(search),
20 onComplete: function(transport) {
21 dijit.byId('feedConfigTab').attr('content', transport.responseText);
22 selectTab("feedConfig", true);
27 function checkInactiveFeeds() {
28 new Ajax.Request("backend.php", {
29 parameters: "?op=pref-feeds&method=getinactivefeeds",
30 onComplete: function (transport) {
31 if (parseInt(transport.responseText) > 0) {
32 Element.show(dijit.byId("pref_feeds_inactive_btn").domNode);
38 function updateUsersList(sort_key) {
39 const user_search = $("user_search");
42 search = user_search.value;
45 const query = "?op=pref-users&sort=" +
46 param_escape(sort_key) +
47 "&search=" + param_escape(search);
49 new Ajax.Request("backend.php", {
51 onComplete: function (transport) {
52 dijit.byId('userConfigTab').attr('content', transport.responseText);
53 selectTab("userConfig", true)
60 const login = prompt(__("Please enter login:"), "");
67 alert(__("Can't create user: no login specified."));
71 notify_progress("Adding user...");
73 const query = "?op=pref-users&method=add&login=" +
76 new Ajax.Request("backend.php", {
78 onComplete: function (transport) {
79 notify_callback2(transport);
86 function editUser(id) {
88 const query = "backend.php?op=pref-users&method=edit&id=" +
91 if (dijit.byId("userEditDlg"))
92 dijit.byId("userEditDlg").destroyRecursive();
94 var dialog = new dijit.Dialog({
96 title: __("User Editor"),
97 style: "width: 600px",
98 execute: function () {
99 if (this.validate()) {
100 notify_progress("Saving data...", true);
102 const query = dojo.formToQuery("user_edit_form");
104 new Ajax.Request("backend.php", {
106 onComplete: function (transport) {
119 function editFilter(id) {
121 const query = "backend.php?op=pref-filters&method=edit&id=" + param_escape(id);
123 if (dijit.byId("feedEditDlg"))
124 dijit.byId("feedEditDlg").destroyRecursive();
126 if (dijit.byId("filterEditDlg"))
127 dijit.byId("filterEditDlg").destroyRecursive();
129 var dialog = new dijit.Dialog({
131 title: __("Edit Filter"),
132 style: "width: 600px",
135 const query = "backend.php?" + dojo.formToQuery("filter_edit_form") + "&savemode=test";
137 editFilterTest(query);
139 selectRules: function (select) {
140 $$("#filterDlg_Matches input[type=checkbox]").each(function (e) {
143 e.parentNode.addClassName("Selected");
145 e.parentNode.removeClassName("Selected");
148 selectActions: function (select) {
149 $$("#filterDlg_Actions input[type=checkbox]").each(function (e) {
153 e.parentNode.addClassName("Selected");
155 e.parentNode.removeClassName("Selected");
159 editRule: function (e) {
160 const li = e.parentNode;
161 const rule = li.getElementsByTagName("INPUT")[1].value;
162 addFilterRule(li, rule);
164 editAction: function (e) {
165 const li = e.parentNode;
166 const action = li.getElementsByTagName("INPUT")[1].value;
167 addFilterAction(li, action);
169 removeFilter: function () {
170 const msg = __("Remove filter?");
175 notify_progress("Removing filter...");
177 const id = this.attr('value').id;
179 const query = "?op=pref-filters&method=remove&ids=" +
182 new Ajax.Request("backend.php", {
184 onComplete: function (transport) {
190 addAction: function () {
193 addRule: function () {
196 deleteAction: function () {
197 $$("#filterDlg_Actions li[class*=Selected]").each(function (e) {
198 e.parentNode.removeChild(e)
201 deleteRule: function () {
202 $$("#filterDlg_Matches li[class*=Selected]").each(function (e) {
203 e.parentNode.removeChild(e)
206 execute: function () {
207 if (this.validate()) {
209 notify_progress("Saving data...", true);
211 const query = dojo.formToQuery("filter_edit_form");
215 new Ajax.Request("backend.php", {
217 onComplete: function (transport) {
231 function getSelectedLabels() {
232 const tree = dijit.byId("labelTree");
233 const items = tree.model.getCheckedItems();
236 items.each(function(item) {
237 rv.push(tree.model.store.getValue(item, 'bare_id'));
243 function getSelectedUsers() {
244 return getSelectedTableRowIds("prefUserList");
247 function getSelectedFeeds() {
248 const tree = dijit.byId("feedTree");
249 const items = tree.model.getCheckedItems();
252 items.each(function(item) {
253 if (item.id[0].match("FEED:"))
254 rv.push(tree.model.store.getValue(item, 'bare_id'));
260 function getSelectedCategories() {
261 const tree = dijit.byId("feedTree");
262 const items = tree.model.getCheckedItems();
265 items.each(function(item) {
266 if (item.id[0].match("CAT:"))
267 rv.push(tree.model.store.getValue(item, 'bare_id'));
273 function getSelectedFilters() {
274 const tree = dijit.byId("filterTree");
275 const items = tree.model.getCheckedItems();
278 items.each(function(item) {
279 rv.push(tree.model.store.getValue(item, 'bare_id'));
286 function removeSelectedLabels() {
288 const sel_rows = getSelectedLabels();
290 if (sel_rows.length > 0) {
292 const ok = confirm(__("Remove selected labels?"));
295 notify_progress("Removing selected labels...");
297 const query = "?op=pref-labels&method=remove&ids="+
298 param_escape(sel_rows.toString());
300 new Ajax.Request("backend.php", {
302 onComplete: function(transport) {
308 alert(__("No labels are selected."));
314 function removeSelectedUsers() {
316 const sel_rows = getSelectedUsers();
318 if (sel_rows.length > 0) {
320 const ok = confirm(__("Remove selected users? Neither default admin nor your account will be removed."));
323 notify_progress("Removing selected users...");
325 const query = "?op=pref-users&method=remove&ids=" +
326 param_escape(sel_rows.toString());
328 new Ajax.Request("backend.php", {
330 onComplete: function (transport) {
338 alert(__("No users are selected."));
344 function removeSelectedFilters() {
346 const sel_rows = getSelectedFilters();
348 if (sel_rows.length > 0) {
350 const ok = confirm(__("Remove selected filters?"));
353 notify_progress("Removing selected filters...");
355 const query = "?op=pref-filters&method=remove&ids=" +
356 param_escape(sel_rows.toString());
358 new Ajax.Request("backend.php", {
360 onComplete: function (transport) {
366 alert(__("No filters are selected."));
372 function removeSelectedFeeds() {
374 const sel_rows = getSelectedFeeds();
376 if (sel_rows.length > 0) {
378 const ok = confirm(__("Unsubscribe from selected feeds?"));
382 notify_progress("Unsubscribing from selected feeds...", true);
384 const query = "?op=pref-feeds&method=remove&ids=" +
385 param_escape(sel_rows.toString());
389 new Ajax.Request("backend.php", {
391 onComplete: function (transport) {
398 alert(__("No feeds are selected."));
404 function editSelectedUser() {
405 const rows = getSelectedUsers();
407 if (rows.length == 0) {
408 alert(__("No users are selected."));
412 if (rows.length > 1) {
413 alert(__("Please select only one user."));
422 function resetSelectedUserPass() {
424 const rows = getSelectedUsers();
426 if (rows.length == 0) {
427 alert(__("No users are selected."));
431 if (rows.length > 1) {
432 alert(__("Please select only one user."));
436 const ok = confirm(__("Reset password of selected user?"));
439 notify_progress("Resetting password for selected user...");
443 const query = "?op=pref-users&method=resetPass&id=" +
446 new Ajax.Request("backend.php", {
448 onComplete: function (transport) {
449 notify_info(transport.responseText, true);
456 function selectedUserDetails() {
458 const rows = getSelectedUsers();
460 if (rows.length == 0) {
461 alert(__("No users are selected."));
465 if (rows.length > 1) {
466 alert(__("Please select only one user."));
472 const query = "backend.php?op=pref-users&method=userdetails&id=" + id;
474 if (dijit.byId("userDetailsDlg"))
475 dijit.byId("userDetailsDlg").destroyRecursive();
477 var dialog = new dijit.Dialog({
478 id: "userDetailsDlg",
479 title: __("User details"),
480 style: "width: 600px",
481 execute: function () {
491 function editSelectedFilter() {
492 const rows = getSelectedFilters();
494 if (rows.length == 0) {
495 alert(__("No filters are selected."));
499 if (rows.length > 1) {
500 alert(__("Please select only one filter."));
510 function joinSelectedFilters() {
511 const rows = getSelectedFilters();
513 if (rows.length == 0) {
514 alert(__("No filters are selected."));
518 const ok = confirm(__("Combine selected filters?"));
521 notify_progress("Joining filters...");
523 const query = "?op=pref-filters&method=join&ids="+
524 param_escape(rows.toString());
528 new Ajax.Request("backend.php", {
530 onComplete: function(transport) {
536 function editSelectedFeed() {
537 const rows = getSelectedFeeds();
539 if (rows.length == 0) {
540 alert(__("No feeds are selected."));
544 if (rows.length > 1) {
545 return editSelectedFeeds();
550 editFeed(rows[0], {});
554 function editSelectedFeeds() {
555 const rows = getSelectedFeeds();
557 if (rows.length == 0) {
558 alert(__("No feeds are selected."));
562 notify_progress("Loading, please wait...");
564 const query = "backend.php?op=pref-feeds&method=editfeeds&ids=" +
565 param_escape(rows.toString());
569 if (dijit.byId("feedEditDlg"))
570 dijit.byId("feedEditDlg").destroyRecursive();
572 new Ajax.Request("backend.php", {
574 onComplete: function (transport) {
578 var dialog = new dijit.Dialog({
580 title: __("Edit Multiple Feeds"),
581 style: "width: 600px",
582 getChildByName: function (name) {
584 this.getChildren().each(
586 if (child.name == name) {
593 toggleField: function (checkbox, elem, label) {
594 this.getChildByName(elem).attr('disabled', !checkbox.checked);
597 if (checkbox.checked)
598 $(label).removeClassName('insensitive');
600 $(label).addClassName('insensitive');
603 execute: function () {
604 if (this.validate() && confirm(__("Save changes to selected feeds?"))) {
605 let query = dojo.objectToQuery(this.attr('value'));
607 /* Form.serialize ignores unchecked checkboxes */
609 if (!query.match("&private=") &&
610 this.getChildByName('private').attr('disabled') == false) {
611 query = query + "&private=false";
615 if (!query.match("&cache_images=") &&
616 this.getChildByName('cache_images').attr('disabled') == false) {
617 query = query + "&cache_images=false";
623 if (!query.match("&hide_images=") &&
624 this.getChildByName('hide_images').attr('disabled') == false) {
625 query = query + "&hide_images=false";
630 if (!query.match("&include_in_digest=") &&
631 this.getChildByName('include_in_digest').attr('disabled') == false) {
632 query = query + "&include_in_digest=false";
635 if (!query.match("&always_display_enclosures=") &&
636 this.getChildByName('always_display_enclosures').attr('disabled') == false) {
637 query = query + "&always_display_enclosures=false";
640 if (!query.match("&mark_unread_on_update=") &&
641 this.getChildByName('mark_unread_on_update').attr('disabled') == false) {
642 query = query + "&mark_unread_on_update=false";
647 notify_progress("Saving data...", true);
649 new Ajax.Request("backend.php", {
651 onComplete: function (transport) {
658 content: transport.responseText
667 function opmlImportComplete(iframe) {
668 if (!iframe.contentDocument.body.innerHTML) return false;
670 Element.show(iframe);
674 if (dijit.byId('opmlImportDlg'))
675 dijit.byId('opmlImportDlg').destroyRecursive();
677 const content = iframe.contentDocument.body.innerHTML;
679 const dialog = new dijit.Dialog({
681 title: __("OPML Import"),
682 style: "width: 600px",
683 onCancel: function () {
684 window.location.reload();
686 execute: function () {
687 window.location.reload();
695 function opmlImport() {
697 const opml_file = $("opml_file");
699 if (opml_file.value.length == 0) {
700 alert(__("Please choose an OPML file first."));
703 notify_progress("Importing, please wait...", true);
705 Element.show("upload_iframe");
712 function updateFilterList() {
713 const user_search = $("filter_search");
715 if (user_search) { search = user_search.value; }
717 new Ajax.Request("backend.php", {
718 parameters: "?op=pref-filters&search=" + param_escape(search),
719 onComplete: function(transport) {
720 dijit.byId('filterConfigTab').attr('content', transport.responseText);
725 function updateLabelList() {
726 new Ajax.Request("backend.php", {
727 parameters: "?op=pref-labels",
728 onComplete: function(transport) {
729 dijit.byId('labelConfigTab').attr('content', transport.responseText);
734 function updatePrefsList() {
735 new Ajax.Request("backend.php", {
736 parameters: "?op=pref-prefs",
737 onComplete: function(transport) {
738 dijit.byId('genConfigTab').attr('content', transport.responseText);
743 function updateSystemList() {
744 new Ajax.Request("backend.php", {
745 parameters: "?op=pref-system",
746 onComplete: function(transport) {
747 dijit.byId('systemConfigTab').attr('content', transport.responseText);
752 function selectTab(id, noupdate) {
754 notify_progress("Loading, please wait...");
756 if (id == "feedConfig") {
758 } else if (id == "filterConfig") {
760 } else if (id == "labelConfig") {
762 } else if (id == "genConfig") {
764 } else if (id == "userConfig") {
766 } else if (id == "systemConfig") {
770 const tab = dijit.byId(id + "Tab");
771 dijit.byId("pref-tabs").selectChild(tab);
776 function init_second_stage() {
777 document.onkeydown = pref_hotkey_handler;
778 loading_set_progress(50);
781 let tab = getURLParam('tab');
784 tab = dijit.byId(tab + "Tab");
785 if (tab) dijit.byId("pref-tabs").selectChild(tab);
788 const method = getURLParam('method');
790 if (method == 'editFeed') {
791 const param = getURLParam('methodparam');
793 window.setTimeout(function() { editFeed(param) }, 100);
796 setTimeout(hotkey_prefix_timeout, 5*1000);
800 window.onerror = function (message, filename, lineno, colno, error) {
801 report_error(message, filename, lineno, colno, error);
804 require(["dojo/_base/kernel",
809 "dijit/ColorPalette",
812 "dijit/form/CheckBox",
813 "dijit/form/DropDownButton",
814 "dijit/form/FilteringSelect",
815 "dijit/form/MultiSelect",
817 "dijit/form/RadioButton",
818 "dijit/form/ComboButton",
820 "dijit/form/SimpleTextarea",
821 "dijit/form/TextBox",
822 "dijit/form/ValidationTextBox",
823 "dijit/InlineEditBox",
824 "dijit/layout/AccordionContainer",
825 "dijit/layout/AccordionPane",
826 "dijit/layout/BorderContainer",
827 "dijit/layout/ContentPane",
828 "dijit/layout/TabContainer",
833 "dijit/tree/dndSource",
834 "dojo/data/ItemFileWriteStore",
835 "lib/CheckBoxStoreModel",
838 "fox/PrefFilterStore",
840 "fox/PrefFilterTree",
841 "fox/PrefLabelTree"], function (dojo, ready, parser) {
847 loading_set_progress(50);
849 const clientTzOffset = new Date().getTimezoneOffset() * 60;
851 new Ajax.Request("backend.php", {
853 op: "rpc", method: "sanityCheck",
854 clientTzOffset: clientTzOffset
856 onComplete: function (transport) {
857 backend_sanity_check_callback(transport);
868 function validatePrefsReset() {
869 const ok = confirm(__("Reset to defaults?"));
873 const query = "?op=pref-prefs&method=resetconfig";
876 new Ajax.Request("backend.php", {
878 onComplete: function(transport) {
880 notify_info(transport.responseText);
889 function pref_hotkey_handler(e) {
891 if (e.target.nodeName == "INPUT" || e.target.nodeName == "TEXTAREA") return;
894 let shift_key = false;
896 const cmdline = $('cmdline');
899 shift_key = e.shiftKey;
905 keycode = window.event.keyCode;
910 let keychar = String.fromCharCode(keycode);
912 if (keycode == 27) { // escape
913 hotkey_prefix = false;
916 if (keycode == 16) return; // ignore lone shift
917 if (keycode == 17) return; // ignore lone ctrl
919 if (!shift_key) keychar = keychar.toLowerCase();
921 var hotkeys = getInitParam("hotkeys");
923 if (!hotkey_prefix && hotkeys[0].indexOf(keychar) != -1) {
925 const date = new Date();
926 const ts = Math.round(date.getTime() / 1000);
928 hotkey_prefix = keychar;
929 hotkey_prefix_pressed = ts;
931 cmdline.innerHTML = keychar;
932 Element.show(cmdline);
937 Element.hide(cmdline);
939 let hotkey = keychar.search(/[a-zA-Z0-9]/) != -1 ? keychar : "(" + keycode + ")";
940 hotkey = hotkey_prefix ? hotkey_prefix + " " + hotkey : hotkey;
941 hotkey_prefix = false;
943 let hotkey_action = false;
944 var hotkeys = getInitParam("hotkeys");
946 for (const sequence in hotkeys[1]) {
947 if (sequence == hotkey) {
948 hotkey_action = hotkeys[1][sequence];
953 switch (hotkey_action) {
954 case "feed_subscribe":
960 case "create_filter":
964 //helpDialog("prefs");
967 console.log("unhandled action: " + hotkey_action + "; hotkey: " + hotkey);
971 function removeCategory(id, item) {
973 const ok = confirm(__("Remove category %s? Any nested feeds would be placed into Uncategorized.").replace("%s", item.name));
976 const query = "?op=pref-feeds&method=removeCat&ids=" +
979 notify_progress("Removing category...");
981 new Ajax.Request("backend.php", {
983 onComplete: function (transport) {
991 function removeSelectedCategories() {
993 const sel_rows = getSelectedCategories();
995 if (sel_rows.length > 0) {
997 const ok = confirm(__("Remove selected categories?"));
1000 notify_progress("Removing selected categories...");
1002 const query = "?op=pref-feeds&method=removeCat&ids="+
1003 param_escape(sel_rows.toString());
1005 new Ajax.Request("backend.php", {
1007 onComplete: function(transport) {
1013 alert(__("No categories are selected."));
1019 function createCategory() {
1020 const title = prompt(__("Category title:"));
1024 notify_progress("Creating category...");
1026 const query = "?op=pref-feeds&method=addCat&cat=" +
1027 param_escape(title);
1029 new Ajax.Request("backend.php", {
1031 onComplete: function (transport) {
1039 function showInactiveFeeds() {
1040 const query = "backend.php?op=pref-feeds&method=inactiveFeeds";
1042 if (dijit.byId("inactiveFeedsDlg"))
1043 dijit.byId("inactiveFeedsDlg").destroyRecursive();
1045 var dialog = new dijit.Dialog({
1046 id: "inactiveFeedsDlg",
1047 title: __("Feeds without recent updates"),
1048 style: "width: 600px",
1049 getSelectedFeeds: function () {
1050 return getSelectedTableRowIds("prefInactiveFeedList");
1052 removeSelected: function () {
1053 const sel_rows = this.getSelectedFeeds();
1055 console.log(sel_rows);
1057 if (sel_rows.length > 0) {
1058 const ok = confirm(__("Remove selected feeds?"));
1061 notify_progress("Removing selected feeds...", true);
1063 const query = "?op=pref-feeds&method=remove&ids=" +
1064 param_escape(sel_rows.toString());
1066 new Ajax.Request("backend.php", {
1068 onComplete: function (transport) {
1077 alert(__("No feeds are selected."));
1080 execute: function () {
1081 if (this.validate()) {
1090 function opmlRegenKey() {
1091 const ok = confirm(__("Replace current OPML publishing address with a new one?"));
1095 notify_progress("Trying to change address...", true);
1097 const query = "?op=pref-feeds&method=regenOPMLKey";
1099 new Ajax.Request("backend.php", {
1101 onComplete: function (transport) {
1102 const reply = JSON.parse(transport.responseText);
1104 const new_link = reply.link;
1106 const e = $('pub_opml_url');
1110 e.innerHTML = new_link;
1112 new Effect.Highlight(e);
1117 notify_error("Could not change feed URL.");
1125 function labelColorReset() {
1126 const labels = getSelectedLabels();
1128 if (labels.length > 0) {
1129 const ok = confirm(__("Reset selected labels to default colors?"));
1132 const query = "?op=pref-labels&method=colorreset&ids=" +
1133 param_escape(labels.toString());
1135 new Ajax.Request("backend.php", {
1137 onComplete: function (transport) {
1144 alert(__("No labels are selected."));
1148 function inPreferences() {
1152 function editProfiles() {
1154 if (dijit.byId("profileEditDlg"))
1155 dijit.byId("profileEditDlg").destroyRecursive();
1157 const query = "backend.php?op=pref-prefs&method=editPrefProfiles";
1159 var dialog = new dijit.Dialog({
1160 id: "profileEditDlg",
1161 title: __("Settings Profiles"),
1162 style: "width: 600px",
1163 getSelectedProfiles: function () {
1164 return getSelectedTableRowIds("prefFeedProfileList");
1166 removeSelected: function () {
1167 const sel_rows = this.getSelectedProfiles();
1169 if (sel_rows.length > 0) {
1170 const ok = confirm(__("Remove selected profiles? Active and default profiles will not be removed."));
1173 notify_progress("Removing selected profiles...", true);
1175 const query = "?op=rpc&method=remprofiles&ids=" +
1176 param_escape(sel_rows.toString());
1178 new Ajax.Request("backend.php", {
1180 onComplete: function (transport) {
1189 alert(__("No profiles are selected."));
1192 activateProfile: function () {
1193 const sel_rows = this.getSelectedProfiles();
1195 if (sel_rows.length == 1) {
1197 const ok = confirm(__("Activate selected profile?"));
1200 notify_progress("Loading, please wait...");
1202 const query = "?op=rpc&method=setprofile&id=" +
1203 param_escape(sel_rows.toString());
1205 new Ajax.Request("backend.php", {
1207 onComplete: function (transport) {
1208 window.location.reload();
1214 alert(__("Please choose a profile to activate."));
1217 addProfile: function () {
1218 if (this.validate()) {
1219 notify_progress("Creating profile...", true);
1221 const query = "?op=rpc&method=addprofile&title=" +
1222 param_escape(dialog.attr('value').newprofile);
1224 new Ajax.Request("backend.php", {
1226 onComplete: function (transport) {
1234 execute: function () {
1235 if (this.validate()) {
1244 function activatePrefProfile() {
1246 const sel_rows = getSelectedFeedCats();
1248 if (sel_rows.length == 1) {
1250 const ok = confirm(__("Activate selected profile?"));
1253 notify_progress("Loading, please wait...");
1255 const query = "?op=rpc&method=setprofile&id="+
1256 param_escape(sel_rows.toString());
1258 new Ajax.Request("backend.php", {
1260 onComplete: function(transport) {
1261 window.location.reload();
1266 alert(__("Please choose a profile to activate."));
1272 function clearFeedAccessKeys() {
1274 const ok = confirm(__("This will invalidate all previously generated feed URLs. Continue?"));
1277 notify_progress("Clearing URLs...");
1279 const query = "?op=pref-feeds&method=clearKeys";
1281 new Ajax.Request("backend.php", {
1283 onComplete: function(transport) {
1284 notify_info("Generated URLs cleared.");
1291 function resetFilterOrder() {
1292 notify_progress("Loading, please wait...");
1294 new Ajax.Request("backend.php", {
1295 parameters: "?op=pref-filters&method=filtersortreset",
1296 onComplete: function (transport) {
1303 function resetFeedOrder() {
1304 notify_progress("Loading, please wait...");
1306 new Ajax.Request("backend.php", {
1307 parameters: "?op=pref-feeds&method=feedsortreset",
1308 onComplete: function (transport) {
1314 function resetCatOrder() {
1315 notify_progress("Loading, please wait...");
1317 new Ajax.Request("backend.php", {
1318 parameters: "?op=pref-feeds&method=catsortreset",
1319 onComplete: function (transport) {
1325 function editCat(id, item) {
1326 const new_name = prompt(__('Rename category to:'), item.name);
1328 if (new_name && new_name != item.name) {
1330 notify_progress("Loading, please wait...");
1332 new Ajax.Request("backend.php", {
1335 method: 'renamecat',
1339 onComplete: function (transport) {
1346 function editLabel(id) {
1347 const query = "backend.php?op=pref-labels&method=edit&id=" +
1350 if (dijit.byId("labelEditDlg"))
1351 dijit.byId("labelEditDlg").destroyRecursive();
1353 const dialog = new dijit.Dialog({
1355 title: __("Label Editor"),
1356 style: "width: 600px",
1357 setLabelColor: function (id, fg, bg) {
1372 const query = "?op=pref-labels&method=colorset&kind=" + kind +
1373 "&ids=" + param_escape(id) + "&fg=" + param_escape(fg) +
1374 "&bg=" + param_escape(bg) + "&color=" + param_escape(color);
1376 // console.log(query);
1378 const e = $("LICID-" + id);
1381 if (fg) e.style.color = fg;
1382 if (bg) e.style.backgroundColor = bg;
1385 new Ajax.Request("backend.php", {parameters: query});
1389 execute: function () {
1390 if (this.validate()) {
1391 const caption = this.attr('value').caption;
1392 const fg_color = this.attr('value').fg_color;
1393 const bg_color = this.attr('value').bg_color;
1394 const query = dojo.objectToQuery(this.attr('value'));
1396 dijit.byId('labelTree').setNameById(id, caption);
1397 this.setLabelColor(id, fg_color, bg_color);
1400 new Ajax.Request("backend.php", {
1402 onComplete: function (transport) {
1415 function customizeCSS() {
1416 const query = "backend.php?op=pref-prefs&method=customizeCSS";
1418 if (dijit.byId("cssEditDlg"))
1419 dijit.byId("cssEditDlg").destroyRecursive();
1421 const dialog = new dijit.Dialog({
1423 title: __("Customize stylesheet"),
1424 style: "width: 600px",
1425 execute: function () {
1426 notify_progress('Saving data...', true);
1427 new Ajax.Request("backend.php", {
1428 parameters: dojo.objectToQuery(this.attr('value')),
1429 onComplete: function (transport) {
1431 window.location.reload();
1442 function insertSSLserial(value) {
1443 dijit.byId("SSL_CERT_SERIAL").attr('value', value);
1446 function gotoExportOpml(filename, settings) {
1447 const tmp = settings ? 1 : 0;
1448 document.location.href = "backend.php?op=opml&method=export&filename=" + filename + "&settings=" + tmp;
1452 function batchSubscribe() {
1453 const query = "backend.php?op=pref-feeds&method=batchSubscribe";
1455 // overlapping widgets
1456 if (dijit.byId("batchSubDlg")) dijit.byId("batchSubDlg").destroyRecursive();
1457 if (dijit.byId("feedAddDlg")) dijit.byId("feedAddDlg").destroyRecursive();
1459 var dialog = new dijit.Dialog({
1461 title: __("Batch subscribe"),
1462 style: "width: 600px",
1463 execute: function () {
1464 if (this.validate()) {
1465 console.log(dojo.objectToQuery(this.attr('value')));
1467 notify_progress(__("Subscribing to feeds..."), true);
1469 new Ajax.Request("backend.php", {
1470 parameters: dojo.objectToQuery(this.attr('value')),
1471 onComplete: function (transport) {
1485 function clearPluginData(name) {
1486 if (confirm(__("Clear stored data for this plugin?"))) {
1487 notify_progress("Loading, please wait...");
1489 new Ajax.Request("backend.php", {
1490 parameters: "?op=pref-prefs&method=clearplugindata&name=" + param_escape(name),
1491 onComplete: function(transport) {
1498 function clearSqlLog() {
1500 if (confirm(__("Clear all messages in the error log?"))) {
1502 notify_progress("Loading, please wait...");
1503 const query = "?op=pref-system&method=clearLog";
1505 new Ajax.Request("backend.php", {
1507 onComplete: function(transport) {
1514 function updateSelectedPrompt() {
1515 // no-op shim for toggleSelectedRow()