r24395 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24394‎ | r24395 | r24396 >
Date:12:29, 26 July 2007
Author:thomasv
Status:old
Tags:
Comment:
button to toggle headers visibility
Modified paths:
  • /trunk/extensions/ProofreadPage/proofread.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ProofreadPage/proofread.js
@@ -82,19 +82,19 @@
8383 pageFooter = '';
8484 }
8585 else {
86 - pageHeader = '';
 86+ pageHeader = '<div class="pagetext">';
8787 pageBody = text;
88 - pageFooter = '';
 88+ pageFooter = '</div>';
8989 }
9090 }
9191
9292 container.innerHTML = ''
93 - +'Header (noinclude):<br/>'
 93+ +'<div id="prp_header" style="display:none">Header (noinclude):<br/>'
9494 +'<textarea name="headerTextbox" rows="4" cols="80">'+pageHeader+'</textarea>'
95 - +'<br/>Page body (to be transcluded):<br/>'
 95+ +'<br/>Page body (to be transcluded):<br/></div>'
9696 +'<textarea name="wpTextbox1" id="wpTextbox1" rows="40" cols="80">'+pageBody+'</textarea>'
97 - +'<br/>Footer (noinclude):<br/>'
98 - +'<textarea name="footerTextbox" rows="4" cols="80">'+pageFooter+'</textarea>';
 97+ +'<div id="prp_footer" style="display:none"><br/>Footer (noinclude):<br/>'
 98+ +'<textarea name="footerTextbox" rows="4" cols="80">'+pageFooter+'</textarea></div>';
9999
100100 saveButton = document.getElementById("wpSave");
101101 saveButton.setAttribute("onclick","proofreadPageFillForm(this.form);");
@@ -106,8 +106,21 @@
107107 }
108108
109109
 110+function proofreadpage_toggle_visibility() {
110111
 112+ h = document.getElementById("prp_header");
 113+ f = document.getElementById("prp_footer");
 114+ s = h.getAttribute("style");
 115+ if( s == ""){
 116+ h.setAttribute("style", "display:none;");
 117+ f.setAttribute("style", "display:none;");
 118+ } else {
 119+ h.setAttribute("style", "");
 120+ f.setAttribute("style", "");
 121+ }
 122+}
111123
 124+
112125 function proofreadpage_default_setup() {
113126
114127 var displayWidth = 400; //default value
@@ -167,6 +180,21 @@
168181
169182 if(proofreadPageIsEdit) {
170183 proofreadpage_make_edit_area(cell_left,new_text.value);
 184+ toolbar = document.getElementById("toolbar");
 185+ if(toolbar){
 186+ var image = document.createElement("img");
 187+ image.width = 23;
 188+ image.height = 22;
 189+ image.className = "mw-toolbar-editbutton";
 190+ image.src = "http://upload.wikimedia.org/wikipedia/commons/2/2a/Button_category_plus.png";
 191+ image.border = 0;
 192+ image.alt = "headers";
 193+ image.title = "toggle headers visibility";
 194+ image.style.cursor = "pointer";
 195+ image.onclick = proofreadpage_toggle_visibility;
 196+ toolbar.appendChild(image);
 197+ }
 198+
171199 } else {
172200 cell_left.appendChild(new_text);
173201 }

Status & tagging log