Created
March 25, 2025 16:30
-
-
Save garvin/b641700f3203ddb37bf222c3a4f8c012 to your computer and use it in GitHub Desktop.
Focused-thing outliner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Focused-thing outliner | |
// @namespace http://garvinggarvin.com/monkies | |
// @description Outline/highlight the focused thingy. | |
// @match *://*.mbsbooks.com/* | |
// @match *://*.cgarvin.com/* | |
// @match *://bookstore.mbsdirect.net/* | |
// @match *://bncvirtual.com/* | |
// @exclude *://*.mbsbooks.com/misi-test/dashboard/modules/webauth/* | |
// @exclude *://*.mbsbooks.com/misi/dashboard/modules/webauth/* | |
// @exclude *://splunk.mbsbooks.com/* | |
// @exclude *://internaldev.mbsbooks.com/mantisbt/* | |
// @exclude *://*.mbsbooks.com/vbe-test/* | |
// @exclude *://*.mbsbooks.com/vbe/* | |
// @exclude *://jira.mbsbooks.com/* | |
// @grant GM_getValue | |
// @version 1 | |
// @exclude http*://*dashboard/modules/session_lookup* | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js | |
// ==/UserScript== | |
/** | |
* CHANGELOG | |
* ======================================== | |
* 2013-06-05: Added cgarvin dev URLs. Not really tested yet. | |
*/ | |
(function() { // start wrapper function | |
$(document).ready( function() { | |
$("body *") | |
.bind( | |
'focus', | |
function() { | |
var $outlined_thing = $(this); | |
// when focused element is a VB <a><ul><li>...</li></ul></a>: | |
if ( | |
$(this).html() != $(this).text() | |
&& | |
$(this).children().first().is("ul") | |
) { | |
$outlined_thing = $(this).children().first(); | |
} | |
// and/or checkbox? | |
// radio button wrapped in a label | |
else if ($(this).is("input[type='radio']") && $(this).parent().is("label")) { | |
$outlined_thing = $(this).parent(); | |
} | |
// checkbox w/ "floating" label | |
else if ( | |
$(this).is("input[type='checkbox']") | |
&& | |
$("label[for='" + $(this).attr("id") + "']").length | |
) { | |
$outlined_thing = $("label[for='" + $(this).attr("id") + "']"); | |
} | |
// adoptions page :: book <label><div><input type='radio'></div></label> | |
else if ($(this).is("input[type='radio']") && $(this).parent().parent().is("label")) { | |
$outlined_thing = $(this).parent().parent(); | |
} | |
$outlined_thing.css({outline: '3px dashed red'}); | |
$(this).data("outlined_thing", $outlined_thing); | |
} | |
).bind( | |
'blur', | |
function() { | |
var $outlined_thing = $(this); | |
if ($(this).data("outlined_thing")) { | |
$outlined_thing = $(this).data("outlined_thing"); | |
} | |
$outlined_thing.css({outline: ''}); | |
} | |
); | |
}); | |
})(); // end wrapper function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment