-
Notifications
You must be signed in to change notification settings - Fork 5
/
app.js
executable file
·48 lines (40 loc) · 1.33 KB
/
app.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
document.addEventListener('DOMContentLoaded', function() {
chrome.tabs.getSelected(null, function(tab) {
let url = tab.url;
// Check for proper hosting server
let server = setServer(url);
if (server == UNKNOWN_SERVER) return;
// Check for proper request
let urlInfo = parseURL(url);
if (urlInfo == UNKNOWN_REQUEST) return;
// Check for account info
checkAccountInfo((account) => {
// Set basic config
setConfig({
account,
repo: urlInfo.repo,
server
}, () => {
// Call content script to gather UI info
let commitType = urlInfo.commitType;
getUiInfo({
commitType
}, ({
uiInfo
}) => {
let requestInfo = {
...urlInfo,
...uiInfo
};
// Perform the request
performRequest({
requestInfo
});
});
});
});
});
// Push new commit to the server
let push_commit = document.getElementById('push_commit')
if (push_commit) addEventListener('click', pushCommit);
});