plugins/embed_original: move to attic repo

This commit is contained in:
Andrew Dolgov 2018-12-13 09:54:41 +03:00
parent d53cdaf815
commit e53959322b
4 changed files with 0 additions and 128 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1,13 +0,0 @@
div.cdmContentInner iframe.embeddedContent {
overflow : auto;
width : 100%;
height : 600px;
border-width : 0px;
}
div.postContent iframe.embeddedContent {
overflow : auto;
width : 100%;
height : 100%;
border-width : 0px;
}

View File

@ -1,56 +0,0 @@
function embedOriginalArticle(id) {
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);
}
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);
}
}
}
});
}

View File

@ -1,59 +0,0 @@
<?php
class Embed_Original extends Plugin {
/* @var PluginHost $host */
private $host;
function init($host) {
$this->host = $host;
$host->add_hook($host::HOOK_ARTICLE_BUTTON, $this);
}
function about() {
return array(1.0,
"Try to display original article content inside tt-rss",
"fox");
}
function get_js() {
return file_get_contents(dirname(__FILE__) . "/init.js");
}
function get_css() {
return file_get_contents(dirname(__FILE__) . "/init.css");
}
function hook_article_button($line) {
$id = $line["id"];
$rv = "<img src=\"plugins/embed_original/button.png\"
class='tagsPic' style=\"cursor : pointer\"
onclick=\"embedOriginalArticle($id)\"
title='".__('Toggle embed original')."'>";
return $rv;
}
function getUrl() {
$id = $_REQUEST['id'];
$sth = $this->pdo->prepare("SELECT link
FROM ttrss_entries, ttrss_user_entries
WHERE id = ? AND ref_id = id AND owner_uid = ?");
$sth->execute([$id, $_SESSION['uid']]);
if ($row = $sth->fetch()) {
$url = $row['link'];
} else {
$url = "";
}
print json_encode(array("url" => $url, "id" => $id));
}
function api_version() {
return 2;
}
}