Skip to content

Commit

Permalink
v4.70.51
Browse files Browse the repository at this point in the history
Code Fix
  • Loading branch information
cyfung1031 committed May 2, 2024
1 parent 33ab6c6 commit d517428
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
31 changes: 16 additions & 15 deletions js/injection_script_1.js
Original file line number Diff line number Diff line change
Expand Up @@ -1324,19 +1324,19 @@ function injection_script_1() {
}


/** @param {Document} cDoc */
const cDocReadyStatePromise = (cDoc) => {
if (cDoc.readyState !== 'loading') return;
return new Promise(resolve => {
cDoc.addEventListener('readystatechange', function () {
if (cDoc && cDoc.readyState && cDoc.readyState !== 'loading') {
cDoc = null;
resolve && resolve();
resolve = null;
}
}, false);
});
}
// /-** @param {Document} cDoc *-/
// const cDocReadyStatePromise = (cDoc) => {
// if (cDoc.readyState !== 'loading') return;
// return new Promise(resolve => {
// cDoc.addEventListener('readystatechange', function () {
// if (cDoc && cDoc.readyState && cDoc.readyState !== 'loading') {
// cDoc = null;
// resolve && resolve();
// resolve = null;
// }
// }, false);
// });
// }


let pageID = 0;
Expand All @@ -1348,8 +1348,9 @@ function injection_script_1() {
pageType = ((evt.detail || 0).pageData || 0).page;
}

let _mceu0 = 0;
function onPageFinished(evt) {
sessionStorage.setItem('mceu0', Date.now() % 31536000000);
_mceu0 = Date.now() % 31536000000;
if ((pageID % 2) === 1) {
pageID++;
translateHanlder = null; // release the memory used for previous page
Expand Down Expand Up @@ -1842,7 +1843,7 @@ function injection_script_1() {
let ed = this.liveChatPageUrl159(a, b, c, d);
if (ed && ed.includes('/live_chat') && ed.includes('continuation=')) {
// force url change
const mceu0 = sessionStorage.getItem('mceu0') || 0;
const mceu0 = _mceu0;
ed = ed.replace(/&mceu=\d+/, '');
ed = ed.replace(/continuation=[^=&\s?]+/, (_) => {
return `${_}&mceu=${((performance.timeOrigin + window.history.length + mceu0) % 31536000000)}`
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"host_permissions": [
"https://www.youtube.com/*"
],
"version": "4.70.50",
"version": "4.70.51",
"web_accessible_resources": [{
"resources": ["images/*.png", "js/injection*.js", "js/content.js", "css/style_*.css"],
"matches": ["https://www.youtube.com/*"]
Expand Down
2 changes: 1 addition & 1 deletion version.ini
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.70.50
4.70.51

0 comments on commit d517428

Please sign in to comment.