Jump to content

User:Terasail/HeaderIcons.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Terasail (talk | contribs) at 16:48, 6 October 2022 (Create). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
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.
//<nowiki>
/*
	HeaderIcons.js
	Created by: Terasail
*/
/*jshint esversion: 6*/
//Static header
let topParent = document.getElementById("p-personal").parentElement;
let topDropdown = topParent.children[1].children[2].children[0].children;
$(topParent).append('<div class="headerAllIcons vector-menu mw-portlet mw-portlet-vector-user-menu-overflow vector-user-menu-overflow"><ul class="vector-menu-content-list"></ul></div>');
$(topParent).append(topParent.children[1]);
let headerAllIcons = document.getElementsByClassName("headerAllIcons")[0].children[0];
for (let i = 0; i < topDropdown.length; i++) {
	let current = topDropdown[i];
	let tempIcon = current.cloneNode(true);
	if (tempIcon.id == "pt-watchlist" || tempIcon.id == "pt-userpage") { tempIcon.style = "display:none"; }
	let tempChild = tempIcon.children[0];
	tempChild.children[1].remove();
	tempChild.className = "mw-ui-button mw-ui-quiet mw-ui-icon-element " + tempChild.children[0].className;
	$(headerAllIcons).append(tempIcon);
}
//Sticky header
let stickyParent = document.getElementById("p-lang-btn-sticky-header").parentElement;
$(stickyParent).append(headerAllIcons.parentElement.cloneNode(true));
$(stickyParent).append(stickyParent.children[2]);
let stickyIcons = stickyParent.children[2].children[0].children;
for (let i = 0; i < stickyIcons.length; i++) {
	let tempIcon = stickyIcons[i];
	tempIcon.style = "";
}
//</nowiki>[[Category:Wikipedia scripts]]