summaryrefslogtreecommitdiffstats
path: root/ui/keyboard/resources/elements/kb-accent-container.html
blob: 3eeb1e050ca54d322e5d39a28e2f587d7d2a1c7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!--
  -- Copyright 2013 The Chromium Authors. All rights reserved.
  -- Use of this source code is governed by a BSD-style license that can be
  -- found in the LICENSE file.
  -->

<element name="kb-accent-container" attributes="keyset" on-pointerup="up">
  <template>
    <content select="#{{keyset}}"></content>
  </template>
  <script>
    Polymer.register(this, {
      resetActiveElement: function() {
        var activeAccentKeySet = this.querySelector('#' + this.keyset);
        var offset = activeAccentKeySet.offset;
        var element = activeAccentKeySet.firstElementChild;
        while (offset) {
          element = element.nextElementSibling;
          offset--;
        }
        element.classList.add('active');
      },
      up: function(detail) {
        this.hidden = true;
        this.resetActiveElement();
        this.keyset = null;
      }
    });
  </script>
</element>