kioskboard
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -33,7 +33,7 @@ [ | ||
"5": "N", | ||
"6": "�", | ||
"7": "�", | ||
"8": "�", | ||
"9": "�" | ||
"6": "É", | ||
"7": "È", | ||
"8": "Ç", | ||
"9": "À" | ||
} | ||
] |
@@ -13,3 +13,3 @@ [ | ||
"9": "P", | ||
"10": "�" | ||
"10": "Ü" | ||
}, | ||
@@ -26,4 +26,4 @@ { | ||
"8": "L", | ||
"9": "�", | ||
"10": "�" | ||
"9": "Ö", | ||
"10": "Ä" | ||
}, | ||
@@ -30,0 +30,0 @@ { |
@@ -24,3 +24,3 @@ [ | ||
"8": "L", | ||
"9": "�" | ||
"9": "Ñ" | ||
}, | ||
@@ -27,0 +27,0 @@ { |
/*! | ||
* KioskBoard - Virtual Keyboard ('https://github.com/furcan/KioskBoard') | ||
* Version: 2.1.0 | ||
* Version: 2.2.0 | ||
* Description: TypeScript Declaration. | ||
@@ -5,0 +5,0 @@ * Author: Furkan MT ('https://github.com/furcan') |
{ | ||
"name": "kioskboard", | ||
"main": "dist/kioskboard-aio-2.1.0.min.js", | ||
"main": "dist/kioskboard-aio-2.2.0.min.js", | ||
"types": "index.d.ts", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "A pure JavaScript library for using virtual keyboards.", | ||
@@ -7,0 +7,0 @@ "homepage": "https://github.com/furcan/KioskBoard", |
@@ -25,3 +25,3 @@ <p align="center"> | ||
## Current Version | ||
2.1.0 [*](https://github.com/furcan/KioskBoard/blob/main/CHANGELOG.md) | ||
2.2.0 [*](https://github.com/furcan/KioskBoard/blob/main/CHANGELOG.md) | ||
@@ -63,5 +63,5 @@ --------- | ||
```html | ||
<link rel="stylesheet" href="dist/kioskboard-2.1.0.min.css" /> | ||
<link rel="stylesheet" href="dist/kioskboard-2.2.0.min.css" /> | ||
<script src="dist/kioskboard-2.1.0.min.js"></script> | ||
<script src="dist/kioskboard-2.2.0.min.js"></script> | ||
``` | ||
@@ -72,3 +72,3 @@ | ||
```html | ||
<script src="dist/kioskboard-aio-2.1.0.min.js"></script> | ||
<script src="dist/kioskboard-aio-2.2.0.min.js"></script> | ||
``` | ||
@@ -75,0 +75,0 @@ |
/*! | ||
* KioskBoard - Virtual Keyboard ('https://github.com/furcan/KioskBoard') | ||
* Version: 2.1.0 | ||
* Version: 2.2.0 | ||
* Author: Furkan MT ('https://github.com/furcan') | ||
@@ -574,2 +574,19 @@ * Copyright 2022 KioskBoard - Virtual Keyboard, MIT Licence ('https://opensource.org/licenses/MIT')* | ||
// keys event listeners: begin | ||
var keysEventListeners = function (keyElement, onClickHandler) { | ||
if (keyElement) { | ||
var isTouchableDevice = 'ontouchend' in window || window.navigator.maxTouchPoints > 0; | ||
if (isTouchableDevice) { | ||
keyElement.addEventListener('contextmenu', function (event) { | ||
event.preventDefault(); | ||
}, false); | ||
keyElement.addEventListener('touchend', onClickHandler); | ||
} | ||
keyElement.addEventListener('click', onClickHandler); | ||
} | ||
}; | ||
// keys event listeners: end | ||
// keys click listeners: begin | ||
@@ -582,3 +599,3 @@ var keysClickListeners = function (input) { | ||
var keyElm = eachKeyElm[ekIndex]; | ||
keyElm.addEventListener('click', function (e) { | ||
keysEventListeners(keyElm, function (e) { | ||
e.preventDefault(); | ||
@@ -625,3 +642,3 @@ | ||
} | ||
}, false); | ||
}); | ||
} | ||
@@ -634,3 +651,3 @@ } | ||
if (capsLockKeyElm) { | ||
capsLockKeyElm.addEventListener('click', function (e) { | ||
keysEventListeners(capsLockKeyElm, function (e) { | ||
e.preventDefault(); | ||
@@ -651,3 +668,3 @@ // focus the input | ||
} | ||
}, false); | ||
}); | ||
} | ||
@@ -659,3 +676,3 @@ // capslock key click listener: end | ||
if (backspaceKeyElm) { | ||
backspaceKeyElm.addEventListener('click', function (e) { | ||
keysEventListeners(backspaceKeyElm, function (e) { | ||
e.preventDefault(); | ||
@@ -683,3 +700,3 @@ | ||
}, false); | ||
}); | ||
} | ||
@@ -693,3 +710,3 @@ // backspace key click listener: end | ||
if (specialCharacterKeyElm && specialCharactersRowElm) { | ||
specialCharacterKeyElm.addEventListener('click', function (e) { | ||
keysEventListeners(specialCharacterKeyElm, function (e) { | ||
e.preventDefault(); | ||
@@ -704,3 +721,3 @@ input.focus(); // focus the input | ||
} | ||
}, false); | ||
}); | ||
} | ||
@@ -710,3 +727,3 @@ // close | ||
if (specialCharCloseElm && specialCharacterKeyElm && specialCharactersRowElm) { | ||
specialCharCloseElm.addEventListener('click', function (e) { | ||
keysEventListeners(specialCharCloseElm, function (e) { | ||
e.preventDefault(); | ||
@@ -716,3 +733,3 @@ input.focus(); // focus the input | ||
specialCharactersRowElm.classList.remove('kioskboard-specialcharacter-show'); | ||
}, false); | ||
}); | ||
} | ||
@@ -750,3 +767,3 @@ // specialcharacter key click listener: end | ||
var theInputOffsetTop = Math.round(inputTop + docTop) - inputThreshold; | ||
var isPaddingTop = theInputOffsetTop < keyboardHeight; | ||
var isPaddingTop = (theInputOffsetTop < keyboardHeight) && isPlacementTop; | ||
var isPaddingBottom = documentHeight <= (theInputOffsetTop + keyboardHeight); | ||
@@ -774,7 +791,16 @@ | ||
var scrollDelay = opt.cssAnimations === true && typeof opt.cssAnimationsDuration === 'number' ? opt.cssAnimationsDuration : 0; | ||
var userAgent = navigator.userAgent.toLocaleLowerCase('en'); | ||
var scrollTop = theInputOffsetTop - (isPlacementTop ? keyboardHeight : 0); | ||
if (userAgent.indexOf('edge') < 0 && userAgent.indexOf('.net4') < 0) { | ||
var userAgent = window.navigator.userAgent.toLocaleLowerCase('en'); | ||
var isBrowserInternetExplorer = userAgent.indexOf('.net4') > -1; | ||
var isBrowserEdgeLegacy = userAgent.indexOf('edge') > -1; | ||
var isBrowserEdgeWebView = isBrowserEdgeLegacy && userAgent.indexOf('webview') > -1; | ||
if ((!isBrowserEdgeLegacy || isBrowserEdgeWebView) && !isBrowserInternetExplorer) { | ||
var scrollTimeout = setTimeout(function () { | ||
window.scrollTo({ top: scrollTop, left: 0, behavior: scrollBehavior }); | ||
if (isBrowserEdgeWebView) { | ||
window.scrollBy(0, theInputOffsetTop); | ||
} else { | ||
window.scrollTo({ top: scrollTop, left: 0, behavior: scrollBehavior }); | ||
} | ||
clearTimeout(scrollTimeout); | ||
@@ -850,10 +876,2 @@ }, scrollDelay); | ||
var getKeysViaXmlHttpRequest = function (jsonUrl, input) { | ||
// check the protocol | ||
var protocolSchemes = ['http:', 'data:', 'chrome:', 'chrome-extension:', 'https:']; | ||
var protocol = (window.location || {}).protocol; | ||
if (protocolSchemes.indexOf(protocol) <= -1) { | ||
kioskBoardConsoleError('The Browser has blocked this request by CORS policy.'); | ||
return false; | ||
} | ||
// if "kioskBoardCachedKeys" is undefined || null => send XMLHttpRequest | ||
@@ -860,0 +878,0 @@ if (!kioskBoardCachedKeys) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
231838
2973