Jump to content

User:Moeron/monobook.js

From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
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.
// <nowiki>
// [[User:Lupin/popups.js]]

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

//Interiot's javascript edit counter
if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) {
  mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js&action=raw&ctype=text/javascript'); }

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

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


// From code by [[User:Raylu|raylu]]
//
//
// This script adds a "CVG Deletion" tab to the top of article pages
// when in edit mode. It is disabled for the User namespace.

function doCvgdeletion() {
  document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + '\n{' + '{' + 'subst' + ':' + 'CVG' + ' ' + 'deletion' + '}' + '}';
  document.editform.wpSummary.value = 'Now a CVG deletion.';
  document.editform.wpMinoredit.checked = true;
  document.editform.submit();
}

function addCvgdeletion() {
  addTab("javascript:doCvgdeletion()", "cvgdeletion", "ca-cvgdeletion", "CVG Deletion", "");
  akeytt();
}

addOnloadHook(function() {
  if (document.title.indexOf("Wikipedia:Articles for deletion/") != -1) {
  addOnloadHook(addCvgdeletion);
  }
});

// Modified code by [[User:Raylu|raylu]]
//
//
// This script adds a "subst:nsd" tab to the top of article pages
// when in edit mode. It is disabled for the User namespace.

function donsd() {
  document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + '\n{' + '{' + 'subst' + ':' + 'nsd' + '}' + '}';
  document.editform.wpSummary.value = 'The source for this image is missing.';
  document.editform.wpMinoredit.checked = true;
  document.editform.submit();
}

function addnsd() {
  addTab("javascript:donsd()", "subst:nsd", "ca-nsd", "subst:nsd", "");
  akeytt();
}

addOnloadHook(function() {
  if (document.title.indexOf("Image:") != -1 || document.title.indexOf("Image talk:") != -1) {
  addOnloadHook(addnsd);
  }
});

// Modified code by [[User:Raylu|raylu]]
//
//
// This script adds a "subst:nrd" tab to the top of article pages
// when in edit mode. It is disabled for the User namespace.

function donrd() {
  document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + '\n{' + '{' + 'subst' + ':' + 'nrd' + '}' + '}';
  document.editform.wpSummary.value = 'Though this page includes a [[WP:FU|fair use]] tag, it is missing a [[Wikipedia:Image description page#Fair use rationale|fair use rationale]] in order to be used.';
  document.editform.wpMinoredit.checked = false;
  document.editform.submit();
}

function addnrd() {
  addTab("javascript:donrd()", "subst:nrd", "ca-nrd", "subst:nrd", "");
  akeytt();
}

addOnloadHook(function() {
  if (document.title.indexOf("Image:") != -1 || document.title.indexOf("Image talk:") != -1) {
  addOnloadHook(addnrd);
  }
});

// Code originally by [[User:Raylu|raylu]]
// Modified by [[User:Moeron]]
//
//
// This script adds a "subst:welcome2" tab to the top of User pages
// when in edit mode.

function dowelcome() {
  document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + '\n{' + '{' + 'subst' + ':' + 'welcome2' + '}' + '}' + ' ' + '~' + '~' + '~' + '~';
  document.editform.wpSummary.value = 'Welcome to Wikipedia!';
  document.editform.wpMinoredit.checked = false;
  document.editform.submit();
}

function addwelcome() {
  addTab("javascript:dowelcome()", "Welcome!", "ca-welcome", "Welcome!", "");
  akeytt();
}

addOnloadHook(function() {
  if (document.title.indexOf("User:") != -1 || document.title.indexOf("User talk:") != -1) {
  addOnloadHook(addwelcome);
  }
});

// Code originally by [[User:Raylu|raylu]]
// Modified by [[User:Moeron]]
//
//
// This script adds a "stub,low" tab to the top of Article pages
// when in edit mode.

function docvg() {
document.editform.wpTextbox1.value = '{{' + 'cvgproj' + '|' + 'class=stub' + '|' + 'importance=low' + '}' + '}';
  document.editform.wpSummary.value = 'Assessed as stub, low importance -- [[:Category:Unassessed computer and video game articles|You can help!]]';
  document.editform.wpMinoredit.checked = false;
  document.editform.submit();
}

function addcvg() {
  addTab("javascript:docvg()", "cvg", "ca-cvg", "cvg", "");
  akeytt();
}

addOnloadHook(function() {
  if (document.title.indexOf("Talk:") != -1) {
  addOnloadHook(addcvg);
  }
});

function docvg2() {
  document.editform.wpTextbox1.value = '{{' + 'cvgproj' + '|' + 'class=start' + '|' + 'importance=low' + '}' + '}';
  document.editform.wpSummary.value = 'Assessed as start, low importance -- [[:Category:Unassessed computer and video game articles|You can help!]]';
  document.editform.wpMinoredit.checked = false;
  document.editform.submit();
}

function addcvg2() {
  addTab("javascript:docvg2()", "cvg-start", "ca-cvg2", "cvg-start", "");
  akeytt();
}

addOnloadHook(function() {
  if (document.title.indexOf("Talk:") != -1) {
  addOnloadHook(addcvg2);
  }
});

function donovel1() {
  document.editform.wpTextbox1.value = '{{' + 'NovelsWikiProject' + '|' + 'class=stub' + '|' + 'importance=low' + '}' + '}';
  document.editform.wpSummary.value = 'Assessed as stub, low importance -- [[:Category:Unassessed novel articles|You can help!]]';
  document.editform.wpMinoredit.checked = false;
  document.editform.submit();
}

function addnovel1() {
  addTab("javascript:donovel1()", "novel1-stub", "ca-novel1", "cvg-novel1", "");
  akeytt();
}

addOnloadHook(function() {
  if (document.title.indexOf("Talk:") != -1) {
  addOnloadHook(addnovel1);
  }
});

function donovel2() {
  document.editform.wpTextbox1.value = '{{' + 'NovelsWikiProject' + '|' + 'class=start' + '|' + 'importance=low' + '}' + '}';
  document.editform.wpSummary.value = 'Assessed as start, low importance -- [[:Category:Unassessed novel articles|You can help!]]';
  document.editform.wpMinoredit.checked = false;
  document.editform.submit();
}

function addnovel2() {
  addTab("javascript:donovel2()", "novel2-start", "ca-novel2", "cvg-novel2", "");
  akeytt();
}

addOnloadHook(function() {
  if (document.title.indexOf("Talk:") != -1) {
  addOnloadHook(addnovel2);
  }
});

// [[User:Invitatious/unsigned2.js]] - unsigned comments script (enwiki)
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Invitatious/unsigned2.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

// This script adds a CSD button
// it depends on [[User:Lupin/popups.js]]
// and the Add Tab function, see [[WP:US]]

function csd(){
    var x=csdUrl(); 
    x && (document.location=x);
}
function csdUrl(){
    var summary='CSD';
    var reason=getCsdReason();
    if (reason===null) { return; }
    if (reason!=='') {
	summary = summary + ' - ' + encodeURI(reason);
	reason = '|' + encodeURI(reason.split('/').join('\\/'));
    }
    var template = '{{db' + reason + '}}';
    var article=Title.fromURL(document.location.href);
    return pg.wiki.titlebase + article.urlString() +
	'&action=edit&autoedit=s/^/' + template + '\\n\\n/' +
	'&autoclick=wpPreview&autosummary=' + summary;
}
function getCsdReason() {
    var presets={
	// you can change this
	'v': 'Vandalism',
	'u': 'User request',
	'n': 'nonsense',
	'b': 'blank page'
    }
    var msg='CSD template tool\n\nSelect an abbreviation, or type a reason for deletion\n\n';
    for (var p in presets) { msg += p + ': ' + presets[p] + '\n'; }
    var ans=prompt(msg);
    if (ans===null) { return null; }
    return presets[ans] || ans;
}
addOnloadHook(function(){addTab('javascript:csd()', 'csd');});

// Modified code by [[User:Raylu|raylu]]
//
//
// This script adds a "album" tab to the top of article pages
// when in edit mode. It is disabled for the User namespace.

function doalbum() {
  document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + '{' + '{album}' + '}';
  document.editform.wpSummary.value = 'Tagged for [[Wikipedia:WikiProject Albums|WikiProject Albums]].';
  document.editform.wpMinoredit.checked = false;
  document.editform.submit();
}

function addalbum() {
  addTab("javascript:doalbum()", "album", "ca-album", "album", "");
  akeytt();
}
addOnloadHook(function() {
  if (document.title.indexOf("Talk:") != -1) {
  addOnloadHook(addalbum);
  }
});

importScript('User:AzaToth/morebits.js');
importScript('User:AzaToth/twinklefluff.js');
importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');
importScript('User:AzaToth/twinklewarn.js');
importScript('User:AzaToth/twinklearv.js');
importScript('User:AzaToth/twinklespeedy.js');
importScript('User:AzaToth/twinklediff.js');

TwinkleConfig = {
        userTalkPageMode                :       [ 'tab' ],
        watchRevertedPages              :       [ 'torev' ],
        markWarningsAsMinor             :       true,
        markAIVReportAsMinor            :       true,
        summaryAd                       :       " Using [[WP:TWINKLE|Twinkle]]",
        deletionSummaryAd               :       " Using [[WP:TWINKLE|Twinkle]]",
};
// </nowiki>