View Card.vue
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
<template> | |
<div v-once contenteditable="true" @input="update" v-text="modelValue"></div> | |
</template> | |
<script> | |
export default { | |
props: { | |
modelValue: { | |
type: String, | |
default: '', | |
}, |
View Card.vue
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
<template> | |
<div contenteditable="true" @blur="update" v-text="modelValue"></div> | |
</template> | |
<script> | |
export default { | |
props: { | |
modelValue: { | |
type: String, | |
default: '', | |
}, |
View App.vue
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
<template> | |
<card v-model="content" /> | |
</template> | |
<script> | |
import Card from '...' | |
export default { | |
components: { Card }, | |
data() { |
View jsconfig.json
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
Show hidden characters
{ | |
"typeAcquisition": { | |
"include": [ | |
"chrome" | |
] | |
} | |
} |
View manifest.json
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
{ | |
"name": "My extension", | |
"content_scripts": [ | |
{ | |
"matches": ["http://*.nytimes.com/*"], | |
"run_at": "document_start", | |
"js": ["contentScript.js"] | |
} | |
] | |
} |
View background.js
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.onConnect.addListener(port => { | |
const tabId = port && port.sender && port.sender.tab.id | |
if (port.name === 'hello') { | |
enableIcon(tabId) | |
} | |
// disable icon when connection is closed | |
port.onDisconnect.addListener(() => { | |
disableIcon(tabId) | |
}) | |
}) |
View contentscript.js
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
// when content script runs, notify background | |
const port = chrome.runtime.connect({ name: 'hello' }) |
View background.js
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 disableIcon(tabId) { | |
chrome.browserAction.setIcon({ | |
tabId: tabId, | |
path: { | |
'16': '/images/icon16-gray.png', | |
'32': '/images/icon32-gray.png', | |
}, | |
}) | |
chrome.browserAction.setPopup({ | |
tabId, |
View GenerateAudioWaveform
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
// rename gist |