-
Notifications
You must be signed in to change notification settings - Fork 0
/
window.js
30 lines (29 loc) · 1018 Bytes
/
window.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
function initApp() {
var showGanttForSelectedRepo = function () {
$('#gantt').show();
var api = new GitHub($('#repo-select').val());
Promise.all([api.fetchIssues(), api.fetchMilestones()])
.then(function (values) {
Planning.init(values[0], values[1]);
});
};
new GitHub().fetchRepos().then(function (repos) {
repos.forEach(function (repo) {
$('<option></option')
.val(repo.full_name)
.text(repo.full_name)
.appendTo('#repo-select');
});
chrome.storage.sync.get('selectedRepo', function (items) {
if (items.selectedRepo) {
$('#repo-select').val(items.selectedRepo);
showGanttForSelectedRepo();
}
});
});
$('#repo-select').on('change', function () {
chrome.storage.sync.set({selectedRepo: $(this).val()});
showGanttForSelectedRepo()
});
}
$(initApp);