User:Lieutenant S. Reznov/scripts/myDocuments.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/* MY DOCUMENTS
AUTHOR: Inquisitor Ehrenstein
CONTRIBUTORS:
LICENSE: CC-BY-SA © Copyright 2013 Inquisitor Ehrenstein
DESCRIPTION: The purpose of this script is to generate a menu that can be brought
up from the userbar for providing various links to userspace pages and directories
of userspace pages.
*/
/* Configuration variables */
// Wiki domain – Full domain, no trailing slash
var wikiDomain = 'www.mediawiki.org';
// Wiki path – File path between domain and page name, include trailing slash
var wikiPath = 'wiki/';
/* END CONFIGURATION */
// Add the link to bring up the menu window
var myDocLinkRef = document.getElementById('pt-preferences');
var myDocLinkParent = myDocLinkRef.parentNode;
var myDocLinkNewLink = document.createElement('li');
myDocLinkNewLink.id = 'myDocLink-link';
myDocLinkNewLink.innerHTML = '<a style="font-size: 9pt;" href="#">My documents</a>';
// Create the link in the userbar for the menu
var myDocumentsLink = myDocLinkParent.insertBefore(myDocLinkNewLink, myDocLinkRef);
// Function for displaying the window when the link is clicked
var displayDocWindow = function displayMyDocumentsWindow(evt) {
// Code to controll the documents window that will display
var myDocumentsWindow = '<p>Hello world!</p>';
// Code to add the box that will have the links
var myDocBoxRef = document.getElementByID('content');
var myDocBoxParent = myDocBoxRef.parentNode;
var myDocBoxNewBox = document.createElement('div');
myDocBoxNewBox.id = 'myDocuments-window';
myDocBoxNewBox.innerHTML = 'myDocumentsWindow';
}
// Display the menu when the link is clicked
myDocumentsLink.onclick = displayDocWindow;