Merge branch 'master' of github.com:zoff-music/zoff

This commit is contained in:
Kasper Rynning-Tønnesen
2018-04-27 12:57:08 +02:00
7 changed files with 245 additions and 227 deletions

View File

@@ -5,11 +5,11 @@ var gulp = require('gulp'),
gulp.task('js', function () { gulp.task('js', function () {
gulp.src(['server/VERSION.js', 'server/config/api_key.js', 'server/public/assets/js/*.js', '!server/public/assets/js/embed*', '!server/public/assets/js/token*', '!server/public/assets/js/remotecontroller.js', '!server/public/assets/js/callback.js']) gulp.src(['server/VERSION.js', 'server/config/api_key.js', 'server/public/assets/js/*.js', '!server/public/assets/js/embed*', '!server/public/assets/js/token*', '!server/public/assets/js/remotecontroller.js', '!server/public/assets/js/callback.js'])
.pipe(uglify({ /*.pipe(uglify({
mangle: true, mangle: true,
compress: true, compress: true,
enclose: true enclose: true
})) }))*/
.pipe(concat('main.min.js')) .pipe(concat('main.min.js'))
.pipe(gulp.dest('server/public/assets/dist')); .pipe(gulp.dest('server/public/assets/dist'));
}); });

View File

@@ -3014,6 +3014,7 @@ nav ul li:hover, nav ul li.active {
#controls{ #controls{
/*opacity: 1;*/ /*opacity: 1;*/
overflow: initial;
background-color: rgb(70, 70, 70); background-color: rgb(70, 70, 70);
height: 50px; height: 50px;
margin-top: inherit; margin-top: inherit;
@@ -3063,7 +3064,7 @@ nav ul li:hover, nav ul li.active {
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
background: #1c1c1c; background: inherit;
} }
.volume-container-cast { .volume-container-cast {

View File

@@ -422,21 +422,22 @@ var Channel = {
add_context_menu: function() { add_context_menu: function() {
addListener("contextmenu", ".vote-container", function(e) { addListener("contextmenu", ".vote-container", function(e) {
event.preventDefault(); this.preventDefault();
this.preventDefault();
var that = this; var that = this;
contextListener(that, e); contextListener(e, that);
}); });
addListener("contextmenu", ".add-suggested", function(e) { addListener("contextmenu", ".add-suggested", function(e) {
event.preventDefault(); this.preventDefault();
var that = this; var that = this;
contextListener(that, e); contextListener(e, that);
}); });
addListener("click", ".list-remove", function(e) { addListener("click", ".list-remove", function(e) {
event.preventDefault(); this.preventDefault();
var that = this; var that = this;
contextListener(that, e); contextListener(e, that);
}); });
}, },

View File

@@ -215,7 +215,7 @@ function get_list_ajax() {
}); });
} }
function contextListener(that, e) { function contextListener(that, event) {
var parent = that.parentElement; var parent = that.parentElement;
var suggested = false; var suggested = false;
if(parent.id.indexOf("suggested-") > -1) suggested = true; if(parent.id.indexOf("suggested-") > -1) suggested = true;
@@ -641,8 +641,8 @@ function change_offline(enabled, already_offline){
} }
function pagination_results(e) { function pagination_results(e) {
event.preventDefault(); this.preventDefault();
var that = this; var that = e;
var pageToken = that.getAttribute("data-pagination"); var pageToken = that.getAttribute("data-pagination");
var searchInput = that.getAttribute("data-original-search"); var searchInput = that.getAttribute("data-original-search");
@@ -652,22 +652,25 @@ function pagination_results(e) {
} }
function handleEvent(e, target, tried, type) { function handleEvent(e, target, tried, type) {
for(var y = 0; y < e.path.length; y++) { var path = e.path || (e.composedPath && e.composedPath());
var target = e.path[y]; if(path) {
for(var y = 0; y < path.length; y++) {
var target = path[y];
if(dynamicListeners[type] && dynamicListeners[type]["#" + target.id]) { if(dynamicListeners[type] && dynamicListeners[type]["#" + target.id]) {
dynamicListeners[type]["#" + target.id].call(target); dynamicListeners[type]["#" + target.id].call(e, target);
return; return;
} else { } else {
if(target.classList == undefined) return; if(target.classList == undefined) return;
for(var i = 0; i < target.classList.length; i++) { for(var i = 0; i < target.classList.length; i++) {
if(dynamicListeners[type] && dynamicListeners[type]["." + target.classList[i]]) { if(dynamicListeners[type] && dynamicListeners[type]["." + target.classList[i]]) {
dynamicListeners[type]["." + target.classList[i]].call(target); dynamicListeners[type]["." + target.classList[i]].call(e, target);
return; return;
} }
} }
} }
} }
} }
}
function addListener(type, element, callback) { function addListener(type, element, callback) {
if(dynamicListeners[type] == undefined) dynamicListeners[type] = {}; if(dynamicListeners[type] == undefined) dynamicListeners[type] = {};

View File

@@ -592,6 +592,9 @@ var Helper = {
var captcha_response = grecaptcha.getResponse(); var captcha_response = grecaptcha.getResponse();
Helper.ajax({ Helper.ajax({
type: "POST", type: "POST",
headers: {
"Content-Type": "application/json"
},
data: { data: {
from: from, from: from,
message: message, message: message,
@@ -606,6 +609,14 @@ var Helper = {
Helper.setHtml("#contact-container", ""); Helper.setHtml("#contact-container", "");
Helper.setHtml("#contact-container", "Something went wrong, sorry about that. You could instead try with your own mail-client: <a title='Open in client' href='mailto:contact@zoff.me?Subject=Contact%20Zoff'>contact@zoff.me</a>") Helper.setHtml("#contact-container", "Something went wrong, sorry about that. You could instead try with your own mail-client: <a title='Open in client' href='mailto:contact@zoff.me?Subject=Contact%20Zoff'>contact@zoff.me</a>")
} }
}, error: function(data) {
if(data == "success"){
Helper.setHtml("#contact-container", "");
Helper.setHtml("#contact-container", "Mail has been sent, we'll be back with you shortly.")
}else{
Helper.setHtml("#contact-container", "");
Helper.setHtml("#contact-container", "Something went wrong, sorry about that. You could instead try with your own mail-client: <a title='Open in client' href='mailto:contact@zoff.me?Subject=Contact%20Zoff'>contact@zoff.me</a>")
}
} }
}); });
} }

View File

@@ -319,7 +319,7 @@ var List = {
Helper.css(wrapperChildren.slice(List.page, List.page + List.can_fit), "display", "inline-flex"); Helper.css(wrapperChildren.slice(List.page, List.page + List.can_fit), "display", "inline-flex");
} else { } else {
Helper.css(wrapperChildren.slice(List.page - List.can_fit, List.page), "display", "inline-flex"); Helper.css(wrapperChildren.slice(List.page - List.can_fit, List.page), "display", "inline-flex");
Helper.addClass(wrapperChildren.slice(List.page, List.page + List.can_fit), "hide"); Helper.css(wrapperChildren.slice(List.page, List.page + List.can_fit), "display", "none");
List.page = List.page - List.can_fit < 0 ? 0 : List.page - List.can_fit; List.page = List.page - List.can_fit < 0 ? 0 : List.page - List.can_fit;
} }
if(List.page == 0 && document.querySelector(".prev_page").style.display != "none"){ if(List.page == 0 && document.querySelector(".prev_page").style.display != "none"){

View File

@@ -127,8 +127,8 @@ try{
.then(function (registration) { .then(function (registration) {
Helper.log(registration); Helper.log(registration);
}) })
.catch(function (e) { .catch(function (event) {
console.error(e); console.error(event);
}); });
} else { } else {
Helper.log('Service Worker is not supported in this browser.'); Helper.log('Service Worker is not supported in this browser.');
@@ -140,7 +140,7 @@ try{
} }
});*/ });*/
} catch(e) {} } catch(event) {}
window.zoff = { window.zoff = {
enable_debug: enable_debug, enable_debug: enable_debug,
@@ -231,7 +231,7 @@ setup_no_connection_listener();
initializeCastApi = function() { initializeCastApi = function() {
try { try {
if(cast == undefined) return; if(cast == undefined) return;
} catch(e) { } catch(event) {
return; return;
} }
cast.framework.CastContext.getInstance().setOptions({ cast.framework.CastContext.getInstance().setOptions({
@@ -257,7 +257,7 @@ initializeCastApi = function() {
var _seekTo; var _seekTo;
try{ try{
_seekTo = Player.player.getCurrentTime(); _seekTo = Player.player.getCurrentTime();
} catch(e){ } catch(event){
_seekTo = seekTo; _seekTo = seekTo;
} }
castSession.sendMessage("urn:x-cast:zoff.me", {type: "loadVideo", start: Player.np.start, end: Player.np.end, videoId: video_id, seekTo: _seekTo, channel: chan.toLowerCase()}) castSession.sendMessage("urn:x-cast:zoff.me", {type: "loadVideo", start: Player.np.start, end: Player.np.end, videoId: video_id, seekTo: _seekTo, channel: chan.toLowerCase()})
@@ -286,7 +286,7 @@ initializeCastApi = function() {
var _seekTo; var _seekTo;
try{ try{
_seekTo = Player.player.getCurrentTime(); _seekTo = Player.player.getCurrentTime();
} catch(e){ } catch(event){
_seekTo = seekTo; _seekTo = seekTo;
} }
castSession.sendMessage("urn:x-cast:zoff.me", {type: "loadVideo", start: Player.np.start, end: Player.np.end, videoId: video_id, seekTo: _seekTo, channel: chan.toLowerCase()}) castSession.sendMessage("urn:x-cast:zoff.me", {type: "loadVideo", start: Player.np.start, end: Player.np.end, videoId: video_id, seekTo: _seekTo, channel: chan.toLowerCase()})
@@ -338,7 +338,7 @@ initializeCastApi = function() {
} }
}; };
addListener("click", "#player_overlay", function(e) { addListener("click", "#player_overlay", function(event) {
if(chromecastAvailable) { if(chromecastAvailable) {
Player.playPauseVideo(); Player.playPauseVideo();
} }
@@ -346,7 +346,7 @@ addListener("click", "#player_overlay", function(e) {
addListener("click", "#bitcoin-address", function(e) { addListener("click", "#bitcoin-address", function(event) {
var copyTextarea = document.querySelector('#bitcoin-address'); var copyTextarea = document.querySelector('#bitcoin-address');
copyTextarea.select(); copyTextarea.select();
var successful = document.execCommand('copy'); var successful = document.execCommand('copy');
@@ -357,7 +357,7 @@ addListener("click", "#bitcoin-address", function(e) {
} }
}); });
addListener("click", "#ethereum-address", function(e) { addListener("click", "#ethereum-address", function(event) {
var copyTextarea = document.querySelector('#ethereum-address'); var copyTextarea = document.querySelector('#ethereum-address');
copyTextarea.select(); copyTextarea.select();
var successful = document.execCommand('copy'); var successful = document.execCommand('copy');
@@ -371,8 +371,7 @@ addListener("click", "#ethereum-address", function(e) {
addListener("click", ".prev-results-button", pagination_results); addListener("click", ".prev-results-button", pagination_results);
addListener("click", ".next-results-button", pagination_results); addListener("click", ".next-results-button", pagination_results);
addListener("click", "#settings", function(e) { addListener("click", "#settings", function(event) {
event.preventDefault();
var sidenavElem = document.getElementsByClassName("sidenav")[0]; var sidenavElem = document.getElementsByClassName("sidenav")[0];
if(!M.Sidenav.getInstance(document.querySelector(".sidenav")).isOpen) { if(!M.Sidenav.getInstance(document.querySelector(".sidenav")).isOpen) {
M.Sidenav.getInstance(sidenavElem).open(); M.Sidenav.getInstance(sidenavElem).open();
@@ -381,24 +380,24 @@ addListener("click", "#settings", function(e) {
} }
}); });
addListener("click", ".accept-delete", function(e) { addListener("click", ".accept-delete", function(event) {
event.preventDefault(); this.preventDefault();
emit("delete_all", {channel: chan.toLowerCase()}); emit("delete_all", {channel: chan.toLowerCase()});
M.Modal.getInstance(document.getElementById("delete_song_alert")).close(); M.Modal.getInstance(document.getElementById("delete_song_alert")).close();
}); });
addListener("click", "#chat_submit", function(e){ addListener("click", "#chat_submit", function(event){
event.preventDefault(); this.preventDefault();
event.stopPropagation(); this.stopPropagation();
Chat.chat(document.getElementById("chatForm").input); Chat.chat(document.getElementById("chatForm").input);
document.getElementById("chat_submit").focus(); document.getElementById("chat_submit").focus();
//return true; //return true;
//document.getElementById("chatForm").submit(); //document.getElementById("chatForm").submit();
}); });
addListener("click", "#offline-mode", function(e){ addListener("click", "#offline-mode", function(event){
event.preventDefault(); this.preventDefault();
if(!Crypt.get_offline()){ if(!Crypt.get_offline()){
change_offline(true, offline); change_offline(true, offline);
} else{ } else{
@@ -406,14 +405,14 @@ addListener("click", "#offline-mode", function(e){
} }
}); });
addListener("submit", "#thumbnail_form", function(e){ addListener("submit", "#thumbnail_form", function(event){
event.preventDefault(); this.preventDefault();
emit("suggest_thumbnail", {channel: chan, thumbnail: document.getElementById("chan_thumbnail").value}); emit("suggest_thumbnail", {channel: chan, thumbnail: document.getElementById("chan_thumbnail").value});
document.getElementById("chan_thumbnail").value = ""; document.getElementById("chan_thumbnail").value = "";
}); });
addListener("submit", "#description_form", function(e){ addListener("submit", "#description_form", function(event){
event.preventDefault(); this.preventDefault();
emit("suggest_description", {channel: chan, description: document.getElementById("chan_description").value}); emit("suggest_description", {channel: chan, description: document.getElementById("chan_description").value});
document.getElementById("chan_description").value = ""; document.getElementById("chan_description").value = "";
}); });
@@ -431,39 +430,39 @@ addListener("click", "#playpause-overlay", function(){
}); });
addListener("click", '#cookieok', function(e) { addListener("click", '#cookieok', function(e) {
event.preventDefault(); this.preventDefault();
M.Toast.getInstance(this.parentElement).dismiss(); M.Toast.getInstance(e.parentElement).dismiss();
localStorage.ok_cookie = true; localStorage.ok_cookie = true;
}); });
addListener("click", ".connect_error", function(e){ addListener("click", ".connect_error", function(event){
event.preventDefault(); this.preventDefault();
M.Toast.getInstance(this.parentElement).dismiss(); M.Toast.getInstance(this.parentElement).dismiss();
}); });
addListener("click", ".extra-button-search", function(e){ addListener("click", ".extra-button-search", function(e){
event.preventDefault(); this.preventDefault();
document.getElementById("search").value = this.getAttribute("data-text"); document.getElementById("search").value = e.getAttribute("data-text");
Search.search(this.getAttribute("data-text")); Search.search(e.getAttribute("data-text"));
}); });
addListener("click", ".extra-button-delete", function(e){ addListener("click", ".extra-button-delete", function(e){
event.preventDefault(); this.preventDefault();
this.parentElement.remove(); e.parentElement.remove();
if(document.querySelector(".not-imported-container").children.length === 0){ if(document.querySelector(".not-imported-container").children.length === 0){
Helper.toggleClass(".not-imported", "hide"); Helper.toggleClass(".not-imported", "hide");
} }
}); });
addListener("click", "#context-menu-overlay", function(e) { addListener("click", "#context-menu-overlay", function(event) {
Helper.addClass(".context-menu-root", "hide"); Helper.addClass(".context-menu-root", "hide");
Helper.addClass("#context-menu-overlay", "hide"); Helper.addClass("#context-menu-overlay", "hide");
Helper.addClass(".context-menu-root", "data-id", ""); Helper.addClass(".context-menu-root", "data-id", "");
}); });
addListener("click", ".copy-context-menu", function(e) { addListener("click", ".copy-context-menu", function(e) {
event.preventDefault(); this.preventDefault();
var that = this; var that = e;
var parent = that.parentElement; var parent = that.parentElement;
var id = parent.getAttribute("data-id"); var id = parent.getAttribute("data-id");
if(id != "") { if(id != "") {
@@ -485,8 +484,8 @@ addListener("click", ".copy-context-menu", function(e) {
}); });
addListener("click", ".find-context-menu", function(e) { addListener("click", ".find-context-menu", function(e) {
event.preventDefault(); this.preventDefault();
var that = this; var that = e;
var parent = that.parentElement; var parent = that.parentElement;
var id = parent.getAttribute("data-id"); var id = parent.getAttribute("data-id");
Search.search(id, false, true); Search.search(id, false, true);
@@ -499,7 +498,7 @@ addListener("click", ".find-context-menu", function(e) {
}); });
addListener("click", ".delete-context-menu", function(e) { addListener("click", ".delete-context-menu", function(e) {
var that = this; var that = e;
if(that.classList.contains("context-menu-disabled")) { if(that.classList.contains("context-menu-disabled")) {
return; return;
} }
@@ -525,8 +524,8 @@ addListener("click", ".delete-context-menu", function(e) {
document.getElementsByClassName("context-menu-root")[0].setAttribute("data-id", ""); document.getElementsByClassName("context-menu-root")[0].setAttribute("data-id", "");
}) })
addListener("click", "#closePlayer", function(e){ addListener("click", "#closePlayer", function(event){
event.preventDefault(); this.preventDefault();
socket.emit("change_channel"); socket.emit("change_channel");
try{ try{
if(chromecastAvailable){ if(chromecastAvailable){
@@ -546,14 +545,14 @@ addListener("click", "#closePlayer", function(e){
Helper.removeElement("#closePlayer"); Helper.removeElement("#closePlayer");
}); });
document.addEventListener("keydown", function(e) { document.addEventListener("keydown", function(event) {
if(window.location.pathname != "/"){ if(window.location.pathname != "/"){
if(event.keyCode == 91 || event.keyCode == 17){ if(event.keyCode == 91 || event.keyCode == 17){
find_start = true; find_start = true;
} else if(find_start && event.keyCode == 70){ } else if(find_start && event.keyCode == 70){
find_start = false; find_start = false;
find_started = !find_started; find_started = !find_started;
event.preventDefault(); this.preventDefault();
if(find_started){ if(find_started){
Helper.toggleClass("#find_div", "hide"); Helper.toggleClass("#find_div", "hide");
document.getElementById("find_input").focus(); document.getElementById("find_input").focus();
@@ -580,11 +579,11 @@ document.addEventListener("keydown", function(e) {
document.querySelector("#find_input") != document.activeElement && document.querySelector("#find_input") != document.activeElement &&
document.querySelector("#import_spotify") != document.activeElement) { document.querySelector("#import_spotify") != document.activeElement) {
if(Player.player.getPlayerState() == 1) { if(Player.player.getPlayerState() == 1) {
event.preventDefault(); this.preventDefault();
Player.player.pauseVideo(); Player.player.pauseVideo();
return false; return false;
} else if(Player.player.getPlayerState() == 2 || Player.player.getPlayerState() == 5) { } else if(Player.player.getPlayerState() == 2 || Player.player.getPlayerState() == 5) {
event.preventDefault(); this.preventDefault();
Player.player.playVideo(); Player.player.playVideo();
return false; return false;
} }
@@ -594,7 +593,7 @@ document.addEventListener("keydown", function(e) {
} }
}, false); }, false);
document.addEventListener("keyup", function(e) { document.addEventListener("keyup", function(event) {
if(event.keyCode == 27 && window.location.path != "/"){ if(event.keyCode == 27 && window.location.path != "/"){
//$("#results").html(""); //$("#results").html("");
if(document.querySelectorAll("#search-wrapper").length != 0 && !document.querySelector("#search-wrapper").classList.contains("hide")) { if(document.querySelectorAll("#search-wrapper").length != 0 && !document.querySelector("#search-wrapper").classList.contains("hide")) {
@@ -618,7 +617,7 @@ document.addEventListener("keyup", function(e) {
if(document.querySelectorAll(".search-container").length != 0 && !document.querySelector(".search-container").classList.contains("hide")){ if(document.querySelectorAll(".search-container").length != 0 && !document.querySelector(".search-container").classList.contains("hide")){
Helper.toggleClass("#results", "hide"); Helper.toggleClass("#results", "hide");
} }
} else if(event.keyCode == 13 && window.location.path != "/" && document.querySelector("#search").value == "fireplace" && !document.querySelector(".search-container").classList.contains("hide") && window.location.pathname != "/") { } else if(event.keyCode == 13 && window.location.path != "/" && document.querySelectorAll("#search").length > 0 && document.querySelector("#search").value == "fireplace" && !document.querySelector(".search-container").classList.contains("hide") && window.location.pathname != "/") {
clearTimeout(timeout_search); clearTimeout(timeout_search);
Helper.setHtml("#results", ""); Helper.setHtml("#results", "");
document.querySelector("#search").value = ""; document.querySelector("#search").value = "";
@@ -652,11 +651,11 @@ document.addEventListener("keyup", function(e) {
} }
}, false); }, false);
document.addEventListener("click", function(e) { document.addEventListener("click", function(event) {
handleEvent(e, e.target, false, "click"); handleEvent(event, event.target, false, "click");
}, true); }, true);
document.addEventListener("mouseleave", function(e) { document.addEventListener("mouseleave", function(event) {
if(event.target.className == "card sticky-action") { if(event.target.className == "card sticky-action") {
var that = event.target; var that = event.target;
that.querySelector(".card-reveal").setAttribute("style", "display: block;transform: translateY(0%);"); that.querySelector(".card-reveal").setAttribute("style", "display: block;transform: translateY(0%);");
@@ -667,7 +666,7 @@ document.addEventListener("mouseleave", function(e) {
} }
}, true); }, true);
document.addEventListener("mouseenter", function(e) { document.addEventListener("mouseenter", function(event) {
if(event.target.className == "card sticky-action") { if(event.target.className == "card sticky-action") {
var that = event.target; var that = event.target;
that.querySelector(".card-reveal").setAttribute("style", "display: block;"); that.querySelector(".card-reveal").setAttribute("style", "display: block;");
@@ -678,47 +677,47 @@ document.addEventListener("mouseenter", function(e) {
} }
}, true); }, true);
document.addEventListener("contextmenu", function(e) { document.addEventListener("contextmenu", function(event) {
handleEvent(e, e.target, false, "contextmenu"); handleEvent(event, event.target, false, "contextmenu");
}, true); }, true);
document.addEventListener("input", function(e) { document.addEventListener("input", function(event) {
handleEvent(e, e.target, false, "input"); handleEvent(event, event.target, false, "input");
}, true); }, true);
document.addEventListener("change", function(e) { document.addEventListener("change", function(event) {
handleEvent(e, e.target, false, "change"); handleEvent(event, event.target, false, "change");
}, true); }, true);
document.addEventListener("submit", function(e) { document.addEventListener("submit", function(event) {
handleEvent(e, e.target, false, "submit"); handleEvent(event, event.target, false, "submit");
}, true); }, true);
addListener("change", "#width_embed", function() { addListener("change", "#width_embed", function(event) {
var that = event.target; var that = this.target;
embed_width = that.value; embed_width = that.value;
document.getElementById("embed-area").value = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly); document.getElementById("embed-area").value = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly);
}); });
addListener("change", "#height_embed", function() { addListener("change", "#height_embed", function(event) {
var that = event.target; var that = this.target;
embed_height = that.value; embed_height = that.value;
document.getElementById("embed-area").value = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly); document.getElementById("embed-area").value = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly);
}); });
addListener("click", ".prev_page", function(e) { addListener("click", ".prev_page", function(event) {
//addListener("click", ".prev_page", function(e){ //addListener("click", ".prev_page", function(event){
event.preventDefault(); this.preventDefault();
List.dynamicContentPage(-1); List.dynamicContentPage(-1);
}); });
addListener("click", ".modal-close", function(e){ addListener("click", ".modal-close", function(event){
event.preventDefault(); this.preventDefault();
}); });
/* /*
addListener("change", ".password_protected", function(e) { addListener("change", ".password_protected", function(event) {
event.preventDefault(); this.preventDefault();
if(this.checked) { if(this.checked) {
M.Modal.getInstance(document.getElementById("user_password")).open(); M.Modal.getInstance(document.getElementById("user_password")).open();
document.getElementById("user-pass-input").focus(); document.getElementById("user-pass-input").focus();
@@ -729,8 +728,8 @@ addListener("change", ".password_protected", function(e) {
} }
});*/ });*/
addListener("submit", "#user-password-channel-form", function(e) { addListener("submit", "#user-password-channel-form", function(event) {
event.preventDefault(); this.preventDefault();
if(user_auth_started) { if(user_auth_started) {
temp_user_pass = document.getElementById("user-pass-input").value; temp_user_pass = document.getElementById("user-pass-input").value;
@@ -745,19 +744,19 @@ addListener("submit", "#user-password-channel-form", function(e) {
} }
}); });
addListener("click", ".change_user_pass_btn", function(e) { addListener("click", ".change_user_pass_btn", function(event) {
event.preventDefault(); this.preventDefault();
user_change_password = true; user_change_password = true;
M.Modal.getInstance(document.getElementById("user_password")).open(); M.Modal.getInstance(document.getElementById("user_password")).open();
document.getElementById("user-pass-input").focus(); document.getElementById("user-pass-input").focus();
}); });
addListener("contextmenu", "#context-menu-overlay", function(e) { addListener("contextmenu", "#context-menu-overlay", function(event) {
event.preventDefault(); this.preventDefault();
}); });
addListener("click", ".submit-user-password", function(e) { addListener("click", ".submit-user-password", function(event) {
event.preventDefault(); this.preventDefault();
if(user_auth_started) { if(user_auth_started) {
temp_user_pass = document.getElementById("user-pass-input").value; temp_user_pass = document.getElementById("user-pass-input").value;
document.getElementById("user-pass-input").value = ""; document.getElementById("user-pass-input").value = "";
@@ -794,32 +793,32 @@ addListener("click", ".close-user-password", function() {
} }
}); });
addListener("click", ".delete-all-songs", function(e){ addListener("click", ".delete-all-songs", function(event){
event.preventDefault(); this.preventDefault();
M.Modal.getInstance(document.getElementById("delete_song_alert")).open(); M.Modal.getInstance(document.getElementById("delete_song_alert")).open();
}); });
addListener("click", ".extra-add-text", function(){ addListener("click", ".extra-add-text", function(e){
this.select(); e.select();
}); });
addListener("click", ".next_page", function(e){ addListener("click", ".next_page", function(event){
event.preventDefault(); this.preventDefault();
List.dynamicContentPage(1); List.dynamicContentPage(1);
}); });
addListener("click", ".last_page", function(e){ addListener("click", ".last_page", function(event){
event.preventDefault(); this.preventDefault();
List.dynamicContentPage(10); List.dynamicContentPage(10);
}); });
addListener("click", ".first_page", function(e){ addListener("click", ".first_page", function(event){
event.preventDefault(); this.preventDefault();
List.dynamicContentPage(-10); List.dynamicContentPage(-10);
}); });
addListener("click", ".donate-button", function(e) { addListener("click", ".donate-button", function(event) {
event.preventDefault(); this.preventDefault();
ga('send', 'event', "button-click", "donate"); ga('send', 'event', "button-click", "donate");
M.Modal.getInstance(document.getElementById("donate")).open(); M.Modal.getInstance(document.getElementById("donate")).open();
}); });
@@ -833,7 +832,7 @@ addListener("click", "#aprilfools", function(){
Helper.css(".mega", "-moz-transform", "rotate(0deg)"); Helper.css(".mega", "-moz-transform", "rotate(0deg)");
}); });
addListener("change", '#view_channels_select', function(e) { addListener("change", '#view_channels_select', function(event) {
var that = this; var that = this;
if(currently_showing_channels != parseInt(that.value)) { if(currently_showing_channels != parseInt(that.value)) {
Frontpage.populate_channels(Frontpage.all_channels, (parseInt(that.value) == 1 ? true : false)); Frontpage.populate_channels(Frontpage.all_channels, (parseInt(that.value) == 1 ? true : false));
@@ -841,27 +840,27 @@ addListener("change", '#view_channels_select', function(e) {
currently_showing_channels = parseInt(that.value); currently_showing_channels = parseInt(that.value);
}); });
addListener("input", '#color_embed', function(){ addListener("input", '#color_embed', function(e){
var that = this; var that = e;
color = that.value.substring(1); color = that.value.substring(1);
document.getElementById("embed-area").value = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly); document.getElementById("embed-area").value = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly);
}); });
addListener("click", ".chan-link", function(e){ addListener("click", ".chan-link", function(e){
event.preventDefault(); this.preventDefault();
var href = this.href.replace(window.location.protocol + "//" + window.location.hostname + "/", ""); var href = e.href.replace(window.location.protocol + "//" + window.location.hostname + "/", "");
Frontpage.to_channel(href, false); Frontpage.to_channel(href, false);
}); });
addListener("click", ".listen-button", function(e){ addListener("click", ".listen-button", function(event){
if(document.querySelector(".room-namer").value === ""){ if(document.querySelector(".room-namer").value === ""){
event.preventDefault(); this.preventDefault();
Frontpage.to_channel(document.querySelector(".room-namer").getAttribute("placeholder")); Frontpage.to_channel(document.querySelector(".room-namer").getAttribute("placeholder"));
} }
}); });
addListener("submit", ".channel-finder", function(e){ addListener("submit", ".channel-finder", function(event){
event.preventDefault(); this.preventDefault();
Frontpage.to_channel(document.querySelector(".room-namer").value); Frontpage.to_channel(document.querySelector(".room-namer").value);
return false; return false;
}); });
@@ -878,11 +877,11 @@ addListener("change", '.offline_switch_class', function()
change_offline(offline, !offline); change_offline(offline, !offline);
}); });
addListener("change", '.conf', function() addListener("change", '.conf', function(e)
{ {
event.preventDefault(); this.preventDefault();
if(this.classList.contains("password_protected")) { if(e.classList.contains("password_protected")) {
if(this.checked) { if(e.checked) {
M.Modal.getInstance(document.getElementById("user_password")).open(); M.Modal.getInstance(document.getElementById("user_password")).open();
document.getElementById("user-pass-input").focus(); document.getElementById("user-pass-input").focus();
} else { } else {
@@ -899,8 +898,8 @@ addListener("click", "#clickme", function(){
Player.playVideo(); Player.playVideo();
}); });
addListener("click", "#listExport", function(e){ addListener("click", "#listExport", function(event){
event.preventDefault(); this.preventDefault();
if(!youtube_authenticated){ if(!youtube_authenticated){
var nonce = Helper.randomString(29); var nonce = Helper.randomString(29);
window.callback = function(data) { window.callback = function(data) {
@@ -928,8 +927,8 @@ addListener("click", "#listExport", function(e){
} }
}); });
addListener("click", ".export-spotify-auth", function(e){ addListener("click", ".export-spotify-auth", function(event){
event.preventDefault(); this.preventDefault();
var nonce = Helper.randomString(29); var nonce = Helper.randomString(29);
window.callback = function(data) { window.callback = function(data) {
access_token_data = data; access_token_data = data;
@@ -953,8 +952,8 @@ addListener("click", ".export-spotify-auth", function(e){
spotify_window = window.open("/o_callback#spotify=true&nonce=" + nonce, "", "width=600, height=600"); spotify_window = window.open("/o_callback#spotify=true&nonce=" + nonce, "", "width=600, height=600");
}); });
addListener("submit", "#listImport", function(e){ addListener("submit", "#listImport", function(event){
event.preventDefault(); this.preventDefault();
var url = document.getElementById("import").value.split("https://www.youtube.com/playlist?list="); var url = document.getElementById("import").value.split("https://www.youtube.com/playlist?list=");
if(document.getElementById("import").value !== "" && url.length == 2){ if(document.getElementById("import").value !== "" && url.length == 2){
Search.importPlaylist(url[1]); Search.importPlaylist(url[1]);
@@ -971,8 +970,8 @@ addListener("submit", "#listImport", function(e){
document.getElementById("import").value = ""; document.getElementById("import").value = "";
}); });
addListener("submit", "#listImportZoff", function(e) { addListener("submit", "#listImportZoff", function(event) {
event.preventDefault(); this.preventDefault();
var new_channel = document.getElementById("import_zoff").value; var new_channel = document.getElementById("import_zoff").value;
document.getElementById("import_zoff").value = ""; document.getElementById("import_zoff").value = "";
if(new_channel == "") { if(new_channel == "") {
@@ -982,14 +981,14 @@ addListener("submit", "#listImportZoff", function(e) {
socket.emit("import_zoff", {channel: chan.toLowerCase(), new_channel: new_channel.toLowerCase()}); socket.emit("import_zoff", {channel: chan.toLowerCase(), new_channel: new_channel.toLowerCase()});
}); });
addListener("click", ".import-zoff", function(e) { addListener("click", ".import-zoff", function(event) {
event.preventDefault(); this.preventDefault();
Helper.addClass(".import-zoff-container", "hide"); Helper.addClass(".import-zoff-container", "hide");
Helper.removeClass(".zoff_add_field", "hide"); Helper.removeClass(".zoff_add_field", "hide");
}); });
addListener("submit", "#listImportSpotify", function(e){ addListener("submit", "#listImportSpotify", function(event){
event.preventDefault(); this.preventDefault();
if(spotify_authenticated && document.getElementById("import_spotify").value !== ""){ if(spotify_authenticated && document.getElementById("import_spotify").value !== ""){
var url = document.getElementById("import_spotify").value.split("https://open.spotify.com/user/"); var url = document.getElementById("import_spotify").value.split("https://open.spotify.com/user/");
if(url.length == 2) { if(url.length == 2) {
@@ -1013,39 +1012,39 @@ addListener("submit", "#listImportSpotify", function(e){
document.getElementById("import_spotify").value = ""; document.getElementById("import_spotify").value = "";
}); });
addListener("change", "#autoplay", function() { addListener("change", "#autoplay", function(e) {
if(this.checked) embed_autoplay = "&autoplay"; if(e.checked) embed_autoplay = "&autoplay";
else embed_autoplay = ""; else embed_autoplay = "";
document.getElementById("embed-area").value = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly); document.getElementById("embed-area").value = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly);
}); });
addListener("change", "#videoonly", function() { addListener("change", "#videoonly", function(e) {
if(this.checked) embed_videoonly = "&videoonly"; if(e.checked) embed_videoonly = "&videoonly";
else embed_videoonly = ""; else embed_videoonly = "";
document.getElementById("embed-area").value = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly); document.getElementById("embed-area").value = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly);
}); });
addListener("click", "#playbutton_remote", function(e) { addListener("click", "#playbutton_remote", function(event) {
event.preventDefault(); this.preventDefault();
Mobile_remote.play_remote(); Mobile_remote.play_remote();
}); });
addListener("click", "#pausebutton_remote", function(e) { addListener("click", "#pausebutton_remote", function(event) {
event.preventDefault(); this.preventDefault();
Mobile_remote.pause_remote(); Mobile_remote.pause_remote();
}); });
addListener("click", "#skipbutton_remote", function(e) { addListener("click", "#skipbutton_remote", function(event) {
event.preventDefault(); this.preventDefault();
Mobile_remote.skip_remote(); Mobile_remote.skip_remote();
}); });
addListener("click", ".skip_next_client", function(e) { addListener("click", ".skip_next_client", function(event) {
event.preventDefault(); this.preventDefault();
}); });
addListener("submit", "#remoteform", function(e) { addListener("submit", "#remoteform", function(event) {
event.preventDefault(); this.preventDefault();
Mobile_remote.get_input(document.getElementById("remote_channel").value); Mobile_remote.get_input(document.getElementById("remote_channel").value);
}); });
@@ -1057,23 +1056,23 @@ addListener("click", ".chat-tab", function(){
document.getElementById("text-chat-input").focus(); document.getElementById("text-chat-input").focus();
}); });
addListener("click", ".prev", function(e){ addListener("click", ".prev", function(event){
event.preventDefault(); this.preventDefault();
List.skip(false); List.skip(false);
}); });
addListener("click", ".skip", function(e){ addListener("click", ".skip", function(event){
event.preventDefault(); this.preventDefault();
List.skip(true); List.skip(true);
}); });
addListener("click", "#chan", function(e){ addListener("click", "#chan", function(event){
event.preventDefault(); this.preventDefault();
List.show(); List.show();
}); });
addListener("submit", "#adminForm", function(e){ addListener("submit", "#adminForm", function(event){
event.preventDefault(); this.preventDefault();
Admin.pass_save(); Admin.pass_save();
}); });
@@ -1081,7 +1080,7 @@ addListener("click", "#channel-share-modal", function(){
M.Modal.getInstance(document.getElementById("channel-share-modal")).close(); M.Modal.getInstance(document.getElementById("channel-share-modal")).close();
}); });
addListener("click", ".shareface", function(e) { addListener("click", ".shareface", function(event) {
ga('send', 'event', "button-click", "share-facebook"); ga('send', 'event', "button-click", "share-facebook");
}); });
@@ -1103,7 +1102,7 @@ addListener("click", "#embed-button", function() {
addListener("click", ".playlist-link", function(e){ addListener("click", ".playlist-link", function(event){
chat_active = false; chat_active = false;
Helper.css("#chat-container", "display", "none"); Helper.css("#chat-container", "display", "none");
Helper.css("#wrapper", "display", "block"); Helper.css("#wrapper", "display", "block");
@@ -1111,7 +1110,7 @@ addListener("click", ".playlist-link", function(e){
Helper.css("#pageButtons", "display", "flex"); Helper.css("#pageButtons", "display", "flex");
}); });
addListener("click", ".suggested-link", function(e){ addListener("click", ".suggested-link", function(event){
chat_active = false; chat_active = false;
Helper.css("#chat-container", "display", "none"); Helper.css("#chat-container", "display", "none");
Helper.css("#wrapper", "display", "none"); Helper.css("#wrapper", "display", "none");
@@ -1119,8 +1118,8 @@ addListener("click", ".suggested-link", function(e){
Helper.css("#pageButtons", "display", "none"); Helper.css("#pageButtons", "display", "none");
}); });
addListener("click", ".import-spotify-auth", function(e){ addListener("click", ".import-spotify-auth", function(event){
event.preventDefault(); this.preventDefault();
var nonce = Helper.randomString(29); var nonce = Helper.randomString(29);
window.callback = function(data) { window.callback = function(data) {
access_token_data = data; access_token_data = data;
@@ -1144,46 +1143,46 @@ addListener("click", ".import-spotify-auth", function(e){
spotify_window = window.open("/o_callback#spotify=true&nonce=" + nonce, "", "width=600, height=600"); spotify_window = window.open("/o_callback#spotify=true&nonce=" + nonce, "", "width=600, height=600");
}); });
addListener("click", ".import-youtube", function(e){ addListener("click", ".import-youtube", function(event){
event.preventDefault(); this.preventDefault();
Helper.css(".youtube_unclicked", "display", "none"); Helper.css(".youtube_unclicked", "display", "none");
Helper.css(".youtube_clicked", "display", "block"); Helper.css(".youtube_clicked", "display", "block");
}); });
addListener("submit", "#chatForm", function(e){ addListener("submit", "#chatForm", function(event){
event.preventDefault(); this.preventDefault();
event.stopPropagation(); this.stopPropagation();
Chat.chat(document.getElementById("chatForm").input); Chat.chat(document.getElementById("chatForm").input);
return false; return false;
}); });
addListener("click", "#shuffle", function(e) addListener("click", "#shuffle", function(event)
{ {
event.preventDefault(); this.preventDefault();
Admin.shuffle(); Admin.shuffle();
}); });
addListener("click", "#search-btn", function(e) addListener("click", "#search-btn", function(event)
{ {
//event.preventDefault(); this.preventDefault();
Search.showSearch(); Search.showSearch();
}); });
addListener("click", "#song-title", function(e) addListener("click", "#song-title", function(event)
{ {
event.preventDefault(); this.preventDefault();
Search.showSearch(); Search.showSearch();
}); });
addListener("click", "#admin-lock", function(e) addListener("click", "#admin-lock", function(event)
{ {
event.preventDefault(); this.preventDefault();
Admin.log_out(); Admin.log_out();
}); });
addListener("click", "#closeSettings", function(e) addListener("click", "#closeSettings", function(event)
{ {
event.preventDefault(); //this.preventDefault();
Admin.hide_settings(); Admin.hide_settings();
}); });
@@ -1218,14 +1217,14 @@ window.addEventListener("resize", function(){
}); });
addListener("click", ".result-object", function(e){ addListener("click", ".result-object", function(e){
var html = event.target; var html = this.target;
var substr = event.target.outerHTML.substring(0,4); var substr = this.target.outerHTML.substring(0,4);
if(substr != "<i c" && !html.classList.contains("waves-effect") && !html.classList.contains("result-start") && !html.classList.contains("result-end") && !html.classList.contains("result-get-more-info")){ if(substr != "<i c" && !html.classList.contains("waves-effect") && !html.classList.contains("result-start") && !html.classList.contains("result-end") && !html.classList.contains("result-get-more-info")){
var id = this.getAttribute("data-video-id"); var id = e.getAttribute("data-video-id");
var title = this.getAttribute("data-video-title"); var title = e.getAttribute("data-video-title");
var original_length = this.getAttribute("data-video-length"); var original_length = e.getAttribute("data-video-length");
var start = parseInt(this.querySelector(".result-start").value); var start = parseInt(e.querySelector(".result-start").value);
var end = parseInt(this.querySelector(".result-end").value); var end = parseInt(e.querySelector(".result-end").value);
if(end > original_length) { if(end > original_length) {
end = original_length; end = original_length;
} }
@@ -1237,15 +1236,15 @@ addListener("click", ".result-object", function(e){
try { try {
var length = parseInt(end) - parseInt(start); var length = parseInt(end) - parseInt(start);
Search.submitAndClose(id, title, length, start, end); Search.submitAndClose(id, title, length, start, end);
} catch(e) { } catch(err) {
M.toast({html: "Only numbers are accepted as song start and end parameters..", displayLength: 3000, classes: "red lighten"}); M.toast({html: "Only numbers are accepted as song start and end parameters..", displayLength: 3000, classes: "red lighten"});
} }
} }
} }
}); });
addListener("click", ".result-get-more-info", function(e) { addListener("click", ".result-get-more-info", function(event) {
event.preventDefault(); this.preventDefault();
var that = this; var that = this;
var parent = that.parentElement.parentElement.parentElement.parentElement; var parent = that.parentElement.parentElement.parentElement.parentElement;
var videoId = parent.getAttribute("data-video-id"); var videoId = parent.getAttribute("data-video-id");
@@ -1259,26 +1258,29 @@ addListener("click", ".result-get-more-info", function(e) {
} }
}) })
addListener("click", '#submit-contact-form', function(e) { addListener("click", '#submit-contact-form', function(event) {
event.preventDefault(); this.preventDefault();
document.getElementById("contact-form").submit(); var message = document.getElementById("contact-form-message").value;
var from = document.getElementById("contact-form-from").value;
Helper.send_mail(from, message);
//document.getElementById("contact-form").submit();
}); });
addListener("submit", '#contact-form', function(e){ addListener("submit", '#contact-form', function(event){
event.preventDefault(); this.preventDefault();
var message = document.getElementById("contact-form-message").value; var message = document.getElementById("contact-form-message").value;
var from = document.getElementById("contact-form-from").value; var from = document.getElementById("contact-form-from").value;
Helper.send_mail(from, message); Helper.send_mail(from, message);
}); });
addListener("click", ".send-error-modal", function(e) { addListener("click", ".send-error-modal", function(event) {
event.preventDefault(); this.preventDefault();
document.getElementById("error-report-form").submit(); document.getElementById("error-report-form").submit();
}) })
addListener("submit", "#error-report-form", function(e) { addListener("submit", "#error-report-form", function(event) {
event.preventDefault(); this.preventDefault();
var captcha_response = grecaptcha.getResponse(); var captcha_response = grecaptcha.getResponse();
Helper.removeClass("#send-loader", "hide"); Helper.removeClass("#send-loader", "hide");
Helper.ajax({ Helper.ajax({
@@ -1306,12 +1308,12 @@ addListener("submit", "#error-report-form", function(e) {
}); });
addListener("click", "#add-many", function(e){ addListener("click", "#add-many", function(e){
event.preventDefault(); this.preventDefault();
event.stopPropagation(); this.stopPropagation();
var id = this.getAttribute("data-video-id"); var id = e.getAttribute("data-video-id");
var title = this.getAttribute("data-video-title"); var title = e.getAttribute("data-video-title");
var original_length = this.getAttribute("data-video-length"); var original_length = e.getAttribute("data-video-length");
var parent = this.parentElement.parentElement; var parent = e.parentElement.parentElement;
var start = parseInt(parent.querySelectorAll(".result-start")[0].value); var start = parseInt(parent.querySelectorAll(".result-start")[0].value);
var end = parseInt(parent.querySelectorAll(".result-end")[0].value); var end = parseInt(parent.querySelectorAll(".result-end")[0].value);
@@ -1325,30 +1327,30 @@ addListener("click", "#add-many", function(e){
} else { } else {
try { try {
var length = parseInt(end) - parseInt(start); var length = parseInt(end) - parseInt(start);
this.parentElement.parentElement.parentElement.remove(); e.parentElement.parentElement.parentElement.remove();
Search.submit(id, title, length, false, 0, 1, start, end); Search.submit(id, title, length, false, 0, 1, start, end);
} catch(e) { } catch(event) {
M.toast({html: "Only numbers are accepted as song start and end parameters..", displayLength: 3000, classes: "red lighten"}); M.toast({html: "Only numbers are accepted as song start and end parameters..", displayLength: 3000, classes: "red lighten"});
} }
} }
}); });
addListener("click", ".vote-container", function(e){ addListener("click", ".vote-container", function(e, target){
var id = this.getAttribute("data-video-id"); var id = e.getAttribute("data-video-id");
List.vote(id, "pos"); List.vote(id, "pos");
}); });
addListener("click", ".delete_button", function(e){ addListener("click", ".delete_button", function(e){
var id = this.getAttribute("data-video-id"); var id = e.getAttribute("data-video-id");
List.vote(id, "del"); List.vote(id, "del");
}); });
addListener("click", ".add-suggested", function(e){ addListener("click", ".add-suggested", function(e){
var id = this.getAttribute("data-video-id"); var id = e.getAttribute("data-video-id");
var title = this.getAttribute("data-video-title"); var title = e.getAttribute("data-video-title");
var length = this.getAttribute("data-video-length"); var length = e.getAttribute("data-video-length");
var added_by = this.getAttribute("data-added-by"); var added_by = e.getAttribute("data-added-by");
Search.submit(id, title, parseInt(length), false, 0, 1, 0, parseInt(length)); Search.submit(id, title, parseInt(length), false, 0, 1, 0, parseInt(length));
if(added_by == "user") { if(added_by == "user") {
number_suggested = number_suggested - 1; number_suggested = number_suggested - 1;
@@ -1367,13 +1369,13 @@ addListener("click", ".add-suggested", function(e){
}); });
addListener("click", ".del_suggested", function(e){ addListener("click", ".del_suggested", function(e){
var id = this.getAttribute("data-video-id"); var id = e.getAttribute("data-video-id");
Helper.removeElement("#suggested-" + id); Helper.removeElement("#suggested-" + id);
}); });
addListener("click", ".del_user_suggested", function(e){ addListener("click", ".del_user_suggested", function(e){
var id = this.getAttribute("data-video-id"); var id = e.getAttribute("data-video-id");
Helper.removeElement("#suggested-" + id); Helper.removeElement("#suggested-" + id);
number_suggested = number_suggested - 1; number_suggested = number_suggested - 1;
@@ -1396,24 +1398,24 @@ addListener("click", '#toast-container', function(){
}); });
addListener("click", "#embed-area", function(){ addListener("click", "#embed-area", function(e){
this.select(); e.select();
}); });
addListener("click", ".brand-logo-navigate", function(e){ addListener("click", ".brand-logo-navigate", function(event){
event.preventDefault(); this.preventDefault();
window.history.pushState("to the frontpage!", "Title", "/"); window.history.pushState("to the frontpage!", "Title", "/");
Channel.onepage_load(); Channel.onepage_load();
}); });
addListener("click", "#player_bottom_overlay", function(e){ addListener("click", "#player_bottom_overlay", function(event){
if(event.target.id == "closePlayer") return; if(this.target.id == "closePlayer") return;
Frontpage.to_channel(chan.toLowerCase(), false); Frontpage.to_channel(chan.toLowerCase(), false);
}); });
addListener("click", ".generate-channel-name", function(e) { addListener("click", ".generate-channel-name", function(event) {
event.preventDefault(); this.preventDefault();
Helper.ajax({ Helper.ajax({
type: "GET", type: "GET",
url: "/api/generate_name", url: "/api/generate_name",
@@ -1426,8 +1428,8 @@ addListener("click", ".generate-channel-name", function(e) {
ga('send', 'event', "button-click", "generate-channel"); ga('send', 'event', "button-click", "generate-channel");
}); });
addListener("click", "#close_find_form_button", function(e) { addListener("click", "#close_find_form_button", function(event) {
event.preventDefault(); this.preventDefault();
find_start = false; find_start = false;
find_started = false; find_started = false;
Helper.toggleClass("#find_div", "hide"); Helper.toggleClass("#find_div", "hide");
@@ -1439,8 +1441,8 @@ addListener("click", "#close_find_form_button", function(e) {
find_word = ""; find_word = "";
}); });
addListener("submit", "#find_form", function(e){ addListener("submit", "#find_form", function(event){
event.preventDefault(); this.preventDefault();
if(this.find_value.value != find_word) { if(this.find_value.value != find_word) {
find_word = this.find_value.value; find_word = this.find_value.value;
found_array = []; found_array = [];