text-counter
from zipfile import ZipFile
import os
# Create a directory for the tool files
tool_dir = "/mnt/data/text-counter"
os.makedirs(tool_dir, exist_ok=True)
# HTML content for the text counter tool
html_content = """
 
 
 टेक्स्ट गिनती टूल
 <br>   body {<br>     font-family: Arial, sans-serif;<br>     padding: 20px;<br>     background: #f4f4f4;<br>   }<br>   textarea {<br>     width: 100%;<br>     height: 150px;<br>     padding: 10px;<br>     font-size: 16px;<br>   }<br>   .result {<br>     margin-top: 20px;<br>     background: #fff;<br>     padding: 15px;<br>     border-radius: 8px;<br>     box-shadow: 0 0 5px rgba(0,0,0,0.1);<br>   }<br>   .result p {<br>     margin: 10px 0;<br>   }<br>   h1 {<br>     color: #2c3e50;<br>   }<br> 
 
टेक्स्ट गिनती टूल
 
   
अक्षर: 0
   
शब्द: 0
   
वाक्य: 0
 
<br> const textInput = document.getElementById("textInput");<br> const charCount = document.getElementById("charCount");<br> const wordCount = document.getElementById("wordCount");<br> const sentenceCount = document.getElementById("sentenceCount");</p><p> textInput.addEventListener("input", () => {<br> const text = textInput.value;</p><p> // अक्षर गिनें<br> charCount.textContent = text.length;</p><p> // शब्द गिनें<br> const words = text.trim().split(/\\s+/).filter(word => word.length > 0);<br> wordCount.textContent = words.length;</p><p> // वाक्य गिनें<br> const sentences = text.split(/[.!?]+/).filter(s => s.trim().length > 0);<br> sentenceCount.textContent = sentences.length;<br> });<br>
"""
# Save the HTML file
html_file_path = os.path.join(tool_dir, "index.html")
with open(html_file_path, "w", encoding="utf-8") as f:
   f.write(html_content)
# Create a zip file of the tool directory
zip_path = "/mnt/data/text-counter.zip"
with ZipFile(zip_path, "w") as zipf:
   zipf.write(html_file_path, arcname="index.html")
zip_path