-
-
Save binarweb/39717e8b563bc9a0ad55e7f962a936f0 to your computer and use it in GitHub Desktop.
Enable Right Click and Text Selection Bookmarklet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a class="btn btn-default btn-info bookmarklet" href="javascript:(function(d){var a=d.document,h=function(){},c=a.body||a.getElementsByTagName("body")[0],f=a.documentElement||a.getElementsByTagName("html")[0],k=[c,f,a],l=["webkit","khtml","moz","ms",""],g=["contextmenu","selectstart","select","mousedown","mouseup"],b=d.Selection,e=b&&b.prototype;e&&(e.removeAllRanges=h,b=a.selection)&&(b.clear=h);for(e=k.length;e--;)if(f=k[e]){for(b=g.length;b--;)f["on"+g[b]]=null;if(a=f.style)for(a.cursor="",a.webkitTouchCallout="initial",b=l.length;b--;)a[((c=l[b])?"-"+c+"-":c)+"user-select"]="initial"}(c=d.jQuery||d.Zepto)&&c(d).off(g)})(this);"> | |
Enable Select | |
</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (w) { | |
var d = w.document | |
, n = function(){} | |
, us = 'user-select' | |
, uv = 'initial' | |
, f = 'getElementsByTagName' | |
, b = d.body || d[f]('body')[0] | |
, h = d.documentElement || d[f]('html')[0] | |
, a = [b,h,d] | |
, p = ['webkit','khtml','moz','ms',''] | |
, e = ['contextmenu','selectstart','select','mousedown','mouseup'] | |
, s=w.Selection | |
, i=s&&s.prototype | |
; | |
if ( i ) { | |
i.removeAllRanges = n; | |
if(s=d.selection) s.clear = n; | |
} | |
for(i=a.length;i--;) if(h=a[i]) { | |
for(s=e.length;s--;) h['on'+e[s]] = null; | |
if(d=h.style) { | |
d.cursor = ''; | |
d.webkitTouchCallout = uv; | |
for(s=p.length;s--;) d[((b=p[s])?'-'+b+'-':b)+us] = uv; | |
} | |
} | |
(b = w.jQuery || w.Zepto) && b(w).off(e); | |
}(this)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(d){var a=d.document,h=function(){},c=a.body||a.getElementsByTagName("body")[0],f=a.documentElement||a.getElementsByTagName("html")[0],k=[c,f,a],l=["webkit","khtml","moz","ms",""],g=["contextmenu","selectstart","select","mousedown","mouseup"],b=d.Selection,e=b&&b.prototype;e&&(e.removeAllRanges=h,b=a.selection)&&(b.clear=h);for(e=k.length;e--;)if(f=k[e]){for(b=g.length;b--;)f["on"+g[b]]=null;if(a=f.style)for(a.cursor="",a.webkitTouchCallout="initial",b=l.length;b--;)a[((c=l[b])?"-"+c+"-":c)+"user-select"]="initial"}(c=d.jQuery||d.Zepto)&&c(d).off(g)})(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment