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.
$(".mw-indicators").appendTo('.mw-body-header.vector-page-titlebar');
function loadScripts() {
importScript('User:Ohconfucius/script/MOSNUM dates.js');
importScript('User:Guywan/Scripts/12HourFormat.js');
}
function createPortlet(name, id, classId, tooltip, location) {
const portlet = document.createElement('div');
const title = document.createElement('div');
const items = document.createElement('div');
portlet.setAttribute('id', id);
title.setAttribute('id', id + '-label');
items.setAttribute('id', id + '-items');
portlet.className = 'vector-menu mw-portlet mw-portlet-' + classId;
title.className = 'vector-menu-heading';
items.className = 'vector-menu-content';
title.title = tooltip;
title.innerHTML = name;
document.getElementById(location).parentNode.insertBefore(portlet, document.getElementById(location).previousSibling);
document.getElementById(id).appendChild(title);
document.getElementById(id).appendChild(items);
}
createPortlet('Personal', 'p-ps', 'personal', 'Your personal pages', 'p-interaction');
mw.config.values.wgVisualEditorConfig.enableVisualSectionEditing = true; // Enable visual section editing.
$.when(mw.loader.using('mediawiki.util'), $.ready).then(function() {
const server = mw.config.values.wgServer;
const userName = 'User:' + mw.config.values.wgUserName;
const articlePath = mw.config.values.wgArticlePath;
const fullPath = server + articlePath;
addPortletLink('p-ps', fullPath.replace('$1', 'Special:Watchlist'), 'Watchlist', 'n-watchlist', 'Your watchlist');
addPortletLink('p-ps', fullPath.replace('$1', 'Special:Notifications'), 'Notifications', 'n-notifications', 'Your notifications');
addPortletLink('p-ps', fullPath.replace('$1', 'Special:PrefixIndex/' + userName), 'Subpages', 'n-subpages', 'Your subpages');
addPortletLink('p-ps', fullPath.replace('$1', 'Special:PendingChanges'), 'Pending changes', 'n-pendingchanges', 'View the pending changes log');
loadScripts();
});
/** Ripped from MediaWiki's util.js file, but slightly modified. */
function addPortletLink(portletId, href, text, id, tooltip, accesskey, nextnode) {
var item, link, portlet, div, ul, next;
if (!portletId) {
return null;
}
portlet = document.getElementById(portletId);
if (!portlet) {
return null;
}
link = document.createElement('a');
link.href = href;
link.textContent = text;
if (tooltip) {
link.title = tooltip;
} else if (accesskey) {
link.accessKey = accesskey;
}
mw.util.showPortlet(portletId);
item = $('<li>').append(link)[0];
item.className = 'mw-list-item';
if (id) {
item.id = id;
}
ul = portlet.tagName.toLowerCase() === 'ul' ? portlet : portlet.querySelector('ul');
if (!ul) {
ul = document.createElement('ul');
ul.className = 'vector-menu-content-list';
div = document.getElementById(portletId + '-items');
if (div) {
div.appendChild(ul);
} else {
portlet.appendChild(ul);
}
}
if (nextnode && (typeof nextnode === 'string' || nextnode.nodeType || nextnode.jquery)) {
nextnode = $(ul).find(nextnode);
if (nextnode.length === 1 && nextnode[0].parentNode === ul) {
nextnode.before(item);
next = true;
}
}
if (!next) {
ul.appendChild(item);
} else if (accesskey) {
$(link).updateTooltipAccessKeys();
}
mw.hook('util.addPortletLink').fire(item, { id: id });
return item;
}