Merge branch 'master' into devel

This commit is contained in:
Sebastien 2018-09-25 15:11:26 +03:00
commit 85504b943e
10 changed files with 3797 additions and 91 deletions

File diff suppressed because one or more lines are too long

View File

@ -17,7 +17,7 @@ var guild;
$(document).ready(function () {
if (Cookies.get('guild') != undefined) {
guild = Cookies.get('guild')
guild = Cookies.get('guild');
btn_play = $('#btn_play');
btn_stop = $('#btn_stop');
btn_next = $('#btn_next');
@ -60,7 +60,10 @@ $(document).ready(function() {
function getCurentMusic() {
$.get("api/music/currentMusicInfo?guild=" + guild, function (data) {
}).done(function (data) {
if (error) {
error = false;
M.Toast.dismissAll();
}
state = data.state;
switch (data.state) {
case "STOP":
@ -154,8 +157,6 @@ function getCurentMusic() {
}
break;
}
if (switchAutoFlow.is(':checked') != data.autoflow)
@ -165,8 +166,14 @@ function getCurentMusic() {
})
.fail(function (data) {
if (!error) {
console.error("Connection lost, I keep trying to refresh!");
error = true;
console.error("Connection lost, I keep trying to refresh!");
M.toast({
html: " <i class=\"material-icons\" style='margin-right: 10px'>warning</i> Connection Lost!",
classes: 'red',
displayLength: 99999999
});
}
})
@ -222,7 +229,11 @@ function getPlayList() {
}).fail(function (data) {
if (!error) {
alert("Comunication error, please refresh.");
M.toast({
html: " <i class=\"material-icons\" style='margin-right: 10px'>warning</i> Connection Lost!",
classes: 'red',
displayLength: 99999999
});
error = true;
}
if (loadingFlag) {
@ -255,7 +266,12 @@ function getChannels(){
}).fail(function (data) {
if (!error) {
alert("Com error, please refresh.");
M.toast({
html: " <i class=\"material-icons\" style='margin-right: 10px'>warning</i> Connection Lost!",
classes: 'red',
displayLength: 99999999
});
error = true;
}
@ -271,7 +287,6 @@ function updateModal(data){
$('#modal_submit').text("Submitted by: " + data.info.user);
}
function updateControl(data) {
@ -292,8 +307,7 @@ function updateControl(data){
enableBtn(btn_next);
enableBtn(btn_disconnect);
}
else
{
else {
disableBtn(btn_play);
disableBtn(btn_stop);
disableBtn(btn_info);
@ -377,14 +391,14 @@ function listeners() {
$('#btn_play').click(function () {
switch (state) {
case "PLAYING":
sendCommand({ command: "PAUSE"})
sendCommand({command: "PAUSE"});
break;
case "PAUSE":
sendCommand({ command: "PLAY"})
sendCommand({command: "PLAY"});
break;
default:
sendCommand({command: "PLAY"})
sendCommand({command: "PLAY"});
}
});

View File

@ -20,7 +20,6 @@ if(discordToken !== ""){
console.log(data);
Cookies.set('token',data.token, { expires: 31 });
Cookies.set('name', data.name, { expires: 31 });
debugger;
window.location = "/";
}

View File

@ -26,26 +26,32 @@ self.addEventListener('install', function (event) {
});
self.addEventListener('fetch', function (event) {
event.respondWith(
caches.match(event.request)
.then(function (response) {
// Cache hit - return response
if (response) {
return response;
}
return fetch(event.request);
}
)
var request = event.request;
event.respondWith(fetch(request).catch( function (reason) {
console.error(
'[onfetch] Failed. Serving cached offline fallback ' +
reason
);
return caches.open(CACHE_NAME).then(function(cache){
return cache.match(request);
})
}));
event.waitUntil(
update(event.request)
.then(refresh)
.then(refresh, function (reason) {
console.log("Update fail");
console.log(event.request)
})
);
function update(request) {
return caches.match(request).then(
function (response) {
return caches.match(request).then(function (response) {
if (response) {
return caches.open(CACHE_NAME).then(function (cache) {
return fetch(request).then(function (response) {

View File

@ -20,7 +20,7 @@
<body class="blue-grey lighten-5" >
<div th:replace="header :: header ('home',${guild_name},${redirect_url})">...</div>
<div th:replace="header :: header ('home',${guild_name},${redirect_url}, ${guild_name})">...</div>
@ -50,15 +50,12 @@
<script>
var needLogin = true;
</script>
<!-- Scripts-->
<script th:src="@{/js/jquery-3.3.1.min.js}"></script>
<script th:src="@{/js/materialize.js}"></script>
<script th:src="@{/js/navabar.js}"></script>
<script th:src="@{/js/js.cookie.js}"></script>
<script src="https://use.fontawesome.com/releases/v5.3.1/js/all.js" crossorigin="anonymous"></script>
<script th:src="@{/js/fontawesome.js}"></script>
<script th:src="@{/js/workerRegister.js}"></script>

View File

@ -38,7 +38,7 @@
<script th:src="@{/js/materialize.js}"></script>
<script th:src="@{/js/navabar.js}"></script>
<script th:src="@{/js/js.cookie.js}"></script>
<script src="https://use.fontawesome.com/releases/v5.3.1/js/all.js" crossorigin="anonymous"></script>
<script th:src="@{/js/fontawesome.js}"></script>
<script th:src="@{/js/workerRegister.js}"></script>

View File

@ -20,7 +20,6 @@
<body class="blue-grey lighten-5" >
<div th:replace="header :: header ('music',${guild_name},${redirect_url}, ${isAdmin})">...</div>
<div class="section no-pad-bot main" id="index-banner">
<div class="row">
<div class="col l8 s12 m12">
@ -313,6 +312,8 @@
<script th:src="@{/js/navabar.js}"></script>
<script th:src="@{/js/js.cookie.js}"></script>
<script th:src="@{/js/workerRegister.js}"></script>
<script th:src="@{/js/fontawesome.js}"></script>
</body>

View File

@ -50,6 +50,8 @@
<script th:src="@{/js/navabar.js}"></script>
<script th:src="@{/js/js.cookie.js}"></script>
<script th:src="@{/js/oauthCallback.js}"></script>
<script th:src="@{/js/fontawesome.js}"></script>
<script src="https://use.fontawesome.com/releases/v5.3.1/js/all.js" crossorigin="anonymous"></script>

View File

@ -101,6 +101,8 @@
<script th:src="@{/js/navabar.js}"></script>
<script th:src="@{/js/js.cookie.js}"></script>
<script th:src="@{/js/workerRegister.js}"></script>
<script th:src="@{/js/fontawesome.js}"></script>

View File

@ -147,7 +147,7 @@
<script th:src="@{/js/js.cookie.js}"></script>
<script th:src="@{/js/settings.js}"></script>
<script src="https://use.fontawesome.com/releases/v5.3.1/js/all.js" crossorigin="anonymous"></script>
<script th:src="@{/js/fontawesome.js}"></script>
<script th:src="@{/js/workerRegister.js}"></script>