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-title" content="Bärneruhr" />
|
||||
<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="uhr-black.css" data-class="black" data-name="Schwarz" />
|
||||
<link rel="shortcut icon" type="image/png" href="favicon.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="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="uhr.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="css/uhr.css" />
|
||||
<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="resources/favicon.png" />
|
||||
<link rel="apple-touch-icon-precomposed" href="resources/apple-touch-icon-precomposed.png" />
|
||||
<script type="text/javascript" src="lib/jquery-2.1.0.min.js"></script>
|
||||
<script type="text/javascript" src="lib/jquery-ui-1.10.4.custom.min.js"></script>
|
||||
<script type="text/javascript" src="lib/jquery-cookie-1.4.0.js"></script>
|
||||
<script type="text/javascript" src="js/uhr.js"></script>
|
||||
</head>
|
||||
<body style="padding:0;margin:0;">
|
||||
<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>
|
||||
<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">
|
||||
(function($) {
|
||||
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>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<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="../uhr-black.css" data-class="black" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/uhr.css" />
|
||||
<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="shortcut icon" type="image/png" href="../favicon.png" />
|
||||
<script type="text/javascript" src="../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="../jquery-cookie-1.4.0.js"></script>
|
||||
<script type="text/javascript" src="../uhr.js"></script>
|
||||
<script type="text/javascript" src="../uhr-de_CH.js"></script>
|
||||
<link rel="shortcut icon" type="image/png" href="../resources/favicon.png" />
|
||||
<script type="text/javascript" src="../lib/jquery-2.1.0.min.js"></script>
|
||||
<script type="text/javascript" src="../lib/jquery-ui-1.10.4.custom.min.js"></script>
|
||||
<script type="text/javascript" src="../lib/jquery-cookie-1.4.0.js"></script>
|
||||
<script type="text/javascript" src="../js/uhr.js"></script>
|
||||
<script type="text/javascript" src="../js/uhr-de_CH.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="main-title">Die Zeit im Wort</h1>
|
||||
|
|
|
@ -67,4 +67,4 @@ var layout = {
|
|||
"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.
|
||||
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]}
|
||||
}
|
||||
};
|
||||
window,_uhr.register('de_CH_genau', layout);
|
||||
window,uhr.register('de_CH_genau', layout);
|
|
@ -76,4 +76,4 @@ var layout = {
|
|||
return hour;
|
||||
}
|
||||
};
|
||||
window,_uhr.register('en', layout);
|
||||
window,uhr.register('en', layout);
|
|
@ -78,4 +78,4 @@ var layout = {
|
|||
return hour;
|
||||
}
|
||||
};
|
||||
window,_uhr.register('fr', layout);
|
||||
window,uhr.register('fr', layout);
|
|
@ -75,4 +75,4 @@ var layout = {
|
|||
return hour;
|
||||
}
|
||||
};
|
||||
window,_uhr.register('it', layout);
|
||||
window,uhr.register('it', layout);
|
|
@ -15,17 +15,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
if (window._uhr !== undefined) {
|
||||
if (window.uhr !== undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
window._uhr = {
|
||||
window.uhr = {
|
||||
id: 0,
|
||||
languages: [],
|
||||
themes: [],
|
||||
register: function (code, language) {
|
||||
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 + '"!');
|
||||
return false;
|
||||
}
|
||||
|
@ -44,19 +44,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
if (name === undefined) {
|
||||
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
|
||||
if (window._uhr.themes.length == 0) {
|
||||
window._uhr.themes.push({});
|
||||
if (window.uhr.themes.length === 0) {
|
||||
window.uhr.themes.push({});
|
||||
}
|
||||
$.widget("fritteli.uhr", {
|
||||
options: {
|
||||
width: '100%',
|
||||
status: 'on',
|
||||
language: 'de_CH',
|
||||
theme: window._uhr.themes[0].styleClass,
|
||||
theme: window.uhr.themes[0].styleClass,
|
||||
force: false,
|
||||
controls: true
|
||||
},
|
||||
|
@ -101,7 +101,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
}
|
||||
},
|
||||
theme: function (theme) {
|
||||
if (theme != this.options.theme) {
|
||||
if (theme !== this.options.theme) {
|
||||
this.element.removeClass(this.options.theme).addClass(theme);
|
||||
$('#uhr-onoffswitch' + this._id).removeClass(this.options.theme).addClass(theme);
|
||||
this.options.theme = theme;
|
||||
|
@ -110,10 +110,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
},
|
||||
time: function (time) {
|
||||
this._currentMinute = -1;
|
||||
if (time == null) {
|
||||
if (time === null) {
|
||||
this.options.time = new Date();
|
||||
} else {
|
||||
if (this._timer != null) {
|
||||
if (this._timer !== null) {
|
||||
window.clearInterval(this._timer);
|
||||
}
|
||||
this.options.time = time;
|
||||
|
@ -131,7 +131,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
_update: function () {
|
||||
if (this._isOn()) {
|
||||
var time = this.options.time;
|
||||
if (time.getMinutes() == this._currentMinute) {
|
||||
if (time.getMinutes() === this._currentMinute) {
|
||||
return;
|
||||
}
|
||||
this._currentMinute = time.getMinutes();
|
||||
|
@ -154,8 +154,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
this._highlight('hour' + hour);
|
||||
},
|
||||
_language: function () {
|
||||
for (var i = 0; i < window._uhr.languages.length; i++) {
|
||||
var language = window._uhr.languages[i];
|
||||
for (var i = 0; i < window.uhr.languages.length; i++) {
|
||||
var language = window.uhr.languages[i];
|
||||
if (language.code == this.options.language) {
|
||||
return language;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
return minutes % 5;
|
||||
},
|
||||
_create: function () {
|
||||
this._id = window._uhr.id++;
|
||||
this._id = window.uhr.id++;
|
||||
var userTime = this.options.time;
|
||||
if (this.options.time === undefined) {
|
||||
this.options.time = new Date();
|
||||
|
@ -232,20 +232,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
e.after(toggleSwitch);
|
||||
|
||||
// language chooser
|
||||
if (window._uhr.languages.length > 1) {
|
||||
if (window.uhr.languages.length > 1) {
|
||||
var languageChooser = $('<select id="uhr-languagechooser' + this._id + '"></select>');
|
||||
for (var i = 0; i < window._uhr.languages.length; i++) {
|
||||
var language = window._uhr.languages[i];
|
||||
for (var i = 0; i < window.uhr.languages.length; i++) {
|
||||
var language = window.uhr.languages[i];
|
||||
languageChooser.append('<option value="' + language.code + '">' + language.language + '</option>');
|
||||
}
|
||||
e.after(languageChooser);
|
||||
}
|
||||
|
||||
// theme chooser
|
||||
if (window._uhr.themes.length > 1) {
|
||||
if (window.uhr.themes.length > 1) {
|
||||
var themeChooser = $('<select id="uhr-themechooser' + this._id + '"></select>');
|
||||
for (var i = 0; i < window._uhr.themes.length; i++) {
|
||||
var theme = window._uhr.themes[i];
|
||||
for (var i = 0; i < window.uhr.themes.length; i++) {
|
||||
var theme = window.uhr.themes[i];
|
||||
themeChooser.append('<option value="' + theme.styleClass + '">' + theme.name + '</option>');
|
||||
}
|
||||
e.after(themeChooser);
|
||||
|
@ -261,11 +261,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
uhr.toggle();
|
||||
});
|
||||
var status = $.cookie('uhr-status' + this._id);
|
||||
if (status == undefined || this.options.force) {
|
||||
if (status === undefined || this.options.force) {
|
||||
status = this.options.status;
|
||||
}
|
||||
toggleSwitch.prop('checked', status == 'on');
|
||||
if (status == 'on') {
|
||||
toggleSwitch.prop('checked', status === 'on');
|
||||
if (status === 'on') {
|
||||
this.start();
|
||||
} else {
|
||||
this.stop();
|
||||
|
@ -277,21 +277,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
uhr.language(this.value);
|
||||
});
|
||||
var selectedLanguage = $.cookie('uhr-language' + this._id);
|
||||
if (selectedLanguage == undefined || this.options.force) {
|
||||
if (selectedLanguage === undefined || this.options.force) {
|
||||
selectedLanguage = this.options.language;
|
||||
}
|
||||
var found = false;
|
||||
for (var i = 0; i < window._uhr.languages.length; i++) {
|
||||
var code = window._uhr.languages[i].code;
|
||||
if (selectedLanguage == code) {
|
||||
for (var i = 0; i < window.uhr.languages.length; i++) {
|
||||
var code = window.uhr.languages[i].code;
|
||||
if (selectedLanguage === code) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
var fallback;
|
||||
if (window._uhr.languages.length > 0) {
|
||||
fallback = window._uhr.languages[0].code;
|
||||
if (window.uhr.languages.length > 0) {
|
||||
fallback = window.uhr.languages[0].code;
|
||||
} else {
|
||||
fallback = '';
|
||||
}
|
||||
|
@ -308,19 +308,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
uhr.theme(this.value);
|
||||
});
|
||||
var selectedTheme = $.cookie('uhr-theme' + this._id);
|
||||
if (selectedTheme == undefined || this.options.force) {
|
||||
if (selectedTheme === undefined || this.options.force) {
|
||||
selectedTheme = this.options.theme;
|
||||
}
|
||||
found = false;
|
||||
for (var i = 0; i < window._uhr.themes.length; i++) {
|
||||
var styleClass = window._uhr.themes[i].styleClass;
|
||||
if (selectedTheme == styleClass) {
|
||||
for (var i = 0; i < window.uhr.themes.length; i++) {
|
||||
var styleClass = window.uhr.themes[i].styleClass;
|
||||
if (selectedTheme === styleClass) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
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);
|
||||
selectedTheme = fallback;
|
||||
}
|
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-title" content="Bärneruhr" />
|
||||
<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="../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="../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="../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="../uhr-pink.css" data-class="pink" data-name="Pink" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/uhr.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/uhr-black.css" data-class="black" data-name="Schwarz" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/uhr-white.css" data-class="white" data-name="Weiss" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/uhr-red.css" data-class="red" data-name="Rot" />
|
||||
<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="../css/uhr-yellow.css" data-class="yellow" data-name="Gelb" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/uhr-blue.css" data-class="blue" data-name="Blau" />
|
||||
<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="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="../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="../uhr.js"></script>
|
||||
<script type="text/javascript" src="../lib/jquery-2.1.0.min.js"></script>
|
||||
<script type="text/javascript" src="../lib/jquery-ui-1.10.4.custom.min.js"></script>
|
||||
<script type="text/javascript" src="../lib/jquery-cookie-1.4.0.js"></script>
|
||||
<script type="text/javascript" src="../js/uhr.js"></script>
|
||||
</head>
|
||||
<body style="padding:0;margin:0;">
|
||||
<div id="uhr"></div>
|
||||
<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="../uhr-de_CH_genau.js"></script>
|
||||
<script type="text/javascript" src="../uhr-de.js"></script>
|
||||
<script type="text/javascript" src="../uhr-en.js"></script>
|
||||
<script type="text/javascript" src="../uhr-fr.js"></script>
|
||||
<script type="text/javascript" src="../uhr-it.js"></script>
|
||||
<script type="text/javascript" src="../js/uhr-de_CH.js"></script>
|
||||
<script type="text/javascript" src="../js/uhr-de_CH_genau.js"></script>
|
||||
<script type="text/javascript" src="../js/uhr-de.js"></script>
|
||||
<script type="text/javascript" src="../js/uhr-en.js"></script>
|
||||
<script type="text/javascript" src="../js/uhr-fr.js"></script>
|
||||
<script type="text/javascript" src="../js/uhr-it.js"></script>
|
||||
<script type="text/javascript">
|
||||
(function($) {
|
||||
var width = $(window).width();
|
||||
|
|
Loading…
Reference in a new issue