-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
25 lines (21 loc) · 904 Bytes
/
popup.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
// DistractMeNot - popup.js
// Author: Eric Liang
// Author URI: https://www.eric-liang.com
// Author Github URI: https://www.github.com/ewliang
// Project Repository URI: https://github.com/ewliang/DistractMeNot-Chrome-Extension
// Description: Handles all the Chrome Extension UI popup.html activities (e.g. button clicks, etc.)
// License: MIT
var urlInput = document.getElementById('urlInput');
var addURLButton = document.getElementById('addURLButton');
var activationToggle = document.getElementById('activationToggle');
var resetButton = document.getElementById('resetButton');
addURLButton.onclick = function() {
chrome.runtime.sendMessage({ url: urlInput.value }, function(response) {
console.log(response.backendMessage);
});
};
resetButton.onclick = function() {
chrome.runtime.sendMessage({ reset: true }, function(response) {
console.log(response.backendMessage);
});
};