Diskusie » Žiadosť o vytvorenie

[Request] Blocking Imgur Drag and Drop Upload functions

§
Pridaný: 31.07.2015

[Request] Blocking Imgur Drag and Drop Upload functions

Is there any simple script that will simply just disable/block drag and drop uploading on imgur.com?

When I browse some sites, I'll have 2 browser windows open and it's easier for me to drag that url or some other link to that second window to open. Imgur.com sees that as a drag and drop upload and prevents that window from actually opening the url (which is what I want).

If you block their javascript, http://s.imgur.com/min/global.js it will block the drag and drop uploading feature but it also disables most everything else as well. It's like using a sledgehammer to swat a fly.

An easy example is to open 2 browser windows (Chrome/FF). View Reddit Pics on one, http://www.reddit.com/r/pics and drag links to the 2nd window. URL links will not open if dragged on to an existing (non-picture) imgur.com window. It thinks it's an upload and you'll have to navigate off imgur to be able to drag and drop urls to that window.

Thanks

woxxomZablokovaný
§
Pridaný: 31.07.2015
Upravený: 21.07.2016

[Obsolete. See the post below for an updated version]

§
Pridaný: 31.07.2015

THANK YOU! I'm so happy it's as easy as that. I kinda figured it was just a matter of replacing whatever drag event was in place. I'm just javascript dumb. That looks even simplier then I could imagine.

Works perfectly.

§
Pridaný: 21.07.2016
Upravený: 21.07.2016
// ==UserScript==
// @name     Disable drag'n'drop upload on imgur
// @include  http*://imgur.com/*
// @grant    none
// @run-at   document-start
// ==/UserScript==

document.addEventListener('dragover', function(e) {
    e.stopPropagation();
    e.stopImmediatePropagation();
},false);
document.addEventListener('drop', function(e) {
    e.stopPropagation();
    e.stopImmediatePropagation();
},false);

Credit goes to above. He did the hard part. I actually want default, as urls dropped on opens instead of uploads. So ridding preventDefault made it worked as I wanted.

Pridať odpoveď

Aby ste mohli pridať odpoveď, prihláste sa.

长期地址
遇到问题?请前往 GitHub 提 Issues。