Index: trunk/extensions/ProofreadPage/proofread.js |
— | — | @@ -119,9 +119,8 @@ |
120 | 120 | //because the template might not be in the header |
121 | 121 | var reg = /\{\{PageQuality\|(0|1|2|3|4|25%|50%|75%|100%)(\|(.*?|))\}\}/g; |
122 | 122 | var m4 = reg.exec(pageHeader); |
123 | | - self.show4 = false; |
124 | | - if(m4) { |
125 | | - switch(m4[1]){ |
| 123 | + if( m4 ) { |
| 124 | + switch( m4[1] ) { |
126 | 125 | case "0": self.proofreadpage_quality = 0; break; |
127 | 126 | case "1": self.proofreadpage_quality = 1; break; |
128 | 127 | case "2": self.proofreadpage_quality = 2; break; |
— | — | @@ -753,6 +752,10 @@ |
754 | 753 | var form = document.getElementById("editform"); |
755 | 754 | var header = form.elements["headerTextbox"]; |
756 | 755 | 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 | + } |
757 | 760 | if(header){ |
758 | 761 | var h = header.value.replace(/(\s*(\r?\n|\r))+$/, ''); |
759 | 762 | if(h) h = "<noinclude>{{PageQuality|"+self.proofreadpage_quality+"|"+self.proofreadpage_username+"}}"+h+"\n\n\n</noinclude>"; |
— | — | @@ -831,26 +834,36 @@ |
832 | 835 | |
833 | 836 | function pr_add_quality(form,value){ |
834 | 837 | |
| 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 | + } |
835 | 848 | self.proofreadpage_quality = value; |
836 | 849 | self.proofreadpage_username = wgUserName; |
837 | 850 | var text=""; |
838 | | - switch(value){ |
| 851 | + switch( value ) { |
839 | 852 | case 0: text = proofreadPageMessageQuality0; break; |
840 | 853 | case 1: text = proofreadPageMessageQuality1; break; |
841 | 854 | case 2: text = proofreadPageMessageQuality2; break; |
842 | 855 | case 3: text = proofreadPageMessageQuality3; break; |
843 | 856 | case 4: text = proofreadPageMessageQuality4; break; |
844 | 857 | } |
845 | | - form.elements["wpSummary"].value="/* "+text+" */ "; |
| 858 | + form.elements["wpSummary"].value="/* " + text + " */ "; |
846 | 859 | |
847 | 860 | } |
848 | 861 | |
849 | 862 | |
850 | 863 | function pr_add_quality_buttons(){ |
851 | 864 | |
852 | | - if(self.proofreadpage_no_quality_buttons) return; |
| 865 | + if( self.proofreadpage_no_quality_buttons ) return; |
853 | 866 | var ig = document.getElementById("wpWatchthis"); |
854 | | - if(!ig) return; |
| 867 | + if( !ig ) return; |
855 | 868 | var f = document.createElement("span"); |
856 | 869 | f.innerHTML = |
857 | 870 | ' <span class="quality0"> <input type="radio" name="quality" onclick="pr_add_quality(this.form,0)"> </span>' |
— | — | @@ -861,19 +874,16 @@ |
862 | 875 | f.innerHTML = f.innerHTML + ' ' + escapeQuotesHTML(proofreadPageMessageStatus); |
863 | 876 | ig.parentNode.insertBefore(f,ig.nextSibling.nextSibling.nextSibling); |
864 | 877 | |
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; |
878 | 888 | } |
879 | 889 | } |
880 | 890 | } |