User:JustLeafy/global.js

//__NOWYSIWYG__ /* Imports */ importArticles({   type: 'script',    articles: [        'u:dev:AjaxDelete/code.js',        'u:dev:AjaxUndo/code.js',        'u:dev:BlogLink/code.js',        'u:dev:CommentPreview/code.js',        'u:dev:ConsistentModules/code.js',        'u:dev:ConsistentNotifications.js',        'u:dev:EditBio/code.js',        'u:dev:EditConflictAlert/code.js',        'u:dev:FANSUN/code.js',        'u:dev:FindAndReplace/code.js',        'u:dev:HistoryKey.js',        'u:dev:GalleryCaptions/code.js',        'u:dev:ManageReferences/code.js',        'u:dev:MediaWiki:MassEdit/code.js',        'u:dev:MassRename/code.js',        'u:dev:MediaWiki:FANSUN.js',        'u:dev:MediaWiki:ModernLightbox.js',        'u:dev:ModernProfile/EditButton.js',        'u:dev:Nuke/code.js',        'u:dev:PurgeButton/code.js',        'u:dev:QQX/code.js',        'u:dev:RandomPageShortcut/code.js',        'u:dev:RedirectManagement/code.js', 'u:dev:RevealAnonIP/code.js', 'u:dev:SandboxTab/code.js', 'u:dev:SeeMoreActivityButton/code.js', 'u:dev:Sine/code.js', 'u:dev:UserActivityTab/code.js', 'u:dev:View Source/code.js', 'u:dev:VSTFReport.js', 'u:dev:WallGreetingButton/code.js' ] });

//SandboxLink /* Add a menu item to profile menu with link to user contributions in modernized UI */ $(function {    var $userContribs = $('')        .attr('id', 'MySandbox')        .append( $('') .attr('href', '/wiki/User:' + wgUserName + '/Sandbox') .addClass('wds-global-navigation__dropdown-link') .text('My Sandbox') ); });

//RemoveBlueOutline /* It basically removes unnecessary blue outlines except when tabbing */ function handleFirstTab(e) { if (e.keyCode === 9) { // the "I am a keyboard user" key document.body.classList.add('user-is-tabbing'); window.removeEventListener('keydown', handleFirstTab); } }

window.addEventListener('keydown', handleFirstTab);

var didScroll; var lastScrollTop = 0; var delta = 5; var navbarHeight = $('div#globalNavigation').outerHeight; $(window).scroll(function(event){   didScroll = true; }); setInterval(function {   if (didScroll) {        hasScrolled;        didScroll = false;    } }, 250); function hasScrolled { var st = $(this).scrollTop; if(Math.abs(lastScrollTop - st) <= delta) return; if (st > lastScrollTop && st > navbarHeight){ $('div#globalNavigation').removeClass('wds-global-navigation').addClass('wds-global-navigation-up'); } else { if(st + $(window).height < $(document).height) { $('div#globalNavigation').removeClass('wds-global-navigation-up').addClass('wds-global-navigation'); }   }    lastScrollTop = st; }