mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Updated panel some
This commit is contained in:
@@ -386,7 +386,7 @@ li.disabled span {
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
.import-spotify-auth, .import-youtube, .export-spotify-auth, .export-youtube, .exported-playlist, .import-zoff, .import-soundcloud{
|
||||
.import-spotify-auth, .import-youtube, .export-spotify-auth, .export-youtube, .exported-playlist, .import-zoff, .import-soundcloud, .export-soundcloud{
|
||||
color:white !important;
|
||||
height:40px !important;
|
||||
line-height: 40px !important;
|
||||
@@ -394,11 +394,11 @@ li.disabled span {
|
||||
width: 76%;
|
||||
}
|
||||
|
||||
.import-soundcloud, .import-soundcloud:active, .import-soundcloud:visited {
|
||||
.import-soundcloud, .import-soundcloud:active, .import-soundcloud:visited, .export-soundcloud:visited {
|
||||
background: #f96200;
|
||||
}
|
||||
|
||||
.import-soundcloud:hover {
|
||||
.import-soundcloud:hover, .export-soundcloud:hover {
|
||||
background: #f97f30;
|
||||
}
|
||||
|
||||
|
||||
@@ -952,6 +952,29 @@ function addDynamicListeners() {
|
||||
}
|
||||
});
|
||||
|
||||
addListener("click", ".export-soundcloud", function(event) {
|
||||
this.preventDefault();
|
||||
var nonce = Helper.randomString(29);
|
||||
Helper.removeClass("#playlist_loader_export", "hide");
|
||||
Helper.addClass(".soundcloud_export_button", "hide");
|
||||
window.callback = function(data) {
|
||||
access_token_data_soundcloud = data;
|
||||
if(access_token_data_soundcloud.state == nonce){
|
||||
soundcloud_authenticated = true;
|
||||
Helper.removeClass("#playlist_loader_export", "hide");
|
||||
Helper.addClass(".soundcloud_export_button", "hide");
|
||||
} else {
|
||||
access_token_data_soundcloud = {};
|
||||
console.error("States doesn't match");
|
||||
Helper.addClass("#playlist_loader_export", "hide");
|
||||
Helper.removeClass(".soundcloud_export_button", "hide");
|
||||
}
|
||||
soundcloud_window.close();
|
||||
window.callback = "";
|
||||
};
|
||||
soundcloud_window = window.open("/api/oauth#soundcloud=true&nonce=" + nonce, "", "width=600, height=600");
|
||||
})
|
||||
|
||||
addListener("click", ".export-spotify-auth", function(event){
|
||||
this.preventDefault();
|
||||
var nonce = Helper.randomString(29);
|
||||
@@ -1019,7 +1042,7 @@ function addDynamicListeners() {
|
||||
document.querySelector("#import_soundcloud").focus();
|
||||
});
|
||||
|
||||
addListener("submit", "#listImportSoundCloud", function(event) {
|
||||
/*addListener("submit", "#listImportSoundCloud", function(event) {
|
||||
this.preventDefault();
|
||||
Helper.removeClass(".playlist_loader_soundcloud", "hide");
|
||||
Helper.addClass("#listImportSoundCloud", "hide");
|
||||
@@ -1085,87 +1108,10 @@ function addDynamicListeners() {
|
||||
console.log(data);
|
||||
Helper.addClass(".playlist_loader_soundcloud", "hide");
|
||||
Helper.removeClass("#listImportSoundCloud", "hide");
|
||||
if(data.status == 404) {
|
||||
var nonce = Helper.randomString(29);
|
||||
window.callback = function(data) {
|
||||
access_token_data_soundcloud = data;
|
||||
console.log(access_token_data_soundcloud, nonce);
|
||||
if(access_token_data_soundcloud.state == nonce){
|
||||
soundcloud_authenticated = true;
|
||||
Helper.ajax({
|
||||
type: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
url: "https://api.soundcloud.com/resolve/?url=" + document.querySelector("#import_soundcloud").value + "&limit=1&client_id=" + api_key.soundcloud + "&oauth_token=" + access_token_data_soundcloud.code + "&format=json&_status_code_map[200]=200",
|
||||
success: function(data){
|
||||
try {
|
||||
var jsonData = JSON.parse(data);
|
||||
var tracks = jsonData.tracks;
|
||||
document.querySelector("#import_soundcloud").value = "";
|
||||
var addList = [];
|
||||
for(var i = 0; i < tracks.length; i++) {
|
||||
var song = tracks[i];
|
||||
var title=song.title;
|
||||
if(title.indexOf(song.user.username) == -1) {
|
||||
title = song.user.username + " - " + title;
|
||||
}
|
||||
if(!song.streamable) {
|
||||
var not_added_song = document.createElement("div");
|
||||
not_added_song.innerHTML = not_import_html;
|
||||
|
||||
not_added_song.querySelector(".extra-add-text").innerText = title;
|
||||
not_added_song.querySelector(".extra-add-text").setAttribute("title", title);
|
||||
not_added_song.querySelector(".extra-button-search").setAttribute("data-text", title);
|
||||
document.querySelector(".not-imported-container").insertAdjacentHTML("beforeend", not_added_song.innerHTML);
|
||||
Helper.removeClass(".not-imported", "hide");
|
||||
continue;
|
||||
}
|
||||
var duration=Math.floor(song.duration / 1000);
|
||||
//var secs=Search.durationToSeconds(duration);
|
||||
var secs = duration;
|
||||
if(longsongs == undefined) longsongs = true;
|
||||
if((longsongs != undefined && !longsongs) || secs<720){
|
||||
|
||||
var id=song.id;
|
||||
//duration = duration.replace("PT","").replace("H","h ").replace("M","m ").replace("S","s");
|
||||
var thumb=song.artwork_url;
|
||||
//var thumb = null;
|
||||
if(thumb == null) thumb = song.waveform_url;
|
||||
|
||||
var songElement = {id: song.id, title: title, duration: secs, source: "soundcloud", thumbnail: thumb};
|
||||
|
||||
addList.push(songElement);
|
||||
}
|
||||
}
|
||||
if(addList.length > 0) {
|
||||
socket.emit("addPlaylist", {channel: chan.toLowerCase(), songs: addList});
|
||||
}
|
||||
Helper.addClass(".playlist_loader_soundcloud", "hide");
|
||||
Helper.removeClass("#listImportSoundCloud", "hide");
|
||||
//{id: song.id, title: enc_title, duration: duration, source: "youtube", thumbnail: "https://img.youtube.com/vi/" + song.id + "/mqdefault.jpg"}
|
||||
} catch(e) {
|
||||
console.error(e);
|
||||
Helper.addClass(".playlist_loader_soundcloud", "hide");
|
||||
Helper.removeClass("#listImportSoundCloud", "hide");
|
||||
}
|
||||
},
|
||||
error: function(e) {
|
||||
console.error(e);
|
||||
toast("If the list is private, you have to add the secret code at the end");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
access_token_data_soundcloud = {};
|
||||
console.error("States doesn't match");
|
||||
}
|
||||
soundcloud_window.close();
|
||||
window.callback = "";
|
||||
};
|
||||
soundcloud_window = window.open("/api/oauth#soundcloud=true&nonce=" + nonce, "", "width=600, height=600");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});*/
|
||||
|
||||
addListener("submit", "#listImportSpotify", function(event){
|
||||
this.preventDefault();
|
||||
|
||||
@@ -203,7 +203,7 @@
|
||||
<form action="#" id="listImportSoundCloud">
|
||||
<i class="material-icons import-icon">playlist_add</i>
|
||||
<input title="Input SoundCloud-playlist url here!" placeholder="Enter SoundCloud-list url" id="import_soundcloud" type="text" class="validate" autocomplete="off" />
|
||||
<p class="soundcloud-disclaimer">Private lists won't work with imports yet, due to our API-key being limited at the time being. Sorry for any inconvinience.</p>
|
||||
<p class="soundcloud-disclaimer">If you want to add a private list, remember to add the secret token at the end!</p>
|
||||
</form>
|
||||
<div id="playlist_loader_soundcloud" class="valign playlist_loader_padding hide">
|
||||
<div class="preloader-wrapper small active">
|
||||
@@ -266,6 +266,11 @@
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
<li class="white-bg">
|
||||
<div class="input-field field-settings">
|
||||
<p class="soundcloud-disclaimer">Exporting to SoundCloud is in the works.</p>
|
||||
</div>
|
||||
</li>
|
||||
<li class="exported-list-container white-bg hide">
|
||||
<div class="valign playlist_loader_padding">
|
||||
<div class="row">
|
||||
|
||||
Reference in New Issue
Block a user