Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added minified version..

  • Loading branch information...
commit 30cc3a7d9d71b13ea5f61827d2b35df145136f00 1 parent 1559255
@jayphelps authored
Showing with 1 addition and 0 deletions.
  1. +1 −0  stutter.min.js
View
1  stutter.min.js
@@ -0,0 +1 @@
+(function(o){function d(a){if(!(this instanceof d))return new d(a);this.name="StutterError "+b.token+k;this.message=a||"Houston, we have a problem. (but I wasn't told why)"}var l=Object.prototype.toString,k;d.prototype=Error();d.prototype.constructor=d;var b={token:"@",directives:{},handlers:[],directiveRegEx:null,expandNewlineEscapes:!0},h;"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(exports=module.exports=b),exports.Stutter=b,h=!1):(o.Stutter=b,h=!0);var m=b.directives,i=b.handlers,n;b.setToken=function(a){b.token=a;n=b.directiveRegEx=RegExp(a+"(\\S+)(.*)?")};b.setToken(b.token);b.register=function(a,e,c){c=c||{};m[a]=function(){return e.apply(c,arguments)}};b.eval=function(a){if(!a)return!1;a=b.process(a);return eval(a)};b.run=function(){for(var a=document.getElementsByTagName("script"),e=0,c=a.length;e<c;e++)switch(a[e].type){case "text/sutter":case "application/stutter":var g=a[e];g.src||b.eval(g.innerHTML||g.text)}};b.process=function(a){b.expandNewlineEscapes&&(a=a.replace(/\\\n/g,""));return a.replace(/(.*)\n/g,function(a){var c=a.match(n);if(c){var b=c[1],f=m[b];if(f&&(k=b,c=c[2],b=c.match(/([\S]+)(?:[ \t]+(.+))?/),f=f(b[1],b[2],c))){if("[object Function]"==l.call(f))return i.push(f),"";if("[object String]"==l.call(f))return f}}f=a;for(c=i.length-1;0<=c;c--)a=i[c](a),"string"!==typeof a&&(a=a?f:"");return a})};var j={};b.register("define",function(a,b){if(!a)throw new d("Invalid define syntax");var c=RegExp(a,"g"),b=this[a]=b||!0;return function(a){return a.replace(c,b)}},j);b.register("ifdef",function(a){var e=b.token+"endif";if(!a)throw new d("Invalid ifdef syntax");var c=!!j[a],g=!1;return function(a){return g?a:a.match(e)?(g=!0,!1):c}});b.register("import",function(a){if(!a)throw new d("Missing file path");var e=a.replace(/\s*url\(\s*'([^']*)'\)/,"$1").replace(/\s*url\(\s*"([^"]*)"\)/,"$1").replace(/\s*'([^']*)'/,"$1").replace(/\s*"([^"]*)"/,"$1");if(!e)throw new d("Invalid import url: "+a);if(h){var c=new XMLHttpRequest;c.open("GET",e,!1);c.send(null);if(200!==c.status&&!c.responseText)throw new d("Importing file failed: "+a+" with status code: "+c.status);a=b.process(c.responseText)}else throw new d("Non-browser use isn't ready yet...sorry");return a},j)})(this);
Please sign in to comment.
Something went wrong with that request. Please try again.