jekyll-theme-noesya 1.0.4 → 1.0.9

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: 5a951d60ab7a1ee5e07eb4fcec0dd84f2d84379564af6f6e05fe87128dd2b1f0
4
- data.tar.gz: cfe1a6842b4b3e5e1181fec46f685d9efb477998bc6aaa2cbafe9f9d0c930bbf
3
+ metadata.gz: 5a6f5da04095b68658ec1c2cf6d025cd95ff5698615c84ea32f0d5d1fc3b5d5e
4
+ data.tar.gz: fe9b7d0906f741550f22d9eb30f5f11e3294668be8c0e80805f73711de861847
5
5
  SHA512:
6
- metadata.gz: 6fac1cd333f87d5325209e653671fe058304700810ce7bea1712aca8fd5cb34e4cdddfe3ee9b0225ee92e6dbc8788cfe9a54d94410ac6b2876351254464a5d12
7
- data.tar.gz: 755da8ddccd4d7f890a970e05dc913b7a805ef134a305b4da6fda4bf828dee957fcb9b8a28d81ca63082a1b15eecbbf82f0c7898d62fc3f3a2733f6fe055365b
6
+ metadata.gz: 4a59f6791c00e7fb96726a16168a95573da534b54b73fe0f9b7b68b5e0d23228b11c5e4e33c7378e8a363fa610f8dfe429593213d52104493be91f1ff36a78a3
7
+ data.tar.gz: d0ba57283b53dbb892388c53d2c6e889aa42c029c97ba8a9574be3c5ca6e4d92f999f464f4244486251ac45953e9b9835d3201bf09148eec46cb14485f7c83f9
@@ -0,0 +1,32 @@
1
+ window.hoverLinks = {
2
+ timeout: null,
3
+ init: function () {
4
+ 'use strict';
5
+ var i = 0,
6
+ links = document.querySelectorAll('[data-link-delay]');
7
+
8
+ for (i = 0; i < links.length; i += 1) {
9
+ this.bind(links[i]);
10
+ }
11
+ },
12
+ bind: function (link) {
13
+ 'use strict';
14
+ var a = link.querySelector('a'),
15
+ delay = link.getAttribute('data-link-delay');
16
+
17
+ link.addEventListener('mouseenter', function () {
18
+ this.timeout = setTimeout(this.click.bind(this, a), delay * 1000);
19
+ }.bind(this));
20
+
21
+ link.addEventListener('mouseleave', function () {
22
+ clearTimeout(this.timeout);
23
+ }.bind(this));
24
+ },
25
+ click: function (element) {
26
+ 'use strict';
27
+ var event = new MouseEvent('click');
28
+ element.dispatchEvent(event);
29
+ }
30
+ };
31
+
32
+ window.hoverLinks.init();
File without changes
@@ -0,0 +1,188 @@
1
+ window.notes = window.notes || {};
2
+ window.notes.Item = window.notes.Item || {};
3
+ window.notes.manager = window.notes.manager || {};
4
+
5
+ window.notes.Item = function (dom, previous) {
6
+ 'use strict';
7
+ this.dom = dom;
8
+ this.parent = dom.parentNode;
9
+ this.y = 0;
10
+ this.previous = previous || null;
11
+ this.anchor = document.querySelector('a[href="#' + dom.id + '"]');
12
+ this.isVisible = false;
13
+ this.verticalOffset = 6;
14
+ setTimeout(function () {
15
+ this.dom.classList.add('is-handled');
16
+ }.bind(this), 1);
17
+ this.replace();
18
+ this.ready();
19
+ };
20
+ window.notes.Item.prototype.ready = function () {
21
+ 'use strict';
22
+ this.anchor.addEventListener('mouseenter', function () {
23
+ this.dom.classList.add('is-hovered');
24
+ }.bind(this));
25
+ this.anchor.addEventListener('mouseleave', function () {
26
+ this.dom.classList.remove('is-hovered');
27
+ }.bind(this));
28
+ };
29
+
30
+ window.notes.Item.prototype.replace = function () {
31
+ 'use strict';
32
+
33
+ if (window.notes.manager.isFixed) {
34
+ this.dom.classList.add('is-fixed');
35
+ this.dom.style.top = '';
36
+ } else {
37
+ this.dom.classList.remove('is-fixed');
38
+ this.updatePosition();
39
+ }
40
+
41
+ this.updateVisibility();
42
+ };
43
+
44
+ window.notes.Item.prototype.updateVisibility = function () {
45
+ 'use strict';
46
+ var anchorTop = this.anchor.getBoundingClientRect().top,
47
+ offset = window.innerHeight * 0.5;
48
+
49
+ this.isVisible = anchorTop > 0 && anchorTop < offset;
50
+ };
51
+
52
+ window.notes.Item.prototype.updatePosition = function () {
53
+ 'use strict';
54
+ this.y = this.getTop(this.anchor) - this.getTop(this.parent);
55
+
56
+ if (this.previous) {
57
+ this.preventOverlap();
58
+ }
59
+
60
+ this.preventTitleOverlap();
61
+
62
+ this.y += this.verticalOffset;
63
+
64
+ this.dom.style.top = this.y + 'px';
65
+ };
66
+
67
+ window.notes.Item.prototype.preventOverlap = function () {
68
+ 'use strict';
69
+ var distance = this.previous.bottom() - this.y;
70
+ this.y = Math.max(this.y, this.y + distance);
71
+ };
72
+
73
+ window.notes.Item.prototype.preventTitleOverlap = function () {
74
+ 'use strict';
75
+ var titles = document.querySelectorAll('h2'),
76
+ i;
77
+
78
+ for (i = 0; i < titles.length; i += 1) {
79
+ this.testTitleOverlap(titles[i]);
80
+ }
81
+ };
82
+
83
+ window.notes.Item.prototype.testTitleOverlap = function (title) {
84
+ 'use strict';
85
+ var top = this.getTop(title) - this.getTop(this.parent),
86
+ safer = 10,
87
+ bottom = top + title.offsetHeight,
88
+ offset = Math.max(bottom - this.y, window.notes.manager.lineHeight);
89
+
90
+ if (this.y >= top - safer && this.y <= bottom + safer) {
91
+ this.y += offset;
92
+ }
93
+ };
94
+
95
+ window.notes.Item.prototype.getTop = function (element) {
96
+ 'use strict';
97
+ return element.getBoundingClientRect().top + window.scrollY;
98
+ };
99
+
100
+ window.notes.Item.prototype.bottom = function () {
101
+ 'use strict';
102
+ return this.y + this.dom.offsetHeight;
103
+ };
104
+
105
+ window.notes.manager = {
106
+ breakpoint: 768,
107
+ isFixed: false,
108
+ pool: [],
109
+ nearest: null,
110
+ lineHeight: 45,
111
+ init: function () {
112
+ 'use strict';
113
+ var i,
114
+ elements = document.querySelectorAll('.js-note');
115
+
116
+ if (elements.length === 0) {
117
+ return;
118
+ }
119
+
120
+ this.setMode();
121
+
122
+ for (i = 0; i < elements.length; i += 1) {
123
+ this.generate(elements[i], i);
124
+ }
125
+
126
+ this.resize();
127
+ this.listen();
128
+
129
+ setTimeout(this.resize.bind(this), 100);
130
+ },
131
+
132
+ generate: function (element, i) {
133
+ 'use strict';
134
+ var previous = this.pool[i - 1] || null;
135
+ this.pool.push(new window.notes.Item(element, previous));
136
+ },
137
+
138
+ listen: function () {
139
+ 'use strict';
140
+ window.addEventListener('scroll', this.scroll.bind(this));
141
+ window.addEventListener('resize', this.resize.bind(this));
142
+ window.addEventListener('load', this.resize.bind(this));
143
+ window.addEventListener('DOMContentLoaded', this.resize.bind(this));
144
+ },
145
+
146
+ resize: function () {
147
+ 'use strict';
148
+ this.lineHeight = getComputedStyle(document.querySelector('section > p')).lineHeight;
149
+ this.lineHeight = parseInt(this.lineHeight.replace('px', ''), 10);
150
+ this.setMode();
151
+ this.update();
152
+ },
153
+
154
+ setMode: function () {
155
+ 'use strict';
156
+ var isFixed = window.innerWidth < this.breakpoint;
157
+ this.isFixed = isFixed;
158
+ },
159
+
160
+ scroll: function () {
161
+ 'use strict';
162
+ var nearest = null,
163
+ i;
164
+
165
+ if (this.isFixed) {
166
+ this.update();
167
+ }
168
+
169
+ for (i = this.pool.length - 1; i >= 0; i -= 1) {
170
+ if (this.pool[i].isVisible && (!nearest || !this.isFixed)) {
171
+ nearest = this.pool[i];
172
+ nearest.dom.classList.add('is-visible');
173
+ } else {
174
+ this.pool[i].dom.classList.remove('is-visible');
175
+ }
176
+ }
177
+ },
178
+
179
+ update: function () {
180
+ 'use strict';
181
+ var i;
182
+ for (i = 0; i < this.pool.length; i += 1) {
183
+ this.pool[i].replace();
184
+ }
185
+ }
186
+ };
187
+
188
+ window.notes.manager.init();
@@ -0,0 +1,12 @@
1
+ (function () {
2
+ 'use strict';
3
+ var paragraphs = document.querySelectorAll('.js-p-index > p'),
4
+ i,
5
+ index;
6
+
7
+ for (i = 0; i < paragraphs.length; i += 1) {
8
+ index = document.createElement('small');
9
+ index.innerText = '§' + (i + 1);
10
+ paragraphs[i].prepend(index);
11
+ }
12
+ }());
@@ -0,0 +1,18 @@
1
+ {% if page.nav %}
2
+ <nav>
3
+ <ul>
4
+ <li data-link-delay="3">
5
+ <a href="{{page.nav.previous.url}}">
6
+ <span>{{page.nav.previous.title}}</span><br>
7
+ {{- page.nav.previous.text -}}
8
+ </a>
9
+ </li>
10
+ <li data-link-delay="3">
11
+ <a href="{{page.nav.next.url}}">
12
+ <span>{{page.nav.next.title}}</span><br>
13
+ {{- page.nav.next.text -}}
14
+ </a>
15
+ </li>
16
+ </ul>
17
+ </nav>
18
+ {% endif %}
@@ -0,0 +1,15 @@
1
+
2
+ {% capture index %}
3
+ {{ note_index }}.
4
+ {% endcapture %}
5
+
6
+ {% capture note_content %}
7
+ {{index}} Voir {% if note.url %}<a href="{{ note.url }}" target="_blank" rel="noreferrer">{% endif %}{{ note.title }}{% if note.url %}</a>{% endif %}
8
+ {% endcapture %}
9
+
10
+ <aside class="js-note" id="note-{{ note_index }}">
11
+ {% if note.image %}
12
+ {% picture note "{{ note.image }}" --img alt="{{ note.title }}" title="{{ note.title }}" loading="lazy" %}
13
+ {% endif %}
14
+ {{ note_content | markdownify | correct_punctuation }}
15
+ </aside>
@@ -0,0 +1,16 @@
1
+ <section {% if page.layout == "member" %} class="js-p-index" {% endif %}>
2
+ {% for section in page.sections %}
3
+ {% if section.title %}
4
+ <h2>{{section.title}}</h2>
5
+ {% endif %}
6
+ {{section.content | markdownify | correct_punctuation}}
7
+ {% endfor %}
8
+
9
+ {% assign note_index = 0 %}
10
+ {% for section in page.sections %}
11
+ {% for note in section.notes %}
12
+ {% assign note_index = note_index | plus: 1 %}
13
+ {% include note.html note=note index=note_index %}
14
+ {% endfor %}
15
+ {% endfor %}
16
+ </section>
@@ -20,6 +20,9 @@
20
20
  {{ content }}
21
21
  </main>
22
22
  {% include footer.html %}
23
- <script src="/assets/js/main.js" async defer></script>
23
+
24
+ {% unless site.options.no_js %}
25
+ <script src="/assets/js/main.js" async defer></script>
26
+ {% endunless %}
24
27
  </body>
25
28
  </html>
@@ -1,6 +1,9 @@
1
+ $icons: ("link-blank": "\e90a", "link": "\e90b", "download": "\e90c", "document": "\e90d", "ecologique-thin": "\e900", "economique-thin": "\e902", "ethique-thin": "\e904", "juridique-thin": "\e906", "strategique-thin": "\e908", "ecologique": "\e901", "economique": "\e903", "ethique": "\e905", "juridique": "\e907", "strategique": "\e909")
2
+
1
3
  @mixin icon
2
4
  -moz-osx-font-smoothing: grayscale
3
5
  -webkit-font-smoothing: antialiased
6
+ content: ''
4
7
  display: inline-block
5
8
  font-family: 'icons' !important
6
9
  font-style: normal
@@ -10,32 +13,8 @@
10
13
  speak: never
11
14
  text-transform: none
12
15
 
13
- .icon::before
14
- @include icon
15
-
16
- .icon-link-blank::before
17
- content: "\e900"
18
-
19
- .icon-link::before
20
- content: "\e901"
21
-
22
- .icon-download::before
23
- content: "\e902"
24
-
25
- .icon-document::before
26
- content: "\e903"
27
-
28
- .icon-strategique::before
29
- content: "\e904"
30
-
31
- .icon-ecologique::before
32
- content: "\e905"
33
-
34
- .icon-juridique::before
35
- content: "\e906"
36
-
37
- .icon-economique::before
38
- content: "\e907"
39
-
40
- .icon-ethique::before
41
- content: "\e908"
16
+ @each $name, $glyph in $icons
17
+ .icon--#{$name}
18
+ &::before
19
+ @include icon
20
+ content: $glyph
data/assets/js/main.js CHANGED
@@ -2,4 +2,20 @@
2
2
  layout:
3
3
  ---
4
4
 
5
- {% include js/menu.js %}
5
+ {%- if site.options.menu_burger -%}
6
+ {% include js/menu-burger.js %}
7
+ {%- endif -%}
8
+
9
+ {%- if site.options.notes -%}
10
+ {% include js/notes.js %}
11
+ {%- endif -%}
12
+
13
+ {%- if site.options.paragraphs_index -%}
14
+ {% include js/paragraphs-index.js %}
15
+ {%- endif -%}
16
+
17
+ {%- if site.options.hover_navigation_links -%}
18
+ {% include js/hover-navigation-links.js %}
19
+ {%- endif -%}
20
+
21
+
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-noesya
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sébastien Moulène
8
8
  - Arnaud Levy
9
+ - Alexis BENOIT
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2021-11-03 00:00:00.000000000 Z
13
+ date: 2021-11-04 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: jekyll
@@ -85,6 +86,7 @@ description:
85
86
  email:
86
87
  - sebousan@gmail.com
87
88
  - contact@arnaudlevy.com
89
+ - alexis.benoit@noesya.coop
88
90
  executables: []
89
91
  extensions: []
90
92
  extra_rdoc_files: []
@@ -93,11 +95,17 @@ files:
93
95
  - README.md
94
96
  - _includes/footer.html
95
97
  - _includes/header.html
96
- - _includes/js/menu.js
98
+ - _includes/js/hover-navigation-links.js
99
+ - _includes/js/menu-burger.js
100
+ - _includes/js/notes.js
101
+ - _includes/js/paragraphs-index.js
97
102
  - _includes/nav/contacts.html
98
103
  - _includes/nav/ecosystem.html
99
104
  - _includes/nav/legal.html
100
105
  - _includes/nav/primary.html
106
+ - _includes/navigation-between-pages.html
107
+ - _includes/note.html
108
+ - _includes/sections-with-notes.html
101
109
  - _includes/seo.html
102
110
  - _layouts/default.html
103
111
  - _layouts/page.html