-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix chords not updating on youtube url change; fix few unresolved chords
- Loading branch information
Showing
6 changed files
with
116 additions
and
68 deletions.
There are no files selected for viewing
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,65 @@ | ||
waitForElementToDisplay(500); | ||
function waitForElementToDisplay(time) { | ||
if(window.document.getElementById("mm") != undefined) { | ||
window.document.getElementById("mm").style.opacity = "0"; | ||
console.log("background removed"); | ||
return; | ||
} | ||
else { | ||
setTimeout(function() { | ||
waitForElementToDisplay(time); | ||
}, time); | ||
} | ||
} | ||
function watchAndExecute(time, func) { | ||
if(func()){ | ||
return; | ||
} | ||
|
||
waitForBottom(500); | ||
function waitForBottom(time) { | ||
if(window.document.getElementsByClassName("dstubn").length > 0 && window.document.getElementsByClassName("dstubn")[0].childNodes.length > 0) { | ||
window.document.getElementsByClassName("dstubn")[0].childNodes[0].click(); | ||
console.log("bottom ad closed"); | ||
return; | ||
} | ||
else { | ||
setTimeout(function() { | ||
waitIconRight(time); | ||
}, time); | ||
} | ||
setTimeout(() => watchAndExecute(time, func), time); | ||
} | ||
|
||
waitIconRight(2000); | ||
function waitIconRight(time) { | ||
if(window.document.getElementById("play-button") != undefined) { | ||
// await delay(10000); | ||
var ele = window.document.getElementById("play-button"); | ||
console.log("right-icon"); | ||
ele.click(); | ||
return; | ||
// Delete top advertisement | ||
watchAndExecute(500, function(){ | ||
if(window.document.getElementById("mm") != undefined) { | ||
window.document.getElementById("mm").remove(); | ||
console.log("top Ad and background removed"); | ||
|
||
if(window.document.getElementById("popup") != undefined){ | ||
window.document.getElementById("popup").remove(); | ||
} | ||
else { | ||
setTimeout(function() { | ||
waitIconRight(time); | ||
}, time); | ||
return true; | ||
} | ||
|
||
return false; | ||
}); | ||
|
||
watchAndExecute(500, function(){ | ||
if(window.document.getElementsByClassName("dstubn").length > 0 && window.document.getElementsByClassName("dstubn")[0].childNodes.length > 0) { | ||
window.document.getElementsByClassName("dstubn")[0].childNodes[0].click(); | ||
console.log("bottom ad closed"); | ||
return true; | ||
} | ||
|
||
return false; | ||
}); | ||
|
||
watchAndExecute(2000, function(){ | ||
if(window.document.getElementById("play-button") != undefined) { | ||
var ele = window.document.getElementById("play-button"); | ||
console.log("right-icon"); | ||
ele.click(); | ||
return true; | ||
} | ||
|
||
return false; | ||
}); | ||
|
||
// Choose Ukulele and play | ||
watchAndExecute(2000, function(){ | ||
if(window.document.getElementsByClassName("i1q78294").length == 4) { | ||
// Choose Ukulele | ||
window.document.getElementsByClassName("i1q78294")[1].click(); | ||
|
||
// play | ||
window.document.getElementById("play-button").click(); | ||
|
||
// close bottom Ad | ||
if(window.document.getElementsByClassName("icon-close").length >= 1){ | ||
window.document.getElementsByClassName("icon-close")[1].click(); | ||
} | ||
} | ||
|
||
// document.getElementsByClassName("dstubn")[0].childNodes[0].click() | ||
console.log("Content script executed."); | ||
return true; | ||
} | ||
|
||
return false; | ||
}); | ||
|
||
console.log("Content script executed."); |
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
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
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