vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 5.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=259)
-   -   Miscellaneous Hacks - Disable Right Click (https://vborg.vbsupport.ru/showthread.php?t=289020)

Shadow 10-12-2012 10:00 PM

Disable Right Click
 
1 Attachment(s)
This script will act as a sort of barrier to prevent people from right clicking on your forum thus offering some sort of protection. There are ways to get round this but think of it as a hurdle which may put some people off.

Add the following code to the header template:
Code:

<script type="text/javascript">
<!--
var error="Right click functionality is disabled";

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(error);return false")

// -->
</script>

While this blocks the ability to Right Click, it also blocks the ability to copy and paste through the context menu that appears when Right Clicking. Copy and paste functionality is still available through the Ctrl+C and Ctrl+V shortcuts respectively.

Editing the Error Message:
Changing the message shown is a piece of cake. This can be done by finding this line near the top of the script:

Code:

var error="Right click functionality is disabled";
Change the text in quotes to anything you like.

TheSupportForum 10-13-2012 07:46 PM

Suggestion :

1) Create Template with this code
2) create a hook : in Header_head
Template Name : from template 1

then there is no need to edit the template

with VB5 alot of use will be aiming towards using template hooks to do all the tasks for use

Shadow 10-14-2012 08:58 AM

Good suggestion. Thanks for the tip :)

Asterix_ita 10-16-2012 01:16 PM

now you can create a mod :p

Shadow 10-16-2012 03:52 PM

Added an xml file that will automatically add the template changes. You can also edit the error message from the Settings page instead of through the template when using the xml file.

Nirjonadda 10-16-2012 04:48 PM

Have an update for 4.1.10 ?

TheSupportForum 10-16-2012 06:14 PM

Quote:

Originally Posted by Nirjonadda (Post 2373496)
Have an update for 4.1.10 ?

this is for VB5 only, you need to request a VB4 version

in this case you would be asking the developer to downgrade the mod

VB5 uses a completly new hook system and will not work on VB4

JamalFree 01-05-2013 05:35 PM

:up: thanks iwill applied in my forums

Dorgham 03-31-2013 12:38 AM

Lock the right button of the mouse has some advantages:
Such as lack of access to the source of the page
And do not copy the content of Thread
And do not copy URL
Thanks :)

Keythacker 03-31-2013 04:24 AM

May seem like a stupid question but this "hook" your talking about how does one go about doing that? I know how to create the template but the hook is something I am not familiar with. Will be glad to read some if I need to learn.


All times are GMT. The time now is 06:02 PM.

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.01030 seconds
  • Memory Usage 1,729KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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