diff --git a/resources/static/include_js/include.js b/resources/static/include_js/include.js index ebbdbb57851563a0aba8c3d78f02ee3cd7f98a6d..d02808d77505676c8b223749df617ef943ab121d 100644 --- a/resources/static/include_js/include.js +++ b/resources/static/include_js/include.js @@ -814,80 +814,12 @@ } } }; - }, - onOpen: function(cb) { - var o = "*"; - var msgTarget = isIE ? findRelay() : window.opener; - if (!msgTarget) throw "can't find relay frame"; - function doPost(msg) { - msg = JSON.stringify(msg); - if (isIE) msgTarget.doPost(msg, o); - else msgTarget.postMessage(msg, o); - } - - function onMessage(e) { - // only one message gets through - removeListener(window, 'message', onMessage); - var d; - o = e.origin; - try { - d = JSON.parse(e.data); - } catch(err) { } - if (cb) { - // this setTimeout is critically important for IE8 - - // in ie8 sometimes addListener for 'message' can synchronously - // cause your callback to be invoked. awesome. - setTimeout(function() { - cb(o, d.d, function(r) { - cb = undefined; - doPost({a: 'response', d: r}); - }); - }, 0); - } - } - - function onDie(e) { - if (e.data === CLOSE_CMD) { - try { window.close(); } catch (o_O) {} - } - } - addListener(isIE ? msgTarget : window, 'message', onMessage); - addListener(isIE ? msgTarget : window, 'message', onDie); - - // we cannot post to our parent that we're ready before the iframe - // is loaded. (IE specific possible failure) - try { - doPost({a: "ready"}); - } catch(e) { - // this code should never be exectued outside IE - addListener(msgTarget, 'load', function(e) { - doPost({a: "ready"}); - }); - } - - // if window is unloaded and the client hasn't called cb, it's an error - var onUnload = function() { - removeListener(isIE ? msgTarget : window, 'message', onDie); - if (cb) doPost({ a: 'error', d: 'client closed window' }); - cb = undefined; - // explicitly close the window, in case the client is trying to reload or nav - try { window.close(); } catch (e) { } - }; - addListener(window, 'unload', onUnload); - return { - detach: function() { - removeListener(window, 'unload', onUnload); - } - }; } }; } else { return { open: function(url, winopts, arg, cb) { setTimeout(function() { cb("unsupported browser"); }, 0); - }, - onOpen: function(cb) { - setTimeout(function() { cb("unsupported browser"); }, 0); } }; }