From da9e025f2b8aa7984782ea86f534530a7c0972f0 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 20 Jun 2017 15:36:37 +0200 Subject: [locationinfo] Finish doorsign.html --- .../locationinfo/frontend/doorsign.html | 2759 ++++++++++---------- 1 file changed, 1364 insertions(+), 1395 deletions(-) (limited to 'modules-available/locationinfo/frontend/doorsign.html') diff --git a/modules-available/locationinfo/frontend/doorsign.html b/modules-available/locationinfo/frontend/doorsign.html index eb15c9d0..a39b982a 100755 --- a/modules-available/locationinfo/frontend/doorsign.html +++ b/modules-available/locationinfo/frontend/doorsign.html @@ -20,113 +20,131 @@ optional: roomupdate: Time the PCs in the room gets updated,in seconds. rotation:[0-3] rotation of the roomplan vertical:[true] only mode 1, sets the calendar above the roomplan - scaledaysauto: [true] if true it finds automaticly the daystoshow parameter depending on display size + scaledaysauto: [true] if true it finds automatically the daystoshow parameter depending on display size --> DoorSign - - - - + + + + + - $(document).ready(function () { - var uuid = getUrlParameter("uuid"); - if (!uuid) { - console.log('No panel uuid given'); - $("body").empty().append($('

').text('No panel UUID given.')); - return; - } - getConfig(uuid); - }); + - - - + + /** + * Used in Mode 4, switches given room from Timetable to room layout and vice versa + */ + function switchLayouts() { + for (var roomKey in rooms) { + var room = rooms[roomKey]; + if (room.config.mode !== 4) continue; + if (room.$.layout.is(':visible')) { + room.$.layout.hide(); + room.$.calendar.show(); + } else { + room.$.layout.show(); + room.$.calendar.hide(); + } + resizeIfRequired(room); + } + lastSwitchTime = MyDate().getTime(); + } + + var $pbar = false; + var pbarTimer = false; + const PX_PER_SEC_TARGET = 10; + + /** + * adds a progressbar (id) used in mode 4 + */ + function generateProgressBar() { + if ($pbar) return; + $pbar = $('
'); + $('body').append($pbar); + SetProgressBarSpeed(); + } + + function SetProgressBarSpeed() { + if (!$pbar || !globalConfig.switchtime) return; + if (pbarTimer) clearInterval(pbarTimer); + var interval = 1000; + if (!globalConfig.eco) { + var pxPerMSec = $('body').width() / globalConfig.switchtime; + interval = Math.max(1 / (pxPerMSec / PX_PER_SEC_TARGET), 100); + } + pbarTimer = setInterval(function () { + var width = ((MyDate().getTime() - lastSwitchTime) / globalConfig.switchtime) * 100; + if (width < 0) width = 0; + if (width >= 100) { + width = 100; + switchLayouts(); + } + $pbar.width(width + '%'); + }, interval); + } + + 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; + } + + -- cgit v1.2.3-55-g7522