SignalBoost bookmarklet update! Now boosts HTML

Feb 08, 2019 11:59

I am using the signal boost bookmarklet to signal boost this update to the signal boost bookmarklet and if any of you signal boost this and someone boosts that then eventually clearly we will create a vortex in the space-time continuum. :P


astolat posted: SignalBoost bookmarklet
I've now updated the bookmarklet so that it preserves the HTML encoding in the selected text, so for instance if you select a chunk of text that includes an image or links to an AO3 story or to another DW post, the links will be preserved. It does NOT work on embedded video, sorry. :(

javascript:void%20function(){function%20e(){var%20e=%22%22;if(%22undefined%22!=typeof%20window.getSelection){var%20n=window.getSelection();if(n.rangeCount){for(var%20t=document.createElement(%22div%22),o=0,r=n.rangeCount;r%3Eo;++o)t.appendChild(n.getRangeAt(o).cloneContents());e=t.innerHTML}}else%22undefined%22!=typeof%20document.selection%26%26%22Text%22==document.selection.type%26%26(e=document.selection.createRange().htmlText);return%20e}function%20n(){return%20document.getElementsByClassName(%22access-filter%22).length%3E0}function%20t(){var%20e=!n();return%20e||(e=confirm(%22Post%20is%20access-locked.%20Continue%3F%22)),e}function%20o(){var%20n=e(),t=c.substr(0,c.indexOf(%22.%22));t=t.substr(t.lastIndexOf(%22/%22)+1);var%20o=document.title;o=o.substr(o.lastIndexOf(%22%20|%20%22)+3);var%20i=%22%3Cp%3E%22;i=i+'%3Cuser%20name=%22'+t+'%22%3E%20posted:%20',i=i+'%3Cstrong%3E%3Ca%20href=%22'+c+'%22%3E'+o+%22%3C/a%3E%3C/strong%3E%22,i=i,n.length%3E0%26%26(i=i+%22\n%3Cblockquote%3E%20%22+n+%22%3C/blockquote%3E%22),i+=%22%3C/p%3E%22;var%20a=%22Signal%20Boost:%20%22+o;r=r+encodeURIComponent(i)+%22%26subject=%22+encodeURIComponent(a),window.location=r}var%20r=%22https://www.dreamwidth.org/update.bml%3Fevent=%22,c=window.location.href;t()%26%26o()}();

You can just copy and paste that code from the textarea into the URL field of the bookmarklet to upgrade it.

Also here's the underlying javascript in much more readable/editable form for anyone who wants to muck around with it: signal_boost.js on Gist

You can also read this entry on Dreamwidth (
comments)

coding, signal boost, dreamwidth

Previous post Next post
Up