X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/87219ebd28426c6d21cb545233ee52f5f7af7dfd..18a6620945d02687fbcfc4c27355d952fd748b41:/resources/jquery/jquery.tabIndex.js diff --git a/resources/jquery/jquery.tabIndex.js b/resources/jquery/jquery.tabIndex.js new file mode 100644 index 00000000..bb9b2bfa --- /dev/null +++ b/resources/jquery/jquery.tabIndex.js @@ -0,0 +1,35 @@ +/** + * jQuery tabIndex + */ +( function( $ ) { +/** + * Finds the lowerst tabindex in use within a selection + * + * @return Integer of lowest tabindex on the page + */ +jQuery.fn.firstTabIndex = function() { + var minTabIndex = 0; + jQuery(this).find( '[tabindex]' ).each( function() { + var tabIndex = parseInt( jQuery(this).attr( 'tabindex' ) ); + if ( tabIndex > minTabIndex ) { + minTabIndex = tabIndex; + } + } ); + return minTabIndex; +}; +/** + * Finds the highest tabindex in use within a selection + * + * @return Integer of highest tabindex on the page + */ +jQuery.fn.lastTabIndex = function() { + var maxTabIndex = 0; + jQuery(this).find( '[tabindex]' ).each( function() { + var tabIndex = parseInt( jQuery(this).attr( 'tabindex' ) ); + if ( tabIndex > maxTabIndex ) { + maxTabIndex = tabIndex; + } + } ); + return maxTabIndex; +}; +} )( jQuery ); \ No newline at end of file