-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdialog.js
31 lines (27 loc) · 1.04 KB
/
dialog.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
window.onload = function() {
var output = document.querySelector('#output');
var header = document.querySelector('header');
var button = document.querySelector('button');
var div = document.createElement('div');
var message = document.createElement('h4');
var errorMessage = document.createElement('p');
var background = chrome.extension.getBackgroundPage();
if (background.bookmarkRes.status == 200) {
header.classList.add("bg-blue");
button.classList.add("bg-light-blue");
message.innerText = "ブックマークしました!";
} else {
header.classList.add("bg-red");
button.classList.add("bg-blue-grey");
message.innerText = "ブックマークに失敗しました・・・";
errorMessage.innerText = background.bookmarkRes.status + " : " + background.bookmarkRes.statusText;
};
div.appendChild(message);
div.appendChild(errorMessage);
output.appendChild(div);
};
document.addEventListener('DOMContentLoaded', function () {
document.querySelector('button').addEventListener('click', function () {
window.close();
});
});