diff options
author | Andrew Dolgov <[email protected]> | 2018-12-03 15:46:54 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-12-03 15:46:54 +0300 |
commit | 4cb3a601a0fbeb0bf98c932bd5af8a3cffa8ab64 (patch) | |
tree | ed3dae8894591be12287b3cce3ff5b4cc6d1ce0e /plugins | |
parent | cd0a39ea4cb7137aef5b225bdc4472d207a48e62 (diff) | |
parent | 98986ce066764158c045c3e23b69e98183b94236 (diff) |
Merge branch 'js-objects' into weblate-integration
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/af_psql_trgm/init.js | 14 | ||||
-rw-r--r-- | plugins/af_psql_trgm/init.php | 8 | ||||
-rwxr-xr-x | plugins/af_readability/init.php | 4 | ||||
-rwxr-xr-x | plugins/af_redditimgur/init.php | 2 | ||||
-rwxr-xr-x | plugins/af_zz_imgproxy/init.php | 2 | ||||
-rw-r--r-- | plugins/close_button/init.php | 2 | ||||
-rw-r--r-- | plugins/embed_original/init.js | 88 | ||||
-rw-r--r-- | plugins/import_export/import_export.js | 14 | ||||
-rw-r--r-- | plugins/mail/init.php | 4 | ||||
-rw-r--r-- | plugins/mail/mail.js | 31 | ||||
-rw-r--r-- | plugins/mailto/init.js | 22 | ||||
-rw-r--r-- | plugins/mailto/init.php | 2 | ||||
-rw-r--r-- | plugins/mark_button/init.php | 4 | ||||
-rw-r--r-- | plugins/no_title_counters/init.js | 2 | ||||
-rw-r--r-- | plugins/note/init.php | 2 | ||||
-rw-r--r-- | plugins/note/note.js | 45 | ||||
-rw-r--r-- | plugins/nsfw/init.js | 11 | ||||
-rw-r--r-- | plugins/nsfw/init.php | 2 | ||||
-rw-r--r-- | plugins/share/init.php | 4 | ||||
-rw-r--r-- | plugins/share/share.js | 33 | ||||
-rw-r--r-- | plugins/share/share_prefs.js | 25 | ||||
-rw-r--r-- | plugins/shorten_expanded/init.js | 22 | ||||
-rw-r--r-- | plugins/toggle_sidebar/init.php | 2 |
23 files changed, 158 insertions, 187 deletions
diff --git a/plugins/af_psql_trgm/init.js b/plugins/af_psql_trgm/init.js index f84bb4877..af337ca6b 100644 --- a/plugins/af_psql_trgm/init.js +++ b/plugins/af_psql_trgm/init.js @@ -1,7 +1,6 @@ -function showTrgmRelated(id) { - try { - - const query = "backend.php?op=pluginhandler&plugin=af_psql_trgm&method=showrelated¶m=" + param_escape(id); +Plugins.Psql_Trgm = { + showRelated: function (id) { + const query = "backend.php?op=pluginhandler&plugin=af_psql_trgm&method=showrelated¶m=" + encodeURIComponent(id); if (dijit.byId("trgmRelatedDlg")) dijit.byId("trgmRelatedDlg").destroyRecursive(); @@ -10,16 +9,13 @@ function showTrgmRelated(id) { id: "trgmRelatedDlg", title: __("Related articles"), style: "width: 600px", - execute: function() { + execute: function () { }, href: query, }); dialog.show(); - - } catch (e) { - exception_error("showTrgmRelated", e); } -} +}; diff --git a/plugins/af_psql_trgm/init.php b/plugins/af_psql_trgm/init.php index fe5b1a959..57ad355f9 100644 --- a/plugins/af_psql_trgm/init.php +++ b/plugins/af_psql_trgm/init.php @@ -93,7 +93,7 @@ class Af_Psql_Trgm extends Plugin { print " <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"$article_link\">". $line["title"]."</a>"; - print " (<a href=\"#\" onclick=\"viewfeed({feed:".$line["feed_id"]."})\">". + print " (<a href=\"#\" onclick=\"Feeds.open({feed:".$line["feed_id"]."})\">". htmlspecialchars($line["feed_title"])."</a>)"; print " <span class='insensitive'>($sm)</span>"; @@ -115,7 +115,7 @@ class Af_Psql_Trgm extends Plugin { function hook_article_button($line) { return "<img src=\"plugins/af_psql_trgm/button.png\" style=\"cursor : pointer\" style=\"cursor : pointer\" - onclick=\"showTrgmRelated(".$line["id"].")\" + onclick=\"Plugins.Psql_Trgm.showRelated(".$line["id"].")\" class='tagsPic' title='".__('Show related articles')."'>"; } @@ -150,7 +150,7 @@ class Af_Psql_Trgm extends Plugin { new Ajax.Request('backend.php', { parameters: dojo.objectToQuery(this.getValues()), onComplete: function(transport) { - notify_info(transport.responseText); + Notify.info(transport.responseText); } }); //this.reset(); @@ -202,7 +202,7 @@ class Af_Psql_Trgm extends Plugin { print "<li>" . "<img src='images/pub_set.png' style='vertical-align : middle'> <a href='#' - onclick='editFeed($f)'>" . + onclick='CommonDialogs.editFeed($f)'>" . Feeds::getFeedTitle($f) . "</a></li>"; } print "</ul>"; diff --git a/plugins/af_readability/init.php b/plugins/af_readability/init.php index cccdf8af7..8c17738c9 100755 --- a/plugins/af_readability/init.php +++ b/plugins/af_readability/init.php @@ -61,7 +61,7 @@ class Af_Readability extends Plugin { new Ajax.Request('backend.php', { parameters: dojo.objectToQuery(this.getValues()), onComplete: function(transport) { - notify_info(transport.responseText); + Notify.info(transport.responseText); } }); //this.reset(); @@ -94,7 +94,7 @@ class Af_Readability extends Plugin { print "<li>" . "<img src='images/pub_set.png' style='vertical-align : middle'> <a href='#' - onclick='editFeed($f)'>". + onclick='CommonDialogs.editFeed($f)'>". Feeds::getFeedTitle($f) . "</a></li>"; } print "</ul>"; diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php index 2b8415dd0..1958e83be 100755 --- a/plugins/af_redditimgur/init.php +++ b/plugins/af_redditimgur/init.php @@ -45,7 +45,7 @@ class Af_RedditImgur extends Plugin { new Ajax.Request('backend.php', { parameters: dojo.objectToQuery(this.getValues()), onComplete: function(transport) { - notify_info(transport.responseText); + Notify.info(transport.responseText); } }); //this.reset(); diff --git a/plugins/af_zz_imgproxy/init.php b/plugins/af_zz_imgproxy/init.php index 1c1e99ae4..ca49e94a7 100755 --- a/plugins/af_zz_imgproxy/init.php +++ b/plugins/af_zz_imgproxy/init.php @@ -216,7 +216,7 @@ class Af_Zz_ImgProxy extends Plugin { new Ajax.Request('backend.php', { parameters: dojo.objectToQuery(this.getValues()), onComplete: function(transport) { - notify_info(transport.responseText); + Notify.info(transport.responseText); } }); //this.reset(); diff --git a/plugins/close_button/init.php b/plugins/close_button/init.php index 66d2af679..8678d577c 100644 --- a/plugins/close_button/init.php +++ b/plugins/close_button/init.php @@ -21,7 +21,7 @@ class Close_Button extends Plugin { if (!get_pref("COMBINED_DISPLAY_MODE")) { $rv = "<img src=\"plugins/close_button/button.png\" class='tagsPic' style=\"cursor : pointer\" - onclick=\"closeArticlePanel()\" + onclick=\"Article.close()\" title='".__('Close article')."'>"; } diff --git a/plugins/embed_original/init.js b/plugins/embed_original/init.js index 3c48b507e..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; - } - - let c = false; + if (!hasSandbox) { + alert(__("Sorry, your browser does not support sandboxed iframes.")); + return; + } - if (isCombinedMode()) { - c = $$("div#RROW-" + id + " div[class=content-inner]")[0]; - } else if (id == getActiveArticleId()) { - c = $$(".post .content")[0]; - } + let c = false; - if (c) { - const iframe = c.parentNode.getElementsByClassName("embeddedContent")[0]; + if (App.isCombinedMode()) { + c = $$("div#RROW-" + id + " div[class=content-inner]")[0]; + } else if (id == Article.getActive()) { + c = $$(".post .content")[0]; + } - if (iframe) { - Element.show(c); - c.parentNode.removeChild(iframe); + if (c) { + const iframe = c.parentNode.getElementsByClassName("embeddedContent")[0]; - if (isCombinedMode()) { - cdmScrollToArticleId(id, true); - } + if (iframe) { + Element.show(c); + c.parentNode.removeChild(iframe); - return; + 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 (isCombinedMode()) { - cdmScrollToArticleId(id, true); - } + 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 780f6bfc7..8dc5f7570 100644 --- a/plugins/import_export/import_export.js +++ b/plugins/import_export/import_export.js @@ -14,7 +14,7 @@ function exportData() { style: "width: 600px", prepare: function() { - notify_progress("Loading, please wait..."); + Notify.progress("Loading, please wait..."); new Ajax.Request("backend.php", { parameters: "op=pluginhandler&plugin=import_export&method=exportrun&offset=" + exported, @@ -50,10 +50,10 @@ function exportData() { "Error occured, could not export data."; } } catch (e) { - exception_error("exportData", e, transport.responseText); + App.Error.report(e); } - notify(''); + Notify.close(); } }); @@ -71,7 +71,7 @@ function exportData() { } catch (e) { - exception_error("exportData", e); + App.Error.report(e); } } @@ -81,7 +81,7 @@ function dataImportComplete(iframe) { Element.hide(iframe); - notify(''); + Notify.close(); if (dijit.byId('dataImportDlg')) dijit.byId('dataImportDlg').destroyRecursive(); @@ -100,7 +100,7 @@ function dataImportComplete(iframe) { dialog.show(); } catch (e) { - exception_error("dataImportComplete", e); + App.Error.report(e); } } @@ -112,7 +112,7 @@ function importData() { alert(__("Please choose the file first.")); return false; } else { - notify_progress("Importing, please wait...", true); + Notify.progress("Importing, please wait...", true); Element.show("data_upload_iframe"); diff --git a/plugins/mail/init.php b/plugins/mail/init.php index 5294931c7..1609a05c3 100644 --- a/plugins/mail/init.php +++ b/plugins/mail/init.php @@ -45,7 +45,7 @@ class Mail extends Plugin { new Ajax.Request('backend.php', { parameters: dojo.objectToQuery(this.getValues()), onComplete: function(transport) { - notify_info(transport.responseText); + Notify.info(transport.responseText); } }); //this.reset(); @@ -72,7 +72,7 @@ class Mail extends Plugin { function hook_article_button($line) { return "<img src=\"plugins/mail/mail.png\" class='tagsPic' style=\"cursor : pointer\" - onclick=\"emailArticle(".$line["id"].")\" + onclick=\"Plugins.Mail.send(".$line["id"].")\" alt='Zoom' title='".__('Forward by email')."'>"; } diff --git a/plugins/mail/mail.js b/plugins/mail/mail.js index 929b35243..eb7b7e6b6 100644 --- a/plugins/mail/mail.js +++ b/plugins/mail/mail.js @@ -1,10 +1,10 @@ -function emailArticle(id) { - try { +Plugins.Mail = { + send: function(id) { if (!id) { - var ids = getSelectedArticleIds2(); + let ids = Headlines.getSelected(); if (ids.length == 0) { - alert(__("No articles are selected.")); + alert(__("No articles selected.")); return; } @@ -14,13 +14,13 @@ function emailArticle(id) { if (dijit.byId("emailArticleDlg")) dijit.byId("emailArticleDlg").destroyRecursive(); - var query = "backend.php?op=pluginhandler&plugin=mail&method=emailArticle¶m=" + param_escape(id); + const query = "backend.php?op=pluginhandler&plugin=mail&method=emailArticle¶m=" + encodeURIComponent(id); - dialog = new dijit.Dialog({ + const dialog = new dijit.Dialog({ id: "emailArticleDlg", title: __("Forward article by email"), style: "width: 600px", - execute: function() { + execute: function () { if (this.validate()) { xhrJson("backend.php", this.attr('value'), (reply) => { if (reply) { @@ -29,7 +29,7 @@ function emailArticle(id) { if (error) { alert(__('Error sending email:') + ' ' + error); } else { - notify_info('Your message has been sent.'); + Notify.info('Your message has been sent.'); dialog.hide(); } @@ -37,10 +37,11 @@ function emailArticle(id) { }); } }, - href: query}); + href: query + }); /* var tmph = dojo.connect(dialog, 'onLoad', function() { - dojo.disconnect(tmph); + dojo.disconnect(tmph); new Ajax.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices', "backend.php?op=pluginhandler&plugin=mail&method=completeEmails", @@ -48,10 +49,8 @@ function emailArticle(id) { }); */ dialog.show(); - - } catch (e) { - exception_error("emailArticle", e); + }, + onHotkey: function(id) { + Plugins.Mail.send(id); } -} - - +}; diff --git a/plugins/mailto/init.js b/plugins/mailto/init.js index 272b8cea7..f81f70fc7 100644 --- a/plugins/mailto/init.js +++ b/plugins/mailto/init.js @@ -1,10 +1,10 @@ -function mailtoArticle(id) { - try { +Plugins.Mailto = { + send: function (id) { if (!id) { - const ids = getSelectedArticleIds2(); + const ids = Headlines.getSelected(); if (ids.length == 0) { - alert(__("No articles are selected.")); + alert(__("No articles selected.")); return; } @@ -14,19 +14,21 @@ function mailtoArticle(id) { if (dijit.byId("emailArticleDlg")) dijit.byId("emailArticleDlg").destroyRecursive(); - const query = "backend.php?op=pluginhandler&plugin=mailto&method=emailArticle¶m=" + param_escape(id); + const query = "backend.php?op=pluginhandler&plugin=mailto&method=emailArticle¶m=" + encodeURIComponent(id); - dialog = new dijit.Dialog({ + const dialog = new dijit.Dialog({ id: "emailArticleDlg", title: __("Forward article by email"), style: "width: 600px", href: query}); dialog.show(); - - } catch (e) { - exception_error("emailArticle", e); } -} +}; +// override default hotkey action if enabled +Plugins.Mail = Plugins.Mail || {}; +Plugins.Mail.onHotkey = function(id) { + Plugins.Mailto.send(id); +};
\ No newline at end of file diff --git a/plugins/mailto/init.php b/plugins/mailto/init.php index 60c58b707..3dbc8d643 100644 --- a/plugins/mailto/init.php +++ b/plugins/mailto/init.php @@ -21,7 +21,7 @@ class MailTo extends Plugin { function hook_article_button($line) { return "<img src=\"plugins/mailto/mail.png\" class='tagsPic' style=\"cursor : pointer\" - onclick=\"mailtoArticle(".$line["id"].")\" + onclick=\"Plugins.Mailto.send(".$line["id"].")\" alt='Zoom' title='".__('Forward by email')."'>"; } diff --git a/plugins/mark_button/init.php b/plugins/mark_button/init.php index 2b8fa9242..8f05d1ada 100644 --- a/plugins/mark_button/init.php +++ b/plugins/mark_button/init.php @@ -23,12 +23,12 @@ class Mark_Button extends Plugin { $marked_pic = "<img src=\"images/mark_set.png\" class=\"marked-pic marked-$id\" alt=\"Unstar article\" - onclick='toggleMark($id)'>"; + onclick='Headlines.toggleMark($id)'>"; } else { $marked_pic = "<img src=\"images/mark_unset.png\" class=\"marked-pic marked-$id\" alt=\"Star article\" - onclick='toggleMark($id)'>"; + onclick='Headlines.toggleMark($id)'>"; } } diff --git a/plugins/no_title_counters/init.js b/plugins/no_title_counters/init.js index 06edfb3ba..1170bf3ef 100644 --- a/plugins/no_title_counters/init.js +++ b/plugins/no_title_counters/init.js @@ -1,6 +1,6 @@ require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) { ready(function () { - updateTitle = function () { + App.updateTitle = function () { document.title = "Tiny Tiny RSS"; }; }); diff --git a/plugins/note/init.php b/plugins/note/init.php index 354591b75..ac908a5ba 100644 --- a/plugins/note/init.php +++ b/plugins/note/init.php @@ -24,7 +24,7 @@ class Note extends Plugin { function hook_article_button($line) { return "<img src=\"plugins/note/note.png\" style=\"cursor : pointer\" style=\"cursor : pointer\" - onclick=\"editArticleNote(".$line["id"].")\" + onclick=\"Plugins.Note.edit(".$line["id"].")\" class='tagsPic' title='".__('Edit article note')."'>"; } diff --git a/plugins/note/note.js b/plugins/note/note.js index bf69a680e..21c1ae51e 100644 --- a/plugins/note/note.js +++ b/plugins/note/note.js @@ -1,46 +1,41 @@ -function editArticleNote(id) { - try { - - var query = "backend.php?op=pluginhandler&plugin=note&method=edit¶m=" + param_escape(id); +Plugins.Note = { + edit: function(id) { + const query = "backend.php?op=pluginhandler&plugin=note&method=edit¶m=" + encodeURIComponent(id); if (dijit.byId("editNoteDlg")) dijit.byId("editNoteDlg").destroyRecursive(); - dialog = new dijit.Dialog({ + const dialog = new dijit.Dialog({ id: "editNoteDlg", title: __("Edit article note"), style: "width: 600px", - execute: function() { + execute: function () { if (this.validate()) { - notify_progress("Saving article note...", true); + Notify.progress("Saving article note...", true); xhrJson("backend.php", this.attr('value'), (reply) => { - notify(''); - dialog.hide(); + Notify.close(); + dialog.hide(); - if (reply) { - cache_delete("article:" + id); + if (reply) { + ArticleCache.del(id); - var elem = $("POSTNOTE-" + id); + var elem = $("POSTNOTE-" + id); - if (elem) { - Element.hide(elem); - elem.innerHTML = reply.note; + if (elem) { + Element.hide(elem); + elem.innerHTML = reply.note; - if (reply.raw_length != 0) - new Effect.Appear(elem); - } - } - }); + if (reply.raw_length != 0) + new Effect.Appear(elem); + } + } + }); } }, href: query, }); dialog.show(); - - } catch (e) { - exception_error("editArticleNote", e); } -} - +};
\ No newline at end of file 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/nsfw/init.php b/plugins/nsfw/init.php index 6a1ae3c65..53b9ee479 100644 --- a/plugins/nsfw/init.php +++ b/plugins/nsfw/init.php @@ -63,7 +63,7 @@ class NSFW extends Plugin { new Ajax.Request('backend.php', { parameters: dojo.objectToQuery(this.getValues()), onComplete: function(transport) { - notify_info(transport.responseText); + Notify.info(transport.responseText); } }); //this.reset(); diff --git a/plugins/share/init.php b/plugins/share/init.php index 94571bb1b..6ac08b751 100644 --- a/plugins/share/init.php +++ b/plugins/share/init.php @@ -40,7 +40,7 @@ class Share extends Plugin { print "<p>" . __("You can disable all articles shared by unique URLs here.") . "</p>"; - print "<button class=\"btn-danger\" dojoType=\"dijit.form.Button\" onclick=\"return clearArticleAccessKeys()\">". + print "<button class=\"btn-danger\" dojoType=\"dijit.form.Button\" onclick=\"return Plugins.Share.clearKeys()\">". __('Unshare all articles')."</button> "; print "</p>"; @@ -74,7 +74,7 @@ class Share extends Plugin { return "<img id='SHARE-IMG-".$line['int_id']."' src=\"plugins/share/$img\" class='tagsPic' style=\"cursor : pointer\" - onclick=\"shareArticle(".$line['int_id'].")\" + onclick=\"Plugins.Share.shareArticle(".$line['int_id'].")\" title='".__('Share by URL')."'>"; } diff --git a/plugins/share/share.js b/plugins/share/share.js index 11748d8fe..7366c2aff 100644 --- a/plugins/share/share.js +++ b/plugins/share/share.js @@ -1,20 +1,20 @@ -function shareArticle(id) { - try { +Plugins.Share = { + shareArticle: function(id) { if (dijit.byId("shareArticleDlg")) dijit.byId("shareArticleDlg").destroyRecursive(); - var query = "backend.php?op=pluginhandler&plugin=share&method=shareArticle¶m=" + param_escape(id); + const query = "backend.php?op=pluginhandler&plugin=share&method=shareArticle¶m=" + encodeURIComponent(id); - dialog = new dijit.Dialog({ + const dialog = new dijit.Dialog({ id: "shareArticleDlg", title: __("Share article by URL"), style: "width: 600px", - newurl: function() { + newurl: function () { if (confirm(__("Generate new share URL for this article?"))) { - notify_progress("Trying to change URL...", true); + Notify.progress("Trying to change URL...", true); - const query = { op: "pluginhandler", plugin: "share", method: "newkey", id: id }; + const query = {op: "pluginhandler", plugin: "share", method: "newkey", id: id}; xhrJson("backend.php", query, (reply) => { if (reply) { @@ -34,22 +34,22 @@ function shareArticle(id) { const img = $("SHARE-IMG-" + id); if (img) img.src = img.src.replace("notshared.png", "share.png"); - notify(''); + Notify.close(); } else { - notify_error("Could not change URL."); + Notify.error("Could not change URL."); } } }); } }, - unshare: function() { + unshare: function () { if (confirm(__("Remove sharing for this article?"))) { - notify_progress("Trying to unshare...", true); + Notify.progress("Trying to unshare...", true); - const query = { op: "pluginhandler", plugin: "share", method: "unshare", id: id }; + const query = {op: "pluginhandler", plugin: "share", method: "unshare", id: id}; xhrPost("backend.php", query, () => { notify("Article unshared."); @@ -62,16 +62,15 @@ function shareArticle(id) { } }, - href: query}); + href: query + }); dialog.show(); const img = $("SHARE-IMG-" + id); if (img) img.src = img.src.replace("notshared.png", "share.png"); - - } catch (e) { - exception_error("shareArticle", e); } -} +}; + diff --git a/plugins/share/share_prefs.js b/plugins/share/share_prefs.js index 79ca37284..071a6667c 100644 --- a/plugins/share/share_prefs.js +++ b/plugins/share/share_prefs.js @@ -1,16 +1,15 @@ -function clearArticleAccessKeys() { - if (confirm(__("This will invalidate all previously shared article URLs. Continue?"))) { - notify_progress("Clearing URLs..."); - - const query = { op: "pluginhandler", plugin: "share", method: "clearArticleKeys" }; - - xhrPost("backend.php", query, () => { - notify_info("Shared URLs cleared."); - }); - } - - return false; -} +Plugins.Share = { + clearKeys: function() { + if (confirm(__("This will invalidate all previously shared article URLs. Continue?"))) { + Notify.progress("Clearing URLs..."); + const query = {op: "pluginhandler", plugin: "share", method: "clearArticleKeys"}; + xhrPost("backend.php", query, () => { + Notify.info("Shared URLs cleared."); + }); + } + return false; + } +}; 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/plugins/toggle_sidebar/init.php b/plugins/toggle_sidebar/init.php index b2b0821a5..e3b2acbb3 100644 --- a/plugins/toggle_sidebar/init.php +++ b/plugins/toggle_sidebar/init.php @@ -18,7 +18,7 @@ class Toggle_Sidebar extends Plugin { function hook_main_toolbar_button() { ?> - <button dojoType="dijit.form.Button" onclick="collapse_feedlist()"> + <button dojoType="dijit.form.Button" onclick="Feeds.toggle()"> <img src="plugins/toggle_sidebar/application_side_list.png" title="<?php echo __('Collapse feedlist') ?>"> </button> |