User:Ajraddatz/monaco.js

// HideMe v0.1 // Elements in the class hideme-hidden will be...uh...hidden. I would prefer to use just class="hideme", but unfortunately those darn userpage addicts are already using it with class="usermessage" (which is annoying enough.) Perhaps Ajrbot can remove them? Hmm.. doubtful, at best :D

// From http://www.netlobo.com/javascript_getelementsbyclassname.html

document.getElementsByClassName = function(clsName){ var retVal = new Array; var elements = document.getElementsByTagName("*"); for(var i = 0;i < elements.length;i++){ if(elements[i].className.indexOf(" ") >= 0){ var classes = elements[i].className.split(" "); for(var j = 0;j < classes.length;j++){ if(classes[j] == clsName) retVal.push(elements[i]); }       }        else if(elements[i].className == clsName) retVal.push(elements[i]); }   return retVal; }

var _hidden_link_text = "hidden"; var _message_question = "You have requested hidden material on a secret Networker, Item, or other info that is a potential spoiler. Do you wish to view the info?"; var _yes_button_text = "Yes, show me the info"; var _no_button_text = "No, close this dialog"; var _message_shown = "The hidden material is shown below."; var _hidden;

function hideMeInit { _hidden = document.getElementsByClassName("hideme"); for (var i = 0; i<_hidden.length; i++) { content = '[' + _hidden_link_text + '] X' + _message_question + ' ' + _yes_button_text + '' + _no_button_text + ' X' + _message_shown + ' ' + _hidden[i].innerHTML + ' '; _hidden[i].innerHTML = content; } }

function hideMeOpenDialog(dialog) { dialog.style.display = "block"; }

function hideMeCloseDialog(dialog) { dialog.style.display = "none"; }