Skip to content

Commit 5e70d39

Browse files
committed
Inject content scripts to any page opened
1 parent 76997ce commit 5e70d39

File tree

4 files changed

+33
-33
lines changed

4 files changed

+33
-33
lines changed

js/list.js

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -40,42 +40,33 @@ $(function () {
4040
markup += '</table>';
4141
markup += '</div>';
4242
$('#listContent').html(markup);
43-
});
4443

45-
$('body').on('click', function(evt) {
46-
//evt.preventDefault();
47-
//evt.stopPropagation();
48-
if ($(evt.currentTarget).hasClass('clickListItem')) {
49-
evt.preventDefault();
50-
evt.stopPropagation();
51-
console.log('a.clickListItem');
52-
//chrome.tabs.create({url: $(evt.document.location.reload(true)currentTarget).attr("href")});
53-
}
44+
$('a.clickListItem').on('click', function(evt) {
45+
evt.preventDefault();
46+
evt.stopPropagation();
47+
console.log('a.clickListItem');
48+
chrome.tabs.create({url: $(evt.currentTarget).attr("href")});
5449
});
5550

56-
$('body').on('click', function(evt) {
57-
//evt.preventDefault();
58-
//evt.stopPropagation();
51+
/*
52+
$('a.removeListItem').on('click', function(evt) {
53+
evt.preventDefault();
54+
evt.stopPropagation();
5955
console.log("removeListItem");
60-
if ($(evt.currentTarget).hasClass('removeListItem')) {
61-
evt.preventDefault();
62-
evt.stopPropagation();
63-
//removeListItem($(evt.currentTarget).attr("href"));
64-
var url = $(evt.currentTarget).attr("href");
65-
chrome.extension.sendMesssage({removeDiff:true, url: url}, function(response) {
66-
/*
67-
if (response) {
68-
var notification = webkitNotifications.createNotification(
69-
'icon.png', // icon url - can be relative
70-
'WebPageDiff', // notification title
71-
response // notification body text
72-
);
73-
notification.show();
74-
}
75-
document.location.reload(true);
76-
*/
77-
});
78-
}
56+
var url = $(evt.currentTarget).attr("href");
57+
chrome.extension.sendMesssage({removeDiff:true, url: url}, function(response) {
58+
if (response) {
59+
var notification = webkitNotifications.createNotification(
60+
'icon.png', // icon url - can be relative
61+
'WebPageDiff', // notification title
62+
response // notification body text
63+
);
64+
notification.show();
65+
}
66+
document.location.reload(true);
67+
});
7968
});
69+
*/
70+
});
8071
});
8172

js/showdiff.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log("I am here");

manifest.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,15 @@
1111
"background": {
1212
"scripts": ["background.js"]
1313
},
14-
"permissions": ["notifications", "storage", "tabs", "http://*/"],
14+
"permissions": ["notifications", "storage", "tabs", "*://*/*"],
15+
"content_scripts": [
16+
{
17+
"matches": ["*://*/*"],
18+
"run_at": "document_idle",
19+
"css": ["mystyles.css"],
20+
"js": ["js/showdiff.js"]
21+
}
22+
],
1523
"web_accessible_resources": [
1624
"icon.png"
1725
]

mystyles.css

Whitespace-only changes.

0 commit comments

Comments
 (0)