Permalink
Browse files

add npm information and use npm dependencies to manage jshint and uglify

  • Loading branch information...
1 parent 467549b commit 541fdeac99ef7f3b0bb1ffb4655fb8ee58d5fa85 @julienw committed May 2, 2015
Showing with 113 additions and 4,583 deletions.
  1. +1 −0 .gitignore
  2. +15 −0 .jshintrc
  3. +14 −6 Makefile
  4. +11 −9 dollardom-animate.min.js
  5. +11 −9 dollardom-chain-animate.min.js
  6. +11 −9 dollardom-chain.min.js
  7. +5 −12 dollardom-full.debug.js
  8. +11 −9 dollardom.min.js
  9. +0 −4,359 lib/jshint/jshint.js
  10. +0 −158 lib/jshint/run.js
  11. +29 −0 package.json
  12. +2 −4 src/animate.js
  13. +0 −2 src/chain.js
  14. +3 −6 src/dollardom.js
View
@@ -1 +1,2 @@
checkjs
+node_modules
View
@@ -0,0 +1,15 @@
+{
+ "bitwise": true,
+ "curly": true,
+ "eqeqeq": true,
+ "immed": true,
+ "latedef": true,
+ "newcap": true,
+ "noarg": true,
+ "nonew": true,
+ "undef": true,
+ "boss": true,
+ "regexdash": true,
+ "smarttabs": true
+}
+
View
@@ -1,11 +1,11 @@
# command to minify the javascript files
-JSMINIFY = uglifyjs
+JSMINIFY = node_modules/.bin/uglifyjs
# options to give to the minification command
-JSMINIFY_OPTS = --unsafe --lift-vars
+JSMINIFY_OPTS = -c unsafe -m --comments --
# command to run jshint
-CHECKJS = node lib/jshint/run.js
+CHECKJS = node_modules/.bin/jshint
# modules to be built
MODULES = dollardom dollardom-animate dollardom-chain dollardom-chain-animate
@@ -19,6 +19,9 @@ CONCAT = $(addsuffix .cat.js,$(MODULES))
# all sources
SOURCES = dollardom.js animate.js chain.js
+# tools installed by npm
+NPM_TOOLS = $(JSMINIFY) $(CHECKJS)
+
# directory for source files
VPATH = src
@@ -40,7 +43,7 @@ all: $(MINIFIED) dollardom-full.debug.js
# recipe for minifying concatenated javascript files
# it also removes the debug parts and checks the resulting file for correctness
-%.min.js: %.cat.js
+%.min.js: %.cat.js | $(JSMINIFY)
sed -e '\#/\*!$(DEBUG_KEYWORD)!\*/#d' -e '\#/\*!$(DEBUG_KEYWORD)#,\#$(DEBUG_KEYWORD)!\*/#d' $< > $<.tmp
$(CHECKJS) $<.tmp
$(JSMINIFY) $(JSMINIFY_OPTS) $<.tmp > $@
@@ -52,7 +55,7 @@ all: $(MINIFIED) dollardom-full.debug.js
# the recipe just concatenates all specified prerequisites together
$(CONCAT): dollardom.js | checkjs
cat $^ > $@
-
+
# specify additional prerequisites for these targets
dollardom-animate.cat.js: animate.js
@@ -70,6 +73,11 @@ clean:
-rm -f dollardom-full.debug.js
-rm checkjs
-checkjs: $(SOURCES)
+checkjs: $(SOURCES) | $(CHECKJS)
$(CHECKJS) $^
touch checkjs
+
+$(NPM_TOOLS): package.json
+ npm install
+ touch $@
+
@@ -1,9 +1,11 @@
-/**
-* $dom library (v0.9.2b) copyright 2009, 2010, 2011 Keith Clark
-* Licensed under the MIT License.
-* http://www.keithclark.co.uk/
-*
-* Copyright 2011, 2012 Julien Wajsberg
-* Licensed under the MIT License
-* http://github.com/julienw/dollardom
-*/(function(a){function q(a,b,c){var d=r(b),e=p[d];return e&&e.set?e.set(a,c):a.style[d]=c}function r(a){return o[a]||(o[a]=a.replace(l,function(a,b){return b.toUpperCase()}))}function s(a,c,d){var f;if(d===b){if(typeof c=="string")return e(a,c)||0;for(f in c)q(a,f,c[f])}else q(a,c,d)}function t(a){var c,d=[];if(typeof a=="string")while(a){c=a.match(k);if(c[0]==="")break;d.push({rel:c[1],uTag:(c[2]||"").toUpperCase(),id:c[3],classes:c[4]?c[4].split("."):b}),a=a.substring(c[0].length)}return d}function u(a,b){while((a=a.parentNode)&&a!==b);return a!==null}function v(a,b){function s(a,b){var c=b.id?(d=(a&&a.ownerDocument||g).getElementById(b.id))&&u(d,a)?[d]:[]:v(a.getElementsByTagName(b.uTag||"*")),d=c.length;if(d>0&&(b.id||b.classes))while(d--)w(c[d],b)||c.splice(d,1);return c}function v(a){var b,c,d;try{return Array.prototype.slice.call(a)}catch(e){b=[];for(c=0,d=a.length;c<d;c++)b.push(a[c]);return b}}function x(a){var b;for(b=c.length;b--;)if(c[b]===a)return i;return j}var c,d,e,f,h,k,l,m,n,o,p,q,r;c=[],d=[a],e=t(b),e.length||(e=[{}]);for(f=0,h=e.length;f<h;f++){o=e[f];for(k=0,l=d.length;k<l;k++){p=d[k];switch(o.rel){case">":r=p.childNodes;for(m=0,n=r.length;m<n;m++)w(r[m],o)&&c.push(r[m]);break;case"~":while(p=p.nextSibling)if(w(p,o)){if(x(p))break;c.push(p)}break;case"+":while((p=p.nextSibling)&&p.nodeType!==1);p&&w(p,o)&&c.push(p);break;default:q=s(p,o);if(f>0)for(m=0,n=q.length;m<n;m++)x(q[m])||c.push(q[m]);else c=c.concat(q)}}if(!c.length)return[];d=c.splice(0,c.length)}return d}function w(a,b){var c,d,e;return b?(c=b.uTag,d=b.id,e=b.classes,a.nodeType===1&&(!c||c===a.tagName)&&(!d||d===a.id)&&(!e||!!A(a,e))):!0}function x(a,b,c){c=t(c)[0];while(a&&!w(a,c)&&(a=a[b]));return a}function y(a,b){return b=t(b)[0],a&&w(a,b)}function z(a,b,c){return x(a[b],b,c)}function A(a,b){var c;if(a.className==="")return j;for(c=0;c<b.length;c++)if(!K(a,b[c]))return j;return i}function B(){function e(){var d,e;if(!b){b=!0,c&&(c=a.clearTimeout(c));for(d=0,e=m.length;d<e;d++)m[d]()}}function f(){try{h.doScroll("left")}catch(b){a.setTimeout(f,20);return}e()}var b,c,d;if(g.addEventListener)g.addEventListener("DOMContentLoaded",e,j),g.addEventListener("load",e,j);else if(g.attachEvent){g.attachEvent("onload",e),d=!1;try{d=a.frameElement===null}catch(i){}d&&h.doScroll&&f()}}function C(a,b){var c,d,e,f=t(a)[0],h=f.uTag;return h?(c=(b||g).createElement(h),d=f.id,e=f.classes,d&&(c.id=d),e&&(c.className=e.join(" ")),c):null}function D(b){/loaded|complete|interactive/.test(g.readyState)?a.setTimeout(b,0):m.push(b)}function E(a,b){return v(b||h,a)}function F(a,b){return z(a,"parentNode",b)}function G(a,b){return z(a,"nextSibling",b)}function H(a,b){return z(a,"previousSibling",b)}function I(a,b){return a=a.parentNode.firstChild,x(a,"nextSibling",b)}function J(a,b){return a=a.parentNode.lastChild,x(a,"previousSibling",b)}function K(a,b){return(" "+a.className+" ").indexOf(" "+b+" ")>-1}function L(a,b){K(a,b)||(a.className+=" "+b)}function M(a,b){K(a,b)&&(a.className=a.className.replace(RegExp("(^|\\s)"+b+"(\\s|$)")," ").replace(/\s$/,""))}function N(a,b,c){(c?L:M)(a,b)}function O(a){return g.createTextNode(a)}function P(a,b,c){a.setAttribute(b,""+c)}function Q(a,b){return a.getAttribute(b)||null}function R(a,c,d){var e;if(typeof c=="object"){for(e in c)P(a,e,c[e]);return}if(d===b)return Q(a,c);P(a,c,d)}function S(a){while(a.firstChild)a.removeChild(a.firstChild)}function T(a,b){var c;b||(b=a,a=this);for(c in b)a[c]=b[c]}var b,c,d,e,f,g=a.document,h=g.documentElement,i=!0,j=!1,k=/^\s*([>+~])?\s*([*\w-]+)?(?:#([\w-]+))?(?:\.([\w.-]+))?\s*/,l=/-(\w)/g,m=[],n=[],o={"float":"cssFloat"in h.style?"cssFloat":"styleFloat"},p={borderWidth:{get:function(a){return e(a,"border-left-width")}},padding:{get:function(a){return e(a,"padding-left")}},margin:{get:function(a){return e(a,"margin-left")}}};!("opacity"in h.style)&&"filters"in h&&(p.opacity={set:function(a,b){var c=a.filters.alpha;c?c.opacity=b*100:a.style.filter+=" Alpha(opacity="+b*100+")"},get:function(a){var b=a.filters.alpha;return b?b.opacity/100:1}}),"clientWidth"in h&&(p.width={get:function(a){return a.style.width||a.clientWidth||a.offsetWidth}}),"clientHeight"in h&&(p.height={get:function(a){return a.style.height||a.clientHeight||a.offsetHeight}}),c=a.addEventListener?function(a,b,c){a.addEventListener(b,c,!1)}:function(b,c,d){var e=b.uniqueID+c+d;n[e]=function(){var c=a.event;return c.target=c.srcElement||g,c.currentTarget=b,c.preventDefault=function(){c.returnValue=!1},c.stopPropagation=function(){c.cancelBubble=!0},d.call(b,c)},b.attachEvent("on"+c,n[e])},d=a.removeEventListener?function(a,b,c){a.removeEventListener(b,c,!1)}:function(a,b,c){var d=a.uniqueID+b+c;a.detachEvent("on"+b,n[d]),delete n[d]},e=g.defaultView&&g.defaultView.getComputedStyle?function(a,b){var c=r(b),d=p[c];return d&&d.get?d.get(a):a.ownerDocument.defaultView.getComputedStyle(a,null).getPropertyValue(b)}:function(a,b){var c=r(b),d=p[c];return d&&d.get?d.get(a):a.currentStyle[c]},f={create:C,onready:D,addEvent:c,removeEvent:d,get:E,descendants:v,ancestor:F,next:G,previous:H,first:I,last:J,empty:S,is:y,text:O,attr:R,hasClass:K,addClass:L,removeClass:M,toggleClass:N,style:s,extend:T},a.$dom=f,B()})(this),function(a){function h(a,b){var c=e.splice(a,1)[0];c.callback&&c.callback(b,c.elm)}function i(a){var b,c,g,j,k,l,m,n,o;a=a||+(new Date);for(b=e.length-1;b>=0;b--){j={},k=e[b],k.startTime=k.startTime||a,l=k.duration,m=k.properties,n=a-k.startTime,o=.5-Math.cos(n/l*Math.PI)/2;for(c in m)g=m[c],j[c]=""+(n<l?g.s+(g.e-g.s)*o:g.e)+g.u,j[c]=="NaNpx"&&(j[c]=0);d(k.elm,j),n>=l&&h(b,!0)}e.length&&f(i)}function j(a,c,j,k){var l,m,n,o,p=[],q=-1;for(o=e.length-1;o>=0;o--)if(e[o].elm==a){q=o;break}if(c===b)return q>-1;q>-1&&h(q,!1),j===b&&(j=500);for(l in c)m=g.exec(d(a,l)),n=g.exec(c[l]),p[l]={s:parseFloat(m[1])||0,e:parseFloat(n[1])||0,u:n[2]||m[2]||""};e.push({elm:a,properties:p,callback:k,duration:j}),f(i)}var b,c=a.$dom,d=c.style,e=[],f=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame||a.msRequestAnimationFrame||function(b){a.setTimeout(function(){b()},16)},g=/^(.*?)(px|deg)?$/;c.transform=c.animate=j}(this);
+/**
+* $dom library (v0.9.2b) copyright 2009, 2010, 2011 Keith Clark
+* Licensed under the MIT License.
+* http://www.keithclark.co.uk/
+*
+* Copyright 2011, 2012 Julien Wajsberg
+* Licensed under the MIT License
+* https://github.com/julienw/dollardom
+* @preserve
+*/
+!function(e){function t(e,t,r){var i=n(t),a=P[i];return a&&a.set?a.set(e,r):e.style[i]=r}function n(e){return M[e]||(M[e]=e.replace(W,function(e,t){return t.toUpperCase()}))}function r(e,n,r){if(r===q){if("string"==typeof n)return U(e,n)||0;for(var i in n)t(e,i,n[i])}else t(e,n,r)}function i(e){var t,n=[];if("string"==typeof e)for(;e&&(t=e.match(I),""!==t[0]);)n.push({rel:t[1],uTag:(t[2]||"").toUpperCase(),id:t[3],classes:t[4]?t[4].split("."):q}),e=e.substring(t[0].length);return n}function a(e,t){for(;(e=e.parentNode)&&e!==t;);return null!==e}function o(e,t){function n(e,t){var n,i=t.id?(n=(e&&e.ownerDocument||D).getElementById(t.id))&&a(n,e)?[n]:[]:r(e.getElementsByTagName(t.uTag||"*"));if(n=i.length,n>0&&(t.id||t.classes))for(;n--;)u(i[n],t)||i.splice(n,1);return i}function r(e){try{return Array.prototype.slice.call(e)}catch(t){for(var n=[],r=0,i=e.length;i>r;r++)n.push(e[r]);return n}}function o(e){for(var t=v.length;t--;)if(v[t]===e)return V;return $}var l,c,s,f,d,g,h,p,m,v=[],y=[e],b=i(t);for(b.length||(b=[{}]),l=0,c=b.length;c>l;l++){for(h=b[l],s=0,f=y.length;f>s;s++)switch(p=y[s],h.rel){case">":var E=p.childNodes;for(d=0,g=E.length;g>d;d++)u(E[d],h)&&v.push(E[d]);break;case"~":for(;p=p.nextSibling;)if(u(p,h)){if(o(p))break;v.push(p)}break;case"+":for(;(p=p.nextSibling)&&1!==p.nodeType;);p&&u(p,h)&&v.push(p);break;default:if(m=n(p,h),l>0)for(d=0,g=m.length;g>d;d++)o(m[d])||v.push(m[d]);else v=v.concat(m)}if(!v.length)return[];y=v.splice(0,v.length)}return y}function u(e,t){if(!t)return!0;var n=t.uTag,r=t.id,i=t.classes;return!(1!==e.nodeType||n&&n!==e.tagName||r&&r!==e.id||i&&!f(e,i))}function l(e,t,n){for(n=i(n)[0];e&&!u(e,n)&&(e=e[t]););return e}function c(e,t){return t=i(t)[0],e&&u(e,t)}function s(e,t,n){return l(e[t],t,n)}function f(e,t){if(""===e.className)return $;for(var n=0;n<t.length;n++)if(!N(e,t[n]))return $;return V}function d(){function t(){if(!r){r=!0,i&&(i=e.clearTimeout(i));for(var t=0,n=B.length;n>t;t++)B[t]()}}function n(){try{R.doScroll("left")}catch(r){return void e.setTimeout(n,20)}t()}var r,i;if(D.addEventListener)D.addEventListener("DOMContentLoaded",t,$),D.addEventListener("load",t,$);else if(D.attachEvent){D.attachEvent("onload",t);var a=!1;try{a=null===e.frameElement}catch(o){}a&&R.doScroll&&n()}}function g(e,t){var n=i(e)[0],r=n.uTag;if(!r)return null;var a=(t||D).createElement(r),o=n.id,u=n.classes;return o&&(a.id=o),u&&(a.className=u.join(" ")),a}function h(t){/loaded|complete|interactive/.test(D.readyState)?e.setTimeout(t,0):B.push(t)}function p(e,t){return o(t||R,e)}function m(e,t){return s(e,"parentNode",t)}function v(e,t){return s(e,"nextSibling",t)}function y(e,t){return s(e,"previousSibling",t)}function b(e,t){return e=e.parentNode.firstChild,l(e,"nextSibling",t)}function E(e,t){return e=e.parentNode.lastChild,l(e,"previousSibling",t)}function N(e,t){return(" "+e.className+" ").indexOf(" "+t+" ")>-1}function T(e,t){N(e,t)||(e.className+=" "+t)}function w(e,t){N(e,t)&&(e.className=e.className.replace(RegExp("(^|\\s)"+t+"(\\s|$)")," ").replace(/\s$/,""))}function x(e,t,n){(n?T:w)(e,t)}function C(e){return D.createTextNode(e)}function S(e,t,n){e.setAttribute(t,""+n)}function F(e,t){return e.getAttribute(t)||null}function k(e,t,n){if("object"!=typeof t)return n===q?F(e,t):void S(e,t,n);for(var r in t)S(e,r,t[r])}function A(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function L(e,t){t||(t=e,e=this);for(var n in t)e[n]=t[n]}var q,D=e.document,R=D.documentElement,V=!0,$=!1,I=/^\s*([>+~])?\s*([*\w-]+)?(?:#([\w-]+))?(?:\.([\w.-]+))?\s*/,W=/-(\w)/g,B=[],H=[],M={"float":"cssFloat"in R.style?"cssFloat":"styleFloat"},P={borderWidth:{get:function(e){return U(e,"border-left-width")}},padding:{get:function(e){return U(e,"padding-left")}},margin:{get:function(e){return U(e,"margin-left")}}};!("opacity"in R.style)&&"filters"in R&&(P.opacity={set:function(e,t){var n=e.filters.alpha;n?n.opacity=100*t:e.style.filter+=" Alpha(opacity="+100*t+")"},get:function(e){var t=e.filters.alpha;return t?t.opacity/100:1}}),"clientWidth"in R&&(P.width={get:function(e){return e.style.width||e.clientWidth||e.offsetWidth}}),"clientHeight"in R&&(P.height={get:function(e){return e.style.height||e.clientHeight||e.offsetHeight}});var j=e.addEventListener?function(e,t,n){e.addEventListener(t,n,!1)}:function(t,n,r){var i=t.uniqueID+n+r;H[i]=function(){var n=e.event;return n.target=n.srcElement||D,n.currentTarget=t,n.preventDefault=function(){n.returnValue=!1},n.stopPropagation=function(){n.cancelBubble=!0},r.call(t,n)},t.attachEvent("on"+n,H[i])},O=e.removeEventListener?function(e,t,n){e.removeEventListener(t,n,!1)}:function(e,t,n){var r=e.uniqueID+t+n;e.detachEvent("on"+t,H[r]),delete H[r]},U=D.defaultView&&D.defaultView.getComputedStyle?function(e,t){var r=n(t),i=P[r];return i&&i.get?i.get(e):e.ownerDocument.defaultView.getComputedStyle(e,null).getPropertyValue(t)}:function(e,t){var r=n(t),i=P[r];return i&&i.get?i.get(e):e.currentStyle[r]},z={create:g,onready:h,addEvent:j,removeEvent:O,get:p,descendants:o,ancestor:m,next:v,previous:y,first:b,last:E,empty:A,is:c,text:C,attr:k,hasClass:N,addClass:T,removeClass:w,toggleClass:x,style:r,extend:L};e.$dom=z,d()}(this),function(e){function t(e,t){var n=u.splice(e,1)[0];n.callback&&n.callback(t,n.elm)}function n(e){e=e||+new Date;for(var r=u.length-1;r>=0;r--){var i,a,c={},s=u[r];s.startTime=s.startTime||e;var f=s.duration,d=s.properties,g=e-s.startTime,h=.5-Math.cos(g/f*Math.PI)/2;for(i in d)a=d[i],c[i]=""+(g>=f?a.e:a.s+(a.e-a.s)*h)+a.u,"NaNpx"===c[i]&&(c[i]=0);o(s.elm,c),g>=f&&t(r,!0)}u.length&&l(n)}function r(e,r,a,s){var f,d,g,h,p=[],m=-1;for(h=u.length-1;h>=0;h--)if(u[h].elm===e){m=h;break}if(r===i)return m>-1;m>-1&&t(m,!1),a===i&&(a=500);for(f in r)d=c.exec(o(e,f)),g=c.exec(r[f]),p[f]={s:parseFloat(d[1])||0,e:parseFloat(g[1])||0,u:g[2]||d[2]||""};u.push({elm:e,properties:p,callback:s,duration:a}),l(n)}var i,a=e.$dom,o=a.style,u=[],l=e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t){e.setTimeout(function(){t()},16)},c=/^(.*?)(px|deg)?$/;a.transform=a.animate=r}(this);
Oops, something went wrong.

0 comments on commit 541fdea

Please sign in to comment.