2013-03-21 12:36:48 +00:00
|
|
|
function embedOriginalArticle(id) {
|
|
|
|
try {
|
2018-11-30 05:39:45 +00:00
|
|
|
const hasSandbox = "sandbox" in document.createElement("iframe");
|
2013-03-21 12:36:48 +00:00
|
|
|
|
|
|
|
if (!hasSandbox) {
|
|
|
|
alert(__("Sorry, your browser does not support sandboxed iframes."));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-11-30 05:39:45 +00:00
|
|
|
let c = false;
|
2013-03-21 12:36:48 +00:00
|
|
|
|
2018-12-01 14:05:28 +00:00
|
|
|
if (App.isCombinedMode()) {
|
2018-11-30 12:48:17 +00:00
|
|
|
c = $$("div#RROW-" + id + " div[class=content-inner]")[0];
|
2018-12-01 18:01:53 +00:00
|
|
|
} else if (id == Article.getActiveArticleId()) {
|
2018-11-30 12:54:38 +00:00
|
|
|
c = $$(".post .content")[0];
|
2013-03-21 12:36:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (c) {
|
2018-11-30 05:39:45 +00:00
|
|
|
const iframe = c.parentNode.getElementsByClassName("embeddedContent")[0];
|
2013-03-21 12:36:48 +00:00
|
|
|
|
|
|
|
if (iframe) {
|
2013-04-05 07:28:32 +00:00
|
|
|
Element.show(c);
|
|
|
|
c.parentNode.removeChild(iframe);
|
2013-03-21 12:36:48 +00:00
|
|
|
|
2018-12-01 14:05:28 +00:00
|
|
|
if (App.isCombinedMode()) {
|
2018-12-01 18:01:53 +00:00
|
|
|
Article.cdmScrollToArticleId(id, true);
|
2013-03-21 12:36:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-30 12:23:48 +00:00
|
|
|
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);
|
|
|
|
|
2018-12-01 14:05:28 +00:00
|
|
|
if (App.isCombinedMode()) {
|
2018-12-01 18:01:53 +00:00
|
|
|
Article.cdmScrollToArticleId(id, true);
|
2013-03-21 12:36:48 +00:00
|
|
|
}
|
|
|
|
}
|
2018-11-30 12:23:48 +00:00
|
|
|
}
|
|
|
|
});
|
2013-03-21 12:36:48 +00:00
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
exception_error("embedOriginalArticle", e);
|
|
|
|
}
|
|
|
|
}
|