Last active
March 12, 2021 08:57
-
-
Save shobhitg/c6be4b757185e41d513f2f829575bd48 to your computer and use it in GitHub Desktop.
MyTurn refresh script
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
var audioCtx = new (window.AudioContext || | |
window.webkitAudioContext || | |
window.audioContext)(); | |
function beep(duration, frequency, volume, type, callback) { | |
var oscillator = audioCtx.createOscillator(); | |
var gainNode = audioCtx.createGain(); | |
oscillator.connect(gainNode); | |
gainNode.connect(audioCtx.destination); | |
if (volume) { | |
gainNode.gain.value = volume; | |
} | |
if (frequency) { | |
oscillator.frequency.value = frequency; | |
} | |
if (type) { | |
oscillator.type = type; | |
} | |
if (callback) { | |
oscillator.onended = callback; | |
} | |
oscillator.start(audioCtx.currentTime); | |
oscillator.stop(audioCtx.currentTime + (duration || 500) / 1000); | |
} | |
var t1 = setInterval(function () { | |
document.querySelectorAll("[data-testid='back-button-header']")[0].click(); | |
var t2 = setTimeout(function () { | |
document | |
.querySelectorAll("[data-testid='location-search-page-continue']")[0] | |
.click(); | |
setTimeout(function () { | |
console.log([...document.querySelectorAll(".tw-text-xl")]); | |
var found = [...document.querySelectorAll(".tw-text-xl")].some((d) => | |
d.innerText.includes("Moscone") | |
); | |
if (found) { | |
beep(1000, 1000, 100); | |
clearInterval(t1); | |
} | |
}, 2000); | |
}, 500); | |
}, 3500); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment