Changeset ee9cedc7ce3c868e14588d97df63d486ec282b79
- Timestamp:
- 11/13/07 22:08:37
(8 months ago)
- Author:
- Antoine Cellerier <dionoea@videolan.org>
- git-committer:
- Antoine Cellerier <dionoea@videolan.org> 1194988117 +0000
- git-parent:
[9f8aa0ff1f7dc797ff47371480829c89377588f6]
- git-author:
- Antoine Cellerier <dionoea@videolan.org> 1194988117 +0000
- Message:
Add "search as you type" to the HTTP interface.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r87c76c2 |
ree9cedc |
|
| 89 | 89 | </div> |
|---|
| 90 | 90 | </td> |
|---|
| | 91 | <td style='width: 30px'></td> |
|---|
| | 92 | <td> |
|---|
| | 93 | <span class="btn_text">Live search:</span> |
|---|
| | 94 | <input title="Live search" type="text" value="<?vlc if _G.search_key then print(search_key) else print('<search>') end ?>" id="search" onfocus="if( this.value == '<search>' ) this.value = ''" onblur="if( this.value == '' ) reset_search()" onchange="update_playlist_search(this.value)" onkeyup="update_playlist_search(this.value)" /> |
|---|
| | 95 | <button id="btn_search_reset" onclick="reset_search()" onmouseover="button_over(this);" onmouseout="button_out(this);" title="Reset search"> |
|---|
| | 96 | <img src="images/reset.png" alt="Reset" /> |
|---|
| | 97 | <span class="btn_text">Reset</span> |
|---|
| | 98 | </button> |
|---|
| | 99 | </td> |
|---|
| 91 | 100 | </tr> |
|---|
| 92 | 101 | </table> |
|---|
| re10d431 |
ree9cedc |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2005-2006 the VideoLAN team |
|---|
| 5 | | * $Id$ |
|---|
| | 5 | * $Id: functions.js 21264 2007-08-19 17:48:28Z dionoea $ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Antoine Cellerier <dionoea -at- videolan -dot- org> |
|---|
| … | … | |
| 395 | 395 | { |
|---|
| 396 | 396 | loadXMLDoc( 'requests/playlist.xml', parse_playlist ); |
|---|
| | 397 | } |
|---|
| | 398 | function update_playlist_search(key) |
|---|
| | 399 | { |
|---|
| | 400 | loadXMLDoc( 'requests/playlist.xml?search='+encodeURIComponent(key), parse_playlist ) |
|---|
| | 401 | } |
|---|
| | 402 | function reset_search() |
|---|
| | 403 | { |
|---|
| | 404 | var search = document.getElementById('search') |
|---|
| | 405 | if( search ) |
|---|
| | 406 | { |
|---|
| | 407 | search.value = '<search>' |
|---|
| | 408 | update_playlist_search('') |
|---|
| | 409 | } |
|---|
| 397 | 410 | } |
|---|
| 398 | 411 | |
|---|
| r87c76c2 |
ree9cedc |
|
| 29 | 29 | --[[<node id="0" name="Undefined" ro="ro">]] |
|---|
| 30 | 30 | function print_playlist(item) |
|---|
| | 31 | if item.flags.disabled then return end |
|---|
| 31 | 32 | if item.children then |
|---|
| 32 | 33 | local name = vlc.convert_xml_special_chars(item.name) |
|---|
| … | … | |
| 57 | 58 | end |
|---|
| 58 | 59 | --]] |
|---|
| 59 | | local p = vlc.playlist.get() |
|---|
| | 60 | local p |
|---|
| | 61 | if _GET["search"] then |
|---|
| | 62 | if _GET["search"] ~= "" then |
|---|
| | 63 | _G.search_key = _GET["search"] |
|---|
| | 64 | else |
|---|
| | 65 | _G.search_key = nil |
|---|
| | 66 | end |
|---|
| | 67 | local key = vlc.decode_uri(_GET["search"]) |
|---|
| | 68 | p = vlc.playlist.search(key) |
|---|
| | 69 | else |
|---|
| | 70 | p = vlc.playlist.get() |
|---|
| | 71 | end |
|---|
| 60 | 72 | -- a(p) Uncomment to debug |
|---|
| 61 | 73 | print_playlist(p) |
|---|