reformatted the whole code base
This commit is contained in:
parent
f576347c06
commit
f171b9c8aa
23 changed files with 1148 additions and 1001 deletions
|
@ -12,7 +12,7 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
(function () {
|
||||
(function() {
|
||||
'use strict';
|
||||
var es_ist = {1: [1, 2, 4, 5, 6]};
|
||||
var uhr = {10: [9, 10, 11]};
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
(function () {
|
||||
(function() {
|
||||
'use strict';
|
||||
var vorne0 = {
|
||||
3: [2, 3, 4],
|
||||
|
@ -73,86 +73,86 @@
|
|||
9: [7, 8, 9, 10, 11]
|
||||
};
|
||||
var vorne3 = {
|
||||
3: [1, 2, 3, 4, 5],
|
||||
4: [4],
|
||||
5: [3],
|
||||
6: [4],
|
||||
7: [5],
|
||||
8: [1, 5],
|
||||
9: [2, 3, 4]
|
||||
};
|
||||
3: [1, 2, 3, 4, 5],
|
||||
4: [4],
|
||||
5: [3],
|
||||
6: [4],
|
||||
7: [5],
|
||||
8: [1, 5],
|
||||
9: [2, 3, 4]
|
||||
};
|
||||
var hinten3 = {
|
||||
3: [7, 8, 9, 10, 11],
|
||||
4: [10],
|
||||
5: [9],
|
||||
6: [10],
|
||||
7: [11],
|
||||
8: [7, 11],
|
||||
9: [8, 9, 10]
|
||||
};
|
||||
3: [7, 8, 9, 10, 11],
|
||||
4: [10],
|
||||
5: [9],
|
||||
6: [10],
|
||||
7: [11],
|
||||
8: [7, 11],
|
||||
9: [8, 9, 10]
|
||||
};
|
||||
var vorne4 = {
|
||||
3: [4],
|
||||
4: [3, 4],
|
||||
5: [2, 4],
|
||||
6: [1, 4],
|
||||
7: [1, 2, 3, 4, 5],
|
||||
8: [4],
|
||||
9: [4]
|
||||
};
|
||||
3: [4],
|
||||
4: [3, 4],
|
||||
5: [2, 4],
|
||||
6: [1, 4],
|
||||
7: [1, 2, 3, 4, 5],
|
||||
8: [4],
|
||||
9: [4]
|
||||
};
|
||||
var hinten4 = {
|
||||
3: [10],
|
||||
4: [9, 10],
|
||||
5: [8, 10],
|
||||
6: [7, 10],
|
||||
7: [7, 8, 9, 10, 11],
|
||||
8: [10],
|
||||
9: [10]
|
||||
};
|
||||
3: [10],
|
||||
4: [9, 10],
|
||||
5: [8, 10],
|
||||
6: [7, 10],
|
||||
7: [7, 8, 9, 10, 11],
|
||||
8: [10],
|
||||
9: [10]
|
||||
};
|
||||
var vorne5 = {
|
||||
3: [1, 2, 3, 4, 5],
|
||||
4: [1],
|
||||
5: [1, 2, 3, 4],
|
||||
6: [5],
|
||||
7: [5],
|
||||
8: [1, 5],
|
||||
9: [2, 3, 4]
|
||||
};
|
||||
3: [1, 2, 3, 4, 5],
|
||||
4: [1],
|
||||
5: [1, 2, 3, 4],
|
||||
6: [5],
|
||||
7: [5],
|
||||
8: [1, 5],
|
||||
9: [2, 3, 4]
|
||||
};
|
||||
var hinten5 = {
|
||||
3: [7, 8, 9, 10, 11],
|
||||
4: [7],
|
||||
5: [7, 8, 9, 10],
|
||||
6: [11],
|
||||
7: [11],
|
||||
8: [7, 11],
|
||||
9: [8, 9, 10]
|
||||
};
|
||||
3: [7, 8, 9, 10, 11],
|
||||
4: [7],
|
||||
5: [7, 8, 9, 10],
|
||||
6: [11],
|
||||
7: [11],
|
||||
8: [7, 11],
|
||||
9: [8, 9, 10]
|
||||
};
|
||||
var hinten6 = {
|
||||
3: [9, 10],
|
||||
4: [8],
|
||||
5: [7],
|
||||
6: [7, 8, 9, 10],
|
||||
7: [7, 11],
|
||||
8: [7, 11],
|
||||
9: [8, 9, 10]
|
||||
};
|
||||
3: [9, 10],
|
||||
4: [8],
|
||||
5: [7],
|
||||
6: [7, 8, 9, 10],
|
||||
7: [7, 11],
|
||||
8: [7, 11],
|
||||
9: [8, 9, 10]
|
||||
};
|
||||
var hinten7 = {
|
||||
3: [7, 8, 9, 10, 11],
|
||||
4: [11],
|
||||
5: [10],
|
||||
6: [9],
|
||||
7: [8],
|
||||
8: [8],
|
||||
9: [8]
|
||||
};
|
||||
3: [7, 8, 9, 10, 11],
|
||||
4: [11],
|
||||
5: [10],
|
||||
6: [9],
|
||||
7: [8],
|
||||
8: [8],
|
||||
9: [8]
|
||||
};
|
||||
var hinten8 = {
|
||||
3: [8, 9, 10],
|
||||
4: [7, 11],
|
||||
5: [7, 11],
|
||||
6: [8, 9, 10],
|
||||
7: [7, 11],
|
||||
8: [7, 11],
|
||||
9: [8, 9, 10]
|
||||
};
|
||||
3: [8, 9, 10],
|
||||
4: [7, 11],
|
||||
5: [7, 11],
|
||||
6: [8, 9, 10],
|
||||
7: [7, 11],
|
||||
8: [7, 11],
|
||||
9: [8, 9, 10]
|
||||
};
|
||||
var hinten9 = {
|
||||
3: [8, 9, 10],
|
||||
4: [7, 11],
|
||||
|
@ -239,7 +239,7 @@
|
|||
"58": [vorne5, hinten8],
|
||||
"59": [vorne5, hinten9]
|
||||
},
|
||||
"getDotMinute": function (time) {
|
||||
"getDotMinute": function() {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
(function () {
|
||||
(function() {
|
||||
'use strict';
|
||||
// hilfsvariablen
|
||||
var es_isch = {1: [1, 2, 4, 5, 6, 7]};
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
(function () {
|
||||
(function() {
|
||||
'use strict';
|
||||
var es_isch = {1: [1, 2, 4, 5, 6, 7]};
|
||||
var genau = {3: [7, 8, 9, 10, 11]};
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
(function () {
|
||||
(function() {
|
||||
'use strict';
|
||||
var it_is = {1: [1, 2, 4, 5]};
|
||||
var half = {4: [1, 2, 3, 4]};
|
||||
|
@ -69,7 +69,7 @@
|
|||
"10,22": {10: [1, 2, 3]},
|
||||
"11,23": {8: [6, 7, 8, 9, 10, 11]}
|
||||
},
|
||||
"getHour": function (date) {
|
||||
"getHour": function(date) {
|
||||
var hour = date.getHours();
|
||||
if (date.getMinutes() >= 35) {
|
||||
return (hour + 1) % 24;
|
||||
|
|
59
js/uhr-fr.js
59
js/uhr-fr.js
|
@ -12,7 +12,7 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
(function () {
|
||||
(function() {
|
||||
'use strict';
|
||||
var il_est = {1: [1, 2, 4, 5, 6]};
|
||||
var et = {8: [1, 2]};
|
||||
|
@ -57,20 +57,53 @@
|
|||
},
|
||||
"hours": {
|
||||
"0": {5: [6, 7, 8, 9, 10, 11]},
|
||||
"1,13": [{3: [5, 6, 7]}, heures],
|
||||
"2,14": [{1: [8, 9, 10, 11]}, heures],
|
||||
"3,15": [{2: [7, 8, 9, 10, 11]}, heures],
|
||||
"4,16": [{2: [1, 2, 3, 4, 5, 6]}, heures],
|
||||
"5,17": [{4: [8, 9, 10, 11]}, heures],
|
||||
"6,18": [{4: [5, 6, 7]}, heures],
|
||||
"7,19": [{3: [8, 9, 10, 11]}, heures],
|
||||
"8,20": [{4: [1, 2, 3, 4]}, heures],
|
||||
"9,21": [{3: [1, 2, 3, 4]}, heures],
|
||||
"10,22": [{5: [3, 4, 5]}, heures],
|
||||
"11,23": [{6: [1, 2, 3, 4]}, heures],
|
||||
"1,13": [
|
||||
{3: [5, 6, 7]},
|
||||
heures
|
||||
],
|
||||
"2,14": [
|
||||
{1: [8, 9, 10, 11]},
|
||||
heures
|
||||
],
|
||||
"3,15": [
|
||||
{2: [7, 8, 9, 10, 11]},
|
||||
heures
|
||||
],
|
||||
"4,16": [
|
||||
{2: [1, 2, 3, 4, 5, 6]},
|
||||
heures
|
||||
],
|
||||
"5,17": [
|
||||
{4: [8, 9, 10, 11]},
|
||||
heures
|
||||
],
|
||||
"6,18": [
|
||||
{4: [5, 6, 7]},
|
||||
heures
|
||||
],
|
||||
"7,19": [
|
||||
{3: [8, 9, 10, 11]},
|
||||
heures
|
||||
],
|
||||
"8,20": [
|
||||
{4: [1, 2, 3, 4]},
|
||||
heures
|
||||
],
|
||||
"9,21": [
|
||||
{3: [1, 2, 3, 4]},
|
||||
heures
|
||||
],
|
||||
"10,22": [
|
||||
{5: [3, 4, 5]},
|
||||
heures
|
||||
],
|
||||
"11,23": [
|
||||
{6: [1, 2, 3, 4]},
|
||||
heures
|
||||
],
|
||||
"12": {5: [1, 2, 3, 4]}
|
||||
},
|
||||
"getHour": function (date) {
|
||||
"getHour": function(date) {
|
||||
var hour = date.getHours();
|
||||
if (date.getMinutes() >= 35) {
|
||||
return (hour + 1) % 24;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
(function () {
|
||||
(function() {
|
||||
'use strict';
|
||||
var sono_le = {1: [1, 2, 3, 4, 6, 7]};
|
||||
var e_l = {2: [1, 3, 4]};
|
||||
|
@ -68,7 +68,7 @@
|
|||
"10,22": [sono_le, {4: [1, 2, 3, 4, 5]}],
|
||||
"11,23": [sono_le, {4: [6, 7, 8, 9, 10, 11]}]
|
||||
},
|
||||
"getHour": function (date) {
|
||||
"getHour": function(date) {
|
||||
var hour = date.getHours();
|
||||
if (date.getMinutes() >= 35) {
|
||||
return (hour + 1) % 24;
|
||||
|
|
82
js/uhr.js
82
js/uhr.js
|
@ -12,16 +12,17 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
(function ($) {
|
||||
(function($) {
|
||||
'use strict';
|
||||
var uhrGlobals = {
|
||||
"id": 0,
|
||||
"languages": [],
|
||||
"themes": [],
|
||||
registerLanguage: function registerLanguage(code, language) {
|
||||
var alreadyExists = uhrGlobals.languages.some(function (element) {
|
||||
var alreadyExists = uhrGlobals.languages.some(function(element) {
|
||||
if (code === element.code) {
|
||||
console.error("Error: Language code '" + code + "' cannot be registered for language '" + language.language + "' because it is already registered for language '" + element.language + "'!");
|
||||
console.error("Error: Language code '" + code + "' cannot be registered for language '" + language.language +
|
||||
"' because it is already registered for language '" + element.language + "'!");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -34,7 +35,7 @@
|
|||
};
|
||||
|
||||
// auto-detect themes
|
||||
$('link[rel=stylesheet]').each(function (index, item) {
|
||||
$('link[rel=stylesheet]').each(function(index, item) {
|
||||
var styleSheet = $(item);
|
||||
var styleClass = styleSheet.attr('data-class');
|
||||
if (styleClass !== undefined) {
|
||||
|
@ -53,7 +54,7 @@
|
|||
// public interface methods (exported later)
|
||||
var start = function start() {
|
||||
if (!isOn.bind(this)()) {
|
||||
this.timer = window.setInterval(function () {
|
||||
this.timer = window.setInterval(function() {
|
||||
this.options.time = new Date();
|
||||
update.bind(this)();
|
||||
}.bind(this), 1000);
|
||||
|
@ -80,7 +81,7 @@
|
|||
if (languageKey !== this.options.language) {
|
||||
this.options.language = languageKey;
|
||||
var renderer = new UhrRenderer(language.bind(this)(), this.element.find('.letterarea'));
|
||||
renderer.render.bind(this)(function () {
|
||||
renderer.render.bind(this)(function() {
|
||||
this.currentMinute = -1;
|
||||
update.bind(this)();
|
||||
}.bind(this));
|
||||
|
@ -152,7 +153,7 @@
|
|||
|
||||
if (this.options.controls) {
|
||||
var configlink = $('<a class="uhr-configlink" id="uhr-configlink' + this.id + '"></a>');
|
||||
configlink.on('click', function () {
|
||||
configlink.on('click', function() {
|
||||
showConfigScreen.bind(this)();
|
||||
}.bind(this));
|
||||
e.after(configlink);
|
||||
|
@ -161,17 +162,16 @@
|
|||
controlpanel.append(content);
|
||||
// on/off switch
|
||||
var toggleSwitch = $('<div class="onoffswitch" id="uhr-onoffswitch' + this.id + '"></div>');
|
||||
toggleSwitch.append('<input type="checkbox" class="onoffswitch-checkbox" id="uhr-onoffswitch-checkbox' + this.id + '" checked="checked" />');
|
||||
toggleSwitch.append('<label class="onoffswitch-label" for="uhr-onoffswitch-checkbox' + this.id + '">'
|
||||
+ '<div class="onoffswitch-inner"></div>'
|
||||
+ '<div class="onoffswitch-switch"></div>'
|
||||
+ '</label>');
|
||||
toggleSwitch.append('<input type="checkbox" class="onoffswitch-checkbox" id="uhr-onoffswitch-checkbox' + this.id +
|
||||
'" checked="checked" />');
|
||||
toggleSwitch.append('<label class="onoffswitch-label" for="uhr-onoffswitch-checkbox' + this.id + '">' +
|
||||
'<div class="onoffswitch-inner"></div>' + '<div class="onoffswitch-switch"></div>' + '</label>');
|
||||
content.append(toggleSwitch);
|
||||
|
||||
// language chooser
|
||||
if (uhrGlobals.languages.length > 1) {
|
||||
var languageChooser = $('<select id="uhr-languagechooser' + this.id + '"></select>');
|
||||
uhrGlobals.languages.forEach(function (item) {
|
||||
uhrGlobals.languages.forEach(function(item) {
|
||||
languageChooser.append('<option value="' + item.code + '">' + item.language + '</option>');
|
||||
});
|
||||
content.append(languageChooser);
|
||||
|
@ -180,13 +180,13 @@
|
|||
// theme chooser
|
||||
if (uhrGlobals.themes.length > 1) {
|
||||
var themeChooser = $('<select id="uhr-themechooser' + this.id + '"></select>');
|
||||
uhrGlobals.themes.forEach(function (item) {
|
||||
uhrGlobals.themes.forEach(function(item) {
|
||||
themeChooser.append('<option value="' + item.styleClass + '">' + item.name + '</option>');
|
||||
});
|
||||
content.append(themeChooser);
|
||||
}
|
||||
var closebutton = $('<a class="uhr-closecontrolpanel" id="uhr-closecontrolpanel' + this.id + '"></a>');
|
||||
closebutton.on('click', function () {
|
||||
closebutton.on('click', function() {
|
||||
$('#uhr-controlpanel' + this.id).fadeOut('fast');
|
||||
}.bind(this));
|
||||
content.append(closebutton);
|
||||
|
@ -197,7 +197,7 @@
|
|||
var wireFunctionality = function wireFunctionality() {
|
||||
// on/off switch
|
||||
var toggleSwitch = $('#uhr-onoffswitch-checkbox' + this.id);
|
||||
toggleSwitch.on('click', function () {
|
||||
toggleSwitch.on('click', function() {
|
||||
this.toggle();
|
||||
}.bind(this));
|
||||
var status = $.cookie('uhr-status' + this.id);
|
||||
|
@ -213,7 +213,7 @@
|
|||
|
||||
// language chooser
|
||||
var languageChooser = $('#uhr-languagechooser' + this.id);
|
||||
languageChooser.on('change', function () {
|
||||
languageChooser.on('change', function() {
|
||||
var languageKey = $('#uhr-languagechooser' + this.id).val();
|
||||
this.language(languageKey);
|
||||
}.bind(this));
|
||||
|
@ -221,7 +221,7 @@
|
|||
if (selectedLanguage === undefined || this.options.force) {
|
||||
selectedLanguage = this.options.language;
|
||||
}
|
||||
var found = uhrGlobals.languages.some(function (item) {
|
||||
var found = uhrGlobals.languages.some(function(item) {
|
||||
return selectedLanguage === item.code;
|
||||
});
|
||||
if (!found) {
|
||||
|
@ -240,7 +240,7 @@
|
|||
|
||||
// theme chooser
|
||||
var themeChooser = $('#uhr-themechooser' + this.id);
|
||||
themeChooser.on('change', function () {
|
||||
themeChooser.on('change', function() {
|
||||
var themeKey = $('#uhr-themechooser' + this.id).val();
|
||||
this.theme(themeKey);
|
||||
}.bind(this));
|
||||
|
@ -248,7 +248,7 @@
|
|||
if (selectedTheme === undefined || this.options.force) {
|
||||
selectedTheme = this.options.theme;
|
||||
}
|
||||
found = uhrGlobals.themes.some(function (item) {
|
||||
found = uhrGlobals.themes.some(function(item) {
|
||||
return selectedTheme === item.styleClass;
|
||||
});
|
||||
if (!found) {
|
||||
|
@ -260,7 +260,7 @@
|
|||
this.options.theme = "";
|
||||
this.theme(selectedTheme);
|
||||
if (this.options.autoresize) {
|
||||
$(window).on('resize', function () {
|
||||
$(window).on('resize', function() {
|
||||
var $e = this.element;
|
||||
var $parent = $e.parent();
|
||||
var $window = $(window);
|
||||
|
@ -353,7 +353,7 @@
|
|||
};
|
||||
|
||||
var language = function language() {
|
||||
var matchingLanguages = uhrGlobals.languages.filter(function (element) {
|
||||
var matchingLanguages = uhrGlobals.languages.filter(function(element) {
|
||||
return (element.code === this.options.language);
|
||||
}, this);
|
||||
if (matchingLanguages.length > 0) {
|
||||
|
@ -394,21 +394,21 @@
|
|||
this.render = function render(beforeshow) {
|
||||
if (layout.parsed === undefined) {
|
||||
switch (layout.version) {
|
||||
case 2:
|
||||
var delegate = new UhrRendererV2Delegate(layout);
|
||||
var parsedLayout = delegate.parse();
|
||||
Object.defineProperty(layout, "parsed", {"value": parsedLayout, "writable": false, "configurable": false});
|
||||
break;
|
||||
default:
|
||||
console.warn("Unknown layout version: '" + layout.version + "'");
|
||||
return;
|
||||
case 2:
|
||||
var delegate = new UhrRendererV2Delegate(layout);
|
||||
var parsedLayout = delegate.parse();
|
||||
Object.defineProperty(layout, "parsed", {"value": parsedLayout, "writable": false, "configurable": false});
|
||||
break;
|
||||
default:
|
||||
console.warn("Unknown layout version: '" + layout.version + "'");
|
||||
return;
|
||||
}
|
||||
}
|
||||
var letters = layout.parsed;
|
||||
renderarea.fadeOut('fast', function () {
|
||||
renderarea.fadeOut('fast', function() {
|
||||
renderarea.empty();
|
||||
letters.forEach(function (line, index, array) {
|
||||
line.forEach(function (letter) {
|
||||
letters.forEach(function(line, index, array) {
|
||||
line.forEach(function(letter) {
|
||||
renderarea.append(letter.toString());
|
||||
});
|
||||
if (index < array.length - 1) {
|
||||
|
@ -427,7 +427,7 @@
|
|||
function parseArrayOrObject(letters, styleClass, input) {
|
||||
if (typeof input !== 'undefined' && input !== null) {
|
||||
if (Array.isArray(input)) {
|
||||
input.forEach(function (item) {
|
||||
input.forEach(function(item) {
|
||||
parseObject(letters, styleClass, item);
|
||||
});
|
||||
} else {
|
||||
|
@ -438,9 +438,9 @@
|
|||
|
||||
function parseObject(letters, styleClass, object) {
|
||||
if (typeof object !== 'undefined' && object !== null) {
|
||||
Object.keys(object).forEach(function (y) {
|
||||
Object.keys(object).forEach(function(y) {
|
||||
var highlightLetters = object[y];
|
||||
highlightLetters.forEach(function (x) {
|
||||
highlightLetters.forEach(function(x) {
|
||||
letters[y - 1][x - 1].addStyle(styleClass);
|
||||
});
|
||||
});
|
||||
|
@ -449,10 +449,10 @@
|
|||
|
||||
function parseTimeDefinition(letters, styleClass, definition) {
|
||||
if (typeof definition !== 'undefined' && definition !== null) {
|
||||
Object.keys(definition).forEach(function (listString) {
|
||||
Object.keys(definition).forEach(function(listString) {
|
||||
var array = listString.split(',');
|
||||
var highlightLetters = definition[listString];
|
||||
array.forEach(function (item) {
|
||||
array.forEach(function(item) {
|
||||
parseArrayOrObject(letters, styleClass + item, highlightLetters);
|
||||
});
|
||||
});
|
||||
|
@ -461,7 +461,7 @@
|
|||
|
||||
this.parse = function parse() {
|
||||
var letters = [];
|
||||
layout.letters.forEach(function (string) {
|
||||
layout.letters.forEach(function(string) {
|
||||
var line = [];
|
||||
for (var c = 0; c < string.length; c++) {
|
||||
var character = new Letter(string[c]);
|
||||
|
@ -485,14 +485,14 @@
|
|||
function Letter(value, style) {
|
||||
var myValue = value;
|
||||
var myStyle = style || '';
|
||||
this.addStyle = function (style) {
|
||||
this.addStyle = function(style) {
|
||||
if (myStyle === '') {
|
||||
myStyle = style;
|
||||
} else {
|
||||
myStyle += ' ' + style;
|
||||
}
|
||||
};
|
||||
this.toString = function () {
|
||||
this.toString = function() {
|
||||
return '<span class="item letter ' + myStyle + '">' + myValue + '</span>';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue