User:Riana dzasta/monobook.js

From Wikipedia, the free encyclopedia

Note: After saving, you have to bypass your browser's cache to see the changes. Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.

/* <nowiki> */
// [[User:Lupin/popups.js]]

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


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);
    na.accesskey = key;
    var pref = 'alt-';
    if(((clientPC.indexOf('AppleWebKit')!=-1) && (clientPC.indexOf('spoofer')==-1)) || navigator.userAgent.toLowerCase().indexOf( 'mac' ) != -1 ) pref = 'control-';
    if(clientPC.indexOf('opera')!=-1) pref = 'shift-esc-';
    if(key && title) na.title = title + ' [' + pref + key + ']';
    else if(title) na.title = title;
    else if(key) na.title = '[' + pref + key + ']';
    return li;
}

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

function getPname() {
  z=document.getElementById("content").childNodes;
  for (var n=0;n<z.length;n++) {
    if (z[n].className=="firstHeading") return z[n].textContent;
  };
}

// ========== Quick Wikify ==========
function doQwikify() {
  document.editform.wpTextbox1.value = '{' + '{' + 'Wikify-date|' + '{' + '{' + 'subst:CURRENTMONTHNAME}} ' + '{' + '{' + 'subst:CURRENTYEAR}}}}\n\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = 'Marked for wikification.';
  document.editform.wpMinoredit.checked = true;
  document.editform.submit();
}

function addQwikify() {
  addTab("javascript:doQwikify()", "wikify", "ca-wikify", "Mark for wikification", "");
  akeytt();
}

if (document.title.indexOf("Editing ") == 0) {
  if (window.addEventListener) window.addEventListener("load", addQwikify, false);
  else if (window.attachEvent) window.attachEvent("onload", addQwikify);
}


//<pre><nowiki> Admin-like RC Patrol tools

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

winc('[[User:Voice_of_All/Addtabs/monobook.js]]'); // Helper tools  
winc('[[User:Cactus.man/Scripts/MoreTabs.js]]');         // Additional tabs for user & project pages
winc('[[User:Voice_of_All/Revert/monobook.js]]'); // Diff page links
winc('[[User:Voice_of_All/Deletion/monobook.js]]'); // AfD/PfD/Copyvio and tagging tabs
winc('[[User:VoA/monobook.js]]'); // Admin-like RC Patrol tools

//</nowiki></pre>[[Category:Wikipedians who use RC script ]]
// Script from [[User:MarkS/extraeditbuttons.js]]
function InsertButtonsToToolBar()
{
//Strike-Out Button
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png",
    "speedTip": "Strike",
    "tagOpen": "<s>",
    "tagClose": "</s>",
    "sampleText": "Strike-through text"}
//Left-Text Button
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/e/ea/Button_align_left.png",
    "speedTip": "Left-Align",
    "tagOpen": "<div style='text-align: left; direction: ltr; margin-left: 1em;'>\n",
    "tagClose": "\n</div>",
    "sampleText": "Left-aligned text"}
//Center-Text Button
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/5/5f/Button_center.png",
    "speedTip": "Center",
    "tagOpen": "<div style='text-align: center;'>\n",
    "tagClose": "\n</div>",
    "sampleText": "Centered text"}
//Table button
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png",
    "speedTip": "Table",
    "tagOpen": "\n{| border='1' \n|- \n| 1 || 2\n|- \n| 3 || 4",
    "tagClose": "\n|}\n",
    "sampleText": ""}
//Line break button
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png",
    "speedTip": "Line break",
    "tagOpen": "<br />",
    "tagClose": "",
    "sampleText": ""}
//Superscript
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png",
    "speedTip": "Superscript",
    "tagOpen": "<sup>",
    "tagClose": "</sup>",
    "sampleText": "Superscript text"}
//Subscript
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png",
    "speedTip": "Subscript",
    "tagOpen": "<sub>",
    "tagClose": "</sub>",
    "sampleText": "Subscript text"}
//Small Text
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/5/58/Button_small.png",
    "speedTip": "Small",
    "tagOpen": "<small>",
    "tagClose": "</small>",
    "sampleText": "Small Text"}
//Comment
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png",
    "speedTip": "Insert hidden Comment",
    "tagOpen": "<!-- ",
    "tagClose": " -->",
    "sampleText": "Adding long comment tag to protect [[Special:Shortpages]]. Adding long comment tag to protect [[Special:Shortpages]]. Adding long comment tag to protect [[Special:Shortpages]]. "}
//Gallery
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/1/12/Button_gallery.png",
    "speedTip": "Insert a picture gallery",
    "tagOpen": "\n<gallery>\n",
    "tagClose": "\n</gallery>",
    "sampleText": "Image:FileName.jpg|Caption1\\Image:FileName2.jpg|Caption2"}
//Tabs
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/8/8e/Button_shifting.png",
    "speedTip": "Insert tab(s)",
    "tagOpen": ":",
    "tagClose": "",
    "sampleText": ":"}
//Block Quote
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/f/fd/Button_blockquote.png",
    "speedTip": "Insert block of quoted text",
    "tagOpen": "<blockquote style='border: 1px solid blue; padding: 2em;'>\n",
    "tagClose": "\n</blockquote>",
    "sampleText": "Block quote"}
//Colour
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/1/1e/Button_font_color.png",
    "speedTip": "Insert colored text",
    "tagOpen": "<span style='color: ColorName'>",
    "tagClose": "</span>",
    "sampleText": "Span of text"}
//Code
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/2/23/Button_code.png",
    "speedTip": "Insert code",
    "tagOpen": "<code>",
    "tagClose": "</code>",
    "sampleText": "Code"}
//Sub-Link
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/9/93/Button_sub_link.png",
    "speedTip": "Insert link to sub-page",
    "tagOpen": "[[Page#",
    "tagClose": "]]",
    "sampleText": "Sub_page"}
//Definition List
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/d/d3/Button_definition_list.png",
    "speedTip": "Insert definition list",
    "tagOpen": "\n; ",
    "tagClose": " : ",
    "sampleText": "Insert text"}
//Template button
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/3/3b/Button_template_alt.png",
    "speedTip": "Template",
    "tagOpen": "{{",
    "tagClose": "}}",
    "sampleText": "Template name"}
//Category button
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/5/5a/Button_category_alt.png",
    "speedTip": "Category",
    "tagOpen": "[[Category:",
    "tagClose": "]]",
    "sampleText": "Category title"}
//Reference link button
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png",
    "speedTip": "<ref>",
    "tagOpen": "<ref>",
    "tagClose": "</ref>",
    "sampleText": "Insert reference material"}
//Reference button
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/a/a0/Button_references_alt.png",
    "speedTip": "Reference footer",
    "tagOpen": "<references/>",
    "tagClose": "",
    "sampleText": ""}
//My own...
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/5/5f/Button_center.png",
    "speedTip": "Welcome",
    "tagOpen": "{{subst:",
    "tagClose": "~~",
    "sampleText": "welcome}} ~~"}
//My own 2
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/e/e9/Button_headline2.png",
    "speedTip": "Bold Title",
    "tagOpen": "'''{{sub",
    "tagClose": "'''",
    "sampleText": "st:PAGENAME}}"}
}
addOnloadHook( InsertButtonsToToolBar );