1. Jesus Galan Lopez
  2. lemmy

Commits

Jesus Galan Lopez  committed fe6b1b3

first attempt at filtering the list

  • Participants
  • Parent commits f6b38e8
  • Branches default

Comments (0)

Files changed (2)

File TODO

View file
 Clean up.
-Shuffle mode is naive.
 Load / save playlists.
 List filtering / search.
 Custom player controls?

File index.html

View file
 	$('#shuffle').click(toggleShuffle);
 	$('#repeat').click(toggleRepeat);
 	$('#clean').click(clean);
+	$('#filter').bind({
+		'click': function() {$(this).select();},
+		'focus': function() {$(this).css('width', '8em');},
+		'blur': function() {
+			if(this.value == '')
+				$(this).css('width', '1em');
+		},
+		'input': filter,
+		'keyup': function(e) {
+			if(e.keyCode != 27) // Escape
+				return;
+			this.value = '';
+			filter(e);
+		}
+	});
 	var $p = $('#tracks');
 	$p.sortable({
 		tolerance: 'pointer',
 	$('#display #current').text('');
 	setNext();
 }
+function filter(ev) {
+	v = ev.target.value;
+	$('#tracks li').each(function(i,e){
+		if($(e).text().toUpperCase().indexOf(v.toUpperCase()) < 0)
+			$(e).css('display', 'none');
+		else
+			$(e).css('display', 'block');
+	});
+}
 google.load("jquery", "1");
 google.load("jqueryui", "1");
 google.setOnLoadCallback(init);
 	background: black;
 	color: white;
 }
+#filter {
+	display: block;
+	position: absolute;
+	top: 0; left: 0;
+	width: 1em;
+	font-size: 1em;
+	background: oldlace; color: #666;
+	border: solid 1px #ccc;
+}
+#filter:focus {
+	border: none;
+}
 #credits {
 	position: fixed;
 	top: 0.2ex;
       <a id="shuffle" class="listop inactive" href="#">Shuffle</a><!--
       --><a id="repeat" class="listop inactive" href="#">Repeat</a><!--
       --><a id="clean" class="listop" href="#">Clean</a>
+      <form><input id="filter"></form>
     </div>
     <div class="list">
       <div id="help">