This repository has been archived by the owner on Oct 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
conf.js
54 lines (47 loc) · 1.47 KB
/
conf.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
var jenkins = jenkins || {};
jenkins.conf = function () {
var default_url = "http://ci.jenkins-ci.org/",
default_pollIntervall = 10;
function setPollIntervall(minutes) {
var pollIntervall = parseInt(minutes);
if (0 < pollIntervall && pollIntervall < (24 * 60)) {
localStorage.pollIntervall = pollIntervall;
}
}
function setJenkinsURL(url) {
var slash = '/';
if (slash !== url.substr( url.length - slash.length, slash.length ) ) {
url = url + slash;
}
localStorage.jenkinsUrl = url;
}
function get(name, defaultValue) {
return function() {
if (localStorage[name]) {
return localStorage[name];
}
return defaultValue;
}
}
function setIconSize(size) {
localStorage.iconSize = size;
}
function setSuccessColor(color) {
localStorage.successColor = color;
}
return {
pollIntervall : get('pollIntervall', default_pollIntervall),
jenkinsURL : get('jenkinsUrl', default_url),
iconSize: get('iconSize', "medium"),
successColor: get('successColor', "blue"),
set : function (values) {
setPollIntervall(values.pollIntervall);
setJenkinsURL(values.jenkinsURL);
setIconSize(values.iconSize);
setSuccessColor(values.successColor);
},
apiURL : function() {
return this.jenkinsURL() + "api/json/";
}
}
}();