Jump to content

User:Josette/monobook.js

From Wikipedia, the free encyclopedia
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.
//<pre><nowiki>
//---------------------------------------------------------------

/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Script loading function by Quarl (http://wiki.riteme.site/wiki/User:Quarl)
/////////////////////////////////////////////////////////////////////////////////////////////////////////

// loads from en...

function winc(s) {
    s = s.replace(/^\[\[/, '').replace(/\]\]$/, '');
    document.write('<script type="text/javascript" src="'
             + 'http://wiki.riteme.site/w/index.php?title=' + s
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}


// **** Add tab to tab structure 'tabs' with function 'url' and label 'name'****

function addlilink(tabs, url, name, id){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    li.id = id;
    li.appendChild(na);
    tabs.appendChild(li);
    return li;
}


function addlimenu(tabset, name, id)
{
    var na = document.createElement('a');
    na.href = '#';
    var mn = document.createElement('ul');
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    li.id = id;
    li.className = 'tabmenu';
    li.appendChild(na);
    li.appendChild(mn);
    tabset.appendChild(li);
    return li;
}


//---------------------------------------------------------------
/* like submitting the URL http://wiki.riteme.site/w/index.php?title={{{PAGENAME}}}&action=purge */

// addPurge
$(function () {
    var hist; var url;
    if (!(hist = document.getElementById('ca-history') )) return;
    if (!(url = hist.getElementsByTagName('a')[0] )) return;
    if (!(url = url.href )) return;
    mw.util.addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),
                   'purge', 'ca-purge', 'Purge server cache for this page', 'p');
});

// 

// This will add an [edit top] link at the top of all pages except preview pages
function addtoplink()
{
var edittop = '<span style="color:black;">[</span>edit top<span style="color:black;">]</span>';
  // if this is preview page or generated page, stop
  if(document.getElementById("wikiPreview") || window.location.href.indexOf("w/index.php?title=Special:") != -1) return;
  if(document.title.indexOf("Main Page") != -1) return;

  // get the page title
  var pageTitle = document.title.split(" - ")[0].replace(" ", "_"); 

  // create div and set innerHTML to link
  var divContainer = document.createElement("div");
  divContainer.innerHTML = '<div class="editsection" style="float:right;margin-left:5px;margin-right:35px;margin-top:3px;"><a href="/w/index.php?title='+pageTitle+'&action=edit&section=0" title="'+document.title.split(" - ")[0]+'">' + edittop + '</a></div>';

  // insert divContainer into the DOM before the h1
if (document.getElementById("content") !=undefined) {
  document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);}
}
//END


// [[User:Lupin/popups.js]]

mw.loader.load(
             'https://wiki.riteme.site/w/index.php?title=User:Lupin/popups.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s');


//First loads
//Helper tools for tabs

// Helper tools (addtabs mandatory for other functions)
winc('[[User:Voice_of_All/Addtabs/monobook.js]]');  

// UTC clock
winc('[[User:Voice_of_All/UTCclock.js]]'); 

// Deletion
winc('[[User:Voice_of_All/Deletion/monobook.js]]'); 

// Replace txt
winc('[[User:Voice_of_All/replacetxt.js]]'); 

//************
//MAIN
//************

window.onload = Main;
function Main() 
{
    changemovetab();
    changelinks();
    addtoplink();

    addtoolboxlinks();
    if(addSinceTab)
    {addSinceTab();}
   
}
//END
//************