2013-03-21 12:36:48 +00:00
|
|
|
function embedOriginalArticle(id) {
|
2018-12-03 10:38:13 +00:00
|
|
|
const hasSandbox = "sandbox" in document.createElement("iframe");
|
2013-03-21 12:36:48 +00:00
|
|
|
|
2018-12-03 10:38:13 +00:00
|
|
|
if (!hasSandbox) {
|
|
|
|
alert(__("Sorry, your browser does not support sandboxed iframes."));
|
|
|
|
return;
|
|
|
|
}
|
2013-03-21 12:36:48 +00:00
|
|
|
|
2018-12-03 10:38:13 +00:00
|
|
|
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);
|
|
|
|
}
|
2013-03-21 12:36:48 +00:00
|
|
|
|
2018-12-03 10:38:13 +00:00
|
|
|
return;
|
2013-03-21 12:36:48 +00:00
|
|
|
}
|
2018-12-03 10:38:13 +00:00
|
|
|
}
|
2013-03-21 12:36:48 +00:00
|
|
|
|
2018-12-03 10:38:13 +00:00
|
|
|
const query = { op: "pluginhandler", plugin: "embed_original", method: "getUrl", id: id };
|
2013-03-21 12:36:48 +00:00
|
|
|
|
2018-12-03 10:38:13 +00:00
|
|
|
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);
|
2013-03-21 12:36:48 +00:00
|
|
|
|
2018-12-01 14:05:28 +00:00
|
|
|
if (App.isCombinedMode()) {
|
2018-12-02 05:32:13 +00:00
|
|
|
Article.cdmScrollToId(id, true);
|
2013-03-21 12:36:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-12-03 10:38:13 +00:00
|
|
|
});
|
2013-03-21 12:36:48 +00:00
|
|
|
|
|
|
|
}
|