mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 08:15:55 +00:00
refactor error reporting to AppBase; keep exception_error() for now as a shim
This commit is contained in:
@@ -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 (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 (!hasSandbox) {
|
||||
alert(__("Sorry, your browser does not support sandboxed iframes."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let c = false;
|
||||
const query = { op: "pluginhandler", plugin: "embed_original", method: "getUrl", id: id };
|
||||
|
||||
if (App.isCombinedMode()) {
|
||||
c = $$("div#RROW-" + id + " div[class=content-inner]")[0];
|
||||
} else if (id == Article.getActive()) {
|
||||
c = $$(".post .content")[0];
|
||||
}
|
||||
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) {
|
||||
const iframe = c.parentNode.getElementsByClassName("embeddedContent")[0];
|
||||
|
||||
if (iframe) {
|
||||
Element.show(c);
|
||||
c.parentNode.removeChild(iframe);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
href: query});
|
||||
|
||||
/* var tmph = dojo.connect(dialog, 'onLoad', function() {
|
||||
dojo.disconnect(tmph);
|
||||
|
||||
new Ajax.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices',
|
||||
"backend.php?op=pluginhandler&plugin=mail&method=completeEmails",
|
||||
{ tokens: '', paramName: "search" });
|
||||
}); */
|
||||
|
||||
dialog.show();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("emailArticle", e);
|
||||
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);
|
||||
|
||||
new Ajax.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices',
|
||||
"backend.php?op=pluginhandler&plugin=mail&method=completeEmails",
|
||||
{ tokens: '', paramName: "search" });
|
||||
}); */
|
||||
|
||||
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();
|
||||
|
||||
const query = "backend.php?op=pluginhandler&plugin=mailto&method=emailArticle¶m=" + encodeURIComponent(id);
|
||||
|
||||
dialog = new dijit.Dialog({
|
||||
id: "emailArticleDlg",
|
||||
title: __("Forward article by email"),
|
||||
style: "width: 600px",
|
||||
href: query});
|
||||
|
||||
dialog.show();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("emailArticle", e);
|
||||
id = ids.toString();
|
||||
}
|
||||
|
||||
if (dijit.byId("emailArticleDlg"))
|
||||
dijit.byId("emailArticleDlg").destroyRecursive();
|
||||
|
||||
const query = "backend.php?op=pluginhandler&plugin=mailto&method=emailArticle¶m=" + encodeURIComponent(id);
|
||||
|
||||
const dialog = new dijit.Dialog({
|
||||
id: "emailArticleDlg",
|
||||
title: __("Forward article by email"),
|
||||
style: "width: 600px",
|
||||
href: query});
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user