1 var sajax_debug_mode
= false;
3 var ShowEditorsCounting
= false;
4 var wgAjaxShowEditors
= {} ;
6 // The loader. Look at bottom for the sajax hook registration
7 wgAjaxShowEditors
.onLoad = function() {
8 var elEditors
= document
.getElementById( 'ajax-se' );
9 // wgAjaxShowEditors.refresh();
10 elEditors
.onclick = function() { wgAjaxShowEditors
.refresh(); } ;
12 var elTextArea
= document
.getElementById( 'wpTextbox1' );
13 elTextArea
.onkeypress = function() { wgAjaxShowEditors
.refresh(); } ;
15 wgAjaxShowEditors
.allowRefresh();
19 // Ask for new data & update UI
20 wgAjaxShowEditors
.refresh = function() {
21 if( !canRefresh
) { return; }
23 // Disable new requests for 5 seconds
25 setTimeout( 'wgAjaxShowEditors.allowRefresh()', 5000 );
27 // Load the editors list element, it will get rewrote
28 var elEditorsList
= document
.getElementById( 'ajax-se-editors' );
30 if( wgUserName
== null ) {
34 // Do the ajax call to the server
35 sajax_do_call( "wfAjaxShowEditors", [ wgArticleId
, wgUserName
], elEditorsList
);
36 if(!ShowEditorsCounting
) {
37 wgAjaxShowEditors
.countup();
41 wgAjaxShowEditors
.countup = function() {
42 ShowEditorsCounting
= true;
44 var elEditorsList
= document
.getElementById( 'ajax-se-editors' );
45 for(var i
=0;i
<elEditorsList
.childNodes
.length
;i
++) {
46 var item
= elEditorsList
.childNodes
[i
];
47 if (item
.nodeName
== 'SPAN') {
48 var value
= parseInt( item
.innerHTML
);
50 item
.innerHTML
= value
;
53 setTimeout( "wgAjaxShowEditors.countup()", 1000 );
56 // callback to allow refresh
57 wgAjaxShowEditors
.allowRefresh = function() {
61 // Register our initialization function.
62 hookEvent( "load", wgAjaxShowEditors
.onLoad
);