mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-04 04:12:45 +00:00 
			
		
		
		
	Use slim socketio again (this time with .map file) change socket behavior
This commit is contained in:
		
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										1
									
								
								app/static/js/Socket.IO/socket.io.slim.js.map
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								app/static/js/Socket.IO/socket.io.slim.js.map
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -5,7 +5,7 @@
 | 
			
		||||
var nopaque = {};
 | 
			
		||||
 | 
			
		||||
// nopaque ressources
 | 
			
		||||
nopaque.socket = io();
 | 
			
		||||
nopaque.socket = undefined;
 | 
			
		||||
 | 
			
		||||
nopaque.corpora = undefined;
 | 
			
		||||
nopaque.corporaSubscribers = [];
 | 
			
		||||
@@ -17,8 +17,71 @@ nopaque.foreignCorporaSubscribers = [];
 | 
			
		||||
nopaque.foreignJobs = undefined;
 | 
			
		||||
nopaque.foreignJobsSubscribers = [];
 | 
			
		||||
 | 
			
		||||
nopaque.user = {};
 | 
			
		||||
nopaque.user.isAuthenticated = undefined;
 | 
			
		||||
nopaque.user.settings = {}
 | 
			
		||||
nopaque.user.settings.darkMode = undefined;
 | 
			
		||||
 | 
			
		||||
nopaque.flashedMessages = []
 | 
			
		||||
 | 
			
		||||
// nopaque functions
 | 
			
		||||
nopaque.socket = {};
 | 
			
		||||
nopaque.socket.init = function() {
 | 
			
		||||
  nopaque.socket = io();
 | 
			
		||||
  // Add event handlers
 | 
			
		||||
  nopaque.socket.on("corpora_init", function(msg) {
 | 
			
		||||
    nopaque.corpora = JSON.parse(msg);
 | 
			
		||||
    for (let subscriber of nopaque.corporaSubscribers) {subscriber._init(nopaque.corpora);}
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  nopaque.socket.on("jobs_init", function(msg) {
 | 
			
		||||
    nopaque.jobs = JSON.parse(msg);
 | 
			
		||||
    for (let subscriber of nopaque.jobsSubscribers) {subscriber._init(nopaque.jobs);}
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  nopaque.socket.on("corpora_update", function(msg) {
 | 
			
		||||
    var patch;
 | 
			
		||||
 | 
			
		||||
    patch = JSON.parse(msg);
 | 
			
		||||
    nopaque.corpora = jsonpatch.apply_patch(nopaque.corpora, patch);
 | 
			
		||||
    for (let subscriber of nopaque.corporaSubscribers) {subscriber._update(patch);}
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  nopaque.socket.on("jobs_update", function(msg) {
 | 
			
		||||
    var patch;
 | 
			
		||||
 | 
			
		||||
    patch = JSON.parse(msg);
 | 
			
		||||
    nopaque.jobs = jsonpatch.apply_patch(nopaque.jobs, patch);
 | 
			
		||||
    for (let subscriber of nopaque.jobsSubscribers) {subscriber._update(patch);}
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  nopaque.socket.on("foreign_corpora_init", function(msg) {
 | 
			
		||||
    nopaque.foreignCorpora = JSON.parse(msg);
 | 
			
		||||
    for (let subscriber of nopaque.foreignCorporaSubscribers) {subscriber._init(nopaque.foreignCorpora);}
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  nopaque.socket.on("foreign_jobs_init", function(msg) {
 | 
			
		||||
    nopaque.foreignJobs = JSON.parse(msg);
 | 
			
		||||
    for (let subscriber of nopaque.foreignJobsSubscribers) {subscriber._init(nopaque.foreignJobs);}
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  nopaque.socket.on("foreign_corpora_update", function(msg) {
 | 
			
		||||
    var patch;
 | 
			
		||||
 | 
			
		||||
    patch = JSON.parse(msg);
 | 
			
		||||
    nopaque.foreignCorpora = jsonpatch.apply_patch(nopaque.foreignCorpora, patch);
 | 
			
		||||
    for (let subscriber of nopaque.foreignCorporaSubscribers) {subscriber._update(patch);}
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  nopaque.socket.on("foreign_jobs_update", function(msg) {
 | 
			
		||||
    var patch;
 | 
			
		||||
 | 
			
		||||
    patch = JSON.parse(msg);
 | 
			
		||||
    nopaque.foreignJobs = jsonpatch.apply_patch(nopaque.foreignJobs, patch);
 | 
			
		||||
    for (let subscriber of nopaque.foreignJobsSubscribers) {subscriber._update(patch);}
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
nopaque.Workarounds = {};
 | 
			
		||||
nopaque.Workarounds.apply = function() {
 | 
			
		||||
  // Disable all option elements with no value
 | 
			
		||||
@@ -128,66 +191,6 @@ nopaque.toast = function(message, color="") {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// socket event handlers
 | 
			
		||||
nopaque.socket.on("corpora_init", function(msg) {
 | 
			
		||||
  nopaque.corpora = JSON.parse(msg);
 | 
			
		||||
  for (let subscriber of nopaque.corporaSubscribers) {subscriber._init(nopaque.corpora);}
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
nopaque.socket.on("jobs_init", function(msg) {
 | 
			
		||||
  nopaque.jobs = JSON.parse(msg);
 | 
			
		||||
  for (let subscriber of nopaque.jobsSubscribers) {subscriber._init(nopaque.jobs);}
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
nopaque.socket.on("corpora_update", function(msg) {
 | 
			
		||||
  var patch;
 | 
			
		||||
 | 
			
		||||
  patch = JSON.parse(msg);
 | 
			
		||||
  nopaque.corpora = jsonpatch.apply_patch(nopaque.corpora, patch);
 | 
			
		||||
  for (let subscriber of nopaque.corporaSubscribers) {subscriber._update(patch);}
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
nopaque.socket.on("jobs_update", function(msg) {
 | 
			
		||||
  var patch;
 | 
			
		||||
 | 
			
		||||
  patch = JSON.parse(msg);
 | 
			
		||||
  nopaque.jobs = jsonpatch.apply_patch(nopaque.jobs, patch);
 | 
			
		||||
  for (let subscriber of nopaque.jobsSubscribers) {subscriber._update(patch);}
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
nopaque.socket.on("foreign_corpora_init", function(msg) {
 | 
			
		||||
  nopaque.foreignCorpora = JSON.parse(msg);
 | 
			
		||||
  for (let subscriber of nopaque.foreignCorporaSubscribers) {subscriber._init(nopaque.foreignCorpora);}
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
nopaque.socket.on("foreign_jobs_init", function(msg) {
 | 
			
		||||
  nopaque.foreignJobs = JSON.parse(msg);
 | 
			
		||||
  for (let subscriber of nopaque.foreignJobsSubscribers) {subscriber._init(nopaque.foreignJobs);}
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
nopaque.socket.on("foreign_corpora_update", function(msg) {
 | 
			
		||||
  var patch;
 | 
			
		||||
 | 
			
		||||
  patch = JSON.parse(msg);
 | 
			
		||||
  nopaque.foreignCorpora = jsonpatch.apply_patch(nopaque.foreignCorpora, patch);
 | 
			
		||||
  for (let subscriber of nopaque.foreignCorporaSubscribers) {subscriber._update(patch);}
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
nopaque.socket.on("foreign_jobs_update", function(msg) {
 | 
			
		||||
  var patch;
 | 
			
		||||
 | 
			
		||||
  patch = JSON.parse(msg);
 | 
			
		||||
  nopaque.foreignJobs = jsonpatch.apply_patch(nopaque.foreignJobs, patch);
 | 
			
		||||
  for (let subscriber of nopaque.foreignJobsSubscribers) {subscriber._update(patch);}
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
document.addEventListener("DOMContentLoaded", function() {
 | 
			
		||||
  nopaque.Workarounds.apply();
 | 
			
		||||
  M.AutoInit();
 | 
			
		||||
@@ -196,5 +199,14 @@ document.addEventListener("DOMContentLoaded", function() {
 | 
			
		||||
                  {alignment: "right", constrainWidth: false, coverTrigger: false});
 | 
			
		||||
  nopaque.Forms.init();
 | 
			
		||||
  nopaque.Navigation.init();
 | 
			
		||||
  nopaque.socket.emit("user_ressources_init");
 | 
			
		||||
  while (nopaque.flashedMessages.length) {
 | 
			
		||||
    nopaque.toast(nopaque.flashedMessages.shift().message);
 | 
			
		||||
  }
 | 
			
		||||
  if (nopaque.user.isAuthenticated) {
 | 
			
		||||
    if (nopaque.user.settings.darkMode) {
 | 
			
		||||
      DarkReader.enable({"brightness": 150, "contrast": 100, "sepia": 0});
 | 
			
		||||
    }
 | 
			
		||||
    nopaque.socket.init();
 | 
			
		||||
    nopaque.socket.emit("user_ressources_init");
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user