rawfeed 0.2.2 → 0.2.4
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/_data/options.yml +4 -0
- data/_includes/layout/head.html +7 -0
- data/_layouts/default.html +8 -6
- data/assets/images/avatar_back.png +0 -0
- data/assets/images/avatar_dark.png +0 -0
- data/assets/images/avatar_light.png +0 -0
- data/assets/images/favicon.png +0 -0
- data/assets/js/fallback/contact.js +91 -90
- data/lib/rawfeed/reading_time.rb +5 -4
- data/lib/rawfeed/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 8511f7129df556936ff6d30d8603ae79a2a83cdcb2be2482fe325cf67efc875f
         | 
| 4 | 
            +
              data.tar.gz: 4bfec0dee20997adc15158230a331ac79a1626ae59c367df03455bc74710d306
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 58ed203632f48facc743334dbcee401886ee70f409885f7c720eed7aa2f6342761e9a18e9e7da0f997094c5768bc5bacf1ffbecca81e049e5be63efd4c5db446
         | 
| 7 | 
            +
              data.tar.gz: da43880931fc8d59d35cb82ac9b1d557044b0f0453342f0747798ff17f43c4c26a3a2b9bbede385b4fcbbe4051527421a60264f74c3b1702015133644b289abb
         | 
    
        data/_data/options.yml
    CHANGED
    
    | @@ -59,14 +59,18 @@ head: | |
| 59 59 | 
             
                connect-src:
         | 
| 60 60 | 
             
                  - https://www.google.com
         | 
| 61 61 | 
             
                  - https://api.github.com
         | 
| 62 | 
            +
                  - https://script.google.com
         | 
| 63 | 
            +
                  - https://script.googleusercontent.com
         | 
| 62 64 | 
             
                img-src:
         | 
| 63 65 | 
             
                  - https://www.google.com
         | 
| 64 66 | 
             
                  - https://media0.giphy.com
         | 
| 65 67 | 
             
                  - https://media4.giphy.com
         | 
| 68 | 
            +
                  - https://media.giphy.com
         | 
| 66 69 | 
             
                  - https://github.githubassets.com
         | 
| 67 70 | 
             
                script-src:
         | 
| 68 71 | 
             
                  - https://www.google.com
         | 
| 69 72 | 
             
                  - https://www.gstatic.com
         | 
| 73 | 
            +
                  - https://script.google.com
         | 
| 70 74 | 
             
                  - https://cdn.jsdelivr.net
         | 
| 71 75 | 
             
                  - https://cdnjs.cloudflare.com
         | 
| 72 76 | 
             
                  - https://giscus.app
         | 
    
        data/_includes/layout/head.html
    CHANGED
    
    | @@ -87,6 +87,13 @@ | |
| 87 87 | 
             
              {% comment %} load theme {% endcomment %}
         | 
| 88 88 | 
             
              <link rel="stylesheet" href="{{ '/assets/css/style.css' | relative_url }}">
         | 
| 89 89 |  | 
| 90 | 
            +
              {% comment %} custom theme {% endcomment %}
         | 
| 91 | 
            +
              {%- assign file_path = '/assets/css/custom.css' -%}
         | 
| 92 | 
            +
              {%- assign file_exists = site.static_files | where: "path", file_path | size -%}
         | 
| 93 | 
            +
              {%- if file_exists > 0 -%}
         | 
| 94 | 
            +
                <link rel="stylesheet" href="{{ '/assets/css/custom.css' | relative_url }}">
         | 
| 95 | 
            +
              {%- endif -%}
         | 
| 96 | 
            +
             | 
| 90 97 | 
             
              {% comment %} feed {% endcomment %}
         | 
| 91 98 | 
             
              <link rel="alternate" type="application/atom+xml" title="{{ site_title }}" href="{{ '/feed.xml' | relative_url }}">
         | 
| 92 99 |  | 
    
        data/_layouts/default.html
    CHANGED
    
    | @@ -38,12 +38,14 @@ | |
| 38 38 |  | 
| 39 39 | 
             
                <!-- scripts -->
         | 
| 40 40 | 
             
                <script src="{{ '/assets/vendor/bootstrap/js/bootstrap.bundle.min.js' | relative_url }}"></script>
         | 
| 41 | 
            -
                <script src="{{ '/assets/js/default.js' | relative_url }}"></script>
         | 
| 42 | 
            -
                 | 
| 43 | 
            -
             | 
| 44 | 
            -
                 | 
| 45 | 
            -
                <script src="{{ '/assets/js/ | 
| 46 | 
            -
                <script src="{{ '/assets/js/ | 
| 41 | 
            +
                <script src="{{ '/assets/js/fallback/default.js' | relative_url }}"></script>
         | 
| 42 | 
            +
                {%- if page.url contains '/blog/' -%}
         | 
| 43 | 
            +
                  <script src="{{ '/assets/vendor/simple-jekyll-search.min.js' | relative_url }}"></script>
         | 
| 44 | 
            +
                {%- endif -%}
         | 
| 45 | 
            +
                <script src="{{ '/assets/js/fallback/blog.js' | relative_url }}"></script>
         | 
| 46 | 
            +
                <script src="{{ '/assets/js/fallback/home.js' | relative_url }}"></script>
         | 
| 47 | 
            +
                <script src="{{ '/assets/js/fallback/page.js' | relative_url }}"></script>
         | 
| 48 | 
            +
                <script src="{{ '/assets/js/fallback/contact.js' | relative_url }}"></script>
         | 
| 47 49 | 
             
                <!-- scripts -->
         | 
| 48 50 | 
             
              </body>
         | 
| 49 51 | 
             
              <!-- body -->
         | 
| Binary file | 
| Binary file | 
| Binary file | 
    
        data/assets/images/favicon.png
    CHANGED
    
    | Binary file | 
| @@ -5,112 +5,113 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            document.addEventListener("DOMContentLoaded", () => {
         | 
| 7 7 | 
             
              const form = document.getElementById("contactForm");
         | 
| 8 | 
            -
               | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
                 | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
                   | 
| 24 | 
            -
             | 
| 25 | 
            -
                   | 
| 26 | 
            -
             | 
| 27 | 
            -
                   | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
                modalTitle.innerHTML = title;
         | 
| 31 | 
            -
                modalBody.innerHTML = message;
         | 
| 32 | 
            -
             | 
| 33 | 
            -
                const bsModal = new bootstrap.Modal(modalEl);
         | 
| 34 | 
            -
                bsModal.show();
         | 
| 35 | 
            -
              }
         | 
| 8 | 
            +
              if (form) {
         | 
| 9 | 
            +
                const submitButton = document.getElementById("submitButton");
         | 
| 10 | 
            +
                const endpoint = "{{ head_.google.apps_script.url }}"; // URL Google Apps Script
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                // get modal
         | 
| 13 | 
            +
                function showModal(title, message, type = 'success') {
         | 
| 14 | 
            +
                  const modalEl = document.getElementById('contactMessageModal');
         | 
| 15 | 
            +
                  const modalTitle = modalEl.querySelector('.modal-title');
         | 
| 16 | 
            +
                  const modalBody = modalEl.querySelector('.modal-body');
         | 
| 17 | 
            +
                  const modalContent = modalEl.querySelector('.modal-content');
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                  modalContent.classList.remove('contact-message-success', 'contact-message-error', 'contact-message-warning');
         | 
| 20 | 
            +
             | 
| 21 | 
            +
             | 
| 22 | 
            +
                  // Apply the color according to the type
         | 
| 23 | 
            +
                  if (type === 'success') {
         | 
| 24 | 
            +
                    modalContent.classList.add('contact-message-success');
         | 
| 25 | 
            +
                  } else if (type === 'error') {
         | 
| 26 | 
            +
                    modalContent.classList.add('contact-message-error');
         | 
| 27 | 
            +
                  } else if (type === 'warning') {
         | 
| 28 | 
            +
                    modalContent.classList.add('contact-message-warning');
         | 
| 29 | 
            +
                  }
         | 
| 36 30 |  | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
                const recaptchaResponse = grecaptcha.getResponse();
         | 
| 41 | 
            -
                if (!recaptchaResponse) {
         | 
| 42 | 
            -
                  showModal(
         | 
| 43 | 
            -
                    "{{ contact_.recaptcha.warning.title | default: 'Warning' }}",
         | 
| 44 | 
            -
                    `{{ contact_.recaptcha.warning.content | default: "Please tick the 'I'm not a robot' box." }}`,
         | 
| 45 | 
            -
                    "warning"
         | 
| 46 | 
            -
                  );
         | 
| 47 | 
            -
                  return;
         | 
| 48 | 
            -
                }
         | 
| 31 | 
            +
                  modalTitle.innerHTML = title;
         | 
| 32 | 
            +
                  modalBody.innerHTML = message;
         | 
| 49 33 |  | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 52 | 
            -
                if (text.length < "{{ contact_.message.caracters.min }}" ) {
         | 
| 53 | 
            -
                  showModal(
         | 
| 54 | 
            -
                    "{{ contact_.message.caracters.warning.title | default: 'Warning' }}",
         | 
| 55 | 
            -
                    "{{ contact_.message.caracters.warning.content | default: 'The message must have at least 50 characters.' }}",
         | 
| 56 | 
            -
                    "warning"
         | 
| 57 | 
            -
                  );
         | 
| 58 | 
            -
                  return;
         | 
| 34 | 
            +
                  const bsModal = new bootstrap.Modal(modalEl);
         | 
| 35 | 
            +
                  bsModal.show();
         | 
| 59 36 | 
             
                }
         | 
| 60 37 |  | 
| 61 | 
            -
                 | 
| 62 | 
            -
             | 
| 38 | 
            +
                form.addEventListener("submit", async (e) => {
         | 
| 39 | 
            +
                  e.preventDefault();
         | 
| 63 40 |  | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 67 | 
            -
                try {
         | 
| 68 | 
            -
                  const response = await fetch(endpoint, {
         | 
| 69 | 
            -
                    method: "POST",
         | 
| 70 | 
            -
                    redirect: "follow",
         | 
| 71 | 
            -
                    body: JSON.stringify(data)
         | 
| 72 | 
            -
                  });
         | 
| 73 | 
            -
             | 
| 74 | 
            -
                  const result = await response.json();
         | 
| 75 | 
            -
             | 
| 76 | 
            -
                  if (result.result === 'success') {
         | 
| 77 | 
            -
                    form.reset();
         | 
| 78 | 
            -
                    grecaptcha.reset();
         | 
| 41 | 
            +
                  const recaptchaResponse = grecaptcha.getResponse();
         | 
| 42 | 
            +
                  if (!recaptchaResponse) {
         | 
| 79 43 | 
             
                    showModal(
         | 
| 80 | 
            -
                      "{{ contact_. | 
| 81 | 
            -
                       | 
| 82 | 
            -
                      " | 
| 44 | 
            +
                      "{{ contact_.recaptcha.warning.title | default: 'Warning' }}",
         | 
| 45 | 
            +
                      `{{ contact_.recaptcha.warning.content | default: "Please tick the 'I'm not a robot' box." }}`,
         | 
| 46 | 
            +
                      "warning"
         | 
| 83 47 | 
             
                    );
         | 
| 84 | 
            -
             | 
| 48 | 
            +
                    return;
         | 
| 49 | 
            +
                  }
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                  const textarea = document.getElementById('textMessage');
         | 
| 52 | 
            +
                  const text = textarea.value.trim();
         | 
| 53 | 
            +
                  if (text.length < "{{ contact_.message.caracters.min }}" ) {
         | 
| 85 54 | 
             
                    showModal(
         | 
| 86 | 
            -
                      "{{ contact_.message. | 
| 87 | 
            -
                      "{{ contact_.message. | 
| 88 | 
            -
                      " | 
| 55 | 
            +
                      "{{ contact_.message.caracters.warning.title | default: 'Warning' }}",
         | 
| 56 | 
            +
                      "{{ contact_.message.caracters.warning.content | default: 'The message must have at least 50 characters.' }}",
         | 
| 57 | 
            +
                      "warning"
         | 
| 89 58 | 
             
                    );
         | 
| 90 | 
            -
                     | 
| 59 | 
            +
                    return;
         | 
| 91 60 | 
             
                  }
         | 
| 92 61 |  | 
| 93 | 
            -
             | 
| 94 | 
            -
                   | 
| 95 | 
            -
             | 
| 62 | 
            +
                  submitButton.disabled = true;
         | 
| 63 | 
            +
                  submitButton.textContent = "{{ contact_.message.status | default: 'Sending...Wait' }}";
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                  const formData = new FormData(form);
         | 
| 66 | 
            +
                  const data = Object.fromEntries(formData.entries());
         | 
| 67 | 
            +
             | 
| 68 | 
            +
                  try {
         | 
| 69 | 
            +
                    const response = await fetch(endpoint, {
         | 
| 70 | 
            +
                      method: "POST",
         | 
| 71 | 
            +
                      redirect: "follow",
         | 
| 72 | 
            +
                      body: JSON.stringify(data)
         | 
| 73 | 
            +
                    });
         | 
| 74 | 
            +
             | 
| 75 | 
            +
                    const result = await response.json();
         | 
| 76 | 
            +
             | 
| 77 | 
            +
                    if (result.result === 'success') {
         | 
| 78 | 
            +
                      form.reset();
         | 
| 79 | 
            +
                      grecaptcha.reset();
         | 
| 96 80 | 
             
                      showModal(
         | 
| 97 | 
            -
                        "{{ contact_.message. | 
| 98 | 
            -
                        "{{ contact_. | 
| 99 | 
            -
                        " | 
| 81 | 
            +
                        "{{ contact_.message.success.title | default: 'Message Sent' }}",
         | 
| 82 | 
            +
                        "{{ contact_.message.success.content | default: 'Your message has been sent successfully!' }}",
         | 
| 83 | 
            +
                        "success"
         | 
| 100 84 | 
             
                      );
         | 
| 101 | 
            -
             | 
| 85 | 
            +
                    } else {
         | 
| 102 86 | 
             
                      showModal(
         | 
| 103 87 | 
             
                        "{{ contact_.message.error.title | default: 'Error' }}",
         | 
| 104 | 
            -
                        "{{ contact_. | 
| 88 | 
            +
                        "{{ contact_.message.error.content | default: 'Something went wrong while sending your message.' }}",
         | 
| 105 89 | 
             
                        "error"
         | 
| 106 90 | 
             
                      );
         | 
| 107 | 
            -
             | 
| 108 | 
            -
             | 
| 109 | 
            -
             | 
| 110 | 
            -
             | 
| 111 | 
            -
             | 
| 112 | 
            -
             | 
| 113 | 
            -
             | 
| 114 | 
            -
             | 
| 91 | 
            +
                      throw new Error(result.message || "{{ contact_.message.error.content | default: 'An unknown error has occurred.' }}");
         | 
| 92 | 
            +
                    }
         | 
| 93 | 
            +
             | 
| 94 | 
            +
                  } catch (error) {
         | 
| 95 | 
            +
                    console.error("Error sending:", error);
         | 
| 96 | 
            +
                    if (error.message.includes("reCAPTCHA")) {
         | 
| 97 | 
            +
                        showModal(
         | 
| 98 | 
            +
                          "{{ contact_.message.error.title | default: 'Error' }}",
         | 
| 99 | 
            +
                          "{{ contact_.recaptcha.fail | default: 'Verification failed. Please reload the page and try again.' }}",
         | 
| 100 | 
            +
                          "error"
         | 
| 101 | 
            +
                        );
         | 
| 102 | 
            +
                    } else {
         | 
| 103 | 
            +
                        showModal(
         | 
| 104 | 
            +
                          "{{ contact_.message.error.title | default: 'Error' }}",
         | 
| 105 | 
            +
                          "{{ contact_.recaptcha.error | default: 'An error occurred while sending the message. Please try again.' }}",
         | 
| 106 | 
            +
                          "error"
         | 
| 107 | 
            +
                        );
         | 
| 108 | 
            +
                    }
         | 
| 109 | 
            +
                    grecaptcha.reset();
         | 
| 115 110 |  | 
| 111 | 
            +
                  } finally {
         | 
| 112 | 
            +
                    submitButton.disabled = false;
         | 
| 113 | 
            +
                    submitButton.textContent = "{{ contact_.button.text | default: 'Send!' }}";
         | 
| 114 | 
            +
                  }
         | 
| 115 | 
            +
                });
         | 
| 116 | 
            +
              }
         | 
| 116 117 | 
             
            });
         | 
    
        data/lib/rawfeed/reading_time.rb
    CHANGED
    
    | @@ -3,10 +3,11 @@ require "jekyll" | |
| 3 3 | 
             
            module Rawfeed
         | 
| 4 4 | 
             
              module ReadingTimeFilter
         | 
| 5 5 | 
             
                def reading_time(input)
         | 
| 6 | 
            -
                   | 
| 7 | 
            -
                   | 
| 8 | 
            -
                   | 
| 9 | 
            -
                   | 
| 6 | 
            +
                  site = Jekyll.sites.first rescue nil
         | 
| 7 | 
            +
                  options_data = site&.data&.dig("options") rescue {}
         | 
| 8 | 
            +
                  words_per_minute = options_data&.dig("reading_time", "words_per_minute") || 180
         | 
| 9 | 
            +
                  message = options_data&.dig("reading_time", "message") || ["Read this post in", "Read this post in less than"]
         | 
| 10 | 
            +
                  minutes_text = options_data&.dig("reading_time", "minutes_label") || ["minute", "minutes"]
         | 
| 10 11 | 
             
                  words = input.split.size;
         | 
| 11 12 | 
             
                  minutes = ( words / words_per_minute ).floor
         | 
| 12 13 | 
             
                  minutes_label = minutes == 1 ? "#{minutes_text[0]}" : "#{minutes_text[1]}"
         | 
    
        data/lib/rawfeed/version.rb
    CHANGED