This file contains 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.onMessage.addListener( | |
function(request, sender, sendResponse) { | |
// listen for messages | |
if (request.type === 'fromContent') { | |
// use own func to process (or just store directly) | |
let data = processData(request.data); | |
localStorage.setItem(request.key, JSON.stringify(data)); | |
} else if (request.type == 'fromPopup') { | |
let data = JSON.parse(localStorage.getItem(request.key)); | |
sendResponse({ |
This file contains 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
function passToBackground() { | |
// {replace with code to collect data} | |
chrome.runtime.sendMessage({ | |
type: "fromContent", | |
data: "data" | |
}); | |
} | |
document.querySelector('.button').addEventListener('click', passToBackground); |
This file contains 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({ | |
type: "fromPopup", | |
key: key | |
}, | |
function(response) { | |
displayData(response.data) | |
} | |
); |
This file contains 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": "{PROJECT TITLE}", | |
"description": "{PROJECT DESCRIPTION}", | |
"version": "0.0.0", | |
"background": { | |
"scripts": ["background.js"], | |
"persistent": false |
This file contains 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
// ORIGINAL CODE BY sidneys: https://gist.githubusercontent.com/raw/ee7a6b80315148ad1fb6847e72a22313/ | |
// change single pass to first change | |
/** | |
* ESLint | |
* | |
* @exports | |
*/ | |
/* exported onElementReady */ | |
/* exported waitForKeyElements */ |
This file contains 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
<!-- Index.svelte --> | |
<script> | |
import { faGithub, faLinkedin } from "@fortawesome/free-brands-svg-icons"; | |
import { Icons } from "../components"; | |
const icons = [ | |
{ data: faGithub }, | |
{ data: faLinkedin }, | |
]; | |
</script> |
This file contains 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
<!-- Icons.svelte --> | |
<script> | |
import { Icon } from "../components"; | |
let className; | |
export { className as class }; | |
export let inverse; | |
export let icons; | |
</script> |
This file contains 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
<!-- Icon.svelte --> | |
<script> | |
import FAIcon from "svelte-awesome"; | |
let className; | |
export { className as class }; | |
export let inverse; | |
export let data; | |
</script> |
This file contains 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
// Icons.jsx | |
export const Icons = ({ | |
className, | |
inverse, | |
children | |
}) => ( | |
<div> | |
{React.Children.map(children, icon => ( | |
React.cloneElement(icon, { className, inverse, ...icon.props }) | |
))} |
This file contains 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
// Icon.jsx | |
import { FontAwesomeIcon as FAIcon } from '@fortawesome/react-fontawesome' | |
export const Icon = ({ | |
data, | |
inverse, | |
className = '', | |
}) => ( | |
<a class={className}> | |
<FAIcon icon={data} inverse={inverse} /> |
OlderNewer