embed right mouse click disable

jpbeenen

Joined: 2006-11-28
Posts: 3
Posted: Tue, 2006-11-28 20:00

I'd like 2 to embed this java code into the .tpl themes. When this is embedded a "copyright message" will appear when using the right mouse button. Ill use watermarks to so the smarter folks wont be able to get the image by just using print screen. This wokrs great when using a php template but since this is .tpl i do not know how to embed it. Can someone please point me out. Tnx in advance. This is the code in my php plate:

<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">

var message="Copyright © www.sorido-biak.nl";
function click(i){
if (document.all) { if (event.button == 2) { alert(message); return false; }}
if (document.layers) { if (i.which == 3) { alert(message); return false; }}
}
if (document.layers) { document.captureEvents(Event.MOUSEDOWN); }
document.onmousedown=click;

</script>

Gallery version 2.2
Webserver Apache
Database MySql
Activated toolkits GD

 
jpbeenen

Joined: 2006-11-28
Posts: 3
Posted: Tue, 2006-11-28 20:22

Hi folks,

Srry i searched for half an hour but with wrong keywords so it seems. Used the freshly found keywords which i came up with for the subject of this post and tataaa :P

Wel use this thread http://gallery.menalto.com/node/47805?highlight=right%2Cclick

And put this code in the top of the album.tpl (others could be nescessarry to.

{literal}
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">

var message="Copyright © www.sorido-biak.nl";
function click(i){
if (document.all) { if (event.button == 2) { alert(message); return false; }}
if (document.layers) { if (i.which == 3) { alert(message); return false; }}
}
if (document.layers) { document.captureEvents(Event.MOUSEDOWN); }
document.onmousedown=click;

</script>
{/literal}

Keep in mind that this will only keep away the simple surfers. If they want the picture it will be theirs so.....

 
chieflbm

Joined: 2006-02-03
Posts: 14
Posted: Thu, 2007-03-15 23:52

I am just learning and I put this patch in. :) This is fun stuff. I figure if this simple fix will discourage most people from copying images.

It seems to work well for IE but firefox lets you "save as..." still.

Did I do something wrong?

 
diverguy

Joined: 2003-08-22
Posts: 24
Posted: Sun, 2008-12-21 04:58
jpbeenen wrote:
And put this code in the top of the album.tpl (others could be nescessarry to.

{literal}
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">

var message="Copyright © www.sorido-biak.nl";
function click(i){
if (document.all) { if (event.button == 2) { alert(message); return false; }}
if (document.layers) { if (i.which == 3) { alert(message); return false; }}
}
if (document.layers) { document.captureEvents(Event.MOUSEDOWN); }
document.onmousedown=click;

</script>
{/literal}

I'm using Gallery 2.3 and put this code in the top of both the album.tpl and the photo.tpl, right after the revision information. It had no effect. I even made sure to turn off template caching before doing it but the right click still works. What steps did I miss?

Thanks,

John

 
brujji

Joined: 2007-02-11
Posts: 47
Posted: Mon, 2009-10-26 09:23

Hi,

I've managed to disable right click using the code mentioned by jpbeenen, but it only works with IE. Anyone knows if there is a code to do this on firefox?

thanks!

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Mon, 2009-10-26 18:38

Why? All I have to do in Firefox is go to Tools > Options and turn off the option to allow you to disable that.

Disabling right-click does nothing. If I can see your pictures I can get them, period. If you want to protect them, watermark them.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here