rename seconds-file; add more failsafety (undefined-checks); override
_getDotMinute for the second, so the dots don't show up.
This commit is contained in:
parent
a0e2588d91
commit
c0af4a976f
4 changed files with 75 additions and 53 deletions
|
@ -1,5 +1,5 @@
|
||||||
CACHE MANIFEST
|
CACHE MANIFEST
|
||||||
# 6.2.1
|
# 6.3-alpha
|
||||||
|
|
||||||
COPYING
|
COPYING
|
||||||
README.md
|
README.md
|
||||||
|
@ -13,6 +13,7 @@ uhr-black.css
|
||||||
uhr-blue.css
|
uhr-blue.css
|
||||||
uhr-de.js
|
uhr-de.js
|
||||||
uhr-de_CH.js
|
uhr-de_CH.js
|
||||||
|
uhr-de_CH-seconds.js
|
||||||
uhr-de_CH_genau.js
|
uhr-de_CH_genau.js
|
||||||
uhr-en.js
|
uhr-en.js
|
||||||
uhr-fr.js
|
uhr-fr.js
|
||||||
|
|
|
@ -40,7 +40,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
<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="../uhr-de_CH.js"></script>
|
||||||
<script type="text/javascript" src="../uhr-de_CH_genau.js"></script>
|
<script type="text/javascript" src="../uhr-de_CH-seconds.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-de.js"></script>
|
||||||
<script type="text/javascript" src="../uhr-en.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-fr.js"></script>
|
||||||
|
|
|
@ -163,19 +163,19 @@ var h = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var layout = {
|
var layout = {
|
||||||
"version": 3,
|
"version": 2,
|
||||||
"language": 'Bärndütschi Sekunde (genau)',
|
"language": 'Bärndütschi Sekunde',
|
||||||
"letters": [
|
"letters": [
|
||||||
'ESKISCHAFÜF',
|
'ESKISCHAFÜF',
|
||||||
'VIERTUBFZÄÄ',
|
'VIERTUBFZÄÄ',
|
||||||
'ZWÄNZGGENAU',
|
'ZWÄNZGSIVOR',
|
||||||
'VORABOHAUBI',
|
'ABOHAUBIEGE',
|
||||||
'EISZWÖISDRÜ',
|
'EISZWÖISDRÜ',
|
||||||
'VIERIFÜFIQT',
|
'VIERIFÜFIQT',
|
||||||
'SÄCHSISIBNI',
|
'SÄCHSISIBNI',
|
||||||
'ACHTINÜNIEL',
|
'ACHTINÜNIEL',
|
||||||
'ZÄNIERBEUFI',
|
'ZÄNIERBEUFI',
|
||||||
'ZWÖUFINAUHR'
|
'ZWÖUFINAUHR'
|
||||||
],
|
],
|
||||||
"seconds": {
|
"seconds": {
|
||||||
"0": [h.vorne0, h.hinten0],
|
"0": [h.vorne0, h.hinten0],
|
||||||
|
@ -238,6 +238,9 @@ var layout = {
|
||||||
"57": [h.vorne5, h.hinten7],
|
"57": [h.vorne5, h.hinten7],
|
||||||
"58": [h.vorne5, h.hinten8],
|
"58": [h.vorne5, h.hinten8],
|
||||||
"59": [h.vorne5, h.hinten9]
|
"59": [h.vorne5, h.hinten9]
|
||||||
|
},
|
||||||
|
"getDotMinute": function(time) {
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
window,_uhr.register('de_CH_seconds', layout);
|
window,_uhr.register('de_CH_seconds', layout);
|
95
uhr.js
95
uhr.js
|
@ -131,10 +131,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
_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 (!this._language().hasOwnProperty('seconds')) {
|
||||||
return;
|
if (time.getMinutes() == this._currentMinute) {
|
||||||
}
|
return;
|
||||||
this._currentMinute = time.getMinutes();
|
}
|
||||||
|
this._currentMinute = time.getMinutes();
|
||||||
|
}
|
||||||
this._show(time);
|
this._show(time);
|
||||||
} else {
|
} else {
|
||||||
this._clear();
|
this._clear();
|
||||||
|
@ -142,7 +144,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_show: function(time) {
|
_show: function(time) {
|
||||||
var dotMinute = this._getDotMinute(time);
|
var second = this._getSecond(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);
|
||||||
this._clear();
|
this._clear();
|
||||||
|
@ -150,7 +153,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
for (var i = 1; i <= dotMinute; i++) {
|
for (var i = 1; i <= dotMinute; i++) {
|
||||||
this._highlight('dot' + i);
|
this._highlight('dot' + i);
|
||||||
}
|
}
|
||||||
this._highlight('minute' + coarseMinute);
|
this._highlight('second' + second);
|
||||||
|
this._highlight('minute' + coarseMinute);
|
||||||
this._highlight('hour' + hour);
|
this._highlight('hour' + hour);
|
||||||
},
|
},
|
||||||
_language: function() {
|
_language: function() {
|
||||||
|
@ -185,13 +189,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
}
|
}
|
||||||
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;
|
||||||
},
|
},
|
||||||
|
_getSecond: function(date) {
|
||||||
|
if (typeof this._language().getSecond === 'function') {
|
||||||
|
return this._language().getSecond(date);
|
||||||
|
}
|
||||||
|
return date.getSeconds();
|
||||||
|
},
|
||||||
_create: function() {
|
_create: function() {
|
||||||
this._id = window._uhr.id++;
|
this._id = window._uhr.id++;
|
||||||
var userTime = this.options.time;
|
var userTime = this.options.time;
|
||||||
|
@ -381,35 +391,41 @@ 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 (typeof input !== 'undefined' && input !== null) {
|
||||||
for (var i = 0; i < input.length; i++) {
|
if (Array.isArray(input)) {
|
||||||
this._parseObject(letters, styleClass, input[i]);
|
for (var i = 0; i < input.length; i++) {
|
||||||
}
|
this._parseObject(letters, styleClass, input[i]);
|
||||||
} else {
|
}
|
||||||
this._parseObject(letters, styleClass, input);
|
} else {
|
||||||
}
|
this._parseObject(letters, styleClass, input);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this._parseObject = function(letters, styleClass, object) {
|
this._parseObject = function(letters, styleClass, object) {
|
||||||
for (var line in object) {
|
if (typeof object !== 'undefined' && object !== null) {
|
||||||
if (object.hasOwnProperty(line)) {
|
for (var line in object) {
|
||||||
var highlightLetters = object[line];
|
if (object.hasOwnProperty(line)) {
|
||||||
for (var i = 0; i < highlightLetters.length; i++) {
|
var highlightLetters = object[line];
|
||||||
var x = highlightLetters[i] - 1;
|
for (var i = 0; i < highlightLetters.length; i++) {
|
||||||
letters[line - 1][x].addStyle(styleClass);
|
var x = highlightLetters[i] - 1;
|
||||||
}
|
letters[line - 1][x].addStyle(styleClass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this._parseTimeDefinition = function(letters, styleClass, definition) {
|
this._parseTimeDefinition = function(letters, styleClass, definition) {
|
||||||
for (var listString in definition) {
|
if (typeof definition !== 'undefined' && definition != null) {
|
||||||
if (definition.hasOwnProperty(listString)) {
|
for (var listString in definition) {
|
||||||
var array = listString.split(',');
|
if (definition.hasOwnProperty(listString)) {
|
||||||
var highlightLetters = definition[listString];
|
var array = listString.split(',');
|
||||||
for (var index = 0; index < array.length; index++) {
|
var highlightLetters = definition[listString];
|
||||||
this._parseArrayOrObject(letters, styleClass + array[index], highlightLetters);
|
for (var index = 0; index < array.length; index++) {
|
||||||
}
|
this._parseArrayOrObject(letters, styleClass + array[index], highlightLetters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_UhrRendererV2Delegate.prototype.parse = function() {
|
_UhrRendererV2Delegate.prototype.parse = function() {
|
||||||
|
@ -424,7 +440,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
letters.push(line);
|
letters.push(line);
|
||||||
}
|
}
|
||||||
this._parseArrayOrObject(letters, 'on', this.layout.permanent);
|
this._parseArrayOrObject(letters, 'on', this.layout.permanent);
|
||||||
this._parseTimeDefinition(letters, 'minute', this.layout.minutes);
|
this._parseTimeDefinition(letters, 'second', this.layout.seconds);
|
||||||
|
this._parseTimeDefinition(letters, 'minute', this.layout.minutes);
|
||||||
this._parseTimeDefinition(letters, 'hour', this.layout.hours);
|
this._parseTimeDefinition(letters, 'hour', this.layout.hours);
|
||||||
return letters;
|
return letters;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue