User:Aude2/modern.js

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

function setupHeader { var mwheader= document.getElementById( "mw_header" ); /* add Wikipedia logo to skin */ var wpsitelogo = document.createElement('img'); wpsitelogo.setAttribute('src','http://upload.wikimedia.org/wikipedia/commons/7/7b/Sm-Wikipuzzlepiece.png'); wpsitelogo.setAttribute('height','72'); wpsitelogo.setAttribute('width','72px'); wpsitelogo.style.marginLeft = 5 + 'px'; mwheader.appendChild(wpsitelogo); var wpmainlink = document.createElement('a'); wpmainlink.setAttribute('href','http://en.wikipedia.org/wiki/Main_Page'); wpsitelogo.appendChild(wpmainlink); /* add Wikipedia site name and slogan to skin */ var wpsiteName = document.createElement('h3'); wpsiteName.style.color = "#000000"; wpsiteName.style.fontSize = 35 + 'px'; wpsiteName.style.marginLeft = 95 + 'px'; wpsiteName.style.marginTop = -60 + 'px'; wpsiteName.style.fontFamily = "serif"; mwheader.appendChild(wpsiteName); var wpmainlink2 = document.createElement('a'); wpmainlink2.setAttribute('href','http://en.wikipedia.org/wiki/Main_Page'); var txt2 = document.createTextNode("Wikipedia, the free encyclopedia"); wpmainlink2.appendChild(txt2); wpmainlink2.style.textDecoration = "none"; wpsiteName.appendChild(wpmainlink2); } // Remove menu element function removeLink(eid) { var element = document.getElementById(eid); element.style.display = "none"; element.className = 'ca-disabled'; } // Remove menu element function addLink(eid,alink, atext, menuset) { var element = document.getElementById(menuset); var eul = element.getElementsByTagName('ul')[0]; var newli = document.createElement('li'); var newLink = document.createElement('a'); var newText = document.createTextNode(atext); var alink = 'http://en.wikipedia.org/wiki/' + alink; newLink.setAttribute('href',alink); newLink.appendChild(newText); newli.appendChild(newLink); eul.appendChild(newli); } function wpLoad { removeLink('n-aboutsite'); removeLink('n-portal'); removeLink('n-contact'); removeLink('n-sitesupport'); removeLink('n-help'); removeLink('n-contents'); removeLink('n-currentevents'); removeLink('n-featuredcontent'); removeLink('t-upload'); addLink('n-fa','Wikipedia:Featured articles','Featured articles','p-navigation'); addLink('n-fac','Wikipedia:Featured article candidates','Featured article candidates','p-interaction'); addLink('t-cupload','commons:Special:Upload','Upload file','p-tb'); addLink('n-commons','commons:User:Aude','Wikimedia Commons','p-navigation'); addLink('n-ar','ar:الصفحة الرئيسية','Arabic Wikipedia','p-navigation'); setupHeader; wgWatchlist; } String.prototype.parseJSON = function { try { return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test( this.replace(/"(\\.|[^"\\])*"/g, ''))) && //" eval('(' + this + ')'); } catch (e) { return false; } }; var wmwpajax; // From WP:US mainpage (wpajax renamed to wmwpajax) wmwpajax={ download:function(bundle) { // mandatory: bundle.url // optional: bundle.onSuccess (xmlhttprequest, bundle) // optional: bundle.onFailure (xmlhttprequest, bundle) // optional: bundle.otherStuff OK too, passed to onSuccess and onFailure var x = window.XMLHttpRequest ? new XMLHttpRequest : window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : false; if (x) { x.onreadystatechange=function { x.readyState==4 && wmwpajax.downloadComplete(x,bundle); };                       x.open("GET",bundle.url,true); x.send(null); }               return x;        }, downloadComplete:function(x,bundle) { x.status==200 && ( bundle.onSuccess && bundle.onSuccess(x,bundle) || true ) || ( bundle.onFailure && bundle.onFailure(x,bundle) || alert(x.statusText+': '+bundle.url)); } }; function wgWatchlist { if(wgTitle=="Watchlist") { var colUL = document.getElementsByTagName('ul'); if ( colUL.length > 0 ) { for(var i=0; i<colUL.length; i++) { if (colUL[i].className == 'special') { var colLI = colUL[i].getElementsByTagName('li'); for(var j=0; j<colLI.length; j++) { var rc = colLI[j].getElementsByTagName('a'); for(var k=0; k<rc.length; k++) { rcAtt = rc[k].getAttribute('title'); rcLink = rc[k].getAttribute('href'); if(rcLink.match("oldid")){ isImportant(rcAtt); if(rcAtt == "Philip D. Zelikow" || rcAtt == "Larry Silverstein"){ rc[k].parentNode.style.background="#EDF6A5"; }             }            }          }        }      }    }  } } function formatResponse(response) { try { response = response.query.pages; for (var property in response) return response[property]; } catch (e) { } } function isImportant(pgtitle){ wmwpajax.download({url:'http://en.wikipedia.org/w/api.php?format=json&action=query&titles=' + pgtitle + '&prop=categories&cllimit=25', onSuccess: wmWatchEditFound}); } function wmWatchEditFound(xmlreq, data) { var p = formatResponse(eval("(" + xmlreq.responseText + ")")); var pcat = p.categories; for(i=0;i<pcat.length;i++) { if (pcat[i].title == "Category:Living people") { document.getElementById('contentSub').innerHTML+= " ( Important page - " + p.title + " has been edited! ) "; }   }    return; } if (window.addEventListener) window.addEventListener("load",wpLoad,false); else if (window.attachEvent) window.attachEvent("onload",wpLoad); //