Misplaced Pages

User:Δ/GeorgeMoney.js

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
< User:Δ
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump.
This code will be executed when previewing this page.
Documentation for this user script can be added at User:Δ/GeorgeMoney.
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 Misplaced Pages:Bypass your cache.
//<pre><nowiki>
//GeorgeMoney's monobook.js
//Copy this to ]
//----------------------------DEVELOPMENTAL-------------------------------

//MAIN VARS
var myname="Δ"
var mypage="User:Δ"
var mytalk="User talk:Δ"
var mytalkurl="User_talk:Δ"
var mycontribs="Special:Contributions/Δ"
var serverurl="http://en.wikipedia.org"
var wikiurl=serverurl+"/"
var pathurl=serverurl+"/w/"
var phpurl=pathurl+"index.php?title="
var editcounturl="http://toolserver.org/~soxred93/count/index.php"
var editcount=editcounturl+"?name="

//

//

//COMMANDS FROM URL

$(function () {
  var fontsize=getParamValue('fontsize');
  if (fontsize) document.write('<style type="text/css">#content {font-size:'+fontsize+';}</style>');

  var fontsizenc=getParamValue('fontsizenc');
  if (fontsizenc) document.write('<style type="text/css">* {font-size:'+fontsizenc+';}</style>');
  
  var welcome=getParamValue('welcome');
   if (welcome) {
  document.getElementById('wpTextbox1').value = "{{subst:User:Δ/Welcome}}";
  document.getElementById('wpSummary').value = "Welcome to wikipedia!";
  document.getElementById('editform').submit();
   }

 /*
  var minor=getParamValue('autominor');
  if (minor) {
    switch (minor) {
    case '1':
    case 'yes':
    case 'true':
      document.editform.wpMinoredit.checked=true;
      break;
    case '0':
    case 'no':
    case 'false':
      document.editform.wpMinoredit.checked=false;
    }
  }
  */
});


//Modified version of user:Where/usertabs
$(function() {
  if (document.title.search("/") != -1 || document.title.search("- History -") != -1) { //no subpages or history
     return;
  }
  if (document.title.indexOf("User:") == 0 || document.title.indexOf("User talk:") == 0) {
     username_a = document.URL.match(/:.*:(.*)/);
     username=username_a;
     addTab(phpurl+"User_talk:"+username+"&action=edit&section=new&welcome=1", "welcome!", "ca-contrib", "contribs", "");
  }
});

//POPUPS
popupFixDabs=true;

//------------------------NON-DEV; REC--------------------------------------------------


//------------ADD EDIT COUNT LINK FOR USERS
$(function () {
        if (document.getElementById('t-contributions')) {
                z=document.getElementById("content").childNodes;
                for (var n=0;n<z.length;n++) { 
                        if (z.className=="firstHeading") var username = z.textContent.replace(new RegExp('User(?:talk)?:(*)', 'g'), '$1');
                };
                var toolbox = document.getElementById('p-tb').getElementsByTagName('ul');
                var link = document.createElement('a');
                link.href = editcount+username+"&lang=en&wiki=wikipedia";
                link.appendChild(document.createTextNode('Edit count'));
                var li = document.createElement('li');
                li.appendChild(link);
                toolbox.appendChild(li);
        }
});

//----------------------------LIST REDLINKS
function listRedLinks() {
        var len=document.links.length;
        var output=document.createElement('div');
        output.innerHTML='<h2>Red links</h2>';
        var gotSome=false;
        for (var i=0; i<len; ++i) {
                if (document.links.className=='new') {
                        gotSome=true;
                        var l=document.links.cloneNode(true);
                        output.appendChild(l);
                        output.appendChild(document.createElement('br'));
                }
        }
        if (gotSome){
                output.appendChild(document.createElement('hr'));
                var h1=document.getElementsByTagName('h1');
                h1.parentNode.insertBefore(output, h1.nextSibling);
        }
}
$(function(){addToolboxLink('javascript:listRedLinks()', 'List red links');});



//---------------------------------------------------------------------------------IGNORE--------------------------------------------------------------------------------------------------------


//LINKS
$(function(){addTopLink(editcount+myname+"&site=en.wikipedia.org", 'edit count');});

//---------------------------------------------------------------------------------------------------------------FUNCTS------------------------------------------------------------------------------------------------
function redir(url) {
document.write('<meta http-equiv="refresh" content="0; url='+url+'">');
}
function loadJS(page){
  page=page.replace(" ", "_");
  document.write('<script type="text/javascript" src="'+phpurl+page+'&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}
function loadCSS(page){
  page=page.replace(" ", "_");
  document.write('<style type="text/css">@import "'+phpurl+page+'&action=raw&ctype=text/css";</style>');
}
function loadCSSext(page){
  document.write('<style type="text/css">@import "'+page+'";</style>');
}
function loadchrome(page){
  page=page.replace(" ", "_");
  document.write('<script type="text/javascript" src="chrome://wikipedia/content/'+page+'"></script>');
}

//PAGENAME FOR CSS
document.write('<body namespace="'+mw.config.get('wgCanonicalNamespace')+'" id="wikipage-'+mw.config.get('wgPageName')+'">');

// ----------------------------------------------HELPERS----------------------------------------------
//    --- ADD VARIOUS LINKS ----
function addToolboxLink(url, name, id){
    var tb = document.getElementById('p-tb').getElementsByTagName('ul');
    addlilink(tb, url, name, id);
}
// 
function addTopLink(url, name, id){
    var personal = document.getElementById('p-personal').getElementsByTagName('ul');
    addlilink(personal, url, name, id);
}
// 
function addNavLink(url, name, id){
    var navigation = document.getElementById('p-navigation').getElementsByTagName('ul');
    addlilink(navigation, url, name, id);
}
// 

function addTab(url, name, id, title, key){
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul');
    return addlilink(tabs, url, name, id, title, key);
}

//

//      ------ MORE MAJOR LINKAGE -----
function addLink(where, url, name, id, title, key, after){
    //* where is the id of the toolbar where the button should be added;
    //   i.e. one of "p-cactions", "p-personal", "p-navigation", or "p-tb".
    //
    //* url is the URL which will be called when the button is clicked.
    //   javascript: urls can be used to do more complex things.
    //
    //* name is what will appear as the name of the button.
    //
    //* id is the id of the button; it's best to define one.  
    //   Use a prefix to make sure its unique. Optional.
    //
    //* title is the tooltip title that gives a longer description 
    //   of the button; if you define a accesskey, mention it here. Optional.
    //
    //* key is the char you want for the accesskey. Optional.
    //
    //* after is the id of the button you want to follow this one. Optional.
    //
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
    var tabs = document.getElementById(where).getElementsByTagName('ul');
    if(after) {
        tabs.insertBefore(li,document.getElementById(after));
    } else {
        tabs.appendChild(li);
    }
    if(id) {
        if(key && title) { ta = ; }
        else if(key) { ta = ; }
        else if(title) { ta = ;} 
    }
    // re-render the title and accesskeys from existing code in wikibits.js
    akeytt();
    return li;
}
    
// 

// ------------- LINKAGE ----------------

function addlilink(tabs, url, name, id, title, key){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
    tabs.appendChild(li);
    if(id)
    {
        if(key && title)
        {
            ta = ;
        }
        else if(key)
        {
            ta = ;
        }
        else if(title)
        {
            ta = ;
        }
    }
    // re-render the title and accesskeys from existing code in wikibits.js
    akeytt();
    return li;
}

// 

// 

// ---------- END HELPER FUNCTIONS ---------

//</nowiki></pre>

//---------- TEST

function NUPatrol()
{
 if ( ( window.location.href.indexOf( 'Special%3ALog&type=newusers' ) == -1 ) &&
 ( window.location.href.indexOf( 'Special:Log/newusers'        ) == -1 )  )
 return; // make more robust???

 var items, item, i, links, user, name, talk, contribs, insertLoc, link;

 items = document.getElementById( 'bodyContent' ).getElementsByTagName( 'ul' ).getElementsByTagName( 'li' );

 function NewLink( txt, url, plainlinks, linkColor )
 { var a = document.createElement( 'a' );
 a.appendChild( document.createTextNode( txt ) );
 a.href = url;
 if ( plainlinks ) a.className = 'plainlinks';
 if ( linkColor )
 { if ( typeof linkColor == "string" )
 a.style.color = linkColor;
 }
 return a;
 }

 for ( i = 0; i < items.length; i++ )
 {
 item = items;
 
 links = item.getElementsByTagName( 'a' );

 user = links; name = user.firstChild.nodeValue;
 talk = links; talk.firstChild.nodeValue = 'talk'; // lowercase 'Talk' for consistency

 insertLoc = user.nextSibling; // ' newusers '

 item.insertBefore( document.createTextNode( ' ( ' ), insertLoc );

 item.insertBefore( talk, insertLoc );
 item.insertBefore( document.createTextNode( ', ' ), insertLoc );

 item.insertBefore( NewLink( 'blocks', '/search/?title=Special%3ALog&type=block&page=User%3A' + name, true, '#002bb8' ), insertLoc );
 item.insertBefore( document.createTextNode( ', ' ), insertLoc );

 item.insertBefore( NewLink( '', 'javascript:AIVandal("' + name + '")', true, 'red' ), insertLoc );
 item.insertBefore( document.createTextNode( ', ' ), insertLoc );

 item.insertBefore( NewLink( '', '/search/?title=User_talk:' + name + '&action=edit&section=new&welcome=1', true, 'green' ), insertLoc );

 item.insertBefore( document.createTextNode( ' )' ), insertLoc );

 item.removeChild( insertLoc.nextSibling ); // should remove the span
 item.removeChild( insertLoc ); // should remove ' newusers ' text
 }
}
if ( window.addEventListener ) window.addEventListener( 'load', NUPatrol, false );
else if ( window.attachEvent ) window.attachEvent( 'onload', NUPatrol );

//<nowiki> AIV tools
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/search/?title=User:Lightdarkness/aiv.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

loadJS('User:Voice_of_All/Sleeper/monobook.js');