Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

src/htdocs/js/uni_gen.js   A
last analyzed

Complexity

Total Complexity 4
Complexity/F 1

Size

Lines of Code 48
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 24
c 0
b 0
f 0
dl 0
loc 48
rs 10
wmc 4
mnd 0
bc 0
fnc 4
bpm 0
cpm 1
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A uni_gen.js ➔ setupDragDrop 0 25 3
1
"use strict";
2
3
// Install drag & drop handlers once the page has finished loading
4
window.onload = function() {
5
	setupDragDrop();
6
};
7
8
/**
9
 * Allows locations to be dragged and dropped to different sectors
10
 * with an AJAX update.
11
 *
12
 * This needs to be called every time the elements in the sector map
13
 * update, to install new handlers on the updated elements.
14
 */
15
function setupDragDrop() {
16
17
	// Make the Location images draggable elements
18
	$(".drag_loc").draggable({
19
		addClasses: false,
20
		revert: "invalid",
21
		cursor: "move",
22
	});
23
24
	// The draggable elements can be dropped into any sector
25
	$(".lm_sector").droppable({
26
		addClasses: false,
27
		accept: ".drag_loc",
28
		drop: function(event, ui) {
29
			var href = ui.draggable.data("href");
30
			var data = {
31
				TargetSectorID: $(this).find(".lmsector").text(),
32
				OrigSectorID: ui.draggable.data("sector"),
33
				LocationTypeID: ui.draggable.data("loc"),
34
			};
35
			ajaxLink(href, {callback: setupDragDrop, params: data});
36
		},
37
	});
38
39
}
40
41
window.toggleLink = function(elem) {
42
	var href = elem.dataset.href;
43
	var data = {
44
		SectorID: elem.dataset.sector,
45
		Dir: elem.dataset.dir,
46
	};
47
	ajaxLink(href, {callback: setupDragDrop, params: data});
48
}
49