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.

// <nowiki>

var linkColor = "#002BB8";

var linkLead = '<a style="color:' + linkColor + ';" href="/wiki/Wikipedia:Version_1.0_Editorial_Team/Assessment">';

 

var asTalkPage; //"as" to reduce name conflict - wikicode of talkpage

var addingNewTemplate = true; 

var parametersChanged = 0;

var talkpagehtml; //html of talkpage

var categoryText = null; //result of query.php request

var existingTemplateCodeArray; //those on the talk page

var TemplateArray = new Array();

var templateSelect;

var prioritySelect;

var bioWorkGroupSelect;

var livingSelect;

var milHistTaskForceSelect;

var livingArray = "", "yes", "no"];

var priorityArray = "", "Low", "Mid", "High", "Top"];

var bioWorkGroupArray = "", "a&e-work-group", "baronets-work-group", "british-royalty", "filmbio-work-group", "military-work-group", "musician-work-group", "peerage-work-group", "politician-work-group", "royalty-work-group", "s&a-work-group", "sports-work-group"];

 

var templateCodeArray = "{{WPBiography\n|small = \n|living = \n|class = \n|priority = \n|needs-infobox = \n|listas = \n|needs-photo = \n}}",

"{{Album\n|class=\n|importance=\n|attention=\n|needs-infobox=\n}}",

"{{Cvgproj|class=|importance=}}",

"{{Physics|class=|importance=}}",

"{{WikiProject China\n|class=\n|importance=}}",

"{{WikiProject Finland|class=|importance=}}",

"{{WPMILHIST\n|small=\n|nested=\n|class=\n|attention=\n|needs-infobox=\n|B-Class-1=\n|B-Class-2=\n|B-Class-3=\n|B-Class-4=\n|B-Class-5=\n}}",

"{{WikiProject College football|class=|importance=}}",

"{{Visual arts\n|cat =\n|class =\n}}",

"{{Film|class=|importance=}}",

"{{AfricaProject\n|class=\n|importance=\n|Liberia=\n|Liberia-importance=\n}}",

"{{WikiProject Germany|class=|importance=}}",

"{{WPSchools|class=|importance=}}",

"{{WikiProject Oklahoma|class=|importance=}}",

"{{OlympicsWikiProject|class=}}",

"{{WikiProject Radio|class=|importance=}}",

"{{WP-Tennis|class=|importance=}}",

"{{WikiProject Serbia|class=|importance=}}",

"{{WP Australia|class=|importance=}}",

"{{WP Indonesia\n|importance=\n|class=\n|attention=\n|collaboration-candidate=\n|past-collaboration=\n|peer-review=\n}}",

"{{WPFC\n|class=\n|HRE-taskforce=\n|GOV-taskforce=\n|flagneeded=\n|coatneeded=\n|mapneeded=\n|infoboxneeded=\n|structureneeded=\n}}",

"{{WikiProject Filmmaking|class=}}",

"{{WikiProject Palestine|class=|importance=}}",

"{{WikiProject Israel|class=|importance=}}",

"{{LabourProject|class=|importance=}}",

"{{WikiProject Oregon|class=|importance=}}",

"{{Cooperatives|class=|importance=}}",

"{{WikiProject Malta|class=|importance=}}",

"{{WikiProject Law|class=|importance=}}",

"{{WP_SCOTUS|class=|importance=|needs-infobox=|flag=}}",

"{{WikiProject Database|class=|importance=}}",

"{{Cycling project|class=}}",

"{{WP:FISHING\n|class=\n|importance=\n}}",

"{{Chemistry|class=|importance=}}",

"{{Chemicals|class=|importance=}}",

"{{WP1.0\n| class = \n| importance = \n| orphan = \n| VA = \n| core = \n| coresup = \n| category = \n| v0.7 = \n| WPCD = \n}}",

"{{Numismaticnotice|class=|importance=}}",

"{{Ice hockey|class=}}",

"{{BCproject|class=|importance=}}"];

 

function aTemplate() {

this.name = "";

this.code = "";

this.existsGrade = "";

this.existsPriority = "";

this.isUsers = "";

}



function TemplateSort(a,b) {

  if ( a.name > b.name ) return 1

  else if ( a.name < b.name ) return -1

  else return 0;

}



$(begin);



function begin() {

  if ( wgNamespaceNumber==0 && !location.pathname.match('/') && !document.body.innerHTML.match('id="disambig"') ) {

    if ( Cookie.read("wpasStatus") >= "1" || Cookie.read("wpasStatus") === null ) {

      if ( document.getElementById("ca-talk").className == "new" ) {

        asTalkPage = "";

        update("#000000", "An " + linkLead + "unassessed</a> article", "");

      }

      else {

        var url = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + "/index.php?title=Talk:" + encodeURIComponent(wgTitle) + "&action=raw";

        loadTalkPageRaw(url);

      }

    }

    else if (Cookie.read("wpasStatus") == "0" && !document.getElementById("siteSub").innerHTML.match(writeActivations()) ) {

      document.getElementById("siteSub").innerHTML += writeActivations(); 

    }

  }

}



function loadTalkPageRaw(url) { 

    if (window.XMLHttpRequest) { // branch for native XMLHttpRequest object

        var tpreq = new XMLHttpRequest();

    }

    else if (window.ActiveXObject) { // branch for IE/Windows ActiveX version

        var tpreq = new ActiveXObject("Microsoft.XMLHTTP");

    }

    if (tpreq) {

     tpreq.onreadystatechange = function () { 

       if (tpreq.readyState==4) {

         // if "OK"

         if (tpreq.status==200) {

           getAssessment(tpreq);

         }

       }

     };

     tpreq.open("GET", url, true);

     tpreq.send("");  

    }

}





function getAssessment(myreq)

{

  asTalkPage = myreq.responseText;

  var otherInfo = "";

  if ( asTalkPage.match( /\{\{ganominee/i ) ) {

    otherInfo='. <i>Currently a <a href="' + wgServer + '/?title=Wikipedia:Good_article_candidates" style="color:' + linkColor + ';">Good Article candidate</a></i>.';

  }

  else if ( asTalkPage.match(/\{\{fac[\|}]/i ) ) { 

    otherInfo='. <i>Currently a <a href="' + wgServer + '/?title=Wikipedia:Featured_article_candidates/' + encodeURIComponent(mw.config.get('wgPageName')) + '&redirect=no" style="color:' + linkColor + ';">Featured Article candidate</a></i>.';

  }

  else if (asTalkPage.match(/\{\{peerreview}/i ) ) {

    otherInfo='. <i>Currently in <a href="' + wgServer + '/?title=Wikipedia:Peer review/' + encodeURIComponent(mw.config.get('wgPageName')) + '" style="color:' + linkColor + ';">peer review</a></i>.';

  }



  if ( document.getElementById("featured-star") ) {

    if (document.body.innerHTML.match('<area href="/wiki/Wikipedia:Featured_lists"') ) {         

      update("#0066CC", 'A <a style="color:' + linkColor + ';" href="/wiki/Wikipedia:Featured_lists">Featured List</a>', ""); 

    }

    else {      

      update("#0066CC", 'A <a style="color:' + linkColor + ';" href="/wiki/Wikipedia:Featured Articles">Featured Article</a>', "");

    }

   

  }

  // should get the match once instead of checking repeatedly:

  else if ( asTalkPage.match(/class *= *a[ \|\n}]/i) ) { update("#007BFF", "An " + linkLead + "A-class</a> article", otherInfo);}

  else if ( asTalkPage.match(/\{\{ga[|}]/i ) || asTalkPage.match(/currentstatus *= *(ffa\/)?ga/i) ) { update("#007700", 'A <a style="color:' + linkColor + ';" href="/wiki/Wikipedia:Good Articles">Good Article</a>', otherInfo);}

  else if ( asTalkPage.match(/class *= *c[ \|\n}]/i) ) { update("#999933", "A " + linkLead + "C-class</a> article", otherInfo);}

  else if ( asTalkPage.match(/class *= *b[ \|\n}]/i) ) { update("#999933", "A " + linkLead + "B-class</a> article", otherInfo);}

  else if ( asTalkPage.match(/class *= *start[ \|\n}]/i) ) { update("#BB6600", "A " + linkLead + "Start-class</a> article", otherInfo);}

  else if ( asTalkPage.match(/class *= *stub[ \|\n}]/i) ) { update("#990011", "A " + linkLead + "Stub-class</a> article", otherInfo);}

  else { update("#000000", "An " + linkLead + "unassessed</a> article", otherInfo);}

}



function update(color, slogan, info) {

  if ( typeof document.getElementsByTagName("h1")[0 != "undefined" ) { // see WPdiff:114016002

    document.getElementsByTagName("h1")[0].style.cssText = "color: " + color + ";";

  }

  t = document.getElementById("siteSub").innerHTML;

  document.getElementById("siteSub").innerHTML = slogan + " " + t.charAt(0).toLowerCase() + t.substring(1) + info + writeActivations();

  

  if ( Cookie.read("wpasStatus") == "2" || Cookie.read("wpasStatus") === null) {

    if ( typeof assessmentMyTemplateCode != "undefined" ) {

      existingTemplateCodeArray = getTemplatesInString(assessmentMyTemplateCode.join('\n'), true);

    }

    existingTemplateCodeArray = existingTemplateCodeArray.concat( getTemplatesInString(asTalkPage, false) );

    for (y = 0; y < existingTemplateCodeArray.length ; y++) {

      z = 0;

      notFound = true;

      while (z < TemplateArray.length && notFound ) {

        if ( existingTemplateCodeArrayy].name == TemplateArrayz].name ) {

          TemplateArrayz = existingTemplateCodeArrayy];

          notFound = false;

        }

        z++;

      }

      if ( notFound ) { 

        TemplateArray.push(existingTemplateCodeArrayy]);

      }

    }

    

    TemplateArray.sort(TemplateSort);

    templateSelect = document.createElement("select");

    for (x = 0; x < TemplateArray.length ; x++) {

      templateSelect.optionsx = new Option(TemplateArrayx].name, TemplateArrayx].name);

      if ( TemplateArrayx].existsGrade != "" && !TemplateArrayx].isUsers ) { 

        existingGrade = TemplateArrayx].existsGrade;

        templateSelect.optionsx].style.backgroundColor =  getAssessmentBackgroundColor(existingGrade);

        templateSelect.optionsx].text += " → " + existingGrade;

      }

      if (TemplateArrayx].existsPriority != "" && !TemplateArrayx].isUsers ) {

        templateSelect.optionsx].text += "/" + TemplateArrayx].existsPriority;

      }

      if ( typeof assessmentDefaultProject != "undefined" && TemplateArrayx].name.toLowerCase() == assessmentDefaultProject.toLowerCase() ) {

        templateSelect.selectedIndex = x;

      }

    }

    templateSelect.onchange = projectChange;

    projectChange();

  }

  //more kludge; repaint for imgs

  document.getElementById('content').style.zIndex = '3';

  window.setTimeout("document.getElementById('content').style.zIndex = '2'",1);



}



function projectChange() {

  var index = templateSelect.selectedIndex;

  var templateChoice = templateSelect.optionsindex].value;

  myDiv = document.createElement("div");

  myDiv.appendChild(templateSelect);

  if ( TemplateArrayindex].code.match(/(priority|importance) *=/) ) {

    prioritySelect = document.createElement("select");

    for (x = 0; x < priorityArray.length ; x++) {

      prioritySelect.optionsx = new Option(priorityArrayx], priorityArrayx]);

          if (TemplateArrayindex].existsPriority.toLowerCase() == priorityArrayx].toLowerCase() )

          { prioritySelect.selectedIndex = x; }

	  else if (typeof assessmentDefaultPriority != "undefined" && priorityArrayx == assessmentDefaultPriority && prioritySelect.selectedIndex < 1) {

	    prioritySelect.selectedIndex = x;

	  }	

    }

    myDiv.appendChild(prioritySelect); 	

  }	

  if ( "WPBiography" == templateChoice ) { 

    bioWorkGroupSelect = document.createElement("select");

	for (x = 0; x < bioWorkGroupArray.length ; x++) {

      bioWorkGroupSelect.optionsx = new Option(bioWorkGroupArrayx], bioWorkGroupArrayx]);

	  if (typeof assessmentDefaultWorkGroup != "undefined" && bioWorkGroupArrayx == assessmentDefaultWorkGroup ) {

	    bioWorkGroupSelect.selectedIndex = x;

	  }

	}

	myDiv.appendChild(bioWorkGroupSelect);

	

	livingSelect = document.createElement("select");

	var livingFlag = "";	

	if ( document.body.innerHTML.match("Category:Living_people") ) {

	  livingFlag = "yes"; }

	else if ( document.body.innerHTML.match(/Category:\d+ (BC )?deaths/i) ) {

	  livingFlag = "no"; }

	else if ( typeof assessmentDefaultLiving != "undefined" ) {

 	  livingFlag = assessmentDefaultLiving;

	} 

	    

	for (x = 0; x < livingArray.length ; x++) {

      livingSelect.optionsx = new Option(livingArrayx], livingArrayx]);

      if ( livingArrayx == livingFlag) { livingSelect.selectedIndex = x; }

	}

	

	myDiv.appendChild(livingSelect);

  }

  else if ( "WPMILHIST" == templateChoice ) {

    milHistTaskForceSelect = document.createElement("select");

    for (x = 0; x < milHistTaskForceArray.length ; x++) {

      milHistTaskForceSelect.optionsx = new Option(milHistTaskForceArrayx], milHistTaskForceArrayx]);

	  if (typeof assessmentDefaultMilHistTaskForce != "undefined" && milHistTaskForceArrayx == assessmentDefaultMilHistTaskForce ) {

	    milHistTaskForceSelect.selectedIndex = x;

	  }

     }

    myDiv.appendChild(milHistTaskForceSelect);

  }

  writeGradeLinks(templateChoice, myDiv);

  if ( document.getElementById("selectionDiv") === null ) { //order of ops is important for IE

    document.getElementById("contentSub").appendChild(myDiv) 

  }

  else {

    document.getElementById("contentSub").replaceChild(myDiv, document.getElementById("selectionDiv")); 

  }

  myDiv.id = "selectionDiv";

}



function writeGradeLinks(template, theDiv) {

  var grades = document.createElement("div");

  var count = ( Cookie.read("wpasCount") === null ) ? "0" : Cookie.read("wpasCount") ;

  filmGrades = (template=="Film") ? ' • <a href="javascript:addAssessment(\'Future\')">Future</a>' : "" ;

  grades.innerHTML = '(<a href="javascript:Cookie.create(\'wpasCount\',0,180);projectChange();" title="Click to reset">' + count + '</a> assessed) <a href="javascript:addAssessment(\'Stub\')" title="Assess as Stub using above template [1]" accesskey="1">Stub</a> • <a href="javascript:addAssessment(\'Start\')" title="Assess as Start using above template [2]" accesskey="2">Start</a> • <a href="javascript:addAssessment(\'C\')" title="Assess as C using above template [3]" accesskey="3">C</a> • <a href="javascript:addAssessment(\'B\')" title="Assess as B using above template [3]" accesskey="4">B</a> • <a href="javascript:addAssessment(\'GA\')">GA</a> • <a href="javascript:addAssessment(\'A\')">A</a> • <a href="javascript:addAssessment(\'List\')" title="Not applicable to all projects">List</a>' + filmGrades;

  theDiv.appendChild(grades);

}



function addAssessment(grade) {

  var thisTemplateMatch, newLines, textToReplace, template, ti;

  var priority = null;

  template = templateSelect.value;

  ti = templateSelect.selectedIndex;

  if (asTalkPage == null) { asTalkPage = "";}

  else if ( asTalkPage.match(new RegExp("\{\{" + template + "[ \n]*[\|}]", "i") ) ) { 

    addingNewTemplate = false;

  }

  else if ( asTalkPage.match(/((^[ \r\n]*\{\{[^\{}]*}}[ \n]*){1,3})/mi ) ) { // there are templates, but not mine

    replaced = RegExp.$1;

    replacement = RegExp.$1;

    if (replaced.match(/(\n{2,}$)/)) { replaced = replaced.replace(RegExp.$1, "\n"); }

    else { replaced += "\n"; }

    asTalkPage = asTalkPage.replace(replacement, replaced + TemplateArrayti].code ); 

  }

  else { asTalkPage = TemplateArrayti].code + "\n" + asTalkPage; } // no templates, so add before rest of talk page

  asTalkPage.match(new RegExp("(\{\{"+template+"[ \n]*[\|}][^}]*}}?)([ \n]?)", "i" ) );

  thisTemplateMatch = RegExp.$1;

  newLines = RegExp.$2;

  textToReplace = thisTemplateMatch; 

  thisTemplateMatch = updateTemplate(thisTemplateMatch, "class", grade);

  if (TemplateArrayti].code.match(/((priority|importance)) *=/) && prioritySelect.optionsprioritySelect.selectedIndex].value != "" ) { 

    priority = prioritySelect.optionsprioritySelect.selectedIndex].value

    thisTemplateMatch = updateTemplate(thisTemplateMatch, RegExp.$1, priority );

  }

  thisTemplateMatch = thisTemplateMatch.replace(/\| *auto *= *yes(\n)?/i, ""); //wpdiff 122608658

  if (template=="WPBiography") {

        thisTemplateMatch = thisTemplateMatch.replace("importance", "priority");

  	if ( bioWorkGroupSelect.optionsbioWorkGroupSelect.selectedIndex].value != "" ) {

		thisTemplateMatch = updateTemplate(thisTemplateMatch, bioWorkGroupSelect.optionsbioWorkGroupSelect.selectedIndex].value, "yes" );

	}

	if ( livingSelect.optionslivingSelect.selectedIndex].value != "" ) {

		thisTemplateMatch = updateTemplate(thisTemplateMatch, "living", livingSelect.optionslivingSelect.selectedIndex].value );

        }

        if ( !thisTemplateMatch.match(/listas *= *\w+/i) ) {

            var sortKey = getSortKey();

            if ( sortKey != null ) { 

              thisTemplateMatch = updateTemplate(thisTemplateMatch, "listas", sortKey); 

            }

        }

  }	

  else if ( template=="WPMILHIST" ) {

    thisTemplateMatch = updateTemplate(thisTemplateMatch, milHistTaskForceSelect.optionsmilHistTaskForceSelect.selectedIndex].value, "yes" );

  }

  asTalkPage = asTalkPage.replace(textToReplace, thisTemplateMatch + ((newLines == "") ? "\n" : newLines) );

  asTalkPage = asTalkPage.replace( /\{\{stubclass[^}]}}/i , "" ); // wpdiff 122730502

  loadTalkPageHTML(grade, priority, mw.config.get('wgServer') + mw.config.get('wgScriptPath') + "/index.php?title=Talk:" + encodeURIComponent(wgTitle) + "&action=edit", template);

}



	function updateTemplate(templateCode, parameter, val) {

	  var s = templateCode;

	  if ( s.match(/\n/) ) { addCr ="\n"; } else {addCr = ""};

	  if ( s.match(" =")  ) { addSp =" = "; } else {addSp = "="};  

	  if ( s.match(new RegExp('(' + parameter + ' *= *([^|}\n]*))'))) {

	    if (RegExp.$2 != val) {  

              s = s.replace(RegExp.$1, parameter + addSp + val );

              parametersChanged++;

            }

	  }

	  else { 

	    s = s.replace(/}}/, '|' + parameter + addSp + val + addCr + "}}");

            parametersChanged++; 

	  }

	  return s;

	}



	function getSortKey() {

	  loadCategories(mw.config.get('wgServer') + mw.config.get('wgScriptPath') + "/query.php?what=categories&titles=" + encodeURIComponent(wgTitle) +    	"&clextended&format=yaml");

	  if ( categoryText != null && categoryText.match(/sortkey: (.+)[\n]/) ) {return RegExp.$1;   }

	  else { return null; }  

	}



function loadCategories(url) {

    if (window.XMLHttpRequest) {

        var catReq = new XMLHttpRequest();

    }

    else if (window.ActiveXObject) {

        var catReq = new ActiveXObject("Microsoft.XMLHTTP");

    }

   if (catReq) {

     catReq.onreadystatechange = function () { 

       if (catReq.readyState==4) {

         if (catReq.status==200) {

           categoryText = catReq.responseText;

         }

       }

     };

     catReq.open("GET", url, false);

     catReq.send("");  

   }

}



function loadTalkPageHTML(grade, priority, url, template) {

    if (window.XMLHttpRequest) {

        var tphreq = new XMLHttpRequest();

    }

    else if (window.ActiveXObject) {

        var tphreq = new ActiveXObject("Microsoft.XMLHTTP");

    }

   if (tphreq) {

     tphreq.onreadystatechange = function () { 

       if (tphreq.readyState==4) {

         if (tphreq.status==200) {

           postAssessment(grade, priority, tphreq, template);

         }

       }

     };

     tphreq.open("GET", url, true);

     tphreq.send("");  

   }

}



function postAssessment(grade, priority, myreq, template) {

  var count;

  var watchPageHTML;

  var minorEditHTML = '<input name="wpMinoredit" value="1" id="wpMinoredit" />';

  talkpagehtml = myreq.responseText;

  if ( Cookie.read("wpasCount") === null ) { count = 0; } 

  else { count = parseInt(Cookie.read("wpasCount")); }

  Cookie.create("wpasCount", String(count + 1), 180);

  if (typeof assessmentMarkAsMinor != "undefined" && !assessmentMarkAsMinor) {

      minorEditHTML = ""; 

  }

  if ( talkpagehtml.match(/<input type=.hidden. value="([\w\d]+)." name="wpEditToken"/i) ) {

    var editToken = RegExp.$1;

  }

  if ( talkpagehtml.match(/<input name=.wpAutoSummary. type="hidden" value="([\w\d]+)"/i) ) {

    var autoSummary = RegExp.$1;

  }

  if ( talkpagehtml.match(/<input type=.hidden. value="([\d]+)" name="wpStarttime"/i) ) {

    var startTime = RegExp.$1;

  }

  if ( talkpagehtml.match(/<input type=.hidden. value="([\d]+)" name="wpEdittime"/i) ) {

    var editTime = RegExp.$1;

  }

  if ( document.body.innerHTML.match('id="ca-unwatch"') ) {

    watchPageHTML = '<input name="wpWatchthis" value="1" id="wpWatchthis" />';

  }

  else if ( talkpagehtml.match(/<input name=.wpWatchthis. type="checkbox" value="1" checked="checked"/i) ) {

    if ( ( typeof assessmentOverrideWatchPref == "undefined" ) || ( typeof assessmentOverrideWatchPref != "undefined" && !assessmentOverrideWatchPref ) ) {  

    watchPageHTML = '<input name="wpWatchthis" value="1" id="wpWatchthis" />';

    }

  }

  mydiv = document.createElement("div");

  mydiv.innerHTML = '<form style="visibility: hidden;" id="editform" name="editform" method="post" action="/?title=Talk:' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=edit" enctype="multipart/form-data"><textarea name="wpTextbox1" id="wpTextbox1"></textarea><input  type="text" name="wpSummary" id="wpSummary"/>' + minorEditHTML + '<input id="wpPreview" name="wpPreview" type="submit"/><input value="' + startTime + '" name="wpStarttime" /><input value="' + editTime + '" name="wpEdittime" /><input value="'+ editToken + '\" name="wpEditToken" /><input name="wpAutoSummary"  value="' + autoSummary + '" />' + watchPageHTML + '</form>';

  document.body.appendChild(mydiv);

  document.editform.wpTextbox1.value = asTalkPage;

  priorityText = ( priority != null ) ? "/"+priority : "";

  document.editform.wpSummary.value = ((addingNewTemplate) ? 'add ' : 'update ') + 'WikiProject [[Template:' + template + '|' + template + ']] (' + grade + priorityText + ')';

  document.editform.submit();

}



function getAssessmentBackgroundColor(grade) {

  var s = grade.toLowerCase();

  switch (s) {

    case "none":

      return "#DDD"

      break

    case "stub":

      return "#FCC"

      break

    case "start":

      return "#FC9"

      break

    case "b":

      return "#FF9"

      break

    case "ga":

      return "#9C9"

      break

    case "a":

      return "#CFF"

      break

    case "fa":

      return "#9BE"

      break

    default:

      return ""

  }

}



function getTemplatesInString(s, isUsers) {

  var a = new Array();  

  while (s.match(/(\{\{ *([\w\d\.\- ]+)[^\{}]*[^\-]class *= *(\w+)?[^}]*}})/mi) ) {

    code = RegExp.$1;

    name = RegExp.$2.charAt(0).toUpperCase() + RegExp.$2.substring(1);

    grade = ( RegExp.$3.length == 1 ? RegExp.$3.toUpperCase() : RegExp.$3 );

    t = new aTemplate();

    t.name = name.replace(/ +$/, "");

    t.code = code;

    t.existsGrade = ((grade == "") ? "none" : grade);

    if ( code.match(/(priority|importance) *= *(\w+)/i) ) {

      t.existsPriority = RegExp.$2;

    }

    t.isUsers = ( isUsers ) ? true : false;

    a.push(t);

    s = s.replace(code, "");

  }

  return a;

}



function writeActivations() {

  return '&nbsp;&nbsp;&nbsp;<small>[<a href="javascript:switchActivation(\'2\')">On</a>] • [<a   href="javascript:switchActivation(\'1\')">Hide</a>] • [<a href="javascript:switchActivation(\'0\')">Off</a>]</small>';

}



function switchActivation(level) {

  Cookie.create("wpasStatus", level,180);

  if (level == "2" && document.getElementById("selectionDiv") === null) {

    begin();

    document.getElementById("selectionDiv").style.display = "block" ; 

  }

  else if ( document.getElementById("selectionDiv") != null && (level == "1" || level == "0" ) ) {

    document.getElementById("selectionDiv").style.display = "none";

  }

}



var Cookie= { // from http://www.quirksmode.org/js/cookies.html

	create: function(name,value,days)

	{

		var expires;

		if (days)

		{

			var date = new Date();

			date.setTime(date.getTime()+(days*24*60*60*1000));

			expires = "; expires="+date.toGMTString();

		}

		else { expires = ""; }

		document.cookie = name+"="+value+expires+"; path=/";

	},



	read: function(name)

	{

		var nameEQ = name + "=";

		var ca = document.cookie.split(';');

		for(var i=0;i < ca.length;i++)

		{

			var c = cai];

			while (c.charAt(0)==' ') { c = c.substring(1,c.length); }

			if (c.indexOf(nameEQ) === 0) { return c.substring(nameEQ.length,c.length); }

		}

		return null;

	},



	erase: function(name)

	{

		Cookie.create(name,"",-1);

	}

};



// </nowiki>
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.

// <nowiki>

var linkColor = "#002BB8";

var linkLead = '<a style="color:' + linkColor + ';" href="/wiki/Wikipedia:Version_1.0_Editorial_Team/Assessment">';

 

var asTalkPage; //"as" to reduce name conflict - wikicode of talkpage

var addingNewTemplate = true; 

var parametersChanged = 0;

var talkpagehtml; //html of talkpage

var categoryText = null; //result of query.php request

var existingTemplateCodeArray; //those on the talk page

var TemplateArray = new Array();

var templateSelect;

var prioritySelect;

var bioWorkGroupSelect;

var livingSelect;

var milHistTaskForceSelect;

var livingArray = "", "yes", "no"];

var priorityArray = "", "Low", "Mid", "High", "Top"];

var bioWorkGroupArray = "", "a&e-work-group", "baronets-work-group", "british-royalty", "filmbio-work-group", "military-work-group", "musician-work-group", "peerage-work-group", "politician-work-group", "royalty-work-group", "s&a-work-group", "sports-work-group"];

 

var templateCodeArray = "{{WPBiography\n|small = \n|living = \n|class = \n|priority = \n|needs-infobox = \n|listas = \n|needs-photo = \n}}",

"{{Album\n|class=\n|importance=\n|attention=\n|needs-infobox=\n}}",

"{{Cvgproj|class=|importance=}}",

"{{Physics|class=|importance=}}",

"{{WikiProject China\n|class=\n|importance=}}",

"{{WikiProject Finland|class=|importance=}}",

"{{WPMILHIST\n|small=\n|nested=\n|class=\n|attention=\n|needs-infobox=\n|B-Class-1=\n|B-Class-2=\n|B-Class-3=\n|B-Class-4=\n|B-Class-5=\n}}",

"{{WikiProject College football|class=|importance=}}",

"{{Visual arts\n|cat =\n|class =\n}}",

"{{Film|class=|importance=}}",

"{{AfricaProject\n|class=\n|importance=\n|Liberia=\n|Liberia-importance=\n}}",

"{{WikiProject Germany|class=|importance=}}",

"{{WPSchools|class=|importance=}}",

"{{WikiProject Oklahoma|class=|importance=}}",

"{{OlympicsWikiProject|class=}}",

"{{WikiProject Radio|class=|importance=}}",

"{{WP-Tennis|class=|importance=}}",

"{{WikiProject Serbia|class=|importance=}}",

"{{WP Australia|class=|importance=}}",

"{{WP Indonesia\n|importance=\n|class=\n|attention=\n|collaboration-candidate=\n|past-collaboration=\n|peer-review=\n}}",

"{{WPFC\n|class=\n|HRE-taskforce=\n|GOV-taskforce=\n|flagneeded=\n|coatneeded=\n|mapneeded=\n|infoboxneeded=\n|structureneeded=\n}}",

"{{WikiProject Filmmaking|class=}}",

"{{WikiProject Palestine|class=|importance=}}",

"{{WikiProject Israel|class=|importance=}}",

"{{LabourProject|class=|importance=}}",

"{{WikiProject Oregon|class=|importance=}}",

"{{Cooperatives|class=|importance=}}",

"{{WikiProject Malta|class=|importance=}}",

"{{WikiProject Law|class=|importance=}}",

"{{WP_SCOTUS|class=|importance=|needs-infobox=|flag=}}",

"{{WikiProject Database|class=|importance=}}",

"{{Cycling project|class=}}",

"{{WP:FISHING\n|class=\n|importance=\n}}",

"{{Chemistry|class=|importance=}}",

"{{Chemicals|class=|importance=}}",

"{{WP1.0\n| class = \n| importance = \n| orphan = \n| VA = \n| core = \n| coresup = \n| category = \n| v0.7 = \n| WPCD = \n}}",

"{{Numismaticnotice|class=|importance=}}",

"{{Ice hockey|class=}}",

"{{BCproject|class=|importance=}}"];

 

function aTemplate() {

this.name = "";

this.code = "";

this.existsGrade = "";

this.existsPriority = "";

this.isUsers = "";

}



function TemplateSort(a,b) {

  if ( a.name > b.name ) return 1

  else if ( a.name < b.name ) return -1

  else return 0;

}



$(begin);



function begin() {

  if ( wgNamespaceNumber==0 && !location.pathname.match('/') && !document.body.innerHTML.match('id="disambig"') ) {

    if ( Cookie.read("wpasStatus") >= "1" || Cookie.read("wpasStatus") === null ) {

      if ( document.getElementById("ca-talk").className == "new" ) {

        asTalkPage = "";

        update("#000000", "An " + linkLead + "unassessed</a> article", "");

      }

      else {

        var url = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + "/index.php?title=Talk:" + encodeURIComponent(wgTitle) + "&action=raw";

        loadTalkPageRaw(url);

      }

    }

    else if (Cookie.read("wpasStatus") == "0" && !document.getElementById("siteSub").innerHTML.match(writeActivations()) ) {

      document.getElementById("siteSub").innerHTML += writeActivations(); 

    }

  }

}



function loadTalkPageRaw(url) { 

    if (window.XMLHttpRequest) { // branch for native XMLHttpRequest object

        var tpreq = new XMLHttpRequest();

    }

    else if (window.ActiveXObject) { // branch for IE/Windows ActiveX version

        var tpreq = new ActiveXObject("Microsoft.XMLHTTP");

    }

    if (tpreq) {

     tpreq.onreadystatechange = function () { 

       if (tpreq.readyState==4) {

         // if "OK"

         if (tpreq.status==200) {

           getAssessment(tpreq);

         }

       }

     };

     tpreq.open("GET", url, true);

     tpreq.send("");  

    }

}





function getAssessment(myreq)

{

  asTalkPage = myreq.responseText;

  var otherInfo = "";

  if ( asTalkPage.match( /\{\{ganominee/i ) ) {

    otherInfo='. <i>Currently a <a href="' + wgServer + '/?title=Wikipedia:Good_article_candidates" style="color:' + linkColor + ';">Good Article candidate</a></i>.';

  }

  else if ( asTalkPage.match(/\{\{fac[\|}]/i ) ) { 

    otherInfo='. <i>Currently a <a href="' + wgServer + '/?title=Wikipedia:Featured_article_candidates/' + encodeURIComponent(mw.config.get('wgPageName')) + '&redirect=no" style="color:' + linkColor + ';">Featured Article candidate</a></i>.';

  }

  else if (asTalkPage.match(/\{\{peerreview}/i ) ) {

    otherInfo='. <i>Currently in <a href="' + wgServer + '/?title=Wikipedia:Peer review/' + encodeURIComponent(mw.config.get('wgPageName')) + '" style="color:' + linkColor + ';">peer review</a></i>.';

  }



  if ( document.getElementById("featured-star") ) {

    if (document.body.innerHTML.match('<area href="/wiki/Wikipedia:Featured_lists"') ) {         

      update("#0066CC", 'A <a style="color:' + linkColor + ';" href="/wiki/Wikipedia:Featured_lists">Featured List</a>', ""); 

    }

    else {      

      update("#0066CC", 'A <a style="color:' + linkColor + ';" href="/wiki/Wikipedia:Featured Articles">Featured Article</a>', "");

    }

   

  }

  // should get the match once instead of checking repeatedly:

  else if ( asTalkPage.match(/class *= *a[ \|\n}]/i) ) { update("#007BFF", "An " + linkLead + "A-class</a> article", otherInfo);}

  else if ( asTalkPage.match(/\{\{ga[|}]/i ) || asTalkPage.match(/currentstatus *= *(ffa\/)?ga/i) ) { update("#007700", 'A <a style="color:' + linkColor + ';" href="/wiki/Wikipedia:Good Articles">Good Article</a>', otherInfo);}

  else if ( asTalkPage.match(/class *= *c[ \|\n}]/i) ) { update("#999933", "A " + linkLead + "C-class</a> article", otherInfo);}

  else if ( asTalkPage.match(/class *= *b[ \|\n}]/i) ) { update("#999933", "A " + linkLead + "B-class</a> article", otherInfo);}

  else if ( asTalkPage.match(/class *= *start[ \|\n}]/i) ) { update("#BB6600", "A " + linkLead + "Start-class</a> article", otherInfo);}

  else if ( asTalkPage.match(/class *= *stub[ \|\n}]/i) ) { update("#990011", "A " + linkLead + "Stub-class</a> article", otherInfo);}

  else { update("#000000", "An " + linkLead + "unassessed</a> article", otherInfo);}

}



function update(color, slogan, info) {

  if ( typeof document.getElementsByTagName("h1")[0 != "undefined" ) { // see WPdiff:114016002

    document.getElementsByTagName("h1")[0].style.cssText = "color: " + color + ";";

  }

  t = document.getElementById("siteSub").innerHTML;

  document.getElementById("siteSub").innerHTML = slogan + " " + t.charAt(0).toLowerCase() + t.substring(1) + info + writeActivations();

  

  if ( Cookie.read("wpasStatus") == "2" || Cookie.read("wpasStatus") === null) {

    if ( typeof assessmentMyTemplateCode != "undefined" ) {

      existingTemplateCodeArray = getTemplatesInString(assessmentMyTemplateCode.join('\n'), true);

    }

    existingTemplateCodeArray = existingTemplateCodeArray.concat( getTemplatesInString(asTalkPage, false) );

    for (y = 0; y < existingTemplateCodeArray.length ; y++) {

      z = 0;

      notFound = true;

      while (z < TemplateArray.length && notFound ) {

        if ( existingTemplateCodeArrayy].name == TemplateArrayz].name ) {

          TemplateArrayz = existingTemplateCodeArrayy];

          notFound = false;

        }

        z++;

      }

      if ( notFound ) { 

        TemplateArray.push(existingTemplateCodeArrayy]);

      }

    }

    

    TemplateArray.sort(TemplateSort);

    templateSelect = document.createElement("select");

    for (x = 0; x < TemplateArray.length ; x++) {

      templateSelect.optionsx = new Option(TemplateArrayx].name, TemplateArrayx].name);

      if ( TemplateArrayx].existsGrade != "" && !TemplateArrayx].isUsers ) { 

        existingGrade = TemplateArrayx].existsGrade;

        templateSelect.optionsx].style.backgroundColor =  getAssessmentBackgroundColor(existingGrade);

        templateSelect.optionsx].text += " → " + existingGrade;

      }

      if (TemplateArrayx].existsPriority != "" && !TemplateArrayx].isUsers ) {

        templateSelect.optionsx].text += "/" + TemplateArrayx].existsPriority;

      }

      if ( typeof assessmentDefaultProject != "undefined" && TemplateArrayx].name.toLowerCase() == assessmentDefaultProject.toLowerCase() ) {

        templateSelect.selectedIndex = x;

      }

    }

    templateSelect.onchange = projectChange;

    projectChange();

  }

  //more kludge; repaint for imgs

  document.getElementById('content').style.zIndex = '3';

  window.setTimeout("document.getElementById('content').style.zIndex = '2'",1);



}



function projectChange() {

  var index = templateSelect.selectedIndex;

  var templateChoice = templateSelect.optionsindex].value;

  myDiv = document.createElement("div");

  myDiv.appendChild(templateSelect);

  if ( TemplateArrayindex].code.match(/(priority|importance) *=/) ) {

    prioritySelect = document.createElement("select");

    for (x = 0; x < priorityArray.length ; x++) {

      prioritySelect.optionsx = new Option(priorityArrayx], priorityArrayx]);

          if (TemplateArrayindex].existsPriority.toLowerCase() == priorityArrayx].toLowerCase() )

          { prioritySelect.selectedIndex = x; }

	  else if (typeof assessmentDefaultPriority != "undefined" && priorityArrayx == assessmentDefaultPriority && prioritySelect.selectedIndex < 1) {

	    prioritySelect.selectedIndex = x;

	  }	

    }

    myDiv.appendChild(prioritySelect); 	

  }	

  if ( "WPBiography" == templateChoice ) { 

    bioWorkGroupSelect = document.createElement("select");

	for (x = 0; x < bioWorkGroupArray.length ; x++) {

      bioWorkGroupSelect.optionsx = new Option(bioWorkGroupArrayx], bioWorkGroupArrayx]);

	  if (typeof assessmentDefaultWorkGroup != "undefined" && bioWorkGroupArrayx == assessmentDefaultWorkGroup ) {

	    bioWorkGroupSelect.selectedIndex = x;

	  }

	}

	myDiv.appendChild(bioWorkGroupSelect);

	

	livingSelect = document.createElement("select");

	var livingFlag = "";	

	if ( document.body.innerHTML.match("Category:Living_people") ) {

	  livingFlag = "yes"; }

	else if ( document.body.innerHTML.match(/Category:\d+ (BC )?deaths/i) ) {

	  livingFlag = "no"; }

	else if ( typeof assessmentDefaultLiving != "undefined" ) {

 	  livingFlag = assessmentDefaultLiving;

	} 

	    

	for (x = 0; x < livingArray.length ; x++) {

      livingSelect.optionsx = new Option(livingArrayx], livingArrayx]);

      if ( livingArrayx == livingFlag) { livingSelect.selectedIndex = x; }

	}

	

	myDiv.appendChild(livingSelect);

  }

  else if ( "WPMILHIST" == templateChoice ) {

    milHistTaskForceSelect = document.createElement("select");

    for (x = 0; x < milHistTaskForceArray.length ; x++) {

      milHistTaskForceSelect.optionsx = new Option(milHistTaskForceArrayx], milHistTaskForceArrayx]);

	  if (typeof assessmentDefaultMilHistTaskForce != "undefined" && milHistTaskForceArrayx == assessmentDefaultMilHistTaskForce ) {

	    milHistTaskForceSelect.selectedIndex = x;

	  }

     }

    myDiv.appendChild(milHistTaskForceSelect);

  }

  writeGradeLinks(templateChoice, myDiv);

  if ( document.getElementById("selectionDiv") === null ) { //order of ops is important for IE

    document.getElementById("contentSub").appendChild(myDiv) 

  }

  else {

    document.getElementById("contentSub").replaceChild(myDiv, document.getElementById("selectionDiv")); 

  }

  myDiv.id = "selectionDiv";

}



function writeGradeLinks(template, theDiv) {

  var grades = document.createElement("div");

  var count = ( Cookie.read("wpasCount") === null ) ? "0" : Cookie.read("wpasCount") ;

  filmGrades = (template=="Film") ? ' • <a href="javascript:addAssessment(\'Future\')">Future</a>' : "" ;

  grades.innerHTML = '(<a href="javascript:Cookie.create(\'wpasCount\',0,180);projectChange();" title="Click to reset">' + count + '</a> assessed) <a href="javascript:addAssessment(\'Stub\')" title="Assess as Stub using above template [1]" accesskey="1">Stub</a> • <a href="javascript:addAssessment(\'Start\')" title="Assess as Start using above template [2]" accesskey="2">Start</a> • <a href="javascript:addAssessment(\'C\')" title="Assess as C using above template [3]" accesskey="3">C</a> • <a href="javascript:addAssessment(\'B\')" title="Assess as B using above template [3]" accesskey="4">B</a> • <a href="javascript:addAssessment(\'GA\')">GA</a> • <a href="javascript:addAssessment(\'A\')">A</a> • <a href="javascript:addAssessment(\'List\')" title="Not applicable to all projects">List</a>' + filmGrades;

  theDiv.appendChild(grades);

}



function addAssessment(grade) {

  var thisTemplateMatch, newLines, textToReplace, template, ti;

  var priority = null;

  template = templateSelect.value;

  ti = templateSelect.selectedIndex;

  if (asTalkPage == null) { asTalkPage = "";}

  else if ( asTalkPage.match(new RegExp("\{\{" + template + "[ \n]*[\|}]", "i") ) ) { 

    addingNewTemplate = false;

  }

  else if ( asTalkPage.match(/((^[ \r\n]*\{\{[^\{}]*}}[ \n]*){1,3})/mi ) ) { // there are templates, but not mine

    replaced = RegExp.$1;

    replacement = RegExp.$1;

    if (replaced.match(/(\n{2,}$)/)) { replaced = replaced.replace(RegExp.$1, "\n"); }

    else { replaced += "\n"; }

    asTalkPage = asTalkPage.replace(replacement, replaced + TemplateArrayti].code ); 

  }

  else { asTalkPage = TemplateArrayti].code + "\n" + asTalkPage; } // no templates, so add before rest of talk page

  asTalkPage.match(new RegExp("(\{\{"+template+"[ \n]*[\|}][^}]*}}?)([ \n]?)", "i" ) );

  thisTemplateMatch = RegExp.$1;

  newLines = RegExp.$2;

  textToReplace = thisTemplateMatch; 

  thisTemplateMatch = updateTemplate(thisTemplateMatch, "class", grade);

  if (TemplateArrayti].code.match(/((priority|importance)) *=/) && prioritySelect.optionsprioritySelect.selectedIndex].value != "" ) { 

    priority = prioritySelect.optionsprioritySelect.selectedIndex].value

    thisTemplateMatch = updateTemplate(thisTemplateMatch, RegExp.$1, priority );

  }

  thisTemplateMatch = thisTemplateMatch.replace(/\| *auto *= *yes(\n)?/i, ""); //wpdiff 122608658

  if (template=="WPBiography") {

        thisTemplateMatch = thisTemplateMatch.replace("importance", "priority");

  	if ( bioWorkGroupSelect.optionsbioWorkGroupSelect.selectedIndex].value != "" ) {

		thisTemplateMatch = updateTemplate(thisTemplateMatch, bioWorkGroupSelect.optionsbioWorkGroupSelect.selectedIndex].value, "yes" );

	}

	if ( livingSelect.optionslivingSelect.selectedIndex].value != "" ) {

		thisTemplateMatch = updateTemplate(thisTemplateMatch, "living", livingSelect.optionslivingSelect.selectedIndex].value );

        }

        if ( !thisTemplateMatch.match(/listas *= *\w+/i) ) {

            var sortKey = getSortKey();

            if ( sortKey != null ) { 

              thisTemplateMatch = updateTemplate(thisTemplateMatch, "listas", sortKey); 

            }

        }

  }	

  else if ( template=="WPMILHIST" ) {

    thisTemplateMatch = updateTemplate(thisTemplateMatch, milHistTaskForceSelect.optionsmilHistTaskForceSelect.selectedIndex].value, "yes" );

  }

  asTalkPage = asTalkPage.replace(textToReplace, thisTemplateMatch + ((newLines == "") ? "\n" : newLines) );

  asTalkPage = asTalkPage.replace( /\{\{stubclass[^}]}}/i , "" ); // wpdiff 122730502

  loadTalkPageHTML(grade, priority, mw.config.get('wgServer') + mw.config.get('wgScriptPath') + "/index.php?title=Talk:" + encodeURIComponent(wgTitle) + "&action=edit", template);

}



	function updateTemplate(templateCode, parameter, val) {

	  var s = templateCode;

	  if ( s.match(/\n/) ) { addCr ="\n"; } else {addCr = ""};

	  if ( s.match(" =")  ) { addSp =" = "; } else {addSp = "="};  

	  if ( s.match(new RegExp('(' + parameter + ' *= *([^|}\n]*))'))) {

	    if (RegExp.$2 != val) {  

              s = s.replace(RegExp.$1, parameter + addSp + val );

              parametersChanged++;

            }

	  }

	  else { 

	    s = s.replace(/}}/, '|' + parameter + addSp + val + addCr + "}}");

            parametersChanged++; 

	  }

	  return s;

	}



	function getSortKey() {

	  loadCategories(mw.config.get('wgServer') + mw.config.get('wgScriptPath') + "/query.php?what=categories&titles=" + encodeURIComponent(wgTitle) +    	"&clextended&format=yaml");

	  if ( categoryText != null && categoryText.match(/sortkey: (.+)[\n]/) ) {return RegExp.$1;   }

	  else { return null; }  

	}



function loadCategories(url) {

    if (window.XMLHttpRequest) {

        var catReq = new XMLHttpRequest();

    }

    else if (window.ActiveXObject) {

        var catReq = new ActiveXObject("Microsoft.XMLHTTP");

    }

   if (catReq) {

     catReq.onreadystatechange = function () { 

       if (catReq.readyState==4) {

         if (catReq.status==200) {

           categoryText = catReq.responseText;

         }

       }

     };

     catReq.open("GET", url, false);

     catReq.send("");  

   }

}



function loadTalkPageHTML(grade, priority, url, template) {

    if (window.XMLHttpRequest) {

        var tphreq = new XMLHttpRequest();

    }

    else if (window.ActiveXObject) {

        var tphreq = new ActiveXObject("Microsoft.XMLHTTP");

    }

   if (tphreq) {

     tphreq.onreadystatechange = function () { 

       if (tphreq.readyState==4) {

         if (tphreq.status==200) {

           postAssessment(grade, priority, tphreq, template);

         }

       }

     };

     tphreq.open("GET", url, true);

     tphreq.send("");  

   }

}



function postAssessment(grade, priority, myreq, template) {

  var count;

  var watchPageHTML;

  var minorEditHTML = '<input name="wpMinoredit" value="1" id="wpMinoredit" />';

  talkpagehtml = myreq.responseText;

  if ( Cookie.read("wpasCount") === null ) { count = 0; } 

  else { count = parseInt(Cookie.read("wpasCount")); }

  Cookie.create("wpasCount", String(count + 1), 180);

  if (typeof assessmentMarkAsMinor != "undefined" && !assessmentMarkAsMinor) {

      minorEditHTML = ""; 

  }

  if ( talkpagehtml.match(/<input type=.hidden. value="([\w\d]+)." name="wpEditToken"/i) ) {

    var editToken = RegExp.$1;

  }

  if ( talkpagehtml.match(/<input name=.wpAutoSummary. type="hidden" value="([\w\d]+)"/i) ) {

    var autoSummary = RegExp.$1;

  }

  if ( talkpagehtml.match(/<input type=.hidden. value="([\d]+)" name="wpStarttime"/i) ) {

    var startTime = RegExp.$1;

  }

  if ( talkpagehtml.match(/<input type=.hidden. value="([\d]+)" name="wpEdittime"/i) ) {

    var editTime = RegExp.$1;

  }

  if ( document.body.innerHTML.match('id="ca-unwatch"') ) {

    watchPageHTML = '<input name="wpWatchthis" value="1" id="wpWatchthis" />';

  }

  else if ( talkpagehtml.match(/<input name=.wpWatchthis. type="checkbox" value="1" checked="checked"/i) ) {

    if ( ( typeof assessmentOverrideWatchPref == "undefined" ) || ( typeof assessmentOverrideWatchPref != "undefined" && !assessmentOverrideWatchPref ) ) {  

    watchPageHTML = '<input name="wpWatchthis" value="1" id="wpWatchthis" />';

    }

  }

  mydiv = document.createElement("div");

  mydiv.innerHTML = '<form style="visibility: hidden;" id="editform" name="editform" method="post" action="/?title=Talk:' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=edit" enctype="multipart/form-data"><textarea name="wpTextbox1" id="wpTextbox1"></textarea><input  type="text" name="wpSummary" id="wpSummary"/>' + minorEditHTML + '<input id="wpPreview" name="wpPreview" type="submit"/><input value="' + startTime + '" name="wpStarttime" /><input value="' + editTime + '" name="wpEdittime" /><input value="'+ editToken + '\" name="wpEditToken" /><input name="wpAutoSummary"  value="' + autoSummary + '" />' + watchPageHTML + '</form>';

  document.body.appendChild(mydiv);

  document.editform.wpTextbox1.value = asTalkPage;

  priorityText = ( priority != null ) ? "/"+priority : "";

  document.editform.wpSummary.value = ((addingNewTemplate) ? 'add ' : 'update ') + 'WikiProject [[Template:' + template + '|' + template + ']] (' + grade + priorityText + ')';

  document.editform.submit();

}



function getAssessmentBackgroundColor(grade) {

  var s = grade.toLowerCase();

  switch (s) {

    case "none":

      return "#DDD"

      break

    case "stub":

      return "#FCC"

      break

    case "start":

      return "#FC9"

      break

    case "b":

      return "#FF9"

      break

    case "ga":

      return "#9C9"

      break

    case "a":

      return "#CFF"

      break

    case "fa":

      return "#9BE"

      break

    default:

      return ""

  }

}



function getTemplatesInString(s, isUsers) {

  var a = new Array();  

  while (s.match(/(\{\{ *([\w\d\.\- ]+)[^\{}]*[^\-]class *= *(\w+)?[^}]*}})/mi) ) {

    code = RegExp.$1;

    name = RegExp.$2.charAt(0).toUpperCase() + RegExp.$2.substring(1);

    grade = ( RegExp.$3.length == 1 ? RegExp.$3.toUpperCase() : RegExp.$3 );

    t = new aTemplate();

    t.name = name.replace(/ +$/, "");

    t.code = code;

    t.existsGrade = ((grade == "") ? "none" : grade);

    if ( code.match(/(priority|importance) *= *(\w+)/i) ) {

      t.existsPriority = RegExp.$2;

    }

    t.isUsers = ( isUsers ) ? true : false;

    a.push(t);

    s = s.replace(code, "");

  }

  return a;

}



function writeActivations() {

  return '&nbsp;&nbsp;&nbsp;<small>[<a href="javascript:switchActivation(\'2\')">On</a>] • [<a   href="javascript:switchActivation(\'1\')">Hide</a>] • [<a href="javascript:switchActivation(\'0\')">Off</a>]</small>';

}



function switchActivation(level) {

  Cookie.create("wpasStatus", level,180);

  if (level == "2" && document.getElementById("selectionDiv") === null) {

    begin();

    document.getElementById("selectionDiv").style.display = "block" ; 

  }

  else if ( document.getElementById("selectionDiv") != null && (level == "1" || level == "0" ) ) {

    document.getElementById("selectionDiv").style.display = "none";

  }

}



var Cookie= { // from http://www.quirksmode.org/js/cookies.html

	create: function(name,value,days)

	{

		var expires;

		if (days)

		{

			var date = new Date();

			date.setTime(date.getTime()+(days*24*60*60*1000));

			expires = "; expires="+date.toGMTString();

		}

		else { expires = ""; }

		document.cookie = name+"="+value+expires+"; path=/";

	},



	read: function(name)

	{

		var nameEQ = name + "=";

		var ca = document.cookie.split(';');

		for(var i=0;i < ca.length;i++)

		{

			var c = cai];

			while (c.charAt(0)==' ') { c = c.substring(1,c.length); }

			if (c.indexOf(nameEQ) === 0) { return c.substring(nameEQ.length,c.length); }

		}

		return null;

	},



	erase: function(name)

	{

		Cookie.create(name,"",-1);

	}

};



// </nowiki>

Videos

Youtube | Vimeo | Bing

Websites

Google | Yahoo | Bing

Encyclopedia

Google | Yahoo | Bing

Facebook