-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent.js
31 lines (28 loc) · 1.05 KB
/
content.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
function hideComments() {
console.log("content.hideComments");
$('.inline-comments').hide();
}
function showComments() {
console.log("content.showComments");
$('.inline-comments').show();
}
chrome.extension.onMessage.addListener(
function(request, sender, sendResponse) {
console.log(sender.tab ?
"from a content script:" + sender.tab.url :
"from the extension");
if (request.action == "hide") {
hideComments();
} else if (request.action == "show") {
showComments();
}
});
$('body').append('<div style="position:fixed; bottom: 0; right: 0; padding: 5px; ' +
'border: 1px solid #D4D4D4; border-bottom-color: #BCBCBC; ' +
'border-radius: 3px;' +
'background:-webkit-linear-gradient(#FAFAFA,#EAEAEA);">' +
'Comments: <a href="javascript:$(\'.inline-comments\').hide();">Hide</a> ' +
'<a href="javascript:$(\'.inline-comments\').show();">Show</a>' +
'</div>');
console.log($('body'));
console.log('added');