Author Topic: [Mod] Disable right click on images only  (Read 55049 times)

0 Members and 1 Guest are viewing this topic.

Offline pixelkitty

  • Pre-Newbie
  • Posts: 6
    • View Profile
    • http://pixelkitty.net
[Mod] Disable right click on images only
« on: February 20, 2003, 08:04:54 AM »
I have a script that I am currently using at pixelkitty.net to disable right click of images only.

This way, visitors can still use other right click functions such as bookmark, back, open in new window/tab etc on the page itself.

Is it possible to put this script into 4images instead of the current 'disable right click' script?

I want to do this as I find the current disable script is too restrictive, as I use right click extensively for navigation and other purposes when I am within my own sites.

The script I use at the above site is below, for those who may want it.

Code: [Select]
// JavaScript Document
var clickmessage="© Copyright by {site_name}"

function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
alert(clickmessage);
return false;
}
}
}
else if (document.layers) {
if (e.which == 3) {
alert(clickmessage);
return false;
}
}
else if (document.getElementById){
if (e.which==3&&e.target.tagName=="IMG"){
alert(clickmessage)
return false
}
}
}

function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}

if (document.all)
document.onmousedown=disableclick
else if (document.getElementById)
document.onmouseup=disableclick
else if (document.layers)
associateimages()

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] Disable right click on images only
« Reply #1 on: February 20, 2003, 09:40:13 AM »
Very good, thank you! I'm moving this post to the MOD section, if you don't mind, otherwise it will be lost here...

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Re: [Mod] Disable right click on images only
« Reply #2 on: February 20, 2003, 11:53:31 PM »
Quote from: pixelkitty
Is it possible to put this script into 4images instead of the current 'disable right click' script?

Personally, I prefer the current right click disable script as I also do not want users choosing "View Source" when I display my images in a chromeless browser window.

Just my two cents.  Nice script though.

Offline pixelkitty

  • Pre-Newbie
  • Posts: 6
    • View Profile
    • http://pixelkitty.net
[Mod] Disable right click on images only
« Reply #3 on: February 21, 2003, 10:53:57 AM »
there is nothing stopping the site visitor from clicking EDIT - VIEW SOURCE

waste of time trying to stop that really.

All my script is designed to do is remind people that copyright is enforced. They already have the image downloaded onto their machine as soon as they view the site so ... *shrug*

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
[Mod] Disable right click on images only
« Reply #4 on: February 21, 2003, 02:55:55 PM »
Actually in a chromless browser window, there is no Edit menu so the user can't choose "View Source".  Yes, you're right about the browser caching images.  It's rather easy to stop that too through meta tags but that's a whole other topic.  :wink:

I applaud you for the script.  I truly do.  It's a nice alternative and it's good to have options for software as rich in features as 4images.  I was just voicing my opinion that I wouldn't prefer it to be the default script that shipped with 4images, that's all.

Offline Shap

  • Full Member
  • ***
  • Posts: 114
    • View Profile
[Mod] Disable right click on images only
« Reply #5 on: February 21, 2003, 06:39:16 PM »
reason I would want it "ONLY ON THE IMAGE" is so people actually hit the download button instead of just right clickin on the image, so it counts how many people download.

I disabled the right-click disabler. Many people get frustrated by it, through my experience.

Offline dune

  • Newbie
  • *
  • Posts: 15
    • View Profile
[Mod] Disable right click on images only
« Reply #6 on: February 22, 2003, 10:48:31 AM »
yes, this right-click disable thingie often seems quite a poor attempt to avoid unlogged downloads or something... i like the winxp thingie where whenever you're with your mouse above a picture it gives you this small menu where you also have the save option and of course it works and the download is still not counted for :) in the end it seems that it is only users' ignorance that keeps those downloads coming  :lol:

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] Disable right click on images only
« Reply #7 on: February 22, 2003, 11:48:12 AM »
not a big deal to disable this "thingie"
Code: [Select]
<meta http-equiv="imagetoolbar" content="no">

or for any particular image
Code: [Select]
<img src="image.jpg" galleryimg="no">

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
[Mod] Disable right click on images only
« Reply #8 on: February 22, 2003, 04:41:28 PM »
Well, since this thread is supposed to be for a mod and it now seems like it might turn into a whole other topic about general image theft, I would like to point everyone to an existing forum topic:

Pic Security
http://www.4homepages.de/forum/viewtopic.php?t=1716

The image toolbar, right clicking and many other techniques have already been documented there.

Offline rustynet

  • Addicted member
  • ******
  • Posts: 1.031
  • {if msg}{msg}{endif msg}
    • View Profile
    • rustynet.de
Re: [Mod] Disable right click on images only
« Reply #9 on: March 15, 2003, 12:14:40 PM »
Quote from: pixelkitty
I have a script that I am currently using at pixelkitty.net to disable right click of images only.

This way, visitors can still use other right click functions such as bookmark, back, open in new window/tab etc on the page itself.

Is it possible to put this script into 4images instead of the current 'disable right click' script?

I want to do this as I find the current disable script is too restrictive, as I use right click extensively for navigation and other purposes when I am within my own sites.

The script I use at the above site is below, for those who may want it.

Code: [Select]
// JavaScript Document
var clickmessage="© Copyright by {site_name}"

function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
alert(clickmessage);
return false;
}
}
}
else if (document.layers) {
if (e.which == 3) {
alert(clickmessage);
return false;
}
}
else if (document.getElementById){
if (e.which==3&&e.target.tagName=="IMG"){
alert(clickmessage)
return false
}
}
}

function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}

if (document.all)
document.onmousedown=disableclick
else if (document.getElementById)
document.onmouseup=disableclick
else if (document.layers)
associateimages()


I do not know how to use this Mod. Anyone help me please.  :)

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: [Mod] Disable right click on images only
« Reply #10 on: March 15, 2003, 01:57:31 PM »
Quote from: boti
I do not know how to use this Mod. Anyone help me please.  :)

Open /templates/<yourtemplate>/header.html
replace the original javascript with this one.
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 rustynet

  • Addicted member
  • ******
  • Posts: 1.031
  • {if msg}{msg}{endif msg}
    • View Profile
    • rustynet.de
[Mod] Disable right click on images only
« Reply #11 on: March 15, 2003, 02:08:10 PM »
ThankS V@no  :D



boti

Offline jengwen

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
    • http://www.jenrichardsphotography.com
[Mod] Disable right click on images only
« Reply #12 on: March 15, 2003, 05:32:58 PM »
Excellent mod.  Can anyone add the F10 right-click disable to it?

Here is what I had in my header before this mode that also handled the F10 issue:
Code: [Select]
<script language=JavaScript>
var message="© Copyright by {site_name}";
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>

Offline tash

  • Newbie
  • *
  • Posts: 39
    • View Profile
    • http://www.aliciakeysnet.tk
[Mod] Disable right click on images only
« Reply #13 on: April 07, 2003, 02:43:50 PM »
hey , how do we disable the right click one image ???
thx
tash

Offline tanvir_bd

  • Newbie
  • *
  • Posts: 12
    • View Profile
Coolll
« Reply #14 on: April 22, 2003, 09:18:50 AM »
:D Cool it work fine..... 8)