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
|
||||
# 6.2.1
|
||||
# 6.3-alpha
|
||||
|
||||
COPYING
|
||||
README.md
|
||||
|
@ -13,6 +13,7 @@ uhr-black.css
|
|||
uhr-blue.css
|
||||
uhr-de.js
|
||||
uhr-de_CH.js
|
||||
uhr-de_CH-seconds.js
|
||||
uhr-de_CH_genau.js
|
||||
uhr-en.js
|
||||
uhr-fr.js
|
||||
|
|
|
@ -40,6 +40,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
<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-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-en.js"></script>
|
||||
|
|
|
@ -163,13 +163,13 @@ var h = {
|
|||
}
|
||||
};
|
||||
var layout = {
|
||||
"version": 3,
|
||||
"language": 'Bärndütschi Sekunde (genau)',
|
||||
"version": 2,
|
||||
"language": 'Bärndütschi Sekunde',
|
||||
"letters": [
|
||||
'ESKISCHAFÜF',
|
||||
'VIERTUBFZÄÄ',
|
||||
'ZWÄNZGGENAU',
|
||||
'VORABOHAUBI',
|
||||
'ZWÄNZGSIVOR',
|
||||
'ABOHAUBIEGE',
|
||||
'EISZWÖISDRÜ',
|
||||
'VIERIFÜFIQT',
|
||||
'SÄCHSISIBNI',
|
||||
|
@ -238,6 +238,9 @@ var layout = {
|
|||
"57": [h.vorne5, h.hinten7],
|
||||
"58": [h.vorne5, h.hinten8],
|
||||
"59": [h.vorne5, h.hinten9]
|
||||
},
|
||||
"getDotMinute": function(time) {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
window,_uhr.register('de_CH_seconds', layout);
|
17
uhr.js
17
uhr.js
|
@ -131,10 +131,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
_update: function() {
|
||||
if (this._isOn()) {
|
||||
var time = this.options.time;
|
||||
if (!this._language().hasOwnProperty('seconds')) {
|
||||
if (time.getMinutes() == this._currentMinute) {
|
||||
return;
|
||||
}
|
||||
this._currentMinute = time.getMinutes();
|
||||
}
|
||||
this._show(time);
|
||||
} else {
|
||||
this._clear();
|
||||
|
@ -142,6 +144,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
}
|
||||
},
|
||||
_show: function(time) {
|
||||
var second = this._getSecond(time);
|
||||
var dotMinute = this._getDotMinute(time);
|
||||
var hour = this._getHour(time);
|
||||
var coarseMinute = this._getCoarseMinute(time);
|
||||
|
@ -150,6 +153,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
for (var i = 1; i <= dotMinute; i++) {
|
||||
this._highlight('dot' + i);
|
||||
}
|
||||
this._highlight('second' + second);
|
||||
this._highlight('minute' + coarseMinute);
|
||||
this._highlight('hour' + hour);
|
||||
},
|
||||
|
@ -191,6 +195,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
}
|
||||
var minutes = date.getMinutes();
|
||||
return minutes % 5;
|
||||
},
|
||||
_getSecond: function(date) {
|
||||
if (typeof this._language().getSecond === 'function') {
|
||||
return this._language().getSecond(date);
|
||||
}
|
||||
return date.getSeconds();
|
||||
},
|
||||
_create: function() {
|
||||
this._id = window._uhr.id++;
|
||||
|
@ -381,6 +391,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
function _UhrRendererV2Delegate(layout) {
|
||||
this.layout = layout;
|
||||
this._parseArrayOrObject = function(letters, styleClass, input) {
|
||||
if (typeof input !== 'undefined' && input !== null) {
|
||||
if (Array.isArray(input)) {
|
||||
for (var i = 0; i < input.length; i++) {
|
||||
this._parseObject(letters, styleClass, input[i]);
|
||||
|
@ -388,8 +399,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
} else {
|
||||
this._parseObject(letters, styleClass, input);
|
||||
}
|
||||
}
|
||||
}
|
||||
this._parseObject = function(letters, styleClass, object) {
|
||||
if (typeof object !== 'undefined' && object !== null) {
|
||||
for (var line in object) {
|
||||
if (object.hasOwnProperty(line)) {
|
||||
var highlightLetters = object[line];
|
||||
|
@ -399,8 +412,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this._parseTimeDefinition = function(letters, styleClass, definition) {
|
||||
if (typeof definition !== 'undefined' && definition != null) {
|
||||
for (var listString in definition) {
|
||||
if (definition.hasOwnProperty(listString)) {
|
||||
var array = listString.split(',');
|
||||
|
@ -412,6 +427,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_UhrRendererV2Delegate.prototype.parse = function() {
|
||||
var letters = [];
|
||||
for (var i = 0; i < this.layout.letters.length; i++) {
|
||||
|
@ -424,6 +440,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
letters.push(line);
|
||||
}
|
||||
this._parseArrayOrObject(letters, 'on', this.layout.permanent);
|
||||
this._parseTimeDefinition(letters, 'second', this.layout.seconds);
|
||||
this._parseTimeDefinition(letters, 'minute', this.layout.minutes);
|
||||
this._parseTimeDefinition(letters, 'hour', this.layout.hours);
|
||||
return letters;
|
||||
|
|
Loading…
Reference in a new issue