2013-01-22 00:01:53 +00:00
|
|
|
( function() {
|
2013-03-05 00:41:38 +00:00
|
|
|
var is_webkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1,
|
|
|
|
is_opera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1,
|
|
|
|
is_ie = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1;
|
2013-03-07 14:10:13 +00:00
|
|
|
|
2014-04-15 09:40:29 +00:00
|
|
|
if ( ( is_webkit || is_opera || is_ie ) && document.getElementById && window.addEventListener ) {
|
|
|
|
window.addEventListener( 'hashchange', function() {
|
2015-02-17 17:52:36 +00:00
|
|
|
var id = location.hash.substring( 1 ),
|
|
|
|
element;
|
|
|
|
|
|
|
|
if ( ! /^[A-z0-9_-]+$/.test( id ) ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
element = document.getElementById( id );
|
2013-03-07 14:10:13 +00:00
|
|
|
|
2013-03-05 00:41:38 +00:00
|
|
|
if ( element ) {
|
2014-12-24 05:19:34 +00:00
|
|
|
if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) {
|
2013-03-05 00:41:38 +00:00
|
|
|
element.tabIndex = -1;
|
2014-12-24 05:19:34 +00:00
|
|
|
}
|
2013-03-07 14:10:13 +00:00
|
|
|
|
2013-03-05 00:41:38 +00:00
|
|
|
element.focus();
|
|
|
|
}
|
2013-03-07 14:10:13 +00:00
|
|
|
}, false );
|
2013-03-05 00:41:38 +00:00
|
|
|
}
|
2013-01-22 00:01:53 +00:00
|
|
|
})();
|