1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- /*!
- * minute countdown renderer for epiclock
- *
- * Copyright (c) Eric Garside
- * Copyright (c) Chamilo team
- * Dual licensed under:
- * MIT: http://www.opensource.org/licenses/mit-license.php
- * GPLv3: http://www.opensource.org/licenses/gpl-3.0.html
- */
- "use strict";
- /*global window, jQuery */
- /*jslint white: true, browser: true, onevar: true, undef: true, eqeqeq: true, bitwise: true, regexp: true, strict: true, newcap: true, immed: true, maxerr: 50, indent: 4 */
- (function ($) {
- //constants
- var epClock; // clock object
- // Setup
- $.epiclock.addRenderer('minute', function (element, value)
- {
- var currentTime = new Date().valueOf();
- var dist = epClock.time+epClock.__offset - currentTime;
-
- //Sets the value to the clock very important!
- element.text(value);
-
- var div_clock = $('#exercise_clock_warning');
-
- // 60000 = 60 seconds
- // Green
- //if (dist > 180000) { // 5min
- // Special changes to 20' and 5' for MINEDU
- if (dist > 1200000) { //>20min
- if (!(div_clock.hasClass('time_warning_three'))) {
- div_clock.addClass('time_warning_three');
- }
- }
- // Yellow
- // if (dist <= 180000) { //3min
- if (dist <= 1200000) { //20min
- div_clock.removeClass('time_warning_three');
- if (!(div_clock.hasClass('time_warning_two'))) {
- div_clock.addClass('time_warning_two');
- }
- }
-
- // Red
- // if (dist <= 60000) { //1min
- if (dist <= 300000) { //5min
- div_clock.removeClass('time_warning_two');
- if (!(div_clock.hasClass('time_warning_one'))) {
- div_clock.addClass('time_warning_one');
- }
- }
- },
- function ()
- {
- epClock = this;
- });
- }(jQuery));
|