diff --git a/core/misc/autocomplete.js b/core/misc/autocomplete.js index d272c6c..094d223 100644 --- a/core/misc/autocomplete.js +++ b/core/misc/autocomplete.js @@ -222,14 +222,17 @@ Drupal.jsAC.prototype.found = function (matches) { // Prepare matches. var ul = $(''); - var ac = this; + var ac = this, + mouseDown = function () { ac.select(this); }, + mouseOver = function () { ac.highlight(this); }, + mouseOut = function () { ac.unhighlight(this); }; for (var key in matches) { if (matches.hasOwnProperty(key)) { $('
  • ') .html($('
    ').html(matches[key])) - .mousedown(function () { ac.select(this); }) - .mouseover(function () { ac.highlight(this); }) - .mouseout(function () { ac.unhighlight(this); }) + .mousedown(mouseDown) + .mouseover(mouseOver) + .mouseout(mouseOut) .data('autocompleteValue', key) .appendTo(ul); } @@ -316,7 +319,9 @@ Drupal.ACDB.prototype.search = function (searchString) { } }, error: function (xmlhttp) { - alert(Drupal.ajaxError(xmlhttp, db.uri)); + if (window.console) { + window.console.log(Drupal.ajaxError(xmlhttp, db.uri)); + } } }); }, this.delay); diff --git a/core/misc/collapse.js b/core/misc/collapse.js index 77eb9ff..62a7c0e 100644 --- a/core/misc/collapse.js +++ b/core/misc/collapse.js @@ -29,7 +29,7 @@ var isDetailsSupported = (function (doc) { root.appendChild(el); diff = el.offsetHeight; el.open = true; - diff = diff != el.offsetHeight; + diff = diff !== el.offsetHeight; root.removeChild(el); if (fake) { root.parentNode.removeChild(root); diff --git a/core/modules/contextual/contextual.js b/core/modules/contextual/contextual.js index aa80b31..10b8531 100644 --- a/core/modules/contextual/contextual.js +++ b/core/modules/contextual/contextual.js @@ -103,7 +103,8 @@ Drupal.contextual.prototype.detachHighlightBehaviors = function () { Drupal.contextual.prototype.highlightRegion = function(event) { // Set up a timeout to delay the dismissal of the region highlight state. if (!event.data.highlight && this.timer === undefined) { - return this.timer = window.setTimeout($.proxy($.fn.trigger, $(event.target), 'mouseleave.contextual'), 100); + this.timer = window.setTimeout($.proxy($.fn.trigger, $(event.target), 'mouseleave.contextual'), 100); + return this.timer; } // Clear the timeout to prevent an infinite loop of mouseleave being // triggered. diff --git a/core/modules/edit/js/backbone.drupalform.js b/core/modules/edit/js/backbone.drupalform.js index 9bd2c89..61273f8 100644 --- a/core/modules/edit/js/backbone.drupalform.js +++ b/core/modules/edit/js/backbone.drupalform.js @@ -93,7 +93,7 @@ Backbone.syncDirect = function(method, model, options) { // Fill in the value in any that isn't hidden or a submit button. $form.find(':input[type!="hidden"][type!="submit"]:not(select)') // Don't mess with the node summary. - .not('[name$="\[summary\]"]').val(value); + .not('[name$="\\[summary\\]"]').val(value); // Submit the form. $form.find('.edit-form-submit').trigger('click.edit'); }; diff --git a/core/modules/edit/js/views/toolbar-view.js b/core/modules/edit/js/views/toolbar-view.js index 2075352..cf3783b 100644 --- a/core/modules/edit/js/views/toolbar-view.js +++ b/core/modules/edit/js/views/toolbar-view.js @@ -221,7 +221,7 @@ Drupal.edit.views.ToolbarView = Backbone.View.extend({ */ onMouseLeave: function(event) { var el = this.editor.element[0]; - if (event.relatedTarget != el && !$.contains(el, event.relatedTarget)) { + if (event.relatedTarget !== el && !$.contains(el, event.relatedTarget)) { this.editor.element.trigger('mouseleave.edit'); } event.stopPropagation(); diff --git a/core/modules/editor/js/editor.js b/core/modules/editor/js/editor.js index 32da290..49d0225 100644 --- a/core/modules/editor/js/editor.js +++ b/core/modules/editor/js/editor.js @@ -69,7 +69,7 @@ Drupal.behaviors.editor = { var editors; // The 'serialize' trigger indicates that we should simply update the // underlying element with the new text, without destroying the editor. - if (trigger == 'serialize') { + if (trigger === 'serialize') { // Removing the editor-processed class guarantees that the editor will // be reattached. Only do this if we're planning to destroy the editor. editors = $(context).find('.editor-processed'); diff --git a/core/modules/overlay/overlay-parent.js b/core/modules/overlay/overlay-parent.js index caf9336..e6e816f 100644 --- a/core/modules/overlay/overlay-parent.js +++ b/core/modules/overlay/overlay-parent.js @@ -883,7 +883,7 @@ Drupal.overlay.getDisplacement = function (region) { var displacement = 0; var lastDisplaced = $('[data-offset-' + region + ']'); if (lastDisplaced.length) { - displacement = parseInt(lastDisplaced.attr('data-offset-' + region)); + displacement = parseInt(lastDisplaced.attr('data-offset-' + region), 10); } return displacement; }; diff --git a/core/modules/toolbar/js/toolbar.js b/core/modules/toolbar/js/toolbar.js index 45e91ad..564a9c5 100644 --- a/core/modules/toolbar/js/toolbar.js +++ b/core/modules/toolbar/js/toolbar.js @@ -56,7 +56,9 @@ Drupal.behaviors.toolbar = { // when the DOM elements are needed. if (Drupal.toolbar.subtrees) { for (var id in Drupal.toolbar.subtrees) { - $('#toolbar-link-' + id).after(Drupal.toolbar.subtrees[id]); + if(typeof id === 'string' || typeof id === 'number') { + $('#toolbar-link-' + id).after(Drupal.toolbar.subtrees[id]); + } } } // Append a messages element for appending interaction updates for screen diff --git a/core/modules/translation_entity/translation_entity.admin.js b/core/modules/translation_entity/translation_entity.admin.js index 7f01944..bd15364 100644 --- a/core/modules/translation_entity/translation_entity.admin.js +++ b/core/modules/translation_entity/translation_entity.admin.js @@ -39,7 +39,7 @@ Drupal.behaviors.translationEntityDependentOptions = { if(!$element) { $fields.each(function() { - if($(this).val() == $column) { + if($(this).val() === $column) { $element = $(this); return false; } diff --git a/core/modules/views/views_ui/js/ajax.js b/core/modules/views/views_ui/js/ajax.js index 8595dc8..ef45e24 100644 --- a/core/modules/views/views_ui/js/ajax.js +++ b/core/modules/views/views_ui/js/ajax.js @@ -195,7 +195,7 @@ if (Drupal.viewsUi.resizeModal) { // If the modal is already at the max height, don't bother with // this since the only reason to do it is to grow the modal. - if ($('.views-ui-dialog').height() < parseInt($(window).height() * .8)) { + if ($('.views-ui-dialog').height() < parseInt($(window).height() * 0.8, 10)) { Drupal.viewsUi.resizeModal('', true); } } diff --git a/core/modules/views/views_ui/js/views-admin.js b/core/modules/views/views_ui/js/views-admin.js index a8fc481..ff38eb4 100644 --- a/core/modules/views/views_ui/js/views-admin.js +++ b/core/modules/views/views_ui/js/views-admin.js @@ -1015,8 +1015,8 @@ Drupal.viewsUi.resizeModal = function (e, no_shrink) { return; } - var maxWidth = parseInt($(window).width() * .85); // 70% of window - var minWidth = parseInt($(window).width() * .6); // 70% of window + var maxWidth = parseInt($(window).width() * 0.85, 10); // 70% of window + var minWidth = parseInt($(window).width() * 0.6, 10); // 70% of window // Set the modal to the minwidth so that our width calculation of // children works. @@ -1024,7 +1024,7 @@ Drupal.viewsUi.resizeModal = function (e, no_shrink) { var width = minWidth; // Don't let the window get more than 80% of the display high. - var maxHeight = parseInt($(window).height() * .8); + var maxHeight = parseInt($(window).height() * 0.8, 10); var minHeight = 200; if (no_shrink) { minHeight = $modal.height(); @@ -1039,8 +1039,8 @@ Drupal.viewsUi.resizeModal = function (e, no_shrink) { // Calculate the height of the 'scroll' region. var scrollHeight = 0; - scrollHeight += parseInt($scroll.css('padding-top')); - scrollHeight += parseInt($scroll.css('padding-bottom')); + scrollHeight += parseInt($scroll.css('padding-top'), 10); + scrollHeight += parseInt($scroll.css('padding-bottom'), 10); $scroll.children().each(function() { var w = $(this).innerWidth(); @@ -1054,8 +1054,8 @@ Drupal.viewsUi.resizeModal = function (e, no_shrink) { // will be. var difference = 0; - difference += parseInt($scroll.css('padding-top')); - difference += parseInt($scroll.css('padding-bottom')); + difference += parseInt($scroll.css('padding-top'), 10); + difference += parseInt($scroll.css('padding-bottom'), 10); difference += $('.views-override').outerHeight(true); difference += $('.views-messages').outerHeight(true); difference += $('#views-ajax-title').outerHeight(true); @@ -1100,7 +1100,7 @@ Drupal.viewsUi.resizeModal = function (e, no_shrink) { jQuery(function() { - "use strict" + "use strict"; jQuery(window).bind('resize', Drupal.viewsUi.resizeModal); jQuery(window).bind('scroll', Drupal.viewsUi.resizeModal);