User:Chlod/Scripts/DirectPDFDownload.js

// Direct PDF Download // Author: Chlod // Version: 1.0.1-REL

// Forces the "Download as PDF" button to directly download the PDF version of // the article.

$(document).ready(function {	$("li#coll-download-as-rl").on("mouseover", function (event) { var a = event.target.querySelector("a"); if (!a || !a.getAttribute("href").includes("show-download-screen")) { return; }		a.setAttribute(			"href",			"https://en.wikipedia.org/api/rest_v1/page/pdf/" + 			encodeURIComponent( mw.util.wikiUrlencode(new URL(a.getAttribute("href"), window.location.href).searchParams.get("page")) )		);	}); });