User:Soldier 1033/monaco.js

addOnloadHook(rollbackAsBot); function rollbackAsBot { var hasRollback = getElementsByClassName(document, "span", "mw-rollback-link"); for (var i in wgUserGroups){ if (wgUserGroups[i] == 'sysop'){ var isSysop = true; } }  if (isSysop && hasRollback[0]){ for (var i in document.links) { var thisLink = document.links[i]; if (thisLink.href.indexOf('&action=rollback') != -1 && thisLink.href.indexOf('&bot=1') == -1) { var newOpen = document.createTextNode(' ['); var newClose = document.createTextNode(']'); var newLink = document.createElement('a'); newLink.setAttribute('href', thisLink.href + '&bot=1'); newLink.setAttribute('title', 'Mark rolled-back edits as bot'); newLink.innerHTML = 'mark as bot'; thisLink.parentNode.appendChild(newOpen); thisLink.parentNode.appendChild(newLink); thisLink.parentNode.appendChild(newClose); }   }  } } addOnloadHook(editSiteNotice); var dCookieName = "dismissSiteNotice="; var msgClose = "dismiss";

var hCookieName = "hideSiteNotice="; var hCookiePos = document.cookie.indexOf(hCookieName); var hCookieValue = ""; function editSiteNotice { var snbox = document.getElementById('mw-dismissable-notice'); if( snbox != null){ if (hCookiePos > -1) { hCookiePos = hCookiePos + hCookieName.length; var hideEndPos = document.cookie.indexOf(";", hCookiePos); if (hideEndPos > -1) { hCookieValue = document.cookie.substring(hCookiePos, hideEndPos); } else { hCookieValue = document.cookie.substring(hCookiePos); }     }      var newLink = document.createElement('a'); newLink.setAttribute('href', "javascript:dismissNotice;"); newLink.setAttribute('title', 'Dismiss this notice.'); newLink.innerHTML = msgClose;

var hideLink = document.getElementById( "collapseButton" + "0" ); hideLink.href = "javascript:hideSiteNotice;" hideLink.parentNode.style.width = "12em"; hideLink.parentNode.appendChild( document.createTextNode(' [') ); hideLink.parentNode.appendChild( newLink ); hideLink.parentNode.appendChild( document.createTextNode(']') ); snbox.tBodies[0].rows[0].deleteCell(1);

if (hCookieValue != siteNoticeID && hideLink.innerHTML == "show") { collapseTable(0); }     if (hCookieValue == siteNoticeID && hideLink.innerHTML == "hide") { collapseTable(0); }  } }

function hideSiteNotice { var hideLink = document.getElementById( "collapseButton" + "0" ); var date = new Date; if (hideLink.innerHTML == 'hide'){ date.setTime(date.getTime + 30*86400*1000); } else { date.setTime(date.getTime - 30*86400*1000); }  document.cookie = hCookieName + siteNoticeID + "; expires="+date.toGMTString + "; path=/"; collapseTable(0); }