Greasy Fork is available in English.

Diskusie » Žiadosť o vytvorenie

Autoclick not working on Firefox 39

D j
§
Pridaný: 04.10.2015
Upravený: 05.10.2015

Autoclick not working on Firefox 39

The following script opens links with a mouse hover of 1.5 seconds. It has worked until recently with Firefox. I don't know if a FF update broke it or not. I have carpal tunnel and this script has been a great help in reducing the number of clicks and subsequently the degree of wrist pain. Could someone look at it and get it working or point me to a mod of Firefox that will allow the script?

// AutoClick
// version 0.2 BETA!
// 2005-07-08
//
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script that opens links in a new tab
// after you hover over them for 1.5 seconds (without clicking).
//
// To install, you need Greasemonkey 0.4 or later.
//
// --------------------------------------------------------------------
//
// ==UserScript==
// @name          AutoClick
// @namespace     http://diveintomark.org/projects/greasemonkey/

// @description   hover over links for 1.5 seconds to open in a new tab


// @include       http://*


// @exclude       http://mail.google.com/*


// ==/UserScript==

/* 



BEGIN LICENSE BLOCK
Copyright (C) 2005 Mark Pilgrim

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You can download a copy of the GNU General Public License at
http://diveintomark.org/projects/greasemonkey/COPYING
or get a free printed copy by writing to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
END LICENSE BLOCK 


*/

function mouseover(event) {
    document._clickTarget = event.currentTarget;
    document._autoclickTimeoutID = window.setTimeout(autoclick, 1500);
}

function mouseout(event) {
    document._clickTarget = null;
    if (document._autoclickTimeoutID) {
    window.clearTimeout(document._autoclickTimeoutID);
    }
}

function clear(elmLink) {
    if (!elmLink) { return; }
    elmLink.removeEventListener('mouseover', mouseover, true);
    elmLink.removeEventListener('mouseout', mouseout, true);
    elmLink.removeEventListener('click', click, true);
}

function click(event) {
    var elmLink = event.currentTarget;
    if (!elmLink) { return false; }
    clear(elmLink);
    mouseout(event);
    return true;
}

function autoclick() {
    if (!document._clickTarget) { return; }
    GM_openInTab(document._clickTarget.href);
    clear(document._clickTarget);
}

if (typeof GM_openInTab != 'undefined') {
    for (var i = document.links.length - 1; i >= 0; i--) {
    var elmLink = document.links[i];
    if (elmLink.href && elmLink.href.indexOf('javascript:') == -1) {
        elmLink.addEventListener('mouseover', mouseover, true);
        elmLink.addEventListener('mouseout', mouseout, true);
        elmLink.addEventListener('click', click, true);
    }
    }
}

//
// ChangeLog
// 2005-07-08 - 0.2 - MAP - fixed bug opening links that contain images
//                          filtered out non-followable javascript: links
// 2005-07-08 - 0.1 - MAP - initial release
//
woxxomZablokovaný
§
Pridaný: 07.10.2015

All GM_ prefixed functions should be explicitly granted in the metablock since over a year in Greasemonkey, so the script should have stopped working long time ago.

Add // @grant GM_openInTab on a new line before // ==/UserScript==

Pridať odpoveď

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