1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/01b94ad2c377/ Changeset: 01b94ad2c377 User: guerler Date: 2013-10-15 06:12:08 Summary: Add onbeforeunload functions to iconbar item Affected #: 4 files diff -r 31442bf4317bf2d8841255a36a42292f319f60e6 -r 01b94ad2c37734c2692744861948eb79c3d32af2 static/scripts/galaxy.frame.js --- a/static/scripts/galaxy.frame.js +++ b/static/scripts/galaxy.frame.js @@ -87,7 +87,11 @@ { icon : 'fa-icon-th', tooltip : 'Enable/Disable Scratchbook', - on_click : function(e) { self.event_panel_active(e) } + on_click : function(e) { self.event_panel_active(e) }, + on_unload : function() { + if (self.frame_counter > 0) + return "You opened " + self.frame_counter + " frame(s) which will be lost."; + } }); // add to master @@ -157,13 +161,6 @@ if (self.visible) self.panel_refresh(); }); - - // catch window close - window.onbeforeunload = function() - { - if (self.frame_counter > 0) - return "You opened " + self.frame_counter + " frame(s) which will be lost."; - }; }, /* diff -r 31442bf4317bf2d8841255a36a42292f319f60e6 -r 01b94ad2c37734c2692744861948eb79c3d32af2 static/scripts/galaxy.master.js --- a/static/scripts/galaxy.master.js +++ b/static/scripts/galaxy.master.js @@ -1,5 +1,5 @@ /* - galaxy master v1.0 + galaxy master */ // dependencies @@ -11,6 +11,9 @@ // base element el_master: '#masthead', + // item list + list : [], + // initialize initialize : function(options) { @@ -19,6 +22,21 @@ // append to master $(this.el_master).append($(this.el)); + + // loop through item specific unload functions + var self = this; + window.onbeforeunload = function() + { + var text = ""; + for (key in self.list) + if (self.list[key].options.on_unload) + { + var q = self.list[key].options.on_unload(); + if (q) text += q + " "; + } + if (text != "") + return text; + }; }, // prevent default @@ -27,16 +45,18 @@ 'mousedown' : function(e) {e.preventDefault()} }, - // adds and displays a new frame/window + // adds a new item to the master append : function(item) { $(this.el).append($(item.el)); + this.list.push(item); }, - // adds and displays a new frame/window + // adds a new item to the master prepend : function(item) { $(this.el).prepend($(item.el)); + this.list.push(item); }, /* @@ -61,6 +81,7 @@ tooltip : "galaxy-icon", with_number : false, on_click : function() { alert ('clicked') }, + on_unload : null, visible : true }, diff -r 31442bf4317bf2d8841255a36a42292f319f60e6 -r 01b94ad2c37734c2692744861948eb79c3d32af2 static/scripts/galaxy.upload.js --- a/static/scripts/galaxy.upload.js +++ b/static/scripts/galaxy.upload.js @@ -68,6 +68,10 @@ icon : 'fa-icon-upload', tooltip : 'Upload Files', on_click : function(e) { self.event_show(e) }, + on_unload : function() { + if (self.counter.running > 0) + return "Currently uploads are running."; + }, with_number : true }); @@ -83,7 +87,6 @@ self.select_extension[filetype] = filetype; } }); - }, // mouse over diff -r 31442bf4317bf2d8841255a36a42292f319f60e6 -r 01b94ad2c37734c2692744861948eb79c3d32af2 static/scripts/utils/galaxy.uploadbox.js --- a/static/scripts/utils/galaxy.uploadbox.js +++ b/static/scripts/utils/galaxy.uploadbox.js @@ -23,7 +23,7 @@ complete : function() {}, error_filesize : "File exceeds 2GB. Please use an FTP client.", error_default : "Please make sure the file is available.", - error_server : "The server is unavailable.", + error_server : "Upload request failed.", error_toomany : "You can only queue <20 files per upload session.", error_login : "Uploads require you to log in." } @@ -200,8 +200,7 @@ if (filesize < maxfilesize) { // send data - var data = opts.initialize(index, file); - send(index, file, data) + send(index, file, opts.initialize(index, file)) } else { // skip file error(index, file, opts.error_filesize); Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.