-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstapaper.js
executable file
·26 lines (23 loc) · 972 Bytes
/
instapaper.js
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
function shareArticleToInstapaper(id) {
try {
var query = "?op=pluginhandler&plugin=instapaper&method=getInfo&id=" + encodeURIComponent(id);
var w = window.open('about:blank', 'ttrss_instapaper',
"status=0,toolbar=0,location=0,width=500,height=450,scrollbars=1,menubar=0");
xhr.json("backend.php", App.getPhArgs("instapaper", "getInfo", {id: id}), (r) => {
var share_url = "http://www.instapaper.com/hello2?" + "url=" + encodeURIComponent(r.link) + "&title=" + encodeURIComponent(r.title);
w.location.href = share_url;
});
} catch (e) {
console.error("[ttrss-instapaper-plugin]", e);
}
}
require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) {
ready(function () {
App.hotkey_actions['instapaper']=() => {
const id = Article.getActive();
if (id) {
shareArticleToInstapaper(id);
}
};
});
});