User:Promethean/monobook.js
Appearance
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. |
![]() | The accompanying .css page for this skin is at User:Promethean/monobook.css. |
importScript('User:AzaToth/twinkle.js')
importScript('User:Tra/whatlinksherewatchlist.js'); //[[User:Tra/whatlinksherewatchlist.js]]
importScript('User:Ioeth/friendly.js');
importScript('User:Lupin/recent2.js');
importScript('User:Mr.Z-man/patrollinks.js');
importScript('User:Ais523/votesymbols.js');
importScript('User:Animum/rfavote.js')
importScript('User:Js/ajaxPreview.js')
importScript('User:John254/mass rollback.js')
importScript('User:Animum/easyblock.js')
importScript('User:Ais523/adminrights.js')
function forcePreview() {
if (wgAction == "edit")
{
document.getElementById("wpSave").disabled=true;
document.getElementById("wpSave").value = "Save (preview first)";
document.getElementById("wpSave").style.fontWeight = "normal";
document.getElementById("wpPreview").style.fontWeight = "bold";
}
}
$(forcePreview);
==Edit summary stuff==
<pre><nowiki> */
// Adapted from:
//http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/Scripts/Force_edit_summary
// The original value of the edit summary field is stored here
var editsummOriginalSummary = new String();
// A global ref to the dropdown with canned edit summaries
var editsummDropdown = null;
function editsummInitialize()
{
// Save the original value of the edit summary field
editsummOriginalSummary = document.forms.editform.wpSummary.value;
// For convenience, add a dropdown box with some canned edit
// summaries to the form.
var dropdown = document.createElement("select");
dropdown.onchange = new Function("editsummOnCannedSummarySelected()");
editsummAddOptionToDropdown(dropdown,"");
editsummAddOptionToDropdown(dropdown,"add categories");
editsummAddOptionToDropdown(dropdown,"add category");
editsummAddOptionToDropdown(dropdown,"add citation");
editsummAddOptionToDropdown(dropdown,"add external link");
editsummAddOptionToDropdown(dropdown,"add internal link");
editsummAddOptionToDropdown(dropdown,"add quotation");
editsummAddOptionToDropdown(dropdown,"add ref");
editsummAddOptionToDropdown(dropdown,"add section");
editsummAddOptionToDropdown(dropdown,"create redirect page");
editsummAddOptionToDropdown(dropdown,"create stub article");
editsummAddOptionToDropdown(dropdown,"delete external link");
editsummAddOptionToDropdown(dropdown,"delete internal link");
editsummAddOptionToDropdown(dropdown,"delete section");
editsummAddOptionToDropdown(dropdown,"fix broken link");
editsummAddOptionToDropdown(dropdown,"fix case");
editsummAddOptionToDropdown(dropdown,"fix grammar");
editsummAddOptionToDropdown(dropdown,"fix punctuation");
editsummAddOptionToDropdown(dropdown,"fix quote marks");
editsummAddOptionToDropdown(dropdown,"fix spelling");
editsummAddOptionToDropdown(dropdown,"indent");
editsummAddOptionToDropdown(dropdown,"make existing text into link (wikify)");
editsummAddOptionToDropdown(dropdown,"make link into plain text (dewikify)");
editsummAddOptionToDropdown(dropdown,"move section");
editsummAddOptionToDropdown(dropdown,"move unrefd material to talk page");
editsummAddOptionToDropdown(dropdown,"new article");
editsummAddOptionToDropdown(dropdown,"remove repetition");
editsummAddOptionToDropdown(dropdown,"reorder links");
editsummAddOptionToDropdown(dropdown,"sectioning");
editsummAddOptionToDropdown(dropdown,"start article");
var insertBeforeThis = document.forms.editform.wpSummary.nextSibling;
var theParent = insertBeforeThis.parentNode;
theParent.insertBefore(dropdown,insertBeforeThis);
// Store a global ref to it
editsummDropdown = dropdown;
}
function editsummAddOptionToDropdown(dropdown,optionText)
{
var option = document.createElement("option");
var optionTextNode = document.createTextNode(optionText);
option.appendChild(optionTextNode);
dropdown.appendChild(option);
}
// There's a cross-browser issue when accessing the selected text:
// *In Firefox you can use: selectObj.value
// *In IE, you have to use: selectObj.options[selectObj.selectedIndex].text
// *The latter method also works in Firefox
function editsummOnCannedSummarySelected()
{
var idx = editsummDropdown.selectedIndex;
var canned = editsummDropdown.options[idx].text;
var newSummary = editsummOriginalSummary;
if (newSummary.length!=0) newSummary += " - ";
newSummary += canned;
document.forms.editform.wpSummary.value = newSummary;
}
// Prefix the edit summary with "SW" or "CP"
// depending on whether it's a SourceWatch or Congresspedia page.
// To determine this, look for a link to "Template:Congresspedia"
// on the edit page.
function editsummAddSubProjectPrefix()
{
// Using the document.links array and the href prop seems to give
// the best cross-browser results.
var allAnchors = document.links;
if (allAnchors)
{
var prefix = "SW: ";
for (i = 0; i < allAnchors.length; i++)
{
var anchorHref = allAnchors[i].href;
if (anchorHref)
{
if (anchorHref.indexOf('Template:Congresspedia') != -1)
{
prefix = "CP: ";
}
}
}
document.forms.editform.wpSummary.value =
prefix + document.forms.editform.wpSummary.value;
}
}
/* </nowiki></pre>