1,935
editsMore actions
newSidebarNavigation is now a function. Removed "Template" from "Custom" Sidebar navigation. Appended "Image Search" to right navigation. Inserted "JS" and "CSS" links to p-personal after "Preferences"
(Added variables for the different navigation menus. Added new section called "Custom" to the panel on the left side of the screen. Added a shortcut to open a template page called "Template" to the new "Custom" section.) |
(newSidebarNavigation is now a function. Removed "Template" from "Custom" Sidebar navigation. Appended "Image Search" to right navigation. Inserted "JS" and "CSS" links to p-personal after "Preferences") |
||
Line 1: | Line 1: | ||
function newSidebarNavigation(id) { | |||
var nav = document.createElement("nav"); | |||
var nav = document.createElement("nav"); | nav.id = "p-" + id; | ||
nav.id = "p-" + id; | nav.className = "vector-menu mw-portlet mw-portlet-" + id + " vector-menu-portal portal"; | ||
nav.className = "vector-menu mw-portlet mw-portlet-" + id + " vector-menu-portal portal"; | nav.setAttribute("aria-labelledby", "p-" + id + "-label"); | ||
nav.setAttribute("aria-labelledby", "p-" + id + "-label"); | nav.setAttribute("role", "navigation"); | ||
nav.setAttribute("role", "navigation"); | |||
var h3 = document.createElement("h3"); | |||
var h3 = document.createElement("h3"); | h3.id = "p-" + id + "-label"; | ||
h3.id = "p-" + id + "-label"; | h3.className = "vector-menu-heading"; | ||
h3.className = "vector-menu-heading"; | |||
var span = document.createElement("span"); | |||
var span = document.createElement("span"); | span.className = "vector-menu-heading-label"; | ||
span.className = "vector-menu-heading-label"; | span.textContent = id; | ||
span.textContent = id; | |||
h3.appendChild(span); | |||
h3.appendChild(span); | nav.appendChild(h3); | ||
nav.appendChild(h3); | |||
var div = document.createElement("div"); | |||
var div = document.createElement("div"); | div.className = "vector-menu-content"; | ||
div.className = "vector-menu-content"; | |||
var ul = document.createElement("ul"); | |||
var ul = document.createElement("ul"); | ul.className = "vector-menu-content-list"; | ||
ul.className = "vector-menu-content-list"; | |||
div.appendChild(ul); | |||
div.appendChild(ul); | nav.appendChild(div); | ||
nav.appendChild(div); | document.getElementById("mw-panel").appendChild(nav); | ||
document.getElementById("mw-panel").appendChild(nav); | } | ||
newSidebarNavigation("Custom"); | |||
Line 71: | Line 70: | ||
var pSpecial = contentLists[6]; | var pSpecial = contentLists[6]; | ||
var pTb = contentLists[7]; | var pTb = contentLists[7]; | ||
var pCustom = contentLists[8]; | var pCustom = contentLists[8]; | ||
function createListItem(contentList, listItemName) { | |||
function createListItem(end, contentList, listItemName, onClick, title) { | |||
var li = document.createElement('li'); | var li = document.createElement('li'); | ||
var a = document.createElement('a'); | var a = document.createElement('a'); | ||
contentList.prepend(li); | var span = document.createElement('span'); | ||
if (end == "a" || end == "app") {contentList.prepend(li);} | |||
else if (Number.isInteger(end)) {contentList.insertBefore(li, contentList.children[end-1]);} | |||
else {contentList.append(li);} | |||
// li.id = "pt/t/ca-" + listItemName; | // li.id = "pt/t/ca-" + listItemName; | ||
li.appendChild(a); | li.appendChild(a); | ||
a.setAttribute('onclick', | if (onClick.includes('/')){ | ||
a.href = onClick; | |||
li.classList | } | ||
a.setAttribute('onclick', onClick); | |||
if (title) {a.title = title;} | |||
a.appendChild(span); | |||
span.innerText = listItemName; | |||
li.classList.add("mw-list-item"); | |||
} | } | ||
Line 96: | Line 103: | ||
var pageName = prompt("Type" + pageType + "here:"); | var pageName = prompt("Type" + pageType + "here:"); | ||
if (pageName) { | if (pageName) { | ||
window.open( | window.open('https://bg3.wiki/wiki/'+ pageType + ':' + pageName, '_blank'); | ||
} | } | ||
} | } | ||
createListItem( | createListItem("p", rightNavigation, "Image Search", "/w/index.php?title=Special:Search&profile=images&search=&fulltext=1", "Open wiki search page on Multimedia"); | ||
createListItem(4, pPersonal, "JS", "https://bg3.wiki/wiki/User:Nattern/vector.js", "User:Nattern/vector.js"); | |||
createListItem(5, pPersonal, "CSS", "https://bg3.wiki/wiki/User:Nattern/vector.css", "User:Nattern/vector.css"); |