);
}
+ window.addEventListener(
+ 'close',
+ function(ev) {
+
+ var unsaved_data = false;
+ for (var id in obj.tab_semaphores) {
+ if (obj.tab_semaphores[id] > 0) {
+ unsaved_data = true;
+ }
+ }
+
+ if (unsaved_data) {
+ var confirmation = window.confirm(offlineStrings.getString('menu.close_window.unsaved_data_warning'));
+ if (!confirmation) {
+ ev.preventDefault();
+ return false;
+ }
+ }
+
+ return true;
+
+ },
+ false
+ );
+
var cmd_map = {
'cmd_broken' : [
['oncommand'],
/* File Menu */
'cmd_close_window' : [
['oncommand'],
- function() { window.close(); }
+ function() {
+ JSAN.use('util.widgets');
+ util.widgets.dispatch('close',window);
+ }
],
'cmd_new_window' : [
['oncommand'],
menu.tab10.accesskey=0
menu.close_tab.unsaved_data_warning=This tab may have unsaved data. Close it anyway?
menu.replace_tab.unsaved_data_warning=This tab may have unsaved data. Replace it anyway?
+menu.close_window.unsaved_data_warning=This window may have unsaved data. Close it anyway?