diff --git a/wallabag_v2/init.php b/wallabag_v2/init.php index 0c8e31f..03b27a8 100644 --- a/wallabag_v2/init.php +++ b/wallabag_v2/init.php @@ -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", "joshu@unfettered.net"); } diff --git a/wallabag_v2/wallabag_v2.js b/wallabag_v2/wallabag_v2.js index 2f73d77..57db1c5 100644 --- a/wallabag_v2/wallabag_v2.js +++ b/wallabag_v2/wallabag_v2.js @@ -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: " + ti.title + ""); + Notify.info("Saved to Wallabag: " + ti.title + ""); } else { - notify_error("Error saving to Wallabag!: ("+ti.status+": "+ti.error+") "+ti.error_msg+""); + Notify.error("Error saving to Wallabag!: ("+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); } } }); @@ -26,9 +26,16 @@ function postArticleToWallabag(id) { } } -hotkey_actions['send_to_wallabag'] = function() { - if (getActiveArticleId()) { - postArticleToWallabag(getActiveArticleId()); - return; - } -}; \ No newline at end of file +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; + } + }; + }); + }); +}); +