User:Ilikecomputers/vector-2022.js

//Test: turn pink text black on Heartwarming pages. if (document.title.includes('Heartwarming')) { document.body.style = 'color:#202122 !important'; } //some options on the left of the screen will be hidden in the vector 2022 skin. Expand and show them here. //update: looks like this bug got resolved //document.querySelectorAll('#mw-panel .vector-menu-content').forEach(function (e) { //   e.style.display = "block"; //}); //Disallows the usage of the Visual Editor, because it gets in the way of more experienced editors if (document.getElementById('ca-ve-edit')) document.getElementById('ca-ve-edit').innerHTML = '';

//adds a special "useful pages" section to the sidebar, along with other things like "Troping Tools" and "Troper Social Networks" function usefulPagesSidebar { var commonPages = [ ['Style Guide', 'https://allthetropes.org/wiki/All_The_Tropes:Style_Guide'], ['Personal Sandbox', 'https://www.allthetropes.org/wiki/User:Ilikecomputers/sandbox'], ['New Files Gallery', 'https://allthetropes.org/wiki/Special:NewFiles'], ['Active users list', "https://allthetropes.org/wiki/Special:ActiveUsers"], ['Statistics', 'https://allthetropes.org/wiki/Special:Statistics']] ; //common pages var usefulPagesDiv = document.createElement('div');

var subDiv = document.createElement('div');

var heading = document.createElement('span'); subDiv.classList.add('vector-menu-heading'); subDiv.appendChild(heading); heading.textContent = 'Useful Pages'; usefulPagesDiv.appendChild(subDiv);

var listingItemsDiv = document.createElement('div'); listingItemsDiv.classList = 'vector-menu-content'; usefulPagesDiv.appendChild(listingItemsDiv);

var unorderedList = document.createElement('ul'); unorderedList.classList = 'vector-menu-content-list'; listingItemsDiv.appendChild(unorderedList);

for (var e in commonPages) { e = commonPages[e]; var listElement = document.createElement('li'); listElement.classList = 'mw-list-item'; var aElement = document.createElement('a'); listElement.appendChild(aElement);

aElement.innerText = e[0]; aElement.href = e[1]; aElement.title = e[0];

unorderedList.appendChild(listElement); }

usefulPagesDiv.classList = 'vector-menu mw-portvar vector-menu-portal portal expanded'; document.querySelector('#p-navigation').after(usefulPagesDiv); } usefulPagesSidebar;