diff options
| author | Mark Christian | 2011-04-04 22:14:17 -0700 |
|---|---|---|
| committer | Mark Christian | 2011-04-04 22:14:17 -0700 |
| commit | bb9fac54096e4afe2f4f460fdb5129beca9e8a88 (patch) | |
| tree | 615994722b57edcbdbc65f5876ebc731dd968395 | |
| parent | 95a03fad9c5cfd25a684be3670bf5d1520d03456 (diff) | |
| download | ffffallback-bb9fac54096e4afe2f4f460fdb5129beca9e8a88.tar.bz2 | |
Fix broken Update, fix console eating, switch to @ded's DOM-ready implementaton
| -rw-r--r-- | bookmarklet/ffffallback.js | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/bookmarklet/ffffallback.js b/bookmarklet/ffffallback.js index 354a127..11f5650 100644 --- a/bookmarklet/ffffallback.js +++ b/bookmarklet/ffffallback.js @@ -3,14 +3,6 @@ return alert('FFFFALLBACK only works in Chrome, Safari, and Firefox right now. :(\n\nSorry,\n - Mark'); } - if(typeof(console) == 'undefined') { - var console = { - log: function(message) { - // alert(message); - } - } - } - var $ = { memo: {}, } @@ -238,7 +230,7 @@ $.each(cssObject, function(declarations, selector) { cssText += '#ffffallback-content-container ' + selector + ' {\n'; - cssText += 'color: magenta'; + cssText += 'color: magenta !important;'; $.each(declarations, function(value, key) { if(key === 'x-more') { cssText += ' ' + value + ';\n'; @@ -263,6 +255,14 @@ window.$fallback = $; $.init = function() { + if(!console || !console.log) { + var console = { + log: function(message) { + // alert(message); + } + } + } + console.log('start'); var clonedCopy = $.createElementWithContent('div', document.body.innerHTML); @@ -394,11 +394,13 @@ }); } - if(document.body) { - $.init(); + // Thanks to Dustin Diaz for this clever hack + // http://dustindiaz.com/smallest-domready-ever + if(/in/(document.readyState)) { + window.addEventListener('load', function() { + $.init(); + }, false); } else { - window.addEventListener('load', function() { $.init(); - }, false); } })();
\ No newline at end of file |
