diff --git a/core/misc/machine-name.js b/core/misc/machine-name.js index 3a9fa0394d16b33e5d8ed3debd438e6224f76192..07077142ec0abeace0313f004a363202c6f492cc 100644 --- a/core/misc/machine-name.js +++ b/core/misc/machine-name.js @@ -29,7 +29,6 @@ attach: function (context, settings) { var self = this; var $context = $(context); - var source_id, options, machine, eventData; function clickEditHandler(e) { var data = e.data; @@ -42,15 +41,15 @@ function machineNameHandler(e) { var data = e.data; - var settings = data.options; + var options = data.options; var baseValue = $(e.target).val(); - var rx = new RegExp(settings.replace_pattern, 'g'); - var expected = baseValue.toLowerCase().replace(rx, settings.replace).substr(0, settings.maxlength); + var rx = new RegExp(options.replace_pattern, 'g'); + var expected = baseValue.toLowerCase().replace(rx, options.replace).substr(0, options.maxlength); if (baseValue.toLowerCase() !== expected) { - self.transliterate(baseValue, settings).done(function (machine) { - self.showMachineName(machine.substr(0, settings.maxlength), data); + self.transliterate(baseValue, options).done(function (machine) { + self.showMachineName(machine.substr(0, options.maxlength), data); }); } else { @@ -58,70 +57,69 @@ } } - for (source_id in settings.machineName) { - if (settings.machineName.hasOwnProperty(source_id)) { - options = settings.machineName[source_id]; + Object.keys(settings.machineName).forEach(function (source_id) { + var machine, eventData; + var options = settings.machineName[source_id]; - var $source = $context.find(source_id).addClass('machine-name-source').once('machine-name'); - var $target = $context.find(options.target).addClass('machine-name-target'); - var $suffix = $context.find(options.suffix); - var $wrapper = $target.closest('.form-item'); - // All elements have to exist. - if (!$source.length || !$target.length || !$suffix.length || !$wrapper.length) { - return; - } - // Skip processing upon a form validation error on the machine name. - if ($target.hasClass('error')) { - return; - } - // Figure out the maximum length for the machine name. - options.maxlength = $target.attr('maxlength'); - // Hide the form item container of the machine name form element. - $wrapper.hide(); - // Determine the initial machine name value. Unless the machine name form - // element is disabled or not empty, the initial default value is based on - // the human-readable form element value. - if ($target.is(':disabled') || $target.val() !== '') { - machine = $target.val(); - } - else { - machine = self.transliterate($source.val(), options); - } - // Append the machine name preview to the source field. - var $preview = $('<span class="machine-name-value">' + options.field_prefix + Drupal.checkPlain(machine) + options.field_suffix + '</span>'); - $suffix.empty(); - if (options.label) { - $suffix.append(' ').append('<span class="machine-name-label">' + options.label + ':</span>'); - } - $suffix.append(' ').append($preview); + var $source = $context.find(source_id).addClass('machine-name-source').once('machine-name'); + var $target = $context.find(options.target).addClass('machine-name-target'); + var $suffix = $context.find(options.suffix); + var $wrapper = $target.closest('.form-item'); + // All elements have to exist. + if (!$source.length || !$target.length || !$suffix.length || !$wrapper.length) { + return; + } + // Skip processing upon a form validation error on the machine name. + if ($target.hasClass('error')) { + return; + } + // Figure out the maximum length for the machine name. + options.maxlength = $target.attr('maxlength'); + // Hide the form item container of the machine name form element. + $wrapper.hide(); + // Determine the initial machine name value. Unless the machine name form + // element is disabled or not empty, the initial default value is based on + // the human-readable form element value. + if ($target.is(':disabled') || $target.val() !== '') { + machine = $target.val(); + } + else { + machine = self.transliterate($source.val(), options); + } + // Append the machine name preview to the source field. + var $preview = $('<span class="machine-name-value">' + options.field_prefix + Drupal.checkPlain(machine) + options.field_suffix + '</span>'); + $suffix.empty(); + if (options.label) { + $suffix.append(' ').append('<span class="machine-name-label">' + options.label + ':</span>'); + } + $suffix.append(' ').append($preview); - // If the machine name cannot be edited, stop further processing. - if ($target.is(':disabled')) { - return; - } + // If the machine name cannot be edited, stop further processing. + if ($target.is(':disabled')) { + return; + } - eventData = { - $source: $source, - $target: $target, - $suffix: $suffix, - $wrapper: $wrapper, - $preview: $preview, - options: options - }; - // If it is editable, append an edit link. - var $link = $('<span class="admin-link"><button type="button" class="link">' + Drupal.t('Edit') + '</button></span>').on('click', eventData, clickEditHandler); - $suffix.append(' ').append($link); + eventData = { + $source: $source, + $target: $target, + $suffix: $suffix, + $wrapper: $wrapper, + $preview: $preview, + options: options + }; + // If it is editable, append an edit link. + var $link = $('<span class="admin-link"><button type="button" class="link">' + Drupal.t('Edit') + '</button></span>').on('click', eventData, clickEditHandler); + $suffix.append(' ').append($link); - // Preview the machine name in realtime when the human-readable name - // changes, but only if there is no machine name yet; i.e., only upon - // initial creation, not when editing. - if ($target.val() === '') { - $source.on('keyup.machineName change.machineName input.machineName', eventData, machineNameHandler) - // Initialize machine name preview. - .trigger('keyup'); - } + // Preview the machine name in realtime when the human-readable name + // changes, but only if there is no machine name yet; i.e., only upon + // initial creation, not when editing. + if ($target.val() === '') { + $source.on('keyup.machineName change.machineName input.machineName', eventData, machineNameHandler) + // Initialize machine name preview. + .trigger('keyup'); } - } + }); }, showMachineName: function (machine, data) { diff --git a/core/modules/block/js/block.admin.js b/core/modules/block/js/block.admin.js index 44a4a7443737197b69edcdf1f56c093de8ab7e86..422a83ac6ed59e33c2e2bd1b9b732f44a33ca2cc 100644 --- a/core/modules/block/js/block.admin.js +++ b/core/modules/block/js/block.admin.js @@ -19,8 +19,8 @@ * Hides the <details> element for a category if it has no visible blocks. */ function hideCategoryDetails(index, element) { - var $details = $(element); - $details.toggle($details.find('li:visible').length > 0); + var $catDetails = $(element); + $catDetails.toggle($catDetails.find('li:visible').length > 0); } /** diff --git a/core/modules/ckeditor/js/ckeditor.admin.js b/core/modules/ckeditor/js/ckeditor.admin.js index f5163b8c2c42a71a656aa4a2509e8fc394d2353b..24de2e6736f596c1c9256bce201012033cd8b1c2 100644 --- a/core/modules/ckeditor/js/ckeditor.admin.js +++ b/core/modules/ckeditor/js/ckeditor.admin.js @@ -1178,7 +1178,6 @@ if ($group.hasClass('placeholder')) { if (view.isProcessing) { - event.stopPropagation(); return; } view.isProcessing = true; diff --git a/core/modules/ckeditor/js/plugins/drupalimage/plugin.js b/core/modules/ckeditor/js/plugins/drupalimage/plugin.js index ffad8c4132788308a8489a6b0a8777efdbbc7f0c..304a8b39ea0183b27d549a592b181f070318182b 100644 --- a/core/modules/ckeditor/js/plugins/drupalimage/plugin.js +++ b/core/modules/ckeditor/js/plugins/drupalimage/plugin.js @@ -71,7 +71,7 @@ 'alt': 'alt', 'width': 'width', 'height': 'height', - 'data-editor-file-uuid': 'data-editor-file-uuid', + 'data-editor-file-uuid': 'data-editor-file-uuid' }; // Protected; transforms widget's data object to the format used by the diff --git a/core/modules/ckeditor/js/plugins/drupalimagecaption/plugin.js b/core/modules/ckeditor/js/plugins/drupalimagecaption/plugin.js index 73fd4dafa85a3ea3a23c89610572ed25a39094a1..9999592fdd560371827eb3ad8b4be5f52dddeded 100644 --- a/core/modules/ckeditor/js/plugins/drupalimagecaption/plugin.js +++ b/core/modules/ckeditor/js/plugins/drupalimagecaption/plugin.js @@ -162,7 +162,7 @@ CKEDITOR.tools.extend(widgetDefinition._mapDataToDialog, { 'align': 'data-align', 'data-caption': 'data-caption', - 'hasCaption': 'hasCaption', + 'hasCaption': 'hasCaption' }); // Override Drupal dialog save callback. diff --git a/core/modules/contextual/js/contextual.toolbar.js b/core/modules/contextual/js/contextual.toolbar.js index 68960d936af64367da037d9f33ff53b488b34785..464189059466a7eed326ba4c1d1119068759da34 100644 --- a/core/modules/contextual/js/contextual.toolbar.js +++ b/core/modules/contextual/js/contextual.toolbar.js @@ -31,7 +31,7 @@ // @see Drupal.contextualToolbar.VisualView.persist() isViewing: localStorage.getItem('Drupal.contextualToolbar.isViewing') !== 'false' }, { - contextualCollection: Drupal.contextual.collection, + contextualCollection: Drupal.contextual.collection }); var viewOptions = { @@ -56,7 +56,7 @@ Drupal.contextualToolbar = { // The Drupal.contextualToolbar.Model instance. - model: null, + model: null }; })(jQuery, Drupal, Backbone); diff --git a/core/modules/quickedit/js/views/AppView.js b/core/modules/quickedit/js/views/AppView.js index c8ed95bb22fd1f108d0403d3799d25d402f0fea1..b9730005a2f0092be44725a3486341b1f99530e0 100644 --- a/core/modules/quickedit/js/views/AppView.js +++ b/core/modules/quickedit/js/views/AppView.js @@ -207,11 +207,9 @@ this.model.set('activeField', fieldModel); accept = false; } - else { - // Do not reject: the field is either in the 'candidate' or - // 'highlighted' state and we allow it to enter the 'activating' - // state! - } + // Do not reject: the field is either in the 'candidate' or + // 'highlighted' state and we allow it to enter the 'activating' + // state! } } // Reject going from activating/active to candidate because of a diff --git a/core/modules/system/system.modules.js b/core/modules/system/system.modules.js index d65a7101d8bdd6f949089c764fe01797a5265953..0d465f5bcdbbb7f4842c091057523c20919c72b2 100644 --- a/core/modules/system/system.modules.js +++ b/core/modules/system/system.modules.js @@ -19,9 +19,9 @@ var $rowsAndDetails, $rows, $details; var searching = false; function hidePackageDetails(index, element) { - var $details = $(element); - var $visibleRows = $details.find('table:not(.sticky-header)').find('tbody tr:visible'); - $details.toggle($visibleRows.length > 0); + var $packDetails = $(element); + var $visibleRows = $packDetails.find('table:not(.sticky-header)').find('tbody tr:visible'); + $packDetails.toggle($visibleRows.length > 0); } function filterModuleList(e) { diff --git a/core/modules/views_ui/js/views-admin.js b/core/modules/views_ui/js/views-admin.js index 1d8d77db23a7b17a5c603f1b3e69dccc91b1198a..b4a1c914dcc128c394231a5818a942cdcb409070 100644 --- a/core/modules/views_ui/js/views-admin.js +++ b/core/modules/views_ui/js/views-admin.js @@ -524,7 +524,7 @@ /** * Dynamically click the button that adds a new filter group. */ - clickAddGroupButton: function () { + clickAddGroupButton: function (event) { // Due to conflicts between Drupal core's AJAX system and the Views AJAX // system, the only way to get this to work seems to be to trigger both the // mousedown and submit events.