June 26, 2011

Tutorial: Disable Highlight


I bet many of you hate it when some d*cks steal your contents without asking. With this tutorial, they can stop doing that because they can't copy sh*t from you anymore since we've disabled highlight.

1. Dashboard -> Design -> Page Element -> Add a Gadget -> HTML/JavaScript
2. Copy the code below and paste it in the HTML/JavaScript box.

<script type="text/javascript">
function disableSelection(target){
if (typeof target.onselectstart!="undefined") //IE route
target.onselectstart=function(){return false}
else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
else //All other route (ie: Opera)
target.onmousedown=function(){return false}
target.style.cursor = "default"
//Sample usages
//disableSelection(document.body) //Disable text selection on entire body
//disableSelection(document.getElementById("mydiv")) //Disable text selection on element with id="mydiv"
<script type="text/javascript">
disableSelection(document.body) //disable text selection on entire body of page

3. Click Save

Lots of love!

Credit: Unwanted

No comments:

Post a Comment

~ Mind your words. I ain't dealing with rude people. ~