/** * Kendo UI v2016.1.112 (http://www.telerik.com/kendo-ui) * Copyright 2016 Telerik AD. All rights reserved. * * Kendo UI commercial licenses may be obtained at * http://www.telerik.com/purchase/license-agreement/kendo-ui-complete * If you do not own a commercial license, this file shall be governed by the trial license terms. */ !function(e,define){define("kendo.mobile.switch.min",["kendo.fx.min","kendo.userevents.min"],e)}(function(){return function(e,n){function t(e,n,t){return Math.max(n,Math.min(t,e))}var s=window.kendo,i=s.mobile.ui,o=i.Widget,a=s.support,r="change",c="km-switch-on",l="km-switch-off",p="margin-left",d="km-state-active",h="km-state-disabled",f="disabled",u=a.transitions.css+"transform",k=e.proxy,m=' {0} {1} ',g=o.extend({init:function(n,t){var i,a=this;o.fn.init.call(a,n,t),t=a.options,a.wrapper=e(s.format(m,t.onLabel,t.offLabel)),a.handle=a.wrapper.find(".km-switch-handle"),a.background=a.wrapper.find(".km-switch-background"),a.wrapper.insertBefore(a.element).prepend(a.element),a._drag(),a.origin=parseInt(a.background.css(p),10),a.constrain=0,a.snapPoint=0,n=a.element[0],n.type="checkbox",a._animateBackground=!0,i=a.options.checked,null===i&&(i=n.checked),a.check(i),a.options.enable=a.options.enable&&!a.element.attr(f),a.enable(a.options.enable),a.refresh(),s.notify(a,s.mobile.ui)},refresh:function(){var e=this,n=e.handle.outerWidth(!0);e.width=e.wrapper.width(),e.constrain=e.width-n,e.snapPoint=e.constrain/2,"number"!=typeof e.origin&&(e.origin=parseInt(e.background.css(p),10)),e.background.data("origin",e.origin),e.check(e.element[0].checked)},events:[r],options:{name:"Switch",onLabel:"on",offLabel:"off",checked:null,enable:!0},check:function(e){var t=this,s=t.element[0];return e===n?s.checked:(t._position(e?t.constrain:0),s.checked=e,t.wrapper.toggleClass(c,e).toggleClass(l,!e),n)},value:function(){return this.check.apply(this,arguments)},destroy:function(){o.fn.destroy.call(this),this.userEvents.destroy()},toggle:function(){var e=this;e.check(!e.element[0].checked)},enable:function(e){var t=this.element,s=this.wrapper;n===e&&(e=!0),this.options.enable=e,e?t.removeAttr(f):t.attr(f,f),s.toggleClass(h,!e)},_resize:function(){this.refresh()},_move:function(e){var n=this;e.preventDefault(),n._position(t(n.position+e.x.delta,0,n.width-n.handle.outerWidth(!0)))},_position:function(e){var n=this;n.position=e,n.handle.css(u,"translatex("+e+"px)"),n._animateBackground&&n.background.css(p,n.origin+e)},_start:function(){this.options.enable?(this.userEvents.capture(),this.handle.addClass(d)):this.userEvents.cancel()},_stop:function(){var e=this;e.handle.removeClass(d),e._toggle(e.position>e.snapPoint)},_toggle:function(e){var n,t=this,i=t.handle,o=t.element[0],a=o.checked,p=s.mobile.application&&s.mobile.application.os.wp?100:200;t.wrapper.toggleClass(c,e).toggleClass(l,!e),t.position=n=e*t.constrain,t._animateBackground&&t.background.kendoStop(!0,!0).kendoAnimate({effects:"slideMargin",offset:n,reset:!0,reverse:!e,axis:"left",duration:p}),i.kendoStop(!0,!0).kendoAnimate({effects:"slideTo",duration:p,offset:n+"px,0",reset:!0,complete:function(){a!==e&&(o.checked=e,t.trigger(r,{checked:e}))}})},_drag:function(){var e=this;e.userEvents=new s.UserEvents(e.wrapper,{fastTap:!0,tap:function(){e.options.enable&&e._toggle(!e.element[0].checked)},start:k(e._start,e),move:k(e._move,e),end:k(e._stop,e)})}});i.plugin(g)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,n,t){(t||n)()}); //# sourceMappingURL=kendo.mobile.switch.min.js.map