diff options
author | Mottie <wowmotty@gmail.com> | 2015-09-29 06:34:50 +0300 |
---|---|---|
committer | Mottie <wowmotty@gmail.com> | 2015-09-29 06:34:50 +0300 |
commit | f00f46471ce7c0a1c566a3773a09341268b03d9b (patch) | |
tree | 92f442bef12c0c86de60038a341a140ffbfb490f /src/bookmarklet/bookmarklet.js | |
parent | 09780adc248988808678eadaa5b33590c19e2493 (diff) |
Add Chrome & Opera extensionsv4.0.1
Diffstat (limited to 'src/bookmarklet/bookmarklet.js')
-rw-r--r-- | src/bookmarklet/bookmarklet.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/bookmarklet/bookmarklet.js b/src/bookmarklet/bookmarklet.js new file mode 100644 index 0000000..04a02e9 --- /dev/null +++ b/src/bookmarklet/bookmarklet.js @@ -0,0 +1,27 @@ +/* +Don't wrap this code in a self-executing anonymous function, i.e. + (function(){ CODE })(); +because uglify changes it into + !function(){ CODE }(); +and Firefox does not work with that format! +*/ +// uncompressed bookmarklet code +function loadScript(url, callback) { + var script = document.createElement('script'), + head = document.getElementsByTagName('head')[0], + done = false; + script.type = 'text/javascript'; + script.src = url; + script.onload = script.onreadystatechange = function() { + if ( !done && ( !this.readyState || this.readyState == 'loaded' || this.readyState == 'complete' ) ) { + done = true; + callback(); + } + }; + head.appendChild(script); +} +// dev = src/printliminator.js +// production = //css-tricks.github.io/The-Printliminator/printliminator.min.js +loadScript('{printliminator}', function() { + thePrintliminator.init(); +}); |