User:ElfAnurin/monaco.js

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); }