some JSHint'ing and reorganizing of the project-structure
This commit is contained in:
parent
340669c5eb
commit
afe923c136
25 changed files with 182 additions and 104 deletions
78
.jshintrc
Normal file
78
.jshintrc
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
{
|
||||||
|
// Settings
|
||||||
|
"passfail" : false, // Stop on first error.
|
||||||
|
"maxerr" : 100, // Maximum error before stopping.
|
||||||
|
|
||||||
|
|
||||||
|
// Predefined globals whom JSHint will ignore.
|
||||||
|
"browser" : true, // Standard browser globals e.g. `window`, `document`.
|
||||||
|
|
||||||
|
"node" : false,
|
||||||
|
"rhino" : false,
|
||||||
|
"couch" : false,
|
||||||
|
"wsh" : true, // Windows Scripting Host.
|
||||||
|
|
||||||
|
"jquery" : true,
|
||||||
|
"ender" : true,
|
||||||
|
"prototypejs" : false,
|
||||||
|
"mootools" : false,
|
||||||
|
"dojo" : false,
|
||||||
|
|
||||||
|
"predef" : [
|
||||||
|
// "define",
|
||||||
|
// "suite",
|
||||||
|
// "test",
|
||||||
|
// "teardown",
|
||||||
|
// "setup",
|
||||||
|
// "sinon",
|
||||||
|
// "mocha",
|
||||||
|
// "requirejs"
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
// Development.
|
||||||
|
"debug" : false, // Allow debugger statements e.g. browser breakpoints.
|
||||||
|
"devel" : true, // Allow developments statements e.g. `console.log();`.
|
||||||
|
|
||||||
|
|
||||||
|
// ECMAScript 5.
|
||||||
|
"es5" : true, // Allow ECMAScript 5 syntax.
|
||||||
|
"strict" : true, // Require `use strict` pragma in every file.
|
||||||
|
"globalstrict" : true, // Allow global "use strict" (also enables 'strict').
|
||||||
|
|
||||||
|
|
||||||
|
// The Good Parts.
|
||||||
|
"asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons).
|
||||||
|
"laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
|
||||||
|
"bitwise" : true, // Prohibit bitwise operators (&, |, ^, etc.).
|
||||||
|
"boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
|
||||||
|
"curly" : true, // Require {} for every new block or scope.
|
||||||
|
"eqeqeq" : true, // Require triple equals i.e. `===`.
|
||||||
|
"eqnull" : false, // Tolerate use of `== null`.
|
||||||
|
"evil" : false, // Tolerate use of `eval`.
|
||||||
|
"expr" : false, // Tolerate `ExpressionStatement` as Programs.
|
||||||
|
"forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`.
|
||||||
|
"immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
|
||||||
|
"latedef" : true, // Prohipit variable use before definition.
|
||||||
|
"loopfunc" : false, // Allow functions to be defined within loops.
|
||||||
|
"noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
|
||||||
|
"regexp" : true, // Prohibit `.` and `[^...]` in regular expressions.
|
||||||
|
"regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`.
|
||||||
|
"scripturl" : true, // Tolerate script-targeted URLs.
|
||||||
|
"shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`.
|
||||||
|
"supernew" : false, // Tolerate `new function () { ... };` and `new Object;`.
|
||||||
|
"undef" : true, // Require all non-global variables be declared before they are used.
|
||||||
|
|
||||||
|
|
||||||
|
// Personal styling preferences.
|
||||||
|
"newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`.
|
||||||
|
"noempty" : true, // Prohibit use of empty blocks.
|
||||||
|
"nonew" : true, // Prohibit use of constructors for side-effects.
|
||||||
|
"nomen" : true, // Prohibit use of initial or trailing underbars in names.
|
||||||
|
"onevar" : false, // Allow only one `var` statement per function.
|
||||||
|
"plusplus" : false, // Prohibit use of `++` & `--`.
|
||||||
|
"sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
|
||||||
|
"trailing" : true, // Prohibit trailing whitespaces.
|
||||||
|
"white" : true, // Check against strict whitespace and indentation rules.
|
||||||
|
"indent" : 0 // Specify indentation spacing
|
||||||
|
}
|
18
index.html
18
index.html
|
@ -21,19 +21,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||||
<meta name="apple-mobile-web-app-title" content="Bärneruhr" />
|
<meta name="apple-mobile-web-app-title" content="Bärneruhr" />
|
||||||
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1" />
|
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1" />
|
||||||
<link rel="stylesheet" type="text/css" href="uhr.css" />
|
<link rel="stylesheet" type="text/css" href="css/uhr.css" />
|
||||||
<link rel="stylesheet" type="text/css" href="uhr-black.css" data-class="black" data-name="Schwarz" />
|
<link rel="stylesheet" type="text/css" href="css/uhr-black.css" data-class="black" data-name="Schwarz" />
|
||||||
<link rel="shortcut icon" type="image/png" href="favicon.png" />
|
<link rel="shortcut icon" type="image/png" href="resources/favicon.png" />
|
||||||
<link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png" />
|
<link rel="apple-touch-icon-precomposed" href="resources/apple-touch-icon-precomposed.png" />
|
||||||
<script type="text/javascript" src="jquery-2.1.0.min.js"></script>
|
<script type="text/javascript" src="lib/jquery-2.1.0.min.js"></script>
|
||||||
<script type="text/javascript" src="jquery-ui-1.10.4.custom.min.js"></script>
|
<script type="text/javascript" src="lib/jquery-ui-1.10.4.custom.min.js"></script>
|
||||||
<script type="text/javascript" src="jquery-cookie-1.4.0.js"></script>
|
<script type="text/javascript" src="lib/jquery-cookie-1.4.0.js"></script>
|
||||||
<script type="text/javascript" src="uhr.js"></script>
|
<script type="text/javascript" src="js/uhr.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body style="padding:0;margin:0;">
|
<body style="padding:0;margin:0;">
|
||||||
<div id="uhr"></div>
|
<div id="uhr"></div>
|
||||||
<p id="disclaimer">Created by <a href="http://www.fritteli.ch/">fritteli</a>, inspired by <a href="http://www.qlocktwo.com/">QLOCKTWO</a>. <a href="info/">Read more!</a> - <a href="showcase">View full showcase!</a></p>
|
<p id="disclaimer">Created by <a href="http://www.fritteli.ch/">fritteli</a>, inspired by <a href="http://www.qlocktwo.com/">QLOCKTWO</a>. <a href="info/">Read more!</a> - <a href="showcase">View full showcase!</a></p>
|
||||||
<script type="text/javascript" src="uhr-de_CH.js"></script>
|
<script type="text/javascript" src="js/uhr-de_CH.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
(function($) {
|
(function($) {
|
||||||
var width = $(window).width();
|
var width = $(window).width();
|
||||||
|
|
|
@ -18,15 +18,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
<title>Die Zeit im Wort - Informationen</title>
|
<title>Die Zeit im Wort - Informationen</title>
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width,user-scalable=yes,initial-scale=1" />
|
<meta name="viewport" content="width=device-width,user-scalable=yes,initial-scale=1" />
|
||||||
<link rel="stylesheet" type="text/css" href="../uhr.css" />
|
<link rel="stylesheet" type="text/css" href="../css/uhr.css" />
|
||||||
<link rel="stylesheet" type="text/css" href="../uhr-black.css" data-class="black" />
|
<link rel="stylesheet" type="text/css" href="../css/uhr-black.css" data-class="black" />
|
||||||
<link rel="stylesheet" type="text/css" href="info.css" />
|
<link rel="stylesheet" type="text/css" href="info.css" />
|
||||||
<link rel="shortcut icon" type="image/png" href="../favicon.png" />
|
<link rel="shortcut icon" type="image/png" href="../resources/favicon.png" />
|
||||||
<script type="text/javascript" src="../jquery-2.1.0.min.js"></script>
|
<script type="text/javascript" src="../lib/jquery-2.1.0.min.js"></script>
|
||||||
<script type="text/javascript" src="../jquery-ui-1.10.4.custom.min.js"></script>
|
<script type="text/javascript" src="../lib/jquery-ui-1.10.4.custom.min.js"></script>
|
||||||
<script type="text/javascript" src="../jquery-cookie-1.4.0.js"></script>
|
<script type="text/javascript" src="../lib/jquery-cookie-1.4.0.js"></script>
|
||||||
<script type="text/javascript" src="../uhr.js"></script>
|
<script type="text/javascript" src="../js/uhr.js"></script>
|
||||||
<script type="text/javascript" src="../uhr-de_CH.js"></script>
|
<script type="text/javascript" src="../js/uhr-de_CH.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1 id="main-title">Die Zeit im Wort</h1>
|
<h1 id="main-title">Die Zeit im Wort</h1>
|
||||||
|
|
|
@ -67,4 +67,4 @@ var layout = {
|
||||||
"11,23": {5:[6,7,8]}
|
"11,23": {5:[6,7,8]}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
window,_uhr.register('de', layout);
|
window,uhr.register('de', layout);
|
|
@ -93,4 +93,4 @@ var layout = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// Das Layout bei der Uhr unter dem Code "de_CH" registrieren.
|
// Das Layout bei der Uhr unter dem Code "de_CH" registrieren.
|
||||||
window,_uhr.register('de_CH', layout);
|
window,uhr.register('de_CH', layout);
|
|
@ -68,4 +68,4 @@ var layout = {
|
||||||
"11,23": {9:[8,9,10,11]}
|
"11,23": {9:[8,9,10,11]}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
window,_uhr.register('de_CH_genau', layout);
|
window,uhr.register('de_CH_genau', layout);
|
|
@ -76,4 +76,4 @@ var layout = {
|
||||||
return hour;
|
return hour;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
window,_uhr.register('en', layout);
|
window,uhr.register('en', layout);
|
|
@ -78,4 +78,4 @@ var layout = {
|
||||||
return hour;
|
return hour;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
window,_uhr.register('fr', layout);
|
window,uhr.register('fr', layout);
|
|
@ -75,4 +75,4 @@ var layout = {
|
||||||
return hour;
|
return hour;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
window,_uhr.register('it', layout);
|
window,uhr.register('it', layout);
|
|
@ -12,20 +12,20 @@ GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
(function($) {
|
(function ($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
if (window._uhr !== undefined) {
|
if (window.uhr !== undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
window._uhr = {
|
window.uhr = {
|
||||||
id: 0,
|
id: 0,
|
||||||
languages: [],
|
languages: [],
|
||||||
themes: [],
|
themes: [],
|
||||||
register: function(code, language) {
|
register: function (code, language) {
|
||||||
for (var i = 0; i < this.languages.length; i++) {
|
for (var i = 0; i < this.languages.length; i++) {
|
||||||
if (code == this.languages[i].code) {
|
if (code === this.languages[i].code) {
|
||||||
console.error('Error: Language code ' + code + ' cannot be registered for language "' + language.language + '" because it is already registered for language "' + this.languages[i].language + '"!');
|
console.error('Error: Language code ' + code + ' cannot be registered for language "' + language.language + '" because it is already registered for language "' + this.languages[i].language + '"!');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -44,23 +44,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
if (name === undefined) {
|
if (name === undefined) {
|
||||||
name = styleClass;
|
name = styleClass;
|
||||||
}
|
}
|
||||||
window._uhr.themes.push({'styleClass': styleClass, 'name': name});
|
window.uhr.themes.push({'styleClass': styleClass, 'name': name});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// fall-back if no theme was included
|
// fall-back if no theme was included
|
||||||
if (window._uhr.themes.length == 0) {
|
if (window.uhr.themes.length === 0) {
|
||||||
window._uhr.themes.push({});
|
window.uhr.themes.push({});
|
||||||
}
|
}
|
||||||
$.widget("fritteli.uhr", {
|
$.widget("fritteli.uhr", {
|
||||||
options: {
|
options: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
status: 'on',
|
status: 'on',
|
||||||
language: 'de_CH',
|
language: 'de_CH',
|
||||||
theme: window._uhr.themes[0].styleClass,
|
theme: window.uhr.themes[0].styleClass,
|
||||||
force: false,
|
force: false,
|
||||||
controls: true
|
controls: true
|
||||||
},
|
},
|
||||||
start: function() {
|
start: function () {
|
||||||
if (!this._isOn()) {
|
if (!this._isOn()) {
|
||||||
var uhr = this;
|
var uhr = this;
|
||||||
this._timer = window.setInterval(function() {
|
this._timer = window.setInterval(function() {
|
||||||
|
@ -72,22 +72,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
stop: function() {
|
stop: function () {
|
||||||
if(this._isOn()) {
|
if (this._isOn()) {
|
||||||
window.clearInterval(this._timer);
|
window.clearInterval(this._timer);
|
||||||
this._timer = null;
|
this._timer = null;
|
||||||
this._update();
|
this._update();
|
||||||
this._setCookie('uhr-status', 'off');
|
this._setCookie('uhr-status', 'off');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
toggle: function() {
|
toggle: function () {
|
||||||
if(this._isOn()) {
|
if (this._isOn()) {
|
||||||
this.stop();
|
this.stop();
|
||||||
} else {
|
} else {
|
||||||
this.start();
|
this.start();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
language: function(languageKey) {
|
language: function (languageKey) {
|
||||||
if (languageKey !== this.options.language) {
|
if (languageKey !== this.options.language) {
|
||||||
this.options.language = languageKey;
|
this.options.language = languageKey;
|
||||||
var renderer = new UhrRenderer(this._language(), this.element.find('.letterarea'));
|
var renderer = new UhrRenderer(this._language(), this.element.find('.letterarea'));
|
||||||
|
@ -100,20 +100,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
this._update();
|
this._update();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
theme: function(theme) {
|
theme: function (theme) {
|
||||||
if (theme != this.options.theme) {
|
if (theme !== this.options.theme) {
|
||||||
this.element.removeClass(this.options.theme).addClass(theme);
|
this.element.removeClass(this.options.theme).addClass(theme);
|
||||||
$('#uhr-onoffswitch' + this._id).removeClass(this.options.theme).addClass(theme);
|
$('#uhr-onoffswitch' + this._id).removeClass(this.options.theme).addClass(theme);
|
||||||
this.options.theme = theme;
|
this.options.theme = theme;
|
||||||
this._setCookie('uhr-theme', theme);
|
this._setCookie('uhr-theme', theme);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
time: function(time) {
|
time: function (time) {
|
||||||
this._currentMinute = -1;
|
this._currentMinute = -1;
|
||||||
if (time == null) {
|
if (time === null) {
|
||||||
this.options.time = new Date();
|
this.options.time = new Date();
|
||||||
} else {
|
} else {
|
||||||
if (this._timer != null) {
|
if (this._timer !== null) {
|
||||||
window.clearInterval(this._timer);
|
window.clearInterval(this._timer);
|
||||||
}
|
}
|
||||||
this.options.time = time;
|
this.options.time = time;
|
||||||
|
@ -125,13 +125,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
_timer: null,
|
_timer: null,
|
||||||
_currentMinute: -1,
|
_currentMinute: -1,
|
||||||
// private methods
|
// private methods
|
||||||
_isOn: function() {
|
_isOn: function () {
|
||||||
return this._timer !== null;
|
return this._timer !== null;
|
||||||
},
|
},
|
||||||
_update: function() {
|
_update: function () {
|
||||||
if (this._isOn()) {
|
if (this._isOn()) {
|
||||||
var time = this.options.time;
|
var time = this.options.time;
|
||||||
if (time.getMinutes() == this._currentMinute) {
|
if (time.getMinutes() === this._currentMinute) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._currentMinute = time.getMinutes();
|
this._currentMinute = time.getMinutes();
|
||||||
|
@ -141,7 +141,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
this._currentMinute = -1;
|
this._currentMinute = -1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_show: function(time) {
|
_show: function (time) {
|
||||||
var dotMinute = this._getDotMinute(time);
|
var dotMinute = this._getDotMinute(time);
|
||||||
var hour = this._getHour(time);
|
var hour = this._getHour(time);
|
||||||
var coarseMinute = this._getCoarseMinute(time);
|
var coarseMinute = this._getCoarseMinute(time);
|
||||||
|
@ -153,9 +153,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
this._highlight('minute' + coarseMinute);
|
this._highlight('minute' + coarseMinute);
|
||||||
this._highlight('hour' + hour);
|
this._highlight('hour' + hour);
|
||||||
},
|
},
|
||||||
_language: function() {
|
_language: function () {
|
||||||
for (var i = 0; i < window._uhr.languages.length; i++) {
|
for (var i = 0; i < window.uhr.languages.length; i++) {
|
||||||
var language = window._uhr.languages[i];
|
var language = window.uhr.languages[i];
|
||||||
if (language.code == this.options.language) {
|
if (language.code == this.options.language) {
|
||||||
return language;
|
return language;
|
||||||
}
|
}
|
||||||
|
@ -163,13 +163,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
// fallback: return empty object
|
// fallback: return empty object
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
_highlight: function(itemClass) {
|
_highlight: function (itemClass) {
|
||||||
this.element.find('.item.' + itemClass).addClass('active');
|
this.element.find('.item.' + itemClass).addClass('active');
|
||||||
},
|
},
|
||||||
_clear: function() {
|
_clear: function () {
|
||||||
this.element.find('.item').removeClass('active');
|
this.element.find('.item').removeClass('active');
|
||||||
},
|
},
|
||||||
_getHour: function(date) {
|
_getHour: function (date) {
|
||||||
if (typeof this._language().getHour === 'function') {
|
if (typeof this._language().getHour === 'function') {
|
||||||
return this._language().getHour(date);
|
return this._language().getHour(date);
|
||||||
}
|
}
|
||||||
|
@ -179,21 +179,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
}
|
}
|
||||||
return hour;
|
return hour;
|
||||||
},
|
},
|
||||||
_getCoarseMinute: function(date) {
|
_getCoarseMinute: function (date) {
|
||||||
if (typeof this._language().getCoarseMinute === 'function') {
|
if (typeof this._language().getCoarseMinute === 'function') {
|
||||||
return this._language().getCoarseMinute(date);
|
return this._language().getCoarseMinute(date);
|
||||||
}
|
}
|
||||||
return date.getMinutes();
|
return date.getMinutes();
|
||||||
},
|
},
|
||||||
_getDotMinute: function(date) {
|
_getDotMinute: function (date) {
|
||||||
if (typeof this._language().getDotMinute === 'function') {
|
if (typeof this._language().getDotMinute === 'function') {
|
||||||
return this._language().getDotMinute(date);
|
return this._language().getDotMinute(date);
|
||||||
}
|
}
|
||||||
var minutes = date.getMinutes();
|
var minutes = date.getMinutes();
|
||||||
return minutes % 5;
|
return minutes % 5;
|
||||||
},
|
},
|
||||||
_create: function() {
|
_create: function () {
|
||||||
this._id = window._uhr.id++;
|
this._id = window.uhr.id++;
|
||||||
var userTime = this.options.time;
|
var userTime = this.options.time;
|
||||||
if (this.options.time === undefined) {
|
if (this.options.time === undefined) {
|
||||||
this.options.time = new Date();
|
this.options.time = new Date();
|
||||||
|
@ -204,7 +204,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
this.time(userTime);
|
this.time(userTime);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_setupHTML: function() {
|
_setupHTML: function () {
|
||||||
var e = this.element;
|
var e = this.element;
|
||||||
// Base clock area
|
// Base clock area
|
||||||
e.addClass('uhr');
|
e.addClass('uhr');
|
||||||
|
@ -232,40 +232,40 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
e.after(toggleSwitch);
|
e.after(toggleSwitch);
|
||||||
|
|
||||||
// language chooser
|
// language chooser
|
||||||
if (window._uhr.languages.length > 1) {
|
if (window.uhr.languages.length > 1) {
|
||||||
var languageChooser = $('<select id="uhr-languagechooser' + this._id + '"></select>');
|
var languageChooser = $('<select id="uhr-languagechooser' + this._id + '"></select>');
|
||||||
for (var i = 0; i < window._uhr.languages.length; i++) {
|
for (var i = 0; i < window.uhr.languages.length; i++) {
|
||||||
var language = window._uhr.languages[i];
|
var language = window.uhr.languages[i];
|
||||||
languageChooser.append('<option value="' + language.code + '">' + language.language + '</option>');
|
languageChooser.append('<option value="' + language.code + '">' + language.language + '</option>');
|
||||||
}
|
}
|
||||||
e.after(languageChooser);
|
e.after(languageChooser);
|
||||||
}
|
}
|
||||||
|
|
||||||
// theme chooser
|
// theme chooser
|
||||||
if (window._uhr.themes.length > 1) {
|
if (window.uhr.themes.length > 1) {
|
||||||
var themeChooser = $('<select id="uhr-themechooser' + this._id + '"></select>');
|
var themeChooser = $('<select id="uhr-themechooser' + this._id + '"></select>');
|
||||||
for (var i = 0; i < window._uhr.themes.length; i++) {
|
for (var i = 0; i < window.uhr.themes.length; i++) {
|
||||||
var theme = window._uhr.themes[i];
|
var theme = window.uhr.themes[i];
|
||||||
themeChooser.append('<option value="' + theme.styleClass + '">' + theme.name + '</option>');
|
themeChooser.append('<option value="' + theme.styleClass + '">' + theme.name + '</option>');
|
||||||
}
|
}
|
||||||
e.after(themeChooser);
|
e.after(themeChooser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_wireFunctionality: function() {
|
_wireFunctionality: function () {
|
||||||
var uhr = this;
|
var uhr = this;
|
||||||
|
|
||||||
// on/off switch
|
// on/off switch
|
||||||
var toggleSwitch = $('#uhr-onoffswitch-checkbox' + this._id);
|
var toggleSwitch = $('#uhr-onoffswitch-checkbox' + this._id);
|
||||||
toggleSwitch.on('click', function() {
|
toggleSwitch.on('click', function () {
|
||||||
uhr.toggle();
|
uhr.toggle();
|
||||||
});
|
});
|
||||||
var status = $.cookie('uhr-status' + this._id);
|
var status = $.cookie('uhr-status' + this._id);
|
||||||
if (status == undefined || this.options.force) {
|
if (status === undefined || this.options.force) {
|
||||||
status = this.options.status;
|
status = this.options.status;
|
||||||
}
|
}
|
||||||
toggleSwitch.prop('checked', status == 'on');
|
toggleSwitch.prop('checked', status === 'on');
|
||||||
if (status == 'on') {
|
if (status === 'on') {
|
||||||
this.start();
|
this.start();
|
||||||
} else {
|
} else {
|
||||||
this.stop();
|
this.stop();
|
||||||
|
@ -273,25 +273,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// language chooser
|
// language chooser
|
||||||
var languageChooser = $('#uhr-languagechooser' + this._id);
|
var languageChooser = $('#uhr-languagechooser' + this._id);
|
||||||
languageChooser.on('change', function() {
|
languageChooser.on('change', function () {
|
||||||
uhr.language(this.value);
|
uhr.language(this.value);
|
||||||
});
|
});
|
||||||
var selectedLanguage = $.cookie('uhr-language' + this._id);
|
var selectedLanguage = $.cookie('uhr-language' + this._id);
|
||||||
if (selectedLanguage == undefined || this.options.force) {
|
if (selectedLanguage === undefined || this.options.force) {
|
||||||
selectedLanguage = this.options.language;
|
selectedLanguage = this.options.language;
|
||||||
}
|
}
|
||||||
var found = false;
|
var found = false;
|
||||||
for (var i = 0; i < window._uhr.languages.length; i++) {
|
for (var i = 0; i < window.uhr.languages.length; i++) {
|
||||||
var code = window._uhr.languages[i].code;
|
var code = window.uhr.languages[i].code;
|
||||||
if (selectedLanguage == code) {
|
if (selectedLanguage === code) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
var fallback;
|
var fallback;
|
||||||
if (window._uhr.languages.length > 0) {
|
if (window.uhr.languages.length > 0) {
|
||||||
fallback = window._uhr.languages[0].code;
|
fallback = window.uhr.languages[0].code;
|
||||||
} else {
|
} else {
|
||||||
fallback = '';
|
fallback = '';
|
||||||
}
|
}
|
||||||
|
@ -304,23 +304,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// theme chooser
|
// theme chooser
|
||||||
var themeChooser = $('#uhr-themechooser' + this._id);
|
var themeChooser = $('#uhr-themechooser' + this._id);
|
||||||
themeChooser.on('change', function() {
|
themeChooser.on('change', function () {
|
||||||
uhr.theme(this.value);
|
uhr.theme(this.value);
|
||||||
});
|
});
|
||||||
var selectedTheme = $.cookie('uhr-theme' + this._id);
|
var selectedTheme = $.cookie('uhr-theme' + this._id);
|
||||||
if (selectedTheme == undefined || this.options.force) {
|
if (selectedTheme === undefined || this.options.force) {
|
||||||
selectedTheme = this.options.theme;
|
selectedTheme = this.options.theme;
|
||||||
}
|
}
|
||||||
found = false;
|
found = false;
|
||||||
for (var i = 0; i < window._uhr.themes.length; i++) {
|
for (var i = 0; i < window.uhr.themes.length; i++) {
|
||||||
var styleClass = window._uhr.themes[i].styleClass;
|
var styleClass = window.uhr.themes[i].styleClass;
|
||||||
if (selectedTheme == styleClass) {
|
if (selectedTheme === styleClass) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
var fallback = window._uhr.themes[0].styleClass;
|
var fallback = window.uhr.themes[0].styleClass;
|
||||||
console.warn("Theme " + selectedTheme + " not found! Using fallback: " + fallback);
|
console.warn("Theme " + selectedTheme + " not found! Using fallback: " + fallback);
|
||||||
selectedTheme = fallback;
|
selectedTheme = fallback;
|
||||||
}
|
}
|
||||||
|
@ -328,7 +328,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
this.options.theme = "";
|
this.options.theme = "";
|
||||||
this.theme(selectedTheme);
|
this.theme(selectedTheme);
|
||||||
},
|
},
|
||||||
_setCookie: function(cookieName, cookieValue) {
|
_setCookie: function (cookieName, cookieValue) {
|
||||||
var options = {};
|
var options = {};
|
||||||
if (this.options.cookiePath !== undefined) {
|
if (this.options.cookiePath !== undefined) {
|
||||||
options = {expires: 365, path: this.options.cookiePath};
|
options = {expires: 365, path: this.options.cookiePath};
|
||||||
|
@ -347,7 +347,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
this.layout = layout;
|
this.layout = layout;
|
||||||
this.renderarea = renderarea;
|
this.renderarea = renderarea;
|
||||||
}
|
}
|
||||||
UhrRenderer.prototype.render = function(uhr, beforeshow) {
|
UhrRenderer.prototype.render = function (uhr, beforeshow) {
|
||||||
var renderer = this;
|
var renderer = this;
|
||||||
if (this.layout._parsed === undefined) {
|
if (this.layout._parsed === undefined) {
|
||||||
switch (this.layout.version) {
|
switch (this.layout.version) {
|
||||||
|
@ -361,7 +361,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var letters = this.layout._parsed;
|
var letters = this.layout._parsed;
|
||||||
this.renderarea.fadeOut('fast', function() {
|
this.renderarea.fadeOut('fast', function () {
|
||||||
renderer.renderarea.empty();
|
renderer.renderarea.empty();
|
||||||
for (var y = 0; y < letters.length; y++) {
|
for (var y = 0; y < letters.length; y++) {
|
||||||
for (var x = 0; x < letters[y].length; x++) {
|
for (var x = 0; x < letters[y].length; x++) {
|
||||||
|
@ -380,7 +380,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
};
|
};
|
||||||
function _UhrRendererV2Delegate(layout) {
|
function _UhrRendererV2Delegate(layout) {
|
||||||
this.layout = layout;
|
this.layout = layout;
|
||||||
this._parseArrayOrObject = function(letters, styleClass, input) {
|
this._parseArrayOrObject = function (letters, styleClass, input) {
|
||||||
if (Array.isArray(input)) {
|
if (Array.isArray(input)) {
|
||||||
for (var i = 0; i < input.length; i++) {
|
for (var i = 0; i < input.length; i++) {
|
||||||
this._parseObject(letters, styleClass, input[i]);
|
this._parseObject(letters, styleClass, input[i]);
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
@ -21,30 +21,30 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||||
<meta name="apple-mobile-web-app-title" content="Bärneruhr" />
|
<meta name="apple-mobile-web-app-title" content="Bärneruhr" />
|
||||||
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1" />
|
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1" />
|
||||||
<link rel="stylesheet" type="text/css" href="../uhr.css" />
|
<link rel="stylesheet" type="text/css" href="../css/uhr.css" />
|
||||||
<link rel="stylesheet" type="text/css" href="../uhr-black.css" data-class="black" data-name="Schwarz" />
|
<link rel="stylesheet" type="text/css" href="../css/uhr-black.css" data-class="black" data-name="Schwarz" />
|
||||||
<link rel="stylesheet" type="text/css" href="../uhr-white.css" data-class="white" data-name="Weiss" />
|
<link rel="stylesheet" type="text/css" href="../css/uhr-white.css" data-class="white" data-name="Weiss" />
|
||||||
<link rel="stylesheet" type="text/css" href="../uhr-red.css" data-class="red" data-name="Rot" />
|
<link rel="stylesheet" type="text/css" href="../css/uhr-red.css" data-class="red" data-name="Rot" />
|
||||||
<link rel="stylesheet" type="text/css" href="../uhr-green.css" data-class="green" data-name="Grün" />
|
<link rel="stylesheet" type="text/css" href="../css/uhr-green.css" data-class="green" data-name="Grün" />
|
||||||
<link rel="stylesheet" type="text/css" href="../uhr-yellow.css" data-class="yellow" data-name="Gelb" />
|
<link rel="stylesheet" type="text/css" href="../css/uhr-yellow.css" data-class="yellow" data-name="Gelb" />
|
||||||
<link rel="stylesheet" type="text/css" href="../uhr-blue.css" data-class="blue" data-name="Blau" />
|
<link rel="stylesheet" type="text/css" href="../css/uhr-blue.css" data-class="blue" data-name="Blau" />
|
||||||
<link rel="stylesheet" type="text/css" href="../uhr-pink.css" data-class="pink" data-name="Pink" />
|
<link rel="stylesheet" type="text/css" href="../css/uhr-pink.css" data-class="pink" data-name="Pink" />
|
||||||
<link rel="shortcut icon" type="image/png" href="favicon.png" />
|
<link rel="shortcut icon" type="image/png" href="favicon.png" />
|
||||||
<link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png" />
|
<link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png" />
|
||||||
<script type="text/javascript" src="../jquery-2.1.0.min.js"></script>
|
<script type="text/javascript" src="../lib/jquery-2.1.0.min.js"></script>
|
||||||
<script type="text/javascript" src="../jquery-ui-1.10.4.custom.min.js"></script>
|
<script type="text/javascript" src="../lib/jquery-ui-1.10.4.custom.min.js"></script>
|
||||||
<script type="text/javascript" src="../jquery-cookie-1.4.0.js"></script>
|
<script type="text/javascript" src="../lib/jquery-cookie-1.4.0.js"></script>
|
||||||
<script type="text/javascript" src="../uhr.js"></script>
|
<script type="text/javascript" src="../js/uhr.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body style="padding:0;margin:0;">
|
<body style="padding:0;margin:0;">
|
||||||
<div id="uhr"></div>
|
<div id="uhr"></div>
|
||||||
<p ><a href="..">Go back to the main page</a></p>
|
<p ><a href="..">Go back to the main page</a></p>
|
||||||
<script type="text/javascript" src="../uhr-de_CH.js"></script>
|
<script type="text/javascript" src="../js/uhr-de_CH.js"></script>
|
||||||
<script type="text/javascript" src="../uhr-de_CH_genau.js"></script>
|
<script type="text/javascript" src="../js/uhr-de_CH_genau.js"></script>
|
||||||
<script type="text/javascript" src="../uhr-de.js"></script>
|
<script type="text/javascript" src="../js/uhr-de.js"></script>
|
||||||
<script type="text/javascript" src="../uhr-en.js"></script>
|
<script type="text/javascript" src="../js/uhr-en.js"></script>
|
||||||
<script type="text/javascript" src="../uhr-fr.js"></script>
|
<script type="text/javascript" src="../js/uhr-fr.js"></script>
|
||||||
<script type="text/javascript" src="../uhr-it.js"></script>
|
<script type="text/javascript" src="../js/uhr-it.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
(function($) {
|
(function($) {
|
||||||
var width = $(window).width();
|
var width = $(window).width();
|
||||||
|
|
Loading…
Reference in a new issue