refactor error reporting to AppBase; keep exception_error() for now as a shim
parent
a049b5bd88
commit
71fc6d45bd
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue