diff --git a/themes/_global/js/autoClose.js b/themes/_global/js/autoClose.js index e9145b7e2..c3ce744f1 100644 --- a/themes/_global/js/autoClose.js +++ b/themes/_global/js/autoClose.js @@ -1,6 +1,15 @@ $(document).ready(function() { - current_url = window.location.href - if (current_url.match("&closewin=true")) { + if (location.search.match("&closewin=true")) { + if (window.opener) { + var msgDiv = $("div.messages"); + var msg = msgDiv.children("p").text(); + var status = msgDiv.hasClass("success") ? + 'success' : 'unknown'; + var url = $(".tool.link")[0].href; + window.opener.postMessage({"wallabag-status": status, + "wallabag-msg": msg, + "wallabag-url": url }, "*"); + } window.close(); } });