| 1 | function removeParam(key, sourceURL) { |
| 2 | var rtn = sourceURL.split("?")[0], |
| 3 | param, |
| 4 | params_arr = [], |
| 5 | queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : ""; |
| 6 | if (queryString !== "") { |
| 7 | params_arr = queryString.split("&"); |
| 8 | for (var i = params_arr.length - 1; i >= 0; i -= 1) { |
| 9 | param = params_arr[i].split("=")[0]; |
| 10 | if ($.inArray( param, key ) > -1 ) { |
| 11 | params_arr.splice(i, 1); |
| 12 | } |
| 13 | } |
| 14 | rtn = rtn + "?" + params_arr.join("&"); |
| 15 | } |
| 16 | return rtn; |
| 17 | } |
| 18 | |
| 19 | var remove_query_args=[ 'user_switched', 'switched_off', 'switched_back', |
| 20 | 'message', 'updated', 'settings-updated', 'saved', |
| 21 | 'activated', 'activate', 'deactivate', |
| 22 | 'locked', 'skipped', 'deleted', 'trashed', 'untrashed' ]; |
| 23 | |
| 24 | url = $(location).attr('href'); |
| 25 | url = removeParam( remove_query_args, url ); |
| 26 | |
| 27 | if (typeof history.replaceState === 'function') { // check html5 functionality support |
| 28 | history.replaceState( {},'',url); |
| 29 | } |
| 30 | No newline at end of file |