From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- .../microformats/test/static/javascript/count.js | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 toolkit/components/microformats/test/static/javascript/count.js (limited to 'toolkit/components/microformats/test/static/javascript/count.js') diff --git a/toolkit/components/microformats/test/static/javascript/count.js b/toolkit/components/microformats/test/static/javascript/count.js new file mode 100644 index 000000000..56a64c05e --- /dev/null +++ b/toolkit/components/microformats/test/static/javascript/count.js @@ -0,0 +1,62 @@ +/*! + parse + Used by http://localhost:3000/ + Copyright (C) 2010 - 2015 Glenn Jones. All Rights Reserved. + MIT License: https://raw.github.com/glennjones/microformat-shiv/master/license.txt +*/ + +window.onload = function() { + + var form; + form= document.getElementById('mf-form'); + + form.onsubmit = function(e){ + e.preventDefault(); + + var html, + doc, + node, + options, + mfJSON, + parserJSONElt; + + // get data from html + html = document.getElementById('html').value; + parserJSONElt = document.querySelector('#parser-json pre code') + + // createHTMLDocument is not well support below ie9 + doc = document.implementation.createHTMLDocument("New Document"); + node = document.createElement('div'); + node.innerHTML = html; + doc.body.appendChild(node); + + options ={ + 'node': node + }; + + // parse direct into Modules to help debugging + if(window.Modules){ + var parser = new Modules.Parser(); + mfJSON = parser.count(options); + }else if(window.Microformats){ + mfJSON = Microformats.count(options); + } + + + // format output + parserJSONElt.innerHTML = htmlEscape( js_beautify( JSON.stringify(mfJSON) ) ); + //prettyPrint(); + + } + + function htmlEscape(str) { + return String(str) + .replace(/&/g, '&') + .replace(/"/g, '"') + .replace(/'/g, ''') + .replace(//g, '>'); + } + + +}; -- cgit v1.2.3