GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Pull Request — master (#2835)
by
unknown
06:01
created

symphony/assets/js/src/backend.js   A

Complexity

Total Complexity 12
Complexity/F 2

Size

Lines of Code 87
Function Count 6

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 0
c 0
b 0
f 0
nc 20
dl 0
loc 87
rs 10
wmc 12
mnd 2
bc 11
fnc 6
bpm 1.8333
cpm 2
noi 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A environment.constructor 0 4 2
B backend.js ➔ $ 0 46 5
1
/**
2
 * Symphony backend initialisation
3
 *
4
 * @package assets
5
 */
6
7
(function($, Symphony) {
8
	'use strict';
9
10
	// Set environment
11
	var environment = (function () {
12
		var env = document.getElementById('environment');
13
		return env ? JSON.parse(env.textContent) : {};
14
	})();
15
	Symphony.Context.add(null, environment);
16
17
	// Get translations
18
	Symphony.Language.add({
19
		'Are you sure you want to proceed?': false,
20
		'Reordering was unsuccessful.': false,
21
		'Change Password': false,
22
		'Remove File': false,
23
		'Untitled Field': false,
24
		'The field “{$title}” ({$type}) has been removed.': false,
25
		'Undo?': false,
26
		'untitled': false,
27
		'Expand all': false,
28
		'Collapse all': false,
29
		'drag to reorder': false,
30
		'Please reset your password': false,
31
		'required': false,
32
		'Click to select': false,
33
		'Type to search': false,
34
		'Clear': false,
35
		'Search for {$item}': false,
36
		'Add filter': false,
37
		'filtered': false,
38
		'None': false,
39
		'Clear filters': false,
40
		'Apply filters': false,
41
		'The Symphony calendar widget has been disabled because your system date format is currently not supported. Try one of the following instead or disable the calendar in the field settings:': false,
42
		'no leading zero': false
43
	});
44
45
	// Initialise backend
46
	$(function() {
47
48
		// Cache main elements
49
		Symphony.Elements.window = $(window);
50
		Symphony.Elements.html = $('html').addClass('js-active');
51
		Symphony.Elements.body = $('body');
52
		Symphony.Elements.wrapper = $('#wrapper');
53
		Symphony.Elements.header = $('#header');
54
		Symphony.Elements.nav = $('#nav');
55
		Symphony.Elements.session = $('#session');
56
		Symphony.Elements.context = $('#context');
57
		Symphony.Elements.breadcrumbs = $('#breadcrumbs');
58
		Symphony.Elements.contents = $('#contents');
59
60
		// Create context id
61
		var path = Symphony.Context.get('path');
62
		var route = Symphony.Context.get('route');
63
		if (path && route) {
64
			var contextId = (path + route).split('/').filter(function(part) {
65
				return (part != 'edit' && part != 'new' && part != 'created' && part != 'saved' && part != '');
66
			}).join('.');
67
			Symphony.Context.add('context-id', contextId);
68
		}
69
70
		// Render view
71
		Symphony.View.render();
72
73
		// Update state to canonical url
74
		if (window.history.replaceState) {
75
			var replaceState = function () {
76
				$('head > link[rel="canonical"][href]').eq(0).each(function () {
77
					var href = $(this).attr('href');
78
					if (href) {
79
						window.history.replaceState(document.title, null, href);
80
					}
81
				});
82
			};
83
			// Let extensions read the window.location when load is completed
84
			if (document.readyState === 'complete') {
85
				replaceState();
86
			} else {
87
				// Document not loaded, delay change on load
88
				$(window).on('load', replaceState);
89
			}
90
		}
91
	});
92
93
})(window.jQuery, window.Symphony);
94