PageSourceSearch

https://portal.hero.co.nz/js/accesskeys.js?v=830f6bf3f2f6286088a4dc87175cd80e

js hero.co.nz collected 2026-10-02 15:01:44 UTC 2,729 bytes, 76 lines download raw bytes

1/**
2 * Accesskeys javascript file.
3 *
4 * @author     Michael Slusarz <[email protected]>
5 * @copyright  2014-2015 Horde LLC
6 * @license    LGPL-2.1 (http://www.horde.org/licenses/lgpl21)
7 */
8
9var AccessKeys = {
10
11    macos: navigator.appVersion.indexOf("Mac") !=- 1,
12
13    keydownHandler: function(e)
14    {
15        var elt, elts, evt, key, href;
16
17        if ((this.macos && e.ctrlKey) ||
18            (!this.macos && e.altKey && !e.ctrlKey)) {
19            // Need to search for both upper and lowercase value
20            key = String.fromCharCode(e.keyCode || e.charCode).sub('"', '\\"');
21            elts = $$('[accesskey="' + key.toUpperCase() + '"]');
22            if (key.toUpperCase() != key.toLowerCase()) {
23                elts = elts.concat($$('[accesskey="' + key.toLowerCase() + '"]'));
24            }
25
26            if ((elt = elts.first())) {
27                // Remove duplicate accesskeys
28                if (elts.size() > 1) {
29                    elts.slice(1).invoke('writeAttribute', 'accesskey', null);
30                }
31
32                e.stop();
33
34                if (Prototype.Browser.Opera && elt.tagName == 'LABEL') {
35                    elt = $(elt.readAttribute('for'));
36                    if (!elt) {
37                        return;
38                    }
39                }
40
41                try {
42                    elt.focus();
43                } catch (ex) {}
44
45                if (navigator.userAgent.indexOf('Chrome/') > -1 && !this.macos &&
46                    elt.tagName == 'A') {
47                    return;
48                }
49
50                // Trigger a mouse event on the accesskey element.
51                if (elt.tagName == 'INPUT') {
52                    // NOOP
53                } else if (elt.match('A') && elt.onclick) {
54                    elt.onclick();
55                } else if (elt.match('A') && Prototype.Browser.IE &&
56                           (href = elt.readAttribute('href')) &&
57                           href.substr(0, 1) != '#') {
58                    if (href.indexOf('javascript:') === 0) {
59                        eval(href.substr(11));
60                    } else {
61                        window.open(href);
62                    }
63                } else if (document.createEvent) {
64                    evt = document.createEvent('MouseEvents');
65                    evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
66                    elt.dispatchEvent(evt);
67                } else {
68                    evt = document.createEventObject();
69                    elt.fireEvent('onclick', evt);
70                }
71            }
72        }
73    }
74};
75
76document.observe('keydown', AccessKeys.keydownHandler.bindAsEventListener(AccessKeys));

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.