12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- /*!
- * =====================================================
- * Ratchet v2.0.2 (http://goratchet.com)
- * Copyright 2014 Connor Sears
- * Licensed under MIT (https://github.com/twbs/ratchet/blob/master/LICENSE)
- *
- * v2.0.2 designed by @connors.
- * =====================================================
- * 自定义模块,去掉了push和modal使用spa替代
- */
- /* ========================================================================
- * Ratchet: popovers.js v2.0.2
- * http://goratchet.com/components#popovers
- * ========================================================================
- * Copyright 2014 Connor Sears
- * Licensed under MIT (https://github.com/twbs/ratchet/blob/master/LICENSE)
- * ======================================================================== */
- /* ========================================================================
- * Ratchet: segmented-controllers.js v2.0.2
- * http://goratchet.com/components#segmentedControls
- * ========================================================================
- * Copyright 2014 Connor Sears
- * Licensed under MIT (https://github.com/twbs/ratchet/blob/master/LICENSE)
- * ======================================================================== */
- /* ========================================================================
- * Ratchet: sliders.js v2.0.2
- * http://goratchet.com/components#sliders
- * ========================================================================
- Adapted from Brad Birdsall's swipe
- * Copyright 2014 Connor Sears
- * Licensed under MIT (https://github.com/twbs/ratchet/blob/master/LICENSE)
- * ======================================================================== */
- /* ========================================================================
- * Ratchet: toggles.js v2.0.2
- * http://goratchet.com/components#toggles
- * ========================================================================
- Adapted from Brad Birdsall's swipe
- * Copyright 2014 Connor Sears
- * Licensed under MIT (https://github.com/twbs/ratchet/blob/master/LICENSE)
- * ======================================================================== */
- !function(){function n(e){if(e.type==="touchstart"){this._startTouchY=e.touches[0].screenY;return}if(e.type==="touchend"){t&&(t=!1,$(e.target).trigger("tap"));return}if(e.target.tagName=="A"){var n=$(e.target).closest("header");if(n.length>0){var r=e.touches[0].screenY;return Math.abs(this._startTouchY-r)<$(e.target).height()/2?t=!0:t=!1,e.preventDefault()}}var i=$(e.target).closest(".content"),s=$(e.target).closest(".prevent-scroll"),o=e.target.tagName;if(e.target.tagName=="TEXTAREA"){var u=e.target.clientHeight,a=e.target.scrollHeight;return u>=a?e.preventDefault():e.stopPropagation()}if(i.length===0||s.length>0)return e.preventDefault();var f=i.get(0),l=f.scrollHeight>f.clientHeight,c=window.getComputedStyle(f,null).getPropertyValue("-webkit - overflow - scrolling")==="touch",h=window.getComputedStyle(f,null).getPropertyValue("overflowY")!=="hidden",u=parseInt(window.getComputedStyle(f,null).getPropertyValue("height"),10);if(c&&h){var r=e.touches[0].screenY,p=this._startTouchY<=r&&f.scrollTop===0,d=this._startTouchY>=r&&f.scrollHeight-f.scrollTop===u;(p||d)&&e.preventDefault();return}}var e,t;window.addEventListener("touchmove",n,!1),window.addEventListener("touchstart",n,!1),window.addEventListener("touchend",n,!1)}(),!function(){"use strict";var e,t=function(e){var t,n=document.querySelectorAll("a");for(;e&&e!==document;e=e.parentNode)for(t=n.length;t--;)if(n[t]===e)return e},n=function(){e.style.display="none",e.removeEventListener("webkitTransitionEnd",n)},r=function(){var t=document.createElement("div");return t.classList.add("backdrop"),t.addEventListener("touchend",function(){e.addEventListener("webkitTransitionEnd",n),e.classList.remove("visible"),e.parentNode.removeChild(r)}),t}(),i=function(n){var r=t(n.target);if(!r||!r.hash||r.hash.indexOf("/")>0)return;try{e=document.querySelector(r.hash)}catch(i){e=null}if(e===null)return;if(!e||!e.classList.contains("popover"))return;return e},s=function(e){var t=i(e);if(!t)return;t.style.display="block",t.offsetHeight,t.classList.add("visible"),t.parentNode.appendChild(r)};window.addEventListener("touchend",s)}(),!function(){"use strict";var e=function(e){var t,n=document.querySelectorAll(".segmented-control .control-item");for(;e&&e!==document;e=e.parentNode)for(t=n.length;t--;)if(n[t]===e)return e};window.addEventListener("touchend",function(t){var n,r,i,s=e(t.target),o="active",u="."+o;if(!s)return;n=s.parentNode.querySelector(u),n&&n.classList.remove(o),s.classList.add(o);if(!s.hash)return;i=document.querySelector(s.hash);if(!i)return;r=i.parentNode.querySelectorAll(u);for(var a=0;a<r.length;a++)r[a].classList.remove(o);i.classList.add(o)}),window.addEventListener("click",function(t){e(t.target)&&t.preventDefault()})}(),!function(){"use strict";var e,t,n,r,i,s,o,u,a,f,l,c,h,p=function(e){var t,n=document.querySelectorAll(".slider > .slide-group");for(;e&&e!==document;e=e.parentNode)for(t=n.length;t--;)if(n[t]===e)return e},d=function(){if("webkitTransform"in n.style){var e=n.style.webkitTransform.match(/translate3d\(([^,]*)/),t=e?e[1]:0;return parseInt(t,10)}},v=function(e){var t=e?r<0?"ceil":"floor":"round";l=Math[t](d()/(h/n.children.length)),l+=e,l=Math.min(l,0),l=Math.max(-(n.children.length-1),l)},m=function(s){n=p(s.target);if(!n)return;var l=n.querySelector(".slide");h=l.offsetWidth*n.children.length,c=undefined,f=n.offsetWidth,a=1,o=-(n.children.length-1),u=+(new Date),e=s.touches[0].pageX,t=s.touches[0].pageY,r=0,i=0,v(0),n.style["-webkit-transition-duration"]=0},g=function(u){if(u.touches.length>1||!n)return;r=u.touches[0].pageX-e,i=u.touches[0].pageY-t,e=u.touches[0].pageX,t=u.touches[0].pageY,typeof c=="undefined"&&(c=Math.abs(i)>Math.abs(r));if(c)return;s=r/a+d(),u.preventDefault(),a=l===0&&r>0?e/f+1.25:l===o&&r<0?Math.abs(e)/f+1.25:1,n.style.webkitTransform="translate3d("+s+"px,0,0)"},y=function(e){if(!n||c)return;v(+(new Date)-u<1e3&&Math.abs(r)>15?r<0?-1:1:0),s=l*f,n.style["-webkit-transition-duration"]=".2s",n.style.webkitTransform="translate3d("+s+"px,0,0)",e=new CustomEvent("slide",{detail:{slideNumber:Math.abs(l)},bubbles:!0,cancelable:!0}),n.parentNode.dispatchEvent(e)};window.addEventListener("touchstart",m),window.addEventListener("touchmove",g),window.addEventListener("touchend",y)}(),!function(){"use strict";var e={},t=!1,n=!1,r=!1,i=function(e){var t,n=document.querySelectorAll(".toggle");for(;e&&e!==document;e=e.parentNode)for(t=n.length;t--;)if(n[t]===e)return e};window.addEventListener("touchstart",function(n){n=n.originalEvent||n,r=i(n.target);if(!r)return;var s=r.querySelector(".toggle-handle"),o=r.clientWidth,u=s.clientWidth,a=r.classList.contains("active")?o-u:0;e={pageX:n.touches[0].pageX-a,pageY:n.touches[0].pageY},t=!1}),window.addEventListener("touchmove",function(i){i=i.originalEvent||i;if(i.touches.length>1)return;if(!r)return;var s=r.querySelector(".toggle-handle"),o=i.touches[0],u=r.clientWidth,a=s.clientWidth,f=u-a;t=!0,n=o.pageX-e.pageX;if(Math.abs(n)<Math.abs(o.pageY-e.pageY))return;i.preventDefault();if(n<0)return s.style.webkitTransform="translate3d(0,0,0)";if(n>f)return s.style.webkitTransform="translate3d("+f+"px,0,0)";s.style.webkitTransform="translate3d("+n+"px,0,0)",r.classList[n>u/2-a/2?"add":"remove"]("active")}),window.addEventListener("touchend",function(e){if(!r)return;var i=r.querySelector(".toggle-handle"),s=r.clientWidth,o=i.clientWidth,u=s-o,a=!t&&!r.classList.contains("active")||t&&n>s/2-o/2;a?i.style.webkitTransform="translate3d("+u+"px,0,0)":i.style.webkitTransform="translate3d(0,0,0)",r.classList[a?"add":"remove"]("active"),e=new CustomEvent("toggle",{detail:{isActive:a},bubbles:!0,cancelable:!0}),r.dispatchEvent(e),t=!1,r=!1})}();
|