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
<template> | |
<div v-once contenteditable="true" @input="update" v-text="modelValue"></div> | |
</template> | |
<script> | |
export default { | |
props: { | |
modelValue: { | |
type: String, | |
default: '', | |
}, |
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
<template> | |
<div contenteditable="true" @blur="update" v-text="modelValue"></div> | |
</template> | |
<script> | |
export default { | |
props: { | |
modelValue: { | |
type: String, | |
default: '', | |
}, |
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
<template> | |
<card v-model="content" /> | |
</template> | |
<script> | |
import Card from '...' | |
export default { | |
components: { Card }, | |
data() { |
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
Show hidden characters
{ | |
"typeAcquisition": { | |
"include": [ | |
"chrome" | |
] | |
} | |
} |
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
{ | |
"name": "My extension", | |
"content_scripts": [ | |
{ | |
"matches": ["http://*.nytimes.com/*"], | |
"run_at": "document_start", | |
"js": ["contentScript.js"] | |
} | |
] | |
} |
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.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) | |
}) | |
}) |
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
// when content script runs, notify background | |
const port = chrome.runtime.connect({ name: 'hello' }) |
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
function disableIcon(tabId) { | |
chrome.browserAction.setIcon({ | |
tabId: tabId, | |
path: { | |
'16': '/images/icon16-gray.png', | |
'32': '/images/icon32-gray.png', | |
}, | |
}) | |
chrome.browserAction.setPopup({ | |
tabId, |
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
// rename gist |