From a10ad0a99ba6e44a35253c3bcaff80c90e99348e Mon Sep 17 00:00:00 2001 From: Karl Hallsby Date: Sun, 3 Oct 2021 00:10:58 -0500 Subject: Revert ALL jekyll-text-theme configuration files I am changing the theme of the site, and need to revert these changes to make everything work. Revert "Add jekyll-text-theme YAML files" This reverts commit 61b34a5f260db45575d448d766ea29c0fb273ed3. Revert "Bring all of jekyll-text-theme _includes into site" This reverts commit c6bf5f7c895287d2028f6024265913b59784a154. Revert "Bring all of jekyll-text-theme assets to site" This reverts commit 7b69c2e5975f98da09d932ba6c70bdd71b1601a7. Remove jekyll text theme from Gemfile --- _includes/search-providers/default/search.js | 112 --------------------------- 1 file changed, 112 deletions(-) delete mode 100644 _includes/search-providers/default/search.js (limited to '_includes/search-providers/default/search.js') diff --git a/_includes/search-providers/default/search.js b/_includes/search-providers/default/search.js deleted file mode 100644 index bf69c28..0000000 --- a/_includes/search-providers/default/search.js +++ /dev/null @@ -1,112 +0,0 @@ -var SOURCES = window.TEXT_VARIABLES.sources; -var PAHTS = window.TEXT_VARIABLES.paths; -window.Lazyload.js([SOURCES.jquery, PAHTS.search_js], function() { - var search = (window.search || (window.search = {})); - var searchData = window.TEXT_SEARCH_DATA || {}; - - function memorize(f) { - var cache = {}; - return function () { - var key = Array.prototype.join.call(arguments, ','); - if (key in cache) return cache[key]; - else return cache[key] = f.apply(this, arguments); - }; - } - - /// search - function searchByQuery(query) { - var i, j, key, keys, cur, _title, result = {}; - keys = Object.keys(searchData); - for (i = 0; i < keys.length; i++) { - key = keys[i]; - for (j = 0; j < searchData[key].length; j++) { - cur = searchData[key][j], _title = cur.title; - if ((result[key] === undefined || result[key] && result[key].length < 4 ) - && _title.toLowerCase().indexOf(query.toLowerCase()) >= 0) { - if (result[key] === undefined) { - result[key] = []; - } - result[key].push(cur); - } - } - } - return result; - } - - var renderHeader = memorize(function(header) { - return $('

' + header + '

'); - }); - - var renderItem = function(index, title, url) { - return $('
  • ' + title + '
  • '); - }; - - function render(data) { - if (!data) { return null; } - var $root = $(''), i, j, key, keys, cur, itemIndex = 0; - keys = Object.keys(data); - for (i = 0; i < keys.length; i++) { - key = keys[i]; - $root.append(renderHeader(key)); - for (j = 0; j < data[key].length; j++) { - cur = data[key][j]; - $root.append(renderItem(itemIndex++, cur.title, cur.url)); - } - } - return $root; - } - - // search box - var $result = $('.js-search-result'), $resultItems; - var lastActiveIndex, activeIndex; - - function clear() { - $result.html(null); - $resultItems = $('.search-result__item'); activeIndex = 0; - } - function onInputNotEmpty(val) { - $result.html(render(searchByQuery(val))); - $resultItems = $('.search-result__item'); activeIndex = 0; - $resultItems.eq(0).addClass('active'); - } - - search.clear = clear; - search.onInputNotEmpty = onInputNotEmpty; - - function updateResultItems() { - lastActiveIndex >= 0 && $resultItems.eq(lastActiveIndex).removeClass('active'); - activeIndex >= 0 && $resultItems.eq(activeIndex).addClass('active'); - } - - function moveActiveIndex(direction) { - var itemsCount = $resultItems ? $resultItems.length : 0; - if (itemsCount > 1) { - lastActiveIndex = activeIndex; - if (direction === 'up') { - activeIndex = (activeIndex - 1 + itemsCount) % itemsCount; - } else if (direction === 'down') { - activeIndex = (activeIndex + 1 + itemsCount) % itemsCount; - } - updateResultItems(); - } - } - - // Char Code: 13 Enter, 37 ⬅, 38 ⬆, 39 ➡, 40 ⬇ - $(window).on('keyup', function(e) { - var modalVisible = search.getModalVisible && search.getModalVisible(); - if (modalVisible) { - if (e.which === 38) { - modalVisible && moveActiveIndex('up'); - } else if (e.which === 40) { - modalVisible && moveActiveIndex('down'); - } else if (e.which === 13) { - modalVisible && $resultItems && activeIndex >= 0 && $resultItems.eq(activeIndex).children('a')[0].click(); - } - } - }); - - $result.on('mouseover', '.search-result__item > a', function() { - var itemIndex = $(this).parent().data('index'); - itemIndex >= 0 && (lastActiveIndex = activeIndex, activeIndex = itemIndex, updateResultItems()); - }); -}); -- cgit v1.2.3