User:Gnomz007/monobook.js

//

/*-- My customized popups and livepreview - very rude! as in "not tested in anything but Firefox" --*/

//Popup options ctFiltNewArticles=15; popupFixDabs=true;

popupImages=false; popupOnlyArticleLinks=false; popupMaxPreviewSentences=15; popupStructure='menus';

// Live Preview customization, wpUserName  = "Gnomz007"; wpShowImages = true;     // Enable downloading and displaying of images wpIsEditing=window.location.href.indexOf("action=edit")!=-1;

//Includes document.write(' '); if(wpIsEditing) { document.write(' '); } /*User:Pilaf/livepreview.js */ // //thanks User:BesigedB function addInsertion(content,name) { return "" + name + ""; }

function havepoint { return confirm("Have a point?"); }

function insertExtra { var copywarn = document.getElementById('editpage-copywarn'); if(copywarn){ var divstart = ""; var divend = " "; var ins = addInsertion(escapeQuotes(''),"clear") + " | "; ins += addInsertion(escapeQuotes('class="prettytable"'),"prettytable") + " | "; ins += addInsertion('',"delete") + " | "; ins += addInsertion('',"deletebecause")+ " | "; ins += addInsertion('[]',"edit template"); copywarn.innerHTML = divstart + ins + divend + ' ' + copywarn.innerHTML; var artname=articleFromURL(window.location); if(!((artname.indexOf('Lenin')==-1) && (artname.indexOf('Putin')==-1) && (artname.indexOf('Stalin')==-1))){ alert("Big brother watches you!\n Will you stop editing controversial articles, you have no real knowledge about?"); document.forms.editform.wpSave.onclick = havepoint; } } }

//thanks User:Trilobite /* this function is used to add extra tabs and links */

function makelilink(url, name, id) {     var na = document.createElement('a'); na.href = url; na.id = id; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); li.appendChild(na); return li; }

function addlilink(tabs, url, name, id) { var li=makelilink(url, name, id); tabs.appendChild(li); return li; }

MyToolsHtml=''+ 'my tools page '+ ' '+ 'Maps '+ 'GFDL Resources '+ 'Public domain resources '+ 'Public domain image resources '+ '<a href="/wiki/Wikipedia:Free or semi-free non-Public-Domain information resources">Non-Public domain image resources</a> '+ '<a href="http://ru.wikipedia.org/wiki/%D0%92%D0%B8%D0%BA%D0%B8%D0%BF%D0%B5%D0%B4%D0%B8%D1%8F:%D0%98%D1%81%D1%82%D0%BE%D1%87%D0%BD%D0%B8%D0%BA%D0%B8_%D0%B8%D0%BD%D1%84%D0%BE%D1%80%D0%BC%D0%B0%D1%86%D0%B8%D0%B8">Источники информации</a> '+ '<a href="http://www.cultinfo.ru/fulltext/1/001/007/121/index.htm">Словарь Брокгауза</a> '+ '<a href="http://meta.wikimedia.org/wiki/Category:MediaWiki_tools">MediaWiki tools</a> '+ '<a href="http://print.google.com">Google print</a> '+ '<a href="http://www.archive.org">archive.org</a> '+ '<a href="http://www.gutenberg.org/">Project Guttenberg</a> '+ '<a href="http://www.uriit.ru/gns/index.jsp">Русский сервер географических названий</a> '+ ' '+ '<a href="http://pere.slovnyk.org.ua">Ukrainian translator</a> '+ '<a href="http://diberri.dyndns.org/html2wiki.html">HTML-&gt;Wiki</a> '+ ' '+ '<a href="/wiki/Wikipedia:Wikiportal/Russia/New article announcements">Russia/New article announcements</a> '+ '';

function OnToolsOver{ return OnToolsOver2(this); } function OnToolsOver2(a) { if (a==window.currentLink) return;  window.currentLink=a; if (typeof over != undef && over != null && typeof over.dragging != undef && over.dragging) return;

if (popupImageTimer != null) { clearInterval(popupImageTimer); counter=0; } var morehtml=''; // if (getValueOf('popupLiveOptions')) morehtml=popupLiveOptionsHTML; overlib(MyToolsHtml+morehtml, STICKY, WRAP, CELLPAD, 5, OFFSETX, 2, OFFSETY, 2, DELAY, getValueOf('popupDelay')*1000); }

function addEditSection0 { ta['ca-edit-0'] = ['', 'Edit the zeroth section of this page']; x = document.getElementById('ca-edit'); if(!x) return; var li=makelilink(x.firstChild.href + '&section=0', '0', 'ca-edit-0'); x.parentNode.insertBefore(li,x.nextSibling); }

function AddMyLinks {  var user = 'Gnomz007'; //   pt-userpage, pt-mytalk, pt-preferences, //   pt-watchlist, pt-mycontris, pt-logout var tb = document.getElementById('p-tb'); tb=tb.getElementsByTagName('ul')[0]; addlilink(tb, '/wiki/Portal:Russia/New article announcements', 'PRNA', '');

var before = document.getElementById( 'pt-preferences'); li=makelilink('/wiki/User:' + user + '/Tools', 'my tools', 'pt-gnomztool'); a=li.firstChild; before.parentNode.insertBefore ( li, before ); setupTooltips; a.onclick= killPopup; a.onmouseout= mouseOutWikiLink; a.onmouseover=OnToolsOver;

if(wpIsEditing) {    insertExtra; LivePreviewInstall; }  else {  addEditSection0; }

}

//initialize the array - only do this once extraPopupFilters=new Array;

function popupFilterVandal (wikiText) { var v=0,p=0,t=''; if(/\bis gay\b/i.test(wikiText))v++; if(/qwer/i.test(wikiText))v++; if(/fuck/i.test(wikiText))p++; if(v || p )t=' '; if(v)t+=' (!?)'+v+' '; if(p)t+=' (!!)'+p+' '; return t; };

function popupFilterCat (wikiText) { var t=''; var ar,re=new RegExp("\\[Category:(.*?)(\\]\\]|\\|)","ig"); if( (ar=re.exec(wikiText) )!= null) { t=' '; for (ar != null; ar = re.exec(wikiText)) {   t+='<a href="/wiki/Category:'+ar[1]+'">'+ar[1]+'</a> | ' } t+=' '; } return t; }

function popupFilterNewArticles (wikiText) { var t='',i; if(/\[\[Category:Wikipedia new articles\]\]/i.test) { var ar,re=new RegExp("\\[\\[(.*?)(\\]\\]|\\|)","ig"); t=' '; for(i=0,ar=re.exec(wikiText);i<ctFiltNewArticles&&ar != null;ar=re.exec(wikiText)) {  if((ar[1].indexOf(":")==-1)&&(ar[1]!="Russia")&&(ar[1]!="Ukraine")&&(ar[1]!="Belarus")) {   t+='<a href="/wiki/'+ar[1]+'">'+ar[1]+'</a> ';   i++; } } t+=' '; } return t; }

// add the function to the array (you can repeat this for lots of functions) extraPopupFilters.push(popupFilterVandal); extraPopupFilters.push(popupFilterCat); extraPopupFilters.push(popupFilterNewArticles);

function asyncRun { window.setTimeout('AddMyLinks', 1) } $(asyncRun); /*