Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added src/browser/chrome/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion src/browser/chrome/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"description": "Time travel",
"manifest_version": 2,
"page_action": {
"default_icon": {
"32": "icon.png"
},
"default_popup": "page_action.html"
},
"background": {
Expand All @@ -24,7 +27,7 @@
"webRequestBlocking"
],
"web_accessible_resources": [
"scripts/deepclone_bundle.js"
"scripts/deepclone_bundle.js"
],
"devtools_page": "devtools.html"
}
30 changes: 27 additions & 3 deletions src/browser/chrome/page_action.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,35 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Page Action</title>
<script src="links.js"></script>
<style>
html, body {
font-size:14px;
min-width: 460px;
min-height: 60px;
}
body {
margin: 8px;
}
hr {
width: 100%;
}

button {
height: 30px;
width: 100px;
outline: none;
}
a:link {
text-decoration: none;
}
</style>
</head>
<body>
Page Action
<a href="http://www.google.com">Test - goto google</a>
<button id="color_btn">CHANGE COLOR!</button>
<p><strong>React Rewind</strong></p>
<p>Open Chrome developer tools, React Rewind tab is on the right.</p>
<a href="https://rewindjs.io">rewindjs.io</a>
<a href="https://github.com/reactrewind/react-rewind">Github</a>
<script src="page_action.js"></script>
</body>
</html>
19 changes: 11 additions & 8 deletions src/browser/chrome/page_action.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
document.addEventListener('DOMContentLoaded', () => {
const btn = document.querySelector('#color_btn');
btn.addEventListener('click', () => {
chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {
console.log(tabs);
chrome.tabs.sendMessage(tabs[0].id, "change_color");
});
});
document.addEventListener('DOMContentLoaded', function() {
var links = document.getElementsByTagName('a');
for (var i = 0; i < links.length; i++) {
(function() {
var ln = links[i];
var location = ln.href;
ln.onclick = function() {
chrome.tabs.create({active: true, url: location});
};
})();
}
});