Skip to content

Instantly share code, notes, and snippets.

@shobhitg
Last active March 12, 2021 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shobhitg/c6be4b757185e41d513f2f829575bd48 to your computer and use it in GitHub Desktop.
Save shobhitg/c6be4b757185e41d513f2f829575bd48 to your computer and use it in GitHub Desktop.
MyTurn refresh script
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