Created
August 1, 2015 15:09
-
-
Save dannvix/df4ff25bc5ed5d15a3c3 to your computer and use it in GitHub Desktop.
Revisions
-
dannvix created this gist
Aug 1, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ /* * Pack below script via http://jscompress.com/ to generate bookmarklet */ (function(rootNode, fontFamily) { var hasChildTextNode = function(parentNode) { return [].some.call(parentNode.childNodes, function(node) { if (node.nodeType == Node.TEXT_NODE) { console.log(node.nodeValue); } return node.nodeType == Node.TEXT_NODE; }); }; var OverrideFontFamilyRecursively = function(parentNode) { var childNodes = parentNode.childNodes; [].forEach.call(childNodes, function(node, index) { switch (node.nodeType) { case Node.ELEMENT_NODE: if (hasChildTextNode(node)) { node.style.fontFamily = fontFamily + " " + node.style.fontFamily; node.style.webkitFontSmoothing = "subpixel-antialiased"; } OverrideFontFamilyRecursively(node); break; } }); }; OverrideFontFamilyRecursively(rootNode); })(document.body, "Hiragino Kaku Gothic Pro");