vernal pool

Mittineague

Really Valid? GreaseMonkey Userscript

There are no plants in blossom on February the 3rd.
The earliest date currently listed is Mar 15, and the latest date is Nov 11
// ==UserScript==
// @name          Really Valid?
// @namespace     http://www.mittineague.com/dev/
// @description   check if pages claiming to be valid (X)HTML really are
// @include       *
// ==/UserScript==
 
/*
 * This is a modified version of the userscript from
 * http://www.oreilly.com/catalog/greasemonkeyhks/
 *
 * XPATH changed so as to include variations in href value
 * title and innerHTML changed
 * November 15, 2006 - added (function(){ [CODE] })();
 * 
 * ORIGINAL CODE
 *
 * var snapValidLinks = document.evaluate(
 *     "//a[@href='http://validator.w3.org/check/referer']",
 *     document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
 * if (!snapValidLinks.snapshotLength) return;
 * GM_xmlhttpRequest({
 *     method: 'GET',
 *     url: 'http://validator.w3.org/check?uri=' + escape(location),
 *     onload: function(oResponse) {
 *         if (/This Page Is Valid/.test(oResponse.responseText)) return;
 *         for (var i = 0; i < snapValidLinks.snapshotLength; i++) {
 *             var elmInvalid = snapValidLinks.snapshotItem(i);
 *             elmInvalid.title = 'This page claimed to validate, but it lied';
 *             elmInvalid.innerHTML = 'Invalid markup!';
 *         }
 *     }
 * });
 *
 */
 
(function(){
 
var snapValidLinks = document.evaluate(
    "//a[starts-with(@href, 'http://validator.w3.org/check')]",
    document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
if (!snapValidLinks.snapshotLength) return;
GM_xmlhttpRequest({
    method: 'GET',
    url: 'http://validator.w3.org/check?uri=' + escape(location),
    data: null,
    onload: function(oResponse) {
        if (/Passed validation/.test(oResponse.responseText)) return; //This Page Is Valid
        for (var i = 0; i < snapValidLinks.snapshotLength; i++) {
            var elmInvalid = snapValidLinks.snapshotItem(i);
            elmInvalid.title = 'This page is NOT valid';
            elmInvalid.innerHTML = 'Invalid (X)HTML!';
        }
    }
});
 
})();
reallyvalid.user.js
About - Blog - Sitemap - Contact - Forums - Home 

PHP icon. PEAR icon. MySQL icon. phpBB icon. Sitepoint icon. Valid XHTML 1.0 icon. Valid CSS! icon. Level A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0