Created
November 25, 2015 03:20
-
-
Save spolischook/9480f5fd8421bc67e645 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pager(val) { | |
var pager = document.getElementById("log_search_type_limit"), | |
perpage = pager.options[pager.selectedIndex].value, | |
url = replaceQueryParam('limit', perpage, window.location.search); | |
window.location = window.location.pathname + url; | |
} | |
function replaceQueryParam(param, newval, search) { | |
var regex = new RegExp("([?;&])" + param + "[^&;]*[;&]?"); | |
var query = search.replace(regex, "$1").replace(/&$/, ''); | |
return (query.length > 2 ? query + "&" : "?") + (newval ? param + "=" + newval : ''); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment