remove the unnecessary change
This commit is contained in:
parent
fee10fa106
commit
233a000b83
|
@ -5,11 +5,11 @@ if (typeof window.oldCode !== 'string') {
|
||||||
window.oldCode = (document.querySelector('body > pre') || document.body).textContent;
|
window.oldCode = (document.querySelector('body > pre') || document.body).textContent;
|
||||||
chrome.runtime.onConnect.addListener(port => {
|
chrome.runtime.onConnect.addListener(port => {
|
||||||
if (port.name !== 'downloadSelf') return;
|
if (port.name !== 'downloadSelf') return;
|
||||||
port.onMessage.addListener(async ({id, force, timer}) => {
|
port.onMessage.addListener(async ({id, force}) => {
|
||||||
const msg = {id};
|
const msg = {id};
|
||||||
try {
|
try {
|
||||||
const code = await (await fetch(location.href, {mode: 'same-origin'})).text();
|
const code = await (await fetch(location.href, {mode: 'same-origin'})).text();
|
||||||
if ((code !== window.oldCode || force) || !(timer && code === window.oldCode)) {
|
if (code !== window.oldCode || force) {
|
||||||
msg.code = window.oldCode = code;
|
msg.code = window.oldCode = code;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user