vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   Mini Mods - Disable right click on your forum. (https://vborg.vbsupport.ru/showthread.php?t=237481)

borbole 03-03-2010 10:00 PM

Disable right click on your forum.
 
1 Attachment(s)
This script taken from dynamic drive will disable the right click on your forum for guests. As to offer some protection to your materials being stolen from your forum.

Note: This will prevent them only for the right click and copy/paste directly.

Anyway, add the following code to the very begin of the headinclude template.

Code:

<vb:if condition="$show['guest']">
<script type="text/javascript">
<!--

//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

var message="Right click is disabled for guests!";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

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

document.oncontextmenu=new Function("alert(message);return false")

// -->
</script>
</vb:if>

To change the message shown to guests when attempting to right click at your forum, find the following code:

Code:

var message="Right click is disabled for guests!";
And change the text
Code:

Right click is disabled for guests!
with your own message.

RedHacker 03-04-2010 05:15 PM

This disable and the "CODE" "/CODE" .....?

borbole 03-04-2010 05:27 PM

Quote:

Originally Posted by RedHacker (Post 1997124)
This disable and the "CODE" "/CODE" .....?

I am not sure what you are asking. This will disable the ability to use the right click at your forum for all the guests.

whitedd 03-04-2010 11:28 PM

...what about ctrl+c???...

borbole 03-05-2010 09:21 AM

Quote:

Originally Posted by whitedd (Post 1997389)
...what about ctrl+c???...

This disables only the right click.

Quote:

Originally Posted by Dr.osamA (Post 1997379)
thanxxx

installed

not working with Opera but with ff it is ok

plzz lok for CODE working with IE Opera & FF

I will look into it.

TimberFloorAu 03-05-2010 09:27 AM

Why bother ?

When the context menu has been disabled like this it can be easily re-enabled by typing javascript:void oncontextmenu(null) into the address bar of the browser.

View source code in nearly every browser.

Opera ignores no right clicks anyhoo.

All you will do is piss people off

borbole 03-05-2010 11:37 AM

You got a point TimberFloorAu. There is no 100% of preventing that but we might as well try to make them work harder :D

TimberFloorAu 03-05-2010 11:07 PM

LOL

You should do the javascript version. When they right click they get a warning, if they do it again : it will redirect them to a porn site !

Markos 03-07-2010 03:14 PM

how do i set it so no one can do it ?? for certain user groups

borbole 03-07-2010 04:07 PM

Quote:

Originally Posted by Markos (Post 1999160)
how do i set it so no one can do it ?? for certain user groups

Replace the code with this one:

Code:

<vb:if condition="is_member_of($bbuserinfo, 1,2,3)">
<script type="text/javascript">
<!--

//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

var message="Right click is disabled for guests!";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

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

document.oncontextmenu=new Function("alert(message);return false")

// -->
</script>
</vb:if>


And change the gids 1,2,3 with your own usergroups ids that you don''t want to use the right click function at your forum.

JenniferK 03-17-2010 01:34 PM

Can this work if I want to allow right click in one section only? I want to allow it there, but no where else on the site.

borbole 03-17-2010 01:43 PM

Quote:

Originally Posted by JenniferK (Post 2005518)
Can this work if I want to allow right click in one section only? I want to allow it there, but no where else on the site.

Yes, I suppose it could. Have a look at the template conditional article and you should change the template as well depending on where you want to apply it.

EconomicVoice 03-21-2010 05:31 PM

I use TYNT. If someone copies and pastes it will leave a link back (unless they remove it). You can also monitor how much and what is being copied.

Classico 04-11-2010 08:56 PM

Working fine.

Thanks!

borbole 04-12-2010 06:29 PM

You are welcome.

Reef Man 04-15-2010 01:41 PM

How can I select wich groups additional to the guests, can not use right click?

Selcor 04-17-2010 05:56 PM

Not work (in vb4.0.3) :erm:

Should work in all browsers?.

It may be configured to apply to certain groups of users?.

Greetings!.

borbole 04-17-2010 08:25 PM

It works fine on a vb 4.0.3. as well. Did you add it according to the instructions?

Whereas to make it so it will apply to other usergroups as well, have a look at the template conditionals at the Article Sections.

borbole 04-18-2010 07:39 PM

Quote:

Originally Posted by Reef Man (Post 2021685)
How can I select wich groups additional to the guests, can not use right click?

Have a look at this article.

https://vborg.vbsupport.ru/showthread.php?t=231525

SCSCSC 04-24-2010 09:49 PM

can we have this for particular forum?

borbole 04-25-2010 01:57 PM

Quote:

Originally Posted by SCSCSC (Post 2026741)
can we have this for particular forum?

Yes, you can. Have a look at the link I posted at my previous post.

Flyte 09-24-2010 02:22 AM

This is great but I am using the light box image viewer
when people click the thumbnail twice to maximize the image size the 'disable right click' function does not work.
Can you help me with this please?
How can I disable the function that allows guests to click on thumbnails two times?

Thanks!

iyama 10-03-2010 10:12 AM

Only for copy/paste :(

Is there something for look the site info cq source ?

InsomniacP 10-03-2010 10:53 AM

Installed cheers! I have a graphics site so this is perfect!!!

ravencr 10-04-2010 04:51 PM

I just copied this and pasted it into my header include twice, one for guests and one for members, so nobody can right click. Thanks for the mod...this was a piece of cake.

Chris

pportuese 10-05-2010 07:50 PM

Where exactly where do you add the code?

ti07shadow 10-07-2010 08:07 PM

umm you do know that even if you disable right click all they have to do is disable javascript. or better yet all they have to do is click view > Page Source.. so this really wouldnt matter

mondiuk 10-11-2010 12:06 AM

I been looking for this for months,
Thank You..

GeorgeEcuador 03-22-2011 06:05 PM

as I do to put a given message when I right click disable all forum content serves these codes.

K!nG 06-22-2011 03:36 AM

IS there a way that we can make this mod work in a way that no one can even highlight the thread or post ? If we can do that no one will be able to even copy it via keyboard by pressin ctrl c i have seen couple of sties they have done that ? is there any other mod for that ?? Thanks

BadgerDog 06-22-2011 10:57 AM

1 Attachment(s)
Interesting idea, but doesn't work well in newer browser version ... ;)

For example, FireFox 4.01 shows the "block" as in the pic attached, but if the user clicks the checkbox shown, the block doesn't work from then onwards. :D

Anyway, would be great to have mod like this that would be more effective in blocking guests from capturing copyrighted pics.

Regardless, thanks to the developer here for his efforts in posting this one .. :up:

Regards,
Doug

apaydin2148 01-30-2012 08:35 PM

with this script you can disable text selection. like in the first post you must copy into top of headinclude template. enjoy. :)

Code:

<vb:if condition="is_member_of($bbuserinfo, 1,2,3)">
<script type="text/javascript">
    function returnFalse(e){
      return false;
    }

    function cancelEvent(e){
      if(e.preventDefault)e.preventDefault();
      else e.returnValue=false;
    }

    function addHandler(e,event,action,param){
      if(document.addEventListener)e.addEventListener(event,action,param);
      else if(document.attachEvent)e.attachEvent('on'+event,action);
      else e['on'+event]=action;
    }

    function removeHandler(e,event,action,param){
      if(document.addEventListener)e.removeEventListener(event,action,param);
      else if(document.attachEvent)e.detachEvent('on'+event,action);
      else e['on'+event]=returnFalse;
    }

    addHandler(document,'mousedown',mouseDown,false);
    addHandler(document,'mouseup',mouseUp,false);

    function mouseDown(e){
      // HACK: calling no selection for class name = "handle hover"
      //if(e.target.className=="handle hover")
      if((e.target.nodeName!="INPUT")&&
        (e.target.nodeName!="TEXTAREA")&&
        (e.target.nodeName!="H1")&&
        (e.target.nodeName!="H2")&&
        (e.target.nodeName!="H3")&&
        (e.target.nodeName!="P")&&
        (e.target.id.substr(0,3)!="lbl")&&
        (e.target.id.substr(0,3)!="ttl")
        )
      {
          e=e||event;
          cancelEvent(e);
          addHandler(document,'selectstart',returnFalse,false);
      }
    }

    function mouseUp(e){
      removeHandler(document,'selectstart',returnFalse,false);
    }
</script></vb:if>


lapiervb 02-04-2012 10:15 AM

Can it disable right click for the members also?

shiraz sat 06-05-2012 03:46 PM

Quote:

Originally Posted by apaydin2148 (Post 2294320)
with this script you can disable text selection. like in the first post you must copy into top of headinclude template. enjoy. :)

Code:

<vb:if condition="is_member_of($bbuserinfo, 1,2,3)">
<script type="text/javascript">
    function returnFalse(e){
      return false;
    }

    function cancelEvent(e){
      if(e.preventDefault)e.preventDefault();
      else e.returnValue=false;
    }

    function addHandler(e,event,action,param){
      if(document.addEventListener)e.addEventListener(event,action,param);
      else if(document.attachEvent)e.attachEvent('on'+event,action);
      else e['on'+event]=action;
    }

    function removeHandler(e,event,action,param){
      if(document.addEventListener)e.removeEventListener(event,action,param);
      else if(document.attachEvent)e.detachEvent('on'+event,action);
      else e['on'+event]=returnFalse;
    }

    addHandler(document,'mousedown',mouseDown,false);
    addHandler(document,'mouseup',mouseUp,false);

    function mouseDown(e){
      // HACK: calling no selection for class name = "handle hover"
      //if(e.target.className=="handle hover")
      if((e.target.nodeName!="INPUT")&&
        (e.target.nodeName!="TEXTAREA")&&
        (e.target.nodeName!="H1")&&
        (e.target.nodeName!="H2")&&
        (e.target.nodeName!="H3")&&
        (e.target.nodeName!="P")&&
        (e.target.id.substr(0,3)!="lbl")&&
        (e.target.id.substr(0,3)!="ttl")
        )
      {
          e=e||event;
          cancelEvent(e);
          addHandler(document,'selectstart',returnFalse,false);
      }
    }

    function mouseUp(e){
      removeHandler(document,'selectstart',returnFalse,false);
    }
</script></vb:if>


Hello
This script can also be used for other user groups?
Please Help

30022 07-11-2012 08:45 AM

Works but in Chrome the scrollbars dont work, so if you dont have a mouse wheel you can't scroll down to read the full content.

I'm using both the right click disable & the disable copy text, not sure which one or both causes this to happen.

davidg 07-11-2012 07:40 PM

Quote:

Originally Posted by TimberFloorAu (Post 1998098)
LOL

You should do the javascript version. When they right click they get a warning, if they do it again : it will redirect them to a porn site !

briliant idea lol
if u can make it please share it with us

faisaly.com 10-07-2012 06:04 PM

Quote:

LOL

You should do the javascript version. When they right click they get a warning, if they do it again : it will redirect them to a porn site !
why give them that kind of enjoyment, why not send them to a different site!

wildheart 03-04-2013 10:01 AM

Thank you so much for this. I have included all 3 although only the 'prevent highlight' should do the job alone.

wildheart 03-14-2013 01:44 PM

Quote:

Originally Posted by apaydin2148 (Post 2294320)
with this script you can disable text selection. like in the first post you must copy into top of headinclude template. enjoy. :)

Code:

<vb:if condition="is_member_of($bbuserinfo, 1,2,3)">
<script type="text/javascript">
    function returnFalse(e){
      return false;
    }

    function cancelEvent(e){
      if(e.preventDefault)e.preventDefault();
      else e.returnValue=false;
    }

    function addHandler(e,event,action,param){
      if(document.addEventListener)e.addEventListener(event,action,param);
      else if(document.attachEvent)e.attachEvent('on'+event,action);
      else e['on'+event]=action;
    }

    function removeHandler(e,event,action,param){
      if(document.addEventListener)e.removeEventListener(event,action,param);
      else if(document.attachEvent)e.detachEvent('on'+event,action);
      else e['on'+event]=returnFalse;
    }

    addHandler(document,'mousedown',mouseDown,false);
    addHandler(document,'mouseup',mouseUp,false);

    function mouseDown(e){
      // HACK: calling no selection for class name = "handle hover"
      //if(e.target.className=="handle hover")
      if((e.target.nodeName!="INPUT")&&
        (e.target.nodeName!="TEXTAREA")&&
        (e.target.nodeName!="H1")&&
        (e.target.nodeName!="H2")&&
        (e.target.nodeName!="H3")&&
        (e.target.nodeName!="P")&&
        (e.target.id.substr(0,3)!="lbl")&&
        (e.target.id.substr(0,3)!="ttl")
        )
      {
          e=e||event;
          cancelEvent(e);
          addHandler(document,'selectstart',returnFalse,false);
      }
    }

    function mouseUp(e){
      removeHandler(document,'selectstart',returnFalse,false);
    }
</script></vb:if>


This code disables the guests from selecting their date of birth on registration. If they click on date etc. it is just blank in google chrome, ie and sometimes firefox. It took me a long time to figure out why all new registrations stopped, nobody could register.

JordanBuss13 03-29-2013 03:07 PM

How do you make it so no one can right click even if there signed in?


All times are GMT. The time now is 05:12 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01365 seconds
  • Memory Usage 1,841KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_code_printable
  • (11)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete