Merge branch 'develop' into feature/new-splashscreen

This commit is contained in:
Manuel Friedli 2014-06-30 15:49:02 +02:00
commit cbbe2e103d
11 changed files with 244 additions and 88 deletions

View file

@ -27,8 +27,13 @@ Beim Einbinden muss das attribut `data-class` angegeben werden, welches die CSS-
* uhr.js
* Binde mindestens eine der folgenden Javascript-Dateien im HTML ein, je nach dem, welche Sprachen deine Uhr unterstützen soll:
* uhr-de_CH.js
* uhr-de_CH_genau.js
* uhr-de.js
* uhr-en.js
* uhr-fr.js
* uhr-it.js
`uhr-de_CH_genau.js` ist eine Variante von Berndeutsch, bei der zur vollen Stunde zusätlich das Wort "genau" angezeigt wird (also z.B. "ES ISCH GENAU DRÜ").
2. Uhr-Element im HTML-Dokument einfügen
----------------------------------------

View file

@ -88,10 +88,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
&lt;script type="text/javascript" src="jquery-cookie-1.4.0.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="uhr.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="uhr-de_CH.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="uhr-de_CH_genau.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="uhr-de.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="uhr-en.js"&gt;&lt;/script&gt;</code>
&lt;script type="text/javascript" src="uhr-en.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="uhr-fr.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="uhr-it.js"&gt;&lt;/script&gt;</code>
</p>
<p>Von den Stylesheets zwingend ist <code>uhr.css</code> und mindestens eines der Farbschema-Stylesheets. Die Attribute <code>data-class</code> bzw. <code>data-name</code> definieren dabei die im Stylesheet deklarierte Klasse bzw. den im Auswahlmenu anzuzeigenden Namen. Der Name kann frei gewählt werden, die Style-Klasse muss mit der im Stylesheet definierten übereinstimmen.</p>
<p><code>uhr-de_CH_genau.js</code> ist eine Variante von Berndeutsch, bei der zur vollen Stunde zusätlich das Wort <tt>genau</tt> angezeigt wird (also z.B. <tt>ES ISCH GENAU DRÜ</tt>).</p>
<h4 id="clock-element">Uhr-Element auf der Seite</h4>
<p>Definiere an der Stelle, wo die Uhr angezeigt werden soll, ein leeres <code>&lt;div&gt;</code>-Element:<br/>
<code>&lt;div id="meine-uhr"&gt;&lt;/div&gt;</code>
@ -122,11 +126,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<br/>Typ: String
<br/> Default: <code>'on'</code></dd>
<dt><code>language</code></dt>
<dd>Die anfänglich ausgewählte Sprache als String. Welche Sprachen unterstützt werden, hängt davon ab, welche Sprachdateien eingebunden werden. Bis anhin unterstützte Sprachen umfassen <code>'de_CH'</code> (Berndeutsch), <code>'de'</code> (Hochdeutsch) und <code>'en'</code> (Englisch).
<dd>Die anfänglich ausgewählte Sprache als String. Welche Sprachen unterstützt werden, hängt davon ab, welche Sprachdateien eingebunden werden.
<br/>Typ: String
<br/>Default: <code>'de_CH'</code></dd>
<dt><code>theme</code></dt>
<dd>Die anfänglich ausgewählte Farbe der Uhr. Welche Farben unterstützt werden, hängt davon ab, welche CSS-Dateien eingebunden werden. Bis anhin unterstützte Farben sind zur Zeit <code>'black'</code> (schwarz), <code>'red'</code> (rot), <code>'blue'</code> (blau), <code>'green'</code> (grün), <code>'white'</code> (weiss) und <code>'pink'</code> (pink).
<dd>Die anfänglich ausgewählte Farbe der Uhr. Welche Farben unterstützt werden, hängt davon ab, welche CSS-Dateien eingebunden werden.
<br/>Typ: String
<br/>Default: Farbe der ersten eingebundenen CSS-Datei</dd>
<dt><code>force</code></dt>

View file

@ -1,5 +1,5 @@
CACHE MANIFEST
# 6.0
# 6.2.1
COPYING
README.md
@ -18,7 +18,9 @@ uhr-de.js
uhr-de_CH.js
uhr-de_CH_genau.js
uhr-en.js
uhr-fr.js
uhr-green.css
uhr-it.js
uhr-pink.css
uhr-red.css
uhr-white.css

View file

@ -43,6 +43,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<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">
(function($) {
var width = $(window).width();

View file

@ -53,18 +53,18 @@ var layout = {
"55,56,57,58,59": [h._5, h._vor]
},
"hours": {
"1": {6:[1,2,3,4]},
"2": {6:[8,9,10,11]},
"3": {7:[1,2,3,4]},
"4": {7:[8,9,10,11]},
"5": {5:[8,9,10,11]},
"6": {8:[1,2,3,4,5]},
"7": {9:[1,2,3,4,5,6]},
"8": {8:[8,9,10,11]},
"9": {10:[4,5,6,7]},
"10": {10:[1,2,3,4]},
"11": {5:[6,7,8]},
"12": {9:[7,8,9,10,11]}
"0,12": {9:[7,8,9,10,11]},
"1,13": {6:[1,2,3,4]},
"2,14": {6:[8,9,10,11]},
"3,15": {7:[1,2,3,4]},
"4,16": {7:[8,9,10,11]},
"5,17": {5:[8,9,10,11]},
"6,18": {8:[1,2,3,4,5]},
"7,19": {9:[1,2,3,4,5,6]},
"8,20": {8:[8,9,10,11]},
"9,21": {10:[4,5,6,7]},
"10,22": {10:[1,2,3,4]},
"11,23": {5:[6,7,8]}
}
};
window,_uhr.register('de', layout);

View file

@ -78,18 +78,18 @@ var layout = {
},
// Die Stunden; gleiches Format wie bei den Minuten
"hours": {
"1": {5:[1,2,3]},
"2": {5:[4,5,6,7]},
"3": {5:[9,10,11]},
"4": {6:[1,2,3,4,5]},
"5": {6:[6,7,8,9]},
"6": {7:[1,2,3,4,5,6]},
"7": {7:[7,8,9,10,11]},
"8": {8:[1,2,3,4,5]},
"9": {8:[6,7,8,9]},
"10": {9:[1,2,3,4]},
"11": {9:[8,9,10,11]},
"12": {10:[1,2,3,4,5,6]}
"0,12": {10:[1,2,3,4,5,6]},
"1,13": {5:[1,2,3]},
"2,14": {5:[4,5,6,7]},
"3,15": {5:[9,10,11]},
"4,16": {6:[1,2,3,4,5]},
"5,17": {6:[6,7,8,9]},
"6,18": {7:[1,2,3,4,5,6]},
"7,19": {7:[7,8,9,10,11]},
"8,20": {8:[1,2,3,4,5]},
"9,21": {8:[6,7,8,9]},
"10,22": {9:[1,2,3,4]},
"11,23": {9:[8,9,10,11]}
}
};
// Das Layout bei der Uhr unter dem Code "de_CH" registrieren.

View file

@ -54,18 +54,18 @@ var layout = {
"55,56,57,58,59": [h._5, h._vor]
},
"hours": {
"1": {5:[1,2,3]},
"2": {5:[4,5,6,7]},
"3": {5:[9,10,11]},
"4": {6:[1,2,3,4,5]},
"5": {6:[6,7,8,9]},
"6": {7:[1,2,3,4,5,6]},
"7": {7:[7,8,9,10,11]},
"8": {8:[1,2,3,4,5]},
"9": {8:[6,7,8,9]},
"10": {9:[1,2,3,4]},
"11": {9:[8,9,10,11]},
"12": {10:[1,2,3,4,5,6]}
"0,12": {10:[1,2,3,4,5,6]},
"1,13": {5:[1,2,3]},
"2,14": {5:[4,5,6,7]},
"3,15": {5:[9,10,11]},
"4,16": {6:[1,2,3,4,5]},
"5,17": {6:[6,7,8,9]},
"6,18": {7:[1,2,3,4,5,6]},
"7,19": {7:[7,8,9,10,11]},
"8,20": {8:[1,2,3,4,5]},
"9,21": {8:[6,7,8,9]},
"10,22": {9:[1,2,3,4]},
"11,23": {9:[8,9,10,11]}
}
};
window,_uhr.register('de_CH_genau', layout);

View file

@ -27,18 +27,6 @@ var h = {
var layout = {
"version": 2,
"language": 'English',
/*
[l('I', 'on'), l('T', 'on'),l('L'),l('I', 'on'),l('S', 'on'),l('B'),l('F'),l('A'),l('M'),l('P'),l('M')],
[m('A', 15, 45), l('C'),m('Q', 15, 45),m('U', 15, 45),m('A', 15, 45),m('R', 15, 45),m('T', 15, 45),m('E', 15, 45),m('R', 15, 45),l('D'),l('C')],
[m('T', 20, 25, 35, 40), m('W', 20, 25, 35, 40),m('E', 20, 25, 35, 40),m('N', 20, 25, 35, 40),m('T', 20, 25, 35, 40),m('Y', 20, 25, 35, 40),m('F', 5, 25, 35, 55),m('I', 5, 25, 35, 55),m('V', 5, 25, 35, 55),m('E', 5, 25, 35, 55),l('X')],
[m('H', 30), m('A', 30),m('L', 30),m('F', 30),l('B'),m('T', 10, 50),m('E', 10, 50),m('N', 10, 50),l('F'),m('T', 35, 40, 45, 50, 55),m('O', 35, 40, 45, 50, 55)],
[m('P', 5, 10, 15, 20, 25, 30),m('A', 5, 10, 15, 20, 25, 30),m('S', 5, 10, 15, 20, 25, 30),m('T', 5, 10, 15, 20, 25, 30),l('E'),l('R'),l('U'),h('N', 9),h('I', 9),h('N', 9),h('E', 9)],
[h('O', 1), h('N', 1),h('E', 1),h('S', 6),h('I', 6),h('X', 6),h('T', 3),h('H', 3),h('R', 3),h('E', 3),h('E', 3)],
[h('F', 4), h('O', 4),h('U', 4),h('R', 4),h('F', 5),h('I', 5),h('V', 5),h('E', 5),h('T', 2),h('W', 2),h('O', 2)],
[h('E', 8), h('I', 8),h('G', 8),h('H', 8),h('T', 8),h('E', 11),h('L', 11),h('E', 11),h('V', 11),h('E', 11),h('N', 11)],
[h('S', 7), h('E', 7),h('V', 7),h('E', 7),h('N', 7),h('T', 12),h('W', 12),h('E', 12),h('L', 12),h('V', 12),h('E', 12)],
[h('T', 10), h('E', 10),h('N', 10),l('S'),l('E'),l('O', 'sharphour'),l('C', 'sharphour'),l('L', 'sharphour'),l('O', 'sharphour'),l('C', 'sharphour'),l('K', 'sharphour')]
*/
"letters": [
'ITLISBFAMPM',
'ACQUARTERDC',
@ -67,23 +55,23 @@ var layout = {
"55,56,57,58,59": [h._5, h._to]
},
"hours": {
"1": {6:[1,2,3]},
"2": {7:[9,10,11]},
"3": {6:[7,8,9,10,11]},
"4": {7:[1,2,3,4]},
"5": {7:[5,6,7,8]},
"6": {6:[4,5,6]},
"7": {9:[1,2,3,4,5]},
"8": {8:[1,2,3,4,5]},
"9": {5:[8,9,10,11]},
"10": {10:[1,2,3]},
"11": {8:[6,7,8,9,10,11]},
"12": {9:[6,7,8,9,10,11]}
"0,12": {9:[6,7,8,9,10,11]},
"1,13": {6:[1,2,3]},
"2,14": {7:[9,10,11]},
"3,15": {6:[7,8,9,10,11]},
"4,16": {7:[1,2,3,4]},
"5,17": {7:[5,6,7,8]},
"6,18": {6:[4,5,6]},
"7,19": {9:[1,2,3,4,5]},
"8,20": {8:[1,2,3,4,5]},
"9,21": {5:[8,9,10,11]},
"10,22": {10:[1,2,3]},
"11,23": {8:[6,7,8,9,10,11]}
},
"getHour": function(date) {
var hour = date.getHours();
if (date.getMinutes() >= 35) {
return hour + 1;
return (hour + 1) % 24;
}
return hour;
}

81
uhr-fr.js Normal file
View file

@ -0,0 +1,81 @@
/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
var h = {
"_il_est": {1:[1,2,4,5,6]},
"_et": {8:[1,2]},
"_moins": {7:[1,2,3,4,5]},
"_demie": {10:[4,5,6,7,8]},
"_heures": {6:[6,7,8,9,10,11]},
"_le": {7:[7,8]},
"_5": {9:[7,8,9,10]},
"_10": {7:[9,10,11]},
"_15": {8:[4,5,6,7,8]},
"_20": {9:[1,2,3,4,5]},
"_25": {9:[1,2,3,4,5,6,7,8,9,10]}
};
var layout = {
"version": 2,
"language": 'Français',
"letters": [
'ILNESTODEUX',
'QUATRETROIS',
'NEUFUNESEPT',
'HUITSIXCINQ',
'MIDIXMINUIT',
'ONZERHEURES',
'MOINSOLEDIX',
'ETRQUARTPMD',
'VINGT-CINQU',
'ETSDEMIEPAM'
],
"permanent": h._il_est,
"minutes": {
"5,6,7,8,9": h._5,
"10,11,12,13,14": h._10,
"15,16,17,18,19": [h._et, h._15],
"20,21,22,23,24": h._20,
"25,26,27,28,29": h._25,
"30,31,32,33,34": [h._et, h._demie],
"35,36,37,38,39": [h._moins, h._25],
"40,41,42,43,44": [h._moins, h._20],
"45,46,47,48,49": [h._moins, h._le, h._15],
"50,51,52,53,54": [h._moins, h._10],
"55,56,57,58,59": [h._moins, h._5]
},
"hours": {
"0": {5:[6,7,8,9,10,11]},
"1,13": [{3:[5,6,7]}, h._heures],
"2,14": [{1:[8,9,10,11]}, h._heures],
"3,15": [{2:[7,8,9,10,11]}, h._heures],
"4,16": [{2:[1,2,3,4,5,6]}, h._heures],
"5,17": [{4:[8,9,10,11]}, h._heures],
"6,18": [{4:[5,6,7]}, h._heures],
"7,19": [{3:[8,9,10,11]}, h._heures],
"8,20": [{4:[1,2,3,4]}, h._heures],
"9,21": [{3:[1,2,3,4]}, h._heures],
"10,22": [{5:[3,4,5]}, h._heures],
"11,23": [{6:[1,2,3,4]}, h._heures],
"12": {5:[1,2,3,4]}
},
"getHour": function(date) {
var hour = date.getHours();
if (date.getMinutes() >= 35) {
return (hour + 1) % 24;
}
return hour;
}
};
window,_uhr.register('fr', layout);

78
uhr-it.js Normal file
View file

@ -0,0 +1,78 @@
/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
var h = {
"_sono_le": {1:[1,2,3,4,6,7]},
"_e_l": {2:[1,3,4]},
"_e": {8:[1]},
"_meno": {7:[8,9,10,11]},
"_mezza": {10:[7,8,9,10,11]},
"_5": {9:[6,7,8,9,10,11]},
"_10": {10:[1,2,3,4,5]},
"_un_quarto": {8:[3,4,6,7,8,9,10,11]},
"_20": {9:[1,2,3,4,5]},
"_25": {9:[1,2,3,4,5,6,7,8,9,10,11]}
};
var layout = {
"version": 2,
"language": 'Italiano',
"letters": [
'SONORLEBORE',
'ÈRL\'UNASDUE',
'TREOTTONOVE',
'DIECIUNDICI',
'DODICISETTE',
'QUATTROCSEI',
'CINQUEAMENO',
'ECUNOQUARTO',
'VENTICINQUE',
'DIECIPMEZZA'
],
"permanent": [],
"minutes": {
"5,6,7,8,9": [h._e, h._5],
"10,11,12,13,14": [h._e, h._10],
"15,16,17,18,19": [h._e, h._un_quarto],
"20,21,22,23,24": [h._e, h._20],
"25,26,27,28,29": [h._e, h._25],
"30,31,32,33,34": [h._e, h._mezza],
"35,36,37,38,39": [h._meno, h._25],
"40,41,42,43,44": [h._meno, h._20],
"45,46,47,48,49": [h._meno, h._un_quarto],
"50,51,52,53,54": [h._meno, h._10],
"55,56,57,58,59": [h._meno, h._5]
},
"hours": {
"0,12": [h._sono_le, {5:[1,2,3,4,5,6]}],
"1,13": [h._e_l, {2:[5,6,7]}],
"2,14": [h._sono_le, {2:[9,10,11]}],
"3,15": [h._sono_le, {3:[1,2,3]}],
"4,16": [h._sono_le, {6:[1,2,3,4,5,6,7]}],
"5,17": [h._sono_le, {7:[1,2,3,4,5,6]}],
"6,18": [h._sono_le, {6:[9,10,11]}],
"7,19": [h._sono_le, {5:[7,8,9,10,11]}],
"8,20": [h._sono_le, {3:[4,5,6,7]}],
"9,21": [h._sono_le, {3:[8,9,10,11]}],
"10,22": [h._sono_le, {4:[1,2,3,4,5]}],
"11,23": [h._sono_le, {4:[6,7,8,9,10,11]}]
},
"getHour": function(date) {
var hour = date.getHours();
if (date.getMinutes() >= 35) {
return (hour + 1) % 24;
}
return hour;
}
};
window,_uhr.register('it', layout);

34
uhr.js
View file

@ -35,7 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
}
};
// auto-detect themes
var styleSheets = $('head link[rel=stylesheet]');
var styleSheets = $('link[rel=stylesheet]');
for (var i = 0; i < styleSheets.length; i++) {
var styleSheet = $(styleSheets[i]);
var styleClass = styleSheet.attr('data-class');
@ -68,7 +68,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
uhr._update();
}, 1000);
this._update();
$.cookie('uhr-status' + this._id, 'on', {expires: 365, path: '/'});
this._setCookie('uhr-status', 'on');
} else {
}
},
@ -77,7 +77,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
window.clearInterval(this._timer);
this._timer = null;
this._update();
$.cookie('uhr-status' + this._id, 'off', {expires: 365, path: '/'});
this._setCookie('uhr-status', 'off');
}
},
toggle: function() {
@ -96,7 +96,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
uhr._currentMinute = -1;
uhr._update();
});
$.cookie('uhr-language' + this._id, languageKey, {expires: 365, path: '/'});
this._setCookie('uhr-language', languageKey);
this._update();
}
},
@ -105,7 +105,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
this.element.removeClass(this.options.theme).addClass(theme);
$('#uhr-onoffswitch' + this._id).removeClass(this.options.theme).addClass(theme);
this.options.theme = theme;
$.cookie('uhr-theme' + this._id, theme, {expires: 365, path: '/'});
this._setCookie('uhr-theme', theme);
}
},
time: function(time) {
@ -151,11 +151,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
this._highlight('dot' + i);
}
this._highlight('minute' + coarseMinute);
hour = this._normalizeHour(hour);
this._highlight('hour' + hour);
if (coarseMinute == 0) {
this._highlight('sharphour');
}
},
_language: function() {
for (var i = 0; i < window._uhr.languages.length; i++) {
@ -179,7 +175,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
}
var hour = date.getHours();
if (date.getMinutes() >= 25) {
return hour + 1;
return (hour + 1) % 24;
}
return hour;
},
@ -196,15 +192,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
var minutes = date.getMinutes();
return minutes % 5;
},
_normalizeHour: function(hour) {
if (hour > 12) {
hour %= 12;
}
if (hour == 0) {
return 12;
}
return hour;
},
_create: function() {
this._id = window._uhr.id++;
var userTime = this.options.time;
@ -340,6 +327,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
themeChooser.val(selectedTheme);
this.options.theme = "";
this.theme(selectedTheme);
},
_setCookie: function(cookieName, cookieValue) {
var options = {};
if (this.options.cookiePath !== undefined) {
options = {expires: 365, path: this.options.cookiePath};
} else {
options = {expires: 365};
}
$.cookie(cookieName + this._id, cookieValue, options);
}
});
/**