Index: branches/RC/core/admin_templates/js/application.js =================================================================== diff -u -r11368 -r11482 --- branches/RC/core/admin_templates/js/application.js (.../application.js) (revision 11368) +++ branches/RC/core/admin_templates/js/application.js (.../application.js) (revision 11482) @@ -2,6 +2,39 @@ this.Hooks = new Array (); } +kApplication.prototype.footerInit = function () { + if (use_popups() && window.name.match(/[\d]+$/)) { + addEvent( + window, 'unload', + function() { +// alert('unload event; unload legal: ' + unload_legal); + if (!unload_legal && window.name != 'main') { + // it's set in submit_kernel_form - if we are submitting form, the unload is already handled + // if we got here, it means that we are closing window ilegally (through OS interace X button) +// alert('closing window'); + // we need to clear temp tables then + + getFrame('head').WatchClosing(window, _DropTempUrl); + } + } + ); + + // we need to set unload_legal to true if we are refreshing current window, because onunload will still fire + addEvent(document, 'keydown', + function(e) { + var code; + if (!e) var e = window.event; + if (e.keyCode) code = e.keyCode; + else if (e.which) code = e.which; + if (code == 116 || (e.ctrlKey && code == 82)) { + unload_legal = true; //F5 or Ctrl+R +// alert('[document.keydown] setting unload_legal = true'); + } + } + ); + } +} + kApplication.prototype.SetVar = function ($name, $value) { set_hidden_field($name, $value); }