Fixed errors with keydown and keyup on desktop

This commit is contained in:
Kasper Rynning-Tønnesen
2016-04-28 10:11:00 +02:00
parent 220f31b291
commit 34b83a1e05
5 changed files with 17 additions and 11 deletions

View File

@@ -200,11 +200,11 @@
<div id="playlist" class="col s12 m3">
<div id="top-button" title="Scroll to the top" class="rounded-bottom hide top-button-with-tabs hide-on-small-only">Top</div>
<div id="bottom-button" title="Scroll to the bottom" class="rounded-top hide hide-on-small-only">Bottom</div>
<ul class="tabs playlist-tabs" style="width:96%">
<ul class="tabs playlist-tabs hide" style="width:96%">
<li class="tab col s3"><a class="playlist-tab-links playlist-link active" href="#wrapper">Playlist</a></li>
<li class="tab col s3"><a class="playlist-tab-links chat-link" href="#chat">Chat</a></li>
</ul>
<ul class="tabs playlist-tabs-loggedIn hide" style="width: 96%;">
<ul class="tabs playlist-tabs-loggedIn" style="width: 96%;">
<li class="tab col s3"><a class="playlist-tab-links playlist-link active" href="#wrapper">Playlist</a></li>
<li class="tab col s3"><a class="playlist-tab-links suggested-link" href="#suggestions">Suggested</a></li>
<li class="tab col s3"><a class="playlist-tab-links chat-link" href="#chat">Chat</a></li>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -266,9 +266,8 @@ $(document).on("click", "#chat-btn", function(){
$("#favicon").attr("href", "static/images/favicon.png");
});
$(document).on('keydown', ".search_input", function(event) {
search_input = $(this).val();
function searchTimeout(event) {
search_input = $(".search_input").val();
code = event.keyCode || event.which;
@@ -286,9 +285,17 @@ $(document).on('keydown', ".search_input", function(event) {
timer=100;*/
}
}
}
});
if(/iPad|iPhone|iPod/.test(navigator.userAgent)){
$document.on('keydown', '.search_input', function(event) {
searchTimeout(event);
});
} else {
$(document).on('keyup', ".search_input", function(event) {
searchTimeout(event);
});
}
$(document).on("click", ".chat-tab", function(){
$("#text-chat-input").focus();

View File

@@ -24,7 +24,6 @@ var Search = {
if(window.search_input !== ""){
searching = true;
var keyword= encodeURIComponent(window.search_input);
//response= x
var yt_url = "https://www.googleapis.com/youtube/v3/search?key="+api_key+"&videoEmbeddable=true&part=id&fields=items(id)&type=video&order=viewCount&safeSearch=none&maxResults=25";
yt_url+="&q="+keyword;