summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/embed_original/init.js86
-rw-r--r--plugins/import_export/import_export.js6
-rw-r--r--plugins/mail/mail.js83
-rw-r--r--plugins/mailto/init.js37
-rw-r--r--plugins/nsfw/init.js11
-rw-r--r--plugins/shorten_expanded/init.js22
6 files changed, 108 insertions, 137 deletions
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&param=" + 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&param=" + 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&param=" + 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&param=" + 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;
});
});
-
});