From a317ffe8375baf518b28aec30fdf150f54e67345 Mon Sep 17 00:00:00 2001 From: anami Date: Tue, 28 Oct 2014 11:07:07 +0000 Subject: [PATCH] bookmarklet working in Firefox - negate_iife option added to the uglify task --- Gruntfile.js | 5 +++++ index.html | 2 +- stylist.min.js | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index d58ee6c..0a42941 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -4,6 +4,11 @@ module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), uglify: { + options: { + compress: { + negate_iife: false + } + }, normal: { src: '<%= pkg.name %>.js', dest: '<%= pkg.name %>.min.js' diff --git a/index.html b/index.html index 4b49d42..86a17b5 100644 --- a/index.html +++ b/index.html @@ -17,7 +17,7 @@

Stylist

Add and edit live CSS to any page in any modern browser.. and have the changes persist everytime you run the bookmarklet on the page.

You may want a different look to a page that you regularly visit or help you style a page that you are developing.

Simply copy the link below as a bookmark - click the bookmark on the page you wish to change...

-

Run Stylist

+

Run Stylist

Once you have clicked the bookmarklet - the panel should open and you're good to go..

Rationale

I wasn't aware of any live CSS editors at the time. However upon finding them, they seem to live as extensions for those browsers. You'd need to download and install the extension on each browser.

diff --git a/stylist.min.js b/stylist.min.js index ce4f858..06f35a7 100644 --- a/stylist.min.js +++ b/stylist.min.js @@ -1 +1 @@ -!function(a,b,c){function d(a,b){return function d(){if(!d.timer){var e=arguments,f=this;d.timer=setTimeout(function(){a.apply(f,e),d.timer=c},b)}}}function e(a,b){for(var c,d=b.split(";"),e=0,f=d.length;f>e;e++)c=d[e].split(":"),a.style.setProperty(c[0],c[1],"important")}function f(a,c){var d=b.createElement("li");e(d,"color:#555;display:block"),d.appendChild(b.createTextNode(c)),a.appendChild(d)}function g(){function c(){o.innerHTML=p.value,t()}if(b.getElementById("stylist:panel"))return void alert("Stylist is already running - CTRL+M to open panel");var g=b.getElementsByTagName("head")[0],n=b.body,o=b.createElement("style"),p=b.createElement("textarea"),q=b.createElement("div"),r=b.createElement("h1"),s=b.createElement("ul");q.style.display="block",p.spellcheck=!1,p.id="stylist:input",q.id="stylist:panel",e(q,"position:fixed;top:0;right:0;width:300px;height:100%;z-index:2147483647;overflow:auto;outline:none;padding:10px 20px;borderTop:0;borderBottom:0;borderRight:0;borderLeft:1px solid #ccc;color:#222;background:#fcfcfc"),e(p,"font:13px Inconsolata, Consolas, Menlo, Monaco, Lucida Console, Courier New, Courier, monospace;width:100%;height:calc(100% - 120px);direction:ltr;textAlign:left;background:#fcfcfc"),r.innerHTML="Stylist",e(r,"color:#555;background-color:#fcfcfc;width:150px;height:1.5em;margin:4px 0 4px 0;font-family:monospace"),e(s,"font:12px monospace;list-style:none;margin-left:-30px"),f(s,"CTRL+M: toggle this panel"),f(s,"ALT+click: target element"),q.appendChild(r),q.appendChild(s),q.appendChild(p),g.appendChild(o),n.appendChild(q),o.innerHTML=localStorage.siteStyle||"",p.value=o.innerHTML,p.placeholder="/* Enter your styles here. */",n.addEventListener("click",function(a){if(-1===p.style.display.indexOf("none")&&a.target.id!==p.id&&a.altKey){var b,c,d=0,e=a.target,f=e.className.split(" ")||"",g=[],h="",i="";for(i+=e.tagName.toLowerCase(),e.id&&(i+="#"+e.id),d=0;de;e++)c=d[e].split(":"),a.style.setProperty(c[0],c[1],"important")}function f(a,c){var d=b.createElement("li");e(d,"color:#555;display:block"),d.appendChild(b.createTextNode(c)),a.appendChild(d)}function g(){function c(){o.innerHTML=p.value,t()}if(b.getElementById("stylist:panel"))return void alert("Stylist is already running - CTRL+M to open panel");var g=b.getElementsByTagName("head")[0],n=b.body,o=b.createElement("style"),p=b.createElement("textarea"),q=b.createElement("div"),r=b.createElement("h1"),s=b.createElement("ul");q.style.display="block",p.spellcheck=!1,p.id="stylist:input",q.id="stylist:panel",e(q,"position:fixed;top:0;right:0;width:300px;height:100%;z-index:2147483647;overflow:auto;outline:none;padding:10px 20px;borderTop:0;borderBottom:0;borderRight:0;borderLeft:1px solid #ccc;color:#222;background:#fcfcfc"),e(p,"font:13px Inconsolata, Consolas, Menlo, Monaco, Lucida Console, Courier New, Courier, monospace;width:100%;height:calc(100% - 120px);direction:ltr;textAlign:left;background:#fcfcfc"),r.innerHTML="Stylist",e(r,"color:#555;background-color:#fcfcfc;width:150px;height:1.5em;margin:4px 0 4px 0;font-family:monospace"),e(s,"font:12px monospace;list-style:none;margin-left:-30px"),f(s,"CTRL+M: toggle this panel"),f(s,"ALT+click: target element"),q.appendChild(r),q.appendChild(s),q.appendChild(p),g.appendChild(o),n.appendChild(q),o.innerHTML=localStorage.siteStyle||"",p.value=o.innerHTML,p.placeholder="/* Enter your styles here. */",n.addEventListener("click",function(a){if(-1===p.style.display.indexOf("none")&&a.target.id!==p.id&&a.altKey){var b,c,d=0,e=a.target,f=e.className.split(" ")||"",g=[],h="",i="";for(i+=e.tagName.toLowerCase(),e.id&&(i+="#"+e.id),d=0;d