Author Topic: Remove the right-click disabler / or remove only for Members  (Read 195362 times)

0 Members and 1 Guest are viewing this topic.

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Remove the right-click disabler / or remove only for Members
« on: December 12, 2002, 09:17:06 AM »
To completely remove right click popup

Open the header.html template and remove these lines:
4images V1.7 - 1.7.2
Code: [Select]
  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;


4images V1.7.3 - 1.7.6
Code: [Select]
  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");




Right-click only for Guest, not for Members

search
Code: [Select]
  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");

replace
Code: [Select]
{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}

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: [Select]
  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");

With this:
Code: [Select]
  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;
« Last Edit: February 21, 2009, 11:06:00 PM by V@no »
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

TheOracle

  • Guest
Re: Remove the right-click disabler
« Reply #1 on: September 04, 2005, 03:41:26 PM »
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;


to :

Code: [Select]

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;


Offline jko

  • Pre-Newbie
  • Posts: 1
    • View Profile
Re: Remove the right-click disabler
« Reply #2 on: February 28, 2006, 07:13:49 PM »
I followed these instructions exactly (cut-and-pasted and used find and replace). Right clicking is still disabled in MSIE and Firefox.

??

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Remove the right-click disabler
« Reply #3 on: March 01, 2006, 12:55:47 AM »
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...
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline cme550

  • Pre-Newbie
  • Posts: 5
    • View Profile
Re: Remove the right-click disabler
« Reply #4 on: April 06, 2006, 04:46:42 AM »
Has anyone been able to get this to work? because it doesn't work for me :(

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Remove the right-click disabler
« Reply #5 on: April 06, 2006, 04:58:22 AM »
You removed that javascript code from your your template and still getting copyright popup when right click? huh? I wish I could do that!
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline cme550

  • Pre-Newbie
  • Posts: 5
    • View Profile
Re: Remove the right-click disabler
« Reply #6 on: April 06, 2006, 05:10:24 AM »
You removed that javascript code from your your template and still getting copyright popup when right click? huh? I wish I could do that!

Yes, and I would love to have it removed. I thought this thread was about removing it. Does anyone know how I can do this?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Remove the right-click disabler
« Reply #7 on: April 06, 2006, 06:44:01 AM »
think about it, how a thing can work when it doesnt exist? if you deleted the code, then there is nothing left that would show a popup!
you did something wrong, perhaps forgot to upload edited files or you edited a wrong file, you name it.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline cme550

  • Pre-Newbie
  • Posts: 5
    • View Profile
Re: Remove the right-click disabler
« Reply #8 on: April 07, 2006, 12:16:24 AM »
Ok, whatever, Ill switch to Coppermine

Offline Gwydion

  • Full Member
  • ***
  • Posts: 126
    • View Profile
Re: Remove the right-click disabler
« Reply #9 on: April 09, 2006, 11:16:21 PM »
LOL!
I found Coppermine more complicated than 4imges.

Anyway, removing the fuction part works perfect. Thanks.

Offline tdkpaul

  • Full Member
  • ***
  • Posts: 205
    • View Profile
Re: Remove the right-click disabler
« Reply #10 on: July 15, 2006, 02:30:02 AM »
Ok, whatever, Ill switch to Coppermine
LLLLLLLLLLLLLLLLLLLLLOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLlll

 :lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol:

 :roll:

[EDITED by V@no]
Check your keyboard, I think some of the keys are stuck :P
« Last Edit: July 15, 2006, 07:32:31 AM by V@no »

Offline comicart

  • Full Member
  • ***
  • Posts: 151
    • View Profile
Re: Remove the right-click disabler
« Reply #11 on: September 12, 2006, 06:35:10 PM »
So *this* stays in?
In my header it comes right below the section you said to delete.

Code: [Select]
}

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

?
T

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Remove the right-click disabler
« Reply #12 on: September 13, 2006, 01:15:17 AM »
yes, you are right, in v1.7.3 this was changed.
I've updated the original post.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline MikeR

  • Pre-Newbie
  • Posts: 3
    • View Profile
    • Tactical Chaos
Re: Remove the right-click disabler
« Reply #13 on: November 17, 2006, 08:44:03 PM »
Im using 1.7.1

Is there a way to disable right clicking for ONLY the pictures.

I would like to ba able to right click on links and open them in a new window, and right click to copy text in the comments.

thanks for any help  8)

Offline jimraynor

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: Remove the right-click disabler
« Reply #14 on: January 02, 2007, 04:58:26 AM »
i am using 1.7.4. How can i do this problem