From 07493d0546e04d6abc0c398b7e360139a58891a8 Mon Sep 17 00:00:00 2001
From: Anika Henke <anika@selfthinker.org>
Date: Sun, 12 Oct 2008 20:16:38 +0200
Subject: [PATCH] removed 'ALT+' from all titles of elements with accesskeys
 (FS#1172)

darcs-hash:20081012181638-f7d6d-d4614321134f78fc176688d8aaf9d9acccf1952e.gz
---
 inc/form.php             |  2 +-
 inc/html.php             |  4 +--
 inc/media.php            |  4 +--
 inc/template.php         |  2 +-
 lib/scripts/edit.js      |  2 +-
 lib/scripts/script.js    | 56 +++++-----------------------------------
 lib/tpl/default/main.php |  2 +-
 7 files changed, 15 insertions(+), 57 deletions(-)

diff --git a/inc/form.php b/inc/form.php
index cd72f7b43..767788ea4 100644
--- a/inc/form.php
+++ b/inc/form.php
@@ -350,7 +350,7 @@ function form_makeButton($type, $act, $value='', $attrs=array()) {
   $elem = array('_elem'=>'button', 'type'=>$type, '_action'=>$act, 
                 'value'=>$value, 'class'=>'button');
   if (!empty($attrs['accesskey']) && empty($attrs['title'])) {
-    $attrs['title'] = $value . ' [ALT+'.strtoupper($attrs['accesskey']).']';
+    $attrs['title'] = $value . ' ['.strtoupper($attrs['accesskey']).']';
   }
   return array_merge($elem, $attrs);
 }
diff --git a/inc/html.php b/inc/html.php
index b9c6138b2..570f12b17 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -183,8 +183,8 @@ function html_btn($name,$id,$akey,$params,$method='get',$tooltip=''){
 
   $ret .= '<input type="submit" value="'.htmlspecialchars($label).'" class="button" ';
   if($akey){
-    $tip .= ' [ALT+'.strtoupper($akey).']';
-    $ret .= 'accesskey="'.$akey.'" ';
+    $tip .= ' ['.strtoupper($akey).']';
+    $ret .= 'accesskey="'.htmlspecialchars($label).' '.$akey.'" ';
   }
   $ret .= 'title="'.$tip.'" ';
   $ret .= '/>';
diff --git a/inc/media.php b/inc/media.php
index 243772ad5..0da8a8578 100644
--- a/inc/media.php
+++ b/inc/media.php
@@ -132,9 +132,9 @@ function media_metaform($id,$auth){
     echo '<div class="buttons">'.NL;
     echo '<input type="hidden" name="img" value="'.hsc($id).'" />'.NL;
     echo '<input name="do[save]" type="submit" value="'.$lang['btn_save'].
-         '" title="ALT+S" accesskey="s" class="button" />'.NL;
+         '" title="'.$lang['btn_save'].' [S]" accesskey="s" class="button" />'.NL;
     echo '<input name="do[cancel]" type="submit" value="'.$lang['btn_cancel'].
-         '" title="ALT+C" accesskey="c" class="button" />'.NL;
+         '" title="'.$lang['btn_cancel'].' [C]" accesskey="c" class="button" />'.NL;
     echo '</div>'.NL;
     echo '</form>'.NL;
 }
diff --git a/inc/template.php b/inc/template.php
index 1385c7547..7fea8c7ac 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -790,7 +790,7 @@ function tpl_searchform($ajax=true,$autocomplete=true){
   print '<input type="text" ';
   if($ACT == 'search') print 'value="'.htmlspecialchars($_REQUEST['id']).'" ';
   if(!$autocomplete) print 'autocomplete="off" ';
-  print 'id="qsearch__in" accesskey="f" name="id" class="edit" title="[ALT+F]" />';
+  print 'id="qsearch__in" accesskey="f" name="id" class="edit" title="[F]" />';
   print '<input type="submit" value="'.$lang['btn_search'].'" class="button" title="'.$lang['btn_search'].'" />';
   if($ajax) print '<div id="qsearch__out" class="ajax_qsearch JSpopup"></div>';
   print '</div></form>';
diff --git a/lib/scripts/edit.js b/lib/scripts/edit.js
index 80bb7a507..1c3df1ef8 100644
--- a/lib/scripts/edit.js
+++ b/lib/scripts/edit.js
@@ -20,7 +20,7 @@ function createToolButton(icon,label,key,id){
     btn.className = 'toolbutton';
     btn.title = label;
     if(key){
-        btn.title += ' [ALT+'+key.toUpperCase()+']';
+        btn.title += ' ['+key.toUpperCase()+']';
         btn.accessKey = key;
     }
 
diff --git a/lib/scripts/script.js b/lib/scripts/script.js
index 8c9327b1f..3d21f580d 100644
--- a/lib/scripts/script.js
+++ b/lib/scripts/script.js
@@ -20,48 +20,6 @@ if (clientPC.indexOf('opera')!=-1) {
 // prepare empty toolbar for checks by lazy plugins
 var toolbar = '';
 
-/**
- * Rewrite the accesskey tooltips to be more browser and OS specific.
- *
- * Accesskey tooltips are still only a best-guess of what will work
- * on well known systems.
- *
- * @author Ben Coburn <btcoburn@silicodon.net>
- */
-function updateAccessKeyTooltip() {
-  // determin tooltip text (order matters)
-  var tip = 'ALT+'; //default
-  if (is_macos) { tip = 'CTRL+'; }
-  if (is_opera) { tip = 'SHIFT+ESC '; }
-  // add other cases here...
-
-  // do tooltip update
-  if (tip=='ALT+') { return; }
-  var exp = /\[ALT\+/i;
-  var rep = '['+tip;
-
-  var elements = document.getElementsByTagName('a');
-  for (var i=0; i<elements.length; i++) {
-    if (elements[i].accessKey.length==1 && elements[i].title.length>0) {
-      elements[i].title = elements[i].title.replace(exp, rep);
-    }
-  }
-
-  elements = document.getElementsByTagName('input');
-  for (var i=0; i<elements.length; i++) {
-    if (elements[i].accessKey.length==1 && elements[i].title.length>0) {
-      elements[i].title = elements[i].title.replace(exp, rep);
-    }
-  }
-
-  elements = document.getElementsByTagName('button');
-  for (var i=0; i<elements.length; i++) {
-    if (elements[i].accessKey.length==1 && elements[i].title.length>0) {
-      elements[i].title = elements[i].title.replace(exp, rep);
-    }
-  }
-}
-
 /**
  * Handy shortcut to document.getElementById
  *
@@ -542,12 +500,12 @@ function checkWindowsShares() {
     var elems = getElementsByClass('windows',document,'a');
     if(elems){
         for(var i=0; i<elems.length; i++){
-			var share = elems[i];
-    		addEvent(share,'click',function(){
-				if(document.all == null) {
-					alert(LANG['nosmblinks']);
-				}
-			});
+            var share = elems[i];
+            addEvent(share,'click',function(){
+                if(document.all == null) {
+                    alert(LANG['nosmblinks']);
+                }
+            });
         }
     }
 }
@@ -558,5 +516,5 @@ function checkWindowsShares() {
  * Michael Klier <chi@chimeric.de>
  */
 addInitEvent(function(){
-	checkWindowsShares();
+    checkWindowsShares();
 });
diff --git a/lib/tpl/default/main.php b/lib/tpl/default/main.php
index 5fd3dba65..35f6b2299 100644
--- a/lib/tpl/default/main.php
+++ b/lib/tpl/default/main.php
@@ -46,7 +46,7 @@ if (!defined('DOKU_INC')) die();
         [[<?php tpl_link(wl($ID,'do=backlink'),tpl_pagetitle($ID,true),'title="'.$lang['btn_backlink'].'"')?>]]
       </div>
       <div class="logo">
-        <?php tpl_link(wl(),$conf['title'],'name="dokuwiki__top" id="dokuwiki__top" accesskey="h" title="[ALT+H]"')?>
+        <?php tpl_link(wl(),$conf['title'],'name="dokuwiki__top" id="dokuwiki__top" accesskey="h" title="[H]"')?>
       </div>
 
       <div class="clearer"></div>
-- 
GitLab