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.
// Generated by CoffeeScript 2.1.1(function(){/* DISAMBIGUATION NAVIGATOR Description: Makes navigation of disambiguation pages easier by associating each article with a keyboard key. Click on a key, such as "5", to click on the fifth article in a disambiguation page. Works with all numbers and letters on the keyboard. */varDisambiguationLinks;DisambiguationLinks=classDisambiguationLinks{staticinit(){vardisambigBoxes,i,j,k,keys,letters,numbers,setIndexBox;disambigBoxes=$('#disambigbox');setIndexBox=$('#setindexbox');if((!disambigBoxes.length&&!setIndexBox.length)||window.mw.config.get('wgCanonicalNamespace')!==''||window.mw.config.get('wgAction')!=='view'){returnfalse;}DisambiguationLinks.setCss();numbers='1234567890';letters='abcdefghijklmnopqrstuvwxyz';// Loop through each disambiguation list item// Place either a number or letter next to each oneDisambiguationLinks.setKeyForItems(letters);// 49 to 57, 48, 65 to 90keys={};j=0;k=0;i=49;while(i<=57){keys[i]=numbers.charAt(j);i++;j++;}keys[48]=numbers.charAt(j);i=65;while(i<=90){keys[i]=letters.charAt(k);i++;k++;}// keys contains numbers and letters$.merge(keys,letters);return$('html').on('keydown',(event)=>{if(!DisambiguationLinks.isModifierKey(event)&&!DisambiguationLinks.isInInputField(event)){DisambiguationLinks.goToDisambigLink(event,keys);returnevent.preventDefault();}});}staticgoToDisambigLink(e,keys){varhref,id;if(!keys[e.which]){returnfalse;}id=$('#disambig-link-'+keys[e.which]);href=id.attr('href');if(!href){returnfalse;}// Remove highlight from other links, then highlight the link's line$('.selected-disambig-link').removeClass('selected-disambig-link');id.closest('li').addClass('selected-disambig-link');// Go to the linkreturn___location.href=href;}staticisInInputField(event){if(['INPUT','TEXTAREA'].indexOf(event.target.nodeName)>-1){returntrue;}else{returnfalse;}}staticisModifierKey(event){if(event.altKey||event.ctrlKey||event.metaKey||event.shiftKey){returntrue;}else{returnfalse;}}staticsetCss(){returnwindow.mw.util.addCSS('.disambig-link { color: #777; display: inline-block; width: 20px; } .catlinks .disambig-link { display: none; } .selected-disambig-link { background-color: #ff9; }');}staticsetKeyForItems(letters){varcharIndex,listIndex;listIndex=1;charIndex=0;return$('#bodyContent').find('li').each(function(index,element){vararticle,links,styledLinks;article=$(element);// Don't use this LI if it's part of the TOCif(article.closest('#toc').length){returntrue;}links=article.find('a');styledLinks=article.find('b > a, i > a, u > a');// There are no links in the current line.// The first link is wrapped in another tag.// The same as the above two but for styled links.if((!links.length||links.first().parent()[0]!==article[0])&&(!styledLinks.length||styledLinks.first().parent().parent()[0]!==article[0])){returntrue;}links.first().attr('id','disambig-link-'+listIndex);article.prepend('<span class="disambig-link">('+listIndex+')</span> ');// Increment index. Numbers from 1 to 0, then a to z. Covers 36 links.if(listIndex===9){listIndex=0;}elseif(listIndex===0||typeoflistIndex==='string'){listIndex=letters.charAt(charIndex);if(!listIndex){returnfalse;}charIndex++;}else{listIndex++;}if(listIndex===''){returnfalse;}});}};$(function(){returnDisambiguationLinks.init();});}).call(this);