Last active
August 29, 2015 14:21
-
-
Save beckettkev/787bc19e087d949f5d8b to your computer and use it in GitHub Desktop.
Full JS Function for forming refiner JSON for Search
This file contains 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
var loadFilteredResults = function (prop, value) { | |
var _isRefiner; | |
var _baseUrl = window.location.protocol + '//' + window.location.hostname + '/sites/search/pages/Results.aspx?k=' + escape(prop + '="' + value) + '"'"; | |
switch (prop) { | |
case "owsRegion": | |
case "owsCountry": | |
case "owsEmpire": | |
case "owsGalaxy": | |
_isRefiner = true; | |
break; | |
default: | |
_isRefiner = false; | |
} | |
if (_isRefiner) { | |
window.location.href = _baseUrl + '#Default={"k":"' + escape(prop + ':\\"' + value) + '\\"","r":[{"n":"' + prop + '","t":["\\"' + unescape('%u01C2') + unescape('%u01C2') + stringToHex(value) + '\\""],"o":"and","k":false,"m":null}]}'; | |
} else { | |
window.location.href = _baseUrl; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment