User:H2g2bob/metadata.js

/* * - Shows hidden data contained in templates like * - Adds a single css class for all microformat classes, to make it easier to highlight. To be fair, this is a little pointless as you could just style that with css anyway :) * * Add css like the following to your common.css file:

.hidden-data { font-size: 70%; color: #cc0000; } .nonhidden-data { color: #000000; } .mf-strong { background-color: #ffcccc; } .mf-weak { background-color: #ffe7e7; }

*/ window.addEventListener && window.addEventListener("load", (function { var colorizer = (function (strength) {   return (function (cssclass) { var el = document.getElementsByClassName(cssclass); for (var i=0; i < el.length; ++i) { var e = el[i]; var p = e.parentNode; while (p.nodeType != Node.ELEMENT_NODE) { p = p.parentNode; }       if (p && p.style.display == "none") { p.style.display = "inline"; p.className = p.className + " hidden-data " + strength; p.title = (p.title || "") + " css: " + cssclass; } else { e.className = e.className + " nonhidden-data " + strength; e.title = (e.title || "") + " css: " + cssclass; }     }    });  });

var weak_metadata_classes = [ "adr", "label" ]; weak_metadata_classes.forEach(colorizer("mf-weak")); var strong_metadata_classes = [ "fn", "nickname", "org", "bday", "dday", "category", "post-office-box", "extended-address", "street-address", "locality", "region", "postal-code", "country-name", "url", "tel", "email", "tz", "geo", "uid" ]; strong_metadata_classes.forEach(colorizer("mf-strong")); }), false);