')
+ .text(
+ PMA_sprintf(
+ PMA_messages.strConsoleDebugArgsSummary,
+ dbgStep.args.length
+ )
+ )
+ );
for (var i = 0; i < dbgStep.args.length; i++) {
$args.append(
$('
')
.html(
- '
' +
- escapeHtml(JSON.stringify(dbgStep.args[i], null, " ")) +
+ '' +
+ escapeHtml(JSON.stringify(dbgStep.args[i], null, ' ')) +
''
- )
+ )
);
}
}
@@ -1280,8 +1277,8 @@ PMA_consoleDebug = {
$stepElem =
$('')
.append(
- $('
').text(step)
- );
+ $('').text(step)
+ );
} else {
if (typeof step.args === 'string' && step.args) {
step.args = [step.args];
@@ -1289,29 +1286,29 @@ PMA_consoleDebug = {
$stepElem =
$('')
.append(
- $('
').text(this._formatFunctionCall(step))
- )
+ $('').text(this._formatFunctionCall(step))
+ )
.append(
- $('').text(this._formatFileName(step))
- );
+ $('').text(this._formatFileName(step))
+ );
if (step.args && step.args.length) {
$stepElem
.append(
- $('').html(this._formatFunctionArgs(step))
- )
+ $('').html(this._formatFunctionArgs(step))
+ )
.prepend(
- $('')
- .append(
- '
' +
+ $('')
+ .append(
+ '
' +
PMA_messages.strConsoleDebugShowArgs +
' '
- )
- .append(
- '
' +
+ )
+ .append(
+ '' +
PMA_messages.strConsoleDebugHideArgs +
' '
- )
- );
+ )
+ );
}
}
$traceElem.append($stepElem);
@@ -1340,12 +1337,12 @@ PMA_consoleDebug = {
var $query = $('')
.append(
- $('#debug_console').find('.templates .debug_query').clone()
- )
+ $('#debug_console').find('.templates .debug_query').clone()
+ )
.append(
- $('
')
- .text(queryText)
- )
+ $('
')
+ .text(queryText)
+ )
.data('queryInfo', queryInfo)
.data('totalTime', totalTime);
if (grouped) {
@@ -1371,12 +1368,12 @@ PMA_consoleDebug = {
$singleQuery = $('
')
.text((parseInt(i) + 1) + '.')
.append(
- $('
').text(
- PMA_messages.strConsoleDebugTimeTaken +
+ $('').text(
+ PMA_messages.strConsoleDebugTimeTaken +
' ' + queryInfo[i].time + 's' +
' (' + ((queryInfo[i].time * 100) / totalTime).toFixed(3) + '%)'
- )
- );
+ )
+ );
this._appendQueryExtraInfo(queryInfo[i], $singleQuery);
$query
.append('')
@@ -1391,20 +1388,20 @@ PMA_consoleDebug = {
this._lastDebugInfo.url = url;
$('#debug_console').find('.debugLog').empty();
- $("#debug_console").find(".debug>.welcome").empty();
+ $('#debug_console').find('.debug>.welcome').empty();
var debugJson = false, i;
- if (typeof debugInfo === "object" && 'queries' in debugInfo) {
+ if (typeof debugInfo === 'object' && 'queries' in debugInfo) {
// Copy it to debugJson, so that it doesn't get changed
if (!('queries' in debugInfo)) {
debugJson = false;
} else {
- debugJson = {queries: []};
+ debugJson = { queries: [] };
for (i in debugInfo.queries) {
debugJson.queries[i] = debugInfo.queries[i];
}
}
- } else if (typeof debugInfo === "string") {
+ } else if (typeof debugInfo === 'string') {
try {
debugJson = JSON.parse(debugInfo);
} catch (e) {
@@ -1415,7 +1412,7 @@ PMA_consoleDebug = {
}
}
if (debugJson === false) {
- $("#debug_console").find(".debug>.welcome").text(
+ $('#debug_console').find('.debug>.welcome').text(
PMA_messages.strConsoleDebugError
);
return;
@@ -1444,7 +1441,7 @@ PMA_consoleDebug = {
}
uniqueQueries = uniqueArray;
// Show summary
- $("#debug_console").find(".debug>.welcome").append(
+ $('#debug_console').find('.debug>.welcome').append(
$('
').text(
PMA_sprintf(
PMA_messages.strConsoleDebugSummary,
@@ -1455,13 +1452,13 @@ PMA_consoleDebug = {
)
);
if (url) {
- $("#debug_console").find(".debug>.welcome").append(
+ $('#debug_console').find('.debug>.welcome').append(
$('').text(url.split('?')[0])
);
}
// For sorting queries
- function sortByTime(a, b) {
+ function sortByTime (a, b) {
var order = ((PMA_consoleDebug.configParam('order') == 'asc') ? 1 : -1);
if (Array.isArray(a) && Array.isArray(b)) {
// It is grouped
@@ -1478,7 +1475,7 @@ PMA_consoleDebug = {
}
}
- function sortByCount(a, b) {
+ function sortByCount (a, b) {
var order = ((PMA_consoleDebug.configParam('order') == 'asc') ? 1 : -1);
return (a.length - b.length) * order;
}
@@ -1522,7 +1519,7 @@ PMA_consoleDebug = {
}
};
-/**s
+/** s
* Executed on page load
*/
$(function () {
diff --git a/js/cross_framing_protection.js b/js/cross_framing_protection.js
index 91e9aa9e49..e6bac0adbb 100644
--- a/js/cross_framing_protection.js
+++ b/js/cross_framing_protection.js
@@ -3,10 +3,10 @@
* Conditionally included if framing is not allowed
*/
if (self == top) {
- var style_element = document.getElementById("cfs-style");
+ var style_element = document.getElementById('cfs-style');
// check if style_element has already been removed
// to avoid frequently reported js error
- if (typeof(style_element) != 'undefined' && style_element != null) {
+ if (typeof(style_element) !== 'undefined' && style_element != null) {
style_element.parentNode.removeChild(style_element);
}
} else {
diff --git a/js/db_central_columns.js b/js/db_central_columns.js
index 5026239a9e..0c6590a333 100644
--- a/js/db_central_columns.js
+++ b/js/db_central_columns.js
@@ -17,20 +17,20 @@
*/
AJAX.registerTeardown('db_central_columns.js', function () {
- $(".edit").off('click');
- $(".edit_save_form").off('click');
+ $('.edit').off('click');
+ $('.edit_save_form').off('click');
$('.edit_cancel_form').off('click');
- $(".del_row").off('click');
- $(document).off("keyup", ".filter_rows");
+ $('.del_row').off('click');
+ $(document).off('keyup', '.filter_rows');
$('.edit_cancel_form').off('click');
$('#table-select').off('change');
$('#column-select').off('change');
- $("#add_col_div").find(">a").off('click');
+ $('#add_col_div').find('>a').off('click');
$('#add_new').off('submit');
$('#multi_edit_central_columns').off('submit');
- $("select.default_type").off('change');
- $("button[name='delete_central_columns']").off('click');
- $("button[name='edit_central_columns']").off('click');
+ $('select.default_type').off('change');
+ $('button[name=\'delete_central_columns\']').off('click');
+ $('button[name=\'edit_central_columns\']').off('click');
});
AJAX.registerOnload('db_central_columns.js', function () {
@@ -38,111 +38,111 @@ AJAX.registerOnload('db_central_columns.js', function () {
$('#tableslistcontainer').find('.checkall').show();
$('#tableslistcontainer').find('.checkall_box').show();
if ($('#table_columns').find('tbody tr').length > 0) {
- $("#table_columns").tablesorter({
+ $('#table_columns').tablesorter({
headers: {
- 0: {sorter: false},
- 1: {sorter: false}, // hidden column
- 4: {sorter: "integer"}
+ 0: { sorter: false },
+ 1: { sorter: false }, // hidden column
+ 4: { sorter: 'integer' }
}
});
}
- $('#tableslistcontainer').find('button[name="delete_central_columns"]').click(function(event){
+ $('#tableslistcontainer').find('button[name="delete_central_columns"]').click(function (event) {
event.preventDefault();
var multi_delete_columns = $('.checkall:checkbox:checked').serialize();
- if(multi_delete_columns === ''){
+ if (multi_delete_columns === '') {
PMA_ajaxShowMessage(PMA_messages.strRadioUnchecked);
return false;
}
PMA_ajaxShowMessage();
- $("#del_col_name").val(multi_delete_columns);
- $("#del_form").submit();
+ $('#del_col_name').val(multi_delete_columns);
+ $('#del_form').submit();
});
- $('#tableslistcontainer').find('button[name="edit_central_columns"]').click(function(event){
+ $('#tableslistcontainer').find('button[name="edit_central_columns"]').click(function (event) {
event.preventDefault();
var editColumnList = $('.checkall:checkbox:checked').serialize();
- if(editColumnList === ''){
+ if (editColumnList === '') {
PMA_ajaxShowMessage(PMA_messages.strRadioUnchecked);
return false;
}
- var editColumnData = editColumnList+ '&edit_central_columns_page=true&ajax_request=true&ajax_page_request=true&db='+PMA_commonParams.get('db');
+ var editColumnData = editColumnList + '&edit_central_columns_page=true&ajax_request=true&ajax_page_request=true&db=' + PMA_commonParams.get('db');
PMA_ajaxShowMessage();
AJAX.source = $(this);
$.get('db_central_columns.php', editColumnData, AJAX.responseHandler);
});
- $('#multi_edit_central_columns').submit(function(event){
+ $('#multi_edit_central_columns').submit(function (event) {
event.preventDefault();
event.stopPropagation();
- var multi_column_edit_data = $("#multi_edit_central_columns").serialize()+'&multi_edit_central_column_save=true&ajax_request=true&ajax_page_request=true&db='+encodeURIComponent(PMA_commonParams.get('db'));
+ var multi_column_edit_data = $('#multi_edit_central_columns').serialize() + '&multi_edit_central_column_save=true&ajax_request=true&ajax_page_request=true&db=' + encodeURIComponent(PMA_commonParams.get('db'));
PMA_ajaxShowMessage();
AJAX.source = $(this);
$.post('db_central_columns.php', multi_column_edit_data, AJAX.responseHandler);
});
- $('#add_new').find('td').each(function(){
+ $('#add_new').find('td').each(function () {
if ($(this).attr('name') !== 'undefined') {
$(this).find('input,select:first').attr('name', $(this).attr('name'));
}
});
- $("#field_0_0").attr('required','required');
+ $('#field_0_0').attr('required','required');
$('#add_new input[type="text"], #add_new input[type="number"], #add_new select')
.css({
'width' : '10em',
'-moz-box-sizing' : 'border-box'
});
window.scrollTo(0, 0);
- $(document).on("keyup", ".filter_rows", function () {
+ $(document).on('keyup', '.filter_rows', function () {
// get the column names
var cols = $('th.column_heading').map(function () {
return $.trim($(this).text());
}).get();
- $.uiTableFilter($("#table_columns"), $(this).val(), cols, null, "td span");
+ $.uiTableFilter($('#table_columns'), $(this).val(), cols, null, 'td span');
});
- $('.edit').click(function() {
+ $('.edit').click(function () {
var rownum = $(this).parent().data('rownum');
$('#save_' + rownum).show();
$(this).hide();
$('#f_' + rownum + ' td span').hide();
$('#f_' + rownum + ' input, #f_' + rownum + ' select, #f_' + rownum + ' .open_enum_editor').show();
var attribute_val = $('#f_' + rownum + ' td[name=col_attribute] span').html();
- $('#f_' + rownum + ' select[name=field_attribute\\['+ rownum +'\\] ] option[value="' + attribute_val + '"]').attr("selected","selected");
- if($('#f_' + rownum + ' .default_type').val() === 'USER_DEFINED') {
+ $('#f_' + rownum + ' select[name=field_attribute\\[' + rownum + '\\] ] option[value="' + attribute_val + '"]').attr('selected','selected');
+ if ($('#f_' + rownum + ' .default_type').val() === 'USER_DEFINED') {
$('#f_' + rownum + ' .default_type').siblings('.default_value').show();
} else {
$('#f_' + rownum + ' .default_type').siblings('.default_value').hide();
}
});
- $(".del_row").click(function (event) {
+ $('.del_row').click(function (event) {
event.preventDefault();
event.stopPropagation();
var $td = $(this);
var question = PMA_messages.strDeleteCentralColumnWarning;
$td.PMA_confirm(question, null, function (url) {
var rownum = $td.data('rownum');
- $("#del_col_name").val("selected_fld%5B%5D="+$('#checkbox_row_' + rownum ).val());
- $("#del_form").submit();
+ $('#del_col_name').val('selected_fld%5B%5D=' + $('#checkbox_row_' + rownum).val());
+ $('#del_form').submit();
});
});
- $('.edit_cancel_form').click(function(event) {
+ $('.edit_cancel_form').click(function (event) {
event.preventDefault();
event.stopPropagation();
var rownum = $(this).data('rownum');
$('#save_' + rownum).hide();
$('#edit_' + rownum).show();
$('#f_' + rownum + ' td span').show();
- $('#f_' + rownum + ' input, #f_' + rownum + ' select,#f_'+rownum+' .default_value, #f_' + rownum + ' .open_enum_editor').hide();
+ $('#f_' + rownum + ' input, #f_' + rownum + ' select,#f_' + rownum + ' .default_value, #f_' + rownum + ' .open_enum_editor').hide();
$('#tableslistcontainer').find('.checkall').show();
});
- $('.edit_save_form').click(function(event) {
+ $('.edit_save_form').click(function (event) {
event.preventDefault();
event.stopPropagation();
var rownum = $(this).data('rownum');
- $('#f_' + rownum + ' td').each(function() {
+ $('#f_' + rownum + ' td').each(function () {
if ($(this).attr('name') !== 'undefined') {
$(this).find(':input[type!="hidden"],select:first')
- .attr('name', $(this).attr('name'));
+ .attr('name', $(this).attr('name'));
}
});
- if($('#f_' + rownum + ' .default_type').val() === 'USER_DEFINED') {
+ if ($('#f_' + rownum + ' .default_type').val() === 'USER_DEFINED') {
$('#f_' + rownum + ' .default_type').attr('name','col_default_sel');
} else {
$('#f_' + rownum + ' .default_value').attr('name','col_default_val');
@@ -150,11 +150,11 @@ AJAX.registerOnload('db_central_columns.js', function () {
var datastring = $('#f_' + rownum + ' :input').serialize();
$.ajax({
- type: "POST",
- url: "db_central_columns.php",
- data: datastring+'&ajax_request=true',
- dataType: "json",
- success: function(data) {
+ type: 'POST',
+ url: 'db_central_columns.php',
+ data: datastring + '&ajax_request=true',
+ dataType: 'json',
+ success: function (data) {
if (data.message !== '1') {
PMA_ajaxShowMessage(
'' +
@@ -168,8 +168,8 @@ AJAX.registerOnload('db_central_columns.js', function () {
$('#f_' + rownum + ' td[name=col_length] span').text($('#f_' + rownum + ' input[name=col_length]').val()).html();
$('#f_' + rownum + ' td[name=collation] span').text($('#f_' + rownum + ' select[name=collation]').val()).html();
$('#f_' + rownum + ' td[name=col_attribute] span').text($('#f_' + rownum + ' select[name=col_attribute]').val()).html();
- $('#f_' + rownum + ' td[name=col_isNull] span').text($('#f_' + rownum +' input[name=col_isNull]').is(":checked")?"Yes":"No").html();
- $('#f_' + rownum + ' td[name=col_extra] span').text($('#f_' + rownum + ' input[name=col_extra]').is(":checked") ? "auto_increment" : "").html();
+ $('#f_' + rownum + ' td[name=col_isNull] span').text($('#f_' + rownum + ' input[name=col_isNull]').is(':checked') ? 'Yes' : 'No').html();
+ $('#f_' + rownum + ' td[name=col_extra] span').text($('#f_' + rownum + ' input[name=col_extra]').is(':checked') ? 'auto_increment' : '').html();
$('#f_' + rownum + ' td[name=col_default] span').text($('#f_' + rownum + ' :input[name=col_default]').val()).html();
}
$('#save_' + rownum).hide();
@@ -178,20 +178,20 @@ AJAX.registerOnload('db_central_columns.js', function () {
$('#f_' + rownum + ' input, #f_' + rownum + ' select,#f_' + rownum + ' .default_value, #f_' + rownum + ' .open_enum_editor').hide();
$('#tableslistcontainer').find('.checkall').show();
},
- error: function() {
- PMA_ajaxShowMessage(
- '
' +
+ error: function () {
+ PMA_ajaxShowMessage(
+ '
' +
PMA_messages.strErrorProcessingRequest +
'
',
- false
- );
- }
+ false
+ );
+ }
});
});
- $('#table-select').change(function(e) {
+ $('#table-select').change(function (e) {
var selectvalue = $(this).val();
var default_column_select = $('#column-select').find('option:first');
- var href = "db_central_columns.php";
+ var href = 'db_central_columns.php';
var params = {
'ajax_request' : true,
'server' : PMA_commonParams.get('server'),
@@ -200,32 +200,32 @@ AJAX.registerOnload('db_central_columns.js', function () {
'populateColumns' : true
};
$('#column-select').html('
');
- if (selectvalue !== "") {
+ if (selectvalue !== '') {
$.post(href, params, function (data) {
$('#column-select').empty().append(default_column_select);
$('#column-select').append(data.message);
});
}
});
- $('#column-select').change(function(e) {
+ $('#column-select').change(function (e) {
var selectvalue = $(this).val();
- if (selectvalue !== "") {
- $("#add_column").submit();
+ if (selectvalue !== '') {
+ $('#add_column').submit();
}
});
- $("#add_col_div").find(">a").click(function(event){
- $('#add_new').slideToggle("slow");
- var $addColDivLinkSpan = $("#add_col_div").find(">a span");
- if($addColDivLinkSpan.html() === '+') {
+ $('#add_col_div').find('>a').click(function (event) {
+ $('#add_new').slideToggle('slow');
+ var $addColDivLinkSpan = $('#add_col_div').find('>a span');
+ if ($addColDivLinkSpan.html() === '+') {
$addColDivLinkSpan.html('-');
} else {
$addColDivLinkSpan.html('+');
}
});
- $('#add_new').submit(function(event){
+ $('#add_new').submit(function (event) {
$('#add_new').toggle();
});
- $("#tableslistcontainer").find("select.default_type").change(function () {
+ $('#tableslistcontainer').find('select.default_type').change(function () {
if ($(this).val() === 'USER_DEFINED') {
$(this).siblings('.default_value').attr('name','col_default');
$(this).attr('name','col_default_sel');
diff --git a/js/db_multi_table_query.js b/js/db_multi_table_query.js
index 6438f7ce87..f42fb04af3 100644
--- a/js/db_multi_table_query.js
+++ b/js/db_multi_table_query.js
@@ -17,7 +17,7 @@
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('db_multi_table_query.js', function () {
- $('.tableNameSelect').each(function(){
+ $('.tableNameSelect').each(function () {
$(this).off('change');
});
$('#update_query_button').off('click');
@@ -25,7 +25,6 @@ AJAX.registerTeardown('db_multi_table_query.js', function () {
});
AJAX.registerOnload('db_multi_table_query.js', function () {
-
var editor = PMA_getSQLEditor($('#MultiSqlquery'), {}, 'both');
$('.CodeMirror-line').css('text-align', 'left');
editor.setSize(-1, 50);
@@ -34,25 +33,24 @@ AJAX.registerOnload('db_multi_table_query.js', function () {
PMA_init_slider();
addNewColumnCallbacks();
- function escapeBacktick(s) {
+ function escapeBacktick (s) {
return s.replace('`', '``');
}
- function escapeSingleQuote(s) {
+ function escapeSingleQuote (s) {
return s.replace('\\', '\\\\').replace('\'', '\\\'');
}
- $('#update_query_button').on('click', function() {
+ $('#update_query_button').on('click', function () {
var columns = [];
var table_aliases = {};
- $('.tableNameSelect').each(function() {
+ $('.tableNameSelect').each(function () {
$show = $(this).siblings('.show_col').first();
- if ($(this).val() !== "" && $show.prop('checked')) {
-
+ if ($(this).val() !== '' && $show.prop('checked')) {
var table_alias = $(this).siblings('.table_alias').first().val();
var column_alias = $(this).siblings('.col_alias').first().val();
- if (table_alias !== "") {
+ if (table_alias !== '') {
columns.push([table_alias, $(this).siblings('.columnNameSelect').first().val()]);
} else {
columns.push([$(this).val(), $(this).siblings('.columnNameSelect').first().val()]);
@@ -76,12 +74,12 @@ AJAX.registerOnload('db_multi_table_query.js', function () {
query = 'SELECT ';
query += '`' + escapeBacktick(columns[0][0]) + '`.`' + escapeBacktick(columns[0][1]) + '`';
- if (columns[0][2] !== "") {
+ if (columns[0][2] !== '') {
query += ' AS ' + columns[0][2];
}
for (var i = 1; i < columns.length; i++) {
query += ', `' + escapeBacktick(columns[i][0]) + '`.`' + escapeBacktick(columns[i][1]) + '`';
- if (columns[i][2] !== "") {
+ if (columns[i][2] !== '') {
query += ' AS `' + escapeBacktick(columns[0][2]) + '`';
}
}
@@ -92,8 +90,8 @@ AJAX.registerOnload('db_multi_table_query.js', function () {
if (table_count > 0) {
query += ', ';
}
- query += '`' + escapeBacktick(table) + '`'
- if (table_aliases[table][i] !== "") {
+ query += '`' + escapeBacktick(table) + '`';
+ if (table_aliases[table][i] !== '') {
query += ' AS `' + escapeBacktick(table_aliases[table][i]) + '`';
}
table_count++;
@@ -108,42 +106,41 @@ AJAX.registerOnload('db_multi_table_query.js', function () {
var count = 0;
- $('.tableNameSelect').each(function() {
+ $('.tableNameSelect').each(function () {
$criteria_div = $(this).siblings('.slide-wrapper').first();
$use_criteria = $(this).siblings('.criteria_col').first();
- if ($(this).val() !== "" && $use_criteria.prop('checked')) {
+ if ($(this).val() !== '' && $use_criteria.prop('checked')) {
if (count > 0) {
- $criteria_div.find('input.logical_op').each(function(){
+ $criteria_div.find('input.logical_op').each(function () {
if ($(this).prop('checked')) {
query += ' ' + $(this).val() + ' ';
}
});
}
formats_text = {
- '=' : " = '%s'",
- '>' : " > '%s'",
- '>=' : " >= '%s'",
- '<' : " < '%s'",
- '<=' : " <= '%s'",
- '!=' : " != '%s'",
- 'LIKE' : " LIKE '%s'",
- 'LIKE \%...\%' : " LIKE '%%%s%%'",
- 'NOT LIKE' : " NOT LIKE '%s'",
- 'BETWEEN' : " BETWEEN '%s'",
- 'NOT BETWEEN' : " NOT BETWEEN '%s'",
- 'IS NULL' : " '%s' IS NULL",
- 'IS NOT NULL' : " '%s' IS NOT NULL",
- 'REGEXP' : " REGEXP '%s'",
- 'REGEXP ^...$' : " REGEXP '^%s$'",
- 'NOT REGEXP' : " NOT REGEXP '%s'"
- }
+ '=' : ' = \'%s\'',
+ '>' : ' > \'%s\'',
+ '>=' : ' >= \'%s\'',
+ '<' : ' < \'%s\'',
+ '<=' : ' <= \'%s\'',
+ '!=' : ' != \'%s\'',
+ 'LIKE' : ' LIKE \'%s\'',
+ 'LIKE \%...\%' : ' LIKE \'%%%s%%\'',
+ 'NOT LIKE' : ' NOT LIKE \'%s\'',
+ 'BETWEEN' : ' BETWEEN \'%s\'',
+ 'NOT BETWEEN' : ' NOT BETWEEN \'%s\'',
+ 'IS NULL' : ' \'%s\' IS NULL',
+ 'IS NOT NULL' : ' \'%s\' IS NOT NULL',
+ 'REGEXP' : ' REGEXP \'%s\'',
+ 'REGEXP ^...$' : ' REGEXP \'^%s$\'',
+ 'NOT REGEXP' : ' NOT REGEXP \'%s\''
+ };
query += '`' + escapeBacktick($(this).val()) + '`.';
query += '`' + escapeBacktick($(this).siblings('.columnNameSelect').first().val()) + '`';
if ($criteria_div.find('.criteria_rhs').first().val() === 'text') {
// query += " '" + $criteria_div.find('.rhs_text_val').first().val() + "'";
query += sprintf(formats_text[$criteria_div.find('.criteria_op').first().val()], escapeSingleQuote($criteria_div.find('.rhs_text_val').first().val()));
- }
- else {
+ } else {
query += ' ' + $criteria_div.find('.criteria_op').first().val();
query += ' `' + escapeBacktick($criteria_div.find('.tableNameSelect').first().val()) + '`.';
query += '`' + escapeBacktick($criteria_div.find('.columnNameSelect').first().val()) + '`';
@@ -155,10 +152,9 @@ AJAX.registerOnload('db_multi_table_query.js', function () {
query += ';';
editor.getDoc().setValue(query);
-
});
- $('#submit_query').on('click', function() {
+ $('#submit_query').on('click', function () {
var query = editor.getDoc().getValue();
var data = {
'db': $('#db_name').val(),
@@ -167,18 +163,18 @@ AJAX.registerOnload('db_multi_table_query.js', function () {
'token': PMA_commonParams.get('token')
};
$.ajax({
- type: "POST",
- url: "db_multi_table_query.php",
+ type: 'POST',
+ url: 'db_multi_table_query.php',
data: data,
- success: function(data) {
+ success: function (data) {
$results_dom = $(data.message);
- $results_dom.find('.ajax:not(.pageselector)').each(function() {
- $(this).on('click', function(event) {
+ $results_dom.find('.ajax:not(.pageselector)').each(function () {
+ $(this).on('click', function (event) {
event.preventDefault();
});
});
- $results_dom.find('.autosubmit, .pageselector, .showAllRows, .filter_rows').each(function() {
- $(this).on('change click select focus', function(event) {
+ $results_dom.find('.autosubmit, .pageselector, .showAllRows, .filter_rows').each(function () {
+ $(this).on('change click select focus', function (event) {
event.preventDefault();
});
});
@@ -188,7 +184,7 @@ AJAX.registerOnload('db_multi_table_query.js', function () {
});
});
- $('#add_column_button').on('click', function() {
+ $('#add_column_button').on('click', function () {
column_count++;
$new_column_dom = $($('#new_column_layout').html()).clone();
$new_column_dom.find('div').first().find('div').first().attr('id', column_count.toString());
@@ -200,24 +196,25 @@ AJAX.registerOnload('db_multi_table_query.js', function () {
addNewColumnCallbacks();
});
- function addNewColumnCallbacks() {
- $('.tableNameSelect').each(function(){
- $(this).on('change', function() {
+ function addNewColumnCallbacks () {
+ $('.tableNameSelect').each(function () {
+ $(this).on('change', function () {
$sibs = $(this).siblings('.columnNameSelect');
- if ($sibs.length === 0)
+ if ($sibs.length === 0) {
$sibs = $(this).parent().parent().find('.columnNameSelect');
+ }
$sibs.first().html($('#' + $.md5($(this).val())).html());
});
});
- $('.removeColumn').each(function() {
- $(this).on('click', function() {
+ $('.removeColumn').each(function () {
+ $(this).on('click', function () {
$(this).parent().remove();
});
});
- $('a.ajax').each(function() {
- $(this).on('click', function(event, from) {
+ $('a.ajax').each(function () {
+ $(this).on('click', function (event, from) {
if (from === null) {
$checkbox = $(this).siblings('.criteria_col').first();
$checkbox.prop('checked', !$checkbox.prop('checked'));
@@ -229,15 +226,15 @@ AJAX.registerOnload('db_multi_table_query.js', function () {
});
});
- $('.criteria_col').each(function() {
- $(this).on('change', function() {
+ $('.criteria_col').each(function () {
+ $(this).on('change', function () {
$anchor = $(this).siblings('a.ajax').first();
$anchor.trigger('click', ['Trigger']);
});
});
- $('.criteria_rhs').each(function() {
- $(this).on('change', function() {
+ $('.criteria_rhs').each(function () {
+ $(this).on('change', function () {
$rhs_col = $(this).parent().parent().siblings('.rhs_table').first();
$rhs_text = $(this).parent().parent().siblings('.rhs_text').first();
if ($(this).val() === 'text') {
diff --git a/js/db_operations.js b/js/db_operations.js
index 537800cc36..74c21282ff 100644
--- a/js/db_operations.js
+++ b/js/db_operations.js
@@ -23,25 +23,24 @@
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('db_operations.js', function () {
- $(document).off('submit', "#rename_db_form.ajax");
- $(document).off('submit', "#copy_db_form.ajax");
- $(document).off('submit', "#change_db_charset_form.ajax");
- $(document).off('click', "#drop_db_anchor.ajax");
+ $(document).off('submit', '#rename_db_form.ajax');
+ $(document).off('submit', '#copy_db_form.ajax');
+ $(document).off('submit', '#change_db_charset_form.ajax');
+ $(document).off('click', '#drop_db_anchor.ajax');
});
AJAX.registerOnload('db_operations.js', function () {
-
/**
* Ajax event handlers for 'Rename Database'
*/
- $(document).on('submit', "#rename_db_form.ajax", function (event) {
+ $(document).on('submit', '#rename_db_form.ajax', function (event) {
event.preventDefault();
var old_db_name = PMA_commonParams.get('db');
var new_db_name = $('#new_db_name').val();
if (new_db_name == old_db_name) {
- PMA_ajaxShowMessage(PMA_messages.strDatabaseRenameToSameName, false, "error");
+ PMA_ajaxShowMessage(PMA_messages.strDatabaseRenameToSameName, false, 'error');
return false;
}
@@ -53,14 +52,14 @@ AJAX.registerOnload('db_operations.js', function () {
$form.PMA_confirm(question, $form.attr('action'), function (url) {
PMA_ajaxShowMessage(PMA_messages.strRenamingDatabases, false);
- $.post(url, $("#rename_db_form").serialize() + '&is_js_confirmed=1', function (data) {
+ $.post(url, $('#rename_db_form').serialize() + '&is_js_confirmed=1', function (data) {
if (typeof data !== 'undefined' && data.success === true) {
PMA_ajaxShowMessage(data.message);
PMA_commonParams.set('db', data.newname);
PMA_reloadNavigation(function () {
$('#pma_navigation_tree')
- .find("a:not('.expander')")
+ .find('a:not(\'.expander\')')
.each(function (index) {
var $thisAnchor = $(this);
if ($thisAnchor.text() == data.newname) {
@@ -80,7 +79,7 @@ AJAX.registerOnload('db_operations.js', function () {
/**
* Ajax Event Handler for 'Copy Database'
*/
- $(document).on('submit', "#copy_db_form.ajax", function (event) {
+ $(document).on('submit', '#copy_db_form.ajax', function (event) {
event.preventDefault();
PMA_ajaxShowMessage(PMA_messages.strCopyingDatabase, false);
var $form = $(this);
@@ -89,7 +88,7 @@ AJAX.registerOnload('db_operations.js', function () {
// use messages that stay on screen
$('div.success, div.error').fadeOut();
if (typeof data !== 'undefined' && data.success === true) {
- if ($("#checkbox_switch").is(":checked")) {
+ if ($('#checkbox_switch').is(':checked')) {
PMA_commonParams.set('db', data.newname);
PMA_commonActions.refreshMain(false, function () {
PMA_ajaxShowMessage(data.message);
@@ -108,12 +107,12 @@ AJAX.registerOnload('db_operations.js', function () {
/**
* Ajax Event handler for 'Change Charset' of the database
*/
- $(document).on('submit', "#change_db_charset_form.ajax", function (event) {
+ $(document).on('submit', '#change_db_charset_form.ajax', function (event) {
event.preventDefault();
var $form = $(this);
PMA_prepareForAjaxRequest($form);
PMA_ajaxShowMessage(PMA_messages.strChangingCharset);
- $.post($form.attr('action'), $form.serialize() + "&submitcollation=1", function (data) {
+ $.post($form.attr('action'), $form.serialize() + '&submitcollation=1', function (data) {
if (typeof data !== 'undefined' && data.success === true) {
PMA_ajaxShowMessage(data.message);
} else {
@@ -125,7 +124,7 @@ AJAX.registerOnload('db_operations.js', function () {
/**
* Ajax event handlers for Drop Database
*/
- $(document).on('click', "#drop_db_anchor.ajax", function (event) {
+ $(document).on('click', '#drop_db_anchor.ajax', function (event) {
event.preventDefault();
/**
* @var question String containing the question to be asked for confirmation
@@ -143,7 +142,7 @@ AJAX.registerOnload('db_operations.js', function () {
PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
$.post(url, params, function (data) {
if (typeof data !== 'undefined' && data.success) {
- //Database deleted successfully, refresh both the frames
+ // Database deleted successfully, refresh both the frames
PMA_reloadNavigation();
PMA_commonParams.set('db', '');
PMA_commonActions.refreshMain(
diff --git a/js/db_qbe.js b/js/db_qbe.js
index ceeca2a4ea..f2b9307c39 100644
--- a/js/db_qbe.js
+++ b/js/db_qbe.js
@@ -21,14 +21,13 @@
*/
AJAX.registerTeardown('db_qbe.js', function () {
$(document).off('change', 'select[name^=criteriaColumn]');
- $(document).off('change', "#searchId");
- $(document).off('click', "#saveSearch");
- $(document).off('click', "#updateSearch");
- $(document).off('click', "#deleteSearch");
+ $(document).off('change', '#searchId');
+ $(document).off('click', '#saveSearch');
+ $(document).off('click', '#updateSearch');
+ $(document).off('click', '#deleteSearch');
});
AJAX.registerOnload('db_qbe.js', function () {
-
PMA_getSQLEditor($('#textSqlquery'), {}, 'both');
/**
@@ -44,7 +43,7 @@ AJAX.registerOnload('db_qbe.js', function () {
/**
* Ajax event handlers for 'Select saved search'
*/
- $(document).on('change', "#searchId", function (event) {
+ $(document).on('change', '#searchId', function (event) {
$('#action').val('load');
$('#formQBE').submit();
});
@@ -52,22 +51,22 @@ AJAX.registerOnload('db_qbe.js', function () {
/**
* Ajax event handlers for 'Create bookmark'
*/
- $(document).on('click', "#saveSearch", function () {
+ $(document).on('click', '#saveSearch', function () {
$('#action').val('create');
});
/**
* Ajax event handlers for 'Update bookmark'
*/
- $(document).on('click', "#updateSearch", function (event) {
+ $(document).on('click', '#updateSearch', function (event) {
$('#action').val('update');
});
/**
* Ajax event handlers for 'Delete bookmark'
*/
- $(document).on('click', "#deleteSearch", function (event) {
- var question = PMA_sprintf(PMA_messages.strConfirmDeleteQBESearch, $("#searchId").find("option:selected").text());
+ $(document).on('click', '#deleteSearch', function (event) {
+ var question = PMA_sprintf(PMA_messages.strConfirmDeleteQBESearch, $('#searchId').find('option:selected').text());
if (!confirm(question)) {
return false;
}
@@ -76,5 +75,5 @@ AJAX.registerOnload('db_qbe.js', function () {
});
var windowwidth = $(window).width();
- $('.jsresponsive').css('max-width', (windowwidth - 35 ) + 'px');
-});
\ No newline at end of file
+ $('.jsresponsive').css('max-width', (windowwidth - 35) + 'px');
+});
diff --git a/js/db_search.js b/js/db_search.js
index 86195bade5..4f82f4d12d 100644
--- a/js/db_search.js
+++ b/js/db_search.js
@@ -23,19 +23,19 @@ AJAX.registerTeardown('db_search.js', function () {
$('a.delete_results').off('click');
$('#buttonGo').off('click');
$('#togglesearchresultlink').off('click');
- $("#togglequerybox").off('click');
+ $('#togglequerybox').off('click');
$('#togglesearchformlink').off('click');
- $(document).off('submit', "#db_search_form.ajax");
+ $(document).off('submit', '#db_search_form.ajax');
});
AJAX.registerOnload('db_search.js', function () {
/** Hide the table link in the initial search result */
- var icon = PMA_getImage('s_tbl.png', '', {'id': 'table-image'}).toString();
- $("#table-info").prepend(icon).hide();
+ var icon = PMA_getImage('s_tbl.png', '', { 'id': 'table-image' }).toString();
+ $('#table-info').prepend(icon).hide();
/** Hide the browse and deleted results in the new search criteria */
$('#buttonGo').click(function () {
- $("#table-info").hide();
+ $('#table-info').hide();
$('#browse-results').hide();
$('#sqlqueryform').hide();
$('#togglequerybox').hide();
@@ -45,50 +45,50 @@ AJAX.registerOnload('db_search.js', function () {
*/
$('#togglesearchresultsdiv')
/** don't show it until we have results on-screen */
- .hide();
+ .hide();
/**
* Changing the displayed text according to
* the hide/show criteria in search result forms
*/
$('#togglesearchresultlink')
- .html(PMA_messages.strHideSearchResults)
- .on('click', function () {
- var $link = $(this);
- $('#searchresults').slideToggle();
- if ($link.text() == PMA_messages.strHideSearchResults) {
- $link.text(PMA_messages.strShowSearchResults);
- } else {
- $link.text(PMA_messages.strHideSearchResults);
- }
- /** avoid default click action */
- return false;
- });
+ .html(PMA_messages.strHideSearchResults)
+ .on('click', function () {
+ var $link = $(this);
+ $('#searchresults').slideToggle();
+ if ($link.text() == PMA_messages.strHideSearchResults) {
+ $link.text(PMA_messages.strShowSearchResults);
+ } else {
+ $link.text(PMA_messages.strHideSearchResults);
+ }
+ /** avoid default click action */
+ return false;
+ });
/**
* Prepare a div containing a link for toggle the search form,
* otherwise it's incorrectly displayed after a couple of clicks
*/
$('#togglesearchformdiv')
- .hide(); // don't show it until we have results on-screen
+ .hide(); // don't show it until we have results on-screen
/**
* Changing the displayed text according to
* the hide/show criteria in search form
*/
- $("#togglequerybox")
- .hide()
- .on('click', function () {
- var $link = $(this);
- $('#sqlqueryform').slideToggle("medium");
- if ($link.text() == PMA_messages.strHideQueryBox) {
- $link.text(PMA_messages.strShowQueryBox);
- } else {
- $link.text(PMA_messages.strHideQueryBox);
- }
- /** avoid default click action */
- return false;
- });
+ $('#togglequerybox')
+ .hide()
+ .on('click', function () {
+ var $link = $(this);
+ $('#sqlqueryform').slideToggle('medium');
+ if ($link.text() == PMA_messages.strHideQueryBox) {
+ $link.text(PMA_messages.strShowQueryBox);
+ } else {
+ $link.text(PMA_messages.strHideQueryBox);
+ }
+ /** avoid default click action */
+ return false;
+ });
/** don't show it until we have results on-screen */
@@ -97,8 +97,8 @@ AJAX.registerOnload('db_search.js', function () {
* the hide/show criteria in search criteria form
*/
$('#togglesearchformlink')
- .html(PMA_messages.strShowSearchCriteria)
- .on('click', function () {
+ .html(PMA_messages.strShowSearchCriteria)
+ .on('click', function () {
var $link = $(this);
$('#db_search_form').slideToggle();
if ($link.text() == PMA_messages.strHideSearchCriteria) {
@@ -113,18 +113,18 @@ AJAX.registerOnload('db_search.js', function () {
/*
* Ajax Event handler for retrieving the results from a table
*/
- $(document).on('click', 'a.browse_results', function(e){
+ $(document).on('click', 'a.browse_results', function (e) {
e.preventDefault();
/** Hides the results shown by the delete criteria */
var $msg = PMA_ajaxShowMessage(PMA_messages.strBrowsing, false);
$('#sqlqueryform').hide();
$('#togglequerybox').hide();
/** Load the browse results to the page */
- $("#table-info").show();
+ $('#table-info').show();
var table_name = $(this).data('table-name');
- $('#table-link').attr({"href" : $(this).attr('href')}).text(table_name);
+ $('#table-link').attr({ 'href' : $(this).attr('href') }).text(table_name);
- var url = $(this).attr('href') + "#searchresults";
+ var url = $(this).attr('href') + '#searchresults';
var browse_sql = $(this).data('browse-sql');
var params = {
'ajax_request': true,
@@ -142,7 +142,7 @@ AJAX.registerOnload('db_search.js', function () {
PMA_highlightSQL($('#browse-results'));
$('html, body')
.animate({
- scrollTop: $("#browse-results").offset().top
+ scrollTop: $('#browse-results').offset().top
}, 1000);
} else {
PMA_ajaxShowMessage(data.error, false);
@@ -153,10 +153,10 @@ AJAX.registerOnload('db_search.js', function () {
/*
* Ajax Event handler for deleting the results from a table
*/
- $(document).on('click', 'a.delete_results', function(e){
+ $(document).on('click', 'a.delete_results', function (e) {
e.preventDefault();
/** Hides the results shown by the browse criteria */
- $("#table-info").hide();
+ $('#table-info').hide();
$('#sqlqueryform').hide();
$('#togglequerybox').hide();
/** Conformation message for deletion */
@@ -191,7 +191,7 @@ AJAX.registerOnload('db_search.js', function () {
$('#togglequerybox').show();
$('html, body')
.animate({
- scrollTop: $("#browse-results").offset().top
+ scrollTop: $('#browse-results').offset().top
}, 1000);
PMA_ajaxRemoveMessage($msg);
});
@@ -201,7 +201,7 @@ AJAX.registerOnload('db_search.js', function () {
/**
* Ajax Event handler for retrieving the result of an SQL Query
*/
- $(document).on('submit', "#db_search_form.ajax", function (event) {
+ $(document).on('submit', '#db_search_form.ajax', function (event) {
event.preventDefault();
var $msgbox = PMA_ajaxShowMessage(PMA_messages.strSearching, false);
@@ -210,18 +210,18 @@ AJAX.registerOnload('db_search.js', function () {
PMA_prepareForAjaxRequest($form);
- var url = $form.serialize() + "&submit_search=" + $("#buttonGo").val();
+ var url = $form.serialize() + '&submit_search=' + $('#buttonGo').val();
$.post($form.attr('action'), url, function (data) {
if (typeof data !== 'undefined' && data.success === true) {
// found results
- $("#searchresults").html(data.message);
+ $('#searchresults').html(data.message);
$('#togglesearchresultlink')
// always start with the Show message
- .text(PMA_messages.strHideSearchResults);
+ .text(PMA_messages.strHideSearchResults);
$('#togglesearchresultsdiv')
// now it's time to show the div containing the link
- .show();
+ .show();
$('#searchresults').show();
@@ -237,7 +237,7 @@ AJAX.registerOnload('db_search.js', function () {
.show();
} else {
// error message (zero rows)
- $("#searchresults").html(data.error).show();
+ $('#searchresults').html(data.error).show();
}
PMA_ajaxRemoveMessage($msgbox);
diff --git a/js/db_structure.js b/js/db_structure.js
index db53bedd27..6352a4a96e 100644
--- a/js/db_structure.js
+++ b/js/db_structure.js
@@ -22,22 +22,22 @@
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('db_structure.js', function () {
- $(document).off('click', "a.truncate_table_anchor.ajax");
- $(document).off('click', "a.drop_table_anchor.ajax");
+ $(document).off('click', 'a.truncate_table_anchor.ajax');
+ $(document).off('click', 'a.drop_table_anchor.ajax');
$(document).off('click', '#real_end_input');
- $(document).off('click', "a.favorite_table_anchor.ajax");
+ $(document).off('click', 'a.favorite_table_anchor.ajax');
$(document).off('click', '#printView');
$('a.real_row_count').off('click');
$('a.row_count_sum').off('click');
$('select[name=submit_mult]').off('change');
- $("#filterText").off('keyup');
+ $('#filterText').off('keyup');
});
/**
* Adjust number of rows and total size in the summary
* when truncating, creating, dropping or inserting into a table
*/
-function PMA_adjustTotals() {
+function PMA_adjustTotals () {
var byteUnits = [
PMA_messages.strB,
PMA_messages.strKiB,
@@ -50,7 +50,7 @@ function PMA_adjustTotals() {
/**
* @var $allTr jQuery object that references all the rows in the list of tables
*/
- var $allTr = $("#tablesForm").find("table.data tbody:first tr");
+ var $allTr = $('#tablesForm').find('table.data tbody:first tr');
// New summary values for the table
var tableSum = $allTr.size();
var rowsSum = 0;
@@ -102,14 +102,14 @@ function PMA_adjustTotals() {
});
// Add some commas for readability:
// 1000000 becomes 1,000,000
- var strRowSum = rowsSum + "";
+ var strRowSum = rowsSum + '';
var regex = /(\d+)(\d{3})/;
while (regex.test(strRowSum)) {
strRowSum = strRowSum.replace(regex, '$1' + ',' + '$2');
}
// If approximated total value add ~ in front
if (rowSumApproximated) {
- strRowSum = "~" + strRowSum;
+ strRowSum = '~' + strRowSum;
}
// Calculate the magnitude for the size and overhead values
var size_magnitude = 0, overhead_magnitude = 0;
@@ -126,27 +126,26 @@ function PMA_adjustTotals() {
overheadSum = Math.round(overheadSum * 10) / 10;
// Update summary with new data
- var $summary = $("#tbl_summary_row");
+ var $summary = $('#tbl_summary_row');
$summary.find('.tbl_num').text(PMA_sprintf(PMA_messages.strNTables, tableSum));
if (rowSumApproximated) {
$summary.find('.row_count_sum').text(strRowSum);
} else {
$summary.find('.tbl_rows').text(strRowSum);
}
- $summary.find('.tbl_size').text(sizeSum + " " + byteUnits[size_magnitude]);
- $summary.find('.tbl_overhead').text(overheadSum + " " + byteUnits[overhead_magnitude]);
+ $summary.find('.tbl_size').text(sizeSum + ' ' + byteUnits[size_magnitude]);
+ $summary.find('.tbl_overhead').text(overheadSum + ' ' + byteUnits[overhead_magnitude]);
}
/**
* Gets the real row count for a table or DB.
* @param object $target Target for appending the real count value.
*/
-function PMA_fetchRealRowCount($target)
-{
+function PMA_fetchRealRowCount ($target) {
var $throbber = $('#pma_navigation').find('.throbber')
.first()
.clone()
- .css({visibility: 'visible', display: 'inline-block'})
+ .css({ visibility: 'visible', display: 'inline-block' })
.click(false);
$target.html($throbber);
$.ajax({
@@ -162,7 +161,7 @@ function PMA_fetchRealRowCount($target)
function (index, table) {
// Update each table row count.
$('table.data td[data-table*="' + table.table + '"]')
- .text(table.row_count);
+ .text(table.row_count);
}
);
}
@@ -191,16 +190,16 @@ AJAX.registerOnload('db_structure.js', function () {
* @param function success function to be called on success
*
*/
- var jqConfirm = function(msg, success) {
- var dialogObj = $("
"+msg+"
");
+ var jqConfirm = function (msg, success) {
+ var dialogObj = $('
' + msg + '
');
$('body').append(dialogObj);
var buttonOptions = {};
buttonOptions[PMA_messages.strContinue] = function () {
success();
- $( this ).dialog( "close" );
+ $(this).dialog('close');
};
buttonOptions[PMA_messages.strCancel] = function () {
- $( this ).dialog( "close" );
+ $(this).dialog('close');
$('#tablesForm')[0].reset();
};
$(dialogObj).dialog({
@@ -211,41 +210,40 @@ AJAX.registerOnload('db_structure.js', function () {
});
};
-/**
+ /**
* Filtering tables on table listing of particular database
*
*/
- $("#filterText").keyup(function() {
+ $('#filterText').keyup(function () {
var filterInput = $(this).val().toUpperCase();
var structureTable = $('#structureTable')[0];
- $('#structureTable tbody tr').each(function() {
+ $('#structureTable tbody tr').each(function () {
var tr = $(this);
var a = tr.find('a')[0];
if (a) {
if (a.text.trim().toUpperCase().indexOf(filterInput) > -1) {
- tr[0].style.display = "";
+ tr[0].style.display = '';
} else {
- tr[0].style.display = "none";
+ tr[0].style.display = 'none';
}
}
});
});
-/**
+ /**
* Event handler on select of "Make consistent with central list"
*/
- $('select[name=submit_mult]').change(function(event) {
+ $('select[name=submit_mult]').change(function (event) {
if ($(this).val() === 'make_consistent_with_central_list') {
event.preventDefault();
event.stopPropagation();
jqConfirm(
- PMA_messages.makeConsistentMessage, function(){
+ PMA_messages.makeConsistentMessage, function () {
$('#tablesForm').submit();
}
);
return false;
- }
- else if ($(this).val() === 'copy_tbl' || $(this).val() === 'add_prefix_tbl' || $(this).val() === 'replace_prefix_tbl' || $(this).val() === 'copy_tbl_change_prefix') {
+ } else if ($(this).val() === 'copy_tbl' || $(this).val() === 'add_prefix_tbl' || $(this).val() === 'replace_prefix_tbl' || $(this).val() === 'copy_tbl_change_prefix') {
event.preventDefault();
event.stopPropagation();
if ($('input[name="selected_tbl[]"]:checked').length === 0) {
@@ -255,14 +253,11 @@ AJAX.registerOnload('db_structure.js', function () {
var modalTitle = '';
if ($(this).val() === 'copy_tbl') {
modalTitle = PMA_messages.strCopyTablesTo;
- }
- else if ($(this).val() === 'add_prefix_tbl') {
+ } else if ($(this).val() === 'add_prefix_tbl') {
modalTitle = PMA_messages.strAddPrefix;
- }
- else if ($(this).val() === 'replace_prefix_tbl') {
+ } else if ($(this).val() === 'replace_prefix_tbl') {
modalTitle = PMA_messages.strReplacePrefix;
- }
- else if ($(this).val() === 'copy_tbl_change_prefix') {
+ } else if ($(this).val() === 'copy_tbl_change_prefix') {
modalTitle = PMA_messages.strCopyPrefix;
}
$.ajax({
@@ -271,17 +266,16 @@ AJAX.registerOnload('db_structure.js', function () {
dataType: 'html',
data: formData
- }).done(function(data) {
-
- var dialogObj = $("
"+data+"
");
+ }).done(function (data) {
+ var dialogObj = $('
' + data + '
');
$('body').append(dialogObj);
var buttonOptions = {};
buttonOptions[PMA_messages.strContinue] = function () {
$('#ajax_form').submit();
- $( this ).dialog( "close" );
+ $(this).dialog('close');
};
buttonOptions[PMA_messages.strCancel] = function () {
- $( this ).dialog( "close" );
+ $(this).dialog('close');
$('#tablesForm')[0].reset();
};
$(dialogObj).dialog({
@@ -292,8 +286,7 @@ AJAX.registerOnload('db_structure.js', function () {
buttons: buttonOptions
});
});
- }
- else {
+ } else {
$('#tablesForm').submit();
}
});
@@ -301,7 +294,7 @@ AJAX.registerOnload('db_structure.js', function () {
/**
* Ajax Event handler for 'Truncate Table'
*/
- $(document).on('click', "a.truncate_table_anchor.ajax", function (event) {
+ $(document).on('click', 'a.truncate_table_anchor.ajax', function (event) {
event.preventDefault();
/**
@@ -309,7 +302,7 @@ AJAX.registerOnload('db_structure.js', function () {
*/
var $this_anchor = $(this);
- //extract current table name and build the question string
+ // extract current table name and build the question string
/**
* @var curr_table_name String containing the name of the table to be truncated
*/
@@ -322,7 +315,6 @@ AJAX.registerOnload('db_structure.js', function () {
getForeignKeyCheckboxLoader();
$this_anchor.PMA_confirm(question, $this_anchor.attr('href'), function (url) {
-
PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
var params = getJSConfirmCommonParam(this);
@@ -334,31 +326,31 @@ AJAX.registerOnload('db_structure.js', function () {
var $tr = $this_anchor.closest('tr');
$tr.find('.tbl_rows').text('0');
$tr.find('.tbl_size, .tbl_overhead').text('-');
- //Fetch inner span of this anchor
- //and replace the icon with its disabled version
+ // Fetch inner span of this anchor
+ // and replace the icon with its disabled version
var span = $this_anchor.html().replace(/b_empty/, 'bd_empty');
- //To disable further attempts to truncate the table,
- //replace the a element with its inner span (modified)
+ // To disable further attempts to truncate the table,
+ // replace the a element with its inner span (modified)
$this_anchor
.replaceWith(span)
.removeClass('truncate_table_anchor');
PMA_adjustTotals();
} else {
- PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + " : " + data.error, false);
+ PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + ' : ' + data.error, false);
}
}); // end $.post()
- }, loadForeignKeyCheckbox); //end $.PMA_confirm()
- }); //end of Truncate Table Ajax action
+ }, loadForeignKeyCheckbox); // end $.PMA_confirm()
+ }); // end of Truncate Table Ajax action
/**
* Ajax Event handler for 'Drop Table' or 'Drop View'
*/
- $(document).on('click', "a.drop_table_anchor.ajax", function (event) {
+ $(document).on('click', 'a.drop_table_anchor.ajax', function (event) {
event.preventDefault();
var $this_anchor = $(this);
- //extract current table name and build the question string
+ // extract current table name and build the question string
/**
* @var $curr_row Object containing reference to the current row
*/
@@ -385,7 +377,6 @@ AJAX.registerOnload('db_structure.js', function () {
question += getForeignKeyCheckboxLoader();
$this_anchor.PMA_confirm(question, $this_anchor.attr('href'), function (url) {
-
var $msg = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
var params = getJSConfirmCommonParam(this);
@@ -393,28 +384,28 @@ AJAX.registerOnload('db_structure.js', function () {
$.post(url, params, function (data) {
if (typeof data !== 'undefined' && data.success === true) {
PMA_ajaxShowMessage(data.message);
- $curr_row.hide("medium").remove();
+ $curr_row.hide('medium').remove();
PMA_adjustTotals();
PMA_reloadNavigation();
PMA_ajaxRemoveMessage($msg);
} else {
- PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + " : " + data.error, false);
+ PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + ' : ' + data.error, false);
}
}); // end $.post()
}, loadForeignKeyCheckbox); // end $.PMA_confirm()
- }); //end of Drop Table Ajax action
+ }); // end of Drop Table Ajax action
/**
* Attach Event Handler for 'Print' link
*/
- $(document).on('click', "#printView", function (event) {
+ $(document).on('click', '#printView', function (event) {
event.preventDefault();
// Take to preview mode
printPreview();
- }); //end of Print View action
+ }); // end of Print View action
- //Calculate Real End for InnoDB
+ // Calculate Real End for InnoDB
/**
* Ajax Event handler for calculating the real end for a InnoDB table
*
@@ -431,14 +422,14 @@ AJAX.registerOnload('db_structure.js', function () {
return true;
});
return false;
- }); //end Calculate Real End for InnoDB
+ }); // end Calculate Real End for InnoDB
// Add tooltip to favorite icons.
- $(".favorite_table_anchor").each(function () {
+ $('.favorite_table_anchor').each(function () {
PMA_tooltip(
$(this),
'a',
- $(this).attr("title")
+ $(this).attr('title')
);
});
diff --git a/js/db_tracking.js b/js/db_tracking.js
index 7fabfcd400..0220a3d155 100644
--- a/js/db_tracking.js
+++ b/js/db_tracking.js
@@ -11,17 +11,16 @@ AJAX.registerTeardown('db_tracking.js', function () {
* Bind event handlers
*/
AJAX.registerOnload('db_tracking.js', function () {
-
var $versions = $('#versions');
$versions.find('tr:first th').append($('
'));
$versions.tablesorter({
sortList: [[1, 0]],
headers: {
- 0: {sorter: false},
- 2: {sorter: "integer"},
- 5: {sorter: false},
- 6: {sorter: false},
- 7: {sorter: false}
+ 0: { sorter: false },
+ 2: { sorter: 'integer' },
+ 5: { sorter: false },
+ 6: { sorter: false },
+ 7: { sorter: false }
}
});
@@ -30,8 +29,8 @@ AJAX.registerOnload('db_tracking.js', function () {
$noVersions.tablesorter({
sortList: [[1, 0]],
headers: {
- 0: {sorter: false},
- 2: {sorter: false}
+ 0: { sorter: false },
+ 2: { sorter: false }
}
});
diff --git a/js/error_report.js b/js/error_report.js
index 1c9beb6f26..29240412e4 100644
--- a/js/error_report.js
+++ b/js/error_report.js
@@ -15,11 +15,11 @@ var ErrorReport = {
* @return void
*/
error_handler: function (exception) {
- if (exception.name === null || typeof(exception.name) == "undefined") {
+ if (exception.name === null || typeof(exception.name) === 'undefined') {
exception.name = ErrorReport._extractExceptionName(exception);
}
ErrorReport._last_exception = exception;
- $.get("error_report.php", {
+ $.get('error_report.php', {
ajax_request: true,
server: PMA_commonParams.get('server'),
get_settings: true,
@@ -29,17 +29,17 @@ var ErrorReport = {
PMA_ajaxShowMessage(data.error, false);
return;
}
- if (data.report_setting == "ask") {
+ if (data.report_setting == 'ask') {
ErrorReport._showErrorNotification();
- } else if (data.report_setting == "always") {
+ } else if (data.report_setting == 'always') {
report_data = ErrorReport._get_report_data(exception);
post_data = $.extend(report_data, {
send_error_report: true,
automatic: true
});
- $.post("error_report.php", post_data, function (data) {
+ $.post('error_report.php', post_data, function (data) {
if (data.success === false) {
- //in the case of an error, show the error message returned.
+ // in the case of an error, show the error message returned.
PMA_ajaxShowMessage(data.error, false);
} else {
PMA_ajaxShowMessage(data.message, false);
@@ -58,7 +58,7 @@ var ErrorReport = {
_showReportDialog: function (exception) {
var report_data = ErrorReport._get_report_data(exception);
- /*Remove the hidden dialogs if there are*/
+ /* Remove the hidden dialogs if there are*/
if ($('#error_report_dialog').length !== 0) {
$('#error_report_dialog').remove();
}
@@ -71,13 +71,13 @@ var ErrorReport = {
var $dialog = $(this);
var post_data = $.extend(report_data, {
send_error_report: true,
- description: $("#report_description").val(),
- always_send: $("#always_send_checkbox")[0].checked
+ description: $('#report_description').val(),
+ always_send: $('#always_send_checkbox')[0].checked
});
- $.post("error_report.php", post_data, function (data) {
+ $.post('error_report.php', post_data, function (data) {
$dialog.dialog('close');
if (data.success === false) {
- //in the case of an error, show the error message returned.
+ // in the case of an error, show the error message returned.
PMA_ajaxShowMessage(data.error, false);
} else {
PMA_ajaxShowMessage(data.message, 3000);
@@ -89,23 +89,23 @@ var ErrorReport = {
$(this).dialog('close');
};
- $.post("error_report.php", report_data, function (data) {
+ $.post('error_report.php', report_data, function (data) {
if (data.success === false) {
- //in the case of an error, show the error message returned.
+ // in the case of an error, show the error message returned.
PMA_ajaxShowMessage(data.error, false);
} else {
// Show dialog if the request was successful
$div
- .append(data.message)
- .dialog({
- title: PMA_messages.strSubmitErrorReport,
- width: 650,
- modal: true,
- buttons: button_options,
- close: function () {
- $(this).remove();
- }
- });
+ .append(data.message)
+ .dialog({
+ title: PMA_messages.strSubmitErrorReport,
+ width: 650,
+ modal: true,
+ buttons: button_options,
+ close: function () {
+ $(this).remove();
+ }
+ });
}
}); // end $.get()
},
@@ -121,7 +121,7 @@ var ErrorReport = {
'
'
).append(
- PMA_getImage("s_error.png") + PMA_messages.strErrorOccurred
+ PMA_getImage('s_error.png') + PMA_messages.strErrorOccurred
);
var $buttons = $('
');
@@ -142,9 +142,9 @@ var ErrorReport = {
$div.append($buttons);
$div.appendTo(document.body);
- $("#change_error_settings").on("click", ErrorReport._redirect_to_settings);
- $("#show_error_report").on("click", ErrorReport._createReportDialog);
- $("#ignore_error").on("click", ErrorReport._removeErrorNotification);
+ $('#change_error_settings').on('click', ErrorReport._redirect_to_settings);
+ $('#show_error_report').on('click', ErrorReport._createReportDialog);
+ $('#ignore_error').on('click', ErrorReport._removeErrorNotification);
},
/**
* Removes the notification if it was displayed before
@@ -156,7 +156,7 @@ var ErrorReport = {
// don't remove the hash fragment by navigating to #
e.preventDefault();
}
- $("#error_notification").fadeOut(function () {
+ $('#error_notification').fadeOut(function () {
$(this).remove();
});
},
@@ -166,8 +166,8 @@ var ErrorReport = {
* @return String
*/
_extractExceptionName: function (exception) {
- if (exception.message === null || typeof(exception.message) == "undefined") {
- return "";
+ if (exception.message === null || typeof(exception.message) === 'undefined') {
+ return '';
}
var reg = /([a-zA-Z]+):/;
@@ -176,7 +176,7 @@ var ErrorReport = {
return regex_result[1];
}
- return "";
+ return '';
},
/**
* Shows the modal dialog previewing the report
@@ -194,7 +194,7 @@ var ErrorReport = {
* @return void
*/
_redirect_to_settings: function () {
- window.location.href = "prefs_forms.php";
+ window.location.href = 'prefs_forms.php';
},
/**
* Returns the report data to send to the server
@@ -205,10 +205,10 @@ var ErrorReport = {
*/
_get_report_data: function (exception) {
var report_data = {
- "ajax_request": true,
- "exception": exception,
- "current_url": window.location.href,
- "exception_type": 'js'
+ 'ajax_request': true,
+ 'exception': exception,
+ 'current_url': window.location.href,
+ 'exception_type': 'js'
};
if (AJAX.scriptHandler._scripts.length > 0) {
report_data.scripts = AJAX.scriptHandler._scripts.map(
@@ -226,9 +226,9 @@ var ErrorReport = {
*/
wrap_global_functions: function () {
for (var key in window) {
- if (key.indexOf("PMA_") === 0) {
+ if (key.indexOf('PMA_') === 0) {
var global = window[key];
- if (typeof(global) === "function") {
+ if (typeof(global) === 'function') {
window[key] = ErrorReport.wrap_function(global);
}
}
@@ -251,8 +251,8 @@ var ErrorReport = {
}
};
new_func.wrapped = true;
- //Set guid of wrapped function same as original function, so it can be removed
- //See bug#4146 (problem with jquery draggable and sortable)
+ // Set guid of wrapped function same as original function, so it can be removed
+ // See bug#4146 (problem with jquery draggable and sortable)
new_func.guid = func.guid = func.guid || new_func.guid || jQuery.guid++;
return new_func;
} else {
@@ -280,7 +280,7 @@ var ErrorReport = {
var oldOn = $.fn.on;
$.fn.on = function () {
for (var i = 1; i <= 3; i++) {
- if (typeof(arguments[i]) === "function") {
+ if (typeof(arguments[i]) === 'function') {
arguments[i] = ErrorReport.wrap_function(arguments[i]);
break;
}
@@ -302,7 +302,7 @@ var ErrorReport = {
};
-AJAX.registerOnload('error_report.js', function(){
+AJAX.registerOnload('error_report.js', function () {
TraceKit.report.subscribe(ErrorReport.error_handler);
ErrorReport.set_up_error_reporting();
ErrorReport.wrap_global_functions();
diff --git a/js/export.js b/js/export.js
index 1af06189e8..6731b836a1 100644
--- a/js/export.js
+++ b/js/export.js
@@ -7,23 +7,21 @@
/**
* Disables the "Dump some row(s)" sub-options
*/
-function disable_dump_some_rows_sub_options()
-{
- $("label[for='limit_to']").fadeTo('fast', 0.4);
- $("label[for='limit_from']").fadeTo('fast', 0.4);
- $("input[type='text'][name='limit_to']").prop('disabled', 'disabled');
- $("input[type='text'][name='limit_from']").prop('disabled', 'disabled');
+function disable_dump_some_rows_sub_options () {
+ $('label[for=\'limit_to\']').fadeTo('fast', 0.4);
+ $('label[for=\'limit_from\']').fadeTo('fast', 0.4);
+ $('input[type=\'text\'][name=\'limit_to\']').prop('disabled', 'disabled');
+ $('input[type=\'text\'][name=\'limit_from\']').prop('disabled', 'disabled');
}
/**
* Enables the "Dump some row(s)" sub-options
*/
-function enable_dump_some_rows_sub_options()
-{
- $("label[for='limit_to']").fadeTo('fast', 1);
- $("label[for='limit_from']").fadeTo('fast', 1);
- $("input[type='text'][name='limit_to']").prop('disabled', '');
- $("input[type='text'][name='limit_from']").prop('disabled', '');
+function enable_dump_some_rows_sub_options () {
+ $('label[for=\'limit_to\']').fadeTo('fast', 1);
+ $('label[for=\'limit_from\']').fadeTo('fast', 1);
+ $('input[type=\'text\'][name=\'limit_to\']').prop('disabled', '');
+ $('input[type=\'text\'][name=\'limit_from\']').prop('disabled', '');
}
/**
@@ -31,8 +29,7 @@ function enable_dump_some_rows_sub_options()
*
* @returns template data
*/
-function getTemplateData()
-{
+function getTemplateData () {
var $form = $('form[name="dump"]');
var blacklist = ['token', 'server', 'db', 'table', 'single_table',
'export_type', 'export_method', 'sql_query', 'template_id'];
@@ -71,8 +68,7 @@ function getTemplateData()
*
* @param name name of the template
*/
-function createTemplate(name)
-{
+function createTemplate (name) {
var templateData = getTemplateData();
var params = {
@@ -91,7 +87,7 @@ function createTemplate(name)
if (response.success === true) {
$('#templateName').val('');
$('#template').html(response.data);
- $("#template").find("option").each(function() {
+ $('#template').find('option').each(function () {
if ($(this).text() == name) {
$(this).prop('selected', true);
}
@@ -108,8 +104,7 @@ function createTemplate(name)
*
* @param id ID of the template to load
*/
-function loadTemplate(id)
-{
+function loadTemplate (id) {
var params = {
ajax_request : true,
server : PMA_commonParams.get('server'),
@@ -156,8 +151,7 @@ function loadTemplate(id)
*
* @param id ID of the template to update
*/
-function updateTemplate(id)
-{
+function updateTemplate (id) {
var templateData = getTemplateData();
var params = {
@@ -186,8 +180,7 @@ function updateTemplate(id)
*
* @param id ID of the template to delete
*/
-function deleteTemplate(id)
-{
+function deleteTemplate (id) {
var params = {
ajax_request : true,
server : PMA_commonParams.get('server'),
@@ -213,13 +206,13 @@ function deleteTemplate(id)
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('export.js', function () {
- $("#plugins").off('change');
- $("input[type='radio'][name='sql_structure_or_data']").off('change');
- $("input[type='radio'][name$='_structure_or_data']").off('change');
- $("input[type='radio'][name='output_format']").off('change');
- $("#checkbox_sql_include_comments").off('change');
- $("input[type='radio'][name='quick_or_custom']").off('change');
- $("input[type='radio'][name='allrows']").off('change');
+ $('#plugins').off('change');
+ $('input[type=\'radio\'][name=\'sql_structure_or_data\']').off('change');
+ $('input[type=\'radio\'][name$=\'_structure_or_data\']').off('change');
+ $('input[type=\'radio\'][name=\'output_format\']').off('change');
+ $('#checkbox_sql_include_comments').off('change');
+ $('input[type=\'radio\'][name=\'quick_or_custom\']').off('change');
+ $('input[type=\'radio\'][name=\'allrows\']').off('change');
$('#btn_alias_config').off('click');
$('.alias_remove').off('click');
$('#db_alias_button').off('click');
@@ -237,7 +230,6 @@ AJAX.registerTeardown('export.js', function () {
});
AJAX.registerOnload('export.js', function () {
-
/**
* Export template handling code
*/
@@ -281,63 +273,62 @@ AJAX.registerOnload('export.js', function () {
* Toggles the hiding and showing of each plugin's options
* according to the currently selected plugin from the dropdown list
*/
- $("#plugins").change(function () {
- $("#format_specific_opts").find("div.format_specific_options").hide();
- var selected_plugin_name = $("#plugins").find("option:selected").val();
- $("#" + selected_plugin_name + "_options").show();
+ $('#plugins').change(function () {
+ $('#format_specific_opts').find('div.format_specific_options').hide();
+ var selected_plugin_name = $('#plugins').find('option:selected').val();
+ $('#' + selected_plugin_name + '_options').show();
});
/**
* Toggles the enabling and disabling of the SQL plugin's comment options that apply only when exporting structure
*/
- $("input[type='radio'][name='sql_structure_or_data']").change(function () {
- var comments_are_present = $("#checkbox_sql_include_comments").prop("checked");
- var show = $("input[type='radio'][name='sql_structure_or_data']:checked").val();
+ $('input[type=\'radio\'][name=\'sql_structure_or_data\']').change(function () {
+ var comments_are_present = $('#checkbox_sql_include_comments').prop('checked');
+ var show = $('input[type=\'radio\'][name=\'sql_structure_or_data\']:checked').val();
if (show == 'data') {
// disable the SQL comment options
if (comments_are_present) {
- $("#checkbox_sql_dates").prop('disabled', true).parent().fadeTo('fast', 0.4);
+ $('#checkbox_sql_dates').prop('disabled', true).parent().fadeTo('fast', 0.4);
}
- $("#checkbox_sql_relation").prop('disabled', true).parent().fadeTo('fast', 0.4);
- $("#checkbox_sql_mime").prop('disabled', true).parent().fadeTo('fast', 0.4);
+ $('#checkbox_sql_relation').prop('disabled', true).parent().fadeTo('fast', 0.4);
+ $('#checkbox_sql_mime').prop('disabled', true).parent().fadeTo('fast', 0.4);
} else {
// enable the SQL comment options
if (comments_are_present) {
- $("#checkbox_sql_dates").prop('disabled', false).parent().fadeTo('fast', 1);
+ $('#checkbox_sql_dates').prop('disabled', false).parent().fadeTo('fast', 1);
}
- $("#checkbox_sql_relation").prop('disabled', false).parent().fadeTo('fast', 1);
- $("#checkbox_sql_mime").prop('disabled', false).parent().fadeTo('fast', 1);
+ $('#checkbox_sql_relation').prop('disabled', false).parent().fadeTo('fast', 1);
+ $('#checkbox_sql_mime').prop('disabled', false).parent().fadeTo('fast', 1);
}
if (show == 'structure') {
$('#checkbox_sql_auto_increment').prop('disabled', true).parent().fadeTo('fast', 0.4);
} else {
- $("#checkbox_sql_auto_increment").prop('disabled', false).parent().fadeTo('fast', 1);
+ $('#checkbox_sql_auto_increment').prop('disabled', false).parent().fadeTo('fast', 1);
}
});
// For separate-file exports only ZIP compression is allowed
- $('input[type="checkbox"][name="as_separate_files"]').change(function(){
+ $('input[type="checkbox"][name="as_separate_files"]').change(function () {
if ($(this).is(':checked')) {
$('#compression').val('zip');
}
});
- $('#compression').change(function(){
+ $('#compression').change(function () {
if ($('option:selected').val() !== 'zip') {
$('input[type="checkbox"][name="as_separate_files"]').prop('checked', false);
}
});
-
});
-function setup_table_structure_or_data() {
- if ($("input[name='export_type']").val() != 'database') {
+function setup_table_structure_or_data () {
+ if ($('input[name=\'export_type\']').val() != 'database') {
return;
}
- var pluginName = $("#plugins").find("option:selected").val();
- var formElemName = pluginName + "_structure_or_data";
- var force_structure_or_data = !($("input[name='" + formElemName + "_default']").length);
+ var pluginName = $('#plugins').find('option:selected').val();
+ var formElemName = pluginName + '_structure_or_data';
+ var force_structure_or_data = !($('input[name=\'' + formElemName + '_default\']').length);
if (force_structure_or_data === true) {
$('input[name="structure_or_data_forced"]').val(1);
@@ -385,13 +376,12 @@ function setup_table_structure_or_data() {
* Toggles the hiding and showing of plugin structure-specific and data-specific
* options
*/
-function toggle_structure_data_opts()
-{
- var pluginName = $("select#plugins").val();
- var radioFormName = pluginName + "_structure_or_data";
- var dataDiv = "#" + pluginName + "_data";
- var structureDiv = "#" + pluginName + "_structure";
- var show = $("input[type='radio'][name='" + radioFormName + "']:checked").val();
+function toggle_structure_data_opts () {
+ var pluginName = $('select#plugins').val();
+ var radioFormName = pluginName + '_structure_or_data';
+ var dataDiv = '#' + pluginName + '_data';
+ var structureDiv = '#' + pluginName + '_structure';
+ var show = $('input[type=\'radio\'][name=\'' + radioFormName + '\']:checked').val();
if (show == 'data') {
$(dataDiv).slideDown('slow');
$(structureDiv).slideUp('slow');
@@ -408,48 +398,46 @@ function toggle_structure_data_opts()
/**
* Toggles the disabling of the "save to file" options
*/
-function toggle_save_to_file()
-{
- var $ulSaveAsfile = $("#ul_save_asfile");
- if (!$("#radio_dump_asfile").prop("checked")) {
- $ulSaveAsfile.find("> li").fadeTo('fast', 0.4);
- $ulSaveAsfile.find("> li > input").prop('disabled', true);
- $ulSaveAsfile.find("> li > select").prop('disabled', true);
+function toggle_save_to_file () {
+ var $ulSaveAsfile = $('#ul_save_asfile');
+ if (!$('#radio_dump_asfile').prop('checked')) {
+ $ulSaveAsfile.find('> li').fadeTo('fast', 0.4);
+ $ulSaveAsfile.find('> li > input').prop('disabled', true);
+ $ulSaveAsfile.find('> li > select').prop('disabled', true);
} else {
- $ulSaveAsfile.find("> li").fadeTo('fast', 1);
- $ulSaveAsfile.find("> li > input").prop('disabled', false);
- $ulSaveAsfile.find("> li > select").prop('disabled', false);
+ $ulSaveAsfile.find('> li').fadeTo('fast', 1);
+ $ulSaveAsfile.find('> li > input').prop('disabled', false);
+ $ulSaveAsfile.find('> li > select').prop('disabled', false);
}
}
AJAX.registerOnload('export.js', function () {
toggle_save_to_file();
- $("input[type='radio'][name='output_format']").change(toggle_save_to_file);
+ $('input[type=\'radio\'][name=\'output_format\']').change(toggle_save_to_file);
});
/**
* For SQL plugin, toggles the disabling of the "display comments" options
*/
-function toggle_sql_include_comments()
-{
- $("#checkbox_sql_include_comments").change(function () {
- var $ulIncludeComments = $("#ul_include_comments");
- if (!$("#checkbox_sql_include_comments").prop("checked")) {
- $ulIncludeComments.find("> li").fadeTo('fast', 0.4);
- $ulIncludeComments.find("> li > input").prop('disabled', true);
+function toggle_sql_include_comments () {
+ $('#checkbox_sql_include_comments').change(function () {
+ var $ulIncludeComments = $('#ul_include_comments');
+ if (!$('#checkbox_sql_include_comments').prop('checked')) {
+ $ulIncludeComments.find('> li').fadeTo('fast', 0.4);
+ $ulIncludeComments.find('> li > input').prop('disabled', true);
} else {
// If structure is not being exported, the comment options for structure should not be enabled
- if ($("#radio_sql_structure_or_data_data").prop("checked")) {
- $("#text_sql_header_comment").prop('disabled', false).parent("li").fadeTo('fast', 1);
+ if ($('#radio_sql_structure_or_data_data').prop('checked')) {
+ $('#text_sql_header_comment').prop('disabled', false).parent('li').fadeTo('fast', 1);
} else {
- $ulIncludeComments.find("> li").fadeTo('fast', 1);
- $ulIncludeComments.find("> li > input").prop('disabled', false);
+ $ulIncludeComments.find('> li').fadeTo('fast', 1);
+ $ulIncludeComments.find('> li > input').prop('disabled', false);
}
}
});
}
-function check_table_select_all() {
+function check_table_select_all () {
var total = $('input[name="table_select[]"]').length;
var str_checked = $('input[name="table_structure[]"]:checked').length;
var data_checked = $('input[name="table_data[]"]:checked').length;
@@ -458,34 +446,34 @@ function check_table_select_all() {
if (str_checked == total) {
str_all
- .prop("indeterminate", false)
+ .prop('indeterminate', false)
.prop('checked', true);
} else if (str_checked === 0) {
str_all
- .prop("indeterminate", false)
+ .prop('indeterminate', false)
.prop('checked', false);
} else {
str_all
- .prop("indeterminate", true)
+ .prop('indeterminate', true)
.prop('checked', false);
}
if (data_checked == total) {
data_all
- .prop("indeterminate", false)
+ .prop('indeterminate', false)
.prop('checked', true);
} else if (data_checked === 0) {
data_all
- .prop("indeterminate", false)
+ .prop('indeterminate', false)
.prop('checked', false);
} else {
data_all
- .prop("indeterminate", true)
+ .prop('indeterminate', true)
.prop('checked', false);
}
}
-function toggle_table_select_all_str() {
+function toggle_table_select_all_str () {
var str_all = $('#table_structure_all').is(':checked');
if (str_all) {
$('input[name="table_structure[]"]').prop('checked', true);
@@ -494,7 +482,7 @@ function toggle_table_select_all_str() {
}
}
-function toggle_table_select_all_data() {
+function toggle_table_select_all_data () {
var data_all = $('#table_data_all').is(':checked');
if (data_all) {
$('input[name="table_data[]"]').prop('checked', true);
@@ -503,13 +491,13 @@ function toggle_table_select_all_data() {
}
}
-function check_selected_tables(argument) {
- $('.export_table_select tbody tr').each(function() {
+function check_selected_tables (argument) {
+ $('.export_table_select tbody tr').each(function () {
check_table_selected(this);
});
}
-function check_table_selected(row) {
+function check_table_selected (row) {
var $row = $(row);
var table_select = $row.find('input[name="table_select[]"]');
var str_check = $row.find('input[name="table_structure[]"]');
@@ -519,18 +507,18 @@ function check_table_selected(row) {
var structure = str_check.is(':checked:not(:disabled)');
if (data && structure) {
- table_select.prop({checked: true, indeterminate: false});
+ table_select.prop({ checked: true, indeterminate: false });
$row.addClass('marked');
} else if (data || structure) {
- table_select.prop({checked: true, indeterminate: true});
+ table_select.prop({ checked: true, indeterminate: true });
$row.removeClass('marked');
} else {
- table_select.prop({checked: false, indeterminate: false});
+ table_select.prop({ checked: false, indeterminate: false });
$row.removeClass('marked');
}
}
-function toggle_table_select(row) {
+function toggle_table_select (row) {
var $row = $(row);
var table_selected = $row.find('input[name="table_select[]"]').is(':checked');
@@ -543,7 +531,7 @@ function toggle_table_select(row) {
}
}
-function handleAddProcCheckbox() {
+function handleAddProcCheckbox () {
if ($('#table_structure_all').is(':checked') === true
&& $('#table_data_all').is(':checked') === true
) {
@@ -557,13 +545,13 @@ AJAX.registerOnload('export.js', function () {
/**
* For SQL plugin, if "CREATE TABLE options" is checked/unchecked, check/uncheck each of its sub-options
*/
- var $create = $("#checkbox_sql_create_table_statements");
- var $create_options = $("#ul_create_table_statements").find("input");
+ var $create = $('#checkbox_sql_create_table_statements');
+ var $create_options = $('#ul_create_table_statements').find('input');
$create.change(function () {
- $create_options.prop('checked', $(this).prop("checked"));
+ $create_options.prop('checked', $(this).prop('checked'));
});
$create_options.change(function () {
- if ($create_options.is(":checked")) {
+ if ($create_options.is(':checked')) {
$create.prop('checked', true);
}
});
@@ -571,57 +559,57 @@ AJAX.registerOnload('export.js', function () {
/**
* Disables the view output as text option if the output must be saved as a file
*/
- $("#plugins").change(function () {
- var active_plugin = $("#plugins").find("option:selected").val();
- var force_file = $("#force_file_" + active_plugin).val();
- if (force_file == "true") {
- if ($("#radio_dump_asfile").prop('checked') !== true) {
- $("#radio_dump_asfile").prop('checked', true);
+ $('#plugins').change(function () {
+ var active_plugin = $('#plugins').find('option:selected').val();
+ var force_file = $('#force_file_' + active_plugin).val();
+ if (force_file == 'true') {
+ if ($('#radio_dump_asfile').prop('checked') !== true) {
+ $('#radio_dump_asfile').prop('checked', true);
toggle_save_to_file();
}
- $("#radio_view_as_text").prop('disabled', true).parent().fadeTo('fast', 0.4);
+ $('#radio_view_as_text').prop('disabled', true).parent().fadeTo('fast', 0.4);
} else {
- $("#radio_view_as_text").prop('disabled', false).parent().fadeTo('fast', 1);
+ $('#radio_view_as_text').prop('disabled', false).parent().fadeTo('fast', 1);
}
});
- $("input[type='radio'][name$='_structure_or_data']").on('change', function () {
+ $('input[type=\'radio\'][name$=\'_structure_or_data\']').on('change', function () {
toggle_structure_data_opts();
});
- $('input[name="table_select[]"]').on('change', function() {
+ $('input[name="table_select[]"]').on('change', function () {
toggle_table_select($(this).closest('tr'));
check_table_select_all();
handleAddProcCheckbox();
});
- $('input[name="table_structure[]"]').on('change', function() {
+ $('input[name="table_structure[]"]').on('change', function () {
check_table_selected($(this).closest('tr'));
check_table_select_all();
handleAddProcCheckbox();
});
- $('input[name="table_data[]"]').on('change', function() {
+ $('input[name="table_data[]"]').on('change', function () {
check_table_selected($(this).closest('tr'));
check_table_select_all();
handleAddProcCheckbox();
});
- $('#table_structure_all').on('change', function() {
+ $('#table_structure_all').on('change', function () {
toggle_table_select_all_str();
check_selected_tables();
handleAddProcCheckbox();
});
- $('#table_data_all').on('change', function() {
+ $('#table_data_all').on('change', function () {
toggle_table_select_all_data();
check_selected_tables();
handleAddProcCheckbox();
});
- if ($("input[name='export_type']").val() == 'database') {
+ if ($('input[name=\'export_type\']').val() == 'database') {
// Hide structure or data radio buttons
- $("input[type='radio'][name$='_structure_or_data']").each(function() {
+ $('input[type=\'radio\'][name$=\'_structure_or_data\']').each(function () {
var $this = $(this);
var name = $this.prop('name');
var val = $('input[name="' + name + '"]:checked').val();
@@ -639,7 +627,7 @@ AJAX.registerOnload('export.js', function () {
$this.parent().remove();
}
});
- $("input[type='radio'][name$='_structure_or_data']").remove();
+ $('input[type=\'radio\'][name$=\'_structure_or_data\']').remove();
// Disable CREATE table checkbox for sql
var createTableCheckbox = $('#checkbox_sql_create_table');
@@ -660,47 +648,45 @@ AJAX.registerOnload('export.js', function () {
/**
* Handle force structure_or_data
*/
- $("#plugins").change(setup_table_structure_or_data);
+ $('#plugins').change(setup_table_structure_or_data);
});
/**
* Toggles display of options when quick and custom export are selected
*/
-function toggle_quick_or_custom()
-{
- if ($("input[name='quick_or_custom']").length === 0 // custom_no_form option
- || $("#radio_custom_export").prop("checked") // custom
+function toggle_quick_or_custom () {
+ if ($('input[name=\'quick_or_custom\']').length === 0 // custom_no_form option
+ || $('#radio_custom_export').prop('checked') // custom
) {
- $("#databases_and_tables").show();
- $("#rows").show();
- $("#output").show();
- $("#format_specific_opts").show();
- $("#output_quick_export").hide();
- var selected_plugin_name = $("#plugins").find("option:selected").val();
- $("#" + selected_plugin_name + "_options").show();
+ $('#databases_and_tables').show();
+ $('#rows').show();
+ $('#output').show();
+ $('#format_specific_opts').show();
+ $('#output_quick_export').hide();
+ var selected_plugin_name = $('#plugins').find('option:selected').val();
+ $('#' + selected_plugin_name + '_options').show();
} else { // quick
- $("#databases_and_tables").hide();
- $("#rows").hide();
- $("#output").hide();
- $("#format_specific_opts").hide();
- $("#output_quick_export").show();
+ $('#databases_and_tables').hide();
+ $('#rows').hide();
+ $('#output').hide();
+ $('#format_specific_opts').hide();
+ $('#output_quick_export').show();
}
}
var time_out;
-function check_time_out(time_limit)
-{
+function check_time_out (time_limit) {
if (typeof time_limit === 'undefined' || time_limit === 0) {
return true;
}
- //margin of one second to avoid race condition to set/access session variable
+ // margin of one second to avoid race condition to set/access session variable
time_limit = time_limit + 1;
- var href = "export.php";
+ var href = 'export.php';
var params = {
'ajax_request' : true,
'check_time_out' : true
};
clearTimeout(time_out);
- time_out = setTimeout(function(){
+ time_out = setTimeout(function () {
$.get(href, params, function (data) {
if (data.message === 'timeout') {
PMA_ajaxShowMessage(
@@ -712,7 +698,6 @@ function check_time_out(time_limit)
}
});
}, time_limit * 1000);
-
}
/**
@@ -722,7 +707,7 @@ function check_time_out(time_limit)
*
* @return void
*/
-function aliasSelectHandler(event) {
+function aliasSelectHandler (event) {
var sel = event.data.sel;
var type = event.data.type;
var inputId = $(this).val();
@@ -748,7 +733,7 @@ function aliasSelectHandler(event) {
} else if (type === '_tables') {
$('.table_alias_select:visible').change();
}
- $("#alias_modal").dialog("option", "position", "center");
+ $('#alias_modal').dialog('option', 'position', 'center');
}
/**
@@ -758,20 +743,20 @@ function aliasSelectHandler(event) {
*
* @return void
*/
-function createAliasModal(event) {
+function createAliasModal (event) {
event.preventDefault();
var dlgButtons = {};
- dlgButtons[PMA_messages.strSaveAndClose] = function() {
- $(this).dialog("close");
+ dlgButtons[PMA_messages.strSaveAndClose] = function () {
+ $(this).dialog('close');
$('#alias_modal').parent().appendTo($('form[name="dump"]'));
};
$('#alias_modal').dialog({
width: Math.min($(window).width() - 100, 700),
maxHeight: $(window).height(),
modal: true,
- dialogClass: "alias-dialog",
+ dialogClass: 'alias-dialog',
buttons: dlgButtons,
- create: function() {
+ create: function () {
$(this).css('maxHeight', $(window).height() - 150);
var db = PMA_commonParams.get('db');
if (db) {
@@ -799,9 +784,9 @@ function createAliasModal(event) {
});
}
},
- close: function() {
+ close: function () {
var isEmpty = true;
- $(this).find('input[type="text"]').each(function() {
+ $(this).find('input[type="text"]').each(function () {
// trim empty input fields on close
if ($(this).val()) {
isEmpty = false;
@@ -812,11 +797,11 @@ function createAliasModal(event) {
// Toggle checkbox based on aliases
$('input#btn_alias_config').prop('checked', !isEmpty);
},
- position: { my: "center top", at: "center top", of: window }
+ position: { my: 'center top', at: 'center top', of: window }
});
}
-function aliasToggleRow(elm) {
+function aliasToggleRow (elm) {
var inputs = elm.parents('tr').find('input,button');
if (elm.val()) {
inputs.attr('disabled', false);
@@ -825,7 +810,7 @@ function aliasToggleRow(elm) {
}
}
-function addAlias(type, name, field, value) {
+function addAlias (type, name, field, value) {
if (value === '') {
return;
}
@@ -848,17 +833,17 @@ function addAlias(type, name, field, value) {
}
AJAX.registerOnload('export.js', function () {
- $("input[type='radio'][name='quick_or_custom']").change(toggle_quick_or_custom);
+ $('input[type=\'radio\'][name=\'quick_or_custom\']').change(toggle_quick_or_custom);
- $("#scroll_to_options_msg").hide();
- $("#format_specific_opts").find("div.format_specific_options")
+ $('#scroll_to_options_msg').hide();
+ $('#format_specific_opts').find('div.format_specific_options')
.hide()
.css({
- "border": 0,
- "margin": 0,
- "padding": 0
+ 'border': 0,
+ 'margin': 0,
+ 'padding': 0
})
- .find("h3")
+ .find('h3')
.remove();
toggle_quick_or_custom();
toggle_structure_data_opts();
@@ -874,8 +859,8 @@ AJAX.registerOnload('export.js', function () {
/**
* Disables the "Dump some row(s)" sub-options when it is not selected
*/
- $("input[type='radio'][name='allrows']").change(function () {
- if ($("input[type='radio'][name='allrows']").prop("checked")) {
+ $('input[type=\'radio\'][name=\'allrows\']').change(function () {
+ if ($('input[type=\'radio\'][name=\'allrows\']').prop('checked')) {
enable_dump_some_rows_sub_options();
} else {
disable_dump_some_rows_sub_options();
diff --git a/js/export_output.js b/js/export_output.js
index fcd91acb59..cd414e503f 100644
--- a/js/export_output.js
+++ b/js/export_output.js
@@ -1,9 +1,9 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
-AJAX.registerOnload('export_output.js', function() {
- $(document).on("keydown", function(e) {
+AJAX.registerOnload('export_output.js', function () {
+ $(document).on('keydown', function (e) {
if ((e.which || e.keyCode) === 116) {
e.preventDefault();
- $("#export_refresh_form").submit();
+ $('#export_refresh_form').submit();
}
});
});
diff --git a/js/functions.js b/js/functions.js
index 2a825dcb76..345aaec360 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -79,11 +79,11 @@ var spatial_indexes = [];
* by appending a random variable to their parameters
*/
$.ajaxPrefilter(function (options, originalOptions, jqXHR) {
- var nocache = new Date().getTime() + "" + Math.floor(Math.random() * 1000000);
- if (typeof options.data == "string") {
- options.data += "&_nocache=" + nocache + "&token=" + encodeURIComponent(PMA_commonParams.get('token'));
- } else if (typeof options.data == "object") {
- options.data = $.extend(originalOptions.data, {'_nocache' : nocache, 'token': PMA_commonParams.get('token')});
+ var nocache = new Date().getTime() + '' + Math.floor(Math.random() * 1000000);
+ if (typeof options.data === 'string') {
+ options.data += '&_nocache=' + nocache + '&token=' + encodeURIComponent(PMA_commonParams.get('token'));
+ } else if (typeof options.data === 'object') {
+ options.data = $.extend(originalOptions.data, { '_nocache' : nocache, 'token': PMA_commonParams.get('token') });
}
});
@@ -92,10 +92,9 @@ $.ajaxPrefilter(function (options, originalOptions, jqXHR) {
*
* @param object $this_element a jQuery object pointing to the element
*/
-function PMA_addDatepicker($this_element, type, options)
-{
+function PMA_addDatepicker ($this_element, type, options) {
var showTimepicker = true;
- if (type=="date") {
+ if (type == 'date') {
showTimepicker = false;
}
@@ -133,7 +132,7 @@ function PMA_addDatepicker($this_element, type, options)
$('#ui-timepicker-div').css('z-index', $('#ui-datepicker-div').css('z-index'));
// Integrate tooltip text into dialog
var tooltip = $this_element.tooltip('instance');
- if(typeof tooltip !== 'undefined') {
+ if (typeof tooltip !== 'undefined') {
tooltip.disable();
var $note = $('
');
$note.text(tooltip.option('content'));
@@ -141,7 +140,7 @@ function PMA_addDatepicker($this_element, type, options)
}
}, 0);
},
- onSelect: function() {
+ onSelect: function () {
$this_element.data('datepicker').inline = true;
},
onClose: function (dateText, dp_inst) {
@@ -151,18 +150,16 @@ function PMA_addDatepicker($this_element, type, options)
$this_element.data('datepicker').inline = false;
}
var tooltip = $this_element.tooltip('instance');
- if(typeof tooltip !== 'undefined') {
+ if (typeof tooltip !== 'undefined') {
tooltip.enable();
}
}
};
- if (type == "datetime" || type == "timestamp") {
+ if (type == 'datetime' || type == 'timestamp') {
$this_element.datetimepicker($.extend(defaultOptions, options));
- }
- else if (type == "date") {
+ } else if (type == 'date') {
$this_element.datetimepicker($.extend(defaultOptions, options));
- }
- else if (type == "time") {
+ } else if (type == 'time') {
$this_element.timepicker($.extend(defaultOptions, options));
// Add a tip regarding entering MySQL allowed-values for TIME data-type
PMA_tooltip($this_element, 'input', PMA_messages.strMysqlAllowedValuesTipTime);
@@ -173,10 +170,9 @@ function PMA_addDatepicker($this_element, type, options)
* Add a date/time picker to each element that needs it
* (only when jquery-ui-timepicker-addon.js is loaded)
*/
-function addDateTimePicker() {
+function addDateTimePicker () {
if ($.timepicker !== undefined) {
$('input.timefield, input.datefield, input.datetimefield').each(function () {
-
var decimals = $(this).parent().attr('data-decimals');
var type = $(this).parent().attr('data-type');
@@ -185,7 +181,7 @@ function addDateTimePicker() {
var timeFormat = 'HH:mm:ss';
var hourMax = 23;
// check for decimal places of seconds
- if (decimals > 0 && type.indexOf('time') != -1){
+ if (decimals > 0 && type.indexOf('time') != -1) {
if (decimals > 3) {
showMillisec = true;
showMicrosec = true;
@@ -195,7 +191,7 @@ function addDateTimePicker() {
timeFormat = 'HH:mm:ss.l';
}
}
- if (type == 'time'){
+ if (type == 'time') {
hourMax = 99;
}
PMA_addDatepicker($(this), type, {
@@ -220,7 +216,7 @@ function addDateTimePicker() {
*
* @param data ajax response data
*/
-function PMA_handleRedirectAndReload(data) {
+function PMA_handleRedirectAndReload (data) {
if (parseInt(data.redirect_flag) == 1) {
// add one more GET param to display session expiry msg
if (window.location.href.indexOf('?') === -1) {
@@ -242,27 +238,26 @@ function PMA_handleRedirectAndReload(data) {
* @param resize optional resizing ('vertical', 'horizontal', 'both')
* @param lintOptions additional options for lint
*/
-function PMA_getSQLEditor($textarea, options, resize, lintOptions) {
+function PMA_getSQLEditor ($textarea, options, resize, lintOptions) {
if ($textarea.length > 0 && typeof CodeMirror !== 'undefined') {
-
// merge options for CodeMirror
var defaults = {
lineNumbers: true,
matchBrackets: true,
- extraKeys: {"Ctrl-Space": "autocomplete"},
- hintOptions: {"completeSingle": false, "completeOnSingleClick": true},
+ extraKeys: { 'Ctrl-Space': 'autocomplete' },
+ hintOptions: { 'completeSingle': false, 'completeOnSingleClick': true },
indentUnit: 4,
- mode: "text/x-mysql",
+ mode: 'text/x-mysql',
lineWrapping: true
};
if (CodeMirror.sqlLint) {
$.extend(defaults, {
- gutters: ["CodeMirror-lint-markers"],
+ gutters: ['CodeMirror-lint-markers'],
lint: {
- "getAnnotations": CodeMirror.sqlLint,
- "async": true,
- "lintOptions": lintOptions
+ 'getAnnotations': CodeMirror.sqlLint,
+ 'async': true,
+ 'lintOptions': lintOptions
}
});
}
@@ -289,12 +284,12 @@ function PMA_getSQLEditor($textarea, options, resize, lintOptions) {
.css('resize', resize)
.resizable({
handles: handles,
- resize: function() {
+ resize: function () {
codemirrorEditor.setSize($(this).width(), $(this).height());
}
});
// enable autocomplete
- codemirrorEditor.on("inputRead", codemirrorAutocompleteOnInputRead);
+ codemirrorEditor.on('inputRead', codemirrorAutocompleteOnInputRead);
return codemirrorEditor;
}
@@ -304,7 +299,7 @@ function PMA_getSQLEditor($textarea, options, resize, lintOptions) {
/**
* Clear text selection
*/
-function PMA_clearSelection() {
+function PMA_clearSelection () {
if (document.selection && document.selection.empty) {
document.selection.empty();
} else if (window.getSelection) {
@@ -328,8 +323,7 @@ function PMA_clearSelection() {
* @param additionalOptions to override the default options
*
*/
-function PMA_tooltip($elements, item, myContent, additionalOptions)
-{
+function PMA_tooltip ($elements, item, myContent, additionalOptions) {
if ($('#no_hint').length > 0) {
return;
}
@@ -337,7 +331,7 @@ function PMA_tooltip($elements, item, myContent, additionalOptions)
var defaultOptions = {
content: myContent,
items: item,
- tooltipClass: "tooltip",
+ tooltipClass: 'tooltip',
track: true,
show: false,
hide: false
@@ -350,39 +344,39 @@ function PMA_tooltip($elements, item, myContent, additionalOptions)
* HTML escaping
*/
-function escapeHtml(unsafe) {
- if (typeof(unsafe) != 'undefined') {
+function escapeHtml (unsafe) {
+ if (typeof(unsafe) !== 'undefined') {
return unsafe
.toString()
- .replace(/&/g, "&")
- .replace(//g, ">")
- .replace(/"/g, """)
- .replace(/'/g, "'");
+ .replace(/&/g, '&')
+ .replace(//g, '>')
+ .replace(/"/g, '"')
+ .replace(/'/g, ''');
} else {
return false;
}
}
-function escapeJsString(unsafe) {
- if (typeof(unsafe) != 'undefined') {
+function escapeJsString (unsafe) {
+ if (typeof(unsafe) !== 'undefined') {
return unsafe
.toString()
- .replace("\x00", '')
+ .replace('\x00', '')
.replace('\\', '\\\\')
.replace('\'', '\\\'')
- .replace("'", "\\\'")
+ .replace(''', '\\\'')
.replace('"', '\"')
- .replace(""", "\"")
- .replace("\n", '\n')
- .replace("\r", '\r')
- .replace(/<\/script/gi, '\' + \'script')
+ .replace('"', '\"')
+ .replace('\n', '\n')
+ .replace('\r', '\r')
+ .replace(/<\/script/gi, '\' + \'script');
} else {
return false;
}
}
-function PMA_sprintf() {
+function PMA_sprintf () {
return sprintf.apply(this, arguments);
}
@@ -390,8 +384,7 @@ function PMA_sprintf() {
* Hides/shows the default value input field, depending on the default type
* Ticks the NULL checkbox if NULL is chosen as default value.
*/
-function PMA_hideShowDefaultValue($default_type)
-{
+function PMA_hideShowDefaultValue ($default_type) {
if ($default_type.val() == 'USER_DEFINED') {
$default_type.siblings('.default_value').show().focus();
} else {
@@ -409,8 +402,7 @@ function PMA_hideShowDefaultValue($default_type)
*
* @param $virtuality virtuality dropdown
*/
-function PMA_hideShowExpression($virtuality)
-{
+function PMA_hideShowExpression ($virtuality) {
if ($virtuality.val() === '') {
$virtuality.siblings('.expression').hide();
} else {
@@ -422,12 +414,11 @@ function PMA_hideShowExpression($virtuality)
* Show notices for ENUM columns; add/hide the default value
*
*/
-function PMA_verifyColumnsProperties()
-{
- $("select.column_type").each(function () {
+function PMA_verifyColumnsProperties () {
+ $('select.column_type').each(function () {
PMA_showNoticeForEnum($(this));
});
- $("select.default_type").each(function () {
+ $('select.default_type').each(function () {
PMA_hideShowDefaultValue($(this));
});
$('select.virtuality').each(function () {
@@ -441,8 +432,7 @@ function PMA_verifyColumnsProperties()
*
* @param $form object the form
*/
-function PMA_prepareForAjaxRequest($form)
-{
+function PMA_prepareForAjaxRequest ($form) {
if (! $form.find('input:hidden').is('#ajax_request_hidden')) {
$form.append('
');
}
@@ -455,12 +445,11 @@ function PMA_prepareForAjaxRequest($form)
*
* @return boolean always true
*/
-function suggestPassword(passwd_form)
-{
+function suggestPassword (passwd_form) {
// restrict the password to just letters and numbers to avoid problems:
// "editors and viewers regard the password as multiple words and
// things like double click no longer work"
- var pwchars = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWYXZ";
+ var pwchars = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWYXZ';
var passwordlength = 16; // do we want that to be dynamic? no, keep it simple :)
var passwd = passwd_form.generated_pw;
var randomWords = new Int32Array(passwordlength);
@@ -487,8 +476,8 @@ function suggestPassword(passwd_form)
$jquery_passwd_form = $(passwd_form);
- passwd_form.elements['pma_pw'].value = passwd.value;
- passwd_form.elements['pma_pw2'].value = passwd.value;
+ passwd_form.elements.pma_pw.value = passwd.value;
+ passwd_form.elements.pma_pw2.value = passwd.value;
meter_obj = $jquery_passwd_form.find('meter[name="pw_meter"]').first();
meter_obj_label = $jquery_passwd_form.find('span[name="pw_strength"]').first();
checkPasswordStrength(passwd.value, meter_obj, meter_obj_label);
@@ -498,9 +487,10 @@ function suggestPassword(passwd_form)
/**
* Version string to integer conversion.
*/
-function parseVersionString(str)
-{
- if (typeof(str) != 'string') { return false; }
+function parseVersionString (str) {
+ if (typeof(str) !== 'string') {
+ return false;
+ }
var add = 0;
// Parse possible alpha/beta/rc/
var state = str.split('-');
@@ -529,8 +519,7 @@ function parseVersionString(str)
/**
* Indicates current available version on main page.
*/
-function PMA_current_version(data)
-{
+function PMA_current_version (data) {
if (data && data.version && data.date) {
var current = parseVersionString($('span.version').text());
var latest = parseVersionString(data.version);
@@ -583,17 +572,16 @@ function PMA_current_version(data)
/**
* Loads Git revision data from ajax for index.php
*/
-function PMA_display_git_revision()
-{
+function PMA_display_git_revision () {
$('#is_git_revision').remove();
$('#li_pma_version_git').remove();
$.get(
- "index.php",
+ 'index.php',
{
- "server": PMA_commonParams.get('server'),
- "git_revision": true,
- "ajax_request": true,
- "no_debug": true
+ 'server': PMA_commonParams.get('server'),
+ 'git_revision': true,
+ 'ajax_request': true,
+ 'no_debug': true
},
function (data) {
if (typeof data !== 'undefined' && data.success === true) {
@@ -609,25 +597,24 @@ function PMA_display_git_revision()
*
*/
-function displayPasswordGenerateButton()
-{
+function displayPasswordGenerateButton () {
var generatePwdRow = $('
|
').addClass('vmiddle');
var titleCell = $('
| ').html(PMA_messages.strGeneratePassword).appendTo(generatePwdRow);
var pwdCell = $('
| ').appendTo(generatePwdRow);
var pwdButton = $('
')
- .attr({type: 'button', id: 'button_generate_password', value: PMA_messages.strGenerate})
+ .attr({ type: 'button', id: 'button_generate_password', value: PMA_messages.strGenerate })
.addClass('button')
- .on('click', function() {
+ .on('click', function () {
suggestPassword(this.form);
});
var pwdTextbox = $('
')
- .attr({type: 'text', name: 'generated_pw', id: 'generated_pw'});
+ .attr({ type: 'text', name: 'generated_pw', id: 'generated_pw' });
pwdCell.append(pwdButton).append(pwdTextbox);
$('#tr_element_before_generate_password').parent().append(generatePwdRow);
var generatePwdDiv = $('
').addClass('item');
- var titleLabel = $('
').attr({for: 'button_generate_password'})
+ var titleLabel = $('
').attr({ for: 'button_generate_password' })
.html(PMA_messages.strGeneratePassword + ':')
.appendTo(generatePwdDiv);
var optionsSpan = $('
').addClass('options')
@@ -647,8 +634,7 @@ function displayPasswordGenerateButton()
* @param only_once boolean if true this is only done once
* f.e. only on first focus
*/
-function selectContent(element, lock, only_once)
-{
+function selectContent (element, lock, only_once) {
if (only_once && only_once_elements[element.name]) {
return;
}
@@ -671,11 +657,10 @@ function selectContent(element, lock, only_once)
*
* @return boolean whether to run the query or not
*/
-function confirmLink(theLink, theSqlQuery)
-{
+function confirmLink (theLink, theSqlQuery) {
// Confirmation is not required in the configuration file
// or browser is Opera (crappy js implementation)
- if (PMA_messages.strDoYouReally === '' || typeof(window.opera) != 'undefined') {
+ if (PMA_messages.strDoYouReally === '' || typeof(window.opera) !== 'undefined') {
return true;
}
@@ -692,9 +677,9 @@ function confirmLink(theLink, theSqlQuery)
}
$(theLink).parents('form').append('
');
- } else if (typeof(theLink.href) != 'undefined') {
+ } else if (typeof(theLink.href) !== 'undefined') {
theLink.href += '&is_js_confirmed=1';
- } else if (typeof(theLink.form) != 'undefined') {
+ } else if (typeof(theLink.form) !== 'undefined') {
theLink.form.action += '?is_js_confirmed=1';
}
}
@@ -714,8 +699,7 @@ function confirmLink(theLink, theSqlQuery)
*
* @see checkSqlQuery()
*/
-function confirmQuery(theForm1, sqlQuery1)
-{
+function confirmQuery (theForm1, sqlQuery1) {
// Confirmation is not required in the configuration file
if (PMA_messages.strDoYouReally === '') {
return true;
@@ -771,8 +755,7 @@ function confirmQuery(theForm1, sqlQuery1)
*
* @see confirmQuery()
*/
-function checkSqlQuery(theForm)
-{
+function checkSqlQuery (theForm) {
// get the textarea element containing the query
var sqlQuery;
if (codemirror_editor) {
@@ -782,11 +765,11 @@ function checkSqlQuery(theForm)
sqlQuery = theForm.elements.sql_query.value;
}
var space_re = new RegExp('\\s+');
- if (typeof(theForm.elements.sql_file) != 'undefined' &&
+ if (typeof(theForm.elements.sql_file) !== 'undefined' &&
theForm.elements.sql_file.value.replace(space_re, '') !== '') {
return true;
}
- if (typeof(theForm.elements.id_bookmark) != 'undefined' &&
+ if (typeof(theForm.elements.id_bookmark) !== 'undefined' &&
(theForm.elements.id_bookmark.value !== null || theForm.elements.id_bookmark.value !== '') &&
theForm.elements.id_bookmark.selectedIndex !== 0) {
return true;
@@ -816,8 +799,7 @@ function checkSqlQuery(theForm)
*
* @return boolean whether the form field is empty or not
*/
-function emptyCheckTheField(theForm, theFieldName)
-{
+function emptyCheckTheField (theForm, theFieldName) {
var theField = theForm.elements[theFieldName];
var space_re = new RegExp('\\s+');
return theField.value.replace(space_re, '') === '';
@@ -833,15 +815,14 @@ function emptyCheckTheField(theForm, theFieldName)
*
* @return boolean whether a valid number has been submitted or not
*/
-function checkFormElementInRange(theForm, theFieldName, message, min, max)
-{
+function checkFormElementInRange (theForm, theFieldName, message, min, max) {
var theField = theForm.elements[theFieldName];
var val = parseInt(theField.value, 10);
- if (typeof(min) == 'undefined') {
+ if (typeof(min) === 'undefined') {
min = 0;
}
- if (typeof(max) == 'undefined') {
+ if (typeof(max) === 'undefined') {
max = Number.MAX_VALUE;
}
@@ -864,12 +845,10 @@ function checkFormElementInRange(theForm, theFieldName, message, min, max)
theField.value = val;
}
return true;
-
} // end of the 'checkFormElementInRange()' function
-function checkTableEditForm(theForm, fieldsCnt)
-{
+function checkTableEditForm (theForm, fieldsCnt) {
// TODO: avoid sending a message if user just wants to add a line
// on the form but has not completed at least one field name
@@ -877,14 +856,14 @@ function checkTableEditForm(theForm, fieldsCnt)
var i, elm, elm2, elm3, val, id;
for (i = 0; i < fieldsCnt; i++) {
- id = "#field_" + i + "_2";
+ id = '#field_' + i + '_2';
elm = $(id);
val = elm.val();
if (val == 'VARCHAR' || val == 'CHAR' || val == 'BIT' || val == 'VARBINARY' || val == 'BINARY') {
- elm2 = $("#field_" + i + "_3");
+ elm2 = $('#field_' + i + '_3');
val = parseInt(elm2.val(), 10);
- elm3 = $("#field_" + i + "_1");
- if (isNaN(val) && elm3.val() !== "") {
+ elm3 = $('#field_' + i + '_1');
+ if (isNaN(val) && elm3.val() !== '') {
elm2.select();
alert(PMA_messages.strEnterValidLength);
elm2.focus();
@@ -893,7 +872,7 @@ function checkTableEditForm(theForm, fieldsCnt)
}
if (atLeastOneField === 0) {
- id = "field_" + i + "_1";
+ id = 'field_' + i + '_1';
if (!emptyCheckTheField(theForm, id)) {
atLeastOneField = 1;
}
@@ -907,8 +886,8 @@ function checkTableEditForm(theForm, fieldsCnt)
}
// at least this section is under jQuery
- var $input = $("input.textfield[name='table']");
- if ($input.val() === "") {
+ var $input = $('input.textfield[name=\'table\']');
+ if ($input.val() === '') {
alert(PMA_messages.strFormEmpty);
$input.focus();
return false;
@@ -943,72 +922,72 @@ AJAX.registerTeardown('functions.js', function () {
});
AJAX.registerOnload('functions.js', function () {
- document.onclick = function() {
+ document.onclick = function () {
_idleSecondsCounter = 0;
};
- $(document).on('mousemove',function() {
+ $(document).on('mousemove',function () {
_idleSecondsCounter = 0;
});
- document.onkeypress = function() {
+ document.onkeypress = function () {
_idleSecondsCounter = 0;
};
- function guid() {
- function s4() {
+ function guid () {
+ function s4 () {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
- .substring(1);
+ .substring(1);
}
return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
s4() + '-' + s4() + s4() + s4();
}
- function SetIdleTime() {
+ function SetIdleTime () {
_idleSecondsCounter++;
}
- function UpdateIdleTime() {
+ function UpdateIdleTime () {
var href = 'index.php';
var guid = 'default';
if (isStorageSupported('sessionStorage')) {
guid = window.sessionStorage.guid;
}
var params = {
- 'ajax_request' : true,
- 'server' : PMA_commonParams.get('server'),
- 'db' : PMA_commonParams.get('db'),
- 'guid': guid,
- 'access_time':_idleSecondsCounter
- };
+ 'ajax_request' : true,
+ 'server' : PMA_commonParams.get('server'),
+ 'db' : PMA_commonParams.get('db'),
+ 'guid': guid,
+ 'access_time':_idleSecondsCounter
+ };
$.ajax({
- type: 'POST',
- url: href,
- data: params,
- success: function (data) {
- if (data.success) {
- if (PMA_commonParams.get('LoginCookieValidity') - _idleSecondsCounter < 0) {
- /* There is other active window, let's reset counter */
- _idleSecondsCounter = 0;
- }
- var remaining = Math.min(
- /* Remaining login validity */
- PMA_commonParams.get('LoginCookieValidity') - _idleSecondsCounter,
- /* Remaining time till session GC */
- PMA_commonParams.get('session_gc_maxlifetime')
- );
- var interval = 1000;
- if (remaining > 5) {
- // max value for setInterval() function
- interval = Math.min((remaining - 1) * 1000, Math.pow(2, 31) - 1);
- }
- updateTimeout = window.setTimeout(UpdateIdleTime, interval);
- } else { //timeout occurred
- clearInterval(IncInterval);
- if (isStorageSupported('sessionStorage')){
- window.sessionStorage.clear();
- }
- window.location.reload(true);
+ type: 'POST',
+ url: href,
+ data: params,
+ success: function (data) {
+ if (data.success) {
+ if (PMA_commonParams.get('LoginCookieValidity') - _idleSecondsCounter < 0) {
+ /* There is other active window, let's reset counter */
+ _idleSecondsCounter = 0;
}
+ var remaining = Math.min(
+ /* Remaining login validity */
+ PMA_commonParams.get('LoginCookieValidity') - _idleSecondsCounter,
+ /* Remaining time till session GC */
+ PMA_commonParams.get('session_gc_maxlifetime')
+ );
+ var interval = 1000;
+ if (remaining > 5) {
+ // max value for setInterval() function
+ interval = Math.min((remaining - 1) * 1000, Math.pow(2, 31) - 1);
+ }
+ updateTimeout = window.setTimeout(UpdateIdleTime, interval);
+ } else { // timeout occurred
+ clearInterval(IncInterval);
+ if (isStorageSupported('sessionStorage')) {
+ window.sessionStorage.clear();
+ }
+ window.location.reload(true);
}
- });
+ }
+ });
}
if (PMA_commonParams.get('logged_in')) {
IncInterval = window.setInterval(SetIdleTime, 1000);
@@ -1117,7 +1096,7 @@ AJAX.registerOnload('functions.js', function () {
* Row highlighting in horizontal mode (use "on"
* so that it works also for pages reached via AJAX)
*/
-/*AJAX.registerOnload('functions.js', function () {
+/* AJAX.registerOnload('functions.js', function () {
$(document).on('hover', 'tr',function (event) {
var $tr = $(this);
$tr.toggleClass('hover',event.type=='mouseover');
@@ -1131,12 +1110,10 @@ AJAX.registerOnload('functions.js', function () {
*
* @param container DOM element
*/
-function markAllRows(container_id)
-{
-
- $("#" + container_id).find("input:checkbox:enabled").prop('checked', true)
- .trigger("change")
- .parents("tr").addClass("marked");
+function markAllRows (container_id) {
+ $('#' + container_id).find('input:checkbox:enabled').prop('checked', true)
+ .trigger('change')
+ .parents('tr').addClass('marked');
return true;
}
@@ -1146,12 +1123,10 @@ function markAllRows(container_id)
*
* @param container DOM element
*/
-function unMarkAllRows(container_id)
-{
-
- $("#" + container_id).find("input:checkbox:enabled").prop('checked', false)
- .trigger("change")
- .parents("tr").removeClass("marked");
+function unMarkAllRows (container_id) {
+ $('#' + container_id).find('input:checkbox:enabled').prop('checked', false)
+ .trigger('change')
+ .parents('tr').removeClass('marked');
return true;
}
@@ -1164,17 +1139,15 @@ function unMarkAllRows(container_id)
*
* @return boolean always true
*/
-function setSelectOptions(the_form, the_select, do_check)
-{
- $("form[name='" + the_form + "'] select[name='" + the_select + "']").find("option").prop('selected', do_check);
+function setSelectOptions (the_form, the_select, do_check) {
+ $('form[name=\'' + the_form + '\'] select[name=\'' + the_select + '\']').find('option').prop('selected', do_check);
return true;
} // end of the 'setSelectOptions()' function
/**
* Sets current value for query box.
*/
-function setQuery(query)
-{
+function setQuery (query) {
if (codemirror_editor) {
codemirror_editor.setValue(query);
codemirror_editor.focus();
@@ -1189,8 +1162,7 @@ function setQuery(query)
*
* @return void
*/
-function PMA_handleSimulateQueryButton()
-{
+function PMA_handleSimulateQueryButton () {
var update_re = new RegExp('^\\s*UPDATE\\s+((`[^`]+`)|([A-Za-z0-9_$]+))\\s+SET\\s', 'i');
var delete_re = new RegExp('^\\s*DELETE\\s+FROM\\s', 'i');
var query = '';
@@ -1205,7 +1177,7 @@ function PMA_handleSimulateQueryButton()
if (update_re.test(query) || delete_re.test(query)) {
if (! $simulateDml.length) {
$('#button_submit_query')
- .before('
');
@@ -1221,12 +1193,11 @@ function PMA_handleSimulateQueryButton()
* Create quick sql statements.
*
*/
-function insertQuery(queryType)
-{
- if (queryType == "clear") {
+function insertQuery (queryType) {
+ if (queryType == 'clear') {
setQuery('');
return;
- } else if (queryType == "format") {
+ } else if (queryType == 'format') {
if (codemirror_editor) {
$('#querymessage').html(PMA_messages.strFormatting +
'

});
}
return;
- } else if (queryType == )
0) {
sql_box_locked = true;
- var columnsList = "";
- var valDis = "";
- var editDis = "";
+ var columnsList = '';
+ var valDis = '';
+ var editDis = '';
var NbSelect = 0;
for (var i = 0; i < myListBox.options.length; i++) {
NbSelect++;
if (NbSelect > 1) {
- columnsList += ", ";
- valDis += ",";
- editDis += ",";
+ columnsList += ', ';
+ valDis += ',';
+ editDis += ',';
}
columnsList += myListBox.options[i].value;
- valDis += "[value-" + NbSelect + "]";
- editDis += myListBox.options[i].value + "=[value-" + NbSelect + "]";
+ valDis += '[value-' + NbSelect + ']';
+ editDis += myListBox.options[i].value + '=[value-' + NbSelect + ']';
}
- if (queryType == "selectall") {
- query = "SELECT * FROM `" + table + "` WHERE 1";
- } else if (queryType == "select") {
- query = "SELECT " + columnsList + " FROM `" + table + "` WHERE 1";
- } else if (queryType == "insert") {
- query = "INSERT INTO `" + table + "`(" + columnsList + ") VALUES (" + valDis + ")";
- } else if (queryType == "update") {
- query = "UPDATE `" + table + "` SET " + editDis + " WHERE 1";
- } else if (queryType == "delete") {
- query = "DELETE FROM `" + table + "` WHERE 0";
+ if (queryType == 'selectall') {
+ query = 'SELECT * FROM `' + table + '` WHERE 1';
+ } else if (queryType == 'select') {
+ query = 'SELECT ' + columnsList + ' FROM `' + table + '` WHERE 1';
+ } else if (queryType == 'insert') {
+ query = 'INSERT INTO `' + table + '`(' + columnsList + ') VALUES (' + valDis + ')';
+ } else if (queryType == 'update') {
+ query = 'UPDATE `' + table + '` SET ' + editDis + ' WHERE 1';
+ } else if (queryType == 'delete') {
+ query = 'DELETE FROM `' + table + '` WHERE 0';
}
setQuery(query);
sql_box_locked = false;
@@ -1302,20 +1273,19 @@ function insertQuery(queryType)
* Inserts multiple fields.
*
*/
-function insertValueQuery()
-{
+function insertValueQuery () {
var myQuery = document.sqlform.sql_query;
var myListBox = document.sqlform.dummy;
if (myListBox.options.length > 0) {
sql_box_locked = true;
- var columnsList = "";
+ var columnsList = '';
var NbSelect = 0;
for (var i = 0; i < myListBox.options.length; i++) {
if (myListBox.options[i].selected) {
NbSelect++;
if (NbSelect > 1) {
- columnsList += ", ";
+ columnsList += ', ';
}
columnsList += myListBox.options[i].value;
}
@@ -1325,14 +1295,14 @@ function insertValueQuery()
if (codemirror_editor) {
codemirror_editor.replaceSelection(columnsList);
codemirror_editor.focus();
- //IE support
+ // IE support
} else if (document.selection) {
myQuery.focus();
var sel = document.selection.createRange();
sel.text = columnsList;
}
- //MOZILLA/NETSCAPE support
- else if (document.sqlform.sql_query.selectionStart || document.sqlform.sql_query.selectionStart == "0") {
+ // MOZILLA/NETSCAPE support
+ else if (document.sqlform.sql_query.selectionStart || document.sqlform.sql_query.selectionStart == '0') {
var startPos = document.sqlform.sql_query.selectionStart;
var endPos = document.sqlform.sql_query.selectionEnd;
var SqlString = document.sqlform.sql_query.value;
@@ -1349,8 +1319,7 @@ function insertValueQuery()
/**
* Updates the input fields for the parameters based on the query
*/
-function updateQueryParameters() {
-
+function updateQueryParameters () {
if ($('#parameterized').is(':checked')) {
var query = codemirror_editor ? codemirror_editor.getValue() : $('#sqlquery').val();
@@ -1358,7 +1327,7 @@ function updateQueryParameters() {
var parameters = [];
// get unique parameters
if (allParameters) {
- $.each(allParameters, function(i, parameter){
+ $.each(allParameters, function (i, parameter) {
if ($.inArray(parameter, parameters) === -1) {
parameters.push(parameter);
}
@@ -1374,7 +1343,7 @@ function updateQueryParameters() {
$.each(parameters, function (i, parameter) {
var paramName = parameter.substring(1);
- var $param = $temp.find('#paramSpan_' + paramName );
+ var $param = $temp.find('#paramSpan_' + paramName);
if (! $param.length) {
$param = $('
');
$('
').text(parameter).appendTo($param);
@@ -1390,8 +1359,7 @@ function updateQueryParameters() {
/**
* Refresh/resize the WYSIWYG scratchboard
*/
-function refreshLayout()
-{
+function refreshLayout () {
var $elm = $('#pdflayout');
var orientation = $('#orientation_opt').val();
var paper = 'A4';
@@ -1412,7 +1380,7 @@ function refreshLayout()
/**
* Initializes positions of elements.
*/
-function TableDragInit() {
+function TableDragInit () {
$('.pdflayout_table').each(function () {
var $this = $(this);
var number = $this.data('number');
@@ -1422,7 +1390,7 @@ function TableDragInit() {
$this.css('top', y + 'px');
/* Make elements draggable */
$this.draggable({
- containment: "parent",
+ containment: 'parent',
drag: function (evt, ui) {
var number = $this.data('number');
$('#c_table_' + number + '_x').val(parseInt(ui.position.left, 10));
@@ -1435,7 +1403,7 @@ function TableDragInit() {
/**
* Resets drag and drop positions.
*/
-function resetDrag() {
+function resetDrag () {
$('.pdflayout_table').each(function () {
var $this = $(this);
var x = $this.data('x');
@@ -1487,8 +1455,7 @@ $(function () {
/**
* Returns paper sizes for a given format
*/
-function pdfPaperSize(format, axis)
-{
+function pdfPaperSize (format, axis) {
switch (format.toUpperCase()) {
case '4A0':
if (axis == 'x') {
@@ -1843,7 +1810,7 @@ function pdfPaperSize(format, axis)
*
* @return string
*/
-function getForeignKeyCheckboxLoader() {
+function getForeignKeyCheckboxLoader () {
var html = '';
html += '
';
html += '
';
@@ -1853,7 +1820,7 @@ function getForeignKeyCheckboxLoader() {
return html;
}
-function loadForeignKeyCheckbox() {
+function loadForeignKeyCheckbox () {
// Load default foreign key check value
var params = {
'ajax_request': true,
@@ -1869,7 +1836,7 @@ function loadForeignKeyCheckbox() {
});
}
-function getJSConfirmCommonParam(elem) {
+function getJSConfirmCommonParam (elem) {
return {
'is_js_confirmed' : 1,
'ajax_request' : true,
@@ -1881,9 +1848,9 @@ function getJSConfirmCommonParam(elem) {
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('functions.js', function () {
- $(document).off('click', "a.inline_edit_sql");
- $(document).off('click', "input#sql_query_edit_save");
- $(document).off('click', "input#sql_query_edit_discard");
+ $(document).off('click', 'a.inline_edit_sql');
+ $(document).off('click', 'input#sql_query_edit_save');
+ $(document).off('click', 'input#sql_query_edit_discard');
$('input.sqlbutton').off('click');
if (codemirror_editor) {
codemirror_editor.off('blur');
@@ -1914,7 +1881,7 @@ AJAX.registerOnload('functions.js', function () {
// If we are coming back to the page by clicking forward button
// of the browser, bind the code mirror to inline query editor.
bindCodeMirrorToInlineEditor();
- $(document).on('click', "a.inline_edit_sql", function () {
+ $(document).on('click', 'a.inline_edit_sql', function () {
if ($('#sql_query_edit').length) {
// An inline query editor is already open,
// we don't want another copy of it
@@ -1922,14 +1889,14 @@ AJAX.registerOnload('functions.js', function () {
}
var $form = $(this).prev('form');
- var sql_query = $form.find("input[name='sql_query']").val().trim();
+ var sql_query = $form.find('input[name=\'sql_query\']').val().trim();
var $inner_sql = $(this).parent().prev().find('code.sql');
var old_text = $inner_sql.html();
- var new_content = "
\n";
+ var new_content = '
\n';
new_content += getForeignKeyCheckboxLoader();
- new_content += "
\n";
- new_content += "
\n";
+ new_content += '
\n';
+ new_content += '
\n';
var $editor_area = $('div#inline_editor');
if ($editor_area.length === 0) {
$editor_area = $('
');
@@ -1943,8 +1910,8 @@ AJAX.registerOnload('functions.js', function () {
return false;
});
- $(document).on('click', "input#sql_query_edit_save", function () {
- //hide already existing success message
+ $(document).on('click', 'input#sql_query_edit_save', function () {
+ // hide already existing success message
var sql_query;
if (codemirror_inline_editor) {
codemirror_inline_editor.save();
@@ -1954,21 +1921,21 @@ AJAX.registerOnload('functions.js', function () {
}
var fk_check = $(this).parent().find('#fk_checks').is(':checked');
- var $form = $("a.inline_edit_sql").prev('form');
- var $fake_form = $('