User:Inquisitor Sasha/myDocuments.js
From RationalWiki
(Redirected from User:Inquisitor Ehrenstein/myDocuments.js)
Note: After saving, 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: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Clear the cache in Tools → Preferences
/* 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() { // Code to control the documents window that will display var myDocumentsWindow = '<div style="position: fixed; background: #DDDDDD; padding: 50px;">Hello world!</div>'; // 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 document.getElementByID('myDocLink-link').onclick = displayDocWindow;