User:Lieutenant S. Reznov/scripts/myDocuments.js

/* 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 = 'My documents'; // 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 function displayMyDocumentsWindow(evt) {

// Code to controll the documents window that will display

var myDocumentsWindow = ' Hello world! ';

// 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 = displayMyDocumentsWindow;