<div id="zub-master-tool">
<style>
#zub-master-tool {
font-family: Arial, sans-serif;
color: #333;
line-height: 1.6;
}
#zub-master-tool * { box-sizing: border-box; }
#zub-master-tool textarea {
width: 100%;
height: 320px;
padding: 12px;
border: 1px solid #ccc;
border-radius: 6px;
font-size: 14px;
}
#zub-master-tool button {
background: #6515bd;
color: white;
border: 0;
padding: 12px 16px;
margin: 8px 5px 12px 0;
border-radius: 5px;
font-weight: bold;
cursor: pointer;
}
#zub-master-tool .zub-banner {
background: linear-gradient(120deg,#1765c1,#168bd1);
color: white;
text-align: center;
padding: 25px 12px;
border-radius: 8px;
margin-bottom: 20px;
}
#zub-master-tool .zub-banner h2 {
margin: 0;
font-size: 25px;
}
#zub-master-tool .zub-counts {
margin-top: 12px;
font-weight: bold;
}
#zub-master-tool .zub-section {
background: #6515bd;
color: white;
padding: 12px;
border-radius: 5px;
margin: 20px 0 12px;
font-weight: bold;
}
#zub-master-tool .zub-card {
border: 1px solid #ddd;
border-left: 4px solid #6515bd;
border-radius: 5px;
margin: 12px 0;
overflow: hidden;
background: white;
}
#zub-master-tool .zub-card-title {
background: #f5f6f9;
color: #6515bd;
font-weight: bold;
padding: 12px;
}
#zub-master-tool .zub-row {
border-top: 1px solid #eee;
padding: 10px 12px;
}
#zub-master-tool .zub-label {
font-weight: bold;
display: block;
margin-bottom: 3px;
}
#zub-master-tool .zub-value {
display: block;
overflow-wrap: anywhere;
}
/* Colors matching the image reference */
#zub-master-tool .zub-composition { color: #1765c1; }
#zub-master-tool .zub-uses { color: #16805d; }
#zub-master-tool .zub-side { color: #bd3c45; }
#zub-master-tool .zub-dose { color: #8a4bb5; }
#zub-master-tool .zub-causes { color: #1765c1; }
#zub-master-tool .zub-symptoms { color: #bd3c45; }
#zub-master-tool .zub-treatment { color: #16805d; }
#zub-master-tool .zub-disclaimer {
background: #fff3cd;
color: #664d03;
padding: 12px;
border-radius: 5px;
margin-top: 18px;
font-size: 12px;
}
@media(max-width:500px) {
#zub-master-tool .zub-banner h2 { font-size: 21px; }
}
</style>
<h3>ZUB Mega Tool - Medical Masterbook Generator</h3>
<p>AI से मिली पूरी मेडिकल बुक नीचे Paste करें:</p>
<textarea id="zub-input" placeholder="SECTION 1: MEDICINES REFERENCE GUIDE
1. Paracetamol (PCM / Acetaminophen)
Composition (क्या पाया जाता है): Paracetamol 500mg
Use (कब लेनी चाहिए): बुखार और दर्द
Side Effects (दुष्प्रभाव): मतली आदि
Dose (कितनी मात्रा में देना है): डॉक्टर की सलाह के अनुसार
SECTION 2: COMMON DISEASES & TREATMENT
1. Hypertension (High BP)
Causes (कारण): अत्यधिक नमक, तनाव
Symptoms (लक्षण): चक्कर आना
Treatment & Care (उपचार): डॉक्टर की सलाह लें"></textarea>
<br>
<button type="button" id="zub-generate">Generate Design</button>
<button type="button" id="zub-copy">Copy HTML</button>
<button type="button" id="zub-clear">Clear</button>
<div id="zub-preview"></div>
<script>
(function(){
const root = document.getElementById("zub-master-tool");
if (!root || root.dataset.zubReady === "1") return;
root.dataset.zubReady = "1";
const input = root.querySelector("#zub-input");
const preview = root.querySelector("#zub-preview");
const generateBtn = root.querySelector("#zub-generate");
const copyBtn = root.querySelector("#zub-copy");
const clearBtn = root.querySelector("#zub-clear");
function esc(text) {
return String(text).replace(/[&<>"']/g, function(c) {
return {
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'"
}[c];
});
}
const fieldList = [
["Composition", "zub-composition"],
["Use", "zub-uses"],
["Uses", "zub-uses"],
["Side Effects", "zub-side"],
["Dose", "zub-dose"],
["Causes", "zub-causes"],
["Symptoms", "zub-symptoms"],
["Treatment & Care", "zub-treatment"],
["Treatment and Care", "zub-treatment"],
["Treatment", "zub-treatment"],
["Care", "zub-treatment"],
["Precautions", "zub-side"],
["Warnings", "zub-side"]
];
function findField(line) {
for (let i = 0; i < fieldList.length; i++) {
const name = fieldList[i][0];
const cls = fieldList[i][1];
const re = new RegExp(
"^(" + name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") +
"(?:\\s*\\([^)]*\\))?)\\s*:\\s*(.*)$",
"i"
);
const match = line.match(re);
if (match) {
return {
label: match[1],
value: match[2],
cls: cls
};
}
}
return null;
}
function generate() {
const text = input.value.trim();
if (!text) {
alert("पहले AI से मिली जानकारी Paste करें");
return;
}
const lines = text
.replace(/\r/g, "")
.split("\n")
.map(function(line) { return line.trim(); })
.filter(Boolean);
let sections = [];
let section = null;
let current = null;
function saveCurrent() {
if (current && section) {
section.items.push(current);
}
current = null;
}
function saveSection() {
saveCurrent();
if (section) {
sections.push(section);
}
section = null;
}
lines.forEach(function(line) {
if (/^SECTION\s*1\s*:/i.test(line)) {
saveSection();
section = {
title: line,
type: "medicine",
items: []
};
return;
}
if (/^SECTION\s*2\s*:/i.test(line)) {
saveSection();
section = {
title: line,
type: "disease",
items: []
};
return;
}
if (!section) {
section = {
title: "SECTION 1: MEDICINES REFERENCE GUIDE",
type: "medicine",
items: []
};
}
const numberMatch = line.match(/^(\d+)\.\s+(.+)$/);
if (numberMatch) {
saveCurrent();
current = {
number: numberMatch[1],
title: numberMatch[2],
rows: []
};
return;
}
if (!current) {
current = {
number: "",
title: "Information",
rows: []
};
}
const field = findField(line);
if (field) {
current.rows.push(field);
} else if (current.rows.length) {
current.rows[current.rows.length - 1].value += " " + line;
} else {
current.rows.push({
label: "Information",
value: line,
cls: "zub-uses"
});
}
});
saveSection();
let medicineCount = 0;
let diseaseCount = 0;
sections.forEach(function(s) {
if (s.type === "medicine") medicineCount += s.items.length;
if (s.type === "disease") diseaseCount += s.items.length;
});
let html = `
<div class="zub-banner">
<h2>Medical Masterbook A-Z</h2>
<p>Complete Clinical Reference Guide</p>
<p>Hindi & English | Medicines & Uses | Diseases & Treatment</p>
<div class="zub-counts">
Medicines: ${medicineCount} | Diseases: ${diseaseCount}
</div>
</div>
`;
sections.forEach(function(s) {
html += '<div class="zub-section">' + esc(s.title) + '</div>';
s.items.forEach(function(item) {
html += '<div class="zub-card">';
html += '<div class="zub-card-title">';
html += esc(item.number ? item.number + ". " : "");
html += esc(item.title);
html += '</div>';
item.rows.forEach(function(row) {
html += '<div class="zub-row">';
html += '<span class="zub-label ' + esc(row.cls) + '">';
html += esc(row.label) + ':</span>';
html += '<span class="zub-value ' + esc(row.cls) + '">';
html += esc(row.value);
html += '</span>';
html += '</div>';
});
html += '</div>';
});
});
html += `
<div class="zub-disclaimer">
<b>Disclaimer:</b> यह सामग्री केवल शैक्षणिक जानकारी के लिए है। यह डॉक्टर की सलाह का विकल्प नहीं है। किसी भी दवा का सेवन या खुराक डॉक्टर की सलाह के बिना न करें।
</div>
`;
preview.innerHTML = html;
preview.scrollIntoView({ behavior: "smooth", block: "start" });
}
async function copyHTML() {
if (!preview.innerHTML.trim()) {
alert("पहले Generate Design दबाएँ");
return;
}
const css = `
<style>
.zub-banner{background:linear-gradient(120deg,#1765c1,#168bd1);color:white;text-align:center;padding:25px 12px;border-radius:8px;margin-bottom:20px}
.zub-banner h2{margin:0;font-size:25px}
.zub-counts{margin-top:12px;font-weight:bold}
.zub-section{background:#6515bd;color:white;padding:12px;border-radius:5px;margin:20px 0 12px;font-weight:bold}
.zub-card{border:1px solid #ddd;border-left:4px solid #6515bd;border-radius:5px;margin:12px 0;overflow:hidden;background:white}
.zub-card-title{background:#f5f6f9;color:#6515bd;font-weight:bold;padding:12px}
.zub-row{border-top:1px solid #eee;padding:10px 12px}
.zub-label{font-weight:bold;display:block;margin-bottom:3px}
.zub-value{display:block;overflow-wrap:anywhere}
.zub-composition{color:#1765c1}
.zub-uses{color:#16805d}
.zub-side{color:#bd3c45}
.zub-dose{color:#8a4bb5}
.zub-causes{color:#1765c1}
.zub-symptoms{color:#bd3c45}
.zub-treatment{color:#16805d}
.zub-disclaimer{background:#fff3cd;color:#664d03;padding:12px;border-radius:5px;margin-top:18px;font-size:12px}
</style>
`;
const fullHTML = css + preview.innerHTML;
try {
await navigator.clipboard.writeText(fullHTML);
alert("HTML Copy हो गया! अब Blogger HTML View में Paste करें।");
} catch (error) {
const area = document.createElement("textarea");
area.value = fullHTML;
area.style.position = "fixed";
area.style.left = "-9999px";
document.body.appendChild(area);
area.focus();
area.select();
const success = document.execCommand("copy");
area.remove();
if (success) {
alert("HTML Copy हो गया! अब Blogger HTML View में Paste करें।");
} else {
alert("Copy नहीं हो पाया।");
}
}
}
function clearAll() {
input.value = "";
preview.innerHTML = "";
input.focus();
}
generateBtn.addEventListener("click", generate);
copyBtn.addEventListener("click", copyHTML);
clearBtn.addEventListener("click", clearAll);
})();
</script>
</div>
0 Comments