actualkly fixed observer logic

This commit is contained in:
Maxim Stewart 2020-05-16 16:19:24 -05:00
parent 2fb39ce6ac
commit 67996869cb
3 changed files with 10 additions and 12 deletions

View File

@ -11,8 +11,8 @@ Better YouTube + works to improve the YouTube experience by providing quick acce
* It shows volume level as you scroll.
* It lets Unix, Linux, and MacOS systems have the ability to download the video using native app calls.
# Version: 1.5.1
* Fixed observer logic.
# Version: 1.5.2
* Actually fixed observer logic.
# Download
https://addons.mozilla.org/en-US/firefox/addon/better-youtube-plus/

View File

@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Better Youtube +",
"version": "1.5.1",
"version": "1.5.2",
"description": "Enhancements for Youtube to have a better experience.",
"applications": {

View File

@ -163,8 +163,7 @@
observer2 = new MutationObserver(mutationCallback);
// Start observing the target node for configured mutations
if (endlessPlayTag.checked == true) {
endlessPlayTag.setAttribute("checked", true);
isEndlessWatch = true;
this.isEndlessWatch = true;
console.log("Endless play checked. Starting observer...");
observer2.observe(document, observerConfig2);
}
@ -177,12 +176,12 @@
if (mutation.type === 'attributes') {
controlManager(mutation.target);
} else if (mutation.type === 'childList') {
if (isEndlessWatch) {
if (this.isEndlessWatch) {
let elm = document.querySelector(dialogElementQueryRef).parentElement;
elmDisplayState = elm.style.display;
if (elmDisplayState !== 'none' && !modalHasBeenClosed) {
clickDialog();
if (elmDisplayState !== 'none' && modalHasBeenClosed == false) {
modalHasBeenClosed = true;
clickDialog();
setTimeout(function () {
modalHasBeenClosed = false;
}, 5000);
@ -212,15 +211,14 @@
}
const toggleEndlessPlay = () => {
isChecked = endlessPlayTag.getAttribute("checked");
if (isChecked) {
if (this.isEndlessWatch) {
endlessPlayTag.setAttribute("checked", false);
isEndlessWatch = false;
this.isEndlessWatch = false;
console.log("Stopping endless play...");
observer2.disconnect();
} else {
endlessPlayTag.setAttribute("checked", true);
isEndlessWatch = true;
this.isEndlessWatch = true;
console.log("Starting endless play...");
observer2.observe(confirmDialogElement, observerConfig2);
}