Skip to content

Instantly share code, notes, and snippets.

@theSage21
Created December 6, 2018 09:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theSage21/a69a3269bff3567e5b2a4a33a1819969 to your computer and use it in GitHub Desktop.
Save theSage21/a69a3269bff3567e5b2a4a33a1819969 to your computer and use it in GitHub Desktop.
Don't redirect a pdf link to a abstract link if there's a noredirect=1 parameter
// ==UserScript==
// @name ArxivPdfNoRedirect
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://arxiv.org/abs/*
// @grant none
// @require https://code.jquery.com/jquery-3.2.1.min.js
// ==/UserScript==
(function() {
'use strict';
var x = $("a[href^='/pdf/']")[0].href.split('/');
var new_url = "/pdf/"+x[x.length-1]+"?noredirect=1";
$("a[href^='/pdf/']")[0].href = new_url;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment