mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Fixing issues with soundcloudplayer not understanding it is loaded
This commit is contained in:
@@ -11,6 +11,9 @@ try {
|
|||||||
} catch(e) {
|
} catch(e) {
|
||||||
_VERSION = 6;
|
_VERSION = 6;
|
||||||
}
|
}
|
||||||
|
var SC_widget;
|
||||||
|
var scUsingWidget = false;
|
||||||
|
var SC_player;
|
||||||
var startTime = 0;
|
var startTime = 0;
|
||||||
var small = false;
|
var small = false;
|
||||||
var small_player = false;
|
var small_player = false;
|
||||||
|
|||||||
@@ -260,7 +260,9 @@ window.addEventListener("DOMContentLoaded", function() {
|
|||||||
tagSC.readyState == "complete"){
|
tagSC.readyState == "complete"){
|
||||||
tagSC.onreadystatechange = null;
|
tagSC.onreadystatechange = null;
|
||||||
if(sc_need_initialization) {
|
if(sc_need_initialization) {
|
||||||
//Player.soundcloudReady();
|
if(SC_player != null && SC_player != undefined && SC_widget != null && SC_widget != undefined) {
|
||||||
|
Player.soundcloudReady();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
SC_player = SC;
|
SC_player = SC;
|
||||||
SC_player.initialize({
|
SC_player.initialize({
|
||||||
@@ -274,7 +276,9 @@ window.addEventListener("DOMContentLoaded", function() {
|
|||||||
} else { //Others
|
} else { //Others
|
||||||
tagSC.onload = function(){
|
tagSC.onload = function(){
|
||||||
if(sc_need_initialization) {
|
if(sc_need_initialization) {
|
||||||
//Player.soundcloudReady();
|
if(SC_player != null && SC_player != undefined && SC_widget != null && SC_widget != undefined) {
|
||||||
|
Player.soundcloudReady();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
SC_player = SC;
|
SC_player = SC;
|
||||||
SC_player.initialize({
|
SC_player.initialize({
|
||||||
|
|||||||
@@ -1123,7 +1123,9 @@ var Player = {
|
|||||||
loadSoundCloudPlayer: function() {
|
loadSoundCloudPlayer: function() {
|
||||||
if(document.querySelectorAll("script[src='https://connect.soundcloud.com/sdk/sdk-3.3.0.js']").length == 1) {
|
if(document.querySelectorAll("script[src='https://connect.soundcloud.com/sdk/sdk-3.3.0.js']").length == 1) {
|
||||||
try {
|
try {
|
||||||
//Player.soundcloudReady();
|
if(SC_player != null && SC_player != undefined && SC_widget != null && SC_widget != undefined) {
|
||||||
|
Player.soundcloudReady();
|
||||||
|
}
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
sc_need_initialization = true;
|
sc_need_initialization = true;
|
||||||
//console.error(error);
|
//console.error(error);
|
||||||
@@ -1137,14 +1139,18 @@ var Player = {
|
|||||||
tagSC.readyState == "complete"){
|
tagSC.readyState == "complete"){
|
||||||
tagSC.onreadystatechange = null;
|
tagSC.onreadystatechange = null;
|
||||||
SC_player = SC;
|
SC_player = SC;
|
||||||
//Player.soundcloudReady();
|
if(SC_player != null && SC_player != undefined && SC_widget != null && SC_widget != undefined) {
|
||||||
|
Player.soundcloudReady();
|
||||||
|
}
|
||||||
Player.loadSoundCloudIframe();
|
Player.loadSoundCloudIframe();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else { //Others
|
} else { //Others
|
||||||
tagSC.onload = function(){
|
tagSC.onload = function(){
|
||||||
SC_player = SC;
|
SC_player = SC;
|
||||||
//Player.soundcloudReady();
|
if(SC_player != null && SC_player != undefined && SC_widget != null && SC_widget != undefined) {
|
||||||
|
Player.soundcloudReady();
|
||||||
|
}
|
||||||
Player.loadSoundCloudIframe();
|
Player.loadSoundCloudIframe();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -1157,7 +1163,9 @@ var Player = {
|
|||||||
loadSoundCloudIframe: function() {
|
loadSoundCloudIframe: function() {
|
||||||
if(document.querySelectorAll("script[src='/assets/sclib/scapi.js']").length == 1) {
|
if(document.querySelectorAll("script[src='/assets/sclib/scapi.js']").length == 1) {
|
||||||
try {
|
try {
|
||||||
Player.soundcloudReady();
|
if(SC_player != null && SC_player != undefined && SC_widget != null && SC_widget != undefined) {
|
||||||
|
Player.soundcloudReady();
|
||||||
|
}
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
//sc_need_initialization = true;
|
//sc_need_initialization = true;
|
||||||
//console.error(error);
|
//console.error(error);
|
||||||
@@ -1171,13 +1179,17 @@ var Player = {
|
|||||||
tagSC.readyState == "complete"){
|
tagSC.readyState == "complete"){
|
||||||
tagSC.onreadystatechange = null;
|
tagSC.onreadystatechange = null;
|
||||||
SC_widget = SC;
|
SC_widget = SC;
|
||||||
Player.soundcloudReady();
|
if(SC_player != null && SC_player != undefined && SC_widget != null && SC_widget != undefined) {
|
||||||
|
Player.soundcloudReady();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else { //Others
|
} else { //Others
|
||||||
tagSC.onload = function(){
|
tagSC.onload = function(){
|
||||||
SC_widget = SC;
|
SC_widget = SC;
|
||||||
Player.soundcloudReady();
|
if(SC_player != null && SC_player != undefined && SC_widget != null && SC_widget != undefined) {
|
||||||
|
Player.soundcloudReady();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
tagSC.src = "/assets/sclib/scapi.js";
|
tagSC.src = "/assets/sclib/scapi.js";
|
||||||
|
|||||||
Reference in New Issue
Block a user