Search is there, just need styling

This commit is contained in:
Kasper Rynning-Tønnesen
2015-04-24 20:52:59 +02:00
parent 6efd5b7b33
commit 2d18ee8ef6
3 changed files with 20 additions and 9 deletions

View File

@@ -19,7 +19,8 @@ $(document).ready(function()
$(".search_input").focus();
$(".search_input").keyup(function(event) {
var search_input = $(this).val();
search_input = $(this).val();
console.log(search_input);
if(event.keyCode == 13 && search_input == "fireplace")
{
if(!peis)
@@ -114,16 +115,22 @@ $(document).keyup(function(e) {
function showSearch(){
$("#search-wrapper").toggleClass("hide");
if(window.mobilecheck())
{
$(".search-container").toggleClass("hide");
$(".search_input").focus();
}
$("#song-title").toggleClass("hide");
$("#second-song-title").toggleClass("hide");
$("#search").focus();
}
function search(search_input){
$("#results").html('');
if(search_input !== ""){
var keyword= encodeURIComponent(search_input);
$(".search_results").html('');
if(window.search_input !== ""){
var keyword= encodeURIComponent(window.search_input);
//response= http://nixo.no/txt/?4574f9b9dd286e0d#X+kzTvyFv5IrdkGQtqmoquhekDRCPJX9N24PSn86CFE=
//var yt_url = "https://www.googleapis.com/youtube/v3/search?videoEmbeddable=true&part=snippet&q=thefatrat&fields=items(id%2Csnippet)&type=video&videoDuration=medium&videoCategoryId=15&key=AIzaSyC3hq93zqwdwcjO8HyD9oToLLFotoAjyWo";

View File

@@ -75,6 +75,8 @@ socket.on(chan.toLowerCase()+",np", function(obj)
if(ytplayer.getDuration() > seekTo)
ytplayer.seekTo(seekTo);
}
else
getTitle(song_title, viewers);
}
});
@@ -209,13 +211,15 @@ function getTitle(titt, v)
{
var outPutWord = v > 1 ? "viewers" : "viewer";
var title= decodeURIComponent(titt);
var elem = document.getElementById('song-title');
if(!window.mobilecheck())
var elem = document.getElementById('song-title');
else
var elem = document.getElementById('second-song-title');
document.title = title + " • Zöff";
if(!window.mobilecheck()){
elem.innerHTML = title;
document.getElementById('viewers').innerHTML = v + " " + outPutWord;
elem.title = title + " • " + v + " " + outPutWord;
}
}
function errorHandler(newState)