NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name FocusEnable // @namespace uso2usom // @description On any web page it will check if the clicked links goes to userscripts.org. If so, the link will be rewritten to point to userscripts-mirror.org // @include http://*.* // @include https://*.* // @exclude http://userscripts.org/* // @exclude https://userscripts.org/* // @exclude http://userscripts.org:8080/* // @exclude https://userscripts.org:8080/* // @version 1.2 // @grant none // @copyright 2019, Ankatsou (https://openuserjs.org/users/Ankatsou) // @license MIT // @require http://code.jquery.com/jquery-3.3.1.min.js // ==/UserScript== var body = document.querySelector('body'); body.addEventListener('keyup', checkTabPress); function checkTabPress(e) { "use strict"; // pick passed event or global event object if passed one is empty e = e || event; var activeElement; if (e.keyCode == 9) { // Here read the active selected link. activeElement = document.activeElement; jQuery('.active-focus').css('border', 'none'); // If HTML element is an anchor a if (activeElement){ // get it's hyperlink console.log(jQuery(activeElement)) jQuery(activeElement).css('border', '1px solid red').addClass('active-focus'); } } }