User:ErrantX/defaultsummaries.js: Difference between revisions

Content deleted Content added
hate js :(
rm some code, adding cats
Line 21:
dropdown.onchange = new Function("editsummOnCannedSummarySelected()");
 
editsummAddOptionToDropdowneditsummAddCatToDropdown(dropdown,"Choose a Default Edit Summary");
editsummAddCatToDropdown(dropdown,"Article");
editsummAddOptionToDropdown(dropdown,"add categories");
editsummAddOptionToDropdown(dropdown,"add category");
Line 64 ⟶ 65:
{
var option = document.createElement("option");
var optionTextNode = document.createTextNode(optionText);
option.appendChild(optionTextNode);
dropdown.appendChild(option);
 
function editsummAddCatToDropdown(dropdown,catText)
var option = document.createElement("option");
option.disabled = "disabled"
var optionTextNode = document.createTextNode(optionText);
option.appendChild(optionTextNode);
Line 84 ⟶ 94:
}
 
// 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;
}
// Hide refs
addOnloadHook(function (){
editsummInitialize ();