From 049a37aa0e7d37cafd979e7d470c7649700b5010 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 1 Dec 2018 17:05:28 +0300 Subject: WIP reshuffling of JS global context into separate logical objects --- js/FeedTree.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/FeedTree.js') diff --git a/js/FeedTree.js b/js/FeedTree.js index b37d339c2..21a19bf85 100755 --- a/js/FeedTree.js +++ b/js/FeedTree.js @@ -97,7 +97,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], menu.addChild(new dijit.MenuItem({ label: __("Mark all feeds as read"), onClick: function() { - catchupAllFeeds(); + Feeds.catchupAllFeeds(); }})); menu.bindDomNode(tnode.domNode); -- cgit v1.2.3-54-g00ecf From d86ddbc635376231ba2e0a70c04f526cb9fedd58 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 1 Dec 2018 17:21:26 +0300 Subject: further objectification of JS code --- classes/feeds.php | 4 +- index.php | 8 +- js/FeedTree.js | 4 +- js/feedlist.js | 330 ++++++++++++++++++++++++++---------------------------- js/functions.js | 128 +++++++++++++++++++++ js/tt-rss.js | 134 +--------------------- js/viewfeed.js | 38 +++---- 7 files changed, 316 insertions(+), 330 deletions(-) (limited to 'js/FeedTree.js') diff --git a/classes/feeds.php b/classes/feeds.php index 93e44e3bb..63366fd0d 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -388,7 +388,7 @@ class Feeds extends Handler_Protected { $vgroup_last_feed = $feed_id; - $vf_catchup_link = "".__('mark feed as read').""; + $vf_catchup_link = "".__('mark feed as read').""; $reply['content'] .= "
". "
$feed_icon_img
". @@ -481,7 +481,7 @@ class Feeds extends Handler_Protected { $vgroup_last_feed = $feed_id; - $vf_catchup_link = "".__('mark feed as read').""; + $vf_catchup_link = "".__('mark feed as read').""; $feed_icon_src = Feeds::getFeedIcon($feed_id); $feed_icon_img = ""; diff --git a/index.php b/index.php index 48bd559f8..820db9073 100644 --- a/index.php +++ b/index.php @@ -207,16 +207,16 @@ -
+
-
+
-
+
-
+
diff --git a/js/FeedTree.js b/js/FeedTree.js index 21a19bf85..55eb3dc30 100755 --- a/js/FeedTree.js +++ b/js/FeedTree.js @@ -41,7 +41,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], menu.addChild(new dijit.MenuItem({ label: __("Mark as read"), onClick: function() { - catchupFeed(this.getParent().row_id); + Feeds.catchupFeed(this.getParent().row_id); }})); if (bare_id > 0) { @@ -69,7 +69,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], menu.addChild(new dijit.MenuItem({ label: __("Mark as read"), onClick: function() { - catchupFeed(this.getParent().row_id, true); + Feeds.catchupFeed(this.getParent().row_id, true); }})); menu.addChild(new dijit.MenuItem({ diff --git a/js/feedlist.js b/js/feedlist.js index b808451b4..c2a0e816d 100644 --- a/js/feedlist.js +++ b/js/feedlist.js @@ -69,23 +69,23 @@ const Feeds = { continue; } - /*if (getFeedUnread(id, (kind == "cat")) != ctr || + /*if (Feeds.getFeedUnread(id, (kind == "cat")) != ctr || (kind == "cat")) { }*/ - setFeedUnread(id, (kind == "cat"), ctr); - setFeedValue(id, (kind == "cat"), 'auxcounter', auxctr); + Feeds.setFeedUnread(id, (kind == "cat"), ctr); + Feeds.setFeedValue(id, (kind == "cat"), 'auxcounter', auxctr); if (kind != "cat") { - setFeedValue(id, false, 'error', error); - setFeedValue(id, false, 'updated', updated); + Feeds.setFeedValue(id, false, 'error', error); + Feeds.setFeedValue(id, false, 'updated', updated); if (id > 0) { if (has_img) { - setFeedIcon(id, false, + Feeds.setFeedIcon(id, false, getInitParam("icons_url") + "/" + id + ".ico?" + has_img); } else { - setFeedIcon(id, false, 'images/blank_icon.gif'); + Feeds.setFeedIcon(id, false, 'images/blank_icon.gif'); } } } @@ -104,7 +104,7 @@ const Feeds = { }, openNextUnreadFeed: function() { const is_cat = Feeds.activeFeedIsCat(); - const nuf = getNextUnreadFeed(Feeds.getActiveFeedId(), is_cat); + const nuf = Feeds.getNextUnreadFeed(Feeds.getActiveFeedId(), is_cat); if (nuf) this.viewfeed({feed: nuf, is_cat: is_cat}); }, collapseFeedlist: function() { @@ -129,13 +129,13 @@ const Feeds = { counters_last_request = timestamp; - let query = {op: "rpc", method: "getAllCounters", seq: App.next_seq()}; + let query = {op: "rpc", method: "getAllCounters", seq: Utils.next_seq()}; if (!force) query.last_article_id = getInitParam("last_article_id"); xhrPost("backend.php", query, (transport) => { - App.handleRpcJson(transport); + Utils.handleRpcJson(transport); }); } else { @@ -357,7 +357,7 @@ const Feeds = { Form.enable("main_toolbar_form"); if (!delayed) - if (!setFeedExpandoIcon(feed, is_cat, + if (!Feeds.setFeedExpandoIcon(feed, is_cat, (is_cat) ? 'images/indicator_tiny.gif' : 'images/indicator_white.gif')) notify_progress("Loading, please wait...", true); @@ -377,7 +377,7 @@ const Feeds = { catchupBatchedArticles(() => { xhrPost("backend.php", query, (transport) => { try { - setFeedExpandoIcon(feed, is_cat, 'images/blank_icon.gif'); + Feeds.setFeedExpandoIcon(feed, is_cat, 'images/blank_icon.gif'); Headlines.onLoaded(transport, offset); PluginHost.run(PluginHost.HOOK_FEED_LOADED, [feed, is_cat]); } catch (e) { @@ -404,221 +404,207 @@ const Feeds = { } }, decrementFeedCounter: function(feed, is_cat) { - let ctr = getFeedUnread(feed, is_cat); + let ctr = Feeds.getFeedUnread(feed, is_cat); if (ctr > 0) { - setFeedUnread(feed, is_cat, ctr - 1); + Feeds.setFeedUnread(feed, is_cat, ctr - 1); App.global_unread -= 1; App.updateTitle(); if (!is_cat) { - const cat = parseInt(getFeedCategory(feed)); + const cat = parseInt(Feeds.getFeedCategory(feed)); if (!isNaN(cat)) { - ctr = getFeedUnread(cat, true); + ctr = Feeds.getFeedUnread(cat, true); if (ctr > 0) { - setFeedUnread(cat, true, ctr - 1); + Feeds.setFeedUnread(cat, true, ctr - 1); } } } } - } -}; - -function getFeedUnread(feed, is_cat) { - try { - const tree = dijit.byId("feedTree"); - - if (tree && tree.model) - return tree.model.getFeedUnread(feed, is_cat); - - } catch (e) { - // - } - - return -1; -} - -function getFeedCategory(feed) { - try { - const tree = dijit.byId("feedTree"); - - if (tree && tree.model) - return tree.getFeedCategory(feed); - - } catch (e) { - // - } - - return false; -} - -function getFeedName(feed, is_cat) { - - if (isNaN(feed)) return feed; // it's a tag - - const tree = dijit.byId("feedTree"); - - if (tree && tree.model) - return tree.model.getFeedValue(feed, is_cat, 'name'); -} - -/* function getFeedValue(feed, is_cat, key) { - try { - const tree = dijit.byId("feedTree"); - - if (tree && tree.model) - return tree.model.getFeedValue(feed, is_cat, key); + }, + catchupFeed: function(feed, is_cat, mode) { + if (is_cat == undefined) is_cat = false; + + let str = false; + + switch (mode) { + case "1day": + str = __("Mark %w in %s older than 1 day as read?"); + break; + case "1week": + str = __("Mark %w in %s older than 1 week as read?"); + break; + case "2week": + str = __("Mark %w in %s older than 2 weeks as read?"); + break; + default: + str = __("Mark %w in %s as read?"); + } - } catch (e) { - // - } - return ''; -} */ + const mark_what = last_search_query && last_search_query[0] ? __("search results") : __("all articles"); + const fn = Feeds.getFeedName(feed, is_cat); -function setFeedUnread(feed, is_cat, unread) { - const tree = dijit.byId("feedTree"); + str = str.replace("%s", fn) + .replace("%w", mark_what); - if (tree && tree.model) - return tree.model.setFeedUnread(feed, is_cat, unread); -} + if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str)) { + return; + } -function setFeedValue(feed, is_cat, key, value) { - try { - const tree = dijit.byId("feedTree"); + const catchup_query = { + op: 'rpc', method: 'catchupFeed', feed_id: feed, + is_cat: is_cat, mode: mode, search_query: last_search_query[0], + search_lang: last_search_query[1] + }; - if (tree && tree.model) - return tree.model.setFeedValue(feed, is_cat, key, value); + notify_progress("Loading, please wait...", true); - } catch (e) { - // - } -} + xhrPost("backend.php", catchup_query, (transport) => { + Utils.handleRpcJson(transport); -function setFeedIcon(feed, is_cat, src) { - const tree = dijit.byId("feedTree"); + const show_next_feed = getInitParam("on_catchup_show_next_feed") == "1"; - if (tree) return tree.setFeedIcon(feed, is_cat, src); -} + if (show_next_feed) { + const nuf = Feeds.getNextUnreadFeed(feed, is_cat); -function setFeedExpandoIcon(feed, is_cat, src) { - const tree = dijit.byId("feedTree"); + if (nuf) { + this.viewfeed({feed: nuf, is_cat: is_cat}); + } + } else if (feed == Feeds.getActiveFeedId() && is_cat == Feeds.activeFeedIsCat()) { + this.viewCurrentFeed(); + } - if (tree) return tree.setFeedExpandoIcon(feed, is_cat, src); + notify(""); + }); + }, + catchupCurrentFeed: function(mode) { + Feeds.catchupFeed(Feeds.getActiveFeedId(), Feeds.activeFeedIsCat(), mode); + }, + catchupFeedInGroup: function(id) { + const title = Feeds.getFeedName(id); - return false; -} + const str = __("Mark all articles in %s as read?").replace("%s", title); -function getNextUnreadFeed(feed, is_cat) { - const tree = dijit.byId("feedTree"); - const nuf = tree.model.getNextUnreadFeed(feed, is_cat); + if (getInitParam("confirm_feed_catchup") != 1 || confirm(str)) { - if (nuf) - return tree.model.store.getValue(nuf, 'bare_id'); -} + const rows = $$("#headlines-frame > div[id*=RROW][data-orig-feed-id='" + id + "']"); -function catchupCurrentFeed(mode) { - catchupFeed(Feeds.getActiveFeedId(), Feeds.activeFeedIsCat(), mode); -} + if (rows.length > 0) { -function catchupFeedInGroup(id) { - const title = getFeedName(id); + rows.each(function (row) { + row.removeClassName("Unread"); - const str = __("Mark all articles in %s as read?").replace("%s", title); + if (row.getAttribute("data-article-id") != getActiveArticleId()) { + new Effect.Fade(row, {duration: 0.5}); + } - if (getInitParam("confirm_feed_catchup") != 1 || confirm(str)) { + }); - const rows = $$("#headlines-frame > div[id*=RROW][data-orig-feed-id='"+id+"']"); + const feedTitles = $$("#headlines-frame > div[class='feed-title']"); - if (rows.length > 0) { + for (let i = 0; i < feedTitles.length; i++) { + if (feedTitles[i].getAttribute("data-feed-id") == id) { - rows.each(function (row) { - row.removeClassName("Unread"); + if (i < feedTitles.length - 1) { + new Effect.Fade(feedTitles[i], {duration: 0.5}); + } - if (row.getAttribute("data-article-id") != getActiveArticleId()) { - new Effect.Fade(row, {duration: 0.5}); + break; + } } - }); - - const feedTitles = $$("#headlines-frame > div[class='feed-title']"); + Headlines.updateFloatingTitle(true); + } - for (let i = 0; i < feedTitles.length; i++) { - if (feedTitles[i].getAttribute("data-feed-id") == id) { + notify_progress("Loading, please wait...", true); - if (i < feedTitles.length - 1) { - new Effect.Fade(feedTitles[i], {duration: 0.5}); - } + xhrPost("backend.php", {op: "rpc", method: "catchupFeed", feed_id: id, is_cat: false}, (transport) => { + Utils.handleRpcJson(transport); + }); + } + }, + getFeedUnread: function(feed, is_cat) { + try { + const tree = dijit.byId("feedTree"); - break; - } - } + if (tree && tree.model) + return tree.model.getFeedUnread(feed, is_cat); - Headlines.updateFloatingTitle(true); + } catch (e) { + // } - notify_progress("Loading, please wait...", true); + return -1; + }, + getFeedCategory: function(feed) { + try { + const tree = dijit.byId("feedTree"); - xhrPost("backend.php", { op: "rpc", method: "catchupFeed", feed_id: id, is_cat: false}, (transport) => { - App.handleRpcJson(transport); - }); - } -} - -function catchupFeed(feed, is_cat, mode) { - if (is_cat == undefined) is_cat = false; - - let str = false; - - switch (mode) { - case "1day": - str = __("Mark %w in %s older than 1 day as read?"); - break; - case "1week": - str = __("Mark %w in %s older than 1 week as read?"); - break; - case "2week": - str = __("Mark %w in %s older than 2 weeks as read?"); - break; - default: - str = __("Mark %w in %s as read?"); - } + if (tree && tree.model) + return tree.getFeedCategory(feed); - const mark_what = last_search_query && last_search_query[0] ? __("search results") : __("all articles"); - const fn = getFeedName(feed, is_cat); + } catch (e) { + // + } - str = str.replace("%s", fn) - .replace("%w", mark_what); + return false; + }, + getFeedName: function(feed, is_cat) { + if (isNaN(feed)) return feed; // it's a tag - if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str)) { - return; - } + const tree = dijit.byId("feedTree"); - const catchup_query = {op: 'rpc', method: 'catchupFeed', feed_id: feed, - is_cat: is_cat, mode: mode, search_query: last_search_query[0], - search_lang: last_search_query[1]}; + if (tree && tree.model) + return tree.model.getFeedValue(feed, is_cat, 'name'); + }, + setFeedUnread: function(feed, is_cat, unread) { + const tree = dijit.byId("feedTree"); - notify_progress("Loading, please wait...", true); + if (tree && tree.model) + return tree.model.setFeedUnread(feed, is_cat, unread); + }, + setFeedValue: function(feed, is_cat, key, value) { + try { + const tree = dijit.byId("feedTree"); - xhrPost("backend.php", catchup_query, (transport) => { - App.handleRpcJson(transport); + if (tree && tree.model) + return tree.model.setFeedValue(feed, is_cat, key, value); - const show_next_feed = getInitParam("on_catchup_show_next_feed") == "1"; + } catch (e) { + // + } + }, + getFeedValue: function(feed, is_cat, key) { + try { + const tree = dijit.byId("feedTree"); - if (show_next_feed) { - const nuf = getNextUnreadFeed(feed, is_cat); + if (tree && tree.model) + return tree.model.getFeedValue(feed, is_cat, key); - if (nuf) { - Feeds.viewfeed({feed: nuf, is_cat: is_cat}); - } - } else if (feed == Feeds.getActiveFeedId() && is_cat == Feeds.activeFeedIsCat()) { - Feeds.viewCurrentFeed(); + } catch (e) { + // } + return ''; + }, + setFeedIcon: function(feed, is_cat, src) { + const tree = dijit.byId("feedTree"); - notify(""); - }); -} + if (tree) return tree.setFeedIcon(feed, is_cat, src); + }, + setFeedExpandoIcon: function(feed, is_cat, src) { + const tree = dijit.byId("feedTree"); + if (tree) return tree.setFeedExpandoIcon(feed, is_cat, src); + return false; + }, + getNextUnreadFeed: function(feed, is_cat) { + const tree = dijit.byId("feedTree"); + const nuf = tree.model.getNextUnreadFeed(feed, is_cat); + if (nuf) + return tree.model.store.getValue(nuf, 'bare_id'); + } +}; diff --git a/js/functions.js b/js/functions.js index d9778ad22..174dbebfe 100755 --- a/js/functions.js +++ b/js/functions.js @@ -57,6 +57,14 @@ Array.prototype.remove = function(s) { }; const Utils = { + _rpc_seq: 0, + next_seq: function() { + this._rpc_seq += 1; + return this._rpc_seq; + }, + get_seq: function() { + return this._rpc_seq; + }, cleanupMemory: function(root) { const dijits = dojo.query("[widgetid]", dijit.byId(root).domNode).map(dijit.byNode); @@ -127,6 +135,126 @@ const Utils = { return false; }, + handleRpcJson: function(transport) { + + const netalert_dijit = dijit.byId("net-alert"); + let netalert = false; + + if (netalert_dijit) netalert = netalert_dijit.domNode; + + try { + const reply = JSON.parse(transport.responseText); + + if (reply) { + + const error = reply['error']; + + if (error) { + const code = error['code']; + const msg = error['msg']; + + console.warn("[handleRpcJson] received fatal error " + code + "/" + msg); + + if (code != 0) { + fatalError(code, msg); + return false; + } + } + + const seq = reply['seq']; + + if (seq && this.get_seq() != seq) { + console.log("[handleRpcJson] sequence mismatch: " + seq + + " (want: " + this.get_seq() + ")"); + return true; + } + + const message = reply['message']; + + if (message == "UPDATE_COUNTERS") { + console.log("need to refresh counters..."); + setInitParam("last_article_id", -1); + Feeds.requestCounters(true); + } + + const counters = reply['counters']; + + if (counters) + Feeds.parseCounters(counters); + + const runtime_info = reply['runtime-info']; + + if (runtime_info) + Utils.parseRuntimeInfo(runtime_info); + + if (netalert) netalert.hide(); + + return reply; + + } else { + if (netalert) + netalert.show(); + else + notify_error("Communication problem with server."); + } + + } catch (e) { + if (netalert) + netalert.show(); + else + notify_error("Communication problem with server."); + + console.error(e); + } + + return false; + }, + parseRuntimeInfo: function(data) { + + //console.log("parsing runtime info..."); + + for (const k in data) { + const v = data[k]; + + if (k == "dep_ts" && parseInt(getInitParam("dep_ts")) > 0) { + if (parseInt(getInitParam("dep_ts")) < parseInt(v) && getInitParam("reload_on_ts_change")) { + window.location.reload(); + } + } + + if (k == "daemon_is_running" && v != 1) { + notify_error("Update daemon is not running.", true); + return; + } + + if (k == "update_result") { + const updatesIcon = dijit.byId("updatesIcon").domNode; + + if (v) { + Element.show(updatesIcon); + } else { + Element.hide(updatesIcon); + } + } + + if (k == "daemon_stamp_ok" && v != 1) { + notify_error("Update daemon is not updating feeds.", true); + return; + } + + if (k == "max_feed_id" || k == "num_feeds") { + if (init_params[k] != v) { + console.log("feed count changed, need to reload feedlist."); + Feeds.reload(); + } + } + + init_params[k] = v; + notify(''); + } + + PluginHost.run(PluginHost.HOOK_RUNTIME_INFO_LOADED, data); + }, }; function report_error(message, filename, lineno, colno, error) { diff --git a/js/tt-rss.js b/js/tt-rss.js index b5b785321..078ac7c63 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -4,15 +4,7 @@ let _widescreen_mode = false; let hotkey_actions = {}; const App = { - _rpc_seq: 0, global_unread: -1, - next_seq: function() { - this._rpc_seq += 1; - return this._rpc_seq; - }, - get_seq: function() { - return this._rpc_seq; - }, updateTitle: function() { let tmp = "Tiny Tiny RSS"; @@ -85,126 +77,6 @@ const App = { xhrPost("backend.php", {op: "rpc", method: "setpanelmode", wide: wide ? 1 : 0}); }, - parseRuntimeInfo: function(data) { - - //console.log("parsing runtime info..."); - - for (const k in data) { - const v = data[k]; - - if (k == "dep_ts" && parseInt(getInitParam("dep_ts")) > 0) { - if (parseInt(getInitParam("dep_ts")) < parseInt(v) && getInitParam("reload_on_ts_change")) { - window.location.reload(); - } - } - - if (k == "daemon_is_running" && v != 1) { - notify_error("Update daemon is not running.", true); - return; - } - - if (k == "update_result") { - const updatesIcon = dijit.byId("updatesIcon").domNode; - - if (v) { - Element.show(updatesIcon); - } else { - Element.hide(updatesIcon); - } - } - - if (k == "daemon_stamp_ok" && v != 1) { - notify_error("Update daemon is not updating feeds.", true); - return; - } - - if (k == "max_feed_id" || k == "num_feeds") { - if (init_params[k] != v) { - console.log("feed count changed, need to reload feedlist."); - Feeds.reload(); - } - } - - init_params[k] = v; - notify(''); - } - - PluginHost.run(PluginHost.HOOK_RUNTIME_INFO_LOADED, data); - }, - handleRpcJson: function(transport) { - - const netalert_dijit = dijit.byId("net-alert"); - let netalert = false; - - if (netalert_dijit) netalert = netalert_dijit.domNode; - - try { - const reply = JSON.parse(transport.responseText); - - if (reply) { - - const error = reply['error']; - - if (error) { - const code = error['code']; - const msg = error['msg']; - - console.warn("[handleRpcJson] received fatal error " + code + "/" + msg); - - if (code != 0) { - fatalError(code, msg); - return false; - } - } - - const seq = reply['seq']; - - if (seq && this.get_seq() != seq) { - console.log("[handleRpcJson] sequence mismatch: " + seq + - " (want: " + this.get_seq() + ")"); - return true; - } - - const message = reply['message']; - - if (message == "UPDATE_COUNTERS") { - console.log("need to refresh counters..."); - setInitParam("last_article_id", -1); - Feeds.requestCounters(true); - } - - const counters = reply['counters']; - - if (counters) - Feeds.parseCounters(counters); - - const runtime_info = reply['runtime-info']; - - if (runtime_info) - this.parseRuntimeInfo(runtime_info); - - if (netalert) netalert.hide(); - - return reply; - - } else { - if (netalert) - netalert.show(); - else - notify_error("Communication problem with server."); - } - - } catch (e) { - if (netalert) - netalert.show(); - else - notify_error("Communication problem with server."); - - console.error(e); - } - - return false; - }, }; function search() { @@ -459,7 +331,7 @@ function init_hotkey_actions() { }; hotkey_actions["feed_catchup"] = function() { if (Feeds.getActiveFeedId() != undefined) { - catchupCurrentFeed(); + Feeds.catchupCurrentFeed(); return; } }; @@ -677,7 +549,7 @@ function quickMenuGo(opid) { return; } - var fn = getFeedName(actid); + var fn = Feeds.getFeedName(actid); var pr = __("Unsubscribe from %s?").replace("%s", fn); @@ -743,7 +615,7 @@ function update_random_feed() { console.log("in update_random_feed"); xhrPost("backend.php", { op: "rpc", method: "updateRandomFeed" }, (transport) => { - App.handleRpcJson(transport, true); + Utils.handleRpcJson(transport, true); window.setTimeout(update_random_feed, 30*1000); }); } diff --git a/js/viewfeed.js b/js/viewfeed.js index 637aa0473..bb3f5ef98 100755 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -75,7 +75,7 @@ const Headlines = { const view_mode = document.forms["main_toolbar_form"].view_mode.value; const unread_in_buffer = $$("#headlines-frame > div[id*=RROW][class*=Unread]").length; const num_all = $$("#headlines-frame > div[id*=RROW]").length; - const num_unread = getFeedUnread(Feeds.getActiveFeedId(), Feeds.activeFeedIsCat()); + const num_unread = Feeds.getFeedUnread(Feeds.getActiveFeedId(), Feeds.activeFeedIsCat()); // TODO implement marked & published @@ -248,7 +248,7 @@ const Headlines = { } }, onLoaded: function(transport, offset) { - const reply = App.handleRpcJson(transport); + const reply = Utils.handleRpcJson(transport); console.log("Headlines.onLoaded: offset=", offset); @@ -436,7 +436,7 @@ function view(id, noexpand) { xhrPost("backend.php", {op: "article", method: "view", id: id, cids: cids.toString()}, (transport) => { try { - const reply = App.handleRpcJson(transport); + const reply = Utils.handleRpcJson(transport); if (reply) { @@ -491,7 +491,7 @@ function toggleMark(id, client_only) { if (!client_only) xhrPost("backend.php", query, (transport) => { - App.handleRpcJson(transport); + Utils.handleRpcJson(transport); }); } } @@ -518,7 +518,7 @@ function togglePub(id, client_only) { if (!client_only) xhrPost("backend.php", query, (transport) => { - App.handleRpcJson(transport); + Utils.handleRpcJson(transport); }); } @@ -642,7 +642,7 @@ function toggleUnread(id, cmode) { if (row.className != origClassName) xhrPost("backend.php", {op: "rpc", method: "catchupSelected", cmode: cmode, ids: id},(transport) => { - App.handleRpcJson(transport); + Utils.handleRpcJson(transport); }); } } @@ -659,7 +659,7 @@ function selectionRemoveLabel(id, ids) { ids: ids.toString(), lid: id }; xhrPost("backend.php", query, (transport) => { - App.handleRpcJson(transport); + Utils.handleRpcJson(transport); updateHeadlineLabels(transport); }); } @@ -676,7 +676,7 @@ function selectionAssignLabel(id, ids) { ids: ids.toString(), lid: id }; xhrPost("backend.php", query, (transport) => { - App.handleRpcJson(transport); + Utils.handleRpcJson(transport); updateHeadlineLabels(transport); }); } @@ -719,7 +719,7 @@ function selectionToggleUnread(params) { notify_progress("Loading, please wait..."); xhrPost("backend.php", query, (transport) => { - App.handleRpcJson(transport); + Utils.handleRpcJson(transport); if (callback) callback(transport); }); } @@ -740,7 +740,7 @@ function selectionToggleMarked(ids) { ids: rows.toString(), cmode: 2 }; xhrPost("backend.php", query, (transport) => { - App.handleRpcJson(transport); + Utils.handleRpcJson(transport); }); } @@ -762,7 +762,7 @@ function selectionTogglePublished(ids) { ids: rows.toString(), cmode: 2 }; xhrPost("backend.php", query, (transport) => { - App.handleRpcJson(transport); + Utils.handleRpcJson(transport); }); } } @@ -862,7 +862,7 @@ function deleteSelection() { return; } - const fn = getFeedName(Feeds.getActiveFeedId(), Feeds.activeFeedIsCat()); + const fn = Feeds.getFeedName(Feeds.getActiveFeedId(), Feeds.activeFeedIsCat()); let str; if (Feeds.getActiveFeedId() != 0) { @@ -881,7 +881,7 @@ function deleteSelection() { const query = { op: "rpc", method: "delete", ids: rows.toString() }; xhrPost("backend.php", query, (transport) => { - App.handleRpcJson(transport); + Utils.handleRpcJson(transport); Feeds.viewCurrentFeed(); }); } @@ -896,7 +896,7 @@ function archiveSelection() { return; } - const fn = getFeedName(Feeds.getActiveFeedId(), Feeds.activeFeedIsCat()); + const fn = Feeds.getFeedName(Feeds.getActiveFeedId(), Feeds.activeFeedIsCat()); let str; let op; @@ -924,7 +924,7 @@ function archiveSelection() { const query = {op: "rpc", method: op, ids: rows.toString()}; xhrPost("backend.php", query, (transport) => { - App.handleRpcJson(transport); + Utils.handleRpcJson(transport); Feeds.viewCurrentFeed(); }); } @@ -938,7 +938,7 @@ function catchupSelection() { return; } - const fn = getFeedName(Feeds.getActiveFeedId(), Feeds.activeFeedIsCat()); + const fn = Feeds.getFeedName(Feeds.getActiveFeedId(), Feeds.activeFeedIsCat()); let str = ngettext("Mark %d selected article in %s as read?", "Mark %d selected articles in %s as read?", rows.length); @@ -1091,7 +1091,7 @@ function catchupBatchedArticles(callback) { cmode: 0, ids: batch.toString() }; xhrPost("backend.php", query, (transport) => { - const reply = App.handleRpcJson(transport); + const reply = Utils.handleRpcJson(transport); if (reply) { const batch = reply.ids; @@ -1167,7 +1167,7 @@ function catchupRelativeToArticle(below, id) { cmode: 0, ids: ids_to_mark.toString() }; xhrPost("backend.php", query, (transport) => { - App.handleRpcJson(transport); + Utils.handleRpcJson(transport); }); } } @@ -1489,7 +1489,7 @@ function initHeadlinesMenu() { menu.addChild(new dijit.MenuItem({ label: __("Mark feed as read"), onClick: function () { - catchupFeedInGroup(this.getParent().currentTarget.getAttribute("data-feed-id")); + Feeds.catchupFeedInGroup(this.getParent().currentTarget.getAttribute("data-feed-id")); } })); -- cgit v1.2.3-54-g00ecf From 1e2d4410d320fcee644add76293f229741a163cb Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 1 Dec 2018 22:39:29 +0300 Subject: move some more shared stuff to CommonDialogs, Filters, and Utils --- classes/dlg.php | 2 +- classes/pref/feeds.php | 8 +- classes/pref/filters.php | 4 +- js/FeedTree.js | 2 +- js/PrefFeedTree.js | 4 +- js/functions.js | 877 ++++++++++++++++++++-------------------- js/prefs.js | 6 +- js/tt-rss.js | 8 +- js/viewfeed.js | 2 +- plugins/af_psql_trgm/init.php | 2 +- plugins/af_readability/init.php | 2 +- tests/functional/BasicTest.php | 2 +- 12 files changed, 463 insertions(+), 456 deletions(-) (limited to 'js/FeedTree.js') diff --git a/classes/dlg.php b/classes/dlg.php index 50cbd12dd..02249ea96 100644 --- a/classes/dlg.php +++ b/classes/dlg.php @@ -174,7 +174,7 @@ class Dlg extends Handler_Protected { print "
"; - print " "; print ""; print "
"; @@ -1247,7 +1247,7 @@ class Pref_Feeds extends Handler_Protected { var bare_id = id.substr(id.indexOf(':')+1); if (id.match('FEED:')) { - editFeed(bare_id); + CommonDialogs.editFeed(bare_id); } else if (id.match('CAT:')) { editCat(bare_id, item); } @@ -1441,7 +1441,7 @@ class Pref_Feeds extends Handler_Protected { print "". + "onclick=\"CommonDialogs.editFeed(".$line["id"].")\">". htmlspecialchars($line["title"]).""; print ""; @@ -1506,7 +1506,7 @@ class Pref_Feeds extends Handler_Protected { print "". + "onclick=\"CommonDialogs.editFeed(".$line["id"].")\">". htmlspecialchars($line["title"]).": "; print ""; diff --git a/classes/pref/filters.php b/classes/pref/filters.php index e3503d545..e60628f8f 100755 --- a/classes/pref/filters.php +++ b/classes/pref/filters.php @@ -797,7 +797,7 @@ class Pref_Filters extends Handler_Protected { dojoType=\"dijit.MenuItem\">".__('None')."
"; print "
"; - print " "; print ""; + content += "
"; + + const dialog = new dijit.Dialog({ + id: "exceptionDlg", + title: "Unhandled exception", + style: "width: 600px", + content: content + }); + + dialog.show(); + } catch (de) { + console.error("[Error.report] exception while showing error dialog", de); + + alert(error.stack ? error.stack : message); + } + + }, + onWindowError: function (message, filename, lineno, colno, error) { + // called without context (this) from window.onerror + App.Error.report(error, + {message: message, filename: filename, lineno: lineno, colno: colno}); + }, + } }); }); diff --git a/js/Article.js b/js/Article.js index d3ae8eed7..04cba8ab7 100644 --- a/js/Article.js +++ b/js/Article.js @@ -168,7 +168,7 @@ define(["dojo/_base/declare"], function (declare) { Notify.close(); } catch (e) { - exception_error(e); + App.Error.report(e); } }) } @@ -206,7 +206,7 @@ define(["dojo/_base/declare"], function (declare) { if (tooltip) tooltip.attr('label', data.content_full); } } catch (e) { - exception_error(e); + App.Error.report(e); } }); } diff --git a/js/CommonDialogs.js b/js/CommonDialogs.js index b9cee8873..81ad2ffce 100644 --- a/js/CommonDialogs.js +++ b/js/CommonDialogs.js @@ -152,7 +152,7 @@ define(["dojo/_base/declare"], function (declare) { } catch (e) { console.error(transport.responseText); - exception_error(e); + App.Error.report(e); } }); } diff --git a/js/CommonFilters.js b/js/CommonFilters.js index d2a3e6317..97a676c98 100644 --- a/js/CommonFilters.js +++ b/js/CommonFilters.js @@ -67,7 +67,7 @@ define(["dojo/_base/declare"], function (declare) { parentNode.appendChild(li); } } catch (e) { - exception_error(e); + App.Error.report(e); } }); }, @@ -117,7 +117,7 @@ define(["dojo/_base/declare"], function (declare) { } } catch (e) { - exception_error(e); + App.Error.report(e); } }); }, @@ -238,7 +238,7 @@ define(["dojo/_base/declare"], function (declare) { console.log("getTestResults: dialog closed, bailing out."); } } catch (e) { - exception_error(e); + App.Error.report(e); } }); diff --git a/js/FeedTree.js b/js/FeedTree.js index 37e3de2d1..75d1c901b 100755 --- a/js/FeedTree.js +++ b/js/FeedTree.js @@ -207,7 +207,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], } } } catch (e) { - exception_error(e); + App.Error.report(e); } }, findNodeParentsAndExpandThem: function(feed, is_cat, root, parents) { @@ -242,7 +242,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], this.expandParentNodes(feed, is_cat, parents.slice(0)); } } catch (e) { - exception_error(e); + App.Error.report(e); } }, selectFeed: function(feed, is_cat) { diff --git a/js/Feeds.js b/js/Feeds.js index eb9a468ad..fbcb56150 100644 --- a/js/Feeds.js +++ b/js/Feeds.js @@ -198,13 +198,13 @@ define(["dojo/_base/declare"], function (declare) { Feeds.init(); App.setLoadingProgress(25); } catch (e) { - exception_error(e); + App.Error.report(e); } }); tree.startup(); } catch (e) { - exception_error(e); + App.Error.report(e); } }, init: function() { @@ -380,7 +380,7 @@ define(["dojo/_base/declare"], function (declare) { Headlines.onLoaded(transport, offset); PluginHost.run(PluginHost.HOOK_FEED_LOADED, [feed, is_cat]); } catch (e) { - exception_error(e); + App.Error.report(e); } }); }); diff --git a/js/common.js b/js/common.js index de6d13a78..427e3034c 100755 --- a/js/common.js +++ b/js/common.js @@ -4,6 +4,16 @@ let _label_base_index = -1024; let loading_progress = 0; +/* error reporting shim */ + +// TODO: deprecated; remove +function exception_error(e, e_compat, filename, lineno, colno) { + if (typeof e == "string") + e = e_compat; + + App.Error.report(e, {filename: filename, lineno: lineno, colno: colno}); +} + /* xhr shorthand helpers */ function xhrPost(url, params, complete) { @@ -118,71 +128,6 @@ const Cookie = { } }; -/* error reporting */ - -function report_error(message, filename, lineno, colno, error) { - exception_error(error, null, filename, lineno); -} - -function exception_error(e, e_compat, filename, lineno, colno) { - if (typeof e == "string") e = e_compat; - - if (!e) return; // no exception object, nothing to report. - - try { - console.error(e); - const msg = e.toString(); - - try { - xhrPost("backend.php", - {op: "rpc", method: "log", - file: e.fileName ? e.fileName : filename, - line: e.lineNumber ? e.lineNumber : lineno, - msg: msg, context: e.stack}, - (transport) => { - console.warn(transport.responseText); - }); - - } catch (e) { - console.error("Exception while trying to log the error.", e); - } - - let content = "

" + msg + "

"; - - if (e.stack) { - content += "
Stack trace:
" + - ""; - } - - content += "
"; - - content += "
"; - - content += ""; - content += "
"; - - if (dijit.byId("exceptionDlg")) - dijit.byId("exceptionDlg").destroyRecursive(); - - const dialog = new dijit.Dialog({ - id: "exceptionDlg", - title: "Unhandled exception", - style: "width: 600px", - content: content}); - - dialog.show(); - - } catch (ei) { - console.error("Exception while trying to report an exception:", ei); - console.error("Original exception:", e); - - alert("Exception occured while trying to report an exception.\n" + - ei.stack + "\n\nOriginal exception:\n" + e.stack); - } -} - /* runtime notifications */ const Notify = { diff --git a/js/prefs.js b/js/prefs.js index dafdbcdee..c89c0494f 100755 --- a/js/prefs.js +++ b/js/prefs.js @@ -58,10 +58,6 @@ require(["dojo/_base/kernel", try { const _App = declare("fox.App", AppBase, { constructor: function() { - window.onerror = function (message, filename, lineno, colno, error) { - report_error(message, filename, lineno, colno, error); - }; - parser.parse(); this.setLoadingProgress(50); @@ -73,7 +69,7 @@ require(["dojo/_base/kernel", try { this.backendSanityCallback(transport); } catch (e) { - exception_error(e); + this.Error.report(e); } }); }, @@ -149,7 +145,7 @@ require(["dojo/_base/kernel", App = new _App(); } catch (e) { - exception_error(e); + this.Error.report(e); } }); }); \ No newline at end of file diff --git a/js/tt-rss.js b/js/tt-rss.js index 97d34fbc1..8931e9860 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -65,10 +65,6 @@ require(["dojo/_base/kernel", _widescreen_mode: false, hotkey_actions: {}, constructor: function () { - window.onerror = function (message, filename, lineno, colno, error) { - report_error(message, filename, lineno, colno, error); - }; - parser.parse(); this.setLoadingProgress(30); @@ -91,7 +87,7 @@ require(["dojo/_base/kernel", try { App.backendSanityCallback(transport); } catch (e) { - exception_error(e); + App.Error.report(e); } }); }, @@ -555,7 +551,7 @@ require(["dojo/_base/kernel", App = new _App(); } catch (e) { - exception_error(e); + App.Error.report(e); } }); }); diff --git a/plugins/embed_original/init.js b/plugins/embed_original/init.js index 6f797556b..1e9fcb253 100644 --- a/plugins/embed_original/init.js +++ b/plugins/embed_original/init.js @@ -1,60 +1,56 @@ function embedOriginalArticle(id) { - try { - const hasSandbox = "sandbox" in document.createElement("iframe"); + const hasSandbox = "sandbox" in document.createElement("iframe"); - if (!hasSandbox) { - alert(__("Sorry, your browser does not support sandboxed iframes.")); - return; - } + if (!hasSandbox) { + alert(__("Sorry, your browser does not support sandboxed iframes.")); + return; + } - let c = false; + let c = false; + + if (App.isCombinedMode()) { + c = $$("div#RROW-" + id + " div[class=content-inner]")[0]; + } else if (id == Article.getActive()) { + c = $$(".post .content")[0]; + } + + if (c) { + const iframe = c.parentNode.getElementsByClassName("embeddedContent")[0]; + + if (iframe) { + Element.show(c); + c.parentNode.removeChild(iframe); + + if (App.isCombinedMode()) { + Article.cdmScrollToId(id, true); + } - if (App.isCombinedMode()) { - c = $$("div#RROW-" + id + " div[class=content-inner]")[0]; - } else if (id == Article.getActive()) { - c = $$(".post .content")[0]; + return; } + } - if (c) { - const iframe = c.parentNode.getElementsByClassName("embeddedContent")[0]; + const query = { op: "pluginhandler", plugin: "embed_original", method: "getUrl", id: id }; - if (iframe) { - Element.show(c); - c.parentNode.removeChild(iframe); + xhrJson("backend.php", query, (reply) => { + if (reply) { + const iframe = new Element("iframe", { + class: "embeddedContent", + src: reply.url, + width: (c.parentNode.offsetWidth - 5) + 'px', + height: (c.parentNode.parentNode.offsetHeight - c.parentNode.firstChild.offsetHeight - 5) + 'px', + style: "overflow: auto; border: none; min-height: " + (document.body.clientHeight / 2) + "px;", + sandbox: 'allow-scripts', + }); + + if (c) { + Element.hide(c); + c.parentNode.insertBefore(iframe, c); if (App.isCombinedMode()) { Article.cdmScrollToId(id, true); } - - return; } } + }); - const query = { op: "pluginhandler", plugin: "embed_original", method: "getUrl", id: id }; - - xhrJson("backend.php", query, (reply) => { - if (reply) { - const iframe = new Element("iframe", { - class: "embeddedContent", - src: reply.url, - width: (c.parentNode.offsetWidth - 5) + 'px', - height: (c.parentNode.parentNode.offsetHeight - c.parentNode.firstChild.offsetHeight - 5) + 'px', - style: "overflow: auto; border: none; min-height: " + (document.body.clientHeight / 2) + "px;", - sandbox: 'allow-scripts', - }); - - if (c) { - Element.hide(c); - c.parentNode.insertBefore(iframe, c); - - if (App.isCombinedMode()) { - Article.cdmScrollToId(id, true); - } - } - } - }); - - } catch (e) { - exception_error("embedOriginalArticle", e); - } } diff --git a/plugins/import_export/import_export.js b/plugins/import_export/import_export.js index 56a2a5c3e..8dc5f7570 100644 --- a/plugins/import_export/import_export.js +++ b/plugins/import_export/import_export.js @@ -50,7 +50,7 @@ function exportData() { "Error occured, could not export data."; } } catch (e) { - exception_error("exportData", e, transport.responseText); + App.Error.report(e); } Notify.close(); @@ -71,7 +71,7 @@ function exportData() { } catch (e) { - exception_error("exportData", e); + App.Error.report(e); } } @@ -100,7 +100,7 @@ function dataImportComplete(iframe) { dialog.show(); } catch (e) { - exception_error("dataImportComplete", e); + App.Error.report(e); } } diff --git a/plugins/mail/mail.js b/plugins/mail/mail.js index b72289c2a..87e354b42 100644 --- a/plugins/mail/mail.js +++ b/plugins/mail/mail.js @@ -1,57 +1,52 @@ function emailArticle(id) { - try { - if (!id) { - var ids = Headlines.getSelected(); + if (!id) { + let ids = Headlines.getSelected(); - if (ids.length == 0) { - alert(__("No articles selected.")); - return; - } - - id = ids.toString(); + if (ids.length == 0) { + alert(__("No articles selected.")); + return; } - if (dijit.byId("emailArticleDlg")) - dijit.byId("emailArticleDlg").destroyRecursive(); - - var query = "backend.php?op=pluginhandler&plugin=mail&method=emailArticle¶m=" + encodeURIComponent(id); - - dialog = new dijit.Dialog({ - id: "emailArticleDlg", - title: __("Forward article by email"), - style: "width: 600px", - execute: function() { - if (this.validate()) { - xhrJson("backend.php", this.attr('value'), (reply) => { - if (reply) { - const error = reply['error']; - - if (error) { - alert(__('Error sending email:') + ' ' + error); - } else { - Notify.info('Your message has been sent.'); - dialog.hide(); - } + id = ids.toString(); + } + if (dijit.byId("emailArticleDlg")) + dijit.byId("emailArticleDlg").destroyRecursive(); + + const query = "backend.php?op=pluginhandler&plugin=mail&method=emailArticle¶m=" + encodeURIComponent(id); + + const dialog = new dijit.Dialog({ + id: "emailArticleDlg", + title: __("Forward article by email"), + style: "width: 600px", + execute: function() { + if (this.validate()) { + xhrJson("backend.php", this.attr('value'), (reply) => { + if (reply) { + const error = reply['error']; + + if (error) { + alert(__('Error sending email:') + ' ' + error); + } else { + Notify.info('Your message has been sent.'); + dialog.hide(); } - }); - } - }, - href: query}); - /* var tmph = dojo.connect(dialog, 'onLoad', function() { - dojo.disconnect(tmph); + } + }); + } + }, + href: query}); - new Ajax.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices', - "backend.php?op=pluginhandler&plugin=mail&method=completeEmails", - { tokens: '', paramName: "search" }); - }); */ + /* var tmph = dojo.connect(dialog, 'onLoad', function() { + dojo.disconnect(tmph); - dialog.show(); + new Ajax.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices', + "backend.php?op=pluginhandler&plugin=mail&method=completeEmails", + { tokens: '', paramName: "search" }); + }); */ - } catch (e) { - exception_error("emailArticle", e); - } + dialog.show(); } diff --git a/plugins/mailto/init.js b/plugins/mailto/init.js index dacff725e..92a90f8e9 100644 --- a/plugins/mailto/init.js +++ b/plugins/mailto/init.js @@ -1,32 +1,27 @@ function mailtoArticle(id) { - try { - if (!id) { - const ids = Headlines.getSelected(); + if (!id) { + const ids = Headlines.getSelected(); - if (ids.length == 0) { - alert(__("No articles selected.")); - return; - } - - id = ids.toString(); + if (ids.length == 0) { + alert(__("No articles selected.")); + return; } - if (dijit.byId("emailArticleDlg")) - dijit.byId("emailArticleDlg").destroyRecursive(); + id = ids.toString(); + } - const query = "backend.php?op=pluginhandler&plugin=mailto&method=emailArticle¶m=" + encodeURIComponent(id); + if (dijit.byId("emailArticleDlg")) + dijit.byId("emailArticleDlg").destroyRecursive(); - dialog = new dijit.Dialog({ - id: "emailArticleDlg", - title: __("Forward article by email"), - style: "width: 600px", - href: query}); + const query = "backend.php?op=pluginhandler&plugin=mailto&method=emailArticle¶m=" + encodeURIComponent(id); - dialog.show(); + const dialog = new dijit.Dialog({ + id: "emailArticleDlg", + title: __("Forward article by email"), + style: "width: 600px", + href: query}); - } catch (e) { - exception_error("emailArticle", e); - } + dialog.show(); } diff --git a/plugins/nsfw/init.js b/plugins/nsfw/init.js index 40ad2b0ba..adb6d43c0 100644 --- a/plugins/nsfw/init.js +++ b/plugins/nsfw/init.js @@ -1,12 +1,7 @@ function nsfwShow(elem) { - try { - content = elem.parentNode.getElementsBySelector("div.nswf.content")[0]; + let content = elem.parentNode.getElementsBySelector("div.nswf.content")[0]; - if (content) { - Element.toggle(content); - } - - } catch (e) { - exception_error("nswfSHow", e); + if (content) { + Element.toggle(content); } } diff --git a/plugins/shorten_expanded/init.js b/plugins/shorten_expanded/init.js index d9995e8ac..a5424ea38 100644 --- a/plugins/shorten_expanded/init.js +++ b/plugins/shorten_expanded/init.js @@ -1,29 +1,20 @@ var _shorten_expanded_threshold = 1.5; //window heights function expandSizeWrapper(id) { - try { - const row = $(id); + const row = $(id); - console.log(row); + if (row) { + const content = row.select(".contentSizeWrapper")[0]; + const link = row.select(".expandPrompt")[0]; - if (row) { - const content = row.select(".contentSizeWrapper")[0]; - const link = row.select(".expandPrompt")[0]; - - if (content) content.removeClassName("contentSizeWrapper"); - if (link) Element.hide(link); - - } - } catch (e) { - exception_error("expandSizeWrapper", e); + if (content) content.removeClassName("contentSizeWrapper"); + if (link) Element.hide(link); } return false; - } require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) { - ready(function() { PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function(row) { window.setTimeout(function() { @@ -48,5 +39,4 @@ require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) { return true; }); }); - }); diff --git a/register.php b/register.php index 6c76eed5a..1bd1b2544 100644 --- a/register.php +++ b/register.php @@ -135,13 +135,13 @@ f.sub_btn.disabled = true; } } catch (e) { - exception_error("checkUsername_callback", e); + App.Error.report(e); } } }); } catch (e) { - exception_error("checkUsername", e); + App.Error.report(e); } return false; @@ -171,7 +171,7 @@ return true; } catch (e) { - exception_error("validateRegForm", e); + alert(e.stack); return false; } } -- cgit v1.2.3-54-g00ecf