Skip to content

Commit 1204b7e

Browse files
committed
Pop up.
1 parent de7472e commit 1204b7e

File tree

4 files changed

+54
-5
lines changed

4 files changed

+54
-5
lines changed

src/browser/chrome/links.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
document.addEventListener('DOMContentLoaded', function() {
2+
var links = document.getElementsByTagName('a');
3+
for (var i = 0; i < links.length; i++) {
4+
(function() {
5+
var ln = links[i];
6+
var location = ln.href;
7+
ln.onclick = function() {
8+
chrome.tabs.create({active: true, url: location});
9+
};
10+
})();
11+
}
12+
});

src/browser/chrome/manifest.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
"description": "Time travel",
55
"manifest_version": 2,
66
"page_action": {
7+
// "default_icon": {
8+
// "16": "images/icon16.png",
9+
// "24": "images/icon24.png",
10+
// "32": "images/icon32.png"
11+
// },
712
"default_popup": "page_action.html"
813
},
914
"background": {

src/browser/chrome/page_action.html

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,36 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<meta http-equiv="X-UA-Compatible" content="ie=edge">
77
<title>Page Action</title>
8+
<script src="links.js"></script>
9+
<style>
10+
html, body {
11+
font-size:14px;
12+
min-width: 460px;
13+
min-height: 60px;
14+
}
15+
body {
16+
margin: 8px;
17+
}
18+
hr {
19+
width: 100%;
20+
}
21+
22+
button {
23+
height: 30px;
24+
width: 100px;
25+
outline: none;
26+
}
27+
a:link {
28+
text-decoration: none;
29+
}
30+
</style>
831
</head>
932
<body>
10-
Page Action
11-
<button id="color_btn">CHANGE COLOR</button>
33+
<p><strong>React Rewind</strong></p>
34+
<p>Open Chrome developer tools, React Rewind tab is on the right.</p>
35+
<a href="https://rewindjs.io">rewindjs.io</a>
36+
<a href="https://github.com/reactrewind/react-rewind">Github</a>
1237
<script src="page_action.js"></script>
38+
<script type="text/javascript" src="devtools.js"></script>
1339
</body>
1440
</html>

src/browser/chrome/page_action.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
document.addEventListener('DOMContentLoaded', () => {
2-
const btn = document.querySelector('#color_btn');
2+
const btn = document.querySelector('#gitHub_btn');
33
btn.addEventListener('click', () => {
44
chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {
5-
console.log(tabs);
6-
chrome.tabs.sendMessage(tabs[0].id, "change_color");
5+
chrome.tab.create({ url:'https://github.com/reactrewind/react-rewind' });
76
});
7+
// chrome.runtime.getURL('https://github.com/reactrewind/react-rewind');
8+
// btn.addEventListener('click', () => {
9+
// chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {
10+
// console.log(tabs);
11+
// chrome.tabs.sendMessage(tabs[0].id, "change_color");
12+
13+
// });
814
});
915
});

0 commit comments

Comments
 (0)