* Added new link to dev
* hopefully fixed evermany cinema breaking * little tidyup of events.js
This commit is contained in:
parent
30727cdc96
commit
7911eb50a4
2
dist/build/bundle.css
vendored
2
dist/build/bundle.css
vendored
@ -1,5 +1,5 @@
|
||||
.svelte-1juin59{padding:3px}.pointer.svelte-1juin59{cursor:pointer}.up.svelte-1juin59,.down.svelte-1juin59{display:inline-block;background-size:contain;width:0.8em;height:0.8em}.up.svelte-1juin59,.down.svelte-1juin59{background-image:url("data:image/svg+xml,%3Csvg width='32' height='32' version='1.1' viewBox='0 0 8.4667 8.4667' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m0.82549 1.3138h5.6797l1.136 2e-7 -3.4078 5.8215z' style='stroke-width:.035938;stroke:%23000'/%3E%3C/svg%3E%0A")}.up.svelte-1juin59{background-image:url("data:image/svg+xml,%3Csvg width='32' height='32' version='1.1' viewBox='0 0 8.4667 8.4667' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m1.3226 7.6324v-5.6797l2e-7 -1.136 5.8215 3.4078z' style='stroke-width:.035938;stroke:%23000'/%3E%3C/svg%3E%0A")}
|
||||
.svelte-oqm7j5{font-size:90%}
|
||||
.svelte-1dnn1u0{padding:3px}.up.svelte-1dnn1u0,.down.svelte-1dnn1u0{display:inline-block;background-size:contain;width:0.8em;height:0.8em}.up.svelte-1dnn1u0,.down.svelte-1dnn1u0{background-image:url("data:image/svg+xml,%3Csvg width='32' height='32' version='1.1' viewBox='0 0 8.4667 8.4667' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m0.82549 1.3138h5.6797l1.136 2e-7 -3.4078 5.8215z' style='stroke-width:.035938;stroke:%23000'/%3E%3C/svg%3E%0A")}.up.svelte-1dnn1u0{background-image:url("data:image/svg+xml,%3Csvg width='32' height='32' version='1.1' viewBox='0 0 8.4667 8.4667' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m1.3226 7.6324v-5.6797l2e-7 -1.136 5.8215 3.4078z' style='stroke-width:.035938;stroke:%23000'/%3E%3C/svg%3E%0A")}
|
||||
.routeBox.svelte-12mw410{border:1px dotted silver}
|
||||
.timerContainer.svelte-1woqwo5.svelte-1woqwo5{border:1px solid #BDBDBD;background-color:#EEEEEE}.inner.svelte-1woqwo5.svelte-1woqwo5{display:flex;color:#333;flex-direction:column;align-items:center;justify-content:center}.timer-value.svelte-1woqwo5.svelte-1woqwo5{display:flex;color:#333;flex-direction:row;align-items:center;justify-content:center;font-size:24px;height:100%;width:100%}.timer-value.svelte-1woqwo5 small.svelte-1woqwo5{font-size:18px;margin-left:4px}
|
||||
.card.svelte-1y1eghs{position:relative;background-color:#fff;min-height:72px}.mui--text-display3.svelte-1y1eghs{font-family:"Roboto Slab", "Helvetica Neue", Helvetica, Arial}.temp0.svelte-1y1eghs,.temp1.svelte-1y1eghs,.temp2.svelte-1y1eghs,.temp3.svelte-1y1eghs,.temp4.svelte-1y1eghs,.temp5.svelte-1y1eghs{color:rgb(80, 181, 221)
|
||||
|
8
dist/build/bundle.css.map
vendored
8
dist/build/bundle.css.map
vendored
@ -2,19 +2,19 @@
|
||||
"version": 3,
|
||||
"file": "bundle.css",
|
||||
"sources": [
|
||||
"../../Fx.svelte",
|
||||
"../../Revealer.svelte",
|
||||
"../../Fx.svelte",
|
||||
"../../Route.svelte",
|
||||
"../../Timer.svelte",
|
||||
"../../Weather.svelte"
|
||||
],
|
||||
"sourcesContent": [
|
||||
"<script>\n import {slide} from 'svelte/transition';\n\n let viewMode = 0;\n let icon;\n\n $: icon = (viewMode === 0) ? 'up' : 'down';\n\n function changeViewMode() {\n viewMode = (viewMode === 0) ? 1 : 0;\n }\n</script>\n\n<style>\n * {\n padding: 3px;\n }\n .pointer {cursor: pointer;}\n .up, .down{\n display:inline-block;\n background-size: contain;\n width:0.8em;\n height:0.8em;\n }\n .up, .down{\n background-image: url(\"data:image/svg+xml,%3Csvg width='32' height='32' version='1.1' viewBox='0 0 8.4667 8.4667' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m0.82549 1.3138h5.6797l1.136 2e-7 -3.4078 5.8215z' style='stroke-width:.035938;stroke:%23000'/%3E%3C/svg%3E%0A\");\n }\n .up{\n background-image: url(\"data:image/svg+xml,%3Csvg width='32' height='32' version='1.1' viewBox='0 0 8.4667 8.4667' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m1.3226 7.6324v-5.6797l2e-7 -1.136 5.8215 3.4078z' style='stroke-width:.035938;stroke:%23000'/%3E%3C/svg%3E%0A\");\n }\n</style>\n\n\n<div><div on:click={changeViewMode} class=\"pointer {icon}\"></div>\n <span on:click={changeViewMode} class=\"pointer\"><slot name=\"header\">No header was provided</slot></span>\n</div>\n{#if viewMode === 1}\n <div transition:slide>\n <slot></slot>\n </div>\n{/if}\n",
|
||||
"<script>\n import {onMount} from 'svelte';\n\n const __url = (__ENV__ === 'production') ? 'https://silvrtree.co.uk' : 'http://localhost:9000';\n\n\n let fxData={};\n\n onMount(async () => {\n await update();\n });\n\n async function update() {\n await getFX();\n\n const now = new Date();\n const mod = 1800000 - (now.getTime() % 1800000);\n\n const fxUpdateFn = function () {\n update();\n };\n\n setTimeout(fxUpdateFn.bind(this), mod + 10);\n }\n\n function reduceFX(data) {\n\n if (data.rates !== undefined) {\n const gpbex = (1 / data.rates.GBP);\n const sekex = (gpbex * data.rates.SEK);\n fxData = {\n 'usd': 1,\n 'gbp': data.rates.GBP,\n 'sek': data.rates.SEK,\n 'gpbe': gpbex,\n 'sekex': sekex\n };\n }\n\n }\n\n async function getFX() {\n\n const res = await fetch(`${__url}/fx`);\n const json = await res.json();\n\n if (json) reduceFX(json);\n }\n</script>\n\n<style>\n * {\n font-size: 90%;\n }\n</style>\n\n{#if fxData.gpbe}\n<span>\n £1 = ${parseFloat(fxData.gpbe.toFixed(2))} = { parseFloat(fxData.sekex.toFixed(2))} SEK\n</span>\n\n{/if}\n\n\n",
|
||||
"<script>\n import {slide} from 'svelte/transition';\n\n let viewMode = 0;\n let icon;\n\n $: icon = (viewMode === 0) ? 'up' : 'down';\n\n function changeViewMode() {\n viewMode = (viewMode === 0) ? 1 : 0;\n }\n</script>\n\n<style>\n * {\n padding: 3px;\n }\n .up, .down{\n display:inline-block;\n background-size: contain;\n width:0.8em;\n height:0.8em;\n }\n .up, .down{\n background-image: url(\"data:image/svg+xml,%3Csvg width='32' height='32' version='1.1' viewBox='0 0 8.4667 8.4667' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m0.82549 1.3138h5.6797l1.136 2e-7 -3.4078 5.8215z' style='stroke-width:.035938;stroke:%23000'/%3E%3C/svg%3E%0A\");\n }\n .up{\n background-image: url(\"data:image/svg+xml,%3Csvg width='32' height='32' version='1.1' viewBox='0 0 8.4667 8.4667' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m1.3226 7.6324v-5.6797l2e-7 -1.136 5.8215 3.4078z' style='stroke-width:.035938;stroke:%23000'/%3E%3C/svg%3E%0A\");\n }\n</style>\n\n\n<div><div on:click={changeViewMode} class=\"{icon}\"></div>\n <span on:click={changeViewMode}><slot name=\"header\">No header was provided</slot></span>\n</div>\n{#if viewMode === 1}\n <div transition:slide>\n <slot></slot>\n </div>\n{/if}\n",
|
||||
"<script>\n import {route} from './store';\n\n const __url = (__ENV__ === 'production') ? 'https://traintimes.silvrtree.co.uk' : 'http://localhost:8100';\n\n let visible = false;\n let fromStation;\n let toStation;\n let url;\n let routeData = {};\n let services = [];\n\n route.subscribe(async (v) => {\n console.log('>> route', v);\n fromStation = v.fromStation;\n toStation = v.toStation;\n visible = (fromStation !== '') ? !visible : false;\n\n // url = `https://traintimes.silvrtree.co.uk/gettrains?from=${ fromStation }&to=${ toStation}`;\n\n url = `${__url}/gettrains?from=${fromStation}&to=${toStation}`;\n\n if (fromStation !== '' && visible) {\n await update();\n }\n });\n\n function reduceRoute(data) {\n const newData = {};\n\n newData.fromName = data.locationName;\n newData.toName = data.filterLocationName;\n newData.services = [];\n\n\n if (typeof data.trainServices === 'object' && data.trainServices !== null)\n for (const item of data.trainServices) {\n const dest = item.destination[0];\n const via = dest.via !== null ? `<em>${dest.via}</em>` : '';\n const platform = item.platform !== null ? item.platform : '💠';\n const time = item.sta !== null ? item.sta : `D ${item.std}`;\n const status = item.eta !== null ? item.eta : item.etd;\n const cls = (status.toLowerCase() === 'on time') ? 'ontime' : 'delayed';\n newData.services.push({\n 'location': dest.locationName,\n 'time': time,\n 'via': via,\n 'class': cls,\n 'status': status,\n 'platform': platform,\n 'cancelReason': item.cancelReason,\n 'type': 'train',\n 'isCancelled': item.isCancelled,\n icon: ''\n });\n }\n\n if (typeof data.busServices === 'object' && data.busServices !== null)\n for (const item of data.busServices) {\n const dest = item.destination[0];\n const via = dest.via !== null ? `<em>${dest.via}</em>` : '';\n const platform = item.platform !== null ? item.platform : '';\n const time = item.sta !== null ? item.sta : `D ${item.std}`;\n const status = item.eta !== null ? item.eta : item.etd;\n const cls = (status.toLowerCase() === 'on time') ? 'ontime' : 'delayed';\n newData.services.push({\n 'location': dest.locationName,\n 'time': time,\n 'via': via,\n 'class': cls,\n 'status': status,\n 'platform': platform,\n 'cancelReason': item.cancelReason,\n 'type': 'bus',\n 'isCancelled': item.isCancelled,\n icon: '🚌 '\n });\n }\n\n routeData = newData;\n services = newData.services;\n\n console.log(routeData);\n }\n\n async function update() {\n await getRoute();\n\n const now = new Date();\n const mod = 180000 - (now.getTime() % 180000);\n\n const routeUpdateFn = function () {\n update();\n };\n\n if(visible) setTimeout(routeUpdateFn.bind(this), mod + 10);\n\n }\n\n\n async function getRoute() {\n console.log('Get route', url);\n\n const res = await fetch(url);\n const json = await res.json();\n\n if (json) {\n console.log(json);\n // data = json;\n reduceRoute(json);\n }\n\n\n }\n\n</script>\n\n<style>\n .routeBox {\n border:1px dotted silver;\n }\n</style>\n\n{#if visible}\n<div class=\"routeBox\">\n <div>{routeData.fromName} TO {routeData.toName}</div>\n <table class=\"mui-table mui-table-bordered\">\n <thead>\n <tr>\n <th>Destination</th>\n <th>Time</th>\n <th>Status</th>\n <th>Platform</th>\n </tr>\n </thead>\n\n <tbody>\n {#each services as item}\n <tr>\n\n <td>{item.icon}{item.location} {@html item.via}</td>\n <td class={item.class}>{item.time}</td>\n {#if !item.isCancelled}\n <td class={item.class}>{item.status}</td>\n <td>{item.platform}</td>\n {:else}\n <td colspan=\"2\" class=\"delayed\">❌ {item.cancelReason}</td>\n {/if}\n </tr>\n {/each}\n </tbody>\n </table>\n\n</div>\n{/if}\n\n",
|
||||
"<script>\n import {tweened} from 'svelte/motion';\n import Revealer from \"./Revealer.svelte\";\n\n let timerVisible = false;\n let range = 25;\n let start;\n let timerID = 0;\n let snd;\n // let timer = 0;\n\n $: startVal = range * 60;\n $: timer = tweened(startVal);\n\n $: minutes = Math.floor($timer / 60);\n $: minname = minutes > 1 ? \"mins\" : \"min\";\n $: seconds = Math.floor($timer - minutes * 60)\n\n const progress = tweened(0, {duration: 1000})\n $: {\n $progress = 1 - ($timer / startVal)\n }\n\n function complete() {\n snd = new Audio('stuff/bell.mp3');\n snd.play();\n\n }\n\n function stopTimer() {\n clearInterval(timerID);\n timerID = 0;\n }\n\n function showTimer() {\n timerVisible = !timerVisible;\n if (!timerVisible) {\n // clearTimer\n stopTimer();\n }\n }\n\n function startTimer() {\n\n if (timerID !== 0) {\n stopTimer();\n } else {\n timerID = setInterval(() => {\n if ($timer > 0) $timer--\n else {\n stopTimer();\n complete();\n }\n }, 1000);\n\n }\n\n }\n\n</script>\n\n<style>\n .timerContainer {\n border: 1px solid #BDBDBD;\n background-color: #EEEEEE;\n\n }\n\n .inner {\n display: flex;\n /*mix-blend-mode: difference;*/\n color: #333;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .timer-value {\n display: flex;\n /*mix-blend-mode: difference;*/\n color: #333;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n font-size: 24px;\n height: 100%;\n width: 100%;\n }\n\n .timer-value small {\n font-size: 18px;\n margin-left: 4px;\n }\n</style>\n<div id=\"timer\">\n <Revealer>\n <span slot=\"header\">Timer</span>\n <div class=\"timerContainer\">\n <div class=\"inner\">\n <label>\n <input type=\"range\" bind:value={range} min=1 max=60>\n <button on:click={startTimer} class=\"mui-btn mui-btn--flat mui-btn--dark\">\n {#if timerID === 0}\n Start\n {:else}\n Stop\n {/if}\n </button>\n </label>\n\n </div>\n <div class=\"timer-value\" style=\"color: hsl({120 * (1-$progress)}deg, 50%, 50%) !important\">\n <span>{minutes}mins</span>\n <small>{seconds}s</small>\n </div>\n\n </div>\n </Revealer>\n</div>\n\n",
|
||||
"<script>\n import {tweened} from 'svelte/motion';\n import Revealer from '@rakh/svelte-revealer';\n\n let timerVisible = false;\n let range = 25;\n let start;\n let timerID = 0;\n let snd;\n // let timer = 0;\n\n $: startVal = range * 60;\n $: timer = tweened(startVal);\n\n $: minutes = Math.floor($timer / 60);\n $: minname = minutes > 1 ? \"mins\" : \"min\";\n $: seconds = Math.floor($timer - minutes * 60)\n\n const progress = tweened(0, {duration: 1000})\n $: {\n $progress = 1 - ($timer / startVal)\n }\n\n function complete() {\n snd = new Audio('stuff/bell.mp3');\n snd.play();\n\n }\n\n function stopTimer() {\n clearInterval(timerID);\n timerID = 0;\n }\n\n function showTimer() {\n timerVisible = !timerVisible;\n if (!timerVisible) {\n // clearTimer\n stopTimer();\n }\n }\n\n function startTimer() {\n\n if (timerID !== 0) {\n stopTimer();\n } else {\n timerID = setInterval(() => {\n if ($timer > 0) $timer--\n else {\n stopTimer();\n complete();\n }\n }, 1000);\n\n }\n\n }\n\n</script>\n\n<style>\n .timerContainer {\n border: 1px solid #BDBDBD;\n background-color: #EEEEEE;\n\n }\n\n .inner {\n display: flex;\n /*mix-blend-mode: difference;*/\n color: #333;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .timer-value {\n display: flex;\n /*mix-blend-mode: difference;*/\n color: #333;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n font-size: 24px;\n height: 100%;\n width: 100%;\n }\n\n .timer-value small {\n font-size: 18px;\n margin-left: 4px;\n }\n</style>\n<div id=\"timer\">\n <Revealer>\n <span slot=\"header\">Timer</span>\n <div class=\"timerContainer\">\n <div class=\"inner\">\n <label>\n <input type=\"range\" bind:value={range} min=1 max=60>\n <button on:click={startTimer} class=\"mui-btn mui-btn--flat mui-btn--dark\">\n {#if timerID === 0}\n Start\n {:else}\n Stop\n {/if}\n </button>\n </label>\n\n </div>\n <div class=\"timer-value\" style=\"color: hsl({120 * (1-$progress)}deg, 50%, 50%) !important\">\n <span>{minutes}mins</span>\n <small>{seconds}s</small>\n </div>\n\n </div>\n </Revealer>\n</div>\n\n",
|
||||
"<script>\n import {onMount} from 'svelte';\n import {format} from 'fecha';\n\n const __url = (__ENV__ === 'production') ? 'https://silvrtree.co.uk/weather' : 'http://localhost:9000/weather';\n\n let weatherData;\n\n onMount(async () => {\n await update();\n });\n\n async function update() {\n await getWeather();\n\n const now = new Date();\n const mod = 1800000 - (now.getTime() % 1800000);\n\n const weatherUpdateFn = function () {\n update();\n };\n\n setTimeout(weatherUpdateFn.bind(this), mod + 10);\n }\n\n function reduceOpenWeather(item) {\n // Openweather returns timestamps in seconds. Moment requires them in milliseconds.\n\n const ts = new Date(item.dt * 1000);\n\n const weatherBlock = item.weather[0];\n\n return {\n 'timestamp': item.dt,\n 'icon': `wi-owm-${weatherBlock.id}`,\n 'summary': weatherBlock.description,\n 'tempHigh': parseInt(item.temp.max, 10),\n 'tempLow': parseInt(item.temp.min, 10),\n 'tempMorn' : parseInt(item.temp.morn, 10),\n 'tempDay' : parseInt(item.temp.day, 10),\n 'tempEve' : parseInt(item.temp.eve, 10),\n 'tempNight' : parseInt(item.temp.night, 10),\n 'datelong': format(ts, 'isoDateTime'),\n 'time': item.dt,\n 'date': format(ts, 'D/M'),\n 'day': format(ts, 'ddd'),\n 'tempHighClass': `temp${parseInt(item.temp.max, 10)}`,\n 'tempLowClass': `temp${parseInt(item.temp.min, 10)}`\n\n };\n }\n\n async function getWeather() {\n\n const res = await fetch(__url);\n const json = await res.json();\n\n if (json) {\n weatherData = json.list.map((item) => {\n // Reduce the data\n return reduceOpenWeather(item);\n });\n }\n }\n\n</script>\n\n<style>\n .card {\n position: relative;\n background-color: #fff;\n min-height: 72px;\n }\n\n .mui--text-display3 {\n font-family: \"Roboto Slab\", \"Helvetica Neue\", Helvetica, Arial;\n }\n\n .temp0, .temp1, .temp2, .temp3, .temp4, .temp5 {\n color: rgb(80, 181, 221)\n }\n\n .temp6 {\n color: rgb(78, 178, 206)\n }\n\n .temp7 {\n color: rgb(76, 176, 190)\n }\n\n .temp8 {\n color: rgb(73, 173, 175)\n }\n\n .temp9 {\n color: rgb(72, 171, 159)\n }\n\n .temp10 {\n color: rgb(70, 168, 142)\n }\n\n .temp11 {\n color: rgb(68, 166, 125)\n }\n\n .temp12 {\n color: rgb(66, 164, 108)\n }\n\n .temp13 {\n color: rgb(102, 173, 94)\n }\n\n .temp14 {\n color: rgb(135, 190, 64)\n }\n\n .temp15 {\n color: rgb(179, 204, 26)\n }\n\n .temp16 {\n color: rgb(214, 213, 28)\n }\n\n .temp17 {\n color: rgb(249, 202, 3)\n }\n\n .temp18 {\n color: rgb(246, 181, 3)\n }\n\n .temp19 {\n color: rgb(244, 150, 26)\n }\n\n .temp20 {\n color: rgb(236, 110, 5)\n }\n\n .day {\n font-family: \"Roboto Slab\", \"Helvetica Neue\", Helvetica, Arial, SansSerif;\n text-transform: uppercase;\n }\n\n .summary::first-letter {\n text-transform: capitalize\n }\n</style>\n\n<div id='weather'>\n\n {#if weatherData}\n {#each weatherData as item}\n <div class=\"card mui--z1 mui-col-md-6 mui-col-lg-4\">\n <div class=\"mui-col-md-3 mui-col-sm-6 mui-col-xs-6\">\n <div class=\"mui--text-accent mui--text-title day mui--text-center\">{item.day}</div>\n <div class=\"mui--text-dark-secondary mui--text-subhead mui--text-center\">{item.date}</div>\n </div>\n <div class=\"mui-col-md-7 mui-col-sm-6 mui-col-xs-6\">\n <div>\n <i class=\"mui--text-headline wi {item.icon }\"></i>\n <span class=\"mui--text-display1 {item.tempHighClass}\">{item.tempHigh}°</span> /\n <span class=\"mui--text-headline {item.tempLowClass}\">{item.tempLow}°</span>\n </div>\n <div class=\"mui--text-caption summary\">{item.summary}</div>\n </div>\n <div class=\"mui-col-md-2 mui--hidden-xs mui--hidden-sm\">\n <div class=\"mui--text-caption\">{item.tempMorn}°</div>\n <div class=\"mui--text-caption\">{item.tempDay}°</div>\n <div class=\"mui--text-caption\">{item.tempEve}°</div>\n <div class=\"mui--text-caption\">{item.tempNight}°</div>\n </div>\n </div>\n {/each}\n {/if}\n\n</div>\n"
|
||||
],
|
||||
"names": [],
|
||||
"mappings": "AAmDI,cAAE,CAAC,AACC,SAAS,CAAE,GAAG,AAClB,CAAC;ACvCD,eAAE,CAAC,AACC,OAAO,CAAE,GAAG,AAChB,CAAC,AACD,kBAAG,CAAE,oBAAK,CAAC,AACP,QAAQ,YAAY,CACpB,eAAe,CAAE,OAAO,CACxB,MAAM,KAAK,CACX,OAAO,KAAK,AAChB,CAAC,AACD,kBAAG,CAAE,oBAAK,CAAC,AACP,gBAAgB,CAAE,IAAI,2PAA2P,CAAC,AACtR,CAAC,AACD,kBAAG,CAAC,AACA,gBAAgB,CAAE,IAAI,2PAA2P,CAAC,AACtR,CAAC;AC0FJ,SAAS,eAAC,CAAC,AACP,OAAO,GAAG,CAAC,MAAM,CAAC,MAAM,AAC5B,CAAC;AC1DE,eAAe,8BAAC,CAAC,AACb,MAAM,CAAE,GAAG,CAAC,KAAK,CAAC,OAAO,CACzB,gBAAgB,CAAE,OAAO,AAE7B,CAAC,AAED,MAAM,8BAAC,CAAC,AACJ,OAAO,CAAE,IAAI,CAEb,KAAK,CAAE,IAAI,CACX,cAAc,CAAE,MAAM,CACtB,WAAW,CAAE,MAAM,CACnB,eAAe,CAAE,MAAM,AAC3B,CAAC,AAED,YAAY,8BAAC,CAAC,AACV,OAAO,CAAE,IAAI,CAEb,KAAK,CAAE,IAAI,CACX,cAAc,CAAE,GAAG,CACnB,WAAW,CAAE,M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AC;IAC5B,CAAC,AAED,OAAO,eAAC,CAAC,AACL,KAAK,CAAE,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;IAC5B,CAAC,AAED,OAAO,eAAC,CAAC,AACL,KAAK,CAAE,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;IAC5B,CAAC,AAED,OAAO,eAAC,CAAC,AACL,KAAK,CAAE,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC,AAED,OAAO,eAAC,CAAC,AACL,KAAK,CAAE,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC,AAED,OAAO,eAAC,CAAC,AACL,KAAK,CAAE,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;IAC5B,CAAC,AAED,OAAO,eAAC,CAAC,AACL,KAAK,CAAE,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC,AAED,IAAI,eAAC,CAAC,AACF,WAAW,CAAE,aAAa,CAAC,CAAC,gBAAgB,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CACzE,cAAc,CAAE,SAAS,AAC7B,CAAC,AAED,uBAAQ,cAAc,AAAC,CAAC,AACpB,cAAc,CAAE,UAAU;IAC9B,CAAC"
|
||||
}
|
2
dist/build/bundle.js
vendored
2
dist/build/bundle.js
vendored
File diff suppressed because one or more lines are too long
@ -1,4 +1,7 @@
|
||||
const http = require('http'), request = require('request'), cheerio = require('cheerio');
|
||||
const http = require('http');
|
||||
const request = require('request');
|
||||
const cheerio = require('cheerio');
|
||||
const logger = require('log4js').getLogger('Events');
|
||||
|
||||
const eventTimer = 0;
|
||||
const eventCache = {
|
||||
@ -12,11 +15,11 @@ const eventCache = {
|
||||
const cinemas = [{ 'id': 'cwr', 'url': 'https://film.list.co.uk/cinema/14982-cineworld-renfrew-street/' },
|
||||
{ 'id': 'gsc', 'url': 'https://film.list.co.uk/cinema/13590-cineworld-glasgow-science-centre/' },
|
||||
{ 'id': 'pho', 'url': 'https://film.list.co.uk/cinema/12500-showcase-cinema-paisley/' },
|
||||
{'id':'evr', 'url':'https://film.list.co.uk/cinema/111845-everyman-glasgow/'}];
|
||||
{ 'id':'evr', 'url':'https://film.list.co.uk/cinema/111845-everyman-glasgow/' }];
|
||||
|
||||
module.exports = {
|
||||
'getEvents': function (req, res) {
|
||||
console.log('Getting events...');
|
||||
logger.debug('Getting events...');
|
||||
const j = [], url = 'https://www.list.co.uk/events/days-out/when:this%20weekend/location:Dumbarton(55.9460,-4.5556)/distance:20/';
|
||||
|
||||
const now = new Date();
|
||||
@ -26,8 +29,8 @@ module.exports = {
|
||||
if (err)
|
||||
throw err;
|
||||
$ = cheerio.load(body);
|
||||
// console.log($);
|
||||
// TODO: scraping goes here!
|
||||
// logger.debug($);
|
||||
// TODO: scraping goes here!
|
||||
|
||||
$('.resultsRow').each(function (div) {
|
||||
const item = {};
|
||||
@ -61,7 +64,7 @@ module.exports = {
|
||||
}
|
||||
});
|
||||
else {
|
||||
console.log('Using event cache...');
|
||||
logger.info('Using event cache...');
|
||||
|
||||
res.render('pages/events', eventCache);
|
||||
}
|
||||
@ -70,18 +73,19 @@ module.exports = {
|
||||
const cinemaID = cinemas[id].id;
|
||||
const url = cinemas[id].url;
|
||||
const thisCinema = eventCache[cinemaID] || { 'data': {}, 'last': 0 };
|
||||
console.log(cinemaID);
|
||||
console.log(url);
|
||||
logger.debug(cinemaID);
|
||||
logger.debug(url);
|
||||
const j = [];
|
||||
|
||||
const now = new Date();
|
||||
|
||||
if ((now - thisCinema.last) > eventCache.expire)
|
||||
request(url, function (err, resp, body) {
|
||||
console.log('Working');
|
||||
if (err)
|
||||
logger.debug('Working');
|
||||
if (err)
|
||||
throw err;
|
||||
$ = cheerio.load(body);
|
||||
|
||||
const $ = cheerio.load(body);
|
||||
|
||||
$('.byEvent').each(function (div) {
|
||||
const item = {};
|
||||
@ -102,24 +106,24 @@ module.exports = {
|
||||
thisCinema.data = j;
|
||||
|
||||
eventCache[cinemaID] = thisCinema;
|
||||
console.log('returning');
|
||||
logger.debug('returning');
|
||||
|
||||
return thisCinema;
|
||||
}, function(error, response, body) {
|
||||
}, (error, response, body) => {
|
||||
if(response.statusCode !== 200) {
|
||||
console.error(response.statusCode);
|
||||
console.error(body);
|
||||
}
|
||||
});
|
||||
else {
|
||||
console.log('Using event cache...');
|
||||
logger.debug('Using event cache...');
|
||||
|
||||
return thisCinema;
|
||||
}
|
||||
},
|
||||
'getCinema': function (req, res) {
|
||||
const id = parseInt(req.params.id);
|
||||
console.log(`Getting cinema: ${ id}`);
|
||||
logger.debug(`Getting cinema: ${ id}`);
|
||||
|
||||
const output = module.exports.doGetCinema(id);
|
||||
res.render('pages/cinema', output);
|
||||
@ -128,6 +132,7 @@ module.exports = {
|
||||
let output = module.exports.doGetCinema(0);
|
||||
output = module.exports.doGetCinema(1);
|
||||
output = module.exports.doGetCinema(2);
|
||||
output = module.exports.doGetCinema(3);
|
||||
|
||||
setTimeout(function () {
|
||||
module.exports.preLoad();
|
||||
@ -136,8 +141,7 @@ module.exports = {
|
||||
};
|
||||
|
||||
setTimeout(function () {
|
||||
console.log('Pre loading cinemas...');
|
||||
logger.debug('Pre loading cinemas...');
|
||||
module.exports.preLoad();
|
||||
}, 10000);
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user