Home | History | Annotate | Download | only in elements
      1 <!--
      2   -- Copyright 2013 The Chromium Authors. All rights reserved.
      3   -- Use of this source code is governed by a BSD-style license that can be
      4   -- found in the LICENSE file.
      5   -->
      6 
      7 <polymer-element name="kb-altkey-container" attributes="keyset" on-pointerup="up">
      8   <template>
      9     <style>
     10       @host {
     11         * {
     12           background-color: rgba(0, 0, 0, 0.6);
     13           bottom: 0;
     14           left: 0;
     15           -webkit-box-flex: 1;
     16           position: absolute;
     17           right: 0;
     18           top: 0;
     19         }
     20       }
     21     </style>
     22     <content select="#{{keyset}}"></content>
     23   </template>
     24   <script>
     25     Polymer('kb-altkey-container', {
     26       resetActiveElement: function() {
     27         var activeAccentKeySet = this.querySelector('#' + this.keyset);
     28         var offset = activeAccentKeySet.offset;
     29         var element = activeAccentKeySet.firstElementChild;
     30         while (offset) {
     31           element = element.nextElementSibling;
     32           offset--;
     33         }
     34         element.classList.add('active');
     35       },
     36       up: function(detail) {
     37         this.hidden = true;
     38         this.resetActiveElement();
     39         this.keyset = null;
     40       }
     41     });
     42   </script>
     43 </polymer-element>
     44