Skip to content

Commit 4a089f0

Browse files
committed
Lesson-1-and-Lesson-2
0 parents  commit 4a089f0

File tree

11 files changed

+80
-0
lines changed

11 files changed

+80
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

Lesson-1-HelloChrome/icon.png

1.37 KB
Loading

Lesson-1-HelloChrome/manifest.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "HelloChrome",
3+
"version": "1.0.0",
4+
"manifest_version": 2,
5+
"description": "对我说 Hello,Chrome",
6+
"browser_action": {
7+
"default_title": "查看",
8+
"default_icon":"icon.png",
9+
"default_popup": "popup.html"
10+
}
11+
}

Lesson-1-HelloChrome/popup.html

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="zh-CN">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Document</title>
6+
7+
</head>
8+
<body style="width:300px; height:100px">
9+
<h1>Hello, Chrome</h1>
10+
</body>
11+
</html>

Lesson-1-HelloChrome/popup.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
var bg = chrome.extension.getBackgroundPage();
3+
4+
$(function(){
5+
$('#input').val(bg.count);
6+
$('#btn').click(function(){
7+
bg.count = bg.count+1;
8+
$('#input').val(bg.count);
9+
});
10+
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
var count = 10;

Lesson-2-PopupAndBackground/icon.png

1.37 KB
Loading

Lesson-2-PopupAndBackground/jquery-2.1.4.min.js

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "HelloChrome",
3+
"version": "1.0.0",
4+
"manifest_version": 2,
5+
"description": "对我说 Hello,Chrome",
6+
"browser_action": {
7+
"default_title": "查看",
8+
"default_icon":"icon.png",
9+
"default_popup": "popup.html"
10+
},
11+
"background" : {
12+
"scripts": ["background.js"],
13+
"persistent": false
14+
}
15+
}
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html lang="zh-CN">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Document</title>
6+
<script src="jquery-2.1.4.min.js"></script>
7+
<script src="popup.js">
8+
9+
10+
</script>
11+
12+
</head>
13+
<body style="width:300px ;height:300px">
14+
<h1>Hello, Chrome</h1>
15+
<input type="text" id="input" value="0">
16+
<button id="btn">+1</button>
17+
</body>
18+
</html>

Lesson-2-PopupAndBackground/popup.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
var bg = chrome.extension.getBackgroundPage();
3+
$(function(){
4+
5+
$('#input').val(bg.count);
6+
$('#btn').click(function(){
7+
bg.count = bg.count+1;
8+
$('#input').val(bg.count);
9+
});
10+
})

0 commit comments

Comments
 (0)