Quelle, en: Shadowrun Sixth World Website - Timer/Kopie Javascript
Zur Navigation springen
Zur Suche springen
Version 3
function getTimeRemaining(endtime) { var t = Date.parse(endtime) - Date.parse(new Date()); var seconds = Math.floor((t / 1000) % 60); var minutes = Math.floor((t / 1000 / 60) % 60); var hours = Math.floor((t / (1000 * 60 * 60)) % 24); var days = Math.floor(t / (1000 * 60 * 60 * 24)); return { 'total': t, 'days': days, 'hours': hours, 'minutes': minutes, 'seconds': seconds }; } function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } async function loopFinalSeconds() { var clock = document.getElementById('countdown'); var seconds = clock.querySelector('#seconds'); loop--; seconds.innerHTML = ('0' + loop).slice(-2); if (loop <= 0) { await sleep(250); loop = 13; for (i = 1; i <= 13; i++) { seconds.innerHTML = ('0' + i).slice(-2); await sleep(20); } } } function initializeClock(id, endtime) { var clock = document.getElementById(id); var days = clock.querySelector('#days'); var hours = clock.querySelector('#hours'); var minutes = clock.querySelector('#minutes'); var seconds = clock.querySelector('#seconds'); function updateClock() { var t = getTimeRemaining(endtime); if (t.total <= 0) { clearInterval(timeinterval); days.innerHTML = '0'; hours.innerHTML = '00'; minutes.innerHTML = '00'; seconds.innerHTML = '00'; timeinterval = setInterval(loopFinalSeconds, 1000); } else { days.innerHTML = t.days; hours.innerHTML = ('0' + t.hours).slice(-2); minutes.innerHTML = ('0' + t.minutes).slice(-2); seconds.innerHTML = ('0' + t.seconds).slice(-2); } } // updateClock(); var timeinterval = setInterval(updateClock, 1000); } var deadline = new Date('June 24, 2019 00:00:00 GMT-0000'); var loop = 0; initializeClock('countdown', deadline); async function matrix() { var messages = [ "> Anyone slept?<br/>> Glitch", "> Of course not! Way too much going on.<br/>> Bull", "> Still at the hospital with ’Cat. Been here too long. Gonna have to burn the SIN she’s using when she gets out.<br/>> Slamm-0!", "> How is she?<br/>> Glitch", "> About the same. Still out, still mumbling sometimes. Doc thinks it’s some kind of biofeedback damage. Like extreme dumpshock.<br/>> Slamm-0!", "> All right, keep an eye in her for us. But we need to talk about what’s going on.<br/>> Glitch", "> I know. I’m watching. Gotta keep myself occupied.<br/>> Slamm-0!", "> So I’d sum up what I know, but I’m still not sure if I know anything. There’s some active misinformation going on out there that’s mucking up the waters.<br/>> Glitch", "> What do you mean?<br/>> Bull", "> I’ve got two different feeds streaming in front of me right now. One of them shows rioting in Nashville. The other one shows normal nighttime traffic in Nashville, with the whole city looking peaceful. One of them is fake, but it’s a good fake. Seamless.<br/>> Glitch", "> What do we know that’s verifiable?<br/>> Bull", "> Some cities are definitely dark. DeeCee, Philly, Newark. And I got some footage of the ARCHology in St. Louis before my drone was taken out. Take a look.<br/>> Glitch", "> They got some light in there. Looks like torches. Good for them.<br/>> Slamm-0!", "> Wait, what was that? Rewind about five seconds.<br/>> Bull", "> What are you looking at?<br/>> Glitch", "> Underside of the arch. Left of center. There’s something moving.<br/>> Bull", "> I’m not seeing it.<br/>> Glitch", "> Watch the stars in the background. One goes out, then another one, then another. Because something is moving in front of them.<br/>> Bull", "> Heh. You can see the stars in St. Louis. Probably the first time a lot of those fraggers have seen how many of them there are.<br/>> Slamm-0!", "> Okay, I see it. Probably human sized, but crawling on the underside of the arch. Too bad drones can’t see astral.<br/>> Glitch", "> What happened to your drone?<br/>> Bull", "> Got zapped. Don’t know who did it. I sent another one, and it returned about half an hour ago. It’s docking and sending me what it got. Should be ready to view about … now! Enjoy.<br/>> Glitch", "> Yup, city’s still dark. Hope everyone burning stuff indoors knows how to ventilate.<br/>> Slamm-0!", "> Looks pretty calm.<br/>> Glitch", "> That’s because we’re outside. We don’t know what’s happening in that arch.<br/>> Bull", "> What’s going on in that window to the left?<br/>> Slamm-0!", "> Hopefully the sub-routines I programmed into it will tell the drone to notice that window as something interesting so we’ll get a better look<br/>> Glitch", "> Looks like it did. Yeah, there’s the chaos I was looking for. What’s that room? <br/>> Slamm-0!", "> Looks like a restaurant. Good meeting place.<br/>> Glitch", "> That’s not a meeting. That ork just decked somebody, solid. And on that pane to the right? That ain’t ketchup. <br/>> Bull", "> Holy drek, that troll has someone lifted over her head. And she’s—she’s not going to—is she?<br/>> Slamm-0!", "> Yeah, she is. Defenestration. That window must have been pummeled already to break like that. Who did she throw?<br/>> Bull", "> Please drone please drone please drone follow it down. And there it goes!<br/>> Slamm-0!", "> Let’s get a look at that poor fragger.<br/>> Glitch", "> What the hell is that?!?!?<br/>> Slamm-0!", "> I don’t even know what I’m looking at.<br/>> Bull", "> Is that a tentacle? A tumor? Where’s it’s face?<br/>> Slamm-0!", "> Why is it wearing a jacket? Doesn’t that look military?<br/>> Glitch", "> Wait. Back up. It got a shot of the left shoulder. Can we look closer?<br/>> Bull", "> What the hell …<br/>> Glitch", "> III Corps. That’s III Corps.<br/>> Bull", "> How the hell does that thing have a III Corps jacket?<br/>> Slamm-0!", "> I don’t know. But that’s what that is.<br/>> Glitch", "> III Corps disappeared almost 900 kilometers from St. Louis. What is that jacket doing here?<br/>> Slamm-0!", "> And how did that thing get it?<br/>> Glitch", "> And how did it get in the arch?<br/>> Bull", "> Good questions. But more footage is coming in. From lots of places. Going to try to compile it. Might take a day. This stuff is a mess.<br/>> Glitch", ]; jQuery('.matrix-messages').removeClass('hidden'); var i = 0; while (true) { if (i >= messages.length) { await sleep(8000); jQuery('.matrix-messages').addClass('hidden'); jQuery('#message1, #message2, #message3').html(''); await sleep(8000); jQuery('.matrix-messages').removeClass('hidden'); i = 0; } else { await sleep(6000 + Math.floor(Math.random() * 6000)); jQuery('#message1').html(messages[i]); if (messages[i-1]) { jQuery('#message2').html(messages[i-1]); } if (messages[i-2]) { jQuery('#message3').html(messages[i-2]); } i++; } } } setTimeout(matrix, 4000);
Version 4
function getTimeRemaining(endtime) { var t = Date.parse(endtime) - Date.parse(new Date()); var seconds = Math.floor((t / 1000) % 60); var minutes = Math.floor((t / 1000 / 60) % 60); var hours = Math.floor((t / (1000 * 60 * 60)) % 24); var days = Math.floor(t / (1000 * 60 * 60 * 24)); return { 'total': t, 'days': days, 'hours': hours, 'minutes': minutes, 'seconds': seconds }; } function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } async function loopFinalSeconds() { var clock = document.getElementById('countdown'); var seconds = clock.querySelector('#seconds'); loop--; seconds.innerHTML = ('0' + loop).slice(-2); if (loop <= 0) { await sleep(250); loop = 13; for (i = 1; i <= 13; i++) { seconds.innerHTML = ('0' + i).slice(-2); await sleep(20); } } } function initializeClock(id, endtime) { var clock = document.getElementById(id); var days = clock.querySelector('#days'); var hours = clock.querySelector('#hours'); var minutes = clock.querySelector('#minutes'); var seconds = clock.querySelector('#seconds'); function updateClock() { var t = getTimeRemaining(endtime); if (t.total <= 0) { clearInterval(timeinterval); days.innerHTML = '0'; hours.innerHTML = '00'; minutes.innerHTML = '00'; seconds.innerHTML = '00'; timeinterval = setInterval(loopFinalSeconds, 1000); } else { days.innerHTML = t.days; hours.innerHTML = ('0' + t.hours).slice(-2); minutes.innerHTML = ('0' + t.minutes).slice(-2); seconds.innerHTML = ('0' + t.seconds).slice(-2); } } // updateClock(); var timeinterval = setInterval(updateClock, 1000); } var deadline = new Date('June 24, 2019 00:00:00 GMT-0000'); var loop = 0; initializeClock('countdown', deadline); async function matrix() { var messages = [ "> How’s that video compilation coming along?<br/>> Slamm-0!", "> Rough. Files keep getting deleted. I think they have embedded code erasing them as soon as I try to monkey with them.<br/>> Glitch", "> Someone’s putting a lot of effort into all this.<br/>> Bull", "> Tell me about it. I’m developing new processes on the fly to try to get something.<br/>> Glitch", "> Like what?<br/>> Slamm-0!", "> Teaching bots to edit. They’re gathering stuff and assembling it without me putting an eye on it. It’s gonna be a mess, but it will be more than we have.<br/>> Glitch", "> Whatever you get, I’ll look at.<br/>> Slamm-0!", "> It’ll be up soon. Except—hell, someone’s trying to hack the footage!<br/>> Glitch", "> For why? Erasing it?<br/>> Slamm-0!", "> No. Looks like an old-school video pirate thing.<br/>> Glitch", "> Oh, I definitely want to see that. Get it up here.<br/>> Slamm-0!", "> Working on it.<br/>> Glitch", ]; jQuery('.matrix-messages').removeClass('hidden'); var i = 0; while (true) { if (i >= messages.length) { await sleep(8000); jQuery('.matrix-messages').addClass('hidden'); jQuery('#message1, #message2, #message3').html(''); await sleep(8000); jQuery('.matrix-messages').removeClass('hidden'); i = 0; } else { await sleep(6000 + Math.floor(Math.random() * 6000)); jQuery('#message1').html(messages[i]); if (messages[i-1]) { jQuery('#message2').html(messages[i-1]); } if (messages[i-2]) { jQuery('#message3').html(messages[i-2]); } i++; } } } //setTimeout(matrix, 4000); var iframe = document.getElementById('vimeo'); var player = new Vimeo.Player(iframe); player.setVolume(0); var played = false; async function fadeVolume(player) { for (i = 1; i <= 10; i++) { player.setVolume(0.1 * i); await sleep(200); } } player.on('play', function() { if (!played) { fadeVolume(player); played = true; } });
Version 5
function getTimeRemaining(endtime) { var t = Date.parse(endtime) - Date.parse(new Date()); var seconds = Math.floor((t / 1000) % 60); var minutes = Math.floor((t / 1000 / 60) % 60); var hours = Math.floor((t / (1000 * 60 * 60)) % 24); var days = Math.floor(t / (1000 * 60 * 60 * 24)); return { 'total': t, 'days': days, 'hours': hours, 'minutes': minutes, 'seconds': seconds }; } function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } async function loopFinalSeconds() { var clock = document.getElementById('countdown'); var seconds = clock.querySelector('#seconds'); loop--; seconds.innerHTML = ('0' + loop).slice(-2); if (loop <= 0) { await sleep(250); loop = 13; for (i = 1; i <= 13; i++) { seconds.innerHTML = ('0' + i).slice(-2); await sleep(20); } } } function initializeClock(id, endtime) { var clock = document.getElementById(id); var days = clock.querySelector('#days'); var hours = clock.querySelector('#hours'); var minutes = clock.querySelector('#minutes'); var seconds = clock.querySelector('#seconds'); function updateClock() { var t = getTimeRemaining(endtime); if (t.total <= 0) { clearInterval(timeinterval); days.innerHTML = '0'; hours.innerHTML = '00'; minutes.innerHTML = '00'; seconds.innerHTML = '00'; timeinterval = setInterval(loopFinalSeconds, 1000); } else { days.innerHTML = t.days; hours.innerHTML = ('0' + t.hours).slice(-2); minutes.innerHTML = ('0' + t.minutes).slice(-2); seconds.innerHTML = ('0' + t.seconds).slice(-2); } } // updateClock(); var timeinterval = setInterval(updateClock, 1000); } var deadline = new Date('June 24, 2019 00:00:00 GMT-0000'); var loop = 0; initializeClock('countdown', deadline); async function matrix() { var messages = [ "> So we’ve had the video for a little, and hopefully we’ve all removed ourselves from imminent danger. What do we know now?<br/>> Glitch", "> The claims about DeeCee are overblown. They whole city hasn’t gone dark—it may have some rioting, but that could just be in response to the other cities.<br/>> Bull", "> Someone’s working hard on the misinformation. I’ve read at least three first-hand accounts of people living through the DeeCee blackout. Two of them I’ve debunked with a lot of confidence. The third is unclear. Matrix research is a bitch right now.<br/>> Slamm-0!", "> I assume you’ve seen all the people who say that lights are and have been on.<br/>> Glitch", "> Yeah. Like I said, tons of misinformation out there. This is a big effort.<br/>> Slamm-0!", "> First, yeah, duh, but second, just because we’re getting all these accounts doesn’t mean there’s a whole army of people involved. Give me one person and a few months of advance time, and I’ll get you dozens of fake eyewitness testimonies.<br/>> Bull", "> It just means we have to rely on what we’ve always relied on: Word from the street.<br/>> Glitch", "> So who do we have on the ground in the UCAS?<br/>> Bull", "> Lyran is still in Philly. Frosty poked her head out to say she’s on the eastern seaboard—she’s going to Toronto. Man-of-Many-Names is checking out St. Louis. Kay St. should still be in DeeCee, but I haven’t heard from him—really want to get word from him to straighten out what’s happening there. Sunshine’s going to Newark.<br/>> Glitch", "> Calm down, I’m here. I hear you’ve been looking for me?<br/>> Kay St. Irregular", "> Look at him, strolling in all casual.<br/>> Slamm-0!", "> I wouldn’t say casual. It’s been a busy few days, as you can imagine. Still trying to sort everything out, obviously.", "> Yes, we can imagine it fine, since you barely could get any text through last time we chatted.<br/>> Bull", "> I couldn’t?<br/>> Kay St. Irregular", "> Yes. When you were sending us messages from DeeCee. You might not have seen it, but they got garbled on the way to us.<br/>> Glitch", "> Messages from DeeCee? I haven’t made it there yet. I’d been in Seattle, since there was a flurry of UCAS diplomats traveling there. I’ve been trying to make it to DeeCee since things went down, but travel sucks right now.<br/>> Kay St. Irregular", "> You’re not in DeeCee?<br/>> Bull", "> That’s what I said.<br/>> Kay St. Irregular", "> You weren’t messaging us from there a few days ago?<br/>> Bull", "> Nope.<br/>> Kay St. Irregular", "> Were you messaging us from anywhere?<br/>> Bull", "> Still no.<br/>> Kay St. Irregular", "> Drek.<br/>> Glitch", "> That’s not just someone spinning out a bunch of fakes stories over the past few months. They’ve got skills.<br/>> Bull", "> Guess who gets to spend an evening reviewing and revamping all of our security protocols?<br/>> Slamm-0!", "> All of us.<br/>> Glitch", "> Oh. Poo.<br/>> Slamm-0!", "> But I’m also sending messages out to people on the ground. Let’s annotate that video. See if we can start sorting out truth and misinformation. And see if we can figure out anything about that poor slot in the second half of the video.<br/>> Glitch", ]; jQuery('.matrix-messages').removeClass('hidden'); var i = 0; while (true) { if (i >= messages.length) { await sleep(8000); jQuery('.matrix-messages').addClass('hidden'); jQuery('#message1, #message2, #message3').html(''); await sleep(8000); jQuery('.matrix-messages').removeClass('hidden'); i = 0; } else { await sleep(6000 + Math.floor(Math.random() * 6000)); jQuery('#message1').html(messages[i]); if (messages[i-1]) { jQuery('#message2').html(messages[i-1]); } if (messages[i-2]) { jQuery('#message3').html(messages[i-2]); } i++; } } } setTimeout(matrix, 4000); var iframe = document.getElementById('vimeo'); var player = new Vimeo.Player(iframe); player.setVolume(0); var played = false; async function fadeVolume(player) { for (i = 1; i <= 10; i++) { player.setVolume(0.1 * i); await sleep(200); } } player.on('play', function() { if (!played) { fadeVolume(player); played = true; } });