Destroy registered jQuery events on page tear down
This commit is contained in:
parent
5838a44339
commit
3ca7d34240
86
js/ajax.js
86
js/ajax.js
@ -19,7 +19,7 @@ var AJAX = {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
getEventName: function (key){
|
||||
hash: function (key){
|
||||
/* http://burtleburtle.net/bob/hash/doobs.html#one */
|
||||
key += "";
|
||||
var len = key.length, hash=0, i=0;
|
||||
@ -31,7 +31,7 @@ var AJAX = {
|
||||
hash += (hash << 3);
|
||||
hash ^= (hash >> 11);
|
||||
hash += (hash << 15);
|
||||
return "onload_" + Math.abs(hash);
|
||||
return Math.abs(hash);
|
||||
},
|
||||
/**
|
||||
* Registers an onload event for a file
|
||||
@ -39,25 +39,63 @@ var AJAX = {
|
||||
* @param string file The filename for which to register the event
|
||||
* @param function func The function to execute when the page is ready
|
||||
*
|
||||
* @return void
|
||||
* @return self For chaining
|
||||
*/
|
||||
registerOnload: function (file, func) {
|
||||
eventName = AJAX.getEventName(file);
|
||||
eventName = 'onload_' + AJAX.hash(file);
|
||||
$(document).bind(eventName, func);
|
||||
this._debug && console.log("Registered event " + eventName + " for file " + file); // no need to translate
|
||||
this._debug && console.log(
|
||||
"Registered event " + eventName + " for file " + file // no need to translate
|
||||
);
|
||||
return this;
|
||||
},
|
||||
/**
|
||||
* Registers a teardown event for a file. This is useful to execute functions
|
||||
* that unbind events for page elements that are about to be removed.
|
||||
*
|
||||
* @param string file The filename for which to register the event
|
||||
* @param function func The function to execute when
|
||||
* the page is about to be torn down
|
||||
*
|
||||
* @return self For chaining
|
||||
*/
|
||||
registerTeardown: function (file, func) {
|
||||
eventName = 'teardown_' + AJAX.hash(file);
|
||||
$(document).bind(eventName, func);
|
||||
this._debug && console.log(
|
||||
"Registered event " + eventName + " for file " + file // no need to translate
|
||||
);
|
||||
return this;
|
||||
},
|
||||
/**
|
||||
* Called when a page has finished loading, once for every
|
||||
* file that registered to the onload event of that file.
|
||||
*
|
||||
* @param string file The filename for which to fire the event
|
||||
* @param string file The filename for which to fire the event
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
fireOnload: function (file) {
|
||||
eventName = AJAX.getEventName(file);
|
||||
eventName = 'onload_' + AJAX.hash(file);
|
||||
$(document).trigger(eventName);
|
||||
this._debug && console.log("Fired event " + eventName + " for file " + file); // no need to translate
|
||||
this._debug && console.log(
|
||||
"Fired event " + eventName + " for file " + file // no need to translate
|
||||
);
|
||||
},
|
||||
/**
|
||||
* Called just before a page is torn down, once for every
|
||||
* file that registered to the teardown event of that file.
|
||||
*
|
||||
* @param string file The filename for which to fire the event
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
fireTeardown: function (file) {
|
||||
eventName = 'teardown_' + AJAX.hash(file);
|
||||
$(document).trigger(eventName);
|
||||
this._debug && console.log(
|
||||
"Fired event " + eventName + " for file " + file // no need to translate
|
||||
);
|
||||
},
|
||||
/**
|
||||
* Event handler for clicks on links and form submissions
|
||||
@ -75,14 +113,14 @@ var AJAX = {
|
||||
return true;
|
||||
} else if ($(this).attr('href') && $(this).attr('href').match(/^mailto/)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
if (AJAX.active == true) {
|
||||
return false;
|
||||
} else {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
if (AJAX.active == true) {
|
||||
return false;
|
||||
} else {
|
||||
AJAX.active = true;
|
||||
}
|
||||
AJAX.active = true;
|
||||
}
|
||||
|
||||
var url = $(this).attr('href') || $(this).attr('action') + '?' + $(this).serialize();
|
||||
@ -93,6 +131,8 @@ var AJAX = {
|
||||
if (data.success) {
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
|
||||
AJAX.scriptHandler.reset();
|
||||
|
||||
if (data._menu) {
|
||||
$('#floating_menubar').html(data._menu)
|
||||
.children().first().remove(); // Remove duplicate wrapper (TODO: don't send it in the response)
|
||||
@ -100,8 +140,6 @@ var AJAX = {
|
||||
menuResize();
|
||||
}
|
||||
|
||||
$('*').unbind().die();
|
||||
|
||||
$('body').children().not('#floating_menubar').not('#page_content').not('#selflink').remove();
|
||||
|
||||
$('#page_content').replaceWith("<div id='page_content'>" + data.message + "</div>");
|
||||
@ -197,14 +235,24 @@ var AJAX = {
|
||||
AJAX.fireOnload(this._scriptsToBeFired[i]);
|
||||
}
|
||||
AJAX.active = false;
|
||||
},
|
||||
reset: function () {
|
||||
for (var i in this._scriptsToBeFired) {
|
||||
AJAX.fireTeardown(this._scriptsToBeFired[i]);
|
||||
}
|
||||
this._scriptsToBeFired = [];
|
||||
/**
|
||||
* Re-attach a generic event handler to clicks
|
||||
* on pages and submissions of forms
|
||||
*/
|
||||
$('a').die('click').live('click', AJAX.requestHandler);
|
||||
$('form').die('submit').live('submit', AJAX.requestHandler);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Attach a generic event handler to clicks
|
||||
* on pages and submissions of forms
|
||||
*/
|
||||
$('a').live('click', AJAX.requestHandler);
|
||||
$('form').live('submit', AJAX.requestHandler);
|
||||
|
||||
|
||||
13
js/config.js
13
js/config.js
@ -3,6 +3,19 @@
|
||||
* Functions used in configuration forms and on user preferences pages
|
||||
*/
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('config.js', function() {
|
||||
$('input[id], select[id], textarea[id]').unbind('change').unbind('keyup');
|
||||
$('input[type=button][name=submit_reset]').unbind('click');
|
||||
$('div.tabs_contents').undelegate();
|
||||
$('#import_local_storage, #export_local_storage').unbind('click');
|
||||
$('form.prefs-form').unbind('change').unbind('submit');
|
||||
$('div.click-hide-message').die('click');
|
||||
$('#prefs_autoload').find('a').unbind('click');
|
||||
});
|
||||
|
||||
// default values for fields
|
||||
var defaultValues = {};
|
||||
|
||||
|
||||
@ -18,6 +18,15 @@
|
||||
* Change charset
|
||||
*/
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('db_operations.js', function() {
|
||||
$("#rename_db_form.ajax").die('submit');
|
||||
$("#copy_db_form.ajax").die('submit');
|
||||
$("#change_db_charset_form.ajax").die('submit');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('db_operations.js', function() {
|
||||
|
||||
/**
|
||||
|
||||
@ -15,6 +15,17 @@
|
||||
* Retrieve result of SQL query
|
||||
*/
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('db_search.js', function() {
|
||||
$('#buttonGo').unbind('click');
|
||||
$('#togglesearchresultlink').unbind('click');
|
||||
$("#togglequerybox").unbind('click');
|
||||
$('#togglesearchformlink').unbind('click');
|
||||
$("#db_search_form.ajax").die('submit');
|
||||
});
|
||||
|
||||
/**
|
||||
* Loads the database search results
|
||||
*
|
||||
|
||||
@ -18,6 +18,21 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('db_structure.js', function() {
|
||||
$("td.insert_table a.ajax").die('click');
|
||||
$("#insertForm .insertRowTable.ajax input[type=submit]").die('click');
|
||||
$("#buttonYes.ajax").die('click');
|
||||
$("span.fkc_switch").unbind('click');
|
||||
$('#fkc_checkbox').unbind('change');
|
||||
$("a.truncate_table_anchor.ajax").die('click');
|
||||
$("a.drop_table_anchor.ajax").die('click');
|
||||
$('a.drop_tracking_anchor.ajax').die('click');
|
||||
$('#real_end_input').die('click');
|
||||
});
|
||||
|
||||
/**
|
||||
* Adjust number of rows and total size in the summary
|
||||
* when truncating, creating, dropping or inserting into a table
|
||||
|
||||
18
js/export.js
18
js/export.js
@ -4,6 +4,24 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('export.js', function() {
|
||||
$("#plugins").unbind('change');
|
||||
$("input[type='radio'][name='sql_structure_or_data']").unbind('change');
|
||||
$("input[type='radio'][name='latex_structure_or_data']").unbind('change');
|
||||
$("input[type='radio'][name='odt_structure_or_data']").unbind('change');
|
||||
$("input[type='radio'][name='texytext_structure_or_data']").unbind('change');
|
||||
$("input[type='radio'][name='htmlword_structure_or_data']").unbind('change');
|
||||
$("input[type='radio'][name='sql_structure_or_data']").unbind('change');
|
||||
$("input[type='radio'][name='output_format']").unbind('change');
|
||||
$("#checkbox_sql_include_comments").unbind('change');
|
||||
$("#plugins").unbind('change');
|
||||
$("input[type='radio'][name='quick_or_custom']").unbind('change');
|
||||
$("input[type='radio'][name='allrows']").unbind('change');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('export.js', function () {
|
||||
/**
|
||||
* Toggles the hiding and showing of each plugin's options
|
||||
|
||||
142
js/functions.js
142
js/functions.js
@ -536,6 +536,12 @@ function checkTableEditForm(theForm, fieldsCnt)
|
||||
return true;
|
||||
} // enf of the 'checkTableEditForm()' function
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('functions.js', function() {
|
||||
$('table:not(.noclick) tr.odd:not(.noclick), table:not(.noclick) tr.even:not(.noclick)').die('click');
|
||||
});
|
||||
AJAX.registerOnload('functions.js', function() {
|
||||
/**
|
||||
* Row marking in horizontal mode (use "live" so that it works also for
|
||||
@ -1268,6 +1274,18 @@ function pdfPaperSize(format, axis)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('functions.js', function() {
|
||||
$("a.inline_edit_sql").die('click');
|
||||
$("input.btnSave").unbind('click');
|
||||
$("input.btnDiscard").unbind('click');
|
||||
$('input.sqlbutton').unbind('click');
|
||||
$("#export_type").unbind('change');
|
||||
$('#sqlquery').unbind('keydown');
|
||||
});
|
||||
|
||||
/**
|
||||
* Jquery Coding for inline editing SQL_QUERY
|
||||
*/
|
||||
@ -1533,7 +1551,8 @@ function PMA_ajaxRemoveMessage($this_msgbox)
|
||||
}
|
||||
}
|
||||
|
||||
AJAX.registerOnload('functions.js', function() {
|
||||
// This event only need to be fired once after the initial page load
|
||||
$(function() {
|
||||
/**
|
||||
* Allows the user to dismiss a notification
|
||||
* created with PMA_ajaxShowMessage()
|
||||
@ -1991,6 +2010,15 @@ jQuery.fn.PMA_sort_table = function(text_selector) {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('functions.js', function() {
|
||||
$("#create_table_form_minimal.ajax").die('submit');
|
||||
$("#create_table_form input[name=do_save_data]").die('click');
|
||||
$("#create_table_form.ajax input[name=submit_num_fields]").die('click');
|
||||
});
|
||||
|
||||
/**
|
||||
* jQuery coding for 'Create Table'. Used on db_operations.php,
|
||||
* db_structure.php and db_tracking.php (i.e., wherever
|
||||
@ -2160,6 +2188,15 @@ AJAX.registerOnload('functions.js', function() {
|
||||
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('functions.js', function() {
|
||||
$("#alterTableOrderby.ajax").die('submit');
|
||||
$("#copyTable.ajax input[name='submit_copy']").die('click');
|
||||
$("#tbl_maintenance li a.maintain_action.ajax").die('click');
|
||||
});
|
||||
/**
|
||||
* jQuery coding for 'Table operations'. Used on tbl_operations.php
|
||||
* Attach Ajax Event handlers for Table operations
|
||||
@ -2276,7 +2313,12 @@ AJAX.registerOnload('functions.js', function() {
|
||||
|
||||
}); //end $(document).ready for 'Table operations'
|
||||
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('functions.js', function() {
|
||||
$("#drop_db_anchor.ajax").die('click');
|
||||
});
|
||||
/**
|
||||
* Attach Ajax event handlers for Drop Database. Moved here from db_structure.js
|
||||
* as it was also required on db_create.php
|
||||
@ -2347,6 +2389,12 @@ function PMA_checkPassword($the_form)
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('functions.js', function() {
|
||||
$('#change_password_anchor.ajax').die('click');
|
||||
});
|
||||
/**
|
||||
* Attach Ajax event handlers for 'Change Password' on main.php
|
||||
*/
|
||||
@ -2440,6 +2488,14 @@ AJAX.registerOnload('functions.js', function() {
|
||||
}); // end handler for change password anchor
|
||||
}); // end $() for Change Password
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('functions.js', function() {
|
||||
$("select.column_type").die('change');
|
||||
$("select.default_type").die('change');
|
||||
$('input.allow_null').die('change');
|
||||
});
|
||||
/**
|
||||
* Toggle the hiding/showing of the "Open in ENUM/SET editor" message when
|
||||
* the page loads and when the selected data type changes
|
||||
@ -2501,6 +2557,15 @@ function PMA_validateDefaultValue($null_checkbox)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('functions.js', function() {
|
||||
$("a.open_enum_editor").die('click');
|
||||
$("input.add_value").die('click');
|
||||
$("#enum_editor td.drop").die('click');
|
||||
});
|
||||
/**
|
||||
* @var $enum_editor_dialog An object that points to the jQuery
|
||||
* dialog of the ENUM/SET editor
|
||||
@ -3038,6 +3103,12 @@ var toggleButton = function ($obj) {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('functions.js', function() {
|
||||
$('div.container').unbind('click');
|
||||
});
|
||||
/**
|
||||
* Initialise all toggle buttons
|
||||
*/
|
||||
@ -3048,6 +3119,16 @@ AJAX.registerOnload('functions.js', function () {
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('functions.js', function() {
|
||||
$('.vpointer').die('hover');
|
||||
$('.vmarker').die('click');
|
||||
$('#pageselector').die('change');
|
||||
$('a.formLinkSubmit').die('click');
|
||||
$('#update_recent_tables').unbind('ready');
|
||||
});
|
||||
/**
|
||||
* Vertical pointer
|
||||
*/
|
||||
@ -3237,6 +3318,13 @@ function PMA_slidingMessage(msg, $obj)
|
||||
return true;
|
||||
} // end PMA_slidingMessage()
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('functions.js', function() {
|
||||
$("#drop_tbl_anchor.ajax").die('click');
|
||||
$("#truncate_tbl_anchor.ajax").die('click');
|
||||
});
|
||||
/**
|
||||
* Attach Ajax event handlers for Drop Table.
|
||||
*
|
||||
@ -3269,14 +3357,7 @@ AJAX.registerOnload('functions.js', function() {
|
||||
}); // end $.get()
|
||||
}); // end $.PMA_confirm()
|
||||
}); //end of Drop Table Ajax action
|
||||
}); // end of $() for Drop Table
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for Truncate Table.
|
||||
*
|
||||
* @see $cfg['AjaxEnable']
|
||||
*/
|
||||
AJAX.registerOnload('functions.js', function() {
|
||||
$("#truncate_tbl_anchor.ajax").live('click', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
@ -3445,6 +3526,15 @@ loadJavascript=function(file) {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('functions.js', function() {
|
||||
$('a.themeselect').die('click');
|
||||
$('.autosubmit').unbind('change');
|
||||
$('a.take_theme').unbind('click');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('functions.js', function() {
|
||||
/**
|
||||
* Theme selector.
|
||||
@ -3520,6 +3610,15 @@ function printPage()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('functions.js', function() {
|
||||
$('input#print').unbind('click');
|
||||
$('span a.create_view.ajax').die('click');
|
||||
$('#createViewDialog').find('input, select').die('keydown');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('functions.js', function() {
|
||||
$('input#print').click(printPage);
|
||||
|
||||
@ -3542,12 +3641,10 @@ AJAX.registerOnload('functions.js', function() {
|
||||
$('#floating_menubar').outerHeight(true)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Ajaxification for the "Create View" action
|
||||
*/
|
||||
AJAX.registerOnload('functions.js', function () {
|
||||
/**
|
||||
* Ajaxification for the "Create View" action
|
||||
*/
|
||||
$('span a.create_view.ajax').live('click', function (e) {
|
||||
e.preventDefault();
|
||||
var $msg = PMA_ajaxShowMessage();
|
||||
@ -3673,18 +3770,15 @@ function formatBytes(bytes, subdecimals, pointchar) {
|
||||
return bytes + ' ' + units[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens pma more themes link in themes browser, in new window instead of popup
|
||||
* This way, we don't break HTML validity
|
||||
*/
|
||||
AJAX.registerOnload('functions.js', function () {
|
||||
/**
|
||||
* Opens pma more themes link in themes browser, in new window instead of popup
|
||||
* This way, we don't break HTML validity
|
||||
*/
|
||||
$("a._blank").prop("target", "_blank");
|
||||
});
|
||||
|
||||
/**
|
||||
* Reveal the login form to users with JS enabled
|
||||
*/
|
||||
AJAX.registerOnload('functions.js', function () {
|
||||
/**
|
||||
* Reveal the login form to users with JS enabled
|
||||
*/
|
||||
var $loginform = $('#loginform');
|
||||
$loginform.find('.js-show').show();
|
||||
$loginform.find('#input_username').select();
|
||||
|
||||
@ -201,6 +201,21 @@ function insertDataAndClose() {
|
||||
closeGISEditor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('gis_data_editor.js', function() {
|
||||
$("#gis_editor input[name='gis_data[save]']").die('click');
|
||||
$('#gis_editor').die('submit');
|
||||
$('#gis_editor').find("input[type='text']").die('change');
|
||||
$("#gis_editor select.gis_type").die('change');
|
||||
$('#gis_editor a.close_gis_editor, #gis_editor a.cancel_gis_editor').die('click');
|
||||
$('#gis_editor a.addJs.addPoint').die('click');
|
||||
$('#gis_editor a.addLine.addJs').die('click');
|
||||
$('#gis_editor a.addJs.addPolygon').die('click');
|
||||
$('#gis_editor a.addJs.addGeom').die('click');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('gis_data_editor.js', function() {
|
||||
|
||||
// Remove the class that is added due to the URL being too long.
|
||||
|
||||
12
js/import.js
12
js/import.js
@ -43,6 +43,18 @@ function matchFile(fname)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('import.js', function() {
|
||||
$("#plugins").unbind('change');
|
||||
$("#input_import_file").unbind('change');
|
||||
$("#select_local_import_file").unbind('change');
|
||||
$("#input_import_file").unbind('change').unbind('focus');
|
||||
$("#select_local_import_file").unbind('focus');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('import.js', function() {
|
||||
// Initially display the options for the selected plugin
|
||||
changePluginOpts();
|
||||
|
||||
@ -76,6 +76,13 @@ function checkIndexType()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('indexes.js', function() {
|
||||
$('#select_index_type').die('change');
|
||||
});
|
||||
|
||||
/**
|
||||
* @description <p>Ajax scripts for table index page</p>
|
||||
*
|
||||
|
||||
@ -4,6 +4,11 @@
|
||||
*/
|
||||
|
||||
var j_tabs, h_tabs, contr, server, db, token;
|
||||
|
||||
AJAX.registerTeardown('pmd/init.js', function() {
|
||||
$(".trigger").unbind('click');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('pmd/init.js', function() {
|
||||
$(".trigger").click(function() {
|
||||
$(".panel").toggle("fast");
|
||||
|
||||
@ -25,6 +25,21 @@ function update_config()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('replication.js', function() {
|
||||
$('#db_type').unbind('change');
|
||||
$('#db_select').unbind('change');
|
||||
$('#master_status_href').unbind('click');
|
||||
$('#master_slaves_href').unbind('click');
|
||||
$('#slave_status_href').unbind('click');
|
||||
$('#slave_control_href').unbind('click');
|
||||
$('#slave_errormanagement_href').unbind('click');
|
||||
$('#slave_synchronization_href').unbind('click');
|
||||
$('#db_reset_href').unbind('click');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('replication.js', function() {
|
||||
$('#rep').text(conf_prefix);
|
||||
$('#db_type').change(update_config);
|
||||
|
||||
@ -75,10 +75,16 @@ var RTE = {
|
||||
}; // end RTE namespace
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for the Routines, Triggers and Events editor.
|
||||
*
|
||||
* @see $cfg['AjaxEnable']
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('rte/common.js', function () {
|
||||
$('a.ajax.add_anchor, a.ajax.edit_anchor').die('click');
|
||||
$('table.rte_table').find('input[name^=item], input[name^=params]').die('keydown');
|
||||
$('a.ajax.export_anchor').die('click');
|
||||
$('a.ajax.drop_anchor').die('click');
|
||||
});
|
||||
|
||||
|
||||
AJAX.registerOnload('rte/common.js', function () {
|
||||
/**
|
||||
* Attach Ajax event handlers for the Add/Edit functionality.
|
||||
|
||||
@ -29,6 +29,13 @@ RTE.validateCustom = function () {
|
||||
return true;
|
||||
}; // end RTE.validateCustom()
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('rte/events.js', function () {
|
||||
$('select[name=item_type]').die('change');
|
||||
});
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for the "Change event type"
|
||||
* functionality in the events editor, so that the correct
|
||||
|
||||
@ -208,6 +208,18 @@ RTE.setOptionsForParameter = function ($type, $len, $text, $num) {
|
||||
}
|
||||
}; // end RTE.setOptionsForParameter()
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('rte/routines.js', function () {
|
||||
$('input[name=routine_addparameter]').die('click');
|
||||
$('a.routine_param_remove_anchor').die('click');
|
||||
$('select[name=item_type]').die('change');
|
||||
$('select[name^=item_param_type]').die('change');
|
||||
$('select[name=item_returntype]').die('change');
|
||||
$('a.ajax.exec_anchor').die('click');
|
||||
});
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for the Routines functionalities.
|
||||
*
|
||||
|
||||
@ -8,6 +8,14 @@
|
||||
* @required js/functions.js
|
||||
*/
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('server_databases.js', function() {
|
||||
$("button[name=drop_selected_dbs].ajax").die('click');
|
||||
$('#create_database_form.ajax').die('submit');
|
||||
});
|
||||
|
||||
/**
|
||||
* AJAX scripts for server_databases.php
|
||||
*
|
||||
|
||||
@ -95,6 +95,23 @@ function appendNewUser(new_user_string, new_user_initial, new_user_initial_strin
|
||||
* @name document.ready
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('server_privileges.js', function() {
|
||||
$("#fieldset_add_user a.ajax").die("click");
|
||||
$('form[name=usersForm]').unbind('submit');
|
||||
$("#reload_privileges_anchor.ajax").die("click");
|
||||
$("#fieldset_delete_user_footer #buttonGo.ajax").die('click');
|
||||
$("a.edit_user_anchor.ajax").die('click');
|
||||
$("#edit_user_dialog").find("form.ajax").die('submit');
|
||||
$("button.mult_submit[value=export]").die('click');
|
||||
$("a.export_user_anchor.ajax").die('click');
|
||||
$("#initials_table").find("a.ajax").die('click');
|
||||
$('#checkbox_drop_users_db').unbind('click');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('server_privileges.js', function() {
|
||||
/**
|
||||
* AJAX event handler for 'Add a New User'
|
||||
@ -353,7 +370,7 @@ AJAX.registerOnload('server_privileges.js', function() {
|
||||
* @memberOf jQuery
|
||||
* @name edit_user_submit
|
||||
*/
|
||||
$("#edit_user_dialog").find("form.ajax").die().live('submit', function(event) {
|
||||
$("#edit_user_dialog").find("form.ajax").live('submit', function(event) {
|
||||
/** @lends jQuery */
|
||||
event.preventDefault();
|
||||
|
||||
@ -537,7 +554,7 @@ AJAX.registerOnload('server_privileges.js', function() {
|
||||
* @name paginate_users_table_click
|
||||
* @memberOf jQuery
|
||||
*/
|
||||
$("#initials_table").find("a.ajax").die().live('click', function(event) {
|
||||
$("#initials_table").find("a.ajax").live('click', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
|
||||
@ -20,6 +20,26 @@ var pma_token,
|
||||
is_superuser,
|
||||
server_db_isLocal;
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('server_status.js', function() {
|
||||
$('a.popupLink').unbind('click');
|
||||
$(document).unbind('click'); // Am I sure about this? I guess not...
|
||||
$('div.buttonlinks select').unbind('click');
|
||||
$('div.buttonlinks a.tabRefresh').unbind('click');
|
||||
$('div.buttonlinks a.livetrafficLink').unbind('click');
|
||||
$('div.buttonlinks a.liveconnectionsLink').unbind('click');
|
||||
$('div.buttonlinks a.livequeriesLink').unbind('click');
|
||||
|
||||
$('#filterAlert').unbind('change');
|
||||
$('#filterText').unbind('keyup');
|
||||
$('#filterCategory').unbind('change');
|
||||
$('input#dontFormat').unbind('change');
|
||||
$('a[href="#openAdvisorInstructions"]').unbind('click');
|
||||
$('a[href="#startAnalyzer"]').unbind('click');
|
||||
});
|
||||
|
||||
// Add a tablesorter parser to properly handle thousands seperated numbers and SI prefixes
|
||||
AJAX.registerOnload('server_status.js', function() {
|
||||
|
||||
|
||||
@ -1,4 +1,29 @@
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('server_status_monitor.js', function() {
|
||||
$('a[href="#rearrangeCharts"], a[href="#endChartEditMode"]').unbind('click');
|
||||
$('div#statustabs_charting div.popupContent select[name="chartColumns"]').unbind('change');
|
||||
$('div#statustabs_charting div.popupContent select[name="gridChartRefresh"]').unbind('change');
|
||||
$('a[href="#addNewChart"]').unbind('click');
|
||||
$('a[href="#exportMonitorConfig"]').unbind('click');
|
||||
$('a[href="#importMonitorConfig"]').unbind('click');
|
||||
$('a[href="#clearMonitorConfig"]').unbind('click');
|
||||
$('a[href="#pauseCharts"]').unbind('click');
|
||||
$('a[href="#monitorInstructionsDialog"]').unbind('click');
|
||||
$('input[name="chartType"]').unbind('click');
|
||||
$('input[name="useDivisor"]').unbind('click');
|
||||
$('input[name="useUnit"]').unbind('click');
|
||||
$('select[name="varChartList"]').unbind('click');
|
||||
$('a[href="#kibDivisor"]').unbind('click');
|
||||
$('a[href="#mibDivisor"]').unbind('click');
|
||||
$('a[href="#submitClearSeries"]').unbind('click');
|
||||
$('a[href="#submitAddSeries"]').unbind('click');
|
||||
// $("input#variableInput").destroy();
|
||||
});
|
||||
|
||||
AJAX.registerOnload('server_status_monitor.js', function() {
|
||||
// Show tab links
|
||||
$('div#statustabs_charting div.tabLinks').show();
|
||||
@ -803,6 +828,7 @@ AJAX.registerOnload('server_status_monitor.js', function() {
|
||||
$('input[name="useDivisor"]').change(function() {
|
||||
$('span.divisorInput').toggle(this.checked);
|
||||
});
|
||||
|
||||
$('input[name="useUnit"]').change(function() {
|
||||
$('span.unitInput').toggle(this.checked);
|
||||
});
|
||||
|
||||
@ -318,6 +318,16 @@ function hideOrDisplayServerFields($server_selector, selected_option)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('server_synchonize.js', function() {
|
||||
$('select.server_selector').unbind('change');
|
||||
$('img.struct_img').unbind('hover');
|
||||
$('img.data_img').unbind('hover');
|
||||
$('#buttonGo').unbind('click');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('server_synchronize.js', function() {
|
||||
$('select.server_selector').change(function(evt) {
|
||||
var selected_option = $(evt.target).val();
|
||||
|
||||
@ -1,4 +1,13 @@
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('server_variables.js', function() {
|
||||
$('table.data tbody tr td:nth-child(2).editable').unbind('hover');
|
||||
$('#filterText').unbind('keyup');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('server_variables.js', function() {
|
||||
var textFilter = null, odd_row = false;
|
||||
var testString = 'abcdefghijklmnopqrstuvwxyz0123456789,ABCEFGHIJKLMOPQRSTUVWXYZ';
|
||||
@ -47,7 +56,7 @@ AJAX.registerOnload('server_variables.js', function() {
|
||||
charWidth = $tmpDiv.width() / testString.length;
|
||||
$tmpDiv.remove();
|
||||
|
||||
$(window).resize(limitTableWidth);
|
||||
$(window).resize(limitTableWidth); // FIXME: this doesn't work that well and binding anything to the window resize event is a bad idea
|
||||
limitTableWidth();
|
||||
|
||||
/* This function chops of long variable values to keep the table from overflowing horizontally
|
||||
|
||||
25
js/sql.js
25
js/sql.js
@ -56,6 +56,28 @@ function getFieldName($this_field)
|
||||
return field_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('sql.js', function() {
|
||||
$('input#bkm_label').unbind('keyup');
|
||||
$("#sqlqueryresults").die('makegrid');
|
||||
$("#togglequerybox").unbind('click');
|
||||
$("#button_submit_query").die('click');
|
||||
$("input[name=bookmark_variable]").unbind("keypress");
|
||||
$("#sqlqueryform.ajax").die('submit');
|
||||
$("input[name=navig].ajax").die('click');
|
||||
$("#pageselector").die('change');
|
||||
$("#table_results.ajax").find("a[title=Sort]").die('click');
|
||||
$("#displayOptionsForm.ajax").die('submit');
|
||||
$("#resultsForm.ajax .mult_submit[value=edit]").die('click');
|
||||
$("#insertForm .insertRowTable.ajax input[type=submit]").die('click');
|
||||
$("#buttonYes.ajax").die('click');
|
||||
$('a.browse_foreign').die('click');
|
||||
$('th.column_heading.pointer').die('hover');
|
||||
$('th.column_heading.marker').die('click');
|
||||
});
|
||||
|
||||
/**
|
||||
* @description <p>Ajax scripts for sql and browse pages</p>
|
||||
*
|
||||
@ -476,6 +498,7 @@ AJAX.registerOnload('sql.js', function() {
|
||||
/**$("#buttonYes.ajax").live('click'
|
||||
* Click action for #buttonYes button in ajax dialog insertForm
|
||||
*/
|
||||
|
||||
$("#buttonYes.ajax").live('click', function(event){
|
||||
event.preventDefault();
|
||||
/**
|
||||
@ -526,7 +549,7 @@ AJAX.registerOnload('sql.js', function() {
|
||||
}); // end $.post()
|
||||
});
|
||||
|
||||
}, 'top.frame_content'); // end $()
|
||||
}); // end $()
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -216,6 +216,18 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType)
|
||||
}
|
||||
/* End of datetime validation*/
|
||||
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('tbl_change.js', function() {
|
||||
$('span.open_gis_editor').die('click');
|
||||
$("input[name='gis_data[save]']").die('click');
|
||||
$('input.checkbox_null').unbind('click');
|
||||
$('select[name="submit_type"]').unbind('change');
|
||||
$("#insert_rows").die('change');
|
||||
});
|
||||
|
||||
/**
|
||||
* Ajax handlers for Change Table page
|
||||
*
|
||||
|
||||
@ -9,6 +9,19 @@ var currentChart = null;
|
||||
var nonJqplotSettings = null;
|
||||
var currentSettings = null;
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('tbl_chart.js', function() {
|
||||
$('input[name="chartType"]').unbind('click');
|
||||
$('input[name="barStacked"]').unbind('click');
|
||||
$('input[name="chartTitle"]').unbind('focus').unbind('keyup').unbind('blur');
|
||||
$('select[name="chartXAxis"]').unbind('change');
|
||||
$('select[name="chartSeries"]').unbind('change');
|
||||
$('input[name="xaxis_label"]').unbind('keyup');
|
||||
$('input[name="yaxis_label"]').unbind('keyup');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('tbl_chart.js', function() {
|
||||
chart_series = $('select[name="chartSeries"]').val();
|
||||
// If no series is selected null is returned.
|
||||
|
||||
@ -170,6 +170,29 @@ function initGISVisualization() {
|
||||
* Panning on clicking the arrow buttons.
|
||||
* Displaying tooltips for GIS objects.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('tbl_gis_visualization.js', function() {
|
||||
$('#choice').die('click');
|
||||
$('#placeholder').die('mousewheel');
|
||||
$('svg').die('dragstart');
|
||||
$('svg').die('mouseup');
|
||||
$('svg').die('drag');
|
||||
$('#placeholder').die('dblclick');
|
||||
$('#zoom_in').die('click');
|
||||
$('#zoom_world').die('click');
|
||||
$('#zoom_out').die('click');
|
||||
$('#left_arrow').die('click');
|
||||
$('#right_arrow').die('click');
|
||||
$('#up_arrow').die('click');
|
||||
$('#down_arrow').die('click');
|
||||
$('.polygon, .multipolygon, .point, .multipoint, .linestring, .multilinestring, '
|
||||
+ '.geometrycollection')
|
||||
.die('mousemove').die('mouseout');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('tbl_gis_visualization.js', function() {
|
||||
|
||||
// If we are in GIS visualization, initialize it
|
||||
|
||||
@ -15,6 +15,13 @@ function show_hide_clauses($thisDropdown)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('tbl_relation.js', function() {
|
||||
$('select.referenced_column_dropdown').unbind('change');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('tbl_relation.js', function() {
|
||||
// initial display
|
||||
$('select.referenced_column_dropdown').each(function(index, one_dropdown) {
|
||||
|
||||
@ -12,6 +12,17 @@
|
||||
* Actions ajaxified here:
|
||||
* Table Search
|
||||
*/
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('tbl_select.js', function() {
|
||||
$('#togglesearchformlink').unbind('click');
|
||||
$("#tbl_search_form.ajax").die('submit');
|
||||
$('select.geom_func').unbind('change');
|
||||
$('span.open_search_gis_editor').die('click');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('tbl_select.js', function() {
|
||||
/**
|
||||
* Prepare a div containing a link, otherwise it's incorrectly displayed
|
||||
|
||||
@ -17,6 +17,21 @@
|
||||
* Drop Primary Key/Index
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('tbl_structure.js', function() {
|
||||
$("a.drop_column_anchor.ajax").die('click');
|
||||
$("a.action_primary.ajax").die('click');
|
||||
$('a.drop_primary_key_index_anchor.ajax').die('click');
|
||||
$("#table_index tbody tr td.edit_index.ajax, #indexes .add_index.ajax").die('click');
|
||||
$('#index_frm input[type=submit]').die('click');
|
||||
$("#move_columns_anchor").die('click');
|
||||
$("#addColumns.ajax input[type=submit]").die('click');
|
||||
$("#append_fields_form.ajax input[name=do_save_data]").die('click');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('tbl_structure.js', function() {
|
||||
/**
|
||||
* Attach Event Handler for 'Drop Column'
|
||||
@ -510,13 +525,12 @@ AJAX.registerOnload('tbl_structure.js', function() {
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}); // end $.get()
|
||||
});
|
||||
}); // end $()
|
||||
|
||||
/**
|
||||
* jQuery coding for 'Change Table' and 'Add Column'. Used on tbl_structure.php *
|
||||
* Attach Ajax Event handlers for Change Table
|
||||
*/
|
||||
AJAX.registerOnload('tbl_structure.js', function() {
|
||||
/**
|
||||
* jQuery coding for 'Change Table' and 'Add Column'. Used on tbl_structure.php *
|
||||
* Attach Ajax Event handlers for Change Table
|
||||
*/
|
||||
|
||||
/**
|
||||
*Ajax action for submitting the "Column Change" and "Add Column" form
|
||||
**/
|
||||
@ -733,7 +747,7 @@ function moreOptsMenuResize() {
|
||||
});
|
||||
}
|
||||
AJAX.registerOnload('tbl_structure.js', function () {
|
||||
$(window).resize(moreOptsMenuResize);
|
||||
$(window).resize(moreOptsMenuResize); // FIXME: shouldn't register that can't be unbound easily
|
||||
$("div.replace_in_more").hide();
|
||||
moreOptsMenuResize();
|
||||
});
|
||||
|
||||
@ -104,6 +104,22 @@ function scrollToChart() {
|
||||
$('html,body').animate({scrollTop: x}, 500);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('tbl_zoom_plot_jqplot.js', function() {
|
||||
$('#tableid_0').unbind('change');
|
||||
$('#tableid_1').unbind('change');
|
||||
$('#tableid_2').unbind('change');
|
||||
$('#tableid_3').unbind('change');
|
||||
$('#inputFormSubmitId').unbind('click');
|
||||
$('#togglesearchformlink').unbind('click');
|
||||
$("#dataDisplay").find(':input').die('keydown');
|
||||
$('button.button-reset').unbind('click');
|
||||
$('div#resizer').unbind('resizestop');
|
||||
$('div#querychart').unbind('jqplotDataClick');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
|
||||
var cursorMode = ($("input[name='mode']:checked").val() == 'edit') ? 'crosshair' : 'pointer';
|
||||
var currentChart = null;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user