Skip to content

Commit a1b2051

Browse files
committed
Add extension skeleton with manifest and a background script which GETs the tab HTML on browser action click.
1 parent 76eb17f commit a1b2051

File tree

5 files changed

+57
-2
lines changed

5 files changed

+57
-2
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
WebPageDiff
2-
===========
1+
# WebPageDiff
32

43
A Chrome extension for tracking when web pages change.

background.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
console.log("hello, guys");
2+
3+
chrome.browserAction.onClicked.addListener(function(tab) {
4+
console.log(tab);
5+
console.log("GET "+tab.url);
6+
var xhr = new XMLHttpRequest();
7+
xhr.open('GET', tab.url, true);
8+
xhr.onreadystatechange = function() {
9+
if (xhr.readyState === this.DONE) {
10+
console.log(xhr.responseText);
11+
}
12+
}
13+
xhr.send();
14+
});

icon.png

2.4 KB
Loading

manifest.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "Web Page Diff",
3+
"description": "Track when a web page changes.",
4+
"version": "0.0.1",
5+
"manifest_version": 2,
6+
"browser_action": {
7+
"default_icon" : "icon.png",
8+
"default_title": "Add to Web Page Diff"
9+
},
10+
"background": {
11+
"scripts": ["background.js"]
12+
},
13+
"permissions": ["http://*/"]
14+
}

notes.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Get Started Developing
2+
3+
- Open Window > Extensions.
4+
- Check Developer mode box.
5+
- Click the Load unpacked extension button. A file dialog appears.
6+
- In the file dialog, navigate to WebPageDiff and click OK.
7+
- Click on `_generated_background_page.html`. Welcome to a REPL.
8+
- Visit a page in a new tab.
9+
- Find the green puzzle browser action button.
10+
- Click on it. With any luck, the html for the page will show up in the log.
11+
12+
# Interesting Chrome Extension Docs
13+
14+
[Overview](http://developer.chrome.com/extensions/overview.html) of the technology.
15+
Set things up in the [Manifest File](http://developer.chrome.com/extensions/manifest.html).
16+
Click on a Browser Action Button to add a page to Web Page Diff.
17+
[Background Pages](http://developer.chrome.com/extensions/background_pages.html) serves as our worker process.
18+
In the future we would use [Event Pages](http://developer.chrome.com/extensions/event_pages.html) but the periodic [alarms api](http://developer.chrome.com/extensions/alarms.html) "requires Google Chrome dev channel or newer".
19+
[Content Scripts](http://developer.chrome.com/extensions/content_scripts.html) patch an already loaded page.
20+
21+
Look at the [Tutorial to Get Started](http://developer.chrome.com/extensions/getstarted.html). Follow with the [Debugging Tutorial](http://developer.chrome.com/extensions/tut_debugging.html).
22+
23+
Steal code from [Samples](http://developer.chrome.com/extensions/samples.html).
24+
25+
[chrome.* API](http://developer.chrome.com/extensions/api_index.html)
26+
27+
[XMLHTTPRequest](http://developer.chrome.com/extensions/xhr.html) basics.
28+

0 commit comments

Comments
 (0)