forked from server/soundboard
fixed wrong js comment
This commit is contained in:
parent
64102b9396
commit
b6905e566c
@ -84,11 +84,11 @@ function addKeyListeners() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// TODO: make sure that only sound buttons get selected, not ALL a-tags. See d4377e0f49dc8dd5787f4466c9ab7f7e7cd37ec5#note_857
|
|
||||||
// keyboard listener for playing sounds using enter key
|
// keyboard listener for playing sounds using enter key
|
||||||
var all_a_s = document.getElementsByTagName("a");
|
var buttons = document.querySelectorAll(".sound");
|
||||||
for(i=0; i<all_a_s.length; i++) {
|
|
||||||
all_a_s[i].addEventListener('keypress', async function (e) {
|
buttons.forEach(function(item) {
|
||||||
|
item.firstChild.addEventListener('keypress', async function (e) {
|
||||||
var key = e.keyCode;
|
var key = e.keyCode;
|
||||||
var source = e.target;
|
var source = e.target;
|
||||||
// keylistener for enter or ctrl+enter (which is k10 on chrome)
|
// keylistener for enter or ctrl+enter (which is k10 on chrome)
|
||||||
@ -103,7 +103,7 @@ function addKeyListeners() {
|
|||||||
source.classList.remove("sound-pressed");
|
source.classList.remove("sound-pressed");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ function resetSearch() {
|
|||||||
/*
|
/*
|
||||||
* Reads the stream url from input with id #streaming-url and forwards it to the server using AJAX.
|
* Reads the stream url from input with id #streaming-url and forwards it to the server using AJAX.
|
||||||
*/
|
*/
|
||||||
function playStream(){
|
function playStream() {
|
||||||
var streamUrl = document.querySelector("#streaming-url").value;
|
var streamUrl = document.querySelector("#streaming-url").value;
|
||||||
ajaxRequest("/?video="+encodeURI(streamUrl));
|
ajaxRequest("/?video="+encodeURI(streamUrl));
|
||||||
}
|
}
|
||||||
@ -135,7 +135,7 @@ function hideSections() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function ajaxRequest(url){
|
function ajaxRequest(url) {
|
||||||
var ajaxRequest;
|
var ajaxRequest;
|
||||||
try{
|
try{
|
||||||
ajaxRequest = new XMLHttpRequest();
|
ajaxRequest = new XMLHttpRequest();
|
||||||
@ -150,8 +150,8 @@ function ajaxRequest(url){
|
|||||||
/*
|
/*
|
||||||
* Switches between local and remote playback mode.
|
* Switches between local and remote playback mode.
|
||||||
* Additionally changes the button text and its color so that the user has a visible feedback.
|
* Additionally changes the button text and its color so that the user has a visible feedback.
|
||||||
/*
|
*/
|
||||||
function toggleLocalMode(){
|
function toggleLocalMode() {
|
||||||
toggleButton = document.getElementById("local-mode-button").children[0];
|
toggleButton = document.getElementById("local-mode-button").children[0];
|
||||||
if(localModeEnabled){
|
if(localModeEnabled){
|
||||||
localModeEnabled = false;
|
localModeEnabled = false;
|
||||||
@ -169,7 +169,7 @@ function toggleLocalMode(){
|
|||||||
/*
|
/*
|
||||||
* Either plays the given sound file locally by using howler.js or forwards the request to the remote server using AJAX.
|
* Either plays the given sound file locally by using howler.js or forwards the request to the remote server using AJAX.
|
||||||
*/
|
*/
|
||||||
function playSound(filename){
|
function playSound(filename) {
|
||||||
if(localModeEnabled){
|
if(localModeEnabled){
|
||||||
// play local audio using howler.js
|
// play local audio using howler.js
|
||||||
var sound = new Howl({
|
var sound = new Howl({
|
||||||
@ -182,7 +182,7 @@ function playSound(filename){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function killAllHowlerAudio(){
|
function killAllHowlerAudio() {
|
||||||
for(i=0; i<howlerSounds.length; i++) {
|
for(i=0; i<howlerSounds.length; i++) {
|
||||||
howlerSounds[i].stop();
|
howlerSounds[i].stop();
|
||||||
}
|
}
|
||||||
@ -191,7 +191,7 @@ function killAllHowlerAudio(){
|
|||||||
/*
|
/*
|
||||||
* Kills all local or remote audio, depending on localModeEnabled
|
* Kills all local or remote audio, depending on localModeEnabled
|
||||||
*/
|
*/
|
||||||
function killAllAudio(){
|
function killAllAudio() {
|
||||||
if (localModeEnabled) {
|
if (localModeEnabled) {
|
||||||
killAllHowlerAudio();
|
killAllHowlerAudio();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user