diff --git a/gillie.js b/gillie.js index 1f06b12..b0f2350 100644 --- a/gillie.js +++ b/gillie.js @@ -307,8 +307,11 @@ return optional ? match : modelVar || match; }); - return this.url ? this.url + route : - window.location.href + '/' + route; + // Use `route` as full URL if its contains + // `http:|https:`. + return (/^(\/\/|http:|https:).*/.test( route )) ? + route : ( this.url ? this.url + route : + window.location.href + '/' + route ); } @@ -511,4 +514,4 @@ // Expose Gillie to the global scope window.Gillie = Gillie; -})( jQuery, this ); \ No newline at end of file +})( jQuery, this ); diff --git a/gillie.min.js b/gillie.min.js index a6ae916..636c3c9 100644 --- a/gillie.min.js +++ b/gillie.min.js @@ -2,4 +2,4 @@ * Gillie JavaScript Library 0.2.0 * http://pablovallejo.github.io/gillie */ -!function(a,b){var c=!1,d=/xyz/.test(function(){})?/\b_super\b/:/.*/,e=function(){},f=function(b){return a.each([].slice.call(arguments,1),function(a,c){if(c)for(var d in c)b[d]=c[d]}),b},g=e.Events={on:function(a,b,c){if(!i(this,"on",a,[b,c])||!b)return this;this._events||(this._events={});var d=this._events[a]||(this._events[a]=[]);return d.push({callback:b,context:c,ctx:c||this}),this},trigger:function(a){if(!this._events)return this;var b=[].slice.call(arguments,1);if(!i(this,"trigger",a,b))return this;var c=this._events[a];return c&&j(c,b),this}},h=/\s+/,i=function(a,b,c,d){if(c){if("object"==typeof c){for(var e in c)a[b].apply(a,[e,c[e]].concat(d));return!1}if(h.test(c)){for(var f=c.split(h),g=0,i=f.length;i>g;g++)a[b].apply(a,[f[g]].concat(d));return!1}return!0}},j=function(a,b){var c,d=-1,e=a.length,f=b[0],g=b[1],h=b[2];switch(b.length){case 0:for(;++dg;g++)a[b].apply(a,[f[g]].concat(d));return!1}return!0}},j=function(a,b){var c,d=-1,e=a.length,f=b[0],g=b[1],h=b[2];switch(b.length){case 0:for(;++d