|
@@ -44,18 +44,27 @@ import {
|
|
initExtConfig();
|
|
initExtConfig();
|
|
|
|
|
|
let jsInitChecktimer = null;
|
|
let jsInitChecktimer = null;
|
|
|
|
+let isSetInitialStateDone = false;
|
|
|
|
|
|
function setEventListeners(evt) {
|
|
function setEventListeners(evt) {
|
|
function checkForJS_Finish() {
|
|
function checkForJS_Finish() {
|
|
- if (isShorts() || (getButtons()?.offsetParent && isVideoLoaded())) {
|
|
|
|
- addLikeDislikeEventListener();
|
|
|
|
- setInitialState();
|
|
|
|
- getBrowser().storage.onChanged.addListener(storageChangeHandler);
|
|
|
|
- clearInterval(jsInitChecktimer);
|
|
|
|
- jsInitChecktimer = null;
|
|
|
|
|
|
+ try {
|
|
|
|
+ if (isShorts() || (getButtons()?.offsetParent && isVideoLoaded())) {
|
|
|
|
+ addLikeDislikeEventListener();
|
|
|
|
+ setInitialState();
|
|
|
|
+ isSetInitialStateDone = true;
|
|
|
|
+ getBrowser().storage.onChanged.addListener(storageChangeHandler);
|
|
|
|
+ clearInterval(jsInitChecktimer);
|
|
|
|
+ jsInitChecktimer = null;
|
|
|
|
+ }
|
|
|
|
+ } catch(exception) {
|
|
|
|
+ if(!isSetInitialStateDone) {
|
|
|
|
+ setInitialState();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
jsInitChecktimer = setInterval(checkForJS_Finish, 111);
|
|
jsInitChecktimer = setInterval(checkForJS_Finish, 111);
|
|
}
|
|
}
|
|
|
|
|