File size: 951 Bytes
f66df0b fe4717f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
// async function magicFunc(x){
// let z = document.getElementById('search_term').getElementsByTagName('textarea')[0].value;
// await fetch('/track?url=' + x + '&q=' + z)
// }
function delay(x) {
setTimeout(() => {
var isLoaded = x.getElementsByTagName('img')[0].complete
console.log('is Loaded: ', isLoaded)
if(!isLoaded){
delay(x)
}else{
x.getElementsByClassName('submit-btn')[0].innerText = 'Drag It!'
}
// Set the flag to true to indicate to break the loop
}, 2000);
}
function mdFunc(x) {
let counter = 0;
var imgUrl = x.getElementsByTagName('img')[0].src;
var rx = RegExp('(.*)\\=w320.*');
var imgUrl = imgUrl.replace(rx, "$1");
x.getElementsByTagName('img')[0].src = imgUrl;
x.getElementsByClassName('submit-btn')[0].innerText = 'Loading...'
delay(x)
var imgID = imgUrl.replace('https://lh3.google.com/u/0/d/', '');
magicFunc(imgID)
} |