summaryrefslogtreecommitdiffstatshomepage
path: root/core
diff options
context:
space:
mode:
authorAlex Pott <alex.a.pott@googlemail.com>2015-04-19 17:30:43 +0200
committerAlex Pott <alex.a.pott@googlemail.com>2015-04-19 17:30:43 +0200
commit49a1b846ec4b8664cadb52afcc15aadc9e295050 (patch)
treeeef94487c1364f108cce77a37b7b3b9b2f79816a /core
parent6cd48a6d5d2295729a1f237bf297e0bb83926771 (diff)
downloaddrupal-49a1b846ec4b8664cadb52afcc15aadc9e295050.tar.gz
drupal-49a1b846ec4b8664cadb52afcc15aadc9e295050.zip
Issue #2461531 by nod_, lauriii, pguillard: ESlint 0.18.0 compatibility and new rule
Diffstat (limited to 'core')
-rw-r--r--core/misc/active-link.js6
-rw-r--r--core/misc/ajax.js20
-rw-r--r--core/misc/announce.js3
-rw-r--r--core/misc/autocomplete.js7
-rw-r--r--core/misc/debounce.js3
-rw-r--r--core/misc/dialog/dialog.jquery-ui.js5
-rw-r--r--core/misc/dialog/dialog.position.js4
-rw-r--r--core/misc/displace.js3
-rw-r--r--core/misc/dropbutton/dropbutton.js3
-rw-r--r--core/misc/drupal.js19
-rw-r--r--core/misc/machine-name.js3
-rw-r--r--core/misc/states.js12
-rw-r--r--core/misc/tabbingmanager.js9
-rw-r--r--core/misc/tabledrag.js13
-rw-r--r--core/misc/tableheader.js9
-rw-r--r--core/misc/tableresponsive.js3
-rw-r--r--core/misc/tableselect.js7
-rw-r--r--core/modules/block/js/block.admin.js3
-rw-r--r--core/modules/block/js/block.js3
-rw-r--r--core/modules/ckeditor/js/plugins/drupalimage/plugin.js4
-rw-r--r--core/modules/ckeditor/js/plugins/drupallink/plugin.js3
-rw-r--r--core/modules/ckeditor/js/views/ControllerView.js9
-rw-r--r--core/modules/ckeditor/js/views/KeyboardView.js3
-rw-r--r--core/modules/color/color.js7
-rw-r--r--core/modules/color/preview.js6
-rw-r--r--core/modules/content_translation/content_translation.admin.js3
-rw-r--r--core/modules/editor/js/editor.admin.js31
-rw-r--r--core/modules/filter/filter.filter_html.admin.js3
-rw-r--r--core/modules/locale/locale.admin.js7
-rw-r--r--core/modules/node/node.js4
-rw-r--r--core/modules/quickedit/js/views/AppView.js3
-rw-r--r--core/modules/quickedit/js/views/EntityToolbarView.js4
-rw-r--r--core/modules/quickedit/js/views/FieldDecorationView.js14
-rw-r--r--core/modules/system/system.modules.js4
-rw-r--r--core/modules/user/user.js6
-rw-r--r--core/modules/user/user.permissions.js6
-rw-r--r--core/modules/views_ui/js/views-admin.js29
37 files changed, 178 insertions, 103 deletions
diff --git a/core/misc/active-link.js b/core/misc/active-link.js
index c33c0ce6f68..3a2f818b009 100644
--- a/core/misc/active-link.js
+++ b/core/misc/active-link.js
@@ -46,14 +46,16 @@
// Query the DOM.
var activeLinks = context.querySelectorAll(selectors.join(','));
- for (var i = 0, il = activeLinks.length; i < il; i += 1) {
+ var il = activeLinks.length;
+ for (var i = 0; i < il; i++) {
activeLinks[i].classList.add('is-active');
}
},
detach: function (context, settings, trigger) {
if (trigger === 'unload') {
var activeLinks = context.querySelectorAll('[data-drupal-link-system-path].is-active');
- for (var i = 0, il = activeLinks.length; i < il; i += 1) {
+ var il = activeLinks.length;
+ for (var i = 0; i < il; i++) {
activeLinks[i].classList.remove('is-active');
}
}
diff --git a/core/misc/ajax.js b/core/misc/ajax.js
index 91e8e1c5ccf..e2aeab15caf 100644
--- a/core/misc/ajax.js
+++ b/core/misc/ajax.js
@@ -84,7 +84,11 @@
*/
Drupal.AjaxError = function (xmlhttp, uri) {
- var statusCode, statusText, pathText, responseText, readyStateText;
+ var statusCode;
+ var statusText;
+ var pathText;
+ var responseText;
+ var readyStateText;
if (xmlhttp.status) {
statusCode = "\n" + Drupal.t("An AJAX HTTP error occurred.") + "\n" + Drupal.t("HTTP Result Code: !status", {'!status': xmlhttp.status});
}
@@ -100,7 +104,9 @@
try {
statusText = "\n" + Drupal.t("StatusText: !statusText", {'!statusText': $.trim(xmlhttp.statusText)});
}
- catch (e) {}
+ catch (e) {
+ // empty
+ }
responseText = '';
// Again, we don't have a way to know for sure whether accessing
@@ -108,7 +114,9 @@
try {
responseText = "\n" + Drupal.t("ResponseText: !responseText", {'!responseText': $.trim(xmlhttp.responseText)});
}
- catch (e) {}
+ catch (e) {
+ // empty
+ }
// Make the responseText more readable by stripping HTML tags and newlines.
responseText = responseText.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi, "");
@@ -375,7 +383,8 @@
// @see \Drupal\Component\Utility\Html::getUniqueId()
var ids = document.querySelectorAll('[id]');
var ajaxHtmlIds = [];
- for (var i = 0, il = ids.length; i < il; i++) {
+ var il = ids.length;
+ for (var i = 0; i < il; i++) {
ajaxHtmlIds.push(ids[i].id);
}
// Join IDs to minimize request size.
@@ -727,7 +736,8 @@
// Add the styles in the normal way.
$('head').prepend(response.data);
// Add imports in the styles using the addImport method if available.
- var match, importMatch = /^@import url\("(.*)"\);$/igm;
+ var match;
+ var importMatch = /^@import url\("(.*)"\);$/igm;
if (document.styleSheets[0].addImport && importMatch.test(response.data)) {
importMatch.lastIndex = 0;
do {
diff --git a/core/misc/announce.js b/core/misc/announce.js
index 00ce14b1188..9aafbbcbce4 100644
--- a/core/misc/announce.js
+++ b/core/misc/announce.js
@@ -49,7 +49,8 @@
// Create an array of announcement strings to be joined and appended to the
// aria live region.
- for (var i = 0, il = announcements.length; i < il; i++) {
+ var il = announcements.length;
+ for (var i = 0; i < il; i++) {
announcement = announcements.pop();
text.unshift(announcement.text);
// If any of the announcements has a priority of assertive then the group
diff --git a/core/misc/autocomplete.js b/core/misc/autocomplete.js
index 639f9dc18e5..92bb86785af 100644
--- a/core/misc/autocomplete.js
+++ b/core/misc/autocomplete.js
@@ -17,9 +17,9 @@
var quote = false;
var current = '';
var valueLength = value.length;
- var i, character;
+ var character;
- for (i = 0; i < valueLength; i++) {
+ for (var i = 0; i < valueLength; i++) {
character = value.charAt(i);
if (character === '"') {
current += character;
@@ -90,7 +90,8 @@
*/
function showSuggestions(suggestions) {
var tagged = autocomplete.splitValues(request.term);
- for (var i = 0, il = tagged.length; i < il; i++) {
+ var il = tagged.length;
+ for (var i = 0; i < il; i++) {
var index = suggestions.indexOf(tagged[i]);
if (index >= 0) {
suggestions.splice(index, 1);
diff --git a/core/misc/debounce.js b/core/misc/debounce.js
index 97312578bac..45a5b87358a 100644
--- a/core/misc/debounce.js
+++ b/core/misc/debounce.js
@@ -23,7 +23,8 @@ Drupal.debounce = function (func, wait, immediate) {
"use strict";
- var timeout, result;
+ var timeout;
+ var result;
return function () {
var context = this;
var args = arguments;
diff --git a/core/misc/dialog/dialog.jquery-ui.js b/core/misc/dialog/dialog.jquery-ui.js
index 59f9073008b..cd6e863fec5 100644
--- a/core/misc/dialog/dialog.jquery-ui.js
+++ b/core/misc/dialog/dialog.jquery-ui.js
@@ -15,8 +15,9 @@
var opts = this.options;
var primaryIndex;
var $buttons;
- var index, il;
- for (index = 0, il = opts.buttons.length; index < il; index += 1) {
+ var index;
+ var il = opts.buttons.length;
+ for (index = 0; index < il; index++) {
if (opts.buttons[index].primary && opts.buttons[index].primary === true) {
primaryIndex = index;
delete opts.buttons[index].primary;
diff --git a/core/misc/dialog/dialog.position.js b/core/misc/dialog/dialog.position.js
index ae1ddf59e47..3e08574a694 100644
--- a/core/misc/dialog/dialog.position.js
+++ b/core/misc/dialog/dialog.position.js
@@ -17,7 +17,9 @@
var positionOptions = ['width', 'height', 'minWidth', 'minHeight', 'maxHeight', 'maxWidth', 'position'];
var adjustedOptions = {};
var windowHeight = $(window).height();
- var option, optionValue, adjustedValue;
+ var option;
+ var optionValue;
+ var adjustedValue;
for (var n = 0; n < positionOptions.length; n++) {
option = positionOptions[n];
optionValue = event.data.settings[option];
diff --git a/core/misc/displace.js b/core/misc/displace.js
index 6dca569b3bb..a52a82650ed 100644
--- a/core/misc/displace.js
+++ b/core/misc/displace.js
@@ -85,7 +85,8 @@
function calculateOffset(edge) {
var edgeOffset = 0;
var displacingElements = document.querySelectorAll('[data-offset-' + edge + ']');
- for (var i = 0, n = displacingElements.length; i < n; i++) {
+ var n = displacingElements.length;
+ for (var i = 0; i < n; i++) {
var el = displacingElements[i];
// If the element is not visible, do consider its dimensions.
if (el.style.display === 'none') {
diff --git a/core/misc/dropbutton/dropbutton.js b/core/misc/dropbutton/dropbutton.js
index ebad07af8c0..eebf354ef9d 100644
--- a/core/misc/dropbutton/dropbutton.js
+++ b/core/misc/dropbutton/dropbutton.js
@@ -15,7 +15,8 @@
$body.on('click', '.dropbutton-toggle', dropbuttonClickHandler);
}
// Initialize all buttons.
- for (var i = 0, il = $dropbuttons.length; i < il; i++) {
+ var il = $dropbuttons.length;
+ for (var i = 0; i < il; i++) {
DropButton.dropbuttons.push(new DropButton($dropbuttons[i], settings.dropbutton));
}
}
diff --git a/core/misc/drupal.js b/core/misc/drupal.js
index b1b4125d4b3..9e9d24e0438 100644
--- a/core/misc/drupal.js
+++ b/core/misc/drupal.js
@@ -32,7 +32,8 @@ if (window.jQuery) {
// Makes the list of errors readable.
var messageList = [];
messageList.push(this.event);
- for (var i = 0, il = this.list.length; i < il; i++) {
+ var il = this.list.length;
+ for (var i = 0; i < il; i++) {
messageList.push(this.list[i].behavior + ': ' + this.list[i].error.message);
}
this.message = messageList.join(' ; ');
@@ -81,9 +82,10 @@ if (window.jQuery) {
Drupal.attachBehaviors = function (context, settings) {
context = context || document;
settings = settings || drupalSettings;
- var i, errors = [], behaviors = Drupal.behaviors;
+ var errors = [];
+ var behaviors = Drupal.behaviors;
// Execute all of them.
- for (i in behaviors) {
+ for (var i in behaviors) {
if (behaviors.hasOwnProperty(i) && typeof behaviors[i].attach === 'function') {
// Don't stop the execution of behaviors in case of an error.
try {
@@ -147,9 +149,10 @@ if (window.jQuery) {
context = context || document;
settings = settings || drupalSettings;
trigger = trigger || 'unload';
- var i, errors = [], behaviors = Drupal.behaviors;
+ var errors = [];
+ var behaviors = Drupal.behaviors;
// Execute all of them.
- for (i in behaviors) {
+ for (var i in behaviors) {
if (behaviors.hasOwnProperty(i) && typeof behaviors[i].detach === 'function') {
// Don't stop the execution of behaviors in case of an error.
try {
@@ -369,9 +372,9 @@ if (window.jQuery) {
args = args || {};
args['@count'] = count;
- var pluralDelimiter = drupalSettings.pluralDelimiter,
- translations = Drupal.t(singular + pluralDelimiter + plural, args, options).split(pluralDelimiter),
- index = 0;
+ var pluralDelimiter = drupalSettings.pluralDelimiter;
+ var translations = Drupal.t(singular + pluralDelimiter + plural, args, options).split(pluralDelimiter);
+ var index = 0;
// Determine the index of the plural form.
if (typeof drupalTranslations !== 'undefined' && drupalTranslations.pluralFormula) {
diff --git a/core/misc/machine-name.js b/core/misc/machine-name.js
index b9e87a6d1b8..d0e4d127b8c 100644
--- a/core/misc/machine-name.js
+++ b/core/misc/machine-name.js
@@ -75,7 +75,8 @@
}
Object.keys(settings.machineName).forEach(function (source_id) {
- var machine, eventData;
+ var machine;
+ var eventData;
var options = settings.machineName[source_id];
var $source = $context.find(source_id).addClass('machine-name-source').once('machine-name');
diff --git a/core/misc/states.js b/core/misc/states.js
index 680e86e234c..c68d1b59793 100644
--- a/core/misc/states.js
+++ b/core/misc/states.js
@@ -22,8 +22,10 @@
Drupal.behaviors.states = {
attach: function (context, settings) {
var $states = $(context).find('[data-drupal-states]');
- var config, state;
- for (var i = 0, il = $states.length; i < il; i += 1) {
+ var config;
+ var state;
+ var il = $states.length;
+ for (var i = 0; i < il; i++) {
config = JSON.parse($states[i].getAttribute('data-drupal-states'));
for (state in config) {
if (config.hasOwnProperty(state)) {
@@ -98,7 +100,8 @@
* dependee's compliance status.
*/
initializeDependee: function (selector, dependeeStates) {
- var state, self = this;
+ var state;
+ var self = this;
function stateEventHandler(e) {
self.update(e.data.selector, e.data.state, e.value);
@@ -212,7 +215,8 @@
if ($.isArray(constraints)) {
// This constraint is an array (OR or XOR).
var hasXor = $.inArray('xor', constraints) === -1;
- for (var i = 0, len = constraints.length; i < len; i++) {
+ var len = constraints.length;
+ for (var i = 0; i < len; i++) {
if (constraints[i] !== 'xor') {
var constraint = this.checkConstraints(constraints[i], selector, i);
// Return if this is OR and we have a satisfied constraint or if this
diff --git a/core/misc/tabbingmanager.js b/core/misc/tabbingmanager.js
index b80f2a3c8f9..dc21c0263bf 100644
--- a/core/misc/tabbingmanager.js
+++ b/core/misc/tabbingmanager.js
@@ -39,7 +39,8 @@
// Deactivate all tabbingContexts to prepare for the new constraint. A
// tabbingContext instance will only be reactivated if the stack is unwound
// to it in the _unwindStack() method.
- for (var i = 0, il = this.stack.length; i < il; i++) {
+ var il = this.stack.length;
+ for (var i = 0; i < il; i++) {
this.stack[i].deactivate();
}
@@ -110,7 +111,8 @@
// Set the disabled set on the tabbingContext.
tabbingContext.$disabledElements = $disabledSet;
// Record the tabindex for each element, so we can restore it later.
- for (var i = 0, il = $disabledSet.length; i < il; i++) {
+ var il = $disabledSet.length;
+ for (var i = 0; i < il; i++) {
this.recordTabindex($disabledSet.eq(i), level);
}
// Make all tabbable elements outside of the active tabbing set unreachable.
@@ -142,7 +144,8 @@
deactivate: function (tabbingContext) {
var $set = tabbingContext.$disabledElements;
var level = tabbingContext.level;
- for (var i = 0, il = $set.length; i < il; i++) {
+ var il = $set.length;
+ for (var i = 0; i < il; i++) {
this.restoreTabindex($set.eq(i), level);
}
},
diff --git a/core/misc/tabledrag.js b/core/misc/tabledrag.js
index 1cc75151abf..61f8e29e80d 100644
--- a/core/misc/tabledrag.js
+++ b/core/misc/tabledrag.js
@@ -153,7 +153,9 @@
*/
Drupal.tableDrag.prototype.initColumns = function () {
var $table = this.$table;
- var hidden, cell, columnIndex;
+ var hidden;
+ var cell;
+ var columnIndex;
for (var group in this.tableSettings) {
if (this.tableSettings.hasOwnProperty(group)) { // Find the first field in this group.
for (var d in this.tableSettings[group]) {
@@ -586,7 +588,8 @@
* Pointerup behavior.
*/
Drupal.tableDrag.prototype.dropRow = function (event, self) {
- var droppedRow, $droppedRow;
+ var droppedRow;
+ var $droppedRow;
// Drop row functionality.
if (self.rowObject !== null) {
@@ -1048,7 +1051,8 @@
Drupal.tableDrag.prototype.row.prototype.isValidSwap = function (row) {
var $row = $(row);
if (this.indentEnabled) {
- var prevRow, nextRow;
+ var prevRow;
+ var nextRow;
if (this.direction === 'down') {
prevRow = row;
nextRow = $row.next('tr').get(0);
@@ -1108,7 +1112,8 @@
*/
Drupal.tableDrag.prototype.row.prototype.validIndentInterval = function (prevRow, nextRow) {
var $prevRow = $(prevRow);
- var minIndent, maxIndent;
+ var minIndent;
+ var maxIndent;
// Minimum indentation:
// Do not orphan the next row.
diff --git a/core/misc/tableheader.js b/core/misc/tableheader.js
index 448d0b289d6..2d6ce16e100 100644
--- a/core/misc/tableheader.js
+++ b/core/misc/tableheader.js
@@ -18,7 +18,8 @@
// Select and initialize sticky table headers.
function tableHeaderInitHandler(e) {
var $tables = $(e.data.context).find('table.sticky-enabled').once('tableheader');
- for (var i = 0, il = $tables.length; i < il; i++) {
+ var il = $tables.length;
+ for (var i = 0; i < il; i++) {
TableHeader.tables.push(new TableHeader($tables[i]));
}
forTables('onScroll');
@@ -27,7 +28,8 @@
// Helper method to loop through tables and execute a method.
function forTables(method, arg) {
var tables = TableHeader.tables;
- for (var i = 0, il = tables.length; i < il; i++) {
+ var il = tables.length;
+ for (var i = 0; i < il; i++) {
tables[i][method](arg);
}
}
@@ -234,7 +236,8 @@
// Resize header and its cell widths.
// Only apply width to visible table cells. This prevents the header from
// displaying incorrectly when the sticky header is no longer visible.
- for (var i = 0, il = this.$originalHeaderCells.length; i < il; i++) {
+ var il = this.$originalHeaderCells.length;
+ for (var i = 0; i < il; i++) {
$that = $(this.$originalHeaderCells[i]);
$stickyCell = this.$stickyHeaderCells.eq($that.index());
display = $that.css('display');
diff --git a/core/misc/tableresponsive.js b/core/misc/tableresponsive.js
index e13acce40d8..b4eab625c82 100644
--- a/core/misc/tableresponsive.js
+++ b/core/misc/tableresponsive.js
@@ -9,7 +9,8 @@
attach: function (context, settings) {
var $tables = $(context).find('table.responsive-enabled').once('tableresponsive');
if ($tables.length) {
- for (var i = 0, il = $tables.length; i < il; i++) {
+ var il = $tables.length;
+ for (var i = 0; i < il; i++) {
TableResponsive.tables.push(new TableResponsive($tables[i]));
}
}
diff --git a/core/misc/tableselect.js b/core/misc/tableselect.js
index 8f91d5e3585..78e8c90fd10 100644
--- a/core/misc/tableselect.js
+++ b/core/misc/tableselect.js
@@ -16,7 +16,9 @@
}
// Keep track of the table, which checkbox is checked and alias the settings.
- var table = this, checkboxes, lastChecked;
+ var table = this;
+ var checkboxes;
+ var lastChecked;
var $table = $(table);
var strings = {'selectAll': Drupal.t('Select all rows in this table'), 'selectNone': Drupal.t('Deselect all rows in this table')};
var updateSelectAll = function (state) {
@@ -71,7 +73,8 @@
var mode = from.rowIndex > to.rowIndex ? 'previousSibling' : 'nextSibling';
// Traverse through the sibling nodes.
- for (var i = from[mode], $i; i; i = i[mode]) {
+ for (var i = from[mode]; i; i = i[mode]) {
+ var $i;
// Make sure that we're only dealing with elements.
if (i.nodeType !== 1) {
continue;
diff --git a/core/modules/block/js/block.admin.js b/core/modules/block/js/block.admin.js
index 89739c7caf0..b8f9682421b 100644
--- a/core/modules/block/js/block.admin.js
+++ b/core/modules/block/js/block.admin.js
@@ -13,7 +13,8 @@
attach: function (context, settings) {
var $input = $('input.block-filter-text').once('block-filter-text');
var $element = $($input.attr('data-element'));
- var $blocks, $details;
+ var $blocks;
+ var $details;
/**
* Hides the <details> element for a category if it has no visible blocks.
diff --git a/core/modules/block/js/block.js b/core/modules/block/js/block.js
index 3a42f37206b..c3a4d0d672c 100644
--- a/core/modules/block/js/block.js
+++ b/core/modules/block/js/block.js
@@ -17,7 +17,8 @@
function checkboxesSummary(context) {
var vals = [];
var $checkboxes = $(context).find('input[type="checkbox"]:checked + label');
- for (var i = 0, il = $checkboxes.length; i < il; i += 1) {
+ var il = $checkboxes.length;
+ for (var i = 0; i < il; i++) {
vals.push($($checkboxes[i]).text());
}
if (!vals.length) {
diff --git a/core/modules/ckeditor/js/plugins/drupalimage/plugin.js b/core/modules/ckeditor/js/plugins/drupalimage/plugin.js
index d649885f149..fd18c5a8d1d 100644
--- a/core/modules/ckeditor/js/plugins/drupalimage/plugin.js
+++ b/core/modules/ckeditor/js/plugins/drupalimage/plugin.js
@@ -114,8 +114,8 @@
editor.fire('saveSnapshot');
// Pass `true` so DocumentFragment will also be returned.
- var container = widget.wrapper.getParent(true),
- image = widget.parts.image;
+ var container = widget.wrapper.getParent(true);
+ var image = widget.parts.image;
// Set the updated widget data, after the necessary conversions from
// the dialog's return values.
diff --git a/core/modules/ckeditor/js/plugins/drupallink/plugin.js b/core/modules/ckeditor/js/plugins/drupallink/plugin.js
index 76e6de2bc4d..04d8aba93a9 100644
--- a/core/modules/ckeditor/js/plugins/drupallink/plugin.js
+++ b/core/modules/ckeditor/js/plugins/drupallink/plugin.js
@@ -25,7 +25,8 @@
linkDOMElement = linkElement.$;
// Populate an array with the link's current attributes.
- var attribute = null, attributeName;
+ var attribute = null;
+ var attributeName;
for (var attrIndex = 0; attrIndex < linkDOMElement.attributes.length; attrIndex++) {
attribute = linkDOMElement.attributes.item(attrIndex);
attributeName = attribute.nodeName.toLowerCase();
diff --git a/core/modules/ckeditor/js/views/ControllerView.js b/core/modules/ckeditor/js/views/ControllerView.js
index aff0f8d4769..7d779439d80 100644
--- a/core/modules/ckeditor/js/views/ControllerView.js
+++ b/core/modules/ckeditor/js/views/ControllerView.js
@@ -162,7 +162,8 @@
// First collect all CKEditor allowedContent rules.
var CKEFeatureRulesMap = {};
var rules = e.editor.filter.allowedContent;
- var rule, name;
+ var rule;
+ var name;
for (var i = 0; i < rules.length; i++) {
rule = rules[i];
name = rule.featureName || ':(';
@@ -233,9 +234,11 @@
var existingButtons = [];
// Loop through each button group after flattening the groups from the
// toolbar row arrays.
- for (var i = 0, buttonGroups = _.flatten(this.model.get('activeEditorConfig')); i < buttonGroups.length; i++) {
+ var buttonGroups = _.flatten(this.model.get('activeEditorConfig'));
+ for (var i = 0; i < buttonGroups.length; i++) {
// Pull the button names from each toolbar button group.
- for (var k = 0, buttons = buttonGroups[i].items; k < buttons.length; k++) {
+ var buttons = buttonGroups[i].items;
+ for (var k = 0; k < buttons.length; k++) {
existingButtons.push(buttons[k]);
}
}
diff --git a/core/modules/ckeditor/js/views/KeyboardView.js b/core/modules/ckeditor/js/views/KeyboardView.js
index 285b963939e..2a2868ae861 100644
--- a/core/modules/ckeditor/js/views/KeyboardView.js
+++ b/core/modules/ckeditor/js/views/KeyboardView.js
@@ -216,7 +216,8 @@
var $group = $(event.currentTarget);
var $container = $group.parent();
var $siblings = $container.children();
- var index, dir;
+ var index;
+ var dir;
// Move groups between sibling groups.
if (_.indexOf(leftRightKeys, event.keyCode) > -1) {
index = $siblings.index($group);
diff --git a/core/modules/color/color.js b/core/modules/color/color.js
index a44f49f6200..afb4dd4af9c 100644
--- a/core/modules/color/color.js
+++ b/core/modules/color/color.js
@@ -9,7 +9,9 @@
Drupal.behaviors.color = {
attach: function (context, settings) {
- var i, j, colors;
+ var i;
+ var j;
+ var colors;
// This behavior attaches by ID, so is only valid once on a page.
var form = $(context).find('#system-theme-settings .color-form').once('color');
if (form.length === 0) {
@@ -56,7 +58,8 @@
// Set up colorScheme selector.
form.find('#edit-scheme').on('change', function () {
- var schemes = settings.color.schemes, colorScheme = this.options[this.selectedIndex].value;
+ var schemes = settings.color.schemes;
+ var colorScheme = this.options[this.selectedIndex].value;
if (colorScheme !== '' && schemes[colorScheme]) {
// Get colors of active scheme.
colors = schemes[colorScheme];
diff --git a/core/modules/color/preview.js b/core/modules/color/preview.js
index 4c99ffa1523..84cf2aa3f26 100644
--- a/core/modules/color/preview.js
+++ b/core/modules/color/preview.js
@@ -9,7 +9,8 @@
Drupal.color = {
callback: function (context, settings, form, farb, height, width) {
- var accum, delta;
+ var accum;
+ var delta;
// Solid background.
form.find('#preview').css('backgroundColor', form.find('#palette input[name="palette[base]"]').val());
@@ -27,7 +28,8 @@
}
// Set up gradients if there are some.
- var color_start, color_end;
+ var color_start;
+ var color_end;
for (var i in settings.gradients) {
if (settings.gradients.hasOwnProperty(i)) {
color_start = farb.unpack(form.find('#palette input[name="palette[' + settings.gradients[i].colors[0] + ']"]').val());
diff --git a/core/modules/content_translation/content_translation.admin.js b/core/modules/content_translation/content_translation.admin.js
index 1f4224befe0..857cbd75a3e 100644
--- a/core/modules/content_translation/content_translation.admin.js
+++ b/core/modules/content_translation/content_translation.admin.js
@@ -9,7 +9,8 @@
attach: function (context) {
var $context = $(context);
var options = drupalSettings.contentTranslationDependentOptions;
- var $fields, dependent_columns;
+ var $fields;
+ var dependent_columns;
function fieldsChangeHandler($fields, dependent_columns) {
return function (e) {
diff --git a/core/modules/editor/js/editor.admin.js b/core/modules/editor/js/editor.admin.js
index cbd15103a51..7c54759e811 100644
--- a/core/modules/editor/js/editor.admin.js
+++ b/core/modules/editor/js/editor.admin.js
@@ -293,8 +293,8 @@
// Check if a tag in the universe is forbidden.
var allRequiredTags = _.keys(universe);
- var filterRule, i;
- for (i = 0; i < filterStatus.rules.length; i++) {
+ var filterRule;
+ for (var i = 0; i < filterStatus.rules.length; i++) {
filterRule = filterStatus.rules[i];
if (filterRule.allow === false) {
if (_.intersection(allRequiredTags, filterRule.tags).length > 0) {
@@ -305,16 +305,15 @@
// Check if a property value of a tag in the universe is forbidden.
// For all filter rules…
- var j, k;
- for (i = 0; i < filterStatus.rules.length; i++) {
- filterRule = filterStatus.rules[i];
+ for (var n = 0; n < filterStatus.rules.length; n++) {
+ filterRule = filterStatus.rules[n];
// … if there are tags with restricted property values …
if (filterRule.restrictedTags.tags.length && !emptyProperties(filterRule.restrictedTags.forbidden)) {
// … for all those tags …
- for (j = 0; j < filterRule.restrictedTags.tags.length; j++) {
+ for (var j = 0; j < filterRule.restrictedTags.tags.length; j++) {
var tag = filterRule.restrictedTags.tags[j];
// … then iterate over all properties …
- for (k = 0; k < properties.length; k++) {
+ for (var k = 0; k < properties.length; k++) {
var property = properties[k];
// … and return true if just one of the forbidden property values
// for this tag and property is listed in the universe.
@@ -339,12 +338,13 @@
var properties = ['attributes', 'styles', 'classes'];
// Check if a tag in the universe is allowed.
- var filterRule, tag, i, j;
- for (i = 0; !_.isEmpty(universe) && i < filterStatus.rules.length; i++) {
- filterRule = filterStatus.rules[i];
+ var filterRule;
+ var tag;
+ for (var l = 0; !_.isEmpty(universe) && l < filterStatus.rules.length; l++) {
+ filterRule = filterStatus.rules[l];
if (filterRule.allow === true) {
- for (j = 0; !_.isEmpty(universe) && j < filterRule.tags.length; j++) {
- tag = filterRule.tags[j];
+ for (var m = 0; !_.isEmpty(universe) && m < filterRule.tags.length; m++) {
+ tag = filterRule.tags[m];
if (_.has(universe, tag)) {
universe[tag].tag = true;
deleteFromUniverseIfAllowed(universe, tag);
@@ -355,16 +355,15 @@
// Check if a property value of a tag in the universe is allowed.
// For all filter rules…
- var k;
- for (i = 0; !_.isEmpty(universe) && i < filterStatus.rules.length; i++) {
+ for (var i = 0; !_.isEmpty(universe) && i < filterStatus.rules.length; i++) {
filterRule = filterStatus.rules[i];
// … if there are tags with restricted property values …
if (filterRule.restrictedTags.tags.length && !emptyProperties(filterRule.restrictedTags.allowed)) {
// … for all those tags …
- for (j = 0; !_.isEmpty(universe) && j < filterRule.restrictedTags.tags.length; j++) {
+ for (var j = 0; !_.isEmpty(universe) && j < filterRule.restrictedTags.tags.length; j++) {
tag = filterRule.restrictedTags.tags[j];
// … then iterate over all properties …
- for (k = 0; k < properties.length; k++) {
+ for (var k = 0; k < properties.length; k++) {
var property = properties[k];
// … and try to delete this tag from the universe if just one of
// the allowed property values for this tag and property is listed
diff --git a/core/modules/filter/filter.filter_html.admin.js b/core/modules/filter/filter.filter_html.admin.js
index a74b938e7c6..a2a20405faa 100644
--- a/core/modules/filter/filter.filter_html.admin.js
+++ b/core/modules/filter/filter.filter_html.admin.js
@@ -15,7 +15,8 @@
Drupal.filterConfiguration.liveSettingParsers.filter_html = {
getRules: function () {
var currentValue = $('#edit-filters-filter-html-settings-allowed-html').val();
- var rules = [], rule;
+ var rules = [];
+ var rule;
// Build a FilterHTMLRule that reflects the hard-coded behavior that
// strips all "style" attribute and all "on*" attributes.
diff --git a/core/modules/locale/locale.admin.js b/core/modules/locale/locale.admin.js
index fc310cf842b..9c32c5e547d 100644
--- a/core/modules/locale/locale.admin.js
+++ b/core/modules/locale/locale.admin.js
@@ -17,10 +17,9 @@
});
// Highlight changed row.
$form.on('formUpdated.localeTranslateDirty', 'tr', function () {
- var
- $row = $(this),
- $rowToMark = $row.once('localemark'),
- marker = Drupal.theme('localeTranslateChangedMarker');
+ var $row = $(this);
+ var $rowToMark = $row.once('localemark');
+ var marker = Drupal.theme('localeTranslateChangedMarker');
$row.addClass('changed');
// Add an asterisk only once if row changed.
diff --git a/core/modules/node/node.js b/core/modules/node/node.js
index 60db08f07b7..cf0f979fa76 100644
--- a/core/modules/node/node.js
+++ b/core/modules/node/node.js
@@ -27,8 +27,8 @@
$context.find('.node-form-author').drupalSetSummary(function (context) {
var $authorContext = $(context);
- var name = $authorContext.find('.field-name-uid input').val(),
- date = $authorContext.find('.field-name-created input').val();
+ var name = $authorContext.find('.field-name-uid input').val();
+ var date = $authorContext.find('.field-name-created input').val();
return date ?
Drupal.t('By @name on @date', {'@name': name, '@date': date}) :
Drupal.t('By @name', {'@name': name});
diff --git a/core/modules/quickedit/js/views/AppView.js b/core/modules/quickedit/js/views/AppView.js
index c911da5f582..a5873d62bfb 100644
--- a/core/modules/quickedit/js/views/AppView.js
+++ b/core/modules/quickedit/js/views/AppView.js
@@ -175,7 +175,8 @@
// If it's not against the general principle, then here are more
// disallowed cases to check.
if (accept) {
- var activeField, activeFieldState;
+ var activeField;
+ var activeFieldState;
// Ensure only one field (editor) at a time is active … but allow a user
// to hop from one field to the next, even if we still have to start
// saving the field that is currently active: assume it will be valid,
diff --git a/core/modules/quickedit/js/views/EntityToolbarView.js b/core/modules/quickedit/js/views/EntityToolbarView.js
index 0cd7f0d4212..e811cb8c1db 100644
--- a/core/modules/quickedit/js/views/EntityToolbarView.js
+++ b/core/modules/quickedit/js/views/EntityToolbarView.js
@@ -175,7 +175,9 @@
// ignore that padding when positioning the toolbar, to not unnecessarily
// move the toolbar horizontally, which feels annoying.
var horizontalPadding = 0;
- var of, activeField, highlightedField;
+ var of;
+ var activeField;
+ var highlightedField;
// There are several elements in the page that the entity toolbar might be
// positioned against. They are considered below in a priority order.
do {
diff --git a/core/modules/quickedit/js/views/FieldDecorationView.js b/core/modules/quickedit/js/views/FieldDecorationView.js
index 93549e35efe..49491da617f 100644
--- a/core/modules/quickedit/js/views/FieldDecorationView.js
+++ b/core/modules/quickedit/js/views/FieldDecorationView.js
@@ -297,13 +297,13 @@
* @param DOM $e
*/
_getPositionProperties: function ($e) {
- var p,
- r = {},
- props = [
- 'top', 'left', 'bottom', 'right',
- 'padding-top', 'padding-left', 'padding-right', 'padding-bottom',
- 'margin-bottom'
- ];
+ var p;
+ var r = {};
+ var props = [
+ 'top', 'left', 'bottom', 'right',
+ 'padding-top', 'padding-left', 'padding-right', 'padding-bottom',
+ 'margin-bottom'
+ ];
var propCount = props.length;
for (var i = 0; i < propCount; i++) {
diff --git a/core/modules/system/system.modules.js b/core/modules/system/system.modules.js
index 4964a1a8825..45ddf3bf4ea 100644
--- a/core/modules/system/system.modules.js
+++ b/core/modules/system/system.modules.js
@@ -16,7 +16,9 @@
attach: function (context, settings) {
var $input = $('input.table-filter-text').once('table-filter-text');
var $table = $($input.attr('data-table'));
- var $rowsAndDetails, $rows, $details;
+ var $rowsAndDetails;
+ var $rows;
+ var $details;
var searching = false;
function hidePackageDetails(index, element) {
diff --git a/core/modules/user/user.js b/core/modules/user/user.js
index 45f554cf8c0..98d1d0e0542 100644
--- a/core/modules/user/user.js
+++ b/core/modules/user/user.js
@@ -89,7 +89,11 @@
* Returns the estimated strength and the relevant output message.
*/
Drupal.evaluatePasswordStrength = function (password, translate) {
- var indicatorText, indicatorClass, weaknesses = 0, strength = 100, msg = [];
+ var indicatorText;
+ var indicatorClass;
+ var weaknesses = 0;
+ var strength = 100;
+ var msg = [];
var hasLowercase = /[a-z]+/.test(password);
var hasUppercase = /[A-Z]+/.test(password);
diff --git a/core/modules/user/user.permissions.js b/core/modules/user/user.permissions.js
index d47ee9ac568..6c28f070e4a 100644
--- a/core/modules/user/user.permissions.js
+++ b/core/modules/user/user.permissions.js
@@ -15,7 +15,8 @@
// performed without triggering internal layout and re-rendering processes
// in the browser.
var $table = $(this);
- var $ancestor, method;
+ var $ancestor;
+ var method;
if ($table.prev().length) {
$ancestor = $table.prev();
method = 'after';
@@ -58,7 +59,8 @@
* checkboxes are shown, the real checkboxes otherwise.
*/
toggle: function () {
- var authCheckbox = this, $row = $(this).closest('tr');
+ var authCheckbox = this;
+ var $row = $(this).closest('tr');
// jQuery performs too many layout calculations for .hide() and .show(),
// leading to a major page rendering lag on sites with many roles and
// permissions. Therefore, we toggle visibility directly.
diff --git a/core/modules/views_ui/js/views-admin.js b/core/modules/views_ui/js/views-admin.js
index 7f217dc7182..d0534cf7765 100644
--- a/core/modules/views_ui/js/views-admin.js
+++ b/core/modules/views_ui/js/views-admin.js
@@ -335,10 +335,12 @@
* shown and hidden depending on the user's search terms.
*/
getOptions: function ($allOptions) {
- var i, $label, $description, $option;
+ var $label;
+ var $description;
+ var $option;
var options = [];
var length = $allOptions.length;
- for (i = 0; i < length; i++) {
+ for (var i = 0; i < length; i++) {
$option = $($allOptions[i]);
$label = $option.find('label');
$description = $option.find('div.description');
@@ -358,7 +360,9 @@
* Keyup handler for the search box that hides or shows the relevant options.
*/
handleKeyup: function (event) {
- var found, i, j, option, zebraClass;
+ var found;
+ var option;
+ var zebraClass;
// Determine the user's search query. The search text has been converted to
// lowercase.
@@ -371,13 +375,13 @@
// Search through the search texts in the form for matching text.
var length = this.options.length;
- for (i = 0; i < length; i++) {
+ for (var i = 0; i < length; i++) {
// Use a local variable for the option being searched, for performance.
option = this.options[i];
found = true;
// Each word in the search string has to match the item in order for the
// item to be shown.
- for (j = 0; j < wordsLength; j++) {
+ for (var j = 0; j < wordsLength; j++) {
if (option.searchText.indexOf(words[j]) === -1) {
found = false;
}
@@ -559,7 +563,9 @@
* duplicate it between any subsequent groups.
*/
duplicateGroupsOperator: function () {
- var dropdowns, newRow, titleRow;
+ var dropdowns;
+ var newRow;
+ var titleRow;
var titleRows = $('tr.views-group-title');
@@ -584,10 +590,10 @@
newRow = $('<tr class="filter-group-operator-row"><td colspan="5"></td></tr>');
newRow.find('td').append(this.operator);
newRow.insertBefore(titleRow);
- var i, length = titleRows.length;
+ var length = titleRows.length;
// Starting with the third group, copy the operator to a new row above the
// group title.
- for (i = 2; i < length; i++) {
+ for (var i = 2; i < length; i++) {
titleRow = $(titleRows[i]);
// Make a copy of the operator dropdown and put it in a new table row.
var fakeOperator = this.operator.clone();
@@ -741,10 +747,13 @@
* Update the rowspan attribute of each cell containing an operator dropdown.
*/
updateRowspans: function () {
- var i, $row, $currentEmptyRow, draggableCount, $operatorCell;
+ var $row;
+ var $currentEmptyRow;
+ var draggableCount;
+ var $operatorCell;
var rows = $(this.table).find('tr');
var length = rows.length;
- for (i = 0; i < length; i++) {
+ for (var i = 0; i < length; i++) {
$row = $(rows[i]);
if ($row.hasClass('views-group-title')) {
// This row is a title row.