1 // MediaWiki JavaScript support functions
3 var clientPC
= navigator
.userAgent
.toLowerCase(); // Get client info
4 var is_gecko
= ((clientPC
.indexOf('gecko')!=-1) && (clientPC
.indexOf('spoofer')==-1)
5 && (clientPC
.indexOf('khtml') == -1) && (clientPC
.indexOf('netscape/7.0')==-1));
6 var is_safari
= ((clientPC
.indexOf('applewebkit')!=-1) && (clientPC
.indexOf('spoofer')==-1));
7 var is_khtml
= (navigator
.vendor
== 'KDE' || ( document
.childNodes
&& !document
.all
&& !navigator
.taintEnabled
));
8 var is_ff2
= (clientPC
.indexOf('firefox/2')!=-1 || clientPC
.indexOf('minefield/3')!=-1); // For accesskeys
9 if (clientPC
.indexOf('opera') != -1) {
11 var is_opera_preseven
= (window
.opera
&& !document
.childNodes
);
12 var is_opera_seven
= (window
.opera
&& document
.childNodes
);
15 // add any onload functions in this hook (please don't hard-code any events in the xhtml source)
19 if (!window
.onloadFuncts
)
20 var onloadFuncts
= [];
22 function addOnloadHook(hookFunct
) {
23 // Allows add-on scripts to add onload functions
24 onloadFuncts
[onloadFuncts
.length
] = hookFunct
;
27 function runOnloadHook() {
28 // don't run anything below this for non-dom browsers
29 if (doneOnloadHook
|| !(document
.getElementById
&& document
.getElementsByTagName
))
37 setupCheckboxShiftClick();
39 // Run any added-on functions
40 for (var i
= 0; i
< onloadFuncts
.length
; i
++)
43 doneOnloadHook
= true;
46 function hookEvent(hookName
, hookFunct
) {
47 if (window
.addEventListener
)
48 addEventListener(hookName
, hookFunct
, false);
49 else if (window
.attachEvent
)
50 attachEvent("on" + hookName
, hookFunct
);
53 //note: all skins shoud call runOnloadHook() at the end of html output,
54 // so the below should be redundant. It's there just in case.
55 hookEvent("load", runOnloadHook
);
57 // document.write special stylesheet links
58 if (typeof stylepath
!= 'undefined' && typeof skin
!= 'undefined') {
59 if (is_opera_preseven
) {
60 document
.write('<link rel="stylesheet" type="text/css" href="'+stylepath
+'/'+skin
+'/Opera6Fixes.css">');
61 } else if (is_opera_seven
) {
62 document
.write('<link rel="stylesheet" type="text/css" href="'+stylepath
+'/'+skin
+'/Opera7Fixes.css">');
63 } else if (is_khtml
) {
64 document
.write('<link rel="stylesheet" type="text/css" href="'+stylepath
+'/'+skin
+'/KHTMLFixes.css">');
67 // Un-trap us from framesets
68 if (window
.top
!= window
)
69 window
.top
.location
= window
.location
;
71 // for enhanced RecentChanges
72 function toggleVisibility(_levelId
, _otherId
, _linkId
) {
73 var thisLevel
= document
.getElementById(_levelId
);
74 var otherLevel
= document
.getElementById(_otherId
);
75 var linkLevel
= document
.getElementById(_linkId
);
76 if (thisLevel
.style
.display
== 'none') {
77 thisLevel
.style
.display
= 'block';
78 otherLevel
.style
.display
= 'none';
79 linkLevel
.style
.display
= 'inline';
81 thisLevel
.style
.display
= 'none';
82 otherLevel
.style
.display
= 'inline';
83 linkLevel
.style
.display
= 'none';
88 // attach event handlers to the input elements on history page
89 function histrowinit() {
90 var hf
= document
.getElementById('pagehistory');
93 var lis
= hf
.getElementsByTagName('li');
94 for (var i
= 0; i
< lis
.length
; i
++) {
95 var inputs
= historyRadios(lis
[i
]);
96 if (inputs
[0] && inputs
[1]) {
97 inputs
[0].onclick
= diffcheck
;
98 inputs
[1].onclick
= diffcheck
;
104 function historyRadios(parent
) {
105 var inputs
= parent
.getElementsByTagName('input');
107 for (var i
= 0; i
< inputs
.length
; i
++) {
108 if (inputs
[i
].name
== "diff" || inputs
[i
].name
== "oldid")
109 radios
[radios
.length
] = inputs
[i
];
114 // check selection and tweak visibility/class onclick
115 function diffcheck() {
116 var dli
= false; // the li where the diff radio is checked
117 var oli
= false; // the li where the oldid radio is checked
118 var hf
= document
.getElementById('pagehistory');
121 var lis
= hf
.getElementsByTagName('li');
122 for (i
=0;i
<lis
.length
;i
++) {
123 var inputs
= historyRadios(lis
[i
]);
124 if (inputs
[1] && inputs
[0]) {
125 if (inputs
[1].checked
|| inputs
[0].checked
) { // this row has a checked radio button
126 if (inputs
[1].checked
&& inputs
[0].checked
&& inputs
[0].value
== inputs
[1].value
)
128 if (oli
) { // it's the second checked radio
129 if (inputs
[1].checked
) {
130 oli
.className
= "selected";
133 } else if (inputs
[0].checked
) {
136 if (inputs
[0].checked
)
139 inputs
[0].style
.visibility
= 'hidden';
141 inputs
[1].style
.visibility
= 'hidden';
142 lis
[i
].className
= "selected";
144 } else { // no radio is checked in this row
146 inputs
[0].style
.visibility
= 'hidden';
148 inputs
[0].style
.visibility
= 'visible';
150 inputs
[1].style
.visibility
= 'hidden';
152 inputs
[1].style
.visibility
= 'visible';
153 lis
[i
].className
= "";
160 // generate toc from prefs form, fold sections
161 // XXX: needs testing on IE/Mac and safari
162 // more comments to follow
163 function tabbedprefs() {
164 var prefform
= document
.getElementById('preferences');
165 if (!prefform
|| !document
.createElement
)
167 if (prefform
.nodeName
.toLowerCase() == 'a')
168 return; // Occasional IE problem
169 prefform
.className
= prefform
.className
+ 'jsprefs';
170 var sections
= new Array();
171 var children
= prefform
.childNodes
;
173 for (var i
= 0; i
< children
.length
; i
++) {
174 if (children
[i
].nodeName
.toLowerCase() == 'fieldset') {
175 children
[i
].id
= 'prefsection-' + seci
;
176 children
[i
].className
= 'prefsection';
177 if (is_opera
|| is_khtml
)
178 children
[i
].className
= 'prefsection operaprefsection';
179 var legends
= children
[i
].getElementsByTagName('legend');
180 sections
[seci
] = new Object();
181 legends
[0].className
= 'mainLegend';
182 if (legends
[0] && legends
[0].firstChild
.nodeValue
)
183 sections
[seci
].text
= legends
[0].firstChild
.nodeValue
;
185 sections
[seci
].text
= '# ' + seci
;
186 sections
[seci
].secid
= children
[i
].id
;
188 if (sections
.length
!= 1)
189 children
[i
].style
.display
= 'none';
191 var selectedid
= children
[i
].id
;
194 var toc
= document
.createElement('ul');
196 toc
.selectedid
= selectedid
;
197 for (i
= 0; i
< sections
.length
; i
++) {
198 var li
= document
.createElement('li');
200 li
.className
= 'selected';
201 var a
= document
.createElement('a');
202 a
.href
= '#' + sections
[i
].secid
;
203 a
.onmousedown
= a
.onclick
= uncoversection
;
204 a
.appendChild(document
.createTextNode(sections
[i
].text
));
205 a
.secid
= sections
[i
].secid
;
209 prefform
.parentNode
.insertBefore(toc
, prefform
.parentNode
.childNodes
[0]);
210 document
.getElementById('prefsubmit').id
= 'prefcontrol';
213 function uncoversection() {
214 var oldsecid
= this.parentNode
.parentNode
.selectedid
;
215 var newsec
= document
.getElementById(this.secid
);
216 if (oldsecid
!= this.secid
) {
217 var ul
= document
.getElementById('preftoc');
218 document
.getElementById(oldsecid
).style
.display
= 'none';
219 newsec
.style
.display
= 'block';
220 ul
.selectedid
= this.secid
;
221 var lis
= ul
.getElementsByTagName('li');
222 for (var i
= 0; i
< lis
.length
; i
++) {
223 lis
[i
].className
= '';
225 this.parentNode
.className
= 'selected';
231 // tz in format [+-]HHMM
232 function checkTimezone(tz
, msg
) {
233 var localclock
= new Date();
234 // returns negative offset from GMT in minutes
235 var tzRaw
= localclock
.getTimezoneOffset();
236 var tzHour
= Math
.floor( Math
.abs(tzRaw
) / 60);
237 var tzMin
= Math
.abs(tzRaw
) % 60;
238 var tzString
= ((tzRaw
>= 0) ? "-" : "+") + ((tzHour
< 10) ? "0" : "") + tzHour
+ ((tzMin
< 10) ? "0" : "") + tzMin
;
239 if (tz
!= tzString
) {
240 var junk
= msg
.split('$1');
241 document
.write(junk
[0] + "UTC" + tzString
+ junk
[1]);
245 function unhidetzbutton() {
246 var tzb
= document
.getElementById('guesstimezonebutton');
248 tzb
.style
.display
= 'inline';
251 // in [-]HH:MM format...
252 // won't yet work with non-even tzs
253 function fetchTimezone() {
254 // FIXME: work around Safari bug
255 var localclock
= new Date();
256 // returns negative offset from GMT in minutes
257 var tzRaw
= localclock
.getTimezoneOffset();
258 var tzHour
= Math
.floor( Math
.abs(tzRaw
) / 60);
259 var tzMin
= Math
.abs(tzRaw
) % 60;
260 var tzString
= ((tzRaw
>= 0) ? "-" : "") + ((tzHour
< 10) ? "0" : "") + tzHour
+
261 ":" + ((tzMin
< 10) ? "0" : "") + tzMin
;
265 function guessTimezone(box
) {
266 document
.getElementsByName("wpHourDiff")[0].value
= fetchTimezone();
269 function showTocToggle() {
270 if (document
.createTextNode
) {
271 // Uses DOM calls to avoid document.write + XHTML issues
273 var linkHolder
= document
.getElementById('toctitle')
277 var outerSpan
= document
.createElement('span');
278 outerSpan
.className
= 'toctoggle';
280 var toggleLink
= document
.createElement('a');
281 toggleLink
.id
= 'togglelink';
282 toggleLink
.className
= 'internal';
283 toggleLink
.href
= 'javascript:toggleToc()';
284 toggleLink
.appendChild(document
.createTextNode(tocHideText
));
286 outerSpan
.appendChild(document
.createTextNode('['));
287 outerSpan
.appendChild(toggleLink
);
288 outerSpan
.appendChild(document
.createTextNode(']'));
290 linkHolder
.appendChild(document
.createTextNode(' '));
291 linkHolder
.appendChild(outerSpan
);
293 var cookiePos
= document
.cookie
.indexOf("hidetoc=");
294 if (cookiePos
> -1 && document
.cookie
.charAt(cookiePos
+ 8) == 1)
299 function changeText(el
, newText
) {
300 // Safari work around
302 el
.innerText
= newText
;
303 else if (el
.firstChild
&& el
.firstChild
.nodeValue
)
304 el
.firstChild
.nodeValue
= newText
;
307 function toggleToc() {
308 var toc
= document
.getElementById('toc').getElementsByTagName('ul')[0];
309 var toggleLink
= document
.getElementById('togglelink')
311 if (toc
&& toggleLink
&& toc
.style
.display
== 'none') {
312 changeText(toggleLink
, tocHideText
);
313 toc
.style
.display
= 'block';
314 document
.cookie
= "hidetoc=0";
316 changeText(toggleLink
, tocShowText
);
317 toc
.style
.display
= 'none';
318 document
.cookie
= "hidetoc=1";
322 var mwEditButtons
= [];
323 var mwCustomEditButtons
= []; // eg to add in MediaWiki:Common.js
325 // this function generates the actual toolbar buttons with localized text
326 // we use it to avoid creating the toolbar where javascript is not enabled
327 function addButton(imageFile
, speedTip
, tagOpen
, tagClose
, sampleText
) {
328 // Don't generate buttons for browsers which don't fully
330 mwEditButtons
[mwEditButtons
.length
] =
331 {"imageFile": imageFile
,
332 "speedTip": speedTip
,
334 "tagClose": tagClose
,
335 "sampleText": sampleText
};
338 // this function generates the actual toolbar buttons with localized text
339 // we use it to avoid creating the toolbar where javascript is not enabled
340 function mwInsertEditButton(parent
, item
) {
341 var image
= document
.createElement("img");
344 image
.src
= item
.imageFile
;
346 image
.alt
= item
.speedTip
;
347 image
.title
= item
.speedTip
;
348 image
.style
.cursor
= "pointer";
349 image
.onclick = function() {
350 insertTags(item
.tagOpen
, item
.tagClose
, item
.sampleText
);
354 parent
.appendChild(image
);
358 function mwSetupToolbar() {
359 var toolbar
= document
.getElementById('toolbar');
360 if (!toolbar
) return false;
362 var textbox
= document
.getElementById('wpTextbox1');
363 if (!textbox
) return false;
365 // Don't generate buttons for browsers which don't fully
367 if (!document
.selection
&& textbox
.selectionStart
== null)
370 for (var i
in mwEditButtons
) {
371 mwInsertEditButton(toolbar
, mwEditButtons
[i
]);
373 for (var i
in mwCustomEditButtons
) {
374 mwInsertEditButton(toolbar
, mwCustomEditButtons
[i
]);
379 function escapeQuotes(text
) {
380 var re
= new RegExp("'","g");
381 text
= text
.replace(re
,"\\'");
382 re
= new RegExp("\\n","g");
383 text
= text
.replace(re
,"\\n");
384 return escapeQuotesHTML(text
);
387 function escapeQuotesHTML(text
) {
388 var re
= new RegExp('&',"g");
389 text
= text
.replace(re
,"&");
390 var re
= new RegExp('"',"g");
391 text
= text
.replace(re
,""");
392 var re
= new RegExp('<',"g");
393 text
= text
.replace(re
,"<");
394 var re
= new RegExp('>',"g");
395 text
= text
.replace(re
,">");
399 // apply tagOpen/tagClose to selection in textarea,
400 // use sampleText instead of selection if there is none
401 // copied and adapted from phpBB
402 function insertTags(tagOpen
, tagClose
, sampleText
) {
403 if (document
.editform
)
404 var txtarea
= document
.editform
.wpTextbox1
;
406 // some alternate form? take the first one we can find
407 var areas
= document
.getElementsByTagName('textarea');
408 var txtarea
= areas
[0];
412 if (document
.selection
&& !is_gecko
) {
413 var theSelection
= document
.selection
.createRange().text
;
415 theSelection
=sampleText
;
417 if (theSelection
.charAt(theSelection
.length
- 1) == " ") { // exclude ending space char, if any
418 theSelection
= theSelection
.substring(0, theSelection
.length
- 1);
419 document
.selection
.createRange().text
= tagOpen
+ theSelection
+ tagClose
+ " ";
421 document
.selection
.createRange().text
= tagOpen
+ theSelection
+ tagClose
;
425 } else if(txtarea
.selectionStart
|| txtarea
.selectionStart
== '0') {
426 var replaced
= false;
427 var startPos
= txtarea
.selectionStart
;
428 var endPos
= txtarea
.selectionEnd
;
431 var scrollTop
= txtarea
.scrollTop
;
432 var myText
= (txtarea
.value
).substring(startPos
, endPos
);
435 if (myText
.charAt(myText
.length
- 1) == " ") { // exclude ending space char, if any
436 subst
= tagOpen
+ myText
.substring(0, (myText
.length
- 1)) + tagClose
+ " ";
438 subst
= tagOpen
+ myText
+ tagClose
;
440 txtarea
.value
= txtarea
.value
.substring(0, startPos
) + subst
+
441 txtarea
.value
.substring(endPos
, txtarea
.value
.length
);
445 var cPos
= startPos
+(tagOpen
.length
+myText
.length
+tagClose
.length
);
446 txtarea
.selectionStart
= cPos
;
447 txtarea
.selectionEnd
= cPos
;
449 txtarea
.selectionStart
= startPos
+tagOpen
.length
;
450 txtarea
.selectionEnd
= startPos
+tagOpen
.length
+myText
.length
;
452 txtarea
.scrollTop
= scrollTop
;
454 // All other browsers get no toolbar.
455 // There was previously support for a crippled "help"
456 // bar, but that caused more problems than it solved.
458 // reposition cursor if possible
459 if (txtarea
.createTextRange
)
460 txtarea
.caretPos
= document
.selection
.createRange().duplicate();
464 if (typeof ta
== "undefined" || !ta
)
466 if (is_safari
|| navigator
.userAgent
.toLowerCase().indexOf('mac') + 1
467 || navigator
.userAgent
.toLowerCase().indexOf('konqueror') + 1 )
477 var n
= document
.getElementById(id
);
481 // Are we putting accesskey in it
482 if (ta
[id
][0].length
> 0) {
483 // Is this object a object? If not assume it's the next child.
485 if (n
.nodeName
.toLowerCase() == "a") {
490 // Don't add an accesskey for the watch tab if the watch
491 // checkbox is also available.
492 if (a
&& ((id
!= 'ca-watch' && id
!= 'ca-unwatch') ||
493 !(window
.location
.search
.match(/[\?&](action=edit|action=submit)/i)))) {
494 a
.accessKey
= ta
[id
][0];
495 ak
= ' ['+pref
+ta
[id
][0]+']';
498 // We don't care what type the object is when assigning tooltip
504 a
.title
= ta
[id
][1]+ak
;
510 function setupRightClickEdit() {
511 if (document
.getElementsByTagName
) {
512 var spans
= document
.getElementsByTagName('span');
513 for (var i
= 0; i
< spans
.length
; i
++) {
515 if(el
.className
== 'editsection') {
516 addRightClickEditHandler(el
);
522 function addRightClickEditHandler(el
) {
523 for (var i
= 0; i
< el
.childNodes
.length
; i
++) {
524 var link
= el
.childNodes
[i
];
525 if (link
.nodeType
== 1 && link
.nodeName
.toLowerCase() == 'a') {
526 var editHref
= link
.getAttribute('href');
527 // find the enclosing (parent) header
528 var prev
= el
.parentNode
;
529 if (prev
&& prev
.nodeType
== 1 &&
530 prev
.nodeName
.match(/^[Hh][1-6]$/)) {
531 prev
.oncontextmenu = function(e
) {
532 if (!e
) e
= window
.event
;
533 // e is now the event in all browsers
534 if (e
.target
) var targ
= e
.target
;
535 else if (e
.srcElement
) var targ
= e
.srcElement
;
536 if (targ
.nodeType
== 3) // defeat Safari bug
537 targ
= targ
.parentNode
;
538 // targ is now the target element
540 // We don't want to deprive the noble reader of a context menu
541 // for the section edit link, do we? (Might want to extend this
543 if (targ
.nodeName
.toLowerCase() != 'a'
544 || targ
.parentNode
.className
!= 'editsection') {
545 document
.location
= editHref
;
554 function addRightClickEditHandler(el) {
555 // find the enclosing (parent) header
556 var par = el.parentNode;
557 if (par && par.nodeType == 1 && par.nodeName.match(/^[Hh][1-6]$/)) {
558 par.oncontextmenu = function(e) {
559 if (!e) var e = window.event;
560 // e is now the event in all browsers
561 if (e.target) targ = e.target;
562 else if (e.srcElement) targ = e.srcElement;
563 if (targ.nodeType == 3) // defeat Safari bug
564 targ = targ.parentNode;
565 // targ is now the target element
566 // We don't want to deprive the noble reader of a context menu
567 // for the section edit link, do we? (Might want to extend this
568 // to all <a>'s.)links
569 if (targ.className != 'editsection') {
570 document.location = editHref;
578 function setupCheckboxShiftClick() {
579 if (document
.getElementsByTagName
) {
580 var uls
= document
.getElementsByTagName('ul');
581 var len
= uls
.length
;
582 for (var i
= 0; i
< len
; ++i
) {
583 addCheckboxClickHandlers(uls
[i
]);
588 function addCheckboxClickHandlers(ul
, start
, finish
) {
589 if (ul
.checkboxHandlersTimer
) {
590 clearInterval(ul
.checkboxHandlersTimer
);
592 if ( !ul
.childNodes
) {
595 var len
= ul
.childNodes
.length
;
600 finish
= finish
|| start
+ 250;
601 if ( finish
> len
) { finish
= len
; }
602 ul
.checkboxes
= ul
.checkboxes
|| [];
603 ul
.lastCheckbox
= ul
.lastCheckbox
|| null;
604 for (var i
= start
; i
<finish
; ++i
) {
605 var child
= ul
.childNodes
[i
];
606 if ( child
&& child
.childNodes
&& child
.childNodes
[0] ) {
607 var cb
= child
.childNodes
[0];
608 if ( !cb
.nodeName
|| cb
.nodeName
.toLowerCase() != 'input' ||
609 !cb
.type
|| cb
.type
.toLowerCase() != 'checkbox' ) {
612 cb
.index
= ul
.checkboxes
.push(cb
) - 1;
614 cb
.onmouseup
= checkboxMouseupHandler
;
618 var f=function(){ addCheckboxClickHandlers(ul
, finish
, finish
+250); };
619 ul
.checkboxHandlersTimer
=setInterval(f
, 200);
623 function checkboxMouseupHandler(e
) {
624 if (typeof e
== 'undefined') {
627 if ( !e
.shiftKey
|| this.container
.lastCheckbox
=== null ) {
628 this.container
.lastCheckbox
= this.index
;
631 var endState
= !this.checked
;
632 if ( is_opera
) { // opera has already toggled the checkbox by this point
633 endState
= !endState
;
636 if ( this.index
< this.container
.lastCheckbox
) {
637 start
= this.index
+ 1;
638 finish
= this.container
.lastCheckbox
;
640 start
= this.container
.lastCheckbox
;
641 finish
= this.index
- 1;
643 for (var i
= start
; i
<= finish
; ++i
) {
644 this.container
.checkboxes
[i
].checked
= endState
;
646 this.container
.lastCheckbox
= this.index
;
650 function toggle_element_activation(ida
,idb
) {
651 if (!document
.getElementById
)
653 document
.getElementById(ida
).disabled
=true;
654 document
.getElementById(idb
).disabled
=false;
657 function toggle_element_check(ida
,idb
) {
658 if (!document
.getElementById
)
660 document
.getElementById(ida
).checked
=true;
661 document
.getElementById(idb
).checked
=false;
664 function fillDestFilename(id
) {
665 if (!document
.getElementById
)
667 var path
= document
.getElementById(id
).value
;
668 // Find trailing part
669 var slash
= path
.lastIndexOf('/');
670 var backslash
= path
.lastIndexOf('\\');
672 if (slash
== -1 && backslash
== -1) {
674 } else if (slash
> backslash
) {
675 fname
= path
.substring(slash
+1, 10000);
677 fname
= path
.substring(backslash
+1, 10000);
680 // Capitalise first letter and replace spaces by underscores
681 fname
= fname
.charAt(0).toUpperCase().concat(fname
.substring(1,10000)).replace(/ /g
, '_');
684 var destFile
= document
.getElementById('wpDestFile');
686 destFile
.value
= fname
;
690 function considerChangingExpiryFocus() {
691 if (!document
.getElementById
)
693 var drop
= document
.getElementById('wpBlockExpiry');
696 var field
= document
.getElementById('wpBlockOther');
699 var opt
= drop
.value
;
701 field
.style
.display
= '';
703 field
.style
.display
= 'none';
706 function scrollEditBox() {
707 var editBoxEl
= document
.getElementById("wpTextbox1");
708 var scrollTopEl
= document
.getElementById("wpScrolltop");
709 var editFormEl
= document
.getElementById("editform");
711 if (editBoxEl
&& scrollTopEl
) {
712 if (scrollTopEl
.value
) editBoxEl
.scrollTop
= scrollTopEl
.value
;
713 editFormEl
.onsubmit = function() {
714 document
.getElementById("wpScrolltop").value
= document
.getElementById("wpTextbox1").scrollTop
;
719 hookEvent("load", scrollEditBox
);
721 function allmessagesfilter() {
722 text
= document
.getElementById('allmessagesinput').value
;
723 k
= document
.getElementById('allmessagestable');
726 var items
= k
.getElementsByTagName('span');
728 if ( text
.length
> allmessages_prev
.length
) {
729 for (var i
= items
.length
-1, j
= 0; i
>= 0; i
--) {
730 j
= allmessagesforeach(items
, i
, j
);
733 for (var i
= 0, j
= 0; i
< items
.length
; i
++) {
734 j
= allmessagesforeach(items
, i
, j
);
737 allmessages_prev
= text
;
740 function allmessagesforeach(items
, i
, j
) {
741 var hItem
= items
[i
].getAttribute('id');
742 if (hItem
.substring(0,17) == 'sp-allmessages-i-') {
743 if (items
[i
].firstChild
&& items
[i
].firstChild
.nodeName
== '#text' && items
[i
].firstChild
.nodeValue
.indexOf(text
) != -1) {
744 var itemA
= document
.getElementById( hItem
.replace('i', 'r1') );
745 var itemB
= document
.getElementById( hItem
.replace('i', 'r2') );
746 if ( itemA
.style
.display
!= '' ) {
747 var s
= "allmessageshider(\"" + hItem
.replace('i', 'r1') + "\", \"" + hItem
.replace('i', 'r2') + "\", '')";
748 var k
= window
.setTimeout(s
,j
++*5);
751 var itemA
= document
.getElementById( hItem
.replace('i', 'r1') );
752 var itemB
= document
.getElementById( hItem
.replace('i', 'r2') );
753 if ( itemA
.style
.display
!= 'none' ) {
754 var s
= "allmessageshider(\"" + hItem
.replace('i', 'r1') + "\", \"" + hItem
.replace('i', 'r2') + "\", 'none')";
755 var k
= window
.setTimeout(s
,j
++*5);
763 function allmessageshider(idA
, idB
, cstyle
) {
764 var itemA
= document
.getElementById( idA
);
765 var itemB
= document
.getElementById( idB
);
766 if (itemA
) { itemA
.style
.display
= cstyle
; }
767 if (itemB
) { itemB
.style
.display
= cstyle
; }
770 function allmessagesmodified() {
771 allmessages_modified
= !allmessages_modified
;
772 k
= document
.getElementById('allmessagestable');
774 var items
= k
.getElementsByTagName('tr');
775 for (var i
= 0, j
= 0; i
< items
.length
; i
++) {
776 if (!allmessages_modified
) {
777 if ( items
[i
].style
.display
!= '' ) {
778 var s
= "allmessageshider(\"" + items
[i
].getAttribute('id') + "\", null, '')";
779 var k
= window
.setTimeout(s
,j
++*5);
781 } else if (items
[i
].getAttribute('class') == 'def' && allmessages_modified
) {
782 if ( items
[i
].style
.display
!= 'none' ) {
783 var s
= "allmessageshider(\"" + items
[i
].getAttribute('id') + "\", null, 'none')";
784 var k
= window
.setTimeout(s
,j
++*5);
790 function allmessagesshow() {
791 k
= document
.getElementById('allmessagesfilter');
792 if (k
) { k
.style
.display
= ''; }
794 allmessages_prev
= '';
795 allmessages_modified
= false;
798 hookEvent("load", allmessagesshow
);
799 hookEvent("load", mwSetupToolbar
);