Skip to content

Commit

Permalink
updating version
Browse files Browse the repository at this point in the history
  • Loading branch information
muzammilkm committed Mar 2, 2019
1 parent 755b043 commit 2af1339
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 40 deletions.
44 changes: 29 additions & 15 deletions dist/jq-router.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*!
* jQ-Router JQuery Plugin v4.5.1
* jQ-Router JQuery Plugin v4.6.0
* https://github.com/muzammilkm/jq-router
*
* Copyright 2017, Muzammil Khaja Mohammed
* Licensed under the MIT license.
* https://github.com/muzammilkm/jq-router/blob/master/LICENSE
*
* Date: Tue Jan 26 12:25:00 2019 +0530
* Date: Sat Mar 2 3:00:00 2019 +0530
*/

(function($, window) {
Expand Down Expand Up @@ -99,12 +99,7 @@
if (!route) {
return;
}

var url = route.relativeUrl;
for (var i = 0; i < route.params.length; i++) {
url = url.replace(':' + route.params[i], params[route.params[i]]);
}
return url;
return s.paramReplacer(route.relativeUrl, route, params);
};

/**
Expand Down Expand Up @@ -170,6 +165,24 @@
return s;
};

/**
* Replace Params for given string with route & params
* @param {string}
* @param {object} route
* @param {object} params
* @returns {string}
*/
s.paramReplacer = function(str, route, params) {
if(!str){
return;
}
for (var i = 0; i < route.params.length; i++) {
str = str.replace(':' + route.params[i], params[route.params[i]]);
}

return str;
};

/**
* Initialize the router & this should be invoked on document ready.
* @param {string} viewSelector
Expand Down Expand Up @@ -258,14 +271,14 @@
$.router = router;
}(jQuery, window));
/*!
* jQ-Router JQuery Plugin v4.5.1
* jQ-Router JQuery Plugin v4.6.0
* https://github.com/muzammilkm/jq-router
*
* Copyright 2017, Muzammil Khaja Mohammed
* Licensed under the MIT license.
* https://github.com/muzammilkm/jq-router/blob/master/LICENSE
*
* Date: Tue Jan 26 12:25:00 2019 +0530
* Date: Sat Mar 2 3:00:00 2019 +0530
*/

(function($, window, router) {
Expand Down Expand Up @@ -348,14 +361,14 @@

}(jQuery, window, $.router));
/*!
* jQ-Router JQuery Plugin v4.5.1
* jQ-Router JQuery Plugin v4.6.0
* https://github.com/muzammilkm/jq-router
*
* Copyright 2017, Muzammil Khaja Mohammed
* Licensed under the MIT license.
* https://github.com/muzammilkm/jq-router/blob/master/LICENSE
*
* Date: Tue Jan 26 12:25:00 2019 +0530
* Date: Sat Mar 2 3:00:00 2019 +0530
*/

(function($, router) {
Expand All @@ -378,14 +391,14 @@
}(jQuery, $.router));

/*!
* jQ-Router JQuery Plugin v4.5.1
* jQ-Router JQuery Plugin v4.6.0
* https://github.com/muzammilkm/jq-router
*
* Copyright 2017, Muzammil Khaja Mohammed
* Licensed under the MIT license.
* https://github.com/muzammilkm/jq-router/blob/master/LICENSE
*
* Date: Tue Jan 26 12:25:00 2019 +0530
* Date: Sat Mar 2 3:00:00 2019 +0530
*/

(function($, router) {
Expand Down Expand Up @@ -449,7 +462,8 @@
}

if (!templateCache[_route.templateUrl] || !_route.cache) {
requests.push(s.getViewTemplate(_route.templateUrl, _route.cache));
var templateUrl = router.paramReplacer(_route.templateUrl, _route, params);
requests.push(s.getViewTemplate(templateUrl, _route.cache));
}
}

Expand Down
2 changes: 1 addition & 1 deletion dist/jq-router.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 29 additions & 15 deletions docs/scripts/jq-router.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*!
* jQ-Router JQuery Plugin v4.5.1
* jQ-Router JQuery Plugin v4.6.0
* https://github.com/muzammilkm/jq-router
*
* Copyright 2017, Muzammil Khaja Mohammed
* Licensed under the MIT license.
* https://github.com/muzammilkm/jq-router/blob/master/LICENSE
*
* Date: Tue Jan 26 12:25:00 2019 +0530
* Date: Sat Mar 2 3:00:00 2019 +0530
*/

(function($, window) {
Expand Down Expand Up @@ -99,12 +99,7 @@
if (!route) {
return;
}

var url = route.relativeUrl;
for (var i = 0; i < route.params.length; i++) {
url = url.replace(':' + route.params[i], params[route.params[i]]);
}
return url;
return s.paramReplacer(route.relativeUrl, route, params);
};

/**
Expand Down Expand Up @@ -170,6 +165,24 @@
return s;
};

/**
* Replace Params for given string with route & params
* @param {string}
* @param {object} route
* @param {object} params
* @returns {string}
*/
s.paramReplacer = function(str, route, params) {
if(!str){
return;
}
for (var i = 0; i < route.params.length; i++) {
str = str.replace(':' + route.params[i], params[route.params[i]]);
}

return str;
};

/**
* Initialize the router & this should be invoked on document ready.
* @param {string} viewSelector
Expand Down Expand Up @@ -258,14 +271,14 @@
$.router = router;
}(jQuery, window));
/*!
* jQ-Router JQuery Plugin v4.5.1
* jQ-Router JQuery Plugin v4.6.0
* https://github.com/muzammilkm/jq-router
*
* Copyright 2017, Muzammil Khaja Mohammed
* Licensed under the MIT license.
* https://github.com/muzammilkm/jq-router/blob/master/LICENSE
*
* Date: Tue Jan 26 12:25:00 2019 +0530
* Date: Sat Mar 2 3:00:00 2019 +0530
*/

(function($, window, router) {
Expand Down Expand Up @@ -348,14 +361,14 @@

}(jQuery, window, $.router));
/*!
* jQ-Router JQuery Plugin v4.5.1
* jQ-Router JQuery Plugin v4.6.0
* https://github.com/muzammilkm/jq-router
*
* Copyright 2017, Muzammil Khaja Mohammed
* Licensed under the MIT license.
* https://github.com/muzammilkm/jq-router/blob/master/LICENSE
*
* Date: Tue Jan 26 12:25:00 2019 +0530
* Date: Sat Mar 2 3:00:00 2019 +0530
*/

(function($, router) {
Expand All @@ -378,14 +391,14 @@
}(jQuery, $.router));

/*!
* jQ-Router JQuery Plugin v4.5.1
* jQ-Router JQuery Plugin v4.6.0
* https://github.com/muzammilkm/jq-router
*
* Copyright 2017, Muzammil Khaja Mohammed
* Licensed under the MIT license.
* https://github.com/muzammilkm/jq-router/blob/master/LICENSE
*
* Date: Tue Jan 26 12:25:00 2019 +0530
* Date: Sat Mar 2 3:00:00 2019 +0530
*/

(function($, router) {
Expand Down Expand Up @@ -449,7 +462,8 @@
}

if (!templateCache[_route.templateUrl] || !_route.cache) {
requests.push(s.getViewTemplate(_route.templateUrl, _route.cache));
var templateUrl = router.paramReplacer(_route.templateUrl, _route, params);
requests.push(s.getViewTemplate(templateUrl, _route.cache));
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jq-router",
"version": "4.5.1",
"version": "4.6.0",
"description": "A tiny jQuery plugin for building single page application (SPA) with the possibility of nested views",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/jq-router.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*!
* jQ-Router JQuery Plugin v4.5.1
* jQ-Router JQuery Plugin v4.6.0
* https://github.com/muzammilkm/jq-router
*
* Copyright 2017, Muzammil Khaja Mohammed
* Licensed under the MIT license.
* https://github.com/muzammilkm/jq-router/blob/master/LICENSE
*
* Date: Tue Jan 26 12:25:00 2019 +0530
* Date: Sat Mar 2 3:00:00 2019 +0530
*/

(function($, window) {
Expand Down
4 changes: 2 additions & 2 deletions src/services/jq-router-events.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*!
* jQ-Router JQuery Plugin v4.5.1
* jQ-Router JQuery Plugin v4.6.0
* https://github.com/muzammilkm/jq-router
*
* Copyright 2017, Muzammil Khaja Mohammed
* Licensed under the MIT license.
* https://github.com/muzammilkm/jq-router/blob/master/LICENSE
*
* Date: Tue Jan 26 12:25:00 2019 +0530
* Date: Sat Mar 2 3:00:00 2019 +0530
*/

(function($, window, router) {
Expand Down
4 changes: 2 additions & 2 deletions src/services/jq-router-param-service.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*!
* jQ-Router JQuery Plugin v4.5.1
* jQ-Router JQuery Plugin v4.6.0
* https://github.com/muzammilkm/jq-router
*
* Copyright 2017, Muzammil Khaja Mohammed
* Licensed under the MIT license.
* https://github.com/muzammilkm/jq-router/blob/master/LICENSE
*
* Date: Tue Jan 26 12:25:00 2019 +0530
* Date: Sat Mar 2 3:00:00 2019 +0530
*/

(function($, router) {
Expand Down
4 changes: 2 additions & 2 deletions src/services/jq-router-renderer.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*!
* jQ-Router JQuery Plugin v4.5.1
* jQ-Router JQuery Plugin v4.6.0
* https://github.com/muzammilkm/jq-router
*
* Copyright 2017, Muzammil Khaja Mohammed
* Licensed under the MIT license.
* https://github.com/muzammilkm/jq-router/blob/master/LICENSE
*
* Date: Tue Jan 26 12:25:00 2019 +0530
* Date: Sat Mar 2 3:00:00 2019 +0530
*/

(function($, router) {
Expand Down

0 comments on commit 2af1339

Please sign in to comment.