From 8fe4b4f19d276b9e02afe828784c7a103bebad39 Mon Sep 17 00:00:00 2001 From: Emanuele Paolini Date: Wed, 7 Feb 2024 12:57:58 +0100 Subject: [PATCH] =?UTF-8?q?aggiunta=20modalit=C3=A0=20test=20cos=C3=AC=20r?= =?UTF-8?q?imuoviamo=20il=20repository=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- fullscreenImagePage.js | 4 +++- index.js | 9 ++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b0d8934..7fa542e 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,4 @@ Pagina HTML da visualizzare sullo schermo nell'atrio del dipartimento Lo puoi vedere qui: produzione: https://unipisa.github.io/dm-monitor/ -test: https://unipisa.github.io/dm-monitor-test/ \ No newline at end of file +test: https://unipisa.github.io/dm-monitor/?test \ No newline at end of file diff --git a/fullscreenImagePage.js b/fullscreenImagePage.js index 75403b2..e7ed6c4 100644 --- a/fullscreenImagePage.js +++ b/fullscreenImagePage.js @@ -1,8 +1,9 @@ class FullScreenImagePage { - constructor({imageUrl,start,end}) { + constructor({imageUrl,start,end,test}) { this.imageUrl = imageUrl this.startDate = start this.endDate = end + this.test = test console.log(`constructor ${this.start}`) } @@ -34,6 +35,7 @@ class FullScreenImagePage { } priority() { + if (this.test) return 1 const showSpecialStart = moment.tz(this.startDate, "Europe/Rome").unix() const showSpecialEnd = moment.tz(this.endDate, "Europe/Rome").unix() if (moment().unix() >= showSpecialStart && moment().unix() <= showSpecialEnd) { diff --git a/index.js b/index.js index dfa9043..f364fa4 100644 --- a/index.js +++ b/index.js @@ -1,8 +1,12 @@ +// true se si aggiunge ?test alla fine dell'URL +const TEST = window.location.search.includes('test') + const pages = [ new FullScreenImagePage({ imageUrl: "images/colloquium_levine.png?d=20231213x", start: "2024-02-19 06:00", - end: "2024-02-19 18:44" + end: "2024-02-19 18:44", + test: TEST, // mostra sempre in modalità test }), new EventsAndVisitorsPage(), @@ -15,6 +19,7 @@ const pages = [ url: "https://lab.phc.dm.unipi.it/problemi/jumbotron", duration: 60000, priority: () => { + if (TEST) return 1 // mostra sempre in modalità test // show with high priority // between 7pm and 7am const date = moment().tz("Europe/Rome").format('HH-mm') @@ -27,6 +32,7 @@ const pages = [ url: "https://montblanc.panomax.com/", duration: 60000, priority: () => { + if (TEST) return 1 // mostra sempre in modalità test // show only in minute 14 const date = moment().tz("Europe/Rome").format('mm') if (date === '42') return 3 @@ -40,6 +46,7 @@ const pages = [ url: "https://zoncolan.panomax.com/", duration: 60000, priority: () => { + if (TEST) return 1 // mostra sempre in modalità test // show only in minute 19 const date = moment().tz("Europe/Rome").format('mm') if (date === '19') return 3