Skip to content

Commit

Permalink
fix pdf ui conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
ttop32 committed Sep 30, 2024
1 parent 5aae0b6 commit cc339f0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion public/pdfjs/web/viewer.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
y<!DOCTYPE html>
<!DOCTYPE html>
<!--
Copyright 2012 Mozilla Foundation
Expand Down
11 changes: 2 additions & 9 deletions src/contentScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var listenText = "";
if (checkExcludeUrl()) {
return;
}
await waitJquery(); //wait jquery load
await dom_util.waitJquery(); //wait jquery load
detectPDF(); //check current page is pdf
checkVideo(); // check video site for subtitle
checkGoogleDocs(); // check google doc
Expand Down Expand Up @@ -637,14 +637,6 @@ function addBackgroundListener() {
});
}

function waitJquery() {
return new Promise(async (resolve, reject) => {
$(() => {
resolve();
});
});
}

function checkExcludeUrl() {
var url = util.getCurrentUrl();
return matchUrl(url, setting["websiteExcludeList"]);
Expand Down Expand Up @@ -855,6 +847,7 @@ function openPdfIframe(url) {
border: "none",
height: "100vh",
width: "100vw",
overflow: "hidden"
},
}).appendTo("body");
}
Expand Down
1 change: 1 addition & 0 deletions src/pdf/pdfInject.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import * as dom_util from "/src/util/dom";
initPdf();

async function initPdf() {
await dom_util.waitJquery(); //wait jquery load
checkLocalFileUrl(); // warn no permission if file url
checkLocalFileType();
checkPdfError();
Expand Down
11 changes: 11 additions & 0 deletions src/util/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,14 @@ export function getFocusedWritingBox() {
return writingBox.get(0);
}
}



export function waitJquery() {
return new Promise(async (resolve, reject) => {
$(() => {
resolve();
});
});
}

0 comments on commit cc339f0

Please sign in to comment.