WIP: Aureplop/kpsul js refactor #501

Draft
delobell wants to merge 215 commits from aureplop/kpsul_js_refactor into master
Showing only changes of commit fa64a68378 - Show all commits

View file

@ -63,6 +63,7 @@
<script type="text/javascript">
$(document).ready(function() {
'use strict';
// Lock to avoid multiple requests
window.lock = 0;
@ -138,12 +139,12 @@ $(document).ready(function() {
// Synchronization
// -----
websocket_msg_default = {'opegroups':[],'opes':[]}
var websocket_msg_default = {'opegroups':[],'opes':[]}
var websocket_protocol = window.location.protocol == 'https:' ? 'wss' : 'ws';
var location_host = window.location.host;
var location_url = window.location.pathname.startsWith('/gestion/') ? location_host + '/gestion' : location_host;
socket = new ReconnectingWebSocket(websocket_protocol+"://" + location_url + "/ws/k-fet/k-psul/");
var socket = new ReconnectingWebSocket(websocket_protocol+"://" + location_url + "/ws/k-fet/k-psul/");
socket.onmessage = function(e) {
data = $.extend({}, websocket_msg_default, JSON.parse(e.data));
history.update_data(data);