Skip to content

Commit

Permalink
MDL-55244 js: fix problems with eslint --fix
Browse files Browse the repository at this point in the history
eslint --fix '**/yui/src/**/*.js'
  • Loading branch information
danpoltawski committed Jul 25, 2016
1 parent 90a8bdb commit 5bb4f44
Show file tree
Hide file tree
Showing 112 changed files with 2,143 additions and 2,143 deletions.
20 changes: 10 additions & 10 deletions admin/tool/capability/yui/src/search/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ SEARCH.prototype = {
* @type Node
* @protected
*/
form : null,
form: null,
/**
* The capability select node.
* @property select
Expand All @@ -36,7 +36,7 @@ SEARCH.prototype = {
* @type Object
* @protected
*/
selectoptions : {},
selectoptions: {},
/**
* The search input field.
* @property input
Expand All @@ -58,12 +58,12 @@ SEARCH.prototype = {
* @type Node
* @protected
*/
lastsearch : null,
lastsearch: null,
/**
* Constructs the search manager.
* @method initializer
*/
initializer : function() {
initializer: function() {
this.form = Y.one('#capability-overview-form');
this.select = this.form.one('select[data-search=capability]');
this.select.setStyle('minWidth', this.select.get('offsetWidth'));
Expand All @@ -75,7 +75,7 @@ SEARCH.prototype = {
this.lastsearch = this.form.one('input[name=search]');

var div = Y.Node.create('<div id="capabilitysearchui"></div>'),
label = Y.Node.create('<label for="capabilitysearch">'+this.get('strsearch')+'</label>');
label = Y.Node.create('<label for="capabilitysearch">' + this.get('strsearch') + '</label>');
this.input = Y.Node.create('<input type="text" id="capabilitysearch" />');

div.append(label).append(this.input);
Expand All @@ -99,15 +99,15 @@ SEARCH.prototype = {
* Disables the submit button if there are no capabilities selected.
* @method validate
*/
validate : function() {
validate: function() {
this.button.set('disabled', (this.select.get('value') === ''));
},
/**
* Called when ever the user types into the search field.
* This method hides any capabilities that don't match the search term.
* @method typed
*/
typed : function() {
typed: function() {
var search = this.input.get('value'),
matching = 0,
last = null,
Expand Down Expand Up @@ -135,9 +135,9 @@ SEARCH.prototype = {
}
};
Y.extend(SEARCH, Y.Base, SEARCH.prototype, {
NAME : 'tool_capability-search',
ATTRS : {
strsearch : {}
NAME: 'tool_capability-search',
ATTRS: {
strsearch: {}
}
});

Expand Down
4 changes: 2 additions & 2 deletions admin/tool/lp/yui/src/dragdrop-reorder/js/dragdropreorder.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ Y.extend(DRAGREORDER, M.core.dragdrop, {
Y.one('.' + args.parentNodeClass)
.all('.' + args.dragHandleInsertClass)
.each(
function (node) {
function(node) {
node.insert(this.draghandle.cloneNode(true));
} , this);
}, this);
},

drop_hit: function(e) {
Expand Down
12 changes: 6 additions & 6 deletions availability/condition/date/yui/src/form/js/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ M.availability_date.form.getNode = function(json) {

var url = M.cfg.wwwroot + '/availability/condition/date/ajax.php?action=fromtime' +
'&time=' + json.t;
Y.io(url, { on : {
success : function(id, response) {
Y.io(url, {on: {
success: function(id, response) {
var fields = Y.JSON.parse(response.responseText);
for (var field in fields) {
var select = node.one('select[name=x\\[' + field + '\\]]');
select.set('value', '' + fields[field]);
select.set('disabled', false);
}
},
failure : function() {
failure: function() {
window.alert(M.util.get_string('ajaxerror', 'availability_date'));
}
}});
Expand Down Expand Up @@ -123,12 +123,12 @@ M.availability_date.form.updateTime = function(node) {
'&day=' + node.one('select[name=x\\[day\\]]').get('value') +
'&hour=' + node.one('select[name=x\\[hour\\]]').get('value') +
'&minute=' + node.one('select[name=x\\[minute\\]]').get('value');
Y.io(url, { on : {
success : function(id, response) {
Y.io(url, {on: {
success: function(id, response) {
node.setData('time', response.responseText);
M.core_availability.form.update();
},
failure : function() {
failure: function() {
window.alert(M.util.get_string('ajaxerror', 'availability_date'));
}
}});
Expand Down
4 changes: 2 additions & 2 deletions availability/condition/grade/yui/src/form/js/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ M.availability_grade.form.fillErrors = function(errors, node) {
}

// Check numeric values.
if ((value.min !== undefined && typeof(value.min) === 'string') ||
(value.max !== undefined && typeof(value.max) === 'string')) {
if ((value.min !== undefined && typeof (value.min) === 'string') ||
(value.max !== undefined && typeof (value.max) === 'string')) {
errors.push('availability_grade:error_invalidnumber');
} else if (value.min !== undefined && value.max !== undefined &&
value.min >= value.max) {
Expand Down
72 changes: 36 additions & 36 deletions availability/yui/src/form/js/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,57 +30,57 @@ M.core_availability.form = {
* @property plugins
* @type Object
*/
plugins : {},
plugins: {},

/**
* Availability field (textarea).
*
* @property field
* @type Y.Node
*/
field : null,
field: null,

/**
* Main div that replaces the availability field.
*
* @property mainDiv
* @type Y.Node
*/
mainDiv : null,
mainDiv: null,

/**
* Object that represents the root of the tree.
*
* @property rootList
* @type M.core_availability.List
*/
rootList : null,
rootList: null,

/**
* Counter used when creating anything that needs an id.
*
* @property idCounter
* @type Number
*/
idCounter : 0,
idCounter: 0,

/**
* The 'Restrict by group' button if present.
*
* @property restrictByGroup
* @type Y.Node
*/
restrictByGroup : null,
restrictByGroup: null,

/**
* Called to initialise the system when the page loads. This method will
* also call the init method for each plugin.
*
* @method init
*/
init : function(pluginParams) {
init: function(pluginParams) {
// Init all plugins.
for(var plugin in pluginParams) {
for (var plugin in pluginParams) {
var params = pluginParams[plugin];
var pluginClass = M[params[0]].form;
pluginClass.init.apply(pluginClass, params);
Expand All @@ -106,7 +106,7 @@ M.core_availability.form = {
if (value !== '') {
try {
data = Y.JSON.parse(value);
} catch(x) {
} catch (x) {
// If the JSON data is not valid, treat it as empty.
this.field.set('value', '');
}
Expand Down Expand Up @@ -152,7 +152,7 @@ M.core_availability.form = {
*
* @method update
*/
update : function() {
update: function() {
// Convert tree to value.
var jsValue = this.rootList.getValue();

Expand All @@ -174,7 +174,7 @@ M.core_availability.form = {
* Updates the status of the 'restrict by group' button (enables or disables
* it) based on current availability restrictions and group/grouping settings.
*/
updateRestrictByGroup : function() {
updateRestrictByGroup: function() {
if (!this.restrictByGroup) {
return;
}
Expand Down Expand Up @@ -213,7 +213,7 @@ M.core_availability.form = {
*
* @param e Button click event
*/
addRestrictByGroup : function(e) {
addRestrictByGroup: function(e) {
// If you don't prevent default, it submits the form for some reason.
e.preventDefault();

Expand All @@ -223,10 +223,10 @@ M.core_availability.form = {
if (groupingid && Number(groupingid.get('value')) !== 0) {
// Add a grouping restriction if one is specified.
newChild = new M.core_availability.Item(
{type : 'grouping', id : Number(groupingid.get('value'))}, true);
{type: 'grouping', id: Number(groupingid.get('value'))}, true);
} else {
// Otherwise just add a group restriction.
newChild = new M.core_availability.Item({type : 'group'}, true);
newChild = new M.core_availability.Item({type: 'group'}, true);
}

// Refresh HTML.
Expand All @@ -251,7 +251,7 @@ M.core_availability.plugin = {
* @property allowAdd
* @type Boolean
*/
allowAdd : false,
allowAdd: false,

/**
* Called (from PHP) to initialise the plugin. Should usually not be
Expand All @@ -260,7 +260,7 @@ M.core_availability.plugin = {
* @method init
* @param {String} component Component name e.g. 'availability_date'
*/
init : function(component, allowAdd, params) {
init: function(component, allowAdd, params) {
var name = component.replace(/^availability_/, '');
this.allowAdd = allowAdd;
M.core_availability.form.plugins[name] = this;
Expand All @@ -276,7 +276,7 @@ M.core_availability.plugin = {
* @method initInner
* @protected
*/
initInner : function() {
initInner: function() {
},

/**
Expand All @@ -287,7 +287,7 @@ M.core_availability.plugin = {
* @method getNode
* @return {Y.Node} YUI node
*/
getNode : function() {
getNode: function() {
throw 'getNode not implemented';
},

Expand All @@ -301,7 +301,7 @@ M.core_availability.plugin = {
* @param {Object} value Value object (to be written to)
* @param {Y.Node} node YUI node (same one returned from getNode)
*/
fillValue : function() {
fillValue: function() {
throw 'fillValue not implemented';
},

Expand All @@ -318,7 +318,7 @@ M.core_availability.plugin = {
* @param {Array} errors Array of errors (push new errors here)
* @param {Y.Node} node YUI node (same one returned from getNode)
*/
fillErrors : function() {
fillErrors: function() {
},

/**
Expand All @@ -327,7 +327,7 @@ M.core_availability.plugin = {
* The default implementation uses a simple algorithm to identify the
* first focusable input/select and then focuses it.
*/
focusAfterAdd : function(node) {
focusAfterAdd: function(node) {
var target = node.one('input:not([disabled]),select:not([disabled])');
target.focus();
}
Expand Down Expand Up @@ -530,7 +530,7 @@ M.core_availability.List.prototype.isIndividualShowIcons = function() {
*/
M.core_availability.List.prototype.renumber = function(parentNumber) {
// Update heading for list.
var headingParams = { count: this.children.length };
var headingParams = {count: this.children.length};
var prefix;
if (parentNumber === undefined) {
headingParams.number = '';
Expand Down Expand Up @@ -668,7 +668,7 @@ M.core_availability.List.prototype.clickAdd = function() {
var cancel = content.one('button');

// Make a list of all the dialog options.
var dialogRef = { dialog: null };
var dialogRef = {dialog: null};
var ul = content.one('ul');
var li, id, button, label;
for (var type in M.core_availability.form.plugins) {
Expand Down Expand Up @@ -701,13 +701,13 @@ M.core_availability.List.prototype.clickAdd = function() {
ul.appendChild(li);

var config = {
headerContent : M.util.get_string('addrestriction', 'availability'),
bodyContent : content,
additionalBaseClass : 'availability-dialogue',
draggable : true,
modal : true,
closeButton : false,
width : '450px'
headerContent: M.util.get_string('addrestriction', 'availability'),
bodyContent: content,
additionalBaseClass: 'availability-dialogue',
draggable: true,
modal: true,
closeButton: false,
width: '450px'
};
dialogRef.dialog = new M.core.dialogue(config);
dialogRef.dialog.show();
Expand All @@ -732,10 +732,10 @@ M.core_availability.List.prototype.getAddHandler = function(type, dialogRef) {
var newItem;
if (type) {
// Create an Item object to represent the child.
newItem = new M.core_availability.Item({ type: type, creating: true }, this.root);
newItem = new M.core_availability.Item({type: type, creating: true}, this.root);
} else {
// Create a new List object to represent the child.
newItem = new M.core_availability.List({ c: [], showc: true }, false, this.root);
newItem = new M.core_availability.List({c: [], showc: true}, false, this.root);
}
// Add to list.
this.addChild(newItem);
Expand Down Expand Up @@ -897,7 +897,7 @@ M.core_availability.Item = function(json, root) {
// hidden depending on the selected list operator.
if (root) {
var shown = true;
if(json.showc !== undefined) {
if (json.showc !== undefined) {
shown = json.showc;
}
this.eyeIcon = new M.core_availability.EyeIcon(true, shown);
Expand Down Expand Up @@ -925,7 +925,7 @@ M.core_availability.Item = function(json, root) {
* @return {Object} JavaScript object containing value of this item
*/
M.core_availability.Item.prototype.getValue = function() {
var value = { 'type' : this.pluginType };
var value = {'type': this.pluginType};
if (this.plugin) {
this.plugin.fillValue(value, this.pluginNode);
}
Expand Down Expand Up @@ -966,7 +966,7 @@ M.core_availability.Item.prototype.fillErrors = function(errors) {
*/
M.core_availability.Item.prototype.renumber = function(number) {
// Update heading for item.
var headingParams = { number: number };
var headingParams = {number: number};
if (this.plugin) {
headingParams.type = M.util.get_string('title', 'availability_' + this.pluginType);
} else {
Expand Down Expand Up @@ -1062,7 +1062,7 @@ M.core_availability.EyeIcon = function(individual, shown) {
this.span.set('title', shownStr + ' \u2022 ' +
M.util.get_string('hide_verb', 'availability'));
};
if(shown) {
if (shown) {
setShown.call(this);
} else {
setHidden.call(this);
Expand Down
Loading

0 comments on commit 5bb4f44

Please sign in to comment.