User:Terasail/HeaderTextLinks.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
This user script seems to have a documentation page at User:Terasail/HeaderTextLinks. |
/* //<nowiki>
HeaderTextLinks.js
Created by: Terasail
*/
if (mw.config.get("skin") === "vector-2022") {
//Static header
let headerIconList = $("#p-vector-user-menu-overflow .vector-menu-content-list")[0];
let headerIcons = headerIconList.children;
for (let i = 0; i < headerIcons.length; i++) {//Remove icons after notification buttons
if (headerIcons[i].id !== "pt-userpage-2" && headerIcons[i].id.indexOf("-2") >= 0) {
headerIcons[i].remove();
}
}
let userLinks = $("#p-personal .mw-list-item");
for (let i = 1; i < userLinks.length; i++) {
let tempElem = userLinks[i].cloneNode(true);
tempElem.id = userLinks[i].id + '-2';
tempElem.className = 'user-links-collapsible-item mw-list-item';
tempElem.children[0].className = 'cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only';
tempElem.children[0].children[0].remove();
$(headerIconList).append(tempElem);
}
//Sticky header
if ($('#vector-sticky-header').length !== 0) {//Check for sticky header
let stickyIconList = $(".vector-sticky-header-buttons")[0];
for (let i = 1; i < userLinks.length; i++) {
let tempElem = userLinks[i].children[0].cloneNode(true);
tempElem.id = userLinks[i].id + '-sticky-header-2';
tempElem.className = 'cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only';
// tempElem.className = "cdx-button cdx-button--weight-quiet mw-interlanguage-selector"
tempElem.children[0].remove();
$(stickyIconList).append(tempElem);
}
}
}
//</nowiki>[[Category:Wikipedia scripts]]