r51467 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51466‎ | r51467 | r51468 >
Date:13:36, 4 June 2009
Author:thomasv
Status:ok
Tags:
Comment:
test that pages marked blank are actually blank; formatting a bit
Modified paths:
  • /trunk/extensions/ProofreadPage/proofread.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ProofreadPage/proofread.js
@@ -119,9 +119,8 @@
120120 //because the template might not be in the header
121121 var reg = /\{\{PageQuality\|(0|1|2|3|4|25%|50%|75%|100%)(\|(.*?|))\}\}/g;
122122 var m4 = reg.exec(pageHeader);
123 - self.show4 = false;
124 - if(m4) {
125 - switch(m4[1]){
 123+ if( m4 ) {
 124+ switch( m4[1] ) {
126125 case "0": self.proofreadpage_quality = 0; break;
127126 case "1": self.proofreadpage_quality = 1; break;
128127 case "2": self.proofreadpage_quality = 2; break;
@@ -753,6 +752,10 @@
754753 var form = document.getElementById("editform");
755754 var header = form.elements["headerTextbox"];
756755 var footer = form.elements["footerTextbox"];
 756+ if( ( self.proofreadpage_quality == 0 ) && ( form.elements["wpTextbox1"].value != "" ) ) {
 757+ self.proofreadpage_quality = 1;
 758+ form.elements["wpSummary"].value="/* " + proofreadPageMessageQuality1 + " */ ";
 759+ }
757760 if(header){
758761 var h = header.value.replace(/(\s*(\r?\n|\r))+$/, '');
759762 if(h) h = "<noinclude>{{PageQuality|"+self.proofreadpage_quality+"|"+self.proofreadpage_username+"}}"+h+"\n\n\n</noinclude>";
@@ -831,26 +834,36 @@
832835
833836 function pr_add_quality(form,value){
834837
 838+ if( ( value == 0 ) && ( form.elements["wpTextbox1"].value != "" ) ) {
 839+ switch( self.proofreadpage_quality ) {
 840+ case 4: document.editform.quality[4].checked = true; break;
 841+ case 3: document.editform.quality[3].checked = true; break;
 842+ case 1: document.editform.quality[2].checked = true; break;
 843+ case 2: document.editform.quality[1].checked = true; break;
 844+ case 0: document.editform.quality[0].checked = true; break;
 845+ }
 846+ return;
 847+ }
835848 self.proofreadpage_quality = value;
836849 self.proofreadpage_username = wgUserName;
837850 var text="";
838 - switch(value){
 851+ switch( value ) {
839852 case 0: text = proofreadPageMessageQuality0; break;
840853 case 1: text = proofreadPageMessageQuality1; break;
841854 case 2: text = proofreadPageMessageQuality2; break;
842855 case 3: text = proofreadPageMessageQuality3; break;
843856 case 4: text = proofreadPageMessageQuality4; break;
844857 }
845 - form.elements["wpSummary"].value="/* "+text+" */ ";
 858+ form.elements["wpSummary"].value="/* " + text + " */ ";
846859
847860 }
848861
849862
850863 function pr_add_quality_buttons(){
851864
852 - if(self.proofreadpage_no_quality_buttons) return;
 865+ if( self.proofreadpage_no_quality_buttons ) return;
853866 var ig = document.getElementById("wpWatchthis");
854 - if(!ig) return;
 867+ if( !ig ) return;
855868 var f = document.createElement("span");
856869 f.innerHTML =
857870 ' <span class="quality0"> <input type="radio" name="quality" onclick="pr_add_quality(this.form,0)"> </span>'
@@ -861,19 +874,16 @@
862875 f.innerHTML = f.innerHTML + '&nbsp;' + escapeQuotesHTML(proofreadPageMessageStatus);
863876 ig.parentNode.insertBefore(f,ig.nextSibling.nextSibling.nextSibling);
864877
865 - var show4 = false;
866 - if(self.proofreadpage_quality==4) show4 = true;
867 - if((self.proofreadpage_quality==3) && (self.proofreadpage_username != wgUserName)) show4 = true;
868 - if(!show4)
869 - document.editform.quality[4].parentNode.style.cssText='display:none';
870 -
871 - if(self.proofreadpage_quality) {
872 - switch(self.proofreadpage_quality){
873 - case 4: document.editform.quality[4].checked=true; break;
874 - case 3: document.editform.quality[3].checked=true; break;
875 - case 1: document.editform.quality[2].checked=true; break;
876 - case 2: document.editform.quality[1].checked=true; break;
877 - case 0: document.editform.quality[0].checked=true; break;
 878+ if( ! ( ( self.proofreadpage_quality == 4 ) || ( ( self.proofreadpage_quality == 3 ) && ( self.proofreadpage_username != wgUserName ) ) ) ) {
 879+ document.editform.quality[4].parentNode.style.cssText = 'display:none';
 880+ }
 881+ if( self.proofreadpage_quality ) {
 882+ switch( self.proofreadpage_quality ) {
 883+ case 4: document.editform.quality[4].checked = true; break;
 884+ case 3: document.editform.quality[3].checked = true; break;
 885+ case 1: document.editform.quality[2].checked = true; break;
 886+ case 2: document.editform.quality[1].checked = true; break;
 887+ case 0: document.editform.quality[0].checked = true; break;
878888 }
879889 }
880890 }

Status & tagging log