Created
December 3, 2017 17:28
-
-
Save kovkor/1e8e333bec0051149491649b3900907e to your computer and use it in GitHub Desktop.
URL feldolgozása pl. kereséshez. A / jellel elválasztott url-ben megkeresi a kulcsszavakat, majd a mögöttök található keresőszavakat tömbbe rendezi.
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
| var keresoszavak = ['kategoria','helyiseg']; | |
| function prepareSearch() { | |
| let searchwords = []; | |
| let uri = window.location.pathname; | |
| let uritemp = uri.split('/'); | |
| let db = uritemp.length; | |
| for (i=1;i<db;i++) { | |
| if (uritemp[i]) { | |
| if ($.inArray(uritemp[i],keresoszavak)>-1) { | |
| actualwords = i; | |
| if (searchwords[uritemp[actualwords]] == undefined) searchwords[uritemp[actualwords]] = ''; | |
| } | |
| if ($.inArray(uritemp[i],keresoszavak) == -1) { | |
| searchwords[uritemp[actualwords]] = searchwords[uritemp[actualwords]] + uritemp[i]+','; | |
| } | |
| } | |
| } | |
| return searchwords; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment