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.
/* HIGHLIGHT NEARBY LINKS Description: If two links are next to each other so it's hard to tell if they are one link or two separate ones (such as [[New York]] [[City]]), both links will be underlined so that it is clear that they are separate.*/if(typeof(unsafeWindow)!='undefined'){mw=unsafeWindow.mw;}$(highlightNearbyLinks);functionhighlightNearbyLinks(){if(!(mw.config.get('wgAction')=='view'||(mw.config.get('wgPageName')=='Wikipedia:Sandbox'&&mw.config.get('wgAction')=='submit')))returnfalse;mw.util.addCSS('a.highlight-nearby { text-decoration: underline; }');mw.util.addCSS('a.highlight-nearby:hover { text-decoration: none; }');varbodyId=mw.config.get('wgPageName')=='Wikipedia:Sandbox'&&mw.config.get('wgAction')=='submit'?'wikiPreview':'bodyContent';varbody=$('#'+bodyId);if(!body.length)returnfalse;varlinks=$('a',body);// loop through links in page bodylinks.each(function(){varlink=$(this);varnext=link.next();// NOT: next node is a link, preceded by spaces// NOT: next node is a link and is also the next siblingif(!(next.length&&next[0].nodeName=='A'&&((link[0].nextSibling.nodeType==3&&link[0].nextSibling.nodeValue.replace(/ /g,'')=='')||link[0].nextSibling==next[0])))returntrue;// NOT: current and next links are not imagesif(!(!link.hasClass('image')&&!next.hasClass('image')))returntrue;// this is a refnameif((link.children().length&&link.children().first()[0].nodeName=='SUP')||(next.children().length&&next.children().first()[0].nodeName=='SUP'))returntrue;link.addClass('highlight-nearby');next.addClass('highlight-nearby');});}