From 8910338cb801d4c4aca479ca7cd74d1bc7d9f08c Mon Sep 17 00:00:00 2001 From: Ilmari Karonen Date: Fri, 12 Jan 2007 23:06:06 +0000 Subject: [PATCH] akeytt(id) was broken, fix it; also make sure window.ta is defined, since many user scripts assume it is --- includes/DefaultSettings.php | 2 +- skins/common/wikibits.js | 26 +++++++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index be3047aa1d..2ce7f98a76 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1104,7 +1104,7 @@ $wgCacheEpoch = '20030516000000'; * to ensure that client-side caches don't keep obsolete copies of global * styles. */ -$wgStyleVersion = '43'; +$wgStyleVersion = '44'; # Server-side caching: diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js index fbfd28b6e4..2557a6ab72 100644 --- a/skins/common/wikibits.js +++ b/skins/common/wikibits.js @@ -481,9 +481,23 @@ function insertTags(tagOpen, tagClose, sampleText) { * @param mixed doId string or null */ function akeytt( doId ) { + // A lot of user scripts (and some of the code below) break if + // ta isn't defined, so we make sure it is. Explictly using + // window.ta avoids a "ta is not defined" error. + if (!window.ta) window.ta = new Array; + + // Make a local, possibly restricted, copy to avoid clobbering + // the original. + var ta; + if ( doId ) { + ta = new Array; + ta[doId] = window.ta[doId]; + } else { + ta = window.ta; + } + + // Set the accesskey prefix based on browser detection var pref; - var ta = window.ta; // make local copy - if (!ta) ta = new Array; if (is_opera) { pref = 'shift-esc-'; } else if (is_safari || navigator.userAgent.toLowerCase().indexOf('mac') != -1 @@ -497,11 +511,9 @@ function akeytt( doId ) { pref = 'alt-'; } - if ( doId ) { - // We're only resetting one id, so don't add the pref to titles - ta = [ta[doId]]; - } else { - // Add browser-specific pref to accesskeys set the proper way + // If we're resetting all tooltips, rather than just one, add + // the browser-specific pref to accesskeys set the proper way + if ( !doId ) { els = document.getElementsByTagName("*"); for (var i = 0; i < els.length; ++i) { var element, tit, key; -- 2.20.1