mirror of
https://github.com/prymitive/karma
synced 2026-05-07 03:26:52 +00:00
Merge pull request #57 from cloudflare/reset-fix
Fix settings reset button
This commit is contained in:
@@ -74,6 +74,8 @@ var Config = (function() {
|
||||
|
||||
|
||||
reset = function() {
|
||||
// this is not part of options map
|
||||
Cookies.remove("defaultFilter.v2");
|
||||
$.each(options, function(name, option) {
|
||||
Cookies.remove(option.Cookie);
|
||||
});
|
||||
@@ -108,6 +110,7 @@ var Config = (function() {
|
||||
// reset settings button action
|
||||
$(params.ResetSelector).on('click', function(elem) {
|
||||
Config.Reset();
|
||||
QueryString.Remove('q');
|
||||
location.reload();
|
||||
});
|
||||
|
||||
|
||||
@@ -9,8 +9,7 @@ var QueryString = (function() {
|
||||
q = q.split('&');
|
||||
for (var i = 0; i < q.length; i++) {
|
||||
hash = q[i].split('=');
|
||||
vars.push(hash[1]);
|
||||
vars[hash[0]] = hash[1];
|
||||
vars[hash[0]] = hash.slice(1).join('=');
|
||||
}
|
||||
}
|
||||
return vars;
|
||||
@@ -39,9 +38,20 @@ var QueryString = (function() {
|
||||
}
|
||||
|
||||
|
||||
remove = function(key) {
|
||||
var baseUrl = [location.protocol, '//', location.host, location.pathname].join(''),
|
||||
q = QueryString.Parse();
|
||||
if (q[key] != undefined) {
|
||||
delete q[key];
|
||||
window.history.replaceState({}, "", baseUrl + "?" + $.param(q));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
Parse: parse,
|
||||
Set: update
|
||||
Set: update,
|
||||
Remove: remove
|
||||
}
|
||||
|
||||
}());
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user