diff --git a/js/ajax.js b/js/ajax.js index 9c2d88b4aa..f2020ca303 100644 --- a/js/ajax.js +++ b/js/ajax.js @@ -44,7 +44,7 @@ var AJAX = { */ hash: function (key) { /* http://burtleburtle.net/bob/hash/doobs.html#one */ - key += ""; + key += ''; var len = key.length, hash = 0, i = 0; for (; i < len; ++i) { hash += key.charCodeAt(i); @@ -70,7 +70,7 @@ var AJAX = { if (this._debug) { console.log( // no need to translate - "Registered event " + eventName + " for file " + file + 'Registered event ' + eventName + ' for file ' + file ); } return this; @@ -91,7 +91,7 @@ var AJAX = { if (this._debug) { console.log( // no need to translate - "Registered event " + eventName + " for file " + file + 'Registered event ' + eventName + ' for file ' + file ); } return this; @@ -110,7 +110,7 @@ var AJAX = { if (this._debug) { console.log( // no need to translate - "Fired event " + eventName + " for file " + file + 'Fired event ' + eventName + ' for file ' + file ); } }, @@ -128,7 +128,7 @@ var AJAX = { if (this._debug) { console.log( // no need to translate - "Fired event " + eventName + " for file " + file + 'Fired event ' + eventName + ' for file ' + file ); } }, @@ -139,8 +139,8 @@ var AJAX = { * * @return void */ - lockPageHandler: function(event) { - //Don't lock on enter. + lockPageHandler: function (event) { + // Don't lock on enter. if (0 === event.charCode) { return; } @@ -157,7 +157,7 @@ var AJAX = { if (event.data.value == 1) { newHash = AJAX.hash($(this).val()); } else { - newHash = AJAX.hash($(this).is(":checked")); + newHash = AJAX.hash($(this).is(':checked')); } var oldHash = $(this).data('val-hash'); // Set lock if old value != new value @@ -180,7 +180,7 @@ var AJAX = { * * @return void */ - resetLock: function() { + resetLock: function () { AJAX.lockedTargets = {}; $('#lock_page_icon').html(''); }, @@ -205,12 +205,12 @@ var AJAX = { // leave the browser deal with it natively (e.g: file download) // or leave an existing ajax event handler present elsewhere deal with it var href = $(this).attr('href'); - if (typeof event != 'undefined' && (event.shiftKey || event.ctrlKey)) { + if (typeof event !== 'undefined' && (event.shiftKey || event.ctrlKey)) { return true; } else if ($(this).attr('target')) { return true; } else if ($(this).hasClass('ajax') || $(this).hasClass('disableAjax')) { - //reset the lockedTargets object, as specified AJAX operation has finished + // reset the lockedTargets object, as specified AJAX operation has finished AJAX.resetLock(); return true; } else if (href && href.match(/^#/)) { @@ -223,15 +223,15 @@ var AJAX = { return true; } - if (typeof event != 'undefined') { + if (typeof event !== 'undefined') { event.preventDefault(); event.stopImmediatePropagation(); } - //triggers a confirm dialog if: - //the user has performed some operations on loaded page - //the user clicks on some link, (won't trigger for buttons) - //the click event is not triggered by script + // triggers a confirm dialog if: + // the user has performed some operations on loaded page + // the user clicks on some link, (won't trigger for buttons) + // the click event is not triggered by script if (typeof event !== 'undefined' && event.type === 'click' && event.isTrigger !== true && !jQuery.isEmptyObject(AJAX.lockedTargets) && @@ -248,27 +248,27 @@ var AJAX = { // something else. Otherwise silently bail out, as there is already // a request well in progress. if (AJAX.xhr) { - //In case of a link request, attempt aborting + // In case of a link request, attempt aborting AJAX.xhr.abort(); - if(AJAX.xhr.status === 0 && AJAX.xhr.statusText === 'abort') { - //If aborted + if (AJAX.xhr.status === 0 && AJAX.xhr.statusText === 'abort') { + // If aborted AJAX.$msgbox = PMA_ajaxShowMessage(PMA_messages.strAbortedRequest); AJAX.active = false; AJAX.xhr = null; previousLinkAborted = true; } else { - //If can't abort + // If can't abort return false; } } else { - //In case submitting a form, don't attempt aborting + // In case submitting a form, don't attempt aborting return false; } } AJAX.source = $(this); - $('html, body').animate({scrollTop: 0}, 'fast'); + $('html, body').animate({ scrollTop: 0 }, 'fast'); var url = isLink ? href : $(this).attr('action'); var params = 'ajax_request=true&ajax_page_request=true'; @@ -281,21 +281,21 @@ var AJAX = { } if (AJAX._debug) { - console.log("Loading: " + url); // no need to translate + console.log('Loading: ' + url); // no need to translate } if (isLink) { AJAX.active = true; AJAX.$msgbox = PMA_ajaxShowMessage(); - //Save reference for the new link request + // Save reference for the new link request AJAX.xhr = $.get(url, params, AJAX.responseHandler); if (history && history.pushState) { var state = { url : href }; if (previousLinkAborted) { - //hack: there is already an aborted entry on stack - //so just modify the aborted one + // hack: there is already an aborted entry on stack + // so just modify the aborted one history.replaceState(state, null, href); } else { history.pushState(state, null, href); @@ -339,8 +339,8 @@ var AJAX = { if (typeof data === 'undefined' || data === null) { return; } - if (typeof data.success != 'undefined' && data.success) { - $('html, body').animate({scrollTop: 0}, 'fast'); + if (typeof data.success !== 'undefined' && data.success) { + $('html, body').animate({ scrollTop: 0 }, 'fast'); PMA_ajaxRemoveMessage(AJAX.$msgbox); if (data._redirect) { @@ -376,8 +376,7 @@ var AJAX = { } if (data._disableNaviSettings) { PMA_disableNaviSettings(); - } - else { + } else { PMA_ensureNaviSettings(data._selflink); } @@ -398,7 +397,7 @@ var AJAX = { // Replace #page_content with new content if (data.message && data.message.length > 0) { $('#page_content').replaceWith( - "
" + data.message + "
" + '
' + data.message + '
' ); PMA_highlightSQL($('#page_content')); checkNumberOfFields(); @@ -406,11 +405,11 @@ var AJAX = { if (data._selflink) { var source = data._selflink.split('?')[0]; - //Check for faulty links + // Check for faulty links $selflink_replace = { - "import.php": "tbl_sql.php", - "tbl_chart.php": "sql.php", - "tbl_gis_visualization.php": "sql.php" + 'import.php': 'tbl_sql.php', + 'tbl_chart.php': 'sql.php', + 'tbl_gis_visualization.php': 'sql.php' }; if ($selflink_replace[source]) { var replacement = $selflink_replace[source]; @@ -443,19 +442,19 @@ var AJAX = { $('#pma_errors').remove(); var msg = ''; - if(data._errSubmitMsg){ + if (data._errSubmitMsg) { msg = data._errSubmitMsg; } if (data._errors) { - $('
', {id : 'pma_errors', class : 'clearfloat'}) + $('
', { id : 'pma_errors', class : 'clearfloat' }) .insertAfter('#selflink') .append(data._errors); // bind for php error reporting forms (bottom) - $("#pma_ignore_errors_bottom").on("click", function(e) { + $('#pma_ignore_errors_bottom').on('click', function (e) { e.preventDefault(); PMA_ignorePhpErrors(); }); - $("#pma_ignore_all_errors_bottom").on("click", function(e) { + $('#pma_ignore_all_errors_bottom').on('click', function (e) { e.preventDefault(); PMA_ignorePhpErrors(false); }); @@ -464,22 +463,22 @@ var AJAX = { if (data._sendErrorAlways == '1' && data._stopErrorReportLoop != '1' ) { - $("#pma_report_errors_form").submit(); + $('#pma_report_errors_form').submit(); PMA_ajaxShowMessage(PMA_messages.phpErrorsBeingSubmitted, false); - $('html, body').animate({scrollTop:$(document).height()}, 'slow'); + $('html, body').animate({ scrollTop:$(document).height() }, 'slow'); } else if (data._promptPhpErrors) { // otherwise just prompt user if it is set so. msg = msg + PMA_messages.phpErrorsFound; // scroll to bottom where all the errors are displayed. - $('html, body').animate({scrollTop:$(document).height()}, 'slow'); + $('html, body').animate({ scrollTop:$(document).height() }, 'slow'); } } PMA_ajaxShowMessage(msg, false); // bind for php error reporting forms (popup) - $("#pma_ignore_errors_popup").on("click", function() { + $('#pma_ignore_errors_popup').on('click', function () { PMA_ignorePhpErrors(); }); - $("#pma_ignore_all_errors_popup").on("click", function() { + $('#pma_ignore_all_errors_popup').on('click', function () { PMA_ignorePhpErrors(false); }); @@ -488,15 +487,14 @@ var AJAX = { } AJAX._callback = function () {}; }); - } else { PMA_ajaxShowMessage(data.error, false); AJAX.active = false; AJAX.xhr = null; PMA_handleRedirectAndReload(data); if (data.fieldWithError) { - $(':input.error').removeClass("error"); - $('#'+data.fieldWithError).addClass("error"); + $(':input.error').removeClass('error'); + $('#' + data.fieldWithError).addClass('error'); } } }, @@ -577,7 +575,7 @@ var AJAX = { if ($.inArray(script, self._scripts) == -1) { needRequest = true; this.add(script); - request.push("scripts%5B%5D=" + script); + request.push('scripts%5B%5D=' + script); if (request.length >= 10) { // Download scripts in chunks this.appendScript(request); @@ -586,8 +584,8 @@ var AJAX = { } } } - request.push("call_done=1"); - request.push("v=" + encodeURIComponent(PMA_commonParams.get('PMA_VERSION'))); + request.push('call_done=1'); + request.push('v=' + encodeURIComponent(PMA_commonParams.get('PMA_VERSION'))); // Download the composite js file, if necessary if (needRequest) { this.appendScript(request); @@ -601,7 +599,7 @@ var AJAX = { * @return void */ done: function (callback) { - if($.isFunction(callback)) { + if ($.isFunction(callback)) { callback(); } if (typeof ErrorReport !== 'undefined') { @@ -621,10 +619,10 @@ var AJAX = { var head = document.head || document.getElementsByTagName('head')[0]; var script = document.createElement('script'); - request.push("call_done=1"); - request.push("v=" + encodeURIComponent(PMA_commonParams.get('PMA_VERSION'))); + request.push('call_done=1'); + request.push('v=' + encodeURIComponent(PMA_commonParams.get('PMA_VERSION'))); script.type = 'text/javascript'; - script.src = "js/get_scripts.js.php?" + request.join("&"); + script.src = 'js/get_scripts.js.php?' + request.join('&'); script.async = false; head.appendChild(script); }, @@ -677,7 +675,7 @@ AJAX.registerOnload('functions.js', function () { * Workaround for passing submit button name,value on ajax form submit * by appending hidden element with submit button name and value. */ - $page_content.on('click', 'form input[type=submit]', function() { + $page_content.on('click', 'form input[type=submit]', function () { var buttonName = $(this).attr('name'); if (typeof buttonName === 'undefined') { return; @@ -699,14 +697,14 @@ AJAX.registerOnload('functions.js', function () { 'form.lock-page input[type="text"], ' + 'form.lock-page input[type="number"], ' + 'form.lock-page select', - {value:1}, + { value:1 }, AJAX.lockPageHandler ); $page_content.on( 'change', 'form.lock-page input[type="checkbox"], ' + 'form.lock-page input[type="radio"]', - {value:2}, + { value:2 }, AJAX.lockPageHandler ); /** @@ -714,7 +712,7 @@ AJAX.registerOnload('functions.js', function () { * Note: reset does not bubble in all browser so attach to * form directly. */ - $('form.lock-page').on('reset', function(event){ + $('form.lock-page').on('reset', function (event) { AJAX.resetLock(); }); }); @@ -728,7 +726,7 @@ $(function () { .append($('#topmenucontainer').clone()) .html(); if (history && history.pushState) { - //set initial state reload + // set initial state reload var initState = ('state' in window.history && window.history.state !== null); var initURL = $('#selflink').find('> a').attr('href') || location.href; var state = { @@ -737,10 +735,10 @@ $(function () { }; history.replaceState(state, null); - $(window).on('popstate', function(event) { + $(window).on('popstate', function (event) { var initPop = (! initState && location.href == initURL); initState = true; - //check if popstate fired on first page itself + // check if popstate fired on first page itself if (initPop) { return; } @@ -750,17 +748,17 @@ $(function () { var params = 'ajax_request=true&ajax_page_request=true'; var url = state.url || location.href; $.get(url, params, AJAX.responseHandler); - //TODO: Check if sometimes menu is not retrieved from server, + // TODO: Check if sometimes menu is not retrieved from server, // Not sure but it seems menu was missing only for printview which // been removed lately, so if it's right some dead menu checks/fallbacks // may need to be removed from this file and Header.php - //AJAX.handleMenu.replace(event.originalEvent.state.menu); + // AJAX.handleMenu.replace(event.originalEvent.state.menu); } }); } else { // Fallback to microhistory mechanism AJAX.scriptHandler - .load([{'name' : 'microhistory.js', 'fire' : 1}], function () { + .load([{ 'name' : 'microhistory.js', 'fire' : 1 }], function () { // The cache primer is set by the footer class if (PMA_MicroHistory.primer.url) { PMA_MicroHistory.menus.add( @@ -800,7 +798,7 @@ $(document).ajaxError(function (event, request, settings) { } // Don't handle aborted requests if (request.status !== 0 || request.statusText !== 'abort') { - var details = '' + var details = ''; var state = request.state(); if (request.status !== 0) { diff --git a/js/chart.js b/js/chart.js index 6f1d036e60..cd48e9b122 100644 --- a/js/chart.js +++ b/js/chart.js @@ -29,7 +29,7 @@ var ChartFactory = function () { }; ChartFactory.prototype = { createChart : function (type, options) { - throw new Error("createChart must be implemented by a subclass"); + throw new Error('createChart must be implemented by a subclass'); } }; @@ -44,16 +44,16 @@ var Chart = function (elementId) { }; Chart.prototype = { draw : function (data, options) { - throw new Error("draw must be implemented by a subclass"); + throw new Error('draw must be implemented by a subclass'); }, redraw : function (options) { - throw new Error("redraw must be implemented by a subclass"); + throw new Error('redraw must be implemented by a subclass'); }, destroy : function () { - throw new Error("destroy must be implemented by a subclass"); + throw new Error('destroy must be implemented by a subclass'); }, - toImageString : function() { - throw new Error("toImageString must be implemented by a subclass"); + toImageString : function () { + throw new Error('toImageString must be implemented by a subclass'); } }; @@ -77,11 +77,11 @@ BaseChart.prototype.constructor = BaseChart; BaseChart.prototype.validateColumns = function (dataTable) { var columns = dataTable.getColumns(); if (columns.length < 2) { - throw new Error("Minimum of two columns are required for this chart"); + throw new Error('Minimum of two columns are required for this chart'); } for (var i = 1; i < columns.length; i++) { if (columns[i].type != ColumnType.NUMBER) { - throw new Error("Column " + (i + 1) + " should be of type 'Number'"); + throw new Error('Column ' + (i + 1) + ' should be of type \'Number\''); } } return true; @@ -101,7 +101,7 @@ PieChart.prototype.constructor = PieChart; PieChart.prototype.validateColumns = function (dataTable) { var columns = dataTable.getColumns(); if (columns.length > 2) { - throw new Error("Pie charts can draw only one series"); + throw new Error('Pie charts can draw only one series'); } return BaseChart.prototype.validateColumns.call(this, dataTable); }; @@ -122,7 +122,7 @@ TimelineChart.prototype.validateColumns = function (dataTable) { if (result) { var columns = dataTable.getColumns(); if (columns[0].type != ColumnType.DATE) { - throw new Error("First column of timeline chart need to be a date column"); + throw new Error('First column of timeline chart need to be a date column'); } } return result; @@ -134,7 +134,7 @@ TimelineChart.prototype.validateColumns = function (dataTable) { * @param elementId * id of the div element the chart is drawn in */ -var ScatterChart = function(elementId) { +var ScatterChart = function (elementId) { BaseChart.call(this, elementId); }; ScatterChart.prototype = new BaseChart(); @@ -144,7 +144,7 @@ ScatterChart.prototype.validateColumns = function (dataTable) { if (result) { var columns = dataTable.getColumns(); if (columns[0].type != ColumnType.NUMBER) { - throw new Error("First column of scatter chart need to be a numeric column"); + throw new Error('First column of scatter chart need to be a numeric column'); } } return result; @@ -179,7 +179,7 @@ var DataTable = function () { var fillMissingValues = function () { if (columns.length === 0) { - throw new Error("Set columns first"); + throw new Error('Set columns first'); } var row; for (var i = 0; i < data.length; i++) { @@ -195,7 +195,7 @@ var DataTable = function () { }; }; -/******************************************************************************* +/** ***************************************************************************** * JQPlot specific code ******************************************************************************/ @@ -215,7 +215,7 @@ JQPlotChart.prototype.constructor = JQPlotChart; JQPlotChart.prototype.draw = function (data, options) { if (this.validator.validateColumns(data)) { this.plot = $.jqplot(this.elementId, this.prepareData(data), this - .populateOptions(data, options)); + .populateOptions(data, options)); } }; JQPlotChart.prototype.destroy = function () { @@ -234,10 +234,10 @@ JQPlotChart.prototype.toImageString = function (options) { } }; JQPlotChart.prototype.populateOptions = function (dataTable, options) { - throw new Error("populateOptions must be implemented by a subclass"); + throw new Error('populateOptions must be implemented by a subclass'); }; JQPlotChart.prototype.prepareData = function (dataTable) { - throw new Error("prepareData must be implemented by a subclass"); + throw new Error('prepareData must be implemented by a subclass'); }; /** @@ -324,7 +324,7 @@ JQPlotSplineChart.prototype.constructor = JQPlotSplineChart; JQPlotSplineChart.prototype.populateOptions = function (dataTable, options) { var optional = {}; var opt = JQPlotLineChart.prototype.populateOptions.call(this, dataTable, - options); + options); var compulsory = { seriesDefaults : { rendererOptions : { @@ -379,7 +379,7 @@ JQPlotScatterChart.prototype.populateOptions = function (dataTable, options) { showLine: false, markerOptions: { size: 7, - style: "x" + style: 'x' } } }; @@ -481,7 +481,7 @@ JQPlotAreaChart.prototype.populateOptions = function (dataTable, options) { } }; var opt = JQPlotLineChart.prototype.populateOptions.call(this, dataTable, - options); + options); var compulsory = { seriesDefaults : { fill : true @@ -510,7 +510,7 @@ JQPlotColumnChart.prototype.populateOptions = function (dataTable, options) { } }; var opt = JQPlotLineChart.prototype.populateOptions.call(this, dataTable, - options); + options); var compulsory = { seriesDefaults : { renderer : $.jqplot.BarRenderer @@ -612,7 +612,7 @@ JQPlotPieChart.prototype.populateOptions = function (dataTable, options) { seriesDefaults : { shadow: false, renderer : $.jqplot.PieRenderer, - rendererOptions: {sliceMargin: 1, showDataLabels: true } + rendererOptions: { sliceMargin: 1, showDataLabels: true } } }; $.extend(true, optional, options, compulsory); @@ -624,9 +624,9 @@ JQPlotPieChart.prototype.prepareData = function (dataTable) { var retData = []; for (var i = 0; i < data.length; i++) { row = data[i]; - retData.push([ row[0], row[1] ]); + retData.push([row[0], row[1]]); } - return [ retData ]; + return [retData]; }; /** diff --git a/js/codemirror/addon/lint/sql-lint.js b/js/codemirror/addon/lint/sql-lint.js index 25c9ef9bd7..46448599d7 100644 --- a/js/codemirror/addon/lint/sql-lint.js +++ b/js/codemirror/addon/lint/sql-lint.js @@ -1,12 +1,11 @@ -CodeMirror.sqlLint = function(text, updateLinting, options, cm) { - +CodeMirror.sqlLint = function (text, updateLinting, options, cm) { // Skipping check if text box is empty. - if(text.trim() == "") { + if (text.trim() == '') { updateLinting(cm, []); return; } - function handleResponse(response) { + function handleResponse (response) { var found = []; for (var idx in response) { found.push({ @@ -25,8 +24,8 @@ CodeMirror.sqlLint = function(text, updateLinting, options, cm) { } $.ajax({ - method: "POST", - url: "lint.php", + method: 'POST', + url: 'lint.php', dataType: 'json', data: { sql_query: text, @@ -36,4 +35,4 @@ CodeMirror.sqlLint = function(text, updateLinting, options, cm) { }, success: handleResponse }); -} +}; diff --git a/js/common.js b/js/common.js index 7bb4aadca8..044ecd1db6 100644 --- a/js/common.js +++ b/js/common.js @@ -99,7 +99,7 @@ var PMA_commonParams = (function () { ); } }; -})(); +}()); /** * Holds common parameters such as server, db, table, etc @@ -118,7 +118,7 @@ var PMA_commonActions = { */ setDb: function (new_db) { if (new_db != PMA_commonParams.get('db')) { - PMA_commonParams.setAll({'db': new_db, 'table': ''}); + PMA_commonParams.setAll({ 'db': new_db, 'table': '' }); } }, /** @@ -150,7 +150,7 @@ var PMA_commonActions = { url = url.substring(0, url.indexOf('?')); } url += PMA_commonParams.getUrlQuery(); - $('', {href: url}) + $('', { href: url }) .appendTo('body') .click() .remove(); @@ -190,17 +190,17 @@ PMA_DROP_IMPORT = { * * @return string, extension for valid extension, '' otherwise */ - _getExtension: function(file) { + _getExtension: function (file) { var arr = file.split('.'); ext = arr[arr.length - 1]; - //check if compressed + // check if compressed if (jQuery.inArray(ext.toLowerCase(), PMA_DROP_IMPORT.allowedCompressedExtensions) !== -1) { ext = arr[arr.length - 2]; } - //Now check for extension + // Now check for extension if (jQuery.inArray(ext.toLowerCase(), PMA_DROP_IMPORT.allowedExtensions) !== -1) { return ext; @@ -215,8 +215,8 @@ PMA_DROP_IMPORT = { * * @return void */ - _setProgress: function(hash, percent) { - $('.pma_sql_import_status div li[data-hash="' +hash +'"]') + _setProgress: function (hash, percent) { + $('.pma_sql_import_status div li[data-hash="' + hash + '"]') .children('progress').val(percent); }, /** @@ -227,33 +227,33 @@ PMA_DROP_IMPORT = { * * @return void */ - _sendFileToServer: function(formData, hash) { - var uploadURL ="./import.php"; //Upload URL - var extraData ={}; + _sendFileToServer: function (formData, hash) { + var uploadURL = './import.php'; // Upload URL + var extraData = {}; var jqXHR = $.ajax({ - xhr: function() { + xhr: function () { var xhrobj = $.ajaxSettings.xhr(); if (xhrobj.upload) { - xhrobj.upload.addEventListener('progress', function(event) { + xhrobj.upload.addEventListener('progress', function (event) { var percent = 0; var position = event.loaded || event.position; var total = event.total; if (event.lengthComputable) { percent = Math.ceil(position / total * 100); } - //Set progress + // Set progress PMA_DROP_IMPORT._setProgress(hash, percent); }, false); } return xhrobj; }, url: uploadURL, - type: "POST", + type: 'POST', contentType:false, processData: false, cache: false, data: formData, - success: function(data){ + success: function (data) { PMA_DROP_IMPORT._importFinished(hash, false, data.success); if (!data.success) { PMA_DROP_IMPORT.importStatus[PMA_DROP_IMPORT.importStatus.length] = { @@ -273,26 +273,26 @@ PMA_DROP_IMPORT = { // -- add event listener to this link to abort upload operation $('.pma_sql_import_status div li[data-hash="' + hash + '"] span.filesize span.pma_drop_file_status') - .on('click', function() { + .on('click', function () { if ($(this).attr('task') === 'cancel') { jqXHR.abort(); - $(this).html('' +PMA_messages.dropImportMessageAborted +''); + $(this).html('' + PMA_messages.dropImportMessageAborted + ''); PMA_DROP_IMPORT._importFinished(hash, true, false); - } else if ($(this).children("span").html() === + } else if ($(this).children('span').html() === PMA_messages.dropImportMessageFailed) { // -- view information var $this = $(this); - $.each( PMA_DROP_IMPORT.importStatus, - function( key, value ) { - if (value.hash === hash) { - $(".pma_drop_result:visible").remove(); - var filename = $this.parent('span').attr('data-filename'); - $("body").append('

' + + $.each(PMA_DROP_IMPORT.importStatus, + function (key, value) { + if (value.hash === hash) { + $('.pma_drop_result:visible').remove(); + var filename = $this.parent('span').attr('data-filename'); + $('body').append('

' + PMA_messages.dropImportImportResultHeader + ' - ' + - filename +'x

' +value.message +'
'); - $(".pma_drop_result").draggable(); //to make this dialog draggable - } - }); + filename + 'x

' + value.message + '
'); + $('.pma_drop_result').draggable(); // to make this dialog draggable + } + }); } }); }, @@ -304,10 +304,9 @@ PMA_DROP_IMPORT = { * @return void */ _dragenter : function (event) { - // We don't want to prevent users from using // browser's default drag-drop feature on some page(s) - if ($(".noDragDrop").length !== 0) { + if ($('.noDragDrop').length !== 0) { return; } @@ -317,11 +316,11 @@ PMA_DROP_IMPORT = { return; } if (PMA_commonParams.get('db') === '') { - $(".pma_drop_handler").html(PMA_messages.dropImportSelectDB); + $('.pma_drop_handler').html(PMA_messages.dropImportSelectDB); } else { - $(".pma_drop_handler").html(PMA_messages.dropImportDropFiles); + $('.pma_drop_handler').html(PMA_messages.dropImportDropFiles); } - $(".pma_drop_handler").fadeIn(); + $('.pma_drop_handler').fadeIn(); }, /** * Check if dragged element contains Files @@ -348,7 +347,7 @@ PMA_DROP_IMPORT = { _dragover: function (event) { // We don't want to prevent users from using // browser's default drag-drop feature on some page(s) - if ($(".noDragDrop").length !== 0) { + if ($('.noDragDrop').length !== 0) { return; } @@ -357,7 +356,7 @@ PMA_DROP_IMPORT = { if (!PMA_DROP_IMPORT._hasFiles(event)) { return; } - $(".pma_drop_handler").fadeIn(); + $('.pma_drop_handler').fadeIn(); }, /** * Triggered when dragged objects are left @@ -369,12 +368,12 @@ PMA_DROP_IMPORT = { _dragleave: function (event) { // We don't want to prevent users from using // browser's default drag-drop feature on some page(s) - if ($(".noDragDrop").length !== 0) { + if ($('.noDragDrop').length !== 0) { return; } event.stopPropagation(); event.preventDefault(); - var $pma_drop_handler = $(".pma_drop_handler"); + var $pma_drop_handler = $('.pma_drop_handler'); $pma_drop_handler.clearQueue().stop(); $pma_drop_handler.fadeOut(); $pma_drop_handler.html(PMA_messages.dropImportDropFiles); @@ -388,20 +387,20 @@ PMA_DROP_IMPORT = { * * @return void */ - _importFinished: function(hash, aborted, status) { - $('.pma_sql_import_status div li[data-hash="' +hash +'"]') - .children("progress").hide(); + _importFinished: function (hash, aborted, status) { + $('.pma_sql_import_status div li[data-hash="' + hash + '"]') + .children('progress').hide(); var icon = 'icon ic_s_success'; // -- provide link to view upload status if (!aborted) { if (status) { $('.pma_sql_import_status div li[data-hash="' + hash + '"] span.filesize span.pma_drop_file_status') - .html('' +PMA_messages.dropImportMessageSuccess +'
'); + .html('' + PMA_messages.dropImportMessageSuccess + ''); } else { $('.pma_sql_import_status div li[data-hash="' + hash + '"] span.filesize span.pma_drop_file_status') - .html('' + PMA_messages.dropImportMessageFailed + + .html('' + PMA_messages.dropImportMessageFailed + ''); icon = 'icon ic_s_error'; } @@ -413,9 +412,9 @@ PMA_DROP_IMPORT = { .attr('task', 'info'); // Set icon - $('.pma_sql_import_status div li[data-hash="' +hash +'"]') + $('.pma_sql_import_status div li[data-hash="' + hash + '"]') .prepend(' '); + icon + '"> '); // Decrease liveUploadCount by one $('.pma_import_count').html(--PMA_DROP_IMPORT.liveUploadCount); @@ -434,49 +433,49 @@ PMA_DROP_IMPORT = { _drop: function (event) { // We don't want to prevent users from using // browser's default drag-drop feature on some page(s) - if ($(".noDragDrop").length !== 0) { + if ($('.noDragDrop').length !== 0) { return; } var dbname = PMA_commonParams.get('db'); var server = PMA_commonParams.get('server'); - //if no database is selected -- no + // if no database is selected -- no if (dbname !== '') { var files = event.originalEvent.dataTransfer.files; if (!files || files.length === 0) { // No files actually transferred - $(".pma_drop_handler").fadeOut(); + $('.pma_drop_handler').fadeOut(); event.stopPropagation(); event.preventDefault(); return; } - $(".pma_sql_import_status").slideDown(); + $('.pma_sql_import_status').slideDown(); for (var i = 0; i < files.length; i++) { var ext = (PMA_DROP_IMPORT._getExtension(files[i].name)); var hash = AJAX.hash(++PMA_DROP_IMPORT.uploadCount); - var $pma_sql_import_status_div = $(".pma_sql_import_status div"); - $pma_sql_import_status_div.append('
  • ' + + var $pma_sql_import_status_div = $('.pma_sql_import_status div'); + $pma_sql_import_status_div.append('
  • ' + ((ext !== '') ? '' : ' ') + escapeHtml(files[i].name) + '' +(files[i].size/1024).toFixed(2) + + escapeHtml(files[i].name) + '">' + (files[i].size / 1024).toFixed(2) + ' kb
  • '); - //scroll the UI to bottom + // scroll the UI to bottom $pma_sql_import_status_div.scrollTop( $pma_sql_import_status_div.scrollTop() + 50 - ); //50 hardcoded for now + ); // 50 hardcoded for now if (ext !== '') { // Increment liveUploadCount by one $('.pma_import_count').html(++PMA_DROP_IMPORT.liveUploadCount); $('.pma_sql_import_status h2 .close').fadeOut(); - $('.pma_sql_import_status div li[data-hash="' +hash +'"]') + $('.pma_sql_import_status div li[data-hash="' + hash + '"]') .append('
    '); - //uploading + // uploading var fd = new FormData(); fd.append('import_file', files[i]); fd.append('noplugin', Math.random().toString(36).substring(2, 12)); @@ -504,7 +503,7 @@ PMA_DROP_IMPORT = { } } } - $(".pma_drop_handler").fadeOut(); + $('.pma_drop_handler').fadeOut(); event.stopPropagation(); event.preventDefault(); } @@ -520,31 +519,31 @@ $(document).on('dragenter', PMA_DROP_IMPORT._dragenter); $(document).on('dragover', PMA_DROP_IMPORT._dragover); $(document).on('dragleave', '.pma_drop_handler', PMA_DROP_IMPORT._dragleave); -//when file is dropped to PMA UI +// when file is dropped to PMA UI $(document).on('drop', 'body', PMA_DROP_IMPORT._drop); // minimizing-maximising the sql ajax upload status -$(document).on('click', '.pma_sql_import_status h2 .minimize', function() { +$(document).on('click', '.pma_sql_import_status h2 .minimize', function () { if ($(this).attr('toggle') === 'off') { $('.pma_sql_import_status div').css('height','270px'); $(this).attr('toggle','on'); $(this).html('-'); // to minimize } else { - $('.pma_sql_import_status div').css("height","0px"); + $('.pma_sql_import_status div').css('height','0px'); $(this).attr('toggle','off'); $(this).html('+'); // to maximise } }); // closing sql ajax upload status -$(document).on('click', '.pma_sql_import_status h2 .close', function() { - $('.pma_sql_import_status').fadeOut(function() { +$(document).on('click', '.pma_sql_import_status h2 .close', function () { + $('.pma_sql_import_status').fadeOut(function () { $('.pma_sql_import_status div').html(''); - PMA_DROP_IMPORT.importStatus = []; //clear the message array + PMA_DROP_IMPORT.importStatus = []; // clear the message array }); }); // Closing the import result box -$(document).on('click', '.pma_drop_result h2 .close', function(){ +$(document).on('click', '.pma_drop_result h2 .close', function () { $(this).parent('h2').parent('div').remove(); }); diff --git a/js/config.js b/js/config.js index 4e19c32aec..abfd601d58 100644 --- a/js/config.js +++ b/js/config.js @@ -10,8 +10,7 @@ * * @returns bool */ -function isStorageSupported(type, warn) -{ +function isStorageSupported (type, warn) { try { window[type].setItem('PMATest', 'test'); // Check whether key-value pair was set successfully @@ -20,7 +19,7 @@ function isStorageSupported(type, warn) window[type].removeItem('PMATest'); return true; } - } catch(error) { + } catch (error) { // Not supported if (warn) { PMA_ajaxShowMessage(PMA_messages.strNoLocalStorage, false); @@ -56,8 +55,7 @@ var defaultValues = {}; * * @param {Element} field */ -function getFieldType(field) -{ +function getFieldType (field) { var $field = $(field); var tagName = $field.prop('tagName'); if (tagName == 'INPUT') { @@ -76,8 +74,7 @@ function getFieldType(field) * @param {Element} field * @param {boolean} display */ -function setRestoreDefaultBtn(field, display) -{ +function setRestoreDefaultBtn (field, display) { var $el = $(field).closest('td').find('.restore-default img'); $el[display ? 'show' : 'hide'](); } @@ -87,8 +84,7 @@ function setRestoreDefaultBtn(field, display) * * @param {Element} field */ -function markField(field) -{ +function markField (field) { var $field = $(field); var type = getFieldType($field); var isDefault = checkFieldDefault($field, type); @@ -112,8 +108,7 @@ function markField(field) * @param {String} field_type see {@link #getFieldType} * @param {String|Boolean} [value] */ -function setFieldValue(field, field_type, value) -{ +function setFieldValue (field, field_type, value) { var $field = $(field); switch (field_type) { case 'text': @@ -152,8 +147,7 @@ function setFieldValue(field, field_type, value) * @param {String} field_type returned by {@link #getFieldType} * @type Boolean|String|String[] */ -function getFieldValue(field, field_type) -{ +function getFieldValue (field, field_type) { var $field = $(field); switch (field_type) { case 'text': @@ -177,15 +171,14 @@ function getFieldValue(field, field_type) /** * Returns values for all fields in fieldsets */ -function getAllValues() -{ +function getAllValues () { var $elements = $('fieldset input, fieldset select, fieldset textarea'); var values = {}; var type, value; for (var i = 0; i < $elements.length; i++) { type = getFieldType($elements[i]); value = getFieldValue($elements[i], type); - if (typeof value != 'undefined') { + if (typeof value !== 'undefined') { // we only have single selects, fatten array if (type == 'select') { value = value[0]; @@ -203,11 +196,10 @@ function getAllValues() * @param {String} type * @return boolean */ -function checkFieldDefault(field, type) -{ +function checkFieldDefault (field, type) { var $field = $(field); var field_id = $field.attr('id'); - if (typeof defaultValues[field_id] == 'undefined') { + if (typeof defaultValues[field_id] === 'undefined') { return true; } var isDefault = true; @@ -218,8 +210,7 @@ function checkFieldDefault(field, type) // compare arrays, will work for our representation of select values if (currentValue.length != defaultValues[field_id].length) { isDefault = false; - } - else { + } else { for (var i = 0; i < currentValue.length; i++) { if (currentValue[i] != defaultValues[field_id][i]) { isDefault = false; @@ -235,8 +226,7 @@ function checkFieldDefault(field, type) * Returns element's id prefix * @param {Element} element */ -function getIdPrefix(element) -{ +function getIdPrefix (element) { return $(element).attr('id').replace(/[^-]+$/, ''); } @@ -333,12 +323,11 @@ var validators = { * @param {boolean} onKeyUp whether fire on key up * @param {Array} params validation function parameters */ -function validateField(id, type, onKeyUp, params) -{ - if (typeof validators[type] == 'undefined') { +function validateField (id, type, onKeyUp, params) { + if (typeof validators[type] === 'undefined') { return; } - if (typeof validate[id] == 'undefined') { + if (typeof validate[id] === 'undefined') { validate[id] = []; } validate[id].push([type, params, onKeyUp]); @@ -352,17 +341,16 @@ function validateField(id, type, onKeyUp, params) * @type Array * @return array of [function, parameters to be passed to function] */ -function getFieldValidators(field_id, onKeyUpOnly) -{ +function getFieldValidators (field_id, onKeyUpOnly) { // look for field bound validator var name = field_id && field_id.match(/[^-]+$/)[0]; - if (typeof validators._field[name] != 'undefined') { + if (typeof validators._field[name] !== 'undefined') { return [[validators._field[name], null]]; } // look for registered validators var functions = []; - if (typeof validate[field_id] != 'undefined') { + if (typeof validate[field_id] !== 'undefined') { // validate[field_id]: array of [type, params, onKeyUp] for (var i = 0, imax = validate[field_id].length; i < imax; i++) { if (onKeyUpOnly && !validate[field_id][i][2]) { @@ -383,8 +371,7 @@ function getFieldValidators(field_id, onKeyUpOnly) * * @param {Object} error_list list of errors in the form {field id: error array} */ -function displayErrors(error_list) -{ +function displayErrors (error_list) { var tempIsEmpty = function (item) { return item !== ''; }; @@ -441,16 +428,15 @@ function displayErrors(error_list) * @param {boolean} isKeyUp * @param {Object} errors */ -function validate_fieldset(fieldset, isKeyUp, errors) -{ +function validate_fieldset (fieldset, isKeyUp, errors) { var $fieldset = $(fieldset); - if ($fieldset.length && typeof validators._fieldset[$fieldset.attr('id')] != 'undefined') { + if ($fieldset.length && typeof validators._fieldset[$fieldset.attr('id')] !== 'undefined') { var fieldset_errors = validators._fieldset[$fieldset.attr('id')].apply($fieldset[0], [isKeyUp]); for (var field_id in fieldset_errors) { - if (typeof errors[field_id] == 'undefined') { + if (typeof errors[field_id] === 'undefined') { errors[field_id] = []; } - if (typeof fieldset_errors[field_id] == 'string') { + if (typeof fieldset_errors[field_id] === 'string') { fieldset_errors[field_id] = [fieldset_errors[field_id]]; } $.merge(errors[field_id], fieldset_errors[field_id]); @@ -465,8 +451,7 @@ function validate_fieldset(fieldset, isKeyUp, errors) * @param {boolean} isKeyUp * @param {Object} errors */ -function validate_field(field, isKeyUp, errors) -{ +function validate_field (field, isKeyUp, errors) { var args, result; var $field = $(field); var field_id = $field.attr('id'); @@ -481,7 +466,7 @@ function validate_field(field, isKeyUp, errors) args.unshift(isKeyUp); result = functions[i][0].apply($field[0], args); if (result !== true) { - if (typeof result == 'string') { + if (typeof result === 'string') { result = [result]; } $.merge(errors[field_id], result); @@ -495,8 +480,7 @@ function validate_field(field, isKeyUp, errors) * @param {Element} field * @param {boolean} isKeyUp */ -function validate_field_and_fieldset(field, isKeyUp) -{ +function validate_field_and_fieldset (field, isKeyUp) { var $field = $(field); var errors = {}; validate_field($field, isKeyUp, errors); @@ -504,7 +488,7 @@ function validate_field_and_fieldset(field, isKeyUp) displayErrors(errors); } -function loadInlineConfig() { +function loadInlineConfig () { if (!Array.isArray(configInlineParams)) { return; } @@ -515,10 +499,10 @@ function loadInlineConfig() { } } -function setupValidation() { +function setupValidation () { validate = {}; configScriptLoaded = true; - if (configScriptLoaded && typeof configInlineParams !== "undefined") { + if (configScriptLoaded && typeof configInlineParams !== 'undefined') { loadInlineConfig(); } // register validators and mark custom values @@ -581,9 +565,8 @@ AJAX.registerOnload('config.js', function () { * * @param {String} tab_id */ -function setTab(tab_id) -{ - $('ul.tabs').each(function() { +function setTab (tab_id) { + $('ul.tabs').each(function () { var $this = $(this); if (!$this.find('li a[href="#' + tab_id + '"]').length) { return; @@ -596,9 +579,9 @@ function setTab(tab_id) }); } -function setupConfigTabs() { +function setupConfigTabs () { var forms = $('form.config-form'); - forms.each(function() { + forms.each(function () { var $this = $(this); var $tabs = $this.find('ul.tabs'); if (!$tabs.length) { @@ -618,14 +601,14 @@ function setupConfigTabs() { }); } -function adjustPrefsNotification() { - var $prefsAutoLoad = $('#prefs_autoload'); - var $tableNameControl = $('#table_name_col_no'); - var $prefsAutoShowing = ($prefsAutoLoad.css('display') !== 'none'); +function adjustPrefsNotification () { + var $prefsAutoLoad = $('#prefs_autoload'); + var $tableNameControl = $('#table_name_col_no'); + var $prefsAutoShowing = ($prefsAutoLoad.css('display') !== 'none'); - if ($prefsAutoShowing && $tableNameControl.length) { + if ($prefsAutoShowing && $tableNameControl.length) { $tableNameControl.css('top', '120px'); - } + } } AJAX.registerOnload('config.js', function () { @@ -681,8 +664,7 @@ AJAX.registerOnload('config.js', function () { * * @param {String} field_id */ -function restoreField(field_id) -{ +function restoreField (field_id) { var $field = $('#' + field_id); if ($field.length === 0 || defaultValues[field_id] === undefined) { return; @@ -690,7 +672,7 @@ function restoreField(field_id) setFieldValue($field, getFieldType($field), defaultValues[field_id]); } -function setupRestoreField() { +function setupRestoreField () { $('div.tabs_contents') .on('mouseenter', '.restore-default, .set-value', function () { $(this).css('opacity', 1); @@ -714,7 +696,7 @@ function setupRestoreField() { }) .find('.restore-default, .set-value') // inline-block for IE so opacity inheritance works - .css({display: 'inline-block', opacity: 0.25}); + .css({ display: 'inline-block', opacity: 0.25 }); } AJAX.registerOnload('config.js', function () { @@ -767,7 +749,7 @@ AJAX.registerOnload('config.js', function () { disabled = $form.find('input[type=radio][value$=local_storage]').prop('checked'); } else if (!ls_exists && $form.attr('name') == 'prefs_import' && $('#import_local_storage')[0].checked - ) { + ) { disabled = true; } $form.find('input[type=submit]').prop('disabled', disabled); @@ -785,11 +767,11 @@ AJAX.registerOnload('config.js', function () { $(document).on('click', 'div.click-hide-message', function () { $(this) - .hide() - .parent('.group') - .css('height', '') - .next('form') - .show(); + .hide() + .parent('.group') + .css('height', '') + .next('form') + .show(); }); }); @@ -798,8 +780,7 @@ AJAX.registerOnload('config.js', function () { * * @param {Element} form */ -function savePrefsToLocalStorage(form) -{ +function savePrefsToLocalStorage (form) { $form = $(form); var submit = $form.find('input[type=submit]'); submit.prop('disabled', true); @@ -837,8 +818,7 @@ function savePrefsToLocalStorage(form) /** * Updates preferences timestamp in Import form */ -function updatePrefsDate() -{ +function updatePrefsDate () { var d = new Date(window.localStorage.config_mtime_local); var msg = PMA_messages.strSavedOn.replace( '@DATE@', @@ -850,8 +830,7 @@ function updatePrefsDate() /** * Prepares message which informs that localStorage preferences are available and can be imported or deleted */ -function offerPrefsAutoimport() -{ +function offerPrefsAutoimport () { var has_config = (isStorageSupported('localStorage')) && (window.localStorage.config || false); var $cnt = $('#prefs_autoload'); if (!$cnt.length || !has_config) { diff --git a/js/console.js b/js/console.js index 57539fca48..bd763e879e 100644 --- a/js/console.js +++ b/js/console.js @@ -55,8 +55,7 @@ var PMA_console = { * * @return void */ - initialize: function() { - + initialize: function () { if ($('#pma_console').length === 0) { return; } @@ -72,8 +71,8 @@ var PMA_console = { } // Vars init - PMA_console.$consoleToolbar = $("#pma_console").find(">.toolbar"); - PMA_console.$consoleContent = $("#pma_console").find(">.content"); + PMA_console.$consoleToolbar = $('#pma_console').find('>.toolbar'); + PMA_console.$consoleContent = $('#pma_console').find('>.content'); PMA_console.$consoleAllContents = $('#pma_console').find('.content'); PMA_console.$consoleTemplates = $('#pma_console').find('>.templates'); @@ -93,7 +92,6 @@ var PMA_console = { // Event binds shouldn't run again if (PMA_console.isInitialized === false) { - // Load config first var tempConfig = Cookies.getJSON('pma_console_config'); if (tempConfig) { @@ -127,51 +125,51 @@ var PMA_console = { PMA_console.$consoleToolbar.children('.console_switch').click(PMA_console.toggle); - $('#pma_console').find('.toolbar').children().mousedown(function(event) { + $('#pma_console').find('.toolbar').children().mousedown(function (event) { event.preventDefault(); event.stopImmediatePropagation(); }); - $('#pma_console').find('.button.clear').click(function() { + $('#pma_console').find('.button.clear').click(function () { PMA_consoleMessages.clear(); }); - $('#pma_console').find('.button.history').click(function() { + $('#pma_console').find('.button.history').click(function () { PMA_consoleMessages.showHistory(); }); - $('#pma_console').find('.button.options').click(function() { + $('#pma_console').find('.button.options').click(function () { PMA_console.showCard('#pma_console_options'); }); - $('#pma_console').find('.button.debug').click(function() { + $('#pma_console').find('.button.debug').click(function () { PMA_console.showCard('#debug_console'); }); - PMA_console.$consoleContent.click(function(event) { + PMA_console.$consoleContent.click(function (event) { if (event.target == this) { PMA_consoleInput.focus(); } }); - $('#pma_console').find('.mid_layer').click(function() { + $('#pma_console').find('.mid_layer').click(function () { PMA_console.hideCard($(this).parent().children('.card')); }); - $('#debug_console').find('.switch_button').click(function() { + $('#debug_console').find('.switch_button').click(function () { PMA_console.hideCard($(this).closest('.card')); }); - $('#pma_bookmarks').find('.switch_button').click(function() { + $('#pma_bookmarks').find('.switch_button').click(function () { PMA_console.hideCard($(this).closest('.card')); }); - $('#pma_console_options').find('.switch_button').click(function() { + $('#pma_console_options').find('.switch_button').click(function () { PMA_console.hideCard($(this).closest('.card')); }); - $('#pma_console_options').find('input[type=checkbox]').change(function() { + $('#pma_console_options').find('input[type=checkbox]').change(function () { PMA_console.updateConfig(); }); - $('#pma_console_options').find('.button.default').click(function() { + $('#pma_console_options').find('.button.default').click(function () { $('#pma_console_options input[name=always_expand]').prop('checked', false); $('#pma_console_options').find('input[name=start_history]').prop('checked', false); $('#pma_console_options').find('input[name=current_query]').prop('checked', true); @@ -180,7 +178,7 @@ var PMA_console = { PMA_console.updateConfig(); }); - $('#pma_console_options').find('input[name=enter_executes]').change(function() { + $('#pma_console_options').find('input[name=enter_executes]').change(function () { PMA_consoleMessages.showInstructions(PMA_console.config.enterExecutes); }); @@ -196,7 +194,7 @@ var PMA_console = { PMA_console.ajaxCallback(data); } catch (e) { console.trace(); - console.log("Failed to parse JSON: " + e.message); + console.log('Failed to parse JSON: ' + e.message); } }); @@ -204,21 +202,21 @@ var PMA_console = { } // Change console mode from cookie - switch(Cookies.get('pma_console_mode')) { - case 'collapse': - PMA_console.collapse(); - break; + switch (Cookies.get('pma_console_mode')) { + case 'collapse': + PMA_console.collapse(); + break; /* jshint -W086 */// no break needed in default section - default: - Cookies.set('pma_console_mode', 'info'); - case 'info': + default: + Cookies.set('pma_console_mode', 'info'); + case 'info': /* jshint +W086 */ - PMA_console.info(); - break; - case 'show': - PMA_console.show(true); - PMA_console.scrollBottom(); - break; + PMA_console.info(); + break; + case 'show': + PMA_console.show(true); + PMA_console.scrollBottom(); + break; } }, /** @@ -226,8 +224,8 @@ var PMA_console = { * * @return void */ - execute: function(queryString, options) { - if (typeof(queryString) != 'string' || ! /[a-z]|[A-Z]/.test(queryString)) { + execute: function (queryString, options) { + if (typeof(queryString) !== 'string' || ! /[a-z]|[A-Z]/.test(queryString)) { return; } PMA_console.$requestForm.children('textarea').val(queryString); @@ -251,16 +249,16 @@ var PMA_console = { return; } PMA_console.$requestForm.children('[name=console_message_id]') - .val(PMA_consoleMessages.appendQuery({sql_query: queryString}).message_id); + .val(PMA_consoleMessages.appendQuery({ sql_query: queryString }).message_id); PMA_console.$requestForm.trigger('submit'); PMA_consoleInput.clear(); PMA_reloadNavigation(); }, - ajaxCallback: function(data) { + ajaxCallback: function (data) { if (data && data.console_message_id) { PMA_consoleMessages.updateQuery(data.console_message_id, data.success, (data._reloadQuerywindow ? data._reloadQuerywindow : false)); - } else if ( data && data._reloadQuerywindow) { + } else if (data && data._reloadQuerywindow) { if (data._reloadQuerywindow.sql_query.length > 0) { PMA_consoleMessages.appendQuery(data._reloadQuerywindow, 'successed') .$message.addClass(PMA_console.config.currentQuery ? '' : 'hide'); @@ -272,7 +270,7 @@ var PMA_console = { * * @return void */ - collapse: function() { + collapse: function () { Cookies.set('pma_console_mode', 'collapse'); var pmaConsoleHeight = Cookies.get('pma_console_height'); @@ -282,9 +280,9 @@ var PMA_console = { PMA_console.$consoleToolbar.addClass('collapsed'); PMA_console.$consoleAllContents.height(pmaConsoleHeight); PMA_console.$consoleContent.stop(); - PMA_console.$consoleContent.animate({'margin-bottom': -1 * PMA_console.$consoleContent.outerHeight() + 'px'}, - 'fast', 'easeOutQuart', function() { - PMA_console.$consoleContent.css({display:'none'}); + PMA_console.$consoleContent.animate({ 'margin-bottom': -1 * PMA_console.$consoleContent.outerHeight() + 'px' }, + 'fast', 'easeOutQuart', function () { + PMA_console.$consoleContent.css({ display:'none' }); $(window).trigger('resize'); }); PMA_console.hideCard(); @@ -295,7 +293,7 @@ var PMA_console = { * @param bool inputFocus If true, focus the input line after show() * @return void */ - show: function(inputFocus) { + show: function (inputFocus) { Cookies.set('pma_console_mode', 'show'); var pmaConsoleHeight = Cookies.get('pma_console_height'); @@ -305,14 +303,14 @@ var PMA_console = { PMA_console.collapse(); return; } - PMA_console.$consoleContent.css({display:'block'}); + PMA_console.$consoleContent.css({ display:'block' }); if (PMA_console.$consoleToolbar.hasClass('collapsed')) { PMA_console.$consoleToolbar.removeClass('collapsed'); } PMA_console.$consoleAllContents.height(pmaConsoleHeight); PMA_console.$consoleContent.stop(); - PMA_console.$consoleContent.animate({'margin-bottom': 0}, - 'fast', 'easeOutQuart', function() { + PMA_console.$consoleContent.animate({ 'margin-bottom': 0 }, + 'fast', 'easeOutQuart', function () { $(window).trigger('resize'); if (inputFocus) { PMA_consoleInput.focus(); @@ -326,7 +324,7 @@ var PMA_console = { * * @return void */ - info: function() { + info: function () { // Under construction PMA_console.collapse(); }, @@ -336,17 +334,17 @@ var PMA_console = { * * @return void */ - toggle: function() { - switch(Cookies.get('pma_console_mode')) { - case 'collapse': - case 'info': - PMA_console.show(true); - break; - case 'show': - PMA_console.collapse(); - break; - default: - PMA_consoleInitialize(); + toggle: function () { + switch (Cookies.get('pma_console_mode')) { + case 'collapse': + case 'info': + PMA_console.show(true); + break; + case 'show': + PMA_console.collapse(); + break; + default: + PMA_consoleInitialize(); } }, /** @@ -354,8 +352,8 @@ var PMA_console = { * * @return void */ - scrollBottom: function() { - PMA_console.$consoleContent.scrollTop(PMA_console.$consoleContent.prop("scrollHeight")); + scrollBottom: function () { + PMA_console.$consoleContent.scrollTop(PMA_console.$consoleContent.prop('scrollHeight')); }, /** * Show card @@ -365,7 +363,7 @@ var PMA_console = { * * @return void */ - showCard: function(cardSelector) { + showCard: function (cardSelector) { var $card = null; if (typeof(cardSelector) !== 'string') { if (cardSelector.length > 0) { @@ -374,7 +372,7 @@ var PMA_console = { return; } } else { - $card = $("#pma_console " + cardSelector); + $card = $('#pma_console ' + cardSelector); } if ($card.length === 0) { return; @@ -392,7 +390,7 @@ var PMA_console = { * @param object $targetCard Target card JQuery object, if it's empty, function will hide all cards * @return void */ - hideCard: function($targetCard) { + hideCard: function ($targetCard) { if (! $targetCard) { $('#pma_console').find('.mid_layer').fadeOut(140); $('#pma_console').find('.card').removeClass('show'); @@ -407,7 +405,7 @@ var PMA_console = { * * @return void */ - updateConfig: function() { + updateConfig: function () { PMA_console.config = { alwaysExpand: $('#pma_console_options input[name=always_expand]').prop('checked'), startHistory: $('#pma_console_options').find('input[name=start_history]').prop('checked'), @@ -416,7 +414,7 @@ var PMA_console = { darkTheme: $('#pma_console_options').find('input[name=dark_theme]').prop('checked') }; Cookies.set('pma_console_config', PMA_console.config); - /*Setting the dark theme of the console*/ + /* Setting the dark theme of the console*/ if (PMA_console.config.darkTheme) { $('#pma_console').find('>.content').addClass('console_dark_theme'); } else { @@ -443,7 +441,7 @@ var PMA_consoleResizer = { * * @return void */ - _mousedown: function(event) { + _mousedown: function (event) { if (Cookies.get('pma_console_mode') !== 'show') { return; } @@ -452,24 +450,25 @@ var PMA_consoleResizer = { $(document).mousemove(PMA_consoleResizer._mousemove); $(document).mouseup(PMA_consoleResizer._mouseup); // Disable text selection while resizing - $(document).on('selectstart', function() { return false; }); + $(document).on('selectstart', function () { + return false; + }); }, /** * Mousemove event handler for bind to resizer * * @return void */ - _mousemove: function(event) { + _mousemove: function (event) { if (event.pageY < 35) { - event.pageY = 35 + event.pageY = 35; } - PMA_consoleResizer._resultHeight = PMA_consoleResizer._height + (PMA_consoleResizer._posY -event.pageY); + PMA_consoleResizer._resultHeight = PMA_consoleResizer._height + (PMA_consoleResizer._posY - event.pageY); // Content min-height is 32, if adjusting height small than it we'll move it out of the page if (PMA_consoleResizer._resultHeight <= 32) { PMA_console.$consoleAllContents.height(32); PMA_console.$consoleContent.css('margin-bottom', PMA_consoleResizer._resultHeight - 32); - } - else { + } else { // Logic below makes viewable area always at bottom when adjusting height and content already at bottom if (PMA_console.$consoleContent.scrollTop() + PMA_console.$consoleContent.innerHeight() + 16 >= PMA_console.$consoleContent.prop('scrollHeight')) { @@ -485,7 +484,7 @@ var PMA_consoleResizer = { * * @return void */ - _mouseup: function() { + _mouseup: function () { Cookies.set('pma_console_height', PMA_consoleResizer._resultHeight); PMA_console.show(); $(document).off('mousemove'); @@ -497,7 +496,7 @@ var PMA_consoleResizer = { * * @return void */ - initialize: function() { + initialize: function () { $('#pma_console').find('.toolbar').off('mousedown'); $('#pma_console').find('.toolbar').mousedown(PMA_consoleResizer._mousedown); } @@ -533,7 +532,7 @@ var PMA_consoleInput = { * * @return void */ - initialize: function() { + initialize: function () { // _cm object can't be reinitialize if (PMA_consoleInput._inputs !== null) { return; @@ -547,16 +546,16 @@ var PMA_consoleInput = { theme: 'pma', mode: 'text/x-sql', lineWrapping: true, - extraKeys: {"Ctrl-Space": "autocomplete"}, - hintOptions: {"completeSingle": false, "completeOnSingleClick": true}, - gutters: ["CodeMirror-lint-markers"], + extraKeys: { 'Ctrl-Space': 'autocomplete' }, + hintOptions: { 'completeSingle': false, 'completeOnSingleClick': true }, + gutters: ['CodeMirror-lint-markers'], lint: { - "getAnnotations": CodeMirror.sqlLint, - "async": true, + 'getAnnotations': CodeMirror.sqlLint, + 'async': true, } }); - PMA_consoleInput._inputs.console.on("inputRead", codemirrorAutocompleteOnInputRead); - PMA_consoleInput._inputs.console.on("keydown", function(instance, event) { + PMA_consoleInput._inputs.console.on('inputRead', codemirrorAutocompleteOnInputRead); + PMA_consoleInput._inputs.console.on('keydown', function (instance, event) { PMA_consoleInput._historyNavigate(event); }); if ($('#pma_bookmarks').length !== 0) { @@ -564,15 +563,15 @@ var PMA_consoleInput = { theme: 'pma', mode: 'text/x-sql', lineWrapping: true, - extraKeys: {"Ctrl-Space": "autocomplete"}, - hintOptions: {"completeSingle": false, "completeOnSingleClick": true}, - gutters: ["CodeMirror-lint-markers"], + extraKeys: { 'Ctrl-Space': 'autocomplete' }, + hintOptions: { 'completeSingle': false, 'completeOnSingleClick': true }, + gutters: ['CodeMirror-lint-markers'], lint: { - "getAnnotations": CodeMirror.sqlLint, - "async": true, + 'getAnnotations': CodeMirror.sqlLint, + 'async': true, } }); - PMA_consoleInput._inputs.bookmark.on("inputRead", codemirrorAutocompleteOnInputRead); + PMA_consoleInput._inputs.bookmark.on('inputRead', codemirrorAutocompleteOnInputRead); } } else { PMA_consoleInput._inputs.console = @@ -585,7 +584,7 @@ var PMA_consoleInput = { } $('#pma_console').find('.console_query_input').keydown(PMA_consoleInput._keydown); }, - _historyNavigate: function(event) { + _historyNavigate: function (event) { if (event.keyCode == 38 || event.keyCode == 40) { var upPermitted = false; var downPermitted = false; @@ -598,7 +597,7 @@ var PMA_consoleInput = { } else { // Get cursor position from textarea var text = PMA_consoleInput.getText(); - cursorLine = text.substr(0, editor.prop("selectionStart")).split("\n").length - 1; + cursorLine = text.substr(0, editor.prop('selectionStart')).split('\n').length - 1; totalLine = text.split(/\r*\n/).length; } if (cursorLine === 0) { @@ -645,7 +644,7 @@ var PMA_consoleInput = { * * @return void */ - _keydown: function(event) { + _keydown: function (event) { if (PMA_console.config.enterExecutes) { // Enter, but not in combination with Shift (which writes a new line). if (!event.shiftKey && event.keyCode === 13) { @@ -663,7 +662,7 @@ var PMA_consoleInput = { * * @return void */ - execute: function() { + execute: function () { if (PMA_consoleInput._codemirror) { PMA_console.execute(PMA_consoleInput._inputs.console.getValue()); } else { @@ -676,7 +675,7 @@ var PMA_consoleInput = { * @param string target, default target is console input * @return void */ - clear: function(target) { + clear: function (target) { PMA_consoleInput.setText('', target); }, /** @@ -684,7 +683,7 @@ var PMA_consoleInput = { * * @return void */ - focus: function() { + focus: function () { PMA_consoleInput._inputs.console.focus(); }, /** @@ -692,7 +691,7 @@ var PMA_consoleInput = { * * @return void */ - blur: function() { + blur: function () { if (PMA_consoleInput._codemirror) { PMA_consoleInput._inputs.console.getInputField().blur(); } else { @@ -706,43 +705,43 @@ var PMA_consoleInput = { * @param string target * @return void */ - setText: function(text, target) { + setText: function (text, target) { if (PMA_consoleInput._codemirror) { - switch(target) { - case 'bookmark': - PMA_console.execute(PMA_consoleInput._inputs.bookmark.setValue(text)); - break; - default: - case 'console': - PMA_console.execute(PMA_consoleInput._inputs.console.setValue(text)); + switch (target) { + case 'bookmark': + PMA_console.execute(PMA_consoleInput._inputs.bookmark.setValue(text)); + break; + default: + case 'console': + PMA_console.execute(PMA_consoleInput._inputs.console.setValue(text)); } } else { - switch(target) { - case 'bookmark': - PMA_console.execute(PMA_consoleInput._inputs.bookmark.val(text)); - break; - default: - case 'console': - PMA_console.execute(PMA_consoleInput._inputs.console.val(text)); + switch (target) { + case 'bookmark': + PMA_console.execute(PMA_consoleInput._inputs.bookmark.val(text)); + break; + default: + case 'console': + PMA_console.execute(PMA_consoleInput._inputs.console.val(text)); } } }, - getText: function(target) { + getText: function (target) { if (PMA_consoleInput._codemirror) { - switch(target) { - case 'bookmark': - return PMA_consoleInput._inputs.bookmark.getValue(); - default: - case 'console': - return PMA_consoleInput._inputs.console.getValue(); + switch (target) { + case 'bookmark': + return PMA_consoleInput._inputs.bookmark.getValue(); + default: + case 'console': + return PMA_consoleInput._inputs.console.getValue(); } } else { - switch(target) { - case 'bookmark': - return PMA_consoleInput._inputs.bookmark.val(); - default: - case 'console': - return PMA_consoleInput._inputs.console.val(); + switch (target) { + case 'bookmark': + return PMA_consoleInput._inputs.bookmark.val(); + default: + case 'console': + return PMA_consoleInput._inputs.console.val(); } } } @@ -759,7 +758,7 @@ var PMA_consoleMessages = { * * @return void */ - clear: function() { + clear: function () { $('#pma_console').find('.content .console_message_container .message:not(.welcome)').addClass('hide'); $('#pma_console').find('.content .console_message_container .message.failed').remove(); $('#pma_console').find('.content .console_message_container .message.expanded').find('.action.collapse').click(); @@ -769,7 +768,7 @@ var PMA_consoleMessages = { * * @return void */ - showHistory: function() { + showHistory: function () { $('#pma_console').find('.content .console_message_container .message.hide').removeClass('hide'); }, /** @@ -778,7 +777,7 @@ var PMA_consoleMessages = { * @param int nthLast get nth query message from latest, i.e 1st is last * @return string message */ - getHistory: function(nthLast) { + getHistory: function (nthLast) { var $queries = $('#pma_console').find('.content .console_message_container .query'); var length = $queries.length; var $query = $queries.eq(length - nthLast); @@ -795,7 +794,7 @@ var PMA_consoleMessages = { * @param bool enterExecutes Only Enter has to be pressed to execute query. * @return void */ - showInstructions: function(enterExecutes) { + showInstructions: function (enterExecutes) { enterExecutes = +enterExecutes || 0; // conversion to int var $welcomeMsg = $('#pma_console').find('.content .console_message_container .message.welcome span'); $welcomeMsg.children('[id^=instructions]').hide(); @@ -808,39 +807,39 @@ var PMA_consoleMessages = { * @param string msgType Message type * @return object, {message_id, $message} */ - append: function(msgString, msgType) { + append: function (msgString, msgType) { if (typeof(msgString) !== 'string') { return false; } // Generate an ID for each message, we can find them later - var msgId = Math.round(Math.random()*(899999999999)+100000000000); + var msgId = Math.round(Math.random() * (899999999999) + 100000000000); var now = new Date(); var $newMessage = $('
    '); - switch(msgType) { - case 'query': - $newMessage.append('
    '); - if (PMA_consoleInput._codemirror) { - CodeMirror.runMode(msgString, - 'text/x-sql', $newMessage.children('.query')[0]); - } else { - $newMessage.children('.query').text(msgString); - } - $newMessage.children('.action_content') - .append(PMA_console.$consoleTemplates.children('.query_actions').html()); - break; - default: - case 'normal': - $newMessage.append('
    ' + msgString + '
    '); + switch (msgType) { + case 'query': + $newMessage.append('
    '); + if (PMA_consoleInput._codemirror) { + CodeMirror.runMode(msgString, + 'text/x-sql', $newMessage.children('.query')[0]); + } else { + $newMessage.children('.query').text(msgString); + } + $newMessage.children('.action_content') + .append(PMA_console.$consoleTemplates.children('.query_actions').html()); + break; + default: + case 'normal': + $newMessage.append('
    ' + msgString + '
    '); } PMA_consoleMessages._msgEventBinds($newMessage); $newMessage.find('span.text.query_time span') .text(now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds()) .parent().attr('title', now); - return {message_id: msgId, - $message: $newMessage.appendTo('#pma_console .content .console_message_container')}; + return { message_id: msgId, + $message: $newMessage.appendTo('#pma_console .content .console_message_container') }; }, /** * Used for log new query @@ -850,7 +849,7 @@ var PMA_consoleMessages = { * @param string state Message state * @return object, {message_id: string message id, $message: JQuery object} */ - appendQuery: function(queryData, state) { + appendQuery: function (queryData, state) { var targetMessage = PMA_consoleMessages.append(queryData.sql_query, 'query'); if (! targetMessage) { return false; @@ -863,20 +862,20 @@ var PMA_consoleMessages = { if (PMA_console.isSelect(queryData.sql_query)) { targetMessage.$message.addClass('select'); } - switch(state) { - case 'failed': - targetMessage.$message.addClass('failed'); - break; - case 'successed': - targetMessage.$message.addClass('successed'); - break; - default: - case 'pending': - targetMessage.$message.addClass('pending'); + switch (state) { + case 'failed': + targetMessage.$message.addClass('failed'); + break; + case 'successed': + targetMessage.$message.addClass('successed'); + break; + default: + case 'pending': + targetMessage.$message.addClass('pending'); } return targetMessage; }, - _msgEventBinds: function($targetMessage) { + _msgEventBinds: function ($targetMessage) { // Leave unbinded elements, remove binded. $targetMessage = $targetMessage.filter(':not(.binded)'); if ($targetMessage.length === 0) { @@ -900,9 +899,9 @@ var PMA_consoleMessages = { var query = $(this).parent().siblings('.query').text(); var $message = $(this).closest('.message'); if (confirm(PMA_messages.strConsoleRequeryConfirm + '\n' + - (query.length<100 ? query : query.slice(0, 100) + '...')) + (query.length < 100 ? query : query.slice(0, 100) + '...')) ) { - PMA_console.execute(query, {db: $message.attr('targetdb'), table: $message.attr('targettable')}); + PMA_console.execute(query, { db: $message.attr('targetdb'), table: $message.attr('targettable') }); } }); $targetMessage.find('.action.bookmark').click(function () { @@ -924,10 +923,10 @@ var PMA_consoleMessages = { if (confirm(PMA_messages.strConsoleDeleteBookmarkConfirm + '\n' + $message.find('.bookmark_label').text())) { $.post('import.php', { - server: PMA_commonParams.get('server'), - action_bookmark: 2, - ajax_request: true, - id_bookmark: $message.attr('bookmarkid')}, + server: PMA_commonParams.get('server'), + action_bookmark: 2, + ajax_request: true, + id_bookmark: $message.attr('bookmarkid') }, function () { PMA_consoleBookmarks.refresh(); }); @@ -936,15 +935,15 @@ var PMA_consoleMessages = { $targetMessage.find('.action.profiling').click(function () { var $message = $(this).closest('.message'); PMA_console.execute($(this).parent().siblings('.query').text(), - {db: $message.attr('targetdb'), - table: $message.attr('targettable'), - profiling: true}); + { db: $message.attr('targetdb'), + table: $message.attr('targettable'), + profiling: true }); }); $targetMessage.find('.action.explain').click(function () { var $message = $(this).closest('.message'); PMA_console.execute('EXPLAIN ' + $(this).parent().siblings('.query').text(), - {db: $message.attr('targetdb'), - table: $message.attr('targettable')}); + { db: $message.attr('targetdb'), + table: $message.attr('targettable') }); }); $targetMessage.find('.action.dbg_show_trace').click(function () { var $message = $(this).closest('.message'); @@ -975,22 +974,22 @@ var PMA_consoleMessages = { $message.removeClass('show_args expanded'); }); if (PMA_consoleInput._codemirror) { - $targetMessage.find('.query:not(.highlighted)').each(function(index, elem) { - CodeMirror.runMode($(elem).text(), - 'text/x-sql', elem); - $(this).addClass('highlighted'); - }); + $targetMessage.find('.query:not(.highlighted)').each(function (index, elem) { + CodeMirror.runMode($(elem).text(), + 'text/x-sql', elem); + $(this).addClass('highlighted'); + }); } }, - msgAppend: function(msgId, msgString, msgType) { - var $targetMessage = $('#pma_console').find('.content .console_message_container .message[msgid=' + msgId +']'); + msgAppend: function (msgId, msgString, msgType) { + var $targetMessage = $('#pma_console').find('.content .console_message_container .message[msgid=' + msgId + ']'); if ($targetMessage.length === 0 || isNaN(parseInt(msgId)) || typeof(msgString) !== 'string') { return false; } $targetMessage.append('
    ' + msgString + '
    '); }, - updateQuery: function(msgId, isSuccessed, queryData) { - var $targetMessage = $('#pma_console').find('.console_message_container .message[msgid=' + parseInt(msgId) +']'); + updateQuery: function (msgId, isSuccessed, queryData) { + var $targetMessage = $('#pma_console').find('.console_message_container .message[msgid=' + parseInt(msgId) + ']'); if ($targetMessage.length === 0 || isNaN(parseInt(msgId))) { return false; } @@ -1021,7 +1020,7 @@ var PMA_consoleMessages = { * * @return void */ - initialize: function() { + initialize: function () { PMA_consoleMessages._msgEventBinds($('#pma_console').find('.message:not(.binded)')); if (PMA_console.config.startHistory) { PMA_consoleMessages.showHistory(); @@ -1043,25 +1042,25 @@ var PMA_consoleBookmarks = { $('#pma_bookmarks').find('.add [name=id_bookmark]').val(''); PMA_consoleInput.setText('', 'bookmark'); - switch(arguments.length) { - case 4: - $('#pma_bookmarks').find('.add [name=shared]').prop('checked', isShared); - case 3: - $('#pma_bookmarks').find('.add [name=label]').val(label); - case 2: - $('#pma_bookmarks').find('.add [name=targetdb]').val(targetDb); - case 1: - PMA_consoleInput.setText(queryString, 'bookmark'); - default: - break; + switch (arguments.length) { + case 4: + $('#pma_bookmarks').find('.add [name=shared]').prop('checked', isShared); + case 3: + $('#pma_bookmarks').find('.add [name=label]').val(label); + case 2: + $('#pma_bookmarks').find('.add [name=targetdb]').val(targetDb); + case 1: + PMA_consoleInput.setText(queryString, 'bookmark'); + default: + break; } }, refresh: function () { $.get('import.php', - {ajax_request: true, - server: PMA_commonParams.get('server'), - console_bookmark_refresh: 'refresh'}, - function(data) { + { ajax_request: true, + server: PMA_commonParams.get('server'), + console_bookmark_refresh: 'refresh' }, + function (data) { if (data.console_message_bookmark) { $('#pma_bookmarks').find('.content.bookmark').html(data.console_message_bookmark); PMA_consoleMessages._msgEventBinds($('#pma_bookmarks').find('.message:not(.binded)')); @@ -1074,40 +1073,39 @@ var PMA_consoleBookmarks = { * * @return void */ - initialize: function() { + initialize: function () { if ($('#pma_bookmarks').length === 0) { return; } - $('#pma_console').find('.button.bookmarks').click(function() { + $('#pma_console').find('.button.bookmarks').click(function () { PMA_console.showCard('#pma_bookmarks'); }); - $('#pma_bookmarks').find('.button.add').click(function() { + $('#pma_bookmarks').find('.button.add').click(function () { PMA_console.showCard('#pma_bookmarks .card.add'); }); $('#pma_bookmarks').find('.card.add [name=submit]').click(function () { if ($('#pma_bookmarks').find('.card.add [name=label]').val().length === 0 - || PMA_consoleInput.getText('bookmark').length === 0) - { + || PMA_consoleInput.getText('bookmark').length === 0) { alert(PMA_messages.strFormEmpty); return; } $(this).prop('disabled', true); $.post('import.php', { - ajax_request: true, - console_bookmark_add: 'true', - label: $('#pma_bookmarks').find('.card.add [name=label]').val(), - server: PMA_commonParams.get('server'), - db: $('#pma_bookmarks').find('.card.add [name=targetdb]').val(), - bookmark_query: PMA_consoleInput.getText('bookmark'), - shared: $('#pma_bookmarks').find('.card.add [name=shared]').prop('checked')}, + ajax_request: true, + console_bookmark_add: 'true', + label: $('#pma_bookmarks').find('.card.add [name=label]').val(), + server: PMA_commonParams.get('server'), + db: $('#pma_bookmarks').find('.card.add [name=targetdb]').val(), + bookmark_query: PMA_consoleInput.getText('bookmark'), + shared: $('#pma_bookmarks').find('.card.add [name=shared]').prop('checked') }, function () { PMA_consoleBookmarks.refresh(); $('#pma_bookmarks').find('.card.add [name=submit]').prop('disabled', false); PMA_console.hideCard($('#pma_bookmarks').find('.card.add')); }); }); - $('#pma_console').find('.button.refresh').click(function() { + $('#pma_console').find('.button.refresh').click(function () { PMA_consoleBookmarks.refresh(); }); } @@ -1195,8 +1193,7 @@ PMA_consoleDebug = { // Show SQL debug info for first page load if (typeof debugSQLInfo !== 'undefined' && debugSQLInfo !== 'null') { $('#pma_console').find('.button.debug').removeClass('hide'); - } - else { + } else { return; } PMA_consoleDebug.showLog(debugSQLInfo); @@ -1238,22 +1235,22 @@ PMA_consoleDebug = { if (dbgStep.args.length) { $args.append('
    ') .append( - $('
    ') - .text( - PMA_sprintf( - PMA_messages.strConsoleDebugArgsSummary, - dbgStep.args.length - ) - ) - ); + $('
    ') + .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 = $('