diff options
author | Jannik Schönartz | 2017-12-07 17:16:16 +0100 |
---|---|---|
committer | Jannik Schönartz | 2017-12-07 17:16:16 +0100 |
commit | 3824805b842ebbe6d84b88fe9c8fb3d9e39f3d26 (patch) | |
tree | 3d348e3418fe771608e4dd3d2a3cfdb7c9ac23e2 /modules-available/locationinfo/templates/frontend-summary.html | |
parent | [locations] Redesign machine count column, make both counts clickable (diff) | |
download | slx-admin-3824805b842ebbe6d84b88fe9c8fb3d9e39f3d26.tar.gz slx-admin-3824805b842ebbe6d84b88fe9c8fb3d9e39f3d26.tar.xz slx-admin-3824805b842ebbe6d84b88fe9c8fb3d9e39f3d26.zip |
[locationinfo] Moved some shared functions to the frontendscript.js
Diffstat (limited to 'modules-available/locationinfo/templates/frontend-summary.html')
-rw-r--r-- | modules-available/locationinfo/templates/frontend-summary.html | 73 |
1 files changed, 2 insertions, 71 deletions
diff --git a/modules-available/locationinfo/templates/frontend-summary.html b/modules-available/locationinfo/templates/frontend-summary.html index 4317b39e..9b375d4f 100644 --- a/modules-available/locationinfo/templates/frontend-summary.html +++ b/modules-available/locationinfo/templates/frontend-summary.html @@ -3,6 +3,7 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0" charset="utf-8"> <head> <script type='text/javascript' src='{{dirprefix}}script/jquery.js'></script> + <script type='text/javascript' src='{{dirprefix}}modules/locationinfo/frontend/frontendscript.js'></script> <style type='text/css'> @@ -422,21 +423,6 @@ } /** - * Convert passed argument to integer if possible, return NaN otherwise. - * The difference to parseInt() is that leading zeros are ignored and not - * interpreted as octal representation. - * - * @param str string or already a number - * @return {number} str converted to number, or NaN - */ - function toInt(str) { - var t = typeof str; - if (t === 'number') return str | 0; - if (t === 'string') return parseInt(str.replace(/^0+([^0])/, '$1')); - return NaN; - } - - /** * computes state of a room, states are: * closed, FreeNoEnd, Free, ClaendarEvent. * @param Room Object @@ -485,6 +471,7 @@ room.state = {state: "Free", end: closing, titel: "", next: "closing"}; } } + /** * checks if a room is open * @param room Room object @@ -585,30 +572,6 @@ } /** - * checks if a room is on a given date/time open - * @param date Date Object - * @param room Room object - * @returns {Boolean} for open or not - */ - function IsOpen(date, room) { - if (!room.openingTimes || room.openingTimes.length === 0) return true; - var tmp = room.openingTimes[date.getDay()]; - if (!tmp) return false; - var openDate = new Date(date.getTime()); - var closeDate = new Date(date.getTime()); - for (var i = 0; i < tmp.length; i++) { - openDate.setHours(tmp[i].HourOpen); - openDate.setMinutes(tmp[i].MinutesOpen); - closeDate.setHours(tmp[i].HourClose); - closeDate.setMinutes(tmp[i].MinutesClose); - if (openDate < date && closeDate > date) { - return true; - } - } - return false; - } - - /** * returns next closing time of a given room * @param room * @returns Date Object of next closing @@ -800,38 +763,6 @@ }); } - - /** - * used for countdown - * computes the time difference between 2 Date objects - * @param a Date Object - * @param b Date Object - * @returns time string - */ - function GetTimeDiferenceAsString(a, b) { - if (a == null || b == null) { - return ""; - } - var milliseconds = a.getTime() - b.getTime(); - var seconds = Math.floor((milliseconds / 1000) % 60); - milliseconds -= seconds * 1000; - var minutes = Math.floor((milliseconds / (1000 * 60)) % 60); - milliseconds -= minutes * 1000 * 60; - var hours = Math.floor((milliseconds / (1000 * 60 * 60)) % 24); - - var days = Math.floor((milliseconds / (1000 * 60 * 60 * 24)) % 31); - if (seconds < 10) { - seconds = "0" + seconds; - } - if (minutes < 10) { - minutes = "0" + minutes; - } - if (days != 0) { - // dont show? - return ""; - } - return hours + ":" + minutes + ":" + seconds; - } </script> </head> <body> |