|
1 | 1 | /*! |
2 | | - * History API JavaScript Library v4.1.2 |
| 2 | + * History API JavaScript Library v4.1.3 |
3 | 3 | * |
4 | 4 | * Support: IE6+, FF3+, Opera 9+, Safari, Chrome and other |
5 | 5 | * |
6 | | - * Copyright 2011-2013, Dmitrii Pakhtinov ( spb.piksel@gmail.com ) |
| 6 | + * Copyright 2011-2014, Dmitrii Pakhtinov ( spb.piksel@gmail.com ) |
7 | 7 | * |
8 | 8 | * http://spb-piksel.ru/ |
9 | 9 | * |
10 | 10 | * Dual licensed under the MIT and GPL licenses: |
11 | 11 | * http://www.opensource.org/licenses/mit-license.php |
12 | 12 | * http://www.gnu.org/licenses/gpl.html |
13 | 13 | * |
14 | | - * Update: 2014-04-29 15:30 |
| 14 | + * Update: 2014-05-14 14:06 |
15 | 15 | */ |
16 | 16 | (function(window) { |
17 | 17 | // Prevent the code from running if there is no window.history object |
|
113 | 113 | * @param {String} [basepath] |
114 | 114 | */ |
115 | 115 | "redirect": function(type, basepath) { |
116 | | - settings["basepath"] = basepath = basepath == null ? settings["basepath"] : basepath; |
| 116 | + settings["basepath"] = basepath = ('' + (basepath == null ? |
| 117 | + settings["basepath"] : basepath)).replace(/(?:^|\/)[^\/]*$/, '/'); |
117 | 118 | settings["type"] = type = type == null ? settings["type"] : type; |
118 | 119 | if (window.top == window.self) { |
119 | 120 | var relative = parseURL(null, false, true)._relative; |
|
859 | 860 | var src = (scripts[scripts.length - 1] || {}).src || ''; |
860 | 861 | var arg = src.indexOf('?') !== -1 ? src.split('?').pop() : ''; |
861 | 862 | arg.replace(/(\w+)(?:=([^&]*))?/g, function(a, key, value) { |
862 | | - settings[key] = (value || (key === 'basepath' ? '/' : '')).replace(/^(0|false)$/, ''); |
| 863 | + value = (value || '').replace(/^(0|false)$/, ''); |
| 864 | + settings[key] = key === 'basepath' ? value.replace(/(?:^|\/)[^\/]*$/, '/') : value; |
863 | 865 | }); |
864 | 866 |
|
865 | 867 | /** |
|
0 commit comments