From decde989ff7614dc109af1fb42559ff4814ffc7c Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Sun, 14 Aug 2022 17:25:43 +0200 Subject: Removed search from the blog --- template/_includes.html | 3 +- template/_meta.html | 5 +- template/_navigation.html | 4 +- template/_search.html | 6 --- template/index.html | 90 ++++++++++++++++++----------------- template/post.html | 116 +++++++++++++++++++++++----------------------- template/script.js | 97 -------------------------------------- template/style.css | 103 +--------------------------------------- 8 files changed, 107 insertions(+), 317 deletions(-) delete mode 100644 template/_search.html (limited to 'template') diff --git a/template/_includes.html b/template/_includes.html index 120f8f2..6615ff2 100755 --- a/template/_includes.html +++ b/template/_includes.html @@ -1,8 +1,7 @@ - - + \ No newline at end of file diff --git a/template/_meta.html b/template/_meta.html index e759a9a..ff0dc0f 100755 --- a/template/_meta.html +++ b/template/_meta.html @@ -11,5 +11,6 @@ - - + \ No newline at end of file diff --git a/template/_navigation.html b/template/_navigation.html index 45a2a9e..8fef331 100755 --- a/template/_navigation.html +++ b/template/_navigation.html @@ -13,8 +13,6 @@ Books - - Search - + \ No newline at end of file diff --git a/template/_search.html b/template/_search.html deleted file mode 100644 index 997b35c..0000000 --- a/template/_search.html +++ /dev/null @@ -1,6 +0,0 @@ - - - diff --git a/template/index.html b/template/index.html index cb334e1..9196940 100755 --- a/template/index.html +++ b/template/index.html @@ -1,64 +1,62 @@ - - {{template "_meta.html"}} + + {{template "_meta.html"}} - {{.Title}} - - - - + {{.Title}} + + + + - + - {{template "_navigation.html"}} + {{template "_navigation.html"}} -
-

Blog posts

- -
+
-
-

Side projects I work/worked on

- -
+
+

Side projects I work/worked on

+ +
-
+
- {{template "openring-build.html"}} + {{template "openring-build.html"}} -
+ - {{template "_footer.html"}} + {{template "_footer.html"}} - {{template "_includes.html"}} + {{template "_includes.html"}} - {{template "_search.html"}} + - - - + \ No newline at end of file diff --git a/template/post.html b/template/post.html index cf80b22..3ce5ff0 100755 --- a/template/post.html +++ b/template/post.html @@ -1,78 +1,76 @@ - - {{template "_meta.html"}} - - {{.Title}} - - - - - - - - {{template "_navigation.html"}} - -
-
-
-

{{.Title}}

- {{if .Listing}} - - {{end}} -
-
- {{.Content}} -
-
+ + {{template "_meta.html"}} - {{if .Listing}} + {{.Title}} + + + + -
+ -

- Comment, contact: The easiest way to contact me is by writing me a message on Telegram (https://t.me/mitjafelicijan). -

+ {{template "_navigation.html"}} -

You can also just write me an email at m@mitjafelicijan.com.

- -
- - {{if .Posts}} - - {{end}} + +
+ {{.Content}} +
+ + + {{if .Listing}} + +
+ +

+ Comment, contact: The easiest way to contact me is by writing me a message on Telegram (https://t.me/mitjafelicijan). +

-
+

You can also just write me an email at m@mitjafelicijan.com.

- {{template "openring-build.html"}} +
+ {{if .Posts}} + + {{end}} + +
+ + {{template "openring-build.html"}} -
+ {{end}} - {{template "_footer.html"}} + - {{template "_includes.html"}} + {{template "_footer.html"}} - {{template "_search.html"}} + {{template "_includes.html"}} - {{template "_libraries.html"}} + {{template "_libraries.html"}} - + - + \ No newline at end of file diff --git a/template/script.js b/template/script.js index 3c58403..796ea4f 100755 --- a/template/script.js +++ b/template/script.js @@ -1,17 +1,4 @@ window.addEventListener('load', async () => { - // dither image on mouse over replace - // document.querySelectorAll('article img').forEach(img => { - // const ditheredImage = img.src; - // const originalImage = img.src.replace('.dith.gif', ''); - - // img.addEventListener('mouseover', evt => { - // evt.target.src = originalImage; - // }); - - // img.addEventListener('mouseout', evt => { - // evt.target.src = ditheredImage; - // }); - // }); // flip CV image on mouse over const cvImage = document.querySelector('.cv-picture img'); @@ -25,88 +12,4 @@ window.addEventListener('load', async () => { }); } - // Search functionality - - window.index = null; - - const response = await fetch('/feed.json'); - const feed = await response.json(); - - window.index = elasticlunr(function () { - this.addField('title'); - this.addField('body'); - this.setRef('id'); - }); - - for (const item of feed.items) { - item.id = item.url; - window.index.addDoc({ - id: item.url, - title: item.title, - body: item.content_html, - url: item.url, - }); - } - - const blur = document.querySelector('.blur'); - const searchForm = document.querySelector('.search-form'); - const searchResultsList = document.querySelector('.search-form ul'); - - function showSearchModal() { - blur.classList.remove('hidden'); - searchForm.classList.remove('hidden'); - - // Clear search input. - searchForm.querySelector('input').value = ''; - - // We need to clear the list before opening modal. - searchResultsList.innerHTML = ''; - - // Focus on search input. - searchForm.querySelector('input').focus(); - } - - document.querySelector('.search-trigger').addEventListener('click', async (evt) => { - showSearchModal(); - }); - - document.onkeydown = function (e) { - // Show search modal on F key. - if (blur.classList.contains('hidden')) { - if (e.key === 'f') { - setTimeout(() => { - showSearchModal(); - }, 100); - } - } - - // Hide search modal on escape key. - if (!blur.classList.contains('hidden')) { - if (e.key === 'Escape') { - blur.classList.add('hidden'); - searchForm.classList.add('hidden'); - } - } - }; - - blur.addEventListener('click', async (evt) => { - evt.target.classList.add('hidden'); - searchForm.classList.add('hidden'); - }); - - document.querySelector('.search-form input').addEventListener('keyup', async (evt) => { - // Perform search. - const searchResults = window.index.search(evt.target.value); - - // We need to clear the list before adding new results. - searchResultsList.innerHTML = ''; - - // Loop through the results and add them to the list. - for (const result of searchResults.slice(0, 9)) { - const listItem = document.createElement('li'); - listItem.innerHTML = `${result.doc.title}`; - searchResultsList.appendChild(listItem); - } - }); - }); diff --git a/template/style.css b/template/style.css index ebb2b26..20ed862 100755 --- a/template/style.css +++ b/template/style.css @@ -386,80 +386,6 @@ audio { color: #666; } -/* comments */ - -.comments input { - width: 100%; - font: var(--comment-form-font); - border: 1px solid #bbb; - padding: 5px; -} - -.comments textarea { - width: 100%; - height: 100px; - resize: vertical; - font: var(--comment-form-font); - border: 1px solid #bbb; - padding: 5px; -} - -.comments ul { - list-style-type: none; - padding: 0; - margin-top: 30px; -} - -.comments hr { - border: initial !important; - border-top: initial !important; -} - -/* search form */ - -.search-form { - position: fixed; - top: 120px; - left: 50%; - margin-left: -250px; - width: 500px; - padding: 30px; - background: #eee; - border-radius: 5px; -} - -.blur { - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - backdrop-filter: blur(15px); -} - -.hidden { - display: none; -} - -.search-form input { - width: 100%; - margin-bottom: 20px; - border: 1px solid #ffffff; - padding: 5px 10px; - border-radius: 3px; - outline: none; -} - -.search-form ul { - list-style-type: none; - padding: 0; - margin: 0; -} - -.search-form ul li { - margin-bottom: 5px; -} - /* responsive */ @media only screen and (max-width: 960px) { @@ -507,31 +433,4 @@ audio { .search-trigger { display: none; } -} - -/* light/dark mode */ - -/*@media (prefers-color-scheme: light) { } - -@media (prefers-color-scheme: dark) { - body { - background: #222; - color: #fff; - } - - time { - color: #fff; - } - - a { - color: #fff !important; - } - - code { - color: #222 !important; - } - - blockquote:before { - background-image: url('/assets/general/alert-dark.svg'); - } -}*/ +} \ No newline at end of file -- cgit v1.2.3