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 () { $(document).ready(function () {
if (Cookies.get('guild') != undefined) { if (Cookies.get('guild') != undefined) {
guild = Cookies.get('guild') guild = Cookies.get('guild');
btn_play = $('#btn_play'); btn_play = $('#btn_play');
btn_stop = $('#btn_stop'); btn_stop = $('#btn_stop');
btn_next = $('#btn_next'); btn_next = $('#btn_next');
@ -60,7 +60,10 @@ $(document).ready(function() {
function getCurentMusic() { function getCurentMusic() {
$.get("api/music/currentMusicInfo?guild=" + guild, function (data) { $.get("api/music/currentMusicInfo?guild=" + guild, function (data) {
}).done(function (data) { }).done(function (data) {
if (error) {
error = false;
M.Toast.dismissAll();
}
state = data.state; state = data.state;
switch (data.state) { switch (data.state) {
case "STOP": case "STOP":
@ -154,8 +157,6 @@ function getCurentMusic() {
} }
break; break;
} }
if (switchAutoFlow.is(':checked') != data.autoflow) if (switchAutoFlow.is(':checked') != data.autoflow)
@ -165,8 +166,14 @@ function getCurentMusic() {
}) })
.fail(function (data) { .fail(function (data) {
if (!error) { if (!error) {
console.error("Connection lost, I keep trying to refresh!");
error = true; 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) { }).fail(function (data) {
if (!error) { 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; error = true;
} }
if (loadingFlag) { if (loadingFlag) {
@ -255,7 +266,12 @@ function getChannels(){
}).fail(function (data) { }).fail(function (data) {
if (!error) { 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; error = true;
} }
@ -271,7 +287,6 @@ function updateModal(data){
$('#modal_submit').text("Submitted by: " + data.info.user); $('#modal_submit').text("Submitted by: " + data.info.user);
} }
function updateControl(data) { function updateControl(data) {
@ -292,8 +307,7 @@ function updateControl(data){
enableBtn(btn_next); enableBtn(btn_next);
enableBtn(btn_disconnect); enableBtn(btn_disconnect);
} }
else else {
{
disableBtn(btn_play); disableBtn(btn_play);
disableBtn(btn_stop); disableBtn(btn_stop);
disableBtn(btn_info); disableBtn(btn_info);
@ -377,14 +391,14 @@ function listeners() {
$('#btn_play').click(function () { $('#btn_play').click(function () {
switch (state) { switch (state) {
case "PLAYING": case "PLAYING":
sendCommand({ command: "PAUSE"}) sendCommand({command: "PAUSE"});
break; break;
case "PAUSE": case "PAUSE":
sendCommand({ command: "PLAY"}) sendCommand({command: "PLAY"});
break; break;
default: default:
sendCommand({command: "PLAY"}) sendCommand({command: "PLAY"});
} }
}); });

View File

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

View File

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

View File

@ -20,7 +20,7 @@
<body class="blue-grey lighten-5" > <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--> <!-- Scripts-->
<script th:src="@{/js/jquery-3.3.1.min.js}"></script> <script th:src="@{/js/jquery-3.3.1.min.js}"></script>
<script th:src="@{/js/materialize.js}"></script> <script th:src="@{/js/materialize.js}"></script>
<script th:src="@{/js/navabar.js}"></script> <script th:src="@{/js/navabar.js}"></script>
<script th:src="@{/js/js.cookie.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> <script th:src="@{/js/workerRegister.js}"></script>

View File

@ -38,7 +38,7 @@
<script th:src="@{/js/materialize.js}"></script> <script th:src="@{/js/materialize.js}"></script>
<script th:src="@{/js/navabar.js}"></script> <script th:src="@{/js/navabar.js}"></script>
<script th:src="@{/js/js.cookie.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> <script th:src="@{/js/workerRegister.js}"></script>

View File

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

View File

@ -50,6 +50,8 @@
<script th:src="@{/js/navabar.js}"></script> <script th:src="@{/js/navabar.js}"></script>
<script th:src="@{/js/js.cookie.js}"></script> <script th:src="@{/js/js.cookie.js}"></script>
<script th:src="@{/js/oauthCallback.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> <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/navabar.js}"></script>
<script th:src="@{/js/js.cookie.js}"></script> <script th:src="@{/js/js.cookie.js}"></script>
<script th:src="@{/js/workerRegister.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/js.cookie.js}"></script>
<script th:src="@{/js/settings.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> <script th:src="@{/js/workerRegister.js}"></script>