From a479f3efe7f5108a3ca41d39dfd490e9ca221973 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 21 Mar 2013 16:36:48 +0400 Subject: add embed_original plugin --- plugins/embed_original/button.png | Bin 0 -> 1298 bytes plugins/embed_original/init.css | 13 +++++++ plugins/embed_original/init.js | 69 ++++++++++++++++++++++++++++++++++++++ plugins/embed_original/init.php | 56 +++++++++++++++++++++++++++++++ 4 files changed, 138 insertions(+) create mode 100644 plugins/embed_original/button.png create mode 100644 plugins/embed_original/init.css create mode 100644 plugins/embed_original/init.js create mode 100644 plugins/embed_original/init.php (limited to 'plugins') diff --git a/plugins/embed_original/button.png b/plugins/embed_original/button.png new file mode 100644 index 000000000..e861201d5 Binary files /dev/null and b/plugins/embed_original/button.png differ diff --git a/plugins/embed_original/init.css b/plugins/embed_original/init.css new file mode 100644 index 000000000..c2e2bb858 --- /dev/null +++ b/plugins/embed_original/init.css @@ -0,0 +1,13 @@ +div.cdmContentInner iframe.embeddedContent { + overflow : hidden; + width : 100%; + height : 300px; + border-width : 0px; +} + +div.postContent iframe.embeddedContent { + overflow : hidden; + width : 100%; + height : 100%; + border-width : 0px; +} diff --git a/plugins/embed_original/init.js b/plugins/embed_original/init.js new file mode 100644 index 000000000..c0ae64619 --- /dev/null +++ b/plugins/embed_original/init.js @@ -0,0 +1,69 @@ +function embedOriginalArticle(id) { + try { + var hasSandbox = "sandbox" in document.createElement("iframe"); + + if (!hasSandbox) { + alert(__("Sorry, your browser does not support sandboxed iframes.")); + return; + } + + var query = "op=pluginhandler&plugin=embed_original&method=getUrl&id=" + + param_escape(id); + + var c = false; + + if (isCdmMode()) { + c = $$("div#RROW-" + id + " div[class=cdmContentInner]")[0]; + } else if (id == getActiveArticleId()) { + c = $$("div[class=postContent]")[0]; + } + + if (c) { + var iframe = c.getElementsByClassName("embeddedContent")[0]; + + if (iframe) { + Element.show(c.firstChild); + c.removeChild(iframe); + + if (isCdmMode()) { + cdmScrollToArticleId(id, true); + } + + return; + } + } + + new Ajax.Request("backend.php", { + parameters: query, + onComplete: function(transport) { + var ti = JSON.parse(transport.responseText); + + if (ti) { + + var iframe = new Element("iframe", { + class: "embeddedContent", + src: ti.url, + sandbox: 'sandbox', + }); + + if (c) { + Element.hide(c.firstChild); + + if (c.firstChild.nextSibling) + c.insertBefore(iframe, c.firstChild.nextSibling); + else + c.appendChild(iframe); + + if (isCdmMode()) { + cdmScrollToArticleId(id, true); + } + } + } + + } }); + + + } catch (e) { + exception_error("embedOriginalArticle", e); + } +} diff --git a/plugins/embed_original/init.php b/plugins/embed_original/init.php new file mode 100644 index 000000000..b28b2f8ee --- /dev/null +++ b/plugins/embed_original/init.php @@ -0,0 +1,56 @@ +link = $host->get_link(); + $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 = ""; + + return $rv; + } + + function getUrl() { + $id = db_escape_string($_REQUEST['id']); + + $result = db_query($this->link, "SELECT link + FROM ttrss_entries, ttrss_user_entries + WHERE id = '$id' AND ref_id = id AND owner_uid = " .$_SESSION['uid']); + + $url = ""; + + if (db_num_rows($result) != 0) { + $url = db_fetch_result($result, 0, "link"); + + } + + print json_encode(array("url" => $url, "id" => $id)); + } + +} +?> -- cgit v1.2.3 From 3873151bcb9fb24d45c5998f743507064642c62c Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 21 Mar 2013 16:39:57 +0400 Subject: minor tweaks to embed_original --- plugins/embed_original/init.css | 2 +- plugins/embed_original/init.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/embed_original/init.css b/plugins/embed_original/init.css index c2e2bb858..4ce482e1a 100644 --- a/plugins/embed_original/init.css +++ b/plugins/embed_original/init.css @@ -1,7 +1,7 @@ div.cdmContentInner iframe.embeddedContent { overflow : hidden; width : 100%; - height : 300px; + height : 600px; border-width : 0px; } diff --git a/plugins/embed_original/init.js b/plugins/embed_original/init.js index c0ae64619..517f2cd54 100644 --- a/plugins/embed_original/init.js +++ b/plugins/embed_original/init.js @@ -43,7 +43,7 @@ function embedOriginalArticle(id) { var iframe = new Element("iframe", { class: "embeddedContent", src: ti.url, - sandbox: 'sandbox', + sandbox: 'allow-scripts', }); if (c) { -- cgit v1.2.3 From d4a5129a24d00efb773bbf4f7e39cd53072aaa46 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 21 Mar 2013 19:41:27 +0400 Subject: remove plugins/googlereadertheme --- plugins/googlereadertheme/init.css | 73 -------------------------------------- plugins/googlereadertheme/init.php | 27 -------------- 2 files changed, 100 deletions(-) delete mode 100644 plugins/googlereadertheme/init.css delete mode 100644 plugins/googlereadertheme/init.php (limited to 'plugins') diff --git a/plugins/googlereadertheme/init.css b/plugins/googlereadertheme/init.css deleted file mode 100644 index 8d5c8cefe..000000000 --- a/plugins/googlereadertheme/init.css +++ /dev/null @@ -1,73 +0,0 @@ -/* fix dijit */ -:focus { - outline: none; -} -input[type="search"] { - -webkit-appearance: none; -} -.claro .dijitToolbar .dijitButton .dijitButtonNode, -.claro .dijitToolbar .dijitDropDownButton .dijitButtonNode, -.claro .dijitToolbar .dijitComboButton .dijitButtonNode, -.claro .dijitToolbar .dijitToggleButton .dijitButtonNode, -.claro .dijitToolbar .dijitComboBox .dijitButtonNode { - -moz-transition: background-color, border-color, color; - -webkit-transition-property: background-color, border-color, color; - transition: background-color, border-color, color; -} - - -/* some style */ -body#ttrssMain, -a, -.titleWrap .title { - color: #444; -} -a:hover, -.Unread .titleWrap .title, -.Selected .titleWrap .title, -html div.cdmContent a { - color: #15c; -} -#feeds-holder, -#content-wrap, -#headlines-frame { - border: none; -} -#ttrssMain #headlines-toolbar, -#ttrssMain .dijitToolbar, -#ttrssMain .cdmHeader { - background: #fff; - border-color: transparent; -} -#ttrssMain #headlines-toolbar { - border-color: #ebebeb; -} -#ttrssMain .cdm { - margin: 5px 25px 10px 5px; - border: 1px solid #ddd !important; - box-shadow: 0 0 4px rgba(0,0,0,.1); - background: #fff !important; -} -#ttrssMain .cdm.Selected { - border-left-color: #4d90f0 !important; - background: #fff !important; -} -#ttrssMain .cdmFeedTitle { - border-color: #ebebeb; - background: #fff; - font-size: 1.2em; - font-weight: bold; -} -#headlines-frame .cdmFooter { - border-top: 1px solid #ebebeb; - background: #fafafa; -} - -.titleWrap .title { - font-size: 1.5em; - font-weight: bold; -} -div.cdmHeader span.hlFeed { - padding-top: .5em; -} - diff --git a/plugins/googlereadertheme/init.php b/plugins/googlereadertheme/init.php deleted file mode 100644 index 4ee4a4ba3..000000000 --- a/plugins/googlereadertheme/init.php +++ /dev/null @@ -1,27 +0,0 @@ -link = $host->get_link(); - $this->host = $host; - - if ($_SESSION["uid"]) { - // force-enable combined mode - set_pref($this->link, "COMBINED_DISPLAY_MODE", true, $_SESSION["uid"]); - } - } - - function get_css() { - return file_get_contents(dirname(__FILE__) . "/init.css"); - } -} -?> -- cgit v1.2.3