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

@@ -25,7 +25,7 @@
<span class="hide-on-large-only">/</span> <span class="hide-on-large-only">/</span>
<span id="chan" class="chan clickable" title="Show big URL" onclick="show()"><?php echo(ucfirst($list));?></span> <span id="chan" class="chan clickable" title="Show big URL" onclick="show()"><?php echo(ucfirst($list));?></span>
</div> </div>
<ul class="title-container hide-on-med-and-down"> <ul class="title-container hide-on-med-and-down">
<li class="song-title" id="song-title" onclick="showSearch();"> <li class="song-title" id="song-title" onclick="showSearch();">
Loading... Loading...
@@ -64,7 +64,7 @@
<ul class="side-nav" id="settings-bar"> <ul class="side-nav" id="settings-bar">
<?php include("php/panel.php");?> <?php include("php/panel.php");?>
</ul> </ul>
<div id="results"></div> <div id="results" class="search_results"></div>
</div> </div>
<div class="nav-wrapper hide-on-large-only"> <div class="nav-wrapper hide-on-large-only">
<ul class="second-title-container"> <ul class="second-title-container">

View File

@@ -19,7 +19,8 @@ $(document).ready(function()
$(".search_input").focus(); $(".search_input").focus();
$(".search_input").keyup(function(event) { $(".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(event.keyCode == 13 && search_input == "fireplace")
{ {
if(!peis) if(!peis)
@@ -114,16 +115,22 @@ $(document).keyup(function(e) {
function showSearch(){ function showSearch(){
$("#search-wrapper").toggleClass("hide"); $("#search-wrapper").toggleClass("hide");
if(window.mobilecheck())
{
$(".search-container").toggleClass("hide");
$(".search_input").focus();
}
$("#song-title").toggleClass("hide"); $("#song-title").toggleClass("hide");
$("#second-song-title").toggleClass("hide");
$("#search").focus(); $("#search").focus();
} }
function search(search_input){ function search(search_input){
$("#results").html(''); $(".search_results").html('');
if(search_input !== ""){ if(window.search_input !== ""){
var keyword= encodeURIComponent(search_input); var keyword= encodeURIComponent(window.search_input);
//response= http://nixo.no/txt/?4574f9b9dd286e0d#X+kzTvyFv5IrdkGQtqmoquhekDRCPJX9N24PSn86CFE= //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"; //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) if(ytplayer.getDuration() > seekTo)
ytplayer.seekTo(seekTo); ytplayer.seekTo(seekTo);
} }
else
getTitle(song_title, viewers);
} }
}); });
@@ -209,13 +211,15 @@ function getTitle(titt, v)
{ {
var outPutWord = v > 1 ? "viewers" : "viewer"; var outPutWord = v > 1 ? "viewers" : "viewer";
var title= decodeURIComponent(titt); 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"; document.title = title + " • Zöff";
if(!window.mobilecheck()){
elem.innerHTML = title; elem.innerHTML = title;
document.getElementById('viewers').innerHTML = v + " " + outPutWord; document.getElementById('viewers').innerHTML = v + " " + outPutWord;
elem.title = title + " • " + v + " " + outPutWord; elem.title = title + " • " + v + " " + outPutWord;
}
} }
function errorHandler(newState) function errorHandler(newState)