Cat Chocolate Toxicity Calculator
Check the methylxanthines dose your cat received from chocolate
Result
Methylxanthines dose
— mg/kg
Total methylxanthines received: —
✅—
Caffeine dose received
— mg/kg
Theobromine dose received
— mg/kg
Methylxanthines = Theobromine + Caffeine
Embed this calculator
Embed code
\n';
}function generateEmbedCode() {
var toolHtml = buildToolHtml();/* Show the full HTML source in the textarea — clean and copyable */
embedCodeTextarea.value = toolHtml;/* Also render a live preview inside the panel */
var iframe = embedPreview;
/* Use srcdoc for safe sandboxed rendering */
iframe.srcdoc = toolHtml;
}window.toggleEmbedPanel = function () {
var isHidden = (embedPanel.style.display === 'none' || embedPanel.style.display === '');
if (isHidden) {
generateEmbedCode();
embedPanel.style.display = 'block';
/* Smooth-scroll the panel into view */
try { embedPanel.scrollIntoView({ behavior:'smooth', block:'start' }); } catch (e) {}
} else {
embedPanel.style.display = 'none';
}
};window.closeEmbed = function () {
embedPanel.style.display = 'none';
};window.refreshEmbed = function () {
generateEmbedCode();
};window.copyEmbedCode = function () {
/* Regenerate to make sure it's current */
generateEmbedCode();
embedCodeTextarea.select();
embedCodeTextarea.setSelectionRange(0, embedCodeTextarea.value.length);
if (navigator.clipboard) {
navigator.clipboard.writeText(embedCodeTextarea.value).then(function () {
alert('Embed code copied!');
}).catch(function () {
try { document.execCommand('copy'); alert('Embed code copied!'); }
catch (e) { alert('Press Ctrl+C to copy'); }
});
} else {
try { document.execCommand('copy'); alert('Embed code copied!'); }
catch (e) { alert('Press Ctrl+C to copy'); }
}
};function bindAll() {
[weightInput, amountInput].forEach(function (el) {
el.addEventListener('input', calculate);
el.addEventListener('change', calculate);
});
weightUnitSelect.addEventListener('change', onWeightUnitChange);
amountUnitSelect.addEventListener('change', calculate);
chocolateSelect.addEventListener('change', function () {
updateChocolateNote();
calculate();
});
}if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', function () {
populateChocolates();
updateChocolateNote();
bindAll();
calculate();
/* Start with the embed panel hidden */
embedPanel.style.display = 'none';
});
} else {
populateChocolates();
updateChocolateNote();
bindAll();
calculate();
embedPanel.style.display = 'none';
}
})();