Skip to content

Commit

Permalink
many some minor fixes (sorry, see diff)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gemorroj committed Jan 26, 2013
1 parent c3f2796 commit fc51a91
Show file tree
Hide file tree
Showing 30 changed files with 192 additions and 183 deletions.
8 changes: 4 additions & 4 deletions js/ajax.js
Expand Up @@ -57,7 +57,7 @@ var AJAX = {
* @return self For chaining
*/
registerOnload: function (file, func) {
eventName = 'onload_' + AJAX.hash(file);
var eventName = 'onload_' + AJAX.hash(file);
$(document).bind(eventName, func);
this._debug && console.log(
// no need to translate
Expand All @@ -76,7 +76,7 @@ var AJAX = {
* @return self For chaining
*/
registerTeardown: function (file, func) {
eventName = 'teardown_' + AJAX.hash(file);
var eventName = 'teardown_' + AJAX.hash(file);
$(document).bind(eventName, func);
this._debug && console.log(
// no need to translate
Expand All @@ -93,7 +93,7 @@ var AJAX = {
* @return void
*/
fireOnload: function (file) {
eventName = 'onload_' + AJAX.hash(file);
var eventName = 'onload_' + AJAX.hash(file);
$(document).trigger(eventName);
this._debug && console.log(
// no need to translate
Expand All @@ -109,7 +109,7 @@ var AJAX = {
* @return void
*/
fireTeardown: function (file) {
eventName = 'teardown_' + AJAX.hash(file);
var eventName = 'teardown_' + AJAX.hash(file);
$(document).triggerHandler(eventName);
this._debug && console.log(
// no need to translate
Expand Down
16 changes: 9 additions & 7 deletions js/config.js
Expand Up @@ -61,9 +61,11 @@ function setFieldValue(field, field_type, value)
field = $(field);
switch (field_type) {
case 'text':
//TODO: replace to .val()
field.attr('value', (value != undefined ? value : field.attr('defaultValue')));
break;
case 'checkbox':
//TODO: replace to .prop()
field.attr('checked', (value != undefined ? value : field.attr('defaultChecked')));
break;
case 'select':
Expand Down Expand Up @@ -642,15 +644,15 @@ AJAX.registerOnload('config.js', function() {

// enable JavaScript dependent fields
radios
.attr('disabled', false)
.prop('disabled', false)
.add('#export_text_file, #import_text_file')
.click(function(){
var enable_id = $(this).attr('id');
var disable_id = enable_id.match(/local_storage$/)
? enable_id.replace(/local_storage$/, 'text_file')
: enable_id.replace(/text_file$/, 'local_storage');
$('#opts_'+disable_id).addClass('disabled').find('input').attr('disabled', true);
$('#opts_'+enable_id).removeClass('disabled').find('input').attr('disabled', false);
$('#opts_'+disable_id).addClass('disabled').find('input').prop('disabled', true);
$('#opts_'+enable_id).removeClass('disabled').find('input').prop('disabled', false);
});

// detect localStorage state
Expand All @@ -665,12 +667,12 @@ AJAX.registerOnload('config.js', function() {
var form = $(this);
var disabled = false;
if (!ls_supported) {
disabled = form.find('input[type=radio][value$=local_storage]').attr('checked');
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]').attr('disabled', disabled);
form.find('input[type=submit]').prop('disabled', disabled);
}).submit(function(e) {
var form = $(this);
if (form.attr('name') == 'prefs_export' && $('#export_local_storage')[0].checked) {
Expand Down Expand Up @@ -702,7 +704,7 @@ function savePrefsToLocalStorage(form)
{
form = $(form);
var submit = form.find('input[type=submit]');
submit.attr('disabled', true);
submit.prop('disabled', true);
$.ajax({
url: 'prefs_manage.php',
cache: false,
Expand All @@ -725,7 +727,7 @@ function savePrefsToLocalStorage(form)
form.prev('.click-hide-message').show('fast');
},
complete: function() {
submit.attr('disabled', false);
submit.prop('disabled', false);
}
});
}
Expand Down
10 changes: 5 additions & 5 deletions js/db_operations.js
Expand Up @@ -63,7 +63,7 @@ AJAX.registerOnload('db_operations.js', function() {
} else {
PMA_ajaxShowMessage(data.error, false);
}
}) // end $.get()
}); // end $.get()
})
}); // end Rename Database

Expand Down Expand Up @@ -92,8 +92,8 @@ AJAX.registerOnload('db_operations.js', function() {
} else {
PMA_ajaxShowMessage(data.error, false);
}
}) // end $.get
}) // end copy database
}); // end $.get
}); // end copy database

/**
* Ajax Event handler for 'Change Charset' of the database
Expand All @@ -109,6 +109,6 @@ AJAX.registerOnload('db_operations.js', function() {
} else {
PMA_ajaxShowMessage(data.error, false);
}
}) // end $.get()
}) // end change charset
}); // end $.get()
}); // end change charset
});
11 changes: 6 additions & 5 deletions js/db_search.js
Expand Up @@ -147,8 +147,9 @@ AJAX.registerOnload('db_search.js', function() {
* Changing the displayed text according to
* the hide/show criteria in search form
*/
$("#togglequerybox").hide();
$("#togglequerybox").bind('click', function() {
$("#togglequerybox")
.hide()
.bind('click', function() {
var $link = $(this);
$('#sqlqueryform').slideToggle("medium");
if ($link.text() == PMA_messages['strHideQueryBox']) {
Expand Down Expand Up @@ -187,7 +188,7 @@ AJAX.registerOnload('db_search.js', function() {

var $msgbox = PMA_ajaxShowMessage(PMA_messages['strSearching'], false);
// jQuery object to reuse
$form = $(this);
var $form = $(this);

PMA_prepareForAjaxRequest($form);

Expand All @@ -199,7 +200,7 @@ AJAX.registerOnload('db_search.js', function() {

$('#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();
Expand All @@ -212,7 +213,7 @@ AJAX.registerOnload('db_search.js', function() {
.hide();
$('#togglesearchformlink')
// always start with the Show message
.text(PMA_messages['strShowSearchCriteria'])
.text(PMA_messages['strShowSearchCriteria']);
$('#togglesearchformdiv')
// now it's time to show the div containing the link
.show();
Expand Down
2 changes: 1 addition & 1 deletion js/db_structure.js
Expand Up @@ -319,7 +319,7 @@ AJAX.registerOnload('db_structure.js', function() {
}

// Make the removed table visible in the list of 'Untracked tables'.
$untracked_table = $('table#noversions');
var $untracked_table = $('table#noversions');

// This won't work if no untracked tables are there.
if ($untracked_table.length > 0) {
Expand Down
45 changes: 22 additions & 23 deletions js/functions.js
Expand Up @@ -17,7 +17,7 @@ var sql_box_locked = false;
/**
* @var array holds elements which content should only selected once
*/
var only_once_elements = new Array();
var only_once_elements = [];

/**
* @var int ajax_message_count Number of AJAX messages shown since page load
Expand All @@ -37,7 +37,7 @@ var codemirror_inline_editor = false;
/**
* @var chart_activeTimeouts object active timeouts that refresh the charts. When disabling a realtime chart, this can be used to stop the continuous ajax requests
*/
var chart_activeTimeouts = new Object();
var chart_activeTimeouts = {};

/**
* Make sure that ajax requests will not be cached
Expand Down Expand Up @@ -82,7 +82,7 @@ function suggestPassword(passwd_form)
var passwd = passwd_form.generated_pw;
passwd.value = '';

for ( i = 0; i < passwordlength; i++ ) {
for (var i = 0; i < passwordlength; i++ ) {
passwd.value += pwchars.charAt( Math.floor( Math.random() * pwchars.length ) );
}
passwd_form.text_pma_pw.value = passwd.value;
Expand Down Expand Up @@ -138,9 +138,9 @@ function PMA_current_version(data)
);
if (Math.floor(latest / 10000) === Math.floor(current / 10000)) {
/* Security update */
klass = 'error';
var klass = 'error';
} else {
klass = 'notice';
var klass = 'notice';
}
$('#maincontainer').after('<div class="' + klass + '">' + message + '</div>');
}
Expand Down Expand Up @@ -676,7 +676,7 @@ var last_shift_clicked_row = -1;
/**
* This array is used to remember mark status of rows in browse mode
*/
var marked_row = new Array;
var marked_row = [];

/**
* marks all rows and selects its first checkbox inside the given element
Expand Down Expand Up @@ -830,7 +830,7 @@ function insertValueQuery()
//IE support
} else if (document.selection) {
myQuery.focus();
sel = document.selection.createRange();
var sel = document.selection.createRange();
sel.text = chaineAj;
document.sqlform.insert.focus();
}
Expand Down Expand Up @@ -873,11 +873,11 @@ function refreshLayout()
var paper = 'A4';
}
if (orientation == 'P') {
posa = 'x';
posb = 'y';
var posa = 'x';
var posb = 'y';
} else {
posa = 'y';
posb = 'x';
var posa = 'y';
var posb = 'x';
}
$elm.css('width', pdfPaperSize(paper, posa) + 'px');
$elm.css('height', pdfPaperSize(paper, posb) + 'px');
Expand Down Expand Up @@ -1356,8 +1356,8 @@ AJAX.registerOnload('functions.js', function() {
var old_text = $inner_sql.html();

var new_content = "<textarea name=\"sql_query_edit\" id=\"sql_query_edit\">" + sql_query + "</textarea>\n";
new_content += "<input type=\"submit\" id=\"sql_query_edit_save\" class=\"button btnSave\" value=\"" + PMA_messages['strGo'] + "\">\n";
new_content += "<input type=\"button\" id=\"sql_query_edit_discard\" class=\"button btnDiscard\" value=\"" + PMA_messages['strCancel'] + "\">\n";
new_content += "<input type=\"submit\" id=\"sql_query_edit_save\" class=\"button btnSave\" value=\"" + PMA_messages['strGo'] + "\"/>\n";
new_content += "<input type=\"button\" id=\"sql_query_edit_discard\" class=\"button btnDiscard\" value=\"" + PMA_messages['strCancel'] + "\"/>\n";
var $editor_area = $('div#inline_editor');
if ($editor_area.length == 0) {
$editor_area = $('<div id="inline_editor_outer"></div>');
Expand All @@ -1377,11 +1377,11 @@ AJAX.registerOnload('functions.js', function() {
var sql_query = $(this).prev().val();
}

$form = $("a.inline_edit_sql").prev('form');
var $form = $("a.inline_edit_sql").prev('form');
var $fake_form = $('<form>', {action: 'import.php', method: 'post'})
.append($form.find("input[name=server], input[name=db], input[name=table], input[name=token]").clone())
.append($('<input>', {type: 'hidden', name: 'show_query', value: 1}))
.append($('<input>', {type: 'hidden', name: 'sql_query', value: sql_query}));
.append($('<input/>', {type: 'hidden', name: 'show_query', value: 1}))
.append($('<input/>', {type: 'hidden', name: 'sql_query', value: sql_query}));
$fake_form.appendTo($('body')).submit();
});

Expand Down Expand Up @@ -1640,8 +1640,7 @@ $(function() {
$('span.ajax_notification a, span.ajax_notification button, span.ajax_notification input')
.live('mouseover', function () {
$(this).parents('span.ajax_notification').tooltip('disable');
});
$('span.ajax_notification a, span.ajax_notification button, span.ajax_notification input')
})
.live('mouseout', function () {
$(this).parents('span.ajax_notification').tooltip('enable');
});
Expand Down Expand Up @@ -2498,7 +2497,7 @@ function PMA_hideShowDefaultValue($default_type)
function PMA_validateDefaultValue($null_checkbox)
{
if (! $null_checkbox.prop('checked')) {
$default = $null_checkbox.closest('tr').find('.default_type');
var $default = $null_checkbox.closest('tr').find('.default_type');
if ($default.val() == 'NULL') {
$default.val('NONE');
}
Expand Down Expand Up @@ -2617,7 +2616,7 @@ AJAX.registerOnload('functions.js', function() {
buttonOptions[PMA_messages['strGo']] = function () {
// When the submit button is clicked,
// put the data back into the original form
var value_array = new Array();
var value_array = [];
$(this).find(".values input").each(function(index, elm) {
var val = elm.value.replace(/\\/g, '\\\\').replace(/'/g, "''");
value_array.push("'" + val + "'");
Expand Down Expand Up @@ -2902,7 +2901,7 @@ AJAX.registerOnload('functions.js', function() {

function PMA_mainMenuResizerCallback() {
// 5 px margin for jumping menu in Chrome
return $('body').width() - 5;
return $(document.body).width() - 5;
}
// This must be fired only once after the inital page load
$(function() {
Expand Down Expand Up @@ -3098,7 +3097,7 @@ AJAX.registerOnload('functions.js', function() {
// for all td of the same vertical row, toggle hover
$('.vpointer').filter('.row_' + row_num).toggleClass('hover');
}
);
);


/**
Expand Down Expand Up @@ -3507,7 +3506,7 @@ function PMA_tooltip($elements, item, myContent, additionalOptions)
track: true,
show: false,
hide: false
}
};

$elements.tooltip($.extend(true, defaultOptions, additionalOptions));
}
Expand Down
4 changes: 2 additions & 2 deletions js/get_image.js.php
Expand Up @@ -52,7 +52,7 @@
*/
function PMA_getImage(image, alternate, attributes) {
var in_array = function (needle, haystack) {
for (i in haystack) {
for (var i in haystack) {
if (haystack[i] == needle) {
return true;
}
Expand Down Expand Up @@ -134,5 +134,5 @@ function PMA_getImage(image, alternate, attributes) {
}

return retval;
};
}
//

0 comments on commit fc51a91

Please sign in to comment.