r50371 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50370‎ | r50371 | r50372 >
Date:16:58, 9 May 2009
Author:thomasv
Status:ok
Tags:
Comment:
fix regexp; add 'proofreadpage_username' variable
Modified paths:
  • /trunk/extensions/ProofreadPage/proofread.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ProofreadPage/proofread.js
@@ -111,7 +111,7 @@
112112 //find the PageQuality template
113113 //we do this separately from header detection,
114114 //because the template might not be in the header
115 - var reg = /\{\{PageQuality\|(0|1|2|3|4|25%|50%|75%|100%)(\|.*?|)\}\}/g;
 115+ var reg = /\{\{PageQuality\|(0|1|2|3|4|25%|50%|75%|100%)(\|(.*?|))\}\}/g;
116116 var m4 = reg.exec(pageHeader);
117117 self.show4 = false;
118118 if(m4) {
@@ -128,12 +128,13 @@
129129 case "25%": self.proofreadpage_quality = 2; break;
130130 default: self.proofreadpage_quality = 1;
131131 }
132 -
133 - if((m4[3]!= "|"+wgUserName) && (m4[1]=="3")) self.show4 = true;
134 - if(m4[1] =="4") self.show4 = true;
 132+ self.proofreadpage_username = m4[3];
135133 pageHeader = pageHeader.replace(reg,'');
136134 }
137 - else self.proofreadpage_quality = 1;
 135+ else {
 136+ self.proofreadpage_quality = 1;
 137+ self.proofreadpage_username = "";
 138+ }
138139
139140
140141 //escape & character
@@ -852,7 +853,11 @@
853854 +'<span class="quality2"> <input type="radio" name="quality" onclick="pr_add_quality(this.form,2)"> </span>'
854855 +'<span class="quality1"> <input type="radio" name="quality" onclick="pr_add_quality(this.form,1)"> </span>'
855856 +'<span class="quality3"> <input type="radio" name="quality" onclick="pr_add_quality(this.form,3)"> </span>';
856 - if(self.show4) f.innerHTML = f.innerHTML
 857+
 858+ var show4 = false;
 859+ if(self.proofreadpage_quality==4) show4 = true;
 860+ if((self.proofreadpage_quality==3) && (self.proofreadpage_username != "|"+wgUserName)) show4 = true;
 861+ if(show4) f.innerHTML = f.innerHTML
857862 + '<span class="quality4"> <input type="radio" name="quality" onclick="pr_add_quality(this.form,4)"> </span>';
858863 f.innerHTML = f.innerHTML + '&nbsp;'+proofreadPageMessageStatus;
859864 ig.parentNode.insertBefore(f,ig.nextSibling.nextSibling.nextSibling);

Status & tagging log