GalaxyTe commited on
Commit
e9fa023
·
verified ·
1 Parent(s): 4742168

undefined - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +144 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Unicode
3
- emoji: 👀
4
- colorFrom: gray
5
- colorTo: pink
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: unicode
3
+ emoji: 🐳
4
+ colorFrom: blue
5
+ colorTo: green
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,144 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="ru">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Конвертер Юникода в символ</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <style>
9
+ @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap');
10
+ body {
11
+ font-family: 'Roboto', sans-serif;
12
+ }
13
+ .glow {
14
+ text-shadow: 0 0 10px rgba(59, 130, 246, 0.7);
15
+ }
16
+ </style>
17
+ </head>
18
+ <body class="bg-gray-100 min-h-screen flex items-center justify-center p-4">
19
+ <div class="bg-white rounded-xl shadow-lg p-6 w-full max-w-md">
20
+ <h1 class="text-2xl font-bold text-center text-blue-600 mb-6">Конвертер Юникода в символ</h1>
21
+
22
+ <div class="space-y-4">
23
+ <div>
24
+ <label for="unicode-input" class="block text-sm font-medium text-gray-700 mb-1">Код Юникода (например: U+0410)</label>
25
+ <div class="relative">
26
+ <div class="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
27
+ <span class="text-gray-500">U+</span>
28
+ </div>
29
+ <input
30
+ type="text"
31
+ id="unicode-input"
32
+ class="bg-gray-50 border border-gray-300 text-gray-900 text-lg rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full pl-10 p-3"
33
+ placeholder="0410"
34
+ maxlength="6"
35
+ autocomplete="off"
36
+ autocapitalize="off"
37
+ spellcheck="false"
38
+ >
39
+ </div>
40
+ </div>
41
+
42
+ <div class="flex justify-center">
43
+ <button id="convert-btn" class="px-6 py-2 bg-blue-600 text-white font-medium rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50 transition-colors">
44
+ Конвертировать
45
+ </button>
46
+ </div>
47
+
48
+ <div class="mt-6">
49
+ <p class="text-sm text-gray-500 mb-2">Результат:</p>
50
+ <div id="result-container" class="border-2 border-dashed border-gray-200 rounded-lg p-6 flex flex-col items-center justify-center min-h-32">
51
+ <div id="symbol-display" class="text-7xl glow text-blue-600 mb-2"></div>
52
+ <div id="code-info" class="text-sm text-gray-500"></div>
53
+ </div>
54
+ </div>
55
+
56
+ <div class="mt-4 text-xs text-gray-400">
57
+ <p>Введите код в формате U+XXXX (например U+0410 для 'А' или U+1F600 для '😀')</p>
58
+ </div>
59
+ </div>
60
+ </div>
61
+
62
+ <script>
63
+ document.addEventListener('DOMContentLoaded', function() {
64
+ const unicodeInput = document.getElementById('unicode-input');
65
+ const convertBtn = document.getElementById('convert-btn');
66
+ const symbolDisplay = document.getElementById('symbol-display');
67
+ const codeInfo = document.getElementById('code-info');
68
+
69
+ // Конвертация при клике на кнопку
70
+ convertBtn.addEventListener('click', convertUnicode);
71
+
72
+ // Конвертация при нажатии Enter
73
+ unicodeInput.addEventListener('keypress', function(e) {
74
+ if (e.key === 'Enter') {
75
+ convertUnicode();
76
+ }
77
+ });
78
+
79
+ // Автоматическая конвертация при изменении значения
80
+ unicodeInput.addEventListener('input', function() {
81
+ // Фильтруем ввод - только шестнадцатеричные цифры
82
+ this.value = this.value.replace(/[^0-9a-fA-F]/g, '');
83
+
84
+ // Если введено 4 символа - автоматически конвертируем
85
+ if (this.value.length === 4) {
86
+ convertUnicode();
87
+ }
88
+ });
89
+
90
+ function convertUnicode() {
91
+ const hexCode = unicodeInput.value.trim();
92
+
93
+ if (!hexCode) {
94
+ showError('Введите код Юникода');
95
+ return;
96
+ }
97
+
98
+ try {
99
+ const codePoint = parseInt(hexCode, 16);
100
+
101
+ if (isNaN(codePoint)) {
102
+ showError('Некорректный код Юникода');
103
+ return;
104
+ }
105
+
106
+ // Проверяем валидность кодовой точки
107
+ if (codePoint < 0 || codePoint > 0x10FFFF) {
108
+ showError('Код вне диапазона Юникода (0-10FFFF)');
109
+ return;
110
+ }
111
+
112
+ const char = String.fromCodePoint(codePoint);
113
+
114
+ // Показываем результат
115
+ symbolDisplay.textContent = char;
116
+ codeInfo.textContent = `U+${hexCode.toUpperCase()} (${codePoint})`;
117
+
118
+ // Подсветка при успешной конвертации
119
+ symbolDisplay.classList.add('glow');
120
+ symbolDisplay.classList.remove('text-red-500');
121
+ symbolDisplay.classList.add('text-blue-600');
122
+
123
+ } catch (e) {
124
+ showError('Ошибка конвертации');
125
+ }
126
+ }
127
+
128
+ function showError(message) {
129
+ symbolDisplay.textContent = '❌';
130
+ codeInfo.textContent = message;
131
+
132
+ // Подсветка ошибки
133
+ symbolDisplay.classList.remove('glow');
134
+ symbolDisplay.classList.remove('text-blue-600');
135
+ symbolDisplay.classList.add('text-red-500');
136
+ }
137
+
138
+ // Пример при загрузке
139
+ unicodeInput.value = '0410';
140
+ convertUnicode();
141
+ });
142
+ </script>
143
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=GalaxyTe/unicode" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
144
+ </html>