4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: pixelkitty on February 20, 2003, 08:04:54 AM

Title: [Mod] Disable right click on images only
Post by: pixelkitty on February 20, 2003, 08:04:54 AM
I have a script that I am currently using at pixelkitty.net (http://www.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()
Title: [Mod] Disable right click on images only
Post by: SLL 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...
Title: Re: [Mod] Disable right click on images only
Post by: Chris 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.
Title: [Mod] Disable right click on images only
Post by: pixelkitty 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*
Title: [Mod] Disable right click on images only
Post by: Chris 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.
Title: [Mod] Disable right click on images only
Post by: Shap 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.
Title: [Mod] Disable right click on images only
Post by: dune 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:
Title: [Mod] Disable right click on images only
Post by: SLL 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">
Title: [Mod] Disable right click on images only
Post by: Chris 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.
Title: Re: [Mod] Disable right click on images only
Post by: rustynet on March 15, 2003, 12:14:40 PM
Quote from: pixelkitty
I have a script that I am currently using at pixelkitty.net (http://www.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.  :)
Title: Re: [Mod] Disable right click on images only
Post by: V@no 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.
Title: [Mod] Disable right click on images only
Post by: rustynet on March 15, 2003, 02:08:10 PM
ThankS V@no  :D



boti
Title: [Mod] Disable right click on images only
Post by: jengwen 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>
Title: [Mod] Disable right click on images only
Post by: tash on April 07, 2003, 02:43:50 PM
hey , how do we disable the right click one image ???
thx
Title: Coolll
Post by: tanvir_bd on April 22, 2003, 09:18:50 AM
:D Cool it work fine..... 8)
Title: [Mod] Disable right click on images only
Post by: lakeside on April 24, 2003, 04:23:18 AM
How can I format the copyright message?

I want to have linebreaks so that it's not just one long run on sentance.

Im trying to put:
All images are copyright their respective owners
Please view the full image and use the download link to download
We dont allow Hotlinking, so there is no need to view the properties
of the images.
Thank you,
Sitename
Title: [Mod] Disable right click on images only
Post by: V@no on April 24, 2003, 03:31:17 PM
use \n
Title: Re: [Mod] Disable right click on images only
Post by: Prashant on April 30, 2005, 09:50:06 AM
Mmmm, but when the site is open in Firefox, if you right click on the image, it will show the Copyright notice. But click 'OK' to close the pop up copyright window and then right after closing the window the usual menu-on-right click opns up allowing the user to save the photo.
Is this just happening to me ??
Title: Re: [Mod] Disable right click on images only
Post by: dontstay on June 02, 2005, 08:43:18 PM
Mmmm, but when the site is open in Firefox, if you right click on the image, it will show the Copyright notice. But click 'OK' to close the pop up copyright window and then right after closing the window the usual menu-on-right click opns up allowing the user to save the photo.
Is this just happening to me ??

Happens with me too, but if you notice and look at the menu, there is no 'properties' or 'save image as' options. It's as though you right-clicked on the page, not the image. :)
Title: Re: [Mod] Disable right click on images only
Post by: impss on November 12, 2005, 09:47:21 PM
Is there a way to change this mod, so that it works only on the details page, with the full image.

I still want to be able to right click on thumbs to open in a new window.

thanks for the help
Title: Re: [Mod] Disable right click on images only
Post by: Acidgod on November 13, 2005, 02:30:27 PM
copy the JS into the detail.html... (o:

a other solution is to use the strg and then klick on the Thumb to open it in a new window...
Title: Re: [Mod] Disable right click on images only
Post by: impss on November 13, 2005, 10:48:50 PM
copy the JS into the detail.html... (o:

a other solution is to use the strg and then klick on the Thumb to open it in a new window...

Thanks Acidgod, after i posted that i thought the same thing.
But didnt get a chance to try it untill now.
and it works  :D
Title: Re: [Mod] Disable right click on images only
Post by: lemccoy on November 18, 2005, 02:31:54 PM
What I have done is delete the javascript code and use:

header.html

Code: [Select]
<meta http-equiv="imagetoolbar" content="no">
as well as:

Code: [Select]
<body oncontextmenu="return false" ...>
Works pretty well so far, need to test on firefox.
Title: Re: [Mod] Disable right click on images only
Post by: Acidgod on November 19, 2005, 03:03:41 PM
Works pretty well so far, need to test on firefox.

Works in Firefox too... (o:
Title: Re: [Mod] Disable right click on images only
Post by: RamEEz on January 08, 2007, 09:04:25 AM
thanks a lot dude for this great thing :)