diff options
author | Dave Lawrence <dlawrence@mozilla.com> | 2011-11-30 20:53:50 +0100 |
---|---|---|
committer | Dave Lawrence <dlawrence@mozilla.com> | 2011-11-30 20:53:50 +0100 |
commit | 5639b2edc8c0d7af299d7b938005d13fe3d64990 (patch) | |
tree | b2028b32e327a616f69176c958430abb6aefcfc9 /js/custom-search.js | |
parent | 41eee15be2640ae0435e2ab51f2d9718819341cc (diff) | |
parent | f22bf7ffb8217525a17ec3e1414fa642047f8584 (diff) | |
download | bugzilla-5639b2edc8c0d7af299d7b938005d13fe3d64990.tar.gz bugzilla-5639b2edc8c0d7af299d7b938005d13fe3d64990.tar.xz |
merged with bugzilla/4.2
Diffstat (limited to 'js/custom-search.js')
-rw-r--r-- | js/custom-search.js | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/js/custom-search.js b/js/custom-search.js index 394e0eb32..0ee7d2488 100644 --- a/js/custom-search.js +++ b/js/custom-search.js @@ -140,14 +140,29 @@ function custom_search_close_paren() { // using the query string, which query.cgi can read to re-create the page // exactly as the user had it before. function fix_query_string(form_member) { - if (!(window.history && window.history.replaceState)) + // window.History comes from history.js. + // It falls back to the normal window.history object for HTML5 browsers. + if (!(window.History && window.History.replaceState)) return; var form = YAHOO.util.Dom.getAncestorByTagName(form_member, 'form'); var query = YAHOO.util.Connect.setForm(form); - window.history.replaceState(null, document.title, '?' + query); + window.History.replaceState(null, document.title, '?' + query); } +// Browsers that do not support HTML5's history.replaceState gain an emulated +// version via history.js, with the full query_string in the location's hash. +// We rewrite the URL to include the hash and redirect to the new location, +// which causes custom search fields to work. +function redirect_html4_browsers() { + var hash = document.location.hash; + if (hash == '') return; + hash = hash.substring(1); + if (hash.substring(0, 10) != 'query.cgi?') return; + var url = document.location + ""; + url = url.substring(0, url.indexOf('query.cgi#')) + hash; + document.location = url; +} function _cs_fix_ids(parent, preserve_values) { // Update the label of the checkbox. |