1var SOURCES = window.TEXT_VARIABLES.sources; 2window.Lazyload.js(SOURCES.jquery, function() { 3 /* global google */ 4 var search = (window.search || (window.search = {})); 5 var searchBox, searchInput, clearIcon, searchModal; 6 7 search.clear = function() { 8 searchBox && searchBox.clearAllResults(); 9 }; 10 search.onShow = function() { 11 searchInput && searchInput.focus(); 12 }; 13 search.onHide = function() { 14 searchInput && searchInput.blur(); 15 }; 16 17 window.__gcse = { 18 callback: function() { 19 searchBox = google.search.cse.element.getElement('search-box'); 20 searchInput = document.getElementById('gsc-i-id1'); 21 clearIcon = document.getElementById('gs_cb50'); 22 searchModal = search.searchModal; 23 searchModal && searchModal.$el && searchModal.$el.on('click', function(e) { 24 (e.target === this || e.target === clearIcon || e.target.className === 'gs-title') && searchModal.hide(); 25 }); 26 } 27 }; 28 var cx = '{{ site.search.google.custom_search_engine_id }}'; // Insert your own Custom Search Engine ID here 29 var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; 30 gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + 31 '//cse.google.com/cse.js?cx=' + cx; 32 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); 33}); 34