Misplaced Pages

User:Mysekurity/monobook.js: Difference between revisions

Article snapshot taken from[REDACTED] 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:Mysekurity Browse history interactively← Previous editNext edit →Content deleted Content added
Revision as of 06:58, 23 April 2006 view sourceMysekurity (talk | contribs)Extended confirmed users5,507 edits adding protect tools (hopefully will work!)← Previous edit Revision as of 20:42, 23 April 2006 view source Aaron Schulz (talk | contribs)Extended confirmed users26,051 editsm categorize the jsNext edit →
Line 11: Line 11:
*/ */


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

//




Line 388: Line 387:
{ {
var txt = document.editform.wpTextbox1; var txt = document.editform.wpTextbox1;
txt.value = "<div class="boilerplate metadata vfd" style="background-color: #F3F9FF; margin: 2em 0 0 0; padding: 0 10px 0 10px; border: 1px solid #AAAAAA;">
txt.value = "{{subst:vt}} '''" + bold + "'''" + notbold + ". &ndash; ~~~~\n" + txt.value
:''The following discussion is an archived debate of the proposed deletion of the article below. <span style="color:red">'''Please do not modify it.'''</span> Subsequent comments should be made on the appropriate discussion page (such as the article's talk page or in a ]). No further edits should be made to this page. ''
+ "\n{{subst:vb}}\n";
<!--
Note: If you are seeing this page as a result of an attempt to re-nominate an article for deletion, you must manually edit the AfD nomination links in order to create a new discussion page using the name format of ]. When you create the new discussion page, please provide a link to this old discussion in your nomination. -->

The result of the debate was '''" + bold + "'''" + notbold + ". &ndash; ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)\n" + txt.value
+ "\n
:''The above discussion is preserved as an archive of the debate. <span style="color:red">'''Please do not modify it.'''</span> Subsequent comments should be made on the appropriate discussion page (such as the article's talk page or in a ]). No further edits should be made to this page.</div>\n";
txt = document.editform.wpSummary; txt = document.editform.wpSummary;
txt.value = "close discussion: " + bold + notbold; txt.value = "close discussion: " + bold + notbold;
Line 437: Line 442:
{ {
var s = (x == '1' ? '' : x); var s = (x == '1' ? '' : x);
return ]'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)', '{{test' + s + '}}'];
return ;
} }


Line 462: Line 467:
var txt = document.editform.wpTextbox1; var txt = document.editform.wpTextbox1;
if(txt.value.length > 0) txt.value += '\n'; if(txt.value.length > 0) txt.value += '\n';
txt.value += '{{oldafdfull|date=] ]|result=' + res + '|votepage={{subst:PAGENAME}}}} &ndash; ~~~~'; txt.value += '{{oldafdfull|date=] ]|result=' + res + '|votepage=Mysekurity/monobook.js}} &ndash; ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)';
txt.focus(); txt.focus();
} }
Line 569: Line 574:
var txt = document.editform.wpTextbox1; var txt = document.editform.wpTextbox1;
if(txt.value.length > 0) txt.value += '\n'; if(txt.value.length > 0) txt.value += '\n';
txt.value += "*'''Make it awesome!''' ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)";
txt.value += "*'''Make it awesome!''' ~~~~";
document.editform.submit(); document.editform.submit();
Line 583: Line 588:
addlimenu(tabs, 'talk messages', 'talkm'); addlimenu(tabs, 'talk messages', 'talkm');
var talkm = document.getElementById('talkm').getElementsByTagName('ul'); var talkm = document.getElementById('talkm').getElementsByTagName('ul');
addlilink(talkm, 'javascript:autoMessage("{{subst:User:Mysekurity/Welcome}} ~~~~", "Welcome to Misplaced Pages!", "save")', 'Welcome!', ''); addlilink(talkm, 'javascript:autoMessage("Hello, Mysekurity/monobook.js, and ] to ]! Thank you for your contributions; I hope you like the place and decide to stay. We're glad to have you in our community! Here are a few good links for newcomers:

addlilink(talkm, 'javascript:autoMessage("{{subst:User:Mysekurity/Semi}} ~~~~", "Semi-protection", "save")', 'GWB semi', '');
*If you haven't already, drop by the ] and tell others a bit about yourself.
addlilink(talkm, 'javascript:autoMessage("{{subst:anon}} Thanks, ~~~~", "Create an account!", "save")', 'anon', '');
*] That way, others will know who left which comments. You can sign your post like I did by using 4 tildes (<code>~&#126;~~</code>), which will leave your username and time you posted the comment.
*]
*]
*]
*]
*], which can be very useful later.
*]
*]
*]
*]
*Check out ]! Redwolf is a very friendly user, and this page might prove useful to you.

I hope you enjoy editing here and being a ]! Though we all make mistakes at some point, here is ], which might help you out. If you have any questions or concerns, don't hesitate to ], check the ], or add <code><nowiki>{{helpme}}</nowiki></code> to this page, and someone'll be along shortly.

Happy editing! ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)", "Welcome to Misplaced Pages!", "save")', 'Welcome!', '');
addlilink(talkm, 'javascript:autoMessage("I saw you just reverted vandalism on ], and wondered what you thought about the proposals to curb what's going on there. If you have time, check out ], and weigh in (there's something of a large discussion page, so be prepared. For a quick run-through of what's been said and done, see ]) Hope to see you there. ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)", "Semi-protection", "save")', 'GWB semi', '');
addlilink(talkm, 'javascript:autoMessage("], the 💕! You don't have to ] to read or edit articles on Misplaced Pages, but creating an account is quick, free and non-intrusive, requires no personal information, and gives you many ], including:
*The use of a ] of your choice, provided that it is ].
*The use of your own personal ] to which you can add articles that interest you.
*The ability to ].
*The ability to ].
*The ability to edit ].
*The ability to ].
*The ability to customize the appearance and behavior of the website.
*The eligibility to eventually become an ].
*Your ] will no longer be visible to other users.

We hope that you choose to become a Wikipedian and <big> ''']'''</big>. Feel free to ask me any questions you may have on my talk page. By the way, make sure to ] and comments with four tildes ('''&#126;&#126;&#126;&#126;'''), which will let others know who left it. Thanks, ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)", "Create an account!", "save")', 'anon', '');
addlilink(talkm, 'javascript:autoMessage(startThread(), "new thread", "save")', 'thread', ''); addlilink(talkm, 'javascript:autoMessage(startThread(), "new thread", "save")', 'thread', '');
addlilink(talkm, 'javascript:autoMessage("{{subst:edit summary}} ~~~~", "Edit summary", "save")', 'summary', ''); addlilink(talkm, 'javascript:autoMessage("Hello. Please remember to always provide an ]. Thanks and happy editing. <!-- Template:Editsummary --> ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)", "Edit summary", "save")', 'summary', '');
addlilink(talkm, 'javascript:autoMessage("Please do not add commercial links (or links to your own private websites) to Misplaced Pages. ] a vehicle for ] or a mere collection of ]. You are, however, ] to the encyclopedia. See the ] to learn more. Thanks. <!-- Template:Spam --> ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)", "Spam", "save")', 'Spam1', '');
addlilink(talkm, 'javascript:autoMessage("{{subst:spam1}} ~~~~", "Spam", "save")', 'Spam1', '');
addlilink(talkm, 'javascript:autoMessage("Please stop. If you continue to use Misplaced Pages for advertising, you will be ] from editing. <!-- Template:Spam2 --> ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)", "Spam", "save")', 'Spam2', '');
addlilink(talkm, 'javascript:autoMessage("{{subst:spam2}} ~~~~", "Spam", "save")', 'Spam2', '');
addlilink(talkm, 'javascript:autoMessage("Please do not replace Misplaced Pages pages or sections with blank content. It is considered ]. Please use ] for any other tests you want to do. Take a look at the ] if you would like to learn more about contributing to our encyclopedia. Thanks.<!-- Template:Blank2 --> ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)", "{{blanking}}", "save")', 'blanking', '');
addlilink(talkm, 'javascript:autoMessage("{{subst:blanking}} ~~~~", "{{blanking}}", "save")', 'blanking', '');
addlilink(talkm, 'javascript:autoMessage("] Welcome to Misplaced Pages. We invite everyone to contribute constructively to our encyclopedia. Take a look at the ] if you would like to learn more about contributing. However, unconstructive edits are considered ], and if you continue in this manner you may be '''] from editing without further warning'''. Please stop, and consider improving rather than damaging the hard work of others. Thanks. <!-- Template:Blatantvandal (serious warning) --> ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)", "{{bv}}", "save")', 'bv', '');
addlilink(talkm, 'javascript:autoMessage("{{subst:bv}} ~~~~", "{{bv}}", "save")', 'bv', '');
addlilink(talkm, 'javascript:autoMessage(test(1), test(1), "save")', 'test', ''); addlilink(talkm, 'javascript:autoMessage(test(1), test(1), "save")', 'test', '');
addlilink(talkm, 'javascript:autoMessage(test(2), test(2), "save")', 'test2', ''); addlilink(talkm, 'javascript:autoMessage(test(2), test(2), "save")', 'test2', '');

Revision as of 20:42, 23 April 2006

/* <nowiki> */

/**
 * Here be all good stuff
 * Original location: ]
 * Forked from ] around April 2005
 * Protection tools taken from ]
 * Dual licensed under the GFDL and GPL
 * See also: ], and especially ]. I tip my hat to you, sir.
 * And best of all: ] (stole most of it from there)
 */

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


/**** Add navigation popups ****/

// ] - please include this line 

document.write('<script type="text/javascript" src="http://en.wikipedia.org/search/?title=User:Lupin/popups.js&action=raw&ctype=text/javascript&dontcountme=s"><\/script>');

// customisations = see ] for more

popupFixRedirs = true;
popupRedirAutoClick = 'wpPreview';
popupFixDabs = true;
popupStructure = 'menus';
popupAdminLinks = true;
imagePopupsForImages = false;

// Filter changes live
// ] - please include this line
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/search/?title=User:Lupin/recent2.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

if (navigator.userAgent.toLowerCase().indexOf('safari') == -1) {
  // ] - please include this line 
  document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/search/?title=User:Lupin/popups.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}

function aol(){
    var form = document.editform;
    var txt = form.wpTextbox1;
    txt.value = "{{AOL}}\n\n" + txt.value;
    form.wpSummary.value = "{{AOL}}"
    form.wpMinoredit.checked = true;
}

/////////////////////////////////////////////////////////////////////////////////
// Misplaced Pages:WikiProject User scripts/Scripts/Changes since I last edited
/////////////////////////////////////////////////////////////////////////////////
function addSinceTab()
{
    var tabs=document.getElementById('p-cactions').getElementsByTagName('ul');
    if (window.location.href.indexOf("&action=history&gotosince=true")!=-1)
       do_since_I_last_edited();
    else if (!/wiki\/Special:|w\/index.php?title=Special:/.test(window.location.href))
    {
       var pageTitle=document.title.slice(0, String(document.title).indexOf(" - "));
       var l=addlilink(tabs, "/search/?title="+pageTitle+"&action=history&gotosince=true", 'since', '');
       l.lastChild.title="Changes since I last edited";
    }
}
function do_since_I_last_edited()
{
        var csub=document.getElementById("contentSub");
        var msg=document.createElement("p");
        msg.appendChild(document.createTextNode("Parsing history, please wait..."));
        msg.className="error";
        csub.insertBefore(msg, csub.firstChild);

        var username=document.getElementById("pt-userpage").textContent;
        var users=getElementsByClass(document, "history-user", "span");

        for(i=0;i<users.length;i++)
        {
            if(users.textContent==username)
            {
                document.location=users.parentNode.childNodes.href;
                return;
            }
        }

        msg.replaceChild(document.createTextNode("You have not edited this page recently."), msg.firstChild);
}

if (window.addEventListener) window.addEventListener("load", addSinceTab, false);
else if (window.attachEvent) window.attachEvent("onload", addSinceTab);

/************* afd Helper ************/
// from User:Jnothman/afd_helper

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

afdh_signature = '~~'+'~';
afdh_summaryprompt = true;

afdh_shortcuts = Array();
afdh_shortcuts = 'Delete';
afdh_shortcuts = 'Keep';
afdh_shortcuts = 'Merge';
afdh_shortcuts = 'Move';
afdh_shortcuts = 'Redirect';
afdh_shortcuts = 'Rewrite';
afdh_shortcuts = 'Transwiki';
afdh_shortcuts = 'Weak delete';
afdh_shortcuts = 'Strong delete';
afdh_shortcuts = 'Speedy delete';
afdh_shortcuts = 'Strong keep';
afdh_shortcuts = 'Weak keep';
afdh_shortcuts = 'Comment';

afdh_commscs = Array();
afdh_commscs = 'per nom.';

function afd_helper() {
    if (auto_mod())
       return;

    var anchors = new Array();
    {
    var oldanchors = document.getElementById('bodyContent').getElementsByTagName('a');
    for (var i=0; i < oldanchors.length; i++)
        anchors = oldanchors;
    }
    var url_re = /\?title=Misplaced Pages:Articles_for_deletion\/(+)&action=edit&/;
    var url, matches;
    for (var i=0; i < anchors.length; i++) {
        if (!(matches = anchors.href.match(url_re))
         || (matches.substr(0, 4) == 'Log/'))
            continue;
        var na = document.createElement('a');
        na.href = "javascript:afd_vote('"+anchors.href.replace(/'/g, '\\\'')+"')";
        na.title = "Vote on deletion of "+unescape(matches);
        var inlink = document.createElement('sup');
        inlink.appendChild(document.createTextNode('vote'));
        na.appendChild(inlink);
        anchors.parentNode.insertBefore(na, anchors.nextSibling);
    }

    if (am_get_title().indexOf(':') == -1)
        am_add_li('tb', 'javascript:afd_nominate()', 'Nominate AFD', '', 'Nominate this article for deletion');
}

function afd_vote(edit_link) {
    var shortcuts_list = '';
    for (var key in afdh_shortcuts)
        shortcuts_list += key + ': ' + afdh_shortcuts + '; ';
    var vote = window.prompt("Enter your vote.   (Shortcuts available are: "+shortcuts_list+")");
    if (!vote) return;
    if (afdh_shortcuts)
        vote = afdh_shortcuts;

    shortcuts_list = '';
    for (var key in afdh_commscs)
        shortcuts_list += key + ': ' + afdh_commscs + '; ';
    var comment = window.prompt("Enter your comment.  (Shortcuts available are: "+shortcuts_list+")");
    if (typeof comment != 'string') return;
    if (afdh_commscs)
        comment = afdh_commscs;

    var summary = vote;
    if (afdh_summaryprompt)
      if (!(summary = window.prompt("Enter the edit summary:", summary)))
         summary = vote;
    var url = edit_link + 
        '&amaddafter='+escape("* '''"+vote+"''' "+comment+" "+afdh_signature+" ~~"+"~~"+"~") +
        '&amsummary='+escape(summary);

    if (window.location.href.indexOf("/Log/") == -1)
      window.location.href = url;
    else
      window.open(url, "afd_helper_vote");
}

function afd_nominate() {
    var title = am_get_title();
    var log_date = window.prompt("This should be the date of the latest AFD log. Change it if necessary.", am_guess_date());
    if (!log_date)
        return;
    var reason = window.prompt("Please justify your AFD nomination of "+title+":");
    if (!reason)
        return;
    window.open(am_make_url(title, '{{'+'subst:afd}}', '', 'nomination for ]'), 'afdhn1');
    window.open(am_make_url('Misplaced Pages:Articles for deletion/Log/'+log_date, '', '{{'+'subst:afd3|pg='+title+'}}', 'Nominating ] for deletion'), 'afdhn3');
    window.location.href = am_make_url('Misplaced Pages:Articles for deletion/'+title, '', '{{'+'subst:afd2|pg='+title+'|text='+reason+' '+afdh_signature+" ~~"+"~~"+"~"+'}}', 'nominated for deletion');
}

if (window.addEventListener) window.addEventListener("load",afd_helper,false);
else if (window.attachEvent) window.attachEvent("onload",afd_helper);


/**** Initialise on window load ****/

if (window.addEventListener) window.addEventListener("load",myLoadFuncs,false);
else if (window.attachEvent) window.attachEvent("onload",myLoadFuncs);
else
{
    window.previousLoadFunction = window.onload;
    window.onload = function()
    {
        window.previousLoadFunction();
        myLoadFuncs();
    }
}

/**** Load custom functions ****/

function myLoadFuncs()
{
    // &action=purge
    addPurge();
    
    // &section=0
    addEditSection0();
    
    // cause the personal menu looks bad
    changeLinks();
    
    // because edit summaries are good
    addForceSummary();
    
    // now add a million extra tabs
    morelinks();
    
    // and some stuff for the sidebar
    addToolBoxLinks();
    
    // make red talk page links start new sections
    talkpageplus();
    
    // for admins only...
    // if(document.title.indexOf("Confirm delete - Delete") == 0) addVfdLink();
    
    // change the title of the edit link
    ta = ;
    
    // remove the logout access key
    //ta = new Array(null, null);
    
    // add the AFD helper
    // afd_helper();
    
    // re-render the title and accesskeys for stuff
    akeytt();
    
    // add history link to new messages box
    newmessagehistory();
}

// Adds "block" and "blocklog" tabs to User: and User talk: pages.
function add_block_tab(){
    var c1 = document.getElementById('column-one');
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul');

    // use the "edit this page" tab to get already-tidied url
    var editlk = document.getElementById('ca-edit').getElementsByTagName('a').href;
    // cut everything up to "title=" from the start and everything past "&action=edit" from the end
    editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit'));
    editlk = editlk.substring(editlk.indexOf(':') + 1);
    var slloc = editlk.indexOf('/');
    if(slloc > 0) editlk = editlk.substring(0, slloc);

    // add "block" tab
    addTab('/Special:Blockip/' + editlk, 'block', 'ca-block');

    // add "blocklog" tab
    addTab('/Special:Log/block?page=User:' + editlk, 'blocklog', 'ca-blocklog');
}

function blockip()
{
  if(document.title.indexOf('User:') == 0 || document.title.indexOf('User talk:') == 0)
      add_block_tab();
  else if(document.title.indexOf('Block user') == 0) // could stand to be more robust
      do_blockip_stuff();
}

//***** Old AfD==
function afdold () {
    var x = document.getElementById('ca-article');
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul');
    if(!x) return;
    if(x.children) x = x.children;
    else x = x.childNodes;
    addlilink(tabs, x.href.replace(/Special:Undelete/, "Misplaced Pages:Articles_for_deletion"), 'afd', '');
}

/**** Edit section 0 ****/

function addEditSection0()
{
    ta = ;
    if(!document.getElementById) return;
    var x = document.getElementById('ca-edit');
    if(!x) return;
    var y = document.createElement('LI');
    y.id = 'ca-edit-0';
    if(x.className == 'selected'){
      if(/&action=edit&section=0$/.test(window.location.href)){
        x.className = 'istalk';
        y.className = 'selected';
      } else {
        x.className = 'selected istalk';
      }
    } else if(x.className == 'selected istalk'){
      if(/&action=edit&section=0$/.test(window.location.href)){
        x.className = 'istalk';
        y.className = 'selected istalk';
      } else {
        y.className = 'istalk';
      }
    } else {
      y.className = x.className;
      x.className = 'istalk';
    }
    var z = document.createElement('A');
    if(x.children){
        z.href = x.children.href + '&section=0';
        z.appendChild(document.createTextNode('0'));
        y.appendChild(z);
        document.getElementById('p-cactions').children.insertBefore(y,x.nextSibling);
    }else{
        z.href = x.childNodes.href + '&section=0';
        z.appendChild(document.createTextNode('0'));
        y.appendChild(z);
        document.getElementById('p-cactions').childNodes.insertBefore(y,x.nextSibling);
    }
}

/**** Add generic tab ****/

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;
}

/**** Add tab as menu ****/

function addlimenu(tabs, 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);
    tabs.appendChild(li);
    return li;
}

/**** Add purge tab ****/

function addPurge()
{
    ta = ;
    if(!document.getElementById) return;
    var x = document.getElementById('ca-history');
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul');
    if(!x) return;
    if(x.children) x = x.children;
    else x = x.childNodes;
    addlilink(tabs, x.href.replace(/=history/, "=purge"), 'purge', 'ca-purge');
}

/**** Add afd header, footer and comment ****/

function closeafd(bold, notbold)
{
    var txt = document.editform.wpTextbox1;
    txt.value = "<div class="boilerplate metadata vfd" style="background-color: #F3F9FF; margin: 2em 0 0 0; padding: 0 10px 0 10px; border: 1px solid #AAAAAA;">
:''The following discussion is an archived debate of the proposed deletion of the article below. <span style="color:red">'''Please do not modify it.'''</span>  Subsequent comments should be made on the appropriate discussion page (such as the article's talk page or in a ]).  No further edits should be made to this page.  ''
<!--
Note:  If you are seeing this page as a result of an attempt to re-nominate an article for deletion, you must manually edit the AfD nomination links in order to create a new discussion page using the name format of ].  When you create the new discussion page, please provide a link to this old discussion in your nomination. -->

The result of the debate was '''" + bold + "'''" + notbold + ". &ndash; ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)\n" + txt.value
    + "\n
:''The above discussion is preserved as an archive of the debate.  <span style="color:red">'''Please do not modify it.'''</span> Subsequent comments should be made on the appropriate discussion page (such as the article's talk page or in a ]). No further edits should be made to this page.</div>\n";
    txt = document.editform.wpSummary;
    txt.value = "close discussion: " + bold + notbold;
    
    // I don't mind still watching them
    // document.editform.wpWatchthis.checked = false;
}

/**** Generic custom talk message ****/

function autoMessage(msgtext, summary, saveopt)
{
    var txt = document.editform.wpTextbox1;
    document.editform.wpSummary.value = summary;
    if(txt.value.length > 0) txt.value += '\n';
    txt.value += msgtext;
    if(saveopt == 'save')
    {
        document.editform.submit();
    }
    else if(saveopt == 'preview')
    {
        document.editform.wpPreview.click();
    }
    else if(saveopt == 'diff')
    {
        document.editform.wpDiff.click();
    }
}

/**** Get the pagename for a specified thread ****/

function startThread()
{
    var which = prompt("Thread number?");
    var now = new Date();
    if(which < 10) which = '0' + which;
    var timestamp = now.getUTCFullYear() + '';
    now.getUTCMonth() < 9 ? timestamp += '0' + (now.getUTCMonth() + 1) : timestamp += (now.getUTCMonth() + 1);
    now.getUTCDate() < 10 ? timestamp += '0' + now.getUTCDate() : timestamp += now.getUTCDate();
    return '{{User talk:Mysekurity/' + timestamp + '-' + which + '}}';
}

/**** Get the text for a specified test number ****/

function test(x)
{
    var s = (x == '1' ? '' : x);
    return ]'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)', '{{test' + s + '}}'];
}

/**** String replacement popup ****/

function replace()
{
    var s = prompt("Search regexp?");
    if(s){
        var r = prompt("Replace regexp?");
        var txt = document.editform.wpTextbox1;
        txt.value = txt.value.replace(new RegExp(s, "g"), r);
    }
}

/**** Talk page AFD result ****/

function afdresult()
{
    var res = prompt("Result?");
    if(!res) return;
    var afddate = prompt("Nomination date?");
    document.editform.wpSummary.value = 'AFD result - ' + res.replace(/'/g, '');
    var txt = document.editform.wpTextbox1;
    if(txt.value.length > 0) txt.value += '\n';
    txt.value += '{{oldafdfull|date=] ]|result=' + res + '|votepage=Mysekurity/monobook.js}} &ndash; ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)';
    txt.focus();
}

/**** Make old AfD's appear or disappear ****/

function hideafd()
{
    var divs = document.getElementsByTagName("div");
    for(var x = 0; x < divs.length; ++x)
        if(divs.className.indexOf("vfd") != -1)
            divs.style.display = "none";
    // needed to shrink the page - rendering bug
    document.getElementById('footer').style.display = 'none';
}

function showafd()
{
    var divs = document.getElementsByTagName("div");
    for(var x = 0; x < divs.length; ++x)
        if(divs.className.indexOf("vfd") != -1)
            divs.style.display = "";
    // might as well put it back...
    document.getElementById('footer').style.display = '';
}

/**** Make the top links look better ****/

function changeLinks()
{
    if(!document.getElementById) return;
    // remove the "my" bits
    document.getElementById('pt-mytalk').firstChild.innerHTML = 'talk';
    document.getElementById('pt-watchlist').firstChild.innerHTML = 'watchlist';
    document.getElementById('pt-mycontris').firstChild.innerHTML = 'contributions';
    // add a clock
    var toplinks = document.getElementById('p-personal').getElementsByTagName('ul');
    addlilink(toplinks, '#', '', 'utcdate');
    showtime();
}

/**** Now using the version I developed on commons ****/

function addForceSummary()
{
    if(!/&action=edit/.test(window.location.href) && !/&action=submit/.test(window.location.href)) return;
    if(/&section=new/.test(window.location.href)) return;
    if(!document.forms.editform) return;
    document.forms.editform.wpSave.onclick = forceSummary;
    document.forms.editform.wpSave.onfocus = forceSummary;
}

function forceSummary()
{
    // Section names be damned
    if (!document.forms.editform.wpSummary.value.replace(/^(?:\/\\*.*\\*\/)? *(.*) *$/,'$1'))
    {
        var r = prompt('Are you sure you want to submit without adding a summary?\nTo add a summary, type it in the box below:',document.forms.editform.wpSummary.value);
        if(r == null) { return false; }
        document.forms.editform.wpSummary.value = r;
    }
    return true;
}

/**** Not sure how this works ****/

function afddelete(){
    var form = document.forms.deleteconfirm;
    form.wpReason.value = '+)&action=delete.*$/, '$1').replace(/_/g, ' ')) + ']]';
    form.wpConfirm.checked = true;
}

/**** Mega Tab Adding ****
 *
 * I'm making this comment block REALLY REALLY BIG so I can find it
 *
 * Possibly the most useful bit of this entire file, it adds various tabs depending on
 * what page we are on
 *
 */

function morelinks()
{
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul');
    if(document.title.indexOf("Editing Misplaced Pages:Articles for deletion") == 0)
    {
        /**** I'm insane! ****/
        
        addlimenu(tabs, 'afd actions', 'afda');
        var afda = document.getElementById('afda').getElementsByTagName('ul');
        addlilink(afda, 'javascript:closeafd("keep", "")', 'keep', '');
        addlilink(afda, 'javascript:closeafd("merge and redirect", " to ]")', 'merge', '');
        addlilink(afda, 'javascript:closeafd("redirect", " to ]")', 'redir', '');
        addlilink(afda, 'javascript:closeafd("transwiki", " to " + prompt("Transwiki to?"))', 'trans', '');
        addlilink(afda, 'javascript:closeafd("transwiki", " to Wiktionary")', 'wikt', '');
        addlilink(afda, 'javascript:closeafd("speedy delete", "")', 'speedy', '');
        addlilink(afda, 'javascript:closeafd("delete", "")', 'del', '');
        addlilink(afda, 'javascript:closeafd(prompt("Result?"), "")', 'other', '');
        addlilink(tabs, 'javascript:replace()', 'replace', '');
        
        /**** Finish insanity ****/
        
        /**** The "Make it Awesome!" button ****
        
        document.editform.wpSummary.value = 'This vote brought to you by the "Make it Awesome!" button';
        var txt = document.editform.wpTextbox1;
        if(txt.value.length > 0) txt.value += '\n';
        txt.value += "*'''Make it awesome!''' ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)";
        document.editform.submit();
        
        **** Finish making it awesome ****/
    }
    else if(document.title.indexOf("Confirm delete - Delete") == 0)
    {
        addlilink(tabs, 'javascript:afddelete()', 'afd', '');
    }
    else if(document.title.indexOf("Editing User talk:") == 0)
    {
        addlilink(tabs, 'javascript:replace()', 'replace', '');
        addlimenu(tabs, 'talk messages', 'talkm');
        var talkm = document.getElementById('talkm').getElementsByTagName('ul');
        addlilink(talkm, 'javascript:autoMessage("Hello, Mysekurity/monobook.js, and ] to ]! Thank you for your contributions; I hope you like the place and decide to stay. We're glad to have you in our community! Here are a few good links for newcomers:

*If you haven't already, drop by the ] and tell others a bit about yourself.
*] That way, others will know who left which comments. You can sign your post like I did by using 4 tildes (<code>~&#126;~~</code>), which will leave your username and time you posted the comment. 
*]
*]
*]
*]
*], which can be very useful later.
*]
*]
*]
*]
*Check out ]! Redwolf is a very friendly user, and this page might prove useful to you.

I hope you enjoy editing here and being a ]! Though we all make mistakes at some point, here is ], which might help you out. If you have any questions or concerns, don't hesitate to ], check the ], or add <code><nowiki>{{helpme}}</nowiki></code> to this page, and someone'll be along shortly.

Happy editing! ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)", "Welcome to Misplaced Pages!", "save")', 'Welcome!', '');
        addlilink(talkm, 'javascript:autoMessage("I saw you just reverted vandalism on ], and wondered what you thought about the proposals to curb what's going on there. If you have time, check out ], and weigh in (there's something of a large discussion page, so be prepared. For a quick run-through of what's been said and done, see ]) Hope to see you there. ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)", "Semi-protection", "save")', 'GWB semi', '');
        addlilink(talkm, 'javascript:autoMessage("], the 💕! You don't have to ] to read or edit articles on Misplaced Pages, but creating an account is quick, free and non-intrusive, requires no personal information, and gives you many ], including:
*The use of a ] of your choice, provided that it is ].
*The use of your own personal ] to which you can add articles that interest you.
*The ability to ].
*The ability to ].
*The ability to edit ].
*The ability to ].
*The ability to customize the appearance and behavior of the website.
*The eligibility to eventually become an ].
*Your ] will no longer be visible to other users.

We hope that you choose to become a Wikipedian and <big> ''']'''</big>. Feel free to ask me any questions you may have on my talk page. By the way, make sure to ] and comments with four tildes ('''&#126;&#126;&#126;&#126;'''), which will let others know who left it.  Thanks, ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)", "Create an account!", "save")', 'anon', '');
        addlilink(talkm, 'javascript:autoMessage(startThread(), "new thread", "save")', 'thread', '');
        addlilink(talkm, 'javascript:autoMessage("Hello. Please remember to always provide an ]. Thanks and happy editing. <!-- Template:Editsummary --> ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)", "Edit summary", "save")', 'summary', '');
        addlilink(talkm, 'javascript:autoMessage("Please do not add commercial links (or links to your own private websites) to Misplaced Pages.  ] a vehicle for ] or a mere collection of ].  You are, however, ] to the encyclopedia. See the ] to learn more.  Thanks. <!-- Template:Spam -->  ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)", "Spam", "save")', 'Spam1', '');
        addlilink(talkm, 'javascript:autoMessage("Please stop. If you continue to use Misplaced Pages for advertising, you will be ] from editing. <!-- Template:Spam2 -->  ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)", "Spam", "save")', 'Spam2', '');
        addlilink(talkm, 'javascript:autoMessage("Please do not replace Misplaced Pages pages or sections with blank content. It is considered ]. Please use ] for any other tests you want to do. Take a look at the ] if you would like to learn more about contributing to our encyclopedia. Thanks.<!-- Template:Blank2 -->  ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)", "{{blanking}}", "save")', 'blanking', '');
        addlilink(talkm, 'javascript:autoMessage("] Welcome to Misplaced Pages. We invite everyone to contribute constructively to our encyclopedia. Take a look at the ] if you would like to learn more about contributing. However, unconstructive edits are considered ], and if you continue in this manner you may be '''] from editing without further warning'''. Please stop, and consider improving rather than damaging the hard work of others. Thanks. <!-- Template:Blatantvandal (serious warning) -->  ''']'''<sup>]|]|]</font></sup> 20:42, 23 April 2006 (UTC)", "{{bv}}", "save")', 'bv', '');
        addlilink(talkm, 'javascript:autoMessage(test(1), test(1), "save")', 'test', '');
        addlilink(talkm, 'javascript:autoMessage(test(2), test(2), "save")', 'test2', '');
        addlilink(talkm, 'javascript:autoMessage(test("2a"), test("2a"), "save")', 'test2a', '');
        addlilink(talkm, 'javascript:autoMessage(test(3), test(3), "save")', 'test3', '');
        addlilink(talkm, 'javascript:autoMessage(test(4), test(4), "save")', 'test4', '');
        addlilink(talkm, 'javascript:autoMessage(test(5), test(5), "save")', 'test5', '');
    }
    else if(document.title.indexOf("Editing ") == 0)
    {
        addlilink(tabs, 'javascript:replace()', 'replace', '');
        addlilink(tabs, 'javascript:afdresult()', 'afd result', '');
    }
    else if(document.title.indexOf("Misplaced Pages:Articles for deletion") == 0)
    {
        addlilink(tabs, 'javascript:hideafd()', 'hide closed', 'ca-hide');
        ta = ;
        addlilink(tabs, 'javascript:showafd()', 'show closed', 'ca-show');
        ta = ;
    }
}


///////////////////////////////////////////////////////////////////
// AutoCopyvio - Created by bmicomp from modified autovfd
// from ]
//////////////////////////////////////////////////////////////////
document.write('<script type="text/javascript" src="http://en.wikipedia.org/search/?title=Misplaced Pages:WikiProject User scripts/Scripts/Autocopyvio.js&action=raw&ctype=text/javascript&dontcountme=s"><\/script>');

/**** Add links to the toolbox ****/

function addToolBoxLinks()
{
    var tb = document.getElementById('p-tb').getElementsByTagName('ul');
    
    var afdtime = new Date();
    var months = ['January', 'February', 'March', 'April', 'May', 'June',
        'July', 'August', 'September', 'October', 'November', 'December'];
    afdtime.setUTCDate(afdtime.getUTCDate() - 7);
    
    addlilink(tb, '/Special:Newpages', 'New pages', '');
    addlilink(tb, '/Special:Shortpages', 'Short pages', '');
    addlilink(tb, '/Special:Log', 'Logs', '');
    addlilink(tb, '/Template:Deletiontools', 'Deletion tools', '');
    addlilink(tb, '/Wikipedia:Articles_for_deletion/Log/' + afdtime.getUTCFullYear()
        + '_' + months + '_' + afdtime.getUTCDate(), 'Week old AfD', '');
    addlilink(tb, '/Wikipedia:Disambiguation_pages_with_links', 'Dab list', '');
    addlilink(tb, '/Wikipedia:Template_messages/User_talk_namespace', 'Talk messages', '');
    addlilink(tb, '/User:Alphax/special', 'Special characters', '');
    addlilink(tb, '/User:Mysekurity/monobook.js', 'Monobook.js', '');
    addlilink(tb, '/User:Mysekurity/monobook.css', 'Monobook.css', '');
    addlilink(tb, '/WP:ICT', 'Image Copyright tags', '');
}

/**** Get a clock that autoupdates! ****/

function showtime()
{
    var timerID;
    var now = new Date();
    var timeValue = now.toUTCString().replace(/GMT/, "UTC");
    document.getElementById('utcdate').firstChild.innerHTML = timeValue;
    timerID = setTimeout('showtime()', 100);
}

/**** Auto start new topics when hitting empty talk pages from the content page ****/

function talkpageplus()
{
    var talkpagelink = document.getElementById('ca-talk');
    if (talkpagelink.className == 'new')
    {
        talkpagelink.firstChild.href += '&section=new';
    }
}

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;
			else	a.style.color = '#FF0000'; // old default behavior
		}
		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
		contribs = links;

		insertLoc = user.nextSibling; // ' newusers '

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

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

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

		item.insertBefore( NewLink( 'actions', '/search/?title=Special%3ALog&user=' + name, true, '#000088' ), insertLoc );
		item.insertBefore( document.createTextNode( ', ' ), insertLoc );

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

		item.insertBefore( NewLink( 'is blocked?', '/Special:Ipblocklist?action=search&ip=' + name, true, '#888800' ), insertLoc );
		item.insertBefore( document.createTextNode( ', ' ), insertLoc );

		item.insertBefore( NewLink( 'do block!', '/search/?title=Special:Blockip&ip=' + name, true, '#880000' ), 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 );

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

/* </nowiki> */
Category:
User:Mysekurity/monobook.js: Difference between revisions Add topic