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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ce48f07e15a628115569f19b3664e5bbe3c0ce9dcfbae3bede8612acc1298ad
4
- data.tar.gz: 69d36262eace558f29c037d31bf46046ac8bc7cc4bae732a00653db0a83b79e0
3
+ metadata.gz: 8511f7129df556936ff6d30d8603ae79a2a83cdcb2be2482fe325cf67efc875f
4
+ data.tar.gz: 4bfec0dee20997adc15158230a331ac79a1626ae59c367df03455bc74710d306
5
5
  SHA512:
6
- metadata.gz: 07134d1761dbd2a2c48a9a2413708c8630abe68d3e193843823fb7a5f55fd604b1acaf28621e27ce3fb06a09de3c76b5e7eb0d83279f7219c80b33b940836a4c
7
- data.tar.gz: c15d9e442c1bbbd108901895d823527718beb4249ef8b0c3281c67d0d5718027c3cda77c6a6814df9c46a763ff2305bdcf530dcb6b0fa6fc7e070087ef5b0c40
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
@@ -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
 
@@ -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
- <script src="{{ '/assets/js/home.js' | relative_url }}"></script>
43
- <script src="{{ '/assets/vendor/simple-jekyll-search.min.js' | relative_url }}"></script>
44
- <script src="{{ '/assets/js/blog.js' | relative_url }}"></script>
45
- <script src="{{ '/assets/js/page.js' | relative_url }}"></script>
46
- <script src="{{ '/assets/js/contact.js' | relative_url }}"></script>
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
Binary file
@@ -5,112 +5,113 @@
5
5
 
6
6
  document.addEventListener("DOMContentLoaded", () => {
7
7
  const form = document.getElementById("contactForm");
8
- const submitButton = document.getElementById("submitButton");
9
- const endpoint = "{{ head_.google.apps_script.url }}"; // URL Google Apps Script
10
-
11
- // get modal
12
- function showModal(title, message, type = 'success') {
13
- const modalEl = document.getElementById('contactMessageModal');
14
- const modalTitle = modalEl.querySelector('.modal-title');
15
- const modalBody = modalEl.querySelector('.modal-body');
16
- const modalContent = modalEl.querySelector('.modal-content');
17
-
18
- modalContent.classList.remove('contact-message-success', 'contact-message-error', 'contact-message-warning');
19
-
20
-
21
- // Apply the color according to the type
22
- if (type === 'success') {
23
- modalContent.classList.add('contact-message-success');
24
- } else if (type === 'error') {
25
- modalContent.classList.add('contact-message-error');
26
- } else if (type === 'warning') {
27
- modalContent.classList.add('contact-message-warning');
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
- form.addEventListener("submit", async (e) => {
38
- e.preventDefault();
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
- const textarea = document.getElementById('textMessage');
51
- const text = textarea.value.trim();
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
- submitButton.disabled = true;
62
- submitButton.textContent = "{{ contact_.message.status | default: 'Sending...Wait' }}";
38
+ form.addEventListener("submit", async (e) => {
39
+ e.preventDefault();
63
40
 
64
- const formData = new FormData(form);
65
- const data = Object.fromEntries(formData.entries());
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_.message.success.title | default: 'Message Sent' }}",
81
- "{{ contact_.message.success.content | default: 'Your message has been sent successfully!' }}",
82
- "success"
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
- } else {
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.error.title | default: 'Error' }}",
87
- "{{ contact_.message.error.content | default: 'Something went wrong while sending your message.' }}",
88
- "error"
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
- throw new Error(result.message || "{{ contact_.message.error.content | default: 'An unknown error has occurred.' }}");
59
+ return;
91
60
  }
92
61
 
93
- } catch (error) {
94
- console.error("Error sending:", error);
95
- if (error.message.includes("reCAPTCHA")) {
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.error.title | default: 'Error' }}",
98
- "{{ contact_.recaptcha.fail | default: 'Verification failed. Please reload the page and try again.' }}",
99
- "error"
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
- } else {
85
+ } else {
102
86
  showModal(
103
87
  "{{ contact_.message.error.title | default: 'Error' }}",
104
- "{{ contact_.recaptcha.error | default: 'An error occurred while sending the message. Please try again.' }}",
88
+ "{{ contact_.message.error.content | default: 'Something went wrong while sending your message.' }}",
105
89
  "error"
106
90
  );
107
- }
108
- grecaptcha.reset();
109
-
110
- } finally {
111
- submitButton.disabled = false;
112
- submitButton.textContent = "{{ contact_.button.text | default: 'Send!' }}";
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
  });
@@ -3,10 +3,11 @@ require "jekyll"
3
3
  module Rawfeed
4
4
  module ReadingTimeFilter
5
5
  def reading_time(input)
6
- site_config = Jekyll.sites.first.config rescue {}
7
- words_per_minute = site_config&.dig("reading_time", "words_per_minute") || 180
8
- message = site_config&.dig("reading_time", "message") || ["Read this post in", "Read this post in less than"]
9
- minutes_text = site_config&.dig("reading_time", "minutes_label") || ["minute", "minutes"]
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]}"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rawfeed
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.4"
5
5
  end
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.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - William C. Canin