Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Clip To WorkFlowy Bookmarklet
javascript: (function C2W2_5() {
function eOPML(str) {
return str
.replace(/&/g, '&')
.replace(/</g, '&amp;lt;')
.replace(/>/g, '&amp;gt;')
.replace(/"/g, '&quot;')
.replace(/(\n)/g, '&#10;');
}
function copy2(str) {
var t = document.createElement('textarea');
t.value = str;
document.body.appendChild(t);
t.select();
document.execCommand('copy');
document.body.removeChild(t);
}
var isWF = location.href.indexOf('https://workflowy.com/#') === 0;
if (isWF && item_select.getSelectedItems().length > 0) {
item_select.clearItemSelection();
}
var bullet = isWF ? '&lt;i&gt;See: &quot;' + eOPML(selectOnActivePage(".selected").getName()[0].textContent) + '&quot;&lt;/i&gt;' : eOPML(document.title);
var selected = eOPML(window.getSelection().toString());
var link = eOPML(location.href);
var note = selected ? '..' + link + '&#10;&#10;' + selected : link;
copy2('<opml><body><outline text="' + bullet + '" _note="' + note + '" /></body></opml>');
if (isWF) {
showMessage('WorkFlowy link is ready to paste.');
setTimeout(function () {
hideMessage();
}, 1500);
}
})();
Owner

rawbytz commented Nov 4, 2017

Go here for draggable install link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment