Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Enable Right Click and Text Selection Bookmarklet
<a class="btn btn-default btn-info bookmarklet" href="javascript:(function(w){var d=w.document,us='user-select',uv='initial',f='getElementsByTagName',b=d.body||d[f]('body')[0],h=d.documentElement||d[f]('html')[0],w=[b,h,d],p=['webkit','khtml','moz','ms',''],e=['contextmenu','selectstart','select','mousedown','mouseup'],i,s;for(i=w.length;i--;)if(h=w[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)&amp;&amp;b(w).off(e)}(this));">
Enable Select
</a>
(function (w) {
var d = w.document
, us = 'user-select'
, uv = 'initial'
, f = 'getElementsByTagName'
, b = d.body || d[f]('body')[0]
, h = d.documentElement || d[f]('html')[0]
, w = [b,h,d]
, p = ['webkit','khtml','moz','ms','']
, e = ['contextmenu','selectstart','select','mousedown','mouseup']
, i
, s
;
for(i=w.length;i--;) if(h=w[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));
javascript:(function(w){var d=w.document,us='user-select',uv='initial',f='getElementsByTagName',b=d.body||d[f]('body')[0],h=d.documentElement||d[f]('html')[0],w=[b,h,d],p=['webkit','khtml','moz','ms',''],e=['contextmenu','selectstart','select','mousedown','mouseup'],i,s;for(i=w.length;i--;)if(h=w[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));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment