diff --git a/js/uhr.js b/js/uhr.js index 4ede129..aa823be 100644 --- a/js/uhr.js +++ b/js/uhr.js @@ -58,7 +58,7 @@ along with this program. If not, see . var start = function start() { if (!isOn(this)) { var uhr = this; - this._timer = window.setInterval(function uhrTimer() { + this.timer = window.setInterval(function uhrTimer() { uhr.options.time = new Date(); update(uhr); }, 1000); @@ -68,8 +68,8 @@ along with this program. If not, see . }; var stop = function stop() { if (isOn(this)) { - window.clearInterval(this._timer); - this._timer = null; + window.clearInterval(this.timer); + this.timer = null; update(this); setCookie(this, 'uhr-status', 'off'); } @@ -107,8 +107,8 @@ along with this program. If not, see . if (time === null) { this.options.time = new Date(); } else { - if (this._timer !== null) { - window.clearInterval(this._timer); + if (this.timer !== null) { + window.clearInterval(this.timer); } this.options.time = time; } @@ -118,6 +118,8 @@ along with this program. If not, see . // private interface methods var create = function create() { this._id = uhrGlobals.id++; + this.timer = null; + this._currentMinute = -1; var userTime = this.options.time; if (this.options.time === undefined) { this.options.time = new Date(); @@ -265,7 +267,7 @@ along with this program. If not, see . // business logic var isOn = function isOn(uhr) { - return uhr._timer !== null; + return uhr.timer !== null; }; var update = function update(uhr) { if (isOn(uhr)) { @@ -349,11 +351,7 @@ along with this program. If not, see . "theme": setTheme, "time": setTime, // constructor method - "_create": create, - // private variables - "_id": -1, - "_timer": null, - "_currentMinute": -1 + "_create": create }); $.fritteli.uhr.register = uhrGlobals.registerLanguage; /**