From e8f9069c5c44fb4512247dbc9d280152e760331a Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 14 Apr 2013 10:23:01 +0400 Subject: quickAddFeed: add placeholder select element to feeds dropdown --- js/functions.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'js/functions.js') diff --git a/js/functions.js b/js/functions.js index 82cfa9054..07eed2ad9 100644 --- a/js/functions.js +++ b/js/functions.js @@ -810,7 +810,7 @@ function quickAddFeed() { notify(''); Element.hide("feed_add_spinner"); - console.log("GOT RC: " + rc); + console.log(rc); switch (parseInt(rc['code'])) { case 1: @@ -866,6 +866,8 @@ function quickAddFeed() { while (select.getOptions().length > 0) select.removeOption(0); + select.addOption({value: '', label: __("Expand to select feed")}); + var count = 0; for (var feedUrl in feeds) { select.addOption({value: feedUrl, label: feeds[feedUrl]}); -- cgit v1.2.3 From e43a9c4a01bf095b740e35711c79f6a0ca3374ba Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 15 Apr 2013 13:16:14 +0400 Subject: add a %d articles selected element --- js/functions.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'js/functions.js') diff --git a/js/functions.js b/js/functions.js index 07eed2ad9..9336433ca 100644 --- a/js/functions.js +++ b/js/functions.js @@ -368,6 +368,9 @@ function toggleSelectRow2(sender, row, is_cdm) { row.addClassName('Selected'); else row.removeClassName('Selected'); + + if (typeof updateSelectedPrompt != undefined) + updateSelectedPrompt(); } @@ -379,6 +382,9 @@ function toggleSelectRow(sender, row) { row.addClassName('Selected'); else row.removeClassName('Selected'); + + if (typeof updateSelectedPrompt != undefined) + updateSelectedPrompt(); } function checkboxToggleElement(elem, id) { -- cgit v1.2.3 From 95437e9e0756edacb835843074c12632c11a64b1 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 17 Apr 2013 10:50:46 +0400 Subject: tweak notify layout/display --- js/functions.js | 44 ++++++++++++++------------------------------ 1 file changed, 14 insertions(+), 30 deletions(-) (limited to 'js/functions.js') diff --git a/js/functions.js b/js/functions.js index 9336433ca..e02767504 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1,8 +1,8 @@ -var notify_silent = false; var loading_progress = 0; var sanity_check_done = false; var init_params = {}; var _label_base_index = -1024; +var notify_hide_timerid = false; Ajax.Base.prototype.initialize = Ajax.Base.prototype.initialize.wrap( function (callOriginal, options) { @@ -147,42 +147,28 @@ function param_unescape(arg) { return unescape(arg); } -var notify_hide_timerid = false; function hide_notify() { - var n = $("notify"); - if (n) { - n.style.display = "none"; - } -} - -function notify_silent_next() { - notify_silent = true; + Element.hide('notify'); } function notify_real(msg, no_hide, n_type) { - if (notify_silent) { - notify_silent = false; - return; - } - var n = $("notify"); - var nb = $("notify_body"); - if (!n || !nb) return; + if (!n) return; if (notify_hide_timerid) { window.clearTimeout(notify_hide_timerid); } if (msg == "") { - if (n.style.display == "block") { + if (Element.visible(n)) { notify_hide_timerid = window.setTimeout("hide_notify()", 0); } return; } else { - n.style.display = "block"; + Element.show(n); } /* types: @@ -194,33 +180,31 @@ function notify_real(msg, no_hide, n_type) { */ - msg = __(msg); + msg = " " + __(msg) + ""; if (n_type == 1) { n.className = "notify"; } else if (n_type == 2) { n.className = "notify progress"; - msg = " " + msg; + msg = "" + msg; + no_hide = true; } else if (n_type == 3) { n.className = "notify error"; - msg = " " + msg; + msg = "" + msg; } else if (n_type == 4) { n.className = "notify info"; - msg = " " + msg; - } - - if (no_hide) { - msg += " (" + - __("close") + ")"; + msg = "" + msg; } + msg += " "; // msg = " " + msg; - nb.innerHTML = msg; + n.innerHTML = msg; if (!no_hide) { - notify_hide_timerid = window.setTimeout("hide_notify()", 3000); + notify_hide_timerid = window.setTimeout("hide_notify()", 5*1000); } } -- cgit v1.2.3 From ebec81a6fb2dff0b2fe6b569b021e057995ee6c7 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 19 Apr 2013 13:17:28 +0400 Subject: subscribe: verify XML before adding to the database; fetch: try to work around entity problems if initial parsing fails --- js/functions.js | 38 +++++--------------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) (limited to 'js/functions.js') diff --git a/js/functions.js b/js/functions.js index e02767504..04be58bf7 100644 --- a/js/functions.js +++ b/js/functions.js @@ -816,39 +816,6 @@ function quickAddFeed() { alert(__("Specified URL doesn't seem to contain any feeds.")); break; case 4: - /* notify_progress("Searching for feed urls...", true); - - new Ajax.Request("backend.php", { - parameters: 'op=rpc&method=extractfeedurls&url=' + param_escape(feed_url), - onComplete: function(transport, dialog, feed_url) { - - notify(''); - - var reply = JSON.parse(transport.responseText); - - var feeds = reply['urls']; - - console.log(transport.responseText); - - var select = dijit.byId("feedDlg_feedContainerSelect"); - - while (select.getOptions().length > 0) - select.removeOption(0); - - var count = 0; - for (var feedUrl in feeds) { - select.addOption({value: feedUrl, label: feeds[feedUrl]}); - count++; - } - -// if (count > 5) count = 5; -// select.size = count; - - Effect.Appear('feedDlg_feedsContainer', {duration : 0.5}); - } - }); - break; */ - feeds = rc['feeds']; var select = dijit.byId("feedDlg_feedContainerSelect"); @@ -871,6 +838,11 @@ function quickAddFeed() { alert(__("Couldn't download the specified URL: %s"). replace("%s", rc['message'])); break; + case 6: + alert(__("XML validation failed: %s"). + replace("%s", rc['message'])); + break; + break; case 0: alert(__("You are already subscribed to this feed.")); break; -- cgit v1.2.3 From f66492d357010a2e5ec11e07fd6db9825184d37d Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 20 Apr 2013 10:43:21 +0400 Subject: better javascript error reporting, save error reports in tt-rss log --- js/functions.js | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'js/functions.js') diff --git a/js/functions.js b/js/functions.js index 04be58bf7..8442e1c9f 100644 --- a/js/functions.js +++ b/js/functions.js @@ -50,6 +50,21 @@ function exception_error(location, e, ext_info) { } } + try { + new Ajax.Request("backend.php", { + parameters: {op: "rpc", method: "log", logmsg: msg}, + onComplete: function (transport) { + console.log(transport.responseText); + } }); + + } catch (eii) { + console.log("Exception while trying to log the error."); + console.log(eii); + } + + msg += "

"+ __("The error will be reported to the configured log destination.") + + "

"; + var content = "
" + "
" + msg + "
"; @@ -106,7 +121,28 @@ function exception_error(location, e, ext_info) { dialog.show(); - } catch (e) { + } catch (ei) { + console.log("Exception while trying to report an exception. Oh boy."); + console.log(ei); + console.log("Original exception:"); + console.log(e); + + msg += "\n\nAdditional exception caught while trying to show the error dialog.\n\n" + format_exception_error('exception_error', ei); + + try { + new Ajax.Request("backend.php", { + parameters: {op: "rpc", method: "log", logmsg: msg}, + onComplete: function (transport) { + console.log(transport.responseText); + } }); + + } catch (eii) { + console.log("Third exception while trying to log the error! Seriously?"); + console.log(eii); + } + + msg += "\n\nThe error will be reported to the configured log destination."; + alert(msg); } -- cgit v1.2.3 From abbe9c1f555baa7ae14b9424ff995edb16122d1c Mon Sep 17 00:00:00 2001 From: supahgreg Date: Sat, 27 Apr 2013 09:45:02 -0500 Subject: minor: remove duplicate check for params --- js/functions.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'js/functions.js') diff --git a/js/functions.js b/js/functions.js index 8442e1c9f..87c52b709 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1269,13 +1269,11 @@ function backend_sanity_check_callback(transport) { if (params) { console.log('reading init-params...'); - if (params) { - for (k in params) { - var v = params[k]; - console.log("IP: " + k + " => " + v); + for (k in params) { + var v = params[k]; + console.log("IP: " + k + " => " + v); - if (k == "label_base_index") _label_base_index = parseInt(v); - } + if (k == "label_base_index") _label_base_index = parseInt(v); } init_params = params; -- cgit v1.2.3 From 8ceea119a8287568439a2a9d167b333f74a47e21 Mon Sep 17 00:00:00 2001 From: supahgreg Date: Sat, 27 Apr 2013 11:01:54 -0500 Subject: Add JS PluginHost.HOOK_PARAMS_LOADED and PluginHost.HOOK_RUNTIME_INFO_LOADED to notify when interesting info has been created/updated. --- js/functions.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'js/functions.js') diff --git a/js/functions.js b/js/functions.js index 87c52b709..8691c1ee5 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1277,6 +1277,9 @@ function backend_sanity_check_callback(transport) { } init_params = params; + + // PluginHost might not be available on non-index pages + window.PluginHost && PluginHost.run(PluginHost.HOOK_PARAMS_LOADED, init_params); } sanity_check_done = true; -- cgit v1.2.3