diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2014-02-28 08:55:40 -0800 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2014-02-28 08:55:40 -0800 |
commit | 11a2d3e6910850ec15461b602321216c33170104 (patch) | |
tree | abe7980c006ae77456ac3e44adfe38ea8b2128ff | |
parent | 6e255883e0cb745f182a1ff1e4427704df231400 (diff) | |
download | tempo-11a2d3e6910850ec15461b602321216c33170104.tar.gz tempo-11a2d3e6910850ec15461b602321216c33170104.tar.xz |
Don't check time format every second.
-rw-r--r-- | options.html | 15 | ||||
-rw-r--r-- | tempo.js | 9 |
2 files changed, 15 insertions, 9 deletions
diff --git a/options.html b/options.html index 52f7b3e..5f7058d 100644 --- a/options.html +++ b/options.html @@ -9,12 +9,15 @@ <script type="text/javascript" src="options.js"></script> </head> <body> - <select id="timeformat"> - <option value="12">12-hour</option> - <option value="24">24-hour</option> - </select> - <br /> + <p> + <select id="timeformat"> + <option value="12">12-hour</option> + <option value="24">24-hour</option> + </select> + </p> <p id="status"></p> - <button id="save">Save</button> + <p> + <button id="save">Save</button> + </p> </body> </html> @@ -2,7 +2,10 @@ // Distributed under the terms of the GNU General Public License v2. // See http://www.gnu.org/licenses/gpl-2.0.txt for the full license text. -var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; +var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', + 'August', 'September', 'October', 'November', 'December']; + +var timeformat = null; function padTime(x) { if(x < 10) { @@ -13,8 +16,6 @@ function padTime(x) { } function updateTime() { - var timeformat = localStorage['timeformat']; - var date = new Date(); var h = date.getHours(); @@ -38,6 +39,8 @@ function updateTime() { } function startTempo() { + timeformat = localStorage['timeformat']; + updateTime(); setTimeout(function() {updateTime(); setInterval(updateTime, 1000)}, |