rawfeed 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/_includes/layout/data.liquid +6 -1
- data/_includes/layout/head.html +1 -1
- data/_includes/layout/header.html +6 -6
- data/_layouts/default.html +111 -8
- data/_layouts/resume.html +0 -21
- data/_sass/components/_markdown.scss +1 -0
- data/assets/js/terminal.js +4 -1
- data/assets/js/toc.js +2 -0
- data/lib/rawfeed/version.rb +1 -1
- metadata +1 -2
- data/assets/js/blog_search.js +0 -102
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 43082a78e1bebe2c53968549b49153fd41a042890a97c8ef2a6246f6e34d5721
         | 
| 4 | 
            +
              data.tar.gz: c0bcceeb789e3f13f21456c06be92110f7cd24d368016fa2e6369b1573edb599
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 176ea97f55511d81489e3a13cb520523b5a09f394c1d2b5f0cdb5fefb9b1dfff9c17762096b344e6d07b145cb202aa7771abf42dd95ce0387f4584bef4b2b842
         | 
| 7 | 
            +
              data.tar.gz: 7e9a264722e5396bf5928108677ec010fb83e7ea6eef85f28b3ff81d6abf66f06ac9c53f8f0bfa2b44b5abf4e51ef5c7818c98eaa8c5ce30bc62dd977a043b23
         | 
    
        data/README.md
    CHANGED
    
    | @@ -47,13 +47,13 @@ In the terminal/Command Prompt, run the commands below according to the OS. | |
| 47 47 | 
             
            **Unix:**
         | 
| 48 48 |  | 
| 49 49 | 
             
            ```shell
         | 
| 50 | 
            -
            curl -fsSL https:// | 
| 50 | 
            +
            curl -fsSL https://raw.githubusercontent.com/williamcanin/rawfeed/refs/heads/main/tools/installer/unix/install.sh | sh
         | 
| 51 51 | 
             
            ```
         | 
| 52 52 |  | 
| 53 53 | 
             
            **Windows:**
         | 
| 54 54 |  | 
| 55 55 | 
             
            ```shell
         | 
| 56 | 
            -
            iwr -useb https:// | 
| 56 | 
            +
            iwr -useb https://raw.githubusercontent.com/williamcanin/rawfeed/refs/heads/main/tools/installer/win/install.ps1 | iex
         | 
| 57 57 | 
             
            ```
         | 
| 58 58 |  | 
| 59 59 | 
             
            # Usage
         | 
| @@ -1,3 +1,8 @@ | |
| 1 1 | 
             
            {%- assign project_url = "https://github.com/williamcanin/rawfeed" -%}
         | 
| 2 2 | 
             
            {%- assign theme_name = "rawfeed" -%}
         | 
| 3 | 
            -
            { | 
| 3 | 
            +
            {%- assign data_cv = site.data.cv -%}
         | 
| 4 | 
            +
            {%- assign home_url = "/" | relative_url -%}
         | 
| 5 | 
            +
            {%- assign blog_url = "/blog/" | relative_url -%}
         | 
| 6 | 
            +
            {%- assign search_url = "/blog/?search=open" | relative_url -%}
         | 
| 7 | 
            +
            {%- assign tags_url = "/blog/tags/" | relative_url -%}
         | 
| 8 | 
            +
            {%- assign feed_url = "/feed.xml" | relative_url -%}
         | 
    
        data/_includes/layout/head.html
    CHANGED
    
    | @@ -4,7 +4,7 @@ | |
| 4 4 | 
             
              <meta name="viewport" content="width=device-width, initial-scale=1">
         | 
| 5 5 | 
             
              <meta charset="utf-8">
         | 
| 6 6 | 
             
              {%- if page.url == "/" -%}
         | 
| 7 | 
            -
                <title>{{ site.title | default: theme_name }} | {{ site. | 
| 7 | 
            +
                <title>{{ site.title | default: theme_name }} | {{ site.baseurl | prepend: site.url }}</title>
         | 
| 8 8 | 
             
              {%- else -%}
         | 
| 9 9 | 
             
                <title>{{ page.title }} | {{ site.title | default: theme_name }}</title>
         | 
| 10 10 | 
             
              {%- endif -%}
         | 
| @@ -25,9 +25,9 @@ | |
| 25 25 | 
             
                    <div class="container">
         | 
| 26 26 | 
             
                      <div class="row">
         | 
| 27 27 | 
             
                        {%- if index.layout == "blog" -%}
         | 
| 28 | 
            -
                          <span>[ <a class="{% if page.url == "/" or page.url == "/index.html" %}menu-active{% endif %}" href=" | 
| 28 | 
            +
                          <span>[ <a class="{% if page.url == "/" or page.url == "/index.html" %}menu-active{% endif %}" href="{{home_url}}">{{ site.text.menu.blog | default: "blog" | downcase }}</a> ]</span>
         | 
| 29 29 | 
             
                        {%- else -%}
         | 
| 30 | 
            -
                          <span>[ <a class="{% if page.url == "/" or page.url == "/index.html" %}menu-active{% endif %}" href=" | 
| 30 | 
            +
                          <span>[ <a class="{% if page.url == "/" or page.url == "/index.html" %}menu-active{% endif %}" href="{{home_url}}">{{ site.text.menu.home | default: "home" | downcase }}</a> ]</span>
         | 
| 31 31 | 
             
                        {%- endif -%}
         | 
| 32 32 | 
             
                      </div>
         | 
| 33 33 | 
             
                    </div>
         | 
| @@ -86,7 +86,7 @@ | |
| 86 86 | 
             
                  <div class="col-sm d-flex justify-content-center column-bottom">
         | 
| 87 87 | 
             
                  {%- if index.layout == "blog" -%}
         | 
| 88 88 | 
             
                    <span class="blog-menu">menu »
         | 
| 89 | 
            -
                       {%- if site.blog.search.enable -%}<a id="blog-search__btn" class="blog-menu__link" href=" | 
| 89 | 
            +
                       {%- if site.blog.search.enable -%}<a id="blog-search__btn" class="blog-menu__link" href="{{search_url}}">{{ site.text.menu.search | default: "search" }}</a><strong> . </strong>{%- endif -%}<a class="blog-menu__link{% if page.url == "/blog/tags/" or page.url == "/blog/tags/index.html" %} menu-active{% endif %}" href="{{tags_url}}">{{ site.text.menu.tags | default: "tags" }}</a><strong> . </strong>
         | 
| 90 90 | 
             
                    </span>
         | 
| 91 91 | 
             
                    {% assign sorted_pages = site.pages | sort: 'order' %}
         | 
| 92 92 | 
             
                      {%- for item in sorted_pages -%}
         | 
| @@ -96,11 +96,11 @@ | |
| 96 96 | 
             
                          {%- endunless -%}
         | 
| 97 97 | 
             
                        {%- endif -%}
         | 
| 98 98 | 
             
                      {%- endfor -%}
         | 
| 99 | 
            -
                      <a class="blog-menu__link" href=" | 
| 99 | 
            +
                      <a class="blog-menu__link" href="{{feed_url}}">{{ site.text.menu.feed | default: "feed" }}</a><strong> . </strong>
         | 
| 100 100 | 
             
                  {%- else index.layout == "home" -%}
         | 
| 101 101 | 
             
                    {%- if page.url contains "/blog/" -%}
         | 
| 102 102 | 
             
                      <span class="blog-menu">{{ site.text.menu.blog }} »
         | 
| 103 | 
            -
                        <a class="blog-menu__link{% if page.url == "/blog/" or page.url == "/blog/index.html" or page.url contains "/blog/page/" %} menu-active{% endif %}" href=" | 
| 103 | 
            +
                        <a class="blog-menu__link{% if page.url == "/blog/" or page.url == "/blog/index.html" or page.url contains "/blog/page/" %} menu-active{% endif %}" href="{{blog_url}}">posts</a><strong> . </strong>{%- if site.blog.search.enable -%}<a id="blog-search__btn" class="blog-menu__link" href="{{search_url}}">{{ site.text.menu.search | default: "search" }}</a><strong> . </strong>{%- endif -%}<a class="blog-menu__link{% if page.url == "/blog/tags/" or page.url == "/blog/tags/index.html" %} menu-active{% endif %}" href="{{tags_url}}">{{ site.text.menu.tags | default: "tags" }}</a><strong> . </strong><a class="blog-menu__link" href="{{feed_url}}">{{ site.text.menu.feed | default: "feed" }}</a><strong> . </strong>
         | 
| 104 104 | 
             
                      </span>
         | 
| 105 105 | 
             
                    {%- else -%}
         | 
| 106 106 | 
             
                      {%- assign published_pages = site.pages | where_exp:"p","p.path contains '_pages/' and p.published" -%}
         | 
| @@ -109,7 +109,7 @@ | |
| 109 109 | 
             
                      {%- endif -%}
         | 
| 110 110 | 
             
                      {%- if site.pagination.enabled == true -%}
         | 
| 111 111 | 
             
                        {%- if blog_page -%}
         | 
| 112 | 
            -
                          <a href=" | 
| 112 | 
            +
                          <a href="{{blog_url}}">{{ site.text.menu.blog }}</a><strong> . </strong>
         | 
| 113 113 | 
             
                        {%- endif -%}
         | 
| 114 114 | 
             
                        {% assign sorted_pages = site.pages | sort: 'order' %}
         | 
| 115 115 | 
             
                        {%- for item in sorted_pages -%}
         | 
    
        data/_layouts/default.html
    CHANGED
    
    | @@ -3,6 +3,8 @@ | |
| 3 3 | 
             
              {%- include layout/maintenance.html -%}
         | 
| 4 4 | 
             
            {%- else -%}
         | 
| 5 5 |  | 
| 6 | 
            +
            {%- include layout/data.liquid -%}
         | 
| 7 | 
            +
             | 
| 6 8 | 
             
            {%- assign index = site.pages | where: "path", "index.md" | first -%}
         | 
| 7 9 |  | 
| 8 10 | 
             
            <!DOCTYPE html>
         | 
| @@ -50,15 +52,116 @@ | |
| 50 52 | 
             
              {%- if site.blog.search.enable -%}
         | 
| 51 53 | 
             
                {%- if page.url == '/blog/' or page.url == '/blog/index.html' -%}
         | 
| 52 54 | 
             
                  <script src="{{ '/assets/vendor/simple-jekyll-search.min.js' | relative_url }}"></script>
         | 
| 53 | 
            -
             | 
| 55 | 
            +
             | 
| 56 | 
            +
             | 
| 57 | 
            +
             | 
| 54 58 | 
             
                  <script>
         | 
| 55 | 
            -
                     | 
| 56 | 
            -
                       | 
| 57 | 
            -
                       | 
| 58 | 
            -
                       | 
| 59 | 
            -
                       | 
| 60 | 
            -
                       | 
| 61 | 
            -
             | 
| 59 | 
            +
                    document.addEventListener("DOMContentLoaded", () => {
         | 
| 60 | 
            +
                      const btn = document.getElementById('blog-search__btn');
         | 
| 61 | 
            +
                      const box = document.querySelector('.blog-search');
         | 
| 62 | 
            +
                      const searchInput = document.getElementById('blog-search__input');
         | 
| 63 | 
            +
                      const blogPosts = document.getElementById('posts');
         | 
| 64 | 
            +
                      const searchResults = document.getElementById('blog-search__results');
         | 
| 65 | 
            +
                      const searchResultsWrapper = document.getElementById('blog-search__results-wrapper');
         | 
| 66 | 
            +
                      const btnSearchClean = document.getElementById('blog-search__btn-clean');
         | 
| 67 | 
            +
                      const blogSeachInput = document.getElementById('blog-search__input');
         | 
| 68 | 
            +
             | 
| 69 | 
            +
             | 
| 70 | 
            +
                      if (!btn || !box) return;
         | 
| 71 | 
            +
             | 
| 72 | 
            +
                      const openSearch = () => {
         | 
| 73 | 
            +
                        box.classList.add('is-open');
         | 
| 74 | 
            +
                        box.style.maxHeight = box.scrollHeight + 'px';
         | 
| 75 | 
            +
                        box.style.opacity = '1';
         | 
| 76 | 
            +
                        box.addEventListener('transitionend', function onOpened(e) {
         | 
| 77 | 
            +
                          if (e.propertyName === 'max-height') {
         | 
| 78 | 
            +
                            box.style.maxHeight = 'none';
         | 
| 79 | 
            +
                            box.removeEventListener('transitionend', onOpened);
         | 
| 80 | 
            +
                          }
         | 
| 81 | 
            +
                        });
         | 
| 82 | 
            +
                        blogSeachInput.focus();
         | 
| 83 | 
            +
                      };
         | 
| 84 | 
            +
             | 
| 85 | 
            +
                      const closeSearch = () => {
         | 
| 86 | 
            +
                        box.style.maxHeight = box.scrollHeight + 'px';
         | 
| 87 | 
            +
                        void box.offsetHeight; // reflow force
         | 
| 88 | 
            +
                        requestAnimationFrame(() => {
         | 
| 89 | 
            +
                          box.style.maxHeight = '0';
         | 
| 90 | 
            +
                          box.style.opacity = '0';
         | 
| 91 | 
            +
                        });
         | 
| 92 | 
            +
                        box.classList.remove('is-open');
         | 
| 93 | 
            +
                      };
         | 
| 94 | 
            +
             | 
| 95 | 
            +
                      btn.addEventListener('click', (e) => {
         | 
| 96 | 
            +
                        e.preventDefault();
         | 
| 97 | 
            +
             | 
| 98 | 
            +
                        // if are already in /blog/, toggle
         | 
| 99 | 
            +
                        const pathname = location.pathname.replace(/\/$/, '');
         | 
| 100 | 
            +
                        const isBlog = pathname === '/blog' || pathname === '/blog/index.html';
         | 
| 101 | 
            +
             | 
| 102 | 
            +
                        if (!isBlog) {
         | 
| 103 | 
            +
                          // if are on another page, go to /blog/ and open it
         | 
| 104 | 
            +
                          window.location.href = "{{ search_url }}";
         | 
| 105 | 
            +
                          return;
         | 
| 106 | 
            +
                        }
         | 
| 107 | 
            +
             | 
| 108 | 
            +
                        // toggle
         | 
| 109 | 
            +
                        if (box.classList.contains('is-open')) {
         | 
| 110 | 
            +
                          closeSearch();
         | 
| 111 | 
            +
                          searchInput.value = '';
         | 
| 112 | 
            +
                          blogPosts.classList.remove('disabled');
         | 
| 113 | 
            +
                          searchResultsWrapper.classList.add('disabled');
         | 
| 114 | 
            +
                        } else {
         | 
| 115 | 
            +
                          openSearch();
         | 
| 116 | 
            +
                        }
         | 
| 117 | 
            +
                      });
         | 
| 118 | 
            +
             | 
| 119 | 
            +
                      // opens automatically if arrived from another link with ?search=open
         | 
| 120 | 
            +
                      const params = new URLSearchParams(location.search);
         | 
| 121 | 
            +
                      if (params.get('search') === 'open') {
         | 
| 122 | 
            +
                        setTimeout(openSearch, 30);
         | 
| 123 | 
            +
                      }
         | 
| 124 | 
            +
             | 
| 125 | 
            +
                      /* clean button input blog search
         | 
| 126 | 
            +
                      --------------------------------------------------------------------------------------------------
         | 
| 127 | 
            +
                      */
         | 
| 128 | 
            +
                      function clearSearch() {
         | 
| 129 | 
            +
                        blogSeachInput.value = '';
         | 
| 130 | 
            +
                        blogPosts.classList.remove('disabled');
         | 
| 131 | 
            +
                        searchResults.classList.add('disabled');
         | 
| 132 | 
            +
                        searchResultsWrapper.classList.add('disabled');
         | 
| 133 | 
            +
                        blogSeachInput.focus();
         | 
| 134 | 
            +
                      }
         | 
| 135 | 
            +
                      btnSearchClean.addEventListener('click', clearSearch);
         | 
| 136 | 
            +
                      document.addEventListener('keydown', (e) => {
         | 
| 137 | 
            +
                        if (e.key === 'Escape') {
         | 
| 138 | 
            +
                          clearSearch();
         | 
| 139 | 
            +
                          closeSearch();
         | 
| 140 | 
            +
                        }
         | 
| 141 | 
            +
                      });
         | 
| 142 | 
            +
             | 
| 143 | 
            +
                      /* open results and close posts in search (toggle)
         | 
| 144 | 
            +
                      --------------------------------------------------------------------------------------------------
         | 
| 145 | 
            +
                      */
         | 
| 146 | 
            +
                      searchInput.addEventListener('input', () => {
         | 
| 147 | 
            +
                        if (searchInput.value.trim().length > 0) {
         | 
| 148 | 
            +
                          blogPosts.classList.add('disabled');
         | 
| 149 | 
            +
                          searchResults.classList.remove('disabled');
         | 
| 150 | 
            +
                          searchResultsWrapper.classList.remove('disabled');
         | 
| 151 | 
            +
                        } else {
         | 
| 152 | 
            +
                          blogPosts.classList.remove('disabled');
         | 
| 153 | 
            +
                          searchResults.classList.add('disabled');
         | 
| 154 | 
            +
                          searchResultsWrapper.classList.add('disabled');
         | 
| 155 | 
            +
                        }
         | 
| 156 | 
            +
                      });
         | 
| 157 | 
            +
                      var sjs = SimpleJekyllSearch({
         | 
| 158 | 
            +
                        searchInput: document.getElementById('blog-search__input'),
         | 
| 159 | 
            +
                        resultsContainer: document.getElementById('blog-search__results'),
         | 
| 160 | 
            +
                        searchResultTemplate: '<li><span class="blog-list__meta"><time datetime="{date}">{date}</time></span> »  <a class="blog-list__link" href="{{ site.url }}{url}">{title}</a></li>',
         | 
| 161 | 
            +
                        noResultsText: '<p>{{ site.text.blog.no_results | default: "No results found" }}</p>',
         | 
| 162 | 
            +
                        json: "{{ '/assets/json/blog_search.json' | relative_url }}"
         | 
| 163 | 
            +
                      })
         | 
| 164 | 
            +
                    });
         | 
| 62 165 | 
             
                  </script>
         | 
| 63 166 | 
             
                {%- endif -%}
         | 
| 64 167 | 
             
              {%- endif -%}
         | 
    
        data/_layouts/resume.html
    CHANGED
    
    | @@ -213,27 +213,6 @@ | |
| 213 213 | 
             
                            {%- endfor -%}
         | 
| 214 214 | 
             
                          </section>
         | 
| 215 215 | 
             
                          {%- endif -%}
         | 
| 216 | 
            -
                          {% comment %} {%- if resume.body.volunteering.enable -%}
         | 
| 217 | 
            -
                          <section class="row section volunteering">
         | 
| 218 | 
            -
                            <h2 class="section-title">{{ resume.body.volunteering.caption }}</h2>
         | 
| 219 | 
            -
                            {%- for vol in resume.body.volunteering.section -%}
         | 
| 220 | 
            -
                              <div class="section-item">
         | 
| 221 | 
            -
                                <div class="row">
         | 
| 222 | 
            -
                                  <div class="role"><p><span class="marker">• </span>{{ vol.role }}</p></div>
         | 
| 223 | 
            -
                                </div>
         | 
| 224 | 
            -
                                <div class="row">
         | 
| 225 | 
            -
                                  {%- if vol.link -%}
         | 
| 226 | 
            -
                                    <div class="col-sm link"><p>- <a href="{{ vol.link }}" target="_blank">{{ vol.company }}</a></p></div>
         | 
| 227 | 
            -
                                  {%- else -%}
         | 
| 228 | 
            -
                                    <div class="col-sm company"><p>- {{ vol.company }}</p></div>
         | 
| 229 | 
            -
                                  {%- endif -%}
         | 
| 230 | 
            -
                                  <span class="col-sm d-flex justify-content-end time">{{ vol.time }}</span>
         | 
| 231 | 
            -
                                </div>
         | 
| 232 | 
            -
                                <div class="row details"><p>- {{ vol.details }}</p></div>
         | 
| 233 | 
            -
                              </div>
         | 
| 234 | 
            -
                            {%- endfor -%}
         | 
| 235 | 
            -
                          </section>
         | 
| 236 | 
            -
                          {%- endif -%} {% endcomment %}
         | 
| 237 216 | 
             
                        </div>
         | 
| 238 217 | 
             
                      </div>
         | 
| 239 218 | 
             
                    </div>
         | 
    
        data/assets/js/terminal.js
    CHANGED
    
    | @@ -3,7 +3,10 @@ document.addEventListener("DOMContentLoaded", () => { | |
| 3 3 | 
             
              --------------------------------------------------------------------------------------------------
         | 
| 4 4 | 
             
              */
         | 
| 5 5 | 
             
              const terminal = document.getElementById("terminal");
         | 
| 6 | 
            -
             | 
| 6 | 
            +
             | 
| 7 | 
            +
              if (!terminal) return;
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              const btnMax = terminal.querySelector(".terminal-header__max");
         | 
| 7 10 |  | 
| 8 11 | 
             
              let isFullscreen = false;
         | 
| 9 12 |  | 
    
        data/assets/js/toc.js
    CHANGED
    
    
    
        data/lib/rawfeed/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: rawfeed
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - William C. Canin
         | 
| @@ -205,7 +205,6 @@ files: | |
| 205 205 | 
             
            - assets/images/avatar_light.png
         | 
| 206 206 | 
             
            - assets/images/favicon.png
         | 
| 207 207 | 
             
            - assets/js/avatar.js
         | 
| 208 | 
            -
            - assets/js/blog_search.js
         | 
| 209 208 | 
             
            - assets/js/default.js
         | 
| 210 209 | 
             
            - assets/js/terminal.js
         | 
| 211 210 | 
             
            - assets/js/toc.js
         | 
    
        data/assets/js/blog_search.js
    DELETED
    
    | @@ -1,102 +0,0 @@ | |
| 1 | 
            -
            document.addEventListener("DOMContentLoaded", () => {
         | 
| 2 | 
            -
              /* blog search open
         | 
| 3 | 
            -
              --------------------------------------------------------------------------------------------------
         | 
| 4 | 
            -
              */
         | 
| 5 | 
            -
              const btn = document.getElementById('blog-search__btn');
         | 
| 6 | 
            -
              const box = document.querySelector('.blog-search');
         | 
| 7 | 
            -
              const searchInput = document.getElementById('blog-search__input');
         | 
| 8 | 
            -
              const blogPosts = document.getElementById('posts');
         | 
| 9 | 
            -
              const searchResults = document.getElementById('blog-search__results');
         | 
| 10 | 
            -
              const searchResultsWrapper = document.getElementById('blog-search__results-wrapper');
         | 
| 11 | 
            -
              const btnSearchClean = document.getElementById('blog-search__btn-clean');
         | 
| 12 | 
            -
              const blogSeachInput = document.getElementById('blog-search__input');
         | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
              if (!btn || !box) return;
         | 
| 16 | 
            -
             | 
| 17 | 
            -
              const openSearch = () => {
         | 
| 18 | 
            -
                box.classList.add('is-open');
         | 
| 19 | 
            -
                box.style.maxHeight = box.scrollHeight + 'px';
         | 
| 20 | 
            -
                box.style.opacity = '1';
         | 
| 21 | 
            -
                box.addEventListener('transitionend', function onOpened(e) {
         | 
| 22 | 
            -
                  if (e.propertyName === 'max-height') {
         | 
| 23 | 
            -
                    box.style.maxHeight = 'none';
         | 
| 24 | 
            -
                    box.removeEventListener('transitionend', onOpened);
         | 
| 25 | 
            -
                  }
         | 
| 26 | 
            -
                });
         | 
| 27 | 
            -
                blogSeachInput.focus();
         | 
| 28 | 
            -
              };
         | 
| 29 | 
            -
             | 
| 30 | 
            -
              const closeSearch = () => {
         | 
| 31 | 
            -
                box.style.maxHeight = box.scrollHeight + 'px';
         | 
| 32 | 
            -
                void box.offsetHeight; // reflow force
         | 
| 33 | 
            -
                requestAnimationFrame(() => {
         | 
| 34 | 
            -
                  box.style.maxHeight = '0';
         | 
| 35 | 
            -
                  box.style.opacity = '0';
         | 
| 36 | 
            -
                });
         | 
| 37 | 
            -
                box.classList.remove('is-open');
         | 
| 38 | 
            -
              };
         | 
| 39 | 
            -
             | 
| 40 | 
            -
              btn.addEventListener('click', (e) => {
         | 
| 41 | 
            -
                e.preventDefault();
         | 
| 42 | 
            -
                // if are already in /blog/, toggle
         | 
| 43 | 
            -
                const pathname = location.pathname.replace(/\/$/, '');
         | 
| 44 | 
            -
                const isBlog = pathname === '/blog' || pathname === '/blog/index.html';
         | 
| 45 | 
            -
             | 
| 46 | 
            -
                if (!isBlog) {
         | 
| 47 | 
            -
                  // if are on another page, go to /blog/ and open it
         | 
| 48 | 
            -
                  window.location.href = '/blog/?search=open';
         | 
| 49 | 
            -
                  return;
         | 
| 50 | 
            -
                }
         | 
| 51 | 
            -
             | 
| 52 | 
            -
                // toggle
         | 
| 53 | 
            -
                if (box.classList.contains('is-open')) {
         | 
| 54 | 
            -
                  closeSearch();
         | 
| 55 | 
            -
                  searchInput.value = '';
         | 
| 56 | 
            -
                  blogPosts.classList.remove('disabled');
         | 
| 57 | 
            -
                  searchResultsWrapper.classList.add('disabled');
         | 
| 58 | 
            -
                } else {
         | 
| 59 | 
            -
                  openSearch();
         | 
| 60 | 
            -
                }
         | 
| 61 | 
            -
              });
         | 
| 62 | 
            -
             | 
| 63 | 
            -
              // opens automatically if arrived from another link with ?search=open
         | 
| 64 | 
            -
              const params = new URLSearchParams(location.search);
         | 
| 65 | 
            -
              if (params.get('search') === 'open') {
         | 
| 66 | 
            -
                setTimeout(openSearch, 30);
         | 
| 67 | 
            -
              }
         | 
| 68 | 
            -
             | 
| 69 | 
            -
              /* clean button input blog search
         | 
| 70 | 
            -
              --------------------------------------------------------------------------------------------------
         | 
| 71 | 
            -
              */
         | 
| 72 | 
            -
              function clearSearch() {
         | 
| 73 | 
            -
                blogSeachInput.value = '';
         | 
| 74 | 
            -
                blogPosts.classList.remove('disabled');
         | 
| 75 | 
            -
                searchResults.classList.add('disabled');
         | 
| 76 | 
            -
                searchResultsWrapper.classList.add('disabled');
         | 
| 77 | 
            -
                blogSeachInput.focus();
         | 
| 78 | 
            -
              }
         | 
| 79 | 
            -
              btnSearchClean.addEventListener('click', clearSearch);
         | 
| 80 | 
            -
              document.addEventListener('keydown', (e) => {
         | 
| 81 | 
            -
                if (e.key === 'Escape') {
         | 
| 82 | 
            -
                  clearSearch();
         | 
| 83 | 
            -
                  closeSearch();
         | 
| 84 | 
            -
                }
         | 
| 85 | 
            -
              });
         | 
| 86 | 
            -
             | 
| 87 | 
            -
              /* open results and close posts in search (toggle)
         | 
| 88 | 
            -
              --------------------------------------------------------------------------------------------------
         | 
| 89 | 
            -
              */
         | 
| 90 | 
            -
              searchInput.addEventListener('input', () => {
         | 
| 91 | 
            -
                if (searchInput.value.trim().length > 0) {
         | 
| 92 | 
            -
                  blogPosts.classList.add('disabled');
         | 
| 93 | 
            -
                  searchResults.classList.remove('disabled');
         | 
| 94 | 
            -
                  searchResultsWrapper.classList.remove('disabled');
         | 
| 95 | 
            -
                } else {
         | 
| 96 | 
            -
                  blogPosts.classList.remove('disabled');
         | 
| 97 | 
            -
                  searchResults.classList.add('disabled');
         | 
| 98 | 
            -
                  searchResultsWrapper.classList.add('disabled');
         | 
| 99 | 
            -
                }
         | 
| 100 | 
            -
              });
         | 
| 101 | 
            -
             | 
| 102 | 
            -
            });
         |