diff --git a/README.md b/README.md index 25d06aa..79d9d69 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,14 @@ # 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. diff --git a/arxivchrome.png b/arxivchrome.png new file mode 100644 index 0000000..d2e0a84 Binary files /dev/null and b/arxivchrome.png differ diff --git a/arxivvanitymod.js b/arxivvanitymod.js new file mode 100644 index 0000000..45a4282 --- /dev/null +++ b/arxivvanitymod.js @@ -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; + } +} diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..fe99709 --- /dev/null +++ b/manifest.json @@ -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"] + } + ] +} diff --git a/popup.html b/popup.html new file mode 100644 index 0000000..2187949 --- /dev/null +++ b/popup.html @@ -0,0 +1,33 @@ + + + +
+Arxiv Vanity originally by Andreas Jansson and Ben Firshman
+Extension by Isay Katsman
+ + diff --git a/popup.js b/popup.js new file mode 100644 index 0000000..e69de29