Skip to content
Snippets Groups Projects
Select Git revision
  • acac1a6234f7cc28d1bce27741d37ef598674ce3
  • renovate/django-split-settings-1.x
  • renovate/djangorestframework-3.x
  • main
  • 520-improve-trackmanager
  • 520-fix-scheduling
  • 520-akowner
  • 520-status
  • 520-message-resolved
  • 520-improve-scheduling-2
  • renovate/django-bootstrap5-24.x
  • 520-improve-submission
  • 520-improve-scheduling
  • 520-improve-wall
  • 520-fix-event-wizard-datepicker
  • 520-upgrades
  • renovate/tzdata-2023.x
  • renovate/django-5.x
  • renovate/fontawesomefree-6.x
  • renovate/sphinx-rtd-theme-2.x
  • renovate/sphinxcontrib-apidoc-0.x
21 results

admin.py

Blame
  • Forked from KIF / AKPlanning
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    Worker.js 1.27 KiB
    self.interval = self.interval || 1000;
    self.tick = self.tick || function() {};
    self.config = self.config || {};
    
    (new function() {
    	var
    		me = this,
    		timer,
    		cmds = [],
    		execRun = false;
    	
    	function update() {
    		if (!!timer) self.clearTimeout(timer);
    		self.tick(function(result) {
    			self.postMessage(result);
    		});
    		timer = self.setTimeout(update, self.interval);
    	}
    	
    	function exec() {
    		if (!!cmds.length) {
    			execRun = true;
    			var cmd = cmds.shift();
    			me[cmd.cmd].apply(this,cmd.params);
    		} else {
    			execRun = false;
    		}
    	}
    	
    	this.start = function() {
    		update();
    		exec();
    	}
    	
    	this.stop = function() {
    		if (!!timer) self.clearTimeout(timer);
    		exec();
    	}
    	
    	this.loadConfig = function(name) {
    		AJAX.request("../../panels/departure/config/"+name+".json").then(function(data) {
    			config = data.response;
    			if (isObject(config) && isArrayNotEmpty(config['stops'])) {
    				config['stops_converted'] = [];
    				for (var i = 0; i < config['stops'].length; ++i) {
    					config['stops_converted'].push({url:'http://vrrf.finalrewind.org/'+config['stops'][i].split(':').join('/')+'.json',method:'GET',params:{frontend:'json'}});
    				}	
    			}
    			exec();
    		},function() {
    			exec();
    		});
    	}
    	
    	self.onmessage = function(e) {
    		cmds.push(e.data);
    		if (!execRun) exec();
    	}.bind(this);
    	
    }());