- when on toptal page
- click on the extension
- click on the button load data (can be onload for now)
- fill the form with data from the page
Created
November 24, 2017 21:14
-
-
Save eluttner/6d836ddf4f6e9ac562d9ceedf43d56e4 to your computer and use it in GitHub Desktop.
chrome-read-page-extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chrome.runtime.sendMessage("nkohjkjhdcoklcopgnefoopkpggbmgcj", {data: "hello"}, | |
function(response) { | |
console.log("RESPONSE"); | |
console.log(response); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"manifest_version": 2, | |
"name": "Test", | |
"description": "read page data", | |
"version": "1.1", | |
"browser_action": { | |
"default_icon": "icon.png", | |
"default_popup": "popup.html" | |
}, | |
"content_scripts": [ | |
{ | |
"matches": ["*://*.toptal.com/*"], | |
"js": ["contentscript.js"] | |
} | |
], | |
"externally_connectable": { | |
"matches": ["*://*.toptal.com/*"] | |
}, | |
"permissions": [ | |
"activeTab", | |
"identity", | |
"tabs" | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>read page</title> | |
<style type="text/css"> | |
body { | |
margin: 10px; | |
padding: 10px; | |
white-space: nowrap; | |
width: 250px; | |
height: 400px; | |
} | |
h1 { | |
font-size: 15px; | |
} | |
#container { | |
align-items: center; | |
justify-content: space-between; | |
} | |
.column { | |
float: left; | |
width: 50%; | |
} | |
/* Clear floats after the columns */ | |
.row:after { | |
content: ""; | |
display: table; | |
clear: both; | |
} | |
</style> | |
<script src="popup.js"></script> | |
</head> | |
<body> | |
<h1>Read Page</h1> | |
<input class="row" type="button" id="pull-data" value="Pull data"/> | |
<hr/> | |
<div id="container" class="column"> | |
<span class="row">text</span> | |
<input class="row" type="text" id="text-from-page" /> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("ABCD"); | |
chrome.runtime.onMessage.addListener( | |
function(request, sender, sendResponse) { | |
console.log(request) | |
console.log(sender) | |
}); | |
document.addEventListener('DOMContentLoaded', function () { | |
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { | |
var current = tabs[0]; | |
url = current.url; | |
console.log(url); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment