summaryrefslogtreecommitdiffstats
path: root/modules-available/locationinfo/templates/frontend-default.html
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/locationinfo/templates/frontend-default.html')
-rwxr-xr-xmodules-available/locationinfo/templates/frontend-default.html103
1 files changed, 10 insertions, 93 deletions
diff --git a/modules-available/locationinfo/templates/frontend-default.html b/modules-available/locationinfo/templates/frontend-default.html
index 4147e4e2..92cad055 100755
--- a/modules-available/locationinfo/templates/frontend-default.html
+++ b/modules-available/locationinfo/templates/frontend-default.html
@@ -343,6 +343,7 @@ optional:
<script type='text/javascript' src='{{dirprefix}}script/jquery.js'></script>
<script type='text/javascript' src='{{dirprefix}}modules/js_jqueryui/clientscript.js'></script>
<script type='text/javascript' src="{{dirprefix}}modules/js_weekcalendar/clientscript.js"></script>
+ <script type='text/javascript' src='{{dirprefix}}modules/locationinfo/frontend/frontendscript.js'></script>
</head>
<body>
@@ -980,10 +981,11 @@ optional:
var columnWidth = $cal.find(".wc-day-1").width();
if (room.config.scaledaysauto) {
- var result = ($cal.weekCalendar("option", "daysToShow") * columnWidth) / 100;
+ var result = ($cal.weekCalendar("option", "daysToShow") * columnWidth) / 130;
result = parseInt(Math.min(Math.max(Math.abs(result), 1), 7));
if (result !== $cal.weekCalendar("option", "daysToShow")) {
$cal.weekCalendar("option", "daysToShow", result);
+ columnWidth = $cal.find(".wc-day-1").width();
}
}
if (((!room.config.scaledaysauto) || $cal.weekCalendar("option", "daysToShow") === 1) && columnWidth < 85) {
@@ -1007,21 +1009,21 @@ optional:
clientHeight -= 6;
var height = clientHeight / (room.openTimes * $cal.weekCalendar("option", "timeslotsPerHour"));
-
if (height < 30) {
height = 30;
}
+ var fontHeight = Math.min(height, columnWidth / 2.1);
// Scale calendar font
- if (height > 120) {
+ if (fontHeight > 120) {
$cal.weekCalendar("option", "textSize", 28);
}
- else if (height > 100) {
+ else if (fontHeight > 100) {
$cal.weekCalendar("option", "textSize", 24);
- } else if (height > 80) {
+ } else if (fontHeight > 80) {
$cal.weekCalendar("option", "textSize", 22);
- } else if (height > 70) {
+ } else if (fontHeight > 70) {
$cal.weekCalendar("option", "textSize", 20);
- } else if (height > 60) {
+ } else if (fontHeight > 60) {
$cal.weekCalendar("option", "textSize", 14);
} else {
$cal.weekCalendar("option", "textSize", 13);
@@ -1040,50 +1042,6 @@ optional:
}
/**
- * used for countdown
- * computes the time difference between 2 Date objects
- * @param {Date} a
- * @param {Date} b
- * @returns {string} printable time
- */
- function GetTimeDiferenceAsString(a, b) {
- if (!a || !b) {
- return "";
- }
- var milliseconds = a.getTime() - b.getTime();
- var days = Math.floor((milliseconds / (1000 * 60 * 60 * 24)) % 31);
- if (days !== 0) {
- // don't show?
- return "";
- }
- 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);
-
- if (globalConfig.prettytime) {
- var str = '';
- if (hours > 0) {
- str += hours + 'h ';
- }
- str += minutes + 'min ';
- return str;
- }
-
- if (minutes < 10) {
- minutes = "0" + minutes;
- }
- if (globalConfig.eco) {
- return hours + ":" + minutes;
- }
- if (seconds < 10) {
- seconds = "0" + seconds;
- }
- return hours + ":" + minutes + ":" + seconds;
- }
-
- /**
* returns next closing time of a given room
* @param room
* @returns {Date} Object of next closing
@@ -1114,32 +1072,6 @@ optional:
return null;
}
-
- /**
- * 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 Opening
* @param room Room Object
@@ -1200,7 +1132,7 @@ optional:
var newText = false, newTime = false;
var seats = room.freePcs;
if (tmp.state === 'closed' || tmp.state === 'CalendarEvent' || tmp.state === 'Free') {
- newTime = GetTimeDiferenceAsString(tmp.end, MyDate());
+ newTime = GetTimeDiferenceAsString(tmp.end, MyDate(), globalConfig);
} else if (!same) {
newTime = '';
}
@@ -1726,20 +1658,5 @@ optional:
}, interval);
}
- /**
- * 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;
- }
-
</script>
</html>