/** * Copyright 2014 Telerik AD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ !function(e,define){define(["./kendo.core.min"],e)}(function(){return function(e,t){var n=window.kendo,i=n.ui.Widget,r=e.proxy,o=n.keys,a="click",s="k-button",l="k-button-icon",u="k-button-icontext",d=".kendoButton",c="disabled",f="k-state-disabled",h="k-state-focused",p="k-state-selected",g=i.extend({init:function(e,t){var o=this;i.fn.init.call(o,e,t),e=o.wrapper=o.element,t=o.options,e.addClass(s).attr("role","button"),t.enable=t.enable&&!e.attr(c),o.enable(t.enable),o._tabindex(),o._graphics(),e.on(a+d,r(o._click,o)).on("focus"+d,r(o._focus,o)).on("blur"+d,r(o._blur,o)).on("keydown"+d,r(o._keydown,o)).on("keyup"+d,r(o._keyup,o)),n.notify(o)},events:[a],options:{name:"Button",icon:"",spriteCssClass:"",imageUrl:"",enable:!0},_isNativeButton:function(){return"button"==this.element.prop("tagName").toLowerCase()},_click:function(e){this.options.enable&&this.trigger(a,{event:e})},_focus:function(){this.options.enable&&this.element.addClass(h)},_blur:function(){this.element.removeClass(h)},_keydown:function(e){var t=this;t._isNativeButton()||(e.keyCode==o.ENTER||e.keyCode==o.SPACEBAR)&&(e.keyCode==o.SPACEBAR&&(e.preventDefault(),t.options.enable&&t.element.addClass(p)),t._click(e))},_keyup:function(){this.element.removeClass(p)},_graphics:function(){var t,n,i,r=this,o=r.element,a=r.options,s=a.icon,d=a.spriteCssClass,c=a.imageUrl;(d||c||s)&&(i=!0,o.contents().not("span.k-sprite").not("span.k-icon").not("img.k-image").each(function(t,n){(1==n.nodeType||3==n.nodeType&&e.trim(n.nodeValue).length>0)&&(i=!1)}),o.addClass(i?l:u)),s?(t=o.children("span.k-icon").first(),t[0]||(t=e('').prependTo(o)),t.addClass("k-i-"+s)):d?(t=o.children("span.k-sprite").first(),t[0]||(t=e('').prependTo(o)),t.addClass(d)):c&&(n=o.children("img.k-image").first(),n[0]||(n=e('icon').prependTo(o)),n.attr("src",c))},enable:function(e){var n=this,i=n.element;e===t&&(e=!0),e=!!e,n.options.enable=e,i.toggleClass(f,!e).attr("aria-disabled",!e).attr(c,!e),i.blur()}});n.ui.plugin(g)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t){t()});