summaryrefslogtreecommitdiffstats
path: root/secret.html
diff options
context:
space:
mode:
authorMark Christian2011-03-30 18:41:27 -0700
committerMark Christian2011-03-30 18:41:27 -0700
commitc91ce65f21f3caa6ae8bcbc5955f6a48878320fa (patch)
tree626b42aed07db34a14abaec1054a248e75ac3d1f /secret.html
parent0b56868cafc04bcca61a9bda36d6351f05a2461c (diff)
downloadffffallback-c91ce65f21f3caa6ae8bcbc5955f6a48878320fa.tar.bz2
Rebuild the bookmarklet on the fly and elide boring fonts
Diffstat (limited to 'secret.html')
-rw-r--r--secret.html33
1 files changed, 30 insertions, 3 deletions
diff --git a/secret.html b/secret.html
index 5fa0df4..cd1970e 100644
--- a/secret.html
+++ b/secret.html
@@ -11,11 +11,38 @@
</style>
</head>
<body>
- <hgroup>
+ <hgroup>
<h1>FFFFALLBACK</h1>
<h2>A simple tool for bulletproof web typography.</h2>
- </hgroup>
+ </hgroup>
<p>Shhhh! This is top secret. Grab the bookmarklet and take it for a spin. Please send any and all feedback to me at <a href="mailto:josh@jbrewer.me">feedback@ffffallback.com</a></p>
- <p>This is the bookmarklet: <a href="javascript:(function(){var scriptTag=document.createElement('script');scriptTag.setAttribute('src','http://ffffallback.com/bookmarklet/ffffallback.js?r' + Math.random());var linkTag=document.createElement('link');linkTag.setAttribute('href','http://ffffallback.com/bookmarklet/ffffallback.css');linkTag.setAttribute('rel','stylesheet');document.body.appendChild(scriptTag);document.body.appendChild(linkTag);})();">ffffallback</a>&mdash;drag it to your bookmarks bar and brace yourself for an onslaught of unicorns and rainbows.</p>
+ <p>This is the bookmarklet: <a id="bookmarklet" href="#">ffffallback</a>&mdash;drag it to your bookmarks bar and brace yourself for an onslaught of unicorns and rainbows.</p>
+ <script>
+ var myURL = window.location.toString();
+ var baseURL;
+ if(myURL.match(/\.html$/)) {
+ var urlChunks = myURL.split('/');
+ baseURL = urlChunks.slice(0, urlChunks.length - 1).join('/')
+ } else {
+ baseURL = myURL;
+ }
+ if(baseURL.substring(myURL.length - 1) !== '/') {
+ baseURL += '/';
+ }
+ var jsURL = baseURL + 'bookmarklet/ffffallback.js?r=' + Math.random();
+ var cssURL = baseURL + 'bookmarklet/ffffallback.css?r=' + Math.random();
+ var bookmarkletSource = 'javascript:' +
+"(function() {\
+ var scriptTag = document.createElement('script');\
+ scriptTag.setAttribute('src', '" + jsURL + "');\
+ var linkTag = document.createElement('link');\
+ linkTag.setAttribute('href', '" + cssURL + "');\
+ linkTag.setAttribute('rel','stylesheet');\
+ document.body.appendChild(scriptTag);\
+ document.body.appendChild(linkTag);\
+})();".replace(/\n/g, ' ');
+
+ document.getElementById('bookmarklet').setAttribute('href', bookmarkletSource);
+ </script>
</body>
</html>