diff options
| author | Mark Christian | 2011-04-03 21:34:49 -0700 |
|---|---|---|
| committer | Mark Christian | 2011-04-03 21:34:49 -0700 |
| commit | 58d83de32e9bc0672fb13b7e2a63a5915b74418d (patch) | |
| tree | f2c3ed80b1308d6251447867c6ef77f17d1653b0 | |
| parent | 400c0050eeef46b1a5a9c04579819a3c0bddc58f (diff) | |
| download | ffffallback-58d83de32e9bc0672fb13b7e2a63a5915b74418d.tar.bz2 | |
FF checkpoint
| -rw-r--r-- | bookmarklet/ffffallback.css | 6 | ||||
| -rw-r--r-- | bookmarklet/ffffallback.js | 36 | ||||
| -rw-r--r-- | secret.html | 5 |
3 files changed, 34 insertions, 13 deletions
diff --git a/bookmarklet/ffffallback.css b/bookmarklet/ffffallback.css index c8f1fd6..492862f 100644 --- a/bookmarklet/ffffallback.css +++ b/bookmarklet/ffffallback.css @@ -23,7 +23,8 @@ } #ffffallback-controller .expanded .ffffallback-disclosure { - -webkit-transform:rotate(90deg); + -moz-transform: rotate(90deg); + -webkit-transform: rotate(90deg); } #ffffallback-controller .ffffallback-disclosure { @@ -31,9 +32,10 @@ display: inline-block; text-decoration: none; width: 16px; + -moz-transition-property: -moz-transform; + -moz-transition-duration: 0.125s; -webkit-transition-property: -webkit-transform; -webkit-transition-duration: 0.125s; - } #ffffallback-content-container * { diff --git a/bookmarklet/ffffallback.js b/bookmarklet/ffffallback.js index d071612..2eb4dd3 100644 --- a/bookmarklet/ffffallback.js +++ b/bookmarklet/ffffallback.js @@ -1,4 +1,12 @@ (function() { + if(typeof(console) == 'undefined') { + var console = { + log: function(message) { + // alert(message); + } + } + } + var $ = { memo: {}, } @@ -18,6 +26,12 @@ }; $.getComputedStyleOfElement = function(elem) { + if(!elem.tagName) { + alert("WHAT THE FUCK"); + window.bum = elem; + return null; + } + /** * Based on this blog entry: * http://blog.stchur.com/2006/06/21/css-computed-style/ @@ -25,6 +39,7 @@ if (typeof elem.currentStyle != 'undefined') { return elem.currentStyle; } + return document.defaultView.getComputedStyle(elem, null); }; @@ -45,7 +60,6 @@ $.getFontsFromDeclaration = function(fontDeclaration) { if($.getFontsFromDeclaration.memo[fontDeclaration]) { - console.log('memo'); return $.getFontsFromDeclaration.memo[fontDeclaration]; } @@ -60,12 +74,14 @@ $.getFontsFromDeclaration.memo = {}; $.getElementFont = function(elem) { - var style = $.getComputedStyleOfElement(elem); - if(style && style['font-family']) { + var style = $.getComputedStyleOfElement(elem) || {}; + if(style['font-family']) { return style['font-family']; - } else { - return null; + } else if(style['fontFamily']) { + return style['fontFamily']; } + + return null; } $.unique = function(array) { @@ -126,6 +142,9 @@ var elemFont = $.getElementFont(elem); var fonts = elemFont ? [elemFont] : []; $.each(elem.childNodes, function(childElem) { + if(!childElem.tagName) { + return; + } fonts = fonts.concat($.getAllFontsInUse(childElem)); }); return $.removeBoringFonts($.unique(fonts)).sort(); @@ -171,7 +190,7 @@ $.addFontClasses = function(elem, parentFont) { parentFont = parentFont || null; - var font = $.getElementFont(elem); + var font = elem.tagName ? $.getElementFont(elem) : false; if(elem.getAttribute) { var className = false; @@ -233,8 +252,8 @@ document.body.appendChild(styleElement); } - styleElement.innerText = cssText; - console.log('Did set', cssText); + styleElement.innerHTML = cssText; + console.log('Did set' + cssText); }; window.$fallback = $; @@ -271,6 +290,7 @@ </form>\ '); controller.setAttribute('id', 'ffffallback-controller'); + console.log('adding controller'); document.body.appendChild(controller); var fontList = document.getElementById('ffffallback-fonts'); fontList.innerHTML = ''; diff --git a/secret.html b/secret.html index 3c3b162..df3f1fd 100644 --- a/secret.html +++ b/secret.html @@ -56,8 +56,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> - <script src="bookmarklet/ffffallback.js"></script> - <link rel="stylesheet" href="bookmarklet/ffffallback.css" /> - + <!-- <script src="bookmarklet/ffffallback.js"></script> + <link rel="stylesheet" href="bookmarklet/ffffallback.css" /> --> </body> </html> |
