2020-02-27 04:59:57 +00:00
|
|
|
Plugins.Af_Readability = {
|
2020-02-28 05:03:25 +00:00
|
|
|
orig_attr_name: 'data-readability-orig-content',
|
|
|
|
self: this,
|
2020-02-27 04:59:57 +00:00
|
|
|
embed: function(id) {
|
2020-02-28 05:03:25 +00:00
|
|
|
const content = $$(App.isCombinedMode() ? ".cdm[data-article-id=" + id + "] .content-inner" :
|
|
|
|
".post[data-article-id=" + id + "] .content")[0];
|
|
|
|
|
|
|
|
if (content.hasAttribute(self.orig_attr_name)) {
|
|
|
|
content.innerHTML = content.getAttribute(self.orig_attr_name);
|
|
|
|
content.removeAttribute(self.orig_attr_name);
|
|
|
|
|
|
|
|
if (App.isCombinedMode()) Article.cdmScrollToId(id);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-02-27 04:59:57 +00:00
|
|
|
Notify.progress("Loading, please wait...");
|
|
|
|
|
|
|
|
xhrJson("backend.php",{ op: "pluginhandler", plugin: "af_readability", method: "embed", param: id }, (reply) => {
|
|
|
|
|
|
|
|
if (content && reply.content) {
|
2020-02-28 05:03:25 +00:00
|
|
|
content.setAttribute(self.orig_attr_name, content.innerHTML);
|
2020-02-27 04:59:57 +00:00
|
|
|
content.innerHTML = reply.content;
|
|
|
|
Notify.close();
|
2020-02-28 05:03:25 +00:00
|
|
|
|
|
|
|
if (App.isCombinedMode()) Article.cdmScrollToId(id);
|
|
|
|
|
2020-02-27 04:59:57 +00:00
|
|
|
} else {
|
2020-02-28 05:03:25 +00:00
|
|
|
Notify.error("Unable to fetch full text for this article");
|
2020-02-27 04:59:57 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|