No Right Click Images Plugin - Version 2.0

Version Description

  • Separated javascript into a loadable file. Added an option to replace images on right click in order to thwart FireFox users who choose to block javascript from controlling the context menu. Made drag and drop blocking optional.

=

Download this release

Release Info

Developer kpgraham
Plugin Icon wp plugin No Right Click Images Plugin
Version 2.0
Comparing to
See all releases

Code changes from version 1.4 to 2.0

Files changed (4) hide show
  1. no-right-click-images-plugin.php +103 -116
  2. no-right-click-images.js +213 -0
  3. not.gif +0 -0
  4. readme.txt +5 -2
no-right-click-images-plugin.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: No Right Click Images Plugin
4
  Plugin URI: http://www.BlogsEye.com/
5
  Description: Uses Javascript to prevent right clicking of images to help keep leaches from copying images
6
- Version: 1.4
7
  Author: Keith P. Graham
8
  Author URI: http://www.BlogsEye.com/
9
 
@@ -19,138 +19,125 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19
  *************************************************************/
20
  function kpg_no_rc_img_fixup() {
21
  // this is the No Right Click Images functionality.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  ?>
24
- <script language="javascript" type="text/javascript">
25
- // <!--
26
- /* <![CDATA[ */
27
- // No Right Click Images Plugin
28
- function kpg_nrci_context(event) {
29
- //alert("context");
30
- var ev=event||window.event;
31
- var targ=ev.srcElement||ev.target;
32
- ev.returnValue=false;
33
- if (ev.preventDefault) {
34
- ev.preventDefault();
35
- }
36
- ev.returnValue=false;
37
- return false;
38
- }
39
- var targImg=null;
40
- function kpg_nrc1_mousedown(event) {
41
- var ev=event||window.event;
42
- var targ=ev.srcElement||ev.target;
43
- if (targ.tagName=="IMG"||targ.tagName=="img") {
44
- targImg=targ;
45
- }
46
- return true
47
- }
48
- function kpg_nrci_contextAll(event) {
49
- if (targImg==null) return true;
50
- var ev=event||window.event;
51
- if (targImg.tagName=="IMG"||targImg.tagName=="img") {
52
- ev.returnValue=false;
53
- if (ev.preventDefault) {
54
- ev.preventDefault();
55
- }
56
- ev.returnValue=false;
57
- targImg=null;
58
- return false;
59
- }
60
- return true;
61
- }
62
- // sets the image onclick event
63
- function kpg_nrci_action(event) {
64
- try {
65
- var b=document.getElementsByTagName("IMG");
66
- for (var i = 0; i < b.length; i++) {
67
- b[i].oncontextmenu=function(event) { return kpg_nrci_context(event);}
68
- b[i].onmousedown=function(event) { return kpg_nrc1_mousedown(event);}
69
- b[i].ondragstart=function() { return false;}
70
- }
71
- } catch (ee) {}
72
- // set the document onclick in case someone loads a new image
73
- document.onmousedown=function(event) { return kpg_nrc1_mousedown(event);}
74
- document.oncontextmenu=function(event) { return kpg_nrci_contextAll(event);}
75
- // other events
76
- document.ondragstart=function(event) { return kpg_nrci_contextAll(event);}
77
- // find all the anchor tags and see if the href is an image in the content directory
78
- var imageclick=false; // change the word false to true if you want to use this option
79
- if (imageclick) {
80
- try {
81
- var b=document.getElementsByTagName("A");
82
- for (var i = 0; i < b.length; i++) {
83
- var hr=b[i].href;
84
- if (b[i].hostname && location.hostname) {
85
- if (b[i].hostname.toLowerCase() == location.hostname.toLowerCase()) {
86
- if (hr.indexOf('wp-content')!=-1 && (hr.indexOf('.jpg')!=-1||hr.indexOf('.png')!=-1||hr.indexOf('.gif')!=-1)) {
87
- b[i].href=null;
88
- }
89
- }
90
- }
91
- }
92
- } catch (ee) {}
93
- }
94
- }
95
- // set the onload event
96
- if (document.addEventListener) {
97
- document.addEventListener("DOMContentLoaded", function(event) { kpg_nrci_action(event); }, false);
98
- } else if (window.attachEvent) {
99
- window.attachEvent("onload", function(event) { kpg_nrci_action(event); });
100
- } else {
101
- var oldFunc = window.onload;
102
- window.onload = function() {
103
- if (oldFunc) {
104
- oldFunc();
105
- }
106
- kpg_nrci_action('load');
107
- };
108
- }
109
- // end of No Right Click Images Plugin
110
- /* ]]> */
111
- // -->
112
- </script>
113
-
114
  <?php
115
  }
116
  function kpg_no_rc_img_control() {
117
- // this is the display of information about the page.
118
- $bname=urlencode(get_bloginfo('name'));
119
- $burl=urlencode(get_bloginfo('url'));
120
- $bdesc=urlencode(get_bloginfo('description'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
 
122
  ?>
123
 
124
  <div class="wrap">
125
- <h2>No Right Click Images Plugin</h2>
126
- <div style="position:relative;float:right;width:35%;background-color:ivory;border:#333333 medium groove;padding-left:6px;">
127
-
128
- <p>This plugin is free and I expect nothing in return. If you would like to support my programming, you can buy my book of short stories.</p><p>Some plugin authors ask for a donation. I ask you to spend a very small amount for something that you will enjoy. eBook versions for the Kindle and other book readers start at 99&cent;. The book is much better than you might think, and it has some very good science fiction writers saying some very nice things. <br/>
129
- <a target="_blank" href="http://www.amazon.com/gp/product/1456336584?ie=UTF8&tag=thenewjt30page&linkCode=as2&camp=1789&creative=390957&creativeASIN=1456336584">Error Message Eyes: A Programmer's Guide to the Digital Soul</a></p>
130
- <p>A link on your blog to one of my personal sites would also be appreciated.</p>
131
- <p><a target="_blank" href="http://www.WestNyackHoney.com">West Nyack Honey</a> (I keep bees and sell the honey)<br />
132
- <a target="_blank" href="http://www.cthreepo.com/blog">Wandering Blog </a> (My personal Blog) <br />
133
- <a target="_blank" href="http://www.cthreepo.com">Resources for Science Fiction</a> (Writing Science Fiction) <br />
134
- <a target="_blank" href="http://www.jt30.com">The JT30 Page</a> (Amplified Blues Harmonica) <br />
135
- <a target="_blank" href="http://www.harpamps.com">Harp Amps</a> (Vacuum Tube Amplifiers for Blues) <br />
136
- <a target="_blank" href="http://www.blogseye.com">Blog&apos;s Eye</a> (PHP coding) <br />
137
- <a target="_blank" href="http://www.cthreepo.com/bees">Bee Progress Beekeeping Blog</a> (My adventures as a new beekeeper) </p>
138
- </div>
139
- <h4>The No Right Click Images Plugin is installed and working correctly.</h4>
140
- <p>This plugin installs some javascript in the footer of every page. When your page finishes loading, the javascript steps through the tags on the page looking for Images and sets them so the context menu won't appear.</p>
141
- <p>There are no configurations options. The plugin is on when it is installed and enabled. To turn it off just disable the plugin from the plugin menu.. </p>
142
-
143
- <hr/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  </div>
145
  <?php
146
  }
147
- // no unistall because I have not created any meta data to delete.
148
  function kpg_no_rc_img_init() {
149
  add_options_page('No Right Click Images', 'No Right Click Images', 'manage_options',__FILE__,'kpg_no_rc_img_control');
150
  }
151
  // Plugin added to Wordpress plugin architecture
152
  add_action('admin_menu', 'kpg_no_rc_img_init');
153
  add_action( 'wp_footer', 'kpg_no_rc_img_fixup' );
 
 
 
 
 
 
 
 
 
 
 
154
 
155
-
156
  ?>
3
  Plugin Name: No Right Click Images Plugin
4
  Plugin URI: http://www.BlogsEye.com/
5
  Description: Uses Javascript to prevent right clicking of images to help keep leaches from copying images
6
+ Version: 2.0
7
  Author: Keith P. Graham
8
  Author URI: http://www.BlogsEye.com/
9
 
19
  *************************************************************/
20
  function kpg_no_rc_img_fixup() {
21
  // this is the No Right Click Images functionality.
22
+ // now we have to get the options
23
+
24
+ $options=get_option('kpg_no_right_click_image');
25
+ if (empty($options)||!is_array($options)) $options=array();
26
+ $replace='N';
27
+ $drag='Y';
28
+ extract($options);
29
+ if ($replace!='Y') $replace='N';
30
+ if ($drag!='Y') $drag='N';
31
+
32
+ // get the full url of the image
33
+
34
+ $dir = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__));
35
+ $img = addslashes($dir.'not.gif');
36
+ $js = addslashes($dir.'no-right-click-images.js');
37
 
38
  ?>
39
+ <script language="javascript" type="text/javascript">var kpg_nrci_image="<?php echo $img; ?>";var kpg_nrci_extra="<?php echo $replace; ?>";var kpg_nrci_drag="<?php echo $drag; ?>";</script>
40
+ <script language="javascript" type="text/javascript" src="<?php echo $js; ?>"></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  <?php
42
  }
43
  function kpg_no_rc_img_control() {
44
+ $options=get_option('kpg_no_right_click_image');
45
+ if (empty($options)||!is_array($options)) $options=array();
46
+ $replace='N';
47
+ $drag='Y';
48
+ extract($options);
49
+ if ($replace!='Y') $replace='N';
50
+ if (empty($drag)) $drag='Y';
51
+ if ($drag!='Y') $drag='N';
52
+ if (array_key_exists('kpg_no_rc_nonce',$_POST)&&wp_verify_nonce($_POST['kpg_no_rc_nonce'],'kpg_no_rc')) {
53
+ // need to update replace
54
+ if (array_key_exists('kpg_replace_image',$_POST)) {
55
+ $replace=stripslashes($_POST['kpg_replace_image']);
56
+ } else {
57
+ $replace='N';
58
+ }
59
+ if (array_key_exists('kpg_prevent_drag',$_POST)) {
60
+ $drag=stripslashes($_POST['kpg_prevent_drag']);
61
+ } else {
62
+ $drag='N';
63
+ }
64
+ if ($replace!='Y') $replace='N';
65
+ if ($drag!='Y') $drag='N';
66
+ $options['replace']=$replace;
67
+ $options['drag']=$drag;
68
+ update_option('kpg_no_right_click_image', $options);
69
+
70
+ }
71
+ $nonce=wp_create_nonce('kpg_no_rc');
72
+ $dir = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__));
73
+ $img = addslashes($dir.'not.gif');
74
 
75
  ?>
76
 
77
  <div class="wrap">
78
+ <h2>No Right Click Images Plugin</h2>
79
+ <h4 style="color:red;">Note: this new version of the plugin now has options that must be set to work correctly.</h4>
80
+ <div style="position:relative;float:right;width:35%;background-color:ivory;border:#333333 medium groove;padding:4px;margin-left:4px;">
81
+ <p>This plugin is free and I expect nothing in return. If you would like to support my programming, you can buy my book of short stories.</p>
82
+ <p>Some plugin authors ask for a donation. I ask you to spend a very small amount for something that you will enjoy. eBook versions for the Kindle and other book readers start at 99&cent;. The book is much better than you might think, and it has some very good science fiction writers saying some very nice things. <br/>
83
+ <a target="_blank" href="http://www.amazon.com/gp/product/1456336584?ie=UTF8&tag=thenewjt30page&linkCode=as2&camp=1789&creative=390957&creativeASIN=1456336584">Error Message Eyes: A Programmer's Guide to the Digital Soul</a></p>
84
+ <p>A link on your blog to one of my personal sites would also be appreciated.</p>
85
+ <p><a target="_blank" href="http://www.WestNyackHoney.com">West Nyack Honey</a> (I keep bees and sell the honey)<br />
86
+ <a target="_blank" href="http://www.cthreepo.com/blog">Wandering Blog </a> (My personal Blog) <br />
87
+ <a target="_blank" href="http://www.cthreepo.com">Resources for Science Fiction</a> (Writing Science Fiction) <br />
88
+ <a target="_blank" href="http://www.jt30.com">The JT30 Page</a> (Amplified Blues Harmonica) <br />
89
+ <a target="_blank" href="http://www.harpamps.com">Harp Amps</a> (Vacuum Tube Amplifiers for Blues) <br />
90
+ <a target="_blank" href="http://www.blogseye.com">Blog&apos;s Eye</a> (PHP coding) <br />
91
+ <a target="_blank" href="http://www.cthreepo.com/bees">Bee Progress Beekeeping Blog</a> (My adventures as a new beekeeper) </p>
92
+ </div>
93
+ <h4>The No Right Click Images Plugin is installed and working correctly.</h4>
94
+ <p>This plugin installs some javascript in the footer of every page. When your page finishes loading, the javascript sets properties on the images to stop them from being dragged or right clicked. </p>
95
+ <p><img width="80" src="<?php echo $img; ?>" align="left" style="margin:2px;"/>This is a major revision in the way the plugin works. <a href="mailto:bugs@blogseye.com">Please report all bugs</a> as soon as possible. </p>
96
+ <p>There are many ways to bypass this plugin and it is impossible to prevent a determined and resourceful user from stealing images, but this plugin will prevent casual users from glomming your images. </p>
97
+ <p>The context menu is disabled on simple elements with background images, but will not work in some cases depending on which element receives the mouse click. </p>
98
+ <p>If you have uploaded your images to WordPress so that the images from the gallery can be opened in their own window, then this plugin will not work on the clicked image. Always upload images using FTP and insert the image via URL with no link to the image other than the IMG tag. </p>
99
+ <form method="post" action="">
100
+ <input type="hidden" name="action" value="update" />
101
+ <input type="hidden" name="kpg_no_rc_nonce" value="<?php echo $nonce;?>" />
102
+ <table cellpadding="2">
103
+ <tr>
104
+ <td>Replace image on right mouse click</td>
105
+ <td><input type="checkbox" <?php if ($replace=='Y') {echo 'checked="true"';} ?>value="Y" name="kpg_replace_image"></td>
106
+ <td><p>This temporarily replaces the target image with the image above. FireFox users can prevent the plugin from stopping the default context menu. Use this to prevent FireFox users from right clicking the image. <br />
107
+ This may interfere with other plugins, especially jquery sliders and galleries. Check your blog pages for functionality and turn this off if your images are not behaving correctly. The original image will reappear in about 10 seconds or when the mouse is clicked. </p>
108
+ </td>
109
+ </tr>
110
+ <tr>
111
+ <td>Prevent Drag and Drop</td>
112
+ <td><input type="checkbox" <?php if ($drag=='Y') {echo 'checked="true"';} ?>value="Y" name="kpg_prevent_drag"></td>
113
+ <td>Users may be able to drag an image to the desktop. If you wish to prevent this, check the box. If this conflicts with a plugin that uses drag and drop, you may wish to uncheck this.
114
+ </td>
115
+ </tr>
116
+ </table>
117
+ <p>
118
+ <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
119
+ </p>
120
+ </form>
121
  </div>
122
  <?php
123
  }
 
124
  function kpg_no_rc_img_init() {
125
  add_options_page('No Right Click Images', 'No Right Click Images', 'manage_options',__FILE__,'kpg_no_rc_img_control');
126
  }
127
  // Plugin added to Wordpress plugin architecture
128
  add_action('admin_menu', 'kpg_no_rc_img_init');
129
  add_action( 'wp_footer', 'kpg_no_rc_img_fixup' );
130
+ // uninstall
131
+ function kpg_no_rc_img_uninstall() {
132
+ if(!current_user_can('manage_options')) {
133
+ die('Access Denied');
134
+ }
135
+ delete_option('kpg_no_right_click_image');
136
+ return;
137
+ }
138
+ if ( function_exists('register_uninstall_hook') ) {
139
+ register_uninstall_hook(__FILE__, 'kpg_no_rc_img_uninstall');
140
+ }
141
 
142
+ // bottom
143
  ?>
no-right-click-images.js ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**************************************************************************
2
+ This javascript is used by the no-right-click-images plugin for wordpress.
3
+ Version 2.0
4
+ Please give credit as no-right-click-images.js by Keith P. Graham
5
+ http://www.blogseye.com
6
+ **************************************************************************/
7
+ var kpg_nrci_targImg=null;
8
+ var kpg_nrci_targSrc=null;
9
+ var kpg_nrci_inContext=false;
10
+ var kpg_nrci_notimage=new Image();
11
+ var kpg_nrci_limit=0;
12
+ function kpg_nrci_dragdropAll(event) {
13
+ try {
14
+ var ev=event||window.event;
15
+ var targ=ev.srcElement||ev.target;
16
+ if (targ.tagName.toUpperCase()=="A") {
17
+ // is this IE and are we dragging a link to the image?
18
+ var hr=targ.href;
19
+ hr=hr.toUpperCase();
20
+ if (hr.indexOf('.JPG')||hr.indexOf('.PNG')||hr.indexOf('.GIF')) {
21
+ ev.returnValue=false;
22
+ if (ev.preventDefault) {
23
+ ev.preventDefault();
24
+ }
25
+ kpg_nrci_inContext=false;
26
+ return false;
27
+ }
28
+ }
29
+ if (targ.tagName.toUpperCase()!="IMG") return true;
30
+ ev.returnValue=false;
31
+ if (ev.preventDefault) {
32
+ ev.preventDefault();
33
+ }
34
+ kpg_nrci_inContext=false;
35
+ return false;
36
+ } catch (er) {
37
+ //alert(er);
38
+ }
39
+ return true;
40
+ }
41
+ function kpg_nrci_dragdrop(event) {
42
+ // I am beginning to doubt if this event ever fires
43
+ try {
44
+ var ev=event||window.event;
45
+ var targ=ev.srcElement||ev.target;
46
+ ev.returnValue=false;
47
+ if (ev.preventDefault) {
48
+ ev.preventDefault();
49
+ }
50
+ ev.returnValue=false;
51
+ kpg_nrci_inContext=false;
52
+ return false;
53
+ } catch (er) {
54
+ //alert(er);
55
+ }
56
+ return true;
57
+ }
58
+ function kpg_nrci_context(event) {
59
+ try {
60
+ kpg_nrci_inContext=true;
61
+ var ev=event||window.event;
62
+ var targ=ev.srcElement||ev.target;
63
+ kpg_nrci_replace(targ);
64
+ ev.returnValue=false;
65
+ if (ev.preventDefault) {
66
+ ev.preventDefault();
67
+ }
68
+ ev.returnValue=false;
69
+ kpg_nrci_targImg=targ;
70
+ } catch (er) {
71
+ //alert(er);
72
+ }
73
+ return false;
74
+ }
75
+ function kpg_nrci_contextAll(event) {
76
+ try {
77
+ if (kpg_nrci_targImg==null) {
78
+ return true;
79
+ }
80
+ kpg_nrci_inContext=true;
81
+ var ev=event||window.event;
82
+ var targ=ev.srcElement||ev.target;
83
+ if (targ.tagName.toUpperCase()=="IMG") {
84
+ ev.returnValue=false;
85
+ if (ev.preventDefault) {
86
+ ev.preventDefault();
87
+ }
88
+ ev.returnValue=false;
89
+ kpg_nrci_replace(targ);
90
+ return false;
91
+ }
92
+ return true;
93
+ } catch (er) {
94
+ //alert(er);
95
+ }
96
+ return false;
97
+
98
+ }
99
+
100
+ function kpg_nrc1_mousedown(event) {
101
+ try {
102
+ kpg_nrci_inContext=false;
103
+ var ev=event||window.event;
104
+ var targ=ev.srcElement||ev.target;
105
+ if (ev.button==2) {
106
+ kpg_nrci_replace(targ);
107
+ return false;
108
+ }
109
+ kpg_nrci_targImg=targ;
110
+ if (kpg_nrci_drag=='Y') {
111
+ if (ev.preventDefault) {
112
+ ev.preventDefault();
113
+ }
114
+ }
115
+ return true;
116
+ } catch (er) {
117
+ //alert(er);
118
+ }
119
+ return true;
120
+ }
121
+ function kpg_nrc1_mousedownAll(event) {
122
+ try {
123
+ kpg_nrci_inContext=false;
124
+ var ev=event||window.event;
125
+ var targ=ev.srcElement||ev.target;
126
+ if (targ.style.backgroundImage!=''&&ev.button==2) {
127
+ targ.oncontextmenu=function(event) { return false;} //iffy - might not work
128
+ }
129
+ if (targ.tagName.toUpperCase()=="IMG") {
130
+ if (ev.button==2) {
131
+ kpg_nrci_replace(targ);
132
+ return false;
133
+ }
134
+ if (kpg_nrci_drag=='Y') {
135
+ if (ev.preventDefault) {
136
+ ev.preventDefault();
137
+ }
138
+ }
139
+ kpg_nrci_targImg=targ;
140
+ }
141
+ return true;
142
+ } catch (er) {
143
+ //alert(er);
144
+ }
145
+ return true;
146
+ }
147
+ function kpg_nrci_replace(targ) {
148
+ if (kpg_nrci_targImg!=null && kpg_nrci_targImg.src==kpg_nrci_notimage.src) return;
149
+ kpg_nrci_targImg=targ;
150
+ if (kpg_nrci_extra!='Y') return;
151
+ var w=targ.width+'';
152
+ var h=targ.height+'';
153
+ if (w.indexOf('px')<=0) w=w+'px';
154
+ if (h.indexOf('px')<=0) h=h+'px';
155
+ kpg_nrci_targSrc=targ.src;
156
+ targ.src=kpg_nrci_notimage.src;
157
+ targ.style.width=w;
158
+ targ.style.height=h;
159
+ kpg_nrci_limit=0;
160
+ var t=setTimeout("kpg_nrci_restore()",500);
161
+ return false;
162
+ }
163
+ function kpg_nrci_restore() {
164
+ if (kpg_nrci_inContext) {
165
+ if (kpg_nrci_limit<=20) {
166
+ kpg_nrci_limit++;
167
+ var t=setTimeout("kpg_nrci_restore()",500);
168
+ return;
169
+ }
170
+ }
171
+ kpg_nrci_limit=0;
172
+ if (kpg_nrci_targImg==null) return;
173
+ if (kpg_nrci_targSrc==null) return;
174
+ kpg_nrci_targImg.src=kpg_nrci_targSrc;
175
+ kpg_nrci_targImg=null;
176
+ kpg_nrci_targSrc=null;
177
+ return;
178
+ }
179
+ // sets the image onclick event
180
+ // need to check for dblclick to see if there is a right double click in IE
181
+ function kpg_nrci_action(event) {
182
+ try {
183
+ document.onmousedown=function(event) { return kpg_nrc1_mousedownAll(event);}
184
+ document.oncontextmenu=function(event) { return kpg_nrci_contextAll(event);}
185
+ if (kpg_nrci_drag=='Y') document.ondragstart=function(event) { return kpg_nrci_dragdropAll(event);}
186
+ var b=document.getElementsByTagName("IMG");
187
+ for (var i = 0; i < b.length; i++) {
188
+ b[i].oncontextmenu=function(event) { return kpg_nrci_context(event);}
189
+ b[i].onmousedown=function(event) { return kpg_nrc1_mousedown(event);}
190
+ if (kpg_nrci_drag=='Y') b[i].ondragstart=function(event) { return kpg_nrci_dragdrop(event);}
191
+ }
192
+ } catch (er) {
193
+ return false;
194
+ }
195
+ }
196
+ if (typeof(kpg_nrci_image) == 'undefined' || kpg_nrci_image=='' || typeof(kpg_nrci_extra) == 'undefined'|| typeof(kpg_nrci_drag) == 'undefined') {
197
+ //alert("vars not found: "+kpg_nrci_image+","+kpg_nrci_extra);
198
+ } else {
199
+ kpg_nrci_notimage.src=kpg_nrci_image;
200
+ if (document.addEventListener) {
201
+ document.addEventListener("DOMContentLoaded", function(event) { kpg_nrci_action(event); }, false);
202
+ } else if (window.attachEvent) {
203
+ window.attachEvent("onload", function(event) { kpg_nrci_action(event); });
204
+ } else {
205
+ var oldFunc = window.onload;
206
+ window.onload = function() {
207
+ if (oldFunc) {
208
+ oldFunc();
209
+ }
210
+ kpg_nrci_action('load');
211
+ };
212
+ }
213
+ }
not.gif ADDED
Binary file
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Tags: images, image, right click, stealing
3
  Donate link: http://www.amazon.com/gp/product/1456336584?ie=UTF8&tag=thenewjt30page&linkCode=as2&camp=1789&creative=390957&creativeASIN=1456336584
4
  Requires at least: 2.8
5
- Tested up to: 3.2
6
  Contributors: Keith Graham
7
- Stable tag: 1.4
8
 
9
  Disables right click context menu on images to help deter leeches from glomming images.
10
 
@@ -37,6 +37,9 @@ It is impossible to keep people from stealing images that appear in web pages, b
37
  = 1.4 =
38
  * Backed out click check on images because it broke galleries. I left it in as an option if you want to change the code.
39
 
 
 
 
40
  == Support ==
41
  This plugin is free and I expect nothing in return. Please rate the plugin at http://wordpress.org/extend/plugins/stop-spammer-registrations-plugin/.
42
  If you wish to support my programming, please buy my Science Fiction book. The Kindle version is less thana buck.
2
  Tags: images, image, right click, stealing
3
  Donate link: http://www.amazon.com/gp/product/1456336584?ie=UTF8&tag=thenewjt30page&linkCode=as2&camp=1789&creative=390957&creativeASIN=1456336584
4
  Requires at least: 2.8
5
+ Tested up to: 3.2.1
6
  Contributors: Keith Graham
7
+ Stable tag: 2.0
8
 
9
  Disables right click context menu on images to help deter leeches from glomming images.
10
 
37
  = 1.4 =
38
  * Backed out click check on images because it broke galleries. I left it in as an option if you want to change the code.
39
 
40
+ = 2.0 =
41
+ * Separated javascript into a loadable file. Added an option to replace images on right click in order to thwart FireFox users who choose to block javascript from controlling the context menu. Made drag and drop blocking optional.
42
+
43
  == Support ==
44
  This plugin is free and I expect nothing in return. Please rate the plugin at http://wordpress.org/extend/plugins/stop-spammer-registrations-plugin/.
45
  If you wish to support my programming, please buy my Science Fiction book. The Kindle version is less thana buck.