mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-29 12:39:45 +00:00
fix indentation
This commit is contained in:
parent
2f71a43420
commit
6cb3cf8747
36
js/main.js
36
js/main.js
@ -326,7 +326,7 @@ var MM = (function() {
|
|||||||
* return array - Filtered collection of modules.
|
* return array - Filtered collection of modules.
|
||||||
*/
|
*/
|
||||||
var exceptWithClass = function(className) {
|
var exceptWithClass = function(className) {
|
||||||
return modulesByClass(className, false);
|
return modulesByClass(className, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* modulesByClass(className, include)
|
/* modulesByClass(className, include)
|
||||||
@ -338,27 +338,27 @@ var MM = (function() {
|
|||||||
* return array - Filtered collection of modules.
|
* return array - Filtered collection of modules.
|
||||||
*/
|
*/
|
||||||
var modulesByClass = function(className, include) {
|
var modulesByClass = function(className, include) {
|
||||||
var searchClasses = className;
|
var searchClasses = className;
|
||||||
if (typeof className === "string") {
|
if (typeof className === "string") {
|
||||||
searchClasses = className.split(" ");
|
searchClasses = className.split(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
var newModules = modules.filter(function(module) {
|
var newModules = modules.filter(function(module) {
|
||||||
var classes = module.data.classes.toLowerCase().split(" ");
|
var classes = module.data.classes.toLowerCase().split(" ");
|
||||||
|
|
||||||
for (var c in searchClasses) {
|
for (var c in searchClasses) {
|
||||||
var searchClass = searchClasses[c];
|
var searchClass = searchClasses[c];
|
||||||
if (classes.indexOf(searchClass.toLowerCase()) !== -1) {
|
if (classes.indexOf(searchClass.toLowerCase()) !== -1) {
|
||||||
return include;
|
return include;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return !include;
|
return !include;
|
||||||
});
|
});
|
||||||
|
|
||||||
setSelectionMethodsForModules(newModules);
|
setSelectionMethodsForModules(newModules);
|
||||||
return newModules;
|
return newModules;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* exceptModule(module)
|
/* exceptModule(module)
|
||||||
* Removes a module instance from the collection.
|
* Removes a module instance from the collection.
|
||||||
|
34
js/module.js
34
js/module.js
@ -203,7 +203,7 @@ var Module = Class.extend({
|
|||||||
* argument callback function - Function called when done.
|
* argument callback function - Function called when done.
|
||||||
*/
|
*/
|
||||||
loadStyles: function (callback) {
|
loadStyles: function (callback) {
|
||||||
this.loadDependencies("getStyles", callback);
|
this.loadDependencies("getStyles", callback);
|
||||||
},
|
},
|
||||||
|
|
||||||
/* loadScripts()
|
/* loadScripts()
|
||||||
@ -221,24 +221,24 @@ var Module = Class.extend({
|
|||||||
* argument funcName string - Function name to call to get scripts or styles.
|
* argument funcName string - Function name to call to get scripts or styles.
|
||||||
* argument callback function - Function called when done.
|
* argument callback function - Function called when done.
|
||||||
*/
|
*/
|
||||||
loadDependencies: function (funcName, callback) {
|
loadDependencies: function (funcName, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var dependencies = this[funcName]();
|
var dependencies = this[funcName]();
|
||||||
|
|
||||||
var loadNextDependency = function () {
|
var loadNextDependency = function () {
|
||||||
if (dependencies.length > 0) {
|
if (dependencies.length > 0) {
|
||||||
var nextDependency = dependencies[0];
|
var nextDependency = dependencies[0];
|
||||||
Loader.loadFile(nextDependency, self, function () {
|
Loader.loadFile(nextDependency, self, function () {
|
||||||
dependencies = dependencies.slice(1);
|
dependencies = dependencies.slice(1);
|
||||||
loadNextDependency();
|
loadNextDependency();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
loadNextDependency();
|
loadNextDependency();
|
||||||
},
|
},
|
||||||
|
|
||||||
/* loadScripts()
|
/* loadScripts()
|
||||||
* Load all required scripts by requesting the MM object to load the files.
|
* Load all required scripts by requesting the MM object to load the files.
|
||||||
|
@ -332,7 +332,7 @@ Module.register("calendar", {
|
|||||||
* return string - The Symbol
|
* return string - The Symbol
|
||||||
*/
|
*/
|
||||||
symbolForUrl: function (url) {
|
symbolForUrl: function (url) {
|
||||||
return this.getCalendarProperty(url, "symbol", this.config.defaultSymbol);
|
return this.getCalendarProperty(url, "symbol", this.config.defaultSymbol);
|
||||||
},
|
},
|
||||||
|
|
||||||
/* colorForUrl(url)
|
/* colorForUrl(url)
|
||||||
@ -343,7 +343,7 @@ Module.register("calendar", {
|
|||||||
* return string - The Color
|
* return string - The Color
|
||||||
*/
|
*/
|
||||||
colorForUrl: function (url) {
|
colorForUrl: function (url) {
|
||||||
return this.getCalendarProperty(url, "color", "#fff");
|
return this.getCalendarProperty(url, "color", "#fff");
|
||||||
},
|
},
|
||||||
|
|
||||||
/* countTitleForUrl(url)
|
/* countTitleForUrl(url)
|
||||||
@ -367,14 +367,14 @@ Module.register("calendar", {
|
|||||||
* return string - The Property
|
* return string - The Property
|
||||||
*/
|
*/
|
||||||
getCalendarProperty: function (url, property, defaultValue) {
|
getCalendarProperty: function (url, property, defaultValue) {
|
||||||
for (var c in this.config.calendars) {
|
for (var c in this.config.calendars) {
|
||||||
var calendar = this.config.calendars[c];
|
var calendar = this.config.calendars[c];
|
||||||
if (calendar.url === url && typeof calendar[property] === "string") {
|
if (calendar.url === url && typeof calendar[property] === "string") {
|
||||||
return calendar[property];
|
return calendar[property];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
},
|
},
|
||||||
|
|
||||||
/* shorten(string, maxLength)
|
/* shorten(string, maxLength)
|
||||||
|
@ -76,9 +76,9 @@ Module.register("clock",{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var hourSymbol = "HH";
|
var hourSymbol = "HH";
|
||||||
if (this.config.timeFormat !== 24) {
|
if (this.config.timeFormat !== 24) {
|
||||||
hourSymbol = "h";
|
hourSymbol = "h";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.config.clockBold === true) {
|
if (this.config.clockBold === true) {
|
||||||
timeString = now.format(hourSymbol + "[<span class=\"bold\">]mm[</span>]");
|
timeString = now.format(hourSymbol + "[<span class=\"bold\">]mm[</span>]");
|
||||||
@ -199,17 +199,17 @@ Module.register("clock",{
|
|||||||
digitalWrapper.appendChild(timeWrapper);
|
digitalWrapper.appendChild(timeWrapper);
|
||||||
|
|
||||||
var appendClocks = function(condition, pos1, pos2) {
|
var appendClocks = function(condition, pos1, pos2) {
|
||||||
var padding = [0,0,0,0];
|
var padding = [0,0,0,0];
|
||||||
padding[(placement === condition) ? pos1 : pos2] = "20px";
|
padding[(placement === condition) ? pos1 : pos2] = "20px";
|
||||||
analogWrapper.style.padding = padding.join(" ");
|
analogWrapper.style.padding = padding.join(" ");
|
||||||
if (placement === condition) {
|
if (placement === condition) {
|
||||||
wrapper.appendChild(analogWrapper);
|
wrapper.appendChild(analogWrapper);
|
||||||
wrapper.appendChild(digitalWrapper);
|
wrapper.appendChild(digitalWrapper);
|
||||||
} else {
|
} else {
|
||||||
wrapper.appendChild(digitalWrapper);
|
wrapper.appendChild(digitalWrapper);
|
||||||
wrapper.appendChild(analogWrapper);
|
wrapper.appendChild(analogWrapper);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
if (placement === "left" || placement === "right") {
|
if (placement === "left" || placement === "right") {
|
||||||
digitalWrapper.style.display = "inline-block";
|
digitalWrapper.style.display = "inline-block";
|
||||||
@ -220,7 +220,7 @@ Module.register("clock",{
|
|||||||
} else {
|
} else {
|
||||||
digitalWrapper.style.textAlign = "center";
|
digitalWrapper.style.textAlign = "center";
|
||||||
|
|
||||||
appendClocks("top", 2, 0);
|
appendClocks("top", 2, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user