Added necessary functionality, link injection to arxiv page complete

This commit is contained in:
isaykatsman
2017-10-24 18:30:43 -04:00
parent deaa6ad6bd
commit da7dc232a3
6 changed files with 89 additions and 1 deletions
+13 -1
View File
@@ -1,2 +1,14 @@
# Chrome-Arxiv-Vanity # Chrome-Arxiv-Vanity
Chrome extension that adds "arxiv-vanity" link to the arxiv download options
An extension that provides an [Arxiv Vanity](https://www.arxiv-vanity.com) link directly on an accessed arxiv page.
# Installation (unofficial)
1. Clone this repo.
2. Open the [chrome://extensions](chrome://extensions) page.
3. Check the *Developer Mode* box on the top of the page.
4. Click "Load unpacked extension..." and select the repo folder.
# Usage
Navigate to any [arxiv.org][arxiv] paper, click the "Arxiv Vanity" link the the downloads section.
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

+20
View File
@@ -0,0 +1,20 @@
var div_dl = document.getElementsByClassName("full-text")[0];
var c = div_dl.childNodes;
var i;
for (i = 0; i < c.length; i++) {
if(c[i].nodeName == "UL") {
var node = document.createElement("LI");
var link = document.createElement("A");
var t = document.createTextNode("Arxiv Vanity");
// get url, extract arxiv id
url = window.location.href
re = /(\d+\.\d+v?\d)/i
found = url.match(re)[0]
av_url = "https://www.arxiv-vanity.com/papers/" + found
link.setAttribute("href", av_url);
link.appendChild(t);
node.appendChild(link);
c[i].insertBefore(node, c[i].childNodes[2]);
break;
}
}
+23
View File
@@ -0,0 +1,23 @@
{
"manifest_version": 2,
"name": "Arxiv Vanity Plugin",
"description": "This extension provides an arxiv vanity link directly on an accessed arxiv page.",
"version": "1.0",
"browser_action": {
"default_icon": "arxivchrome.png",
"default_popup": "popup.html"
},
"permissions": [
"activeTab",
"storage",
"*://*.arxiv.org/*"
],
"content_scripts": [
{
"matches": ["*://*.arxiv.org/*"],
"js": ["arxivvanitymod.js"]
}
]
}
+33
View File
@@ -0,0 +1,33 @@
<!doctype html>
<!--
This page is shown when the extension button is clicked, because the
"browser_action" field in manifest.json contains the "default_popup" key with
value "popup.html".
-->
<html>
<head>
<title>Arxiv Vanity Plugin</title>
<style type="text/css">
body {
margin: 10px;
white-space: nowrap;
}
h1 {
font-size: 15px;
}
#container {
align-items: center;
display: flex;
justify-content: space-between;
}
</style>
</head>
<body>
<h1>Arxiv Vanity Plugin</h1>
<p>Arxiv Vanity originally by Andreas Jansson and Ben Firshman</p>
<p>Extension by Isay Katsman</p>
</body>
</html>
View File