User:Thingg/monobook.js

// SCRIPT:    Twinkle importScript('User:AzaToth/twinkle.js'); TwinkleConfig = { revertMaxRevisions             :       50, userTalkPageMode               :       'tab', showSharedIPNotice             :       false, openTalkPage                   :       [ 'agf', 'norm', 'vand' ], openTalkPageOnAutoRevert       :       false, summaryAd                      :       " (TW)", deletionSummaryAd              :       " (TW)", protectionSummaryAd            :       " (TW)", watchSpeedyPages               :       [], watchProdPages                 :       false, openUserTalkPageOnSpeedyDelete :       [], markRevertedPagesAsMinor       :       [ 'agf', 'norm', 'vand', 'torev' ], deleteTalkPageOnDelete         :       true, watchWarnings                  :       false, watchRevertedPages             :       [], markAIVReportAsMinor           :       true, markSpeedyPagesAsMinor         :       true, offerReasonOnNormalRevert      :       true, orphanBacklinksOnSpeedyDelete  :       {orphan:false, exclude:['g6']} };

// SCRIPT:    Quick preview importScript('User:CBM/quickpreview.js')

importScript('User:Shubinator/DYKcheck.js'); //DYKcheck tool

// SCRIPT:    Admin highlighter importScript('User:Ais523/adminrights.js');

// SCRIPT:    Easyblock importScript('User:Animum/easyblock.js'); //User:Animum/easyblock.js

// SCRIPT:   toolbox page logs link // from Wikipedia:WikiProject User scripts/Scripts/Logs link addOnloadHook(function {    if ( mw.config.get('wgCanonicalNamespace') == "Special" )        return;  // don't display link for special pages

url = mw.config.get('wgServer') + "/w/index.php?title=Special:Log&page=" + encodeURIComponent(mw.config.get('wgPageName'));

mw.util.addPortletLink("p-tb", url, "Page logs", "pt-logs"); });

//SCRIPT: dashboard link in toolbar addOnloadHook(function {     url = "http://en.wikipedia.org/wiki/User:Thingg/dashboard";    mw.util.addPortletLink("p-personal", url, "dashboard", "pt-dash"); });

//SCRIPT: logs link in toolbar addOnloadHook(function {     url = "http://en.wikipedia.org/w/index.php?title=Special:Log&user=Thingg";    mw.util.addPortletLink("p-personal", url, "logs", "pt-logs"); });

//SCRIPT: Clock //from MediaWiki:Gadget-UTCLiveClock.js //clock shows up in incorrect position due to above code function liveClock {	liveClock.node = mw.util.addPortletLink( 'p-personal', mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=purge', '', 'utcdate' ); liveClock.node.style.fontSize = 'larger'; liveClock.node.style.fontWeight = 'bolder'; showTime; } addOnloadHook(liveClock) function showTime {	var dateNode = liveClock.node; if( !dateNode ) { return; }   var now = new Date; var hh = now.getUTCHours; var mm = now.getUTCMinutes; var ss = now.getUTCSeconds; var time = ( hh < 10 ? '0' + hh : hh ) + ':' + ( mm < 10 ? '0' + mm : mm ) + ':' + ( ss < 10 ? '0' + ss : ss ); dateNode.firstChild.replaceChild( document.createTextNode( time ), dateNode.firstChild.firstChild ); window.setTimeout(showTime, 1000); }

// SCRIPT: NewPagePatrol // copied from User:TheJosh/Scripts/NewPagePatrol.js and tweaked by User:Thingg var npp_http; var npp_enabled; var npp_num_pages; var npp_refresh; var npp_num_idle_req; var npp_curr_idle_req;

npp_enabled = false; npp_num_pages = 50; npp_refresh = 5; npp_num_idle_req = 60; var npp_str_no_ajax = "There seems to be a problem using the NewPagePatrol script. Your browser is not supported. God Bless!"; var npp_str_box_title = "New pages"; var npp_str_box_title_updating = "New pages (updating)"; var npp_str_box_title_failed = "New pages (update failed)"; var npp_str_enable = "enable this box"; var npp_str_disable = "disable this box"; addOnloadHook( npp_init ); /* initalise */ function npp_init { // allow user settings through if (npp_enabled == null) { npp_enabled = false; } if (npp_num_pages == null) { npp_num_pages = 10; } if (npp_refresh == null) { npp_refresh = 5; } if (npp_num_idle_req == null) { npp_num_idle_req = 60; } // A few limits to be nice to the servers if (npp_num_pages > 50) { npp_num_pages = 50; } if (npp_num_pages < 1) { npp_num_pages = 1; } if (npp_refresh < 2) { npp_refresh = 2; } if (npp_num_idle_req > 1000) { npp_num_idle_req = 1000; } if (npp_num_idle_req < 5) { npp_num_idle_req = 5; } // get our cookie if (document.cookie.length > 0) { var c_start = document.cookie.indexOf("npp_show_box="); if (c_start != -1) { c_start = c_start + 13; var c_end = document.cookie.indexOf(";", c_start); if (c_end == -1) { c_end = document.cookie.length; }     if (document.cookie.substring(c_start, c_end) == "yes") { npp_enabled = true; } else { npp_enabled = false; }   }   }  // Either make a request or show nothing npp_curr_idle_req = 0; if (npp_enabled == true) { npp_ajax_request; } else { npp_draw_disabled_box; } } /* init ajax */ function npp_create_request { try { npp_http = new XMLHttpRequest; } catch (e) { try { npp_http = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { npp_http = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { return false; }   }  }  npp_http.onreadystatechange = function { if(npp_http.readyState == 4) npp_ajax_response; } return true; } /* make a request */ function npp_ajax_request { // if we have done too many requests, disable the box npp_curr_idle_req++; if (npp_curr_idle_req > npp_num_idle_req) { npp_disable_box; } // check we are enabled if (npp_enabled == false) return; // firstly, inform the user var cur_box = document.getElementById('p-newpages'); if (cur_box != null) { cur_box.firstChild.firstChild.data = npp_str_box_title_updating; } if (npp_create_request  == false) { if (cur_box != null) { cur_box.firstChild.firstChild.data = npp_str_box_title_failed; } else { alert (npp_str_no_ajax); } }  // Then make the request npp_http.open("GET", "/w/api.php?action=query&format=xml&list=recentchanges&rcshow=!bot|!redirect&rctype=new&rcnamespace=0&rcprop=title|timestamp|ids|patrolled&rclimit=" + npp_num_pages, true); npp_http.send(null); } /* we have received a response */ function npp_ajax_response { var items = npp_http.responseXML.getElementsByTagName('rc'); // create the div that holds all the newpage links var link_div = document.createElement('div'); link_div.className = 'pBody'; var list = document.createElement('ul'); link_div.appendChild(list); // populate the list with 10 links. for (var i = 0; i < items.length; i++) { var item_name = items[i].getAttribute('title'); var rcid = items[i].getAttribute('rcid'); var patrolled = items[i].getAttribute('patrolled') != null; item_name = item_name.replace(/&/, "%26"); var item_url = 'http://en.wikipedia.org/w/index.php?title=' + item_name + '&rcid=' + rcid + '&redirect=no'; a = document.createElement('a'); a.setAttribute('href', item_url); a.appendChild(document.createTextNode(item_name)); var li = document.createElement('li'); li.appendChild(a); if (!patrolled) { li.setAttribute('class', 'not-patrolled'); }   list.appendChild(li); } // Container div var div = document.createElement('div'); div.setAttribute('id', 'p-newpages'); div.className = 'portlet'; var heading = document.createElement('h5'); heading.appendChild(document.createTextNode(npp_str_box_title)); div.appendChild(heading); div.appendChild(link_div); // disable link var p = document.createElement('p'); p.style.fontSize = 'x-small'; p.style.margin = '0px'; p.style.textAlign = 'right'; a = document.createElement('a'); a.appendChild(document.createTextNode(npp_str_disable)); a.onclick = npp_disable_box; p.appendChild(a); link_div.appendChild(p); // now replace the div var old_div = document.getElementById('p-newpages'); var side_col = document.getElementById('column-one'); if (old_div != null) { side_col.replaceChild(div, old_div); } else { var node = document.getElementById('p-tb'); side_col.insertBefore(div, node); } // and do it again in 5 secs setTimeout("npp_ajax_request", npp_refresh * 1000); } function npp_disable_box { npp_enabled = false; npp_draw_disabled_box; document.cookie = "npp_show_box=no; path=/"; } function npp_enable_box { npp_enabled = true; npp_curr_idle_req = 0; document.cookie = "npp_show_box=yes; path=/"; npp_ajax_request; } function npp_draw_disabled_box { // Container div var link_div = document.createElement('div'); link_div.className = 'pBody'; var div = document.createElement('div'); div.setAttribute('id', 'p-newpages'); div.className = 'portlet'; var heading = document.createElement('h5'); heading.appendChild(document.createTextNode(npp_str_box_title)); div.appendChild(heading); div.appendChild(link_div); // enable link var p = document.createElement('p'); p.style.fontSize = 'x-small'; p.style.margin = '0px'; var a = document.createElement('a'); a.appendChild(document.createTextNode(npp_str_enable)); a.onclick = npp_enable_box; p.appendChild(a); link_div.appendChild(p); // now replace the div var old_div = document.getElementById('p-newpages'); var side_col = document.getElementById('column-one'); if (old_div != null) { side_col.replaceChild(div, old_div); } else { var node = document.getElementById('p-tb'); side_col.insertBefore(div, node); } }