Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSS Виртуальная клавиатура #1

Open
wants to merge 11 commits into
base: Review
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": [
"stylelint-config-standard",
"stylelint-config-recess-order"
],
"rules": {
"declaration-no-important": true,
"color-hex-length": "short"
}
}
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@ https://tensegrity666.github.io/virtualKeyboard/

## Virtual Keyboard

It has full functionality when typing with the mouse in English and Russian,
__Much attention is paid to UX,
the project is made in the [neomorphic style](https://dribbble.com/tags/neumorphism)__

partially duplicates the functionality of a physical keyboard.



_English and Russian supports,_
_partially duplicates the functionality of a physical keyboard._

______________________________________________________________________________________________________

Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=0.8, user-scalable=yes">
<link rel="stylesheet" href="styles/main.css">
<link href="https://fonts.googleapis.com/css2?family=Sen&display=swap"
rel="stylesheet">
Expand Down
2 changes: 2 additions & 0 deletions js/Helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ export const keyShiftLayoutRussian = [
'Shift', 'я', 'ч', 'с', 'м', 'и', 'т', 'ь', 'б', 'ю', ',', 'Shift',
'Ctrl', 'Alt', 'Space', 'Alt', 'Ctrl',
];

export const functionalKeys = ['Escape', 'F1', 'F2', 'F3', 'F4', 'F6', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12', 'Insert', 'Home', 'PageUp', 'PageDown', 'End', 'Delete', 'NumLock'];
21 changes: 11 additions & 10 deletions js/InputTextKeyboard.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { keyLayoutDefault, keyLayoutRussian } from './Helper.js';
import { keyLayoutDefault, keyShiftLayoutRussian } from './Helper.js';
import { textBuffer } from './InputTextMouse.js';
import toggleCase from './ToggleCase.js';
import textRender from './TextRender.js';
Expand Down Expand Up @@ -53,12 +53,6 @@ export default function inputTextKeyboard() {
textfield.innerHTML = localStorage.text;
break;

case 'Alt':
break;

case 'Control':
break;

case 'ArrowRight':
textBuffer.push('➡');
textRender(textBuffer, textfield);
Expand All @@ -79,24 +73,30 @@ export default function inputTextKeyboard() {
textRender(textBuffer, textfield);
break;

case 'Meta':
case 'Control':
if (localStorage.language === 'en') {
localStorage.language = 'rus';
} else {
localStorage.language = 'en';
}
window.location.reload();
location.reload();
break;

case 'F5':
break;

case 'Escape':
break;

case 'Alt':
break;

default:
if (localStorage.language === 'rus') {
keyLayoutDefault.forEach((element) => {
if (element === event.key.toLowerCase()) {
const index = keyLayoutDefault.indexOf(element);
textBuffer.push(keyLayoutRussian[index]);
textBuffer.push(keyShiftLayoutRussian[index]);
buttons[index].classList.add('keyboard__key_press');
}
});
Expand All @@ -106,6 +106,7 @@ export default function inputTextKeyboard() {
} else {
textBuffer.push(event.key);
}

textRender(textBuffer, textfield);
break;
}
Expand Down
8 changes: 4 additions & 4 deletions js/Keyboard.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { keyLayoutDefault, keyLayoutRussian } from './Helper.js';
import { keyLayoutDefault, keyShiftLayoutRussian } from './Helper.js';

let language = [];

if (localStorage.language === 'rus') {
language = keyLayoutRussian;
language = keyShiftLayoutRussian;
} else {
language = keyLayoutDefault;
}
Expand Down Expand Up @@ -93,8 +93,8 @@ export default function keyboardInit() {
const tips = document.createElement('div');
wrapper.append(tips);
tips.classList.add('tips');
tips.innerText = `Use Shift+Ctrl+Alt to switch input language
Press F5 on your keyboard to clear input area`;
tips.innerText = `Use Ctrl to switch input language
Press F5 on your keyboard to clear input area`;

container.append(createFragment());
}
Loading