Changeset ee9cedc7ce3c868e14588d97df63d486ec282b79

Show
Ignore:
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
  • share/http-lua/dialogs/playlist

    r87c76c2 ree9cedc  
    8989          </div> 
    9090        </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> 
    91100      </tr> 
    92101    </table> 
  • share/http-lua/js/functions.js

    re10d431 ree9cedc  
    33 ***************************************************************************** 
    44 * Copyright (C) 2005-2006 the VideoLAN team 
    5  * $Id
     5 * $Id: functions.js 21264 2007-08-19 17:48:28Z dionoea
    66 * 
    77 * Authors: Antoine Cellerier <dionoea -at- videolan -dot- org> 
     
    395395{ 
    396396    loadXMLDoc( 'requests/playlist.xml', parse_playlist ); 
     397} 
     398function update_playlist_search(key) 
     399{ 
     400    loadXMLDoc( 'requests/playlist.xml?search='+encodeURIComponent(key), parse_playlist ) 
     401} 
     402function reset_search() 
     403{ 
     404    var search = document.getElementById('search') 
     405    if( search ) 
     406    { 
     407        search.value = '<search>' 
     408        update_playlist_search('') 
     409    } 
    397410} 
    398411 
  • share/http-lua/requests/playlist.xml

    r87c76c2 ree9cedc  
    2929--[[<node id="0" name="Undefined" ro="ro">]] 
    3030function print_playlist(item) 
     31  if item.flags.disabled then return end 
    3132  if item.children then 
    3233    local name = vlc.convert_xml_special_chars(item.name) 
     
    5758end 
    5859--]] 
    59 local p = vlc.playlist.get() 
     60local p 
     61if _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) 
     69else 
     70  p = vlc.playlist.get() 
     71end 
    6072-- a(p) Uncomment to debug 
    6173print_playlist(p)