Fixed search crashing in client-mode

This commit is contained in:
Kasper Rynning-Tønnesen
2018-08-12 14:41:11 +02:00
parent a5048f13a0
commit d4957b52f0
3 changed files with 10 additions and 2 deletions

View File

@@ -95,8 +95,8 @@ var Channel = {
}
Helper.tabs('.chatTabs');
Helper.tabs('.results-tabs');
}
Helper.tabs('.results-tabs');
var sidenavElem = document.getElementsByClassName("sidenav")[0];
M.Sidenav.init(sidenavElem, {
menuWidth: 310,
@@ -259,6 +259,8 @@ var Channel = {
if(!client) {
window.onYouTubeIframeAPIReady = Player.onYouTubeIframeAPIReady;
if(Player.player === "" || Player.player === undefined || Helper.mobilecheck()) Player.loadPlayer();
} else {
Player.loadSoundCloudPlayer();
}
//}

View File

@@ -245,6 +245,8 @@ window.addEventListener("DOMContentLoaded", function() {
firstScriptTagSC = document.getElementsByTagName('script')[0];
firstScriptTagSC.parentNode.insertBefore(tagSC, firstScriptTagSC);
}
} else if(window.location.pathname == "/" && client) {
Player.loadSoundCloudPlayer();
}
if(Helper.mobilecheck()) {

View File

@@ -990,6 +990,11 @@ var Player = {
firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
}
Player.loadSoundCloudPlayer();
},
loadSoundCloudPlayer: function() {
if(document.querySelectorAll("script[src='https://connect.soundcloud.com/sdk/sdk-3.3.0.js']").length == 1) {
try {
Player.soundcloudReady();
@@ -1016,7 +1021,6 @@ var Player = {
firstScriptTagSC = document.getElementsByTagName('script')[0];
firstScriptTagSC.parentNode.insertBefore(tagSC, firstScriptTagSC);
}
}
};