Skip to content

Instantly share code, notes, and snippets.

@chrissound
Created December 17, 2017 14:01
Show Gist options
  • Select an option

  • Save chrissound/c08f62eb9b52347b8a980c3b3de25752 to your computer and use it in GitHub Desktop.

Select an option

Save chrissound/c08f62eb9b52347b8a980c3b3de25752 to your computer and use it in GitHub Desktop.
<span style="color: #d2d22a">──────────────────────────────────────────────────────
</span><span style="color: #d2d22a">modified: scripts/stackoverflow/inject.js
</span><span style="color: #d2d22a">──────────────────────────────────────────────────────
</span><span style="font-weight: bold; color: #E850A8">@ inject.js:33 @</span><span style="font-weight: bold; color: #E850A8"></span><span style="font-weight: bold; color: #7e7ea8"> chrome.storage.local.get(null, function (result) {</span>
Array.from(document.getElementsByTagName('pre')) // get all code snippets
.forEach(function (block) {
<span style="font-weight: bold; color: #aa0000"> block.addEventListener('dblclick', function (event) {</span>
// Reference: http://stackoverflow.com/a/6462980/3485241
// Add snippet to range
<span style="font-weight: bold; color: #E850A8">@ inject.js:71 @</span><span style="font-weight: bold; color: #E850A8"></span><span style="font-weight: bold; color: #7e7ea8"> chrome.storage.local.get(null, function (result) {</span>
} catch (err) {
console.log('Failed to copy', err);
}
<span style="font-weight: bold; color: #aa0000"> });</span>
});
break;
}
}
<span style="font-weight: bold; color: #aa0000">});</span>
\ No newline at end of file
<span style="font-weight: bold; color: #00aa00"></span><span style="font-weight: bold; color: #00aa00">});</span><span style="background-color: #aa0000; color: #000000">
</span>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment