// ==UserScript==
// @name          No Right Click Disabler
// @description   Block right click disablers and related annoyances
// @namespace     http://www.gozer.org/mozilla/greasemonkey/
// @include       *
// ==/UserScript==

var s = document.createElement('script');

s.innerHTML = '(function()' +
              '{' +
              '  function hasHandler(e) {' +
              '    return(e && e.toString().indexOf("alert") != -1);' +
              '  }' +

              // http://www.dynamicdrive.com/dynamicindex9/noright.htm
              // http://www.codelifter.com/main/javascript/norightclick1.html
              '  if(hasHandler(window.oncontextmenu) ||' +
              '     hasHandler(document.oncontextmenu))' +
              '    window.oncontextmenu = document.oncontextmenu = null;' +
              '  if(hasHandler(window.onmousedown) ||' +
              '     hasHandler(document.onmousedown))' +
              '    window.onmousedown = document.onmousedown = null;' +

              // http://www.dynamicdrive.com/dynamicindex9/noright2.htm
              '  if(hasHandler(window.onmouseup) ||' +
              '     hasHandler(document.onmouseup))' +
              '    window.onmouseup = document.onmouseup = null;' +
            /*'  document.body.addEventListener("mousedown", function(e) {' +
              '    if(hasHandler(e.originalTarget.onmousedown))' +
              '      e.originalTarget.onmousedown = null;' +
              '  }, true);' +*/
              '})();';

document.body.appendChild(s);
