1/** 2 * main.js 3 * http://www.codrops.com 4 * 5 * Licensed under the MIT license. 6 * http://www.opensource.org/licenses/mit-license.php 7 * 8 * Copyright 2016, Codrops 9 * http://www.codrops.com 10 */ 11 12 'use strict'; 13 14 var openCtrl = document.getElementById('btn-search'), 15 closeCtrl = document.getElementById('btn-search-close'), 16 searchContainer = document.querySelector('.search'), 17 inputSearch = searchContainer.querySelector('.search__input'); 18 19 function init() { 20 initEvents(); 21 } 22 23 function initEvents() { 24 openCtrl.addEventListener('click', openSearch); 25 closeCtrl.addEventListener('click', closeSearch); 26 document.addEventListener('keyup', function(ev) { 27 // escape key. 28 if( ev.keyCode == 27 ) { 29 closeSearch(); 30 } 31 }); 32 } 33 34 function openSearch() { 35 searchContainer.classList.add('search--open'); 36 inputSearch.focus(); 37 } 38 39 function closeSearch() { 40 searchContainer.classList.remove('search--open'); 41 inputSearch.blur(); 42 inputSearch.value = ''; 43 } 44 45 init();
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.