-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinit.php
61 lines (49 loc) · 1.36 KB
/
init.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
class Article_Headline_Toggle extends Plugin {
function about() {
return [
1.6, // version
'Toggle article visibility by clicking on the headline', // description
'wn', // author
false, // is system
'https://www.github.com/supahgreg/ttrss-article-headline-toggle', // more info URL
];
}
function api_version() {
return 2;
}
function init($host) {
}
function get_css() {
return '#headlines-frame > div span.titleWrap { cursor: pointer; }';
}
function get_js() {
return <<<'JS'
require(['dojo/ready'], (ready) => {
ready(() => {
PluginHost.register(PluginHost.HOOK_RUNTIME_INFO_LOADED, () => {
// Do nothing if the user is forcing the expanded view
if (App.getInitParam('cdm_expanded')) return;
Headlines.click = (aEvent /*, aId, aInBody*/) => {
const id = aEvent.target.dataset.articleId || aEvent.target.parentNode.dataset.articleId;
if (!id || aEvent.ctrlKey) {
return true;
}
if (document.getElementById(`RROW-${id}`).classList.contains('active')) {
if (aEvent.target.tagName === 'A') {
return true;
}
Article.cdmUnsetActive(aEvent);
}
else {
Article.setActive(id);
Article.cdmMoveToId(id);
}
return false;
};
});
});
});
JS;
}
}