Skip to content

Towards safari #312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: towards-v1
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/background/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ chrome.runtime.onMessage.addListener((payload, sender, sendResponse) => {
} else if (payload.type === "google-scholar") {
fetchGSData(payload.paper).then(sendResponse);
} else if (payload.type === "download-pdf-to-store") {
if (global.state.isSafari) {
sendResponse(false);
return;
}
getStoredFiles().then((storedFiles) => {
if (storedFiles.length === 0) {
chrome.downloads.download({
Expand Down
2 changes: 1 addition & 1 deletion src/popup/js/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const handleMemoryOpenLocal = (e) => {
global.state.papers[id] = updatePaperVisits(paper);
setStorage("papers", global.state.papers);
if (file && (file.id || file.id === 0)) {
chrome.downloads.open(file.id);
chrome.downloads?.open(file.id);
}
window?.close && window.close();
};
Expand Down
2 changes: 1 addition & 1 deletion src/popup/js/memory.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ const focusExistingOrCreateNewPaperTab = (paper, fromMemoryItem) => {
const hasFile = global.state.files.hasOwnProperty(paper.id);
if (hasFile && !fromMemoryItem) {
// this paper has a local file
chrome.downloads.open(global.state.files[paper.id].id);
chrome.downloads?.open(global.state.files[paper.id].id);
} else {
// no tab open or local file: open a new tab to the paper's pdf
chrome.tabs.create({
Expand Down
4 changes: 3 additions & 1 deletion src/popup/js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ const popupMain = async (url, is, manualTrigger = false, tab = null) => {
addListener(`popup-memory-item-openLocal--${id}`, "click", async () => {
const file = (await findLocalFile(paper)) || global.state.files[paper.id];
if (file) {
chrome.downloads.open(file.id);
chrome.downloads?.open(file.id);
} else {
chrome.tabs.create({ url: paper.pdfLink });
}
Expand Down Expand Up @@ -519,6 +519,8 @@ const popupMain = async (url, is, manualTrigger = false, tab = null) => {
// ------------------------------

const query = { active: true, lastFocusedWindow: true };
console.log("navigator.userAgent: ", navigator.userAgent);
console.log("state: ", global.state);
if (window.location.href.includes("popup")) {
chrome.tabs.query(query, async (tabs) => {
chrome.runtime.connect({ name: "PaperMemoryPopupSync" });
Expand Down
2 changes: 1 addition & 1 deletion src/popup/min/popup.min.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html><html><head><meta charset="utf-8"><script src="../../shared/min/theme.min.js"></script><style>@import url("https://fonts.googleapis.com/css2?family=Yantramanav:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;1,600&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500;600;700&display=swap");</style><link rel="stylesheet" type="text/css" href="../css/select2.min.css"><link rel="stylesheet" type="text/css" href="../../shared/css/bootstrap-utilities.min.css"><link rel="stylesheet" type="text/css" href="../../shared/css/vars.css"><link rel="stylesheet" type="text/css" href="../../popup/css/options.css"><link rel="stylesheet" type="text/css" href="../../popup/css/popup.css"><link rel="stylesheet" type="text/css" href="../../shared/css/loader.css"><script defer="defer" src="../../shared/min/jquery.min.js"></script><script defer="defer" src="../js/select2.min.js"></script><script defer="defer" src="../../shared/js/utils/logTrace.js"></script><script defer="defer" src="../../shared/js/utils/miniquery.js"></script><script defer="defer" src="../../shared/js/utils/config.js"></script><script defer="defer" src="../../shared/js/utils/octokit.bundle.js"></script><script defer="defer" src="../../shared/js/utils/sync.js"></script><script defer="defer" src="../../shared/js/utils/functions.js"></script><script defer="defer" src="../../shared/js/utils/data.js"></script><script defer="defer" src="../../shared/js/utils/paper.js"></script><script defer="defer" src="../../shared/js/utils/state.js"></script><script defer="defer" src="../../shared/js/utils/bibtexParser.js"></script><script defer="defer" src="../../shared/js/utils/parsers.js"></script><script defer="defer" src="../js/handlers.js"></script><script defer="defer" src="../js/templates.js"></script><script defer="defer" src="../js/memory.js"></script><script defer="defer" src="../js/popup.js"></script></head><body><div id="popup-header"><h1 title="https://papermemory.org"><a class="link-in-new-tab" href="https://papermemory.org">PaperMemory</a></h1><svg viewBox="0 0 24 24" class="pm-tabler-icon ml-3" id="header-icon"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><polyline points="13 3 13 10 19 10 11 21 11 14 5 14 13 3"/></svg></div><div id="popup-container"><div id="notArxiv" style="display: none; position: relative"><p><strong style="color: var(--lightRed)">PaperMemory</strong> automatically records and organizes the papers you read, without ever leaving your browser.</p><p>When opening a paper (its web page or pdf), a reference to that paper will be stored in your Memory. Supports Arxiv, Open Review, PNAS, Science, Nature <a href="https://papermemory.org/features/#venues" class="link-in-new-tab">and more</a>!</p><p><a class="link-in-new-tab" href="https://github.com/vict0rsch/PaperMemory/issues/13">Request a new venue</a>.</p><p class="d-flex-center-start">Click on the&nbsp;<svg xmlns="http://www.w3.org/2000/svg" tabindex="0" class="icon icon-tabler" width="22" height="22" viewBox="0 0 24 24" stroke-width="1.5" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 4h3l2 2h5a2 2 0 0 1 2 2v7a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-9a2 2 0 0 1 2 -2"/><path d="M17 17v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-9a2 2 0 0 1 2 -2h2"/></svg>&nbsp;Memory button below <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-arrow-down-left" width="20" height="20" viewBox="0 0 24 24" stroke-width="2" stroke="#7c7f8b" fill="none" stroke-linecap="round" stroke-linejoin="round" style="stroke-width: 2px; vertical-align: bottom"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="17" y1="7" x2="7" y2="17"/><polyline points="16 17 7 17 7 8"/></svg> <span>(or press <code>a</code></span> )!</p><p style="text-align: center"><button style="cursor: pointer" id="keyboardShortcuts" class="code-font">User Guide</button></p><div id="website-parsing-root" style="display: none; width: 100%"></div><div id="whats-new-container"><div class="d-relative"><svg width="34" height="34" viewBox="0 0 24 24" stroke-width="1" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10 5a2 2 0 0 1 4 0a7 7 0 0 1 4 6v3a4 4 0 0 0 2 3h-16a4 4 0 0 0 2 -3v-3a7 7 0 0 1 4 -6"/><path d="M9 17v1a3 3 0 0 0 6 0v-1"/></svg> <span id="whats-new-marker" style="display: none"></span></div></div></div><div id="isArxiv" style="display: none"><h3 style="text-align: center;
@import url("https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500;600;700&display=swap");</style><link rel="stylesheet" type="text/css" href="../css/select2.min.css"><link rel="stylesheet" type="text/css" href="../../shared/css/bootstrap-utilities.min.css"><link rel="stylesheet" type="text/css" href="popup.min.css"><script defer="defer" src="../../shared/min/jquery.min.js"></script><script defer="defer" src="../js/select2.min.js"></script><script defer="defer" src="../../shared/min/utils.min.js"></script><script defer="defer" src="popup.min.js"></script></head><body><div id="popup-header-empty">&nbsp;</div><div id="popup-header"><h1 title="https://papermemory.org"><a class="link-in-new-tab" href="https://papermemory.org">PaperMemory</a></h1><svg viewBox="0 0 24 24" class="pm-tabler-icon ml-3" id="header-icon"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><polyline points="13 3 13 10 19 10 11 21 11 14 5 14 13 3"/></svg></div><div id="popup-container"><div id="notArxiv" style="display: none; position: relative"><p><strong style="color: var(--lightRed)">PaperMemory</strong> automatically records and organizes the papers you read, without ever leaving your browser.</p><p>When opening a paper (its web page or pdf), a reference to that paper will be stored in your Memory. Supports Arxiv, Open Review, PNAS, Science, Nature <a href="https://papermemory.org/features/#venues" class="link-in-new-tab">and more</a>!</p><p><a class="link-in-new-tab" href="https://github.com/vict0rsch/PaperMemory/issues/13">Request a new venue</a>.</p><p class="d-flex-center-start">Click on the&nbsp;<svg xmlns="http://www.w3.org/2000/svg" tabindex="0" class="icon icon-tabler" width="22" height="22" viewBox="0 0 24 24" stroke-width="1.5" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 4h3l2 2h5a2 2 0 0 1 2 2v7a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-9a2 2 0 0 1 2 -2"/><path d="M17 17v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-9a2 2 0 0 1 2 -2h2"/></svg>&nbsp;Memory button below <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-arrow-down-left" width="20" height="20" viewBox="0 0 24 24" stroke-width="2" stroke="#7c7f8b" fill="none" stroke-linecap="round" stroke-linejoin="round" style="stroke-width: 2px; vertical-align: bottom"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="17" y1="7" x2="7" y2="17"/><polyline points="16 17 7 17 7 8"/></svg> <span>(or press <code>a</code></span> )!</p><p style="text-align: center"><button style="cursor: pointer" id="keyboardShortcuts" class="code-font">User Guide</button></p><div id="website-parsing-root" style="display: none; width: 100%"></div><div id="whats-new-container"><div class="d-relative"><svg width="34" height="34" viewBox="0 0 24 24" stroke-width="1" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10 5a2 2 0 0 1 4 0a7 7 0 0 1 4 6v3a4 4 0 0 0 2 3h-16a4 4 0 0 0 2 -3v-3a7 7 0 0 1 4 -6"/><path d="M9 17v1a3 3 0 0 0 6 0v-1"/></svg> <span id="whats-new-marker" style="display: none"></span></div></div></div><div id="isArxiv" style="display: none"><h3 style="text-align: center;
max-width: 95%;
font-weight: 400;
margin-bottom: 0px;
Expand Down
Loading