Skip to content

Commit cd4aa6e

Browse files
committed
Deleted links.js and moved function to page_action.js
1 parent 402adc6 commit cd4aa6e

File tree

3 files changed

+11
-27
lines changed

3 files changed

+11
-27
lines changed

src/browser/chrome/links.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/browser/chrome/page_action.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,5 @@
3535
<a href="https://rewindjs.io">rewindjs.io</a>
3636
<a href="https://github.com/reactrewind/react-rewind">Github</a>
3737
<script src="page_action.js"></script>
38-
<script type="text/javascript" src="devtools.js"></script>
3938
</body>
4039
</html>

src/browser/chrome/page_action.js

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
document.addEventListener('DOMContentLoaded', () => {
2-
const btn = document.querySelector('#gitHub_btn');
3-
btn.addEventListener('click', () => {
4-
chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {
5-
chrome.tab.create({ url:'https://github.com/reactrewind/react-rewind' });
6-
});
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-
// });
14-
});
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+
}
1512
});

0 commit comments

Comments
 (0)