?>
</div>
</td>
+ <td style='width: 30px'></td>
+ <td>
+ <span class="btn_text">Live search:</span>
+ <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)" />
+ <button id="btn_search_reset" onclick="reset_search()" onmouseover="button_over(this);" onmouseout="button_out(this);" title="Reset search">
+ <img src="images/reset.png" alt="Reset" />
+ <span class="btn_text">Reset</span>
+ </button>
+ </td>
</tr>
</table>
</div>
* functions.js: VLC media player web interface
*****************************************************************************
* Copyright (C) 2005-2006 the VideoLAN team
- * $Id$
+ * $Id: functions.js 21264 2007-08-19 17:48:28Z dionoea $
*
* Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
*
{
loadXMLDoc( 'requests/playlist.xml', parse_playlist );
}
+function update_playlist_search(key)
+{
+ loadXMLDoc( 'requests/playlist.xml?search='+encodeURIComponent(key), parse_playlist )
+}
+function reset_search()
+{
+ var search = document.getElementById('search')
+ if( search )
+ {
+ search.value = '<search>'
+ update_playlist_search('')
+ }
+}
/**********************************************************************
* Parse xml replies to XMLHttpRequests
<?vlc
--[[<node id="0" name="Undefined" ro="ro">]]
function print_playlist(item)
+ if item.flags.disabled then return end
if item.children then
local name = vlc.convert_xml_special_chars(item.name)
print("<node id=\""..tostring(item.id).."\" name=\""..name.."\" ro=\""..(item.flags.ro and "ro" or "rw").."\">")
print("</node>")
end
--]]
-local p = vlc.playlist.get()
+local p
+if _GET["search"] then
+ if _GET["search"] ~= "" then
+ _G.search_key = _GET["search"]
+ else
+ _G.search_key = nil
+ end
+ local key = vlc.decode_uri(_GET["search"])
+ p = vlc.playlist.search(key)
+else
+ p = vlc.playlist.get()
+end
-- a(p) Uncomment to debug
print_playlist(p)
?>