Sha256: 9cd23fedb28f4934b2fe5dd8195364927c6f23ec1ef1121420083d1b84badb00
Contents?: true
Size: 778 Bytes
Versions: 17
Compression:
Stored size: 778 Bytes
Contents
// // @brief // @author ongaeshi // @date 2011/08/24 function replace_query_param(url, value) { var url_s = url.split("?"); if (url_s.length <= 1) { return url + "?query=" + value; } else { var params = url_s[1].split("&"); var found_query = false; for (var i = 0; i < params.length; i++) { if (params[i].search(/^query=/) != -1) { params[i] = params[i].replace(/^query=.*/, "query=" + value); found_query = true; } } if (!found_query) params.unshift("query=" + value); return url_s[0] + "?" + params.join("&"); } } function topic_path(id) { var url = document.getElementById(id).href; url = replace_query_param(url, document.searchform.query.value); document.getElementById(id).href = url; }
Version data entries
17 entries across 17 versions & 1 rubygems