MediaWiki:Common.js

/* WEBSITE LOGO */ //Add any new logo's url to the list below. A resolution between 200 or 300px should do just fine. Make it a square. var picUrl = ["https://whogen.miraheze.org/w/thumb_handler.php/d/da/Pjlogo.jpg/300px-Pjlogo.jpg","https://static.miraheze.org/whogenwiki/f/f9/Mrtardisremembers.jpg","https://static.miraheze.org/whogenwiki/1/19/Judylogo.jpg","https://static.miraheze.org/whogenwiki/2/2d/Jahanslogo.jpg","https://static.miraheze.org/whogenwiki/e/eb/GMmuedQK_400x400.jpg","https://static.miraheze.org/whogenwiki/f/f7/Logo-landing-qui.png","https://static.miraheze.org/whogenwiki/8/85/Logo-landing-briggs.png","https://whogen.miraheze.org/w/thumb_handler.php/e/e7/1633520784544.png/233px-1633520784544.png","https://static.miraheze.org/whogenwiki/b/b9/Z1.jpg","https://static.miraheze.org/whogenwiki/9/92/Z2x.jpg","https://whogen.miraheze.org/w/thumb_handler.php/f/fc/Zperi.png/300px-Zperi.png","https://static.miraheze.org/whogenwiki/thumb/1/13/Z_.png/300px-Z_.png","https://static.miraheze.org/whogenwiki/6/62/Bojototherescue.png","https://static.miraheze.org/whogenwiki/2/2a/Nyssssaaaaa9.png","https://static.miraheze.org/whogenwiki/f/fa/Routinelogo.png","https://static.miraheze.org/whogenwiki/6/6a/Sunnysatire.png","https://static.miraheze.org/whogenwiki/7/73/Perty_satire.PNG","https://static.miraheze.org/whogenwiki/6/67/Draft_logo.jpg","https://static.miraheze.org/whogenwiki/f/f3/Npclogo.png","https://static.miraheze.org/whogenwiki/d/d9/Logo_rtd_returns.png","https://whogen.miraheze.org/w/thumb_handler.php/d/d1/Elhighvisman.png/300px-Elhighvisman.png","https://whogen.miraheze.org/w/thumb_handler.php/6/6c/Z1599048963612.png/300px-Z1599048963612.png","https://static.miraheze.org/whogenwiki/6/64/Z1633712706650.png","https://static.miraheze.org/whogenwiki/d/d5/Logo_eric_roberts_needs_work.png","https://static.miraheze.org/whogenwiki/9/99/Logo_bill_enjoys_bbc.png","https://static.miraheze.org/whogenwiki/a/a5/Tomdimensions.jpg"];

var logo = document.createElement('img'); SetPicSrc; logo.style.display = "block"; logo.style.width= "100%"; logo.style.marginLeft = "-7px";

document.getElementById('mw-panel').insertBefore(logo, document.getElementById('p-navigation'));

//Changes the logo on click logo.addEventListener('click', function {	SetPicSrc; }, false);

//Defines Pic URL randomly function SetPicSrc { var randomNum = Math.floor(Math.random * picUrl.length); logo.setAttribute ("src", picUrl[randomNum]); }

/*--*/

/* COLOURED LINE */ var theLine = document.createElement('div'); theLine.style.width = '100%'; theLine.style.height = '6px'; theLine.style.background = 'linear-gradient(90deg, rgb(71, 136, 193) 0%, rgb(11, 159, 189) 100%)'; theLine.style.marginTop = '-10px'; theLine.style.marginBottom = '6px';

document.getElementsByClassName('mw-page-container-inner')[0].insertBefore(theLine, document.getElementsByClassName('mw-workspace-container')[0]);

/*--*/

/* 'CREATE NEW PAGE' SIDEBAR LINK */ var newPageLink = document.createElement('li'); newPageLink.classList.add('mw-list-item');

var newPageLinkInner = document.createElement('a'); newPageLinkInner.innerHTML = " Create new page "; newPageLinkInner.href="/wiki/Special:CreatePage";

newPageLink.appendChild(newPageLinkInner);

document.getElementById('t-specialpages').insertAdjacentElement('beforebegin', newPageLink);

/*--*/

/* AUTO HIDE SIDEBAR ON SMALL SCREENS */ var screenWidth = window.innerWidth;

if(screenWidth <= 720) { document.getElementById('mw-sidebar-checkbox').checked = false; }

/*--*/

/* COMMENT SECTION */ // Header var commentHeader = document.createElement('span'); commentHeader.classList.add('ra-read-more'); commentHeader.id = "commentHeaderStyling"; commentHeader.innerHTML = " Comments ";

setTimeout(function{   document.getElementsByClassName('cs-header')[0].insertAdjacentElement('beforebegin', commentHeader);    warnVisitors; }, 1500);

// Message to visitors (must be logged in to post comments) function warnVisitors{ // If the "Add comment" button doesn't appear to visitors if(document.getElementsByClassName('cs-footer')[0].childNodes.length == 0) { var warningText = document.createElement('div'); warningText.innerHTML = "You must be logged in to post comments."; warningText.style.display = "ruby-text-container";

commentHeader.insertAdjacentElement('afterend', warningText); } }