From a7991b2d4c8ca35ed421af62f47e558fce0f8fff Mon Sep 17 00:00:00 2001 From: Frederik B Date: Thu, 30 Jul 2015 13:49:41 +0200 Subject: Send postMessage to opener before autoclose --- themes/_global/js/autoClose.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'themes') diff --git a/themes/_global/js/autoClose.js b/themes/_global/js/autoClose.js index e9145b7e..c3ce744f 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(); } }); -- cgit v1.2.3