From b1112787e60be712d508e80baaf0d6f9a861f0ac Mon Sep 17 00:00:00 2001 From: Ben Coburn Date: Fri, 28 Apr 2006 03:51:58 +0200 Subject: accesskey tooltip rewriting Does client-side rewriting of accesskey tooltip text so that it will be more OS and browser specific. Dokuwiki should output all accesskey tooltips as [ALT+] because this patch matches on "[ALT+". darcs-hash:20060428015158-05dcb-0102a1b2068c053e81dd21ad3927c78b6c9f349e.gz --- inc/html.php | 2 +- lib/exe/js.php | 3 ++- lib/scripts/script.js | 27 +++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/inc/html.php b/inc/html.php index 908849d2b..6d0b7e116 100644 --- a/inc/html.php +++ b/inc/html.php @@ -248,7 +248,7 @@ function html_btn($name,$id,$akey,$params,$method='get'){ $ret .= ' + */ +function updateAccessKeyTooltip() { + // determin tooltip text (order matters) + var tip = 'ALT+'; //default + if (domLib_isMac) { tip = 'CTRL+'; } + if (domLib_isOpera) { tip = 'SHIFT+ESC '; } + // add other cases here... + + // do tooltip update + if (tip=='ALT+') { return; } + var exp = /\[ALT\+/i; + var rep = '['+tip; + var elements = domLib_getElementsByTagNames(['a', 'input', 'button']); + for (var i=0; i0) { + elements[i].title = elements[i].title.replace(exp, rep); + } + } +} + /** * Handy shortcut to document.getElementById * -- cgit v1.2.3