Jump to content

User:B/vector.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>

==function addLink()==

*This function will add a link to your Wikipedia toolbar.  It is required both for [[User:Howcheng/quickimgdelete.js|Howcheng's image deletion script]] and my template replacement script.

<pre>
*/

/* This code may be problematic when it comes to titles with ampersands, etc, which are stored as ''& amp ;'' in HTML (without the spaces).
  A solution that solves this is the following:
    return document.title.substr(0, document.title.lastIndexOf(' - Wikipedia, the free'));
*/

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('div')[0].getElementsByTagName('ul')[0];

    if(after) 
{
        tabs.insertBefore(li,document.getElementById(after));
    } else {
        tabs.appendChild(li);
    }
/*
    if(id) {
        if(key && title) { ta[id] = [key, title]; }
        else if(key) { ta[id] = [key, '']; }
        else if(title) { ta[id] = ['', title];} 
    }
    // re-render the title and accesskeys from existing code in wikibits.js
    akeytt();*/
    return li;
}

function ReplaceDeletedTemplate_onload()
{
addLink('p-tb', 'http://en.wikipedia.org/wiki/User_talk:B/page', 'My user page', 'temp-bp', 'My user page');
addLink('p-tb', 'http://en.wikipedia.org/wiki/User_talk:B/page2', 'Working page', 'temp-bp2', 'Working page');
addLink('p-tb', 'http://en.wikipedia.org/wiki/Category:Candidates_for_speedy_deletion?action=purge#Pages_in_category', 'CAT:CSD', 'temp-csd', 'CAT:CSD');
addLink('p-tb', 'http://en.wikipedia.org/w/index.php?title=Category:Candidates_for_speedy_deletion_as_attack_pages&action=purge#Pages_in_category', 'CAT:ASD', 'temp-asd', 'CAT:ASD');
addLink('p-tb', 'http://en.wikipedia.org/wiki/Category:Candidates_for_speedy_deletion_as_nonsense_pages?action=purge#Pages_in_category', 'CAT:NSD', 'temp-nsd', 'CAT:NSD');
addLink('p-tb', 'http://en.wikipedia.org/w/index.php?title=Category:Candidates_for_speedy_deletion_as_non-commercial_use_only_files&action=purge#Pages_in_category', 'CAT:NCSD', 'temp-ncsd', 'CAT:NCSD');
addLink('p-tb', 'http://en.wikipedia.org/wiki/Wikipedia:Files_for_deletion?action=purge', 'WP:IFD', 'temp-ifd', 'WP:IFD');
addLink('p-tb', 'http://en.wikipedia.org/w/index.php?title=Wikipedia:Possibly_unfree_files&action=purge', 'WP:PUI', 'temp-pui', 'WP:PUI');
addLink('p-tb', 'http://en.wikipedia.org/w/index.php?title=Wikipedia:Templates_for_discussion&action=purge#Current_discussions', 'WP:TFD', 'temp-tfd', 'WP:TFD');
addLink('p-tb', 'http://en.wikipedia.org/wiki/Wikipedia:Miscellany_for_deletion?action=purge', 'WP:MFD', 'temp-mfd', 'WP:MFD');
addLink('p-tb', 'http://en.wikipedia.org/wiki/Wikipedia:Deletion_review?action=purge', 'WP:DRV', 'temp-mfd', 'WP:DRV');
addLink('p-tb', 'http://en.wikipedia.org/wiki/Wikipedia:Requests_for_adminship?action=purge', 'WP:RFA', 'temp-rfa', 'WP:RFA');
addLink('p-tb', 'http://en.wikipedia.org/w/index.php?title=Wikipedia:Usernames_for_administrator_attention&action=purge', 'WP:UAA', 'temp-uaa', 'WP:UAA');
addLink('p-tb', 'http://en.wikipedia.org/w/index.php?title=Wikipedia:Requests_for_undeletion&action=purge', 'WP:REFUND', 'temp-und', 'WP:REFUND');
addLink('p-tb', 'http://en.wikipedia.org/w/index.php?title=Wikipedia:Administrator_intervention_against_vandalism&action=purge', 'WP:AIV', 'temp-aiv', 'WP:AIV');
addLink('p-tb', 'http://en.wikipedia.org/w/index.php?title=Wikipedia:Administrators%27_noticeboard/Incidents&action=purge', 'WP:ANI', 'temp-ani', 'WP:ANI');
addLink('p-tb', 'http://en.wikipedia.org/w/index.php?title=Wikipedia:Administrators%27_noticeboard/Edit_warring&action=purge', 'WP:AN3', 'temp-an3', 'WP:AN3');
addLink('p-tb', 'http://en.wikipedia.org/w/index.php?title=Category:Requests_for_unblock&action=purge', 'CAT:RFU', 'temp-rfu', 'CAT:RFU');
addLink('p-tb', 'http://en.wikipedia.org/w/index.php?title=Wikipedia:Administrators%27_noticeboard&action=purge', 'WP:AN', 'temp-an', 'WP:AN');
addLink('p-tb', 'http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=newusers&user=&page=', 'New Users', 'temp-newuser', 'New Users');
addLink('p-tb', 'http://en.wikipedia.org/w/index.php?title=Special:Contributions&limit=30&target=newbies', 'Newbie Contribs', 'temp-newbcont', 'Newbie Contribs');
addLink('p-tb', 'http://en.wikipedia.org/w/index.php?title=Special:Recentchanges&limit=30&hideliu=1', 'IP Contribs', 'temp-ipcont', 'IP Contribs');
addLink('p-tb', 'http://en.wikipedia.org/w/index.php?title=Special:Uncategorizedimages&limit=500&offset=0', 'Uncat Images', 'temp-uncatim', 'Uncat images');
}

$(ReplaceDeletedTemplate_onload);

//importScript('User:Lupin/popups.js');
importScript("User:Lupin/recent2.js");


importScript('User:AzaToth/twinkle.js');

importScript('User:B/rescaledsidebar.js');

importScript('User:B/quickimgdelete.js');