From a9261759cbef599a23cee0a31e1fd687e189f126 Mon Sep 17 00:00:00 2001 From: Kirby Wu Date: Wed, 19 Jan 2022 16:47:53 +0800 Subject: [PATCH] - further minimize js file with mangling and compression options. --- build | 2 +- dist/index.min.js | 2 +- web/static/assets/lib/ldslider/dev/index.min.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build b/build index 06d248e..86cefa1 100755 --- a/build +++ b/build @@ -8,7 +8,7 @@ echo "build src/font.styl -> dist/index.css ..." echo "build src/index.styl ->> dist/index.css ..." ./node_modules/.bin/stylus -p src/index.styl >> dist/index.css echo "minifying index.js ..." -./node_modules/.bin/uglifyjs dist/index.js > dist/index.min.js +./node_modules/.bin/uglifyjs dist/index.js -m -c > dist/index.min.js echo "minifying index.css ..." ./node_modules/.bin/uglifycss dist/index.css > dist/index.min.css echo "copy dist files to web ..." diff --git a/dist/index.min.js b/dist/index.min.js index c139cbe..d1d96c1 100644 --- a/dist/index.min.js +++ b/dist/index.min.js @@ -1 +1 @@ -(function(){var ldslider;ldslider=function(opt){var root,i$,to$,i,that,handle,el,mouse,this$=this;opt==null&&(opt={});this.evtHandler={};this.opt=import$({min:0,max:100,from:0,to:0,step:1},opt);this.val={to:0,from:0};this.root=root=typeof opt.root==="string"?document.querySelector(opt.root):opt.root;if(this.root.tagName==="INPUT"){this.input=this.root;ld$.attr(this.input,"type","hidden");this.root=root=document.createElement("div");this.input.parentNode.insertBefore(this.root,this.input);for(i$=0,to$=this.input.classList.length;i$\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n
\n
\n
';this.el=el={b:{fg:ld$.find(root,".fg",0)},p:ld$.find(root,".line.p",0),q:ld$.find(root,".line.p.alt",0),h:{p:ld$.find(root,".hint.p",0),q:ld$.find(root,".hint.p.alt",0),l:ld$.find(root,".hint.l",0),r:ld$.find(root,".hint.r",0),lock:ld$.find(root,".hint.lock",0),lockLine:ld$.find(root,".lock-line",0)}};mouse={move:function(e){if(e.buttons&1){return this$.repos(e.clientX,true,true,false,mouse.alt)}else{return mouse.up(e)}},up:function(){var ref$,p,v;document.removeEventListener("mouseup",mouse.up);document.removeEventListener("mousemove",mouse.move);ref$=!mouse.alt?[this$.el.h.p,this$.val.from]:[this$.el.h.q,this$.val.to],p=ref$[0],v=ref$[1];return p.innerText=this$.label.ptr(Math.round(1e4*v)/1e4)},prepare:function(e){mouse.alt=e.target&&e.target.classList&&e.target.classList.contains("alt")?true:false;document.addEventListener("mousemove",mouse.move);return document.addEventListener("mouseup",mouse.up)}};el.p.addEventListener("mousedown",mouse.prepare);root.addEventListener("click",mouse.move);root.addEventListener("mousedown",mouse.prepare);this.prepare();return this};ldslider.prototype=import$(Object.create(Object.prototype),{on:function(n,cb){var ref$;return((ref$=this.evtHandler)[n]||(ref$[n]=[])).push(cb)},fire:function(n){var v,res$,i$,to$,ref$,len$,cb,results$=[];res$=[];for(i$=1,to$=arguments.length;i$0?ref2$:0)<(ref1$=rbox.width)?ref$:ref1$;dx=x/rbox.width;if(this.expFactor){dx=Math.pow(dx,this.expFactor)}value=this.opt.min+(this.opt.max-this.opt.min)*dx;if(this.opt.limitMax!=null){if(x>w06){value=this.opt.limitMax+(this.opt.max-this.opt.limitMax)*(x-w06)/(rbox.width-w06)}else{dx=x/w06;if(this.expFactor){dx=Math.pow(dx,this.expFactor)}value=this.opt.min+this.opt.limitMax*dx}}}else{value=v}value=v=(ref$=(ref2$=this.opt.min+Math.round((value-this.opt.min)/this.opt.step)*this.opt.step)>(ref3$=this.opt.min)?ref2$:ref3$)<(ref1$=this.opt.max)?ref$:ref1$;this.val[label]=value;xs={};for(k in ref$=this.val){v=ref$[k];if(!this.range&&k==="to"){continue}if(this.opt.limitMax!=null){if(v>this.opt.limitMax){x=(v-this.opt.limitMax)/(this.opt.max-this.opt.limitMax)*40+60}else{if(this.expFactor){x=60*Math.pow((v-this.opt.min)/(this.opt.limitMax-this.opt.min),1/this.expFactor)}else{x=60*(v-this.opt.min)/(this.opt.limitMax-this.opt.min)}}}else{if(this.expFactor){x=100*Math.pow((v-this.opt.min)/(this.opt.max-this.opt.min),1/this.expFactor)}else{x=100*((v-this.opt.min)/(this.opt.max-this.opt.min))}}if(this.opt.limitMax!=null&&this.opt.limitHard){if(x>60){x=60}if(v>this.opt.limitMax){v=this.opt.limitMax}}this.val[k]=v;xs[k]=x}x=xs[label];v=this.val[label];left=!this.range?0:Math.min(xs.from,xs.to)+.5;width=!this.range?xs.from:Math.max(xs.from,xs.to)-left+.5;hbox=elH.getBoundingClientRect();elH.innerText=this.label.ptr(Math.round(1e4*v)/1e4);elH.style.left=100*(.01*x*rbox.width)/rbox.width+"%";elH.style.transform="translate(-50%,0)";elL.style.left=x+"%";this.el.b.fg.style.width=width+"%";this.el.b.fg.style.left=left+"%";if(v!==old&&forceNotify){this.fire("change",this.range?this.val:this.val[label])}if(this.input){return this.updateInput({now:!fromInput})}}});if(typeof module!="undefined"&&module!==null){module.exports=ldslider}else if(typeof window!="undefined"&&window!==null){window.ldSlider=window.ldslider=ldslider}function import$(obj,src){var own={}.hasOwnProperty;for(var key in src)if(own.call(src,key))obj[key]=src[key];return obj}}).call(this); +(function(){function t(t,i){var s={}.hasOwnProperty;for(var e in i)s.call(i,e)&&(t[e]=i[e]);return t}var i;(i=function(i){var s,e,n,o,l,a,r,h,p=this;if(null==i&&(i={}),this.evtHandler={},this.opt=t({min:0,max:100,from:0,to:0,step:1},i),this.val={to:0,from:0},this.root=s="string"==typeof i.root?document.querySelector(i.root):i.root,"INPUT"===this.root.tagName){for(this.input=this.root,ld$.attr(this.input,"type","hidden"),this.root=s=document.createElement("div"),this.input.parentNode.insertBefore(this.root,this.input),e=0,n=this.input.classList.length;e\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n
\n
\n
',this.el=r={b:{fg:ld$.find(s,".fg",0)},p:ld$.find(s,".line.p",0),q:ld$.find(s,".line.p.alt",0),h:{p:ld$.find(s,".hint.p",0),q:ld$.find(s,".hint.p.alt",0),l:ld$.find(s,".hint.l",0),r:ld$.find(s,".hint.r",0),lock:ld$.find(s,".hint.lock",0),lockLine:ld$.find(s,".lock-line",0)}},h={move:function(t){return 1&t.buttons?p.repos(t.clientX,!0,!0,!1,h.alt):h.up(t)},up:function(){var t,i,s;return document.removeEventListener("mouseup",h.up),document.removeEventListener("mousemove",h.move),t=h.alt?[p.el.h.q,p.val.to]:[p.el.h.p,p.val.from],i=t[0],s=t[1],i.innerText=p.label.ptr(Math.round(1e4*s)/1e4)},prepare:function(t){return h.alt=!!(t.target&&t.target.classList&&t.target.classList.contains("alt")),document.addEventListener("mousemove",h.move),document.addEventListener("mouseup",h.up)}},r.p.addEventListener("mousedown",h.prepare),s.addEventListener("click",h.move),s.addEventListener("mousedown",h.prepare),this.prepare(),this}).prototype=t(Object.create(Object.prototype),{on:function(t,i){var s;return((s=this.evtHandler)[t]||(s[t]=[])).push(i)},fire:function(t){var i,s,e,n,o,l,a,r=[];for(s=[],e=1,n=arguments.length;e0?v:0)<(m=h.width)?d:m)/h.width,this.expFactor&&(c=Math.pow(c,this.expFactor)),f=this.opt.min+(this.opt.max-this.opt.min)*c,null!=this.opt.limitMax&&(u>p?f=this.opt.limitMax+(this.opt.max-this.opt.limitMax)*(u-p)/(h.width-p):(c=u/p,this.expFactor&&(c=Math.pow(c,this.expFactor)),f=this.opt.min+this.opt.limitMax*c))):f=t,f=t=(d=(v=this.opt.min+Math.round((f-this.opt.min)/this.opt.step)*this.opt.step)>(x=this.opt.min)?v:x)<(m=this.opt.max)?d:m,this.val[o]=f,g={};for(b in d=this.val)t=d[b],(this.range||"to"!==b)&&(u=null!=this.opt.limitMax?t>this.opt.limitMax?(t-this.opt.limitMax)/(this.opt.max-this.opt.limitMax)*40+60:this.expFactor?60*Math.pow((t-this.opt.min)/(this.opt.limitMax-this.opt.min),1/this.expFactor):60*(t-this.opt.min)/(this.opt.limitMax-this.opt.min):this.expFactor?100*Math.pow((t-this.opt.min)/(this.opt.max-this.opt.min),1/this.expFactor):(t-this.opt.min)/(this.opt.max-this.opt.min)*100,null!=this.opt.limitMax&&this.opt.limitHard&&(u>60&&(u=60),t>this.opt.limitMax&&(t=this.opt.limitMax)),this.val[b]=t,g[b]=u);if(u=g[o],t=this.val[o],M=this.range?Math.min(g.from,g.to)+.5:0,w=this.range?Math.max(g.from,g.to)-M+.5:g.from,a.getBoundingClientRect(),a.innerText=this.label.ptr(Math.round(1e4*t)/1e4),a.style.left=.01*u*h.width*100/h.width+"%",a.style.transform="translate(-50%,0)",r.style.left=u+"%",this.el.b.fg.style.width=w+"%",this.el.b.fg.style.left=M+"%",t!==l&&i&&this.fire("change",this.range?this.val:this.val[o]),this.input)return this.updateInput({now:!e})}}),"undefined"!=typeof module&&null!==module?module.exports=i:"undefined"!=typeof window&&null!==window&&(window.ldSlider=window.ldslider=i)}).call(this); diff --git a/web/static/assets/lib/ldslider/dev/index.min.js b/web/static/assets/lib/ldslider/dev/index.min.js index c139cbe..d1d96c1 100644 --- a/web/static/assets/lib/ldslider/dev/index.min.js +++ b/web/static/assets/lib/ldslider/dev/index.min.js @@ -1 +1 @@ -(function(){var ldslider;ldslider=function(opt){var root,i$,to$,i,that,handle,el,mouse,this$=this;opt==null&&(opt={});this.evtHandler={};this.opt=import$({min:0,max:100,from:0,to:0,step:1},opt);this.val={to:0,from:0};this.root=root=typeof opt.root==="string"?document.querySelector(opt.root):opt.root;if(this.root.tagName==="INPUT"){this.input=this.root;ld$.attr(this.input,"type","hidden");this.root=root=document.createElement("div");this.input.parentNode.insertBefore(this.root,this.input);for(i$=0,to$=this.input.classList.length;i$\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n
\n
\n
';this.el=el={b:{fg:ld$.find(root,".fg",0)},p:ld$.find(root,".line.p",0),q:ld$.find(root,".line.p.alt",0),h:{p:ld$.find(root,".hint.p",0),q:ld$.find(root,".hint.p.alt",0),l:ld$.find(root,".hint.l",0),r:ld$.find(root,".hint.r",0),lock:ld$.find(root,".hint.lock",0),lockLine:ld$.find(root,".lock-line",0)}};mouse={move:function(e){if(e.buttons&1){return this$.repos(e.clientX,true,true,false,mouse.alt)}else{return mouse.up(e)}},up:function(){var ref$,p,v;document.removeEventListener("mouseup",mouse.up);document.removeEventListener("mousemove",mouse.move);ref$=!mouse.alt?[this$.el.h.p,this$.val.from]:[this$.el.h.q,this$.val.to],p=ref$[0],v=ref$[1];return p.innerText=this$.label.ptr(Math.round(1e4*v)/1e4)},prepare:function(e){mouse.alt=e.target&&e.target.classList&&e.target.classList.contains("alt")?true:false;document.addEventListener("mousemove",mouse.move);return document.addEventListener("mouseup",mouse.up)}};el.p.addEventListener("mousedown",mouse.prepare);root.addEventListener("click",mouse.move);root.addEventListener("mousedown",mouse.prepare);this.prepare();return this};ldslider.prototype=import$(Object.create(Object.prototype),{on:function(n,cb){var ref$;return((ref$=this.evtHandler)[n]||(ref$[n]=[])).push(cb)},fire:function(n){var v,res$,i$,to$,ref$,len$,cb,results$=[];res$=[];for(i$=1,to$=arguments.length;i$0?ref2$:0)<(ref1$=rbox.width)?ref$:ref1$;dx=x/rbox.width;if(this.expFactor){dx=Math.pow(dx,this.expFactor)}value=this.opt.min+(this.opt.max-this.opt.min)*dx;if(this.opt.limitMax!=null){if(x>w06){value=this.opt.limitMax+(this.opt.max-this.opt.limitMax)*(x-w06)/(rbox.width-w06)}else{dx=x/w06;if(this.expFactor){dx=Math.pow(dx,this.expFactor)}value=this.opt.min+this.opt.limitMax*dx}}}else{value=v}value=v=(ref$=(ref2$=this.opt.min+Math.round((value-this.opt.min)/this.opt.step)*this.opt.step)>(ref3$=this.opt.min)?ref2$:ref3$)<(ref1$=this.opt.max)?ref$:ref1$;this.val[label]=value;xs={};for(k in ref$=this.val){v=ref$[k];if(!this.range&&k==="to"){continue}if(this.opt.limitMax!=null){if(v>this.opt.limitMax){x=(v-this.opt.limitMax)/(this.opt.max-this.opt.limitMax)*40+60}else{if(this.expFactor){x=60*Math.pow((v-this.opt.min)/(this.opt.limitMax-this.opt.min),1/this.expFactor)}else{x=60*(v-this.opt.min)/(this.opt.limitMax-this.opt.min)}}}else{if(this.expFactor){x=100*Math.pow((v-this.opt.min)/(this.opt.max-this.opt.min),1/this.expFactor)}else{x=100*((v-this.opt.min)/(this.opt.max-this.opt.min))}}if(this.opt.limitMax!=null&&this.opt.limitHard){if(x>60){x=60}if(v>this.opt.limitMax){v=this.opt.limitMax}}this.val[k]=v;xs[k]=x}x=xs[label];v=this.val[label];left=!this.range?0:Math.min(xs.from,xs.to)+.5;width=!this.range?xs.from:Math.max(xs.from,xs.to)-left+.5;hbox=elH.getBoundingClientRect();elH.innerText=this.label.ptr(Math.round(1e4*v)/1e4);elH.style.left=100*(.01*x*rbox.width)/rbox.width+"%";elH.style.transform="translate(-50%,0)";elL.style.left=x+"%";this.el.b.fg.style.width=width+"%";this.el.b.fg.style.left=left+"%";if(v!==old&&forceNotify){this.fire("change",this.range?this.val:this.val[label])}if(this.input){return this.updateInput({now:!fromInput})}}});if(typeof module!="undefined"&&module!==null){module.exports=ldslider}else if(typeof window!="undefined"&&window!==null){window.ldSlider=window.ldslider=ldslider}function import$(obj,src){var own={}.hasOwnProperty;for(var key in src)if(own.call(src,key))obj[key]=src[key];return obj}}).call(this); +(function(){function t(t,i){var s={}.hasOwnProperty;for(var e in i)s.call(i,e)&&(t[e]=i[e]);return t}var i;(i=function(i){var s,e,n,o,l,a,r,h,p=this;if(null==i&&(i={}),this.evtHandler={},this.opt=t({min:0,max:100,from:0,to:0,step:1},i),this.val={to:0,from:0},this.root=s="string"==typeof i.root?document.querySelector(i.root):i.root,"INPUT"===this.root.tagName){for(this.input=this.root,ld$.attr(this.input,"type","hidden"),this.root=s=document.createElement("div"),this.input.parentNode.insertBefore(this.root,this.input),e=0,n=this.input.classList.length;e\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n
\n
\n
',this.el=r={b:{fg:ld$.find(s,".fg",0)},p:ld$.find(s,".line.p",0),q:ld$.find(s,".line.p.alt",0),h:{p:ld$.find(s,".hint.p",0),q:ld$.find(s,".hint.p.alt",0),l:ld$.find(s,".hint.l",0),r:ld$.find(s,".hint.r",0),lock:ld$.find(s,".hint.lock",0),lockLine:ld$.find(s,".lock-line",0)}},h={move:function(t){return 1&t.buttons?p.repos(t.clientX,!0,!0,!1,h.alt):h.up(t)},up:function(){var t,i,s;return document.removeEventListener("mouseup",h.up),document.removeEventListener("mousemove",h.move),t=h.alt?[p.el.h.q,p.val.to]:[p.el.h.p,p.val.from],i=t[0],s=t[1],i.innerText=p.label.ptr(Math.round(1e4*s)/1e4)},prepare:function(t){return h.alt=!!(t.target&&t.target.classList&&t.target.classList.contains("alt")),document.addEventListener("mousemove",h.move),document.addEventListener("mouseup",h.up)}},r.p.addEventListener("mousedown",h.prepare),s.addEventListener("click",h.move),s.addEventListener("mousedown",h.prepare),this.prepare(),this}).prototype=t(Object.create(Object.prototype),{on:function(t,i){var s;return((s=this.evtHandler)[t]||(s[t]=[])).push(i)},fire:function(t){var i,s,e,n,o,l,a,r=[];for(s=[],e=1,n=arguments.length;e0?v:0)<(m=h.width)?d:m)/h.width,this.expFactor&&(c=Math.pow(c,this.expFactor)),f=this.opt.min+(this.opt.max-this.opt.min)*c,null!=this.opt.limitMax&&(u>p?f=this.opt.limitMax+(this.opt.max-this.opt.limitMax)*(u-p)/(h.width-p):(c=u/p,this.expFactor&&(c=Math.pow(c,this.expFactor)),f=this.opt.min+this.opt.limitMax*c))):f=t,f=t=(d=(v=this.opt.min+Math.round((f-this.opt.min)/this.opt.step)*this.opt.step)>(x=this.opt.min)?v:x)<(m=this.opt.max)?d:m,this.val[o]=f,g={};for(b in d=this.val)t=d[b],(this.range||"to"!==b)&&(u=null!=this.opt.limitMax?t>this.opt.limitMax?(t-this.opt.limitMax)/(this.opt.max-this.opt.limitMax)*40+60:this.expFactor?60*Math.pow((t-this.opt.min)/(this.opt.limitMax-this.opt.min),1/this.expFactor):60*(t-this.opt.min)/(this.opt.limitMax-this.opt.min):this.expFactor?100*Math.pow((t-this.opt.min)/(this.opt.max-this.opt.min),1/this.expFactor):(t-this.opt.min)/(this.opt.max-this.opt.min)*100,null!=this.opt.limitMax&&this.opt.limitHard&&(u>60&&(u=60),t>this.opt.limitMax&&(t=this.opt.limitMax)),this.val[b]=t,g[b]=u);if(u=g[o],t=this.val[o],M=this.range?Math.min(g.from,g.to)+.5:0,w=this.range?Math.max(g.from,g.to)-M+.5:g.from,a.getBoundingClientRect(),a.innerText=this.label.ptr(Math.round(1e4*t)/1e4),a.style.left=.01*u*h.width*100/h.width+"%",a.style.transform="translate(-50%,0)",r.style.left=u+"%",this.el.b.fg.style.width=w+"%",this.el.b.fg.style.left=M+"%",t!==l&&i&&this.fire("change",this.range?this.val:this.val[o]),this.input)return this.updateInput({now:!e})}}),"undefined"!=typeof module&&null!==module?module.exports=i:"undefined"!=typeof window&&null!==window&&(window.ldSlider=window.ldslider=i)}).call(this);