This file contains 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
// ==UserScript== | |
// @name Emulate `unsafeWindow` in browsers that don’t support it. | |
// ==/UserScript== | |
// http://mths.be/unsafewindow | |
window.unsafeWindow || ( | |
unsafeWindow = (function() { | |
var el = document.createElement('p'); | |
el.setAttribute('onclick', 'return window;'); | |
return el.onclick(); |
This file contains 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
// Usage: $("elements").disableSelection() | |
(function($){ | |
$.fn.extend({ | |
disableSelection : function() { | |
return this.each(function() { | |
this.onselectstart = function(){return false;}; | |
this.unselectable = "on"; | |
jQuery(this).css({'-moz-user-select': 'none', '-webkit-user-select': 'none', 'user-select': 'none'); | |
}); |