Spaces:
Running
Running
Add 2 files
Browse files- README.md +7 -5
- index.html +193 -19
README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
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: specbook-generator
|
3 |
+
emoji: 🐳
|
4 |
+
colorFrom: pink
|
5 |
+
colorTo: blue
|
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,193 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Print Specifications Generator</title>
|
7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
+
<style>
|
9 |
+
.output-box {
|
10 |
+
min-height: 300px;
|
11 |
+
white-space: pre-wrap;
|
12 |
+
font-family: monospace;
|
13 |
+
}
|
14 |
+
.copy-btn {
|
15 |
+
transition: all 0.2s;
|
16 |
+
}
|
17 |
+
.copy-btn:hover {
|
18 |
+
transform: translateY(-2px);
|
19 |
+
}
|
20 |
+
.copy-btn:active {
|
21 |
+
transform: translateY(0);
|
22 |
+
}
|
23 |
+
</style>
|
24 |
+
</head>
|
25 |
+
<body class="bg-gray-50">
|
26 |
+
<div class="container mx-auto px-4 py-8 max-w-4xl">
|
27 |
+
<h1 class="text-3xl font-bold text-center mb-6 text-gray-800">Print Specifications Generator</h1>
|
28 |
+
|
29 |
+
<div class="bg-white rounded-lg shadow-md p-6 mb-8">
|
30 |
+
<div class="mb-4">
|
31 |
+
<label for="bookText" class="block text-sm font-medium text-gray-700 mb-2">Paste Book Text:</label>
|
32 |
+
<textarea id="bookText" rows="10" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500"></textarea>
|
33 |
+
</div>
|
34 |
+
|
35 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
|
36 |
+
<div>
|
37 |
+
<label for="printRun" class="block text-sm font-medium text-gray-700 mb-2">Print Run (copies):</label>
|
38 |
+
<input type="number" id="printRun" min="1" value="100" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
|
39 |
+
</div>
|
40 |
+
<div>
|
41 |
+
<label for="formatSize" class="block text-sm font-medium text-gray-700 mb-2">Format Size:</label>
|
42 |
+
<select id="formatSize" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
|
43 |
+
<option value="A5">A5 (148×210 mm)</option>
|
44 |
+
<option value="A4">A4 (210×297 mm)</option>
|
45 |
+
<option value="B5">B5 (176×250 mm)</option>
|
46 |
+
<option value="custom">Custom</option>
|
47 |
+
</select>
|
48 |
+
</div>
|
49 |
+
</div>
|
50 |
+
|
51 |
+
<div class="mb-4">
|
52 |
+
<label class="inline-flex items-center">
|
53 |
+
<input type="checkbox" id="hasImages" class="rounded border-gray-300 text-indigo-600 shadow-sm focus:border-indigo-300 focus:ring focus:ring-offset-0 focus:ring-indigo-200 focus:ring-opacity-50">
|
54 |
+
<span class="ml-2 text-sm text-gray-700">Contains images/illustrations</span>
|
55 |
+
</label>
|
56 |
+
</div>
|
57 |
+
|
58 |
+
<div class="flex justify-center">
|
59 |
+
<button id="generateBtn" class="px-6 py-3 bg-indigo-600 text-white font-medium rounded-md shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
|
60 |
+
Generate Print Specs
|
61 |
+
</button>
|
62 |
+
</div>
|
63 |
+
</div>
|
64 |
+
|
65 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
66 |
+
<div class="bg-white rounded-lg shadow-md p-6">
|
67 |
+
<div class="flex justify-between items-center mb-4">
|
68 |
+
<h2 class="text-xl font-semibold text-gray-800">Russian Version</h2>
|
69 |
+
<button onclick="copyToClipboard('russianOutput')" class="copy-btn px-3 py-1 bg-gray-100 text-gray-700 text-sm rounded hover:bg-gray-200">
|
70 |
+
Copy Text
|
71 |
+
</button>
|
72 |
+
</div>
|
73 |
+
<div id="russianOutput" class="output-box p-3 border border-gray-200 rounded bg-gray-50 text-gray-800 overflow-auto"></div>
|
74 |
+
</div>
|
75 |
+
|
76 |
+
<div class="bg-white rounded-lg shadow-md p-6">
|
77 |
+
<div class="flex justify-between items-center mb-4">
|
78 |
+
<h2 class="text-xl font-semibold text-gray-800">Chinese Version</h2>
|
79 |
+
<button onclick="copyToClipboard('chineseOutput')" class="copy-btn px-3 py-1 bg-gray-100 text-gray-700 text-sm rounded hover:bg-gray-200">
|
80 |
+
Copy Text
|
81 |
+
</button>
|
82 |
+
</div>
|
83 |
+
<div id="chineseOutput" class="output-box p-3 border border-gray-200 rounded bg-gray-50 text-gray-800 overflow-auto"></div>
|
84 |
+
</div>
|
85 |
+
</div>
|
86 |
+
</div>
|
87 |
+
|
88 |
+
<script>
|
89 |
+
document.getElementById('generateBtn').addEventListener('click', generatePrintSpecs);
|
90 |
+
|
91 |
+
function generatePrintSpecs() {
|
92 |
+
const bookText = document.getElementById('bookText').value;
|
93 |
+
const printRun = document.getElementById('printRun').value;
|
94 |
+
const formatSize = document.getElementById('formatSize').value;
|
95 |
+
const hasImages = document.getElementById('hasImages').checked;
|
96 |
+
|
97 |
+
if (!bookText.trim()) {
|
98 |
+
alert('Please paste the book text');
|
99 |
+
return;
|
100 |
+
}
|
101 |
+
|
102 |
+
// Calculate word count and pages
|
103 |
+
const wordCount = bookText.trim().split(/\s+/).length;
|
104 |
+
let wordsPerPage;
|
105 |
+
|
106 |
+
switch(formatSize) {
|
107 |
+
case 'A5': wordsPerPage = 280; break;
|
108 |
+
case 'A4': wordsPerPage = 500; break;
|
109 |
+
case 'B5': wordsPerPage = 350; break;
|
110 |
+
default: wordsPerPage = 280;
|
111 |
+
}
|
112 |
+
|
113 |
+
const pageCount = Math.ceil(wordCount / wordsPerPage);
|
114 |
+
|
115 |
+
// Determine binding method
|
116 |
+
let bindingMethod;
|
117 |
+
if (pageCount <= 48) {
|
118 |
+
bindingMethod = 'скрепка (степлер)';
|
119 |
+
} else if (pageCount <= 96) {
|
120 |
+
bindingMethod = 'клеевое бесшвейное скрепление (КБС)';
|
121 |
+
} else {
|
122 |
+
bindingMethod = 'прошивка нитками';
|
123 |
+
}
|
124 |
+
|
125 |
+
// Determine paper type
|
126 |
+
const innerPaper = hasImages ? 'мелованная бумага 115 г/м²' : 'офсетная бумага 80 г/м²';
|
127 |
+
const coverPaper = 'картон 250 г/м² с матовой ламинацией';
|
128 |
+
|
129 |
+
// Generate Russian output
|
130 |
+
const russianOutput = `Здравствуйте,
|
131 |
+
|
132 |
+
Требуется расчет стоимости печати книги со следующими параметрами:
|
133 |
+
|
134 |
+
• Формат: ${formatSize}
|
135 |
+
• Объем: ~${pageCount} страниц
|
136 |
+
• Тираж: ${printRun} экз.
|
137 |
+
• Бумага внутреннего блока: ${innerPaper}
|
138 |
+
• Бумага обложки: ${coverPaper}
|
139 |
+
• Способ скрепления: ${bindingMethod}
|
140 |
+
• Печать: ${hasImages ? 'цветная (4+4)' : 'черно-белая (1+1)'}
|
141 |
+
${hasImages ? '• Содержит иллюстрации/изображения\n' : ''}
|
142 |
+
|
143 |
+
Прошу сообщить стоимость и сроки изготовления.
|
144 |
+
|
145 |
+
Спасибо!`;
|
146 |
+
|
147 |
+
// Generate Chinese output
|
148 |
+
const chineseBinding = pageCount <= 48 ? '骑马钉' : (pageCount <= 96 ? '胶装' : '锁线胶装');
|
149 |
+
const chineseColor = hasImages ? '彩色印刷(4+4)' : '黑白印刷(1+1)';
|
150 |
+
|
151 |
+
const chineseOutput = `您好,
|
152 |
+
|
153 |
+
请报价以下印刷规格:
|
154 |
+
|
155 |
+
规格:${formatSize}
|
156 |
+
页数:约${pageCount}页
|
157 |
+
印量:${printRun}本
|
158 |
+
内页用纸:${hasImages ? '115克铜版纸' : '80克双胶纸'}
|
159 |
+
封面用纸:250克铜版纸+哑膜
|
160 |
+
装订方式:${chineseBinding}
|
161 |
+
印刷方式:${chineseColor}
|
162 |
+
${hasImages ? '包含图片/插图\n' : ''}
|
163 |
+
|
164 |
+
请告知价格和交货时间。
|
165 |
+
|
166 |
+
谢谢!`;
|
167 |
+
|
168 |
+
// Display outputs
|
169 |
+
document.getElementById('russianOutput').textContent = russianOutput;
|
170 |
+
document.getElementById('chineseOutput').textContent = chineseOutput;
|
171 |
+
}
|
172 |
+
|
173 |
+
function copyToClipboard(elementId) {
|
174 |
+
const element = document.getElementById(elementId);
|
175 |
+
const range = document.createRange();
|
176 |
+
range.selectNode(element);
|
177 |
+
window.getSelection().removeAllRanges();
|
178 |
+
window.getSelection().addRange(range);
|
179 |
+
document.execCommand('copy');
|
180 |
+
window.getSelection().removeAllRanges();
|
181 |
+
|
182 |
+
// Show feedback
|
183 |
+
const originalText = event.target.textContent;
|
184 |
+
event.target.textContent = 'Copied!';
|
185 |
+
event.target.classList.add('bg-green-100', 'text-green-700');
|
186 |
+
setTimeout(() => {
|
187 |
+
event.target.textContent = originalText;
|
188 |
+
event.target.classList.remove('bg-green-100', 'text-green-700');
|
189 |
+
}, 2000);
|
190 |
+
}
|
191 |
+
</script>
|
192 |
+
<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=Nekruz/specbook-generator" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
193 |
+
</html>
|