Skip to content

Commit

Permalink
v0 working
Browse files Browse the repository at this point in the history
  • Loading branch information
vict0rsch committed Oct 17, 2023
1 parent e1fdf43 commit c7f3ffc
Show file tree
Hide file tree
Showing 3 changed files with 579 additions and 0 deletions.
266 changes: 266 additions & 0 deletions src/fullMemory/bibMatcher.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
/*
---------------------
----- Globals -----
---------------------
*/
:root {
--maxWidth: 1000px;
--color: unset;
}
body {
margin: 0;
font-family: "Yantramanav";
font-weight: 400;
}

svg {
stroke-width: 1.15;
stroke: #7c7f8b;
fill: none;
stroke-linecap: round;
stroke-linejoin: round;
}

code {
font-family: "Fira Code", monospace !important;
color: inherit !important;
padding: 1px 4px;
vertical-align: text-top;
border-radius: var(--round);
background-color: rgb(238, 238, 238);
}

.pm-tabler-icon {
height: 32px;
width: 32px;
color: var(--red);
stroke-width: 1px;
}

h2,
h3,
h4,
h5,
h6 {
padding-top: 1.5rem;
}

/*
--------------------
----- Header -----
--------------------
*/
#header {
background-color: var(--red);
padding: 12px;
color: white;
display: flex;
justify-content: start;
align-items: center;
border-radius: 0 0 75% 0/50%;
box-shadow: 14px 30px 122px -30px rgba(0, 0, 0, 0.75);
}
#header-wrapper {
max-width: var(--maxWidth);
margin: auto;
display: flex;
justify-content: center;
align-items: center;
}
#header-wrapper h1 {
font-weight: 300;
}
#header-icon {
stroke: white;
margin-left: 1rem;
}

#toc {
text-align: center;
max-width: 75%;
margin: auto;
margin-top: 2rem;
font-size: 1.2rem;
}

.toc-item {
display: inline-block;
}

/*
---------------------
----- Content -----
---------------------
*/
#content {
max-width: var(--maxWidth);
margin: auto;
padding: 32px;
}

hr {
border: none;
border-top: 1px solid var(--lighterColor);
margin: 4rem;
}

textarea {
border-radius: var(--round);
border: 1px solid #aaaaaa;
font-family: "Yantramanav";
padding: 6px;
}

button,
.file-upload-label {
border: 1px solid var(--red);
border-radius: var(--rounder);
padding: 4px 6px;
background-color: white;
transition: all ease 200ms;
cursor: pointer;
}
button:disabled,
.file-upload-label:disabled {
cursor: not-allowed;
pointer-events: none;
border-color: #e7a9a9;
}

button:hover,
.file-upload-label:hover {
border-color: var(--red);
background-color: rgb(253, 235, 235);
}

input {
border-radius: var(--round);
border: 1px solid #aaa;
margin-top: 8px;
line-height: 1.1rem;
padding: 6px;
margin-bottom: 4px;
}

/*
-----------------------------
----- Matcher options -----
-----------------------------
*/
.option-item {
margin-bottom: 1rem;
margin-top: 1rem;
}

.option-help {
margin-left: 1rem;
color: #7c7f8b;
}

#match-bib,
#match-bib-stop,
#copy-results {
max-width: 200px;
margin: auto;
}
#bib-text {
max-width: 100%;
margin: 1rem;
}

#match-results {
padding: 1rem;
border: 1px solid #ff4754;
border-radius: var(--round);
}
#copy-results {
background-color: rgb(86, 168, 86);
margin: 2rem auto;
color: white;
}
#copy-results:hover {
color: wheat;
background-color: rgb(86, 168, 86, 0.8);
}
.match-citation-key {
color: #7c7f8b;
padding-right: 0.5rem;
font-family: "Fira Code", monospace;
font-size: 0.85rem;
font-weight: 400;
}
.match-title {
font-weight: 400;
}
#match-bib-stop {
display: flex;
height: 34px;
align-items: center;
justify-content: center;
}
#match-bib-stop:hover {
background-color: rgb(253, 235, 235);
}
/*
----------------------
----- Progress -----
----------------------
*/

.progress-container {
margin: 30px;
margin-top: 0;
height: 0.8rem;
width: 40%;
border-radius: 0.4rem;
background: #000;
}

.progress-container .progress {
height: 100%;
width: 0;
border-radius: 0.4rem;
background: #ff4754;
transition: width 0.4s ease;
}

#matching-progress-container {
display: flex;
justify-content: space-evenly;
align-items: center;
width: 100%;
padding-top: 24px;
}

#matching-status-title {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
display: inline-block;
max-width: 100%;
}

#matching-status {
width: 60%;
min-width: 60%;
max-width: 60%;
}
.loader {
width: 16px;
height: 16px;
border: 3px solid #fff;
border-bottom-color: transparent;
border-radius: 50%;
display: inline-block;
box-sizing: border-box;
animation: rotation 1s linear infinite;
}

@keyframes rotation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
124 changes: 124 additions & 0 deletions src/fullMemory/bibMatcher.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<!DOCTYPE html>
<html>

<head>
<title>PaperMemory Options</title>
<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 href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="../shared/css/vars.css">
<link rel="stylesheet" type="text/css" href="../shared/css/loader.css">
<link rel="stylesheet" type="text/css" href="../popup/css/select2.min.css">
<link rel="stylesheet" type="text/css" href="../options/github.min.css">
<link rel="stylesheet" type="text/css" href="bibMatcher.css">
</head>

<body>

<div id="header">
<div id="header-wrapper">
<h1>Bib Matcher</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>
<div id="content">
<p style="margin-bottom: 3rem;">
Paste the content of your <code>.bib</code> file and PaperMemory will automatically match the Arxiv entries
to publications by
fetching information from PapersWithCode, DBLP, Semantic Scholar, CrossRef and Google Scholar.
</p>

<p><strong style="color: rgb(169, 37, 37)">Warning:</strong> the matching procedure produces an output which
does
<strong>NOT</strong> maintain comments. Select
matched
entries one by one if you want to keep your initial comment structure.
</p>

<h1>TODO</h1>

<ul>
<li>Matched or all as dynamic button</li>
<li>Keep citation key</li>
</ul>

<div class="row mb-5">
<textarea id="bib-text" placeholder="@article{foo2023bar, ..." rows="12
"></textarea>
<br /><br />
<div class="col-12">
<div class="row">
<div class="col-12 col-xl-6 option-item">
<input type="checkbox" id="keep-keys" checked>
<label for="keep-keys">Keep citation keys</label>
<span class="option-help">When a pre-print is matched to a publication, the latter may have a
standard citation key. You can either update the entry's citation key or use the new one.
Note that if you use the new one, your existing citations will be broken.</span>
</div>
<div class="col-12 col-xl-6 option-item">
<input type="checkbox" id="show-only-matches">
<label for="show-only-matches">Show only matched items</label>
<span class="option-help">You can choose to EITHER (default) get the same list of references,
with matched items updated (easier to copy-paste a full bibliography) OR just see the new
matches </span>
</div>

</div>
</div>
<button id="match-bib" class="mt-4">Match</button>
<button id="match-bib-stop" style="background-color: rgb(216, 71, 100); display: none;"
class="mt-4">STOP</button>
</div>

<div class="row">
<div>
<p id="n-arxivs"></p>
</div>
<div id="matching-progress-container" style="display: none;">
<div class="progress-container">
<div class="progress" id="matching-progress-bar"></div>
<div style="padding: 8px; text-align: center;">
<span id="matching-status-index"></span> / <span id="matching-status-total"></span>
</div>
</div>
<div id="matching-status">
<div id="matching-status-title"></div>
<div>
Looking for publications on <span id="matching-status-provider"></span>
</div>
</div>
</div>
</div>

<div class="row mb-5">
<div id="matched-list"> </div>
<h2 id="match-results-title"></h2>
<br />
<button id="copy-results" style="display: none;">Copy to clipboard</button>
<br />
<pre id="match-results" style="display: none;">
</pre>
</div>


<div class="section">

</div>

</div>

<script src="../shared/min/jquery.min.js"></script>
<script src="../popup/js/select2.min.js"></script>
<script src="../options/highlight.min.js"></script>
<script src="../shared/min/utils.min.js"></script>
<script src="bibMatcher.js"></script>
</body>

</html>
Loading

0 comments on commit c7f3ffc

Please sign in to comment.