From 4c566dd3c22c77747e02468bf30ab4787f2575e7 Mon Sep 17 00:00:00 2001 From: progrape Date: Thu, 30 Jun 2016 19:08:57 +0800 Subject: [PATCH] #401 update demo router --- dist/example/router.min.js | 2 +- src/example/router.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/example/router.min.js b/dist/example/router.min.js index 0343c5fb..8e1b454f 100644 --- a/dist/example/router.min.js +++ b/dist/example/router.min.js @@ -3,4 +3,4 @@ * Copyright 2016 * Licensed under the MIT license */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Router",[],t):"object"==typeof exports?exports.Router=t():e.Router=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n0?setTimeout(function(){e.parentNode.removeChild(e)},t._options.leaveTimeout):e.parentNode.removeChild(e)}();var s=document.createElement("div");o.className&&s.classList.add(o.className),s.innerHTML=r,t._$container.appendChild(s),!n&&t._options.enter&&i&&s.classList.add(t._options.enter),t._options.enterTimeout>0?setTimeout(function(){s.classList.remove(t._options.enter)},t._options.enterTimeout):s.classList.remove(t._options.enter),location.hash="#"+e;try{n?t._index--:t._index++,history.replaceState&&history.replaceState({_index:t._index},"",location.href)}catch(a){}"function"!=typeof o.bind||o.__isBind||(o.bind.call(s),o.__isBind=!0)}(),this}},{key:"_getRoute",value:function(e){for(var t=0,n=this._routes.length;n>t;t++){var o=this._routes[t],r=a.getRegExp(o.url),i=a.getParams(o.url),s=r.exec(e);if(s){o.params={};for(var u=0,c=i.length;c>u;u++){var l=i[u];o.params[l]=s[u+1]}return o}}return null}}]),e}();t["default"]=u,e.exports=t["default"]},function(e,t){"use strict";function n(e,t){for(var n in t)e[n]=t[n];return e}function o(e){return-1!==e.indexOf("#")?e.substring(e.indexOf("#")+1):"/"}function r(){}function i(e){var t=/\((.*?)\)/g,n=/(\(\?)?:\w+/g,o=/\*\w+/g,r=/[\-{}\[\]+?.,\\\^$|#\s]/g;return e=e.replace(r,"\\$&").replace(t,"(?:$1)?").replace(n,function(e,t){return t?e:"([^/?]+)"}).replace(o,"([^?]*?)"),new RegExp("^"+e+"(?:\\?([\\s\\S]*))?$")}function s(e){for(var t=/:(\w+)/g,n=[],o=void 0;null!==(o=t.exec(e));)n.push(o[1]);return n}Object.defineProperty(t,"__esModule",{value:!0}),t.extend=n,t.getHash=o,t.noop=r,t.getRegExp=i,t.getParams=s}])}); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Router",[],t):"object"==typeof exports?exports.Router=t():e.Router=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t0?setTimeout(function(){e.parentNode.removeChild(e)},t._options.leaveTimeout):e.parentNode.removeChild(e)}()},i=function(o,i){var a=document.createElement("div");r.className&&a.classList.add(r.className),a.innerHTML=i,t._$container.appendChild(a),!n&&t._options.enter&&o&&a.classList.add(t._options.enter),t._options.enterTimeout>0?setTimeout(function(){a.classList.remove(t._options.enter)},t._options.enterTimeout):a.classList.remove(t._options.enter),location.hash="#"+e;try{n?t._index--:t._index++,history.replaceState&&history.replaceState({_index:t._index},"",location.href)}catch(u){}"function"==typeof r.bind&&r.bind.call(a)},a=s.hasChildren(t._$container);o(a);var u=function(e){var t=arguments.length<=1||void 0===arguments[1]?"":arguments[1];if(e)throw e;i(a,t)},l=r.render(u);l&&"function"==typeof l.then?l.then(function(e){u(null,e)},u):0===r.render.length&&u(null,l)}(),this}}]),e}();t["default"]=l,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return-1!==e.indexOf("#")?e.substring(e.indexOf("#")+1):"/"}function i(e,t){for(var n=0,r=e.length;r>n;n++){var o=e[n],i=[],a=(0,l["default"])(o.url,i),u=a.exec(t);if(u){o.params={};for(var s=0,c=i.length;c>s;s++){var f=i[s],p=f.name;o.params[p]=u[s+1]}return o}}return null}function a(e){var t=e.children;return t.length>0}function u(){}Object.defineProperty(t,"__esModule",{value:!0}),t.getHash=o,t.getRoute=i,t.hasChildren=a,t.noop=u;var s=n(2),l=r(s)},function(e,t,n){function r(e){for(var t,n=[],r=0,o=0,i="";null!=(t=x.exec(e));){var a=t[0],u=t[1],l=t.index;if(i+=e.slice(o,l),o=l+a.length,u)i+=u[1];else{var c=e[o],f=t[2],p=t[3],h=t[4],d=t[5],v=t[6],g=t[7];null!=f&&null!=c&&c!==f&&(i+=f,f=null),i&&(n.push(i),i="");var y="+"===v||"*"===v,_="?"===v||"*"===v,m=t[2]||"/",w=h||d||(g?".*":"[^"+m+"]+?");n.push({name:p||r++,prefix:f||"",delimiter:m,optional:_,repeat:y,pattern:s(w)})}}return o0?setTimeout(function(){e.parentNode.removeChild(e)},t._options.leaveTimeout):e.parentNode.removeChild(e)}();var s=document.createElement("div");o.className&&s.classList.add(o.className),s.innerHTML=r,t._$container.appendChild(s),!n&&t._options.enter&&i&&s.classList.add(t._options.enter),t._options.enterTimeout>0?setTimeout(function(){s.classList.remove(t._options.enter)},t._options.enterTimeout):s.classList.remove(t._options.enter),location.hash="#"+e;try{n?t._index--:t._index++,history.replaceState&&history.replaceState({_index:t._index},"",location.href)}catch(a){}"function"!=typeof o.bind||o.__isBind||(o.bind.call(s),o.__isBind=!0)}(),this}},{key:"_getRoute",value:function(e){for(var t=0,n=this._routes.length;n>t;t++){var o=this._routes[t],r=a.getRegExp(o.url),i=a.getParams(o.url),s=r.exec(e);if(s){o.params={};for(var u=0,c=i.length;c>u;u++){var l=i[u];o.params[l]=s[u+1]}return o}}return null}}]),e}();t["default"]=u,e.exports=t["default"]},function(e,t){"use strict";function n(e,t){for(var n in t)e[n]=t[n];return e}function o(e){return-1!==e.indexOf("#")?e.substring(e.indexOf("#")+1):"/"}function r(){}function i(e){var t=/\((.*?)\)/g,n=/(\(\?)?:\w+/g,o=/\*\w+/g,r=/[\-{}\[\]+?.,\\\^$|#\s]/g;return e=e.replace(r,"\\$&").replace(t,"(?:$1)?").replace(n,function(e,t){return t?e:"([^/?]+)"}).replace(o,"([^?]*?)"),new RegExp("^"+e+"(?:\\?([\\s\\S]*))?$")}function s(e){for(var t=/:(\w+)/g,n=[],o=void 0;null!==(o=t.exec(e));)n.push(o[1]);return n}Object.defineProperty(t,"__esModule",{value:!0}),t.extend=n,t.getHash=o,t.noop=r,t.getRegExp=i,t.getParams=s}])}); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Router",[],t):"object"==typeof exports?exports.Router=t():e.Router=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t0?setTimeout(function(){e.parentNode.removeChild(e)},t._options.leaveTimeout):e.parentNode.removeChild(e)}()},i=function(o,i){var a=document.createElement("div");r.className&&a.classList.add(r.className),a.innerHTML=i,t._$container.appendChild(a),!n&&t._options.enter&&o&&a.classList.add(t._options.enter),t._options.enterTimeout>0?setTimeout(function(){a.classList.remove(t._options.enter)},t._options.enterTimeout):a.classList.remove(t._options.enter),location.hash="#"+e;try{n?t._index--:t._index++,history.replaceState&&history.replaceState({_index:t._index},"",location.href)}catch(u){}"function"==typeof r.bind&&r.bind.call(a)},a=s.hasChildren(t._$container);o(a);var u=function(e){var t=arguments.length<=1||void 0===arguments[1]?"":arguments[1];if(e)throw e;i(a,t)},l=r.render(u);l&&"function"==typeof l.then?l.then(function(e){u(null,e)},u):0===r.render.length&&u(null,l)}(),this}}]),e}();t["default"]=l,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return-1!==e.indexOf("#")?e.substring(e.indexOf("#")+1):"/"}function i(e,t){for(var n=0,r=e.length;r>n;n++){var o=e[n],i=[],a=(0,l["default"])(o.url,i),u=a.exec(t);if(u){o.params={};for(var s=0,c=i.length;c>s;s++){var f=i[s],p=f.name;o.params[p]=u[s+1]}return o}}return null}function a(e){var t=e.children;return t.length>0}function u(){}Object.defineProperty(t,"__esModule",{value:!0}),t.getHash=o,t.getRoute=i,t.hasChildren=a,t.noop=u;var s=n(2),l=r(s)},function(e,t,n){function r(e){for(var t,n=[],r=0,o=0,i="";null!=(t=x.exec(e));){var a=t[0],u=t[1],l=t.index;if(i+=e.slice(o,l),o=l+a.length,u)i+=u[1];else{var c=e[o],f=t[2],p=t[3],h=t[4],d=t[5],v=t[6],g=t[7];null!=f&&null!=c&&c!==f&&(i+=f,f=null),i&&(n.push(i),i="");var y="+"===v||"*"===v,_="?"===v||"*"===v,m=t[2]||"/",w=h||d||(g?".*":"[^"+m+"]+?");n.push({name:p||r++,prefix:f||"",delimiter:m,optional:_,repeat:y,pattern:s(w)})}}return o