10 lines
4.5 KiB
JavaScript
10 lines
4.5 KiB
JavaScript
/*
|
|
* Kendo UI Complete v2013.3.1119 (http://kendoui.com)
|
|
* Copyright 2013 Telerik AD. All rights reserved.
|
|
*
|
|
* Kendo UI Complete commercial licenses may be obtained at
|
|
* https://www.kendoui.com/purchase/license-agreement/kendo-ui-complete-commercial.aspx
|
|
* If you do not own a commercial license, this file shall be governed by the trial license terms.
|
|
*/
|
|
!function(define){return define(["./kendo.core.min"],function(){!function(t){function n(t,n){if(!n)return t;t+"/"===n&&(t=n);var e=RegExp("^"+n,"i");return e.test(t)||(t=n+"/"+t),s.protocol+"//"+(s.host+"/"+t).replace(/\/\/+/g,"/")}function e(t,n){return 0===n.indexOf(t)?n.substr(t.length).replace(/\/\//g,"/"):t}var r=window.kendo,i="change",a="back",o=r.support,s=window.location,u=window.history,c=50,h=/^#*/,d=window.document,l=r.Class.extend({init:function(t){this.root=t},navigate:function(t){return u.pushState({},d.title,n(t,this.root)),this.current()},current:function(){var t=s.pathname;return s.search&&(t+=s.search),e(this.root,t)},change:function(n){t(window).bind("popstate.kendo",n)},stop:function(){t(window).unbind("popstate.kendo")}}),p=r.Class.extend({navigate:function(t){return s.hash=t,t},change:function(n){o.hashChange?t(window).bind("hashchange.kendo",n):this._interval=setInterval(n,c)},stop:function(){t(window).unbind("popstate.kendo"),clearInterval(this._interval)},current:function(){return s.hash.replace(h,"")}}),f=r.Observable.extend({start:function(r){var c,f,g,b,w,k;if(r=r||{},this.bind([i,a],r),!this._started){if(this._started=!0,c=s.pathname,f=s.hash,g=o.pushState&&r.pushState,b=r.root||"/",w=b===c,this.adapter=g?new l(b):new p,r.pushState&&!o.pushState&&!w)return s.replace(b+"#"+e(b,c)),!0;g&&(b===c+"/"&&(k=b),w&&f&&(k=n(f.replace(h,""),b)),k&&u.replaceState({},d.title,k)),this.root=b,this.current=this.adapter.current(),this.locations=[this.current],this.adapter.change(t.proxy(this,"_checkUrl"))}},stop:function(){this._started&&(this.adapter.stop(),this.unbind(i),this._started=!1)},change:function(t){this.bind(i,t)},navigate:function(t,n){return"#:back"===t?(u.back(),undefined):(t=t.replace(h,""),this.current!==t&&this.current!==decodeURIComponent(t)&&(n||!this.trigger(i,{url:t}))&&(this.current=this.adapter.navigate(t),this.locations.push(this.current)),undefined)},_checkUrl:function(){var t=this.adapter.current(),n=t===this.locations[this.locations.length-2],e=this.current;if(this.current!==t&&this.current!==decodeURIComponent(t))return this.current=t,n&&this.trigger("back",{url:e,to:t})?(u.forward(),this.current=e,undefined):this.trigger(i,{url:t})?(n?u.forward():u.back(),this.current=e,undefined):(n?this.locations.pop():this.locations.push(t),undefined)}});r.absoluteURL=n,r.history=new f}(window.kendo.jQuery),function(){function t(t,n){return n?t:"([^/]+)"}function n(n){return RegExp("^"+n.replace(p,"\\$&").replace(h,"(?:$1)?").replace(d,t).replace(l,"(.*?)")+"$")}function e(t){return t.replace(/(\?.*)|(#.*)/g,"")}var r=window.kendo,i=r.history,a=r.Observable,o="init",s="routeMissing",u="change",c="back",h=/\((.*?)\)/g,d=/(\(\?)?:\w+/g,l=/\*\w+/g,p=/[\-{}\[\]+?.,\\\^$|#\s]/g,f=r.Class.extend({init:function(t,e){t instanceof RegExp||(t=n(t)),this.route=t,this._callback=e},callback:function(t){var n,i,a=0,o=r.parseQueryStringParams(t);for(t=e(t),n=this.route.exec(t).slice(1),i=n.length;i>a;a++)void 0!==n[a]&&(n[a]=decodeURIComponent(n[a]));n.push(o),this._callback.apply(null,n)},worksWith:function(t){return this.route.test(t)?(this.callback(t),!0):!1}}),g=a.extend({init:function(t){a.fn.init.call(this),this.routes=[],this.pushState=t?t.pushState:!1,t&&t.root&&(this.root=t.root),this.bind([o,s,u],t)},destroy:function(){i.unbind(u,this._urlChangedProxy),i.unbind(c,this._backProxy),this.unbind()},start:function(){var t,n=this,e=function(t){n._back(t)},r=function(t){n._urlChanged(t)};i.start({change:r,back:e,pushState:n.pushState,root:n.root}),t={url:i.current||"/"},n.trigger(o,t)||n._urlChanged(t),this._urlChangedProxy=r,this._backProxy=e},route:function(t,n){this.routes.push(new f(t,n))},navigate:function(t,n){r.history.navigate(t,n)},_back:function(t){this.trigger(c,{url:t.url,to:t.to})&&t.preventDefault()},_urlChanged:function(t){var n,e,i,a,o=t.url;if(o||(o="/"),this.trigger(u,{url:t.url,params:r.parseQueryStringParams(t.url)}))return t.preventDefault(),void 0;for(e=0,i=this.routes,a=i.length;a>e;e++)if(n=i[e],n.worksWith(o))return;this.trigger(s,{url:o,params:r.parseQueryStringParams(o)})&&t.preventDefault()}});r.Router=g}()})}("function"==typeof define&&define.amd?define:function(t,n){return n()});
|
|
//@ sourceMappingURL=kendo.router.min.js.map
|