Preparing some code for enter to next, and fixing position bugs with search

This commit is contained in:
KasperRT
2015-03-17 15:17:30 +01:00
parent fd660f872c
commit c66e7288b0
2 changed files with 7 additions and 6 deletions

View File

@@ -38,7 +38,6 @@ function updateList()
$.each(list.songs, function(j, listeID){
var video_title=listeID.title.replace(/\\\'/g, "'").replace(/"/g,"'").replace(/&/g,"&");
var video_id = listeID.id;
console.log($.inArray(video_id, bright));
if(find && $.inArray(video_id, bright) == -1) brightness = "brightness";
else if(find && $.inArray(video_id, bright) != -1) brightness = "brightness fullbrightness";
else brightness = "";

View File

@@ -1,6 +1,8 @@
$(document).ready(function()
{
found = null;
znum = 1;
elems = [];
bright = [];
$.expr[":"].contains = $.expr.createPseudo(function(arg) {
return function( elem ) {
@@ -9,7 +11,7 @@ $(document).ready(function()
});
find = false;
$("html").keydown(function(event) {
if ((event.keyCode == 13 && find) || (event.keyCode == 27 && find) || (event.ctrlKey && event.keyCode === 70))
if ((event.keyCode == 27 && find) || (event.ctrlKey && event.keyCode === 70))
{
find = !find;
if(find)
@@ -57,7 +59,6 @@ $(document).ready(function()
myScroll.refresh();
setTimeout(function(){myScroll.refresh();}, 505);
}
});
$("body").keyup(function(event) {
if(find)
@@ -74,15 +75,16 @@ $(document).ready(function()
for(i = 0; i < found.length; i++)
{
found[i].className = found[i].className + " fullbrightness";
console.log(found[i].className.split(" ")[0]);
bright.push(found[i].className.split(" ")[0]);
//bright.push(found[i].className.split(" ")[0]);
elems.push(found[i]);
}
myScroll.scrollToElement(found[0], 10, 0, -40);
myScroll.scrollToElement(found[0], 10, 0, 0);
}else
{
$(".lresult").removeClass("fullbrightness");
bright.length = 0;
elems.length = 0;
znum = 1;
}
//console.log($("#wrapper").find(".result:contains('"+$("#findform-input").val()+"')"));
}