diff options
author | Andrew Dolgov <[email protected]> | 2019-03-08 09:33:23 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2019-03-08 09:33:23 +0300 |
commit | 516d9d5e2cfe0c72cde857e876861761b107ed85 (patch) | |
tree | 25be5b0a07673aaf34587aa479782611fbd410d3 |
initial
-rwxr-xr-x | init.js | 37 | ||||
-rwxr-xr-x | init.php | 22 |
2 files changed, 59 insertions, 0 deletions
@@ -0,0 +1,37 @@ +require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) { + ready(function() { + Headlines.click = function (event, id, in_body) { + in_body = in_body || false; + + if (App.isCombinedMode()) { + + if (!in_body && (event.ctrlKey || id == Article.getActive() || App.getInitParam("cdm_expanded"))) { + Article.openInNewWindow(id); + Headlines.toggleUnread(id, 0); + return false; + } + + if (Article.getActive() != id) { + Article.setActive(id); + + if (!App.getInitParam("cdm_expanded")) + Article.cdmScrollToId(id); + } else if (in_body) { + Headlines.toggleUnread(id, 0); + } + + return in_body; + + } else { + if (event.ctrlKey) { + Article.openInNewWindow(id); + Headlines.toggleUnread(id, 0); + } else { + Article.view(id); + } + + return false; + } + } + }); +}); diff --git a/init.php b/init.php new file mode 100755 index 0000000..c72a63e --- /dev/null +++ b/init.php @@ -0,0 +1,22 @@ +<?php +class HL_Legacy extends Plugin { + private $host; + + function about() { + return array(1.0, + "Revert back to legacy headline click behavior", + "fox"); + } + + function init($host) { + $this->host = $host; + } + + function get_js() { + return file_get_contents(__DIR__ . "/init.js"); + } + + function api_version() { + return 2; + } +} |