Last active
July 25, 2020 20:54
-
-
Save fletchto99/39af6486c1a0ae89c527d5e1b03e0d9d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Tomorroland timetable line | |
// @namespace http://tampermonkey.net/ | |
// @version 1.0 | |
// @description Tomorroland timetable line! | |
// @author fletchto99 | |
// @match https://timetable.aroundtheworld.tomorrowland.com/* | |
// @run-at document-end | |
// @grant GM_addStyle | |
// ==/UserScript== | |
GM_addStyle ( ` | |
.stage::before { | |
content:"" !important; | |
position: absolute !important; | |
z-index: 1 !important; | |
top: 0 !important; | |
bottom: 0 !important; | |
left: var(--time) !important; | |
border-left: 2px dotted #ffcc5d !important; | |
} | |
` ); | |
(function() { | |
'use strict'; | |
let start = 1595692800000; | |
let end = 1595718000000; | |
let day = 86400000; | |
if (Date.now() > end) { | |
end = end + day | |
start = start + day | |
} | |
let style = () => { | |
let q = Math.abs(Date.now()-start); | |
let d = Math.abs(end-start); | |
document.querySelectorAll(".stage").forEach(elem => { | |
elem.style.setProperty('--time', Math.round((q/d)*3360) + 'px'); | |
}) | |
} | |
setTimeout(style, 1) | |
setInterval(style, 1000) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment