]>
git.wh0rd.org - tt-rss.git/blob - js/prefs.js
792ad6b3d4aa91b86e279c3df4aae4167398b88f
5 let hotkey_prefix
= false;
6 let hotkey_prefix_pressed
= false;
10 function notify_callback2(transport
, sticky
) {
11 notify_info(transport
.responseText
, sticky
);
14 function updateFeedList() {
16 const user_search
= $("feed_search");
18 if (user_search
) { search
= user_search
.value
; }
20 new Ajax
.Request("backend.php", {
21 parameters
: "?op=pref-feeds&search=" + param_escape(search
),
22 onComplete: function(transport
) {
23 dijit
.byId('feedConfigTab').attr('content', transport
.responseText
);
24 selectTab("feedConfig", true);
29 function checkInactiveFeeds() {
30 new Ajax
.Request("backend.php", {
31 parameters
: "?op=pref-feeds&method=getinactivefeeds",
32 onComplete: function (transport
) {
33 if (parseInt(transport
.responseText
) > 0) {
34 Element
.show(dijit
.byId("pref_feeds_inactive_btn").domNode
);
40 function updateUsersList(sort_key
) {
41 const user_search
= $("user_search");
44 search
= user_search
.value
;
47 const query
= "?op=pref-users&sort=" +
48 param_escape(sort_key
) +
49 "&search=" + param_escape(search
);
51 new Ajax
.Request("backend.php", {
53 onComplete: function (transport
) {
54 dijit
.byId('userConfigTab').attr('content', transport
.responseText
);
55 selectTab("userConfig", true)
62 const login
= prompt(__("Please enter login:"), "");
69 alert(__("Can't create user: no login specified."));
73 notify_progress("Adding user...");
75 const query
= "?op=pref-users&method=add&login=" +
78 new Ajax
.Request("backend.php", {
80 onComplete: function (transport
) {
81 notify_callback2(transport
);
88 function editUser(id
) {
90 const query
= "backend.php?op=pref-users&method=edit&id=" +
93 if (dijit
.byId("userEditDlg"))
94 dijit
.byId("userEditDlg").destroyRecursive();
96 var dialog
= new dijit
.Dialog({
98 title
: __("User Editor"),
99 style
: "width: 600px",
100 execute: function () {
101 if (this.validate()) {
102 notify_progress("Saving data...", true);
104 const query
= dojo
.formToQuery("user_edit_form");
106 new Ajax
.Request("backend.php", {
108 onComplete: function (transport
) {
121 function editFilter(id
) {
123 const query
= "backend.php?op=pref-filters&method=edit&id=" + param_escape(id
);
125 if (dijit
.byId("feedEditDlg"))
126 dijit
.byId("feedEditDlg").destroyRecursive();
128 if (dijit
.byId("filterEditDlg"))
129 dijit
.byId("filterEditDlg").destroyRecursive();
131 var dialog
= new dijit
.Dialog({
133 title
: __("Edit Filter"),
134 style
: "width: 600px",
137 const query
= "backend.php?" + dojo
.formToQuery("filter_edit_form") + "&savemode=test";
139 editFilterTest(query
);
141 selectRules: function (select
) {
142 $$("#filterDlg_Matches input[type=checkbox]").each(function (e
) {
145 e
.parentNode
.addClassName("Selected");
147 e
.parentNode
.removeClassName("Selected");
150 selectActions: function (select
) {
151 $$("#filterDlg_Actions input[type=checkbox]").each(function (e
) {
155 e
.parentNode
.addClassName("Selected");
157 e
.parentNode
.removeClassName("Selected");
161 editRule: function (e
) {
162 const li
= e
.parentNode
;
163 const rule
= li
.getElementsByTagName("INPUT")[1].value
;
164 addFilterRule(li
, rule
);
166 editAction: function (e
) {
167 const li
= e
.parentNode
;
168 const action
= li
.getElementsByTagName("INPUT")[1].value
;
169 addFilterAction(li
, action
);
171 removeFilter: function () {
172 const msg
= __("Remove filter?");
177 notify_progress("Removing filter...");
179 const id
= this.attr('value').id
;
181 const query
= "?op=pref-filters&method=remove&ids=" +
184 new Ajax
.Request("backend.php", {
186 onComplete: function (transport
) {
192 addAction: function () {
195 addRule: function () {
198 deleteAction: function () {
199 $$("#filterDlg_Actions li[class*=Selected]").each(function (e
) {
200 e
.parentNode
.removeChild(e
)
203 deleteRule: function () {
204 $$("#filterDlg_Matches li[class*=Selected]").each(function (e
) {
205 e
.parentNode
.removeChild(e
)
208 execute: function () {
209 if (this.validate()) {
211 notify_progress("Saving data...", true);
213 const query
= dojo
.formToQuery("filter_edit_form");
217 new Ajax
.Request("backend.php", {
219 onComplete: function (transport
) {
233 function getSelectedLabels() {
234 const tree
= dijit
.byId("labelTree");
235 const items
= tree
.model
.getCheckedItems();
238 items
.each(function(item
) {
239 rv
.push(tree
.model
.store
.getValue(item
, 'bare_id'));
245 function getSelectedUsers() {
246 return getSelectedTableRowIds("prefUserList");
249 function getSelectedFeeds() {
250 const tree
= dijit
.byId("feedTree");
251 const items
= tree
.model
.getCheckedItems();
254 items
.each(function(item
) {
255 if (item
.id
[0].match("FEED:"))
256 rv
.push(tree
.model
.store
.getValue(item
, 'bare_id'));
262 function getSelectedCategories() {
263 const tree
= dijit
.byId("feedTree");
264 const items
= tree
.model
.getCheckedItems();
267 items
.each(function(item
) {
268 if (item
.id
[0].match("CAT:"))
269 rv
.push(tree
.model
.store
.getValue(item
, 'bare_id'));
275 function getSelectedFilters() {
276 const tree
= dijit
.byId("filterTree");
277 const items
= tree
.model
.getCheckedItems();
280 items
.each(function(item
) {
281 rv
.push(tree
.model
.store
.getValue(item
, 'bare_id'));
288 function removeSelectedLabels() {
290 const sel_rows
= getSelectedLabels();
292 if (sel_rows
.length
> 0) {
294 const ok
= confirm(__("Remove selected labels?"));
297 notify_progress("Removing selected labels...");
299 const query
= "?op=pref-labels&method=remove&ids="+
300 param_escape(sel_rows
.toString());
302 new Ajax
.Request("backend.php", {
304 onComplete: function(transport
) {
310 alert(__("No labels are selected."));
316 function removeSelectedUsers() {
318 const sel_rows
= getSelectedUsers();
320 if (sel_rows
.length
> 0) {
322 const ok
= confirm(__("Remove selected users? Neither default admin nor your account will be removed."));
325 notify_progress("Removing selected users...");
327 const query
= "?op=pref-users&method=remove&ids=" +
328 param_escape(sel_rows
.toString());
330 new Ajax
.Request("backend.php", {
332 onComplete: function (transport
) {
340 alert(__("No users are selected."));
346 function removeSelectedFilters() {
348 const sel_rows
= getSelectedFilters();
350 if (sel_rows
.length
> 0) {
352 const ok
= confirm(__("Remove selected filters?"));
355 notify_progress("Removing selected filters...");
357 const query
= "?op=pref-filters&method=remove&ids=" +
358 param_escape(sel_rows
.toString());
360 new Ajax
.Request("backend.php", {
362 onComplete: function (transport
) {
368 alert(__("No filters are selected."));
374 function removeSelectedFeeds() {
376 const sel_rows
= getSelectedFeeds();
378 if (sel_rows
.length
> 0) {
380 const ok
= confirm(__("Unsubscribe from selected feeds?"));
384 notify_progress("Unsubscribing from selected feeds...", true);
386 const query
= "?op=pref-feeds&method=remove&ids=" +
387 param_escape(sel_rows
.toString());
391 new Ajax
.Request("backend.php", {
393 onComplete: function (transport
) {
400 alert(__("No feeds are selected."));
406 function editSelectedUser() {
407 const rows
= getSelectedUsers();
409 if (rows
.length
== 0) {
410 alert(__("No users are selected."));
414 if (rows
.length
> 1) {
415 alert(__("Please select only one user."));
424 function resetSelectedUserPass() {
426 const rows
= getSelectedUsers();
428 if (rows
.length
== 0) {
429 alert(__("No users are selected."));
433 if (rows
.length
> 1) {
434 alert(__("Please select only one user."));
438 const ok
= confirm(__("Reset password of selected user?"));
441 notify_progress("Resetting password for selected user...");
445 const query
= "?op=pref-users&method=resetPass&id=" +
448 new Ajax
.Request("backend.php", {
450 onComplete: function (transport
) {
451 notify_info(transport
.responseText
, true);
458 function selectedUserDetails() {
460 const rows
= getSelectedUsers();
462 if (rows
.length
== 0) {
463 alert(__("No users are selected."));
467 if (rows
.length
> 1) {
468 alert(__("Please select only one user."));
474 const query
= "backend.php?op=pref-users&method=userdetails&id=" + id
;
476 if (dijit
.byId("userDetailsDlg"))
477 dijit
.byId("userDetailsDlg").destroyRecursive();
479 var dialog
= new dijit
.Dialog({
480 id
: "userDetailsDlg",
481 title
: __("User details"),
482 style
: "width: 600px",
483 execute: function () {
493 function editSelectedFilter() {
494 const rows
= getSelectedFilters();
496 if (rows
.length
== 0) {
497 alert(__("No filters are selected."));
501 if (rows
.length
> 1) {
502 alert(__("Please select only one filter."));
512 function joinSelectedFilters() {
513 const rows
= getSelectedFilters();
515 if (rows
.length
== 0) {
516 alert(__("No filters are selected."));
520 const ok
= confirm(__("Combine selected filters?"));
523 notify_progress("Joining filters...");
525 const query
= "?op=pref-filters&method=join&ids="+
526 param_escape(rows
.toString());
530 new Ajax
.Request("backend.php", {
532 onComplete: function(transport
) {
538 function editSelectedFeed() {
539 const rows
= getSelectedFeeds();
541 if (rows
.length
== 0) {
542 alert(__("No feeds are selected."));
546 if (rows
.length
> 1) {
547 return editSelectedFeeds();
552 editFeed(rows
[0], {});
556 function editSelectedFeeds() {
557 const rows
= getSelectedFeeds();
559 if (rows
.length
== 0) {
560 alert(__("No feeds are selected."));
564 notify_progress("Loading, please wait...");
566 const query
= "backend.php?op=pref-feeds&method=editfeeds&ids=" +
567 param_escape(rows
.toString());
571 if (dijit
.byId("feedEditDlg"))
572 dijit
.byId("feedEditDlg").destroyRecursive();
574 new Ajax
.Request("backend.php", {
576 onComplete: function (transport
) {
580 var dialog
= new dijit
.Dialog({
582 title
: __("Edit Multiple Feeds"),
583 style
: "width: 600px",
584 getChildByName: function (name
) {
586 this.getChildren().each(
588 if (child
.name
== name
) {
595 toggleField: function (checkbox
, elem
, label
) {
596 this.getChildByName(elem
).attr('disabled', !checkbox
.checked
);
599 if (checkbox
.checked
)
600 $(label
).removeClassName('insensitive');
602 $(label
).addClassName('insensitive');
605 execute: function () {
606 if (this.validate() && confirm(__("Save changes to selected feeds?"))) {
607 let query
= dojo
.objectToQuery(this.attr('value'));
609 /* Form.serialize ignores unchecked checkboxes */
611 if (!query
.match("&private=") &&
612 this.getChildByName('private').attr('disabled') == false) {
613 query
= query
+ "&private=false";
617 if (!query
.match("&cache_images=") &&
618 this.getChildByName('cache_images').attr('disabled') == false) {
619 query
= query
+ "&cache_images=false";
625 if (!query
.match("&hide_images=") &&
626 this.getChildByName('hide_images').attr('disabled') == false) {
627 query
= query
+ "&hide_images=false";
632 if (!query
.match("&include_in_digest=") &&
633 this.getChildByName('include_in_digest').attr('disabled') == false) {
634 query
= query
+ "&include_in_digest=false";
637 if (!query
.match("&always_display_enclosures=") &&
638 this.getChildByName('always_display_enclosures').attr('disabled') == false) {
639 query
= query
+ "&always_display_enclosures=false";
642 if (!query
.match("&mark_unread_on_update=") &&
643 this.getChildByName('mark_unread_on_update').attr('disabled') == false) {
644 query
= query
+ "&mark_unread_on_update=false";
649 notify_progress("Saving data...", true);
651 new Ajax
.Request("backend.php", {
653 onComplete: function (transport
) {
660 content
: transport
.responseText
669 function opmlImportComplete(iframe
) {
670 if (!iframe
.contentDocument
.body
.innerHTML
) return false;
672 Element
.show(iframe
);
676 if (dijit
.byId('opmlImportDlg'))
677 dijit
.byId('opmlImportDlg').destroyRecursive();
679 const content
= iframe
.contentDocument
.body
.innerHTML
;
681 const dialog
= new dijit
.Dialog({
683 title
: __("OPML Import"),
684 style
: "width: 600px",
685 onCancel: function () {
686 window
.location
.reload();
688 execute: function () {
689 window
.location
.reload();
697 function opmlImport() {
699 const opml_file
= $("opml_file");
701 if (opml_file
.value
.length
== 0) {
702 alert(__("Please choose an OPML file first."));
705 notify_progress("Importing, please wait...", true);
707 Element
.show("upload_iframe");
714 function updateFilterList() {
715 const user_search
= $("filter_search");
717 if (user_search
) { search
= user_search
.value
; }
719 new Ajax
.Request("backend.php", {
720 parameters
: "?op=pref-filters&search=" + param_escape(search
),
721 onComplete: function(transport
) {
722 dijit
.byId('filterConfigTab').attr('content', transport
.responseText
);
727 function updateLabelList() {
728 new Ajax
.Request("backend.php", {
729 parameters
: "?op=pref-labels",
730 onComplete: function(transport
) {
731 dijit
.byId('labelConfigTab').attr('content', transport
.responseText
);
736 function updatePrefsList() {
737 new Ajax
.Request("backend.php", {
738 parameters
: "?op=pref-prefs",
739 onComplete: function(transport
) {
740 dijit
.byId('genConfigTab').attr('content', transport
.responseText
);
745 function updateSystemList() {
746 new Ajax
.Request("backend.php", {
747 parameters
: "?op=pref-system",
748 onComplete: function(transport
) {
749 dijit
.byId('systemConfigTab').attr('content', transport
.responseText
);
754 function selectTab(id
, noupdate
) {
756 notify_progress("Loading, please wait...");
758 if (id
== "feedConfig") {
760 } else if (id
== "filterConfig") {
762 } else if (id
== "labelConfig") {
764 } else if (id
== "genConfig") {
766 } else if (id
== "userConfig") {
768 } else if (id
== "systemConfig") {
772 const tab
= dijit
.byId(id
+ "Tab");
773 dijit
.byId("pref-tabs").selectChild(tab
);
778 function init_second_stage() {
779 document
.onkeydown
= pref_hotkey_handler
;
780 loading_set_progress(50);
783 let tab
= getURLParam('tab');
786 tab
= dijit
.byId(tab
+ "Tab");
787 if (tab
) dijit
.byId("pref-tabs").selectChild(tab
);
790 const method
= getURLParam('method');
792 if (method
== 'editFeed') {
793 const param
= getURLParam('methodparam');
795 window
.setTimeout(function() { editFeed(param
) }, 100);
798 setTimeout(hotkey_prefix_timeout
, 5*1000);
802 window
.onerror = function (message
, filename
, lineno
, colno
, error
) {
803 report_error(message
, filename
, lineno
, colno
, error
);
806 require(["dojo/_base/kernel",
811 "dijit/ColorPalette",
814 "dijit/form/CheckBox",
815 "dijit/form/DropDownButton",
816 "dijit/form/FilteringSelect",
817 "dijit/form/MultiSelect",
819 "dijit/form/RadioButton",
820 "dijit/form/ComboButton",
822 "dijit/form/SimpleTextarea",
823 "dijit/form/TextBox",
824 "dijit/form/ValidationTextBox",
825 "dijit/InlineEditBox",
826 "dijit/layout/AccordionContainer",
827 "dijit/layout/AccordionPane",
828 "dijit/layout/BorderContainer",
829 "dijit/layout/ContentPane",
830 "dijit/layout/TabContainer",
835 "dijit/tree/dndSource",
836 "dojo/data/ItemFileWriteStore",
837 "lib/CheckBoxStoreModel",
840 "fox/PrefFilterStore",
842 "fox/PrefFilterTree",
843 "fox/PrefLabelTree"], function (dojo
, ready
, parser
) {
849 loading_set_progress(50);
851 const clientTzOffset
= new Date().getTimezoneOffset() * 60;
853 new Ajax
.Request("backend.php", {
855 op
: "rpc", method
: "sanityCheck",
856 clientTzOffset
: clientTzOffset
858 onComplete: function (transport
) {
859 backend_sanity_check_callback(transport
);
870 function validatePrefsReset() {
871 const ok
= confirm(__("Reset to defaults?"));
875 const query
= "?op=pref-prefs&method=resetconfig";
878 new Ajax
.Request("backend.php", {
880 onComplete: function(transport
) {
882 notify_info(transport
.responseText
);
891 function pref_hotkey_handler(e
) {
893 if (e
.target
.nodeName
== "INPUT" || e
.target
.nodeName
== "TEXTAREA") return;
896 let shift_key
= false;
898 const cmdline
= $('cmdline');
901 shift_key
= e
.shiftKey
;
907 keycode
= window
.event
.keyCode
;
912 let keychar
= String
.fromCharCode(keycode
);
914 if (keycode
== 27) { // escape
915 hotkey_prefix
= false;
918 if (keycode
== 16) return; // ignore lone shift
919 if (keycode
== 17) return; // ignore lone ctrl
921 if (!shift_key
) keychar
= keychar
.toLowerCase();
923 var hotkeys
= getInitParam("hotkeys");
925 if (!hotkey_prefix
&& hotkeys
[0].indexOf(keychar
) != -1) {
927 const date
= new Date();
928 const ts
= Math
.round(date
.getTime() / 1000);
930 hotkey_prefix
= keychar
;
931 hotkey_prefix_pressed
= ts
;
933 cmdline
.innerHTML
= keychar
;
934 Element
.show(cmdline
);
939 Element
.hide(cmdline
);
941 let hotkey
= keychar
.search(/[a-zA-Z0-9]/) != -1 ? keychar
: "(" + keycode
+ ")";
942 hotkey
= hotkey_prefix
? hotkey_prefix
+ " " + hotkey
: hotkey
;
943 hotkey_prefix
= false;
945 let hotkey_action
= false;
946 var hotkeys
= getInitParam("hotkeys");
948 for (const sequence
in hotkeys
[1]) {
949 if (sequence
== hotkey
) {
950 hotkey_action
= hotkeys
[1][sequence
];
955 switch (hotkey_action
) {
956 case "feed_subscribe":
962 case "create_filter":
966 //helpDialog("prefs");
969 console
.log("unhandled action: " + hotkey_action
+ "; hotkey: " + hotkey
);
973 function removeCategory(id
, item
) {
975 const ok
= confirm(__("Remove category %s? Any nested feeds would be placed into Uncategorized.").replace("%s", item
.name
));
978 const query
= "?op=pref-feeds&method=removeCat&ids=" +
981 notify_progress("Removing category...");
983 new Ajax
.Request("backend.php", {
985 onComplete: function (transport
) {
993 function removeSelectedCategories() {
995 const sel_rows
= getSelectedCategories();
997 if (sel_rows
.length
> 0) {
999 const ok
= confirm(__("Remove selected categories?"));
1002 notify_progress("Removing selected categories...");
1004 const query
= "?op=pref-feeds&method=removeCat&ids="+
1005 param_escape(sel_rows
.toString());
1007 new Ajax
.Request("backend.php", {
1009 onComplete: function(transport
) {
1015 alert(__("No categories are selected."));
1021 function createCategory() {
1022 const title
= prompt(__("Category title:"));
1026 notify_progress("Creating category...");
1028 const query
= "?op=pref-feeds&method=addCat&cat=" +
1029 param_escape(title
);
1031 new Ajax
.Request("backend.php", {
1033 onComplete: function (transport
) {
1041 function showInactiveFeeds() {
1042 const query
= "backend.php?op=pref-feeds&method=inactiveFeeds";
1044 if (dijit
.byId("inactiveFeedsDlg"))
1045 dijit
.byId("inactiveFeedsDlg").destroyRecursive();
1047 var dialog
= new dijit
.Dialog({
1048 id
: "inactiveFeedsDlg",
1049 title
: __("Feeds without recent updates"),
1050 style
: "width: 600px",
1051 getSelectedFeeds: function () {
1052 return getSelectedTableRowIds("prefInactiveFeedList");
1054 removeSelected: function () {
1055 const sel_rows
= this.getSelectedFeeds();
1057 console
.log(sel_rows
);
1059 if (sel_rows
.length
> 0) {
1060 const ok
= confirm(__("Remove selected feeds?"));
1063 notify_progress("Removing selected feeds...", true);
1065 const query
= "?op=pref-feeds&method=remove&ids=" +
1066 param_escape(sel_rows
.toString());
1068 new Ajax
.Request("backend.php", {
1070 onComplete: function (transport
) {
1079 alert(__("No feeds are selected."));
1082 execute: function () {
1083 if (this.validate()) {
1092 function opmlRegenKey() {
1093 const ok
= confirm(__("Replace current OPML publishing address with a new one?"));
1097 notify_progress("Trying to change address...", true);
1099 const query
= "?op=pref-feeds&method=regenOPMLKey";
1101 new Ajax
.Request("backend.php", {
1103 onComplete: function (transport
) {
1104 const reply
= JSON
.parse(transport
.responseText
);
1106 const new_link
= reply
.link
;
1108 const e
= $('pub_opml_url');
1112 e
.innerHTML
= new_link
;
1114 new Effect
.Highlight(e
);
1119 notify_error("Could not change feed URL.");
1127 function labelColorReset() {
1128 const labels
= getSelectedLabels();
1130 if (labels
.length
> 0) {
1131 const ok
= confirm(__("Reset selected labels to default colors?"));
1134 const query
= "?op=pref-labels&method=colorreset&ids=" +
1135 param_escape(labels
.toString());
1137 new Ajax
.Request("backend.php", {
1139 onComplete: function (transport
) {
1146 alert(__("No labels are selected."));
1150 function inPreferences() {
1154 function editProfiles() {
1156 if (dijit
.byId("profileEditDlg"))
1157 dijit
.byId("profileEditDlg").destroyRecursive();
1159 const query
= "backend.php?op=pref-prefs&method=editPrefProfiles";
1161 var dialog
= new dijit
.Dialog({
1162 id
: "profileEditDlg",
1163 title
: __("Settings Profiles"),
1164 style
: "width: 600px",
1165 getSelectedProfiles: function () {
1166 return getSelectedTableRowIds("prefFeedProfileList");
1168 removeSelected: function () {
1169 const sel_rows
= this.getSelectedProfiles();
1171 if (sel_rows
.length
> 0) {
1172 const ok
= confirm(__("Remove selected profiles? Active and default profiles will not be removed."));
1175 notify_progress("Removing selected profiles...", true);
1177 const query
= "?op=rpc&method=remprofiles&ids=" +
1178 param_escape(sel_rows
.toString());
1180 new Ajax
.Request("backend.php", {
1182 onComplete: function (transport
) {
1191 alert(__("No profiles are selected."));
1194 activateProfile: function () {
1195 const sel_rows
= this.getSelectedProfiles();
1197 if (sel_rows
.length
== 1) {
1199 const ok
= confirm(__("Activate selected profile?"));
1202 notify_progress("Loading, please wait...");
1204 const query
= "?op=rpc&method=setprofile&id=" +
1205 param_escape(sel_rows
.toString());
1207 new Ajax
.Request("backend.php", {
1209 onComplete: function (transport
) {
1210 window
.location
.reload();
1216 alert(__("Please choose a profile to activate."));
1219 addProfile: function () {
1220 if (this.validate()) {
1221 notify_progress("Creating profile...", true);
1223 const query
= "?op=rpc&method=addprofile&title=" +
1224 param_escape(dialog
.attr('value').newprofile
);
1226 new Ajax
.Request("backend.php", {
1228 onComplete: function (transport
) {
1236 execute: function () {
1237 if (this.validate()) {
1246 function activatePrefProfile() {
1248 const sel_rows
= getSelectedFeedCats();
1250 if (sel_rows
.length
== 1) {
1252 const ok
= confirm(__("Activate selected profile?"));
1255 notify_progress("Loading, please wait...");
1257 const query
= "?op=rpc&method=setprofile&id="+
1258 param_escape(sel_rows
.toString());
1260 new Ajax
.Request("backend.php", {
1262 onComplete: function(transport
) {
1263 window
.location
.reload();
1268 alert(__("Please choose a profile to activate."));
1274 function clearFeedAccessKeys() {
1276 const ok
= confirm(__("This will invalidate all previously generated feed URLs. Continue?"));
1279 notify_progress("Clearing URLs...");
1281 const query
= "?op=pref-feeds&method=clearKeys";
1283 new Ajax
.Request("backend.php", {
1285 onComplete: function(transport
) {
1286 notify_info("Generated URLs cleared.");
1293 function resetFilterOrder() {
1294 notify_progress("Loading, please wait...");
1296 new Ajax
.Request("backend.php", {
1297 parameters
: "?op=pref-filters&method=filtersortreset",
1298 onComplete: function (transport
) {
1305 function resetFeedOrder() {
1306 notify_progress("Loading, please wait...");
1308 new Ajax
.Request("backend.php", {
1309 parameters
: "?op=pref-feeds&method=feedsortreset",
1310 onComplete: function (transport
) {
1316 function resetCatOrder() {
1317 notify_progress("Loading, please wait...");
1319 new Ajax
.Request("backend.php", {
1320 parameters
: "?op=pref-feeds&method=catsortreset",
1321 onComplete: function (transport
) {
1327 function editCat(id
, item
) {
1328 const new_name
= prompt(__('Rename category to:'), item
.name
);
1330 if (new_name
&& new_name
!= item
.name
) {
1332 notify_progress("Loading, please wait...");
1334 new Ajax
.Request("backend.php", {
1337 method
: 'renamecat',
1341 onComplete: function (transport
) {
1348 function editLabel(id
) {
1349 const query
= "backend.php?op=pref-labels&method=edit&id=" +
1352 if (dijit
.byId("labelEditDlg"))
1353 dijit
.byId("labelEditDlg").destroyRecursive();
1355 const dialog
= new dijit
.Dialog({
1357 title
: __("Label Editor"),
1358 style
: "width: 600px",
1359 setLabelColor: function (id
, fg
, bg
) {
1374 const query
= "?op=pref-labels&method=colorset&kind=" + kind
+
1375 "&ids=" + param_escape(id
) + "&fg=" + param_escape(fg
) +
1376 "&bg=" + param_escape(bg
) + "&color=" + param_escape(color
);
1378 // console.log(query);
1380 const e
= $("LICID-" + id
);
1383 if (fg
) e
.style
.color
= fg
;
1384 if (bg
) e
.style
.backgroundColor
= bg
;
1387 new Ajax
.Request("backend.php", {parameters
: query
});
1391 execute: function () {
1392 if (this.validate()) {
1393 const caption
= this.attr('value').caption
;
1394 const fg_color
= this.attr('value').fg_color
;
1395 const bg_color
= this.attr('value').bg_color
;
1396 const query
= dojo
.objectToQuery(this.attr('value'));
1398 dijit
.byId('labelTree').setNameById(id
, caption
);
1399 this.setLabelColor(id
, fg_color
, bg_color
);
1402 new Ajax
.Request("backend.php", {
1404 onComplete: function (transport
) {
1417 function customizeCSS() {
1418 const query
= "backend.php?op=pref-prefs&method=customizeCSS";
1420 if (dijit
.byId("cssEditDlg"))
1421 dijit
.byId("cssEditDlg").destroyRecursive();
1423 const dialog
= new dijit
.Dialog({
1425 title
: __("Customize stylesheet"),
1426 style
: "width: 600px",
1427 execute: function () {
1428 notify_progress('Saving data...', true);
1429 new Ajax
.Request("backend.php", {
1430 parameters
: dojo
.objectToQuery(this.attr('value')),
1431 onComplete: function (transport
) {
1433 window
.location
.reload();
1444 function insertSSLserial(value
) {
1445 dijit
.byId("SSL_CERT_SERIAL").attr('value', value
);
1448 function gotoExportOpml(filename
, settings
) {
1449 const tmp
= settings
? 1 : 0;
1450 document
.location
.href
= "backend.php?op=opml&method=export&filename=" + filename
+ "&settings=" + tmp
;
1454 function batchSubscribe() {
1455 const query
= "backend.php?op=pref-feeds&method=batchSubscribe";
1457 // overlapping widgets
1458 if (dijit
.byId("batchSubDlg")) dijit
.byId("batchSubDlg").destroyRecursive();
1459 if (dijit
.byId("feedAddDlg")) dijit
.byId("feedAddDlg").destroyRecursive();
1461 var dialog
= new dijit
.Dialog({
1463 title
: __("Batch subscribe"),
1464 style
: "width: 600px",
1465 execute: function () {
1466 if (this.validate()) {
1467 console
.log(dojo
.objectToQuery(this.attr('value')));
1469 notify_progress(__("Subscribing to feeds..."), true);
1471 new Ajax
.Request("backend.php", {
1472 parameters
: dojo
.objectToQuery(this.attr('value')),
1473 onComplete: function (transport
) {
1487 function clearPluginData(name
) {
1488 if (confirm(__("Clear stored data for this plugin?"))) {
1489 notify_progress("Loading, please wait...");
1491 new Ajax
.Request("backend.php", {
1492 parameters
: "?op=pref-prefs&method=clearplugindata&name=" + param_escape(name
),
1493 onComplete: function(transport
) {
1500 function clearSqlLog() {
1502 if (confirm(__("Clear all messages in the error log?"))) {
1504 notify_progress("Loading, please wait...");
1505 const query
= "?op=pref-system&method=clearLog";
1507 new Ajax
.Request("backend.php", {
1509 onComplete: function(transport
) {
1516 function updateSelectedPrompt() {
1517 // no-op shim for toggleSelectedRow()