Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// FIX LINKS TO TEMPORARY arxiv.org/PS_cache URLS TO PERMANENT ONES:// SEE ALSO: http://arxiv.org/help/arxiv_identifier_for_services// To use, go to Special:Linksearch, search for "arxiv.org/PS_cache" or "arxiv.org/ftp" (or same with "www." prefix) and click the "FIX" links.vararXivPSCacheRegex="http://(?:(?:\\w+\\.|)arxiv\\.org|xxx\\.lanl\\.gov|arxiv\\d+\\.library\\.cornell\\.edu)/(?:PS_cache|ftp)/(?:arxiv/|(([\\-.\\w]*)/))(?:pdf|ps|papers)/(\\d{4})/(\\3\\.?\\d+)(v\\d+|)\\.(?:ps|pdf)";// contains 5 capturing parens:// $1 = old-style group (if any)// $2 = old-style group without trailing slash (if any)// $3 = year and month// $4 = (within-group) article ID// $5 = version, if any// replace with "$1$4$5" to get the full arXiv IDif(mw.config.get('wgCanonicalNamespace')=="Special"&&mw.config.get('wgCanonicalSpecialPageName').toLowerCase()=="linksearch")addOnloadHook(function(){// add quick edit links to Special:Linksearchvarol=document.getElementsByTagName("ol")[0];if(!ol)return;varre=newRegExp("^"+arXivPSCacheRegex+"$","i");varseen=newObject();for(varli=ol.firstChild;li;li=li.nextSibling){if(li.nodeType!=1||li.tagName.toLowerCase()!="li")continue;varlinks=li.getElementsByTagName("a");if(links.length!=2)continue;if(!re.test(links[0].href))continue;vartitle=links[1].title;if(seen[title])continue;seen[title]=true;vareditlink=document.createElement("a");editlink.href=mw.config.get('wgScript')+"?title="+encodeURIComponent(title)+"&action=edit&fixarxivlinks=1";editlink.title="Fix arXiv/PS_cache links in "+title;editlink.appendChild(document.createTextNode("FIX"));li.insertBefore(editlink,li.firstChild);li.insertBefore(document.createTextNode(" ("),editlink);li.insertBefore(document.createTextNode(") "),editlink.nextSibling);}});if(mw.config.get('wgAction')=="edit"&&/[?&]fixarxivlinks=/.test(window.location.search))addOnloadHook(function(){vareditForm=document.forms.editform;if(!editForm)return;varpdfRe=newRegExp("\\b"+arXivPSCacheRegex+"\\b(?=[^\\0]*\\bhttp://(?:(?:\\w+\\.|)arxiv\\.org|xxx\\.lanl\\.gov|arxiv\\d+\\.library\\.cornell\\.edu)/(?:abs/|)\\1\\4(?:\\5|)\\b|[^\\0]*\\[\\[[\\s_]*:?[\\s_]*arXiv[\\s_]*:[\\s_]*\\1\\4(?:\\5|)[\\s_]*(?:\\]\\]|\\|)|[^\\0]*\\{\\{(?:\\s*msg:|)[\\s_]*(?:Template[\\s_]*:[\\s_]*|)arXiv[\\s_]*\\|\\s*(?:(?:archive\\s*=\\s*|)\\2\\s*\\|\\s*(?:id\\s*=\\s*|)\\4(?:\\5|)|(?:id\\s*=\\s*|)\\1\\4(?:\\5|))\\s*(?:\\}\\}|\\|))","ig");varabsRe=newRegExp("\\b"+arXivPSCacheRegex+"\\b(?:(\\s*\\|[^{}]*|\\s*)\\|\\s*format\\s*=\\s*(?:PDF|\\[\\[PDF\\]\\])\\s*(?=\\\}\\}|\\s*\\|)|(\\s+Preprint on arXiv)\\s*\\(PDF\\)|)","ig");varcontent1=editForm.wpTextbox1.value;varcontent2=content1.replace(pdfRe,"http://arxiv.org/pdf/$1$4$5");varcontent3=content2.replace(absRe,"http://arxiv.org/abs/$1$4$5$6$7");if(content1==content3)return;editForm.wpTextbox1.value=content3;varsummaryType=(content1==content2?"abstract page with download links":content2==content3?"stable URLs":"stable URL and/or abstract page");editForm.wpSummary.value="Fixing temporary \"arxiv.org/PS_cache\" and obsolete \"arxiv.org/ftp\" URLs to link to "+summaryType+" instead (with [[User talk:Ilmari Karonen/fixarxivlinks.js|script assistance]])";editForm.wpMinoredit.checked=true;editForm.wpDiff.click();// Not feeling lucky yet...});