4images Help / Hilfe > FAQ, Tips

Remove the right-click disabler / or remove only for Members

(1/10) > >>

Jan:
To completely remove right click popup

Open the header.html template and remove these lines:
4images V1.7 - 1.7.2

--- Code: ---  function right(e) {
    if (navigator.appName == 'Netscape' && (e.which == 2 || e.which == 3)) {
      alert("© Copyright by {site_name}");
      return false;
    }
    else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button==2 || event.button == 3)) {
      alert("© Copyright by {site_name}");
      return false;
    }
    return true;
  }
  document.onmousedown=right;
  if (document.layers) window.captureEvents(Event.MOUSEDOWN);
  window.onmousedown=right;
--- End code ---


4images V1.7.3 - 1.7.6

--- Code: ---  function right(e) {
    if ((document.layers || (document.getElementById && !document.all)) && (e.which == 2 || e.which == 3)) {
      alert("© Copyright by {site_name}");
      return false;
    }
    else if (event.button == 2 || event.button == 3) {
      alert("© Copyright by {site_name}");
      return false;
    }
    return true;
  }

  if (document.layers){
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown = right;
  }
  else if (document.all && !document.getElementById){
    document.onmousedown = right;
  }

document.oncontextmenu = new Function("alert('© Copyright by {site_name}');return false");

--- End code ---


Right-click only for Guest, not for Members

search

--- Code: ---  function right(e) {
    if ((document.layers || (document.getElementById && !document.all)) && (e.which == 2 || e.which == 3)) {
      alert("© Copyright by {site_name}");
      return false;
    }
    else if (event.button == 2 || event.button == 3) {
      alert("© Copyright by {site_name}");
      return false;
    }
    return true;
  }

  if (document.layers){
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown = right;
  }
  else if (document.all && !document.getElementById){
    document.onmousedown = right;
  }

document.oncontextmenu = new Function("alert('© Copyright by {site_name}');return false");

--- End code ---

replace

--- Code: ---{if user_loggedout} 
  function right(e) {
    if ((document.layers || (document.getElementById && !document.all)) && (e.which == 2 || e.which == 3)) {
      alert("© Copyright by {site_name}");
      return false;
    }
    else if (event.button == 2 || event.button == 3) {
      alert("© Copyright by {site_name}");
      return false;
    }
    return true;
  }

  if (document.layers){
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown = right;
  }
  else if (document.all && !document.getElementById){
    document.onmousedown = right;
  }

document.oncontextmenu = new Function("alert('© Copyright by {site_name}');return false");
{endif user_loggedout}

--- End code ---

Update: 13.06.2008 / Ivan


Right click popup for everyone, but allow right click on input and textarea fields

in header.html template replace
--- Code: ---  function right(e) {
    if ((document.layers || (document.getElementById && !document.all)) && (e.which == 2 || e.which == 3)) {
      alert("© Copyright by {site_name}");
      return false;
    }
    else if (event.button == 2 || event.button == 3) {
      alert("© Copyright by {site_name}");
      return false;
    }
    return true;
  }

  if (document.layers){
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown = right;
  }
  else if (document.all && !document.getElementById){
    document.onmousedown = right;
  }

document.oncontextmenu = new Function("alert('© Copyright by {site_name}');return false");

--- End code ---

With this:
--- Code: ---  function right(e) {
    if ((document.layers || (document.getElementById && !document.all)) && (e.which == 2 || e.which == 3)) {
      msg(e);
      return false;
    }
    else if (event.button == 2 || event.button == 3) {
      msg(e);
      return false;
    }
    return true;
  }

  function msg(e)
  {
    var target = window.event ? window.event.srcElement : e ? e.target : null;
    if (target.type != "text" && target.type != "textarea" && target.type != "password")
    {
      alert("© Copyright by <?=str_replace("'","\'", "{site_name}");?>");
      return false;
    }
    return true;
  }

  if (document.layers){
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown = right;
  }
  else if (document.all && !document.getElementById){
    document.onmousedown = right;
  }

document.oncontextmenu = msg;

--- End code ---

TheOracle:
For users who uses Mozilla Firefox,

change :


--- Quote ---
function right(e) {
   if (navigator.appName == 'Netscape' && (e.which == 2 || e.which == 3)) {
     alert("© Copyright by {site_name}");
     return false;
   }
   else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button==2 || event.button == 3)) {
     alert("© Copyright by {site_name}");
     return false;
   }
   return true;
 }
 document.onmousedown=right;
 if (document.layers) window.captureEvents(Event.MOUSEDOWN);
 window.onmousedown=right;


--- End quote ---

to :


--- Code: ---
function right(e) {
   if (navigator.appName == 'Netscape' && (e.which == 2 || e.which == 3)) {
     alert("© Copyright by {site_name}");
     return false;
   }
   else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button==2 || event.button == 3)) {
     alert("© Copyright by {site_name}");
     return false;
   }
   else if (navigator.appName == 'Mozilla Firefox' && (event.button == 2 || event.button == 3)) {
     alert("© Copyright by {site_name}");
     return false;
   }
   return true;
 }
 document.onmousedown=right;
 if (document.layers) window.captureEvents(Event.MOUSEDOWN);
 window.onmousedown=right;


--- End code ---

jko:
I followed these instructions exactly (cut-and-pasted and used find and replace). Right clicking is still disabled in MSIE and Firefox.

??

V@no:
cut-and-paste ???
There is nothing to paste, only cut! ;)

P.S. Disregard TheOracle's post, since it wasnt related to this topic...as usual...

cme550:
Has anyone been able to get this to work? because it doesn't work for me :(

Navigation

[0] Message Index

[#] Next page

Go to full version