Skip to content

Commit 8ae7683

Browse files
authored
Feat source AIP (#330)
* 🐛 fix: Don't execute `handlePopupKeydown` if the user is trying to copy/paste Otherwise cmd+c on the title triggers the `c` command to copy the abstract/pdf * ♻ refactor: Rename `fetchBibtex` to `fetchBibtexToPaper` * 💄 style: New notification style (more discrete) * 🐛 fix: double logged `[PM]` * ♻ refactor: Remove useless log * 🐛 fix: Missing `fetchBibtexToPaper` use in `makeRSCPaper` * ✨ feat: New source: handle AIP journal data * 🏗 build: gulp build * ♻ refactor: Abstracts are defaults over pdfs for new users * 🏗 build: Prepare release 1.1.0 * 🏗 build: gulp build
1 parent 6c4414d commit 8ae7683

File tree

12 files changed

+140
-50
lines changed

12 files changed

+140
-50
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Paper Memory",
3-
"version": "1.0.2",
3+
"version": "1.1.0",
44
"manifest_version": 3,
55
"description": "Automatically record papers and their codes from Arxiv, OpenReview & more! Organize your library with tags, links and quick notes.",
66
"homepage_url": "https://papermemory.org",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "papermemory",
3-
"version": "1.0.2",
3+
"version": "1.1.0",
44
"description": "N/A",
55
"main": "gulpfile.js",
66
"moduleDirectories": [

src/content_scripts/content_script.css

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,26 @@
4141
}
4242

4343
#feedback-notif {
44-
padding: 1em;
45-
z-index: 1000;
44+
font-size: 14px;
45+
font-family: Mukta, Arial, sans-serif, Helvetica;
46+
color: #b31b1b;
47+
height: 36px;
48+
background: white;
49+
opacity: 1;
50+
position: fixed;
51+
border-radius: 4px;
52+
border: 1px solid;
53+
padding: 0px;
54+
bottom: 48px;
55+
right: -200px;
4656
display: flex;
4757
align-items: center;
4858
justify-content: center;
4959
text-align: center;
50-
color: white;
51-
background: #b31b1b;
52-
border-radius: 4px;
53-
position: fixed;
54-
font-size: 14px;
55-
bottom: 64px;
56-
right: -200px;
57-
opacity: 0;
58-
padding: 1rem;
59-
-webkit-box-shadow: 14px 30px 122px -30px rgba(0, 0, 0, 0.75);
60-
-moz-box-shadow: 14px 30px 122px -30px rgba(0, 0, 0, 0.75);
61-
box-shadow: 14px 30px 122px -30px rgba(0, 0, 0, 0.75);
62-
font-family: Mukta, Arial, sans-serif, Helvetica;
60+
z-index: 1000;
61+
box-shadow: #b31b1b 4px 4px 0px 0px;
62+
-moz-box-shadow: #b31b1b 4px 4px 0px 0px;
63+
-webkit-box-shadow: #b31b1b 4px 4px 0px 0px;
6364
}
6465

6566
#feedback-pwc {
@@ -98,22 +99,22 @@
9899
justify-content: center;
99100
align-items: center;
100101
padding: 0px 16px;
101-
min-height: 60px;
102102
}
103103

104104
#notif-cancel {
105+
color: #b31b1b;
105106
display: flex;
106107
justify-content: center;
107108
align-items: center;
108-
min-height: 60px;
109109
padding: 0px 16px;
110110
cursor: pointer;
111-
border-left: 1px solid #7f2828;
111+
border-left: 1px solid #ffe9e9;
112112
border-top-right-radius: 4px;
113113
border-bottom-right-radius: 4px;
114114
}
115-
#notif-cancel:hover {
116-
background: #7f2828;
115+
116+
.notif-small {
117+
width: 36px;
117118
}
118119

119120
/*

src/content_scripts/content_script.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,14 @@ const svg = (name) => {
136136

137137
case "notif-cancel":
138138
return /*html*/ `<svg
139-
width="25"
140-
height="25"
139+
width="20"
140+
height="20"
141141
viewBox="0 0 24 24"
142142
stroke-width="1"
143143
fill="none"
144144
stroke-linecap="round"
145145
stroke-linejoin="round"
146-
stroke="white"
146+
stroke="#b31b1b"
147147
>
148148
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
149149
<line x1="4" y1="7" x2="20" y2="7" />
@@ -163,9 +163,9 @@ const injectNotifCSS = () => {
163163
el.type = "text/css";
164164
el.innerText = `
165165
.pm-notif-loader {
166-
width: 24px;
167-
height: 24px;
168-
border: 2px solid #FFF;
166+
width: 16px;
167+
height: 16px;
168+
border: 1px solid #b31b1b;
169169
border-bottom-color: transparent;
170170
border-radius: 50%;
171171
display: inline-block;
@@ -416,11 +416,12 @@ const hideNotif = () =>
416416
const end = ({ dontWait = false } = {}) => {
417417
global.notif.prevent = false;
418418
global.notif.isLoading = false;
419+
querySelector("#feedback-notif")?.classList.remove("notif-small");
419420
setTimeout(resolve, dontWait ? 0 : 150);
420421
};
421422

422423
if (!global.notif.element) {
423-
warn("[PM][hideNotif] Notif element not found");
424+
warn("[hideNotif] Notif element not found");
424425
end({ dontWait: true });
425426
return;
426427
}
@@ -437,7 +438,7 @@ const hideNotif = () =>
437438

438439
const setNotifContent = (text) => {
439440
if (!global.notif.element) {
440-
warn("[PM][setNotifContent] Notif element not found");
441+
warn("[setNotifContent] Notif element not found");
441442
return;
442443
}
443444
global.notif.element.html(text);
@@ -495,10 +496,11 @@ const feedback = async ({
495496
<div>${text}</div>
496497
</div>
497498
<div title="Cancel" id="notif-cancel">
498-
<div>${svg("notif-cancel")}</div>
499+
${svg("notif-cancel")}
499500
</div>`;
500501
} else if (loading) {
501502
global.notif.isLoading = true;
503+
querySelector("#feedback-notif")?.classList.add("notif-small");
502504
content = /*html*/ `<div id="notif-text"><span class="pm-notif-loader"></span></div>`;
503505
} else {
504506
content = /*html*/ ` <div id="notif-text">

src/popup/html/modals/whatsnew.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
11
<div id="modal-whatsnew-content" class="popup-modal-content" style="display: none">
22
<h3 style="margin-bottom: 0px">What's new</h3>
33
<ul>
4+
<li>
5+
<strong>Current: </strong>
6+
<a href="https://github.com/vict0rsch/PaperMemory/releases/tag/1.1.0"
7+
>1.1.0</a
8+
>
9+
<em>(2025-07-12)</em>
10+
<ul>
11+
<li>[new source] Add AIP as a paper source</li>
12+
<li>[new source] Add Cell as a paper source</li>
13+
<li>
14+
[feature] New loading notification when PaperMemory is working in
15+
the background to fetch a paper's data
16+
</li>
17+
<li>[feature] New notification style, more discrete</li>
18+
<li>
19+
[dev] Make Abstracts the defaults not PDFs (for new users only, go
20+
to your settings otherwise)
21+
</li>
22+
<li>[dev] Fix a keyboard shortcut bug</li>
23+
<li>[dev] Fix a post-click feedback bug</li>
24+
</ul>
25+
</li>
426
<li>
527
<strong>Current: </strong>
628
<a href="https://github.com/vict0rsch/PaperMemory/releases/tag/1.0.2"

src/popup/js/handlers.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ const handlePopupKeydown = async (e) => {
393393
const isCtrlOrMeta = e.ctrlKey || e.metaKey;
394394
const isEnter = key === "Enter" && !isCtrlOrMeta;
395395
const isCmdEnter = key === "Enter" && isCtrlOrMeta;
396+
if (isCtrlOrMeta && !isCmdEnter) return;
396397
if (
397398
[
398399
"Backspace",

src/popup/min/popup.min.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/popup/min/popup.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/shared/js/utils/config.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ global.prefsCheckNames = [
119119
"checkAr5iv",
120120
"checkHuggingface",
121121
"checkOfficialRepos",
122-
"checkPreferPdf",
123122
"checkPdfOnly",
124123
"checkNoAuto",
125124
"checkMdYearVenue",
@@ -140,6 +139,7 @@ global.prefsCheckDefaultFalse = [
140139
"checkPdfOnly",
141140
"checkNoAuto",
142141
"checkMdYearVenue",
142+
"checkPreferPdf",
143143
];
144144
/**
145145
* All keys to retrieve from the menu, the checkboxes + the custom pdf function
@@ -355,6 +355,15 @@ global.knownPaperPages = {
355355
],
356356
name: "Wiley",
357357
},
358+
aip: {
359+
patterns: [
360+
(url) =>
361+
url.match(
362+
/pubs.aip.org\/aip\/.+\/(article|article-abstract|article-split)\//g
363+
) || url.match(/watermark.silverchair.com\/.+\.pdf/g),
364+
],
365+
name: "AIP (American Institute of Physics)",
366+
},
358367
};
359368

360369
global.overrideORConfs = {

src/shared/js/utils/paper.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ const paperToAbs = (paper) => {
200200
abs = `https://www.cell.com/${journal}/fulltext/${pii}`;
201201
break;
202202

203+
case "aip":
204+
abs = `https://doi.org/${paper.doi}`;
205+
break;
206+
203207
default:
204208
abs = "https://xkcd.com/1969/";
205209
break;
@@ -320,9 +324,13 @@ const paperToPDF = (paper) => {
320324

321325
case "website":
322326
break;
327+
323328
case "cell":
324329
break;
325330

331+
case "aip":
332+
break;
333+
326334
default:
327335
pdf = "https://xkcd.com/1969/";
328336
break;
@@ -685,7 +693,7 @@ const addOrUpdatePaper = async ({
685693
}
686694
log("paper: ", paper);
687695

688-
notifText = "Added to your Memory";
696+
notifText = "Saved ✓";
689697
if (pwc.codeLink) {
690698
notifText +=
691699
"<br/><div id='feedback-pwc'>(+ repo from PapersWithCode) </div>";
@@ -967,6 +975,11 @@ const parseIdFromUrl = async (url, tab = null) => {
967975
"cell",
968976
miniHash(url.split("cell.com/")[1])
969977
);
978+
} else if (is.aip) {
979+
const { aipId, doi } = parseAIPIdOrDOI(url);
980+
idForUrl = doi
981+
? findPaperForProperty(papers, "aip", doi, "doi")
982+
: findPaperForProperty(papers, "aip", miniHash(aipId));
970983
} else if (is.localFile) {
971984
idForUrl = is.localFile;
972985
} else if (is.parsedWebsite) {

0 commit comments

Comments
 (0)