| | |
| | | const doc = document.documentElement; |
| | | const toggleId = 'toggle'; |
| | | const showId = 'show'; |
| | | const menu = 'menu'; |
| | | |
| | | function isObj(obj) { |
| | | return (obj && typeof obj === 'object' && obj !== null) ? true : false; |
| | |
| | | if(hyperLinks) { |
| | | hyperLinks.forEach(function(link){ |
| | | const href = link.href.replaceAll(encodeURI(open), "").replaceAll(encodeURI(close), ""); |
| | | console.log(open, close); |
| | | link.href = href; |
| | | }); |
| | | } |
| | |
| | | const target = event.target; |
| | | const isToggleControl = target.matches(`.${toggleId}`); |
| | | const isWithToggleControl = target.closest(`.${toggleId}`); |
| | | const showInstances = elems(`.${showId}`) ? Array.from(elems(`.${showId}`)) : []; |
| | | const menuInstance = target.closest(`.${menu}`); |
| | | |
| | | function showOff(target, self = false) { |
| | | showInstances.forEach(function(showInstance){ |
| | | if(!self) { |
| | | deleteClass(showInstance, showId); |
| | | } |
| | | if(showInstance !== target.closest(`.${menu}`)) { |
| | | deleteClass(showInstance, showId); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | if(isToggleControl || isWithToggleControl) { |
| | | const menu = isWithToggleControl ? isWithToggleControl.parentNode.parentNode : target.parentNode.parentNode; |
| | | event.preventDefault(); |
| | | modifyClass(menu, showId); |
| | | } else { |
| | | if(!menuInstance) { |
| | | showOff(target); |
| | | } else { |
| | | showOff(target, true); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | const minimumSearchTermLength = isFloat ? 2 : 3; |
| | | if(searchTerm.length >= minimumSearchTermLength) { |
| | | let rawResults = index.search(searchTerm); |
| | | // console.log(rawResults); |
| | | rawResults = rawResults.map(function(result){ |
| | | const score = result.score; |
| | | const resultItem = result.item; |
| | | resultItem.score = (parseFloat(score) * 50).toFixed(0); |
| | | return resultItem; |
| | | }); |
| | | // console.log(rawResults); |
| | | searchResults(rawResults, searchTerm); |
| | | } else { |
| | | searchResults(); |
| | |
| | | main = elem('.main'); |
| | | } |
| | | const searchQuery = findQuery(); |
| | | // console.log(searchQuery); |
| | | wrapText(searchQuery[0],main); |
| | | wrapText(searchQuery[1],main); |
| | | |
| | |
| | | // right: 2.5rem |
| | | // opacity: 0 |
| | | padding: 1.5rem 0 |
| | | margin: -1.5rem 0 |
| | | margin: -1.5rem -0.5rem -1.5rem 0 |
| | | display: flex |
| | | justify-content: space-between |
| | | @media screen and (min-width: 42rem) |
| | |
| | | --accent: var(--bubble) |
| | | --overlay: var(--bubble) |
| | | --border-color: transparent |
| | | // * |
| | | // box-shadow: none !important |
| | | * |
| | | box-shadow: none !important |
| | | |
| | | &[data-mode="dark"] |
| | | @include darkmode |