Fix wish add modal re-appearing
This commit is contained in:
parent
3dc893fa77
commit
741fc7cdc7
1 changed files with 21 additions and 0 deletions
|
@ -511,6 +511,27 @@ $(function () {
|
|||
validateWishURL(formAdd, buttonAdd, modalWishlistWishAdd);
|
||||
|
||||
return false;
|
||||
},
|
||||
onHide : function() {
|
||||
/** Ugly URL */
|
||||
var paramString = location.search.split('?')[1];
|
||||
var queryString = new URLSearchParams(paramString);
|
||||
|
||||
if (queryString.has('wish_add')) {
|
||||
queryString.delete('wish_add');
|
||||
|
||||
window.history.replaceState(null, document.title, '?' + queryString.toString());
|
||||
}
|
||||
|
||||
/** Pretty URL */
|
||||
var path = location.pathname;
|
||||
var pathParts = path.split('/')
|
||||
var pathAdd = pathParts[pathParts.length - 1];
|
||||
var pathNew = path.substring(0, path.length - pathAdd.length - 1);
|
||||
|
||||
if (pathAdd.toLowerCase() === 'add') {
|
||||
window.history.replaceState(null, document.title, pathNew);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue