Skip to content

Instantly share code, notes, and snippets.

View jr-codes's full-sized avatar

JR Shampang jr-codes

  • DISCO
  • Milwaukee, WI
View GitHub Profile
@mathiasbynens
mathiasbynens / unsafeWindow.user.js
Created August 13, 2011 13:21
`unsafeWindow` polyfill (for use in user scripts)
// ==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();
@aidilfbk
aidilfbk / disableSelection.jquery.js
Created August 14, 2010 11:48
jQuery plugin to prevent selection of text
// 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');
});