jekyll-hover-popup 0.2.0 → 0.3.0
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 +14 -11
- data/assets/jekyll-hover-popup/hover_popup.js +1 -1
- data/lib/jekyll/hover_popup/hooks.rb +2 -2
- data/lib/jekyll/hover_popup/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: cdae0cb64015858986ffe6c6dc11d44947b4e172dee08bccd68d191230416b26
|
|
4
|
+
data.tar.gz: af148150f8a1890b082adbccc2c4665a56dacbad3eea581608dd02c0cbee8f36
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a3192b0edd3563b6b267740ca86eff70b040b269d30aff9005366902be46d6f11026644757ea3f010296aa610f91f4969426e82c0bb1860ed473b7ed0cd07f44
|
|
7
|
+
data.tar.gz: 203ad982a1a4dd62680ee9798179a224835fca23322b2744e1239d09dfcce0ac8a63e63e574f90a58acf893a43cd69204015160ba37d229b2d5d1a9f40076d30
|
data/README.md
CHANGED
|
@@ -6,14 +6,15 @@ Inspired by the hover window behavior in [5etools](https://github.com/5etools/5e
|
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- Hover an internal link to
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
|
|
9
|
+
- Hover over an internal link to see a reference preview
|
|
10
|
+
- Persist windows by holding the SHIFT key
|
|
11
|
+
- Close all windows by holding CTRL while closing one
|
|
12
|
+
- Minimize windows by double clicking the title bar
|
|
13
|
+
- Navigate to an entry later by clicking the link in the title bar
|
|
14
|
+
- Eight point window resize
|
|
15
|
+
- Exposes `window.JekyllHoverPopup` for other plugins
|
|
16
|
+
|
|
17
|
+
<img width="640" height="360" alt="window-preview-demo-2" src="https://github.com/user-attachments/assets/1f8f60ad-ad2a-4418-ad0f-0494f4e43faf" />
|
|
17
18
|
|
|
18
19
|
## Install
|
|
19
20
|
|
|
@@ -41,10 +42,12 @@ hover_popup:
|
|
|
41
42
|
enabled: true
|
|
42
43
|
assets_path: /assets/jekyll-hover-popup
|
|
43
44
|
hover_delay_ms: 0
|
|
44
|
-
nav_hover_preview:
|
|
45
|
+
nav_hover_preview: false
|
|
45
46
|
```
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
Add a `hover_delay_ms` to delay the preview window creation
|
|
49
|
+
|
|
50
|
+
Set `nav_hover_preview: true` to enable hover previews for links inside navigation elements (`.site-nav`, `nav`, `[role="navigation"]`, etc.).
|
|
48
51
|
|
|
49
52
|
## JavaScript API
|
|
50
53
|
|
|
@@ -72,4 +75,4 @@ window.JekyllHoverPopup.openContent({
|
|
|
72
75
|
|
|
73
76
|
## License
|
|
74
77
|
|
|
75
|
-
MIT
|
|
78
|
+
[MIT](LICENSE)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
const config = window.__JHP_CONFIG__ || {};
|
|
5
5
|
const HOVER_DELAY_MS = Number(config.hoverDelayMs) || 0;
|
|
6
|
-
const NAV_HOVER_PREVIEW = config.navHoverPreview
|
|
6
|
+
const NAV_HOVER_PREVIEW = config.navHoverPreview === true;
|
|
7
7
|
const TRANSIENT_TITLE_HINT = "SHIFT to persist";
|
|
8
8
|
const MAX_VIEWPORT_WIDTH = 0.92;
|
|
9
9
|
const MAX_VIEWPORT_HEIGHT = 0.92;
|
|
@@ -11,7 +11,7 @@ module Jekyll
|
|
|
11
11
|
assets_path = cfg["assets_path"] || "/assets/jekyll-hover-popup"
|
|
12
12
|
assets_path = "/#{assets_path}" unless assets_path.start_with?("/")
|
|
13
13
|
hover_delay_ms = cfg["hover_delay_ms"] || 0
|
|
14
|
-
nav_hover_preview = cfg.fetch("nav_hover_preview",
|
|
14
|
+
nav_hover_preview = cfg.fetch("nav_hover_preview", false)
|
|
15
15
|
|
|
16
16
|
begin
|
|
17
17
|
doc.output = inject_assets(doc.output.to_s, assets_path: assets_path, hover_delay_ms: hover_delay_ms, nav_hover_preview: nav_hover_preview)
|
|
@@ -21,7 +21,7 @@ module Jekyll
|
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
def self.inject_assets(html, assets_path:, hover_delay_ms:, nav_hover_preview:
|
|
24
|
+
def self.inject_assets(html, assets_path:, hover_delay_ms:, nav_hover_preview: false)
|
|
25
25
|
return html if html.include?('data-hover-popup-root="true"')
|
|
26
26
|
|
|
27
27
|
tags = <<~HTML
|