diff --git a/Progress.html b/Progress.html new file mode 100644 index 0000000..b79a0f6 --- /dev/null +++ b/Progress.html @@ -0,0 +1,82 @@ + + + + + + + + + + + miniMobile + + + + + + + + + + + + + + + +
+
+ +
+
+ 进度条 +
+
+ +
+
+
+

默认:

+

+

插件默认:

+ +

皮肤primary:

+ +

皮肤success:

+ +

皮肤info:

+ +

皮肤warning:

+ +

皮肤danger:

+ +
+ + + + + \ No newline at end of file diff --git a/aside.html b/aside.html new file mode 100644 index 0000000..70576d9 --- /dev/null +++ b/aside.html @@ -0,0 +1,111 @@ + + + + + + + + + + + miniMobile + + + + + + + + + + + + + + + + +
+
+ +
+
+ 快速预览 +
+
+ +
+
+
+ 请在开发者模式下模拟触摸! +

+ + 左侧弹出 + + + 右侧弹出 + +

+ + 顶部弹出 + + + 底部弹出 +

+ 回到首页 +
+ + + + + + + + + + + + + \ No newline at end of file diff --git a/blockquote.html b/blockquote.html new file mode 100644 index 0000000..1388bf3 --- /dev/null +++ b/blockquote.html @@ -0,0 +1,83 @@ + + + + + + + + + + + miniMobile + + + + + + + + + + + + + +
+
+ +
+
+ 引用、下划线、返回顶部 +
+
+ +
+
+
+

引用块

+
+
+

这是一个blockquote块,提示用的!

+
+
+

默认是主色调,但是你可以引用normal来清除掉,实现用辅助色样式

+
+
+

不同颜色的 blockquote-primary

+
+
+

不同颜色的 blockquote-success

+
+
+

不同颜色的 blockquote-info

+
+
+

不同颜色的 blockquote-warning

+
+
+

不同颜色的 blockquote-danger

+
+

下划线

+

细线

+
+

粗线

+
+
+

实际意义中,粗的下划线并不是各个屏幕下都加粗的,而是在渲染过程中,最小只能渲染一像素,所以在屏幕小得情况下,粗线和细线是相同的。

+
+
+ +
+ +
+ + + + \ No newline at end of file diff --git a/button.html b/button.html new file mode 100644 index 0000000..b188eab --- /dev/null +++ b/button.html @@ -0,0 +1,132 @@ + + + + + + + + + + + miniMobile + + + + + + + + + + + + + +
+
+ +
+
+ 按钮组合 +
+
+ +
+

+ +
+ 按钮 + 按钮 + 按钮 + 按钮 + 按钮 +
+
+ +
+
+ + 下拉导航组件   + + + +
+
+ + 下拉导航组件   + + + +
+ +
+
+
+ 首页 + < + 1 + > + 尾页 +
+
+
+ 按钮 + 按钮 + 按钮 + +

+ 按钮 +
+
+
+ tag + tag-primary + tag-success + tag-info + tag-warning + tag-danger +
+ + + \ No newline at end of file diff --git a/comment.html b/comment.html new file mode 100644 index 0000000..3151e7c --- /dev/null +++ b/comment.html @@ -0,0 +1,211 @@ + + + + + + + + + + + miniMobile + + + + + + + + + + + + + +
+
+ +
+
+ 评论列表 +
+
+ +
+
+
+
+
+ +
+
+

产品开发部

+

社区系统账号

+
+

[问题]:平台注册流程第一步中的手机号,与竞价系统新增供应商界面中的“联系电话”,这两者不等同。

+

[意见]:判断手机号是否被注册,判断是否被之前的账号在第一步注册时填写了。根据不同的情况显示不同的界面元素!

+
+
+

全文

+
+ 23分钟 + 56 + 43 +
+
+

+ + 张三、 + 李四、 + 张三、 + 李四、 + 张三、 + 李四、 + 张三、 + 王二... + 等21人觉得赞 +

+

+ 张三:这是一条认真有内涵的评论,作为一个资深的评论家,我不得不说这个评论很棒,简直帅呆了! +

+

+ 大嘴巴图图:评论长了不好看啊! +

+
+
+
+
+
+ +
+
+

河南市场部

+

社区系统账号

+
+

[问题]:网站突然登录不了了,显示404。

+

[意见]:是否可以管理一下服务器。

+ +
+ +
+ 23分钟 + 56 + 43 +
+
+

+ + 张三、 + 李四、 + 张三、 + 李四、 + 张三、 + 王二... + 等21人觉得赞 +

+

+ 张三:产品部赶紧解决! +

+

+ 产品开发部 回复 + 张三:好的,正在重启服务器,马上解决! +

+
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/css/miniMobile.css b/css/miniMobile.css new file mode 100644 index 0000000..b0bb345 --- /dev/null +++ b/css/miniMobile.css @@ -0,0 +1,5 @@ +/* + * minimobile.css v0.0.1 by chenyaowen + * 在保留作者签名的情况下,允许使用与商业用途 + */ +*{margin:0;padding:0;box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Helvetica Neue",STHeiti,"Microsoft Yahei",Tahoma,Simsun,sans-serif}a{text-decoration:none;color:#666;cursor:pointer}body{overflow-x:hidden}img{vertical-align:middle;border:none}li{list-style:none}.fl{float:left}.fr{float:right}.fn{float:none}.clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}.t-c{text-align:center}.t-l{text-align:left}.t-r{text-align:right}.nowrap{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.o-h{overflow:hidden}.o-s{overflow:scroll}.o-v{overflow:visible}.t-c-v{display:-webkit-inline-box;display:-ms-inline-flexbox;display:-webkit-inline-flex;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center}.f0{font-size:0}.f28{font-size:.28rem}.f30{font-size:.3rem}.f32{font-size:.32rem}.f34{font-size:.34rem}.f36{font-size:.36rem}.f38{font-size:.38rem}.f40{font-size:.4rem}.f42{font-size:.42rem}.f44{font-size:.44rem}.f46{font-size:.46rem}.f48{font-size:.48rem}.f50{font-size:.5rem}.f52{font-size:.52rem}.f54{font-size:.54rem}.f56{font-size:.56rem}.f58{font-size:.58rem}.f60{font-size:.6rem}.color1{color:#e4393c}.color2{color:#222}.color3{color:#666}.color4{color:#999}.color5{color:#d7d7d7}.color6{color:#f3f5f7}.color7{color:#f8f8f8}.color8{color:#fff}.color-primary{color:#1ab394}.color-success{color:#1c84c6}.color-info{color:#23c6c8}.color-warning{color:#f8ac59}.color-danger{color:#ed5565}.bg-color1{background-color:#e4393c}.bg-color2{background-color:#222}.bg-color3{background-color:#666}.bg-color4{background-color:#999}.bg-color5{background-color:#d7d7d7}.bg-color6{background-color:#f3f5f7}.bg-color7{background-color:#f8f8f8}.bg-color8{background-color:#fff}.bg-color-primary{background-color:#1ab394}.bg-color-success{background-color:#1c84c6}.bg-color-info{background-color:#23c6c8}.bg-color-warning{background-color:#f8ac59}.bg-color-danger{background-color:#ed5565}hr{border:none;border-bottom:.01rem solid #d7d7d7}hr.lg{border-bottom:.03rem solid #d7d7d7}.w1{width:.1rem}.h1{height:.1rem}.w2{width:.2rem}.h2{height:.2rem}.w3{width:.3rem}.h3{height:.3rem}.w4{width:.4rem}.h4{height:.4rem}.w5{width:.5rem}.h5{height:.5rem}.w6{width:.6rem}.h6{height:.6rem}.w7{width:.7rem}.h7{height:.7rem}.w8{width:.8rem}.h8{height:.8rem}.w9{width:.9rem}.h9{height:.9rem}.w10{width:1rem}.h10{height:1rem}.w11{width:1.1rem}.h11{height:1.1rem}.w12{width:1.2rem}.h12{height:1.2rem}.w13{width:1.3rem}.h13{height:1.3rem}.w14{width:1.4rem}.h14{height:1.4rem}.w15{width:1.5rem}.h15{height:1.5rem}.w16{width:1.6rem}.h16{height:1.6rem}.w17{width:1.7rem}.h17{height:1.7rem}.w18{width:1.8rem}.h18{height:1.8rem}.w19{width:1.9rem}.h19{height:1.9rem}.w20{width:2rem}.h20{height:2rem}.w21{width:2.1rem}.h21{height:2.1rem}.w22{width:2.2rem}.h22{height:2.2rem}.w23{width:2.3rem}.h23{height:2.3rem}.w24{width:2.4rem}.h24{height:2.4rem}.w25{width:2.5rem}.h25{height:2.5rem}.w26{width:2.6rem}.h26{height:2.6rem}.w27{width:2.7rem}.h27{height:2.7rem}.w28{width:2.8rem}.h28{height:2.8rem}.w29{width:2.9rem}.h29{height:2.9rem}.w30{width:3rem}.h30{height:3rem}.w31{width:3.1rem}.h31{height:3.1rem}.w32{width:3.2rem}.h32{height:3.2rem}.w33{width:3.3rem}.h33{height:3.3rem}.w34{width:3.4rem}.h34{height:3.4rem}.w35{width:3.5rem}.h35{height:3.5rem}.w36{width:3.6rem}.h36{height:3.6rem}.w37{width:3.7rem}.h37{height:3.7rem}.w38{width:3.8rem}.h38{height:3.8rem}.w39{width:3.9rem}.h39{height:3.9rem}.w40{width:4rem}.h40{height:4rem}.w41{width:4.1rem}.h41{height:4.1rem}.w42{width:4.2rem}.h42{height:4.2rem}.w43{width:4.3rem}.h43{height:4.3rem}.w44{width:4.4rem}.h44{height:4.4rem}.w45{width:4.5rem}.h45{height:4.5rem}.w46{width:4.6rem}.h46{height:4.6rem}.w47{width:4.7rem}.h47{height:4.7rem}.w48{width:4.8rem}.h48{height:4.8rem}.w49{width:4.9rem}.h49{height:4.9rem}.w50{width:5rem}.h50{height:5rem}.w51{width:5.1rem}.h51{height:5.1rem}.w52{width:5.2rem}.h52{height:5.2rem}.w53{width:5.3rem}.h53{height:5.3rem}.w54{width:5.4rem}.h54{height:5.4rem}.w55{width:5.5rem}.h55{height:5.5rem}.w56{width:5.6rem}.h56{height:5.6rem}.w57{width:5.7rem}.h57{height:5.7rem}.w58{width:5.8rem}.h58{height:5.8rem}.w59{width:5.9rem}.h59{height:5.9rem}.w60{width:6rem}.h60{height:6rem}.w61{width:6.1rem}.h61{height:6.1rem}.w62{width:6.2rem}.h62{height:6.2rem}.w63{width:6.3rem}.h63{height:6.3rem}.w64{width:6.4rem}.h64{height:6.4rem}.w65{width:6.5rem}.h65{height:6.5rem}.w66{width:6.6rem}.h66{height:6.6rem}.w67{width:6.7rem}.h67{height:6.7rem}.w68{width:6.8rem}.h68{height:6.8rem}.w69{width:6.9rem}.h69{height:6.9rem}.w70{width:7rem}.h70{height:7rem}.w71{width:7.1rem}.h71{height:7.1rem}.w72{width:7.2rem}.h72{height:7.2rem}.w73{width:7.3rem}.h73{height:7.3rem}.w74{width:7.4rem}.h74{height:7.4rem}.w75{width:7.5rem}.h75{height:7.5rem}.col-1,.col-10,.col-11,.col-12,.col-2,.col-3,.col-4,.col-5,.col-6,.col-7,.col-8,.col-9{float:left;display:inline-block}.col-1{width:calc(8.33333333%)}.col-2{width:calc(16.66666667%)}.col-3{width:calc(25%)}.col-4{width:calc(33.33333333%)}.col-5{width:calc(41.66666667%)}.col-6{width:calc(50%)}.col-7{width:calc(58.33333333%)}.col-8{width:calc(66.66666667%)}.col-9{width:calc(75%)}.col-10{width:calc(83.33333333%)}.col-11{width:calc(91.66666667%)}.col-12{width:calc(100%)}.m1{margin:.1rem}.p1{padding:.1rem}.m2{margin:.2rem}.p2{padding:.2rem}.m3{margin:.3rem}.p3{padding:.3rem}.m4{margin:.4rem}.p4{padding:.4rem}.m5{margin:.5rem}.p5{padding:.5rem}.m6{margin:.6rem}.p6{padding:.6rem}.m7{margin:.7rem}.p7{padding:.7rem}.m8{margin:.8rem}.p8{padding:.8rem}.m9{margin:.9rem}.p9{padding:.9rem}.m10{margin:1rem}.p10{padding:1rem}.m11{margin:1.1rem}.p11{padding:1.1rem}.m12{margin:1.2rem}.p12{padding:1.2rem}.ml1{margin-left:.1rem}.mr1{margin-right:.1rem}.mt1{margin-top:.1rem}.mb1{margin-bottom:.1rem}.pl1{padding-left:.1rem}.pr1{padding-right:.1rem}.pt1{padding-top:.1rem}.pb1{padding-bottom:.1rem}.ml2{margin-left:.2rem}.mr2{margin-right:.2rem}.mt2{margin-top:.2rem}.mb2{margin-bottom:.2rem}.pl2{padding-left:.2rem}.pr2{padding-right:.2rem}.pt2{padding-top:.2rem}.pb2{padding-bottom:.2rem}.ml3{margin-left:.3rem}.mr3{margin-right:.3rem}.mt3{margin-top:.3rem}.mb3{margin-bottom:.3rem}.pl3{padding-left:.3rem}.pr3{padding-right:.3rem}.pt3{padding-top:.3rem}.pb3{padding-bottom:.3rem}.ml4{margin-left:.4rem}.mr4{margin-right:.4rem}.mt4{margin-top:.4rem}.mb4{margin-bottom:.4rem}.pl4{padding-left:.4rem}.pr4{padding-right:.4rem}.pt4{padding-top:.4rem}.pb4{padding-bottom:.4rem}.ml5{margin-left:.5rem}.mr5{margin-right:.5rem}.mt5{margin-top:.5rem}.mb5{margin-bottom:.5rem}.pl5{padding-left:.5rem}.pr5{padding-right:.5rem}.pt5{padding-top:.5rem}.pb5{padding-bottom:.5rem}.ml6{margin-left:.6rem}.mr6{margin-right:.6rem}.mt6{margin-top:.6rem}.mb6{margin-bottom:.6rem}.pl6{padding-left:.6rem}.pr6{padding-right:.6rem}.pt6{padding-top:.6rem}.pb6{padding-bottom:.6rem}.ml7{margin-left:.7rem}.mr7{margin-right:.7rem}.mt7{margin-top:.7rem}.mb7{margin-bottom:.7rem}.pl7{padding-left:.7rem}.pr7{padding-right:.7rem}.pt7{padding-top:.7rem}.pb7{padding-bottom:.7rem}.ml8{margin-left:.8rem}.mr8{margin-right:.8rem}.mt8{margin-top:.8rem}.mb8{margin-bottom:.8rem}.pl8{padding-left:.8rem}.pr8{padding-right:.8rem}.pt8{padding-top:.8rem}.pb8{padding-bottom:.8rem}.ml9{margin-left:.9rem}.mr9{margin-right:.9rem}.mt9{margin-top:.9rem}.mb9{margin-bottom:.9rem}.pl9{padding-left:.9rem}.pr9{padding-right:.9rem}.pt9{padding-top:.9rem}.pb9{padding-bottom:.9rem}.ml10{margin-left:1rem}.mr10{margin-right:1rem}.mt10{margin-top:1rem}.mb10{margin-bottom:1rem}.pl10{padding-left:1rem}.pr10{padding-right:1rem}.pt10{padding-top:1rem}.pb10{padding-bottom:1rem}.ml11{margin-left:1.1rem}.mr11{margin-right:1.1rem}.mt11{margin-top:1.1rem}.mb11{margin-bottom:1.1rem}.pl11{padding-left:1.1rem}.pr11{padding-right:1.1rem}.pt11{padding-top:1.1rem}.pb11{padding-bottom:1.1rem}.ml12{margin-left:1.2rem}.mr12{margin-right:1.2rem}.mt12{margin-top:1.2rem}.mb12{margin-bottom:1.2rem}.pl12{padding-left:1.2rem}.pr12{padding-right:1.2rem}.pt12{padding-top:1.2rem}.pb12{padding-bottom:1.2rem}.btn{display:-webkit-inline-box;display:-ms-inline-flexbox;display:-webkit-inline-flex;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;background-color:#e4393c;cursor:pointer;color:#fff;border:1px solid #e4393c}.btn:active,.btn:hover{background-color:#ce1c1f;border-color:#ce1c1f}.btn.disable,.btn[disabled=disabled]{background-color:#999!important;border-color:#999!important;cursor:default}.btn-primary{background-color:#1ab394;border-color:#1ab394}.btn-primary:active,.btn-primary:hover{background-color:#14866f;border-color:#14866f}.btn-success{background-color:#1c84c6;border-color:#1c84c6}.btn-success:active,.btn-success:hover{background-color:#166699;border-color:#166699}.btn-info{background-color:#23c6c8;border-color:#23c6c8}.btn-info:active,.btn-info:hover{background-color:#1b9b9d;border-color:#1b9b9d}.btn-warning{background-color:#f8ac59;border-color:#f8ac59}.btn-warning:active,.btn-warning:hover{background-color:#f69428;border-color:#f69428}.btn-danger{background-color:#ed5565;border-color:#ed5565}.btn-danger:active,.btn-danger:hover{background-color:#e8273b;border-color:#e8273b}.btn-select{position:relative;border:none}.btn-select .btn-select-list{position:absolute;left:0;top:100%;width:100%;line-height:2.4em;border-top:1px solid #fff;display:none}.btn-select .btn-select-list li,.btn-select .btn-select-list li a{color:#fff;display:block;width:100%;height:100%;cursor:pointer}.btn-select .btn-select-list li a:hover,.btn-select .btn-select-list li:hover{background:rgba(0,0,0,.1)}.tag{background-color:#e4393c;padding:.01rem .1rem;border-radius:.05rem;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tag-primary{background-color:#1ab394}.tag-success{background-color:#1c84c6}.tag-info{background-color:#23c6c8}.tag-warning{background-color:#f8ac59}.tag-danger{background-color:#ed5565}.form-control{border:1px solid #d7d7d7;resize:none;padding:.1rem .2rem;vertical-align:middle;font:inherit;font-size:inherit}.form-control:focus{border-color:#999}.ui-checkbox,.ui-radio{cursor:pointer;width:.35rem;height:.35rem;display:inline-block;vertical-align:middle;border:.01rem solid #999;margin-right:.05rem;margin-top:-.05rem;border-radius:20%;text-align:center;display:-webkit-inline-box;display:-ms-inline-flexbox;display:-webkit-inline-flex;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center}.ui-checkbox.checked,.ui-radio.checked{background-color:#e4393c;border-color:#e4393c}.ui-checkbox.checked:after,.ui-radio.checked:after{content:'';display:inline-block;width:20%;height:40%;margin-top:-5%;border-bottom:2px solid #fff;border-right:2px solid #fff;transform:rotate(30deg)}.ui-radio{border-radius:50%}.ui-checkbox.disabled,.ui-radio.disabled{opacity:.3;cursor:default}.check-primary.checked{background-color:#1ab394;border-color:#1ab394}.check-success.checked{background-color:#1c84c6;border-color:#1c84c6}.check-info.checked{background-color:#23c6c8;border-color:#23c6c8}.check-warning.checked{background-color:#f8ac59;border-color:#f8ac59}.check-danger.checked{background-color:#ed5565;border-color:#ed5565}.ui-selectBox{display:inline-block;border:1px solid #d7d7d7;height:.62rem;line-height:.6rem;padding:0;position:relative;overflow:hidden}.ui-selectBox input{float:left;display:block;position:absolute;padding-left:.5em;top:0;width:100%;height:100%;line-height:.6rem;border:none}.ui-selectBox i.icon{float:right;display:inline-block;width:1em;position:absolute;right:.5em;top:0}.ui-selectBox .box{position:absolute;width:100%;height:100%;left:0;top:0;cursor:pointer}blockquote{padding:.1rem .2rem;border-left:.05rem solid #e4393c;color:#666}.blockquote-primary{border-color:#1ab394}.blockquote-success{border-color:#1c84c6}.blockquote-info{border-color:#23c6c8}.blockquote-warning{border-color:#f8ac59}.blockquote-danger{border-color:#ed5565}blockquote.normal{border-color:#999}.radius0{border-radius:0}.radius5{border-radius:.05rem}.radius10{border-radius:.1rem}.radius15{border-radius:.15rem}.radius20{border-radius:.2rem}.radius-o{border-radius:50%}table{border-collapse:collapse;border-spacing:0;border:0 solid gray}td,th{border:1px solid #ccc;padding:2px 15px}th{background:#f1f1f1}.ui-title{line-height:1.8em;border-bottom:.01rem solid #d7d7d7;font-weight:400}.ui-header{line-height:.8rem}.ui-header-l,.ui-header-r{cursor:pointer}.ui-aside{position:fixed;top:-99999rem;bottom:-99999rem;z-index:99}.ui-aside-mask{position:fixed;left:0;top:0;bottom:0;right:0;z-index:98;background:rgba(0,0,0,.5);opacity:0}.ui-btnlist .btn{float:left}.ui-btnlist .btn:first-child{border-radius:.05rem 0 0 .05rem}.ui-btnlist .btn:last-child{border-radius:0 .05rem .05rem 0}.ui-progressBox{overflow:hidden;height:20px;background:#fff;border:1px solid #d7d7d7;border-radius:10px}.ui-progressBox progress{transform:translateX(120%)}.ui-progressBox .progress-content{display:block;height:100%;border:2px solid #fff;border-radius:8px;background-color:#e4393c;min-width:16px;width:0}.ui-progressBox .progress-content.primary{background-color:#1ab394}.ui-progressBox .progress-content.success{background-color:#1c84c6}.ui-progressBox .progress-content.info{background-color:#23c6c8}.ui-progressBox .progress-content.warning{background-color:#f8ac59}.ui-progressBox .progress-content.danger{background-color:#ed5565} \ No newline at end of file diff --git a/css/miniMobile.less b/css/miniMobile.less new file mode 100644 index 0000000..38e2669 --- /dev/null +++ b/css/miniMobile.less @@ -0,0 +1,688 @@ +/* + * minimobile.less v0.0.1 by chenyaowen + * 在保留作者签名的情况下,允许使用与商业用途 + */ +//颜色变量 +@color1: #e4393c; //点睛色,按钮着色,icon着色,特殊强调的文字 +@color2: #222; //重要颜色,导航名称,板块标题,类目名称 +@color3: #666; //普通段落信息,引导词 +@color4: #999; //辅助,次要文字,按钮描边,按钮灰色背景,默认blockquote颜色 +@color5: #d7d7d7; //分割线,标签描边 +@color6: #f3f5f7; //区域底色1 +@color7: #f8f8f8; //区域底色2 +@color8: #fff; //默认白色,通常很多地方采用,请勿修改 +@color-primary: #1ab394; +@color-success: #1c84c6; +@color-info: #23c6c8; +@color-warning: #f8ac59; +@color-danger: #ed5565; +@font: -apple-system, +BlinkMacSystemFont, +"PingFang SC", +"Helvetica Neue", +STHeiti, +"Microsoft Yahei", +Tahoma, +Simsun, +sans-serif; +@size-loop-n: 75; //栅格化等份值 +@spacing-loop-n: 12; //内外边距最大等份值 +@percentage-loop-n: 12; //百分比栅格数 +@fontsize-min: 28; //字体最小值,单位像素 +@fontsize-max: 60; //字体最大值,单位像素 +//清除默认样式 +* { + margin: 0; + padding: 0; + box-sizing: border-box; + font-family: @font; +} + +a { + text-decoration: none; + color: @color3; + cursor: pointer; +} + +body { + overflow-x: hidden; +} + +img { + vertical-align: middle; + border: none; +} + +li { + list-style: none; +} + +//浮动 +.fl { + float: left; +} + +.fr { + float: right; +} + +.fn { + float: none; +} + +.clearfix:after { + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden +} + +//文本对其 +.t-c { + text-align: center; +} + +.t-l { + text-align: left; +} + +.t-r { + text-align: right; +} + +.nowrap { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.o-h { + overflow: hidden; +} + +.o-s { + overflow: scroll; +} + +.o-v { + overflow: visible; +} + + +/* 文本垂直居中 */ + +.t-c-v { + display: -webkit-inline-box; + display: -ms-inline-flexbox; + display: -webkit-inline-flex; + display: inline-flex; + -webkit-box-pack: center; + -ms-flex-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: center; + -ms-flex-align: center; + -webkit-align-items: center; + align-items: center; +} + +//字体大小 +.f0 { + font-size: 0; +} + +.font-size(@n, @i) when(@i <=@n) { + .f@{i} { + font-size: @i/100rem; + } + .font-size(@n, (@i+2)); +} + +.font-size(@fontsize-max, @fontsize-min); +//颜色 +.color1 { + color: @color1; +} + +.color2 { + color: @color2; +} + +.color3 { + color: @color3; +} + +.color4 { + color: @color4; +} + +.color5 { + color: @color5; +} + +.color6 { + color: @color6; +} + +.color7 { + color: @color7; +} + +.color8 { + color: @color8; +} + +.color-primary { + color: @color-primary; +} + +.color-success { + color: @color-success; +} + +.color-info { + color: @color-info; +} + +.color-warning { + color: @color-warning; +} + +.color-danger { + color: @color-danger; +} + +//背景色 +.bg-color1 { + background-color: @color1; +} + +.bg-color2 { + background-color: @color2; +} + +.bg-color3 { + background-color: @color3; +} + +.bg-color4 { + background-color: @color4; +} + +.bg-color5 { + background-color: @color5; +} + +.bg-color6 { + background-color: @color6; +} + +.bg-color7 { + background-color: @color7; +} + +.bg-color8 { + background-color: @color8; +} + +.bg-color-primary { + background-color: @color-primary; +} + +.bg-color-success { + background-color: @color-success; +} + +.bg-color-info { + background-color: @color-info; +} + +.bg-color-warning { + background-color: @color-warning; +} + +.bg-color-danger { + background-color: @color-danger; +} + +//下划线 +hr { + border: none; + border-bottom: 0.01rem solid @color5; +} + +hr.lg { + border-bottom: 0.03rem solid @color5; +} + +//栅格化 +.size-loop(@n, @i) when(@i <=@n) { + .w@{i} { + width: @i/10rem + } + .h@{i} { + height: @i/10rem + } + .size-loop(@n, (@i+1)); +} + +.size-loop(@size-loop-n, 1); +//12栏栅格 +.col-1, +.col-2, +.col-3, +.col-4, +.col-5, +.col-6, +.col-7, +.col-8, +.col-9, +.col-10, +.col-11, +.col-12 { + float: left; + display: inline-block +} + +.size-loop2(@n, @i) when(@i <=@n) { + .col-@{i} { + width: calc(100%/@n * @i) + } + .size-loop2(@n, (@i+1)); +} + +.size-loop2(@percentage-loop-n, 1); +//间距 +.spacing-loop-short(@n, @i) when(@i <=@n) { + .m@{i} { + margin: @i/10rem; + } + .p@{i} { + padding: @i/10rem; + } + .spacing-loop-short(@n, (@i+1)); +} + +.spacing-loop-short(@spacing-loop-n, 1); +.spacing-loop(@n, @i) when(@i <=@n) { + .ml@{i} { + margin-left: @i/10rem; + } + .mr@{i} { + margin-right: @i/10rem; + } + .mt@{i} { + margin-top: @i/10rem; + } + .mb@{i} { + margin-bottom: @i/10rem; + } + .pl@{i} { + padding-left: @i/10rem; + } + .pr@{i} { + padding-right: @i/10rem; + } + .pt@{i} { + padding-top: @i/10rem; + } + .pb@{i} { + padding-bottom: @i/10rem; + } + .spacing-loop(@n, (@i+1)); +} + +.spacing-loop(@spacing-loop-n, 1); +//按钮 +.btn { + .t-c-v; + background-color: @color1; + cursor: pointer; + color: #fff; + border: 1px solid @color1; + &:hover, + &:active { + background-color: darken(@color1, 10%); + border-color: darken(@color1, 10%); + } +} + +.btn.disable, +.btn[disabled=disabled] { + background-color: @color4 !important; + border-color: @color4 !important; + cursor: default; +} + +.btn-fun(@name, @thiscolor) { + .btn-@{name} { + background-color: @thiscolor; + border-color: @thiscolor; + &:hover, + &:active { + background-color: darken(@thiscolor, 10%); + border-color: darken(@thiscolor, 10%); + } + } +} + +.btn-fun(primary, @color-primary); +.btn-fun(success, @color-success); +.btn-fun(info, @color-info); +.btn-fun(warning, @color-warning); +.btn-fun(danger, @color-danger); +//下拉按钮 +.btn-select { + position: relative; + border: none; + .btn-select-list { + position: absolute; + left: 0; + top: 100%; + width: 100%; + line-height: 2.4em; + border-top: 1px solid #fff; + display: none; + li, + li a { + color: #fff; + display: block; + width: 100%; + height: 100%; + cursor: pointer; + &:hover { + background: rgba(0, 0, 0, .1); + } + } + } +} + +//状态 +.tag { + background-color: @color1; + padding: 0.01rem 0.1rem; + border-radius: 0.05rem; + color: #fff; + .nowrap +} + +.tag-fun(@name, @thiscolor) { + .tag-@{name} { + background-color: @thiscolor; + } +} + +.tag-fun(primary, @color-primary); +.tag-fun(success, @color-success); +.tag-fun(info, @color-info); +.tag-fun(warning, @color-warning); +.tag-fun(danger, @color-danger); +//表单组件 +.form-control { + border: 1px solid @color5; + resize: none; + padding: 0.1rem 0.2rem; + vertical-align: middle; + font: inherit; + font-size: inherit; +} + +.form-control:focus { + border-color: @color4; +} + +.ui-checkbox, +.ui-radio { + cursor: pointer; + width: 0.35rem; + height: 0.35rem; + display: inline-block; + vertical-align: middle; + border: 0.01rem solid @color4; + margin-right: 0.05rem; + margin-top: -0.05rem; + border-radius: 20%; + text-align: center; + .t-c-v; +} + +.ui-checkbox.checked, +.ui-radio.checked { + background-color: @color1; + border-color: @color1; +} + +.ui-checkbox.checked:after, +.ui-radio.checked:after { + content: ''; + display: inline-block; + width: 20%; + height: 40%; + margin-top: -5%; + border-bottom: 2px solid #fff; + border-right: 2px solid #fff; + transform: rotate(30deg); +} + +.ui-radio { + border-radius: 50%; +} + +.ui-radio.disabled, +.ui-checkbox.disabled { + opacity: 0.3; + cursor: default; +} + +.check-fun(@name, @thiscolor) { + .check-@{name}.checked { + background-color: @thiscolor; + border-color: @thiscolor; + } +} + +.check-fun(primary, @color-primary); +.check-fun(success, @color-success); +.check-fun(info, @color-info); +.check-fun(warning, @color-warning); +.check-fun(danger, @color-danger); +//下拉按钮 +.ui-selectBox { + display: inline-block; + border: 1px solid @color5; + height: 0.62rem; + line-height: 0.6rem; + padding: 0; + position: relative; + overflow: hidden; + input { + float: left; + display: block; + position: absolute; + padding-left: 0.5em; + top: 0; + width: 100%; + height: 100%; + line-height: 0.6rem; + border: none; + } + i.icon { + float: right; + display: inline-block; + width: 1em; + position: absolute; + right: 0.5em; + top: 0; + } + .box { + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + cursor: pointer; + } +} + +//引用 +blockquote { + padding: 0.1rem 0.2rem; + border-left: 0.05rem solid @color1; + color: #666; +} + +.blockquote-primary { + border-color: #1ab394; +} + +.blockquote-success { + border-color: #1c84c6; +} + +.blockquote-info { + border-color: #23c6c8 +} + +.blockquote-warning { + border-color: #f8ac59 +} + +.blockquote-danger { + border-color: #ed5565 +} + +blockquote.normal { + border-color: @color4; +} + +//圆角 +.radius0 { + border-radius: 0; +} + +.radius5 { + border-radius: 0.05rem; +} + +.radius10 { + border-radius: 0.1rem; +} + +.radius15 { + border-radius: 0.15rem; +} + +.radius20 { + border-radius: 0.2rem; +} + +.radius-o { + border-radius: 50%; +} + +//table +table { + border-collapse: collapse; + border-spacing: 0px; + border: 0px solid gray; +} + +td, +th { + border: 1px solid #ccc; + padding: 2px 15px; +} + +th { + background: #f1f1f1; +} + + +/* + * 以下是公用的东西 + */ + +.ui-title { + line-height: 1.8em; + border-bottom: 0.01rem solid @color5; + font-weight: normal; +} + +//公用头部 +.ui-header { + line-height: 0.8rem; +} + +.ui-header-l, +.ui-header-r { + cursor: pointer; +} + +//侧栏 +.ui-aside { + position: fixed; + top: -99999rem; + bottom: -99999rem; + z-index: 99; +} + +.ui-aside-mask { + position: fixed; + left: 0; + top: 0; + bottom: 0; + right: 0; + z-index: 98; + background: rgba(0, 0, 0, 0.5); + opacity: 0; +} + +//按钮组 +.ui-btnlist .btn { + float: left; +} + +.ui-btnlist .btn:first-child { + border-radius: .05rem 0 0 .05rem; +} + +.ui-btnlist .btn:last-child { + border-radius: 0 .05rem .05rem 0; +} + +//进度条 +.ui-progressBox { + overflow: hidden; + height: 20px; + background: #fff; + border: 1px solid @color5; + border-radius: 10px; + progress { + transform: translateX(120%); + } + .progress-content { + display: block; + height: 100%; + border: 2px solid #fff; + border-radius: 8px; + background-color: @color1; + min-width: 16px; + width: 0; + &.primary { + background-color: @color-primary; + } + &.success { + background-color: @color-success; + } + &.info { + background-color: @color-info; + } + &.warning { + background-color: @color-warning; + } + &.danger { + background-color: @color-danger; + } + } +} \ No newline at end of file diff --git a/flow.html b/flow.html new file mode 100644 index 0000000..7ceafa9 --- /dev/null +++ b/flow.html @@ -0,0 +1,107 @@ + + + + + + + + + + + miniMobile + + + + + + + + + + + + + + + +
+
+ +
+
+ 瀑布流 +
+
+ +
+
+
+

+ myflow.js +

+

一只简单实用的响应式瀑布流插件!

+
+
+
+ 点击加载 +
+ + + +
+ +
+ + + + \ No newline at end of file diff --git a/foldingPanel.html b/foldingPanel.html new file mode 100644 index 0000000..69271a7 --- /dev/null +++ b/foldingPanel.html @@ -0,0 +1,307 @@ + + + + + + + + + + + miniMobile + + + + + + + + + + + + + +
+
+ +
+
+ 折叠面板 +
+
+ +
+
+
+

普通折叠面板


+
+
+
讲一个笑话
+
明天爸爸生日,我问老公带点什么礼物回去?老公想了想说:“就带着我们最真诚的祝福吧。”我。。。
+
+
+
学姐你冷吗
+
大一时,有个学弟追我,在室友的起哄下,我和他出去看了一场电影。那时候是初冬,进场的时候不太冷,看完电影出来有点冷,学弟可能看出来了,问我:学姐,很冷吗?然后拉开他的羽绒服拉链,在我以为他要把衣服给我的时候,他对我说:你看,我都穿保暖衣了……
+
+
+
这是为什么
+
突然想到一个问题:西游记中玉帝只有十万天兵天将,而天蓬元帅有八十万天河水军,天蓬元帅为什么不反玉帝自己做玉帝呢?哥们儿一句话:因为八十万是水军。
+
+
+
什么情况
+
想吃火腿肠了,不过我在看电视,懒得动,懒得去拿,就喊老公:老公,我想吃火腿肠,帮我拿一根。 结果这货很激动地直接过来了……
+
+
+
+

普通表格

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
名字语文数学英语化学生物物理地理历史总分
刘全蛋88分59分90分10分69分100分70分90分490分
李大嘴88分59分90分10分69分100分70分90分490分
郭芙蓉88分59分90分10分69分100分70分90分490分
+
+
+

使用面板代替table表格


+
+
+
考试成绩表
+
+
+
张一毛
+
+
+

语文:

+

88分

+
+
+

数学:

+

59分

+
+
+

英语:

+

90分

+
+
+

化学:

+

10分

+
+
+

生物:

+

69分

+
+
+

物理:

+

100分

+
+
+

地理:

+

70分

+
+
+

历史:

+

90分

+
+
+

总分:

+

490分

+
+
+
+
+
刘全蛋
+
+
+

语文:

+

88分

+
+
+

数学:

+

59分

+
+
+

英语:

+

90分

+
+
+

化学:

+

10分

+
+
+

生物:

+

69分

+
+
+

物理:

+

100分

+
+
+

地理:

+

70分

+
+
+

历史:

+

90分

+
+
+

总分:

+

490分

+
+
+
+
+
李大嘴
+
+
+

语文:

+

88分

+
+
+

数学:

+

59分

+
+
+

英语:

+

90分

+
+
+

化学:

+

10分

+
+
+

生物:

+

69分

+
+
+

物理:

+

100分

+
+
+

地理:

+

70分

+
+
+

历史:

+

90分

+
+
+

总分:

+

490分

+
+
+
+
+
郭芙蓉
+
+
+

语文:

+

88分

+
+
+

数学:

+

59分

+
+
+

英语:

+

90分

+
+
+

化学:

+

10分

+
+
+

生物:

+

69分

+
+
+

物理:

+

100分

+
+
+

地理:

+

70分

+
+
+

历史:

+

90分

+
+
+

总分:

+

490分

+
+
+
+
+

+ + + + + \ No newline at end of file diff --git a/font.html b/font.html new file mode 100644 index 0000000..52e88eb --- /dev/null +++ b/font.html @@ -0,0 +1,90 @@ + + + + + + + + + + + 字体排版 + + + + + + + + + + + + + +
+
+ +
+
+ 字体大小与颜色 +
+
+ +
+
+
+

+ 文字排版 +

+

中国的文字很有意思!

+

Chinese characters are very interesting

+
+ +
+
color1
+
color2
+
color3
+
color4
+
color5
+
color6
+
color7
+
color8
+
color-success
+
color-primary
+
color-info
+
color-warning
+
color-warning
+
--
+

+

字体大小表


+
+
字体大小
+
字体大小
+
字体大小
+
字体大小
+
字体大小
+
字体大小
+
字体大小
+
字体大小
+
字体大小
+
--
+
+ + + + \ No newline at end of file diff --git a/form.html b/form.html new file mode 100644 index 0000000..31657f2 --- /dev/null +++ b/form.html @@ -0,0 +1,218 @@ + + + + + + + + + + + miniMobile + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+ + + + +
+
+ +
+
+
+ 姓名: + +
+
+ 年龄: + +
+
+ 邮箱: + +
+
+ 地址: +
+ 请选择 +
+
+
+ 性别: + + +
+
+ 爱好: + + + +
+
+ 范围: +
+
+
+ 滑块: + +
+
+ 备注: + +
+
+ +
+
+
+ + + + \ No newline at end of file diff --git a/fullWinodwPage.html b/fullWinodwPage.html new file mode 100644 index 0000000..60bd4f0 --- /dev/null +++ b/fullWinodwPage.html @@ -0,0 +1,113 @@ + + + + + + + + + + + 全屏切换 + + + + + + + + + + + + + + + + + +
+
+
+ 全屏切换基于swiper插件 +
+
Slide 2 + 点击回到首页 +
+
Slide 3 + 点击回到首页 +
+
Slide 4 + 点击回到首页 +
+
Slide 5 + 点击回到首页 +
+
Slide 6 + 点击回到首页 +
+
Slide 7 + 点击回到首页 +
+
Slide 8 + 点击回到首页 +
+
Slide 9 + 点击回到首页 +
+
Slide 10 + 点击回到首页 +
+
+
+
+ + + + + + \ No newline at end of file diff --git a/grid.html b/grid.html new file mode 100644 index 0000000..dc5df3a --- /dev/null +++ b/grid.html @@ -0,0 +1,114 @@ + + + + + + + + + + + 栅格化 + + + + + + + + + + + + + +
+
+ +
+
+ 栅格化 +
+
+ +
+
+
+

+ 栅格化系统 +

+

使用栅格化,轻松排版每个模块!

+
+
+
+ +
模块布局 +
+
+
+ 可定宽高 +
+
+ 方便快捷 +
+
+
+
+ 灵活易懂 +
+
+ 好学好用 +
+
+
+
+

混合形式的栅格化


+
+
col-6
+
col-6
+
+
+
col-4
+
col-4
+
col-4
+
+
+
col-3
+
col-3
+
col-3
+
col-3
+
+
+
w15
+
w15
+
w15
+
w15
+
w15
+
+
+
col-2
+
col-2
+
col-2
+
col-2
+
col-2
+
col-2
+
+
+
col-1
+
col-2
+
col-3
+
col-6
+

+ + + + \ No newline at end of file diff --git a/header.html b/header.html new file mode 100644 index 0000000..57b7301 --- /dev/null +++ b/header.html @@ -0,0 +1,86 @@ + + + + + + + + + + + miniMobile + + + + + + + + + + + + + +
+
+ +
+
+ 标题内容 +
+
+ +
+
+

+
+
+ +
+
+ 标题内容 +
+
+ +
+
+

+
+
+ +
+
+ 标题内容 +
+
+ +
+
+

+
+
+ +
+
+ 标题内容 +
+
+ +
+
+

+
+
+ +
+
+ 标题内容 +
+
+ +
+
+ + + \ No newline at end of file diff --git a/icon.html b/icon.html new file mode 100644 index 0000000..bfb0e1f --- /dev/null +++ b/icon.html @@ -0,0 +1,92 @@ + + + + + + + + + + + miniMobile + + + + + + + + + + + + + +
+
+ +
+
+ 字体图标 +
+
+ +
+

+

可以在fonticon官网新增

+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/img/banner1.jpg b/img/banner1.jpg new file mode 100644 index 0000000..3839d3e Binary files /dev/null and b/img/banner1.jpg differ diff --git a/img/banner2.jpg b/img/banner2.jpg new file mode 100644 index 0000000..d0fd07b Binary files /dev/null and b/img/banner2.jpg differ diff --git a/img/banner3.jpg b/img/banner3.jpg new file mode 100644 index 0000000..598e619 Binary files /dev/null and b/img/banner3.jpg differ diff --git a/img/meng.jpg b/img/meng.jpg new file mode 100644 index 0000000..16793bf Binary files /dev/null and b/img/meng.jpg differ diff --git a/img/s1.jpg b/img/s1.jpg new file mode 100644 index 0000000..2c97402 Binary files /dev/null and b/img/s1.jpg differ diff --git a/img/s2.jpg b/img/s2.jpg new file mode 100644 index 0000000..8f5b38e Binary files /dev/null and b/img/s2.jpg differ diff --git a/img/s3.jpg b/img/s3.jpg new file mode 100644 index 0000000..ed0f15a Binary files /dev/null and b/img/s3.jpg differ diff --git a/img/s4.jpg b/img/s4.jpg new file mode 100644 index 0000000..75013d4 Binary files /dev/null and b/img/s4.jpg differ diff --git a/img/s5.jpg b/img/s5.jpg new file mode 100644 index 0000000..c207ead Binary files /dev/null and b/img/s5.jpg differ diff --git a/img/select.png b/img/select.png new file mode 100644 index 0000000..428ab26 Binary files /dev/null and b/img/select.png differ diff --git a/img/timg.gif b/img/timg.gif new file mode 100644 index 0000000..a2b0931 Binary files /dev/null and b/img/timg.gif differ diff --git a/img/user.jpg b/img/user.jpg new file mode 100644 index 0000000..9c07d14 Binary files /dev/null and b/img/user.jpg differ diff --git a/img/user2.jpg b/img/user2.jpg new file mode 100644 index 0000000..31c1bda Binary files /dev/null and b/img/user2.jpg differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..6b7904c --- /dev/null +++ b/index.html @@ -0,0 +1,291 @@ + + + + + + + + + + + miniMobile + + + + + + + + + + + + + + + + +
+
+ +
+
+ 快速预览 +
+
+ +
+
+ + + + + +
+
+
+
+
+
+ +
+
+ +
+
+ + + +
+

+ miniMobile +

+

用最少的codding写出最灵活的代码。

+
+ +
+
+ +

按钮徽章

+
+
+
+ + +

消息提示

+
+
+
+ +

栅格化

+
+
+
+ +

表单元素

+
+
+
+ +

icon

+
+
+
+ +

侧栏导航

+
+
+
+ +

字体排版

+
+
+
+ +

折叠面板

+
+
+
+ +

swiper

+
+
+
+ +

瀑布流

+
+
+
+ +

iScroll

+
+
+
+ +

相册切换

+
+
+
+ +

安全键盘

+
+
+
+ +

Progress

+
+
+
+ +

全屏切换

+
+
+
+ +

Tab切换

+
+
+
+ + + + + + + \ No newline at end of file diff --git a/iscroll.html b/iscroll.html new file mode 100644 index 0000000..9a5143c --- /dev/null +++ b/iscroll.html @@ -0,0 +1,146 @@ + + + + + + + + + + + miniMobile + + + + + + + + + + + + + + + +
+
+ +
+
+ iScroll +
+
+ +
+
+
+
+
+ +
+ +
+ +
+
+
+ + + + + \ No newline at end of file diff --git a/js/flexible.min.js b/js/flexible.min.js new file mode 100644 index 0000000..10d1af1 --- /dev/null +++ b/js/flexible.min.js @@ -0,0 +1,116 @@ +//改版的flexible.min.js , 并没有按照原来的要求和比例,而是按照设计稿件一对一的设置比例 +//如果设计稿件为750,或者360,那么这里只需要修改一个designPixel参数,就可以一对一的还原设计。 +;(function(win, lib) { + var doc = win.document; + var docEl = doc.documentElement; + var metaEl = doc.querySelector('meta[name="viewport"]'); + var flexibleEl = doc.querySelector('meta[name="flexible"]'); + var dpr = 0; + var scale = 0; + var tid; + var flexible = lib.flexible || (lib.flexible = {}); + var designPixel = 750;//设计稿件尺寸 + + if (metaEl) { + console.warn('将根据已有的meta标签来设置缩放比例'); + var match = metaEl.getAttribute('content').match(/initial\-scale=([\d\.]+)/); + if (match) { + scale = parseFloat(match[1]); + dpr = parseInt(1 / scale); + } + } else if (flexibleEl) { + var content = flexibleEl.getAttribute('content'); + if (content) { + var initialDpr = content.match(/initial\-dpr=([\d\.]+)/); + var maximumDpr = content.match(/maximum\-dpr=([\d\.]+)/); + if (initialDpr) { + dpr = parseFloat(initialDpr[1]); + scale = parseFloat((1 / dpr).toFixed(2)); + } + if (maximumDpr) { + dpr = parseFloat(maximumDpr[1]); + scale = parseFloat((1 / dpr).toFixed(2)); + } + } + } + + if (!dpr && !scale) { + var isAndroid = win.navigator.appVersion.match(/android/gi); + var isIPhone = win.navigator.appVersion.match(/iphone/gi); + var devicePixelRatio = win.devicePixelRatio; + if (isIPhone) { + if (devicePixelRatio >= 3 && (!dpr || dpr >= 3)) { + dpr = 3; + } else if (devicePixelRatio >= 2 && (!dpr || dpr >= 2)){ + dpr = 2; + } else { + dpr = 1; + } + } else { + dpr = 1; + } + scale = 1 / dpr; + } + + docEl.setAttribute('data-dpr', dpr); + if (!metaEl) { + metaEl = doc.createElement('meta'); + metaEl.setAttribute('name', 'viewport'); + metaEl.setAttribute('content', 'initial-scale=' + scale + ', maximum-scale=' + scale + ', minimum-scale=' + scale + ', user-scalable=no'); + if (docEl.firstElementChild) { + docEl.firstElementChild.appendChild(metaEl); + } else { + var wrap = doc.createElement('div'); + wrap.appendChild(metaEl); + doc.write(wrap.innerHTML); + } + } + + function refreshRem(){ + var width = docEl.getBoundingClientRect().width; + if (width / dpr > designPixel) { //如果分辨率不是1,那么获取的物理宽度应该乘以分辨率,才是最终可用的width + width = width * dpr; + } + var rem = width / (designPixel/100); //计算最终还原到设计图上的比例,从而设置到文档上 + docEl.style.fontSize = rem + 'px'; + flexible.rem = win.rem = rem; + } + + win.addEventListener('resize', function() { + clearTimeout(tid); + tid = setTimeout(refreshRem, 300); + }, false); + win.addEventListener('pageshow', function(e) { + if (e.persisted) { + clearTimeout(tid); + tid = setTimeout(refreshRem, 300); + } + }, false); + + if (doc.readyState === 'complete') { + doc.body.style.fontSize = 16 * dpr + 'px'; + } else { + doc.addEventListener('DOMContentLoaded', function(e) { + doc.body.style.fontSize = 16 * dpr + 'px'; + }, false); + } + refreshRem(); + + flexible.dpr = win.dpr = dpr; + flexible.refreshRem = refreshRem; + flexible.rem2px = function(d) { + var val = parseFloat(d) * this.rem; + if (typeof d === 'string' && d.match(/rem$/)) { + val += 'px'; + } + return val; + } + flexible.px2rem = function(d) { + var val = parseFloat(d) / this.rem; + if (typeof d === 'string' && d.match(/px$/)) { + val += 'rem'; + } + return val; + } + +})(window, window['lib'] || (window['lib'] = {})); \ No newline at end of file diff --git a/js/miniMobile.js b/js/miniMobile.js new file mode 100644 index 0000000..e7ed45e --- /dev/null +++ b/js/miniMobile.js @@ -0,0 +1,232 @@ +/* + * minimobile.js v0.0.1 by chenyaowen + * 在保留作者签名的情况下,允许使用与商业用途 + */ + if(!window.Zepto && !window.jQuery){ + console.log("minimobile 是基于Zepto.js 或者 jQuery.js 的,请检查页面是否已在miniMobile之前引入!") + } +;(function(win, lib) { + //摘自淘宝移动端 + var doc = win.document; + var docEl = doc.documentElement; + var metaEl = doc.querySelector('meta[name="viewport"]'); + var flexibleEl = doc.querySelector('meta[name="flexible"]'); + var dpr = 0; + var scale = 0; + var tid; + var flexible = lib.flexible || (lib.flexible = {}); + var designPixel = 750;//设计稿件尺寸 + + if (metaEl) { + console.warn('将根据已有的meta标签来设置缩放比例'); + var match = metaEl.getAttribute('content').match(/initial\-scale=([\d\.]+)/); + if (match) { + scale = parseFloat(match[1]); + dpr = parseInt(1 / scale); + } + } else if (flexibleEl) { + var content = flexibleEl.getAttribute('content'); + if (content) { + var initialDpr = content.match(/initial\-dpr=([\d\.]+)/); + var maximumDpr = content.match(/maximum\-dpr=([\d\.]+)/); + if (initialDpr) { + dpr = parseFloat(initialDpr[1]); + scale = parseFloat((1 / dpr).toFixed(2)); + } + if (maximumDpr) { + dpr = parseFloat(maximumDpr[1]); + scale = parseFloat((1 / dpr).toFixed(2)); + } + } + } + if (!dpr && !scale) { + var isAndroid = win.navigator.appVersion.match(/android/gi); + var isIPhone = win.navigator.appVersion.match(/iphone/gi); + var devicePixelRatio = win.devicePixelRatio; + if (isIPhone) { + if (devicePixelRatio >= 3 && (!dpr || dpr >= 3)) { + dpr = 3; + } else if (devicePixelRatio >= 2 && (!dpr || dpr >= 2)){ + dpr = 2; + } else { + dpr = 1; + } + } else { + dpr = 1; + } + scale = 1 / dpr; + } + + docEl.setAttribute('data-dpr', dpr); + if (!metaEl) { + metaEl = doc.createElement('meta'); + metaEl.setAttribute('name', 'viewport'); + metaEl.setAttribute('content', 'initial-scale=' + scale + ', maximum-scale=' + scale + ', minimum-scale=' + scale + ', user-scalable=no'); + if (docEl.firstElementChild) { + docEl.firstElementChild.appendChild(metaEl); + } else { + var wrap = doc.createElement('div'); + wrap.appendChild(metaEl); + doc.write(wrap.innerHTML); + } + } + + function refreshRem(){ + var width = docEl.getBoundingClientRect().width; + if (width / dpr > designPixel) { //如果分辨率不是1,那么获取的物理宽度应该乘以分辨率,才是最终可用的width + width = width * dpr; + } + var rem = width / (designPixel/100); //计算最终还原到设计图上的比例,从而设置到文档上 + docEl.style.fontSize = rem + 'px'; + flexible.rem = win.rem = rem; + } + + win.addEventListener('resize', function() { + clearTimeout(tid); + tid = setTimeout(refreshRem, 300); + }, false); + win.addEventListener('pageshow', function(e) { + if (e.persisted) { + clearTimeout(tid); + tid = setTimeout(refreshRem, 300); + } + }, false); + + if (doc.readyState === 'complete') { + doc.body.style.fontSize = 16 * dpr + 'px'; + } else { + doc.addEventListener('DOMContentLoaded', function(e) { + doc.body.style.fontSize = 16 * dpr + 'px'; + }, false); + } + refreshRem(); + + flexible.dpr = win.dpr = dpr; + flexible.refreshRem = refreshRem; + flexible.rem2px = function(d) { + var val = parseFloat(d) * this.rem; + if (typeof d === 'string' && d.match(/rem$/)) { + val += 'px'; + } + return val; + } + flexible.px2rem = function(d) { + var val = parseFloat(d) / this.rem; + if (typeof d === 'string' && d.match(/px$/)) { + val += 'rem'; + } + return val; + } + +})(window, window['lib'] || (window['lib'] = {})); +/* + * asideUi 侧栏 + */ +; +(function($) { + $.fn.asideUi = function(options) { + var defaults = { + size: '100%', + hasmask: true, + position: 'left', + sidertime: 300 + }; + var val = $.extend(defaults, options); + var obj = function() {}, + _self = this, + thisMask = $("
"), + thisCss = {}, + thisCss2 = {}; + thisCss[val.position] = '-' + val.size; + this.css({ + 'top': (val.position == "bottom") ? "auto" : 0, + 'bottom': 0 + }); + thisCss2[val.position] = 0; + _self.css(thisCss); + + obj.toggle = function() { + if(_self.hasClass('ui-aside-open')) { + _self.removeClass('ui-aside-open'); + _self.animate(thisCss, val.sidertime); + $('.ui-aside-mask').animate({ + 'opacity': 0 + }, 100, function() { + $(this).remove(); + }); + } else { + _self.addClass('ui-aside-open'); + _self.animate(thisCss2, val.sidertime); + if(val.hasmask) { + $('body').append(thisMask); + $(".ui-aside-mask").animate({ + 'opacity': 1 + }, 100); + } + } + } + thisMask.tap(function() { + obj.toggle(); + }) + return obj; + }; +})(window.Zepto || window.jQuery) +/* + * 返回顶部 + */ +function goTop(acceleration, time) { + acceleration = acceleration || 0.1; + time = time || 16; + var x1 = 0; + var y1 = 0; + var x2 = 0; + var y2 = 0; + var x3 = 0; + var y3 = 0; + if(document.documentElement) { + x1 = document.documentElement.scrollLeft || 0; + y1 = document.documentElement.scrollTop || 0; + } + if(document.body) { + x2 = document.body.scrollLeft || 0; + y2 = document.body.scrollTop || 0; + } + var x3 = window.scrollX || 0; + var y3 = window.scrollY || 0; + // 滚动条到页面顶部的水平距离 + var x = Math.max(x1, Math.max(x2, x3)); + // 滚动条到页面顶部的垂直距离 + var y = Math.max(y1, Math.max(y2, y3)); + // 滚动距离 = 目前距离 / 速度, 因为距离原来越小, 速度是大于 1 的数, 所以滚动距离会越来越小 + var speed = 1 + acceleration; + window.scrollTo(Math.floor(x / speed), Math.floor(y / speed)); + // 如果距离不为零, 继续调用迭代本函数 + if(x > 0 || y > 0) { + var invokeFunction = "goTop(" + acceleration + ", " + time + ")"; + window.setTimeout(invokeFunction, time); + } +} + +/* + * ui-progress进度条 + */ +; +(function($) { + $.fn.progressUi = function(options) { + var defaults = { + skin: '' + }; + var val = $.extend(defaults, options); + var attrs = { + max: this.attr('max') || 0, + value: this.attr("value") || 0 + }, + doms = $('
'); + domsContent = $('
'); + this.wrap(doms); + domsContent.animate({ + 'width': attrs.value / attrs.max * 100 + '%', + }); + doms.prepend(domsContent); + }; +})(window.Zepto || window.jQuery) \ No newline at end of file diff --git a/js/zepto.min.js b/js/zepto.min.js new file mode 100644 index 0000000..d5a41f1 --- /dev/null +++ b/js/zepto.min.js @@ -0,0 +1,3 @@ +/* Zepto 1.2.0 - zepto event ajax form ie detect fx fx_methods assets data deferred callbacks selector touch gesture stack ios3 - zeptojs.com/license */ +!function(t,e){"function"==typeof define&&define.amd?define(function(){return e(t)}):e(t)}(window,function(t){var e=function(){function D(t){return null==t?String(t):S[j.call(t)]||"object"}function k(t){return"function"==D(t)}function L(t){return null!=t&&t==t.window}function F(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function $(t){return"object"==D(t)}function R(t){return $(t)&&!L(t)&&Object.getPrototypeOf(t)==Object.prototype}function _(t){var e=!!t&&"length"in t&&t.length,n=i.type(t);return"function"!=n&&!L(t)&&("array"==n||0===e||"number"==typeof e&&e>0&&e-1 in t)}function q(t){return s.call(t,function(t){return null!=t})}function z(t){return t.length>0?i.fn.concat.apply([],t):t}function I(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function Z(t){return t in l?l[t]:l[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function W(t,e){return"number"!=typeof e||h[I(t)]?e:e+"px"}function B(t){var e,n;return c[t]||(e=f.createElement(t),f.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),c[t]=n),c[t]}function V(t){return"children"in t?u.call(t.children):i.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function X(t,e){var n,i=t?t.length:0;for(n=0;i>n;n++)this[n]=t[n];this.length=i,this.selector=e||""}function H(t,i,r){for(n in i)r&&(R(i[n])||M(i[n]))?(R(i[n])&&!R(t[n])&&(t[n]={}),M(i[n])&&!M(t[n])&&(t[n]=[]),H(t[n],i[n],r)):i[n]!==e&&(t[n]=i[n])}function U(t,e){return null==e?i(t):i(t).filter(e)}function Y(t,e,n,i){return k(e)?e.call(t,n,i):e}function G(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function J(t,n){var i=t.className||"",r=i&&i.baseVal!==e;return n===e?r?i.baseVal:i:void(r?i.baseVal=n:t.className=n)}function K(t){try{return t?"true"==t||("false"==t?!1:"null"==t?null:+t+""==t?+t:/^[\[\{]/.test(t)?i.parseJSON(t):t):t}catch(e){return t}}function Q(t,e){e(t);for(var n=0,i=t.childNodes.length;i>n;n++)Q(t.childNodes[n],e)}var e,n,i,r,O,P,o=[],a=o.concat,s=o.filter,u=o.slice,f=t.document,c={},l={},h={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},p=/^\s*<(\w+|!)[^>]*>/,d=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,m=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,g=/^(?:body|html)$/i,v=/([A-Z])/g,y=["val","css","html","text","data","width","height","offset"],b=["after","prepend","before","append"],x=f.createElement("table"),w=f.createElement("tr"),E={tr:f.createElement("tbody"),tbody:x,thead:x,tfoot:x,td:w,th:w,"*":f.createElement("div")},T=/^[\w-]*$/,S={},j=S.toString,C={},N=f.createElement("div"),A={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},M=Array.isArray||function(t){return t instanceof Array};return C.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var i,r=t.parentNode,o=!r;return o&&(r=N).appendChild(t),i=~C.qsa(r,e).indexOf(t),o&&N.removeChild(t),i},O=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},P=function(t){return s.call(t,function(e,n){return t.indexOf(e)==n})},C.fragment=function(t,n,r){var o,a,s;return d.test(t)&&(o=i(f.createElement(RegExp.$1))),o||(t.replace&&(t=t.replace(m,"<$1>")),n===e&&(n=p.test(t)&&RegExp.$1),n in E||(n="*"),s=E[n],s.innerHTML=""+t,o=i.each(u.call(s.childNodes),function(){s.removeChild(this)})),R(r)&&(a=i(o),i.each(r,function(t,e){y.indexOf(t)>-1?a[t](e):a.attr(t,e)})),o},C.Z=function(t,e){return new X(t,e)},C.isZ=function(t){return t instanceof C.Z},C.init=function(t,n){var r;if(!t)return C.Z();if("string"==typeof t)if(t=t.trim(),"<"==t[0]&&p.test(t))r=C.fragment(t,RegExp.$1,n),t=null;else{if(n!==e)return i(n).find(t);r=C.qsa(f,t)}else{if(k(t))return i(f).ready(t);if(C.isZ(t))return t;if(M(t))r=q(t);else if($(t))r=[t],t=null;else if(p.test(t))r=C.fragment(t.trim(),RegExp.$1,n),t=null;else{if(n!==e)return i(n).find(t);r=C.qsa(f,t)}}return C.Z(r,t)},i=function(t,e){return C.init(t,e)},i.extend=function(t){var e,n=u.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){H(t,n,e)}),t},C.qsa=function(t,e){var n,i="#"==e[0],r=!i&&"."==e[0],o=i||r?e.slice(1):e,a=T.test(o);return t.getElementById&&a&&i?(n=t.getElementById(o))?[n]:[]:1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType?[]:u.call(a&&!i&&t.getElementsByClassName?r?t.getElementsByClassName(o):t.getElementsByTagName(e):t.querySelectorAll(e))},i.contains=f.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},i.type=D,i.isFunction=k,i.isWindow=L,i.isArray=M,i.isPlainObject=R,i.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},i.isNumeric=function(t){var e=Number(t),n=typeof t;return null!=t&&"boolean"!=n&&("string"!=n||t.length)&&!isNaN(e)&&isFinite(e)||!1},i.inArray=function(t,e,n){return o.indexOf.call(e,t,n)},i.camelCase=O,i.trim=function(t){return null==t?"":String.prototype.trim.call(t)},i.uuid=0,i.support={},i.expr={},i.noop=function(){},i.map=function(t,e){var n,r,o,i=[];if(_(t))for(r=0;r=0?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return o.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return k(t)?this.not(this.not(t)):i(s.call(this,function(e){return C.matches(e,t)}))},add:function(t,e){return i(P(this.concat(i(t,e))))},is:function(t){return"string"==typeof t?this.length>0&&C.matches(this[0],t):t&&this.selector==t.selector},not:function(t){var n=[];if(k(t)&&t.call!==e)this.each(function(e){t.call(this,e)||n.push(this)});else{var r="string"==typeof t?this.filter(t):_(t)&&k(t.item)?u.call(t):i(t);this.forEach(function(t){r.indexOf(t)<0&&n.push(t)})}return i(n)},has:function(t){return this.filter(function(){return $(t)?i.contains(this,t):i(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!$(t)?t:i(t)},last:function(){var t=this[this.length-1];return t&&!$(t)?t:i(t)},find:function(t){var e,n=this;return e=t?"object"==typeof t?i(t).filter(function(){var t=this;return o.some.call(n,function(e){return i.contains(e,t)})}):1==this.length?i(C.qsa(this[0],t)):this.map(function(){return C.qsa(this,t)}):i()},closest:function(t,e){var n=[],r="object"==typeof t&&i(t);return this.each(function(i,o){for(;o&&!(r?r.indexOf(o)>=0:C.matches(o,t));)o=o!==e&&!F(o)&&o.parentNode;o&&n.indexOf(o)<0&&n.push(o)}),i(n)},parents:function(t){for(var e=[],n=this;n.length>0;)n=i.map(n,function(t){return(t=t.parentNode)&&!F(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return U(e,t)},parent:function(t){return U(P(this.pluck("parentNode")),t)},children:function(t){return U(this.map(function(){return V(this)}),t)},contents:function(){return this.map(function(){return this.contentDocument||u.call(this.childNodes)})},siblings:function(t){return U(this.map(function(t,e){return s.call(V(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return i.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=B(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var e=k(t);if(this[0]&&!e)var n=i(t).get(0),r=n.parentNode||this.length>1;return this.each(function(o){i(this).wrapAll(e?t.call(this,o):r?n.cloneNode(!0):n)})},wrapAll:function(t){if(this[0]){i(this[0]).before(t=i(t));for(var e;(e=t.children()).length;)t=e.first();i(t).append(this)}return this},wrapInner:function(t){var e=k(t);return this.each(function(n){var r=i(this),o=r.contents(),a=e?t.call(this,n):t;o.length?o.wrapAll(a):r.append(a)})},unwrap:function(){return this.parent().each(function(){i(this).replaceWith(i(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(t){return this.each(function(){var n=i(this);(t===e?"none"==n.css("display"):t)?n.show():n.hide()})},prev:function(t){return i(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return i(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var n=this.innerHTML;i(this).empty().append(Y(this,t,e,n))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=Y(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this.pluck("textContent").join(""):null},attr:function(t,i){var r;return"string"!=typeof t||1 in arguments?this.each(function(e){if(1===this.nodeType)if($(t))for(n in t)G(this,n,t[n]);else G(this,t,Y(this,i,e,this.getAttribute(t)))}):0 in this&&1==this[0].nodeType&&null!=(r=this[0].getAttribute(t))?r:e},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){G(this,t)},this)})},prop:function(t,e){return t=A[t]||t,"string"!=typeof t||1 in arguments?this.each(function(i){if($(t))for(n in t)this[A[n]||n]=t[n];else this[t]=Y(this,e,i,this[t])}):this[0]&&this[0][t]},removeProp:function(t){return t=A[t]||t,this.each(function(){delete this[t]})},data:function(t,n){var i="data-"+t.replace(v,"-$1").toLowerCase(),r=1 in arguments?this.attr(i,n):this.attr(i);return null!==r?K(r):e},val:function(t){return 0 in arguments?(null==t&&(t=""),this.each(function(e){this.value=Y(this,t,e,this.value)})):this[0]&&(this[0].multiple?i(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(e){if(e)return this.each(function(t){var n=i(this),r=Y(this,e,t,n.offset()),o=n.offsetParent().offset(),a={top:r.top-o.top,left:r.left-o.left};"static"==n.css("position")&&(a.position="relative"),n.css(a)});if(!this.length)return null;if(f.documentElement!==this[0]&&!i.contains(f.documentElement,this[0]))return{top:0,left:0};var n=this[0].getBoundingClientRect();return{left:n.left+t.pageXOffset,top:n.top+t.pageYOffset,width:Math.round(n.width),height:Math.round(n.height)}},css:function(t,e){if(arguments.length<2){var r=this[0];if("string"==typeof t){if(!r)return;return r.style[O(t)]||getComputedStyle(r,"").getPropertyValue(t)}if(M(t)){if(!r)return;var o={},a=getComputedStyle(r,"");return i.each(t,function(t,e){o[e]=r.style[O(e)]||a.getPropertyValue(e)}),o}}var s="";if("string"==D(t))e||0===e?s=I(t)+":"+W(t,e):this.each(function(){this.style.removeProperty(I(t))});else for(n in t)t[n]||0===t[n]?s+=I(n)+":"+W(n,t[n])+";":this.each(function(){this.style.removeProperty(I(n))});return this.each(function(){this.style.cssText+=";"+s})},index:function(t){return t?this.indexOf(i(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return t?o.some.call(this,function(t){return this.test(J(t))},Z(t)):!1},addClass:function(t){return t?this.each(function(e){if("className"in this){r=[];var n=J(this),o=Y(this,t,e,n);o.split(/\s+/g).forEach(function(t){i(this).hasClass(t)||r.push(t)},this),r.length&&J(this,n+(n?" ":"")+r.join(" "))}}):this},removeClass:function(t){return this.each(function(n){if("className"in this){if(t===e)return J(this,"");r=J(this),Y(this,t,n,r).split(/\s+/g).forEach(function(t){r=r.replace(Z(t)," ")}),J(this,r.trim())}})},toggleClass:function(t,n){return t?this.each(function(r){var o=i(this),a=Y(this,t,r,J(this));a.split(/\s+/g).forEach(function(t){(n===e?!o.hasClass(t):n)?o.addClass(t):o.removeClass(t)})}):this},scrollTop:function(t){if(this.length){var n="scrollTop"in this[0];return t===e?n?this[0].scrollTop:this[0].pageYOffset:this.each(n?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)})}},scrollLeft:function(t){if(this.length){var n="scrollLeft"in this[0];return t===e?n?this[0].scrollLeft:this[0].pageXOffset:this.each(n?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),n=this.offset(),r=g.test(e[0].nodeName)?{top:0,left:0}:e.offset();return n.top-=parseFloat(i(t).css("margin-top"))||0,n.left-=parseFloat(i(t).css("margin-left"))||0,r.top+=parseFloat(i(e[0]).css("border-top-width"))||0,r.left+=parseFloat(i(e[0]).css("border-left-width"))||0,{top:n.top-r.top,left:n.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||f.body;t&&!g.test(t.nodeName)&&"static"==i(t).css("position");)t=t.offsetParent;return t})}},i.fn.detach=i.fn.remove,["width","height"].forEach(function(t){var n=t.replace(/./,function(t){return t[0].toUpperCase()});i.fn[t]=function(r){var o,a=this[0];return r===e?L(a)?a["inner"+n]:F(a)?a.documentElement["scroll"+n]:(o=this.offset())&&o[t]:this.each(function(e){a=i(this),a.css(t,Y(this,r,e,a[t]()))})}}),b.forEach(function(n,r){var o=r%2;i.fn[n]=function(){var n,s,a=i.map(arguments,function(t){var r=[];return n=D(t),"array"==n?(t.forEach(function(t){return t.nodeType!==e?r.push(t):i.zepto.isZ(t)?r=r.concat(t.get()):void(r=r.concat(C.fragment(t)))}),r):"object"==n||null==t?t:C.fragment(t)}),u=this.length>1;return a.length<1?this:this.each(function(e,n){s=o?n:n.parentNode,n=0==r?n.nextSibling:1==r?n.firstChild:2==r?n:null;var c=i.contains(f.documentElement,s);a.forEach(function(e){if(u)e=e.cloneNode(!0);else if(!s)return i(e).remove();s.insertBefore(e,n),c&&Q(e,function(e){if(!(null==e.nodeName||"SCRIPT"!==e.nodeName.toUpperCase()||e.type&&"text/javascript"!==e.type||e.src)){var n=e.ownerDocument?e.ownerDocument.defaultView:t;n.eval.call(n,e.innerHTML)}})})})},i.fn[o?n+"To":"insert"+(r?"Before":"After")]=function(t){return i(t)[n](this),this}}),C.Z.prototype=X.prototype=i.fn,C.uniq=P,C.deserializeValue=K,i.zepto=C,i}();return t.Zepto=e,void 0===t.$&&(t.$=e),function(e){function h(t){return t._zid||(t._zid=n++)}function p(t,e,n,i){if(e=d(e),e.ns)var r=m(e.ns);return(s[h(t)]||[]).filter(function(t){return t&&(!e.e||t.e==e.e)&&(!e.ns||r.test(t.ns))&&(!n||h(t.fn)===h(n))&&(!i||t.sel==i)})}function d(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function m(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function g(t,e){return t.del&&!f&&t.e in c||!!e}function v(t){return l[t]||f&&c[t]||t}function y(t,n,r,o,a,u,f){var c=h(t),p=s[c]||(s[c]=[]);n.split(/\s/).forEach(function(n){if("ready"==n)return e(document).ready(r);var s=d(n);s.fn=r,s.sel=a,s.e in l&&(r=function(t){var n=t.relatedTarget;return!n||n!==this&&!e.contains(this,n)?s.fn.apply(this,arguments):void 0}),s.del=u;var c=u||r;s.proxy=function(e){if(e=S(e),!e.isImmediatePropagationStopped()){e.data=o;var n=c.apply(t,e._args==i?[e]:[e].concat(e._args));return n===!1&&(e.preventDefault(),e.stopPropagation()),n}},s.i=p.length,p.push(s),"addEventListener"in t&&t.addEventListener(v(s.e),s.proxy,g(s,f))})}function b(t,e,n,i,r){var o=h(t);(e||"").split(/\s/).forEach(function(e){p(t,e,n,i).forEach(function(e){delete s[o][e.i],"removeEventListener"in t&&t.removeEventListener(v(e.e),e.proxy,g(e,r))})})}function S(t,n){if(n||!t.isDefaultPrevented){n||(n=t),e.each(T,function(e,i){var r=n[e];t[e]=function(){return this[i]=x,r&&r.apply(n,arguments)},t[i]=w});try{t.timeStamp||(t.timeStamp=Date.now())}catch(r){}(n.defaultPrevented!==i?n.defaultPrevented:"returnValue"in n?n.returnValue===!1:n.getPreventDefault&&n.getPreventDefault())&&(t.isDefaultPrevented=x)}return t}function j(t){var e,n={originalEvent:t};for(e in t)E.test(e)||t[e]===i||(n[e]=t[e]);return S(n,t)}var i,n=1,r=Array.prototype.slice,o=e.isFunction,a=function(t){return"string"==typeof t},s={},u={},f="onfocusin"in t,c={focus:"focusin",blur:"focusout"},l={mouseenter:"mouseover",mouseleave:"mouseout"};u.click=u.mousedown=u.mouseup=u.mousemove="MouseEvents",e.event={add:y,remove:b},e.proxy=function(t,n){var i=2 in arguments&&r.call(arguments,2);if(o(t)){var s=function(){return t.apply(n,i?i.concat(r.call(arguments)):arguments)};return s._zid=h(t),s}if(a(n))return i?(i.unshift(t[n],t),e.proxy.apply(null,i)):e.proxy(t[n],t);throw new TypeError("expected function")},e.fn.bind=function(t,e,n){return this.on(t,e,n)},e.fn.unbind=function(t,e){return this.off(t,e)},e.fn.one=function(t,e,n,i){return this.on(t,e,n,i,1)};var x=function(){return!0},w=function(){return!1},E=/^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/,T={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};e.fn.delegate=function(t,e,n){return this.on(e,t,n)},e.fn.undelegate=function(t,e,n){return this.off(e,t,n)},e.fn.live=function(t,n){return e(document.body).delegate(this.selector,t,n),this},e.fn.die=function(t,n){return e(document.body).undelegate(this.selector,t,n),this},e.fn.on=function(t,n,s,u,f){var c,l,h=this;return t&&!a(t)?(e.each(t,function(t,e){h.on(t,n,s,e,f)}),h):(a(n)||o(u)||u===!1||(u=s,s=n,n=i),(u===i||s===!1)&&(u=s,s=i),u===!1&&(u=w),h.each(function(i,o){f&&(c=function(t){return b(o,t.type,u),u.apply(this,arguments)}),n&&(l=function(t){var i,a=e(t.target).closest(n,o).get(0);return a&&a!==o?(i=e.extend(j(t),{currentTarget:a,liveFired:o}),(c||u).apply(a,[i].concat(r.call(arguments,1)))):void 0}),y(o,t,u,s,n,l||c)}))},e.fn.off=function(t,n,r){var s=this;return t&&!a(t)?(e.each(t,function(t,e){s.off(t,n,e)}),s):(a(n)||o(r)||r===!1||(r=n,n=i),r===!1&&(r=w),s.each(function(){b(this,t,r,n)}))},e.fn.trigger=function(t,n){return t=a(t)||e.isPlainObject(t)?e.Event(t):S(t),t._args=n,this.each(function(){t.type in c&&"function"==typeof this[t.type]?this[t.type]():"dispatchEvent"in this?this.dispatchEvent(t):e(this).triggerHandler(t,n)})},e.fn.triggerHandler=function(t,n){var i,r;return this.each(function(o,s){i=j(a(t)?e.Event(t):t),i._args=n,i.target=s,e.each(p(s,t.type||t),function(t,e){return r=e.proxy(i),i.isImmediatePropagationStopped()?!1:void 0})}),r},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(t){e.fn[t]=function(e){return 0 in arguments?this.bind(t,e):this.trigger(t)}}),e.Event=function(t,e){a(t)||(e=t,t=e.type);var n=document.createEvent(u[t]||"Events"),i=!0;if(e)for(var r in e)"bubbles"==r?i=!!e[r]:n[r]=e[r];return n.initEvent(t,i,!0),S(n)}}(e),function(e){function p(t,n,i){var r=e.Event(n);return e(t).trigger(r,i),!r.isDefaultPrevented()}function d(t,e,n,r){return t.global?p(e||i,n,r):void 0}function m(t){t.global&&0===e.active++&&d(t,null,"ajaxStart")}function g(t){t.global&&!--e.active&&d(t,null,"ajaxStop")}function v(t,e){var n=e.context;return e.beforeSend.call(n,t,e)===!1||d(e,n,"ajaxBeforeSend",[t,e])===!1?!1:void d(e,n,"ajaxSend",[t,e])}function y(t,e,n,i){var r=n.context,o="success";n.success.call(r,t,o,e),i&&i.resolveWith(r,[t,o,e]),d(n,r,"ajaxSuccess",[e,n,t]),x(o,e,n)}function b(t,e,n,i,r){var o=i.context;i.error.call(o,n,e,t),r&&r.rejectWith(o,[n,e,t]),d(i,o,"ajaxError",[n,i,t||e]),x(e,n,i)}function x(t,e,n){var i=n.context;n.complete.call(i,e,t),d(n,i,"ajaxComplete",[e,n]),g(n)}function w(t,e,n){if(n.dataFilter==E)return t;var i=n.context;return n.dataFilter.call(i,t,e)}function E(){}function T(t){return t&&(t=t.split(";",2)[0]),t&&(t==c?"html":t==f?"json":s.test(t)?"script":u.test(t)&&"xml")||"text"}function S(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function j(t){t.processData&&t.data&&"string"!=e.type(t.data)&&(t.data=e.param(t.data,t.traditional)),!t.data||t.type&&"GET"!=t.type.toUpperCase()&&"jsonp"!=t.dataType||(t.url=S(t.url,t.data),t.data=void 0)}function C(t,n,i,r){return e.isFunction(n)&&(r=i,i=n,n=void 0),e.isFunction(i)||(r=i,i=void 0),{url:t,data:n,success:i,dataType:r}}function P(t,n,i,r){var o,a=e.isArray(n),s=e.isPlainObject(n);e.each(n,function(n,u){o=e.type(u),r&&(n=i?r:r+"["+(s||"object"==o||"array"==o?n:"")+"]"),!r&&a?t.add(u.name,u.value):"array"==o||!i&&"object"==o?P(t,u,i,n):t.add(n,u)})}var r,o,n=+new Date,i=t.document,a=/)<[^<]*)*<\/script>/gi,s=/^(?:text|application)\/javascript/i,u=/^(?:text|application)\/xml/i,f="application/json",c="text/html",l=/^\s*$/,h=i.createElement("a");h.href=t.location.href,e.active=0,e.ajaxJSONP=function(r,o){if(!("type"in r))return e.ajax(r);var c,p,a=r.jsonpCallback,s=(e.isFunction(a)?a():a)||"Zepto"+n++,u=i.createElement("script"),f=t[s],l=function(t){e(u).triggerHandler("error",t||"abort")},h={abort:l};return o&&o.promise(h),e(u).on("load error",function(n,i){clearTimeout(p),e(u).off().remove(),"error"!=n.type&&c?y(c[0],h,r,o):b(null,i||"error",h,r,o),t[s]=f,c&&e.isFunction(f)&&f(c[0]),f=c=void 0}),v(h,r)===!1?(l("abort"),h):(t[s]=function(){c=arguments},u.src=r.url.replace(/\?(.+)=\?/,"?$1="+s),i.head.appendChild(u),r.timeout>0&&(p=setTimeout(function(){l("timeout")},r.timeout)),h)},e.ajaxSettings={type:"GET",beforeSend:E,success:E,error:E,complete:E,context:null,global:!0,xhr:function(){return new t.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:f,xml:"application/xml, text/xml",html:c,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0,dataFilter:E},e.ajax=function(n){var u,f,a=e.extend({},n||{}),s=e.Deferred&&e.Deferred();for(r in e.ajaxSettings)void 0===a[r]&&(a[r]=e.ajaxSettings[r]);m(a),a.crossDomain||(u=i.createElement("a"),u.href=a.url,u.href=u.href,a.crossDomain=h.protocol+"//"+h.host!=u.protocol+"//"+u.host),a.url||(a.url=t.location.toString()),(f=a.url.indexOf("#"))>-1&&(a.url=a.url.slice(0,f)),j(a);var c=a.dataType,p=/\?.+=\?/.test(a.url);if(p&&(c="jsonp"),a.cache!==!1&&(n&&n.cache===!0||"script"!=c&&"jsonp"!=c)||(a.url=S(a.url,"_="+Date.now())),"jsonp"==c)return p||(a.url=S(a.url,a.jsonp?a.jsonp+"=?":a.jsonp===!1?"":"callback=?")),e.ajaxJSONP(a,s);var N,d=a.accepts[c],g={},x=function(t,e){g[t.toLowerCase()]=[t,e]},C=/^([\w-]+:)\/\//.test(a.url)?RegExp.$1:t.location.protocol,O=a.xhr(),P=O.setRequestHeader;if(s&&s.promise(O),a.crossDomain||x("X-Requested-With","XMLHttpRequest"),x("Accept",d||"*/*"),(d=a.mimeType||d)&&(d.indexOf(",")>-1&&(d=d.split(",",2)[0]),O.overrideMimeType&&O.overrideMimeType(d)),(a.contentType||a.contentType!==!1&&a.data&&"GET"!=a.type.toUpperCase())&&x("Content-Type",a.contentType||"application/x-www-form-urlencoded"),a.headers)for(o in a.headers)x(o,a.headers[o]);if(O.setRequestHeader=x,O.onreadystatechange=function(){if(4==O.readyState){O.onreadystatechange=E,clearTimeout(N);var t,n=!1;if(O.status>=200&&O.status<300||304==O.status||0==O.status&&"file:"==C){if(c=c||T(a.mimeType||O.getResponseHeader("content-type")),"arraybuffer"==O.responseType||"blob"==O.responseType)t=O.response;else{t=O.responseText;try{t=w(t,c,a),"script"==c?(1,eval)(t):"xml"==c?t=O.responseXML:"json"==c&&(t=l.test(t)?null:e.parseJSON(t))}catch(i){n=i}if(n)return b(n,"parsererror",O,a,s)}y(t,O,a,s)}else b(O.statusText||null,O.status?"error":"abort",O,a,s)}},v(O,a)===!1)return O.abort(),b(null,"abort",O,a,s),O;var A="async"in a?a.async:!0;if(O.open(a.type,a.url,A,a.username,a.password),a.xhrFields)for(o in a.xhrFields)O[o]=a.xhrFields[o];for(o in g)P.apply(O,g[o]);return a.timeout>0&&(N=setTimeout(function(){O.onreadystatechange=E,O.abort(),b(null,"timeout",O,a,s)},a.timeout)),O.send(a.data?a.data:null),O},e.get=function(){return e.ajax(C.apply(null,arguments))},e.post=function(){var t=C.apply(null,arguments);return t.type="POST",e.ajax(t)},e.getJSON=function(){var t=C.apply(null,arguments);return t.dataType="json",e.ajax(t)},e.fn.load=function(t,n,i){if(!this.length)return this;var s,r=this,o=t.split(/\s/),u=C(t,n,i),f=u.success;return o.length>1&&(u.url=o[0],s=o[1]),u.success=function(t){r.html(s?e("
").html(t.replace(a,"")).find(s):t),f&&f.apply(r,arguments)},e.ajax(u),this};var O=encodeURIComponent;e.param=function(t,n){var i=[];return i.add=function(t,n){e.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(O(t)+"="+O(n))},P(i,t,n),i.join("&").replace(/%20/g,"+")}}(e),function(t){t.fn.serializeArray=function(){var e,n,i=[],r=function(t){return t.forEach?t.forEach(r):void i.push({name:e,value:t})};return this[0]&&t.each(this[0].elements,function(i,o){n=o.type,e=o.name,e&&"fieldset"!=o.nodeName.toLowerCase()&&!o.disabled&&"submit"!=n&&"reset"!=n&&"button"!=n&&"file"!=n&&("radio"!=n&&"checkbox"!=n||o.checked)&&r(t(o).val())}),i},t.fn.serialize=function(){var t=[];return this.serializeArray().forEach(function(e){t.push(encodeURIComponent(e.name)+"="+encodeURIComponent(e.value))}),t.join("&")},t.fn.submit=function(e){if(0 in arguments)this.bind("submit",e);else if(this.length){var n=t.Event("submit");this.eq(0).trigger(n),n.isDefaultPrevented()||this.get(0).submit()}return this}}(e),function(){try{getComputedStyle(void 0)}catch(e){var n=getComputedStyle;t.getComputedStyle=function(t,e){try{return n(t,e)}catch(i){return null}}}}(),function(t){function e(t,e){var n=this.os={},i=this.browser={},r=t.match(/Web[kK]it[\/]{0,1}([\d.]+)/),o=t.match(/(Android);?[\s\/]+([\d.]+)?/),a=!!t.match(/\(Macintosh\; Intel /),s=t.match(/(iPad).*OS\s([\d_]+)/),u=t.match(/(iPod)(.*OS\s([\d_]+))?/),f=!s&&t.match(/(iPhone\sOS)\s([\d_]+)/),c=t.match(/(webOS|hpwOS)[\s\/]([\d.]+)/),l=/Win\d{2}|Windows/.test(e),h=t.match(/Windows Phone ([\d.]+)/),p=c&&t.match(/TouchPad/),d=t.match(/Kindle\/([\d.]+)/),m=t.match(/Silk\/([\d._]+)/),g=t.match(/(BlackBerry).*Version\/([\d.]+)/),v=t.match(/(BB10).*Version\/([\d.]+)/),y=t.match(/(RIM\sTablet\sOS)\s([\d.]+)/),b=t.match(/PlayBook/),x=t.match(/Chrome\/([\d.]+)/)||t.match(/CriOS\/([\d.]+)/),w=t.match(/Firefox\/([\d.]+)/),E=t.match(/\((?:Mobile|Tablet); rv:([\d.]+)\).*Firefox\/[\d.]+/),T=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/[\d](?=[^\?]+).*rv:([0-9.].)/),S=!x&&t.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/),j=S||t.match(/Version\/([\d.]+)([^S](Safari)|[^M]*(Mobile)[^S]*(Safari))/);(i.webkit=!!r)&&(i.version=r[1]),o&&(n.android=!0,n.version=o[2]),f&&!u&&(n.ios=n.iphone=!0,n.version=f[2].replace(/_/g,".")),s&&(n.ios=n.ipad=!0,n.version=s[2].replace(/_/g,".")),u&&(n.ios=n.ipod=!0,n.version=u[3]?u[3].replace(/_/g,"."):null),h&&(n.wp=!0,n.version=h[1]),c&&(n.webos=!0,n.version=c[2]),p&&(n.touchpad=!0),g&&(n.blackberry=!0,n.version=g[2]),v&&(n.bb10=!0,n.version=v[2]),y&&(n.rimtabletos=!0,n.version=y[2]),b&&(i.playbook=!0),d&&(n.kindle=!0,n.version=d[1]),m&&(i.silk=!0,i.version=m[1]),!m&&n.android&&t.match(/Kindle Fire/)&&(i.silk=!0),x&&(i.chrome=!0,i.version=x[1]),w&&(i.firefox=!0,i.version=w[1]),E&&(n.firefoxos=!0,n.version=E[1]),T&&(i.ie=!0,i.version=T[1]),j&&(a||n.ios||l)&&(i.safari=!0,n.ios||(i.version=j[1])),S&&(i.webview=!0),n.tablet=!!(s||b||o&&!t.match(/Mobile/)||w&&t.match(/Tablet/)||T&&!t.match(/Phone/)&&t.match(/Touch/)),n.phone=!(n.tablet||n.ipod||!(o||f||c||g||v||x&&t.match(/Android/)||x&&t.match(/CriOS\/([\d.]+)/)||w&&t.match(/Mobile/)||T&&t.match(/Touch/)))}e.call(t,navigator.userAgent,navigator.platform),t.__detect=e}(e),function(t,e){function v(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function y(t){return i?i+t:t.toLowerCase()}var i,s,u,f,c,l,h,p,d,m,n="",r={Webkit:"webkit",Moz:"",O:"o"},o=document.createElement("div"),a=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i,g={};o.style.transform===e&&t.each(r,function(t,r){return o.style[t+"TransitionProperty"]!==e?(n="-"+t.toLowerCase()+"-",i=r,!1):void 0}),s=n+"transform",g[u=n+"transition-property"]=g[f=n+"transition-duration"]=g[l=n+"transition-delay"]=g[c=n+"transition-timing-function"]=g[h=n+"animation-name"]=g[p=n+"animation-duration"]=g[m=n+"animation-delay"]=g[d=n+"animation-timing-function"]="",t.fx={off:i===e&&o.style.transitionProperty===e,speeds:{_default:400,fast:200,slow:600},cssPrefix:n,transitionEnd:y("TransitionEnd"),animationEnd:y("AnimationEnd")},t.fn.animate=function(n,i,r,o,a){return t.isFunction(i)&&(o=i,r=e,i=e),t.isFunction(r)&&(o=r,r=e),t.isPlainObject(i)&&(r=i.easing,o=i.complete,a=i.delay,i=i.duration),i&&(i=("number"==typeof i?i:t.fx.speeds[i]||t.fx.speeds._default)/1e3),a&&(a=parseFloat(a)/1e3),this.anim(n,i,r,o,a)},t.fn.anim=function(n,i,r,o,y){var b,w,S,x={},E="",T=this,j=t.fx.transitionEnd,C=!1;if(i===e&&(i=t.fx.speeds._default/1e3),y===e&&(y=0),t.fx.off&&(i=0),"string"==typeof n)x[h]=n,x[p]=i+"s",x[m]=y+"s",x[d]=r||"linear",j=t.fx.animationEnd;else{w=[];for(b in n)a.test(b)?E+=b+"("+n[b]+") ":(x[b]=n[b],w.push(v(b)));E&&(x[s]=E,w.push(s)),i>0&&"object"==typeof n&&(x[u]=w.join(", "),x[f]=i+"s",x[l]=y+"s",x[c]=r||"linear")}return S=function(e){if("undefined"!=typeof e){if(e.target!==e.currentTarget)return;t(e.target).unbind(j,S)}else t(this).unbind(j,S);C=!0,t(this).css(g),o&&o.call(this)},i>0&&(this.bind(j,S),setTimeout(function(){C||S.call(T)},1e3*(i+y)+25)),this.size()&&this.get(0).clientLeft,this.css(x),0>=i&&setTimeout(function(){T.each(function(){S.call(this)})},0),this},o=null}(e),function(e,n){function s(t,i,r,o,a){"function"!=typeof i||a||(a=i,i=n);var s={opacity:r};return o&&(s.scale=o,t.css(e.fx.cssPrefix+"transform-origin","0 0")),t.animate(s,i,null,a)}function u(t,n,i,r){return s(t,n,0,i,function(){o.call(e(this)),r&&r.call(this)})}var r=(t.document,e.fn.show),o=e.fn.hide,a=e.fn.toggle;e.fn.show=function(t,e){return r.call(this),t===n?t=0:this.css("opacity",0),s(this,t,1,"1,1",e)},e.fn.hide=function(t,e){return t===n?o.call(this):u(this,t,"0,0",e)},e.fn.toggle=function(t,i){return t===n||"boolean"==typeof t?a.call(this,t):this.each(function(){var n=e(this);n["none"==n.css("display")?"show":"hide"](t,i)})},e.fn.fadeTo=function(t,e,n){return s(this,t,e,null,n)},e.fn.fadeIn=function(t,e){var n=this.css("opacity");return n>0?this.css("opacity",0):n=1,r.call(this).fadeTo(t,n,e)},e.fn.fadeOut=function(t,e){return u(this,t,null,e)},e.fn.fadeToggle=function(t,n){return this.each(function(){var i=e(this);i[0==i.css("opacity")||"none"==i.css("display")?"fadeIn":"fadeOut"](t,n)})}}(e),function(t){var n,e=[];t.fn.remove=function(){return this.each(function(){this.parentNode&&("IMG"===this.tagName&&(e.push(this),this.src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=",n&&clearTimeout(n),n=setTimeout(function(){e=[]},6e4)),this.parentNode.removeChild(this))})}}(e),function(t){function a(o,a){var u=o[r],f=u&&e[u];if(void 0===a)return f||s(o);if(f){if(a in f)return f[a]; +var c=i(a);if(c in f)return f[c]}return n.call(t(o),a)}function s(n,o,a){var s=n[r]||(n[r]=++t.uuid),f=e[s]||(e[s]=u(n));return void 0!==o&&(f[i(o)]=a),f}function u(e){var n={};return t.each(e.attributes||o,function(e,r){0==r.name.indexOf("data-")&&(n[i(r.name.replace("data-",""))]=t.zepto.deserializeValue(r.value))}),n}var e={},n=t.fn.data,i=t.camelCase,r=t.expando="Zepto"+ +new Date,o=[];t.fn.data=function(e,n){return void 0===n?t.isPlainObject(e)?this.each(function(n,i){t.each(e,function(t,e){s(i,t,e)})}):0 in this?a(this[0],e):void 0:this.each(function(){s(this,e,n)})},t.data=function(e,n,i){return t(e).data(n,i)},t.hasData=function(n){var i=n[r],o=i&&e[i];return o?!t.isEmptyObject(o):!1},t.fn.removeData=function(n){return"string"==typeof n&&(n=n.split(/\s+/)),this.each(function(){var o=this[r],a=o&&e[o];a&&t.each(n||a,function(t){delete a[n?i(this):t]})})},["remove","empty"].forEach(function(e){var n=t.fn[e];t.fn[e]=function(){var t=this.find("*");return"remove"===e&&(t=t.add(this)),t.removeData(),n.call(this)}})}(e),function(t){function n(e){var i=[["resolve","done",t.Callbacks({once:1,memory:1}),"resolved"],["reject","fail",t.Callbacks({once:1,memory:1}),"rejected"],["notify","progress",t.Callbacks({memory:1})]],r="pending",o={state:function(){return r},always:function(){return a.done(arguments).fail(arguments),this},then:function(){var e=arguments;return n(function(n){t.each(i,function(i,r){var s=t.isFunction(e[i])&&e[i];a[r[1]](function(){var e=s&&s.apply(this,arguments);if(e&&t.isFunction(e.promise))e.promise().done(n.resolve).fail(n.reject).progress(n.notify);else{var i=this===o?n.promise():this,a=s?[e]:arguments;n[r[0]+"With"](i,a)}})}),e=null}).promise()},promise:function(e){return null!=e?t.extend(e,o):o}},a={};return t.each(i,function(t,e){var n=e[2],s=e[3];o[e[1]]=n.add,s&&n.add(function(){r=s},i[1^t][2].disable,i[2][2].lock),a[e[0]]=function(){return a[e[0]+"With"](this===a?o:this,arguments),this},a[e[0]+"With"]=n.fireWith}),o.promise(a),e&&e.call(a,a),a}var e=Array.prototype.slice;t.when=function(i){var f,c,l,r=e.call(arguments),o=r.length,a=0,s=1!==o||i&&t.isFunction(i.promise)?o:0,u=1===s?i:n(),h=function(t,n,i){return function(r){n[t]=this,i[t]=arguments.length>1?e.call(arguments):r,i===f?u.notifyWith(n,i):--s||u.resolveWith(n,i)}};if(o>1)for(f=new Array(o),c=new Array(o),l=new Array(o);o>a;++a)r[a]&&t.isFunction(r[a].promise)?r[a].promise().done(h(a,l,r)).fail(u.reject).progress(h(a,c,f)):--s;return s||u.resolveWith(l,r),u.promise()},t.Deferred=n}(e),function(t){t.Callbacks=function(e){e=t.extend({},e);var n,i,r,o,a,s,u=[],f=!e.once&&[],c=function(t){for(n=e.memory&&t,i=!0,s=o||0,o=0,a=u.length,r=!0;u&&a>s;++s)if(u[s].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}r=!1,u&&(f?f.length&&c(f.shift()):n?u.length=0:l.disable())},l={add:function(){if(u){var i=u.length,s=function(n){t.each(n,function(t,n){"function"==typeof n?e.unique&&l.has(n)||u.push(n):n&&n.length&&"string"!=typeof n&&s(n)})};s(arguments),r?a=u.length:n&&(o=i,c(n))}return this},remove:function(){return u&&t.each(arguments,function(e,n){for(var i;(i=t.inArray(n,u,i))>-1;)u.splice(i,1),r&&(a>=i&&--a,s>=i&&--s)}),this},has:function(e){return!(!u||!(e?t.inArray(e,u)>-1:u.length))},empty:function(){return a=u.length=0,this},disable:function(){return u=f=n=void 0,this},disabled:function(){return!u},lock:function(){return f=void 0,n||l.disable(),this},locked:function(){return!f},fireWith:function(t,e){return!u||i&&!f||(e=e||[],e=[t,e.slice?e.slice():e],r?f.push(e):c(e)),this},fire:function(){return l.fireWith(this,arguments)},fired:function(){return!!i}};return l}}(e),function(t){function r(e){return e=t(e),!(!e.width()&&!e.height())&&"none"!==e.css("display")}function f(t,e){t=t.replace(/=#\]/g,'="#"]');var n,i,r=a.exec(t);if(r&&r[2]in o&&(n=o[r[2]],i=r[3],t=r[1],i)){var s=Number(i);i=isNaN(s)?i.replace(/^["']|["']$/g,""):s}return e(t,n,i)}var e=t.zepto,n=e.qsa,i=e.matches,o=t.expr[":"]={visible:function(){return r(this)?this:void 0},hidden:function(){return r(this)?void 0:this},selected:function(){return this.selected?this:void 0},checked:function(){return this.checked?this:void 0},parent:function(){return this.parentNode},first:function(t){return 0===t?this:void 0},last:function(t,e){return t===e.length-1?this:void 0},eq:function(t,e,n){return t===n?this:void 0},contains:function(e,n,i){return t(this).text().indexOf(i)>-1?this:void 0},has:function(t,n,i){return e.qsa(this,i).length?this:void 0}},a=new RegExp("(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*"),s=/^\s*>/,u="Zepto"+ +new Date;e.qsa=function(i,r){return f(r,function(o,a,f){try{var c;!o&&a?o="*":s.test(o)&&(c=t(i).addClass(u),o="."+u+" "+o);var l=n(i,o)}catch(h){throw console.error("error performing selector: %o",r),h}finally{c&&c.removeClass(u)}return a?e.uniq(t.map(l,function(t,e){return a.call(t,e,l,f)})):l})},e.matches=function(t,e){return f(e,function(e,n,r){return(!e||i(t,e))&&(!n||n.call(t,null,r)===t)})}}(e),function(e){function d(t,e,n,i){return Math.abs(t-e)>=Math.abs(n-i)?t-e>0?"Left":"Right":n-i>0?"Up":"Down"}function m(){a=null,n.last&&(n.el.trigger("longTap"),n={})}function g(){a&&clearTimeout(a),a=null}function v(){i&&clearTimeout(i),r&&clearTimeout(r),o&&clearTimeout(o),a&&clearTimeout(a),i=r=o=a=null,n={}}function y(t){return("touch"==t.pointerType||t.pointerType==t.MSPOINTER_TYPE_TOUCH)&&t.isPrimary}function b(t,e){return t.type=="pointer"+e||t.type.toLowerCase()=="mspointer"+e}function x(){p&&(e(document).off(h.down,f).off(h.up,c).off(h.move,l).off(h.cancel,v),e(t).off("scroll",v),v(),p=!1)}function w(w){var E,T,C,O,S=0,j=0;x(),h=w&&"down"in w?w:"ontouchstart"in document?{down:"touchstart",up:"touchend",move:"touchmove",cancel:"touchcancel"}:"onpointerdown"in document?{down:"pointerdown",up:"pointerup",move:"pointermove",cancel:"pointercancel"}:"onmspointerdown"in document?{down:"MSPointerDown",up:"MSPointerUp",move:"MSPointerMove",cancel:"MSPointerCancel"}:!1,h&&("MSGesture"in t&&(u=new MSGesture,u.target=document.body,e(document).bind("MSGestureEnd",function(t){var e=t.velocityX>1?"Right":t.velocityX<-1?"Left":t.velocityY>1?"Down":t.velocityY<-1?"Up":null;e&&(n.el.trigger("swipe"),n.el.trigger("swipe"+e))})),f=function(t){(!(O=b(t,"down"))||y(t))&&(C=O?t:t.touches[0],t.touches&&1===t.touches.length&&n.x2&&(n.x2=void 0,n.y2=void 0),E=Date.now(),T=E-(n.last||E),n.el=e("tagName"in C.target?C.target:C.target.parentNode),i&&clearTimeout(i),n.x1=C.pageX,n.y1=C.pageY,T>0&&250>=T&&(n.isDoubleTap=!0),n.last=E,a=setTimeout(m,s),u&&O&&u.addPointer(t.pointerId))},l=function(t){(!(O=b(t,"move"))||y(t))&&(C=O?t:t.touches[0],g(),n.x2=C.pageX,n.y2=C.pageY,S+=Math.abs(n.x1-n.x2),j+=Math.abs(n.y1-n.y2))},c=function(t){(!(O=b(t,"up"))||y(t))&&(g(),n.x2&&Math.abs(n.x1-n.x2)>30||n.y2&&Math.abs(n.y1-n.y2)>30?o=setTimeout(function(){n.el&&(n.el.trigger("swipe"),n.el.trigger("swipe"+d(n.x1,n.x2,n.y1,n.y2))),n={}},0):"last"in n&&(30>S&&30>j?r=setTimeout(function(){var t=e.Event("tap");t.cancelTouch=v,n.el&&n.el.trigger(t),n.isDoubleTap?(n.el&&n.el.trigger("doubleTap"),n={}):i=setTimeout(function(){i=null,n.el&&n.el.trigger("singleTap"),n={}},250)},0):n={}),S=j=0)},e(document).on(h.up,c).on(h.down,f).on(h.move,l),e(document).on(h.cancel,v),e(t).on("scroll",v),p=!0)}var i,r,o,a,u,f,c,l,h,n={},s=750,p=!1;["swipe","swipeLeft","swipeRight","swipeUp","swipeDown","doubleTap","tap","singleTap","longTap"].forEach(function(t){e.fn[t]=function(e){return this.on(t,e)}}),e.touch={setup:w},e(document).ready(w)}(e),function(t){function i(t){return"tagName"in t?t:t.parentNode}if(t.os.ios){var n,e={};t(document).bind("gesturestart",function(t){var r=Date.now();r-(e.last||r);e.target=i(t.target),n&&clearTimeout(n),e.e1=t.scale,e.last=r}).bind("gesturechange",function(t){e.e2=t.scale}).bind("gestureend",function(n){e.e2>0?(0!=Math.abs(e.e1-e.e2)&&t(e.target).trigger("pinch")&&t(e.target).trigger("pinch"+(e.e1-e.e2>0?"In":"Out")),e.e1=e.e2=e.last=0):"last"in e&&(e={})}),["pinch","pinchIn","pinchOut"].forEach(function(e){t.fn[e]=function(t){return this.bind(e,t)}})}}(e),function(t){t.fn.end=function(){return this.prevObject||t()},t.fn.andSelf=function(){return this.add(this.prevObject||t())},"filter,add,not,eq,first,last,find,closest,parents,parent,children,siblings".split(",").forEach(function(e){var n=t.fn[e];t.fn[e]=function(){var t=n.apply(this,arguments);return t.prevObject=this,t}})}(e),function(t){String.prototype.trim===t&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),Array.prototype.reduce===t&&(Array.prototype.reduce=function(e){if(void 0===this||null===this)throw new TypeError;var o,n=Object(this),i=n.length>>>0,r=0;if("function"!=typeof e)throw new TypeError;if(0==i&&1==arguments.length)throw new TypeError;if(arguments.length>=2)o=arguments[1];else for(;;){if(r in n){o=n[r++];break}if(++r>=i)throw new TypeError}for(;i>r;)r in n&&(o=e.call(t,o,n[r],r,n)),r++;return o})}(),e}); \ No newline at end of file diff --git a/keyboard.html b/keyboard.html new file mode 100644 index 0000000..f497725 --- /dev/null +++ b/keyboard.html @@ -0,0 +1,77 @@ + + + + + + + + + + + miniMobile + + + + + + + + + + + + + + + + + +
+
+ +
+
+ 调用软键盘 +
+
+ +
+
+
+ + 点击弹出软键盘 +
+ + + + \ No newline at end of file diff --git a/layer.html b/layer.html new file mode 100644 index 0000000..0fe24ba --- /dev/null +++ b/layer.html @@ -0,0 +1,145 @@ + + + + + + + + + + + miniMobile + + + + + + + + + + + + + + + +
+
+ +
+
+ Layer For Mobile +
+
+ +
+
+

+
+ 信息框 + 提示 + 询问层 + 底部对话框 + 底部提示 + 自定义标题风格 + 页面层 + loadding层 + 加载层 + 底部弹出完整对话框 +
+ + + + \ No newline at end of file diff --git a/list-button.html b/list-button.html new file mode 100644 index 0000000..055cb87 --- /dev/null +++ b/list-button.html @@ -0,0 +1,301 @@ + + + + + + + + + + + miniMobile + + + + + + + + + + + + + +
+
+ +
+
+ 好友列表 +
+
+ +
+
+ +
+
    +
  • +
    +
    + +
    +
    +
    +

    12:01

    +

    小糖豆

    +
    +

    你起床了吗?大懒虫!

    +
    +
    +
    +
    + +
    +
    + +
    +
    +
  • +
  • +
    +
    + +
    +
    +
    +

    昨天

    +

    Angelina

    +
    +

    我家断电了![笑哭]

    +
    +
    +
    +
    + +
    +
    + +
    +
    +
  • +
  • +
    +
    + +
    +
    +
    +

    昨天

    +

    麦当娜

    +
    +

    起床!!请我吃麦当劳!

    +
    +
    +
    +
    + +
    +
    + +
    +
    +
  • +
  • +
    +
    + +
    +
    +
    +

    星期五

    +

    风一样的男人

    +
    +

    周末出去爬山吗,最近打算锻炼身体!我打算自驾去密云一趟,外挂你啊!

    +
    +
    +
    +
    + +
    +
    + +
    +
    +
  • +
  • +
    +
    + +
    +
    +
    +

    昨天

    +

    隔壁大叔

    +
    +

    小伙子你很有音乐天赋,但请不要在半夜在窗户上拉小提琴!

    +
    +
    +
    +
    + +
    +
    + +
    +
    +
  • +
  • +
    +
    + +
    +
    +
    +

    昨天

    +

    阿妹

    +
    +

    我有一只漂亮的发卡!

    +
    +
    +
    +
    + +
    +
    + +
    +
    +
  • +
+
+
+ 没有更多内容 +
+ + + + + + + + \ No newline at end of file diff --git a/list.html b/list.html new file mode 100644 index 0000000..c745548 --- /dev/null +++ b/list.html @@ -0,0 +1,124 @@ + + + + + + + + + + + miniMobile + + + + + + + + + + + + + +
+
+ +
+
+ 常见列表 +
+
+ +
+
+
+
+ +

这是一张图片

+

¥146.00 ¥367.00

+

简短的说明一下这个图片的来历,可是空间不够,省略了呢!

+
+
+ +

这是一张图片

+

¥146.00 ¥367.00

+

简短的说明一下这个图片的来历,可是空间不够,省略了呢!

+
+
+ +

这是一张图片

+

¥146.00 ¥367.00

+

简短的说明一下这个图片的来历,可是空间不够,省略了呢!

+
+
+ +

这是一张图片

+

¥146.00 ¥367.00

+

简短的说明一下这个图片的来历,可是空间不够,省略了呢!

+
+
+ +

这是一张图片

+

¥146.00 ¥367.00

+

简短的说明一下这个图片的来历,可是空间不够,省略了呢!

+
+
+ +

这是一张图片

+

¥146.00 ¥367.00

+

简短的说明一下这个图片的来历,可是空间不够,省略了呢!

+
+
+
+ 没有更多内容 +
+ + + + + + \ No newline at end of file diff --git a/listPic.html b/listPic.html new file mode 100644 index 0000000..6ac8bf1 --- /dev/null +++ b/listPic.html @@ -0,0 +1,120 @@ + + + + + + + + + + + miniMobile + + + + + + + + + + + + + + + + + + +
+
+ +
+
+ 滑动相册 +
+
+ +
+
+

PhotoSwipe


+ + + + + + + + + + \ No newline at end of file diff --git a/my.html b/my.html new file mode 100644 index 0000000..cf7f594 --- /dev/null +++ b/my.html @@ -0,0 +1,179 @@ + + + + + + + + + + + miniMobile + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/plugins/fonticon/demo.css b/plugins/fonticon/demo.css new file mode 100644 index 0000000..3d9cbe7 --- /dev/null +++ b/plugins/fonticon/demo.css @@ -0,0 +1,370 @@ +*{margin: 0;padding: 0;list-style: none;} +/* +KISSY CSS Reset +理念:1. reset 的目的不是清除浏览器的默认样式,这仅是部分工作。清除和重置是紧密不可分的。 +2. reset 的目的不是让默认样式在所有浏览器下一致,而是减少默认样式有可能带来的问题。 +3. reset 期望提供一套普适通用的基础样式。但没有银弹,推荐根据具体需求,裁剪和修改后再使用。 +特色:1. 适应中文;2. 基于最新主流浏览器。 +维护:玉伯, 正淳 + */ + +/** 清除内外边距 **/ +body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, /* structural elements 结构元素 */ +dl, dt, dd, ul, ol, li, /* list elements 列表元素 */ +pre, /* text formatting elements 文本格式元素 */ +form, fieldset, legend, button, input, textarea, /* form elements 表单元素 */ +th, td /* table elements 表格元素 */ { + margin: 0; + padding: 0; +} + +/** 设置默认字体 **/ +body, +button, input, select, textarea /* for ie */ { + font: 12px/1.5 tahoma, arial, \5b8b\4f53, sans-serif; +} +h1, h2, h3, h4, h5, h6 { font-size: 100%; } +address, cite, dfn, em, var { font-style: normal; } /* 将斜体扶正 */ +code, kbd, pre, samp { font-family: courier new, courier, monospace; } /* 统一等宽字体 */ +small { font-size: 12px; } /* 小于 12px 的中文很难阅读,让 small 正常化 */ + +/** 重置列表元素 **/ +ul, ol { list-style: none; } + +/** 重置文本格式元素 **/ +a { text-decoration: none; } +a:hover { text-decoration: underline; } + + +/** 重置表单元素 **/ +legend { color: #000; } /* for ie6 */ +fieldset, img { border: 0; } /* img 搭车:让链接里的 img 无边框 */ +button, input, select, textarea { font-size: 100%; } /* 使得表单元素在 ie 下能继承字体大小 */ +/* 注:optgroup 无法扶正 */ + +/** 重置表格元素 **/ +table { border-collapse: collapse; border-spacing: 0; } + +/* 清除浮动 */ +.ks-clear:after, .clear:after { + content: '\20'; + display: block; + height: 0; + clear: both; +} +.ks-clear, .clear { + *zoom: 1; +} + +.main { + padding: 30px 100px; +width: 960px; +margin: 0 auto; +} +.main h1{font-size:36px; color:#333; text-align:left;margin-bottom:30px; border-bottom: 1px solid #eee;} + +.helps{margin-top:40px;} +.helps pre{ + padding:20px; + margin:10px 0; + border:solid 1px #e7e1cd; + background-color: #fffdef; + overflow: auto; +} + +.icon_lists{ + width: 100% !important; + +} + +.icon_lists li{ + float:left; + width: 100px; + height:180px; + text-align: center; + list-style: none !important; +} +.icon_lists .icon{ + font-size: 42px; + line-height: 100px; + margin: 10px 0; + color:#333; + -webkit-transition: font-size 0.25s ease-out 0s; + -moz-transition: font-size 0.25s ease-out 0s; + transition: font-size 0.25s ease-out 0s; + +} +.icon_lists .icon:hover{ + font-size: 100px; +} + + + +.markdown { + color: #666; + font-size: 14px; + line-height: 1.8; +} + +.highlight { + line-height: 1.5; +} + +.markdown img { + vertical-align: middle; + max-width: 100%; +} + +.markdown h1 { + color: #404040; + font-weight: 500; + line-height: 40px; + margin-bottom: 24px; +} + +.markdown h2, +.markdown h3, +.markdown h4, +.markdown h5, +.markdown h6 { + color: #404040; + margin: 1.6em 0 0.6em 0; + font-weight: 500; + clear: both; +} + +.markdown h1 { + font-size: 28px; +} + +.markdown h2 { + font-size: 22px; +} + +.markdown h3 { + font-size: 16px; +} + +.markdown h4 { + font-size: 14px; +} + +.markdown h5 { + font-size: 12px; +} + +.markdown h6 { + font-size: 12px; +} + +.markdown hr { + height: 1px; + border: 0; + background: #e9e9e9; + margin: 16px 0; + clear: both; +} + +.markdown p, +.markdown pre { + margin: 1em 0; +} + +.markdown > p, +.markdown > blockquote, +.markdown > .highlight, +.markdown > ol, +.markdown > ul { + width: 80%; +} + +.markdown ul > li { + list-style: circle; +} + +.markdown > ul li, +.markdown blockquote ul > li { + margin-left: 20px; + padding-left: 4px; +} + +.markdown > ul li p, +.markdown > ol li p { + margin: 0.6em 0; +} + +.markdown ol > li { + list-style: decimal; +} + +.markdown > ol li, +.markdown blockquote ol > li { + margin-left: 20px; + padding-left: 4px; +} + +.markdown code { + margin: 0 3px; + padding: 0 5px; + background: #eee; + border-radius: 3px; +} + +.markdown pre { + border-radius: 6px; + background: #f7f7f7; + padding: 20px; +} + +.markdown pre code { + border: none; + background: #f7f7f7; + margin: 0; +} + +.markdown strong, +.markdown b { + font-weight: 600; +} + +.markdown > table { + border-collapse: collapse; + border-spacing: 0px; + empty-cells: show; + border: 1px solid #e9e9e9; + width: 95%; + margin-bottom: 24px; +} + +.markdown > table th { + white-space: nowrap; + color: #333; + font-weight: 600; + +} + +.markdown > table th, +.markdown > table td { + border: 1px solid #e9e9e9; + padding: 8px 16px; + text-align: left; +} + +.markdown > table th { + background: #F7F7F7; +} + +.markdown blockquote { + font-size: 90%; + color: #999; + border-left: 4px solid #e9e9e9; + padding-left: 0.8em; + margin: 1em 0; + font-style: italic; +} + +.markdown blockquote p { + margin: 0; +} + +.markdown .anchor { + opacity: 0; + transition: opacity 0.3s ease; + margin-left: 8px; +} + +.markdown .waiting { + color: #ccc; +} + +.markdown h1:hover .anchor, +.markdown h2:hover .anchor, +.markdown h3:hover .anchor, +.markdown h4:hover .anchor, +.markdown h5:hover .anchor, +.markdown h6:hover .anchor { + opacity: 1; + display: inline-block; +} + +.markdown > br, +.markdown > p > br { + clear: both; +} + + +.hljs { + display: block; + background: white; + padding: 0.5em; + color: #333333; + overflow-x: auto; +} + +.hljs-comment, +.hljs-meta { + color: #969896; +} + +.hljs-string, +.hljs-variable, +.hljs-template-variable, +.hljs-strong, +.hljs-emphasis, +.hljs-quote { + color: #df5000; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-type { + color: #a71d5d; +} + +.hljs-literal, +.hljs-symbol, +.hljs-bullet, +.hljs-attribute { + color: #0086b3; +} + +.hljs-section, +.hljs-name { + color: #63a35c; +} + +.hljs-tag { + color: #333333; +} + +.hljs-title, +.hljs-attr, +.hljs-selector-id, +.hljs-selector-class, +.hljs-selector-attr, +.hljs-selector-pseudo { + color: #795da3; +} + +.hljs-addition { + color: #55a532; + background-color: #eaffea; +} + +.hljs-deletion { + color: #bd2c00; + background-color: #ffecec; +} + +.hljs-link { + text-decoration: underline; +} + +pre{ + background: #fff; +} + + + + + diff --git a/plugins/fonticon/demo_fontclass.html b/plugins/fonticon/demo_fontclass.html new file mode 100644 index 0000000..98becc9 --- /dev/null +++ b/plugins/fonticon/demo_fontclass.html @@ -0,0 +1,268 @@ + + + + + + IconFont + + + + +
+

IconFont 图标

+
    + +
  • + +
    appreciate
    +
    .icon-appreciate
    +
  • + +
  • + +
    check
    +
    .icon-check
    +
  • + +
  • + +
    close
    +
    .icon-close
    +
  • + +
  • + +
    phone
    +
    .icon-phone
    +
  • + +
  • + +
    search
    +
    .icon-search
    +
  • + +
  • + +
    unfold
    +
    .icon-unfold
    +
  • + +
  • + +
    comment
    +
    .icon-comment
    +
  • + +
  • + +
    list
    +
    .icon-list
    +
  • + +
  • + +
    top
    +
    .icon-top
    +
  • + +
  • + +
    refresh
    +
    .icon-refresh
    +
  • + +
  • + +
    delete_fill
    +
    .icon-deletefill
    +
  • + +
  • + +
    delete
    +
    .icon-delete
    +
  • + +
  • + +
    cart_fill
    +
    .icon-cartfill
    +
  • + +
  • + +
    fold
    +
    .icon-fold
    +
  • + +
  • + +
    info
    +
    .icon-info
    +
  • + +
  • + +
    rank_fill
    +
    .icon-rankfill
    +
  • + +
  • + +
    rank
    +
    .icon-rank
    +
  • + +
  • + +
    service_fill
    +
    .icon-servicefill
    +
  • + +
  • + +
    全屏
    +
    .icon-icwindowzoom48px
    +
  • + +
  • + +
    Dialog
    +
    .icon-dialog
    +
  • + +
  • + +
    表格
    +
    .icon-tables-copy
    +
  • + +
  • + +
    表格
    +
    .icon-biaoge
    +
  • + +
  • + +
    表单
    +
    .icon-iconfontliebiao1copy
    +
  • + +
  • + +
    键盘
    +
    .icon-jianpan
    +
  • + +
  • + +
    图片
    +
    .icon-tupian
    +
  • + +
  • + +
    sort_light
    +
    .icon-sortlight
    +
  • + +
  • + +
    font
    +
    .icon-font
    +
  • + +
  • + +
    返回顶部
    +
    .icon-fanhuidingbu
    +
  • + +
  • + +
    home_light
    +
    .icon-home_light
    +
  • + +
  • + +
    瀑布流
    +
    .icon-pubuliu
    +
  • + +
  • + +
    轮播
    +
    .icon-ic_view_carousel_px
    +
  • + +
  • + +
    3d动画bai
    +
    .icon-ddonghuabai
    +
  • + +
  • + +
    符号-折叠面板
    +
    .icon-zhediemianban
    +
  • + +
  • + +
    tab
    +
    .icon-tab
    +
  • + +
  • + +
    菜单
    +
    .icon-menu
    +
  • + +
  • + +
    右箭头
    +
    .icon-arrow-right
    +
  • + +
  • + +
    按钮
    +
    .icon-anniu
    +
  • + +
  • + +
    进度条
    +
    .icon-jindutiao
    +
  • + +
+ +

font-class引用

+
+ +

font-class是unicode使用方式的一种变种,主要是解决unicode书写不直观,语意不明确的问题。

+

与unicode使用方式相比,具有如下特点:

+
    +
  • 兼容性良好,支持ie8+,及所有现代浏览器。
  • +
  • 相比于unicode语意明确,书写更直观。可以很容易分辨这个icon是什么。
  • +
  • 因为使用class来定义图标,所以当要替换图标时,只需要修改class里面的unicode引用。
  • +
  • 不过因为本质上还是使用的字体,所以多色图标还是不支持的。
  • +
+

使用步骤如下:

+

第一步:引入项目下面生成的fontclass代码:

+ + +
<link rel="stylesheet" type="text/css" href="./iconfont.css">
+

第二步:挑选相应图标并获取类名,应用于页面:

+
<i class="iconfont icon-xxx"></i>
+
+

"iconfont"是你项目下的font-family。可以通过编辑项目查看,默认是"iconfont"。

+
+
+ + diff --git a/plugins/fonticon/iconfont.css b/plugins/fonticon/iconfont.css new file mode 100644 index 0000000..559e778 --- /dev/null +++ b/plugins/fonticon/iconfont.css @@ -0,0 +1,92 @@ + +@font-face {font-family: "iconfont"; + src: url('iconfont.eot?t=1512547219580'); /* IE9*/ + src: url('iconfont.eot?t=1512547219580#iefix') format('embedded-opentype'), /* IE6-IE8 */ + url('data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAABo8AAsAAAAAK/AAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAARAAAAFZXAkr6Y21hcAAAAYAAAAGeAAAEZEUAxAhnbHlmAAADIAAAE6MAACCIv2MJT2hlYWQAABbEAAAALwAAADYQOs0PaGhlYQAAFvQAAAAeAAAAJAhfBChobXR4AAAXFAAAABoAAACgoG0AAGxvY2EAABcwAAAAUgAAAFKg8JcUbWF4cAAAF4QAAAAfAAAAIAE/AMduYW1lAAAXpAAAAUUAAAJtPlT+fXBvc3QAABjsAAABTQAAAcuUdXUzeJxjYGRgYOBikGPQYWB0cfMJYeBgYGGAAJAMY05meiJQDMoDyrGAaQ4gZoOIAgCKIwNPAHicY2BkYWacwMDKwMHUyXSGgYGhH0IzvmYwYuRgYGBiYGVmwAoC0lxTGBwYKl6yMjf8b2CIYW5gmAIUZgTJAQDVgQuUeJzF0ztPmzEYxfG/cwEKoS0lvXEJvKEUIbEjAVNFo6oDqphZmJjZIqaKD4IYEBsbCxIfg5mpHItPAcd5okrtwFCG2vpFeS9ObD/HQBOo25o1oPaT5G+kI99Ng/t1xgf3G2nH11ss+r05+qqrpbYWVGlVm+ppV3va14GOdaJTnelcl7rStW51l7t5PR/mi3xz33x48K/0hcY9ujMYvaHtJ0dXf43+15Y8+y2+0HP/Nujf2Xmy//jdy+j3LPPOa3/LBz6xxAKfaTNDxQo171PDuznCKGO88J51maDFJC/5yCteM8Ubpplnlo73kDTyjJU8s6X/99d/tlb5SL+GVyvWH/IURfC+oxRcAVQLrgWqB1fFiQquD5oIrhRqBdcMtYOrhzrBdURDriiqAuXd1eAqo41Aeb4Zypy1HSjz+hrKmVIvlHOl3VDOm/aCs4L2g1ODDoLzg46Dk4ROQjmHOg1OFzoLlLWeh7KjugzOHroKTiG6Ds4jug1OJroLzii5Ck4ruRucW/J6cILJh8FZJl8Ep5p8E5xv7puBxUdDOMBsAAB4nK05C5QcVZV136tPV3VVdVdVd1d/pqc/Nd01k5nuyXRPdyeZZD75QMhnQMlHAmIIQs4qILhoXIzYIIirICgLq3w0m6C7a5QDHvYjEhjQhXVXYA9oANddI3I4C5EjS44Le0wXe19V92QGE9k9Z2eq37vvvftevfvu/xUncNzbv6QP0SRncYPcGLeWO4vjQByGok6yUHDHq2QY4gUhbsd06jpuQXKKVboK7KIYS9Sa42VblMQI6NAP9UKt6VaJC43xSTIBtUQWIJVJn22W+kx6CyhJt/96bwPZD/Gc0xeZrHhnjEzFankrtEc1zZRp3hgSBSFECB/R4VI7IQuyInr3CJF0/KHcEMmBmnLTm87R8hnzgs+NX5Yt2TJAuw1WJq//5ZSRNvDZm05YZkqKaqFkWnMGYrDnpXDSUrPlX3H4R5HWX9A5OsAVuBluFul0JsGtglsWJR0iwEokT4wbsUS90DQbVaAFoz4JrUnamgS7H+wEUpuwE3a9lrBFAgFurdkwxsv0Q4eUiCiMudmGYdmyJsmZTer7I4YRIc75H4DGDZ3O5tjOohrVDZXEI1pWFB1KgA9HXhMsELd2liFuv2HAkeKFy6rTEVmOxta59WRksEyMiDcdMZJw3tBI01sLn+LHG1ZrckUYD4v0D5y5h4YMKQKmvtp7E+4NkI0IzEUMDnzCP0M+wNlILxKK1CLrbCGRg0RtCpotaI7TTyhp2dv6ipK2FADKU1EVecrDozLZJoPirXhZjqWUDgVKKCEUfqGk2LLB2jPkYS7DcTKuUy5KMvjLy8DEoyUDkxGXVECRrbTiven9t5KKKSB5byrYBhlkfKcMn4aQjLX3FtZWSvHe8t5SUtgf8n7L5nV59xDybhXybiN3BceV4hLj3CRp1Wt2oumWR6Hsjjdb9YBLOriJZstnr6NDHDvjjG/9gCNlt8y4zmTWXjrWqtlFbCJ/E4zV/oAUQ2SGWIUG9iGeDnCF0TydgOlU0vxgsXpuWgnRHDmtyVfWhDVtx47b3Wh7y2xYEQt2nwOKKIo8sYwxZ2apzfOipWUd4mSo8JVzz1aVcFI9ffbACzz/wgEs+7OSaKdCBUfoPPxwRxA6qwHgtGZqtByDZPSqoqRQp9LcQKE5kv7ONR+dXiss/aMrbokm+8hARo+JgC/io+eeXukHmVAhBKTUKAI87gjJlMz3B+/AsrW7qqZ0QW38ybT/FnyXz8O3D9Ef0BluhOMEdxIawQEgyTU8vipIooM9wSHEUPpjOZqoTQJ98KvVmnD0vvuP8vzR+3e8V5XDSW3dptsf5/nHb7/tCb4+KiuUfBO5DeqBZTdsCPDuOyqURNyVkOefuC3AXfepmpJSCH+/YqbnZeo6MsWZTF7nBQq5U/NF9SrE9v7ee8CX1QsICi6cr5CGLHt/A2coKKbefiLLsAtFlEfajtB9KDoNbpI7nVk2oYhiMt6s5aDVRBPlK65TCNSYmawYWj4k10B6C0iwwQyCJNIq4BwctH8PIJym7GQyesYZinZEN02902blTr8YagI0h0g7qJ/dphyKZTKDmcy3F1V5eSfTgg0bZFMnHJvosbLPZHO5YK7H6u0y7AM2YzAD76jZsYW69Oa5MGq7w41yU9yZ3Ae4j+BJFopINlpo3LK0AKan6AfGdCb6TJ3iOtCimAX/iJqrAI/MeJdx2vb8w4C8T867w5035gJCg+oVNjDnFyfvJm08H3z2BdXb3KIm7Jyf4ldTvcV0s8OdcoidIcEznKNtlJk0V2ZWrSy5RbSazJxNQdfY28yqWQuPcYV3RNGopApehxm2p3APv0aeZjvT/mbZG2ArFNC6CgwFbeBTnR/7Q43XcAJ8LNh3oI9H6A/pOLfKt9cRJo5lXvKNFfrYWrOF/1X0VfjPo7vF1gDzTG5ZB2bTJ8CeBLTrZXpQTfKpxJqRL3sPfKQ2lNyydnl79a77ploW1dMJGh0933v5kytOjzlLzof03uFJ8zItKSvqflEEXonyK/gwafNhbd3YlsLFo19Y87Vv3lRbMrT1PWe8T0sImr5h1ccGtw3vuen65Vjnt9aGeSVli1MEIKz8hWb7ujeH9nqai+M51lD/0Nsy21JAlYo7LHpg8cJ4WSqMMfVDCgooTqiOEBOLZdRLVK+4tQCm+/ZBc9B7BHm2j50cZUf7xc6cZiEngbHS9L4cHONcUJF90wGfp4N2GyUuH/QASp7n8wZ8TfX2nYA5YX7vKpdCLVrObUV/M78RIyY6Cxsnp6sUyAbGUFBgFqWL7Y/25upAdvqKbj4VVPDGSWjsfBl3NqOZXhv2eYwihqkDypSVQRPRPhkNDCb5xeT75E538l3y2WH4E37hw4WhZi9GmkN/MI3WxEDaOTSDjJyiKPQACy0m858+sSwSyoHVZZ/VLAOFgWap1ByA4wgM4PPtlNu5yRbqpTKLSspKlGbr4pgDLztjYp3IGYYzkAkqsj57ebECVsoCXb3Lu7G0FGAoD2dbpXnfcA1p485QMzGQkRaGGXSP93XmD7z9zA3AetiEGgg2nE9kxfu6H09s9P4WbTVbhvH4UfoInfJtZRKjiip2zns6tGiBE/QjAgnjRKbmxbK1kPGEO3RcEI4fCsr9z/P88/uDcmnXKo8GbJ2cRzp0nLbmsfY//63AAXhrF1pExgOkk9mgCJdjPABn3kP5Hkt4R/ud45D3fRArwDwZSHain/JlgOBr5xbKDrCheavFiQv2YqFPcbkWN4FS0dUA5jPZUbh1w4H/bd+J3V02PY0h/ClbwfaCrU7Dkc6RheI9DXlvX9e2+jueRsHoyu8+2ofxwwS3m+ntKATRHQsH/fivVSyvYoFhN9SJRSDOeIuOawp89ucQD92ZKDAPJzqu6PZWQO/GJB8jSkwD4n6g6Ct0FcgFaTOlRWlMm/l8TEomZTH7mZd0c1hW6YGrrjpANQslQbOUf/jSzT9UR2TV9N6IF5SEvd3SMnlxMNO6KAXw0YtiF11Oc+t2XU0snVypp2DPEUKIlYmCZOa1kJpU64WCqV8WpdEwLopLG7J+JTuB66OKdstDPP+9myJ8VLleN29Rok6CByD8klaeYjKVSAzu/mNKr9y95uBKJbKhocdiemMDspfZ6n+i28jHkdsa2us+1ISW27Jbceq23HrcFcYkV2rUJcuWbKdhkw9v/+zEDdv/feKz21/d7j2O4KvbN/qNxvYbWA1fWtDXRcD3yPieS+gj5DXUuAr3Pu4cbhd3IXcJdyn3cZTx4jBmkSxuXxx/uQsiNLuYaLGRWlMYi7OTZ7F+sxEI/TA06t2QrejH9yxEYYyeV96WE8RsDOr1kW+Ett3Z90Bcc2mhAlApkLhfC2qo80tZVWWQIsnvjYMQUr1PYUuoP5jUpZCqhu6/tzgCMFIkg2r8gexbfUMSjVUgVUqnS6lnRlLlFD4/wQ4fgKh6X0Lhffz+4EXeo4XKRljD3tH5NzkMwJuHdHXLblnVHjYRU5VJUVaX44zOiziDVxL3hSGfUsLjv7XYkilrUYXnq+H5vkkfpbKvqzZmZTlfY5eiB1uN8e9GjAZZJCgu8ENldFoNPLkscRqu06iXsCnU4073eMabzu8BNg43DCwKjXqc3n78J2YyadIRVh7zXnrjjSXHjkHfG9B37Jj3GnYOJJOXLKrMHx07dowsP0ZDSbOzlk0jD5nJv7rnHu/mAweWsOepe+556gD8hiEvfq5GpIsOHDgQyNIL9F+p27WRvUj309zNzF7q0AtHW6ibpQVtpsCsLWFO2AtXmf1k4zZLABG/sKDN8Fmb4QftE/i99QvOwvD3BP78+pnDmmlqh3UDwIDp51gDC4TXBX06G++c/f+HRV0EvsPGvhN0ngz2nvyDw13Ye8bU7mVdpygCX9qmP6NttL4S+tM+lktCIT7/H0RAC3IqpulGcGPUMnAMIvCi19/7kbFOe2YbIdtmSHtmO8D2mU673wVw+0mvPuts9uf9CyDO09MMd7ozNrMN6LfBzXbG+t3BLHk66wLuhvmvOfLoIjm5lPsk9znuLm4/x1lj9bFJ5JHbcNCeI8/fpS38H/FLDUf3RaPXy6KmbouOFfwYqsAaVgNDyLgxxkIp5nfG2J1SwTEKxj8vV1RVWY6W4osBhMWfLZe1APJ+9weH4YNPK7quPK1omjIPqZ2vhjUtTHaHdX3r8SPxPuiL0TzmIen1nXVjNAuvg25pgH+apZFTwF8CLXai/+RwFUs8Buy4BfQA8H6qx7Wg+8eYvcY7z8YwiyWpGKnE0p1vkpHOT5Blks+3R2g/arqClmwYZeocbgfKVXDtiEZs7F3FqmCxm51WENL1+wA+zI45vquRxMBR+A1njF2clPAh6zuXjq0GWD1Gbg3qzqWJfoD+BLk1qDuXDgu8pvJwznnpSjxTz0VMRT3tPOaHWyO64laWrOmzSjEYnVSooZBculQaL5XSHoHVNWJ113ytthrIIbbaa3Z/v00sXLvzGPC2ZtwtQ1gKKQIpFGsXUhPD/GX1gbWyqMoiuqALi4rKBf4Uz+jPye3dfH8AvWoV47Nl3MypM/4AZkfGMpeeG7RPAtFrPI55J+KXp4A7rWEIbPOS3wPIVtVS8XlVNVV8juIP3RoWR9Hol5LJ5wN/8EJQ+XEI0vOn5AnMwhU/EuEgA9Sh9Vbdrk9hjutINgOhdO65yuef3jn2eu0Toca4cNZMH3whuw5qMOD9HG7rXH7XXV+58cYn790OO3o5/UtoA+72bROejK+nvtIJ78ghXHrr8Z9Z6bRFy+hWvav0Ad27TssM6HAenKcPZDRyN/PowIrfaJp3HeuD93sHGE7vXf+JPjiDu9/o3x8UJf92vAXNmg2JVqLVLEvMBSckP2/0XRGGKswXB4lw4DUmWY0x5omonv6dd7W90vaulohiSHCtmgvDtbKoSALZoqjQ9yRMVPiRCfLjiIGHDkOFF5UwOGk+U8RY4lf5sgqHoW6a3pOCqVEBGqEQggCyFN0QVrx/zML1I8sBVgxfDxEdlilh1pkfDCt3JB0neYcSHszDspDWvWdq01+jvX+n7+X8LaMuFfxwull3uvkytpmm1tm4EYyztKBOWYbcHW+w8ULgmf1sknnuwmKVZtGLNH9ZwNqL8ekdhg1oDLznTNs2X2SF91zQRcf/wJD3HLIAqg4MYboAo51nved8oAhD/gD8x7th0O1J47tGslt4k2x9eMxIehfjeyZZHzxm2t7rJ7DIs7jcd4NVu5U36YyOOvCYU/V2j7JW8MrHnFHv9UXI3RzxIDnc9blcqWAUKGZXBaNuwDB8y9t2+OBBcvDgVtLuHIafesPw0558tnmBXs39Nfcg8gslsEpZJu1//GAmURJj7KKcTgCDWNI/xS6ZxtFSjvp3sTkMf4Ib9CqMT5JWs4XBjv9VIUd8Ya23mIGOQGO8hTLfj9lVsLpYDCYh7H9Lsf3LrEnaKrvshTGdBCPshquFvrJcCgy2vwiiI3t3ObMV0c4Uo8PnD5fTkbhYmXXWu9Wqu955744P1pftEEUaUkO0TQhQChTaoqGJO6YvOPfs0/K1aFTX87X8ilkJdkhRTWxTwhuU0LakGdIubfYbm6moaWk1E82uykYzGh+RZInXisZIxR6NldOarSkAodkJXMRfSREpjYq4AUjaI51DkqWxuZM4V01rG79G0mpcrsyettyqVHCHuPV4JF12L3aDpXAPEgWgbBtU4XsbOUfDyZmomsn35dk6mzdrO0QtKiFNfJtte4f23k2yXD5zqEtVPh+t5XGjNCI5yy22l+5x4Mw0WyaXzfWISbk+LYVZZ222N3Vis0o4rmd/51C0TK6I/rbpy4eDnAxuP/1rT7fVVcmeClLmU5j9KjQKjcDLxKkoqIIeWss+5lQq7Oql2eEyAwADGdqtjUhnOmJQrsMZETIXMcjneUFeqyRjysiIEksqDyJOpx3gEqw7F6gWANq16ek5zbLm7RDP0St8O8QynWG0Ru/D6G4+A+hF7JKDSV+j7N9DSPGE2MLNxrs/tvGS02AZJAvjexBLjAJoYbpEA2PVu9PIAiMXmg+yYJgVfXdqmLvx2p0qqy6HX3q5hT8yGTX0b2nmjaZ2UDNgbzBJo4+x0tSO72U1FuQV/KlgaN/XWBzOqhd4FRf1i9HcnbmDOfhY7kd7dcPQ9y4oj8/669maefwVH7rSHzO17t3e2/Qa8lY3XuBYAHXiSwCDg7hgETzNuBDwADlynQ/vzZRKmQX9ZA8MtAbw8R5nl37ACm9uHuzd3ZF9ZBfLFqBlS24Lbi0ePVp8nEw5r77qPNG9h7iZb6NfCXNl9CrovC3kThx/yCOn921hfnP+BQy7AS/RIMTzr4tdWmU882HLLaMtqeUgoRNmvHT/agf9T3Ezfdl7Etq/a0P6SXqJahiq94NoIhGFVZWVACsrWpRgcHOMwKYVyzcRkkafT9DppxlkHi6DO/ThJe/RIF3SztIH0qAdVvhwQovR+tvcZrjDu3hz55lM7PsY2aYH00DOXPn9lWeBmMgmQ8fg6olZQmYnvJ/HMpkYDLBow7sWYW/uN0s+MjI0uCVSyoC2ResbiLwezqQj3Vh4Ddk7/11nArP59YsjmYUxnu339+7XT/DYXojv+MdYZzyWyO88JTc4mIP/6h8cXOpVI/F4BJ6JxGJ0Uf8h7InAmnf2P8C6/YJ8EgZXDQIrPhTLxfBZj/DQ0KrBD0OsPx7vx/bQyiFgBeuJgV9w3P8AtJyWmQB4nGNgZGBgAOKX5XuvxvPbfGXgZmEAgWu+RyYj6P85LA3MDUAuBwMTSBQAYxwMEwB4nGNgZGBgbvjfwBDD0sDA8P8/kASKoAANAIgDBY8AAHicY2FgYGB+ycDAwjCAmAWLWAOEBgDEQwINAAAAAAAAAHYA8AEeAVQCAAJIAm4C5gOIA8gELASKBQgFVgV8BcoGEAZoBwIHNgfmCFwJIglwCkwK3gtGC3ILqAwaDNwM+A4GDl4O9g80D0YP0hBEAAB4nGNgZGBg0GDYzcDLAAJMQMwFhAwM/8F8BgAf8AIHAHicZY9NTsMwEIVf+gekEqqoYIfkBWIBKP0Rq25YVGr3XXTfpk6bKokjx63UA3AejsAJOALcgDvwSCebNpbH37x5Y08A3OAHHo7fLfeRPVwyO3INF7gXrlN/EG6QX4SbaONVuEX9TdjHM6bCbXRheYPXuGL2hHdhDx18CNdwjU/hOvUv4Qb5W7iJO/wKt9Dx6sI+5l5XuI1HL/bHVi+cXqnlQcWhySKTOb+CmV7vkoWt0uqca1vEJlODoF9JU51pW91T7NdD5yIVWZOqCas6SYzKrdnq0AUb5/JRrxeJHoQm5Vhj/rbGAo5xBYUlDowxQhhkiMro6DtVZvSvsUPCXntWPc3ndFsU1P9zhQEC9M9cU7qy0nk6T4E9XxtSdXQrbsuelDSRXs1JErJCXta2VELqATZlV44RelzRiT8oZ0j/AAlabsgAAAB4nG1Qy3LbMAzUxnrYUtKmTfp+v9NDDp3poX/joShYREIRHIqM3Xx9KedanBZY7M4CxUnxUG3x/7rCCVYoUaFGgzU2aNHhFGd4hMc4xxM8xQUu8QzP8QIv8Qqv8QZv8Q7v8QEf8Qmf8QVf8Q3f8QNX+Fng0CrvA2lWkSptSN9W2spMlTfiqJ5JBW3q5HZih0bLNJGLpeU5rqL4JtAu0GzagSxF2rG19QNcaxXi0peLsOSsXwflbo+jBXQzhTvWR8056z27Qfb3ItPvP/5QD6ysjF1UvaX5Wov/W/esZKRL1pK9XLRMy+TXwjU3rJxXro7JZ7SZJWR+NLFcNk93ypnEA7uxT62RibZHsvGpT5bTBevtHdN+myNLmslu/aEbBnGjSapXfHZvaGCasnOv3CpnKvMTUqdCkP11WKwq5RynzU0+IsWcqij+AR/vgk8AAAA=') format('woff'), + url('iconfont.ttf?t=1512547219580') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ + url('iconfont.svg?t=1512547219580#iconfont') format('svg'); /* iOS 4.1- */ +} + +.iconfont { + font-family:"iconfont" !important; + font-style:normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-appreciate:before { content: "\e644"; } + +.icon-check:before { content: "\e645"; } + +.icon-close:before { content: "\e646"; } + +.icon-phone:before { content: "\e652"; } + +.icon-search:before { content: "\e65c"; } + +.icon-unfold:before { content: "\e661"; } + +.icon-comment:before { content: "\e667"; } + +.icon-list:before { content: "\e682"; } + +.icon-top:before { content: "\e69e"; } + +.icon-refresh:before { content: "\e6a4"; } + +.icon-deletefill:before { content: "\e6a6"; } + +.icon-delete:before { content: "\e6b4"; } + +.icon-cartfill:before { content: "\e6b9"; } + +.icon-fold:before { content: "\e6de"; } + +.icon-info:before { content: "\e6e5"; } + +.icon-rankfill:before { content: "\e721"; } + +.icon-rank:before { content: "\e722"; } + +.icon-servicefill:before { content: "\e737"; } + +.icon-icwindowzoom48px:before { content: "\e621"; } + +.icon-dialog:before { content: "\e60a"; } + +.icon-tables-copy:before { content: "\e602"; } + +.icon-biaoge:before { content: "\e600"; } + +.icon-iconfontliebiao1copy:before { content: "\e60b"; } + +.icon-jianpan:before { content: "\e6bc"; } + +.icon-tupian:before { content: "\e629"; } + +.icon-sortlight:before { content: "\e7ad"; } + +.icon-font:before { content: "\e603"; } + +.icon-fanhuidingbu:before { content: "\e771"; } + +.icon-home_light:before { content: "\e7d4"; } + +.icon-pubuliu:before { content: "\e61e"; } + +.icon-ic_view_carousel_px:before { content: "\e905"; } + +.icon-ddonghuabai:before { content: "\e63a"; } + +.icon-zhediemianban:before { content: "\e6a0"; } + +.icon-tab:before { content: "\e614"; } + +.icon-menu:before { content: "\e60c"; } + +.icon-arrow-right:before { content: "\e601"; } + +.icon-anniu:before { content: "\e61f"; } + +.icon-jindutiao:before { content: "\e63b"; } + diff --git a/plugins/fonticon/iconfont.eot b/plugins/fonticon/iconfont.eot new file mode 100644 index 0000000..16b4144 Binary files /dev/null and b/plugins/fonticon/iconfont.eot differ diff --git a/plugins/fonticon/iconfont.svg b/plugins/fonticon/iconfont.svg new file mode 100644 index 0000000..eafebcf --- /dev/null +++ b/plugins/fonticon/iconfont.svg @@ -0,0 +1,147 @@ + + + + + +Created by iconfont + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/fonticon/iconfont.ttf b/plugins/fonticon/iconfont.ttf new file mode 100644 index 0000000..79a5603 Binary files /dev/null and b/plugins/fonticon/iconfont.ttf differ diff --git a/plugins/fonticon/iconfont.woff b/plugins/fonticon/iconfont.woff new file mode 100644 index 0000000..66d204d Binary files /dev/null and b/plugins/fonticon/iconfont.woff differ diff --git a/plugins/icheck/icheck.js b/plugins/icheck/icheck.js new file mode 100644 index 0000000..7bf2768 --- /dev/null +++ b/plugins/icheck/icheck.js @@ -0,0 +1,509 @@ +/*! + * iCheck v1.0.2, http://git.io/arlzeA + * =================================== + * Powerful jQuery and Zepto plugin for checkboxes and radio buttons customization + * + * (c) 2013 Damir Sultanov, http://fronteed.com + * MIT Licensed + */ + +(function($) { + + // Cached vars + var _iCheck = 'iCheck', + _iCheckHelper = _iCheck + '-helper', + _checkbox = 'checkbox', + _radio = 'radio', + _checked = 'checked', + _unchecked = 'un' + _checked, + _disabled = 'disabled', + _determinate = 'determinate', + _indeterminate = 'in' + _determinate, + _update = 'update', + _type = 'type', + _click = 'click', + _touch = 'touchbegin.i touchend.i', + _add = 'addClass', + _remove = 'removeClass', + _callback = 'trigger', + _label = 'label', + _cursor = 'cursor', + _mobile = /ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent); + + // Plugin init + $.fn[_iCheck] = function(options, fire) { + + // Walker + var handle = 'input[type="' + _checkbox + '"], input[type="' + _radio + '"]', + stack = $(), + walker = function(object) { + object.each(function() { + var self = $(this); + + if (self.is(handle)) { + stack = stack.add(self); + } else { + stack = stack.add(self.find(handle)); + } + }); + }; + + // Check if we should operate with some method + if (/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(options)) { + + // Normalize method's name + options = options.toLowerCase(); + + // Find checkboxes and radio buttons + walker(this); + + return stack.each(function() { + var self = $(this); + + if (options == 'destroy') { + tidy(self, 'ifDestroyed'); + } else { + operate(self, true, options); + } + + // Fire method's callback + if ($.isFunction(fire)) { + fire(); + } + }); + + // Customization + } else if (typeof options == 'object' || !options) { + + // Check if any options were passed + var settings = $.extend({ + checkedClass: _checked, + disabledClass: _disabled, + indeterminateClass: _indeterminate, + labelHover: true + }, options), + + selector = settings.handle, + hoverClass = settings.hoverClass || 'hover', + focusClass = settings.focusClass || 'focus', + activeClass = settings.activeClass || 'active', + labelHover = !!settings.labelHover, + labelHoverClass = settings.labelHoverClass || 'hover', + + // Setup clickable area + area = ('' + settings.increaseArea).replace('%', '') | 0; + + // Selector limit + if (selector == _checkbox || selector == _radio) { + handle = 'input[type="' + selector + '"]'; + } + + // Clickable area limit + if (area < -50) { + area = -50; + } + + // Walk around the selector + walker(this); + + return stack.each(function() { + var self = $(this); + + // If already customized + tidy(self); + + var node = this, + id = node.id, + + // Layer styles + offset = -area + '%', + size = 100 + (area * 2) + '%', + layer = { + position: 'absolute', + top: offset, + left: offset, + display: 'block', + width: size, + height: size, + margin: 0, + padding: 0, + background: '#fff', + border: 0, + opacity: 0 + }, + + // Choose how to hide input + hide = _mobile ? { + position: 'absolute', + visibility: 'hidden' + } : area ? layer : { + position: 'absolute', + opacity: 0 + }, + + // Get proper class + className = node[_type] == _checkbox ? settings.checkboxClass || 'i' + _checkbox : settings.radioClass || 'i' + _radio, + + // Find assigned labels + label = $(_label + '[for="' + id + '"]').add(self.closest(_label)), + + // Check ARIA option + aria = !!settings.aria, + + // Set ARIA placeholder + ariaID = _iCheck + '-' + Math.random().toString(36).substr(2,6), + + // Parent & helper + parent = '
')[_callback]('ifCreated').parent().append(settings.insert); + + // Layer addition + helper = $('').css(layer).appendTo(parent); + + // Finalize customization + self.data(_iCheck, {o: settings, s: self.attr('style')}).css(hide); + !!settings.inheritClass && parent[_add](node.className || ''); + !!settings.inheritID && id && parent.attr('id', _iCheck + '-' + id); + parent.css('position') == 'static' && parent.css('position', 'relative'); + operate(self, true, _update); + + // Label events + if (label.length) { + label.on(_click + '.i mouseover.i mouseout.i ' + _touch, function(event) { + var type = event[_type], + item = $(this); + + // Do nothing if input is disabled + if (!node[_disabled]) { + + // Click + if (type == _click) { + if ($(event.target).is('a')) { + return; + } + operate(self, false, true); + + // Hover state + } else if (labelHover) { + + // mouseout|touchend + if (/ut|nd/.test(type)) { + parent[_remove](hoverClass); + item[_remove](labelHoverClass); + } else { + parent[_add](hoverClass); + item[_add](labelHoverClass); + } + } + + if (_mobile) { + event.stopPropagation(); + } else { + return false; + } + } + }); + } + + // Input events + self.on(_click + '.i focus.i blur.i keyup.i keydown.i keypress.i', function(event) { + var type = event[_type], + key = event.keyCode; + + // Click + if (type == _click) { + return false; + + // Keydown + } else if (type == 'keydown' && key == 32) { + if (!(node[_type] == _radio && node[_checked])) { + if (node[_checked]) { + off(self, _checked); + } else { + on(self, _checked); + } + } + + return false; + + // Keyup + } else if (type == 'keyup' && node[_type] == _radio) { + !node[_checked] && on(self, _checked); + + // Focus/blur + } else if (/us|ur/.test(type)) { + parent[type == 'blur' ? _remove : _add](focusClass); + } + }); + + // Helper events + helper.on(_click + ' mousedown mouseup mouseover mouseout ' + _touch, function(event) { + var type = event[_type], + + // mousedown|mouseup + toggle = /wn|up/.test(type) ? activeClass : hoverClass; + + // Do nothing if input is disabled + if (!node[_disabled]) { + + // Click + if (type == _click) { + operate(self, false, true); + + // Active and hover states + } else { + + // State is on + if (/wn|er|in/.test(type)) { + + // mousedown|mouseover|touchbegin + parent[_add](toggle); + + // State is off + } else { + parent[_remove](toggle + ' ' + activeClass); + } + + // Label hover + if (label.length && labelHover && toggle == hoverClass) { + + // mouseout|touchend + label[/ut|nd/.test(type) ? _remove : _add](labelHoverClass); + } + } + + if (_mobile) { + event.stopPropagation(); + } else { + return false; + } + } + }); + }); + } else { + return this; + } + }; + + // Do something with inputs + function operate(input, direct, method) { + var node = input[0], + state = /er/.test(method) ? _indeterminate : /bl/.test(method) ? _disabled : _checked, + active = method == _update ? { + checked: node[_checked], + disabled: node[_disabled], + indeterminate: input.attr(_indeterminate) == 'true' || input.attr(_determinate) == 'false' + } : node[state]; + + // Check, disable or indeterminate + if (/^(ch|di|in)/.test(method) && !active) { + on(input, state); + + // Uncheck, enable or determinate + } else if (/^(un|en|de)/.test(method) && active) { + off(input, state); + + // Update + } else if (method == _update) { + + // Handle states + for (var each in active) { + if (active[each]) { + on(input, each, true); + } else { + off(input, each, true); + } + } + + } else if (!direct || method == 'toggle') { + + // Helper or label was clicked + if (!direct) { + input[_callback]('ifClicked'); + } + + // Toggle checked state + if (active) { + if (node[_type] !== _radio) { + off(input, state); + } + } else { + on(input, state); + } + } + } + + // Add checked, disabled or indeterminate state + function on(input, state, keep) { + var node = input[0], + parent = input.parent(), + checked = state == _checked, + indeterminate = state == _indeterminate, + disabled = state == _disabled, + callback = indeterminate ? _determinate : checked ? _unchecked : 'enabled', + regular = option(input, callback + capitalize(node[_type])), + specific = option(input, state + capitalize(node[_type])); + + // Prevent unnecessary actions + if (node[state] !== true) { + + // Toggle assigned radio buttons + if (!keep && state == _checked && node[_type] == _radio && node.name) { + var form = input.closest('form'), + inputs = 'input[name="' + node.name + '"]'; + + inputs = form.length ? form.find(inputs) : $(inputs); + + inputs.each(function() { + if (this !== node && $(this).data(_iCheck)) { + off($(this), state); + } + }); + } + + // Indeterminate state + if (indeterminate) { + + // Add indeterminate state + node[state] = true; + + // Remove checked state + if (node[_checked]) { + off(input, _checked, 'force'); + } + + // Checked or disabled state + } else { + + // Add checked or disabled state + if (!keep) { + node[state] = true; + } + + // Remove indeterminate state + if (checked && node[_indeterminate]) { + off(input, _indeterminate, false); + } + } + + // Trigger callbacks + callbacks(input, checked, state, keep); + } + + // Add proper cursor + if (node[_disabled] && !!option(input, _cursor, true)) { + parent.find('.' + _iCheckHelper).css(_cursor, 'default'); + } + + // Add state class + parent[_add](specific || option(input, state) || ''); + + // Set ARIA attribute + if (!!parent.attr('role') && !indeterminate) { + parent.attr('aria-' + (disabled ? _disabled : _checked), 'true'); + } + + // Remove regular state class + parent[_remove](regular || option(input, callback) || ''); + } + + // Remove checked, disabled or indeterminate state + function off(input, state, keep) { + var node = input[0], + parent = input.parent(), + checked = state == _checked, + indeterminate = state == _indeterminate, + disabled = state == _disabled, + callback = indeterminate ? _determinate : checked ? _unchecked : 'enabled', + regular = option(input, callback + capitalize(node[_type])), + specific = option(input, state + capitalize(node[_type])); + + // Prevent unnecessary actions + if (node[state] !== false) { + + // Toggle state + if (indeterminate || !keep || keep == 'force') { + node[state] = false; + } + + // Trigger callbacks + callbacks(input, checked, callback, keep); + } + + // Add proper cursor + if (!node[_disabled] && !!option(input, _cursor, true)) { + parent.find('.' + _iCheckHelper).css(_cursor, 'pointer'); + } + + // Remove state class + parent[_remove](specific || option(input, state) || ''); + + // Set ARIA attribute + if (!!parent.attr('role') && !indeterminate) { + parent.attr('aria-' + (disabled ? _disabled : _checked), 'false'); + } + + // Add regular state class + parent[_add](regular || option(input, callback) || ''); + } + + // Remove all traces + function tidy(input, callback) { + if (input.data(_iCheck)) { + + // Remove everything except input + input.parent().html(input.attr('style', input.data(_iCheck).s || '')); + + // Callback + if (callback) { + input[_callback](callback); + } + + // Unbind events + input.off('.i').unwrap(); + $(_label + '[for="' + input[0].id + '"]').add(input.closest(_label)).off('.i'); + } + } + + // Get some option + function option(input, state, regular) { + if (input.data(_iCheck)) { + return input.data(_iCheck).o[state + (regular ? '' : 'Class')]; + } + } + + // Capitalize some string + function capitalize(string) { + return string.charAt(0).toUpperCase() + string.slice(1); + } + + // Executable handlers + function callbacks(input, checked, callback, keep) { + if (!keep) { + if (checked) { + input[_callback]('ifToggled'); + } + + input[_callback]('ifChanged')[_callback]('if' + capitalize(callback)); + } + } +})(window.jQuery || window.Zepto); diff --git a/plugins/iscroll-probe.js b/plugins/iscroll-probe.js new file mode 100644 index 0000000..68e9e43 --- /dev/null +++ b/plugins/iscroll-probe.js @@ -0,0 +1,2197 @@ +/*! iScroll v5.2.0-snapshot ~ (c) 2008-2017 Matteo Spinelli ~ http://cubiq.org/license */ +(function (window, document, Math) { +var rAF = window.requestAnimationFrame || + window.webkitRequestAnimationFrame || + window.mozRequestAnimationFrame || + window.oRequestAnimationFrame || + window.msRequestAnimationFrame || + function (callback) { window.setTimeout(callback, 1000 / 60); }; + +var utils = (function () { + var me = {}; + + var _elementStyle = document.createElement('div').style; + var _vendor = (function () { + var vendors = ['t', 'webkitT', 'MozT', 'msT', 'OT'], + transform, + i = 0, + l = vendors.length; + + for ( ; i < l; i++ ) { + transform = vendors[i] + 'ransform'; + if ( transform in _elementStyle ) return vendors[i].substr(0, vendors[i].length-1); + } + + return false; + })(); + + function _prefixStyle (style) { + if ( _vendor === false ) return false; + if ( _vendor === '' ) return style; + return _vendor + style.charAt(0).toUpperCase() + style.substr(1); + } + + me.getTime = Date.now || function getTime () { return new Date().getTime(); }; + + me.extend = function (target, obj) { + for ( var i in obj ) { + target[i] = obj[i]; + } + }; + + me.addEvent = function (el, type, fn, capture) { + el.addEventListener(type, fn, !!capture); + }; + + me.removeEvent = function (el, type, fn, capture) { + el.removeEventListener(type, fn, !!capture); + }; + + me.prefixPointerEvent = function (pointerEvent) { + return window.MSPointerEvent ? + 'MSPointer' + pointerEvent.charAt(7).toUpperCase() + pointerEvent.substr(8): + pointerEvent; + }; + + me.momentum = function (current, start, time, lowerMargin, wrapperSize, deceleration) { + var distance = current - start, + speed = Math.abs(distance) / time, + destination, + duration; + + deceleration = deceleration === undefined ? 0.0006 : deceleration; + + destination = current + ( speed * speed ) / ( 2 * deceleration ) * ( distance < 0 ? -1 : 1 ); + duration = speed / deceleration; + + if ( destination < lowerMargin ) { + destination = wrapperSize ? lowerMargin - ( wrapperSize / 2.5 * ( speed / 8 ) ) : lowerMargin; + distance = Math.abs(destination - current); + duration = distance / speed; + } else if ( destination > 0 ) { + destination = wrapperSize ? wrapperSize / 2.5 * ( speed / 8 ) : 0; + distance = Math.abs(current) + destination; + duration = distance / speed; + } + + return { + destination: Math.round(destination), + duration: duration + }; + }; + + var _transform = _prefixStyle('transform'); + + me.extend(me, { + hasTransform: _transform !== false, + hasPerspective: _prefixStyle('perspective') in _elementStyle, + hasTouch: 'ontouchstart' in window, + hasPointer: !!(window.PointerEvent || window.MSPointerEvent), // IE10 is prefixed + hasTransition: _prefixStyle('transition') in _elementStyle + }); + + /* + This should find all Android browsers lower than build 535.19 (both stock browser and webview) + - galaxy S2 is ok + - 2.3.6 : `AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1` + - 4.0.4 : `AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30` + - galaxy S3 is badAndroid (stock brower, webview) + `AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30` + - galaxy S4 is badAndroid (stock brower, webview) + `AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30` + - galaxy S5 is OK + `AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Mobile Safari/537.36 (Chrome/)` + - galaxy S6 is OK + `AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Mobile Safari/537.36 (Chrome/)` + */ + me.isBadAndroid = (function() { + var appVersion = window.navigator.appVersion; + // Android browser is not a chrome browser. + if (/Android/.test(appVersion) && !(/Chrome\/\d/.test(appVersion))) { + var safariVersion = appVersion.match(/Safari\/(\d+.\d)/); + if(safariVersion && typeof safariVersion === "object" && safariVersion.length >= 2) { + return parseFloat(safariVersion[1]) < 535.19; + } else { + return true; + } + } else { + return false; + } + })(); + + me.extend(me.style = {}, { + transform: _transform, + transitionTimingFunction: _prefixStyle('transitionTimingFunction'), + transitionDuration: _prefixStyle('transitionDuration'), + transitionDelay: _prefixStyle('transitionDelay'), + transformOrigin: _prefixStyle('transformOrigin'), + touchAction: _prefixStyle('touchAction') + }); + + me.hasClass = function (e, c) { + var re = new RegExp("(^|\\s)" + c + "(\\s|$)"); + return re.test(e.className); + }; + + me.addClass = function (e, c) { + if ( me.hasClass(e, c) ) { + return; + } + + var newclass = e.className.split(' '); + newclass.push(c); + e.className = newclass.join(' '); + }; + + me.removeClass = function (e, c) { + if ( !me.hasClass(e, c) ) { + return; + } + + var re = new RegExp("(^|\\s)" + c + "(\\s|$)", 'g'); + e.className = e.className.replace(re, ' '); + }; + + me.offset = function (el) { + var left = -el.offsetLeft, + top = -el.offsetTop; + + // jshint -W084 + while (el = el.offsetParent) { + left -= el.offsetLeft; + top -= el.offsetTop; + } + // jshint +W084 + + return { + left: left, + top: top + }; + }; + + me.preventDefaultException = function (el, exceptions) { + for ( var i in exceptions ) { + if ( exceptions[i].test(el[i]) ) { + return true; + } + } + + return false; + }; + + me.extend(me.eventType = {}, { + touchstart: 1, + touchmove: 1, + touchend: 1, + + mousedown: 2, + mousemove: 2, + mouseup: 2, + + pointerdown: 3, + pointermove: 3, + pointerup: 3, + + MSPointerDown: 3, + MSPointerMove: 3, + MSPointerUp: 3 + }); + + me.extend(me.ease = {}, { + quadratic: { + style: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)', + fn: function (k) { + return k * ( 2 - k ); + } + }, + circular: { + style: 'cubic-bezier(0.1, 0.57, 0.1, 1)', // Not properly "circular" but this looks better, it should be (0.075, 0.82, 0.165, 1) + fn: function (k) { + return Math.sqrt( 1 - ( --k * k ) ); + } + }, + back: { + style: 'cubic-bezier(0.175, 0.885, 0.32, 1.275)', + fn: function (k) { + var b = 4; + return ( k = k - 1 ) * k * ( ( b + 1 ) * k + b ) + 1; + } + }, + bounce: { + style: '', + fn: function (k) { + if ( ( k /= 1 ) < ( 1 / 2.75 ) ) { + return 7.5625 * k * k; + } else if ( k < ( 2 / 2.75 ) ) { + return 7.5625 * ( k -= ( 1.5 / 2.75 ) ) * k + 0.75; + } else if ( k < ( 2.5 / 2.75 ) ) { + return 7.5625 * ( k -= ( 2.25 / 2.75 ) ) * k + 0.9375; + } else { + return 7.5625 * ( k -= ( 2.625 / 2.75 ) ) * k + 0.984375; + } + } + }, + elastic: { + style: '', + fn: function (k) { + var f = 0.22, + e = 0.4; + + if ( k === 0 ) { return 0; } + if ( k == 1 ) { return 1; } + + return ( e * Math.pow( 2, - 10 * k ) * Math.sin( ( k - f / 4 ) * ( 2 * Math.PI ) / f ) + 1 ); + } + } + }); + + me.tap = function (e, eventName) { + var ev = document.createEvent('Event'); + ev.initEvent(eventName, true, true); + ev.pageX = e.pageX; + ev.pageY = e.pageY; + e.target.dispatchEvent(ev); + }; + + me.click = function (e) { + var target = e.target, + ev; + + if ( !(/(SELECT|INPUT|TEXTAREA)/i).test(target.tagName) ) { + // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent + // initMouseEvent is deprecated. + ev = document.createEvent(window.MouseEvent ? 'MouseEvents' : 'Event'); + ev.initEvent('click', true, true); + ev.view = e.view || window; + ev.detail = 1; + ev.screenX = target.screenX || 0; + ev.screenY = target.screenY || 0; + ev.clientX = target.clientX || 0; + ev.clientY = target.clientY || 0; + ev.ctrlKey = !!e.ctrlKey; + ev.altKey = !!e.altKey; + ev.shiftKey = !!e.shiftKey; + ev.metaKey = !!e.metaKey; + ev.button = 0; + ev.relatedTarget = null; + ev._constructed = true; + target.dispatchEvent(ev); + } + }; + + me.getTouchAction = function(eventPassthrough, addPinch) { + var touchAction = 'none'; + if ( eventPassthrough === 'vertical' ) { + touchAction = 'pan-y'; + } else if (eventPassthrough === 'horizontal' ) { + touchAction = 'pan-x'; + } + if (addPinch && touchAction != 'none') { + // add pinch-zoom support if the browser supports it, but if not (eg. Chrome <55) do nothing + touchAction += ' pinch-zoom'; + } + return touchAction; + }; + + me.getRect = function(el) { + if (el instanceof SVGElement) { + var rect = el.getBoundingClientRect(); + return { + top : rect.top, + left : rect.left, + width : rect.width, + height : rect.height + }; + } else { + return { + top : el.offsetTop, + left : el.offsetLeft, + width : el.offsetWidth, + height : el.offsetHeight + }; + } + }; + + return me; +})(); +function IScroll (el, options) { + this.wrapper = typeof el == 'string' ? document.querySelector(el) : el; + this.scroller = this.wrapper.children[0]; + this.scrollerStyle = this.scroller.style; // cache style for better performance + + this.options = { + + resizeScrollbars: true, + + mouseWheelSpeed: 20, + + snapThreshold: 0.334, + +// INSERT POINT: OPTIONS + disablePointer : !utils.hasPointer, + disableTouch : utils.hasPointer || !utils.hasTouch, + disableMouse : utils.hasPointer || utils.hasTouch, + startX: 0, + startY: 0, + scrollY: true, + directionLockThreshold: 5, + momentum: true, + + bounce: true, + bounceTime: 600, + bounceEasing: '', + + preventDefault: true, + preventDefaultException: { tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/ }, + + HWCompositing: true, + useTransition: true, + useTransform: true, + bindToWrapper: typeof window.onmousedown === "undefined" + }; + + for ( var i in options ) { + this.options[i] = options[i]; + } + + // Normalize options + this.translateZ = this.options.HWCompositing && utils.hasPerspective ? ' translateZ(0)' : ''; + + this.options.useTransition = utils.hasTransition && this.options.useTransition; + this.options.useTransform = utils.hasTransform && this.options.useTransform; + + this.options.eventPassthrough = this.options.eventPassthrough === true ? 'vertical' : this.options.eventPassthrough; + this.options.preventDefault = !this.options.eventPassthrough && this.options.preventDefault; + + // If you want eventPassthrough I have to lock one of the axes + this.options.scrollY = this.options.eventPassthrough == 'vertical' ? false : this.options.scrollY; + this.options.scrollX = this.options.eventPassthrough == 'horizontal' ? false : this.options.scrollX; + + // With eventPassthrough we also need lockDirection mechanism + this.options.freeScroll = this.options.freeScroll && !this.options.eventPassthrough; + this.options.directionLockThreshold = this.options.eventPassthrough ? 0 : this.options.directionLockThreshold; + + this.options.bounceEasing = typeof this.options.bounceEasing == 'string' ? utils.ease[this.options.bounceEasing] || utils.ease.circular : this.options.bounceEasing; + + this.options.resizePolling = this.options.resizePolling === undefined ? 60 : this.options.resizePolling; + + if ( this.options.tap === true ) { + this.options.tap = 'tap'; + } + + // https://github.com/cubiq/iscroll/issues/1029 + if (!this.options.useTransition && !this.options.useTransform) { + if(!(/relative|absolute/i).test(this.scrollerStyle.position)) { + this.scrollerStyle.position = "relative"; + } + } + + if ( this.options.shrinkScrollbars == 'scale' ) { + this.options.useTransition = false; + } + + this.options.invertWheelDirection = this.options.invertWheelDirection ? -1 : 1; + + if ( this.options.probeType == 3 ) { + this.options.useTransition = false; } + +// INSERT POINT: NORMALIZATION + + // Some defaults + this.x = 0; + this.y = 0; + this.directionX = 0; + this.directionY = 0; + this._events = {}; + +// INSERT POINT: DEFAULTS + + this._init(); + this.refresh(); + + this.scrollTo(this.options.startX, this.options.startY); + this.enable(); +} + +IScroll.prototype = { + version: '5.2.0-snapshot', + + _init: function () { + this._initEvents(); + + if ( this.options.scrollbars || this.options.indicators ) { + this._initIndicators(); + } + + if ( this.options.mouseWheel ) { + this._initWheel(); + } + + if ( this.options.snap ) { + this._initSnap(); + } + + if ( this.options.keyBindings ) { + this._initKeys(); + } + +// INSERT POINT: _init + + }, + + destroy: function () { + this._initEvents(true); + clearTimeout(this.resizeTimeout); + this.resizeTimeout = null; + this._execEvent('destroy'); + }, + + _transitionEnd: function (e) { + if ( e.target != this.scroller || !this.isInTransition ) { + return; + } + + this._transitionTime(); + if ( !this.resetPosition(this.options.bounceTime) ) { + this.isInTransition = false; + this._execEvent('scrollEnd'); + } + }, + + _start: function (e) { + // React to left mouse button only + if ( utils.eventType[e.type] != 1 ) { + // for button property + // http://unixpapa.com/js/mouse.html + var button; + if (!e.which) { + /* IE case */ + button = (e.button < 2) ? 0 : + ((e.button == 4) ? 1 : 2); + } else { + /* All others */ + button = e.button; + } + if ( button !== 0 ) { + return; + } + } + + if ( !this.enabled || (this.initiated && utils.eventType[e.type] !== this.initiated) ) { + return; + } + + if ( this.options.preventDefault && !utils.isBadAndroid && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) { + e.preventDefault(); + } + + var point = e.touches ? e.touches[0] : e, + pos; + + this.initiated = utils.eventType[e.type]; + this.moved = false; + this.distX = 0; + this.distY = 0; + this.directionX = 0; + this.directionY = 0; + this.directionLocked = 0; + + this.startTime = utils.getTime(); + + if ( this.options.useTransition && this.isInTransition ) { + this._transitionTime(); + this.isInTransition = false; + pos = this.getComputedPosition(); + this._translate(Math.round(pos.x), Math.round(pos.y)); + this._execEvent('scrollEnd'); + } else if ( !this.options.useTransition && this.isAnimating ) { + this.isAnimating = false; + this._execEvent('scrollEnd'); + } + + this.startX = this.x; + this.startY = this.y; + this.absStartX = this.x; + this.absStartY = this.y; + this.pointX = point.pageX; + this.pointY = point.pageY; + + this._execEvent('beforeScrollStart'); + }, + + _move: function (e) { + if ( !this.enabled || utils.eventType[e.type] !== this.initiated ) { + return; + } + + if ( this.options.preventDefault ) { // increases performance on Android? TODO: check! + e.preventDefault(); + } + + var point = e.touches ? e.touches[0] : e, + deltaX = point.pageX - this.pointX, + deltaY = point.pageY - this.pointY, + timestamp = utils.getTime(), + newX, newY, + absDistX, absDistY; + + this.pointX = point.pageX; + this.pointY = point.pageY; + + this.distX += deltaX; + this.distY += deltaY; + absDistX = Math.abs(this.distX); + absDistY = Math.abs(this.distY); + + // We need to move at least 10 pixels for the scrolling to initiate + if ( timestamp - this.endTime > 300 && (absDistX < 10 && absDistY < 10) ) { + return; + } + + // If you are scrolling in one direction lock the other + if ( !this.directionLocked && !this.options.freeScroll ) { + if ( absDistX > absDistY + this.options.directionLockThreshold ) { + this.directionLocked = 'h'; // lock horizontally + } else if ( absDistY >= absDistX + this.options.directionLockThreshold ) { + this.directionLocked = 'v'; // lock vertically + } else { + this.directionLocked = 'n'; // no lock + } + } + + if ( this.directionLocked == 'h' ) { + if ( this.options.eventPassthrough == 'vertical' ) { + e.preventDefault(); + } else if ( this.options.eventPassthrough == 'horizontal' ) { + this.initiated = false; + return; + } + + deltaY = 0; + } else if ( this.directionLocked == 'v' ) { + if ( this.options.eventPassthrough == 'horizontal' ) { + e.preventDefault(); + } else if ( this.options.eventPassthrough == 'vertical' ) { + this.initiated = false; + return; + } + + deltaX = 0; + } + + deltaX = this.hasHorizontalScroll ? deltaX : 0; + deltaY = this.hasVerticalScroll ? deltaY : 0; + + newX = this.x + deltaX; + newY = this.y + deltaY; + + // Slow down if outside of the boundaries + if ( newX > 0 || newX < this.maxScrollX ) { + newX = this.options.bounce ? this.x + deltaX / 3 : newX > 0 ? 0 : this.maxScrollX; + } + if ( newY > 0 || newY < this.maxScrollY ) { + newY = this.options.bounce ? this.y + deltaY / 3 : newY > 0 ? 0 : this.maxScrollY; + } + + this.directionX = deltaX > 0 ? -1 : deltaX < 0 ? 1 : 0; + this.directionY = deltaY > 0 ? -1 : deltaY < 0 ? 1 : 0; + + if ( !this.moved ) { + this._execEvent('scrollStart'); + } + + this.moved = true; + + this._translate(newX, newY); + +/* REPLACE START: _move */ + if ( timestamp - this.startTime > 300 ) { + this.startTime = timestamp; + this.startX = this.x; + this.startY = this.y; + + if ( this.options.probeType == 1 ) { + this._execEvent('scroll'); + } + } + + if ( this.options.probeType > 1 ) { + this._execEvent('scroll'); + } +/* REPLACE END: _move */ + + }, + + _end: function (e) { + if ( !this.enabled || utils.eventType[e.type] !== this.initiated ) { + return; + } + + if ( this.options.preventDefault && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) { + e.preventDefault(); + } + + var point = e.changedTouches ? e.changedTouches[0] : e, + momentumX, + momentumY, + duration = utils.getTime() - this.startTime, + newX = Math.round(this.x), + newY = Math.round(this.y), + distanceX = Math.abs(newX - this.startX), + distanceY = Math.abs(newY - this.startY), + time = 0, + easing = ''; + + this.isInTransition = 0; + this.initiated = 0; + this.endTime = utils.getTime(); + + // reset if we are outside of the boundaries + if ( this.resetPosition(this.options.bounceTime) ) { + return; + } + + this.scrollTo(newX, newY); // ensures that the last position is rounded + + // we scrolled less than 10 pixels + if ( !this.moved ) { + if ( this.options.tap ) { + utils.tap(e, this.options.tap); + } + + if ( this.options.click ) { + utils.click(e); + } + + this._execEvent('scrollCancel'); + return; + } + + if ( this._events.flick && duration < 200 && distanceX < 100 && distanceY < 100 ) { + this._execEvent('flick'); + return; + } + + // start momentum animation if needed + if ( this.options.momentum && duration < 300 ) { + momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0, this.options.deceleration) : { destination: newX, duration: 0 }; + momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0, this.options.deceleration) : { destination: newY, duration: 0 }; + newX = momentumX.destination; + newY = momentumY.destination; + time = Math.max(momentumX.duration, momentumY.duration); + this.isInTransition = 1; + } + + + if ( this.options.snap ) { + var snap = this._nearestSnap(newX, newY); + this.currentPage = snap; + time = this.options.snapSpeed || Math.max( + Math.max( + Math.min(Math.abs(newX - snap.x), 1000), + Math.min(Math.abs(newY - snap.y), 1000) + ), 300); + newX = snap.x; + newY = snap.y; + + this.directionX = 0; + this.directionY = 0; + easing = this.options.bounceEasing; + } + +// INSERT POINT: _end + + if ( newX != this.x || newY != this.y ) { + // change easing function when scroller goes out of the boundaries + if ( newX > 0 || newX < this.maxScrollX || newY > 0 || newY < this.maxScrollY ) { + easing = utils.ease.quadratic; + } + + this.scrollTo(newX, newY, time, easing); + return; + } + + this._execEvent('scrollEnd'); + }, + + _resize: function () { + var that = this; + + clearTimeout(this.resizeTimeout); + + this.resizeTimeout = setTimeout(function () { + that.refresh(); + }, this.options.resizePolling); + }, + + resetPosition: function (time) { + var x = this.x, + y = this.y; + + time = time || 0; + + if ( !this.hasHorizontalScroll || this.x > 0 ) { + x = 0; + } else if ( this.x < this.maxScrollX ) { + x = this.maxScrollX; + } + + if ( !this.hasVerticalScroll || this.y > 0 ) { + y = 0; + } else if ( this.y < this.maxScrollY ) { + y = this.maxScrollY; + } + + if ( x == this.x && y == this.y ) { + return false; + } + + this.scrollTo(x, y, time, this.options.bounceEasing); + + return true; + }, + + disable: function () { + this.enabled = false; + }, + + enable: function () { + this.enabled = true; + }, + + refresh: function () { + utils.getRect(this.wrapper); // Force reflow + + this.wrapperWidth = this.wrapper.clientWidth; + this.wrapperHeight = this.wrapper.clientHeight; + + var rect = utils.getRect(this.scroller); +/* REPLACE START: refresh */ + + this.scrollerWidth = rect.width; + this.scrollerHeight = rect.height; + + this.maxScrollX = this.wrapperWidth - this.scrollerWidth; + this.maxScrollY = this.wrapperHeight - this.scrollerHeight; + +/* REPLACE END: refresh */ + + this.hasHorizontalScroll = this.options.scrollX && this.maxScrollX < 0; + this.hasVerticalScroll = this.options.scrollY && this.maxScrollY < 0; + + if ( !this.hasHorizontalScroll ) { + this.maxScrollX = 0; + this.scrollerWidth = this.wrapperWidth; + } + + if ( !this.hasVerticalScroll ) { + this.maxScrollY = 0; + this.scrollerHeight = this.wrapperHeight; + } + + this.endTime = 0; + this.directionX = 0; + this.directionY = 0; + + if(utils.hasPointer && !this.options.disablePointer) { + // The wrapper should have `touchAction` property for using pointerEvent. + this.wrapper.style[utils.style.touchAction] = utils.getTouchAction(this.options.eventPassthrough, true); + + // case. not support 'pinch-zoom' + // https://github.com/cubiq/iscroll/issues/1118#issuecomment-270057583 + if (!this.wrapper.style[utils.style.touchAction]) { + this.wrapper.style[utils.style.touchAction] = utils.getTouchAction(this.options.eventPassthrough, false); + } + } + this.wrapperOffset = utils.offset(this.wrapper); + + this._execEvent('refresh'); + + this.resetPosition(); + +// INSERT POINT: _refresh + + }, + + on: function (type, fn) { + if ( !this._events[type] ) { + this._events[type] = []; + } + + this._events[type].push(fn); + }, + + off: function (type, fn) { + if ( !this._events[type] ) { + return; + } + + var index = this._events[type].indexOf(fn); + + if ( index > -1 ) { + this._events[type].splice(index, 1); + } + }, + + _execEvent: function (type) { + if ( !this._events[type] ) { + return; + } + + var i = 0, + l = this._events[type].length; + + if ( !l ) { + return; + } + + for ( ; i < l; i++ ) { + this._events[type][i].apply(this, [].slice.call(arguments, 1)); + } + }, + + scrollBy: function (x, y, time, easing) { + x = this.x + x; + y = this.y + y; + time = time || 0; + + this.scrollTo(x, y, time, easing); + }, + + scrollTo: function (x, y, time, easing) { + easing = easing || utils.ease.circular; + + this.isInTransition = this.options.useTransition && time > 0; + var transitionType = this.options.useTransition && easing.style; + if ( !time || transitionType ) { + if(transitionType) { + this._transitionTimingFunction(easing.style); + this._transitionTime(time); + } + this._translate(x, y); + } else { + this._animate(x, y, time, easing.fn); + } + }, + + scrollToElement: function (el, time, offsetX, offsetY, easing) { + el = el.nodeType ? el : this.scroller.querySelector(el); + + if ( !el ) { + return; + } + + var pos = utils.offset(el); + + pos.left -= this.wrapperOffset.left; + pos.top -= this.wrapperOffset.top; + + // if offsetX/Y are true we center the element to the screen + var elRect = utils.getRect(el); + var wrapperRect = utils.getRect(this.wrapper); + if ( offsetX === true ) { + offsetX = Math.round(elRect.width / 2 - wrapperRect.width / 2); + } + if ( offsetY === true ) { + offsetY = Math.round(elRect.height / 2 - wrapperRect.height / 2); + } + + pos.left -= offsetX || 0; + pos.top -= offsetY || 0; + + pos.left = pos.left > 0 ? 0 : pos.left < this.maxScrollX ? this.maxScrollX : pos.left; + pos.top = pos.top > 0 ? 0 : pos.top < this.maxScrollY ? this.maxScrollY : pos.top; + + time = time === undefined || time === null || time === 'auto' ? Math.max(Math.abs(this.x-pos.left), Math.abs(this.y-pos.top)) : time; + + this.scrollTo(pos.left, pos.top, time, easing); + }, + + _transitionTime: function (time) { + if (!this.options.useTransition) { + return; + } + time = time || 0; + var durationProp = utils.style.transitionDuration; + if(!durationProp) { + return; + } + + this.scrollerStyle[durationProp] = time + 'ms'; + + if ( !time && utils.isBadAndroid ) { + this.scrollerStyle[durationProp] = '0.0001ms'; + // remove 0.0001ms + var self = this; + rAF(function() { + if(self.scrollerStyle[durationProp] === '0.0001ms') { + self.scrollerStyle[durationProp] = '0s'; + } + }); + } + + + if ( this.indicators ) { + for ( var i = this.indicators.length; i--; ) { + this.indicators[i].transitionTime(time); + } + } + + +// INSERT POINT: _transitionTime + + }, + + _transitionTimingFunction: function (easing) { + this.scrollerStyle[utils.style.transitionTimingFunction] = easing; + + + if ( this.indicators ) { + for ( var i = this.indicators.length; i--; ) { + this.indicators[i].transitionTimingFunction(easing); + } + } + + +// INSERT POINT: _transitionTimingFunction + + }, + + _translate: function (x, y) { + if ( this.options.useTransform ) { + +/* REPLACE START: _translate */ + + this.scrollerStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.translateZ; + +/* REPLACE END: _translate */ + + } else { + x = Math.round(x); + y = Math.round(y); + this.scrollerStyle.left = x + 'px'; + this.scrollerStyle.top = y + 'px'; + } + + this.x = x; + this.y = y; + + + if ( this.indicators ) { + for ( var i = this.indicators.length; i--; ) { + this.indicators[i].updatePosition(); + } + } + + +// INSERT POINT: _translate + + }, + + _initEvents: function (remove) { + var eventType = remove ? utils.removeEvent : utils.addEvent, + target = this.options.bindToWrapper ? this.wrapper : window; + + eventType(window, 'orientationchange', this); + eventType(window, 'resize', this); + + if ( this.options.click ) { + eventType(this.wrapper, 'click', this, true); + } + + if ( !this.options.disableMouse ) { + eventType(this.wrapper, 'mousedown', this); + eventType(target, 'mousemove', this); + eventType(target, 'mousecancel', this); + eventType(target, 'mouseup', this); + } + + if ( utils.hasPointer && !this.options.disablePointer ) { + eventType(this.wrapper, utils.prefixPointerEvent('pointerdown'), this); + eventType(target, utils.prefixPointerEvent('pointermove'), this); + eventType(target, utils.prefixPointerEvent('pointercancel'), this); + eventType(target, utils.prefixPointerEvent('pointerup'), this); + } + + if ( utils.hasTouch && !this.options.disableTouch ) { + eventType(this.wrapper, 'touchstart', this); + eventType(target, 'touchmove', this); + eventType(target, 'touchcancel', this); + eventType(target, 'touchend', this); + } + + eventType(this.scroller, 'transitionend', this); + eventType(this.scroller, 'webkitTransitionEnd', this); + eventType(this.scroller, 'oTransitionEnd', this); + eventType(this.scroller, 'MSTransitionEnd', this); + }, + + getComputedPosition: function () { + var matrix = window.getComputedStyle(this.scroller, null), + x, y; + + if ( this.options.useTransform ) { + matrix = matrix[utils.style.transform].split(')')[0].split(', '); + x = +(matrix[12] || matrix[4]); + y = +(matrix[13] || matrix[5]); + } else { + x = +matrix.left.replace(/[^-\d.]/g, ''); + y = +matrix.top.replace(/[^-\d.]/g, ''); + } + + return { x: x, y: y }; + }, + _initIndicators: function () { + var interactive = this.options.interactiveScrollbars, + customStyle = typeof this.options.scrollbars != 'string', + indicators = [], + indicator; + + var that = this; + + this.indicators = []; + + if ( this.options.scrollbars ) { + // Vertical scrollbar + if ( this.options.scrollY ) { + indicator = { + el: createDefaultScrollbar('v', interactive, this.options.scrollbars), + interactive: interactive, + defaultScrollbars: true, + customStyle: customStyle, + resize: this.options.resizeScrollbars, + shrink: this.options.shrinkScrollbars, + fade: this.options.fadeScrollbars, + listenX: false + }; + + this.wrapper.appendChild(indicator.el); + indicators.push(indicator); + } + + // Horizontal scrollbar + if ( this.options.scrollX ) { + indicator = { + el: createDefaultScrollbar('h', interactive, this.options.scrollbars), + interactive: interactive, + defaultScrollbars: true, + customStyle: customStyle, + resize: this.options.resizeScrollbars, + shrink: this.options.shrinkScrollbars, + fade: this.options.fadeScrollbars, + listenY: false + }; + + this.wrapper.appendChild(indicator.el); + indicators.push(indicator); + } + } + + if ( this.options.indicators ) { + // TODO: check concat compatibility + indicators = indicators.concat(this.options.indicators); + } + + for ( var i = indicators.length; i--; ) { + this.indicators.push( new Indicator(this, indicators[i]) ); + } + + // TODO: check if we can use array.map (wide compatibility and performance issues) + function _indicatorsMap (fn) { + if (that.indicators) { + for ( var i = that.indicators.length; i--; ) { + fn.call(that.indicators[i]); + } + } + } + + if ( this.options.fadeScrollbars ) { + this.on('scrollEnd', function () { + _indicatorsMap(function () { + this.fade(); + }); + }); + + this.on('scrollCancel', function () { + _indicatorsMap(function () { + this.fade(); + }); + }); + + this.on('scrollStart', function () { + _indicatorsMap(function () { + this.fade(1); + }); + }); + + this.on('beforeScrollStart', function () { + _indicatorsMap(function () { + this.fade(1, true); + }); + }); + } + + + this.on('refresh', function () { + _indicatorsMap(function () { + this.refresh(); + }); + }); + + this.on('destroy', function () { + _indicatorsMap(function () { + this.destroy(); + }); + + delete this.indicators; + }); + }, + + _initWheel: function () { + utils.addEvent(this.wrapper, 'wheel', this); + utils.addEvent(this.wrapper, 'mousewheel', this); + utils.addEvent(this.wrapper, 'DOMMouseScroll', this); + + this.on('destroy', function () { + clearTimeout(this.wheelTimeout); + this.wheelTimeout = null; + utils.removeEvent(this.wrapper, 'wheel', this); + utils.removeEvent(this.wrapper, 'mousewheel', this); + utils.removeEvent(this.wrapper, 'DOMMouseScroll', this); + }); + }, + + _wheel: function (e) { + if ( !this.enabled ) { + return; + } + + e.preventDefault(); + + var wheelDeltaX, wheelDeltaY, + newX, newY, + that = this; + + if ( this.wheelTimeout === undefined ) { + that._execEvent('scrollStart'); + } + + // Execute the scrollEnd event after 400ms the wheel stopped scrolling + clearTimeout(this.wheelTimeout); + this.wheelTimeout = setTimeout(function () { + if(!that.options.snap) { + that._execEvent('scrollEnd'); + } + that.wheelTimeout = undefined; + }, 400); + + if ( 'deltaX' in e ) { + if (e.deltaMode === 1) { + wheelDeltaX = -e.deltaX * this.options.mouseWheelSpeed; + wheelDeltaY = -e.deltaY * this.options.mouseWheelSpeed; + } else { + wheelDeltaX = -e.deltaX; + wheelDeltaY = -e.deltaY; + } + } else if ( 'wheelDeltaX' in e ) { + wheelDeltaX = e.wheelDeltaX / 120 * this.options.mouseWheelSpeed; + wheelDeltaY = e.wheelDeltaY / 120 * this.options.mouseWheelSpeed; + } else if ( 'wheelDelta' in e ) { + wheelDeltaX = wheelDeltaY = e.wheelDelta / 120 * this.options.mouseWheelSpeed; + } else if ( 'detail' in e ) { + wheelDeltaX = wheelDeltaY = -e.detail / 3 * this.options.mouseWheelSpeed; + } else { + return; + } + + wheelDeltaX *= this.options.invertWheelDirection; + wheelDeltaY *= this.options.invertWheelDirection; + + if ( !this.hasVerticalScroll ) { + wheelDeltaX = wheelDeltaY; + wheelDeltaY = 0; + } + + if ( this.options.snap ) { + newX = this.currentPage.pageX; + newY = this.currentPage.pageY; + + if ( wheelDeltaX > 0 ) { + newX--; + } else if ( wheelDeltaX < 0 ) { + newX++; + } + + if ( wheelDeltaY > 0 ) { + newY--; + } else if ( wheelDeltaY < 0 ) { + newY++; + } + + this.goToPage(newX, newY); + + return; + } + + newX = this.x + Math.round(this.hasHorizontalScroll ? wheelDeltaX : 0); + newY = this.y + Math.round(this.hasVerticalScroll ? wheelDeltaY : 0); + + this.directionX = wheelDeltaX > 0 ? -1 : wheelDeltaX < 0 ? 1 : 0; + this.directionY = wheelDeltaY > 0 ? -1 : wheelDeltaY < 0 ? 1 : 0; + + if ( newX > 0 ) { + newX = 0; + } else if ( newX < this.maxScrollX ) { + newX = this.maxScrollX; + } + + if ( newY > 0 ) { + newY = 0; + } else if ( newY < this.maxScrollY ) { + newY = this.maxScrollY; + } + + this.scrollTo(newX, newY, 0); + + if ( this.options.probeType > 1 ) { + this._execEvent('scroll'); + } + +// INSERT POINT: _wheel + }, + + _initSnap: function () { + this.currentPage = {}; + + if ( typeof this.options.snap == 'string' ) { + this.options.snap = this.scroller.querySelectorAll(this.options.snap); + } + + this.on('refresh', function () { + var i = 0, l, + m = 0, n, + cx, cy, + x = 0, y, + stepX = this.options.snapStepX || this.wrapperWidth, + stepY = this.options.snapStepY || this.wrapperHeight, + el, + rect; + + this.pages = []; + + if ( !this.wrapperWidth || !this.wrapperHeight || !this.scrollerWidth || !this.scrollerHeight ) { + return; + } + + if ( this.options.snap === true ) { + cx = Math.round( stepX / 2 ); + cy = Math.round( stepY / 2 ); + + while ( x > -this.scrollerWidth ) { + this.pages[i] = []; + l = 0; + y = 0; + + while ( y > -this.scrollerHeight ) { + this.pages[i][l] = { + x: Math.max(x, this.maxScrollX), + y: Math.max(y, this.maxScrollY), + width: stepX, + height: stepY, + cx: x - cx, + cy: y - cy + }; + + y -= stepY; + l++; + } + + x -= stepX; + i++; + } + } else { + el = this.options.snap; + l = el.length; + n = -1; + + for ( ; i < l; i++ ) { + rect = utils.getRect(el[i]); + if ( i === 0 || rect.left <= utils.getRect(el[i-1]).left ) { + m = 0; + n++; + } + + if ( !this.pages[m] ) { + this.pages[m] = []; + } + + x = Math.max(-rect.left, this.maxScrollX); + y = Math.max(-rect.top, this.maxScrollY); + cx = x - Math.round(rect.width / 2); + cy = y - Math.round(rect.height / 2); + + this.pages[m][n] = { + x: x, + y: y, + width: rect.width, + height: rect.height, + cx: cx, + cy: cy + }; + + if ( x > this.maxScrollX ) { + m++; + } + } + } + + this.goToPage(this.currentPage.pageX || 0, this.currentPage.pageY || 0, 0); + + // Update snap threshold if needed + if ( this.options.snapThreshold % 1 === 0 ) { + this.snapThresholdX = this.options.snapThreshold; + this.snapThresholdY = this.options.snapThreshold; + } else { + this.snapThresholdX = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].width * this.options.snapThreshold); + this.snapThresholdY = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].height * this.options.snapThreshold); + } + }); + + this.on('flick', function () { + var time = this.options.snapSpeed || Math.max( + Math.max( + Math.min(Math.abs(this.x - this.startX), 1000), + Math.min(Math.abs(this.y - this.startY), 1000) + ), 300); + + this.goToPage( + this.currentPage.pageX + this.directionX, + this.currentPage.pageY + this.directionY, + time + ); + }); + }, + + _nearestSnap: function (x, y) { + if ( !this.pages.length ) { + return { x: 0, y: 0, pageX: 0, pageY: 0 }; + } + + var i = 0, + l = this.pages.length, + m = 0; + + // Check if we exceeded the snap threshold + if ( Math.abs(x - this.absStartX) < this.snapThresholdX && + Math.abs(y - this.absStartY) < this.snapThresholdY ) { + return this.currentPage; + } + + if ( x > 0 ) { + x = 0; + } else if ( x < this.maxScrollX ) { + x = this.maxScrollX; + } + + if ( y > 0 ) { + y = 0; + } else if ( y < this.maxScrollY ) { + y = this.maxScrollY; + } + + for ( ; i < l; i++ ) { + if ( x >= this.pages[i][0].cx ) { + x = this.pages[i][0].x; + break; + } + } + + l = this.pages[i].length; + + for ( ; m < l; m++ ) { + if ( y >= this.pages[0][m].cy ) { + y = this.pages[0][m].y; + break; + } + } + + if ( i == this.currentPage.pageX ) { + i += this.directionX; + + if ( i < 0 ) { + i = 0; + } else if ( i >= this.pages.length ) { + i = this.pages.length - 1; + } + + x = this.pages[i][0].x; + } + + if ( m == this.currentPage.pageY ) { + m += this.directionY; + + if ( m < 0 ) { + m = 0; + } else if ( m >= this.pages[0].length ) { + m = this.pages[0].length - 1; + } + + y = this.pages[0][m].y; + } + + return { + x: x, + y: y, + pageX: i, + pageY: m + }; + }, + + goToPage: function (x, y, time, easing) { + easing = easing || this.options.bounceEasing; + + if ( x >= this.pages.length ) { + x = this.pages.length - 1; + } else if ( x < 0 ) { + x = 0; + } + + if ( y >= this.pages[x].length ) { + y = this.pages[x].length - 1; + } else if ( y < 0 ) { + y = 0; + } + + var posX = this.pages[x][y].x, + posY = this.pages[x][y].y; + + time = time === undefined ? this.options.snapSpeed || Math.max( + Math.max( + Math.min(Math.abs(posX - this.x), 1000), + Math.min(Math.abs(posY - this.y), 1000) + ), 300) : time; + + this.currentPage = { + x: posX, + y: posY, + pageX: x, + pageY: y + }; + + this.scrollTo(posX, posY, time, easing); + }, + + next: function (time, easing) { + var x = this.currentPage.pageX, + y = this.currentPage.pageY; + + x++; + + if ( x >= this.pages.length && this.hasVerticalScroll ) { + x = 0; + y++; + } + + this.goToPage(x, y, time, easing); + }, + + prev: function (time, easing) { + var x = this.currentPage.pageX, + y = this.currentPage.pageY; + + x--; + + if ( x < 0 && this.hasVerticalScroll ) { + x = 0; + y--; + } + + this.goToPage(x, y, time, easing); + }, + + _initKeys: function (e) { + // default key bindings + var keys = { + pageUp: 33, + pageDown: 34, + end: 35, + home: 36, + left: 37, + up: 38, + right: 39, + down: 40 + }; + var i; + + // if you give me characters I give you keycode + if ( typeof this.options.keyBindings == 'object' ) { + for ( i in this.options.keyBindings ) { + if ( typeof this.options.keyBindings[i] == 'string' ) { + this.options.keyBindings[i] = this.options.keyBindings[i].toUpperCase().charCodeAt(0); + } + } + } else { + this.options.keyBindings = {}; + } + + for ( i in keys ) { + this.options.keyBindings[i] = this.options.keyBindings[i] || keys[i]; + } + + utils.addEvent(window, 'keydown', this); + + this.on('destroy', function () { + utils.removeEvent(window, 'keydown', this); + }); + }, + + _key: function (e) { + if ( !this.enabled ) { + return; + } + + var snap = this.options.snap, // we are using this alot, better to cache it + newX = snap ? this.currentPage.pageX : this.x, + newY = snap ? this.currentPage.pageY : this.y, + now = utils.getTime(), + prevTime = this.keyTime || 0, + acceleration = 0.250, + pos; + + if ( this.options.useTransition && this.isInTransition ) { + pos = this.getComputedPosition(); + + this._translate(Math.round(pos.x), Math.round(pos.y)); + this.isInTransition = false; + } + + this.keyAcceleration = now - prevTime < 200 ? Math.min(this.keyAcceleration + acceleration, 50) : 0; + + switch ( e.keyCode ) { + case this.options.keyBindings.pageUp: + if ( this.hasHorizontalScroll && !this.hasVerticalScroll ) { + newX += snap ? 1 : this.wrapperWidth; + } else { + newY += snap ? 1 : this.wrapperHeight; + } + break; + case this.options.keyBindings.pageDown: + if ( this.hasHorizontalScroll && !this.hasVerticalScroll ) { + newX -= snap ? 1 : this.wrapperWidth; + } else { + newY -= snap ? 1 : this.wrapperHeight; + } + break; + case this.options.keyBindings.end: + newX = snap ? this.pages.length-1 : this.maxScrollX; + newY = snap ? this.pages[0].length-1 : this.maxScrollY; + break; + case this.options.keyBindings.home: + newX = 0; + newY = 0; + break; + case this.options.keyBindings.left: + newX += snap ? -1 : 5 + this.keyAcceleration>>0; + break; + case this.options.keyBindings.up: + newY += snap ? 1 : 5 + this.keyAcceleration>>0; + break; + case this.options.keyBindings.right: + newX -= snap ? -1 : 5 + this.keyAcceleration>>0; + break; + case this.options.keyBindings.down: + newY -= snap ? 1 : 5 + this.keyAcceleration>>0; + break; + default: + return; + } + + if ( snap ) { + this.goToPage(newX, newY); + return; + } + + if ( newX > 0 ) { + newX = 0; + this.keyAcceleration = 0; + } else if ( newX < this.maxScrollX ) { + newX = this.maxScrollX; + this.keyAcceleration = 0; + } + + if ( newY > 0 ) { + newY = 0; + this.keyAcceleration = 0; + } else if ( newY < this.maxScrollY ) { + newY = this.maxScrollY; + this.keyAcceleration = 0; + } + + this.scrollTo(newX, newY, 0); + + this.keyTime = now; + }, + + _animate: function (destX, destY, duration, easingFn) { + var that = this, + startX = this.x, + startY = this.y, + startTime = utils.getTime(), + destTime = startTime + duration; + + function step () { + var now = utils.getTime(), + newX, newY, + easing; + + if ( now >= destTime ) { + that.isAnimating = false; + that._translate(destX, destY); + + if ( !that.resetPosition(that.options.bounceTime) ) { + that._execEvent('scrollEnd'); + } + + return; + } + + now = ( now - startTime ) / duration; + easing = easingFn(now); + newX = ( destX - startX ) * easing + startX; + newY = ( destY - startY ) * easing + startY; + that._translate(newX, newY); + + if ( that.isAnimating ) { + rAF(step); + } + + if ( that.options.probeType == 3 ) { + that._execEvent('scroll'); + } + } + + this.isAnimating = true; + step(); + }, + + handleEvent: function (e) { + switch ( e.type ) { + case 'touchstart': + case 'pointerdown': + case 'MSPointerDown': + case 'mousedown': + this._start(e); + break; + case 'touchmove': + case 'pointermove': + case 'MSPointerMove': + case 'mousemove': + this._move(e); + break; + case 'touchend': + case 'pointerup': + case 'MSPointerUp': + case 'mouseup': + case 'touchcancel': + case 'pointercancel': + case 'MSPointerCancel': + case 'mousecancel': + this._end(e); + break; + case 'orientationchange': + case 'resize': + this._resize(); + break; + case 'transitionend': + case 'webkitTransitionEnd': + case 'oTransitionEnd': + case 'MSTransitionEnd': + this._transitionEnd(e); + break; + case 'wheel': + case 'DOMMouseScroll': + case 'mousewheel': + this._wheel(e); + break; + case 'keydown': + this._key(e); + break; + case 'click': + if ( this.enabled && !e._constructed ) { + e.preventDefault(); + e.stopPropagation(); + } + break; + } + } +}; +function createDefaultScrollbar (direction, interactive, type) { + var scrollbar = document.createElement('div'), + indicator = document.createElement('div'); + + if ( type === true ) { + scrollbar.style.cssText = 'position:absolute;z-index:9999'; + indicator.style.cssText = '-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px'; + } + + indicator.className = 'iScrollIndicator'; + + if ( direction == 'h' ) { + if ( type === true ) { + scrollbar.style.cssText += ';height:7px;left:2px;right:2px;bottom:0'; + indicator.style.height = '100%'; + } + scrollbar.className = 'iScrollHorizontalScrollbar'; + } else { + if ( type === true ) { + scrollbar.style.cssText += ';width:7px;bottom:2px;top:2px;right:1px'; + indicator.style.width = '100%'; + } + scrollbar.className = 'iScrollVerticalScrollbar'; + } + + scrollbar.style.cssText += ';overflow:hidden'; + + if ( !interactive ) { + scrollbar.style.pointerEvents = 'none'; + } + + scrollbar.appendChild(indicator); + + return scrollbar; +} + +function Indicator (scroller, options) { + this.wrapper = typeof options.el == 'string' ? document.querySelector(options.el) : options.el; + this.wrapperStyle = this.wrapper.style; + this.indicator = this.wrapper.children[0]; + this.indicatorStyle = this.indicator.style; + this.scroller = scroller; + + this.options = { + listenX: true, + listenY: true, + interactive: false, + resize: true, + defaultScrollbars: false, + shrink: false, + fade: false, + speedRatioX: 0, + speedRatioY: 0 + }; + + for ( var i in options ) { + this.options[i] = options[i]; + } + + this.sizeRatioX = 1; + this.sizeRatioY = 1; + this.maxPosX = 0; + this.maxPosY = 0; + + if ( this.options.interactive ) { + if ( !this.options.disableTouch ) { + utils.addEvent(this.indicator, 'touchstart', this); + utils.addEvent(window, 'touchend', this); + } + if ( !this.options.disablePointer ) { + utils.addEvent(this.indicator, utils.prefixPointerEvent('pointerdown'), this); + utils.addEvent(window, utils.prefixPointerEvent('pointerup'), this); + } + if ( !this.options.disableMouse ) { + utils.addEvent(this.indicator, 'mousedown', this); + utils.addEvent(window, 'mouseup', this); + } + } + + if ( this.options.fade ) { + this.wrapperStyle[utils.style.transform] = this.scroller.translateZ; + var durationProp = utils.style.transitionDuration; + if(!durationProp) { + return; + } + this.wrapperStyle[durationProp] = utils.isBadAndroid ? '0.0001ms' : '0ms'; + // remove 0.0001ms + var self = this; + if(utils.isBadAndroid) { + rAF(function() { + if(self.wrapperStyle[durationProp] === '0.0001ms') { + self.wrapperStyle[durationProp] = '0s'; + } + }); + } + this.wrapperStyle.opacity = '0'; + } +} + +Indicator.prototype = { + handleEvent: function (e) { + switch ( e.type ) { + case 'touchstart': + case 'pointerdown': + case 'MSPointerDown': + case 'mousedown': + this._start(e); + break; + case 'touchmove': + case 'pointermove': + case 'MSPointerMove': + case 'mousemove': + this._move(e); + break; + case 'touchend': + case 'pointerup': + case 'MSPointerUp': + case 'mouseup': + case 'touchcancel': + case 'pointercancel': + case 'MSPointerCancel': + case 'mousecancel': + this._end(e); + break; + } + }, + + destroy: function () { + if ( this.options.fadeScrollbars ) { + clearTimeout(this.fadeTimeout); + this.fadeTimeout = null; + } + if ( this.options.interactive ) { + utils.removeEvent(this.indicator, 'touchstart', this); + utils.removeEvent(this.indicator, utils.prefixPointerEvent('pointerdown'), this); + utils.removeEvent(this.indicator, 'mousedown', this); + + utils.removeEvent(window, 'touchmove', this); + utils.removeEvent(window, utils.prefixPointerEvent('pointermove'), this); + utils.removeEvent(window, 'mousemove', this); + + utils.removeEvent(window, 'touchend', this); + utils.removeEvent(window, utils.prefixPointerEvent('pointerup'), this); + utils.removeEvent(window, 'mouseup', this); + } + + if ( this.options.defaultScrollbars && this.wrapper.parentNode ) { + this.wrapper.parentNode.removeChild(this.wrapper); + } + }, + + _start: function (e) { + var point = e.touches ? e.touches[0] : e; + + e.preventDefault(); + e.stopPropagation(); + + this.transitionTime(); + + this.initiated = true; + this.moved = false; + this.lastPointX = point.pageX; + this.lastPointY = point.pageY; + + this.startTime = utils.getTime(); + + if ( !this.options.disableTouch ) { + utils.addEvent(window, 'touchmove', this); + } + if ( !this.options.disablePointer ) { + utils.addEvent(window, utils.prefixPointerEvent('pointermove'), this); + } + if ( !this.options.disableMouse ) { + utils.addEvent(window, 'mousemove', this); + } + + this.scroller._execEvent('beforeScrollStart'); + }, + + _move: function (e) { + var point = e.touches ? e.touches[0] : e, + deltaX, deltaY, + newX, newY, + timestamp = utils.getTime(); + + if ( !this.moved ) { + this.scroller._execEvent('scrollStart'); + } + + this.moved = true; + + deltaX = point.pageX - this.lastPointX; + this.lastPointX = point.pageX; + + deltaY = point.pageY - this.lastPointY; + this.lastPointY = point.pageY; + + newX = this.x + deltaX; + newY = this.y + deltaY; + + this._pos(newX, newY); + + + if ( this.scroller.options.probeType == 1 && timestamp - this.startTime > 300 ) { + this.startTime = timestamp; + this.scroller._execEvent('scroll'); + } else if ( this.scroller.options.probeType > 1 ) { + this.scroller._execEvent('scroll'); + } + + +// INSERT POINT: indicator._move + + e.preventDefault(); + e.stopPropagation(); + }, + + _end: function (e) { + if ( !this.initiated ) { + return; + } + + this.initiated = false; + + e.preventDefault(); + e.stopPropagation(); + + utils.removeEvent(window, 'touchmove', this); + utils.removeEvent(window, utils.prefixPointerEvent('pointermove'), this); + utils.removeEvent(window, 'mousemove', this); + + if ( this.scroller.options.snap ) { + var snap = this.scroller._nearestSnap(this.scroller.x, this.scroller.y); + + var time = this.options.snapSpeed || Math.max( + Math.max( + Math.min(Math.abs(this.scroller.x - snap.x), 1000), + Math.min(Math.abs(this.scroller.y - snap.y), 1000) + ), 300); + + if ( this.scroller.x != snap.x || this.scroller.y != snap.y ) { + this.scroller.directionX = 0; + this.scroller.directionY = 0; + this.scroller.currentPage = snap; + this.scroller.scrollTo(snap.x, snap.y, time, this.scroller.options.bounceEasing); + } + } + + if ( this.moved ) { + this.scroller._execEvent('scrollEnd'); + } + }, + + transitionTime: function (time) { + time = time || 0; + var durationProp = utils.style.transitionDuration; + if(!durationProp) { + return; + } + + this.indicatorStyle[durationProp] = time + 'ms'; + + if ( !time && utils.isBadAndroid ) { + this.indicatorStyle[durationProp] = '0.0001ms'; + // remove 0.0001ms + var self = this; + rAF(function() { + if(self.indicatorStyle[durationProp] === '0.0001ms') { + self.indicatorStyle[durationProp] = '0s'; + } + }); + } + }, + + transitionTimingFunction: function (easing) { + this.indicatorStyle[utils.style.transitionTimingFunction] = easing; + }, + + refresh: function () { + this.transitionTime(); + + if ( this.options.listenX && !this.options.listenY ) { + this.indicatorStyle.display = this.scroller.hasHorizontalScroll ? 'block' : 'none'; + } else if ( this.options.listenY && !this.options.listenX ) { + this.indicatorStyle.display = this.scroller.hasVerticalScroll ? 'block' : 'none'; + } else { + this.indicatorStyle.display = this.scroller.hasHorizontalScroll || this.scroller.hasVerticalScroll ? 'block' : 'none'; + } + + if ( this.scroller.hasHorizontalScroll && this.scroller.hasVerticalScroll ) { + utils.addClass(this.wrapper, 'iScrollBothScrollbars'); + utils.removeClass(this.wrapper, 'iScrollLoneScrollbar'); + + if ( this.options.defaultScrollbars && this.options.customStyle ) { + if ( this.options.listenX ) { + this.wrapper.style.right = '8px'; + } else { + this.wrapper.style.bottom = '8px'; + } + } + } else { + utils.removeClass(this.wrapper, 'iScrollBothScrollbars'); + utils.addClass(this.wrapper, 'iScrollLoneScrollbar'); + + if ( this.options.defaultScrollbars && this.options.customStyle ) { + if ( this.options.listenX ) { + this.wrapper.style.right = '2px'; + } else { + this.wrapper.style.bottom = '2px'; + } + } + } + + utils.getRect(this.wrapper); // force refresh + + if ( this.options.listenX ) { + this.wrapperWidth = this.wrapper.clientWidth; + if ( this.options.resize ) { + this.indicatorWidth = Math.max(Math.round(this.wrapperWidth * this.wrapperWidth / (this.scroller.scrollerWidth || this.wrapperWidth || 1)), 8); + this.indicatorStyle.width = this.indicatorWidth + 'px'; + } else { + this.indicatorWidth = this.indicator.clientWidth; + } + + this.maxPosX = this.wrapperWidth - this.indicatorWidth; + + if ( this.options.shrink == 'clip' ) { + this.minBoundaryX = -this.indicatorWidth + 8; + this.maxBoundaryX = this.wrapperWidth - 8; + } else { + this.minBoundaryX = 0; + this.maxBoundaryX = this.maxPosX; + } + + this.sizeRatioX = this.options.speedRatioX || (this.scroller.maxScrollX && (this.maxPosX / this.scroller.maxScrollX)); + } + + if ( this.options.listenY ) { + this.wrapperHeight = this.wrapper.clientHeight; + if ( this.options.resize ) { + this.indicatorHeight = Math.max(Math.round(this.wrapperHeight * this.wrapperHeight / (this.scroller.scrollerHeight || this.wrapperHeight || 1)), 8); + this.indicatorStyle.height = this.indicatorHeight + 'px'; + } else { + this.indicatorHeight = this.indicator.clientHeight; + } + + this.maxPosY = this.wrapperHeight - this.indicatorHeight; + + if ( this.options.shrink == 'clip' ) { + this.minBoundaryY = -this.indicatorHeight + 8; + this.maxBoundaryY = this.wrapperHeight - 8; + } else { + this.minBoundaryY = 0; + this.maxBoundaryY = this.maxPosY; + } + + this.maxPosY = this.wrapperHeight - this.indicatorHeight; + this.sizeRatioY = this.options.speedRatioY || (this.scroller.maxScrollY && (this.maxPosY / this.scroller.maxScrollY)); + } + + this.updatePosition(); + }, + + updatePosition: function () { + var x = this.options.listenX && Math.round(this.sizeRatioX * this.scroller.x) || 0, + y = this.options.listenY && Math.round(this.sizeRatioY * this.scroller.y) || 0; + + if ( !this.options.ignoreBoundaries ) { + if ( x < this.minBoundaryX ) { + if ( this.options.shrink == 'scale' ) { + this.width = Math.max(this.indicatorWidth + x, 8); + this.indicatorStyle.width = this.width + 'px'; + } + x = this.minBoundaryX; + } else if ( x > this.maxBoundaryX ) { + if ( this.options.shrink == 'scale' ) { + this.width = Math.max(this.indicatorWidth - (x - this.maxPosX), 8); + this.indicatorStyle.width = this.width + 'px'; + x = this.maxPosX + this.indicatorWidth - this.width; + } else { + x = this.maxBoundaryX; + } + } else if ( this.options.shrink == 'scale' && this.width != this.indicatorWidth ) { + this.width = this.indicatorWidth; + this.indicatorStyle.width = this.width + 'px'; + } + + if ( y < this.minBoundaryY ) { + if ( this.options.shrink == 'scale' ) { + this.height = Math.max(this.indicatorHeight + y * 3, 8); + this.indicatorStyle.height = this.height + 'px'; + } + y = this.minBoundaryY; + } else if ( y > this.maxBoundaryY ) { + if ( this.options.shrink == 'scale' ) { + this.height = Math.max(this.indicatorHeight - (y - this.maxPosY) * 3, 8); + this.indicatorStyle.height = this.height + 'px'; + y = this.maxPosY + this.indicatorHeight - this.height; + } else { + y = this.maxBoundaryY; + } + } else if ( this.options.shrink == 'scale' && this.height != this.indicatorHeight ) { + this.height = this.indicatorHeight; + this.indicatorStyle.height = this.height + 'px'; + } + } + + this.x = x; + this.y = y; + + if ( this.scroller.options.useTransform ) { + this.indicatorStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.scroller.translateZ; + } else { + this.indicatorStyle.left = x + 'px'; + this.indicatorStyle.top = y + 'px'; + } + }, + + _pos: function (x, y) { + if ( x < 0 ) { + x = 0; + } else if ( x > this.maxPosX ) { + x = this.maxPosX; + } + + if ( y < 0 ) { + y = 0; + } else if ( y > this.maxPosY ) { + y = this.maxPosY; + } + + x = this.options.listenX ? Math.round(x / this.sizeRatioX) : this.scroller.x; + y = this.options.listenY ? Math.round(y / this.sizeRatioY) : this.scroller.y; + + this.scroller.scrollTo(x, y); + }, + + fade: function (val, hold) { + if ( hold && !this.visible ) { + return; + } + + clearTimeout(this.fadeTimeout); + this.fadeTimeout = null; + + var time = val ? 250 : 500, + delay = val ? 0 : 300; + + val = val ? '1' : '0'; + + this.wrapperStyle[utils.style.transitionDuration] = time + 'ms'; + + this.fadeTimeout = setTimeout((function (val) { + this.wrapperStyle.opacity = val; + this.visible = +val; + }).bind(this, val), delay); + } +}; + +IScroll.utils = utils; + +if ( typeof module != 'undefined' && module.exports ) { + module.exports = IScroll; +} else if ( typeof define == 'function' && define.amd ) { + define( function () { return IScroll; } ); +} else { + window.IScroll = IScroll; +} + +})(window, document, Math); diff --git a/plugins/json.json b/plugins/json.json new file mode 100644 index 0000000..7af9428 --- /dev/null +++ b/plugins/json.json @@ -0,0 +1,32 @@ +{ + "piclist":[ + { + "imgsrc":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1510724005600&di=844d7c98a5772e552fc236a2b51314a3&imgtype=0&src=http%3A%2F%2Fc.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Fa50f4bfbfbedab643102c011fd36afc378311eea.jpg", + "text":"阳光美少女" + }, + { + "imgsrc":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1510724079677&di=132d422bd208257d6d8501017c9a3c26&imgtype=0&src=http%3A%2F%2Fimg.taopic.com%2Fuploads%2Fallimg%2F140305%2F240449-1403050T41292.jpg", + "text":"鲜花美女" + }, + { + "imgsrc":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1510724140514&di=8a9b8fe1407344f367270369a6d6e9c4&imgtype=0&src=http%3A%2F%2Fwww.wndhw.com%2Fxiezhen%2Fshuaige%2Fimages%2Fashuaige1.jpg", + "text":"这是郭敬明吗?" + }, + { + "imgsrc":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1510724174205&di=6a3800e2b0dbd6c7d3970901d93231ee&imgtype=0&src=http%3A%2F%2Fimg1.3lian.com%2F2016%2Fw1%2F94%2F101.jpg", + "text":"型男标准" + }, + { + "imgsrc":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1511318939&di=c16b854e15e8dbd2fce08fcf49ee7e5e&imgtype=jpg&er=1&src=http%3A%2F%2Fimg.jiaodong.net%2Fpic%2F0%2F10%2F50%2F17%2F10501750_887023.jpg", + "text":"单纯的笑脸" + }, + { + "imgsrc":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1510726259197&di=88d0f550014df3ccd8be3cebacbc1a49&imgtype=0&src=http%3A%2F%2Fimg.mp.sohu.com%2Fupload%2F20170602%2Fcffaca0f793745d390be0a079933ee65_th.png", + "text":"有名的熊孩子" + }, + { + "imgsrc":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1510724317019&di=45b124c6db39256d7206ac951b6fb2f9&imgtype=0&src=http%3A%2F%2Fimg5q.duitang.com%2Fuploads%2Fitem%2F201507%2F01%2F20150701143659_mkena.jpeg", + "text":"剪刀手帅哥" + } + ] +} \ No newline at end of file diff --git a/plugins/layer_mobile/layer.js b/plugins/layer_mobile/layer.js new file mode 100644 index 0000000..2eb3e28 --- /dev/null +++ b/plugins/layer_mobile/layer.js @@ -0,0 +1,2 @@ +/*! layer mobile-v2.0 弹层组件移动版 License LGPL http://layer.layui.com/mobile By 贤心 */ +;!function(a){"use strict";var b=document,c="querySelectorAll",d="getElementsByClassName",e=function(a){return b[c](a)},f={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},g={extend:function(a){var b=JSON.parse(JSON.stringify(f));for(var c in a)b[c]=a[c];return b},timer:{},end:{}};g.touch=function(a,b){a.addEventListener("click",function(a){b.call(this,a)},!1)};var h=0,i=["layui-m-layer"],j=function(a){var b=this;b.config=g.extend(a),b.view()};j.prototype.view=function(){var a=this,c=a.config,f=b.createElement("div");a.id=f.id=i[0]+h,f.setAttribute("class",i[0]+" "+i[0]+(c.type||0)),f.setAttribute("index",h);var g=function(){var a="object"==typeof c.title;return c.title?'

'+(a?c.title[0]:c.title)+"

":""}(),j=function(){"string"==typeof c.btn&&(c.btn=[c.btn]);var a,b=(c.btn||[]).length;return 0!==b&&c.btn?(a=''+c.btn[0]+"",2===b&&(a=''+c.btn[1]+""+a),'
'+a+"
"):""}();if(c.fixed||(c.top=c.hasOwnProperty("top")?c.top:100,c.style=c.style||"",c.style+=" top:"+(b.body.scrollTop+c.top)+"px"),2===c.type&&(c.content='

'+(c.content||"")+"

"),c.skin&&(c.anim="up"),"msg"===c.skin&&(c.shade=!1),f.innerHTML=(c.shade?"
':"")+'
"+g+'
'+c.content+"
"+j+"
",!c.type||2===c.type){var k=b[d](i[0]+c.type),l=k.length;l>=1&&layer.close(k[0].getAttribute("index"))}document.body.appendChild(f);var m=a.elem=e("#"+a.id)[0];c.success&&c.success(m),a.index=h++,a.action(c,m)},j.prototype.action=function(a,b){var c=this;a.time&&(g.timer[c.index]=setTimeout(function(){layer.close(c.index)},1e3*a.time));var e=function(){var b=this.getAttribute("type");0==b?(a.no&&a.no(),layer.close(c.index)):a.yes?a.yes(c.index):layer.close(c.index)};if(a.btn)for(var f=b[d]("layui-m-layerbtn")[0].children,h=f.length,i=0;h>i;i++)g.touch(f[i],e);if(a.shade&&a.shadeClose){var j=b[d]("layui-m-layershade")[0];g.touch(j,function(){layer.close(c.index,a.end)})}a.end&&(g.end[c.index]=a.end)},a.layer={v:"2.0",index:h,open:function(a){var b=new j(a||{});return b.index},close:function(a){var c=e("#"+i[0]+a)[0];c&&(c.innerHTML="",b.body.removeChild(c),clearTimeout(g.timer[a]),delete g.timer[a],"function"==typeof g.end[a]&&g.end[a](),delete g.end[a])},closeAll:function(){for(var a=b[d](i[0]),c=0,e=a.length;e>c;c++)layer.close(0|a[0].getAttribute("index"))}},"function"==typeof define?define(function(){return layer}):function(){var a=document.scripts,c=a[a.length-1],d=c.src,e=d.substring(0,d.lastIndexOf("/")+1);c.getAttribute("merge")||document.head.appendChild(function(){var a=b.createElement("link");return a.href=e+"need/layer.css?2.0",a.type="text/css",a.rel="styleSheet",a.id="layermcss",a}())}()}(window); \ No newline at end of file diff --git a/plugins/layer_mobile/need/layer.css b/plugins/layer_mobile/need/layer.css new file mode 100644 index 0000000..b9dbf20 --- /dev/null +++ b/plugins/layer_mobile/need/layer.css @@ -0,0 +1 @@ +.layui-m-layer{position:relative;z-index:19891014}.layui-m-layer *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.layui-m-layermain,.layui-m-layershade{position:fixed;left:0;top:0;width:100%;height:100%}.layui-m-layershade{background-color:rgba(0,0,0,.7);pointer-events:auto}.layui-m-layermain{display:table;font-family:Helvetica,arial,sans-serif;pointer-events:none}.layui-m-layermain .layui-m-layersection{display:table-cell;vertical-align:middle;text-align:center}.layui-m-layerchild{position:relative;display:inline-block;text-align:left;background-color:#fff;font-size:14px;border-radius:5px;box-shadow:0 0 8px rgba(0,0,0,.1);pointer-events:auto;-webkit-overflow-scrolling:touch;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.2s;animation-duration:.2s}@-webkit-keyframes layui-m-anim-scale{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes layui-m-anim-scale{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}.layui-m-anim-scale{animation-name:layui-m-anim-scale;-webkit-animation-name:layui-m-anim-scale}@-webkit-keyframes layui-m-anim-up{0%{opacity:0;-webkit-transform:translateY(800px);transform:translateY(800px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layui-m-anim-up{0%{opacity:0;-webkit-transform:translateY(800px);transform:translateY(800px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}.layui-m-anim-up{-webkit-animation-name:layui-m-anim-up;animation-name:layui-m-anim-up}.layui-m-layer0 .layui-m-layerchild{width:90%;max-width:640px}.layui-m-layer1 .layui-m-layerchild{border:none;border-radius:0}.layui-m-layer2 .layui-m-layerchild{width:auto;max-width:260px;min-width:40px;border:none;background:0 0;box-shadow:none;color:#fff}.layui-m-layerchild h3{padding:0 10px;height:60px;line-height:60px;font-size:16px;font-weight:400;border-radius:5px 5px 0 0;text-align:center}.layui-m-layerbtn span,.layui-m-layerchild h3{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-m-layercont{padding:50px 30px;line-height:22px;text-align:center}.layui-m-layer1 .layui-m-layercont{padding:0;text-align:left}.layui-m-layer2 .layui-m-layercont{text-align:center;padding:0;line-height:0}.layui-m-layer2 .layui-m-layercont i{width:25px;height:25px;margin-left:8px;display:inline-block;background-color:#fff;border-radius:100%;-webkit-animation:layui-m-anim-loading 1.4s infinite ease-in-out;animation:layui-m-anim-loading 1.4s infinite ease-in-out;-webkit-animation-fill-mode:both;animation-fill-mode:both}.layui-m-layerbtn,.layui-m-layerbtn span{position:relative;text-align:center;border-radius:0 0 5px 5px}.layui-m-layer2 .layui-m-layercont p{margin-top:20px}@-webkit-keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}@keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}.layui-m-layer2 .layui-m-layercont i:first-child{margin-left:0;-webkit-animation-delay:-.32s;animation-delay:-.32s}.layui-m-layer2 .layui-m-layercont i.layui-m-layerload{-webkit-animation-delay:-.16s;animation-delay:-.16s}.layui-m-layer2 .layui-m-layercont>div{line-height:22px;padding-top:7px;margin-bottom:20px;font-size:14px}.layui-m-layerbtn{display:box;display:-moz-box;display:-webkit-box;width:100%;height:50px;line-height:50px;font-size:0;border-top:1px solid #D0D0D0;background-color:#F2F2F2}.layui-m-layerbtn span{display:block;-moz-box-flex:1;box-flex:1;-webkit-box-flex:1;font-size:14px;cursor:pointer}.layui-m-layerbtn span[yes]{color:#40AFFE}.layui-m-layerbtn span[no]{border-right:1px solid #D0D0D0;border-radius:0 0 0 5px}.layui-m-layerbtn span:active{background-color:#F6F6F6}.layui-m-layerend{position:absolute;right:7px;top:10px;width:30px;height:30px;border:0;font-weight:400;background:0 0;cursor:pointer;-webkit-appearance:none;font-size:30px}.layui-m-layerend::after,.layui-m-layerend::before{position:absolute;left:5px;top:15px;content:'';width:18px;height:1px;background-color:#999;transform:rotate(45deg);-webkit-transform:rotate(45deg);border-radius:3px}.layui-m-layerend::after{transform:rotate(-45deg);-webkit-transform:rotate(-45deg)}body .layui-m-layer .layui-m-layer-footer{position:fixed;width:95%;max-width:100%;margin:0 auto;left:0;right:0;bottom:10px;background:0 0}.layui-m-layer-footer .layui-m-layercont{padding:20px;border-radius:5px 5px 0 0;background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn{display:block;height:auto;background:0 0;border-top:none}.layui-m-layer-footer .layui-m-layerbtn span{background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn span[no]{color:#FD482C;border-top:1px solid #c2c2c2;border-radius:0 0 5px 5px}.layui-m-layer-footer .layui-m-layerbtn span[yes]{margin-top:10px;border-radius:5px}body .layui-m-layer .layui-m-layer-msg{width:auto;max-width:90%;margin:0 auto;bottom:-150px;background-color:rgba(0,0,0,.7);color:#fff}.layui-m-layer-msg .layui-m-layercont{padding:10px 20px} \ No newline at end of file diff --git a/plugins/mobileSelect/mobileSelect.css b/plugins/mobileSelect/mobileSelect.css new file mode 100644 index 0000000..6ca1730 --- /dev/null +++ b/plugins/mobileSelect/mobileSelect.css @@ -0,0 +1,150 @@ +.mobileSelect { + position: relative; + z-index: 0; + opacity: 0; + visibility: hidden; + -webkit-transition: opacity 0.4s, z-index 0.4s; + transition: opacity 0.4s, z-index 0.4s; +} +.mobileSelect * { + margin: 0; + padding: 0; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} +.mobileSelect .grayLayer { + position: fixed; + top: 0; + left: 0; + bottom: 0; + right: 0; + background: #eee; + background: rgba(0, 0, 0, 0.7); + z-index: 888; + display: block; +} +.mobileSelect .content { + width: 100%; + display: block; + position: fixed; + z-index: 889; + color: black; + -webkit-transition: all 0.4s; + transition: all 0.4s; + bottom: -350px; + left: 0; + background: white; +} +.mobileSelect .content .fixWidth { + width: 90%; + margin: 0 auto; + position: relative; +} +.mobileSelect .content .fixWidth:after { + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; +} +.mobileSelect .content .btnBar { + border-bottom: 1px solid #DCDCDC; + font-size: 15px; + height: 45px; + position: relative; + text-align: center; + line-height: 45px; +} +.mobileSelect .content .btnBar .cancel, +.mobileSelect .content .btnBar .ensure { + height: 45px; + width: 55px; + cursor: pointer; + position: absolute; + top: 0; +} +.mobileSelect .content .btnBar .cancel { + left: 0; + color: #666; +} +.mobileSelect .content .btnBar .ensure { + right: 0; + color: #1e83d3; +} +.mobileSelect .content .btnBar .title { + font-size: 15px; + padding: 0 15%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} +.mobileSelect .content .panel:after { + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; +} +.mobileSelect .content .panel .wheels { + width: 100%; + height: 200px; + overflow: hidden; +} +.mobileSelect .content .panel .wheel { + position: relative; + z-index: 0; + float: left; + width: 50%; + height: 200px; + overflow: hidden; + -webkit-transition: width 0.3s ease; + transition: width 0.3s ease; +} +.mobileSelect .content .panel .wheel .selectContainer { + display: block; + text-align: center; + -webkit-transition: -webkit-transform 0.18s ease-out; + transition: -webkit-transform 0.18s ease-out; + transition: transform 0.18s ease-out; + transition: transform 0.18s ease-out, -webkit-transform 0.18s ease-out; +} +.mobileSelect .content .panel .wheel .selectContainer li { + font-size: 15px; + display: block; + height: 40px; + line-height: 40px; + cursor: pointer; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} +.mobileSelect .content .panel .selectLine { + height: 40px; + width: 100%; + position: absolute; + top: 80px; + pointer-events: none; + -webkit-box-sizing: border-box; + box-sizing: border-box; + border-top: 1px solid #DCDCDC; + border-bottom: 1px solid #DCDCDC; +} +.mobileSelect .content .panel .shadowMask { + position: absolute; + top: 0; + width: 100%; + height: 200px; + background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), color-stop(rgba(255, 255, 255, 0)), to(#ffffff)); + background: -webkit-linear-gradient(top, #ffffff, rgba(255, 255, 255, 0), #ffffff); + background: linear-gradient(to bottom, #ffffff, rgba(255, 255, 255, 0), #ffffff); + opacity: 0.9; + pointer-events: none; +} +.mobileSelect-show { + opacity: 1; + z-index: 10000; + visibility: visible; +} +.mobileSelect-show .content { + bottom: 0; +} diff --git a/plugins/mobileSelect/mobileSelect.js b/plugins/mobileSelect/mobileSelect.js new file mode 100644 index 0000000..d2b6d1f --- /dev/null +++ b/plugins/mobileSelect/mobileSelect.js @@ -0,0 +1,690 @@ +/*! + * mobileSelect.js + * (c) 2017-present onlyhom + * Released under the MIT License. + */ + +(function() { + function getClass(dom,string) { + return dom.getElementsByClassName(string); + } + //构造器 + function MobileSelect(config) { + this.mobileSelect; + this.wheelsData = config.wheels; + this.jsonType = false; + this.cascadeJsonData = []; + this.displayJson = []; + this.curValue = null; + this.curIndexArr = []; + this.cascade = false; + this.startY; + this.moveEndY; + this.moveY; + this.oldMoveY; + this.offset = 0; + this.offsetSum = 0; + this.oversizeBorder; + this.curDistance = []; + this.clickStatus = false; + this.isPC = true; + this.init(config); + } + MobileSelect.prototype = { + constructor: MobileSelect, + init: function(config){ + var _this = this; + _this.keyMap = config.keyMap ? config.keyMap : {id:'id', value:'value', childs:'childs'}; + _this.checkDataType(); + _this.renderWheels(_this.wheelsData, config.cancelBtnText, config.ensureBtnText); + _this.trigger = document.querySelector(config.trigger); + if(!_this.trigger){ + console.error('mobileSelect has been successfully installed, but no trigger found on your page.'); + return false; + } + _this.wheel = getClass(_this.mobileSelect,'wheel'); + _this.slider = getClass(_this.mobileSelect,'selectContainer'); + _this.wheels = _this.mobileSelect.querySelector('.wheels'); + _this.liHeight = _this.mobileSelect.querySelector('li').offsetHeight; + _this.ensureBtn = _this.mobileSelect.querySelector('.ensure'); + _this.cancelBtn = _this.mobileSelect.querySelector('.cancel'); + _this.grayLayer = _this.mobileSelect.querySelector('.grayLayer'); + _this.popUp = _this.mobileSelect.querySelector('.content'); + _this.callback = config.callback ? config.callback : function(){}; + _this.cancel = config.cancel ? config.cancel : function(){}; + _this.transitionEnd = config.transitionEnd ? config.transitionEnd : function(){}; + _this.initPosition = config.position ? config.position : []; + _this.titleText = config.title ? config.title : ''; + _this.connector = config.connector ? config.connector : ' '; + _this.triggerDisplayData = !(typeof(config.triggerDisplayData)=='undefined') ? config.triggerDisplayData : true; + _this.trigger.style.cursor='pointer'; + _this.setStyle(config); + _this.setTitle(_this.titleText); + _this.checkIsPC(); + _this.checkCascade(); + if (_this.cascade) { + _this.initCascade(); + } + //定位 初始位置 + if(_this.initPosition.length < _this.slider.length){ + var diff = _this.slider.length - _this.initPosition.length; + for(var i=0; i
'+ + '
'+ + '
'+ + '
'+ + '
'+ cancelText +'
'+ + '
'+ + '
'+ ensureText +'
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'; + document.body.appendChild(_this.mobileSelect); + + //根据数据长度来渲染 + + var tempHTML=''; + for(var i=0; i'+wheelsData[i].data[j][_this.keyMap.value]+''; + } + }else{ + for(var j=0; j'; + } + } + tempHTML += '
'; + } + _this.mobileSelect.querySelector('.wheels').innerHTML = tempHTML; + }, + + addListenerAll: function(){ + var _this = this; + for(var i=0; i<_this.slider.length; i++){ + //手势监听 + (function (i) { + _this.addListenerWheel(_this.wheel[i], i); + _this.addListenerLi(i); + })(i); + } + }, + + addListenerWheel: function(theWheel, index){ + var _this = this; + theWheel.addEventListener('touchstart', function () { + _this.touch(event, this.firstChild, index); + },false); + theWheel.addEventListener('touchend', function () { + _this.touch(event, this.firstChild, index); + },false); + theWheel.addEventListener('touchmove', function () { + _this.touch(event, this.firstChild, index); + },false); + + if(_this.isPC){ + //如果是PC端则再增加拖拽监听 方便调试 + theWheel.addEventListener('mousedown', function () { + _this.dragClick(event, this.firstChild, index); + },false); + theWheel.addEventListener('mousemove', function () { + _this.dragClick(event, this.firstChild, index); + },false); + theWheel.addEventListener('mouseup', function () { + _this.dragClick(event, this.firstChild, index); + },true); + } + }, + + addListenerLi:function(sliderIndex){ + var _this = this; + var curWheelLi = _this.slider[sliderIndex].getElementsByTagName('li'); + for(var j=0; j 0){ + _this.cascade = true; + _this.cascadeJsonData = _this.wheelsData[0].data; + break; + } + } + }else{ + _this.cascade = false; + } + }, + + generateArrData: function (targetArr) { + var tempArr = []; + var keyMap_id = this.keyMap.id; + var keyMap_value = this.keyMap.value; + for(var i=0; i0){ + _this.initDeepCount = 0; + _this.initCheckArrDeep(_this.cascadeJsonData[_this.initPosition[0]]); + }else{ + _this.checkArrDeep(_this.cascadeJsonData[0]); + } + _this.reRenderWheels(); + }, + + initCheckArrDeep: function (parent) { + var _this = this; + if(parent){ + if (_this.keyMap.childs in parent && parent[_this.keyMap.childs].length > 0) { + _this.displayJson.push(_this.generateArrData(parent[_this.keyMap.childs])); + _this.initDeepCount++; + var nextNode = parent[_this.keyMap.childs][_this.initPosition[_this.initDeepCount]]; + if(nextNode){ + _this.initCheckArrDeep(nextNode); + }else{ + _this.checkArrDeep(parent[_this.keyMap.childs][0]); + } + } + } + }, + + checkArrDeep: function (parent) { + //检测子节点深度 修改 displayJson + var _this = this; + if(parent){ + if (_this.keyMap.childs in parent && parent[_this.keyMap.childs].length > 0) { + _this.displayJson.push(_this.generateArrData(parent[_this.keyMap.childs])); //生成子节点数组 + _this.checkArrDeep(parent[_this.keyMap.childs][0]);//检测下一个子节点 + } + } + }, + + checkRange: function(index, posIndexArr){ + var _this = this; + var deleteNum = _this.displayJson.length-1-index; + for(var i=0; i posIndexArr.length){ + tempCount = _this.slider.length - posIndexArr.length; + for(var i=0; i _this.displayJson.length){ + var count = _this.wheel.length - _this.displayJson.length; + for(var i=0; i'+_this.displayJson[i][j][_this.keyMap.value]+''; + } + _this.slider[i].innerHTML = tempHTML; + + }else{ + var tempWheel = document.createElement("div"); + tempWheel.className = "wheel"; + tempHTML = '
    '; + for(var j=0; j<_this.displayJson[i].length; j++){ + //行 + tempHTML += '
  • '+_this.displayJson[i][j][_this.keyMap.value]+'
  • '; + } + tempHTML += '
'; + tempWheel.innerHTML = tempHTML; + + _this.addListenerWheel(tempWheel, i); + _this.wheels.appendChild(tempWheel); + } + _this.addListenerLi(i); + })(i); + } + }, + + updateWheels:function(data){ + var _this = this; + if(_this.cascade){ + _this.cascadeJsonData = data; + _this.displayJson = []; + _this.initCascade(); + if(_this.initPosition.length < _this.slider.length){ + var diff = _this.slider.length - _this.initPosition.length; + for(var i=0; i'+data[j][_this.keyMap.value]+''; + } + _this.wheelsData[sliderIndex] = {data: data}; + }else{ + for(var j=0; j'; + } + _this.wheelsData[sliderIndex] = data; + } + _this.slider[sliderIndex].innerHTML = tempHTML; + _this.addListenerLi(sliderIndex); + }, + + fixRowStyle: function(){ + var _this = this; + var width = (100/_this.wheel.length).toFixed(2); + for(var i=0; i<_this.wheel.length; i++){ + _this.wheel[i].style.width = width+'%'; + } + }, + + getIndex: function(distance){ + return Math.round((2*this.liHeight-distance)/this.liHeight); + }, + + getIndexArr: function(){ + var _this = this; + var temp = []; + for(var i=0; i<_this.curDistance.length; i++){ + temp.push(_this.getIndex(_this.curDistance[i])); + } + return temp; + }, + + getCurValue: function(){ + var _this = this; + var temp = []; + var positionArr = _this.getIndexArr(); + if(_this.cascade){ + for(var i=0; i<_this.wheel.length; i++){ + temp.push(_this.displayJson[i][positionArr[i]]); + } + } + else if(_this.jsonType){ + for(var i=0; i<_this.curDistance.length; i++){ + temp.push(_this.wheelsData[i].data[_this.getIndex(_this.curDistance[i])]); + } + }else{ + for(var i=0; i<_this.curDistance.length; i++){ + temp.push(_this.getInnerHtml(i)); + } + } + return temp; + }, + + getValue: function(){ + return this.curValue; + }, + + calcDistance: function(index){ + return 2*this.liHeight-index*this.liHeight; + }, + + setCurDistance: function(indexArr){ + var _this = this; + var temp = []; + for(var i=0; i<_this.slider.length; i++){ + temp.push(_this.calcDistance(indexArr[i])); + _this.movePosition(_this.slider[i],temp[i]); + } + _this.curDistance = temp; + }, + + fixPosition: function(distance){ + return -(this.getIndex(distance)-2)*this.liHeight; + }, + + movePosition: function(theSlider, distance){ + theSlider.style.webkitTransform = 'translate3d(0,' + distance + 'px, 0)'; + theSlider.style.transform = 'translate3d(0,' + distance + 'px, 0)'; + }, + + locatePosition: function(index, posIndex){ + this.curDistance[index] = this.calcDistance(posIndex); + this.movePosition(this.slider[index],this.curDistance[index]); + if(_this.cascade){ + _this.checkRange(index, _this.getIndexArr()); + } + }, + + updateCurDistance: function(theSlider, index){ + this.curDistance[index] = parseInt(theSlider.style.transform.split(',')[1]); + }, + + getDistance:function(theSlider){ + return parseInt(theSlider.style.transform.split(',')[1]); + }, + + getInnerHtml: function(sliderIndex){ + var _this = this; + var index = _this.getIndex(_this.curDistance[sliderIndex]); + return _this.slider[sliderIndex].getElementsByTagName('li')[index].innerHTML; + }, + + touch: function(event, theSlider, index){ + var _this = this; + event = event || window.event; + switch(event.type){ + case "touchstart": + _this.startY = event.touches[0].clientY; + _this.oldMoveY = _this.startY; + break; + + case "touchend": + + _this.moveEndY = event.changedTouches[0].clientY; + _this.offsetSum = _this.moveEndY - _this.startY; + + //修正位置 + _this.updateCurDistance(theSlider, index); + _this.curDistance[index] = _this.fixPosition(_this.curDistance[index]); + _this.movePosition(theSlider, _this.curDistance[index]); + _this.oversizeBorder = -(theSlider.getElementsByTagName('li').length-3)*_this.liHeight; + + + //反弹 + if(_this.curDistance[index] + _this.offsetSum > 2*_this.liHeight){ + _this.curDistance[index] = 2*_this.liHeight; + setTimeout(function(){ + _this.movePosition(theSlider, _this.curDistance[index]); + }, 100); + + }else if(_this.curDistance[index] + _this.offsetSum < _this.oversizeBorder){ + _this.curDistance[index] = _this.oversizeBorder; + setTimeout(function(){ + _this.movePosition(theSlider, _this.curDistance[index]); + }, 100); + } + + + _this.transitionEnd(_this.getIndexArr(),_this.getCurValue()); + + if(_this.cascade){ + _this.checkRange(index, _this.getIndexArr()); + } + + break; + + case "touchmove": + event.preventDefault(); + _this.moveY = event.touches[0].clientY; + _this.offset = _this.moveY - _this.oldMoveY; + + _this.updateCurDistance(theSlider, index); + _this.curDistance[index] = _this.curDistance[index] + _this.offset; + _this.movePosition(theSlider, _this.curDistance[index]); + _this.oldMoveY = _this.moveY; + break; + } + }, + + dragClick: function(event, theSlider, index){ + var _this = this; + event = event || window.event; + switch(event.type){ + case "mousedown": + _this.startY = event.clientY; + _this.oldMoveY = _this.startY; + _this.clickStatus = true; + break; + + case "mouseup": + + _this.moveEndY = event.clientY; + _this.offsetSum = _this.moveEndY - _this.startY; + + //修正位置 + _this.updateCurDistance(theSlider, index); + _this.curDistance[index] = _this.fixPosition(_this.curDistance[index]); + _this.movePosition(theSlider, _this.curDistance[index]); + _this.oversizeBorder = -(theSlider.getElementsByTagName('li').length-3)*_this.liHeight; + + + //反弹 + if(_this.curDistance[index] + _this.offsetSum > 2*_this.liHeight){ + _this.curDistance[index] = 2*_this.liHeight; + setTimeout(function(){ + _this.movePosition(theSlider, _this.curDistance[index]); + }, 100); + + }else if(_this.curDistance[index] + _this.offsetSum < _this.oversizeBorder){ + _this.curDistance[index] = _this.oversizeBorder; + setTimeout(function(){ + _this.movePosition(theSlider, _this.curDistance[index]); + }, 100); + } + + _this.clickStatus = false; + _this.transitionEnd(_this.getIndexArr(),_this.getCurValue()); + if(_this.cascade){ + _this.checkRange(index, _this.getIndexArr()); + } + break; + + case "mousemove": + event.preventDefault(); + if(_this.clickStatus){ + _this.moveY = event.clientY; + _this.offset = _this.moveY - _this.oldMoveY; + _this.updateCurDistance(theSlider, index); + _this.curDistance[index] = _this.curDistance[index] + _this.offset; + _this.movePosition(theSlider, _this.curDistance[index]); + _this.oldMoveY = _this.moveY; + } + break; + } + }, + + singleClick: function(theLi, index, sliderIndex){ + var _this = this; + if(_this.cascade){ + var tempPosArr = _this.getIndexArr(); + tempPosArr[sliderIndex] = index; + _this.checkRange(sliderIndex, tempPosArr); + + }else{ + _this.curDistance[sliderIndex] = (2-index)*_this.liHeight; + _this.movePosition(theLi.parentNode, _this.curDistance[sliderIndex]); + } + } + + }; + + if (typeof exports == "object") { + module.exports = MobileSelect; + } else if (typeof define == "function" && define.amd) { + define([], function () { + return MobileSelect; + }) + } else { + window.MobileSelect = MobileSelect; + } +})(); diff --git a/plugins/myflow.js b/plugins/myflow.js new file mode 100644 index 0000000..f7d61b7 --- /dev/null +++ b/plugins/myflow.js @@ -0,0 +1,63 @@ +(function($) { + $.fn.myflow = function(options) { + var defaults = { + url: '', + type: 'post', + data: {}, + clearlist: false, + colspan: 4, + template: function(data) { + console.log(data); + return "
请添加模板!
"; + }, + dataArr: function(data) { + return data; + } + }; + var val = $.extend(defaults, options); + //生成子列 + if(this.children().length == 0) { + var thisHtml = ''; + for(i = 0; i < val.colspan; i++) { + thisHtml += "
"; + } + this.addClass("clearfix"); + this.html(thisHtml).children().css({ + "width": 10 / val.colspan * 10 + "%", + "float": "left" + }); + } + if(val.clearlist) { + this.children().html(""); + } + //获取数据 + var children = this.children(); + $.ajax({ + url: val.url, + type: val.post, + data: val.data, + dataType: "json", + success: function(data) { + var newData = val.dataArr(data); + console.log(newData) + for(i = 0; i < newData.length; i++) { + var heightArr = []; + children.each(function() { + heightArr.push($(this).height()); + }); + var index = heightArr.indexOf(Math.min.apply(null, heightArr)); + var items = $(val.template(newData[i])).css({ + 'opacity': '0' + }) + children.eq(index).append(items); + items.animate({ + 'opacity': '1' + }); + } + }, + error: function(XMLHttpRequest, textStatus, errorThrown) { + console.log(XMLHttpRequest.status + "" + XMLHttpRequest.readyState + "" + errorThrown); + } + }); + }; +})(window.Zepto || window.jQuery); \ No newline at end of file diff --git a/plugins/noUiSlider.10.0.0/nouislider.css b/plugins/noUiSlider.10.0.0/nouislider.css new file mode 100644 index 0000000..97a96f0 --- /dev/null +++ b/plugins/noUiSlider.10.0.0/nouislider.css @@ -0,0 +1,260 @@ +/*! nouislider - 10.0.0 - 2017-05-28 14:52:48 */ +/* Functional styling; + * These styles are required for noUiSlider to function. + * You don't need to change these rules to apply your design. + */ +.noUi-target, +.noUi-target * { + -webkit-touch-callout: none; + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); + -webkit-user-select: none; + -ms-touch-action: none; + touch-action: none; + -ms-user-select: none; + -moz-user-select: none; + user-select: none; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.noUi-target { + position: relative; + direction: ltr; +} +.noUi-base { + width: 100%; + height: 100%; + position: relative; + z-index: 1; + /* Fix 401 */ +} +.noUi-connect { + position: absolute; + right: 0; + top: 0; + left: 0; + bottom: 0; +} +.noUi-origin { + position: absolute; + height: 0; + width: 0; +} +.noUi-handle { + position: relative; + z-index: 1; +} +.noUi-state-tap .noUi-connect, +.noUi-state-tap .noUi-origin { + -webkit-transition: top 0.3s, right 0.3s, bottom 0.3s, left 0.3s; + transition: top 0.3s, right 0.3s, bottom 0.3s, left 0.3s; +} +.noUi-state-drag * { + cursor: inherit !important; +} +/* Painting and performance; + * Browsers can paint handles in their own layer. + */ +.noUi-base, +.noUi-handle { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); +} +/* Slider size and handle placement; + */ +.noUi-horizontal { + height: 18px; +} +.noUi-horizontal .noUi-handle { + width: 34px; + height: 28px; + left: -17px; + top: -6px; +} +.noUi-vertical { + width: 18px; +} +.noUi-vertical .noUi-handle { + width: 28px; + height: 34px; + left: -6px; + top: -17px; +} +/* Styling; + */ +.noUi-target { + background: #FAFAFA; + border-radius: 4px; + border: 1px solid #D3D3D3; + box-shadow: inset 0 1px 1px #F0F0F0, 0 3px 6px -5px #BBB; +} +.noUi-connect { + background: #3FB8AF; + border-radius: 4px; + box-shadow: inset 0 0 3px rgba(51, 51, 51, 0.45); + -webkit-transition: background 450ms; + transition: background 450ms; +} +/* Handles and cursors; + */ +.noUi-draggable { + cursor: ew-resize; +} +.noUi-vertical .noUi-draggable { + cursor: ns-resize; +} +.noUi-handle { + border: 1px solid #D9D9D9; + border-radius: 3px; + background: #FFF; + cursor: default; + box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #EBEBEB, 0 3px 6px -3px #BBB; +} +.noUi-active { + box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #DDD, 0 3px 6px -3px #BBB; +} +/* Handle stripes; + */ +.noUi-handle:before, +.noUi-handle:after { + content: ""; + display: block; + position: absolute; + height: 14px; + width: 1px; + background: #E8E7E6; + left: 14px; + top: 6px; +} +.noUi-handle:after { + left: 17px; +} +.noUi-vertical .noUi-handle:before, +.noUi-vertical .noUi-handle:after { + width: 14px; + height: 1px; + left: 6px; + top: 14px; +} +.noUi-vertical .noUi-handle:after { + top: 17px; +} +/* Disabled state; + */ +[disabled] .noUi-connect { + background: #B8B8B8; +} +[disabled].noUi-target, +[disabled].noUi-handle, +[disabled] .noUi-handle { + cursor: not-allowed; +} +/* Base; + * + */ +.noUi-pips, +.noUi-pips * { + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.noUi-pips { + position: absolute; + color: #999; +} +/* Values; + * + */ +.noUi-value { + position: absolute; + white-space: nowrap; + text-align: center; +} +.noUi-value-sub { + color: #ccc; + font-size: 10px; +} +/* Markings; + * + */ +.noUi-marker { + position: absolute; + background: #CCC; +} +.noUi-marker-sub { + background: #AAA; +} +.noUi-marker-large { + background: #AAA; +} +/* Horizontal layout; + * + */ +.noUi-pips-horizontal { + padding: 10px 0; + height: 80px; + top: 100%; + left: 0; + width: 100%; +} +.noUi-value-horizontal { + -webkit-transform: translate3d(-50%, 50%, 0); + transform: translate3d(-50%, 50%, 0); +} +.noUi-marker-horizontal.noUi-marker { + margin-left: -1px; + width: 2px; + height: 5px; +} +.noUi-marker-horizontal.noUi-marker-sub { + height: 10px; +} +.noUi-marker-horizontal.noUi-marker-large { + height: 15px; +} +/* Vertical layout; + * + */ +.noUi-pips-vertical { + padding: 0 10px; + height: 100%; + top: 0; + left: 100%; +} +.noUi-value-vertical { + -webkit-transform: translate3d(0, 50%, 0); + transform: translate3d(0, 50%, 0); + padding-left: 25px; +} +.noUi-marker-vertical.noUi-marker { + width: 5px; + height: 2px; + margin-top: -1px; +} +.noUi-marker-vertical.noUi-marker-sub { + width: 10px; +} +.noUi-marker-vertical.noUi-marker-large { + width: 15px; +} +.noUi-tooltip { + display: block; + position: absolute; + border: 1px solid #D9D9D9; + border-radius: 3px; + background: #fff; + color: #000; + padding: 5px; + text-align: center; + white-space: nowrap; +} +.noUi-horizontal .noUi-tooltip { + -webkit-transform: translate(-50%, 0); + transform: translate(-50%, 0); + left: 50%; + bottom: 120%; +} +.noUi-vertical .noUi-tooltip { + -webkit-transform: translate(0, -50%); + transform: translate(0, -50%); + top: 50%; + right: 120%; +} diff --git a/plugins/noUiSlider.10.0.0/nouislider.js b/plugins/noUiSlider.10.0.0/nouislider.js new file mode 100644 index 0000000..f282fac --- /dev/null +++ b/plugins/noUiSlider.10.0.0/nouislider.js @@ -0,0 +1,2256 @@ +/*! nouislider - 10.0.0 - 2017-05-28 14:52:48 */ + +(function (factory) { + + if ( typeof define === 'function' && define.amd ) { + + // AMD. Register as an anonymous module. + define([], factory); + + } else if ( typeof exports === 'object' ) { + + // Node/CommonJS + module.exports = factory(); + + } else { + + // Browser globals + window.noUiSlider = factory(); + } + +}(function( ){ + + 'use strict'; + + var VERSION = '10.0.0'; + + + function isValidFormatter ( entry ) { + return typeof entry === 'object' && typeof entry.to === 'function' && typeof entry.from === 'function'; + } + + function removeElement ( el ) { + el.parentElement.removeChild(el); + } + + // Bindable version + function preventDefault ( e ) { + e.preventDefault(); + } + + // Removes duplicates from an array. + function unique ( array ) { + return array.filter(function(a){ + return !this[a] ? this[a] = true : false; + }, {}); + } + + // Round a value to the closest 'to'. + function closest ( value, to ) { + return Math.round(value / to) * to; + } + + // Current position of an element relative to the document. + function offset ( elem, orientation ) { + + var rect = elem.getBoundingClientRect(); + var doc = elem.ownerDocument; + var docElem = doc.documentElement; + var pageOffset = getPageOffset(doc); + + // getBoundingClientRect contains left scroll in Chrome on Android. + // I haven't found a feature detection that proves this. Worst case + // scenario on mis-match: the 'tap' feature on horizontal sliders breaks. + if ( /webkit.*Chrome.*Mobile/i.test(navigator.userAgent) ) { + pageOffset.x = 0; + } + + return orientation ? (rect.top + pageOffset.y - docElem.clientTop) : (rect.left + pageOffset.x - docElem.clientLeft); + } + + // Checks whether a value is numerical. + function isNumeric ( a ) { + return typeof a === 'number' && !isNaN( a ) && isFinite( a ); + } + + // Sets a class and removes it after [duration] ms. + function addClassFor ( element, className, duration ) { + if (duration > 0) { + addClass(element, className); + setTimeout(function(){ + removeClass(element, className); + }, duration); + } + } + + // Limits a value to 0 - 100 + function limit ( a ) { + return Math.max(Math.min(a, 100), 0); + } + + // Wraps a variable as an array, if it isn't one yet. + // Note that an input array is returned by reference! + function asArray ( a ) { + return Array.isArray(a) ? a : [a]; + } + + // Counts decimals + function countDecimals ( numStr ) { + numStr = String(numStr); + var pieces = numStr.split("."); + return pieces.length > 1 ? pieces[1].length : 0; + } + + // http://youmightnotneedjquery.com/#add_class + function addClass ( el, className ) { + if ( el.classList ) { + el.classList.add(className); + } else { + el.className += ' ' + className; + } + } + + // http://youmightnotneedjquery.com/#remove_class + function removeClass ( el, className ) { + if ( el.classList ) { + el.classList.remove(className); + } else { + el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' '); + } + } + + // https://plainjs.com/javascript/attributes/adding-removing-and-testing-for-classes-9/ + function hasClass ( el, className ) { + return el.classList ? el.classList.contains(className) : new RegExp('\\b' + className + '\\b').test(el.className); + } + + // https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY#Notes + function getPageOffset ( doc ) { + + var supportPageOffset = window.pageXOffset !== undefined; + var isCSS1Compat = ((doc.compatMode || "") === "CSS1Compat"); + var x = supportPageOffset ? window.pageXOffset : isCSS1Compat ? doc.documentElement.scrollLeft : doc.body.scrollLeft; + var y = supportPageOffset ? window.pageYOffset : isCSS1Compat ? doc.documentElement.scrollTop : doc.body.scrollTop; + + return { + x: x, + y: y + }; + } + + // we provide a function to compute constants instead + // of accessing window.* as soon as the module needs it + // so that we do not compute anything if not needed + function getActions ( ) { + + // Determine the events to bind. IE11 implements pointerEvents without + // a prefix, which breaks compatibility with the IE10 implementation. + return window.navigator.pointerEnabled ? { + start: 'pointerdown', + move: 'pointermove', + end: 'pointerup' + } : window.navigator.msPointerEnabled ? { + start: 'MSPointerDown', + move: 'MSPointerMove', + end: 'MSPointerUp' + } : { + start: 'mousedown touchstart', + move: 'mousemove touchmove', + end: 'mouseup touchend' + }; + } + + // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md + // Issue #785 + function getSupportsPassive ( ) { + + var supportsPassive = false; + + try { + + var opts = Object.defineProperty({}, 'passive', { + get: function() { + supportsPassive = true; + } + }); + + window.addEventListener('test', null, opts); + + } catch (e) {} + + return supportsPassive; + } + + function getSupportsTouchActionNone ( ) { + return window.CSS && CSS.supports && CSS.supports('touch-action', 'none'); + } + + +// Value calculation + + // Determine the size of a sub-range in relation to a full range. + function subRangeRatio ( pa, pb ) { + return (100 / (pb - pa)); + } + + // (percentage) How many percent is this value of this range? + function fromPercentage ( range, value ) { + return (value * 100) / ( range[1] - range[0] ); + } + + // (percentage) Where is this value on this range? + function toPercentage ( range, value ) { + return fromPercentage( range, range[0] < 0 ? + value + Math.abs(range[0]) : + value - range[0] ); + } + + // (value) How much is this percentage on this range? + function isPercentage ( range, value ) { + return ((value * ( range[1] - range[0] )) / 100) + range[0]; + } + + +// Range conversion + + function getJ ( value, arr ) { + + var j = 1; + + while ( value >= arr[j] ){ + j += 1; + } + + return j; + } + + // (percentage) Input a value, find where, on a scale of 0-100, it applies. + function toStepping ( xVal, xPct, value ) { + + if ( value >= xVal.slice(-1)[0] ){ + return 100; + } + + var j = getJ( value, xVal ), va, vb, pa, pb; + + va = xVal[j-1]; + vb = xVal[j]; + pa = xPct[j-1]; + pb = xPct[j]; + + return pa + (toPercentage([va, vb], value) / subRangeRatio (pa, pb)); + } + + // (value) Input a percentage, find where it is on the specified range. + function fromStepping ( xVal, xPct, value ) { + + // There is no range group that fits 100 + if ( value >= 100 ){ + return xVal.slice(-1)[0]; + } + + var j = getJ( value, xPct ), va, vb, pa, pb; + + va = xVal[j-1]; + vb = xVal[j]; + pa = xPct[j-1]; + pb = xPct[j]; + + return isPercentage([va, vb], (value - pa) * subRangeRatio (pa, pb)); + } + + // (percentage) Get the step that applies at a certain value. + function getStep ( xPct, xSteps, snap, value ) { + + if ( value === 100 ) { + return value; + } + + var j = getJ( value, xPct ), a, b; + + // If 'snap' is set, steps are used as fixed points on the slider. + if ( snap ) { + + a = xPct[j-1]; + b = xPct[j]; + + // Find the closest position, a or b. + if ((value - a) > ((b-a)/2)){ + return b; + } + + return a; + } + + if ( !xSteps[j-1] ){ + return value; + } + + return xPct[j-1] + closest( + value - xPct[j-1], + xSteps[j-1] + ); + } + + +// Entry parsing + + function handleEntryPoint ( index, value, that ) { + + var percentage; + + // Wrap numerical input in an array. + if ( typeof value === "number" ) { + value = [value]; + } + + // Reject any invalid input, by testing whether value is an array. + if ( Object.prototype.toString.call( value ) !== '[object Array]' ){ + throw new Error("noUiSlider (" + VERSION + "): 'range' contains invalid value."); + } + + // Covert min/max syntax to 0 and 100. + if ( index === 'min' ) { + percentage = 0; + } else if ( index === 'max' ) { + percentage = 100; + } else { + percentage = parseFloat( index ); + } + + // Check for correct input. + if ( !isNumeric( percentage ) || !isNumeric( value[0] ) ) { + throw new Error("noUiSlider (" + VERSION + "): 'range' value isn't numeric."); + } + + // Store values. + that.xPct.push( percentage ); + that.xVal.push( value[0] ); + + // NaN will evaluate to false too, but to keep + // logging clear, set step explicitly. Make sure + // not to override the 'step' setting with false. + if ( !percentage ) { + if ( !isNaN( value[1] ) ) { + that.xSteps[0] = value[1]; + } + } else { + that.xSteps.push( isNaN(value[1]) ? false : value[1] ); + } + + that.xHighestCompleteStep.push(0); + } + + function handleStepPoint ( i, n, that ) { + + // Ignore 'false' stepping. + if ( !n ) { + return true; + } + + // Factor to range ratio + that.xSteps[i] = fromPercentage([ + that.xVal[i] + ,that.xVal[i+1] + ], n) / subRangeRatio ( + that.xPct[i], + that.xPct[i+1] ); + + var totalSteps = (that.xVal[i+1] - that.xVal[i]) / that.xNumSteps[i]; + var highestStep = Math.ceil(Number(totalSteps.toFixed(3)) - 1); + var step = that.xVal[i] + (that.xNumSteps[i] * highestStep); + + that.xHighestCompleteStep[i] = step; + } + + +// Interface + + function Spectrum ( entry, snap, singleStep ) { + + this.xPct = []; + this.xVal = []; + this.xSteps = [ singleStep || false ]; + this.xNumSteps = [ false ]; + this.xHighestCompleteStep = []; + + this.snap = snap; + + var index, ordered = [ /* [0, 'min'], [1, '50%'], [2, 'max'] */ ]; + + // Map the object keys to an array. + for ( index in entry ) { + if ( entry.hasOwnProperty(index) ) { + ordered.push([entry[index], index]); + } + } + + // Sort all entries by value (numeric sort). + if ( ordered.length && typeof ordered[0][0] === "object" ) { + ordered.sort(function(a, b) { return a[0][0] - b[0][0]; }); + } else { + ordered.sort(function(a, b) { return a[0] - b[0]; }); + } + + + // Convert all entries to subranges. + for ( index = 0; index < ordered.length; index++ ) { + handleEntryPoint(ordered[index][1], ordered[index][0], this); + } + + // Store the actual step values. + // xSteps is sorted in the same order as xPct and xVal. + this.xNumSteps = this.xSteps.slice(0); + + // Convert all numeric steps to the percentage of the subrange they represent. + for ( index = 0; index < this.xNumSteps.length; index++ ) { + handleStepPoint(index, this.xNumSteps[index], this); + } + } + + Spectrum.prototype.getMargin = function ( value ) { + + var step = this.xNumSteps[0]; + + if ( step && ((value / step) % 1) !== 0 ) { + throw new Error("noUiSlider (" + VERSION + "): 'limit', 'margin' and 'padding' must be divisible by step."); + } + + return this.xPct.length === 2 ? fromPercentage(this.xVal, value) : false; + }; + + Spectrum.prototype.toStepping = function ( value ) { + + value = toStepping( this.xVal, this.xPct, value ); + + return value; + }; + + Spectrum.prototype.fromStepping = function ( value ) { + + return fromStepping( this.xVal, this.xPct, value ); + }; + + Spectrum.prototype.getStep = function ( value ) { + + value = getStep(this.xPct, this.xSteps, this.snap, value ); + + return value; + }; + + Spectrum.prototype.getNearbySteps = function ( value ) { + + var j = getJ(value, this.xPct); + + return { + stepBefore: { startValue: this.xVal[j-2], step: this.xNumSteps[j-2], highestStep: this.xHighestCompleteStep[j-2] }, + thisStep: { startValue: this.xVal[j-1], step: this.xNumSteps[j-1], highestStep: this.xHighestCompleteStep[j-1] }, + stepAfter: { startValue: this.xVal[j-0], step: this.xNumSteps[j-0], highestStep: this.xHighestCompleteStep[j-0] } + }; + }; + + Spectrum.prototype.countStepDecimals = function () { + var stepDecimals = this.xNumSteps.map(countDecimals); + return Math.max.apply(null, stepDecimals); + }; + + // Outside testing + Spectrum.prototype.convert = function ( value ) { + return this.getStep(this.toStepping(value)); + }; + +/* Every input option is tested and parsed. This'll prevent + endless validation in internal methods. These tests are + structured with an item for every option available. An + option can be marked as required by setting the 'r' flag. + The testing function is provided with three arguments: + - The provided value for the option; + - A reference to the options object; + - The name for the option; + + The testing function returns false when an error is detected, + or true when everything is OK. It can also modify the option + object, to make sure all values can be correctly looped elsewhere. */ + + var defaultFormatter = { 'to': function( value ){ + return value !== undefined && value.toFixed(2); + }, 'from': Number }; + + function validateFormat ( entry ) { + + // Any object with a to and from method is supported. + if ( isValidFormatter(entry) ) { + return true; + } + + throw new Error("noUiSlider (" + VERSION + "): 'format' requires 'to' and 'from' methods."); + } + + function testStep ( parsed, entry ) { + + if ( !isNumeric( entry ) ) { + throw new Error("noUiSlider (" + VERSION + "): 'step' is not numeric."); + } + + // The step option can still be used to set stepping + // for linear sliders. Overwritten if set in 'range'. + parsed.singleStep = entry; + } + + function testRange ( parsed, entry ) { + + // Filter incorrect input. + if ( typeof entry !== 'object' || Array.isArray(entry) ) { + throw new Error("noUiSlider (" + VERSION + "): 'range' is not an object."); + } + + // Catch missing start or end. + if ( entry.min === undefined || entry.max === undefined ) { + throw new Error("noUiSlider (" + VERSION + "): Missing 'min' or 'max' in 'range'."); + } + + // Catch equal start or end. + if ( entry.min === entry.max ) { + throw new Error("noUiSlider (" + VERSION + "): 'range' 'min' and 'max' cannot be equal."); + } + + parsed.spectrum = new Spectrum(entry, parsed.snap, parsed.singleStep); + } + + function testStart ( parsed, entry ) { + + entry = asArray(entry); + + // Validate input. Values aren't tested, as the public .val method + // will always provide a valid location. + if ( !Array.isArray( entry ) || !entry.length ) { + throw new Error("noUiSlider (" + VERSION + "): 'start' option is incorrect."); + } + + // Store the number of handles. + parsed.handles = entry.length; + + // When the slider is initialized, the .val method will + // be called with the start options. + parsed.start = entry; + } + + function testSnap ( parsed, entry ) { + + // Enforce 100% stepping within subranges. + parsed.snap = entry; + + if ( typeof entry !== 'boolean' ){ + throw new Error("noUiSlider (" + VERSION + "): 'snap' option must be a boolean."); + } + } + + function testAnimate ( parsed, entry ) { + + // Enforce 100% stepping within subranges. + parsed.animate = entry; + + if ( typeof entry !== 'boolean' ){ + throw new Error("noUiSlider (" + VERSION + "): 'animate' option must be a boolean."); + } + } + + function testAnimationDuration ( parsed, entry ) { + + parsed.animationDuration = entry; + + if ( typeof entry !== 'number' ){ + throw new Error("noUiSlider (" + VERSION + "): 'animationDuration' option must be a number."); + } + } + + function testConnect ( parsed, entry ) { + + var connect = [false]; + var i; + + // Map legacy options + if ( entry === 'lower' ) { + entry = [true, false]; + } + + else if ( entry === 'upper' ) { + entry = [false, true]; + } + + // Handle boolean options + if ( entry === true || entry === false ) { + + for ( i = 1; i < parsed.handles; i++ ) { + connect.push(entry); + } + + connect.push(false); + } + + // Reject invalid input + else if ( !Array.isArray( entry ) || !entry.length || entry.length !== parsed.handles + 1 ) { + throw new Error("noUiSlider (" + VERSION + "): 'connect' option doesn't match handle count."); + } + + else { + connect = entry; + } + + parsed.connect = connect; + } + + function testOrientation ( parsed, entry ) { + + // Set orientation to an a numerical value for easy + // array selection. + switch ( entry ){ + case 'horizontal': + parsed.ort = 0; + break; + case 'vertical': + parsed.ort = 1; + break; + default: + throw new Error("noUiSlider (" + VERSION + "): 'orientation' option is invalid."); + } + } + + function testMargin ( parsed, entry ) { + + if ( !isNumeric(entry) ){ + throw new Error("noUiSlider (" + VERSION + "): 'margin' option must be numeric."); + } + + // Issue #582 + if ( entry === 0 ) { + return; + } + + parsed.margin = parsed.spectrum.getMargin(entry); + + if ( !parsed.margin ) { + throw new Error("noUiSlider (" + VERSION + "): 'margin' option is only supported on linear sliders."); + } + } + + function testLimit ( parsed, entry ) { + + if ( !isNumeric(entry) ){ + throw new Error("noUiSlider (" + VERSION + "): 'limit' option must be numeric."); + } + + parsed.limit = parsed.spectrum.getMargin(entry); + + if ( !parsed.limit || parsed.handles < 2 ) { + throw new Error("noUiSlider (" + VERSION + "): 'limit' option is only supported on linear sliders with 2 or more handles."); + } + } + + function testPadding ( parsed, entry ) { + + if ( !isNumeric(entry) ){ + throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be numeric."); + } + + if ( entry === 0 ) { + return; + } + + parsed.padding = parsed.spectrum.getMargin(entry); + + if ( !parsed.padding ) { + throw new Error("noUiSlider (" + VERSION + "): 'padding' option is only supported on linear sliders."); + } + + if ( parsed.padding < 0 ) { + throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be a positive number."); + } + + if ( parsed.padding >= 50 ) { + throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be less than half the range."); + } + } + + function testDirection ( parsed, entry ) { + + // Set direction as a numerical value for easy parsing. + // Invert connection for RTL sliders, so that the proper + // handles get the connect/background classes. + switch ( entry ) { + case 'ltr': + parsed.dir = 0; + break; + case 'rtl': + parsed.dir = 1; + break; + default: + throw new Error("noUiSlider (" + VERSION + "): 'direction' option was not recognized."); + } + } + + function testBehaviour ( parsed, entry ) { + + // Make sure the input is a string. + if ( typeof entry !== 'string' ) { + throw new Error("noUiSlider (" + VERSION + "): 'behaviour' must be a string containing options."); + } + + // Check if the string contains any keywords. + // None are required. + var tap = entry.indexOf('tap') >= 0; + var drag = entry.indexOf('drag') >= 0; + var fixed = entry.indexOf('fixed') >= 0; + var snap = entry.indexOf('snap') >= 0; + var hover = entry.indexOf('hover') >= 0; + + if ( fixed ) { + + if ( parsed.handles !== 2 ) { + throw new Error("noUiSlider (" + VERSION + "): 'fixed' behaviour must be used with 2 handles"); + } + + // Use margin to enforce fixed state + testMargin(parsed, parsed.start[1] - parsed.start[0]); + } + + parsed.events = { + tap: tap || snap, + drag: drag, + fixed: fixed, + snap: snap, + hover: hover + }; + } + + function testTooltips ( parsed, entry ) { + + if ( entry === false ) { + return; + } + + else if ( entry === true ) { + + parsed.tooltips = []; + + for ( var i = 0; i < parsed.handles; i++ ) { + parsed.tooltips.push(true); + } + } + + else { + + parsed.tooltips = asArray(entry); + + if ( parsed.tooltips.length !== parsed.handles ) { + throw new Error("noUiSlider (" + VERSION + "): must pass a formatter for all handles."); + } + + parsed.tooltips.forEach(function(formatter){ + if ( typeof formatter !== 'boolean' && (typeof formatter !== 'object' || typeof formatter.to !== 'function') ) { + throw new Error("noUiSlider (" + VERSION + "): 'tooltips' must be passed a formatter or 'false'."); + } + }); + } + } + + function testAriaFormat ( parsed, entry ) { + parsed.ariaFormat = entry; + validateFormat(entry); + } + + function testFormat ( parsed, entry ) { + parsed.format = entry; + validateFormat(entry); + } + + function testCssPrefix ( parsed, entry ) { + + if ( entry !== undefined && typeof entry !== 'string' && entry !== false ) { + throw new Error("noUiSlider (" + VERSION + "): 'cssPrefix' must be a string or `false`."); + } + + parsed.cssPrefix = entry; + } + + function testCssClasses ( parsed, entry ) { + + if ( entry !== undefined && typeof entry !== 'object' ) { + throw new Error("noUiSlider (" + VERSION + "): 'cssClasses' must be an object."); + } + + if ( typeof parsed.cssPrefix === 'string' ) { + parsed.cssClasses = {}; + + for ( var key in entry ) { + if ( !entry.hasOwnProperty(key) ) { continue; } + + parsed.cssClasses[key] = parsed.cssPrefix + entry[key]; + } + } else { + parsed.cssClasses = entry; + } + } + + function testUseRaf ( parsed, entry ) { + if ( entry === true || entry === false ) { + parsed.useRequestAnimationFrame = entry; + } else { + throw new Error("noUiSlider (" + VERSION + "): 'useRequestAnimationFrame' option should be true (default) or false."); + } + } + + // Test all developer settings and parse to assumption-safe values. + function testOptions ( options ) { + + // To prove a fix for #537, freeze options here. + // If the object is modified, an error will be thrown. + // Object.freeze(options); + + var parsed = { + margin: 0, + limit: 0, + padding: 0, + animate: true, + animationDuration: 300, + ariaFormat: defaultFormatter, + format: defaultFormatter + }; + + // Tests are executed in the order they are presented here. + var tests = { + 'step': { r: false, t: testStep }, + 'start': { r: true, t: testStart }, + 'connect': { r: true, t: testConnect }, + 'direction': { r: true, t: testDirection }, + 'snap': { r: false, t: testSnap }, + 'animate': { r: false, t: testAnimate }, + 'animationDuration': { r: false, t: testAnimationDuration }, + 'range': { r: true, t: testRange }, + 'orientation': { r: false, t: testOrientation }, + 'margin': { r: false, t: testMargin }, + 'limit': { r: false, t: testLimit }, + 'padding': { r: false, t: testPadding }, + 'behaviour': { r: true, t: testBehaviour }, + 'ariaFormat': { r: false, t: testAriaFormat }, + 'format': { r: false, t: testFormat }, + 'tooltips': { r: false, t: testTooltips }, + 'cssPrefix': { r: false, t: testCssPrefix }, + 'cssClasses': { r: false, t: testCssClasses }, + 'useRequestAnimationFrame': { r: false, t: testUseRaf } + }; + + var defaults = { + 'connect': false, + 'direction': 'ltr', + 'behaviour': 'tap', + 'orientation': 'horizontal', + 'cssPrefix' : 'noUi-', + 'cssClasses': { + target: 'target', + base: 'base', + origin: 'origin', + handle: 'handle', + handleLower: 'handle-lower', + handleUpper: 'handle-upper', + horizontal: 'horizontal', + vertical: 'vertical', + background: 'background', + connect: 'connect', + ltr: 'ltr', + rtl: 'rtl', + draggable: 'draggable', + drag: 'state-drag', + tap: 'state-tap', + active: 'active', + tooltip: 'tooltip', + pips: 'pips', + pipsHorizontal: 'pips-horizontal', + pipsVertical: 'pips-vertical', + marker: 'marker', + markerHorizontal: 'marker-horizontal', + markerVertical: 'marker-vertical', + markerNormal: 'marker-normal', + markerLarge: 'marker-large', + markerSub: 'marker-sub', + value: 'value', + valueHorizontal: 'value-horizontal', + valueVertical: 'value-vertical', + valueNormal: 'value-normal', + valueLarge: 'value-large', + valueSub: 'value-sub' + }, + 'useRequestAnimationFrame': true + }; + + // AriaFormat defaults to regular format, if any. + if ( options.format && !options.ariaFormat ) { + options.ariaFormat = options.format; + } + + // Run all options through a testing mechanism to ensure correct + // input. It should be noted that options might get modified to + // be handled properly. E.g. wrapping integers in arrays. + Object.keys(tests).forEach(function( name ){ + + // If the option isn't set, but it is required, throw an error. + if ( options[name] === undefined && defaults[name] === undefined ) { + + if ( tests[name].r ) { + throw new Error("noUiSlider (" + VERSION + "): '" + name + "' is required."); + } + + return true; + } + + tests[name].t( parsed, options[name] === undefined ? defaults[name] : options[name] ); + }); + + // Forward pips options + parsed.pips = options.pips; + + var styles = [['left', 'top'], ['right', 'bottom']]; + + // Pre-define the styles. + parsed.style = styles[parsed.dir][parsed.ort]; + parsed.styleOposite = styles[parsed.dir?0:1][parsed.ort]; + + return parsed; + } + + +function closure ( target, options, originalOptions ){ + + var actions = getActions(); + var supportsTouchActionNone = getSupportsTouchActionNone(); + var supportsPassive = supportsTouchActionNone && getSupportsPassive(); + + // All variables local to 'closure' are prefixed with 'scope_' + var scope_Target = target; + var scope_Locations = []; + var scope_Base; + var scope_Handles; + var scope_HandleNumbers = []; + var scope_ActiveHandle = false; + var scope_Connects; + var scope_Spectrum = options.spectrum; + var scope_Values = []; + var scope_Events = {}; + var scope_Self; + var scope_Pips; + var scope_Listeners = null; + var scope_Document = target.ownerDocument; + var scope_DocumentElement = scope_Document.documentElement; + var scope_Body = scope_Document.body; + + + // Creates a node, adds it to target, returns the new node. + function addNodeTo ( target, className ) { + + var div = scope_Document.createElement('div'); + + if ( className ) { + addClass(div, className); + } + + target.appendChild(div); + + return div; + } + + // Append a origin to the base + function addOrigin ( base, handleNumber ) { + + var origin = addNodeTo(base, options.cssClasses.origin); + var handle = addNodeTo(origin, options.cssClasses.handle); + + handle.setAttribute('data-handle', handleNumber); + + // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex + // 0 = focusable and reachable + handle.setAttribute('tabindex', '0'); + handle.setAttribute('role', 'slider'); + handle.setAttribute('aria-orientation', options.ort ? 'vertical' : 'horizontal'); + + if ( handleNumber === 0 ) { + addClass(handle, options.cssClasses.handleLower); + } + + else if ( handleNumber === options.handles - 1 ) { + addClass(handle, options.cssClasses.handleUpper); + } + + return origin; + } + + // Insert nodes for connect elements + function addConnect ( base, add ) { + + if ( !add ) { + return false; + } + + return addNodeTo(base, options.cssClasses.connect); + } + + // Add handles to the slider base. + function addElements ( connectOptions, base ) { + + scope_Handles = []; + scope_Connects = []; + + scope_Connects.push(addConnect(base, connectOptions[0])); + + // [::::O====O====O====] + // connectOptions = [0, 1, 1, 1] + + for ( var i = 0; i < options.handles; i++ ) { + // Keep a list of all added handles. + scope_Handles.push(addOrigin(base, i)); + scope_HandleNumbers[i] = i; + scope_Connects.push(addConnect(base, connectOptions[i + 1])); + } + } + + // Initialize a single slider. + function addSlider ( target ) { + + // Apply classes and data to the target. + addClass(target, options.cssClasses.target); + + if ( options.dir === 0 ) { + addClass(target, options.cssClasses.ltr); + } else { + addClass(target, options.cssClasses.rtl); + } + + if ( options.ort === 0 ) { + addClass(target, options.cssClasses.horizontal); + } else { + addClass(target, options.cssClasses.vertical); + } + + scope_Base = addNodeTo(target, options.cssClasses.base); + } + + + function addTooltip ( handle, handleNumber ) { + + if ( !options.tooltips[handleNumber] ) { + return false; + } + + return addNodeTo(handle.firstChild, options.cssClasses.tooltip); + } + + // The tooltips option is a shorthand for using the 'update' event. + function tooltips ( ) { + + // Tooltips are added with options.tooltips in original order. + var tips = scope_Handles.map(addTooltip); + + bindEvent('update', function(values, handleNumber, unencoded) { + + if ( !tips[handleNumber] ) { + return; + } + + var formattedValue = values[handleNumber]; + + if ( options.tooltips[handleNumber] !== true ) { + formattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]); + } + + tips[handleNumber].innerHTML = formattedValue; + }); + } + + + function aria ( ) { + + bindEvent('update', function ( values, handleNumber, unencoded, tap, positions ) { + + // Update Aria Values for all handles, as a change in one changes min and max values for the next. + scope_HandleNumbers.forEach(function( handleNumber ){ + + var handle = scope_Handles[handleNumber]; + + var min = checkHandlePosition(scope_Locations, handleNumber, 0, true, true, true); + var max = checkHandlePosition(scope_Locations, handleNumber, 100, true, true, true); + + var now = positions[handleNumber]; + var text = options.ariaFormat.to(unencoded[handleNumber]); + + handle.children[0].setAttribute('aria-valuemin', min.toFixed(1)); + handle.children[0].setAttribute('aria-valuemax', max.toFixed(1)); + handle.children[0].setAttribute('aria-valuenow', now.toFixed(1)); + handle.children[0].setAttribute('aria-valuetext', text); + }); + }); + } + + + function getGroup ( mode, values, stepped ) { + + // Use the range. + if ( mode === 'range' || mode === 'steps' ) { + return scope_Spectrum.xVal; + } + + if ( mode === 'count' ) { + + if ( !values ) { + throw new Error("noUiSlider (" + VERSION + "): 'values' required for mode 'count'."); + } + + // Divide 0 - 100 in 'count' parts. + var spread = ( 100 / (values - 1) ); + var v; + var i = 0; + + values = []; + + // List these parts and have them handled as 'positions'. + while ( (v = i++ * spread) <= 100 ) { + values.push(v); + } + + mode = 'positions'; + } + + if ( mode === 'positions' ) { + + // Map all percentages to on-range values. + return values.map(function( value ){ + return scope_Spectrum.fromStepping( stepped ? scope_Spectrum.getStep( value ) : value ); + }); + } + + if ( mode === 'values' ) { + + // If the value must be stepped, it needs to be converted to a percentage first. + if ( stepped ) { + + return values.map(function( value ){ + + // Convert to percentage, apply step, return to value. + return scope_Spectrum.fromStepping( scope_Spectrum.getStep( scope_Spectrum.toStepping( value ) ) ); + }); + + } + + // Otherwise, we can simply use the values. + return values; + } + } + + function generateSpread ( density, mode, group ) { + + function safeIncrement(value, increment) { + // Avoid floating point variance by dropping the smallest decimal places. + return (value + increment).toFixed(7) / 1; + } + + var indexes = {}; + var firstInRange = scope_Spectrum.xVal[0]; + var lastInRange = scope_Spectrum.xVal[scope_Spectrum.xVal.length-1]; + var ignoreFirst = false; + var ignoreLast = false; + var prevPct = 0; + + // Create a copy of the group, sort it and filter away all duplicates. + group = unique(group.slice().sort(function(a, b){ return a - b; })); + + // Make sure the range starts with the first element. + if ( group[0] !== firstInRange ) { + group.unshift(firstInRange); + ignoreFirst = true; + } + + // Likewise for the last one. + if ( group[group.length - 1] !== lastInRange ) { + group.push(lastInRange); + ignoreLast = true; + } + + group.forEach(function ( current, index ) { + + // Get the current step and the lower + upper positions. + var step; + var i; + var q; + var low = current; + var high = group[index+1]; + var newPct; + var pctDifference; + var pctPos; + var type; + var steps; + var realSteps; + var stepsize; + + // When using 'steps' mode, use the provided steps. + // Otherwise, we'll step on to the next subrange. + if ( mode === 'steps' ) { + step = scope_Spectrum.xNumSteps[ index ]; + } + + // Default to a 'full' step. + if ( !step ) { + step = high-low; + } + + // Low can be 0, so test for false. If high is undefined, + // we are at the last subrange. Index 0 is already handled. + if ( low === false || high === undefined ) { + return; + } + + // Make sure step isn't 0, which would cause an infinite loop (#654) + step = Math.max(step, 0.0000001); + + // Find all steps in the subrange. + for ( i = low; i <= high; i = safeIncrement(i, step) ) { + + // Get the percentage value for the current step, + // calculate the size for the subrange. + newPct = scope_Spectrum.toStepping( i ); + pctDifference = newPct - prevPct; + + steps = pctDifference / density; + realSteps = Math.round(steps); + + // This ratio represents the ammount of percentage-space a point indicates. + // For a density 1 the points/percentage = 1. For density 2, that percentage needs to be re-devided. + // Round the percentage offset to an even number, then divide by two + // to spread the offset on both sides of the range. + stepsize = pctDifference/realSteps; + + // Divide all points evenly, adding the correct number to this subrange. + // Run up to <= so that 100% gets a point, event if ignoreLast is set. + for ( q = 1; q <= realSteps; q += 1 ) { + + // The ratio between the rounded value and the actual size might be ~1% off. + // Correct the percentage offset by the number of points + // per subrange. density = 1 will result in 100 points on the + // full range, 2 for 50, 4 for 25, etc. + pctPos = prevPct + ( q * stepsize ); + indexes[pctPos.toFixed(5)] = ['x', 0]; + } + + // Determine the point type. + type = (group.indexOf(i) > -1) ? 1 : ( mode === 'steps' ? 2 : 0 ); + + // Enforce the 'ignoreFirst' option by overwriting the type for 0. + if ( !index && ignoreFirst ) { + type = 0; + } + + if ( !(i === high && ignoreLast)) { + // Mark the 'type' of this point. 0 = plain, 1 = real value, 2 = step value. + indexes[newPct.toFixed(5)] = [i, type]; + } + + // Update the percentage count. + prevPct = newPct; + } + }); + + return indexes; + } + + function addMarking ( spread, filterFunc, formatter ) { + + var element = scope_Document.createElement('div'); + + var valueSizeClasses = [ + options.cssClasses.valueNormal, + options.cssClasses.valueLarge, + options.cssClasses.valueSub + ]; + var markerSizeClasses = [ + options.cssClasses.markerNormal, + options.cssClasses.markerLarge, + options.cssClasses.markerSub + ]; + var valueOrientationClasses = [ + options.cssClasses.valueHorizontal, + options.cssClasses.valueVertical + ]; + var markerOrientationClasses = [ + options.cssClasses.markerHorizontal, + options.cssClasses.markerVertical + ]; + + addClass(element, options.cssClasses.pips); + addClass(element, options.ort === 0 ? options.cssClasses.pipsHorizontal : options.cssClasses.pipsVertical); + + function getClasses( type, source ){ + var a = source === options.cssClasses.value; + var orientationClasses = a ? valueOrientationClasses : markerOrientationClasses; + var sizeClasses = a ? valueSizeClasses : markerSizeClasses; + + return source + ' ' + orientationClasses[options.ort] + ' ' + sizeClasses[type]; + } + + function addSpread ( offset, values ){ + + // Apply the filter function, if it is set. + values[1] = (values[1] && filterFunc) ? filterFunc(values[0], values[1]) : values[1]; + + // Add a marker for every point + var node = addNodeTo(element, false); + node.className = getClasses(values[1], options.cssClasses.marker); + node.style[options.style] = offset + '%'; + + // Values are only appended for points marked '1' or '2'. + if ( values[1] ) { + node = addNodeTo(element, false); + node.className = getClasses(values[1], options.cssClasses.value); + node.style[options.style] = offset + '%'; + node.innerText = formatter.to(values[0]); + } + } + + // Append all points. + Object.keys(spread).forEach(function(a){ + addSpread(a, spread[a]); + }); + + return element; + } + + function removePips ( ) { + if ( scope_Pips ) { + removeElement(scope_Pips); + scope_Pips = null; + } + } + + function pips ( grid ) { + + // Fix #669 + removePips(); + + var mode = grid.mode; + var density = grid.density || 1; + var filter = grid.filter || false; + var values = grid.values || false; + var stepped = grid.stepped || false; + var group = getGroup( mode, values, stepped ); + var spread = generateSpread( density, mode, group ); + var format = grid.format || { + to: Math.round + }; + + scope_Pips = scope_Target.appendChild(addMarking( + spread, + filter, + format + )); + + return scope_Pips; + } + + + // Shorthand for base dimensions. + function baseSize ( ) { + var rect = scope_Base.getBoundingClientRect(), alt = 'offset' + ['Width', 'Height'][options.ort]; + return options.ort === 0 ? (rect.width||scope_Base[alt]) : (rect.height||scope_Base[alt]); + } + + // Handler for attaching events trough a proxy. + function attachEvent ( events, element, callback, data ) { + + // This function can be used to 'filter' events to the slider. + // element is a node, not a nodeList + + var method = function ( e ){ + + if ( scope_Target.hasAttribute('disabled') ) { + return false; + } + + // Stop if an active 'tap' transition is taking place. + if ( hasClass(scope_Target, options.cssClasses.tap) ) { + return false; + } + + e = fixEvent(e, data.pageOffset); + + // Handle reject of multitouch + if ( !e ) { + return false; + } + + // Ignore right or middle clicks on start #454 + if ( events === actions.start && e.buttons !== undefined && e.buttons > 1 ) { + return false; + } + + // Ignore right or middle clicks on start #454 + if ( data.hover && e.buttons ) { + return false; + } + + // 'supportsPassive' is only true if a browser also supports touch-action: none in CSS. + // iOS safari does not, so it doesn't get to benefit from passive scrolling. iOS does support + // touch-action: manipulation, but that allows panning, which breaks + // sliders after zooming/on non-responsive pages. + // See: https://bugs.webkit.org/show_bug.cgi?id=133112 + if ( !supportsPassive ) { + e.preventDefault(); + } + + e.calcPoint = e.points[ options.ort ]; + + // Call the event handler with the event [ and additional data ]. + callback ( e, data ); + }; + + var methods = []; + + // Bind a closure on the target for every event type. + events.split(' ').forEach(function( eventName ){ + element.addEventListener(eventName, method, supportsPassive ? { passive: true } : false); + methods.push([eventName, method]); + }); + + return methods; + } + + // Provide a clean event with standardized offset values. + function fixEvent ( e, pageOffset ) { + + // Filter the event to register the type, which can be + // touch, mouse or pointer. Offset changes need to be + // made on an event specific basis. + var touch = e.type.indexOf('touch') === 0; + var mouse = e.type.indexOf('mouse') === 0; + var pointer = e.type.indexOf('pointer') === 0; + + var x; + var y; + + // IE10 implemented pointer events with a prefix; + if ( e.type.indexOf('MSPointer') === 0 ) { + pointer = true; + } + + if ( touch ) { + + // Fix bug when user touches with two or more fingers on mobile devices. + // It's useful when you have two or more sliders on one page, + // that can be touched simultaneously. + // #649, #663, #668 + if ( e.touches.length > 1 ) { + return false; + } + + // noUiSlider supports one movement at a time, + // so we can select the first 'changedTouch'. + x = e.changedTouches[0].pageX; + y = e.changedTouches[0].pageY; + } + + pageOffset = pageOffset || getPageOffset(scope_Document); + + if ( mouse || pointer ) { + x = e.clientX + pageOffset.x; + y = e.clientY + pageOffset.y; + } + + e.pageOffset = pageOffset; + e.points = [x, y]; + e.cursor = mouse || pointer; // Fix #435 + + return e; + } + + // Translate a coordinate in the document to a percentage on the slider + function calcPointToPercentage ( calcPoint ) { + var location = calcPoint - offset(scope_Base, options.ort); + var proposal = ( location * 100 ) / baseSize(); + return options.dir ? 100 - proposal : proposal; + } + + // Find handle closest to a certain percentage on the slider + function getClosestHandle ( proposal ) { + + var closest = 100; + var handleNumber = false; + + scope_Handles.forEach(function(handle, index){ + + // Disabled handles are ignored + if ( handle.hasAttribute('disabled') ) { + return; + } + + var pos = Math.abs(scope_Locations[index] - proposal); + + if ( pos < closest ) { + handleNumber = index; + closest = pos; + } + }); + + return handleNumber; + } + + // Moves handle(s) by a percentage + // (bool, % to move, [% where handle started, ...], [index in scope_Handles, ...]) + function moveHandles ( upward, proposal, locations, handleNumbers ) { + + var proposals = locations.slice(); + + var b = [!upward, upward]; + var f = [upward, !upward]; + + // Copy handleNumbers so we don't change the dataset + handleNumbers = handleNumbers.slice(); + + // Check to see which handle is 'leading'. + // If that one can't move the second can't either. + if ( upward ) { + handleNumbers.reverse(); + } + + // Step 1: get the maximum percentage that any of the handles can move + if ( handleNumbers.length > 1 ) { + + handleNumbers.forEach(function(handleNumber, o) { + + var to = checkHandlePosition(proposals, handleNumber, proposals[handleNumber] + proposal, b[o], f[o], false); + + // Stop if one of the handles can't move. + if ( to === false ) { + proposal = 0; + } else { + proposal = to - proposals[handleNumber]; + proposals[handleNumber] = to; + } + }); + } + + // If using one handle, check backward AND forward + else { + b = f = [true]; + } + + var state = false; + + // Step 2: Try to set the handles with the found percentage + handleNumbers.forEach(function(handleNumber, o) { + state = setHandle(handleNumber, locations[handleNumber] + proposal, b[o], f[o]) || state; + }); + + // Step 3: If a handle moved, fire events + if ( state ) { + handleNumbers.forEach(function(handleNumber){ + fireEvent('update', handleNumber); + fireEvent('slide', handleNumber); + }); + } + } + + // External event handling + function fireEvent ( eventName, handleNumber, tap ) { + + Object.keys(scope_Events).forEach(function( targetEvent ) { + + var eventType = targetEvent.split('.')[0]; + + if ( eventName === eventType ) { + scope_Events[targetEvent].forEach(function( callback ) { + + callback.call( + // Use the slider public API as the scope ('this') + scope_Self, + // Return values as array, so arg_1[arg_2] is always valid. + scope_Values.map(options.format.to), + // Handle index, 0 or 1 + handleNumber, + // Unformatted slider values + scope_Values.slice(), + // Event is fired by tap, true or false + tap || false, + // Left offset of the handle, in relation to the slider + scope_Locations.slice() + ); + }); + } + }); + } + + + // Fire 'end' when a mouse or pen leaves the document. + function documentLeave ( event, data ) { + if ( event.type === "mouseout" && event.target.nodeName === "HTML" && event.relatedTarget === null ){ + eventEnd (event, data); + } + } + + // Handle movement on document for handle and range drag. + function eventMove ( event, data ) { + + // Fix #498 + // Check value of .buttons in 'start' to work around a bug in IE10 mobile (data.buttonsProperty). + // https://connect.microsoft.com/IE/feedback/details/927005/mobile-ie10-windows-phone-buttons-property-of-pointermove-event-always-zero + // IE9 has .buttons and .which zero on mousemove. + // Firefox breaks the spec MDN defines. + if ( navigator.appVersion.indexOf("MSIE 9") === -1 && event.buttons === 0 && data.buttonsProperty !== 0 ) { + return eventEnd(event, data); + } + + // Check if we are moving up or down + var movement = (options.dir ? -1 : 1) * (event.calcPoint - data.startCalcPoint); + + // Convert the movement into a percentage of the slider width/height + var proposal = (movement * 100) / data.baseSize; + + moveHandles(movement > 0, proposal, data.locations, data.handleNumbers); + } + + // Unbind move events on document, call callbacks. + function eventEnd ( event, data ) { + + // The handle is no longer active, so remove the class. + if ( scope_ActiveHandle ) { + removeClass(scope_ActiveHandle, options.cssClasses.active); + scope_ActiveHandle = false; + } + + // Remove cursor styles and text-selection events bound to the body. + if ( event.cursor ) { + scope_Body.style.cursor = ''; + scope_Body.removeEventListener('selectstart', preventDefault); + } + + // Unbind the move and end events, which are added on 'start'. + scope_Listeners.forEach(function( c ) { + scope_DocumentElement.removeEventListener(c[0], c[1]); + }); + + // Remove dragging class. + removeClass(scope_Target, options.cssClasses.drag); + + setZindex(); + + data.handleNumbers.forEach(function(handleNumber){ + fireEvent('change', handleNumber); + fireEvent('set', handleNumber); + fireEvent('end', handleNumber); + }); + } + + // Bind move events on document. + function eventStart ( event, data ) { + + if ( data.handleNumbers.length === 1 ) { + + var handle = scope_Handles[data.handleNumbers[0]]; + + // Ignore 'disabled' handles + if ( handle.hasAttribute('disabled') ) { + return false; + } + + // Mark the handle as 'active' so it can be styled. + scope_ActiveHandle = handle.children[0]; + addClass(scope_ActiveHandle, options.cssClasses.active); + } + + // A drag should never propagate up to the 'tap' event. + event.stopPropagation(); + + // Attach the move and end events. + var moveEvent = attachEvent(actions.move, scope_DocumentElement, eventMove, { + startCalcPoint: event.calcPoint, + baseSize: baseSize(), + pageOffset: event.pageOffset, + handleNumbers: data.handleNumbers, + buttonsProperty: event.buttons, + locations: scope_Locations.slice() + }); + + var endEvent = attachEvent(actions.end, scope_DocumentElement, eventEnd, { + handleNumbers: data.handleNumbers + }); + + var outEvent = attachEvent("mouseout", scope_DocumentElement, documentLeave, { + handleNumbers: data.handleNumbers + }); + + scope_Listeners = moveEvent.concat(endEvent, outEvent); + + // Text selection isn't an issue on touch devices, + // so adding cursor styles can be skipped. + if ( event.cursor ) { + + // Prevent the 'I' cursor and extend the range-drag cursor. + scope_Body.style.cursor = getComputedStyle(event.target).cursor; + + // Mark the target with a dragging state. + if ( scope_Handles.length > 1 ) { + addClass(scope_Target, options.cssClasses.drag); + } + + // Prevent text selection when dragging the handles. + // In noUiSlider <= 9.2.0, this was handled by calling preventDefault on mouse/touch start/move, + // which is scroll blocking. The selectstart event is supported by FireFox starting from version 52, + // meaning the only holdout is iOS Safari. This doesn't matter: text selection isn't triggered there. + // The 'cursor' flag is false. + // See: http://caniuse.com/#search=selectstart + scope_Body.addEventListener('selectstart', preventDefault, false); + } + + data.handleNumbers.forEach(function(handleNumber){ + fireEvent('start', handleNumber); + }); + } + + // Move closest handle to tapped location. + function eventTap ( event ) { + + // The tap event shouldn't propagate up + event.stopPropagation(); + + var proposal = calcPointToPercentage(event.calcPoint); + var handleNumber = getClosestHandle(proposal); + + // Tackle the case that all handles are 'disabled'. + if ( handleNumber === false ) { + return false; + } + + // Flag the slider as it is now in a transitional state. + // Transition takes a configurable amount of ms (default 300). Re-enable the slider after that. + if ( !options.events.snap ) { + addClassFor(scope_Target, options.cssClasses.tap, options.animationDuration); + } + + setHandle(handleNumber, proposal, true, true); + + setZindex(); + + fireEvent('slide', handleNumber, true); + fireEvent('update', handleNumber, true); + fireEvent('change', handleNumber, true); + fireEvent('set', handleNumber, true); + + if ( options.events.snap ) { + eventStart(event, { handleNumbers: [handleNumber] }); + } + } + + // Fires a 'hover' event for a hovered mouse/pen position. + function eventHover ( event ) { + + var proposal = calcPointToPercentage(event.calcPoint); + + var to = scope_Spectrum.getStep(proposal); + var value = scope_Spectrum.fromStepping(to); + + Object.keys(scope_Events).forEach(function( targetEvent ) { + if ( 'hover' === targetEvent.split('.')[0] ) { + scope_Events[targetEvent].forEach(function( callback ) { + callback.call( scope_Self, value ); + }); + } + }); + } + + // Attach events to several slider parts. + function bindSliderEvents ( behaviour ) { + + // Attach the standard drag event to the handles. + if ( !behaviour.fixed ) { + + scope_Handles.forEach(function( handle, index ){ + + // These events are only bound to the visual handle + // element, not the 'real' origin element. + attachEvent ( actions.start, handle.children[0], eventStart, { + handleNumbers: [index] + }); + }); + } + + // Attach the tap event to the slider base. + if ( behaviour.tap ) { + attachEvent (actions.start, scope_Base, eventTap, {}); + } + + // Fire hover events + if ( behaviour.hover ) { + attachEvent (actions.move, scope_Base, eventHover, { hover: true }); + } + + // Make the range draggable. + if ( behaviour.drag ){ + + scope_Connects.forEach(function( connect, index ){ + + if ( connect === false || index === 0 || index === scope_Connects.length - 1 ) { + return; + } + + var handleBefore = scope_Handles[index - 1]; + var handleAfter = scope_Handles[index]; + var eventHolders = [connect]; + + addClass(connect, options.cssClasses.draggable); + + // When the range is fixed, the entire range can + // be dragged by the handles. The handle in the first + // origin will propagate the start event upward, + // but it needs to be bound manually on the other. + if ( behaviour.fixed ) { + eventHolders.push(handleBefore.children[0]); + eventHolders.push(handleAfter.children[0]); + } + + eventHolders.forEach(function( eventHolder ) { + attachEvent ( actions.start, eventHolder, eventStart, { + handles: [handleBefore, handleAfter], + handleNumbers: [index - 1, index] + }); + }); + }); + } + } + + + // Split out the handle positioning logic so the Move event can use it, too + function checkHandlePosition ( reference, handleNumber, to, lookBackward, lookForward, getValue ) { + + // For sliders with multiple handles, limit movement to the other handle. + // Apply the margin option by adding it to the handle positions. + if ( scope_Handles.length > 1 ) { + + if ( lookBackward && handleNumber > 0 ) { + to = Math.max(to, reference[handleNumber - 1] + options.margin); + } + + if ( lookForward && handleNumber < scope_Handles.length - 1 ) { + to = Math.min(to, reference[handleNumber + 1] - options.margin); + } + } + + // The limit option has the opposite effect, limiting handles to a + // maximum distance from another. Limit must be > 0, as otherwise + // handles would be unmoveable. + if ( scope_Handles.length > 1 && options.limit ) { + + if ( lookBackward && handleNumber > 0 ) { + to = Math.min(to, reference[handleNumber - 1] + options.limit); + } + + if ( lookForward && handleNumber < scope_Handles.length - 1 ) { + to = Math.max(to, reference[handleNumber + 1] - options.limit); + } + } + + // The padding option keeps the handles a certain distance from the + // edges of the slider. Padding must be > 0. + if ( options.padding ) { + + if ( handleNumber === 0 ) { + to = Math.max(to, options.padding); + } + + if ( handleNumber === scope_Handles.length - 1 ) { + to = Math.min(to, 100 - options.padding); + } + } + + to = scope_Spectrum.getStep(to); + + // Limit percentage to the 0 - 100 range + to = limit(to); + + // Return false if handle can't move + if ( to === reference[handleNumber] && !getValue ) { + return false; + } + + return to; + } + + function toPct ( pct ) { + return pct + '%'; + } + + // Updates scope_Locations and scope_Values, updates visual state + function updateHandlePosition ( handleNumber, to ) { + + // Update locations. + scope_Locations[handleNumber] = to; + + // Convert the value to the slider stepping/range. + scope_Values[handleNumber] = scope_Spectrum.fromStepping(to); + + // Called synchronously or on the next animationFrame + var stateUpdate = function() { + scope_Handles[handleNumber].style[options.style] = toPct(to); + updateConnect(handleNumber); + updateConnect(handleNumber + 1); + }; + + // Set the handle to the new position. + // Use requestAnimationFrame for efficient painting. + // No significant effect in Chrome, Edge sees dramatic performace improvements. + // Option to disable is useful for unit tests, and single-step debugging. + if ( window.requestAnimationFrame && options.useRequestAnimationFrame ) { + window.requestAnimationFrame(stateUpdate); + } else { + stateUpdate(); + } + } + + function setZindex ( ) { + + scope_HandleNumbers.forEach(function(handleNumber){ + // Handles before the slider middle are stacked later = higher, + // Handles after the middle later is lower + // [[7] [8] .......... | .......... [5] [4] + var dir = (scope_Locations[handleNumber] > 50 ? -1 : 1); + var zIndex = 3 + (scope_Handles.length + (dir * handleNumber)); + scope_Handles[handleNumber].childNodes[0].style.zIndex = zIndex; + }); + } + + // Test suggested values and apply margin, step. + function setHandle ( handleNumber, to, lookBackward, lookForward ) { + + to = checkHandlePosition(scope_Locations, handleNumber, to, lookBackward, lookForward, false); + + if ( to === false ) { + return false; + } + + updateHandlePosition(handleNumber, to); + + return true; + } + + // Updates style attribute for connect nodes + function updateConnect ( index ) { + + // Skip connects set to false + if ( !scope_Connects[index] ) { + return; + } + + var l = 0; + var h = 100; + + if ( index !== 0 ) { + l = scope_Locations[index - 1]; + } + + if ( index !== scope_Connects.length - 1 ) { + h = scope_Locations[index]; + } + + scope_Connects[index].style[options.style] = toPct(l); + scope_Connects[index].style[options.styleOposite] = toPct(100 - h); + } + + // ... + function setValue ( to, handleNumber ) { + + // Setting with null indicates an 'ignore'. + // Inputting 'false' is invalid. + if ( to === null || to === false ) { + return; + } + + // If a formatted number was passed, attemt to decode it. + if ( typeof to === 'number' ) { + to = String(to); + } + + to = options.format.from(to); + + // Request an update for all links if the value was invalid. + // Do so too if setting the handle fails. + if ( to !== false && !isNaN(to) ) { + setHandle(handleNumber, scope_Spectrum.toStepping(to), false, false); + } + } + + // Set the slider value. + function valueSet ( input, fireSetEvent ) { + + var values = asArray(input); + var isInit = scope_Locations[0] === undefined; + + // Event fires by default + fireSetEvent = (fireSetEvent === undefined ? true : !!fireSetEvent); + + values.forEach(setValue); + + // Animation is optional. + // Make sure the initial values were set before using animated placement. + if ( options.animate && !isInit ) { + addClassFor(scope_Target, options.cssClasses.tap, options.animationDuration); + } + + // Now that all base values are set, apply constraints + scope_HandleNumbers.forEach(function(handleNumber){ + setHandle(handleNumber, scope_Locations[handleNumber], true, false); + }); + + setZindex(); + + scope_HandleNumbers.forEach(function(handleNumber){ + + fireEvent('update', handleNumber); + + // Fire the event only for handles that received a new value, as per #579 + if ( values[handleNumber] !== null && fireSetEvent ) { + fireEvent('set', handleNumber); + } + }); + } + + // Reset slider to initial values + function valueReset ( fireSetEvent ) { + valueSet(options.start, fireSetEvent); + } + + // Get the slider value. + function valueGet ( ) { + + var values = scope_Values.map(options.format.to); + + // If only one handle is used, return a single value. + if ( values.length === 1 ){ + return values[0]; + } + + return values; + } + + // Removes classes from the root and empties it. + function destroy ( ) { + + for ( var key in options.cssClasses ) { + if ( !options.cssClasses.hasOwnProperty(key) ) { continue; } + removeClass(scope_Target, options.cssClasses[key]); + } + + while (scope_Target.firstChild) { + scope_Target.removeChild(scope_Target.firstChild); + } + + delete scope_Target.noUiSlider; + } + + // Get the current step size for the slider. + function getCurrentStep ( ) { + + // Check all locations, map them to their stepping point. + // Get the step point, then find it in the input list. + return scope_Locations.map(function( location, index ){ + + var nearbySteps = scope_Spectrum.getNearbySteps( location ); + var value = scope_Values[index]; + var increment = nearbySteps.thisStep.step; + var decrement = null; + + // If the next value in this step moves into the next step, + // the increment is the start of the next step - the current value + if ( increment !== false ) { + if ( value + increment > nearbySteps.stepAfter.startValue ) { + increment = nearbySteps.stepAfter.startValue - value; + } + } + + + // If the value is beyond the starting point + if ( value > nearbySteps.thisStep.startValue ) { + decrement = nearbySteps.thisStep.step; + } + + else if ( nearbySteps.stepBefore.step === false ) { + decrement = false; + } + + // If a handle is at the start of a step, it always steps back into the previous step first + else { + decrement = value - nearbySteps.stepBefore.highestStep; + } + + + // Now, if at the slider edges, there is not in/decrement + if ( location === 100 ) { + increment = null; + } + + else if ( location === 0 ) { + decrement = null; + } + + // As per #391, the comparison for the decrement step can have some rounding issues. + var stepDecimals = scope_Spectrum.countStepDecimals(); + + // Round per #391 + if ( increment !== null && increment !== false ) { + increment = Number(increment.toFixed(stepDecimals)); + } + + if ( decrement !== null && decrement !== false ) { + decrement = Number(decrement.toFixed(stepDecimals)); + } + + return [decrement, increment]; + }); + } + + // Attach an event to this slider, possibly including a namespace + function bindEvent ( namespacedEvent, callback ) { + scope_Events[namespacedEvent] = scope_Events[namespacedEvent] || []; + scope_Events[namespacedEvent].push(callback); + + // If the event bound is 'update,' fire it immediately for all handles. + if ( namespacedEvent.split('.')[0] === 'update' ) { + scope_Handles.forEach(function(a, index){ + fireEvent('update', index); + }); + } + } + + // Undo attachment of event + function removeEvent ( namespacedEvent ) { + + var event = namespacedEvent && namespacedEvent.split('.')[0]; + var namespace = event && namespacedEvent.substring(event.length); + + Object.keys(scope_Events).forEach(function( bind ){ + + var tEvent = bind.split('.')[0], + tNamespace = bind.substring(tEvent.length); + + if ( (!event || event === tEvent) && (!namespace || namespace === tNamespace) ) { + delete scope_Events[bind]; + } + }); + } + + // Updateable: margin, limit, padding, step, range, animate, snap + function updateOptions ( optionsToUpdate, fireSetEvent ) { + + // Spectrum is created using the range, snap, direction and step options. + // 'snap' and 'step' can be updated. + // If 'snap' and 'step' are not passed, they should remain unchanged. + var v = valueGet(); + + var updateAble = ['margin', 'limit', 'padding', 'range', 'animate', 'snap', 'step', 'format']; + + // Only change options that we're actually passed to update. + updateAble.forEach(function(name){ + if ( optionsToUpdate[name] !== undefined ) { + originalOptions[name] = optionsToUpdate[name]; + } + }); + + var newOptions = testOptions(originalOptions); + + // Load new options into the slider state + updateAble.forEach(function(name){ + if ( optionsToUpdate[name] !== undefined ) { + options[name] = newOptions[name]; + } + }); + + scope_Spectrum = newOptions.spectrum; + + // Limit, margin and padding depend on the spectrum but are stored outside of it. (#677) + options.margin = newOptions.margin; + options.limit = newOptions.limit; + options.padding = newOptions.padding; + + // Update pips, removes existing. + if ( options.pips ) { + pips(options.pips); + } + + // Invalidate the current positioning so valueSet forces an update. + scope_Locations = []; + valueSet(optionsToUpdate.start || v, fireSetEvent); + } + + // Throw an error if the slider was already initialized. + if ( scope_Target.noUiSlider ) { + throw new Error("noUiSlider (" + VERSION + "): Slider was already initialized."); + } + + // Create the base element, initialise HTML and set classes. + // Add handles and connect elements. + addSlider(scope_Target); + addElements(options.connect, scope_Base); + + scope_Self = { + destroy: destroy, + steps: getCurrentStep, + on: bindEvent, + off: removeEvent, + get: valueGet, + set: valueSet, + reset: valueReset, + // Exposed for unit testing, don't use this in your application. + __moveHandles: function(a, b, c) { moveHandles(a, b, scope_Locations, c); }, + options: originalOptions, // Issue #600, #678 + updateOptions: updateOptions, + target: scope_Target, // Issue #597 + removePips: removePips, + pips: pips // Issue #594 + }; + + // Attach user events. + bindSliderEvents(options.events); + + // Use the public value method to set the start values. + valueSet(options.start); + + if ( options.pips ) { + pips(options.pips); + } + + if ( options.tooltips ) { + tooltips(); + } + + aria(); + + return scope_Self; + +} + + + // Run the standard initializer + function initialize ( target, originalOptions ) { + + if ( !target || !target.nodeName ) { + throw new Error("noUiSlider (" + VERSION + "): create requires a single element, got: " + target); + } + + // Test the options and create the slider environment; + var options = testOptions( originalOptions, target ); + var api = closure( target, options, originalOptions ); + + target.noUiSlider = api; + + return api; + } + + // Use an object instead of a function for future expansibility; + return { + version: VERSION, + create: initialize + }; + +})); \ No newline at end of file diff --git a/plugins/noUiSlider.10.0.0/nouislider.min.css b/plugins/noUiSlider.10.0.0/nouislider.min.css new file mode 100644 index 0000000..fc1a3b3 --- /dev/null +++ b/plugins/noUiSlider.10.0.0/nouislider.min.css @@ -0,0 +1 @@ +/*! nouislider - 10.0.0 - 2017-05-28 14:52:48 */.noUi-target,.noUi-target *{-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-ms-touch-action:none;touch-action:none;-ms-user-select:none;-moz-user-select:none;user-select:none;-moz-box-sizing:border-box;box-sizing:border-box}.noUi-target{position:relative;direction:ltr}.noUi-base{width:100%;height:100%;position:relative;z-index:1}.noUi-connect{position:absolute;right:0;top:0;left:0;bottom:0}.noUi-origin{position:absolute;height:0;width:0}.noUi-handle{position:relative;z-index:1}.noUi-state-tap .noUi-connect,.noUi-state-tap .noUi-origin{-webkit-transition:top .3s,right .3s,bottom .3s,left .3s;transition:top .3s,right .3s,bottom .3s,left .3s}.noUi-state-drag *{cursor:inherit!important}.noUi-base,.noUi-handle{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.noUi-horizontal{height:18px}.noUi-horizontal .noUi-handle{width:34px;height:28px;left:-17px;top:-6px}.noUi-vertical{width:18px}.noUi-vertical .noUi-handle{width:28px;height:34px;left:-6px;top:-17px}.noUi-target{background:#FAFAFA;border-radius:4px;border:1px solid #D3D3D3;box-shadow:inset 0 1px 1px #F0F0F0,0 3px 6px -5px #BBB}.noUi-connect{background:#3FB8AF;border-radius:4px;box-shadow:inset 0 0 3px rgba(51,51,51,.45);-webkit-transition:background 450ms;transition:background 450ms}.noUi-draggable{cursor:ew-resize}.noUi-vertical .noUi-draggable{cursor:ns-resize}.noUi-handle{border:1px solid #D9D9D9;border-radius:3px;background:#FFF;cursor:default;box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #EBEBEB,0 3px 6px -3px #BBB}.noUi-active{box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #DDD,0 3px 6px -3px #BBB}.noUi-handle:after,.noUi-handle:before{content:"";display:block;position:absolute;height:14px;width:1px;background:#E8E7E6;left:14px;top:6px}.noUi-handle:after{left:17px}.noUi-vertical .noUi-handle:after,.noUi-vertical .noUi-handle:before{width:14px;height:1px;left:6px;top:14px}.noUi-vertical .noUi-handle:after{top:17px}[disabled] .noUi-connect{background:#B8B8B8}[disabled] .noUi-handle,[disabled].noUi-handle,[disabled].noUi-target{cursor:not-allowed}.noUi-pips,.noUi-pips *{-moz-box-sizing:border-box;box-sizing:border-box}.noUi-pips{position:absolute;color:#999}.noUi-value{position:absolute;white-space:nowrap;text-align:center}.noUi-value-sub{color:#ccc;font-size:10px}.noUi-marker{position:absolute;background:#CCC}.noUi-marker-large,.noUi-marker-sub{background:#AAA}.noUi-pips-horizontal{padding:10px 0;height:80px;top:100%;left:0;width:100%}.noUi-value-horizontal{-webkit-transform:translate3d(-50%,50%,0);transform:translate3d(-50%,50%,0)}.noUi-marker-horizontal.noUi-marker{margin-left:-1px;width:2px;height:5px}.noUi-marker-horizontal.noUi-marker-sub{height:10px}.noUi-marker-horizontal.noUi-marker-large{height:15px}.noUi-pips-vertical{padding:0 10px;height:100%;top:0;left:100%}.noUi-value-vertical{-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0);padding-left:25px}.noUi-marker-vertical.noUi-marker{width:5px;height:2px;margin-top:-1px}.noUi-marker-vertical.noUi-marker-sub{width:10px}.noUi-marker-vertical.noUi-marker-large{width:15px}.noUi-tooltip{display:block;position:absolute;border:1px solid #D9D9D9;border-radius:3px;background:#fff;color:#000;padding:5px;text-align:center;white-space:nowrap}.noUi-horizontal .noUi-tooltip{-webkit-transform:translate(-50%,0);transform:translate(-50%,0);left:50%;bottom:120%}.noUi-vertical .noUi-tooltip{-webkit-transform:translate(0,-50%);transform:translate(0,-50%);top:50%;right:120%} \ No newline at end of file diff --git a/plugins/noUiSlider.10.0.0/nouislider.min.js b/plugins/noUiSlider.10.0.0/nouislider.min.js new file mode 100644 index 0000000..b6f3032 --- /dev/null +++ b/plugins/noUiSlider.10.0.0/nouislider.min.js @@ -0,0 +1,3 @@ +/*! nouislider - 10.0.0 - 2017-05-28 14:52:49 */ + +!function(a){"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?module.exports=a():window.noUiSlider=a()}(function(){"use strict";function a(a){return"object"==typeof a&&"function"==typeof a.to&&"function"==typeof a.from}function b(a){a.parentElement.removeChild(a)}function c(a){a.preventDefault()}function d(a){return a.filter(function(a){return this[a]?!1:this[a]=!0},{})}function e(a,b){return Math.round(a/b)*b}function f(a,b){var c=a.getBoundingClientRect(),d=a.ownerDocument,e=d.documentElement,f=o(d);return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(f.x=0),b?c.top+f.y-e.clientTop:c.left+f.x-e.clientLeft}function g(a){return"number"==typeof a&&!isNaN(a)&&isFinite(a)}function h(a,b,c){c>0&&(l(a,b),setTimeout(function(){m(a,b)},c))}function i(a){return Math.max(Math.min(a,100),0)}function j(a){return Array.isArray(a)?a:[a]}function k(a){a=String(a);var b=a.split(".");return b.length>1?b[1].length:0}function l(a,b){a.classList?a.classList.add(b):a.className+=" "+b}function m(a,b){a.classList?a.classList.remove(b):a.className=a.className.replace(new RegExp("(^|\\b)"+b.split(" ").join("|")+"(\\b|$)","gi")," ")}function n(a,b){return a.classList?a.classList.contains(b):new RegExp("\\b"+b+"\\b").test(a.className)}function o(a){var b=void 0!==window.pageXOffset,c="CSS1Compat"===(a.compatMode||""),d=b?window.pageXOffset:c?a.documentElement.scrollLeft:a.body.scrollLeft,e=b?window.pageYOffset:c?a.documentElement.scrollTop:a.body.scrollTop;return{x:d,y:e}}function p(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function q(){var a=!1;try{var b=Object.defineProperty({},"passive",{get:function(){a=!0}});window.addEventListener("test",null,b)}catch(c){}return a}function r(){return window.CSS&&CSS.supports&&CSS.supports("touch-action","none")}function s(a,b){return 100/(b-a)}function t(a,b){return 100*b/(a[1]-a[0])}function u(a,b){return t(a,a[0]<0?b+Math.abs(a[0]):b-a[0])}function v(a,b){return b*(a[1]-a[0])/100+a[0]}function w(a,b){for(var c=1;a>=b[c];)c+=1;return c}function x(a,b,c){if(c>=a.slice(-1)[0])return 100;var d,e,f,g,h=w(c,a);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],f+u([d,e],c)/s(f,g)}function y(a,b,c){if(c>=100)return a.slice(-1)[0];var d,e,f,g,h=w(c,b);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],v([d,e],(c-f)*s(f,g))}function z(a,b,c,d){if(100===d)return d;var f,g,h=w(d,a);return c?(f=a[h-1],g=a[h],d-f>(g-f)/2?g:f):b[h-1]?a[h-1]+e(d-a[h-1],b[h-1]):d}function A(a,b,c){var d;if("number"==typeof b&&(b=[b]),"[object Array]"!==Object.prototype.toString.call(b))throw new Error("noUiSlider ("+$+"): 'range' contains invalid value.");if(d="min"===a?0:"max"===a?100:parseFloat(a),!g(d)||!g(b[0]))throw new Error("noUiSlider ("+$+"): 'range' value isn't numeric.");c.xPct.push(d),c.xVal.push(b[0]),d?c.xSteps.push(isNaN(b[1])?!1:b[1]):isNaN(b[1])||(c.xSteps[0]=b[1]),c.xHighestCompleteStep.push(0)}function B(a,b,c){if(!b)return!0;c.xSteps[a]=t([c.xVal[a],c.xVal[a+1]],b)/s(c.xPct[a],c.xPct[a+1]);var d=(c.xVal[a+1]-c.xVal[a])/c.xNumSteps[a],e=Math.ceil(Number(d.toFixed(3))-1),f=c.xVal[a]+c.xNumSteps[a]*e;c.xHighestCompleteStep[a]=f}function C(a,b,c){this.xPct=[],this.xVal=[],this.xSteps=[c||!1],this.xNumSteps=[!1],this.xHighestCompleteStep=[],this.snap=b;var d,e=[];for(d in a)a.hasOwnProperty(d)&&e.push([a[d],d]);for(e.sort(e.length&&"object"==typeof e[0][0]?function(a,b){return a[0][0]-b[0][0]}:function(a,b){return a[0]-b[0]}),d=0;d=50)throw new Error("noUiSlider ("+$+"): 'padding' option must be less than half the range.")}}function P(a,b){switch(b){case"ltr":a.dir=0;break;case"rtl":a.dir=1;break;default:throw new Error("noUiSlider ("+$+"): 'direction' option was not recognized.")}}function Q(a,b){if("string"!=typeof b)throw new Error("noUiSlider ("+$+"): 'behaviour' must be a string containing options.");var c=b.indexOf("tap")>=0,d=b.indexOf("drag")>=0,e=b.indexOf("fixed")>=0,f=b.indexOf("snap")>=0,g=b.indexOf("hover")>=0;if(e){if(2!==a.handles)throw new Error("noUiSlider ("+$+"): 'fixed' behaviour must be used with 2 handles");M(a,a.start[1]-a.start[0])}a.events={tap:c||f,drag:d,fixed:e,snap:f,hover:g}}function R(a,b){if(b!==!1)if(b===!0){a.tooltips=[];for(var c=0;c=l;l=e(l,h)){for(n=ta.toStepping(l),o=n-k,r=o/a,s=Math.round(r),t=o/s,m=1;s>=m;m+=1)p=k+m*t,f[p.toFixed(5)]=["x",0];q=c.indexOf(l)>-1?1:"steps"===b?2:0,!g&&i&&(q=0),l===v&&j||(f[n.toFixed(5)]=[l,q]),k=n}}),f}function B(a,b,c){function d(a,b){var c=b===e.cssClasses.value,d=c?j:m,f=c?h:i;return b+" "+d[e.ort]+" "+f[a]}function f(a,f){f[1]=f[1]&&b?b(f[0],f[1]):f[1];var h=k(g,!1);h.className=d(f[1],e.cssClasses.marker),h.style[e.style]=a+"%",f[1]&&(h=k(g,!1),h.className=d(f[1],e.cssClasses.value),h.style[e.style]=a+"%",h.innerText=c.to(f[0]))}var g=xa.createElement("div"),h=[e.cssClasses.valueNormal,e.cssClasses.valueLarge,e.cssClasses.valueSub],i=[e.cssClasses.markerNormal,e.cssClasses.markerLarge,e.cssClasses.markerSub],j=[e.cssClasses.valueHorizontal,e.cssClasses.valueVertical],m=[e.cssClasses.markerHorizontal,e.cssClasses.markerVertical];return l(g,e.cssClasses.pips),l(g,0===e.ort?e.cssClasses.pipsHorizontal:e.cssClasses.pipsVertical),Object.keys(a).forEach(function(b){f(b,a[b])}),g}function C(){la&&(b(la),la=null)}function D(a){C();var b=a.mode,c=a.density||1,d=a.filter||!1,e=a.values||!1,f=a.stepped||!1,g=z(b,e,f),h=A(c,b,g),i=a.format||{to:Math.round};return la=pa.appendChild(B(h,d,i))}function E(){var a=ha.getBoundingClientRect(),b="offset"+["Width","Height"][e.ort];return 0===e.ort?a.width||ha[b]:a.height||ha[b]}function F(a,b,c,d){var f=function(b){return pa.hasAttribute("disabled")?!1:n(pa,e.cssClasses.tap)?!1:(b=G(b,d.pageOffset))?a===ma.start&&void 0!==b.buttons&&b.buttons>1?!1:d.hover&&b.buttons?!1:(oa||b.preventDefault(),b.calcPoint=b.points[e.ort],void c(b,d)):!1},g=[];return a.split(" ").forEach(function(a){b.addEventListener(a,f,oa?{passive:!0}:!1),g.push([a,f])}),g}function G(a,b){var c,d,e=0===a.type.indexOf("touch"),f=0===a.type.indexOf("mouse"),g=0===a.type.indexOf("pointer");if(0===a.type.indexOf("MSPointer")&&(g=!0),e){if(a.touches.length>1)return!1;c=a.changedTouches[0].pageX,d=a.changedTouches[0].pageY}return b=b||o(xa),(f||g)&&(c=a.clientX+b.x,d=a.clientY+b.y),a.pageOffset=b,a.points=[c,d],a.cursor=f||g,a}function H(a){var b=a-f(ha,e.ort),c=100*b/E();return e.dir?100-c:c}function I(a){var b=100,c=!1;return ia.forEach(function(d,e){if(!d.hasAttribute("disabled")){var f=Math.abs(qa[e]-a);b>f&&(c=e,b=f)}}),c}function J(a,b,c,d){var e=c.slice(),f=[!a,a],g=[a,!a];d=d.slice(),a&&d.reverse(),d.length>1?d.forEach(function(a,c){var d=S(e,a,e[a]+b,f[c],g[c],!1);d===!1?b=0:(b=d-e[a],e[a]=d)}):f=g=[!0];var h=!1;d.forEach(function(a,d){h=W(a,c[a]+b,f[d],g[d])||h}),h&&d.forEach(function(a){K("update",a),K("slide",a)})}function K(a,b,c){Object.keys(va).forEach(function(d){var f=d.split(".")[0];a===f&&va[d].forEach(function(a){a.call(ka,ua.map(e.format.to),b,ua.slice(),c||!1,qa.slice())})})}function L(a,b){"mouseout"===a.type&&"HTML"===a.target.nodeName&&null===a.relatedTarget&&N(a,b)}function M(a,b){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===a.buttons&&0!==b.buttonsProperty)return N(a,b);var c=(e.dir?-1:1)*(a.calcPoint-b.startCalcPoint),d=100*c/b.baseSize;J(c>0,d,b.locations,b.handleNumbers)}function N(a,b){sa&&(m(sa,e.cssClasses.active),sa=!1),a.cursor&&(za.style.cursor="",za.removeEventListener("selectstart",c)),wa.forEach(function(a){ya.removeEventListener(a[0],a[1])}),m(pa,e.cssClasses.drag),V(),b.handleNumbers.forEach(function(a){K("change",a),K("set",a),K("end",a)})}function O(a,b){if(1===b.handleNumbers.length){var d=ia[b.handleNumbers[0]];if(d.hasAttribute("disabled"))return!1;sa=d.children[0],l(sa,e.cssClasses.active)}a.stopPropagation();var f=F(ma.move,ya,M,{startCalcPoint:a.calcPoint,baseSize:E(),pageOffset:a.pageOffset,handleNumbers:b.handleNumbers,buttonsProperty:a.buttons,locations:qa.slice()}),g=F(ma.end,ya,N,{handleNumbers:b.handleNumbers}),h=F("mouseout",ya,L,{handleNumbers:b.handleNumbers});wa=f.concat(g,h),a.cursor&&(za.style.cursor=getComputedStyle(a.target).cursor,ia.length>1&&l(pa,e.cssClasses.drag),za.addEventListener("selectstart",c,!1)),b.handleNumbers.forEach(function(a){K("start",a)})}function P(a){a.stopPropagation();var b=H(a.calcPoint),c=I(b);return c===!1?!1:(e.events.snap||h(pa,e.cssClasses.tap,e.animationDuration),W(c,b,!0,!0),V(),K("slide",c,!0),K("update",c,!0),K("change",c,!0),K("set",c,!0),void(e.events.snap&&O(a,{handleNumbers:[c]})))}function Q(a){var b=H(a.calcPoint),c=ta.getStep(b),d=ta.fromStepping(c);Object.keys(va).forEach(function(a){"hover"===a.split(".")[0]&&va[a].forEach(function(a){a.call(ka,d)})})}function R(a){a.fixed||ia.forEach(function(a,b){F(ma.start,a.children[0],O,{handleNumbers:[b]})}),a.tap&&F(ma.start,ha,P,{}),a.hover&&F(ma.move,ha,Q,{hover:!0}),a.drag&&ja.forEach(function(b,c){if(b!==!1&&0!==c&&c!==ja.length-1){var d=ia[c-1],f=ia[c],g=[b];l(b,e.cssClasses.draggable),a.fixed&&(g.push(d.children[0]),g.push(f.children[0])),g.forEach(function(a){F(ma.start,a,O,{handles:[d,f],handleNumbers:[c-1,c]})})}})}function S(a,b,c,d,f,g){return ia.length>1&&(d&&b>0&&(c=Math.max(c,a[b-1]+e.margin)),f&&b1&&e.limit&&(d&&b>0&&(c=Math.min(c,a[b-1]+e.limit)),f&&b50?-1:1,c=3+(ia.length+b*a);ia[a].childNodes[0].style.zIndex=c})}function W(a,b,c,d){return b=S(qa,a,b,c,d,!1),b===!1?!1:(U(a,b),!0)}function Y(a){if(ja[a]){var b=0,c=100;0!==a&&(b=qa[a-1]),a!==ja.length-1&&(c=qa[a]),ja[a].style[e.style]=T(b),ja[a].style[e.styleOposite]=T(100-c)}}function Z(a,b){null!==a&&a!==!1&&("number"==typeof a&&(a=String(a)),a=e.format.from(a),a===!1||isNaN(a)||W(b,ta.toStepping(a),!1,!1))}function _(a,b){var c=j(a),d=void 0===qa[0];b=void 0===b?!0:!!b,c.forEach(Z),e.animate&&!d&&h(pa,e.cssClasses.tap,e.animationDuration),ra.forEach(function(a){W(a,qa[a],!0,!1)}),V(),ra.forEach(function(a){K("update",a),null!==c[a]&&b&&K("set",a)})}function aa(a){_(e.start,a)}function ba(){var a=ua.map(e.format.to);return 1===a.length?a[0]:a}function ca(){for(var a in e.cssClasses)e.cssClasses.hasOwnProperty(a)&&m(pa,e.cssClasses[a]);for(;pa.firstChild;)pa.removeChild(pa.firstChild);delete pa.noUiSlider}function da(){return qa.map(function(a,b){var c=ta.getNearbySteps(a),d=ua[b],e=c.thisStep.step,f=null;e!==!1&&d+e>c.stepAfter.startValue&&(e=c.stepAfter.startValue-d),f=d>c.thisStep.startValue?c.thisStep.step:c.stepBefore.step===!1?!1:d-c.stepBefore.highestStep,100===a?e=null:0===a&&(f=null);var g=ta.countStepDecimals();return null!==e&&e!==!1&&(e=Number(e.toFixed(g))),null!==f&&f!==!1&&(f=Number(f.toFixed(g))),[f,e]})}function ea(a,b){va[a]=va[a]||[],va[a].push(b),"update"===a.split(".")[0]&&ia.forEach(function(a,b){K("update",b)})}function fa(a){var b=a&&a.split(".")[0],c=b&&a.substring(b.length);Object.keys(va).forEach(function(a){var d=a.split(".")[0],e=a.substring(d.length);b&&b!==d||c&&c!==e||delete va[a]})}function ga(a,b){var c=ba(),d=["margin","limit","padding","range","animate","snap","step","format"];d.forEach(function(b){void 0!==a[b]&&(g[b]=a[b])});var f=X(g);d.forEach(function(b){void 0!==a[b]&&(e[b]=f[b])}),ta=f.spectrum,e.margin=f.margin,e.limit=f.limit,e.padding=f.padding,e.pips&&D(e.pips),qa=[],_(a.start||c,b)}var ha,ia,ja,ka,la,ma=p(),na=r(),oa=na&&q(),pa=a,qa=[],ra=[],sa=!1,ta=e.spectrum,ua=[],va={},wa=null,xa=a.ownerDocument,ya=xa.documentElement,za=xa.body;if(pa.noUiSlider)throw new Error("noUiSlider ("+$+"): Slider was already initialized.");return v(pa),u(e.connect,ha),ka={destroy:ca,steps:da,on:ea,off:fa,get:ba,set:_,reset:aa,__moveHandles:function(a,b,c){J(a,b,qa,c)},options:g,updateOptions:ga,target:pa,removePips:C,pips:D},R(e.events),_(e.start),e.pips&&D(e.pips),e.tooltips&&x(),y(),ka}function Z(a,b){if(!a||!a.nodeName)throw new Error("noUiSlider ("+$+"): create requires a single element, got: "+a);var c=X(b,a),d=Y(a,c,b);return a.noUiSlider=d,d}var $="10.0.0";C.prototype.getMargin=function(a){var b=this.xNumSteps[0];if(b&&a/b%1!==0)throw new Error("noUiSlider ("+$+"): 'limit', 'margin' and 'padding' must be divisible by step.");return 2===this.xPct.length?t(this.xVal,a):!1},C.prototype.toStepping=function(a){return a=x(this.xVal,this.xPct,a)},C.prototype.fromStepping=function(a){return y(this.xVal,this.xPct,a)},C.prototype.getStep=function(a){return a=z(this.xPct,this.xSteps,this.snap,a)},C.prototype.getNearbySteps=function(a){var b=w(a,this.xPct);return{stepBefore:{startValue:this.xVal[b-2],step:this.xNumSteps[b-2],highestStep:this.xHighestCompleteStep[b-2]},thisStep:{startValue:this.xVal[b-1],step:this.xNumSteps[b-1],highestStep:this.xHighestCompleteStep[b-1]},stepAfter:{startValue:this.xVal[b-0],step:this.xNumSteps[b-0],highestStep:this.xHighestCompleteStep[b-0]}}},C.prototype.countStepDecimals=function(){var a=this.xNumSteps.map(k);return Math.max.apply(null,a)},C.prototype.convert=function(a){return this.getStep(this.toStepping(a))};var _={to:function(a){return void 0!==a&&a.toFixed(2)},from:Number};return{version:$,create:Z}}); \ No newline at end of file diff --git a/plugins/photoswipe/default-skin/default-skin.css b/plugins/photoswipe/default-skin/default-skin.css new file mode 100644 index 0000000..c961632 --- /dev/null +++ b/plugins/photoswipe/default-skin/default-skin.css @@ -0,0 +1,482 @@ +/*! PhotoSwipe Default UI CSS by Dmitry Semenov | photoswipe.com | MIT license */ +/* + + Contents: + + 1. Buttons + 2. Share modal and links + 3. Index indicator ("1 of X" counter) + 4. Caption + 5. Loading indicator + 6. Additional styles (root element, top bar, idle state, hidden state, etc.) + +*/ +/* + + 1. Buttons + + */ +/*