2018-12-02 15:38:27 +00:00
|
|
|
'use strict'
|
2020-06-04 20:27:22 +00:00
|
|
|
|
2021-02-12 16:02:09 +00:00
|
|
|
/* eslint-disable no-new */
|
2021-02-19 08:28:14 +00:00
|
|
|
/* global __, ngettext, App, Headlines, xhr, dojo, dijit, PluginHost, Notify, fox */
|
2020-06-04 20:27:22 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
const Article = {
|
|
|
|
_scroll_reset_timeout: false,
|
|
|
|
getScoreClass: function (score) {
|
|
|
|
if (score > 500) {
|
|
|
|
return "score-high";
|
|
|
|
} else if (score > 0) {
|
|
|
|
return "score-half-high";
|
|
|
|
} else if (score < -100) {
|
|
|
|
return "score-low";
|
|
|
|
} else if (score < 0) {
|
|
|
|
return "score-half-low";
|
|
|
|
} else {
|
|
|
|
return "score-neutral";
|
|
|
|
}
|
|
|
|
},
|
|
|
|
getScorePic: function (score) {
|
|
|
|
if (score > 500) {
|
|
|
|
return "trending_up";
|
|
|
|
} else if (score > 0) {
|
|
|
|
return "trending_up";
|
|
|
|
} else if (score < 0) {
|
|
|
|
return "trending_down";
|
|
|
|
} else {
|
|
|
|
return "trending_neutral";
|
|
|
|
}
|
|
|
|
},
|
|
|
|
selectionSetScore: function () {
|
|
|
|
const ids = Headlines.getSelected();
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
if (ids.length > 0) {
|
|
|
|
const score = prompt(__("Please enter new score for selected articles:"));
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
if (!isNaN(parseInt(score))) {
|
2021-02-18 18:51:18 +00:00
|
|
|
ids.forEach((id) => {
|
|
|
|
const row = App.byId("RROW-" + id);
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
if (row) {
|
|
|
|
row.setAttribute("data-score", score);
|
2018-12-06 11:23:45 +00:00
|
|
|
|
2021-02-18 18:51:18 +00:00
|
|
|
const pic = row.querySelector(".icon-score");
|
2018-12-06 11:23:45 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
pic.innerHTML = Article.getScorePic(score);
|
|
|
|
pic.setAttribute("title", score);
|
2018-12-11 07:00:54 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
["score-low", "score-high", "score-half-low", "score-half-high", "score-neutral"]
|
2021-02-18 18:51:18 +00:00
|
|
|
.forEach(function(scl) {
|
2020-06-04 16:50:13 +00:00
|
|
|
if (row.hasClassName(scl))
|
|
|
|
row.removeClassName(scl);
|
|
|
|
});
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
row.addClassName(Article.getScoreClass(score));
|
|
|
|
}
|
|
|
|
});
|
2018-12-02 14:18:59 +00:00
|
|
|
}
|
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
} else {
|
|
|
|
alert(__("No articles selected."));
|
|
|
|
}
|
|
|
|
},
|
|
|
|
setScore: function (id, pic) {
|
2021-02-19 04:43:05 +00:00
|
|
|
const row = pic.closest("div[id*=RROW]");
|
2018-12-11 07:30:32 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
if (row) {
|
|
|
|
const score_old = row.getAttribute("data-score");
|
|
|
|
const score = prompt(__("Please enter new score for this article:"), score_old);
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
if (!isNaN(parseInt(score))) {
|
|
|
|
row.setAttribute("data-score", score);
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2021-02-18 18:51:18 +00:00
|
|
|
const pic = row.querySelector(".icon-score");
|
2018-12-06 11:23:45 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
pic.innerHTML = Article.getScorePic(score);
|
|
|
|
pic.setAttribute("title", score);
|
2018-12-06 11:23:45 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
["score-low", "score-high", "score-half-low", "score-half-high", "score-neutral"]
|
2021-02-18 18:51:18 +00:00
|
|
|
.forEach(function(scl) {
|
2020-06-04 16:50:13 +00:00
|
|
|
if (row.hasClassName(scl))
|
|
|
|
row.removeClassName(scl);
|
|
|
|
});
|
|
|
|
|
|
|
|
row.addClassName(Article.getScoreClass(score));
|
2018-12-02 14:18:59 +00:00
|
|
|
}
|
2020-06-04 16:50:13 +00:00
|
|
|
}
|
|
|
|
},
|
2020-06-05 04:44:57 +00:00
|
|
|
popupOpenUrl: function(url) {
|
|
|
|
const w = window.open("");
|
|
|
|
|
|
|
|
w.opener = null;
|
|
|
|
w.location = url;
|
|
|
|
},
|
2020-06-04 16:50:13 +00:00
|
|
|
cdmUnsetActive: function (event) {
|
2021-02-18 18:51:18 +00:00
|
|
|
const row = App.byId("RROW-" + Article.getActive());
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
if (row) {
|
|
|
|
row.removeClassName("active");
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
if (event)
|
|
|
|
event.stopPropagation();
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
close: function () {
|
|
|
|
if (dijit.byId("content-insert"))
|
|
|
|
dijit.byId("headlines-wrap-inner").removeChild(
|
|
|
|
dijit.byId("content-insert"));
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
Article.setActive(0);
|
|
|
|
},
|
|
|
|
displayUrl: function (id) {
|
2021-02-15 12:52:28 +00:00
|
|
|
const query = {op: "article", method: "getmetadatabyid", id: id};
|
2018-12-09 01:32:41 +00:00
|
|
|
|
2021-02-19 07:22:00 +00:00
|
|
|
xhr.json("backend.php", query, (reply) => {
|
2020-06-04 16:50:13 +00:00
|
|
|
if (reply && reply.link) {
|
|
|
|
prompt(__("Article URL:"), reply.link);
|
2021-02-13 07:10:44 +00:00
|
|
|
} else {
|
|
|
|
alert(__("No URL could be displayed for this article."));
|
2018-12-09 01:32:41 +00:00
|
|
|
}
|
2020-06-04 16:50:13 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
openInNewWindow: function (id) {
|
2020-09-15 13:12:53 +00:00
|
|
|
/* global __csrf_token */
|
|
|
|
App.postOpenWindow("backend.php",
|
|
|
|
{ "op": "article", "method": "redirect", "id": id, "csrf_token": __csrf_token });
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-09-15 13:12:53 +00:00
|
|
|
Headlines.toggleUnread(id, 0);
|
2020-06-04 16:50:13 +00:00
|
|
|
},
|
2021-02-15 11:10:46 +00:00
|
|
|
renderEnclosures: function (enclosures) {
|
|
|
|
|
|
|
|
// enclosure list was handled by backend (HOOK_FORMAT_ENCLOSURES)
|
|
|
|
if (enclosures.formatted)
|
|
|
|
return enclosures.formatted;
|
|
|
|
|
|
|
|
return `
|
|
|
|
${enclosures.can_inline ?
|
|
|
|
`<div class='attachments-inline'>
|
|
|
|
${enclosures.entries.map((enc) => {
|
|
|
|
if (!enclosures.inline_text_only) {
|
|
|
|
if (enc.content_type && enc.content_type.indexOf("image/") != -1) {
|
|
|
|
return `<p>
|
|
|
|
<img loading="lazy"
|
|
|
|
width="${enc.width ? enc.width : ''}"
|
|
|
|
height="${enc.height ? enc.height : ''}"
|
|
|
|
src="${App.escapeHtml(enc.content_url)}"
|
|
|
|
title="${App.escapeHtml(enc.title ? enc.title : enc.content_url)}"/>
|
|
|
|
</p>`
|
|
|
|
} else if (enc.content_type && enc.content_type.indexOf("audio/") != -1 && App.audioCanPlay(enc.content_type)) {
|
|
|
|
return `<p class='inline-player' title="${App.escapeHtml(enc.content_url)}">
|
|
|
|
<audio preload="none" controls="controls">
|
|
|
|
<source type="${App.escapeHtml(enc.content_type)}" src="${App.escapeHtml(enc.content_url)}"/>
|
|
|
|
</audio>
|
|
|
|
</p>
|
|
|
|
`;
|
|
|
|
} else {
|
|
|
|
return `<p>
|
|
|
|
<a target="_blank" href="${App.escapeHtml(enc.content_url)}"
|
|
|
|
title="${App.escapeHtml(enc.title ? enc.title : enc.content_url)}"
|
|
|
|
rel="noopener noreferrer">${App.escapeHtml(enc.content_url)}</a>
|
|
|
|
</p>`
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return `<p>
|
|
|
|
<a target="_blank" href="${App.escapeHtml(enc.content_url)}"
|
|
|
|
title="${App.escapeHtml(enc.title ? enc.title : enc.content_url)}"
|
|
|
|
rel="noopener noreferrer">${App.escapeHtml(enc.content_url)}</a>
|
|
|
|
</p>`
|
|
|
|
}
|
|
|
|
}).join("")}
|
|
|
|
</div>` : ''}
|
|
|
|
${enclosures.entries.length > 0 ?
|
|
|
|
`<div class="attachments" dojoType="fox.form.DropDownButton">
|
|
|
|
<span>${__('Attachments')}</span>
|
|
|
|
<div dojoType="dijit.Menu" style="display: none">
|
|
|
|
${enclosures.entries.map((enc) => `
|
|
|
|
<div onclick='Article.popupOpenUrl("${App.escapeHtml(enc.content_url)}")'
|
|
|
|
title="${App.escapeHtml(enc.title ? enc.title : enc.content_url)}" dojoType="dijit.MenuItem">
|
|
|
|
${enc.title ? enc.title : enc.filename}
|
|
|
|
</div>
|
|
|
|
`).join("")}
|
|
|
|
</div>
|
|
|
|
</div>` : ''}
|
|
|
|
`
|
|
|
|
},
|
2020-06-04 16:50:13 +00:00
|
|
|
render: function (article) {
|
|
|
|
App.cleanupMemory("content-insert");
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
dijit.byId("headlines-wrap-inner").addChild(
|
|
|
|
dijit.byId("content-insert"));
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
const c = dijit.byId("content-insert");
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
try {
|
|
|
|
c.domNode.scrollTop = 0;
|
|
|
|
} catch (e) {
|
|
|
|
}
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
c.attr('content', article);
|
|
|
|
PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED, c.domNode);
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
//Headlines.correctHeadlinesOffset(Article.getActive());
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
try {
|
|
|
|
c.focus();
|
|
|
|
} catch (e) {
|
|
|
|
}
|
|
|
|
},
|
|
|
|
formatComments: function(hl) {
|
|
|
|
let comments = "";
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
if (hl.comments || hl.num_comments > 0) {
|
|
|
|
let comments_msg = __("comments");
|
|
|
|
|
|
|
|
if (hl.num_comments > 0) {
|
|
|
|
comments_msg = hl.num_comments + " " + ngettext("comment", "comments", hl.num_comments)
|
2018-12-08 06:32:14 +00:00
|
|
|
}
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-09-15 15:48:33 +00:00
|
|
|
comments = `<a target="_blank" rel="noopener noreferrer" href="${App.escapeHtml(hl.comments ? hl.comments : hl.link)}">(${comments_msg})</a>`;
|
2020-06-04 16:50:13 +00:00
|
|
|
}
|
2018-12-10 12:06:47 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
return comments;
|
|
|
|
},
|
2020-10-21 04:19:15 +00:00
|
|
|
unpack: function(row) {
|
|
|
|
if (row.hasAttribute("data-content")) {
|
|
|
|
console.log("unpacking: " + row.id);
|
|
|
|
|
|
|
|
const container = row.querySelector(".content-inner");
|
|
|
|
|
|
|
|
container.innerHTML = row.getAttribute("data-content").trim();
|
|
|
|
|
2021-02-16 19:05:12 +00:00
|
|
|
dojo.parser.parse(container);
|
|
|
|
|
2020-10-21 04:19:15 +00:00
|
|
|
// blank content element might screw up onclick selection and keyboard moving
|
|
|
|
if (container.textContent.length == 0)
|
|
|
|
container.innerHTML += " ";
|
|
|
|
|
|
|
|
// in expandable mode, save content for later, so that we can pack unfocused rows back
|
2021-02-18 18:51:18 +00:00
|
|
|
if (App.isCombinedMode() && App.byId("main").hasClassName("expandable"))
|
2020-10-21 04:19:15 +00:00
|
|
|
row.setAttribute("data-content-original", row.getAttribute("data-content"));
|
|
|
|
|
|
|
|
row.removeAttribute("data-content");
|
|
|
|
|
|
|
|
PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, row);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
pack: function(row) {
|
|
|
|
if (row.hasAttribute("data-content-original")) {
|
|
|
|
console.log("packing", row.id);
|
|
|
|
row.setAttribute("data-content", row.getAttribute("data-content-original"));
|
|
|
|
row.removeAttribute("data-content-original");
|
|
|
|
|
|
|
|
row.querySelector(".content-inner").innerHTML = " ";
|
|
|
|
}
|
|
|
|
},
|
2020-06-04 16:50:13 +00:00
|
|
|
view: function (id, no_expand) {
|
|
|
|
this.setActive(id);
|
|
|
|
Headlines.scrollToArticleId(id);
|
|
|
|
|
|
|
|
if (!no_expand) {
|
|
|
|
const hl = Headlines.objectById(id);
|
|
|
|
|
|
|
|
if (hl) {
|
|
|
|
|
|
|
|
const comments = this.formatComments(hl);
|
|
|
|
|
|
|
|
const article = `<div class="post post-${hl.id}" data-article-id="${hl.id}">
|
|
|
|
<div class="header">
|
|
|
|
<div class="row">
|
|
|
|
<div class="title"><a target="_blank" rel="noopener noreferrer"
|
2020-06-05 04:44:57 +00:00
|
|
|
title="${App.escapeHtml(hl.title)}"
|
|
|
|
href="${App.escapeHtml(hl.link)}">${hl.title}</a></div>
|
2020-06-04 16:50:13 +00:00
|
|
|
<div class="date">${hl.updated_long}</div>
|
2018-12-08 06:32:14 +00:00
|
|
|
</div>
|
2020-06-04 16:50:13 +00:00
|
|
|
<div class="row">
|
|
|
|
<div class="buttons left">${hl.buttons_left}</div>
|
|
|
|
<div class="comments">${comments}</div>
|
|
|
|
<div class="author">${hl.author}</div>
|
|
|
|
<i class="material-icons">label_outline</i>
|
|
|
|
<span id="ATSTR-${hl.id}">${hl.tags_str}</span>
|
|
|
|
<a title="${__("Edit tags for this article")}" href="#"
|
|
|
|
onclick="Article.editTags(${hl.id})">(+)</a>
|
|
|
|
<div class="buttons right">${hl.buttons}</div>
|
2018-12-08 06:32:14 +00:00
|
|
|
</div>
|
2020-06-04 16:50:13 +00:00
|
|
|
</div>
|
|
|
|
<div id="POSTNOTE-${hl.id}">${hl.note}</div>
|
|
|
|
<div class="content" lang="${hl.lang ? hl.lang : 'en'}">
|
|
|
|
${hl.content}
|
2021-02-15 11:10:46 +00:00
|
|
|
${Article.renderEnclosures(hl.enclosures)}
|
2020-06-04 16:50:13 +00:00
|
|
|
</div>
|
|
|
|
</div>`;
|
2018-12-08 06:32:14 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
Headlines.toggleUnread(id, 0);
|
|
|
|
this.render(article);
|
2018-12-02 14:18:59 +00:00
|
|
|
}
|
2020-06-04 16:50:13 +00:00
|
|
|
}
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
return false;
|
|
|
|
},
|
|
|
|
editTags: function (id) {
|
2021-02-12 16:02:09 +00:00
|
|
|
const dialog = new fox.SingleUseDialog({
|
|
|
|
title: __("Edit article Tags"),
|
2021-02-15 11:50:40 +00:00
|
|
|
content: `
|
2021-02-17 16:34:54 +00:00
|
|
|
${App.FormFields.hidden_tag("id", id.toString())}
|
|
|
|
${App.FormFields.hidden_tag("op", "article")}
|
|
|
|
${App.FormFields.hidden_tag("method", "setArticleTags")}
|
2021-02-15 11:50:40 +00:00
|
|
|
|
|
|
|
<header class='horizontal'>
|
|
|
|
${__("Tags for this article (separated by commas):")}
|
|
|
|
</header>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<textarea dojoType='dijit.form.SimpleTextarea' rows='4' disabled='true'
|
|
|
|
id='tags_str' name='tags_str'></textarea>
|
|
|
|
<div class='autocomplete' id='tags_choices' style='display:none'></div>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<footer>
|
|
|
|
<button dojoType='dijit.form.Button' type='submit' class='alt-primary'>
|
|
|
|
${__('Save')}
|
|
|
|
</button>
|
|
|
|
<button dojoType='dijit.form.Button' onclick='App.dialogOf(this).hide()'>
|
|
|
|
${__('Cancel')}
|
|
|
|
</button>
|
|
|
|
</footer>
|
|
|
|
`,
|
2021-02-12 16:02:09 +00:00
|
|
|
execute: function () {
|
|
|
|
if (this.validate()) {
|
|
|
|
Notify.progress("Saving article tags...", true);
|
|
|
|
|
2021-02-19 08:28:14 +00:00
|
|
|
xhr.json("backend.php", this.attr('value'), (data) => {
|
2021-02-12 16:02:09 +00:00
|
|
|
try {
|
|
|
|
Notify.close();
|
|
|
|
dialog.hide();
|
|
|
|
|
|
|
|
if (data) {
|
|
|
|
const id = data.id;
|
|
|
|
|
2021-02-18 18:51:18 +00:00
|
|
|
const tags = App.byId("ATSTR-" + id);
|
2021-02-12 16:02:09 +00:00
|
|
|
const tooltip = dijit.byId("ATSTRTIP-" + id);
|
|
|
|
|
|
|
|
if (tags) tags.innerHTML = data.content;
|
|
|
|
if (tooltip) tooltip.attr('label', data.content_full);
|
2018-12-02 14:18:59 +00:00
|
|
|
}
|
2021-02-12 16:02:09 +00:00
|
|
|
} catch (e) {
|
|
|
|
App.Error.report(e);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const tmph = dojo.connect(dialog, 'onShow', function () {
|
|
|
|
dojo.disconnect(tmph);
|
2020-09-15 15:47:19 +00:00
|
|
|
|
2021-02-19 07:22:00 +00:00
|
|
|
xhr.json("backend.php", {op: "article", method: "printArticleTags", id: id}, (reply) => {
|
2020-09-15 15:47:19 +00:00
|
|
|
|
2021-02-18 18:51:18 +00:00
|
|
|
dijit.getEnclosingWidget(App.byId("tags_str"))
|
2021-02-15 11:50:40 +00:00
|
|
|
.attr('value', reply.tags.join(", "))
|
|
|
|
.attr('disabled', false);
|
|
|
|
|
2021-02-18 18:51:18 +00:00
|
|
|
/* new Ajax.Autocompleter("tags_str", "tags_choices",
|
2020-09-15 15:47:19 +00:00
|
|
|
"backend.php?op=article&method=completeTags",
|
2021-02-18 18:51:18 +00:00
|
|
|
{tokens: ',', paramName: "search"}); */
|
2020-09-15 15:47:19 +00:00
|
|
|
});
|
2020-06-04 16:50:13 +00:00
|
|
|
});
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2021-02-12 16:02:09 +00:00
|
|
|
dialog.show();
|
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
},
|
2021-02-18 12:13:41 +00:00
|
|
|
cdmMoveToId: function (id, params = {}) {
|
2020-06-04 16:50:13 +00:00
|
|
|
const force_to_top = params.force_to_top || false;
|
2020-05-09 05:16:12 +00:00
|
|
|
|
2021-02-18 18:51:18 +00:00
|
|
|
const ctr = App.byId("headlines-frame");
|
|
|
|
const row = App.byId("RROW-" + id);
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
if (!row || !ctr) return;
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
if (force_to_top || !App.Scrollable.fitsInContainer(row, ctr)) {
|
|
|
|
ctr.scrollTop = row.offsetTop;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
setActive: function (id) {
|
|
|
|
if (id != Article.getActive()) {
|
|
|
|
console.log("setActive", id, "was", Article.getActive());
|
|
|
|
|
2021-02-18 18:51:18 +00:00
|
|
|
App.findAll("div[id*=RROW][class*=active]").forEach((row) => {
|
2020-06-04 16:50:13 +00:00
|
|
|
row.removeClassName("active");
|
2020-10-21 04:19:15 +00:00
|
|
|
Article.pack(row);
|
2020-06-04 16:50:13 +00:00
|
|
|
});
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2021-02-18 18:51:18 +00:00
|
|
|
const row = App.byId("RROW-" + id);
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
if (row) {
|
2020-10-21 04:19:15 +00:00
|
|
|
Article.unpack(row);
|
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
row.removeClassName("Unread");
|
|
|
|
row.addClassName("active");
|
2018-12-02 14:18:59 +00:00
|
|
|
|
2020-06-04 16:50:13 +00:00
|
|
|
PluginHost.run(PluginHost.HOOK_ARTICLE_SET_ACTIVE, row.getAttribute("data-article-id"));
|
2018-12-02 14:18:59 +00:00
|
|
|
}
|
|
|
|
}
|
2020-06-04 16:50:13 +00:00
|
|
|
},
|
|
|
|
getActive: function () {
|
|
|
|
const row = document.querySelector("#headlines-frame > div[id*=RROW][class*=active]");
|
|
|
|
|
|
|
|
if (row)
|
|
|
|
return row.getAttribute("data-article-id");
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
},
|
|
|
|
scrollByPages: function (page_offset) {
|
2021-02-18 18:51:18 +00:00
|
|
|
App.Scrollable.scrollByPages(App.byId("content-insert"), page_offset);
|
2020-06-04 16:50:13 +00:00
|
|
|
},
|
|
|
|
scroll: function (offset) {
|
2021-02-18 18:51:18 +00:00
|
|
|
App.Scrollable.scroll(App.byId("content-insert"), offset);
|
2020-06-04 16:50:13 +00:00
|
|
|
},
|
|
|
|
mouseIn: function (id) {
|
|
|
|
this.post_under_pointer = id;
|
|
|
|
},
|
2020-06-04 20:27:22 +00:00
|
|
|
mouseOut: function (/* id */) {
|
2020-06-04 16:50:13 +00:00
|
|
|
this.post_under_pointer = false;
|
|
|
|
},
|
|
|
|
getUnderPointer: function () {
|
|
|
|
return this.post_under_pointer;
|
2018-12-03 06:33:44 +00:00
|
|
|
}
|
2020-06-04 16:50:13 +00:00
|
|
|
}
|