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
/
options.js
66 lines (57 loc) · 2.04 KB
/
options.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
54
55
56
57
58
59
60
61
62
63
64
65
jenkins.options = function(conf) {
var jenkinsUrlTextbox, pollIntervallTextbox, saveButton, saveStatus, iconSize;
function showSaveStatus(show) {
saveStatus.style.display = show ? '' : "none";
saveButton.disabled = show;
}
function display() {
jenkinsUrlTextbox.value = conf.jenkinsURL();
pollIntervallTextbox.value = conf.pollIntervall();
document.getElementById(conf.iconSize()).checked = true;
document.getElementById(conf.successColor()).checked = true;
saveButton.disabled = true;
var checks = document.getElementById('checks');
checks.innerHTML = "";
var checkedArray = conf.ignoreList().split(",");
checks.appendChild(getListOfJobs(checkedArray));
}
function getIconSize() {
if (document.optionForm.small.checked) {
return document.optionForm.small.value;
} if (document.optionForm.medium.checked) {
return document.optionForm.medium.value;
} if (document.optionForm.large.checked) {
return document.optionForm.large.value;
}
}
function getSuccessColor() {
if (document.optionForm.blue.checked) {
return document.optionForm.blue.value;
} if (document.optionForm.green.checked) {
return document.optionForm.green.value;
}
}
return {
save : function () {
conf.set({
jenkinsURL : jenkinsUrlTextbox.value,
pollIntervall: pollIntervallTextbox.value,
iconSize: getIconSize(),
successColor: getSuccessColor()
});
showSaveStatus(true);
display();
chrome.extension.getBackgroundPage().jenkins.init();
},
markDirty : function () {
showSaveStatus(false);
},
init : function () {
jenkinsUrlTextbox = document.getElementById("jenkins-url");
pollIntervallTextbox = document.getElementById("poll-intervall");
saveButton = document.getElementById("save-button");
saveStatus = document.getElementById("save-status");
display();
}
};
}(jenkins.conf);