diff options
author | Mottie <wowmotty@gmail.com> | 2015-08-23 02:22:14 +0300 |
---|---|---|
committer | Mottie <wowmotty@gmail.com> | 2015-08-24 19:05:21 +0300 |
commit | 499adbd59e8958c1596b7ae60d410a733de7650a (patch) | |
tree | 61c3b3564215d6db01ce6b013b6878dc343c2d45 /index.html | |
parent | d12145f26c63d37fd029bdb80a2cf0a539c3c8df (diff) |
Add grunt build process:
1) The "src/bookmarklet.js" file contains the uncompressed bookmarklet code.
2) In the build process, that file is minified & added into the "src/index.html"
file in two places:
a) The actual link href (default link).
b) development bookmarklet link (inside js code which updates the link).
3) A new "index.html" and minified "printliminator.min.js" file are written
to the root folder.
4) When the "index.html" in the root folder is loaded in the browser, and the
js detects the origin is "file://", then the links in the "index.html" file
get changed and to point to local files to make it easier for development.
Diffstat (limited to 'index.html')
-rw-r--r-- | index.html | 32 |
1 files changed, 27 insertions, 5 deletions
@@ -3,10 +3,20 @@ <head> <meta charset="UTF-8"> <title>The Printliminator</title> - <link rel="stylesheet" href="css/style.css"> + <link rel="stylesheet" href="demo/css/style.css"> </head> <body> + +<!-- +This file is dynamically generated +█████▄ ▄████▄ █████▄ ▄████▄ ██████ ███████▄ ▄████▄ █████▄ ██ ██████ ██ ██ +██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀▀██ +█████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀ +To make changes, modify the "src/index.html" +--> + <div id="demo-top-bar"> <div id="demo-bar-inside"> <h2 id="demo-bar-badge"> @@ -18,7 +28,7 @@ <div id="page-wrap"> - <h1>The Printliminator</h1> + <h1>The Printliminator<span id="dev-mode"></span></h1> <p>The Printliminator is a bookmarklet with some simple tools you can use to makes websites print better. One click to activate, and then click to remove @@ -26,8 +36,9 @@ Here is the bookmarklet:</p> <p> - <a href="javascript:/*PRINTLIMINATOR*/(function(){function%20loadScript(a,b){var%20c=document.createElement('script');c.type='text/javascript';c.src=a;var%20d=document.getElementsByTagName('head')[0],done=false;c.onload=c.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){done=true;b()}};d.appendChild(c)}loadScript('//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js',function(){var%20jq=jQuery.noConflict();loadScript('//css-tricks.github.io/The-Printliminator/js/printliminator.js',function(){csstricksPrintliminator(jq)})})})()" class="bookmarklet">Printliminator</a> - <span style="font-size: 14px;">< drag to your bookmarks bar</span> + <a href="javascript:/*PRINTLIMINATOR*/!function(){function%20a(a,b){var%20c=document.createElement('script'),d=document.getElementsByTagName('head')[0],e=!1;c.type='text/javascript',c.src=a,c.onload=c.onreadystatechange=function(){e||this.readyState&&'loaded'!=this.readyState&&'complete'!=this.readyState||(e=!0,b())},d.appendChild(c)}a('//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js',function(){var%20b=jQuery.noConflict();a('//css-tricks.github.io/The-Printliminator/printliminator.min.js',function(){csstricksPrintliminator(b)})})}();" id="bookmarklet" class="bookmarklet">Printliminator</a> + <span class="drag-arrow"><strong>←</strong> drag to your bookmarks bar</span> + </p> <h2>Video Demo</h2> @@ -43,6 +54,17 @@ </div> + <script> + // file loaded locally, switch to local version for development + ( function() { + if ( window.location.origin === 'file://' ) { + var link = document.getElementById( 'bookmarklet' ); + link.href = "javascript:/*PRINTLIMINATOR*/!function(){function%20a(a,b){var%20c=document.createElement('script'),d=document.getElementsByTagName('head')[0],e=!1;c.type='text/javascript',c.src=a,c.onload=c.onreadystatechange=function(){e||this.readyState&&'loaded'!=this.readyState&&'complete'!=this.readyState||(e=!0,b())},d.appendChild(c)}a('http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js',function(){var%20b=jQuery.noConflict();a('src/printliminator.js',function(){csstricksPrintliminator(b)})})}();"; + document.getElementById('dev-mode').textContent = '(Dev Mode)'; + } + })(); + </script> + </body> -</html>
\ No newline at end of file +</html> |