2559
                nodeArray.push(node);
2560
                node = node.parentNode;
2561
            }
2562
2563
            return distNode;
2564
        }
2565
    };
2566
2567
    function getOriginalEvent(e) {
2568
        return e.originalEvent || e;
2569
    }
2570
2571
    function getXY(e) {
2572
        var x = e.touches ? e.touches[0].pageX : e.clientX;
2573
        var y = e.touches ? e.touches[0].pageY : e.clientY;
2574
        return [x, y];
2575
    }
2576
2577
    //根据不同浏览器获取不同原生事件event
2578
    var hasTouch = "ontouchstart" in window,
2579
        START_EVENT = hasTouch ? 'touchstart' : 'mousedown',
2580
        MOVE_EVENT = hasTouch ? 'touchmove' : 'mousemove',
2581
        END_EVENT = hasTouch ? 'touchend' : 'mouseup',
2582
        CANCEL_EVENT = hasTouch ? 'touchcancel' : '';
2583
2584
    $(function () {
2585
        var startXY, tapEl, timeOutID;
2586
        var dom = document.body;
2587
2588
        // force为false的时候,不用管timeOutID,在老的timeOutID未移除的情况下,有可能又产生了新的,
2589
        // 导致else代码未被执行,导致老的点击元素class未被移除
2590
        function removeClass(dom, force) {
2591
            if (force && timeOutID) {
2592
                window.clearTimeout(timeOutID);
2593
            } else {
2594
                $(dom).removeClass(options.activeClass);
2595
            }
2596
        }
2597
2598
        function removeActive(force) {
2599
            if (force) {
2600
                removeClass(tapEl, force);
2601
            } else {
2602
                window.setTimeout(removeClass, options.hideDelay, tapEl, force);
2603
            }
2604
            startXY = null;
2605
            tapEl = null;
2606
        }
2607
2608
        $(dom).bind(START_EVENT, function (e) {
2609
            if (tapEl) {    // 多点接触时处理
2610
                removeActive(true);
2611
                return;
2612
            }
2613
2614
            e = getOriginalEvent(e);
2615
            startXY = getXY(e);
2616
            tapEl = options.getHandleNode(e.target);
2617
2618
            if (tapEl) {
2619
                timeOutID = window.setTimeout(function (dom) {
2620
                    timeOutID = null;
2621
                    $(dom).addClass(options.activeClass);
2622
                }, options.displayDelay, tapEl);
2623
            }
2624
        });
2625
2626
        $(dom).bind(MOVE_EVENT, function (e) {
2627
            if (!tapEl) {
2628
                return;
2629
            }
2630
2631
            e = getOriginalEvent(e);
2632
2633
            var xy = getXY(e);
2634
            if (startXY && (Math.abs(xy[0] - startXY[0]) > options.distanceAllow || Math.abs(xy[1] - startXY[1]) > options.distanceAllow)) {
2635
                removeActive(true);
2636
            }
2637
        });
2638
2639
        $(dom).bind(END_EVENT, function (e) {
2640
            if (tapEl) {
2641
                removeActive();
2642
            }
2643
        });
2644
2645
        // 手机来电等非用户取消操作时触发事件
2646
        if (CANCEL_EVENT) {
2647
            $(dom).bind(CANCEL_EVENT, function (e) {
2648
                if (tapEl) {
2649
                    removeActive();
2650
                }
2651
            });
2652
        }
2653
    });
2654
2655
    // 更新默认值
2656
    active.setOptions = function (opts) {
2657
        options = this.options = $.extend({}, defaultOptions, opts);
2658
    };
2659
    ipu.active = active;
2660
})(ipu || window, jQuery);
2661
2662
2494 2663
/*===========================
2495 2664
Device/OS Detection
2496 2665
===========================*/
@ -2620,8 +2789,8 @@ Device/OS Detection
2620 2789
    // todo:可以添加一个和其它库的适配处理,
2621 2790
    // 这里假设第三方库,jquery,iScroll,Hammer的史称已经固定
2622 2791
    if ( typeof define === "function" && define.amd ) {
2623
        define(['jquery', 'iScroll', 'Hammer', 'FastClick'], function (jquery, iscroll, hammer, FastClick) {
2624
            return window.ipu = setup(jquery, iscroll, hammer, FastClick);
2792
        define(['jquery', 'iScroll', 'Hammer', 'FastClick'], function (jQuery, iScroll, Hammer, FastClick) {
2793
            return window.ipu = setup(jQuery, iScroll, Hammer, FastClick);
2625 2794
        });
2626 2795
    } else {
2627 2796
        window.ipu = setup(window.jQuery, window.iScroll, window.Hammer, window.FastClick);

+ 2 - 2
static-res/appmenu-ipu/ipu/js/ipu.min.js

@ -1,3 +1,3 @@
1
!function(){function t(t,e,i,s){var o={};return function(t,e,i){function s(t,i){this.options=i=e.extend({},this.defaultOpt,i),this.el=e(t).eq(0),this.autoPlay=i.autoPlay,this.hasIndicator=i.indicator,this.callBack=i.callBack,this.currentIndex=null,this._init(),this.play()}s.prototype={defaultOpt:{index:null,autoPlay:!1,duration:3e3,indicator:!1,indicatorPosition:"center",callBack:null},_init:function(){var t=e(">.ipu-carousel-wrapper",this.el),s=e(">li",t);if(this.carouselItems=s,this.size=s.size(),that=this,null==this.options.index){var o=s.filter(".ipu-active").index();this.options.index=o!=-1?o:0}this.hasIndicator&&this._addIndicator(),e(window).resize(function(){that.refresh()});var n={snap:"li",momentum:!1,scrollX:!0,scrollY:!1,hScrollbar:!1,onScrollStart:function(){that._pause()},onTouchEnd:function(){},onScrollEnd:function(){that._end()}};this.iscroll=new i(this.el.get(0),n),this.show(this.options.index,0)},stop:function(){this._pause(),this.autoPlay=!1},_pause:function(){this.autoPlay&&this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)},prev:function(){var t=0==this.currentIndex?this.size-1:this.currentIndex-1;this.show(t)},next:function(){var t=this.currentIndex==this.size-1?0:this.currentIndex+1;this.show(t)},show:function(t,e){this._pause(),this.iscroll.scrollToPage(t,0,e)},play:function(){this.autoPlay=!0,this._play()},refresh:function(){var t=this;t.show(this.currentIndex)},_play:function(){if(this.autoPlay&&!this.timeoutId){var t=this;this.timeoutId=setTimeout(function(){this.timeoutId=null,t.next()},t.options.duration)}},_end:function(){var t=this.iscroll.currPageX;t!=this.currentIndex&&(this.callBack&&this.callBack(t,this.currentIndex),this.currentIndex=t,this.hasIndicator&&this.indicatorIndexs.eq(t).addClass("ipu-active").siblings().removeClass("ipu-active"),this.carouselItems.eq(t).addClass("ipu-active").siblings().removeClass("ipu-active")),this._play()},_addIndicator:function(){for(var t="",i=0;i<this.size;i++)t+="<li></li>";t="<ul class='ipu-carousel-indicator'>"+t+"</ul>",this.indicator=e(t).appendTo(this.el),this.indicatorIndexs=e("li",this.indicator)},destroy:function(){this.iscroll.destroy()}},t.carousel=function(t,e){return new s(t,e)}}(o||window,t,e),function(t,e){function i(i){this.options=e.extend({},this.defaultOptions,i),s||(s=t.Picker),this._init()}var s=t.Picker,o=new Date;i.prototype.defaultOptions={template:'<div class="ipu-poppicker ipu-dtpicker">                        <div class="ipu-poppicker-header">                            <button class="ipu-btn ipu-btn-s ipu-poppicker-btn-cancel">取消</button>                            <button class="ipu-btn ipu-btn-s ipu-poppicker-btn-ok">确定</button>                            <button class="ipu-btn ipu-btn-s ipu-poppicker-btn-clear">清除</button>                        </div>                        <div class="ipu-poppicker-title">                            <label class="ipu-dtpicker-y"></label>                            <label class="ipu-dtpicker-m"></label>                            <label class="ipu-dtpicker-d"></label>                            <label class="ipu-dtpicker-h"></label>                            <label class="ipu-dtpicker-mi"></label>                        </div>                        <div>                        <div class="ipu-poppicker-body">                            <div class="ipu-picker" data-id="picker-y">                                <div class="ipu-picker-selectbox"></div>                                <ul></ul>                            </div>                             <div class="ipu-picker" data-id="picker-m">                                <div class="ipu-picker-selectbox"></div>                                <ul></ul>                            </div>                             <div class="ipu-picker" data-id="picker-d">                                <div class="ipu-picker-selectbox"></div>                                <ul></ul>                            </div>                             <div class="ipu-picker" data-id="picker-h">                                <div class="ipu-picker-selectbox"></div>                                <ul></ul>                            </div>                             <div class="ipu-picker" data-id="picker-mi">                                <div class="ipu-picker-selectbox"></div>                                <ul></ul>                            </div>                        </div>                    </div>',buttons:["取消","确认","清除"],labels:["年","月","日","时","分"],type:"datetime",customData:{},hasClear:!1,callBack:function(){}},i.prototype._init=function(){var t=this;this.mask=this.createMask();var i=this.holder=e(this.options.template).appendTo("body"),o=t.ui={picker:this.holder,ok:e(".ipu-poppicker-btn-ok",i),cancel:e(".ipu-poppicker-btn-cancel",i),clear:e(".ipu-poppicker-btn-clear",i),buttons:e(".ipu-poppicker-header .ipu-btn",i),labels:e(".ipu-poppicker-title label",i)};o.i=new s(e('[data-id="picker-mi"]',i),{listen:!1}),o.h=new s(e('[data-id="picker-h"]',i),{listen:!1,onChange:function(e,i){null!==i&&(t.options.beginMonth||t.options.endMonth)&&t._createMinutes()}}),o.d=new s(e('[data-id="picker-d"]',i),{listen:!1,onChange:function(e,i){null!==i&&(t.options.beginMonth||t.options.endMonth)&&t._createHours()}}),o.m=new s(e('[data-id="picker-m"]',i),{listen:!1,onChange:function(e,i){null!==i&&t._createDay()}}),o.y=new s(e('[data-id="picker-y"]',i),{listen:!1,onChange:function(e,i){null!=i&&(t.options.beginMonth||t.options.endMonth?t._createMonth():t._createDay())}}),t._create();var o=t.ui;t._setLabels(),t._setButtons(),o.picker.attr("data-type",this.options.type),t._setSelectedValue(this.options.value)},i.prototype.getSelected=function(){var t=this,e=t.ui,i=t.options.type,s={type:i,y:e.y.getSelectedItem(),m:e.m.getSelectedItem(),d:e.d.getSelectedItem(),h:e.h.getSelectedItem(),i:e.i.getSelectedItem(),toString:function(){return this.value}};switch(i){case"datetime":s.value=s.y.value+"-"+s.m.value+"-"+s.d.value+" "+s.h.value+":"+s.i.value,s.text=s.y.text+"-"+s.m.text+"-"+s.d.text+" "+s.h.text+":"+s.i.text;break;case"date":s.value=s.y.value+"-"+s.m.value+"-"+s.d.value,s.text=s.y.text+"-"+s.m.text+"-"+s.d.text;break;case"time":s.value=s.h.value+":"+s.i.value,s.text=s.h.text+":"+s.i.text;break;case"month":s.value=s.y.value+"-"+s.m.value,s.text=s.y.text+"-"+s.m.text;break;case"hour":s.value=s.y.value+"-"+s.m.value+"-"+s.d.value+" "+s.h.value,s.text=s.y.text+"-"+s.m.text+"-"+s.d.text+" "+s.h.text}return s},i.prototype._setSelectedValue=function(t){var e=this,i=e.ui;t||(t="time"==this.options.type?"00:00":o.getFullYear()+"-"+(o.getMonth()+1)+"-"+o.getDate()+" "+o.getHours()+":"+o.getMinutes());var s=e._parseSetValue(t);i.y.setListen(!0),i.m.setListen(!1),i.d.setListen(!1),i.h.setListen(!1),i.i.setListen(!1),i.y.setSelectedValue(s.y),i.m.setListen(!0),i.m.setSelectedValue(s.m),i.d.setListen(!0),i.d.setSelectedValue(s.d),i.h.setListen(!0),i.h.setSelectedValue(s.h),i.i.setListen(!0),i.i.setSelectedValue(s.i),this.value=this.getSelected().value},i.prototype.setSelectedValue=function(t){this._setSelectedValue(t)},i.prototype.isLeapYear=function(t){return t%4==0&&t%100!=0||t%400==0},i.prototype._inArray=function(t,e){for(var i in t){var s=t[i];if(s===e)return!0}return!1},i.prototype.getDayNum=function(t,e){var i=this;return i._inArray([1,3,5,7,8,10,12],e)?31:i._inArray([4,6,9,11],e)?30:i.isLeapYear(t)?29:28},i.prototype._fill=function(t){return t=t.toString(),t.length<2&&(t=0+t),t},i.prototype._isBeginYear=function(){return this.options.beginYear===parseInt(this.ui.y.getSelectedValue())},i.prototype._isBeginMonth=function(){return this.options.beginMonth&&this._isBeginYear()&&this.options.beginMonth===parseInt(this.ui.m.getSelectedValue())},i.prototype._isBeginDay=function(){return this._isBeginMonth()&&this.options.beginDay===parseInt(this.ui.d.getSelectedValue())},i.prototype._isBeginHours=function(){return this._isBeginDay()&&this.options.beginHours===parseInt(this.ui.h.getSelectedValue())},i.prototype._isEndYear=function(){return this.options.endYear===parseInt(this.ui.y.getSelectedValue())},i.prototype._isEndMonth=function(){return this.options.endMonth&&this._isEndYear()&&this.options.endMonth===parseInt(this.ui.m.getSelectedValue())},i.prototype._isEndDay=function(){return this._isEndMonth()&&this.options.endDay===parseInt(this.ui.d.getSelectedValue())},i.prototype._isEndHours=function(){return this._isEndDay()&&this.options.endHours===parseInt(this.ui.h.getSelectedValue())},i.prototype._createYear=function(t){var e=this,i=e.options,s=e.ui,o=[];if(i.customData.y)o=i.customData.y;else for(var n=i.beginYear,a=i.endYear,r=n;r<=a;r++)o.push({text:r+"",value:r});s.y.setItems(o)},i.prototype._createMonth=function(t){var e=this,i=e.options,s=e.ui,o=[];if(i.customData.m)o=i.customData.m;else for(var n=i.beginMonth&&e._isBeginYear()?i.beginMonth:1,a=i.endMonth&&e._isEndYear()?i.endMonth:12;n<=a;n++){var r=e._fill(n);o.push({text:r,value:n})}s.m.setItems(o)},i.prototype._createDay=function(t){var e=this,i=e.options,s=e.ui,o=[];if(i.customData.d)o=i.customData.d;else for(var n=e._isBeginMonth()?i.beginDay:1,a=e._isEndMonth()?i.endDay:e.getDayNum(parseInt(this.ui.y.getSelectedValue()),parseInt(this.ui.m.getSelectedValue()));n<=a;n++){var r=e._fill(n);o.push({text:r,value:n})}s.d.setItems(o)},i.prototype._createHours=function(t){var e=this,i=e.options,s=e.ui,o=[];if(i.customData.h)o=i.customData.h;else for(var n=e._isBeginDay()?i.beginHours:0,a=e._isEndDay()?i.endHours:23;n<=a;n++){var r=e._fill(n);o.push({text:r,value:n})}s.h.setItems(o)},i.prototype._createMinutes=function(t){var e=this,i=e.options,s=e.ui,o=[];if(i.customData.i)o=i.customData.i;else for(var n=e._isBeginHours()?i.beginMinutes:0,a=e._isEndHours()?i.endMinutes:59;n<=a;n++){var r=e._fill(n);o.push({text:r,value:n})}s.i.setItems(o)},i.prototype._setLabels=function(){var t=this,e=t.options,i=t.ui;i.labels.each(function(t,i){i.innerText=e.labels[t]})},i.prototype._setButtons=function(){var t=this,i=t.options,s=t.ui;s.cancel.text(i.buttons[0]),s.ok.text(i.buttons[1]),i.hasClear?s.clear.text(i.buttons[2]):s.clear.hide(),s.buttons.each(function(i){e(this).click(function(){t.clickCall(i)})})},i.prototype._parseSetValue=function(t){var e=o,i=this.options.type,s={y:e.getFullYear(),m:e.getMonth()+1,d:e.getDate(),h:e.getHours(),i:e.getMinutes()};t instanceof Date&&("time"==i?valu=+t.getHours()+":"+t.getMinutes():t=t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()+" "+t.getHours()+":"+t.getMinutes());for(var n=t.replace(":","-").replace(" ","-").split("-"),a=0,r=n.length;a<r;a++)n[a]=parseInt(n[a]);return"datetime"==i?(s.y=n[0],s.m=n[1],s.d=n[2],s.h=n[3],s.i=n[4]):"date"==i?(s.y=n[0],s.m=n[1],s.d=n[2],s.h=0,s.i=0):"time"==i?(s.h=n[0],s.i=n[1]):"hour"==i?(s.y=n[0],s.m=n[1],s.d=n[2],s.h=n[3],s.i=0):"month"==i&&(s.y=n[0],s.m=n[1],s.d=1,s.h=0,s.i=0),s},i.prototype._create=function(){var t=this,e=this.options,i=o,s=e.beginDate;s?(s=this._parseSetValue(s),e.beginYear=s.y,e.beginMonth=s.m,e.beginDay=s.d,e.beginHours=s.h,e.beginMinutes=s.i):"time"==e.type?(e.beginYear=i.getFullYear(),e.beginMonth=i.getMonth()+1,e.beginDay=i.getDate(),e.beginHours=0,e.beginMinutes=0):e.beginYear=i.getFullYear()-5;var n=e.endDate;n?(n=this._parseSetValue(n),e.endYear=n.y,e.endMonth=n.m,e.endDay=n.d,e.endHours=n.h,e.endMinutes=n.i):"time"==e.type?(e.endYear=i.getFullYear(),e.endMonth=i.getMonth()+1,e.endDay=i.getDate(),e.endHours=24,e.endMinutes=59):e.endYear=e.beginYear+10,t._createYear(),t._createMonth(),t._createDay(),t._createHours(),t._createMinutes()},i.prototype.setBeginDate=function(t){this.options.beginDate=t,this._create()},i.prototype.setEndDate=function(t){this.options.endDate=t,this._create()},i.prototype.dispose=function(){var t=this;t.hide(),setTimeout(function(){t.ui.picker.parentNode.removeChild(t.ui.picker);for(var e in t)t[e]=null,delete t[e];t.disposed=!0},300)},i.prototype.show=function(t){t&&(this.options.callBack=t),this.mask.show(),this.setSelectedValue(this.value),this.holder.addClass("ipu-active")},i.prototype.clickCall=function(t){var e=this,i=e.getSelected(),s=e.options.callBack.call(this,i,t);s!==!1&&(1==t?e.value=i.value:2==t&&(e.value=null),e.hide())},i.prototype.hide=function(){this.mask.close(),this.holder.removeClass("ipu-active")},i.prototype.createMask=function(t){var e=this,i=document.createElement("div");i.classList.add("ipu-picker-backup"),i.addEventListener("click",function(){e.clickCall(0)});var s=[i];return s._show=!1,s.show=function(){return s._show=!0,i.setAttribute("style","opacity:1"),document.body.appendChild(i),s},s._remove=function(){return s._show&&(s._show=!1,i.setAttribute("style","opacity:0"),setTimeout(function(){var t=document.body;i.parentNode===t&&t.removeChild(i)},350)),s},s.close=function(){s._show&&(t?t()!==!1&&s._remove():s._remove())},s},t.dtPicker=function(t){return new i(t)}}(o||window,t),function(t,e,i){function s(t,i){this.options=i=e.extend({},this.defaultOptions,i),this.el=e(t).get(0),this._init()}s.prototype={defaultOptions:{index:null,autoPlay:!1,duration:3e3,indicator:!1,callBack:null,clickBack:null},_init:function(){this.wrapper=e(">.ipu-carousel-wrapper",this.el),this.carouselItems=e(">li",this.wrapper),this.showSize=1,this.carouselItemSizes=[],this.currentIndex=0,this.moveLen=0,this.lastItem=!1,this.carouselItems.slice(0,this.showSize).clone().appendTo(this.wrapper),this.size=this.carouselItems.size();var t=this;this.options.clickBack&&e(">li",this.wrapper).each(function(i){e(this).click(function(){t.options.clickBack.call(this,i%t.size)})}),this.sizeCount();var s=this;if(this.hammer=new i.Manager(this.el),this.hammer.add(new i.Pan({direction:i.DIRECTION_HORIZONTAL,threshold:10})),this.hammer.on("panstart panmove panend pancancel",i.bindFn(this.onPan,this)),e(window).resize(function(){s.refresh()}),null==this.options.index){var o=this.carouselItems.filter(".ipu-active").index();this.options.index=o!=-1?o:0}this.options.indicator&&this._addIndicator(),this.show(this.options.index)},stop:function(){this._pause(),this.options.autoPlay=!1},_pause:function(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)},prev:function(){var t=0==this.currentIndex?this.size-1:this.currentIndex-1;t==this.size-1&&(this._show(this.size,!1),this.wrapper.width()),this._show(t,!0)},next:function(){var t=this.currentIndex==this.size?1:this.currentIndex+1;1==t&&(this._show(0,!1),this.wrapper.width()),this._show(t,!0)},show:function(t){t>this.size||t<0?console.error("index超出范围!"):this._show(t)},play:function(){this.options.autoPlay=!0,this._play()},_play:function(){if(this.options.autoPlay&&!this.timeoutId){var t=this;this.timeoutId=setTimeout(function(){t.timeoutId=null,t.next()},t.options.duration)}},_end:function(){var t=this.currentIndex;this.options.callBack&&this.options.callBack(t,this.lastItem),this.indicator&&this.indicatorIndexs.eq(t).addClass("ipu-active").siblings().removeClass("ipu-active"),this.carouselItems.eq(t).addClass("ipu-active").siblings().removeClass("ipu-active"),this._play()},_addIndicator:function(){for(var t="",i=0;i<this.size;i++)t+="<li></li>";t="<ul class='ipu-carousel-indicator'>"+t+"</ul>",this.indicator=e(t).appendTo(this.el),this.indicatorIndexs=e("li",this.indicator)},sizeCount:function(){this.wrapperSize=this.wrapper.outerWidth(!0),this.itemSize=this.carouselItems.eq(0).outerWidth(!0),this.mostSize=this.size*this.itemSize,e(this.wrapper).removeClass("ipu-carousel-animate").width();var t=this;e(">li",this.wrapper).each(function(i,s){t.carouselItemSizes[i]=e(this).position().left})},refresh:function(){this.wrapperSize!=this.wrapper.outerWidth(!0)&&(this.sizeCount(),this._show(this.currentIndex,!0))},move:function(t){this._pause(),e(this.wrapper).removeClass("ipu-carousel-animate");var i=(this.moveLen-t)%this.mostSize;i=(i+this.mostSize)%this.mostSize,this.displayMoveLen=i,i=-i+"px",e(this.wrapper).css("transform","translate3d("+i+", 0, 0)")},_show:function(t,i){i!==!1&&(i=!0),this._pause(),e(this.wrapper).toggleClass("ipu-carousel-animate",i),this.currentIndex=t%this.size,this.lastItem=t==this.size;var s=this.carouselItemSizes[t];this.moveLen=s,s=-s+"px",e(this.wrapper).css("transform","translate3d("+s+", 0, 0)"),i&&this._end()},onPan:function(t){var e=t.deltaX;if("panend"==t.type||"pancancel"==t.type){var i=e/this.itemSize,s=parseInt(Math.abs(i)),o=Math.abs(i)%1;o>.2&&(s+=1),i>0&&(s=-s);var n=(this.currentIndex+s)%this.size;n=(n+this.size)%this.size,0==n&&this.displayMoveLen>this.itemSize&&(n=this.size),this._show(n)}else"panmove"==t.type&&this.move(e)}},t.hammerCarousel=function(t,e){return new s(t,e)}}(o||window,t,i),function(t,e){function i(t,e){function i(t){if(t.target===this)for(e.call(this,t),s=0;s<o.length;s++)n.off(o[s],i)}var s,o=t,n=this;if(e)for(s=0;s<o.length;s++)n.on(o[s],i)}function s(i){var s=e(this);s.attr("href");s.hasClass("ipu-modal-overlay")&&(e(".ipu-modal.ipu-modal-in").length>0&&n.modalCloseByOutside&&t.closeModal(".ipu-modal.ipu-modal-in"),e(".ipu-actions-modal.ipu-modal-in").length>0&&n.actionsCloseByOutside&&t.closeModal(".ipu-actions-modal.ipu-modal-in")),s.hasClass("ipu-popup-overlay")&&e(".ipu-popup.ipu-modal-in").length>0&&n.popupCloseByOutside&&t.closeModal(".ipu-popup.modal-in")}e.fn.transitionEnd=function(t){return i.call(this,["webkitTransitionEnd","transitionend"],t),this};var o=document.createElement("div"),n={modalStack:!0,modalButtonOk:"确定",modalButtonCancel:"取消",modalPreloaderTitle:"加载中",modalContainer:document.body?document.body:"body"};t.modalStack=[],t.modalStackClearQueue=function(){t.modalStack.length&&t.modalStack.shift()()},t.modal=function(i){i=i||{};var s="",a="";if(i.buttons&&i.buttons.length>0)for(var r=0;r<i.buttons.length;r++)a+='<span class="ipu-modal-button'+(i.buttons[r].bold?" ipu-modal-button-bold":"")+'">'+i.buttons[r].text+"</span>";var l=i.extraClass||"",u=i.title?'<div class="ipu-modal-title">'+i.title+"</div>":"",h=i.text?'<div class="ipu-modal-text">'+i.text+"</div>":"",d=i.afterText?i.afterText:"",c=i.buttons&&0!==i.buttons.length?"":"ipu-modal-no-buttons",p=i.verticalButtons?"ipu-modal-buttons-vertical":"";s='<div class="ipu-modal '+l+" "+c+'"><div class="ipu-modal-inner">'+(u+h+d)+'</div><div class="ipu-modal-buttons '+p+'">'+a+"</div></div>",o.innerHTML=s;var m=e(o).children();return e(n.modalContainer).append(m[0]),m.find(".ipu-modal-button").each(function(s,o){e(o).on("click",function(e){i.buttons[s].close!==!1&&t.closeModal(m),i.buttons[s].onClick&&i.buttons[s].onClick(m,e),i.onClick&&i.onClick(m,s)})}),t.openModal(m),m[0]},t.alert=function(e,i,s){return"function"==typeof i&&(s=arguments[1],i=void 0),t.modal({text:e||"",title:"undefined"==typeof i?n.modalTitle:i,buttons:[{text:n.modalButtonOk,bold:!0,onClick:s}]})},t.confirm=function(e,i,s,o){return"function"==typeof i&&(o=arguments[2],s=arguments[1],i=void 0),t.modal({text:e||"",title:"undefined"==typeof i?n.modalTitle:i,buttons:[{text:n.modalButtonCancel,omodalButtonCancelnClick:o},{text:n.modalButtonOk,bold:!0,onClick:s}]})},t.prompt=function(i,s,o,a){return"function"==typeof s&&(a=arguments[2],o=arguments[1],s=void 0),t.modal({text:i||"",title:"undefined"==typeof s?n.modalTitle:s,afterText:'<input type="text" class="ipu-modal-text-input">',buttons:[{text:n.modalButtonCancel},{text:n.modalButtonOk,bold:!0}],onClick:function(t,i){0===i&&a&&a(e(t).find(".ipu-modal-text-input").val()),1===i&&o&&o(e(t).find(".ipu-modal-text-input").val())}})};var a=!1,r=!1,l=!1,u=null;t.showPreloader=function(e,i){return t.hidePreloader(!0),t.showPreloader.preloaderModal=t.modal({title:e||n.modalPreloaderTitle,text:'<div class="ipu-preloader"></div>'}),i&&(a=!0,u=setTimeout(function(){r=!0,l&&t.hidePreloader()},i)),t.showPreloader.preloaderModal},t.hidePreloader=function(e){e||!a||a&&r?(e&&u&&window.clearTimeout(u),t.showPreloader.preloaderModal&&t.closeModal(t.showPreloader.preloaderModal),a=!1,r=!1,l=!1,u=null):l=!0},t.showIndicator=function(){e(".ipu-preloader-indicator-modal")[0]||e(n.modalContainer).append('<div class="ipu-preloader-indicator-overlay"></div><div class="ipu-preloader-indicator-modal"><span class="ipu-preloader ipu-preloader-white"></span></div>')},t.hideIndicator=function(){e(".ipu-preloader-indicator-overlay, .ipu-preloader-indicator-modal").remove()},t.actions=function(i){var s,a,r;i=i||[],i.length>0&&!e.isArray(i[0])&&(i=[i]);for(var l,u="",h=0;h<i.length;h++)for(var d=0;d<i[h].length;d++){0===d&&(u+='<div class="ipu-actions-modal-group">');var c=i[h][d],p=c.label?"ipu-actions-modal-label":"ipu-actions-modal-button";c.bold&&(p+=" ipu-actions-modal-button-bold"),c.color&&(p+=" ipu-color-"+c.color),c.bg&&(p+=" ipu-bg-"+c.bg),c.disabled&&(p+=" disabled"),u+='<span class="'+p+'">'+c.text+"</span>",d===i[h].length-1&&(u+="</div>")}l='<div class="ipu-actions-modal">'+u+"</div>",o.innerHTML=l,s=e(o).children(),e(n.modalContainer).append(s[0]),a=".ipu-actions-modal-group",r=".ipu-actions-modal-button";var m=s.find(a);return m.each(function(o,n){var a=o;e(n).children().each(function(o,n){var l,u=o,h=i[a][u];e(n).is(r)&&(l=e(n)),l&&l.on("click",function(e){h.close!==!1&&t.closeModal(s),h.onClick&&h.onClick(s,e)})})}),t.openModal(s),s[0]},t.toast=function(i,s,o){var n=e('<div class="ipu-modal ipu-toast '+(o||"")+'">'+i+"</div>").appendTo(document.body);t.openModal(n,function(){setTimeout(function(){t.closeModal(n)},s||2e3)})},t.openModal=function(i,s){i=e(i);var o=i.hasClass("ipu-modal"),a=!i.hasClass("ipu-toast");if(a=!1,e(".ipu-modal.ipu-modal-in:not(.ipu-modal-out)").length&&n.modalStack&&o&&a)return void t.modalStack.push(function(){t.openModal(i,s)});var r=i.hasClass("ipu-popup"),l=i.hasClass("ipu-login-screen"),u=i.hasClass("ipu-picker-modal"),h=i.hasClass("ipu-toast");o&&(i.show(),i.css({marginTop:-Math.round(i.outerHeight()/2)+"px"})),h&&i.css({marginLeft:-Math.round(i.outerWidth()/2)+"px"});var d;l||u||h||(0!==e(".ipu-modal-overlay").length||r||e(n.modalContainer).append('<div class="ipu-modal-overlay"></div>'),0===e(".ipu-popup-overlay").length&&r&&e(n.modalContainer).append('<div class="ipu-popup-overlay"></div>'),d=e(r?".ipu-popup-overlay":".ipu-modal-overlay"));i[0].clientLeft;return i.trigger("open"),u&&e(n.modalContainer).addClass("ipu-with-picker-modal"),l||u||h||d.addClass("ipu-modal-overlay-visible"),i.removeClass("ipu-modal-out").addClass("ipu-modal-in").transitionEnd(function(t){i.hasClass("ipu-modal-out")?i.trigger("closed"):i.trigger("opened")}),"function"==typeof s&&s.call(this),!0},t.closeModal=function(i){if(i=e(i||".ipu-modal-in"),"undefined"==typeof i||0!==i.length){var s=i.hasClass("ipu-modal"),o=i.hasClass("ipu-popup"),a=i.hasClass("ipu-toast"),r=i.hasClass("ipu-login-screen"),l=i.hasClass("ipu-picker-modal"),u=i.hasClass("ipu-remove-on-close"),h=e(o?".ipu-popup-overlay":".ipu-modal-overlay");return o?i.length===e(".ipu-popup.ipu-modal-in").length&&h.removeClass("ipu-modal-overlay-visible"):l||a||h.removeClass("ipu-modal-overlay-visible"),i.trigger("close"),l&&(e(n.modalContainer).removeClass("ipu-with-picker-modal"),e(n.modalContainer).addClass("ipu-picker-modal-closing")),i.removeClass("ipu-modal-in").addClass("ipu-modal-out").transitionEnd(function(t){i.hasClass("ipu-modal-out")?i.trigger("closed"):i.trigger("opened"),l&&e(n.modalContainer).removeClass("ipu-picker-modal-closing"),o||r||l?(i.removeClass("ipu-modal-out").hide(),u&&i.length>0&&i.remove()):i.remove()}),s&&n.modalStack&&t.modalStackClearQueue(),!0}},e(document).on("click"," .ipu-modal-overlay, .ipu-popup-overlay, .ipu-close-popup, .ipu-open-popup, .ipu-close-picker",s)}(o||window,t),function(t,e){function i(t,i){this.options=e.extend({},this.defaultOpt,i),this.content=e(this.options.contentSlt),this.nav=e(t),this.wrapper=e(">ul",this.content),this.contents=e(">li",this.wrapper),this.navs=e(">a",this.nav);var s=this,o=this.navs.filter(".ipu-active").index();o==-1&&(o=this.contents.filter(".ipu-active").index()),this.options.index=o!=-1?o:0,this.options.animate||this.wrapper.addClass("ipu-no-animation"),this.navs.each(function(t,i){e(this).click(function(){s.show(t)})}),this.lastIndex=null,this.currentIndex=null,s.show(this.options.index)}i.prototype.defaultOpt={animate:!1,contentSlt:".ipu-nav-content",callBack:function(t,e){}},i.prototype.show=function(t){if(this.currentIndex!=t){e(this.contents[t]).addClass("ipu-show");this.options.animate?(null!=this.lastIndex&&this.lastIndex!=t&&e(this.contents[this.lastIndex]).removeClass("ipu-show"),null!=this.currentIndex&&(this.currentIndex<t?null!=this.lastIndex&&this.lastIndex<this.currentIndex&&this.wrapper.addClass("ipu-no-animation").removeClass("ipu-nav-content-right").width():(null==this.lastIndex||this.lastIndex>this.currentIndex)&&this.wrapper.addClass("ipu-no-animation").addClass("ipu-nav-content-right").width(),this.wrapper.removeClass("ipu-no-animation").toggleClass("ipu-nav-content-right"))):e(this.contents[this.currentIndex]).removeClass("ipu-show"),e(this.contents[t]).addClass("ipu-active").siblings(".ipu-active").removeClass("ipu-active"),e(this.navs[t]).addClass("ipu-active").siblings(".ipu-active").removeClass("ipu-active"),this.lastIndex=this.currentIndex,this.currentIndex=t,this.options.callBack&&this.options.callBack(this.currentIndex,this.lastIndex)}},t.navBar=function(t,e){return new i(t,e)}}(o||window,t),function(t,e){function i(t,e){function i(t){if(t.target===this)for(e.call(this,t),s=0;s<o.length;s++)n.off(o[s],i)}var s,o=t,n=this;if(e)for(s=0;s<o.length;s++)n.on(o[s],i)}function s(t,e,i){var s=t.createElement("form");s.action=e,s.method="post",s.style.display="none";for(var o in i){var n=t.createElement("input");n.type="hidden",n.name=o,n.value=i[o],s.appendChild(n)}t.body.appendChild(s),s.submit()}function o(){r||(d=e(".ipu-pages"),0==d.size()&&(d=e("<div class='ipu-pages'><div class='ipu-page ipu-show "+f+"' id='"+h+"0'></div>").appendTo("body")),r=!0)}function n(t){return e(t).hasClass(f)}e.fn.animationEnd=function(t){return i.call(this,["webkitAnimationEnd","animationend"],t),this};var a={},r=!1,l={},u=1,h="ipuPage-",d=null,c="ipu-anim ipu-slideRightIn",p="ipu-anim ipu-slideRightOut",m="ipuUIPageBack",f="ipu-page-zero",v="ipu-pages-zero";a.options={target:window.parent,backIndex:-1,closeIndex:-1,params:{},animate:!0,showLoading:!0,loadingMessage:"正在加载中",method:null,minMessageTime:500,callBack:function(){}},a.openPage=function(i,a){function r(){a.showLoading&&t.hidePreloader(),a.animate&&g.removeClass(c),p.siblings(".ipu-show").removeClass("ipu-show"),a.callBack&&a.callBack()}var p=null,m=h+u++;l[m]=i,o(),a.showLoading&&t.showPreloader(a.loadingMessage,a.minMessageTime),p=e("post"==a.method?"<div class='ipu-page' id='"+m+"'><iframe class='ipu-page-iframe'></iframe></div>":"<div class='ipu-page' id='"+m+"'><iframe class='ipu-page-iframe' src='"+i+"'></iframe></div>");var f=n(e(".ipu-page:last",d)),g=p;if(f&&(g=d.addClass(v)),e(".ipu-page-iframe",p).one("load",function(){p.addClass("ipu-show").width(),f&&g.removeClass(v),a.animate?g.addClass(c).animationEnd(r):r()}),p.appendTo(d),"post"==a.method){var b=e(".ipu-page-iframe",p)[0].contentDocument;s(b,i,a.params)}},a.postPage=function(t,e){e.method="post",a.openPage(t,e)},a.backPage=function(t){function i(){e(this).removeClass(p),o.nextAll(".ipu-page").remove();var i,s=e(".ipu-page-iframe",o);i=0==s.size()?window.document:s[0].contentDocument,u&&d.addClass(v);var n=i.createEvent("Event");n.initEvent(m,!0,!0),t.data&&(n.data=t.data),i.body.dispatchEvent(n),t.callBack&&t.callBack()}var s=t.backIndex,o=null,a=e(".ipu-page.ipu-show",d);if(0==s)o=e(".ipu-page:first",d);else{var r=a.prevAll(".ipu-page");o=e(s<0?r[-s-1]:r[r.size()-s])}var l=a,u=n(o);u?l=d:o.addClass("ipu-show"),t.animate?l.addClass(p).animationEnd(i):i()},a.closePage=function(t){var i=t.closeIndex,s=e(".ipu-page.ipu-show",d).prevAll(".ipu-page");i=i<0?-i-1:s.size()-i,e(s[i]).remove(),t.callBack&&t.callBack()},a.open=function(t,i){i=e.extend({},this.options,i),i.target.ipu.page.openPage(t,i)},a.post=function(t,i){i=e.extend({},this.options,i),i.method="post",i.target.ipu.page.openPage(t,i)},a.back=function(t){t=e.extend({},this.options,t),t.target.ipu.page.backPage(t)},a.backHome=function(t){t=t||{},t.backIndex=0,a.back(t)},a.close=function(t){t=e.extend({},this.options,t),t.target.ipu.page.closePage(t)},a.onBack=function(t){e("body").on(m,function(e){var i=e.originalEvent.data;t(i)})},t.page=a}(o||window,t),function(t,e,i){function s(t,i){this.el=e(t)[0],this.options=e.extend({},this.defaultOptions,i),this._init()}var o=9,n=90,a=180/o,r=a;s.prototype.defaultOptions={onChange:function(){},listen:!0,data:[]},s.prototype._init=function(){var s=this;this.wrap=e(">ul",this.el),this.index=null,this.listen=!!this.options.listen,this.beginAngle=0,this.beginExceed=this.beginAngle-r,this.stopInertiaMove=!1,this.lastAngle=null,this.empty=0==this.options.data.length,t.device.ios&&this.wrap.css("transform-origin","center center "+n+"px"),this.hammer=new i.Manager(this.el),this.hammer.add(new i.Pan({direction:i.DIRECTION_VERTICAL,threshold:5})),this.hammer.add(new i.Press({threshold:4})),this.hammer.on("panstart panmove panend pancancel",i.bindFn(this._onPan,this)),this.hammer.on("press pressup",function(t){this.empty||(s.stopInertiaMove=!0,"pressup"==t.type&&s.endScroll())}),this.setItems(this.options.data)},s.prototype.setItems=function(t,i){this.wrap.empty(),this.data=t=t||[],this.empty=0==t.length,this.newData=!0;var s=this,o="";i=i||"text";for(var l=0,u=t.length;l<u;l++)o=o+"<li>"+t[l][i]+"</li>";e(o).appendTo(this.wrap),this.items=e(">li",this.wrap),this.itemsSize=this.items.size(),this.endAngle=(this.empty?0:this.itemsSize-1)*a,this.endExceed=this.endAngle+r,this.items.each(function(t){e(this).css({transform:"translateZ("+n+"px) rotateX(-"+t*a+"deg)","transform-origin":"center center -"+n+"px"}),e(this).click(function(){console.log("click"),s.stopInertiaMove=!0,s.setAngle(t*a,!0)})});var h;h=this.empty||null==this.index?0:this.index>this.itemsSize-1?(this.itemsSize-1)*a:this.index*a,this.setAngle(h,!0)},s.prototype._onPan=function(t){if(!this.empty)if("panstart"==t.type)self.stopInertiaMove=!0,this.lastAngle=this.angle,this.wrap.addClass("ipu-noanimate"),this.stopInertiaMove=!0;else if("panmove"==t.type){var e=this.calcAngle(t.deltaY),i=this.lastAngle-e;i<this.beginExceed&&(i=this.beginExceed),i>this.endExceed&&(i=this.endExceed),this.setAngle(i)}else{var s=t.overallVelocityY,o=s>0?-1:1,n=6e-4*o*-1,a=Math.abs(s/n),r=s*a/2,l=this.angle,u=-this.calcAngle(r),h=u;if(l+u<this.beginExceed&&(u=this.beginExceed-l,a=a*(u/h)*.6),l+u>this.endExceed&&(u=this.endExceed-l,a=a*(u/h)*.6),0==u)return void this.endScroll();this.scrollDistAngle(l,u,a)}};var l=360/(2*n*Math.PI);s.prototype.calcAngle=function(t){return t*l},s.prototype.setAngle=function(t,e){if(this.angle=t,this.wrap.css("transform","perspective(1000px) rotateY(0deg) rotateX("+t+"deg)"),this.calcItemVisable(t),e){var i=t/a,s=this.index;this.index=this.empty?null:i,(s!=i||this.newData)&&(this.newData=!1,this.options.onChange&&this.listen&&this.options.onChange(this.getSelectedItem(),this.index,s,this.newData))}},s.prototype.calcItemVisable=function(t){this.items.each(function(i){var s=Math.abs(i*a-t);s<a/2?e(this).addClass("ipu-highlight ipu-visible"):s>=90-a/2?e(this).removeClass("ipu-highlight ipu-visible"):e(this).addClass("ipu-visible").removeClass("ipu-highlight")})},s.prototype.endScroll=function(){this.wrap.removeClass("ipu-noanimate");var t;if(this.angle<this.beginAngle)t=this.beginAngle;else if(this.angle>this.endAngle)t=this.endAngle;else{var e=parseInt((this.angle/a).toFixed(0));t=a*e}this.setAngle(t,!0)},s.prototype.scrollDistAngle=function(t,e,i){var s=this,o=(new Date).getTime();this.stopInertiaMove=!1,i=1*i,function(t,e,i,o){var n=13,a=o/n,r=0;!function l(){if(!s.stopInertiaMove){var t=s.quartEaseOut(r,e,i,a);return s.setAngle(t),r++,r>a-1||t<s.beginExceed||t>s.endExceed?void s.endScroll():void setTimeout(l,n)}}()}(o,t,e,i)},s.prototype.setListen=function(t){this.listen=!!t},s.prototype.quartEaseOut=function(t,e,i,s){return-i*((t=t/s-1)*t*t*t-1)+e},s.prototype.setSelectedValue=function(t){var e=this;for(var i in e.data){var s=e.data[i];if(s.value==t)return void e.setAngle(i*a,!0)}},s.prototype.getSelectedItem=function(){return this.empty?{}:this.data[this.index];
2
},s.prototype.getSelectedValue=function(){return this.getSelectedItem().value},s.prototype.getSelectedText=function(){return this.getSelectedItem().text},s.prototype.getSelectedIndex=function(){return this.index},t.Picker=s}(o||window,t,i),function(t,e){function i(i){this.options=e.extend({},this.defaultOptions,i),s||(s=t.Picker),this._init()}var s=t.Picker;i.prototype.defaultOptions={template:'<div class="ipu-poppicker">                        <div class="ipu-poppicker-header">                            <button class="ipu-btn ipu-btn-s ipu-poppicker-btn-cancel">取消</button>                            <button class="ipu-btn ipu-btn-s ipu-poppicker-btn-ok">确定</button>                        </div>                        <div class="ipu-poppicker-body">                        </div>                    </div>',pickerTemplate:'<div class="ipu-picker">                            <div class="ipu-picker-selectbox"></div>                            <ul></ul>                          </div>',data:[],layer:1,btns:["取消","确认"],callBack:function(){}},i.prototype._init=function(){this.holder=e(this.options.template).appendTo("body");var t=e(".ipu-poppicker-body",this.holder),i=this.options.layer,o=100/i+"%";this.pickers=new Array(i);var n,a=this;this.mask=this.createMask();for(var r=i-1;r>=0;r--)n=e(this.options.pickerTemplate).prependTo(t).css({width:o}),this.pickers[r]=new s(n,{onChange:function(t){return function(e,s){t!=i-1&&a.pickers[t+1].setItems(e.data)}}(r)});e(".ipu-poppicker-btn-ok",this.holder).click(function(){var t=a.getSelectItems();a.options.callBack(t)!==!1&&a.hide()}).text(this.options.btns[1]),e(".ipu-poppicker-btn-cancel",this.holder).click(function(){a.hide()}).text(this.options.btns[0])},i.prototype.setData=function(t){this.pickers[0].setItems(t)},i.prototype.show=function(t){t&&(this.options.callBack=t),this.mask.show(),this.holder.addClass("ipu-active")},i.prototype.hide=function(){this.mask.close(),this.holder.removeClass("ipu-active")},i.prototype.getSelectItems=function(){if(1==this.options.layer)return this.pickers[0].getSelectedItem();for(var t=[],e=0;e<this.options.layer;e++)t.push(this.pickers[e].getSelectedItem());return t},i.prototype.createMask=function(t){var e=this,i=document.createElement("div");i.classList.add("ipu-picker-backup"),i.addEventListener("click",function(){e.hide()});var s=[i];return s._show=!1,s.show=function(){return s._show=!0,i.setAttribute("style","opacity:1"),document.body.appendChild(i),s},s._remove=function(){return s._show&&(s._show=!1,i.setAttribute("style","opacity:0"),setTimeout(function(){var t=document.body;i.parentNode===t&&t.removeChild(i)},350)),s},s.close=function(){s._show&&(t?t()!==!1&&s._remove():s._remove())},s},t.popPicker=function(t){return new i(t)}}(o||window,t),function(t,e){function i(t,i){this.id=t,this.level=i.level,this.progress=i.progress,this.progressBar=e(t).eq(0),null!=i.progress&&this.setProgress(this.progress),null!=i.level&&this.setLevel(this.level)}i.prototype.setProgress=function(t){t<0||t>100||(e(this.progressBar.find(".ipu-progressbar")).css("transform","translate3d("+-(100-t)+"%, 0px, 0px)"),this.progress=t)},i.prototype.getProgress=function(){return this.progress},i.prototype.setLevel=function(t){"default"==t?(e(this.progressBar).removeClass("ipu-progressbar-success ipu-progressbar-hightlight ipu-progressbar-warning"),e(this.progressBar).addClass("ipu-progress")):"success"==t?(e(this.progressBar).removeClass("ipu-progressbar-highlight ipu-progressbar-warning"),e(this.progressBar).addClass("ipu-progressbar-success")):"highlight"==t?(e(this.progressBar).removeClass("ipu-progressbar-success ipu-progressbar-warning"),e(this.progressBar).addClass("ipu-progressbar-highlight")):"warning"==t&&(e(this.progressBar).removeClass("ipu-progressbar-success ipu-progressbar-highlight"),e(this.progressBar).addClass("ipu-progressbar-warning"))},t.progressBar=function(t,e){return new i(t,e)}}(o||window,t),function(t,e,i){function s(t,s){this.options=e.extend({},this.defaultOptions,s),this.el=e(t).get(0),this._initBottomAndTop();var o=this;this.iScrollOptions={onScrollMove:function(t){o.topEnable&&!o.topLoading&&(this.y>=o.topPullOffset&&!o.topEl.hasClass("ipu-refresh-toload")?o.topEl.addClass("ipu-refresh-toload"):this.y<o.topPullOffset&&o.topEl.hasClass("ipu-refresh-toload")&&o.topEl.removeClass("ipu-refresh-toload")),o._checkBottomLoading(),o.goTop=this.y>o.topPullOffset},onBeforeScrollEnd:function(){o._checkTopLoading(),o._checkBottomLoading()},onScrollEnd:function(){o.topLoading&&this.y<this.minScrollY&&o.goTop&&o.iScroll.scrollTo(0,this.minScrollY,0),o._checkBottomLoading()},onRefresh:function(){o.topLoading&&(this.minScrollY=this.minScrollY+o.topPullOffset)}},this.iScrollOptions=e.extend({},this.options.iScrollOptions,this.iScrollOptions),this.iScroll=new i(this.el,this.iScrollOptions),this._checkContentLoading()}s.prototype.defaultOptions={bottomLoadFun:null,topLoadFun:null,initEnableTop:!0,initEnableBottom:!0,bottomLoadHtml:'<div class="ipu-refresh-bottom"><span class="ipu-refresh-loading"></span></div>',topLoadHtml:'<div class="ipu-refresh-top"><span class="ipu-refresh-loading"></span><div class="ipu-refresh-arrow"></div></div>',bottomAddLen:0,iScrollOptions:{}},s.prototype._initBottomAndTop=function(){this.scrollEl=e(">.ipu-refresh-wrapper",this.el),this.bottomEl=e(this.options.bottomLoadHtml).appendTo(this.scrollEl),this.topEl=e(this.options.topLoadHtml).prependTo(this.scrollEl),this.topPullOffset=this.topEl.outerHeight(),this.bottomPullOffset=this.bottomEl.outerHeight()+this.options.bottomAddLen,this.topLoading=!1,this.bottomLoading=!1,this.bottomEnable=this.options.initEnableBottom&&!!this.options.bottomLoadFun,this.topEnable=this.options.initEnableTop&&!!this.options.topLoadFun,this.goTop=!1,this.enableBottom(this.bottomEnable),this.enableTop(this.topEnable)},s.prototype._checkBottomLoading=function(){this.bottomEnable&&!this.bottomLoading&&this.iScroll.y<this.iScroll.maxScrollY+this.bottomPullOffset&&this._startBottomLoading()},s.prototype._checkTopLoading=function(){this.topEnable&&!this.topLoading&&this.topEl.hasClass("ipu-refresh-toload")&&this._startTopLoading()},s.prototype._checkContentLoading=function(){this.iScroll.maxScrollY>=-this.bottomPullOffset&&this._startBottomLoading()},s.prototype._startBottomLoading=function(){this.bottomEnable&&!this.bottomLoading&&(this.bottomLoading=!0,this.options.bottomLoadFun())},s.prototype._startTopLoading=function(){this.topEnable&&!this.topLoading&&(this.topLoading=!0,this.topEl.removeClass("ipu-refresh-toload").addClass("ipu-refresh-top-loading"),this.iScroll.minScrollY=this.iScroll.minScrollY+this.topPullOffset,this.options.topLoadFun())},s.prototype.endBottomLoading=function(){this.bottomLoading=!1,this.refresh()},s.prototype.endTopLoading=function(){this.topEl.removeClass("ipu-refresh-top-loading"),this.topLoading=!1,this.refresh()},s.prototype.enableTop=function(t){this.topEnable=t,t?this.topEl.show():this.topEl.hide()},s.prototype.enableBottom=function(t){this.bottomEnable=t,t?this.bottomEl.show():this.bottomEl.hide()},s.prototype.refresh=function(){this.iScroll.refresh(),this._checkContentLoading()},t.refresh=function(t,e){return new s(t,e)}}(o||window,t,e),function(t,e){function i(t,i){this.el=e(t).get(0),this.titleItems=e(".ipu-tab-title:first>li",this.el),this.bodyWrapper=e(".ipu-tab-body-wrapper:first",this.el),this.contentItems=e(">li",this.bodyWrapper),this.options=e.extend({},this.defaultOptions,i),this.itemSize=this.contentItems.size(),this.fixed=e(this.el).is(".ipu-tab-fixed");var s=this;this.titleItems.each(function(t){e(this).click(function(){s.show(t)})})}i.prototype.defaultOptions={callBack:null},i.prototype.show=function(t){if(this.fixed){var e=100*-t+"%";this.bodyWrapper.css("transform","translate3d("+e+", 0, 0)")}this.contentItems.eq(t).addClass("ipu-active").siblings().removeClass("ipu-active"),this.titleItems.eq(t).addClass("ipu-active").siblings().removeClass("ipu-active"),this._end(t)},i.prototype._end=function(t){this.lastIndex=this.currentIndex,this.currentIndex=this.index,this.options.callBack&&this.options.callBack(t,this.lastIndex)},t.tab=function(t,e){return new i(t,e)}}(o||window,t),function(t,e){"use strict";var i={},s=[],o=navigator.userAgent;if(console.log("device"),o.match(/ipumobile/i))i.ios=!!o.match(/ios/i),i.android=!!o.match(/android/i);else{var n=o.match(/(Android);?[\s\/]+([\d.]+)?/),a=o.match(/(iPad).*OS\s([\d_]+)/),r=o.match(/(iPod)(.*OS\s([\d_]+))?/),l=!a&&o.match(/(iPhone\sOS)\s([\d_]+)/);if(i.ios=i.android=i.iphone=i.ipad=i.androidChrome=!1,n&&(i.os="android",i.osVersion=n[2],i.android=!0,i.androidChrome=o.toLowerCase().indexOf("chrome")>=0),(a||l||r)&&(i.os="ios",i.ios=!0),l&&!r&&(i.osVersion=l[2].replace(/_/g,"."),i.iphone=!0),a&&(i.osVersion=a[2].replace(/_/g,"."),i.ipad=!0),r&&(i.osVersion=r[3]?r[3].replace(/_/g,"."):null,i.iphone=!0),i.ios&&i.osVersion&&o.indexOf("Version/")>=0&&"10"===i.osVersion.split(".")[0]&&(i.osVersion=o.toLowerCase().split("version/")[1].split(" ")[0]),i.webView=(l||a||r)&&o.match(/.*AppleWebKit(?!.*Safari)/i),i.os&&"ios"===i.os){var u=i.osVersion.split(".");i.minimalUi=!i.webView&&(r||l)&&(1*u[0]===7?1*u[1]>=1:1*u[0]>7)&&e('meta[name="viewport"]').length>0&&e('meta[name="viewport"]').attr("content").indexOf("minimal-ui")>=0}var h=e(window).width(),d=e(window).height();if(i.statusBar=!1,i.webView&&h*d===screen.width*screen.height?i.statusBar=!0:i.statusBar=!1,i.pixelRatio=window.devicePixelRatio||1,s.push("pixel-ratio-"+Math.floor(i.pixelRatio)),i.pixelRatio>=2&&s.push("retina"),i.os&&(s.push(i.os,i.os+"-"+i.osVersion.split(".")[0],i.os+"-"+i.osVersion.replace(/\./g,"-")),"ios"===i.os))for(var c=parseInt(i.osVersion.split(".")[0],10),p=c-1;p>=6;p--)s.push("ios-gt-"+p);i.statusBar?s.push("with-statusbar-overlay"):e("html").removeClass("with-statusbar-overlay"),i.isWeixin=/MicroMessenger/i.test(o)}s.length>0&&e("html").addClass(s.join(" ")),t.device=i}(o||window,t),t(function(){s.attach(document.body)}),o}"function"==typeof define&&define.amd?define(["jquery","iScroll","Hammer","FastClick"],function(e,i,s,o){return window.ipu=t(e,i,s,o)}):window.ipu=t(window.jQuery,window.iScroll,window.Hammer,window.FastClick)}();
1
!function(){function t(t,e,i,s){var o={};return function(t,e,i){function s(t,i){this.options=i=e.extend({},this.defaultOpt,i),this.el=e(t).eq(0),this.autoPlay=i.autoPlay,this.hasIndicator=i.indicator,this.callBack=i.callBack,this.currentIndex=null,this._init(),this.play()}s.prototype={defaultOpt:{index:null,autoPlay:!1,duration:3e3,indicator:!1,indicatorPosition:"center",callBack:null},_init:function(){var t=e(">.ipu-carousel-wrapper",this.el),s=e(">li",t);if(this.carouselItems=s,this.size=s.size(),that=this,null==this.options.index){var o=s.filter(".ipu-current").index();this.options.index=o!=-1?o:0}this.hasIndicator&&this._addIndicator(),e(window).resize(function(){that.refresh()});var n={snap:"li",momentum:!1,scrollX:!0,scrollY:!1,hScrollbar:!1,onScrollStart:function(){that._pause()},onTouchEnd:function(){},onScrollEnd:function(){that._end()}};this.iscroll=new i(this.el.get(0),n),this.show(this.options.index,0)},stop:function(){this._pause(),this.autoPlay=!1},_pause:function(){this.autoPlay&&this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)},prev:function(){var t=0==this.currentIndex?this.size-1:this.currentIndex-1;this.show(t)},next:function(){var t=this.currentIndex==this.size-1?0:this.currentIndex+1;this.show(t)},show:function(t,e){this._pause(),this.iscroll.scrollToPage(t,0,e)},play:function(){this.autoPlay=!0,this._play()},refresh:function(){var t=this;t.show(this.currentIndex)},_play:function(){if(this.autoPlay&&!this.timeoutId){var t=this;this.timeoutId=setTimeout(function(){this.timeoutId=null,t.next()},t.options.duration)}},_end:function(){var t=this.iscroll.currPageX;t!=this.currentIndex&&(this.callBack&&this.callBack(t,this.currentIndex),this.currentIndex=t,this.hasIndicator&&this.indicatorIndexs.eq(t).addClass("ipu-current").siblings().removeClass("ipu-current"),this.carouselItems.eq(t).addClass("ipu-current").siblings().removeClass("ipu-current")),this._play()},_addIndicator:function(){for(var t="",i=0;i<this.size;i++)t+="<li></li>";t="<ul class='ipu-carousel-indicator'>"+t+"</ul>",this.indicator=e(t).appendTo(this.el),this.indicatorIndexs=e("li",this.indicator)},destroy:function(){this.iscroll.destroy()}},t.carousel=function(t,e){return new s(t,e)}}(o||window,t,e),function(t,e){function i(i){this.options=e.extend({},this.defaultOptions,i),s||(s=t.Picker),this._init()}var s=t.Picker,o=new Date;i.prototype.defaultOptions={template:'<div class="ipu-poppicker ipu-dtpicker">                        <div class="ipu-poppicker-header">                            <button class="ipu-btn ipu-btn-s ipu-poppicker-btn-cancel">取消</button>                            <button class="ipu-btn ipu-btn-s ipu-poppicker-btn-ok">确定</button>                            <button class="ipu-btn ipu-btn-s ipu-poppicker-btn-clear">清除</button>                        </div>                        <div class="ipu-poppicker-title">                            <label class="ipu-dtpicker-y"></label>                            <label class="ipu-dtpicker-m"></label>                            <label class="ipu-dtpicker-d"></label>                            <label class="ipu-dtpicker-h"></label>                            <label class="ipu-dtpicker-mi"></label>                        </div>                        <div>                        <div class="ipu-poppicker-body">                            <div class="ipu-picker" data-id="picker-y">                                <div class="ipu-picker-selectbox"></div>                                <ul></ul>                            </div>                             <div class="ipu-picker" data-id="picker-m">                                <div class="ipu-picker-selectbox"></div>                                <ul></ul>                            </div>                             <div class="ipu-picker" data-id="picker-d">                                <div class="ipu-picker-selectbox"></div>                                <ul></ul>                            </div>                             <div class="ipu-picker" data-id="picker-h">                                <div class="ipu-picker-selectbox"></div>                                <ul></ul>                            </div>                             <div class="ipu-picker" data-id="picker-mi">                                <div class="ipu-picker-selectbox"></div>                                <ul></ul>                            </div>                        </div>                    </div>',buttons:["取消","确认","清除"],labels:["年","月","日","时","分"],type:"datetime",customData:{},hasClear:!1,callBack:function(){}},i.prototype._init=function(){var t=this;this.mask=this.createMask();var i=this.holder=e(this.options.template).appendTo("body"),o=t.ui={picker:this.holder,ok:e(".ipu-poppicker-btn-ok",i),cancel:e(".ipu-poppicker-btn-cancel",i),clear:e(".ipu-poppicker-btn-clear",i),buttons:e(".ipu-poppicker-header .ipu-btn",i),labels:e(".ipu-poppicker-title label",i)};o.i=new s(e('[data-id="picker-mi"]',i),{listen:!1}),o.h=new s(e('[data-id="picker-h"]',i),{listen:!1,onChange:function(e,i){null!==i&&(t.options.beginMonth||t.options.endMonth)&&t._createMinutes()}}),o.d=new s(e('[data-id="picker-d"]',i),{listen:!1,onChange:function(e,i){null!==i&&(t.options.beginMonth||t.options.endMonth)&&t._createHours()}}),o.m=new s(e('[data-id="picker-m"]',i),{listen:!1,onChange:function(e,i){null!==i&&t._createDay()}}),o.y=new s(e('[data-id="picker-y"]',i),{listen:!1,onChange:function(e,i){null!=i&&(t.options.beginMonth||t.options.endMonth?t._createMonth():t._createDay())}}),t._create();var o=t.ui;t._setLabels(),t._setButtons(),o.picker.attr("data-type",this.options.type),t._setSelectedValue(this.options.value)},i.prototype.getSelected=function(){var t=this,e=t.ui,i=t.options.type,s={type:i,y:e.y.getSelectedItem(),m:e.m.getSelectedItem(),d:e.d.getSelectedItem(),h:e.h.getSelectedItem(),i:e.i.getSelectedItem(),toString:function(){return this.value}};switch(i){case"datetime":s.value=s.y.value+"-"+s.m.value+"-"+s.d.value+" "+s.h.value+":"+s.i.value,s.text=s.y.text+"-"+s.m.text+"-"+s.d.text+" "+s.h.text+":"+s.i.text;break;case"date":s.value=s.y.value+"-"+s.m.value+"-"+s.d.value,s.text=s.y.text+"-"+s.m.text+"-"+s.d.text;break;case"time":s.value=s.h.value+":"+s.i.value,s.text=s.h.text+":"+s.i.text;break;case"month":s.value=s.y.value+"-"+s.m.value,s.text=s.y.text+"-"+s.m.text;break;case"hour":s.value=s.y.value+"-"+s.m.value+"-"+s.d.value+" "+s.h.value,s.text=s.y.text+"-"+s.m.text+"-"+s.d.text+" "+s.h.text}return s},i.prototype._setSelectedValue=function(t){var e=this,i=e.ui;t||(t="time"==this.options.type?"00:00":o.getFullYear()+"-"+(o.getMonth()+1)+"-"+o.getDate()+" "+o.getHours()+":"+o.getMinutes());var s=e._parseSetValue(t);i.y.setListen(!0),i.m.setListen(!1),i.d.setListen(!1),i.h.setListen(!1),i.i.setListen(!1),i.y.setSelectedValue(s.y),i.m.setListen(!0),i.m.setSelectedValue(s.m),i.d.setListen(!0),i.d.setSelectedValue(s.d),i.h.setListen(!0),i.h.setSelectedValue(s.h),i.i.setListen(!0),i.i.setSelectedValue(s.i),this.value=this.getSelected().value},i.prototype.setSelectedValue=function(t){this._setSelectedValue(t)},i.prototype.isLeapYear=function(t){return t%4==0&&t%100!=0||t%400==0},i.prototype._inArray=function(t,e){for(var i in t){var s=t[i];if(s===e)return!0}return!1},i.prototype.getDayNum=function(t,e){var i=this;return i._inArray([1,3,5,7,8,10,12],e)?31:i._inArray([4,6,9,11],e)?30:i.isLeapYear(t)?29:28},i.prototype._fill=function(t){return t=t.toString(),t.length<2&&(t=0+t),t},i.prototype._isBeginYear=function(){return this.options.beginYear===parseInt(this.ui.y.getSelectedValue())},i.prototype._isBeginMonth=function(){return this.options.beginMonth&&this._isBeginYear()&&this.options.beginMonth===parseInt(this.ui.m.getSelectedValue())},i.prototype._isBeginDay=function(){return this._isBeginMonth()&&this.options.beginDay===parseInt(this.ui.d.getSelectedValue())},i.prototype._isBeginHours=function(){return this._isBeginDay()&&this.options.beginHours===parseInt(this.ui.h.getSelectedValue())},i.prototype._isEndYear=function(){return this.options.endYear===parseInt(this.ui.y.getSelectedValue())},i.prototype._isEndMonth=function(){return this.options.endMonth&&this._isEndYear()&&this.options.endMonth===parseInt(this.ui.m.getSelectedValue())},i.prototype._isEndDay=function(){return this._isEndMonth()&&this.options.endDay===parseInt(this.ui.d.getSelectedValue())},i.prototype._isEndHours=function(){return this._isEndDay()&&this.options.endHours===parseInt(this.ui.h.getSelectedValue())},i.prototype._createYear=function(t){var e=this,i=e.options,s=e.ui,o=[];if(i.customData.y)o=i.customData.y;else for(var n=i.beginYear,a=i.endYear,r=n;r<=a;r++)o.push({text:r+"",value:r});s.y.setItems(o)},i.prototype._createMonth=function(t){var e=this,i=e.options,s=e.ui,o=[];if(i.customData.m)o=i.customData.m;else for(var n=i.beginMonth&&e._isBeginYear()?i.beginMonth:1,a=i.endMonth&&e._isEndYear()?i.endMonth:12;n<=a;n++){var r=e._fill(n);o.push({text:r,value:n})}s.m.setItems(o)},i.prototype._createDay=function(t){var e=this,i=e.options,s=e.ui,o=[];if(i.customData.d)o=i.customData.d;else for(var n=e._isBeginMonth()?i.beginDay:1,a=e._isEndMonth()?i.endDay:e.getDayNum(parseInt(this.ui.y.getSelectedValue()),parseInt(this.ui.m.getSelectedValue()));n<=a;n++){var r=e._fill(n);o.push({text:r,value:n})}s.d.setItems(o)},i.prototype._createHours=function(t){var e=this,i=e.options,s=e.ui,o=[];if(i.customData.h)o=i.customData.h;else for(var n=e._isBeginDay()?i.beginHours:0,a=e._isEndDay()?i.endHours:23;n<=a;n++){var r=e._fill(n);o.push({text:r,value:n})}s.h.setItems(o)},i.prototype._createMinutes=function(t){var e=this,i=e.options,s=e.ui,o=[];if(i.customData.i)o=i.customData.i;else for(var n=e._isBeginHours()?i.beginMinutes:0,a=e._isEndHours()?i.endMinutes:59;n<=a;n++){var r=e._fill(n);o.push({text:r,value:n})}s.i.setItems(o)},i.prototype._setLabels=function(){var t=this,e=t.options,i=t.ui;i.labels.each(function(t,i){i.innerText=e.labels[t]})},i.prototype._setButtons=function(){var t=this,i=t.options,s=t.ui;s.cancel.text(i.buttons[0]),s.ok.text(i.buttons[1]),i.hasClear?s.clear.text(i.buttons[2]):s.clear.hide(),s.buttons.each(function(i){e(this).click(function(){t.clickCall(i)})})},i.prototype._parseSetValue=function(t){var e=o,i=this.options.type,s={y:e.getFullYear(),m:e.getMonth()+1,d:e.getDate(),h:e.getHours(),i:e.getMinutes()};t instanceof Date&&("time"==i?valu=+t.getHours()+":"+t.getMinutes():t=t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()+" "+t.getHours()+":"+t.getMinutes());for(var n=t.replace(":","-").replace(" ","-").split("-"),a=0,r=n.length;a<r;a++)n[a]=parseInt(n[a]);return"datetime"==i?(s.y=n[0],s.m=n[1],s.d=n[2],s.h=n[3],s.i=n[4]):"date"==i?(s.y=n[0],s.m=n[1],s.d=n[2],s.h=0,s.i=0):"time"==i?(s.h=n[0],s.i=n[1]):"hour"==i?(s.y=n[0],s.m=n[1],s.d=n[2],s.h=n[3],s.i=0):"month"==i&&(s.y=n[0],s.m=n[1],s.d=1,s.h=0,s.i=0),s},i.prototype._create=function(){var t=this,e=this.options,i=o,s=e.beginDate;s?(s=this._parseSetValue(s),e.beginYear=s.y,e.beginMonth=s.m,e.beginDay=s.d,e.beginHours=s.h,e.beginMinutes=s.i):"time"==e.type?(e.beginYear=i.getFullYear(),e.beginMonth=i.getMonth()+1,e.beginDay=i.getDate(),e.beginHours=0,e.beginMinutes=0):e.beginYear=i.getFullYear()-5;var n=e.endDate;n?(n=this._parseSetValue(n),e.endYear=n.y,e.endMonth=n.m,e.endDay=n.d,e.endHours=n.h,e.endMinutes=n.i):"time"==e.type?(e.endYear=i.getFullYear(),e.endMonth=i.getMonth()+1,e.endDay=i.getDate(),e.endHours=24,e.endMinutes=59):e.endYear=e.beginYear+10,t._createYear(),t._createMonth(),t._createDay(),t._createHours(),t._createMinutes()},i.prototype.setBeginDate=function(t){this.options.beginDate=t,this._create()},i.prototype.setEndDate=function(t){this.options.endDate=t,this._create()},i.prototype.dispose=function(){var t=this;t.hide(),setTimeout(function(){t.ui.picker.parentNode.removeChild(t.ui.picker);for(var e in t)t[e]=null,delete t[e];t.disposed=!0},300)},i.prototype.show=function(t){t&&(this.options.callBack=t),this.mask.show(),this.setSelectedValue(this.value),this.holder.addClass("ipu-current")},i.prototype.clickCall=function(t){var e=this,i=e.getSelected(),s=e.options.callBack.call(this,i,t);s!==!1&&(1==t?e.value=i.value:2==t&&(e.value=null),e.hide())},i.prototype.hide=function(){this.mask.close(),this.holder.removeClass("ipu-current")},i.prototype.createMask=function(t){var e=this,i=document.createElement("div");i.classList.add("ipu-picker-backup"),i.addEventListener("click",function(){e.clickCall(0)});var s=[i];return s._show=!1,s.show=function(){return s._show=!0,i.setAttribute("style","opacity:1"),document.body.appendChild(i),s},s._remove=function(){return s._show&&(s._show=!1,i.setAttribute("style","opacity:0"),setTimeout(function(){var t=document.body;i.parentNode===t&&t.removeChild(i)},350)),s},s.close=function(){s._show&&(t?t()!==!1&&s._remove():s._remove())},s},t.dtPicker=function(t){return new i(t)}}(o||window,t),function(t,e,i){function s(t,i){this.options=i=e.extend({},this.defaultOptions,i),this.el=e(t).get(0),this._init()}s.prototype={defaultOptions:{index:null,autoPlay:!1,duration:3e3,indicator:!1,callBack:null,clickBack:null},_init:function(){this.wrapper=e(">.ipu-carousel-wrapper",this.el),this.carouselItems=e(">li",this.wrapper),this.showSize=1,this.carouselItemSizes=[],this.currentIndex=0,this.moveLen=0,this.lastItem=!1,this.carouselItems.slice(0,this.showSize).clone().appendTo(this.wrapper),this.size=this.carouselItems.size();var t=this;this.options.clickBack&&e(">li",this.wrapper).each(function(i){e(this).click(function(){t.options.clickBack.call(this,i%t.size)})}),this.sizeCount();var s=this;if(this.hammer=new i.Manager(this.el),this.hammer.add(new i.Pan({direction:i.DIRECTION_HORIZONTAL,threshold:10})),this.hammer.on("panstart panmove panend pancancel",i.bindFn(this.onPan,this)),e(window).resize(function(){s.refresh()}),null==this.options.index){var o=this.carouselItems.filter(".ipu-current").index();this.options.index=o!=-1?o:0}this.options.indicator&&this._addIndicator(),this.show(this.options.index)},stop:function(){this._pause(),this.options.autoPlay=!1},_pause:function(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)},prev:function(){var t=0==this.currentIndex?this.size-1:this.currentIndex-1;t==this.size-1&&(this._show(this.size,!1),this.wrapper.width()),this._show(t,!0)},next:function(){var t=this.currentIndex==this.size?1:this.currentIndex+1;1==t&&(this._show(0,!1),this.wrapper.width()),this._show(t,!0)},show:function(t){t>this.size||t<0?console.error("index超出范围!"):this._show(t)},play:function(){this.options.autoPlay=!0,this._play()},_play:function(){if(this.options.autoPlay&&!this.timeoutId){var t=this;this.timeoutId=setTimeout(function(){t.timeoutId=null,t.next()},t.options.duration)}},_end:function(){var t=this.currentIndex;this.options.callBack&&this.options.callBack(t,this.lastItem),this.indicator&&this.indicatorIndexs.eq(t).addClass("ipu-current").siblings().removeClass("ipu-current"),this.carouselItems.eq(t).addClass("ipu-current").siblings().removeClass("ipu-current"),this._play()},_addIndicator:function(){for(var t="",i=0;i<this.size;i++)t+="<li></li>";t="<ul class='ipu-carousel-indicator'>"+t+"</ul>",this.indicator=e(t).appendTo(this.el),this.indicatorIndexs=e("li",this.indicator)},sizeCount:function(){this.wrapperSize=this.wrapper.outerWidth(!0),this.itemSize=this.carouselItems.eq(0).outerWidth(!0),this.mostSize=this.size*this.itemSize,e(this.wrapper).removeClass("ipu-carousel-animate").width();var t=this;e(">li",this.wrapper).each(function(i,s){t.carouselItemSizes[i]=e(this).position().left})},refresh:function(){this.wrapperSize!=this.wrapper.outerWidth(!0)&&(this.sizeCount(),this._show(this.currentIndex,!0))},move:function(t){this._pause(),e(this.wrapper).removeClass("ipu-carousel-animate");var i=(this.moveLen-t)%this.mostSize;i=(i+this.mostSize)%this.mostSize,this.displayMoveLen=i,i=-i+"px",e(this.wrapper).css("transform","translate3d("+i+", 0, 0)")},_show:function(t,i){i!==!1&&(i=!0),this._pause(),e(this.wrapper).toggleClass("ipu-carousel-animate",i),this.currentIndex=t%this.size,this.lastItem=t==this.size;var s=this.carouselItemSizes[t];this.moveLen=s,s=-s+"px",e(this.wrapper).css("transform","translate3d("+s+", 0, 0)"),i&&this._end()},onPan:function(t){var e=t.deltaX;if("panend"==t.type||"pancancel"==t.type){var i=e/this.itemSize,s=parseInt(Math.abs(i)),o=Math.abs(i)%1;o>.2&&(s+=1),i>0&&(s=-s);var n=(this.currentIndex+s)%this.size;n=(n+this.size)%this.size,0==n&&this.displayMoveLen>this.itemSize&&(n=this.size),this._show(n)}else"panmove"==t.type&&this.move(e)}},t.hammerCarousel=function(t,e){return new s(t,e)}}(o||window,t,i),function(t,e){function i(t,e){function i(t){if(t.target===this)for(e.call(this,t),s=0;s<o.length;s++)n.off(o[s],i)}var s,o=t,n=this;if(e)for(s=0;s<o.length;s++)n.on(o[s],i)}function s(i){var s=e(this);s.attr("href");s.hasClass("ipu-modal-overlay")&&(e(".ipu-modal.ipu-modal-in").length>0&&n.modalCloseByOutside&&t.closeModal(".ipu-modal.ipu-modal-in"),e(".ipu-actions-modal.ipu-modal-in").length>0&&n.actionsCloseByOutside&&t.closeModal(".ipu-actions-modal.ipu-modal-in")),s.hasClass("ipu-popup-overlay")&&e(".ipu-popup.ipu-modal-in").length>0&&n.popupCloseByOutside&&t.closeModal(".ipu-popup.modal-in")}e.fn.transitionEnd=function(t){return i.call(this,["webkitTransitionEnd","transitionend"],t),this};var o=document.createElement("div"),n={modalStack:!0,modalButtonOk:"确定",modalButtonCancel:"取消",modalPreloaderTitle:"加载中",modalContainer:document.body?document.body:"body"};t.modalStack=[],t.modalStackClearQueue=function(){t.modalStack.length&&t.modalStack.shift()()},t.modal=function(i){i=i||{};var s="",a="";if(i.buttons&&i.buttons.length>0)for(var r=0;r<i.buttons.length;r++)a+='<span class="ipu-modal-button'+(i.buttons[r].bold?" ipu-modal-button-bold":"")+'">'+i.buttons[r].text+"</span>";var l=i.extraClass||"",u=i.title?'<div class="ipu-modal-title">'+i.title+"</div>":"",c=i.text?'<div class="ipu-modal-text">'+i.text+"</div>":"",d=i.afterText?i.afterText:"",h=i.buttons&&0!==i.buttons.length?"":"ipu-modal-no-buttons",p=i.verticalButtons?"ipu-modal-buttons-vertical":"";s='<div class="ipu-modal '+l+" "+h+'"><div class="ipu-modal-inner">'+(u+c+d)+'</div><div class="ipu-modal-buttons '+p+'">'+a+"</div></div>",o.innerHTML=s;var m=e(o).children();return e(n.modalContainer).append(m[0]),m.find(".ipu-modal-button").each(function(s,o){e(o).on("click",function(e){i.buttons[s].close!==!1&&t.closeModal(m),i.buttons[s].onClick&&i.buttons[s].onClick(m,e),i.onClick&&i.onClick(m,s)})}),t.openModal(m),m[0]},t.alert=function(e,i,s){return"function"==typeof i&&(s=arguments[1],i=void 0),t.modal({text:e||"",title:"undefined"==typeof i?n.modalTitle:i,buttons:[{text:n.modalButtonOk,bold:!0,onClick:s}]})},t.confirm=function(e,i,s,o){return"function"==typeof i&&(o=arguments[2],s=arguments[1],i=void 0),t.modal({text:e||"",title:"undefined"==typeof i?n.modalTitle:i,buttons:[{text:n.modalButtonCancel,omodalButtonCancelnClick:o},{text:n.modalButtonOk,bold:!0,onClick:s}]})},t.prompt=function(i,s,o,a){return"function"==typeof s&&(a=arguments[2],o=arguments[1],s=void 0),t.modal({text:i||"",title:"undefined"==typeof s?n.modalTitle:s,afterText:'<input type="text" class="ipu-modal-text-input">',buttons:[{text:n.modalButtonCancel},{text:n.modalButtonOk,bold:!0}],onClick:function(t,i){0===i&&a&&a(e(t).find(".ipu-modal-text-input").val()),1===i&&o&&o(e(t).find(".ipu-modal-text-input").val())}})};var a=!1,r=!1,l=!1,u=null;t.showPreloader=function(e,i){return t.hidePreloader(!0),t.showPreloader.preloaderModal=t.modal({title:e||n.modalPreloaderTitle,text:'<div class="ipu-preloader"></div>'}),i&&(a=!0,u=setTimeout(function(){r=!0,l&&t.hidePreloader()},i)),t.showPreloader.preloaderModal},t.hidePreloader=function(e){e||!a||a&&r?(e&&u&&window.clearTimeout(u),t.showPreloader.preloaderModal&&t.closeModal(t.showPreloader.preloaderModal),a=!1,r=!1,l=!1,u=null):l=!0},t.showIndicator=function(){e(".ipu-preloader-indicator-modal")[0]||e(n.modalContainer).append('<div class="ipu-preloader-indicator-overlay"></div><div class="ipu-preloader-indicator-modal"><span class="ipu-preloader ipu-preloader-white"></span></div>')},t.hideIndicator=function(){e(".ipu-preloader-indicator-overlay, .ipu-preloader-indicator-modal").remove()},t.actions=function(i){var s,a,r;i=i||[],i.length>0&&!e.isArray(i[0])&&(i=[i]);for(var l,u="",c=0;c<i.length;c++)for(var d=0;d<i[c].length;d++){0===d&&(u+='<div class="ipu-actions-modal-group">');var h=i[c][d],p=h.label?"ipu-actions-modal-label":"ipu-actions-modal-button";h.bold&&(p+=" ipu-actions-modal-button-bold"),h.color&&(p+=" ipu-color-"+h.color),h.bg&&(p+=" ipu-bg-"+h.bg),h.disabled&&(p+=" disabled"),u+='<span class="'+p+'">'+h.text+"</span>",d===i[c].length-1&&(u+="</div>")}l='<div class="ipu-actions-modal">'+u+"</div>",o.innerHTML=l,s=e(o).children(),e(n.modalContainer).append(s[0]),a=".ipu-actions-modal-group",r=".ipu-actions-modal-button";var m=s.find(a);return m.each(function(o,n){var a=o;e(n).children().each(function(o,n){var l,u=o,c=i[a][u];e(n).is(r)&&(l=e(n)),l&&l.on("click",function(e){c.close!==!1&&t.closeModal(s),c.onClick&&c.onClick(s,e)})})}),t.openModal(s),s[0]},t.toast=function(i,s,o){var n=e('<div class="ipu-modal ipu-toast '+(o||"")+'">'+i+"</div>").appendTo(document.body);t.openModal(n,function(){setTimeout(function(){t.closeModal(n)},s||2e3)})},t.openModal=function(i,s){i=e(i);var o=i.hasClass("ipu-modal"),a=!i.hasClass("ipu-toast");if(a=!1,e(".ipu-modal.ipu-modal-in:not(.ipu-modal-out)").length&&n.modalStack&&o&&a)return void t.modalStack.push(function(){t.openModal(i,s)});var r=i.hasClass("ipu-popup"),l=i.hasClass("ipu-login-screen"),u=i.hasClass("ipu-picker-modal"),c=i.hasClass("ipu-toast");o&&(i.show(),i.css({marginTop:-Math.round(i.outerHeight()/2)+"px"})),c&&i.css({marginLeft:-Math.round(i.outerWidth()/2)+"px"});var d;l||u||c||(0!==e(".ipu-modal-overlay").length||r||e(n.modalContainer).append('<div class="ipu-modal-overlay"></div>'),0===e(".ipu-popup-overlay").length&&r&&e(n.modalContainer).append('<div class="ipu-popup-overlay"></div>'),d=e(r?".ipu-popup-overlay":".ipu-modal-overlay"));i[0].clientLeft;return i.trigger("open"),u&&e(n.modalContainer).addClass("ipu-with-picker-modal"),l||u||c||d.addClass("ipu-modal-overlay-visible"),i.removeClass("ipu-modal-out").addClass("ipu-modal-in").transitionEnd(function(t){i.hasClass("ipu-modal-out")?i.trigger("closed"):i.trigger("opened")}),"function"==typeof s&&s.call(this),!0},t.closeModal=function(i){if(i=e(i||".ipu-modal-in"),"undefined"==typeof i||0!==i.length){var s=i.hasClass("ipu-modal"),o=i.hasClass("ipu-popup"),a=i.hasClass("ipu-toast"),r=i.hasClass("ipu-login-screen"),l=i.hasClass("ipu-picker-modal"),u=i.hasClass("ipu-remove-on-close"),c=e(o?".ipu-popup-overlay":".ipu-modal-overlay");return o?i.length===e(".ipu-popup.ipu-modal-in").length&&c.removeClass("ipu-modal-overlay-visible"):l||a||c.removeClass("ipu-modal-overlay-visible"),i.trigger("close"),l&&(e(n.modalContainer).removeClass("ipu-with-picker-modal"),e(n.modalContainer).addClass("ipu-picker-modal-closing")),i.removeClass("ipu-modal-in").addClass("ipu-modal-out").transitionEnd(function(t){i.hasClass("ipu-modal-out")?i.trigger("closed"):i.trigger("opened"),l&&e(n.modalContainer).removeClass("ipu-picker-modal-closing"),o||r||l?(i.removeClass("ipu-modal-out").hide(),u&&i.length>0&&i.remove()):i.remove()}),s&&n.modalStack&&t.modalStackClearQueue(),!0}},e(document).on("click"," .ipu-modal-overlay, .ipu-popup-overlay, .ipu-close-popup, .ipu-open-popup, .ipu-close-picker",s)}(o||window,t),function(t,e){function i(t,i){this.options=e.extend({},this.defaultOpt,i),this.content=e(this.options.contentSlt),this.nav=e(t),this.wrapper=e(">ul",this.content),this.contents=e(">li",this.wrapper),this.navs=e(">a",this.nav);var s=this,o=this.navs.filter(".ipu-current").index();o==-1&&(o=this.contents.filter(".ipu-current").index()),this.options.index=o!=-1?o:0,this.options.animate||this.wrapper.addClass("ipu-no-animation"),this.navs.each(function(t,i){e(this).click(function(){s.show(t)})}),this.lastIndex=null,this.currentIndex=null,s.show(this.options.index)}i.prototype.defaultOpt={animate:!1,contentSlt:".ipu-nav-content",callBack:function(t,e){}},i.prototype.show=function(t){if(this.currentIndex!=t){e(this.contents[t]).addClass("ipu-show");this.options.animate?(null!=this.lastIndex&&this.lastIndex!=t&&e(this.contents[this.lastIndex]).removeClass("ipu-show"),null!=this.currentIndex&&(this.currentIndex<t?null!=this.lastIndex&&this.lastIndex<this.currentIndex&&this.wrapper.addClass("ipu-no-animation").removeClass("ipu-nav-content-right").width():(null==this.lastIndex||this.lastIndex>this.currentIndex)&&this.wrapper.addClass("ipu-no-animation").addClass("ipu-nav-content-right").width(),this.wrapper.removeClass("ipu-no-animation").toggleClass("ipu-nav-content-right"))):e(this.contents[this.currentIndex]).removeClass("ipu-show"),e(this.contents[t]).addClass("ipu-current").siblings(".ipu-current").removeClass("ipu-current"),e(this.navs[t]).addClass("ipu-current").siblings(".ipu-current").removeClass("ipu-current"),this.lastIndex=this.currentIndex,this.currentIndex=t,this.options.callBack&&this.options.callBack(this.currentIndex,this.lastIndex)}},t.navBar=function(t,e){return new i(t,e)}}(o||window,t),function(t,e){function i(t,e){function i(t){if(t.target===this)for(e.call(this,t),s=0;s<o.length;s++)n.off(o[s],i)}var s,o=t,n=this;if(e)for(s=0;s<o.length;s++)n.on(o[s],i)}function s(t,e,i){var s=t.createElement("form");s.action=e,s.method="post",s.style.display="none";for(var o in i){var n=t.createElement("input");n.type="hidden",n.name=o,n.value=i[o],s.appendChild(n)}t.body.appendChild(s),s.submit()}function o(){r||(d=e(".ipu-pages"),0==d.size()&&(d=e("<div class='ipu-pages'><div class='ipu-page ipu-show "+f+"' id='"+c+"0'></div>").appendTo("body")),r=!0)}function n(t){return e(t).hasClass(f)}e.fn.animationEnd=function(t){return i.call(this,["webkitAnimationEnd","animationend"],t),this};var a={},r=!1,l={},u=1,c="ipuPage-",d=null,h="ipu-anim ipu-slideRightIn",p="ipu-anim ipu-slideRightOut",m="ipuUIPageBack",f="ipu-page-zero",v="ipu-pages-zero";a.options={target:window.parent,backIndex:-1,closeIndex:-1,params:{},animate:!0,showLoading:!0,loadingMessage:"正在加载中",method:null,minMessageTime:500,callBack:function(){}},a.openPage=function(i,a){function r(){a.showLoading&&t.hidePreloader(),a.animate&&g.removeClass(h),p.siblings(".ipu-show").removeClass("ipu-show"),a.callBack&&a.callBack()}var p=null,m=c+u++;l[m]=i,o(),a.showLoading&&t.showPreloader(a.loadingMessage,a.minMessageTime),p=e("post"==a.method?"<div class='ipu-page' id='"+m+"'><iframe class='ipu-page-iframe'></iframe></div>":"<div class='ipu-page' id='"+m+"'><iframe class='ipu-page-iframe' src='"+i+"'></iframe></div>");var f=n(e(".ipu-page:last",d)),g=p;if(f&&(g=d.addClass(v)),e(".ipu-page-iframe",p).one("load",function(){p.addClass("ipu-show").width(),f&&g.removeClass(v),a.animate?g.addClass(h).animationEnd(r):r()}),p.appendTo(d),"post"==a.method){var b=e(".ipu-page-iframe",p)[0].contentDocument;s(b,i,a.params)}},a.postPage=function(t,e){e.method="post",a.openPage(t,e)},a.backPage=function(t){function i(){e(this).removeClass(p),o.nextAll(".ipu-page").remove();var i,s=e(".ipu-page-iframe",o);i=0==s.size()?window.document:s[0].contentDocument,u&&d.addClass(v);var n=i.createEvent("Event");n.initEvent(m,!0,!0),t.data&&(n.data=t.data),i.body.dispatchEvent(n),t.callBack&&t.callBack()}var s=t.backIndex,o=null,a=e(".ipu-page.ipu-show",d);if(0==s)o=e(".ipu-page:first",d);else{var r=a.prevAll(".ipu-page");o=e(s<0?r[-s-1]:r[r.size()-s])}var l=a,u=n(o);u?l=d:o.addClass("ipu-show"),t.animate?l.addClass(p).animationEnd(i):i()},a.closePage=function(t){var i=t.closeIndex,s=e(".ipu-page.ipu-show",d).prevAll(".ipu-page");i=i<0?-i-1:s.size()-i,e(s[i]).remove(),t.callBack&&t.callBack()},a.open=function(t,i){i=e.extend({},this.options,i),i.target.ipu.page.openPage(t,i)},a.post=function(t,i){i=e.extend({},this.options,i),i.method="post",i.target.ipu.page.openPage(t,i)},a.back=function(t){t=e.extend({},this.options,t),t.target.ipu.page.backPage(t)},a.backHome=function(t){t=t||{},t.backIndex=0,a.back(t)},a.close=function(t){t=e.extend({},this.options,t),t.target.ipu.page.closePage(t)},a.onBack=function(t){e("body").on(m,function(e){var i=e.originalEvent.data;t(i)})},t.page=a}(o||window,t),function(t,e,i){function s(t,i){this.el=e(t)[0],this.options=e.extend({},this.defaultOptions,i),this._init()}var o=9,n=90,a=180/o,r=a;s.prototype.defaultOptions={onChange:function(){},listen:!0,data:[]},s.prototype._init=function(){var s=this;this.wrap=e(">ul",this.el),this.index=null,this.listen=!!this.options.listen,this.beginAngle=0,this.beginExceed=this.beginAngle-r,this.stopInertiaMove=!1,this.lastAngle=null,this.empty=0==this.options.data.length,t.device.ios&&this.wrap.css("transform-origin","center center "+n+"px"),this.hammer=new i.Manager(this.el),this.hammer.add(new i.Pan({direction:i.DIRECTION_VERTICAL,threshold:5})),this.hammer.add(new i.Press({threshold:4})),this.hammer.on("panstart panmove panend pancancel",i.bindFn(this._onPan,this)),this.hammer.on("press pressup",function(t){this.empty||(s.stopInertiaMove=!0,"pressup"==t.type&&s.endScroll())}),this.setItems(this.options.data)},s.prototype.setItems=function(t,i){this.wrap.empty(),this.data=t=t||[],this.empty=0==t.length,this.newData=!0;var s=this,o="";i=i||"text";for(var l=0,u=t.length;l<u;l++)o=o+"<li>"+t[l][i]+"</li>";e(o).appendTo(this.wrap),this.items=e(">li",this.wrap),this.itemsSize=this.items.size(),this.endAngle=(this.empty?0:this.itemsSize-1)*a,this.endExceed=this.endAngle+r,this.items.each(function(t){e(this).css({transform:"translateZ("+n+"px) rotateX(-"+t*a+"deg)","transform-origin":"center center -"+n+"px"}),e(this).click(function(){console.log("click"),s.stopInertiaMove=!0,s.setAngle(t*a,!0)})});var c;c=this.empty||null==this.index?0:this.index>this.itemsSize-1?(this.itemsSize-1)*a:this.index*a,this.setAngle(c,!0)},s.prototype._onPan=function(t){if(!this.empty)if("panstart"==t.type)self.stopInertiaMove=!0,this.lastAngle=this.angle,this.wrap.addClass("ipu-noanimate"),this.stopInertiaMove=!0;else if("panmove"==t.type){var e=this.calcAngle(t.deltaY),i=this.lastAngle-e;i<this.beginExceed&&(i=this.beginExceed),i>this.endExceed&&(i=this.endExceed),this.setAngle(i)}else{var s=t.overallVelocityY,o=s>0?-1:1,n=6e-4*o*-1,a=Math.abs(s/n),r=s*a/2,l=this.angle,u=-this.calcAngle(r),c=u;if(l+u<this.beginExceed&&(u=this.beginExceed-l,a=a*(u/c)*.6),l+u>this.endExceed&&(u=this.endExceed-l,a=a*(u/c)*.6),0==u)return void this.endScroll();this.scrollDistAngle(l,u,a)}};var l=360/(2*n*Math.PI);s.prototype.calcAngle=function(t){return t*l},s.prototype.setAngle=function(t,e){if(this.angle=t,this.wrap.css("transform","perspective(1000px) rotateY(0deg) rotateX("+t+"deg)"),this.calcItemVisable(t),e){var i=t/a,s=this.index;this.index=this.empty?null:i,(s!=i||this.newData)&&(this.newData=!1,this.options.onChange&&this.listen&&this.options.onChange(this.getSelectedItem(),this.index,s,this.newData))}},s.prototype.calcItemVisable=function(t){this.items.each(function(i){var s=Math.abs(i*a-t);s<a/2?e(this).addClass("ipu-highlight ipu-visible"):s>=90-a/2?e(this).removeClass("ipu-highlight ipu-visible"):e(this).addClass("ipu-visible").removeClass("ipu-highlight")})},s.prototype.endScroll=function(){this.wrap.removeClass("ipu-noanimate");var t;if(this.angle<this.beginAngle)t=this.beginAngle;else if(this.angle>this.endAngle)t=this.endAngle;else{var e=parseInt((this.angle/a).toFixed(0));t=a*e}this.setAngle(t,!0)},s.prototype.scrollDistAngle=function(t,e,i){var s=this,o=(new Date).getTime();this.stopInertiaMove=!1,i=1*i,function(t,e,i,o){var n=13,a=o/n,r=0;!function l(){if(!s.stopInertiaMove){var t=s.quartEaseOut(r,e,i,a);return s.setAngle(t),r++,r>a-1||t<s.beginExceed||t>s.endExceed?void s.endScroll():void setTimeout(l,n)}}()}(o,t,e,i)},s.prototype.setListen=function(t){this.listen=!!t},s.prototype.quartEaseOut=function(t,e,i,s){return-i*((t=t/s-1)*t*t*t-1)+e},s.prototype.setSelectedValue=function(t){var e=this;for(var i in e.data){var s=e.data[i];if(s.value==t)return void e.setAngle(i*a,!0)}},s.prototype.getSelectedItem=function(){return this.empty?{}:this.data[this.index];
2
},s.prototype.getSelectedValue=function(){return this.getSelectedItem().value},s.prototype.getSelectedText=function(){return this.getSelectedItem().text},s.prototype.getSelectedIndex=function(){return this.index},t.Picker=s}(o||window,t,i),function(t,e){function i(i){this.options=e.extend({},this.defaultOptions,i),s||(s=t.Picker),this._init()}var s=t.Picker;i.prototype.defaultOptions={template:'<div class="ipu-poppicker">                        <div class="ipu-poppicker-header">                            <button class="ipu-btn ipu-btn-s ipu-poppicker-btn-cancel">取消</button>                            <button class="ipu-btn ipu-btn-s ipu-poppicker-btn-ok">确定</button>                        </div>                        <div class="ipu-poppicker-body">                        </div>                    </div>',pickerTemplate:'<div class="ipu-picker">                            <div class="ipu-picker-selectbox"></div>                            <ul></ul>                          </div>',data:[],layer:1,btns:["取消","确认"],callBack:function(){}},i.prototype._init=function(){this.holder=e(this.options.template).appendTo("body");var t=e(".ipu-poppicker-body",this.holder),i=this.options.layer,o=100/i+"%";this.pickers=new Array(i);var n,a=this;this.mask=this.createMask();for(var r=i-1;r>=0;r--)n=e(this.options.pickerTemplate).prependTo(t).css({width:o}),this.pickers[r]=new s(n,{onChange:function(t){return function(e,s){t!=i-1&&a.pickers[t+1].setItems(e.data)}}(r)});e(".ipu-poppicker-btn-ok",this.holder).click(function(){var t=a.getSelectItems();a.options.callBack(t)!==!1&&a.hide()}).text(this.options.btns[1]),e(".ipu-poppicker-btn-cancel",this.holder).click(function(){a.hide()}).text(this.options.btns[0])},i.prototype.setData=function(t){this.pickers[0].setItems(t)},i.prototype.show=function(t){t&&(this.options.callBack=t),this.mask.show(),this.holder.addClass("ipu-current")},i.prototype.hide=function(){this.mask.close(),this.holder.removeClass("ipu-current")},i.prototype.getSelectItems=function(){if(1==this.options.layer)return this.pickers[0].getSelectedItem();for(var t=[],e=0;e<this.options.layer;e++)t.push(this.pickers[e].getSelectedItem());return t},i.prototype.createMask=function(t){var e=this,i=document.createElement("div");i.classList.add("ipu-picker-backup"),i.addEventListener("click",function(){e.hide()});var s=[i];return s._show=!1,s.show=function(){return s._show=!0,i.setAttribute("style","opacity:1"),document.body.appendChild(i),s},s._remove=function(){return s._show&&(s._show=!1,i.setAttribute("style","opacity:0"),setTimeout(function(){var t=document.body;i.parentNode===t&&t.removeChild(i)},350)),s},s.close=function(){s._show&&(t?t()!==!1&&s._remove():s._remove())},s},t.popPicker=function(t){return new i(t)}}(o||window,t),function(t,e){function i(t,i){this.id=t,this.level=i.level,this.progress=i.progress,this.progressBar=e(t).eq(0),null!=i.progress&&this.setProgress(this.progress),null!=i.level&&this.setLevel(this.level)}i.prototype.setProgress=function(t){t<0||t>100||(e(this.progressBar.find(".ipu-progressbar")).css("transform","translate3d("+-(100-t)+"%, 0px, 0px)"),this.progress=t)},i.prototype.getProgress=function(){return this.progress},i.prototype.setLevel=function(t){"default"==t?(e(this.progressBar).removeClass("ipu-progressbar-success ipu-progressbar-hightlight ipu-progressbar-warning"),e(this.progressBar).addClass("ipu-progress")):"success"==t?(e(this.progressBar).removeClass("ipu-progressbar-highlight ipu-progressbar-warning"),e(this.progressBar).addClass("ipu-progressbar-success")):"highlight"==t?(e(this.progressBar).removeClass("ipu-progressbar-success ipu-progressbar-warning"),e(this.progressBar).addClass("ipu-progressbar-highlight")):"warning"==t&&(e(this.progressBar).removeClass("ipu-progressbar-success ipu-progressbar-highlight"),e(this.progressBar).addClass("ipu-progressbar-warning"))},t.progressBar=function(t,e){return new i(t,e)}}(o||window,t),function(t,e,i){function s(t,s){this.options=e.extend({},this.defaultOptions,s),this.el=e(t).get(0),this._initBottomAndTop();var o=this;this.iScrollOptions={onScrollMove:function(t){o.topEnable&&!o.topLoading&&(this.y>=o.topPullOffset&&!o.topEl.hasClass("ipu-refresh-toload")?o.topEl.addClass("ipu-refresh-toload"):this.y<o.topPullOffset&&o.topEl.hasClass("ipu-refresh-toload")&&o.topEl.removeClass("ipu-refresh-toload")),o._checkBottomLoading(),o.goTop=this.y>o.topPullOffset},onBeforeScrollEnd:function(){o._checkTopLoading(),o._checkBottomLoading()},onScrollEnd:function(){o.topLoading&&this.y<this.minScrollY&&o.goTop&&o.iScroll.scrollTo(0,this.minScrollY,0),o._checkBottomLoading()},onRefresh:function(){o.topLoading&&(this.minScrollY=this.minScrollY+o.topPullOffset)}},this.iScrollOptions=e.extend({},this.options.iScrollOptions,this.iScrollOptions),this.iScroll=new i(this.el,this.iScrollOptions),this._checkContentLoading()}s.prototype.defaultOptions={bottomLoadFun:null,topLoadFun:null,initEnableTop:!0,initEnableBottom:!0,bottomLoadHtml:'<div class="ipu-refresh-bottom"><span class="ipu-refresh-loading"></span></div>',topLoadHtml:'<div class="ipu-refresh-top"><span class="ipu-refresh-loading"></span><div class="ipu-refresh-arrow"></div></div>',bottomAddLen:0,iScrollOptions:{}},s.prototype._initBottomAndTop=function(){this.scrollEl=e(">.ipu-refresh-wrapper",this.el),this.bottomEl=e(this.options.bottomLoadHtml).appendTo(this.scrollEl),this.topEl=e(this.options.topLoadHtml).prependTo(this.scrollEl),this.topPullOffset=this.topEl.outerHeight(),this.bottomPullOffset=this.bottomEl.outerHeight()+this.options.bottomAddLen,this.topLoading=!1,this.bottomLoading=!1,this.bottomEnable=this.options.initEnableBottom&&!!this.options.bottomLoadFun,this.topEnable=this.options.initEnableTop&&!!this.options.topLoadFun,this.goTop=!1,this.enableBottom(this.bottomEnable),this.enableTop(this.topEnable)},s.prototype._checkBottomLoading=function(){this.bottomEnable&&!this.bottomLoading&&this.iScroll.y<this.iScroll.maxScrollY+this.bottomPullOffset&&this._startBottomLoading()},s.prototype._checkTopLoading=function(){this.topEnable&&!this.topLoading&&this.topEl.hasClass("ipu-refresh-toload")&&this._startTopLoading()},s.prototype._checkContentLoading=function(){this.iScroll.maxScrollY>=-this.bottomPullOffset&&this._startBottomLoading()},s.prototype._startBottomLoading=function(){this.bottomEnable&&!this.bottomLoading&&(this.bottomLoading=!0,this.options.bottomLoadFun())},s.prototype._startTopLoading=function(){this.topEnable&&!this.topLoading&&(this.topLoading=!0,this.topEl.removeClass("ipu-refresh-toload").addClass("ipu-refresh-top-loading"),this.iScroll.minScrollY=this.iScroll.minScrollY+this.topPullOffset,this.options.topLoadFun())},s.prototype.endBottomLoading=function(){this.bottomLoading=!1,this.refresh()},s.prototype.endTopLoading=function(){this.topEl.removeClass("ipu-refresh-top-loading"),this.topLoading=!1,this.refresh()},s.prototype.enableTop=function(t){this.topEnable=t,t?this.topEl.show():this.topEl.hide()},s.prototype.enableBottom=function(t){this.bottomEnable=t,t?this.bottomEl.show():this.bottomEl.hide()},s.prototype.refresh=function(){this.iScroll.refresh(),this._checkContentLoading()},t.refresh=function(t,e){return new s(t,e)}}(o||window,t,e),function(t,e){function i(t,i){this.el=e(t).get(0),this.titleItems=e(".ipu-tab-title:first>li",this.el),this.bodyWrapper=e(".ipu-tab-body-wrapper:first",this.el),this.contentItems=e(">li",this.bodyWrapper),this.options=e.extend({},this.defaultOptions,i),this.itemSize=this.contentItems.size(),this.fixed=e(this.el).is(".ipu-tab-fixed");var s=this;this.titleItems.each(function(t){e(this).click(function(){s.show(t)})});var o=this.titleItems.filter(".ipu-current").index();o==-1&&(o=0),this.show(o)}i.prototype.defaultOptions={callBack:null},i.prototype.show=function(t){if(this.fixed){var e=100*-t+"%";this.bodyWrapper.css("transform","translate3d("+e+", 0, 0)")}this.contentItems.eq(t).addClass("ipu-current").siblings().removeClass("ipu-current"),this.titleItems.eq(t).addClass("ipu-current").siblings().removeClass("ipu-current"),this._end(t)},i.prototype._end=function(t){this.lastIndex=this.currentIndex,this.currentIndex=t,this.options.callBack&&this.options.callBack(t,this.lastIndex)},t.tab=function(t,e){return new i(t,e)}}(o||window,t),function(t,e){function i(t){return t.originalEvent||t}function s(t){var e=t.touches?t.touches[0].pageX:t.clientX,i=t.touches?t.touches[0].pageY:t.clientY;return[e,i]}var o={},n=defaultOptions={distanceAllow:10,displayDelay:100,hideDelay:120,eventName:"click",activeClass:"ipu-active",getHandleNode:function(t){function i(t){var i=(e._data||e.data)(t,"events");if(i&&(i=i[n.eventName]),i){var a=!1;return e.each(i,function(i,n){if(n.selector){var r=e(n.selector,t);if(e.each(o,function(t,e){if(r.is(e))return s=e,!1}),s)return!1}else a=!0}),a&&null==s&&(s=t),s}}if(t&&t.nodeType){for(var s=null,o=[];!("tagName"in t&&i(t))&&t.parentNode&&1==t.parentNode.nodeType;)o.push(t),t=t.parentNode;return s}}},a="ontouchstart"in window,r=a?"touchstart":"mousedown",l=a?"touchmove":"mousemove",u=a?"touchend":"mouseup",c=a?"touchcancel":"";e(function(){function t(t,i){i&&h?window.clearTimeout(h):e(t).removeClass(n.activeClass)}function o(e){e?t(d,e):window.setTimeout(t,n.hideDelay,d,e),a=null,d=null}var a,d,h,p=document.body;e(p).bind(r,function(t){return d?void o(!0):(t=i(t),a=s(t),d=n.getHandleNode(t.target),void(d&&(h=window.setTimeout(function(t){h=null,e(t).addClass(n.activeClass)},n.displayDelay,d))))}),e(p).bind(l,function(t){if(d){t=i(t);var e=s(t);a&&(Math.abs(e[0]-a[0])>n.distanceAllow||Math.abs(e[1]-a[1])>n.distanceAllow)&&o(!0)}}),e(p).bind(u,function(t){d&&o()}),c&&e(p).bind(c,function(t){d&&o()})}),o.setOptions=function(t){n=this.options=e.extend({},defaultOptions,t)},t.active=o}(o||window,t),function(t,e){"use strict";var i={},s=[],o=navigator.userAgent;if(console.log("device"),o.match(/ipumobile/i))i.ios=!!o.match(/ios/i),i.android=!!o.match(/android/i);else{var n=o.match(/(Android);?[\s\/]+([\d.]+)?/),a=o.match(/(iPad).*OS\s([\d_]+)/),r=o.match(/(iPod)(.*OS\s([\d_]+))?/),l=!a&&o.match(/(iPhone\sOS)\s([\d_]+)/);if(i.ios=i.android=i.iphone=i.ipad=i.androidChrome=!1,n&&(i.os="android",i.osVersion=n[2],i.android=!0,i.androidChrome=o.toLowerCase().indexOf("chrome")>=0),(a||l||r)&&(i.os="ios",i.ios=!0),l&&!r&&(i.osVersion=l[2].replace(/_/g,"."),i.iphone=!0),a&&(i.osVersion=a[2].replace(/_/g,"."),i.ipad=!0),r&&(i.osVersion=r[3]?r[3].replace(/_/g,"."):null,i.iphone=!0),i.ios&&i.osVersion&&o.indexOf("Version/")>=0&&"10"===i.osVersion.split(".")[0]&&(i.osVersion=o.toLowerCase().split("version/")[1].split(" ")[0]),i.webView=(l||a||r)&&o.match(/.*AppleWebKit(?!.*Safari)/i),i.os&&"ios"===i.os){var u=i.osVersion.split(".");i.minimalUi=!i.webView&&(r||l)&&(1*u[0]===7?1*u[1]>=1:1*u[0]>7)&&e('meta[name="viewport"]').length>0&&e('meta[name="viewport"]').attr("content").indexOf("minimal-ui")>=0}var c=e(window).width(),d=e(window).height();if(i.statusBar=!1,i.webView&&c*d===screen.width*screen.height?i.statusBar=!0:i.statusBar=!1,i.pixelRatio=window.devicePixelRatio||1,s.push("pixel-ratio-"+Math.floor(i.pixelRatio)),i.pixelRatio>=2&&s.push("retina"),i.os&&(s.push(i.os,i.os+"-"+i.osVersion.split(".")[0],i.os+"-"+i.osVersion.replace(/\./g,"-")),"ios"===i.os))for(var h=parseInt(i.osVersion.split(".")[0],10),p=h-1;p>=6;p--)s.push("ios-gt-"+p);i.statusBar?s.push("with-statusbar-overlay"):e("html").removeClass("with-statusbar-overlay"),i.isWeixin=/MicroMessenger/i.test(o)}s.length>0&&e("html").addClass(s.join(" ")),t.device=i}(o||window,t),t(function(){s.attach(document.body)}),o}"function"==typeof define&&define.amd?define(["jquery","iScroll","Hammer","FastClick"],function(e,i,s,o){return window.ipu=t(e,i,s,o)}):window.ipu=t(window.jQuery,window.iScroll,window.Hammer,window.FastClick)}();
3 3
//# sourceMappingURL=ipu.min.js.map

+ 1 - 1
static-res/appmenu-ipu/js/biz/about.js

@ -1,6 +1,6 @@
1 1
require(["ipu", "jquery", "tap"], function (ipu, $) {
2 2
    $(function () {
3
        $(".list-share .ipu-list-item").tap(function () {
3
        $(".list-share .ipu-list-item").click(function () {
4 4
5 5
        });
6 6
    });

+ 2 - 2
static-res/appmenu-ipu/js/biz/app-set.js

@ -1,12 +1,12 @@
1 1
require(["ipu", "jquery", "tap"], function (ipu, $) {
2 2
    $(function(){
3 3
        // 清除缓存
4
        $(".item-clear").tap(function () {
4
        $(".item-clear").click(function () {
5 5
6 6
        });
7 7
8 8
        // 选择字体了
9
        $(".font-size span").tap(function () {
9
        $(".font-size span").click(function () {
10 10
            if(!$(this).hasClass("on")){
11 11
                $("html").attr('size', $(this).data('size'));
12 12
                $(this).addClass('on').siblings('.on').removeClass('on');

+ 1 - 1
static-res/appmenu-ipu/js/biz/category.js

@ -1,6 +1,6 @@
1 1
require(["ipu", "jquery", "tap"], function (ipu, $) {
2 2
    $(function () {
3
        $(".app-item a").tap(function () {
3
        $(".app-item a").click(function () {
4 4
5 5
        });
6 6
    });

+ 1 - 1
static-res/appmenu-ipu/js/biz/feedback-menu.js

@ -1,6 +1,6 @@
1 1
require(["ipu", "jquery", "tap"], function (ipu, $) {
2 2
    $(function () {
3
        $(".page-head-right, .ipu-list-item-link").tap(function () {
3
        $(".page-head-right, .ipu-list-item-link").click(function () {
4 4
           window.location.href = "feedback-type.html";
5 5
        });
6 6
    });

+ 1 - 1
static-res/appmenu-ipu/js/biz/feedback-type.js

@ -1,6 +1,6 @@
1 1
require(["ipu", "jquery", "tap"], function (ipu, $) {
2 2
    $(function () {
3
        $(".ipu-list-item-link").tap(function () {
3
        $(".ipu-list-item-link").click(function () {
4 4
        });
5 5
    });
6 6
});

+ 9 - 9
static-res/appmenu-ipu/js/biz/index.js

@ -1,4 +1,4 @@
1
require(["ipu", "jquery", "iScroll", 'dragsort', "tap"], function (ipu, $, iScroll) {
1
require(["ipu", "jquery", "iScroll", 'dragsort'], function (ipu, $, iScroll) {
2 2
    // 通用
3 3
    $(function () {
4 4
        // 初始化底部导航
@ -28,11 +28,11 @@ require(["ipu", "jquery", "iScroll", 'dragsort', "tap"], function (ipu, $, iScro
28 28
            );
29 29
        });
30 30
31
        $(".app-category .apps a").tap(function () {
32
            alert('进入app');
31
        $(".app-category .apps a").click(function () {
32
            ipu.toast('进入app');
33 33
        });
34
        $(".apps-container a span").tap(function () {
35
            alert('收藏');
34
        $(".apps-container a .favicon").click(function () {
35
            ipu.toast('收藏');
36 36
            return false;
37 37
        });
38 38
@ -164,14 +164,14 @@ require(["ipu", "jquery", "iScroll", 'dragsort', "tap"], function (ipu, $, iScro
164 164
            $(".fav-top-apps").toggleClass("top-app-setup", check);
165 165
        });
166 166
167
        $(".fav-top-apps li a").tap(function () {
167
        $(".fav-top-apps li a").click(function () {
168 168
            //
169 169
        });
170 170
    });
171 171
172 172
    // 历史页
173 173
    $(function(){
174
        $(".ipu-list .ipu-list-item").tap(function () {
174
        $(".ipu-list .ipu-list-item").click(function () {
175 175
            console.log('tap');
176 176
        });
177 177
@ -195,11 +195,11 @@ require(["ipu", "jquery", "iScroll", 'dragsort', "tap"], function (ipu, $, iScro
195 195
            }, 2000);
196 196
        }
197 197
198
        $(".page-his .page-head-right").tap(function () {
198
        $(".page-his .page-head-right").click(function () {
199 199
            ipu.toast('清空历史');
200 200
        });
201 201
202
        $(".fav-all-list .favicon").tap(function () {
202
        $(".fav-all-list .favicon").click(function () {
203 203
            ipu.toast(12);
204 204
        });
205 205
    });

+ 2 - 2
static-res/appmenu-ipu/js/biz/open-count.js

@ -2,7 +2,7 @@ require(["ipu", "jquery", "tap"], function (ipu, $) {
2 2
    $(function(){
3 3
        // 切换
4 4
        $(".count-labels span").each(function (index) {
5
            $(this).tap(function () {
5
            $(this).click(function () {
6 6
                if(!$(this).hasClass("on")){
7 7
                    $(this).addClass("on").siblings(".on").removeClass("on");
8 8
@ -11,7 +11,7 @@ require(["ipu", "jquery", "tap"], function (ipu, $) {
11 11
            })
12 12
        });
13 13
14
        $(".ipu-list-item").tap(function () {
14
        $(".ipu-list-item").click(function () {
15 15
16 16
        });
17 17
    });

+ 4 - 4
static-res/appmenu-ipu/js/biz/search.js

@ -37,17 +37,17 @@ require(["ipu", "jquery", 'tap'], function (ipu, $) {
37 37
            $(".app-search-result .search-no-result, .app-search-result").hide();
38 38
        });
39 39
40
        $(".hot-words label").tap(function () {
40
        $(".hot-words label").click(function () {
41 41
42 42
        });
43
        $(".search-history-clear").tap(function () {
43
        $(".search-history-clear").click(function () {
44 44
45 45
        });
46
        $(".fav-all-list a").tap(function () {
46
        $(".fav-all-list a").click(function () {
47 47
48 48
        });
49 49
50
        $(".fav-all-list .favicon").tap(function () {
50
        $(".fav-all-list .favicon").click(function () {
51 51
52 52
        });
53 53
    });

+ 2 - 2
static-res/appmenu-ipu/js/biz/user-info.js

@ -1,7 +1,7 @@
1 1
require(["ipu", "jquery", "tap"], function (ipu, $) {
2 2
    $(function(){
3 3
        // 进入头像修改,用户上传头像
4
        $(".user-info").tap(function () {
4
        $(".user-info").click(function () {
5 5
6 6
        });
7 7
@ -16,7 +16,7 @@ require(["ipu", "jquery", "tap"], function (ipu, $) {
16 16
        }
17 17
18 18
        // 保存变更
19
        $(".page-head-right").tap(function () {
19
        $(".page-head-right").click(function () {
20 20
            $(this).hide();
21 21
        });
22 22
    });

+ 0 - 2124
static-res/appmenu-ipu/js/lib/iscroll/iscroll-5.2.0.js

@ -1,2124 +0,0 @@
1
/*! iScroll v5.2.0 ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */
2
(function (window, document, Math) {
3
var rAF = window.requestAnimationFrame	||
4
	window.webkitRequestAnimationFrame	||
5
	window.mozRequestAnimationFrame		||
6
	window.oRequestAnimationFrame		||
7
	window.msRequestAnimationFrame		||
8
	function (callback) { window.setTimeout(callback, 1000 / 60); };
9
10
var utils = (function () {
11
	var me = {};
12
13
	var _elementStyle = document.createElement('div').style;
14
	var _vendor = (function () {
15
		var vendors = ['t', 'webkitT', 'MozT', 'msT', 'OT'],
16
			transform,
17
			i = 0,
18
			l = vendors.length;
19
20
		for ( ; i < l; i++ ) {
21
			transform = vendors[i] + 'ransform';
22
			if ( transform in _elementStyle ) return vendors[i].substr(0, vendors[i].length-1);
23
		}
24
25
		return false;
26
	})();
27
28
	function _prefixStyle (style) {
29
		if ( _vendor === false ) return false;
30
		if ( _vendor === '' ) return style;
31
		return _vendor + style.charAt(0).toUpperCase() + style.substr(1);
32
	}
33
34
	me.getTime = Date.now || function getTime () { return new Date().getTime(); };
35
36
	me.extend = function (target, obj) {
37
		for ( var i in obj ) {
38
			target[i] = obj[i];
39
		}
40
	};
41
42
	me.addEvent = function (el, type, fn, capture) {
43
		el.addEventListener(type, fn, !!capture);
44
	};
45
46
	me.removeEvent = function (el, type, fn, capture) {
47
		el.removeEventListener(type, fn, !!capture);
48
	};
49
50
	me.prefixPointerEvent = function (pointerEvent) {
51
		return window.MSPointerEvent ?
52
			'MSPointer' + pointerEvent.charAt(7).toUpperCase() + pointerEvent.substr(8):
53
			pointerEvent;
54
	};
55
56
	me.momentum = function (current, start, time, lowerMargin, wrapperSize, deceleration) {
57
		var distance = current - start,
58
			speed = Math.abs(distance) / time,
59
			destination,
60
			duration;
61
62
		deceleration = deceleration === undefined ? 0.0006 : deceleration;
63
64
		destination = current + ( speed * speed ) / ( 2 * deceleration ) * ( distance < 0 ? -1 : 1 );
65
		duration = speed / deceleration;
66
67
		if ( destination < lowerMargin ) {
68
			destination = wrapperSize ? lowerMargin - ( wrapperSize / 2.5 * ( speed / 8 ) ) : lowerMargin;
69
			distance = Math.abs(destination - current);
70
			duration = distance / speed;
71
		} else if ( destination > 0 ) {
72
			destination = wrapperSize ? wrapperSize / 2.5 * ( speed / 8 ) : 0;
73
			distance = Math.abs(current) + destination;
74
			duration = distance / speed;
75
		}
76
77
		return {
78
			destination: Math.round(destination),
79
			duration: duration
80
		};
81
	};
82
83
	var _transform = _prefixStyle('transform');
84
85
	me.extend(me, {
86
		hasTransform: _transform !== false,
87
		hasPerspective: _prefixStyle('perspective') in _elementStyle,
88
		hasTouch: 'ontouchstart' in window,
89
		hasPointer: !!(window.PointerEvent || window.MSPointerEvent), // IE10 is prefixed
90
		hasTransition: _prefixStyle('transition') in _elementStyle
91
	});
92
93
	/*
94
	This should find all Android browsers lower than build 535.19 (both stock browser and webview)
95
	- galaxy S2 is ok
96
    - 2.3.6 : `AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1`
97
    - 4.0.4 : `AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30`
98
   - galaxy S3 is badAndroid (stock brower, webview)
99
     `AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30`
100
   - galaxy S4 is badAndroid (stock brower, webview)
101
     `AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30`
102
   - galaxy S5 is OK
103
     `AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Mobile Safari/537.36 (Chrome/)`
104
   - galaxy S6 is OK
105
     `AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Mobile Safari/537.36 (Chrome/)`
106
  */
107
	me.isBadAndroid = (function() {
108
		var appVersion = window.navigator.appVersion;
109
		// Android browser is not a chrome browser.
110
		if (/Android/.test(appVersion) && !(/Chrome\/\d/.test(appVersion))) {
111
			var safariVersion = appVersion.match(/Safari\/(\d+.\d)/);
112
			if(safariVersion && typeof safariVersion === "object" && safariVersion.length >= 2) {
113
				return parseFloat(safariVersion[1]) < 535.19;
114
			} else {
115
				return true;
116
			}
117
		} else {
118
			return false;
119
		}
120
	})();
121
122
	me.extend(me.style = {}, {
123
		transform: _transform,
124
		transitionTimingFunction: _prefixStyle('transitionTimingFunction'),
125
		transitionDuration: _prefixStyle('transitionDuration'),
126
		transitionDelay: _prefixStyle('transitionDelay'),
127
		transformOrigin: _prefixStyle('transformOrigin')
128
	});
129
130
	me.hasClass = function (e, c) {
131
		var re = new RegExp("(^|\\s)" + c + "(\\s|$)");
132
		return re.test(e.className);
133
	};
134
135
	me.addClass = function (e, c) {
136
		if ( me.hasClass(e, c) ) {
137
			return;
138
		}
139
140
		var newclass = e.className.split(' ');
141
		newclass.push(c);
142
		e.className = newclass.join(' ');
143
	};
144
145
	me.removeClass = function (e, c) {
146
		if ( !me.hasClass(e, c) ) {
147
			return;
148
		}
149
150
		var re = new RegExp("(^|\\s)" + c + "(\\s|$)", 'g');
151
		e.className = e.className.replace(re, ' ');
152
	};
153
154
	me.offset = function (el) {
155
		var left = -el.offsetLeft,
156
			top = -el.offsetTop;
157
158
		// jshint -W084
159
		while (el = el.offsetParent) {
160
			left -= el.offsetLeft;
161
			top -= el.offsetTop;
162
		}
163
		// jshint +W084
164
165
		return {
166
			left: left,
167
			top: top
168
		};
169
	};
170
171
	me.preventDefaultException = function (el, exceptions) {
172
		for ( var i in exceptions ) {
173
			if ( exceptions[i].test(el[i]) ) {
174
				return true;
175
			}
176
		}
177
178
		return false;
179
	};
180
181
	me.extend(me.eventType = {}, {
182
		touchstart: 1,
183
		touchmove: 1,
184
		touchend: 1,
185
186
		mousedown: 2,
187
		mousemove: 2,
188
		mouseup: 2,
189
190
		pointerdown: 3,
191
		pointermove: 3,
192
		pointerup: 3,
193
194
		MSPointerDown: 3,
195
		MSPointerMove: 3,
196
		MSPointerUp: 3
197
	});
198
199
	me.extend(me.ease = {}, {
200
		quadratic: {
201
			style: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)',
202
			fn: function (k) {
203
				return k * ( 2 - k );
204
			}
205
		},
206
		circular: {
207
			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)
208
			fn: function (k) {
209
				return Math.sqrt( 1 - ( --k * k ) );
210
			}
211
		},
212
		back: {
213
			style: 'cubic-bezier(0.175, 0.885, 0.32, 1.275)',
214
			fn: function (k) {
215
				var b = 4;
216
				return ( k = k - 1 ) * k * ( ( b + 1 ) * k + b ) + 1;
217
			}
218
		},
219
		bounce: {
220
			style: '',
221
			fn: function (k) {
222
				if ( ( k /= 1 ) < ( 1 / 2.75 ) ) {
223
					return 7.5625 * k * k;
224
				} else if ( k < ( 2 / 2.75 ) ) {
225
					return 7.5625 * ( k -= ( 1.5 / 2.75 ) ) * k + 0.75;
226
				} else if ( k < ( 2.5 / 2.75 ) ) {
227
					return 7.5625 * ( k -= ( 2.25 / 2.75 ) ) * k + 0.9375;
228
				} else {
229
					return 7.5625 * ( k -= ( 2.625 / 2.75 ) ) * k + 0.984375;
230
				}
231
			}
232
		},
233
		elastic: {
234
			style: '',
235
			fn: function (k) {
236
				var f = 0.22,
237
					e = 0.4;
238
239
				if ( k === 0 ) { return 0; }
240
				if ( k == 1 ) { return 1; }
241
242
				return ( e * Math.pow( 2, - 10 * k ) * Math.sin( ( k - f / 4 ) * ( 2 * Math.PI ) / f ) + 1 );
243
			}
244
		}
245
	});
246
247
	me.tap = function (e, eventName) {
248
		var ev = document.createEvent('Event');
249
		ev.initEvent(eventName, true, true);
250
		ev.pageX = e.pageX;
251
		ev.pageY = e.pageY;
252
		e.target.dispatchEvent(ev);
253
	};
254
255
	me.click = function (e) {
256
		var target = e.target,
257
			ev;
258
259
		if ( !(/(SELECT|INPUT|TEXTAREA)/i).test(target.tagName) ) {
260
			// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
261
			// initMouseEvent is deprecated.
262
			ev = document.createEvent(window.MouseEvent ? 'MouseEvents' : 'Event');
263
			ev.initEvent('click', true, true);
264
			ev.view = e.view || window;
265
			ev.detail = 1;
266
			ev.screenX = target.screenX || 0;
267
			ev.screenY = target.screenY || 0;
268
			ev.clientX = target.clientX || 0;
269
			ev.clientY = target.clientY || 0;
270
			ev.ctrlKey = !!e.ctrlKey;
271
			ev.altKey = !!e.altKey;
272
			ev.shiftKey = !!e.shiftKey;
273
			ev.metaKey = !!e.metaKey;
274
			ev.button = 0;
275
			ev.relatedTarget = null;
276
			ev._constructed = true;
277
			target.dispatchEvent(ev);
278
		}
279
	};
280
281
	return me;
282
})();
283
function IScroll (el, options) {
284
	this.wrapper = typeof el == 'string' ? document.querySelector(el) : el;
285
	this.scroller = this.wrapper.children[0];
286
	this.scrollerStyle = this.scroller.style;		// cache style for better performance
287
288
	this.options = {
289
290
		resizeScrollbars: true,
291
292
		mouseWheelSpeed: 20,
293
294
		snapThreshold: 0.334,
295
296
// INSERT POINT: OPTIONS
297
		disablePointer : !utils.hasPointer,
298
		disableTouch : utils.hasPointer || !utils.hasTouch,
299
		disableMouse : utils.hasPointer || utils.hasTouch,
300
		startX: 0,
301
		startY: 0,
302
		scrollY: true,
303
		directionLockThreshold: 5,
304
		momentum: true,
305
306
		bounce: true,
307
		bounceTime: 600,
308
		bounceEasing: '',
309
310
		preventDefault: true,
311
		preventDefaultException: { tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/ },
312
313
		HWCompositing: true,
314
		useTransition: true,
315
		useTransform: true,
316
		bindToWrapper: typeof window.onmousedown === "undefined"
317
	};
318
319
	for ( var i in options ) {
320
		this.options[i] = options[i];
321
	}
322
323
	// Normalize options
324
	this.translateZ = this.options.HWCompositing && utils.hasPerspective ? ' translateZ(0)' : '';
325
326
	this.options.useTransition = utils.hasTransition && this.options.useTransition;
327
	this.options.useTransform = utils.hasTransform && this.options.useTransform;
328
329
	this.options.eventPassthrough = this.options.eventPassthrough === true ? 'vertical' : this.options.eventPassthrough;
330
	this.options.preventDefault = !this.options.eventPassthrough && this.options.preventDefault;
331
332
	// If you want eventPassthrough I have to lock one of the axes
333
	this.options.scrollY = this.options.eventPassthrough == 'vertical' ? false : this.options.scrollY;
334
	this.options.scrollX = this.options.eventPassthrough == 'horizontal' ? false : this.options.scrollX;
335
336
	// With eventPassthrough we also need lockDirection mechanism
337
	this.options.freeScroll = this.options.freeScroll && !this.options.eventPassthrough;
338
	this.options.directionLockThreshold = this.options.eventPassthrough ? 0 : this.options.directionLockThreshold;
339
340
	this.options.bounceEasing = typeof this.options.bounceEasing == 'string' ? utils.ease[this.options.bounceEasing] || utils.ease.circular : this.options.bounceEasing;
341
342
	this.options.resizePolling = this.options.resizePolling === undefined ? 60 : this.options.resizePolling;
343
344
	if ( this.options.tap === true ) {
345
		this.options.tap = 'tap';
346
	}
347
348
	// https://github.com/cubiq/iscroll/issues/1029
349
	if (!this.options.useTransition && !this.options.useTransform) {
350
		if(!(/relative|absolute/i).test(this.scrollerStyle.position)) {
351
			this.scrollerStyle.position = "relative";
352
		}
353
	}
354
355
	if ( this.options.shrinkScrollbars == 'scale' ) {
356
		this.options.useTransition = false;
357
	}
358
359
	this.options.invertWheelDirection = this.options.invertWheelDirection ? -1 : 1;
360
361
// INSERT POINT: NORMALIZATION
362
363
	// Some defaults
364
	this.x = 0;
365
	this.y = 0;
366
	this.directionX = 0;
367
	this.directionY = 0;
368
	this._events = {};
369
370
// INSERT POINT: DEFAULTS
371
372
	this._init();
373
	this.refresh();
374
375
	this.scrollTo(this.options.startX, this.options.startY);
376
	this.enable();
377
}
378
379
IScroll.prototype = {
380
	version: '5.2.0',
381
382
	_init: function () {
383
		this._initEvents();
384
385
		if ( this.options.scrollbars || this.options.indicators ) {
386
			this._initIndicators();
387
		}
388
389
		if ( this.options.mouseWheel ) {
390
			this._initWheel();
391
		}
392
393
		if ( this.options.snap ) {
394
			this._initSnap();
395
		}
396
397
		if ( this.options.keyBindings ) {
398
			this._initKeys();
399
		}
400
401
// INSERT POINT: _init
402
403
	},
404
405
	destroy: function () {
406
		this._initEvents(true);
407
		clearTimeout(this.resizeTimeout);
408
 		this.resizeTimeout = null;
409
		this._execEvent('destroy');
410
	},
411
412
	_transitionEnd: function (e) {
413
		if ( e.target != this.scroller || !this.isInTransition ) {
414
			return;
415
		}
416
417
		this._transitionTime();
418
		if ( !this.resetPosition(this.options.bounceTime) ) {
419
			this.isInTransition = false;
420
			this._execEvent('scrollEnd');
421
		}
422
	},
423
424
	_start: function (e) {
425
		// React to left mouse button only
426
		if ( utils.eventType[e.type] != 1 ) {
427
		  // for button property
428
		  // http://unixpapa.com/js/mouse.html
429
		  var button;
430
	    if (!e.which) {
431
	      /* IE case */
432
	      button = (e.button < 2) ? 0 :
433
	               ((e.button == 4) ? 1 : 2);
434
	    } else {
435
	      /* All others */
436
	      button = e.button;
437
	    }
438
			if ( button !== 0 ) {
439
				return;
440
			}
441
		}
442
443
		if ( !this.enabled || (this.initiated && utils.eventType[e.type] !== this.initiated) ) {
444
			return;
445
		}
446
447
		if ( this.options.preventDefault && !utils.isBadAndroid && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) {
448
			e.preventDefault();
449
		}
450
451
		var point = e.touches ? e.touches[0] : e,
452
			pos;
453
454
		this.initiated	= utils.eventType[e.type];
455
		this.moved		= false;
456
		this.distX		= 0;
457
		this.distY		= 0;
458
		this.directionX = 0;
459
		this.directionY = 0;
460
		this.directionLocked = 0;
461
462
		this.startTime = utils.getTime();
463
464
		if ( this.options.useTransition && this.isInTransition ) {
465
			this._transitionTime();
466
			this.isInTransition = false;
467
			pos = this.getComputedPosition();
468
			this._translate(Math.round(pos.x), Math.round(pos.y));
469
			this._execEvent('scrollEnd');
470
		} else if ( !this.options.useTransition && this.isAnimating ) {
471
			this.isAnimating = false;
472
			this._execEvent('scrollEnd');
473
		}
474
475
		this.startX    = this.x;
476
		this.startY    = this.y;
477
		this.absStartX = this.x;
478
		this.absStartY = this.y;
479
		this.pointX    = point.pageX;
480
		this.pointY    = point.pageY;
481
482
		this._execEvent('beforeScrollStart');
483
	},
484
485
	_move: function (e) {
486
		console.log('move');
487
		if ( !this.enabled || utils.eventType[e.type] !== this.initiated ) {
488
			return;
489
		}
490
491
		if ( this.options.preventDefault ) {	// increases performance on Android? TODO: check!
492
			e.preventDefault();
493
		}
494
495
		var point		= e.touches ? e.touches[0] : e,
496
			deltaX		= point.pageX - this.pointX,
497
			deltaY		= point.pageY - this.pointY,
498
			timestamp	= utils.getTime(),
499
			newX, newY,
500
			absDistX, absDistY;
501
502
		this.pointX		= point.pageX;
503
		this.pointY		= point.pageY;
504
505
		this.distX		+= deltaX;
506
		this.distY		+= deltaY;
507
		absDistX		= Math.abs(this.distX);
508
		absDistY		= Math.abs(this.distY);
509
510
		// We need to move at least 10 pixels for the scrolling to initiate
511
		if ( timestamp - this.endTime > 300 && (absDistX < 10 && absDistY < 10) ) {
512
			return;
513
		}
514
515
		console.log("aava");
516
517
		// If you are scrolling in one direction lock the other
518
		if ( !this.directionLocked && !this.options.freeScroll ) {
519
			if ( absDistX > absDistY + this.options.directionLockThreshold ) {
520
				this.directionLocked = 'h';		// lock horizontally
521
			} else if ( absDistY >= absDistX + this.options.directionLockThreshold ) {
522
				this.directionLocked = 'v';		// lock vertically
523
			} else {
524
				this.directionLocked = 'n';		// no lock
525
			}
526
		}
527
528
		if ( this.directionLocked == 'h' ) {
529
			if ( this.options.eventPassthrough == 'vertical' ) {
530
				e.preventDefault();
531
			} else if ( this.options.eventPassthrough == 'horizontal' ) {
532
				this.initiated = false;
533
				return;
534
			}
535
536
			deltaY = 0;
537
		} else if ( this.directionLocked == 'v' ) {
538
			if ( this.options.eventPassthrough == 'horizontal' ) {
539
				e.preventDefault();
540
			} else if ( this.options.eventPassthrough == 'vertical' ) {
541
				this.initiated = false;
542
				return;
543
			}
544
545
			deltaX = 0;
546
		}
547
548
		deltaX = this.hasHorizontalScroll ? deltaX : 0;
549
		//deltaY = this.hasVerticalScroll ? deltaY : 0; // 移除判断条件,可使得内容在未超过窗口高度时,也可滚动
550
551
		newX = this.x + deltaX;
552
		newY = this.y + deltaY;
553
554
		// Slow down if outside of the boundaries
555
		if ( newX > 0 || newX < this.maxScrollX ) {
556
			newX = this.options.bounce ? this.x + deltaX / 3 : newX > 0 ? 0 : this.maxScrollX;
557
		}
558
		if ( newY > 0 || newY < this.maxScrollY ) {
559
			newY = this.options.bounce ? this.y + deltaY / 3 : newY > 0 ? 0 : this.maxScrollY;
560
		}
561
562
		this.directionX = deltaX > 0 ? -1 : deltaX < 0 ? 1 : 0;
563
		this.directionY = deltaY > 0 ? -1 : deltaY < 0 ? 1 : 0;
564
565
		if ( !this.moved ) {
566
			this._execEvent('scrollStart');
567
		}
568
569
		this.moved = true;
570
571
		this._translate(newX, newY);
572
573
/* REPLACE START: _move */
574
575
		if ( timestamp - this.startTime > 300 ) {
576
			this.startTime = timestamp;
577
			this.startX = this.x;
578
			this.startY = this.y;
579
		}
580
581
/* REPLACE END: _move */
582
583
	},
584
585
	_end: function (e) {
586
		if ( !this.enabled || utils.eventType[e.type] !== this.initiated ) {
587
			return;
588
		}
589
590
		if ( this.options.preventDefault && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) {
591
			e.preventDefault();
592
		}
593
594
		var point = e.changedTouches ? e.changedTouches[0] : e,
595
			momentumX,
596
			momentumY,
597
			duration = utils.getTime() - this.startTime,
598
			newX = Math.round(this.x),
599
			newY = Math.round(this.y),
600
			distanceX = Math.abs(newX - this.startX),
601
			distanceY = Math.abs(newY - this.startY),
602
			time = 0,
603
			easing = '';
604
605
		this.isInTransition = 0;
606
		this.initiated = 0;
607
		this.endTime = utils.getTime();
608
609
		// reset if we are outside of the boundaries
610
		if ( this.resetPosition(this.options.bounceTime) ) {
611
			return;
612
		}
613
614
		this.scrollTo(newX, newY);	// ensures that the last position is rounded
615
616
		// we scrolled less than 10 pixels
617
		if ( !this.moved ) {
618
			if ( this.options.tap ) {
619
				utils.tap(e, this.options.tap);
620
			}
621
622
			if ( this.options.click ) {
623
				utils.click(e);
624
			}
625
626
			this._execEvent('scrollCancel');
627
			return;
628
		}
629
630
		if ( this._events.flick && duration < 200 && distanceX < 100 && distanceY < 100 ) {
631
			this._execEvent('flick');
632
			return;
633
		}
634
635
		// start momentum animation if needed
636
		if ( this.options.momentum && duration < 300 ) {
637
			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 };
638
			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 };
639
			newX = momentumX.destination;
640
			newY = momentumY.destination;
641
			time = Math.max(momentumX.duration, momentumY.duration);
642
			this.isInTransition = 1;
643
		}
644
645
646
		if ( this.options.snap ) {
647
			var snap = this._nearestSnap(newX, newY);
648
			this.currentPage = snap;
649
			time = this.options.snapSpeed || Math.max(
650
					Math.max(
651
						Math.min(Math.abs(newX - snap.x), 1000),
652
						Math.min(Math.abs(newY - snap.y), 1000)
653
					), 300);
654
			newX = snap.x;
655
			newY = snap.y;
656
657
			this.directionX = 0;
658
			this.directionY = 0;
659
			easing = this.options.bounceEasing;
660
		}
661
662
// INSERT POINT: _end
663
664
		if ( newX != this.x || newY != this.y ) {
665
			// change easing function when scroller goes out of the boundaries
666
			if ( newX > 0 || newX < this.maxScrollX || newY > 0 || newY < this.maxScrollY ) {
667
				easing = utils.ease.quadratic;
668
			}
669
670
			this.scrollTo(newX, newY, time, easing);
671
			return;
672
		}
673
674
		this._execEvent('scrollEnd');
675
	},
676
677
	_resize: function () {
678
		var that = this;
679
680
		clearTimeout(this.resizeTimeout);
681
682
		this.resizeTimeout = setTimeout(function () {
683
			that.refresh();
684
		}, this.options.resizePolling);
685
	},
686
687
	resetPosition: function (time) {
688
		var x = this.x,
689
			y = this.y;
690
691
		time = time || 0;
692
693
		if ( !this.hasHorizontalScroll || this.x > 0 ) {
694
			x = 0;
695
		} else if ( this.x < this.maxScrollX ) {
696
			x = this.maxScrollX;
697
		}
698
699
		if ( !this.hasVerticalScroll || this.y > 0 ) {
700
			y = 0;
701
		} else if ( this.y < this.maxScrollY ) {
702
			y = this.maxScrollY;
703
		}
704
705
		if ( x == this.x && y == this.y ) {
706
			return false;
707
		}
708
709
		this.scrollTo(x, y, time, this.options.bounceEasing);
710
711
		return true;
712
	},
713
714
	disable: function () {
715
		this.enabled = false;
716
	},
717
718
	enable: function () {
719
		this.enabled = true;
720
	},
721
722
	refresh: function () {
723
		var rf = this.wrapper.offsetHeight;		// Force reflow
724
725
		this.wrapperWidth	= this.wrapper.clientWidth;
726
		this.wrapperHeight	= this.wrapper.clientHeight;
727
728
/* REPLACE START: refresh */
729
730
		this.scrollerWidth	= this.scroller.offsetWidth;
731
		this.scrollerHeight	= this.scroller.offsetHeight;
732
733
		this.maxScrollX		= this.wrapperWidth - this.scrollerWidth;
734
		this.maxScrollY		= this.wrapperHeight - this.scrollerHeight;
735
736
/* REPLACE END: refresh */
737
738
		this.hasHorizontalScroll	= this.options.scrollX && this.maxScrollX < 0;
739
		this.hasVerticalScroll		= this.options.scrollY && this.maxScrollY < 0;
740
741
		if ( !this.hasHorizontalScroll ) {
742
			this.maxScrollX = 0;
743
			this.scrollerWidth = this.wrapperWidth;
744
		}
745
746
		if ( !this.hasVerticalScroll ) {
747
			this.maxScrollY = 0;
748
			this.scrollerHeight = this.wrapperHeight;
749
		}
750
751
		this.endTime = 0;
752
		this.directionX = 0;
753
		this.directionY = 0;
754
755
		this.wrapperOffset = utils.offset(this.wrapper);
756
757
		this._execEvent('refresh');
758
759
		this.resetPosition();
760
761
// INSERT POINT: _refresh
762
763
	},
764
765
	on: function (type, fn) {
766
		if ( !this._events[type] ) {
767
			this._events[type] = [];
768
		}
769
770
		this._events[type].push(fn);
771
	},
772
773
	off: function (type, fn) {
774
		if ( !this._events[type] ) {
775
			return;
776
		}
777
778
		var index = this._events[type].indexOf(fn);
779
780
		if ( index > -1 ) {
781
			this._events[type].splice(index, 1);
782
		}
783
	},
784
785
	_execEvent: function (type) {
786
		if ( !this._events[type] ) {
787
			return;
788
		}
789
790
		var i = 0,
791
			l = this._events[type].length;
792
793
		if ( !l ) {
794
			return;
795
		}
796
797
		for ( ; i < l; i++ ) {
798
			this._events[type][i].apply(this, [].slice.call(arguments, 1));
799
		}
800
	},
801
802
	scrollBy: function (x, y, time, easing) {
803
		x = this.x + x;
804
		y = this.y + y;
805
		time = time || 0;
806
807
		this.scrollTo(x, y, time, easing);
808
	},
809
810
	scrollTo: function (x, y, time, easing) {
811
		easing = easing || utils.ease.circular;
812
813
		this.isInTransition = this.options.useTransition && time > 0;
814
		var transitionType = this.options.useTransition && easing.style;
815
		if ( !time || transitionType ) {
816
				if(transitionType) {
817
					this._transitionTimingFunction(easing.style);
818
					this._transitionTime(time);
819
				}
820
			this._translate(x, y);
821
		} else {
822
			this._animate(x, y, time, easing.fn);
823
		}
824
	},
825
826
	scrollToElement: function (el, time, offsetX, offsetY, easing) {
827
		el = el.nodeType ? el : this.scroller.querySelector(el);
828
829
		if ( !el ) {
830
			return;
831
		}
832
833
		var pos = utils.offset(el);
834
835
		pos.left -= this.wrapperOffset.left;
836
		pos.top  -= this.wrapperOffset.top;
837
838
		// if offsetX/Y are true we center the element to the screen
839
		if ( offsetX === true ) {
840
			offsetX = Math.round(el.offsetWidth / 2 - this.wrapper.offsetWidth / 2);
841
		}
842
		if ( offsetY === true ) {
843
			offsetY = Math.round(el.offsetHeight / 2 - this.wrapper.offsetHeight / 2);
844
		}
845
846
		pos.left -= offsetX || 0;
847
		pos.top  -= offsetY || 0;
848
849
		pos.left = pos.left > 0 ? 0 : pos.left < this.maxScrollX ? this.maxScrollX : pos.left;
850
		pos.top  = pos.top  > 0 ? 0 : pos.top  < this.maxScrollY ? this.maxScrollY : pos.top;
851
852
		time = time === undefined || time === null || time === 'auto' ? Math.max(Math.abs(this.x-pos.left), Math.abs(this.y-pos.top)) : time;
853
854
		this.scrollTo(pos.left, pos.top, time, easing);
855
	},
856
857
	_transitionTime: function (time) {
858
		if (!this.options.useTransition) {
859
			return;
860
		}
861
		time = time || 0;
862
		var durationProp = utils.style.transitionDuration;
863
		if(!durationProp) {
864
			return;
865
		}
866
867
		this.scrollerStyle[durationProp] = time + 'ms';
868
869
		if ( !time && utils.isBadAndroid ) {
870
			this.scrollerStyle[durationProp] = '0.0001ms';
871
			// remove 0.0001ms
872
			var self = this;
873
			rAF(function() {
874
				if(self.scrollerStyle[durationProp] === '0.0001ms') {
875
					self.scrollerStyle[durationProp] = '0s';
876
				}
877
			});
878
		}
879
880
881
		if ( this.indicators ) {
882
			for ( var i = this.indicators.length; i--; ) {
883
				this.indicators[i].transitionTime(time);
884
			}
885
		}
886
887
888
// INSERT POINT: _transitionTime
889
890
	},
891
892
	_transitionTimingFunction: function (easing) {
893
		this.scrollerStyle[utils.style.transitionTimingFunction] = easing;
894
895
896
		if ( this.indicators ) {
897
			for ( var i = this.indicators.length; i--; ) {
898
				this.indicators[i].transitionTimingFunction(easing);
899
			}
900
		}
901
902
903
// INSERT POINT: _transitionTimingFunction
904
905
	},
906
907
	_translate: function (x, y) {
908
		if ( this.options.useTransform ) {
909
910
/* REPLACE START: _translate */
911
912
			this.scrollerStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.translateZ;
913
914
/* REPLACE END: _translate */
915
916
		} else {
917
			x = Math.round(x);
918
			y = Math.round(y);
919
			this.scrollerStyle.left = x + 'px';
920
			this.scrollerStyle.top = y + 'px';
921
		}
922
923
		this.x = x;
924
		this.y = y;
925
926
927
	if ( this.indicators ) {
928
		for ( var i = this.indicators.length; i--; ) {
929
			this.indicators[i].updatePosition();
930
		}
931
	}
932
933
934
// INSERT POINT: _translate
935
936
	},
937
938
	_initEvents: function (remove) {
939
		var eventType = remove ? utils.removeEvent : utils.addEvent,
940
			target = this.options.bindToWrapper ? this.wrapper : window;
941
942
		eventType(window, 'orientationchange', this);
943
		eventType(window, 'resize', this);
944
945
		if ( this.options.click ) {
946
			eventType(this.wrapper, 'click', this, true);
947
		}
948
949
		if ( !this.options.disableMouse ) {
950
			eventType(this.wrapper, 'mousedown', this);
951
			eventType(target, 'mousemove', this);
952
			eventType(target, 'mousecancel', this);
953
			eventType(target, 'mouseup', this);
954
		}
955
956
		if ( utils.hasPointer && !this.options.disablePointer ) {
957
			eventType(this.wrapper, utils.prefixPointerEvent('pointerdown'), this);
958
			eventType(target, utils.prefixPointerEvent('pointermove'), this);
959
			eventType(target, utils.prefixPointerEvent('pointercancel'), this);
960
			eventType(target, utils.prefixPointerEvent('pointerup'), this);
961
		}
962
963
		if ( utils.hasTouch && !this.options.disableTouch ) {
964
			eventType(this.wrapper, 'touchstart', this);
965
			eventType(target, 'touchmove', this);
966
			eventType(target, 'touchcancel', this);
967
			eventType(target, 'touchend', this);
968
		}
969
970
		eventType(this.scroller, 'transitionend', this);
971
		eventType(this.scroller, 'webkitTransitionEnd', this);
972
		eventType(this.scroller, 'oTransitionEnd', this);
973
		eventType(this.scroller, 'MSTransitionEnd', this);
974
	},
975
976
	getComputedPosition: function () {
977
		var matrix = window.getComputedStyle(this.scroller, null),
978
			x, y;
979
980
		if ( this.options.useTransform ) {
981
			matrix = matrix[utils.style.transform].split(')')[0].split(', ');
982
			x = +(matrix[12] || matrix[4]);
983
			y = +(matrix[13] || matrix[5]);
984
		} else {
985
			x = +matrix.left.replace(/[^-\d.]/g, '');
986
			y = +matrix.top.replace(/[^-\d.]/g, '');
987
		}
988
989
		return { x: x, y: y };
990
	},
991
	_initIndicators: function () {
992
		var interactive = this.options.interactiveScrollbars,
993
			customStyle = typeof this.options.scrollbars != 'string',
994
			indicators = [],
995
			indicator;
996
997
		var that = this;
998
999
		this.indicators = [];
1000
1001
		if ( this.options.scrollbars ) {
1002
			// Vertical scrollbar
1003
			if ( this.options.scrollY ) {
1004
				indicator = {
1005
					el: createDefaultScrollbar('v', interactive, this.options.scrollbars),
1006
					interactive: interactive,
1007
					defaultScrollbars: true,
1008
					customStyle: customStyle,
1009
					resize: this.options.resizeScrollbars,
1010
					shrink: this.options.shrinkScrollbars,
1011
					fade: this.options.fadeScrollbars,
1012
					listenX: false
1013
				};
1014
1015
				this.wrapper.appendChild(indicator.el);
1016
				indicators.push(indicator);
1017
			}
1018
1019
			// Horizontal scrollbar
1020
			if ( this.options.scrollX ) {
1021
				indicator = {
1022
					el: createDefaultScrollbar('h', interactive, this.options.scrollbars),
1023
					interactive: interactive,
1024
					defaultScrollbars: true,
1025
					customStyle: customStyle,
1026
					resize: this.options.resizeScrollbars,
1027
					shrink: this.options.shrinkScrollbars,
1028
					fade: this.options.fadeScrollbars,
1029
					listenY: false
1030
				};
1031
1032
				this.wrapper.appendChild(indicator.el);
1033
				indicators.push(indicator);
1034
			}
1035
		}
1036
1037
		if ( this.options.indicators ) {
1038
			// TODO: check concat compatibility
1039
			indicators = indicators.concat(this.options.indicators);
1040
		}
1041
1042
		for ( var i = indicators.length; i--; ) {
1043
			this.indicators.push( new Indicator(this, indicators[i]) );
1044
		}
1045
1046
		// TODO: check if we can use array.map (wide compatibility and performance issues)
1047
		function _indicatorsMap (fn) {
1048
			if (that.indicators) {
1049
				for ( var i = that.indicators.length; i--; ) {
1050
					fn.call(that.indicators[i]);
1051
				}
1052
			}
1053
		}
1054
1055
		if ( this.options.fadeScrollbars ) {
1056
			this.on('scrollEnd', function () {
1057
				_indicatorsMap(function () {
1058
					this.fade();
1059
				});
1060
			});
1061
1062
			this.on('scrollCancel', function () {
1063
				_indicatorsMap(function () {
1064
					this.fade();
1065
				});
1066
			});
1067
1068
			this.on('scrollStart', function () {
1069
				_indicatorsMap(function () {
1070
					this.fade(1);
1071
				});
1072
			});
1073
1074
			this.on('beforeScrollStart', function () {
1075
				_indicatorsMap(function () {
1076
					this.fade(1, true);
1077
				});
1078
			});
1079
		}
1080
1081
1082
		this.on('refresh', function () {
1083
			_indicatorsMap(function () {
1084
				this.refresh();
1085
			});
1086
		});
1087
1088
		this.on('destroy', function () {
1089
			_indicatorsMap(function () {
1090
				this.destroy();
1091
			});
1092
1093
			delete this.indicators;
1094
		});
1095
	},
1096
1097
	_initWheel: function () {
1098
		utils.addEvent(this.wrapper, 'wheel', this);
1099
		utils.addEvent(this.wrapper, 'mousewheel', this);
1100
		utils.addEvent(this.wrapper, 'DOMMouseScroll', this);
1101
1102
		this.on('destroy', function () {
1103
			clearTimeout(this.wheelTimeout);
1104
			this.wheelTimeout = null;
1105
			utils.removeEvent(this.wrapper, 'wheel', this);
1106
			utils.removeEvent(this.wrapper, 'mousewheel', this);
1107
			utils.removeEvent(this.wrapper, 'DOMMouseScroll', this);
1108
		});
1109
	},
1110
1111
	_wheel: function (e) {
1112
		if ( !this.enabled ) {
1113
			return;
1114
		}
1115
1116
		e.preventDefault();
1117
1118
		var wheelDeltaX, wheelDeltaY,
1119
			newX, newY,
1120
			that = this;
1121
1122
		if ( this.wheelTimeout === undefined ) {
1123
			that._execEvent('scrollStart');
1124
		}
1125
1126
		// Execute the scrollEnd event after 400ms the wheel stopped scrolling
1127
		clearTimeout(this.wheelTimeout);
1128
		this.wheelTimeout = setTimeout(function () {
1129
			if(!that.options.snap) {
1130
				that._execEvent('scrollEnd');
1131
			}
1132
			that.wheelTimeout = undefined;
1133
		}, 400);
1134
1135
		if ( 'deltaX' in e ) {
1136
			if (e.deltaMode === 1) {
1137
				wheelDeltaX = -e.deltaX * this.options.mouseWheelSpeed;
1138
				wheelDeltaY = -e.deltaY * this.options.mouseWheelSpeed;
1139
			} else {
1140
				wheelDeltaX = -e.deltaX;
1141
				wheelDeltaY = -e.deltaY;
1142
			}
1143
		} else if ( 'wheelDeltaX' in e ) {
1144
			wheelDeltaX = e.wheelDeltaX / 120 * this.options.mouseWheelSpeed;
1145
			wheelDeltaY = e.wheelDeltaY / 120 * this.options.mouseWheelSpeed;
1146
		} else if ( 'wheelDelta' in e ) {
1147
			wheelDeltaX = wheelDeltaY = e.wheelDelta / 120 * this.options.mouseWheelSpeed;
1148
		} else if ( 'detail' in e ) {
1149
			wheelDeltaX = wheelDeltaY = -e.detail / 3 * this.options.mouseWheelSpeed;
1150
		} else {
1151
			return;
1152
		}
1153
1154
		wheelDeltaX *= this.options.invertWheelDirection;
1155
		wheelDeltaY *= this.options.invertWheelDirection;
1156
1157
		if ( !this.hasVerticalScroll ) {
1158
			wheelDeltaX = wheelDeltaY;
1159
			wheelDeltaY = 0;
1160
		}
1161
1162
		if ( this.options.snap ) {
1163
			newX = this.currentPage.pageX;
1164
			newY = this.currentPage.pageY;
1165
1166
			if ( wheelDeltaX > 0 ) {
1167
				newX--;
1168
			} else if ( wheelDeltaX < 0 ) {
1169
				newX++;
1170
			}
1171
1172
			if ( wheelDeltaY > 0 ) {
1173
				newY--;
1174
			} else if ( wheelDeltaY < 0 ) {
1175
				newY++;
1176
			}
1177
1178
			this.goToPage(newX, newY);
1179
1180
			return;
1181
		}
1182
1183
		newX = this.x + Math.round(this.hasHorizontalScroll ? wheelDeltaX : 0);
1184
		newY = this.y + Math.round(this.hasVerticalScroll ? wheelDeltaY : 0);
1185
1186
		this.directionX = wheelDeltaX > 0 ? -1 : wheelDeltaX < 0 ? 1 : 0;
1187
		this.directionY = wheelDeltaY > 0 ? -1 : wheelDeltaY < 0 ? 1 : 0;
1188
1189
		if ( newX > 0 ) {
1190
			newX = 0;
1191
		} else if ( newX < this.maxScrollX ) {
1192
			newX = this.maxScrollX;
1193
		}
1194
1195
		if ( newY > 0 ) {
1196
			newY = 0;
1197
		} else if ( newY < this.maxScrollY ) {
1198
			newY = this.maxScrollY;
1199
		}
1200
1201
		this.scrollTo(newX, newY, 0);
1202
1203
// INSERT POINT: _wheel
1204
	},
1205
1206
	_initSnap: function () {
1207
		this.currentPage = {};
1208
1209
		if ( typeof this.options.snap == 'string' ) {
1210
			this.options.snap = this.scroller.querySelectorAll(this.options.snap);
1211
		}
1212
1213
		this.on('refresh', function () {
1214
			var i = 0, l,
1215
				m = 0, n,
1216
				cx, cy,
1217
				x = 0, y,
1218
				stepX = this.options.snapStepX || this.wrapperWidth,
1219
				stepY = this.options.snapStepY || this.wrapperHeight,
1220
				el;
1221
1222
			this.pages = [];
1223
1224
			if ( !this.wrapperWidth || !this.wrapperHeight || !this.scrollerWidth || !this.scrollerHeight ) {
1225
				return;
1226
			}
1227
1228
			if ( this.options.snap === true ) {
1229
				cx = Math.round( stepX / 2 );
1230
				cy = Math.round( stepY / 2 );
1231
1232
				while ( x > -this.scrollerWidth ) {
1233
					this.pages[i] = [];
1234
					l = 0;
1235
					y = 0;
1236
1237
					while ( y > -this.scrollerHeight ) {
1238
						this.pages[i][l] = {
1239
							x: Math.max(x, this.maxScrollX),
1240
							y: Math.max(y, this.maxScrollY),
1241
							width: stepX,
1242
							height: stepY,
1243
							cx: x - cx,
1244
							cy: y - cy
1245
						};
1246
1247
						y -= stepY;
1248
						l++;
1249
					}
1250
1251
					x -= stepX;
1252
					i++;
1253
				}
1254
			} else {
1255
				el = this.options.snap;
1256
				l = el.length;
1257
				n = -1;
1258
1259
				for ( ; i < l; i++ ) {
1260
					if ( i === 0 || el[i].offsetLeft <= el[i-1].offsetLeft ) {
1261
						m = 0;
1262
						n++;
1263
					}
1264
1265
					if ( !this.pages[m] ) {
1266
						this.pages[m] = [];
1267
					}
1268
1269
					x = Math.max(-el[i].offsetLeft, this.maxScrollX);
1270
					y = Math.max(-el[i].offsetTop, this.maxScrollY);
1271
					cx = x - Math.round(el[i].offsetWidth / 2);
1272
					cy = y - Math.round(el[i].offsetHeight / 2);
1273
1274
					this.pages[m][n] = {
1275
						x: x,
1276
						y: y,
1277
						width: el[i].offsetWidth,
1278
						height: el[i].offsetHeight,
1279
						cx: cx,
1280
						cy: cy
1281
					};
1282
1283
					if ( x > this.maxScrollX ) {
1284
						m++;
1285
					}
1286
				}
1287
			}
1288
1289
			this.goToPage(this.currentPage.pageX || 0, this.currentPage.pageY || 0, 0);
1290
1291
			// Update snap threshold if needed
1292
			if ( this.options.snapThreshold % 1 === 0 ) {
1293
				this.snapThresholdX = this.options.snapThreshold;
1294
				this.snapThresholdY = this.options.snapThreshold;
1295
			} else {
1296
				this.snapThresholdX = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].width * this.options.snapThreshold);
1297
				this.snapThresholdY = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].height * this.options.snapThreshold);
1298
			}
1299
		});
1300
1301
		this.on('flick', function () {
1302
			var time = this.options.snapSpeed || Math.max(
1303
					Math.max(
1304
						Math.min(Math.abs(this.x - this.startX), 1000),
1305
						Math.min(Math.abs(this.y - this.startY), 1000)
1306
					), 300);
1307
1308
			this.goToPage(
1309
				this.currentPage.pageX + this.directionX,
1310
				this.currentPage.pageY + this.directionY,
1311
				time
1312
			);
1313
		});
1314
	},
1315
1316
	_nearestSnap: function (x, y) {
1317
		if ( !this.pages.length ) {
1318
			return { x: 0, y: 0, pageX: 0, pageY: 0 };
1319
		}
1320
1321
		var i = 0,
1322
			l = this.pages.length,
1323
			m = 0;
1324
1325
		// Check if we exceeded the snap threshold
1326
		if ( Math.abs(x - this.absStartX) < this.snapThresholdX &&
1327
			Math.abs(y - this.absStartY) < this.snapThresholdY ) {
1328
			return this.currentPage;
1329
		}
1330
1331
		if ( x > 0 ) {
1332
			x = 0;
1333
		} else if ( x < this.maxScrollX ) {
1334
			x = this.maxScrollX;
1335
		}
1336
1337
		if ( y > 0 ) {
1338
			y = 0;
1339
		} else if ( y < this.maxScrollY ) {
1340
			y = this.maxScrollY;
1341
		}
1342
1343
		for ( ; i < l; i++ ) {
1344
			if ( x >= this.pages[i][0].cx ) {
1345
				x = this.pages[i][0].x;
1346
				break;
1347
			}
1348
		}
1349
1350
		l = this.pages[i].length;
1351
1352
		for ( ; m < l; m++ ) {
1353
			if ( y >= this.pages[0][m].cy ) {
1354
				y = this.pages[0][m].y;
1355
				break;
1356
			}
1357
		}
1358
1359
		if ( i == this.currentPage.pageX ) {
1360
			i += this.directionX;
1361
1362
			if ( i < 0 ) {
1363
				i = 0;
1364
			} else if ( i >= this.pages.length ) {
1365
				i = this.pages.length - 1;
1366
			}
1367
1368
			x = this.pages[i][0].x;
1369
		}
1370
1371
		if ( m == this.currentPage.pageY ) {
1372
			m += this.directionY;
1373
1374
			if ( m < 0 ) {
1375
				m = 0;
1376
			} else if ( m >= this.pages[0].length ) {
1377
				m = this.pages[0].length - 1;
1378
			}
1379
1380
			y = this.pages[0][m].y;
1381
		}
1382
1383
		return {
1384
			x: x,
1385
			y: y,
1386
			pageX: i,
1387
			pageY: m
1388
		};
1389
	},
1390
1391
	goToPage: function (x, y, time, easing) {
1392
		easing = easing || this.options.bounceEasing;
1393
1394
		if ( x >= this.pages.length ) {
1395
			x = this.pages.length - 1;
1396
		} else if ( x < 0 ) {
1397
			x = 0;
1398
		}
1399
1400
		if ( y >= this.pages[x].length ) {
1401
			y = this.pages[x].length - 1;
1402
		} else if ( y < 0 ) {
1403
			y = 0;
1404
		}
1405
1406
		var posX = this.pages[x][y].x,
1407
			posY = this.pages[x][y].y;
1408
1409
		time = time === undefined ? this.options.snapSpeed || Math.max(
1410
			Math.max(
1411
				Math.min(Math.abs(posX - this.x), 1000),
1412
				Math.min(Math.abs(posY - this.y), 1000)
1413
			), 300) : time;
1414
1415
		this.currentPage = {
1416
			x: posX,
1417
			y: posY,
1418
			pageX: x,
1419
			pageY: y
1420
		};
1421
1422
		this.scrollTo(posX, posY, time, easing);
1423
	},
1424
1425
	next: function (time, easing) {
1426
		var x = this.currentPage.pageX,
1427
			y = this.currentPage.pageY;
1428
1429
		x++;
1430
1431
		if ( x >= this.pages.length && this.hasVerticalScroll ) {
1432
			x = 0;
1433
			y++;
1434
		}
1435
1436
		this.goToPage(x, y, time, easing);
1437
	},
1438
1439
	prev: function (time, easing) {
1440
		var x = this.currentPage.pageX,
1441
			y = this.currentPage.pageY;
1442
1443
		x--;
1444
1445
		if ( x < 0 && this.hasVerticalScroll ) {
1446
			x = 0;
1447
			y--;
1448
		}
1449
1450
		this.goToPage(x, y, time, easing);
1451
	},
1452
1453
	_initKeys: function (e) {
1454
		// default key bindings
1455
		var keys = {
1456
			pageUp: 33,
1457
			pageDown: 34,
1458
			end: 35,
1459
			home: 36,
1460
			left: 37,
1461
			up: 38,
1462
			right: 39,
1463
			down: 40
1464
		};
1465
		var i;
1466
1467
		// if you give me characters I give you keycode
1468
		if ( typeof this.options.keyBindings == 'object' ) {
1469
			for ( i in this.options.keyBindings ) {
1470
				if ( typeof this.options.keyBindings[i] == 'string' ) {
1471
					this.options.keyBindings[i] = this.options.keyBindings[i].toUpperCase().charCodeAt(0);
1472
				}
1473
			}
1474
		} else {
1475
			this.options.keyBindings = {};
1476
		}
1477
1478
		for ( i in keys ) {
1479
			this.options.keyBindings[i] = this.options.keyBindings[i] || keys[i];
1480
		}
1481
1482
		utils.addEvent(window, 'keydown', this);
1483
1484
		this.on('destroy', function () {
1485
			utils.removeEvent(window, 'keydown', this);
1486
		});
1487
	},
1488
1489
	_key: function (e) {
1490
		if ( !this.enabled ) {
1491
			return;
1492
		}
1493
1494
		var snap = this.options.snap,	// we are using this alot, better to cache it
1495
			newX = snap ? this.currentPage.pageX : this.x,
1496
			newY = snap ? this.currentPage.pageY : this.y,
1497
			now = utils.getTime(),
1498
			prevTime = this.keyTime || 0,
1499
			acceleration = 0.250,
1500
			pos;
1501
1502
		if ( this.options.useTransition && this.isInTransition ) {
1503
			pos = this.getComputedPosition();
1504
1505
			this._translate(Math.round(pos.x), Math.round(pos.y));
1506
			this.isInTransition = false;
1507
		}
1508
1509
		this.keyAcceleration = now - prevTime < 200 ? Math.min(this.keyAcceleration + acceleration, 50) : 0;
1510
1511
		switch ( e.keyCode ) {
1512
			case this.options.keyBindings.pageUp:
1513
				if ( this.hasHorizontalScroll && !this.hasVerticalScroll ) {
1514
					newX += snap ? 1 : this.wrapperWidth;
1515
				} else {
1516
					newY += snap ? 1 : this.wrapperHeight;
1517
				}
1518
				break;
1519
			case this.options.keyBindings.pageDown:
1520
				if ( this.hasHorizontalScroll && !this.hasVerticalScroll ) {
1521
					newX -= snap ? 1 : this.wrapperWidth;
1522
				} else {
1523
					newY -= snap ? 1 : this.wrapperHeight;
1524
				}
1525
				break;
1526
			case this.options.keyBindings.end:
1527
				newX = snap ? this.pages.length-1 : this.maxScrollX;
1528
				newY = snap ? this.pages[0].length-1 : this.maxScrollY;
1529
				break;
1530
			case this.options.keyBindings.home:
1531
				newX = 0;
1532
				newY = 0;
1533
				break;
1534
			case this.options.keyBindings.left:
1535
				newX += snap ? -1 : 5 + this.keyAcceleration>>0;
1536
				break;
1537
			case this.options.keyBindings.up:
1538
				newY += snap ? 1 : 5 + this.keyAcceleration>>0;
1539
				break;
1540
			case this.options.keyBindings.right:
1541
				newX -= snap ? -1 : 5 + this.keyAcceleration>>0;
1542
				break;
1543
			case this.options.keyBindings.down:
1544
				newY -= snap ? 1 : 5 + this.keyAcceleration>>0;
1545
				break;
1546
			default:
1547
				return;
1548
		}
1549
1550
		if ( snap ) {
1551
			this.goToPage(newX, newY);
1552
			return;
1553
		}
1554
1555
		if ( newX > 0 ) {
1556
			newX = 0;
1557
			this.keyAcceleration = 0;
1558
		} else if ( newX < this.maxScrollX ) {
1559
			newX = this.maxScrollX;
1560
			this.keyAcceleration = 0;
1561
		}
1562
1563
		if ( newY > 0 ) {
1564
			newY = 0;
1565
			this.keyAcceleration = 0;
1566
		} else if ( newY < this.maxScrollY ) {
1567
			newY = this.maxScrollY;
1568
			this.keyAcceleration = 0;
1569
		}
1570
1571
		this.scrollTo(newX, newY, 0);
1572
1573
		this.keyTime = now;
1574
	},
1575
1576
	_animate: function (destX, destY, duration, easingFn) {
1577
		var that = this,
1578
			startX = this.x,
1579
			startY = this.y,
1580
			startTime = utils.getTime(),
1581
			destTime = startTime + duration;
1582
1583
		function step () {
1584
			var now = utils.getTime(),
1585
				newX, newY,
1586
				easing;
1587
1588
			if ( now >= destTime ) {
1589
				that.isAnimating = false;
1590
				that._translate(destX, destY);
1591
1592
				if ( !that.resetPosition(that.options.bounceTime) ) {
1593
					that._execEvent('scrollEnd');
1594
				}
1595
1596
				return;
1597
			}
1598
1599
			now = ( now - startTime ) / duration;
1600
			easing = easingFn(now);
1601
			newX = ( destX - startX ) * easing + startX;
1602
			newY = ( destY - startY ) * easing + startY;
1603
			that._translate(newX, newY);
1604
1605
			if ( that.isAnimating ) {
1606
				rAF(step);
1607
			}
1608
		}
1609
1610
		this.isAnimating = true;
1611
		step();
1612
	},
1613
	handleEvent: function (e) {
1614
		switch ( e.type ) {
1615
			case 'touchstart':
1616
			case 'pointerdown':
1617
			case 'MSPointerDown':
1618
			case 'mousedown':
1619
				this._start(e);
1620
				break;
1621
			case 'touchmove':
1622
			case 'pointermove':
1623
			case 'MSPointerMove':
1624
			case 'mousemove':
1625
				this._move(e);
1626
				break;
1627
			case 'touchend':
1628
			case 'pointerup':
1629
			case 'MSPointerUp':
1630
			case 'mouseup':
1631
			case 'touchcancel':
1632
			case 'pointercancel':
1633
			case 'MSPointerCancel':
1634
			case 'mousecancel':
1635
				this._end(e);
1636
				break;
1637
			case 'orientationchange':
1638
			case 'resize':
1639
				this._resize();
1640
				break;
1641
			case 'transitionend':
1642
			case 'webkitTransitionEnd':
1643
			case 'oTransitionEnd':
1644
			case 'MSTransitionEnd':
1645
				this._transitionEnd(e);
1646
				break;
1647
			case 'wheel':
1648
			case 'DOMMouseScroll':
1649
			case 'mousewheel':
1650
				this._wheel(e);
1651
				break;
1652
			case 'keydown':
1653
				this._key(e);
1654
				break;
1655
			case 'click':
1656
				if ( this.enabled && !e._constructed ) {
1657
					e.preventDefault();
1658
					e.stopPropagation();
1659
				}
1660
				break;
1661
		}
1662
	}
1663
};
1664
function createDefaultScrollbar (direction, interactive, type) {
1665
	var scrollbar = document.createElement('div'),
1666
		indicator = document.createElement('div');
1667
1668
	if ( type === true ) {
1669
		scrollbar.style.cssText = 'position:absolute;z-index:9999';
1670
		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';
1671
	}
1672
1673
	indicator.className = 'iScrollIndicator';
1674
1675
	if ( direction == 'h' ) {
1676
		if ( type === true ) {
1677
			scrollbar.style.cssText += ';height:7px;left:2px;right:2px;bottom:0';
1678
			indicator.style.height = '100%';
1679
		}
1680
		scrollbar.className = 'iScrollHorizontalScrollbar';
1681
	} else {
1682
		if ( type === true ) {
1683
			scrollbar.style.cssText += ';width:7px;bottom:2px;top:2px;right:1px';
1684
			indicator.style.width = '100%';
1685
		}
1686
		scrollbar.className = 'iScrollVerticalScrollbar';
1687
	}
1688
1689
	scrollbar.style.cssText += ';overflow:hidden';
1690
1691
	if ( !interactive ) {
1692
		scrollbar.style.pointerEvents = 'none';
1693
	}
1694
1695
	scrollbar.appendChild(indicator);
1696
1697
	return scrollbar;
1698
}
1699
1700
function Indicator (scroller, options) {
1701
	this.wrapper = typeof options.el == 'string' ? document.querySelector(options.el) : options.el;
1702
	this.wrapperStyle = this.wrapper.style;
1703
	this.indicator = this.wrapper.children[0];
1704
	this.indicatorStyle = this.indicator.style;
1705
	this.scroller = scroller;
1706
1707
	this.options = {
1708
		listenX: true,
1709
		listenY: true,
1710
		interactive: false,
1711
		resize: true,
1712
		defaultScrollbars: false,
1713
		shrink: false,
1714
		fade: false,
1715
		speedRatioX: 0,
1716
		speedRatioY: 0
1717
	};
1718
1719
	for ( var i in options ) {
1720
		this.options[i] = options[i];
1721
	}
1722
1723
	this.sizeRatioX = 1;
1724
	this.sizeRatioY = 1;
1725
	this.maxPosX = 0;
1726
	this.maxPosY = 0;
1727
1728
	if ( this.options.interactive ) {
1729
		if ( !this.options.disableTouch ) {
1730
			utils.addEvent(this.indicator, 'touchstart', this);
1731
			utils.addEvent(window, 'touchend', this);
1732
		}
1733
		if ( !this.options.disablePointer ) {
1734
			utils.addEvent(this.indicator, utils.prefixPointerEvent('pointerdown'), this);
1735
			utils.addEvent(window, utils.prefixPointerEvent('pointerup'), this);
1736
		}
1737
		if ( !this.options.disableMouse ) {
1738
			utils.addEvent(this.indicator, 'mousedown', this);
1739
			utils.addEvent(window, 'mouseup', this);
1740
		}
1741
	}
1742
1743
	if ( this.options.fade ) {
1744
		this.wrapperStyle[utils.style.transform] = this.scroller.translateZ;
1745
		var durationProp = utils.style.transitionDuration;
1746
		if(!durationProp) {
1747
			return;
1748
		}
1749
		this.wrapperStyle[durationProp] = utils.isBadAndroid ? '0.0001ms' : '0ms';
1750
		// remove 0.0001ms
1751
		var self = this;
1752
		if(utils.isBadAndroid) {
1753
			rAF(function() {
1754
				if(self.wrapperStyle[durationProp] === '0.0001ms') {
1755
					self.wrapperStyle[durationProp] = '0s';
1756
				}
1757
			});
1758
		}
1759
		this.wrapperStyle.opacity = '0';
1760
	}
1761
}
1762
1763
Indicator.prototype = {
1764
	handleEvent: function (e) {
1765
		switch ( e.type ) {
1766
			case 'touchstart':
1767
			case 'pointerdown':
1768
			case 'MSPointerDown':
1769
			case 'mousedown':
1770
				this._start(e);
1771
				break;
1772
			case 'touchmove':
1773
			case 'pointermove':
1774
			case 'MSPointerMove':
1775
			case 'mousemove':
1776
				this._move(e);
1777
				break;
1778
			case 'touchend':
1779
			case 'pointerup':
1780
			case 'MSPointerUp':
1781
			case 'mouseup':
1782
			case 'touchcancel':
1783
			case 'pointercancel':
1784
			case 'MSPointerCancel':
1785
			case 'mousecancel':
1786
				this._end(e);
1787
				break;
1788
		}
1789
	},
1790
1791
	destroy: function () {
1792
		if ( this.options.fadeScrollbars ) {
1793
			clearTimeout(this.fadeTimeout);
1794
			this.fadeTimeout = null;
1795
		}
1796
		if ( this.options.interactive ) {
1797
			utils.removeEvent(this.indicator, 'touchstart', this);
1798
			utils.removeEvent(this.indicator, utils.prefixPointerEvent('pointerdown'), this);
1799
			utils.removeEvent(this.indicator, 'mousedown', this);
1800
1801
			utils.removeEvent(window, 'touchmove', this);
1802
			utils.removeEvent(window, utils.prefixPointerEvent('pointermove'), this);
1803
			utils.removeEvent(window, 'mousemove', this);
1804
1805
			utils.removeEvent(window, 'touchend', this);
1806
			utils.removeEvent(window, utils.prefixPointerEvent('pointerup'), this);
1807
			utils.removeEvent(window, 'mouseup', this);
1808
		}
1809
1810
		if ( this.options.defaultScrollbars ) {
1811
			this.wrapper.parentNode.removeChild(this.wrapper);
1812
		}
1813
	},
1814
1815
	_start: function (e) {
1816
		var point = e.touches ? e.touches[0] : e;
1817
1818
		e.preventDefault();
1819
		e.stopPropagation();
1820
1821
		this.transitionTime();
1822
1823
		this.initiated = true;
1824
		this.moved = false;
1825
		this.lastPointX	= point.pageX;
1826
		this.lastPointY	= point.pageY;
1827
1828
		this.startTime	= utils.getTime();
1829
1830
		if ( !this.options.disableTouch ) {
1831
			utils.addEvent(window, 'touchmove', this);
1832
		}
1833
		if ( !this.options.disablePointer ) {
1834
			utils.addEvent(window, utils.prefixPointerEvent('pointermove'), this);
1835
		}
1836
		if ( !this.options.disableMouse ) {
1837
			utils.addEvent(window, 'mousemove', this);
1838
		}
1839
1840
		this.scroller._execEvent('beforeScrollStart');
1841
	},
1842
1843
	_move: function (e) {
1844
		var point = e.touches ? e.touches[0] : e,
1845
			deltaX, deltaY,
1846
			newX, newY,
1847
			timestamp = utils.getTime();
1848
1849
		if ( !this.moved ) {
1850
			this.scroller._execEvent('scrollStart');
1851
		}
1852
1853
		this.moved = true;
1854
1855
		deltaX = point.pageX - this.lastPointX;
1856
		this.lastPointX = point.pageX;
1857
1858
		deltaY = point.pageY - this.lastPointY;
1859
		this.lastPointY = point.pageY;
1860
1861
		newX = this.x + deltaX;
1862
		newY = this.y + deltaY;
1863
1864
		this._pos(newX, newY);
1865
1866
// INSERT POINT: indicator._move
1867
1868
		e.preventDefault();
1869
		e.stopPropagation();
1870
	},
1871
1872
	_end: function (e) {
1873
		if ( !this.initiated ) {
1874
			return;
1875
		}
1876
1877
		this.initiated = false;
1878
1879
		e.preventDefault();
1880
		e.stopPropagation();
1881
1882
		utils.removeEvent(window, 'touchmove', this);
1883
		utils.removeEvent(window, utils.prefixPointerEvent('pointermove'), this);
1884
		utils.removeEvent(window, 'mousemove', this);
1885
1886
		if ( this.scroller.options.snap ) {
1887
			var snap = this.scroller._nearestSnap(this.scroller.x, this.scroller.y);
1888
1889
			var time = this.options.snapSpeed || Math.max(
1890
					Math.max(
1891
						Math.min(Math.abs(this.scroller.x - snap.x), 1000),
1892
						Math.min(Math.abs(this.scroller.y - snap.y), 1000)
1893
					), 300);
1894
1895
			if ( this.scroller.x != snap.x || this.scroller.y != snap.y ) {
1896
				this.scroller.directionX = 0;
1897
				this.scroller.directionY = 0;
1898
				this.scroller.currentPage = snap;
1899
				this.scroller.scrollTo(snap.x, snap.y, time, this.scroller.options.bounceEasing);
1900
			}
1901
		}
1902
1903
		if ( this.moved ) {
1904
			this.scroller._execEvent('scrollEnd');
1905
		}
1906
	},
1907
1908
	transitionTime: function (time) {
1909
		time = time || 0;
1910
		var durationProp = utils.style.transitionDuration;
1911
		if(!durationProp) {
1912
			return;
1913
		}
1914
1915
		this.indicatorStyle[durationProp] = time + 'ms';
1916
1917
		if ( !time && utils.isBadAndroid ) {
1918
			this.indicatorStyle[durationProp] = '0.0001ms';
1919
			// remove 0.0001ms
1920
			var self = this;
1921
			rAF(function() {
1922
				if(self.indicatorStyle[durationProp] === '0.0001ms') {
1923
					self.indicatorStyle[durationProp] = '0s';
1924
				}
1925
			});
1926
		}
1927
	},
1928
1929
	transitionTimingFunction: function (easing) {
1930
		this.indicatorStyle[utils.style.transitionTimingFunction] = easing;
1931
	},
1932
1933
	refresh: function () {
1934
		this.transitionTime();
1935
1936
		if ( this.options.listenX && !this.options.listenY ) {
1937
			this.indicatorStyle.display = this.scroller.hasHorizontalScroll ? 'block' : 'none';
1938
		} else if ( this.options.listenY && !this.options.listenX ) {
1939
			this.indicatorStyle.display = this.scroller.hasVerticalScroll ? 'block' : 'none';
1940
		} else {
1941
			this.indicatorStyle.display = this.scroller.hasHorizontalScroll || this.scroller.hasVerticalScroll ? 'block' : 'none';
1942
		}
1943
1944
		if ( this.scroller.hasHorizontalScroll && this.scroller.hasVerticalScroll ) {
1945
			utils.addClass(this.wrapper, 'iScrollBothScrollbars');
1946
			utils.removeClass(this.wrapper, 'iScrollLoneScrollbar');
1947
1948
			if ( this.options.defaultScrollbars && this.options.customStyle ) {
1949
				if ( this.options.listenX ) {
1950
					this.wrapper.style.right = '8px';
1951
				} else {
1952
					this.wrapper.style.bottom = '8px';
1953
				}
1954
			}
1955
		} else {
1956
			utils.removeClass(this.wrapper, 'iScrollBothScrollbars');
1957
			utils.addClass(this.wrapper, 'iScrollLoneScrollbar');
1958
1959
			if ( this.options.defaultScrollbars && this.options.customStyle ) {
1960
				if ( this.options.listenX ) {
1961
					this.wrapper.style.right = '2px';
1962
				} else {
1963
					this.wrapper.style.bottom = '2px';
1964
				}
1965
			}
1966
		}
1967
1968
		var r = this.wrapper.offsetHeight;	// force refresh
1969
1970
		if ( this.options.listenX ) {
1971
			this.wrapperWidth = this.wrapper.clientWidth;
1972
			if ( this.options.resize ) {
1973
				this.indicatorWidth = Math.max(Math.round(this.wrapperWidth * this.wrapperWidth / (this.scroller.scrollerWidth || this.wrapperWidth || 1)), 8);
1974
				this.indicatorStyle.width = this.indicatorWidth + 'px';
1975
			} else {
1976
				this.indicatorWidth = this.indicator.clientWidth;
1977
			}
1978
1979
			this.maxPosX = this.wrapperWidth - this.indicatorWidth;
1980
1981
			if ( this.options.shrink == 'clip' ) {
1982
				this.minBoundaryX = -this.indicatorWidth + 8;
1983
				this.maxBoundaryX = this.wrapperWidth - 8;
1984
			} else {
1985
				this.minBoundaryX = 0;
1986
				this.maxBoundaryX = this.maxPosX;
1987
			}
1988
1989
			this.sizeRatioX = this.options.speedRatioX || (this.scroller.maxScrollX && (this.maxPosX / this.scroller.maxScrollX));
1990
		}
1991
1992
		if ( this.options.listenY ) {
1993
			this.wrapperHeight = this.wrapper.clientHeight;
1994
			if ( this.options.resize ) {
1995
				this.indicatorHeight = Math.max(Math.round(this.wrapperHeight * this.wrapperHeight / (this.scroller.scrollerHeight || this.wrapperHeight || 1)), 8);
1996
				this.indicatorStyle.height = this.indicatorHeight + 'px';
1997
			} else {
1998
				this.indicatorHeight = this.indicator.clientHeight;
1999
			}
2000
2001
			this.maxPosY = this.wrapperHeight - this.indicatorHeight;
2002
2003
			if ( this.options.shrink == 'clip' ) {
2004
				this.minBoundaryY = -this.indicatorHeight + 8;
2005
				this.maxBoundaryY = this.wrapperHeight - 8;
2006
			} else {
2007
				this.minBoundaryY = 0;
2008
				this.maxBoundaryY = this.maxPosY;
2009
			}
2010
2011
			this.maxPosY = this.wrapperHeight - this.indicatorHeight;
2012
			this.sizeRatioY = this.options.speedRatioY || (this.scroller.maxScrollY && (this.maxPosY / this.scroller.maxScrollY));
2013
		}
2014
2015
		this.updatePosition();
2016
	},
2017
2018
	updatePosition: function () {
2019
		var x = this.options.listenX && Math.round(this.sizeRatioX * this.scroller.x) || 0,
2020
			y = this.options.listenY && Math.round(this.sizeRatioY * this.scroller.y) || 0;
2021
2022
		if ( !this.options.ignoreBoundaries ) {
2023
			if ( x < this.minBoundaryX ) {
2024
				if ( this.options.shrink == 'scale' ) {
2025
					this.width = Math.max(this.indicatorWidth + x, 8);
2026
					this.indicatorStyle.width = this.width + 'px';
2027
				}
2028
				x = this.minBoundaryX;
2029
			} else if ( x > this.maxBoundaryX ) {
2030
				if ( this.options.shrink == 'scale' ) {
2031
					this.width = Math.max(this.indicatorWidth - (x - this.maxPosX), 8);
2032
					this.indicatorStyle.width = this.width + 'px';
2033
					x = this.maxPosX + this.indicatorWidth - this.width;
2034
				} else {
2035
					x = this.maxBoundaryX;
2036
				}
2037
			} else if ( this.options.shrink == 'scale' && this.width != this.indicatorWidth ) {
2038
				this.width = this.indicatorWidth;
2039
				this.indicatorStyle.width = this.width + 'px';
2040
			}
2041
2042
			if ( y < this.minBoundaryY ) {
2043
				if ( this.options.shrink == 'scale' ) {
2044
					this.height = Math.max(this.indicatorHeight + y * 3, 8);
2045
					this.indicatorStyle.height = this.height + 'px';
2046
				}
2047
				y = this.minBoundaryY;
2048
			} else if ( y > this.maxBoundaryY ) {
2049
				if ( this.options.shrink == 'scale' ) {
2050
					this.height = Math.max(this.indicatorHeight - (y - this.maxPosY) * 3, 8);
2051
					this.indicatorStyle.height = this.height + 'px';
2052
					y = this.maxPosY + this.indicatorHeight - this.height;
2053
				} else {
2054
					y = this.maxBoundaryY;
2055
				}
2056
			} else if ( this.options.shrink == 'scale' && this.height != this.indicatorHeight ) {
2057
				this.height = this.indicatorHeight;
2058
				this.indicatorStyle.height = this.height + 'px';
2059
			}
2060
		}
2061
2062
		this.x = x;
2063
		this.y = y;
2064
2065
		if ( this.scroller.options.useTransform ) {
2066
			this.indicatorStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.scroller.translateZ;
2067
		} else {
2068
			this.indicatorStyle.left = x + 'px';
2069
			this.indicatorStyle.top = y + 'px';
2070
		}
2071
	},
2072
2073
	_pos: function (x, y) {
2074
		if ( x < 0 ) {
2075
			x = 0;
2076
		} else if ( x > this.maxPosX ) {
2077
			x = this.maxPosX;
2078
		}
2079
2080
		if ( y < 0 ) {
2081
			y = 0;
2082
		} else if ( y > this.maxPosY ) {
2083
			y = this.maxPosY;
2084
		}
2085
2086
		x = this.options.listenX ? Math.round(x / this.sizeRatioX) : this.scroller.x;
2087
		y = this.options.listenY ? Math.round(y / this.sizeRatioY) : this.scroller.y;
2088
2089
		this.scroller.scrollTo(x, y);
2090
	},
2091
2092
	fade: function (val, hold) {
2093
		if ( hold && !this.visible ) {
2094
			return;
2095
		}
2096
2097
		clearTimeout(this.fadeTimeout);
2098
		this.fadeTimeout = null;
2099
2100
		var time = val ? 250 : 500,
2101
			delay = val ? 0 : 300;
2102
2103
		val = val ? '1' : '0';
2104
2105
		this.wrapperStyle[utils.style.transitionDuration] = time + 'ms';
2106
2107
		this.fadeTimeout = setTimeout((function (val) {
2108
			this.wrapperStyle.opacity = val;
2109
			this.visible = +val;
2110
		}).bind(this, val), delay);
2111
	}
2112
};
2113
2114
IScroll.utils = utils;
2115
2116
if ( typeof module != 'undefined' && module.exports ) {
2117
	module.exports = IScroll;
2118
} else if ( typeof define == 'function' && define.amd ) {
2119
        define( function () { return IScroll; } );
2120
} else {
2121
	window.IScroll = IScroll;
2122
}
2123
2124
})(window, document, Math);

+ 7 - 12
static-res/appmenu-ipu/js/lib/iscroll/iscroll.js

@ -105,7 +105,7 @@
105 105
                useTransition: false,
106 106
                topOffset: 0,
107 107
                checkDOMChanges: false,		// Experimental
108
                handleClick: true,
108
                handleClick: false,
109 109
110 110
                // Scrollbar
111 111
                hScrollbar: true,
@ -131,18 +131,13 @@
131 131
                //阻止默认事件
132 132
                //onBeforeScrollStart: function (e) { e.preventDefault(); },
133 133
                onBeforeScrollStart: function (e) {
134
                    var target = e.target;
135
                    while (target.nodeType != 1) {
136
                        target = target.parentNode;
137
                    }
138
139
                    if (target.tagName != "SELECT" && target.tagName != "INPUT" && target.tagName != "TEXTAREA") {
140
                        //alert('no t');
141
                        e.preventDefault();
142
                    }
134
                    //e.preventDefault();
135
                    //e.stopPropagation();
143 136
                },
144 137
                onScrollStart: null,
145
                onBeforeScrollMove: null,
138
                onBeforeScrollMove: function (e) {
139
                    e.preventDefault();
140
                },
146 141
                onScrollMove: null,
147 142
                onBeforeScrollEnd: null,
148 143
                onScrollEnd: null,
@ -464,7 +459,7 @@
464 459
                that.lastScale = scale / this.scale;
465 460
466 461
                newX = this.originX - this.originX * that.lastScale + this.x,
467
                newY = this.originY - this.originY * that.lastScale + this.y;
462
                    newY = this.originY - this.originY * that.lastScale + this.y;
468 463
469 464
                this.scroller.style[transform] = 'translate(' + newX + 'px,' + newY + 'px) scale(' + scale + ')' + translateZ;
470 465

+ 0 - 167
static-res/appmenu-ipu/js/lib/tap/tap.js

@ -1,167 +0,0 @@
1
(function($) {
2
3
	var toString = Object.prototype.toString;
4
	var expando = "tap" + (new Date()).valueOf(), uuid = 0;
5
6
	/*使用如下全局变量可以支持绑定多个tap方法*/
7
	var tapHandlersCache = {};	//存储引用
8
	var tapParamsCache = {};	//存储参数
9
10
	function addTapHandler(elem, callback, params){
11
		var id = elem[expando];
12
		if(!id){
13
			id = ++ uuid;
14
			elem[expando] = id;
15
		}
16
		//存储传入的方法handler
17
		var handlersCache = tapHandlersCache[id];
18
		if(!handlersCache){
19
			handlersCache = tapHandlersCache[id] = [];
20
		}
21
		handlersCache.push(callback);
22
		//存储传入的方法参数,依靠下标对应
23
		var paramsCache = tapParamsCache[id];
24
		if(!paramsCache){
25
			paramsCache = tapParamsCache[id] = [];
26
		}
27
		paramsCache.push(params);
28
	}
29
30
	/*获取绑定方法的引用*/
31
	function getTapHandler(elem){
32
		var id = elem[expando];
33
		if(id && tapHandlersCache[id]){
34
			return tapHandlersCache[id];
35
		}
36
		return [];
37
	}
38
39
	/*获取绑定方法的参数*/
40
	function getTapParam(elem){
41
		var id = elem[expando];
42
		if(id && tapParamsCache[id]){
43
			return tapParamsCache[id];
44
		}
45
		return [];
46
	}
47
48
	/*向父级节点查找ontap属性,以此判断是否存在触感*/
49
	var parentByTap = function(node){
50
		if(!node || !node.nodeType) return;
51
		var i = 0;
52
		while((!("tagName" in node) || (!("ontap" in node.attributes) && !getTapHandler(node).length)) && i < 10){
53
			if(!node.parentNode || 1 != node.parentNode.nodeType)
54
				break;
55
			node = node.parentNode;
56
			i ++;
57
		}
58
59
		if("ontap" in node.attributes || getTapHandler(node).length)
60
			return node;
61
	};
62
63
	var preventAll = function (e) {
64
		e.preventDefault();
65
		e.stopPropagation();
66
	};
67
68
	var getXY = function(e){
69
		var x = e.touches ? e.touches[0].pageX : e.clientX;
70
		var y = e.touches ? e.touches[0].pageY : e.clientY;
71
		return [x, y];
72
	};
73
74
	//根据不同浏览器获取不同原生事件event
75
	var hasTouch     = "ontouchstart" in window,
76
		START_EVENT  = hasTouch ? 'touchstart': 'mousedown',
77
		MOVE_EVENT   = hasTouch ? 'touchmove' : 'mousemove',
78
		END_EVENT    = hasTouch ? 'touchend' : 'mouseup',
79
		CANCEL_EVENT = hasTouch ? 'touchcancel' : 'mouseup';
80
81
	var distanceAllow = 10;
82
	var startXY,tapEl,activeTimer;
83
	var isListener;//是否监听
84
85
	$(document).ready(function(){
86
87
		$(document.body).bind(START_EVENT, function(e){
88
			if (e.originalEvent)
89
				e = e.originalEvent;
90
91
			startXY = getXY(e);
92
			tapEl = parentByTap(e.target);
93
			if(tapEl){
94
				activeTimer = setTimeout(function(){  // 需要一定时间来判断是点击或是移动,若是移动不需要出现class
95
					$(tapEl).addClass("active");
96
				}, 100);
97
				isListener = true;
98
			}
99
		});
100
101
		$(document.body).bind(MOVE_EVENT, function(e){
102
			//标记
103
			if(!isListener)
104
				return;
105
			if (e.originalEvent)
106
				e = e.originalEvent;
107
108
			var xy = getXY(e);
109
			if(startXY && (Math.abs(xy[0] - startXY[0]) > distanceAllow
110
				|| Math.abs(xy[1] - startXY[1]) > distanceAllow)){
111
				clearTimeout(activeTimer);							// 此处可以通过activetime来判断是否需要clear和移除class
112
				if(tapEl){
113
					$(tapEl).removeClass("active");
114
				}
115
				startXY = null;
116
				tapEl = null;
117
			}
118
		});
119
120
		$(document.body).bind(END_EVENT, function(e){
121
			isListener = false;
122
123
			if (e.originalEvent)
124
				e = e.originalEvent;
125
126
			setTimeout(function(){							// 多点触摸时,对tapE1的影响?,是否需要延时120?有什么意思
127
				if(tapEl){
128
					$(tapEl).removeClass("active");
129
					var strFn = $(tapEl).attr("ontap");
130
					if(strFn){
131
						(new Function(strFn)).call(tapEl);
132
					}
133
					var handlersCache = getTapHandler(tapEl);
134
					var paramsCache = getTapParam(tapEl);
135
					for(var i=0;i<handlersCache.length;i++){
136
						handlersCache[i].apply(tapEl,paramsCache[i]);
137
					}
138
				}
139
				clearTimeout(activeTimer);
140
				startXY = null;
141
				tapEl = null;
142
			}, 120);
143
144
		});
145
	});
146
147
	/*
148
	 * 绑定到zepto对象上,支持方法传入动态参数。
149
	 */
150
	$.fn["tap"] = function(callback) {
151
		if(typeof(callback) == "string"){
152
			this.attr("ontap", callback);
153
		}else if(toString.call(callback) === "[object Function]"){
154
			var params;
155
			//第一个参数是函数体或函数名
156
			if (arguments.length > 1) {
157
				params = new Array();
158
				for ( var i = 1; i < arguments.length; i++) {
159
					params[i - 1] = arguments[i];
160
				}
161
			}
162
			this.each(function(){
163
				addTapHandler(this, callback, params);
164
			});
165
		}
166
	};
167
})(jQuery);

+ 4 - 7
static-res/appmenu-ipu/js/require-config.js

@ -6,20 +6,17 @@
6 6
 * 3.如果以"http:"或者"https:"开头
7 7
 */
8 8
require.config({
9
    baseUrl:'js', //也是个相对路径?是的,看你的写法 ../demo/js
10
    //指定别名. zepto.event如果不使用引号,会导致异常
9
    baseUrl:'js',
11 10
    paths:{
12 11
        'iScroll':'lib/iscroll/iscroll',
13 12
        'Hammer':'lib/hammer/hammer',
14 13
        'jquery':'lib/jquery/jquery-2.2.4',
15
        'ipu':'../ipu/js/ipu',
16 14
        'FastClick':'lib/fastclick/fastclick',
17
        'dragsort':'lib/dragsort/jquery.dragsort-0.5.2',
18
        'tap':'lib/tap/tap'
15
        'ipu':'../ipu/js/ipu',
16
        'dragsort':'lib/dragsort/jquery.dragsort-0.5.2'
19 17
    },
20 18
    shim:{
21
        'dragsort': { deps: ['jquery'] },
22
        'tap': { deps: ['jquery'] }
19
        'dragsort': { deps: ['jquery'] }
23 20
    },
24 21
    // 避免浏览器缓存
25 22
    urlArgs: "urlArgs="+new Date().getTime()

Merge branch 'master' of http://10.1.235.20:3000/ipu/android-share · fb345b3d2e - Nuosi Git Service
Bladeren bron

Merge branch 'master' of http://10.1.235.20:3000/ipu/android-share

leijie 8 jaren geleden
bovenliggende
commit
fb345b3d2e
1 gewijzigde bestanden met toevoegingen van 11 en 0 verwijderingen
  1. 11 0
      display-server/web/res/js/mobile/mobile-core.js

+ 11 - 0
display-server/web/res/js/mobile/mobile-core.js

@ -0,0 +1,11 @@
1
if(typeof PluginManager === "undefined"){
2
	window.PluginManager = {
3
		    exec: function(arg0, arg1, arg2) {
4
		        prompt('_$$_SafelyJsInterface:_' + JSON.stringify({
5
		            inf: 'PluginManager',
6
		            func: 'exec',
7
		            args: [arg0, arg1, arg2]
8
		        }));
9
		    },
10
	};
11
}