Index: trunk/extensions/ProofreadPage/proofread.js |
— | — | @@ -32,30 +32,37 @@ |
33 | 33 | |
34 | 34 | if(proofreadPageIsEdit) { |
35 | 35 | text = document.getElementById("wpTextbox1"); |
36 | | - if (text) { |
37 | | - text.setAttribute("style", "width:100%; height:100%;"); //width seems to be set by monobook already... |
| 36 | + if (!text) return; |
| 37 | + text.setAttribute("style", "width:100%; height:100%;"); //width seems to be set by monobook already... |
38 | 38 | |
39 | | - re = /^(\{\{PageQuality\|[0-9][0-9*]%\}\}|)<noinclude>([\s\S]*?)<\/noinclude>([\s\S]*?)(<noinclude>([\s\S]*?)<\/noinclude>|)\n$/; |
40 | | - m = text.value.match(re); |
41 | | - if(m) { |
42 | | - pageHeader = m2[2]; |
43 | | - pageBody = m2[1]+m2[3]; |
44 | | - pageFooter = m2[5]; |
45 | | - } |
46 | | - else { |
47 | | - pageBody = text.value; |
48 | | - pageHeader = ''; |
49 | | - pageFooter = ''; |
50 | | - } |
| 39 | + re = /^(\{\{PageQuality\|[0-9][0-9]%\}\}|)<noinclude>([\s\S]*?)<\/noinclude>([\s\S]*)<noinclude>([\s\S]*?)<\/noinclude>\n$/; |
| 40 | + m = text.value.match(re); |
| 41 | + if(m) { |
| 42 | + pageHeader = m[2]; |
| 43 | + pageBody = m[1]+m[3]; |
| 44 | + pageFooter = m[4]; |
51 | 45 | } |
52 | | - } else { |
| 46 | + else { |
| 47 | + re2 = /^(\{\{PageQuality\|[0-9][0-9]%\}\}|)<noinclude>([\s\S]*?)<\/noinclude>([\s\S]*?)\n$/; |
| 48 | + m2 = text.value.match(re2); |
| 49 | + if(m2) { |
| 50 | + pageHeader = m2[2]; |
| 51 | + pageBody = m2[1]+m2[3]; |
| 52 | + pageFooter = ''; |
| 53 | + } |
| 54 | + else { |
| 55 | + pageHeader = ''; |
| 56 | + pageBody = text.value; |
| 57 | + pageFooter = ''; |
| 58 | + } |
| 59 | + } |
| 60 | + } |
| 61 | + else { |
53 | 62 | text = document.getElementById("bodyContent"); |
| 63 | + if(!text) return; |
54 | 64 | } |
55 | | - if(!text) return; |
56 | 65 | |
57 | 66 | |
58 | | - |
59 | | - |
60 | 67 | //image |
61 | 68 | image = document.createElement("img"); |
62 | 69 | image.setAttribute("src", image_url); |