User:Hippietrail/akeytt

Definition from Wiktionary, the free dictionary
Jump to: navigation, search

/*

*/

function akeytt() {
        if (typeof ta == "undefined" || !ta)
                return;
        var pref = 'alt-';
        if (is_safari || navigator.userAgent.toLowerCase().indexOf('mac') + 1
                || navigator.userAgent.toLowerCase().indexOf('konqueror') + 1 )
                pref = 'control-';
        if (is_opera)
                pref = 'shift-esc-';

        for (var id in ta) {
                var n = document.getElementById(id);
                if (n) {
                        var a = null;
                        var ak = '';
                        // Are we putting accesskey in it
                        if (ta[id][0].length > 0) {
                                // Is this object a object? If not assume it's the next child.

                                if (n.nodeName.toLowerCase() == "a") {
                                        a = n;
                                } else {
                                        a = n.childNodes[0];
                                }

                                if (a) {
                                        a.accessKey = ta[id][0];
                                        ak = ' ['+pref+ta[id][0]+']';
                                }
                        } else {
                                // We don't care what type the object is when assigning tooltip
                                a = n;
                                ak = '';
                        }

                        if (a) {
                                a.title = ta[id][1]+ak;
                        }
                }
        }
}

/*
  • /