16 lines
2.6 KiB
JavaScript
16 lines
2.6 KiB
JavaScript
/**
|
|
* 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){function t(t){return e('<span class="km-badge">'+t+"</span>")}var n=window.kendo,i=n.mobile.ui,r=i.Widget,o="km-state-active",a="select",s=r.extend({init:function(t,n){var i=this;r.fn.init.call(i,t,n),i.container().bind("show",e.proxy(this,"refresh")),i.element.addClass("km-tabstrip").find("a").each(i._buildButton).eq(i.options.selectedIndex).addClass(o),i.element.on("down","a","_release")},events:[a],switchTo:function(t){var n,i,r=this.element.find("a"),o=0,a=r.length;if(!isNaN(t))return this._setActiveItem(r.eq(t)),!0;for(;a>o;o++)if(n=r[o],i=n.href.replace(/(\#.+)(\?.+)$/,"$1"),-1!==i.indexOf(t,i.length-t.length))return this._setActiveItem(e(n)),!0;return!1},switchByFullUrl:function(e){var t;t=this.element.find("a[href$='"+e+"']"),this._setActiveItem(t)},clear:function(){this.currentItem().removeClass(o)},currentItem:function(){return this.element.children("."+o)},badge:function(n,i){var r,o=this.element;return isNaN(n)||(n=o.children().get(n)),n=o.find(n),r=e(n.find(".km-badge")[0]||t(i).insertAfter(n.children(".km-icon"))),i||0===i?(r.html(i),this):i===!1?(r.empty().remove(),this):r.html()},_release:function(t){if(!(t.which>1)){var n=this,i=e(t.currentTarget);i[0]!==n.currentItem()[0]&&(n.trigger(a,{item:i})?t.preventDefault():n._setActiveItem(i))}},_setActiveItem:function(e){e[0]&&(this.clear(),e.addClass(o))},_buildButton:function(){var i=e(this),r=n.attrValue(i,"icon"),o=n.attrValue(i,"badge"),a=i.find("img"),s=e('<span class="km-icon"/>');i.addClass("km-button").attr(n.attr("role"),"tab").contents().not(a).wrapAll('<span class="km-text"/>'),a[0]?a.addClass("km-image").prependTo(i):(i.prepend(s),r&&(s.addClass("km-"+r),(o||0===o)&&t(o).insertAfter(s)))},refresh:function(e){var t=e.view.element.attr(n.attr("url"));!this.switchTo(e.view.id)&&t&&this.switchTo(t)},options:{name:"TabStrip",selectedIndex:0,enable:!0}});i.plugin(s)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t){t()}); |