User:Spidern/monobook.js

importScript('w:User:Pyrospirit/metadata.js'); //User:Pyrospirit/metadata.js

//friendly in the article namespace importScript('w:User:AzaToth/morebits.js'); importScript('w:User:Ioeth/friendlytag.js');

//deletion importScript('w:User:Quarl/util.js'); importScript('w:User:Quarl/wikipage.js'); importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu'); importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');; importScript('Wikipedia:WikiProject Deletion sorting/delsort.js');

importScript('w:User:Lupin/popups.js'); //popupStructure="nostalgia"; popupRedlinkRemoval="true";

//importScript('w:User:Supadawg/secedit.js'); // Doesn't work for all threads importScript('w:User:JeremyMcCracken/contribstab.js'); importScript('w:User:Animum/count.js'); importScript('w:User:Lupin/recent2.js'); importScript('w:User:Anomie/getWatchlist.js'); importScript('w:User:js/watchlist.js') // watchlist enhancments

// //importScript('w:User:AndyZ/peerreviewer.js'); // importScript('w:User:Dr_pda/prosesize.js');

// importScript('w:User:Alex Smotrov/histcomb.js'); // histCombLeaveComment = true //if true, keep summary on the last folded edit histCombNoCollapse = false //if true, do not collapse edits on load histCombMyBg = '#F0FFF0' //background on your edits (light green) histCombTalk = 'talk' //string to replace 'Talk' histCombContrib = 'contribs' //string to replace 'contribs'

// //importScript('w:User:Js/ajaxPreview.js'); // function ajaxPreviewInit{ if ((wgNamespaceNumber % 2 == 0) && /\.(js|css)$/.test(wgTitle)) return if (typeof ajaxPreviewKey != 'string') ajaxPreviewKey = 'p' if (typeof ajaxDiffKey != 'string') ajaxDiffKey = 'v' ajaxPreviewPos = window.ajaxPreviewPos || 'right' if (ajaxPreviewPos != 'bottom'){ var tOld = document.getElementById('toolbar') || document.getElementById('wpTextbox1') tOld.style.clear = 'none' var d = document.createElement('div'); d.style.cssText = 'width:100%; clear:both' tOld.parentNode.insertBefore(d, tOld) var tNew = document.createElement('div'); tNew.style.cssText = 'float:'+ ajaxPreviewPos tOld.parentNode.insertBefore(tNew, tOld) } addBtn(window.ajaxPreviewButton, 'wpPreview', ajaxPreviewKey) addBtn(window.ajaxDiffButton, 'wpDiff', ajaxDiffKey) function addBtn(name, id, akey){ var btnOld = document.getElementById(id) if (!btnOld) return //var btn = document.createElement('input'); btn.type = 'button' btn.onclick = ajaxPreviewClick; btn.id = id + 'Live' if (!name){ //extract last word from standard buttons name = btnOld.value.split(' '); name = name[name.length-1] name = name.substring(0,1).toUpperCase + name.substring(1) } btn.value = name;  btn.title = btnOld.value + ' (Ajax)' if (ajaxPreviewPos == 'bottom'){ btnOld.parentNode.insertBefore(btn, btnOld) btn.value = btnOld.value btnOld.value = '>' }else{ btn.style.cssText = 'height:22px; padding:0 1px' tNew.appendChild(btn) } if (akey){ //reassign acces key if (btnOld.accessKey == akey){ btnOld.accessKey = '' //btnOld.setAttribute('accesskey', '') btnOld.title = btnOld.title.replace(tooltipAccessKeyRegexp, '') }   //btn.setAttribute('accesskey', akey) btn.accessKey = akey btn.title += ' ['+tooltipAccessKeyPrefix+akey+']' } btn.value2 = btn.value } } function ajaxPreviewClick{ajaxPreviewRun(this)} function ajaxPreviewRun(btn){ var wkPreview = document.getElementById('wikiPreview'), form = document.editform var aj = sajax_init_object if (!wkPreview || !form || !aj) return var oldHeight = wkPreview.offsetHeight var el, htm, isDiff = (btn.id=='wpDiffLive') wkPreview.style.opacity = '0.3'; wkPreview.style.color = 'gray'; document.body.style.cursor = 'wait' if (el=document.getElementById('wikiDiff')) el.style.display = 'none' if (el=document.getElementById('newarticletext')) el.style.display = 'none' btn.style.width = Math.max(btn.scrollWidth, btn.offsetWidth) + 'px'; btn.value = '...' //prepare var txt = form.wpTextbox1.value, action = form.action var boundary = '123xyz', data = '' if (isDiff){ addData('wpDiff', ''); addData('wpStarttime'); addData('wpEdittime') if (!window.ajaxPreview_CSS) ajaxPreview_CSS = importStylesheetURI('/skins-1.5/common/diff.css') }else{ action += '&live' if (form.wpSection && form.wpSection.value) txt += '\n ', p1)   htm = (p1!=-1 && p2!=-1) ? htm.substring(p1, p2+8) : 'Error'  }else{    htm = aj.responseText.replace(/&gt;/g,'>').replace(/&lt;/g,'<').replace(/&quot;/g,'"').replace(/&amp;/g,'&').replace(/&apos;/g,"'")  }  wkPreview.innerHTML = htm  btn.value = btn.value2  btn.blur  if (el = wkPreview.getElementsByTagName('h2')[0]){    if (el.style.textAlign != 'right') el.innerHML +=  ' (Ajax)'    el.style.textAlign = 'right'  }  if (window.ajaxPreviewScrollTop && wkPreview.scrollIntoView) wkPreview.scrollIntoView  else document.documentElement.scrollTop +=  wkPreview.offsetHeight - oldHeight   wkPreview.style.opacity = ; wkPreview.style.color = ; document.body.style.cursor =   if (!isDiff) ajaxPreviewFinish(wkPreview) } function addData(name, value){   if (!value) value = form[name] ? form[name].value :    data += '--' + boundary + '\nContent-Disposition: form-data; name="'+name+'"\n\n' + value + '\n' } } function ajaxPreviewFinish(el){ sortables_init if (window.createCollapseButtons){//en.wp  createCollapseButtons createNavigationBarToggleButton } if (window.ajaxPreviewExec) ajaxPreviewExec(el) }

if (wgAction=='edit' || wgAction=='submit') addOnloadHook(ajaxPreviewInit)

// //importScript('w:User:Cacycle/wikEdDiff.js); // // install User:Cacycle/wikEdDiff enhanced diff view using ajax document.write(' ');

// //importScript(Menustuff); // function do_onload { if (document.title.indexOf('w:User:') == 0      || document.title.indexOf('User talk:') == 0) add_block_tab; else if (document.title.indexOf('Block user') == 0) // could stand to be more robust do_blockip_stuff; } if (window.addEventListener) window.addEventListener("load", do_onload, false); else if (window.attachEvent) window.attachEvent("onload", do_onload); if ( document.createElement && window.addEventListener ) { function SoFixItInit // pre-load, (don't want to slow down loading of article's content, though) { } function SoFixItLoad // post-load { UserMenu = new PortletMenu( 'p-personal'  ); PageMenu = new PortletMenu( 'p-cactions'  ); NavMenu = new PortletMenu( 'p-navigation' ); //ToolMenu = new PortletMenu( 'p-tb'        ); // This is inefficient and not particularly robust. // This comes first, I want this link to come up as // fast as possible. // function GetByClass( sElem, sClass ) { var i, a2 = [], a = document.getElementsByTagName( sElem ); for ( i = 0; i < a.length; i++ ) if ( a[ i ].className == sClass ) a2.push( a[ i ] ); return a2; } var a, td = GetByClass( 'td', 'diff-otitle' ); if ( ( td = td[ 0 ] ) && ( a = td.getElementsByTagName( 'a' )[ 0 ] ) ) a.href = a.href + '&action=edit'; // need to change text, later var userName = UserMenu.getText( 'pt-userpage' ); // personal (top-most) menu // // Splash Talk  Prefs  Watch  List  Contribs Logout // UserMenu.setText( 'pt-watchlist', 'watch' ); UserMenu.setText( 'pt-mytalk'   , 'talk'  ); UserMenu.setText( 'pt-preferences', 'prefs' ); UserMenu.setText( 'pt-mycontris', 'contribs' ); UserMenu.setText( 'pt-logout'   , 'logout'   ); // UserMenu.setHref( 'pt-mycontris', 'http://en.wikipedia.org/wiki/Special:Contributions/' + userName ); // // // it seems there is a stylesheet that makes them lowercase // // ok, the lowercased menu items are starting to really bug me: // document.getElementById( 'p-personal' ).getElementsByTagName( 'ul' )[0].style.textTransform = 'none'; // UserMenu.insertBefore( 'pt-mycontris', 'pt-list', 'editlist', '/wiki/Special:Watchlist/edit' );

// article-actions menu, (the "tabs") // if ( PageMenu[ 'ca-history' ] ) // theory: if it has a history tab, then it's purgable { PageMenu.insertBefore( 'ca-history', 'ca-lastdiff', 'Last Diff', PageMenu.getHref( 'ca-history' ).replace( /action=history/, 'diff=0' ) ); PageMenu.append( 'ca-purge', 'Purge', PageMenu.getHref( 'ca-history' ).replace( /action=history/, 'action=purge' ) ); } var x = 1; NavMenu.append( 'n-' + x++, 'monobook.js', '/wiki/User:' + userName + '/monobook.js' ); NavMenu.append( 'n-' + x++, 'Templates', '/wiki/Wikipedia:Template' ); NavMenu.append( 'n-' + x++, 'Cleanup tags', '/wiki/Wikipedia:Template_messages/Cleanup' ); NavMenu.append( 'n-' + x++, 'Stub sorts', '/wiki/Stub_types' ); } function PortletMenu( id ) // constructor { this.menu = document.getElementById( id ); this.list = this.menu.getElementsByTagName( 'ul' )[ 0 ]; // bypass " Views ", etc. // sigh...as far as I can figure, there is empty whitespace being treated // as TextNodes.... // var LIs = this.list.getElementsByTagName( 'li' ); for ( var i = 0; i < LIs.length; i++ ) { this[ LIs[ i ].id ] = LIs[ i ]; } this.newItem = function( id, txt, url ) { var li = document.createElement( 'li' ); li.id  = id; var a = document.createElement( 'a'  );  a.href = url; a.appendChild( document.createTextNode( txt ) ); li.appendChild( a ); this[ id ] = li; // watch this!!! return li; } this.append = function( id, txt, url ) { this.list.appendChild( this.newItem( id, txt, url ) ); } this.insertBefore = function( old, id, txt, url ) { this.list.insertBefore( this.newItem( id, txt, url ), this[ old ] ); } // the ByTagName here is a bit annoying, but in Safari, I was picking // up TextNodes by using this[ id ].firstChild.firstChild // this.getText = function( id     ) { return this[ id ].getElementsByTagName( 'a' )[ 0 ].firstChild.data } this.setText = function( id, txt ) {       this[ id ].getElementsByTagName( 'a' )[ 0 ].firstChild.data = txt } this.getHref = function( id     ) { return this[ id ].getElementsByTagName( 'a' )[ 0 ].href       } this.setHref = function( id, url ) {       this[ id ].getElementsByTagName( 'a' )[ 0 ].href = url }

} function RemoveNode( id ) { var node = document.getElementById( id ) node.parentNode.removeChild( node ); } SoFixItInit; window.addEventListener( 'load', SoFixItLoad, false ); }