Commit a8791d80 authored by marc duez's avatar marc duez

url.js : add a clean() function to remove all params from url

needed to avoid accumulating params in url from successive db call
parent e0d703db
......@@ -931,6 +931,7 @@ Database.prototype = {
xhrFields: {withCredentials: true},
success: function (result) {
self.m.resume()
self.m.url_manager.clean();
self.display_result(result, "", args);
self.connected = true;
},
......
......@@ -198,6 +198,22 @@ Url.prototype= {
this.url_dict = {};
this.pushUrl("");
db.load_custom_data();
},
clean: function(){
var url = this.window.location;
var original_pathname = url.pathname;
var positionnal_params = url.pathname.substr(1).split('-');
if (positionnal_params.length > 1 && positionnal_params[0] != "index.html"){
var split = original_pathname.split('/');
if (split[split.length-1] == "")
split.splice(split.length-1, 1);
split.splice(split.length-1, 1);
original_pathname = split.join('/');
}
if (original_pathname == "") original_pathname = "/";
this.pushUrl(original_pathname);
}
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment