mw.loader.impl(function(){return["ext.gadget.ReferenceTooltips@j5jn8",function($,jQuery,require,module){(function(){var REF_LINK_SELECTOR='.reference, a[href^="#CITEREF"]',COMMENTED_TEXT_CLASS='rt-commentedText',COMMENTED_TEXT_SELECTOR=(COMMENTED_TEXT_CLASS?'.'+COMMENTED_TEXT_CLASS+', ':'')+'abbr[title]';mw.messages.set({'rt-settings':'Reference Tooltips settings','rt-enable-footer':'Enable Reference Tooltips','rt-settings-title':'Reference Tooltips','rt-save':'Save','rt-cancel':'Cancel','rt-enable':'Enable','rt-disable':'Disable','rt-activationMethod':'Tooltip appears when','rt-hovering':'hovering','rt-clicking':'clicking','rt-delay':'Delay before the tooltip appears (in milliseconds)','rt-tooltipsForComments':'Show tooltips over text with a dotted underline in Reference Tooltips style (allows to see such tooltips on devices with no mouse support)','rt-disabledNote':'You can re-enable Reference Tooltips using a link in the footer of the page.', 'rt-done':'Done','rt-enabled':'Reference Tooltips are enabled'});var SECONDS_IN_A_DAY=60*60*24,CLASSES={FADE_IN_DOWN:'rt-fade-in-down',FADE_IN_UP:'rt-fade-in-up',FADE_OUT_DOWN:'rt-fade-out-down',FADE_OUT_UP:'rt-fade-out-up'},IS_TOUCHSCREEN='ontouchstart'in document.documentElement,IS_MOBILE=/Mobi|Android/i.test(navigator.userAgent)||typeof window.orientation!=='undefined',CLIENT_NAME=$.client.profile().name,settingsString,settings,enabled,delay,activatedByClick,tooltipsForComments,cursorWaitCss,windowManager,$body=$(document.body),$window=$(window);function rt($content){if(window.pg){return;}var teSelector,settingsDialogOpening=false;function setSettingsCookie(){mw.cookie.set('RTsettings',Number(enabled)+'|'+delay+'|'+Number(activatedByClick)+'|'+Number(tooltipsForComments),{path:'/',expires:90*SECONDS_IN_A_DAY,prefix:''});}function enableRt(){enabled=true;setSettingsCookie();$('.rt-enableItem').remove();rt($content);mw.notify(mw.msg('rt-enabled'));}function disableRt(){$content.find( teSelector).removeClass('rt-commentedText').off('.rt');$body.off('.rt');$window.off('.rt');}function addEnableLink(){var $footer=$('#footer-places, #f-list');if(!$footer.length){$footer=$('#footer li').parent();}$footer.append($('
').append($(' | ').addClass('rt-disabledNote').text(mw.msg('rt-disabledNote')))));this.stackLayout=new OO.ui.StackLayout({items:[this.panelSettings,this.panelDisabled]});this.$body.append(this.stackLayout.$element);};SettingsDialog.prototype.getSetupProcess=function(data){return SettingsDialog.parent.prototype.getSetupProcess.call(this,data).next(function(){this.stackLayout.setItem(this.panelSettings);this.actions.setMode('basic');
},this);};SettingsDialog.prototype.getActionProcess=function(action){var dialog=this;if(action==='save'){return new OO.ui.Process(function(){var newDelay=Number(dialog.delayInput.getValue());enabled=dialog.enableOption.isSelected();if(newDelay>=0&&newDelay<=5000){delay=newDelay;}activatedByClick=dialog.clickOption.isSelected();tooltipsForComments=dialog.tooltipsForCommentsCheckbox.isSelected();setSettingsCookie();if(enabled){dialog.close();disableRt();rt($content);}else{dialog.actions.setMode('disabled');dialog.stackLayout.setItem(dialog.panelDisabled);disableRt();addEnableLink();}});}else if(action==='deactivated'){dialog.close();}return SettingsDialog.parent.prototype.getActionProcess.call(this,action);};SettingsDialog.prototype.getBodyHeight=function(){return this.stackLayout.getCurrentItem().$element.outerHeight(true);};tooltip.upToTopParent(function adjustRightAndHide(){if(this.isPresent){if(this.$element[0].style.right){this.$element.css('right','+='+(window.innerWidth-$window.
width()));}this.te.hideRef(true);}});if(!windowManager){windowManager=new OO.ui.WindowManager();$body.append(windowManager.$element);}settingsDialog=new SettingsDialog();windowManager.addWindows([settingsDialog]);settingsWindow=windowManager.openWindow(settingsDialog);settingsWindow.opened.then(function(){settingsDialogOpening=false;});settingsWindow.closed.then(function(){windowManager.clearWindows();});}var tooltip=this;this.te=te;switch(this.te.type){case'supRef':this.id='rt-'+this.te.$originalElement.attr('id');this.$content=this.te.$ref.contents().filter(function(i){var $this=$(this);return this.nodeType===Node.TEXT_NODE||!($this.is('.mw-cite-backlink')||(i===0&&($this.is('b')||$this.is('a')&&$this.attr('href').indexOf('#ref')===0)));}).clone(true);break;case'harvardRef':this.id='rt-'+this.te.$originalElement.closest('li').attr('id');this.$content=this.te.$ref.clone(true).removeAttr('id');break;case'commentedText':this.id='rt-'+String(Math.random()).slice(2);this.$content=$(
document.createTextNode(this.te.comment));break;}if(!this.$content.length){return;}this.insideWindow=Boolean(this.te.$element.closest('.oo-ui-window').length);this.$element=$(' ').addClass('rt-tooltip').attr('id',this.id).attr('role','tooltip').data('tooltip',this);if(this.insideWindow){this.$element.addClass('rt-tooltip-insideWindow');}this.$content=this.$content.wrapAll(' ').parent().addClass('rt-tooltipContent').addClass('mw-parser-output').appendTo(this.$element);if(!activatedByClick){this.$element.mouseenter(function(){if(!tooltip.disappearing){tooltip.upToTopParent(function(){this.show();});}}).mouseleave(function(e){if(CLIENT_NAME!=='chrome'||(!e.originalEvent||e.originalEvent.relatedTarget!==null||!tooltip.clickedTime||$.now()-tooltip.clickedTime>50)){tooltip.upToTopParent(function(){this.te.hideRef();});}}).click(function(){tooltip.clickedTime=$.now();});}if(!this.insideWindow){$(' ').addClass('rt-settingsLink').attr('title',mw.msg('rt-settings')).click(function(){
if(settingsDialogOpening){return;}settingsDialogOpening=true;if(mw.loader.getState('oojs-ui')!=='ready'){if(cursorWaitCss){cursorWaitCss.disabled=false;}else{cursorWaitCss=mw.util.addCSS('body { cursor: wait; }');}}mw.loader.using(['oojs','oojs-ui'],openSettingsDialog);}).prependTo(this.$content);}this.$tail=$(' ').addClass('rt-tooltipTail').prependTo(this.$element);this.disappearing=false;this.show=function(){this.disappearing=false;clearTimeout(this.te.hideTimer);clearTimeout(this.te.removeTimer);this.$element.removeClass(CLASSES.FADE_OUT_DOWN).removeClass(CLASSES.FADE_OUT_UP);if(!this.isPresent){$body.append(this.$element);}this.isPresent=true;};this.hide=function(){var tooltip=this;tooltip.disappearing=true;if(tooltip.$element.hasClass('rt-tooltip-above')){tooltip.$element.removeClass(CLASSES.FADE_IN_DOWN).addClass(CLASSES.FADE_OUT_UP);}else{tooltip.$element.removeClass(CLASSES.FADE_IN_UP).addClass(CLASSES.FADE_OUT_DOWN);}tooltip.te.removeTimer=setTimeout(function(){if(tooltip.
isPresent){tooltip.$element.detach();tooltip.$tail.css('left','');if(activatedByClick){$body.off('click.rt touchstart.rt',tooltip.te.onBodyClick);}$window.off('resize.rt',tooltip.te.onWindowResize);tooltip.isPresent=false;}},200);};this.calculatePosition=function(ePageX,ePageY){var teElement,teOffsets,teOffset,tooltipTailOffsetX,tooltipTailLeft,offsetYCorrection=0;this.$tail.css('left','');teElement=this.te.$element.get(0);if(ePageX!==undefined){tooltipTailOffsetX=ePageX;teOffsets=teElement.getClientRects&&teElement.getClientRects()||teElement.getBoundingClientRect();if(teOffsets.length>1){for(var i=teOffsets.length-1;i>=0;i--){if(ePageY>=Math.round($window.scrollTop()+teOffsets[i].top)&&ePageY<=Math.round($window.scrollTop()+teOffsets[i].top+teOffsets[i].height)){teOffset=teOffsets[i];}}}}if(!teOffset){teOffset=teElement.getClientRects&&teElement.getClientRects()[0]||teElement.getBoundingClientRect();}teOffset={top:$window.scrollTop()+teOffset.top,left:$window.scrollLeft()+teOffset.
left,width:teOffset.width,height:teOffset.height};if(!tooltipTailOffsetX){tooltipTailOffsetX=(teOffset.left*2+teOffset.width)/2;}if(CLIENT_NAME==='msie'&&this.te.type==='supRef'){offsetYCorrection=-Number(this.te.$element.parent().css('font-size').replace('px',''))/2;}this.$element.css({top:teOffset.top-this.$element.outerHeight()-7+offsetYCorrection,left:tooltipTailOffsetX-20,right:''});if(this.$element.offset().left+this.$element.outerWidth()>$window.width()-1){this.$element.css({left:'',right:0});tooltipTailLeft=tooltipTailOffsetX-this.$element.offset().left-5;}if(teOffset.top |