-
Notifications
You must be signed in to change notification settings - Fork 1
/
actions.js
57 lines (50 loc) · 1.65 KB
/
actions.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
var UI = {
status: function(color, text, timed) {
if (color == null) {
return;
} else if (color == 'green') {
chrome.browserAction.setBadgeBackgroundColor({ color: [0, 255, 0, 255] });
} else if (color == 'red') {
chrome.browserAction.setBadgeBackgroundColor({ color: [255, 0, 0, 255] });
} else if (color == 'orange' ) {
chrome.browserAction.setBadgeBackgroundColor({ color: [255, 128, 0, 255] });
} else if (color == 'azure' ) {
chrome.browserAction.setBadgeBackgroundColor({ color: [0, 128, 255, 255] });
} else if (color == 'gray' ) {
chrome.browserAction.setBadgeBackgroundColor({ color: [0, 128, 128, 128] });
}
chrome.browserAction.setBadgeText({ text: text });
// *** Triggered if the message will be shown just for a short amout of time (specified)
if (timed > 0) {
setTimeout(function() {
chrome.browserAction.setBadgeText({ text: "" });
}, timed);
}
},
clear: function() {
chrome.browserAction.setBadgeText({
text: ''
});
}
}
//chrome.browserAction.onClicked.addListener(function(tab) {
// UI.status('red', "grab");
//
// Screenshotter.grab();
// //chrome.extension.sendMessage({ action: 'grab' });
//});
var $ = jQuery;
$(document).ready(function(){
$(".popup li a").click(function(){
$("ul").hide();
$(".loading").show();
if($(this).attr("class") == "simple"){
UI.status('red', "take");
Screenshotter.grabSimple();
}else{
UI.status('gray', "responsive");
Screenshotter.grabResponsive();
}
// window.setTimeout(window.close, 1000);
});
});