Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
varnup_http;varnup_enabled;varnup_num_pages;varnup_refresh;/* initalise */functionnup_init(){// allow user settings throughif(nup_enabled===undefined){nup_enabled=false;}if(nup_num_pages===undefined){nup_num_pages=10;}if(nup_refresh===undefined){nup_refresh=5;}// A few limits to be nice to the serversif(nup_num_pages>50){nup_num_pages=50;}if(nup_num_pages<1){nup_num_pages=1;}if(nup_refresh<2){nup_refresh=2;}// get our cookieif(document.cookie.length>0){varc_start=document.cookie.indexOf("nup_show_box=");if(c_start!=-1){c_start=c_start+13;varc_end=document.cookie.indexOf(";",c_start);if(c_end==-1){c_end=document.cookie.length;}if(document.cookie.substring(c_start,c_end)=="yes"){nup_enabled=true;}else{nup_enabled=false;}}}// Either make a request or show nothingif(nup_enabled===true){nup_ajax_request();}else{nup_draw_disabled_box();}}/* init ajax */functionnup_create_request(){try{nup_http=newXMLHttpRequest();}catch(e){try{nup_http=newActiveXObject("Msxml2.XMLHTTP");}catch(e){try{nup_http=newActiveXObject("Microsoft.XMLHTTP");}catch(e){alert("Your browser does not support AJAX!");returnfalse;}}}nup_http.onreadystatechange=function(){if(nup_http.readyState==4)nup_ajax_response();};returntrue;}/* make a request */functionnup_ajax_request(){// check we are enabledif(nup_enabled===false)return;// firstly, inform the uservarcur_box=document.getElementById('p-newuserpatrolscript');if(cur_box!==null){cur_box.firstChild.firstChild.data='New users (...)';}if(nup_create_request()===false){if(cur_box!==null){cur_box.firstChild.firstChild.data='New users (Update FAILED!)';}else{alert("Error with AJAX object creation.");}}// Then make the requestnup_http.open("GET","/w/api.php?action=query&list=logevents&leaction=newusers/create&format=xml&lelimit="+nup_num_pages,true);nup_http.send(null);}/* we have received a response */functionnup_ajax_response(){varitems=nup_http.responseXML.getElementsByTagName('item');// create the nup_div that holds all the newpage linksvarnup_link_div=document.createElement('div');nup_link_div.className='pBody';varlist=document.createElement('ul');nup_link_div.appendChild(list);// populate the list with 10 links.for(vari=0;i<items.length;i++){varitem_name=items[i].getAttribute('title').substring(5);varitem_url='https://en.wikipedia.org/wiki/Special:Contributions/'+encodeURIComponent(item_name);a=document.createElement('a');a.style.fontSize='small';a.setAttribute('href',item_url);a.appendChild(document.createTextNode(item_name));varli=document.createElement('li');li.appendChild(a);list.appendChild(li);}// Container nup_divvarnup_div=document.createElement('div');nup_div.setAttribute('id','p-newuserpatrolscript');nup_div.className='portal';varnup_heading=document.createElement('h6');nup_heading.appendChild(document.createTextNode('New users'));nup_div.appendChild(nup_heading);nup_div.appendChild(nup_link_div);window.console.log("[NEW-USER-PATROL]: Object created!");// disable linkvarp=document.createElement('p');p.style.fontSize='x-small';p.style.margin='0px';p.style.textAlign='right';a=document.createElement('a');a.appendChild(document.createTextNode('disable this box'));a.onclick=nup_disable_box;p.appendChild(a);nup_link_div.appendChild(p);// now replace the nup_divvarnup_old_div=document.getElementById('p-newuserpatrolscript');varnup_side_col=mw.config.get('skin')==='vector-2022'?document.getElementById('vector-page-tools'):document.getElementById('mw-panel');if(nup_old_div!==null){nup_side_col.replaceChild(nup_div,nup_old_div);window.console.log("[NEW-USER-PATROL]: Object updated!");}else{varnode=document.getElementById('p-tb');nup_side_col.insertBefore(nup_div,node.nextSibling);//Effectively, "insert after"window.console.log("[NEW-USER-PATROL]: Object inserted for the first time!");}// and do it again in 5 secssetTimeout(nup_ajax_request,nup_refresh*1000);}functionnup_disable_box(){nup_enabled=false;nup_draw_disabled_box();document.cookie="nup_show_box=no; path=/";}functionnup_enable_box(){nup_enabled=true;document.cookie="nup_show_box=yes; path=/";nup_ajax_request();}functionnup_draw_disabled_box(){// Container nup_divvarnup_link_div=document.createElement('div');nup_link_div.className='pBody';varnup_div=document.createElement('div');nup_div.setAttribute('id','p-newuserpatrolscript');nup_div.className='portal';varnup_heading=document.createElement('h6');nup_heading.appendChild(document.createTextNode('New users (Disabled)'));nup_div.appendChild(nup_heading);nup_div.appendChild(nup_link_div);// enable linkvarp=document.createElement('p');p.style.fontSize='x-small';p.style.margin='0px';vara=document.createElement('a');a.appendChild(document.createTextNode('enable this box'));a.onclick=nup_enable_box;p.appendChild(a);nup_link_div.appendChild(p);// now replace the nup_divvarnup_old_div=document.getElementById('p-newuserpatrolscript');varnup_side_col=document.getElementById('mw-panel');if(nup_old_div!==null){nup_side_col.replaceChild(nup_div,nup_old_div);}else{varnode=document.getElementById('p-tb');if(nup_side_col)nup_side_col.insertBefore(nup_div,node.nextSibling);//Effectively, "insert after"}}addOnloadHook(nup_init);