@xiee/utils
Advanced tools
Comparing version 1.2.7 to 1.2.8
(function(d) { | ||
const a1 = ['Enter', 'Up', 'Down', 'Left', 'Right']; | ||
const a2 = ['↵', '↑', '↓', '←', '→']; | ||
function drawArrows(x) { | ||
a1.map((v, i) => x = x.replace(new RegExp('>' + v + '<', 'g'), ' title="' + v + (i ? ' Arrow' : '') + '">' + a2[i] + '<')); | ||
return x; | ||
} | ||
// 1. individual keys; 2. modifiers; 3. normal keys | ||
const k1 = 'Esc|Tab|Enter|PageUp|PageDown|Up|Down|Left|Right|' + | ||
Array(12).fill().map((v, i) => 'F' + (i + 1)).join('|'), | ||
const k1 = 'Esc|Tab|PageUp|PageDown|Space|Delete|Home|End|PrtScr?|PrintScreen|' + | ||
Array(12).fill().map((v, i) => 'F' + (i + 1)).concat(a1).join('|'), | ||
k2 = 'Ctrl|Control|Shift|Alt|Cmd|Command|fn', | ||
@@ -14,3 +20,3 @@ k3 = '[a-zA-Z0-9]|Click', | ||
if (r1.test(t)) { | ||
el.outerHTML = '<kbd>' + t + '</kbd>'; | ||
el.outerHTML = drawArrows('<kbd>' + t + '</kbd>'); | ||
return; | ||
@@ -24,4 +30,4 @@ } | ||
} | ||
if (t === '') el.outerHTML = t2.replace(/ \+ $/, ''); | ||
if (t === '') el.outerHTML = drawArrows(t2.replace(/ \+ $/, '')); | ||
}); | ||
})(document); |
{ | ||
"name": "@xiee/utils", | ||
"version": "1.2.7", | ||
"version": "1.2.8", | ||
"description": "Miscellaneous tools and utilities to manipulate HTML pages", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24390
529