-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDisable Image Dragging.user.js
More file actions
32 lines (30 loc) · 1.04 KB
/
Copy pathDisable Image Dragging.user.js
File metadata and controls
32 lines (30 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// ==UserScript==
// @name Disable Image Dragging
// @version 0.1
// @description Disables image dragging.
// @author You
// @include *://*.recaptcha.com/*
// @include *://recaptcha.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=stackoverflow.com
// @grant none
// ==/UserScript==
// register onLoad event with anonymous function
(function (e) {
var evt = e || window.event,// define event (cross browser)
imgs, // images collection
i; // used in local loop
// if preventDefault exists, then define onmousedown event handlers
if (evt.preventDefault) {
// collect all images on the page
imgs = document.getElementsByTagName('img');
// loop through fetched images
for (i = 0; i < imgs.length; i++) {
// and define onmousedown event handler
imgs[i].onmousedown = disableDragging;
}
}
});
// disable image dragging
function disableDragging(e) {
e.preventDefault();
}