jekyll-dice-tray 0.5.2 → 0.6.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2a26bfe4476cf5803127bbeedc4d880e33c99542f5d4b1c81b0e51a06d0ef181
|
|
4
|
+
data.tar.gz: 30a10792b7e94cf0323d54f60a14eb269cd35eed615e0796ab6c67b54debfb6b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 21124bf090c27e159ebdf5d1bdf547060edf559a46837cc573b4f2a11e5eb3d6905d720d4091d68a730e01f2b6da2b6f99db31ec0625967630d8aee8c6863e36
|
|
7
|
+
data.tar.gz: 0a3f664eb69e877948cbdd2a302509491b73bc81894233f9945bde69d710361f8de8cb96ece2133716e7f4398217272c1a7ab22666a9d0df3c3002107bb96a48
|
|
@@ -529,9 +529,34 @@
|
|
|
529
529
|
setTimeout(function () {
|
|
530
530
|
input && input.focus();
|
|
531
531
|
}, 0);
|
|
532
|
+
} else if (input && document.activeElement === input) {
|
|
533
|
+
input.blur();
|
|
532
534
|
}
|
|
533
535
|
}
|
|
534
536
|
|
|
537
|
+
function isOtherTextEntry(node) {
|
|
538
|
+
if (!node || node === input) return false;
|
|
539
|
+
var el = node.nodeType === 1 ? node : node.parentElement;
|
|
540
|
+
if (!el) return false;
|
|
541
|
+
if (el.closest && el.closest("#jekyll-dice-tray")) return false;
|
|
542
|
+
var tag = el.tagName;
|
|
543
|
+
if (tag === "TEXTAREA") return true;
|
|
544
|
+
if (tag === "INPUT") {
|
|
545
|
+
var type = (el.getAttribute("type") || "text").toLowerCase();
|
|
546
|
+
return (
|
|
547
|
+
type !== "button" &&
|
|
548
|
+
type !== "submit" &&
|
|
549
|
+
type !== "reset" &&
|
|
550
|
+
type !== "checkbox" &&
|
|
551
|
+
type !== "radio" &&
|
|
552
|
+
type !== "file" &&
|
|
553
|
+
type !== "color" &&
|
|
554
|
+
type !== "range"
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
return !!el.isContentEditable;
|
|
558
|
+
}
|
|
559
|
+
|
|
535
560
|
function renderHistory() {
|
|
536
561
|
log.innerHTML = "";
|
|
537
562
|
history.forEach(function (item) {
|
|
@@ -789,6 +814,15 @@
|
|
|
789
814
|
setExpanded(!expanded);
|
|
790
815
|
});
|
|
791
816
|
|
|
817
|
+
document.addEventListener("keydown", function (e) {
|
|
818
|
+
if (e.defaultPrevented || e.repeat || e.isComposing) return;
|
|
819
|
+
if (e.key !== "~" && e.key !== "`") return;
|
|
820
|
+
if (e.ctrlKey || e.metaKey || e.altKey) return;
|
|
821
|
+
if (isOtherTextEntry(e.target)) return;
|
|
822
|
+
e.preventDefault();
|
|
823
|
+
setExpanded(toggle.getAttribute("aria-expanded") !== "true");
|
|
824
|
+
});
|
|
825
|
+
|
|
792
826
|
input.addEventListener("keydown", function (e) {
|
|
793
827
|
if (e.key !== "Enter") return;
|
|
794
828
|
var v = input.value;
|
|
@@ -207,7 +207,7 @@ module Jekyll
|
|
|
207
207
|
tray = <<~HTML
|
|
208
208
|
<div id="jekyll-dice-tray" data-dice-tray-root="true" data-version="#{VERSION}" data-expanded="false" aria-live="polite">
|
|
209
209
|
<div class="jdt-header">
|
|
210
|
-
<button type="button" class="jdt-toggle" aria-expanded="false" title="Toggle dice tray">Dice</button>
|
|
210
|
+
<button type="button" class="jdt-toggle" aria-expanded="false" title="Toggle dice tray (~)">Dice</button>
|
|
211
211
|
</div>
|
|
212
212
|
<div class="jdt-body" hidden style="display:none">
|
|
213
213
|
<div class="jdt-clue">Type <code>1d20+5</code> or <code>/help</code>, then press Enter.</div>
|