/* * Kendo UI Beta v2013.2.716 (http://kendoui.com) * Copyright 2013 Telerik AD. All rights reserved. * * Kendo UI Beta license terms available at * http://www.kendoui.com/purchase/license-agreement/kendo-ui-beta.aspx */ ("function"==typeof define&&define.amd?define:function(t,e){return e()})(["./kendo.data.min"],function(){!function(t,e){function n(e){e.children(h).addClass(A),e.children("a").addClass(b).children(h).addClass(A),e.filter(":not([disabled]):not([class*=k-state-disabled])").addClass(I),e.filter("li[disabled]").addClass(H).removeAttr("disabled"),e.filter(":not([class*=k-state])").children("a").filter(":focus").parent().addClass(q+" "+N),e.attr("role","tab"),e.filter("."+q).attr("aria-selected",!0),e.each(function(){var e=t(this);e.children("."+b).length||e.contents().filter(function(){return!(this.nodeName.match(p)||3==this.nodeType&&!l(this.nodeValue))}).wrapAll("")})}function a(t){var e=t.children(".k-item");e.filter(".k-first:not(:first-child)").removeClass(w),e.filter(".k-last:not(:last-child)").removeClass(k),e.filter(":first-child").addClass(w),e.filter(":last-child").addClass(k)}var r=window.kendo,i=r.ui,s=r.keys,o=t.map,d=t.each,l=t.trim,c=t.extend,u=r.template,f=i.Widget,p=/^(a|div)$/i,m=".kendoTabStrip",h="img",g="href",v="prev",b="k-link",k="k-last",C="click",_="error",x=":empty",A="k-image",w="k-first",E="select",G="activate",S="k-content",y="contentUrl",T="mouseenter",U="mouseleave",F="contentLoad",H="k-state-disabled",I="k-state-default",q="k-state-active",R="k-state-focused",D="k-state-hover",N="k-tab-on-top",B=".k-item:not(."+H+")",O=".k-tabstrip-items > "+B+":not(."+q+")",j={content:u("
#= content(item) #
"),itemWrapper:u("<#= tag(item) # class='k-link'#= contentUrl(item) ##= textAttributes(item) #>#= image(item) ##= sprite(item) ##= text(item) #"),item:u(""),image:u(""),sprite:u(""),empty:u("")},W={wrapperCssClass:function(t,e){var n="k-item",a=e.index;return n+=e.enabled===!1?" k-state-disabled":" k-state-default",0===a&&(n+=" k-first"),a==t.length-1&&(n+=" k-last"),n},textAttributes:function(t){return t.url?" href='"+t.url+"'":""},text:function(t){return t.encoded===!1?t.text:r.htmlEncode(t.text)},tag:function(t){return t.url?"a":"span"},contentAttributes:function(t){return t.active!==!0?" style='display:none' aria-hidden='true' aria-expanded='false'":""},content:function(t){return t.content?t.content:t.contentUrl?"":" "},contentUrl:function(t){return t.contentUrl?r.attr("content-url")+'="'+t.contentUrl+'"':""}},z=f.extend({init:function(e,n){var a,i,s=this;f.fn.init.call(s,e,n),s._animations(s.options),s.wrapper=s.element.is("ul")?s.element.wrapAll("
").parent():s.element,n=s.options,s._isRtl=r.support.isRtl(s.wrapper),s._tabindex(),s._updateClasses(),s._dataSource(),n.dataSource&&s.dataSource.fetch(),s.options.contentUrls&&s.wrapper.find(".k-tabstrip-items > .k-item").each(function(e,n){t(n).find(">."+b).data(y,s.options.contentUrls[e])}),s.wrapper.on(T+m+" "+U+m,O,s._toggleHover).on("keydown"+m,t.proxy(s._keydown,s)).on("focus"+m,t.proxy(s._active,s)).on("blur"+m,function(){s._current(null)}),s.wrapper.children(".k-tabstrip-items").on(C+m,".k-state-disabled .k-link",!1).on(C+m," > "+B,function(e){s._click(t(e.currentTarget))&&e.preventDefault()}),a=s.tabGroup.children("li."+q),i=s.contentHolder(a.index()),i.length>0&&0===i[0].childNodes.length&&s.activateTab(a.eq(0)),s.element.attr("role","tablist"),s.element[0].id&&(s._ariaId=s.element[0].id+"_ts_active"),r.notify(s)},_active:function(){var t=this.tabGroup.children().filter("."+q);t=t[0]?t:this._endItem("first"),t[0]&&this._current(t)},_endItem:function(t){return this.tabGroup.children(B)[t]()},_item:function(t,e){var n;return n=e===v?"last":"first",t?(t=t[e](),t[0]||(t=this._endItem(n)),t.hasClass(H)&&(t=this._item(t,e)),t):this._endItem(n)},_current:function(t){var n=this,a=n._focused,r=n._ariaId;return t===e?a:(a&&(a[0].id===r&&a.removeAttr("id"),a.removeClass(R)),t&&(t.hasClass(q)||t.addClass(R),n.element.removeAttr("aria-activedescendant"),r=t[0].id||r,r&&(t.attr("id",r),n.element.attr("aria-activedescendant",r))),n._focused=t,e)},_keydown:function(t){var n,a=this,r=t.keyCode,i=a._current(),o=a._isRtl;if(t.target==t.currentTarget){if(r==s.DOWN||r==s.RIGHT)n=o?v:"next";else if(r==s.UP||r==s.LEFT)n=o?"next":v;else if(r==s.ENTER||r==s.SPACEBAR)a._click(i),t.preventDefault();else{if(r==s.HOME)return a._click(a._endItem("first")),t.preventDefault(),e;if(r==s.END)return a._click(a._endItem("last")),t.preventDefault(),e}n&&(a._click(a._item(i,n)),t.preventDefault())}},_dataSource:function(){var e=this;e.dataSource&&e._refreshHandler?e.dataSource.unbind("change",e._refreshHandler):e._refreshHandler=t.proxy(e.refresh,e),e.dataSource=r.data.DataSource.create(e.options.dataSource).bind("change",e._refreshHandler)},setDataSource:function(t){this.options.dataSource=t,this._dataSource(),t.fetch()},_animations:function(t){t&&"animation"in t&&!t.animation&&(t.animation={open:{effects:{}},close:{effects:{}}})},refresh:function(t){var e,n,a,i,s=this,o=s.options,d=r.getter(o.dataTextField),l=r.getter(o.dataContentField),c=r.getter(o.dataContentUrlField),u=r.getter(o.dataImageUrlField),f=r.getter(o.dataUrlField),p=r.getter(o.dataSpriteCssClass),m=[],h=s.dataSource.view();for(t=t||{},a=t.action,a&&(h=t.items),e=0,i=h.length;i>e;e++)n={text:d(h[e])},o.dataContentField&&(n.content=l(h[e])),o.dataContentUrlField&&(n.contentUrl=c(h[e])),o.dataUrlField&&(n.url=f(h[e])),o.dataImageUrlField&&(n.imageUrl=u(h[e])),o.dataSpriteCssClass&&(n.spriteCssClass=p(h[e])),m[e]=n;if("add"==t.action)t.index"),n(r)),{tabs:r,contents:i}},_toggleDisabled:function(e,n){e=this.tabGroup.find(e),e.each(function(){t(this).toggleClass(I,n).toggleClass(H,!n)})},_updateClasses:function(){var r,i,s,o=this;o.wrapper.addClass("k-widget k-header k-tabstrip"),o.tabGroup=o.wrapper.children("ul").addClass("k-tabstrip-items k-reset"),o.tabGroup[0]||(o.tabGroup=t("
    ").appendTo(o.wrapper)),r=o.tabGroup.find("li").addClass("k-item"),r.length&&(i=r.filter("."+q).index(),s=i>=0?i:e,o.tabGroup.contents().filter(function(){return 3==this.nodeType&&!l(this.nodeValue)}).remove()),i>=0&&r.eq(i).addClass(N),o.contentElements=o.wrapper.children("div"),o.contentElements.addClass(S).eq(s).addClass(q).css({display:"block"}),r.length&&(n(r),a(o.tabGroup),o._updateContentElements())},_updateContentElements:function(){var e=this,n=e.options.contentUrls||[],a=e.element.attr("id"),i=e.wrapper.children("div");e.tabGroup.find(".k-item").each(function(r){var s=i.eq(r),o=a+"-"+(r+1);this.setAttribute("aria-controls",o),!s.length&&n[r]?t("
    ").appendTo(e.wrapper):s.attr("id",o),s.attr("role","tabpanel"),s.filter(":not(."+q+")").attr("aria-hidden",!0).attr("aria-expanded",!1),s.filter("."+q).attr("aria-expanded",!0)}),e.contentElements=e.contentAnimators=e.wrapper.children("div"),r.kineticScrollNeeded&&r.mobile.ui.Scroller&&(r.touchScroller(e.contentElements),e.contentElements=e.contentElements.children(".km-scroll-container"))},_toggleHover:function(e){t(e.currentTarget).toggleClass(D,e.type==T)},_click:function(t){var e,n,a=this,r=t.find("."+b),i=r.attr(g),s=a.options.collapsible,o=a.contentHolder(t.index());if(t.closest(".k-widget")[0]==a.wrapper[0]){if(t.is("."+H+(s?"":",."+q)))return!0;if(n=r.data(y)||i&&("#"==i.charAt(i.length-1)||-1!=i.indexOf("#"+a.element[0].id+"-")),e=!i||n,a.tabGroup.children("[data-animating]").length)return e;if(a.trigger(E,{item:t[0],contentElement:o[0]}))return!0;if(e!==!1)return s&&t.is("."+q)?(a.deactivateTab(t),!0):(a.activateTab(t)&&(e=!0),e)}},deactivateTab:function(t){var e=this,n=e.options.animation,a=n.open,i=c({},n.close),s=i&&"effects"in i;t=e.tabGroup.find(t),i=c(s?i:c({reverse:!0},a),{hide:!0}),r.size(a.effects)?(t.kendoAddClass(I,{duration:a.duration}),t.kendoRemoveClass(q,{duration:a.duration})):(t.addClass(I),t.removeClass(q)),t.removeAttr("aria-selected"),e.contentAnimators.filter("."+q).kendoStop(!0,!0).kendoAnimate(i).removeClass(q).attr("aria-hidden",!0)},activateTab:function(t){var e,n,a,i,s,o,d,l,u,f,p,m,h,g,v;return t=this.tabGroup.find(t),e=this,n=e.options.animation,a=n.open,i=c({},n.close),s=i&&"effects"in i,o=t.parent().children(),d=o.filter("."+q),l=o.index(t),i=c(s?i:c({reverse:!0},a),{hide:!0}),r.size(a.effects)?(d.kendoRemoveClass(q,{duration:i.duration}),t.kendoRemoveClass(D,{duration:i.duration})):(d.removeClass(q),t.removeClass(D)),u=e.contentAnimators,t.data("in-request")&&(e.xhr.abort(),t.removeAttr("data-in-request")),0===u.length?(d.removeClass(N),t.addClass(N).css("z-index"),t.addClass(q),e._current(t),e.trigger("change"),!1):(f=u.filter("."+q),p=e.contentHolder(l),m=p.closest(".k-content"),0===p.length?(f.removeClass(q).attr("aria-hidden",!0).kendoStop(!0,!0).kendoAnimate(i),!1):(t.attr("data-animating",!0),h=(t.children("."+b).data(y)||!1)&&p.is(x),g=function(){d.removeClass(N),t.addClass(N).css("z-index"),r.size(a.effects)?(d.kendoAddClass(I,{duration:a.duration}),t.kendoAddClass(q,{duration:a.duration})):(d.addClass(I),t.addClass(q)),d.removeAttr("aria-selected"),t.attr("aria-selected",!0),e._current(t),m.addClass(q).removeAttr("aria-hidden").kendoStop(!0,!0).attr("aria-expanded",!0).kendoAnimate(c({init:function(){e.trigger(G,{item:t[0],contentElement:p[0]})}},a,{complete:function(){t.removeAttr("data-animating")}}))},v=function(){h?(t.removeAttr("data-animating"),e.ajaxRequest(t,p,function(){t.attr("data-animating",!0),g(),e.trigger("change")})):(g(),e.trigger("change"))},f.removeClass(q),f.attr("aria-hidden",!0),f.attr("aria-expanded",!1),f.length?f.kendoStop(!0,!0).kendoAnimate(c({complete:v},i)):v(),!0))},contentElement:function(t){var n,a,i,s;if(isNaN(t-0))return e;if(n=this.contentElements&&this.contentElements[0]&&!r.kineticScrollNeeded?this.contentElements:this.contentAnimators,a=RegExp("-"+(t+1)+"$"),n)for(i=0,s=n.length;s>i;i++)if(a.test(n.closest(".k-content")[i].id))return n[i];return e},contentHolder:function(e){var n=t(this.contentElement(e)),a=n.children(".km-scroll-container");return r.support.touch&&a[0]?a:n},ajaxRequest:function(e,n,a,r){if(e=this.tabGroup.find(e),!e.find(".k-loading").length){var i=this,s=e.find("."+b),o={},d=null,l=setTimeout(function(){d=t("").prependTo(s)},100);r=r||s.data(y)||s.attr(g),e.attr("data-in-request",!0),i.xhr=t.ajax({type:"GET",cache:!1,url:r,dataType:"html",data:o,error:function(t,e){i.trigger("error",{xhr:t,status:e})&&this.complete()},complete:function(){e.removeAttr("data-in-request"),clearTimeout(l),null!==d&&d.remove()},success:function(t){try{n.html(t)}catch(s){var o=window.console;o&&o.error&&o.error(s.name+": "+s.message+" in "+r),this.error(this.xhr,"error")}a&&a.call(i,n),i.trigger(F,{item:e[0],contentElement:n[0]})}})}}});c(z,{renderItem:function(t){t=c({tabStrip:{},group:{}},t);var e=j.empty,n=t.item;return j.item(c(t,{image:n.imageUrl?j.image:e,sprite:n.spriteCssClass?j.sprite:e,itemWrapper:j.itemWrapper},W))},renderContent:function(t){return j.content(c(t,W))}}),r.ui.plugin(z)}(window.kendo.jQuery)});