top | item 8031717

(no title)

nbush | 11 years ago

Cool, I love counterintuitive (and even counterproductive) solutions just for their own sake. I tried to do a similar thing with text a while ago: http://nbush.github.io/headache/

discuss

order

fabrixxm|11 years ago

"Tired of people stealing your content? Looking to make copying HTML text a huge pain for your users? Sick and tired of useful, well-made Python scripts? Headache will make it so users cannot select, copy or paste html text without getting a bunch of garbage as well. Try copying this sentence. No, seriously, try it. Yeah that's right. Now try pasting it somewhere.

Now the only way you can steal my sweet, sweet content is by writing it out letter by letter or writing your own noble script that filters out all the junk. Checkmate.

You might say that this solution is unintuitive, massively inefficient and completely unnecessary. Well that's not the true Hacker Spirit now, is it? " ;)

abbeyj|11 years ago

As a challenge I wanted to see how hard it would be to circumvent this. Here's a bookmarklet: javascript:void(function(s,i){for(i=0;i<s.length;i++)if(window.getComputedStyle(s[i]).color=='transparent')s[i].style.display='none'}(document.getElementsByTagName('span')))

That should be one line with no spaces if gets line wrapped.

nbush|11 years ago

Nice work! Here's another solution posted in an earlier thread: javascript:d=document.createElement("div");d.innerHTML="<style>span:nth-child(odd) {display:none;}</style>";document.body.appendChild(d);

I don't think there's any easy way for the obfuscation to stay ahead of JS reversal. Thanks for taking a look!

awhitty|11 years ago

This is clever! I think it can be circumvented by removing all spans in a paragraph with more than 1 character.

nbush|11 years ago

Thanks! Yeah, there are many JS ways around this, but it would be more than enough to stop most people... including myself in most cases.