65451ab9e641638ca69eec5ce8e94f959d33008d
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 if (clientPC
.indexOf('opera') != -1) {
10 var is_opera_preseven
= (window
.opera
&& !document
.childNodes
);
11 var is_opera_seven
= (window
.opera
&& document
.childNodes
);
14 // add any onload functions in this hook (please don't hard-code any events in the xhtml source)
18 if (!window
.onloadFuncts
)
19 var onloadFuncts
= [];
21 function addOnloadHook(hookFunct
) {
22 // Allows add-on scripts to add onload functions
23 onloadFuncts
[onloadFuncts
.length
] = hookFunct
;
26 function runOnloadHook() {
27 // don't run anything below this for non-dom browsers
28 if (doneOnloadHook
|| !(document
.getElementById
&& document
.getElementsByTagName
))
36 setupCheckboxShiftClick();
38 // Run any added-on functions
39 for (var i
= 0; i
< onloadFuncts
.length
; i
++)
42 doneOnloadHook
= true;
45 function hookEvent(hookName
, hookFunct
) {
46 if (window
.addEventListener
)
47 addEventListener(hookName
, hookFunct
, false);
48 else if (window
.attachEvent
)
49 attachEvent("on" + hookName
, hookFunct
);
52 //note: all skins shoud call runOnloadHook() at the end of html output,
53 // so the below should be redundant. It's there just in case.
54 hookEvent("load", runOnloadHook
);
56 // document.write special stylesheet links
57 if (typeof stylepath
!= 'undefined' && typeof skin
!= 'undefined') {
58 if (is_opera_preseven
) {
59 document
.write('<link rel="stylesheet" type="text/css" href="'+stylepath
+'/'+skin
+'/Opera6Fixes.css">');
60 } else if (is_opera_seven
) {
61 document
.write('<link rel="stylesheet" type="text/css" href="'+stylepath
+'/'+skin
+'/Opera7Fixes.css">');
62 } else if (is_khtml
) {
63 document
.write('<link rel="stylesheet" type="text/css" href="'+stylepath
+'/'+skin
+'/KHTMLFixes.css">');
66 // Un-trap us from framesets
67 if (window
.top
!= window
)
68 window
.top
.location
= window
.location
;
70 // for enhanced RecentChanges
71 function toggleVisibility(_levelId
, _otherId
, _linkId
) {
72 var thisLevel
= document
.getElementById(_levelId
);
73 var otherLevel
= document
.getElementById(_otherId
);
74 var linkLevel
= document
.getElementById(_linkId
);
75 if (thisLevel
.style
.display
== 'none') {
76 thisLevel
.style
.display
= 'block';
77 otherLevel
.style
.display
= 'none';
78 linkLevel
.style
.display
= 'inline';
80 thisLevel
.style
.display
= 'none';
81 otherLevel
.style
.display
= 'inline';
82 linkLevel
.style
.display
= 'none';
87 // attach event handlers to the input elements on history page
88 function histrowinit() {
89 var hf
= document
.getElementById('pagehistory');
92 var lis
= hf
.getElementsByTagName('li');
93 for (var i
= 0; i
< lis
.length
; i
++) {
94 var inputs
= historyRadios(lis
[i
]);
95 if (inputs
[0] && inputs
[1]) {
96 inputs
[0].onclick
= diffcheck
;
97 inputs
[1].onclick
= diffcheck
;
103 function historyRadios(parent
) {
104 var inputs
= parent
.getElementsByTagName('input');
106 for (var i
= 0; i
< inputs
.length
; i
++) {
107 if (inputs
[i
].name
== "diff" || inputs
[i
].name
== "oldid")
108 radios
[radios
.length
] = inputs
[i
];
113 // check selection and tweak visibility/class onclick
114 function diffcheck() {
115 var dli
= false; // the li where the diff radio is checked
116 var oli
= false; // the li where the oldid radio is checked
117 var hf
= document
.getElementById('pagehistory');
120 var lis
= hf
.getElementsByTagName('li');
121 for (i
=0;i
<lis
.length
;i
++) {
122 var inputs
= historyRadios(lis
[i
]);
123 if (inputs
[1] && inputs
[0]) {
124 if (inputs
[1].checked
|| inputs
[0].checked
) { // this row has a checked radio button
125 if (inputs
[1].checked
&& inputs
[0].checked
&& inputs
[0].value
== inputs
[1].value
)
127 if (oli
) { // it's the second checked radio
128 if (inputs
[1].checked
) {
129 oli
.className
= "selected";
132 } else if (inputs
[0].checked
) {
135 if (inputs
[0].checked
)
138 inputs
[0].style
.visibility
= 'hidden';
140 inputs
[1].style
.visibility
= 'hidden';
141 lis
[i
].className
= "selected";
143 } else { // no radio is checked in this row
145 inputs
[0].style
.visibility
= 'hidden';
147 inputs
[0].style
.visibility
= 'visible';
149 inputs
[1].style
.visibility
= 'hidden';
151 inputs
[1].style
.visibility
= 'visible';
152 lis
[i
].className
= "";
159 // generate toc from prefs form, fold sections
160 // XXX: needs testing on IE/Mac and safari
161 // more comments to follow
162 function tabbedprefs() {
163 var prefform
= document
.getElementById('preferences');
164 if (!prefform
|| !document
.createElement
)
166 if (prefform
.nodeName
.toLowerCase() == 'a')
167 return; // Occasional IE problem
168 prefform
.className
= prefform
.className
+ 'jsprefs';
169 var sections
= new Array();
170 var children
= prefform
.childNodes
;
172 for (var i
= 0; i
< children
.length
; i
++) {
173 if (children
[i
].nodeName
.toLowerCase() == 'fieldset') {
174 children
[i
].id
= 'prefsection-' + seci
;
175 children
[i
].className
= 'prefsection';
176 if (is_opera
|| is_khtml
)
177 children
[i
].className
= 'prefsection operaprefsection';
178 var legends
= children
[i
].getElementsByTagName('legend');
179 sections
[seci
] = new Object();
180 legends
[0].className
= 'mainLegend';
181 if (legends
[0] && legends
[0].firstChild
.nodeValue
)
182 sections
[seci
].text
= legends
[0].firstChild
.nodeValue
;
184 sections
[seci
].text
= '# ' + seci
;
185 sections
[seci
].secid
= children
[i
].id
;
187 if (sections
.length
!= 1)
188 children
[i
].style
.display
= 'none';
190 var selectedid
= children
[i
].id
;
193 var toc
= document
.createElement('ul');
195 toc
.selectedid
= selectedid
;
196 for (i
= 0; i
< sections
.length
; i
++) {
197 var li
= document
.createElement('li');
199 li
.className
= 'selected';
200 var a
= document
.createElement('a');
201 a
.href
= '#' + sections
[i
].secid
;
202 a
.onmousedown
= a
.onclick
= uncoversection
;
203 a
.appendChild(document
.createTextNode(sections
[i
].text
));
204 a
.secid
= sections
[i
].secid
;
208 prefform
.parentNode
.insertBefore(toc
, prefform
.parentNode
.childNodes
[0]);
209 document
.getElementById('prefsubmit').id
= 'prefcontrol';
212 function uncoversection() {
213 var oldsecid
= this.parentNode
.parentNode
.selectedid
;
214 var newsec
= document
.getElementById(this.secid
);
215 if (oldsecid
!= this.secid
) {
216 var ul
= document
.getElementById('preftoc');
217 document
.getElementById(oldsecid
).style
.display
= 'none';
218 newsec
.style
.display
= 'block';
219 ul
.selectedid
= this.secid
;
220 var lis
= ul
.getElementsByTagName('li');
221 for (var i
= 0; i
< lis
.length
; i
++) {
222 lis
[i
].className
= '';
224 this.parentNode
.className
= 'selected';
230 // tz in format [+-]HHMM
231 function checkTimezone(tz
, msg
) {
232 var localclock
= new Date();
233 // returns negative offset from GMT in minutes
234 var tzRaw
= localclock
.getTimezoneOffset();
235 var tzHour
= Math
.floor( Math
.abs(tzRaw
) / 60);
236 var tzMin
= Math
.abs(tzRaw
) % 60;
237 var tzString
= ((tzRaw
>= 0) ? "-" : "+") + ((tzHour
< 10) ? "0" : "") + tzHour
+ ((tzMin
< 10) ? "0" : "") + tzMin
;
238 if (tz
!= tzString
) {
239 var junk
= msg
.split('$1');
240 document
.write(junk
[0] + "UTC" + tzString
+ junk
[1]);
244 function unhidetzbutton() {
245 var tzb
= document
.getElementById('guesstimezonebutton');
247 tzb
.style
.display
= 'inline';
250 // in [-]HH:MM format...
251 // won't yet work with non-even tzs
252 function fetchTimezone() {
253 // FIXME: work around Safari bug
254 var localclock
= new Date();
255 // returns negative offset from GMT in minutes
256 var tzRaw
= localclock
.getTimezoneOffset();
257 var tzHour
= Math
.floor( Math
.abs(tzRaw
) / 60);
258 var tzMin
= Math
.abs(tzRaw
) % 60;
259 var tzString
= ((tzRaw
>= 0) ? "-" : "") + ((tzHour
< 10) ? "0" : "") + tzHour
+
260 ":" + ((tzMin
< 10) ? "0" : "") + tzMin
;
264 function guessTimezone(box
) {
265 document
.getElementsByName("wpHourDiff")[0].value
= fetchTimezone();
268 function showTocToggle() {
269 if (document
.createTextNode
) {
270 // Uses DOM calls to avoid document.write + XHTML issues
272 var linkHolder
= document
.getElementById('toctitle')
276 var outerSpan
= document
.createElement('span');
277 outerSpan
.className
= 'toctoggle';
279 var toggleLink
= document
.createElement('a');
280 toggleLink
.id
= 'togglelink';
281 toggleLink
.className
= 'internal';
282 toggleLink
.href
= 'javascript:toggleToc()';
283 toggleLink
.appendChild(document
.createTextNode(tocHideText
));
285 outerSpan
.appendChild(document
.createTextNode('['));
286 outerSpan
.appendChild(toggleLink
);
287 outerSpan
.appendChild(document
.createTextNode(']'));
289 linkHolder
.appendChild(document
.createTextNode(' '));
290 linkHolder
.appendChild(outerSpan
);
292 var cookiePos
= document
.cookie
.indexOf("hidetoc=");
293 if (cookiePos
> -1 && document
.cookie
.charAt(cookiePos
+ 8) == 1)
298 function changeText(el
, newText
) {
299 // Safari work around
301 el
.innerText
= newText
;
302 else if (el
.firstChild
&& el
.firstChild
.nodeValue
)
303 el
.firstChild
.nodeValue
= newText
;
306 function toggleToc() {
307 var toc
= document
.getElementById('toc').getElementsByTagName('ul')[0];
308 var toggleLink
= document
.getElementById('togglelink')
310 if (toc
&& toggleLink
&& toc
.style
.display
== 'none') {
311 changeText(toggleLink
, tocHideText
);
312 toc
.style
.display
= 'block';
313 document
.cookie
= "hidetoc=0";
315 changeText(toggleLink
, tocShowText
);
316 toc
.style
.display
= 'none';
317 document
.cookie
= "hidetoc=1";
321 var mwEditButtons
= [];
322 var mwCustomEditButtons
= []; // eg to add in MediaWiki:Common.js
324 // this function generates the actual toolbar buttons with localized text
325 // we use it to avoid creating the toolbar where javascript is not enabled
326 function addButton(imageFile
, speedTip
, tagOpen
, tagClose
, sampleText
) {
327 // Don't generate buttons for browsers which don't fully
329 mwEditButtons
[mwEditButtons
.length
] =
330 {"imageFile": imageFile
,
331 "speedTip": speedTip
,
333 "tagClose": tagClose
,
334 "sampleText": sampleText
};
337 // this function generates the actual toolbar buttons with localized text
338 // we use it to avoid creating the toolbar where javascript is not enabled
339 function mwInsertEditButton(parent
, item
) {
340 var image
= document
.createElement("img");
343 image
.src
= item
.imageFile
;
345 image
.alt
= item
.speedTip
;
346 image
.title
= item
.speedTip
;
347 image
.style
.cursor
= "pointer";
348 image
.onclick = function() {
349 insertTags(item
.tagOpen
, item
.tagClose
, item
.sampleText
);
353 parent
.appendChild(image
);
357 function mwSetupToolbar() {
358 var toolbar
= document
.getElementById('toolbar');
359 if (!toolbar
) return false;
361 var textbox
= document
.getElementById('wpTextbox1');
362 if (!textbox
) return false;
364 // Don't generate buttons for browsers which don't fully
366 if (!document
.selection
&& textbox
.selectionStart
== null)
369 for (var i
in mwEditButtons
) {
370 mwInsertEditButton(toolbar
, mwEditButtons
[i
]);
372 for (var i
in mwCustomEditButtons
) {
373 mwInsertEditButton(toolbar
, mwCustomEditButtons
[i
]);
378 function escapeQuotes(text
) {
379 var re
= new RegExp("'","g");
380 text
= text
.replace(re
,"\\'");
381 re
= new RegExp("\\n","g");
382 text
= text
.replace(re
,"\\n");
383 return escapeQuotesHTML(text
);
386 function escapeQuotesHTML(text
) {
387 var re
= new RegExp('&',"g");
388 text
= text
.replace(re
,"&");
389 var re
= new RegExp('"',"g");
390 text
= text
.replace(re
,""");
391 var re
= new RegExp('<',"g");
392 text
= text
.replace(re
,"<");
393 var re
= new RegExp('>',"g");
394 text
= text
.replace(re
,">");
398 // apply tagOpen/tagClose to selection in textarea,
399 // use sampleText instead of selection if there is none
400 // copied and adapted from phpBB
401 function insertTags(tagOpen
, tagClose
, sampleText
) {
402 if (document
.editform
)
403 var txtarea
= document
.editform
.wpTextbox1
;
405 // some alternate form? take the first one we can find
406 var areas
= document
.getElementsByTagName('textarea');
407 var txtarea
= areas
[0];
411 if (document
.selection
&& !is_gecko
) {
412 var theSelection
= document
.selection
.createRange().text
;
414 theSelection
=sampleText
;
416 if (theSelection
.charAt(theSelection
.length
- 1) == " ") { // exclude ending space char, if any
417 theSelection
= theSelection
.substring(0, theSelection
.length
- 1);
418 document
.selection
.createRange().text
= tagOpen
+ theSelection
+ tagClose
+ " ";
420 document
.selection
.createRange().text
= tagOpen
+ theSelection
+ tagClose
;
424 } else if(txtarea
.selectionStart
|| txtarea
.selectionStart
== '0') {
425 var replaced
= false;
426 var startPos
= txtarea
.selectionStart
;
427 var endPos
= txtarea
.selectionEnd
;
430 var scrollTop
= txtarea
.scrollTop
;
431 var myText
= (txtarea
.value
).substring(startPos
, endPos
);
434 if (myText
.charAt(myText
.length
- 1) == " ") { // exclude ending space char, if any
435 subst
= tagOpen
+ myText
.substring(0, (myText
.length
- 1)) + tagClose
+ " ";
437 subst
= tagOpen
+ myText
+ tagClose
;
439 txtarea
.value
= txtarea
.value
.substring(0, startPos
) + subst
+
440 txtarea
.value
.substring(endPos
, txtarea
.value
.length
);
444 var cPos
= startPos
+(tagOpen
.length
+myText
.length
+tagClose
.length
);
445 txtarea
.selectionStart
= cPos
;
446 txtarea
.selectionEnd
= cPos
;
448 txtarea
.selectionStart
= startPos
+tagOpen
.length
;
449 txtarea
.selectionEnd
= startPos
+tagOpen
.length
+myText
.length
;
451 txtarea
.scrollTop
= scrollTop
;
453 // All other browsers get no toolbar.
454 // There was previously support for a crippled "help"
455 // bar, but that caused more problems than it solved.
457 // reposition cursor if possible
458 if (txtarea
.createTextRange
)
459 txtarea
.caretPos
= document
.selection
.createRange().duplicate();
463 if (typeof ta
== "undefined" || !ta
)
466 if (is_safari
|| navigator
.userAgent
.toLowerCase().indexOf('mac') + 1
467 || navigator
.userAgent
.toLowerCase().indexOf('konqueror') + 1 )
473 var n
= document
.getElementById(id
);
477 // Are we putting accesskey in it
478 if (ta
[id
][0].length
> 0) {
479 // Is this object a object? If not assume it's the next child.
481 if (n
.nodeName
.toLowerCase() == "a") {
488 a
.accessKey
= ta
[id
][0];
489 ak
= ' ['+pref
+ta
[id
][0]+']';
492 // We don't care what type the object is when assigning tooltip
498 a
.title
= ta
[id
][1]+ak
;
504 function setupRightClickEdit() {
505 if (document
.getElementsByTagName
) {
506 var spans
= document
.getElementsByTagName('span');
507 for (var i
= 0; i
< spans
.length
; i
++) {
509 if(el
.className
== 'editsection') {
510 addRightClickEditHandler(el
);
516 function addRightClickEditHandler(el
) {
517 for (var i
= 0; i
< el
.childNodes
.length
; i
++) {
518 var link
= el
.childNodes
[i
];
519 if (link
.nodeType
== 1 && link
.nodeName
.toLowerCase() == 'a') {
520 var editHref
= link
.getAttribute('href');
521 // find the enclosing (parent) header
522 var prev
= el
.parentNode
;
523 if (prev
&& prev
.nodeType
== 1 &&
524 prev
.nodeName
.match(/^[Hh][1-6]$/)) {
525 prev
.oncontextmenu = function(e
) {
526 if (!e
) e
= window
.event
;
527 // e is now the event in all browsers
528 if (e
.target
) var targ
= e
.target
;
529 else if (e
.srcElement
) var targ
= e
.srcElement
;
530 if (targ
.nodeType
== 3) // defeat Safari bug
531 targ
= targ
.parentNode
;
532 // targ is now the target element
534 // We don't want to deprive the noble reader of a context menu
535 // for the section edit link, do we? (Might want to extend this
537 if (targ
.nodeName
.toLowerCase() != 'a'
538 || targ
.parentNode
.className
!= 'editsection') {
539 document
.location
= editHref
;
548 function addRightClickEditHandler(el) {
549 // find the enclosing (parent) header
550 var par = el.parentNode;
551 if (par && par.nodeType == 1 && par.nodeName.match(/^[Hh][1-6]$/)) {
552 par.oncontextmenu = function(e) {
553 if (!e) var e = window.event;
554 // e is now the event in all browsers
555 if (e.target) targ = e.target;
556 else if (e.srcElement) targ = e.srcElement;
557 if (targ.nodeType == 3) // defeat Safari bug
558 targ = targ.parentNode;
559 // targ is now the target element
560 // We don't want to deprive the noble reader of a context menu
561 // for the section edit link, do we? (Might want to extend this
562 // to all <a>'s.)links
563 if (targ.className != 'editsection') {
564 document.location = editHref;
572 function setupCheckboxShiftClick() {
573 if (document
.getElementsByTagName
) {
574 var uls
= document
.getElementsByTagName('ul');
575 var len
= uls
.length
;
576 for (var i
= 0; i
< len
; ++i
) {
577 addCheckboxClickHandlers(uls
[i
]);
582 function addCheckboxClickHandlers(ul
, start
, finish
) {
583 if (ul
.checkboxHandlersTimer
) {
584 clearInterval(ul
.checkboxHandlersTimer
);
586 if ( !ul
.childNodes
) {
589 var len
= ul
.childNodes
.length
;
594 finish
= finish
|| start
+ 250;
595 if ( finish
> len
) { finish
= len
; }
596 ul
.checkboxes
= ul
.checkboxes
|| [];
597 ul
.lastCheckbox
= ul
.lastCheckbox
|| null;
598 for (var i
= start
; i
<finish
; ++i
) {
599 var child
= ul
.childNodes
[i
];
600 if ( child
&& child
.childNodes
&& child
.childNodes
[0] ) {
601 var cb
= child
.childNodes
[0];
602 if ( !cb
.nodeName
|| cb
.nodeName
.toLowerCase() != 'input' ||
603 !cb
.type
|| cb
.type
.toLowerCase() != 'checkbox' ) {
606 cb
.index
= ul
.checkboxes
.push(cb
) - 1;
608 cb
.onmouseup
= checkboxMouseupHandler
;
612 var f=function(){ addCheckboxClickHandlers(ul
, finish
, finish
+250); };
613 ul
.checkboxHandlersTimer
=setInterval(f
, 200);
617 function checkboxMouseupHandler(e
) {
618 if (typeof e
== 'undefined') {
621 if ( !e
.shiftKey
|| this.container
.lastCheckbox
=== null ) {
622 this.container
.lastCheckbox
= this.index
;
625 var endState
= !this.checked
;
626 if ( is_opera
) { // opera has already toggled the checkbox by this point
627 endState
= !endState
;
630 if ( this.index
< this.container
.lastCheckbox
) {
631 start
= this.index
+ 1;
632 finish
= this.container
.lastCheckbox
;
634 start
= this.container
.lastCheckbox
;
635 finish
= this.index
- 1;
637 for (var i
= start
; i
<= finish
; ++i
) {
638 this.container
.checkboxes
[i
].checked
= endState
;
640 this.container
.lastCheckbox
= this.index
;
644 function toggle_element_activation(ida
,idb
) {
645 if (!document
.getElementById
)
647 document
.getElementById(ida
).disabled
=true;
648 document
.getElementById(idb
).disabled
=false;
651 function toggle_element_check(ida
,idb
) {
652 if (!document
.getElementById
)
654 document
.getElementById(ida
).checked
=true;
655 document
.getElementById(idb
).checked
=false;
658 function fillDestFilename(id
) {
659 if (!document
.getElementById
)
661 var path
= document
.getElementById(id
).value
;
662 // Find trailing part
663 var slash
= path
.lastIndexOf('/');
664 var backslash
= path
.lastIndexOf('\\');
666 if (slash
== -1 && backslash
== -1) {
668 } else if (slash
> backslash
) {
669 fname
= path
.substring(slash
+1, 10000);
671 fname
= path
.substring(backslash
+1, 10000);
674 // Capitalise first letter and replace spaces by underscores
675 fname
= fname
.charAt(0).toUpperCase().concat(fname
.substring(1,10000)).replace(/ /g
, '_');
678 var destFile
= document
.getElementById('wpDestFile');
680 destFile
.value
= fname
;
684 function considerChangingExpiryFocus() {
685 if (!document
.getElementById
)
687 var drop
= document
.getElementById('wpBlockExpiry');
690 var field
= document
.getElementById('wpBlockOther');
693 var opt
= drop
.value
;
695 field
.style
.display
= '';
697 field
.style
.display
= 'none';
700 function scrollEditBox() {
701 var editBoxEl
= document
.getElementById("wpTextbox1");
702 var scrollTopEl
= document
.getElementById("wpScrolltop");
703 var editFormEl
= document
.getElementById("editform");
705 if (editBoxEl
&& scrollTopEl
) {
706 if (scrollTopEl
.value
) editBoxEl
.scrollTop
= scrollTopEl
.value
;
707 editFormEl
.onsubmit = function() {
708 document
.getElementById("wpScrolltop").value
= document
.getElementById("wpTextbox1").scrollTop
;
713 hookEvent("load", scrollEditBox
);
715 function allmessagesfilter() {
716 text
= document
.getElementById('allmessagesinput').value
;
717 k
= document
.getElementById('allmessagestable');
720 var items
= k
.getElementsByTagName('span');
722 if ( text
.length
> allmessages_prev
.length
) {
723 for (var i
= items
.length
-1, j
= 0; i
>= 0; i
--) {
724 j
= allmessagesforeach(items
, i
, j
);
727 for (var i
= 0, j
= 0; i
< items
.length
; i
++) {
728 j
= allmessagesforeach(items
, i
, j
);
731 allmessages_prev
= text
;
734 function allmessagesforeach(items
, i
, j
) {
735 var hItem
= items
[i
].getAttribute('id');
736 if (hItem
.substring(0,17) == 'sp-allmessages-i-') {
737 if (items
[i
].firstChild
&& items
[i
].firstChild
.nodeName
== '#text' && items
[i
].firstChild
.nodeValue
.indexOf(text
) != -1) {
738 var itemA
= document
.getElementById( hItem
.replace('i', 'r1') );
739 var itemB
= document
.getElementById( hItem
.replace('i', 'r2') );
740 if ( itemA
.style
.display
!= '' ) {
741 var s
= "allmessageshider(\"" + hItem
.replace('i', 'r1') + "\", \"" + hItem
.replace('i', 'r2') + "\", '')";
742 var k
= window
.setTimeout(s
,j
++*5);
745 var itemA
= document
.getElementById( hItem
.replace('i', 'r1') );
746 var itemB
= document
.getElementById( hItem
.replace('i', 'r2') );
747 if ( itemA
.style
.display
!= 'none' ) {
748 var s
= "allmessageshider(\"" + hItem
.replace('i', 'r1') + "\", \"" + hItem
.replace('i', 'r2') + "\", 'none')";
749 var k
= window
.setTimeout(s
,j
++*5);
757 function allmessageshider(idA
, idB
, cstyle
) {
758 var itemA
= document
.getElementById( idA
);
759 var itemB
= document
.getElementById( idB
);
760 if (itemA
) { itemA
.style
.display
= cstyle
; }
761 if (itemB
) { itemB
.style
.display
= cstyle
; }
764 function allmessagesmodified() {
765 allmessages_modified
= !allmessages_modified
;
766 k
= document
.getElementById('allmessagestable');
768 var items
= k
.getElementsByTagName('tr');
769 for (var i
= 0, j
= 0; i
< items
.length
; i
++) {
770 if (!allmessages_modified
) {
771 if ( items
[i
].style
.display
!= '' ) {
772 var s
= "allmessageshider(\"" + items
[i
].getAttribute('id') + "\", null, '')";
773 var k
= window
.setTimeout(s
,j
++*5);
775 } else if (items
[i
].getAttribute('class') == 'def' && allmessages_modified
) {
776 if ( items
[i
].style
.display
!= 'none' ) {
777 var s
= "allmessageshider(\"" + items
[i
].getAttribute('id') + "\", null, 'none')";
778 var k
= window
.setTimeout(s
,j
++*5);
784 function allmessagesshow() {
785 k
= document
.getElementById('allmessagesfilter');
786 if (k
) { k
.style
.display
= ''; }
788 allmessages_prev
= '';
789 allmessages_modified
= false;
792 hookEvent("load", allmessagesshow
);
793 hookEvent("load", mwSetupToolbar
);