Created
October 13, 2014 16:22
-
-
Save anthonydillon/4df41bfe9b86182f20d6 to your computer and use it in GitHub Desktop.
Search function from tour
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.appSearch = function($query){ | |
if($query != ''){ | |
var listFilesContents = ''; | |
fileList = _parent.fileSystem.getFiles(); | |
var listContents = ''; | |
var i = this.totalApps.length; | |
var tempArray = new Array(); | |
var patt1 = new RegExp($query,"gi"); | |
while(i--){ | |
tempArray = this.totalApps[i].name.match(patt1); | |
if(tempArray != null){ | |
if(this.totalApps[i].image.substr(0,4) == 'img/'){ | |
listContents += '<div><img src="'+this.totalApps[i].image+'" /><p>'+this.totalApps[i].name+'</p></div>'; | |
}else{ | |
listContents += '<div><img src="img/applications/'+this.totalApps[i].image+'" /><p>'+this.totalApps[i].name+'</p></div>'; | |
} | |
} | |
} | |
for(var i = 0; i < fileList.length; i++){ | |
tempArray = fileList[i].name().match(patt1); | |
if(tempArray != null){ | |
listFilesContents += this.getDisplayIcon(fileList[i], i); | |
} | |
} | |
this.hideAll(); | |
$('#systemOverlay #display-search .files .app-list').html(listFilesContents); | |
$('#systemOverlay #display-search .applications .app-list').html(listContents); | |
//$('#systemOverlay input').css('background-image','url(img/overlay/cancel-logo.png)') | |
$('#systemOverlay #display-search').show(); | |
$('#systemOverlay .app-container .app-list div').bind('mouseover', function(){ | |
$('img',this).addClass('hover'); | |
}); | |
$('#systemOverlay .app-container .app-list div').bind('mouseout', function(){ | |
$('img',this).removeClass('hover'); | |
}); | |
$('#systemOverlay .app-container .applications .app-list div').bind('click', function(){ | |
var download = false; | |
if($(this).attr('data-type') == 'download'){ download = true; } | |
_this.appClicked($('img', this).attr('src'), download); | |
}); | |
$('#systemOverlay .app-container .files .app-list div').bind('click', function(){ | |
_this.fileClicked($(this).attr('data-id')); | |
}); | |
}else{ | |
this.showHome(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment