Skip to content

Commit

Permalink
Update js to recent tt-rss updates
Browse files Browse the repository at this point in the history
  • Loading branch information
joshp23 committed Dec 9, 2018
1 parent bd45d67 commit f586edb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion wallabag_v2/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Wallabag_v2 extends Plugin {
private $host;

function about() {
return array("1.6.0",
return array("1.7.0",
"Post articles to a Wallabag v 2.x instance",
"[email protected]");
}
Expand Down
29 changes: 18 additions & 11 deletions wallabag_v2/wallabag_v2.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
function postArticleToWallabag(id) {
try {
notify_progress("Saving to Wallabag …", true);
Notify.progress("Saving to Wallabag …", true);
new Ajax.Request("backend.php", {
parameters: {
'op': 'pluginhandler',
'plugin': 'wallabag_v2',
'method': 'getwallabagInfo',
'id': param_escape(id)
'id': encodeURIComponent(id)
},
onSuccess: function(transport) {
var ti = JSON.parse(transport.responseText);
if (ti.status) {
if (ti.status=="200") {
notify_info("Saved to Wallabag: <em>" + ti.title + "</em>");
Notify.info("Saved to Wallabag: <em>" + ti.title + "</em>");
} else {
notify_error("<strong>Error saving to Wallabag!</strong>: ("+ti.status+": "+ti.error+") "+ti.error_msg+"");
Notify.error("<strong>Error saving to Wallabag!</strong>: ("+ti.status+": "+ti.error+") "+ti.error_msg+"");
}
} else {
notify_error("The Wallabag_v2 plugin needs to be configured. See the README for help", true);
Notify.error("The Wallabag_v2 plugin needs to be configured. See the README for help", true);
}
}
});
Expand All @@ -26,9 +26,16 @@ function postArticleToWallabag(id) {
}
}

hotkey_actions['send_to_wallabag'] = function() {
if (getActiveArticleId()) {
postArticleToWallabag(getActiveArticleId());
return;
}
};
require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) {
ready(function () {
PluginHost.register(PluginHost.HOOK_INIT_COMPLETE, () => {
App.hotkey_actions["send_to_wallabag"] = function() {
if (Article.getActive()) {
postArticleToWallabag(Article.getActive());
return;
}
};
});
});
});

0 comments on commit f586edb

Please sign in to comment.