1/** 2 * "Yet Another Multicolumn Layout" - YAML CSS Framework 3 * 4 * (en) Workaround for IE8 und Webkit browsers to fix focus problems when using skiplinks 5 * (de) Workaround für IE8 und Webkit browser, um den Focus zu korrigieren, bei Verwendung von Skiplinks 6 * 7 * @note inspired by Paul Ratcliffe's article 8 * http://www.communis.co.uk/blog/2009-06-02-skip-links-chrome-safari-and-added-wai-aria 9 * Many thanks to Mathias Schäfer (http://molily.de/) for his code improvements 10 * 11 * @copyright Copyright 2005-2012, Dirk Jesse 12 * @license CC-BY 2.0 (http://creativecommons.org/licenses/by/2.0/), 13 * YAML-CDL (http://www.yaml.de/license.html) 14 * @link http://www.yaml.de 15 * @package yaml 16 * @version 4.0+ 17 * @revision $Revision: 617 $ 18 * @lastmodified $Date: 2012-01-05 23:56:54 +0100 (Do, 05 Jan 2012) $ 19 */ 20 21(function () { 22 var YAML_focusFix = { 23 skipClass : 'ym-skip', 24 25 init : function () { 26 var userAgent = navigator.userAgent.toLowerCase(); 27 var is_webkit = userAgent.indexOf('webkit') > -1; 28 var is_ie = userAgent.indexOf('msie') > -1; 29 30 if (is_webkit || is_ie) { 31 var body = document.body, 32 handler = YAML_focusFix.click; 33 if (body.addEventListener) { 34 body.addEventListener('click', handler, false); 35 } else if (body.attachEvent) { 36 body.attachEvent('onclick', handler); 37 } 38 } 39 }, 40 41 trim : function (str) { 42 return str.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); 43 }, 44 45 click : function (e) { 46 e = e || window.event; 47 var target = e.target || e.srcElement; 48 var a = target.className.split(' '); 49 50 for (var i=0; i < a.length; i++) { 51 var cls = YAML_focusFix.trim(a[i]); 52 if ( cls === YAML_focusFix.skipClass) { 53 YAML_focusFix.focus(target); 54 break; 55 } 56 } 57 }, 58 59 focus : function (link) { 60 if (link.href) { 61 var href = link.href, 62 id = href.substr(href.indexOf('#') + 1), 63 target = document.getElementById(id); 64 if (target) { 65 target.setAttribute("tabindex", "-1"); 66 target.focus(); 67 } 68 } 69 } 70 }; 71 YAML_focusFix.init(); 72})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.