Skip to content

Instantly share code, notes, and snippets.

@renehuber
renehuber / enlink.js
Created May 2, 2012 11:51
Evernote Note Link Bookmarklet
@renehuber
renehuber / gist:2576088
Created May 2, 2012 11:59
Embedding a Github-hosted script in a bookmarklet
// Minifiy the following with http://jscompress.com/ and save the string in a Bookmark in your browser
javascript:(function() {
var extScript = document.createElement('script');
extScript.type = 'text/javascript';
extScript.src = 'https://raw.github.com/gist/2576050/009a1d68f3c308bf8ebb041a3b3137d01713673d/enlink.js';
document.body.appendChild(extScript);
}());
@renehuber
renehuber / gist:2959472
Created June 20, 2012 11:38
Plaintext contentEditable DIVs
/**
* Event handler to prevent richtext and linebreaks in contentEditable DIVs
*/
$('body').on('keydown paste', 'div.editfield', function(e) {
var $field = $(e.currentTarget);
if (e.keyCode===13 && $field.hasClass('multiline')) {
return true;
} else if (e.keyCode===13 || e.type==='paste') {
setTimeout(function() {
$field.html($field.text());