diff options
Diffstat (limited to 'assets/js')
| -rw-r--r-- | assets/js/list.js | 17 | ||||
| -rw-r--r-- | assets/js/search.js | 40 |
2 files changed, 0 insertions, 57 deletions
diff --git a/assets/js/list.js b/assets/js/list.js deleted file mode 100644 index 25ff80d..0000000 --- a/assets/js/list.js +++ /dev/null | |||
| @@ -1,17 +0,0 @@ | |||
| 1 | function clickSearchResult(resId) { | ||
| 2 | var xhr = new XMLHttpRequest(); | ||
| 3 | xhr.onreadystatechange = function() { | ||
| 4 | if (xhr.readyState == XMLHttpRequest.DONE) { | ||
| 5 | if (xhr.status !== 200) { | ||
| 6 | alert(xhr.status + ": " + xhr.response); | ||
| 7 | return; | ||
| 8 | } | ||
| 9 | |||
| 10 | data = xhr.responseText; | ||
| 11 | document.getElementById("gril-list").innerHTML += data; | ||
| 12 | } | ||
| 13 | } | ||
| 14 | xhr.open('POST', window.location, true); | ||
| 15 | xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); | ||
| 16 | xhr.send('id=' + resId); | ||
| 17 | } \ No newline at end of file | ||
diff --git a/assets/js/search.js b/assets/js/search.js deleted file mode 100644 index 0cb33df..0000000 --- a/assets/js/search.js +++ /dev/null | |||
| @@ -1,40 +0,0 @@ | |||
| 1 | var strokeTimeout = null; | ||
| 2 | |||
| 3 | function instantSearch() { | ||
| 4 | if (strokeTimeout) { | ||
| 5 | clearTimeout(strokeTimeout); | ||
| 6 | } | ||
| 7 | strokeTimeout = setTimeout(doSearch, 150); | ||
| 8 | } | ||
| 9 | |||
| 10 | function doSearch() { | ||
| 11 | value = document.getElementById("search").value; | ||
| 12 | |||
| 13 | if (value === "") { | ||
| 14 | strokeTimeout = null; | ||
| 15 | document.getElementById("search-results").innerHTML = ""; | ||
| 16 | return; | ||
| 17 | } | ||
| 18 | var xhr = new XMLHttpRequest(); | ||
| 19 | xhr.onreadystatechange = function() { | ||
| 20 | if (xhr.readyState == XMLHttpRequest.DONE) { | ||
| 21 | if (xhr.status === 404 || xhr.status === 400 || typeof xhr.response === 'undefined' || xhr.response === '404 not found') { | ||
| 22 | document.getElementById("search-results").innerHTML = ''; | ||
| 23 | return | ||
| 24 | } | ||
| 25 | if (value === "") { | ||
| 26 | document.getElementById("search-results").innerHTML = ""; | ||
| 27 | return; | ||
| 28 | } | ||
| 29 | |||
| 30 | document.getElementById("search-results").innerHTML = xhr.response.replace(new RegExp('{ (.*?)(' + value + ')(.*?) }', 'gi'), "$1<b>$2</b>$3").replace(new RegExp('{ (.*?) }', 'gi'), '$1'); | ||
| 31 | } | ||
| 32 | } | ||
| 33 | xhr.open('GET', '/search/gril_instant/' + value, true); | ||
| 34 | xhr.send(null); | ||
| 35 | strokeTimeout = null; | ||
| 36 | } | ||
| 37 | |||
| 38 | function clickSearchResult(resId) { | ||
| 39 | |||
| 40 | } \ No newline at end of file | ||
