Work CalculatorCalculate the work done by a force from force, displacement and angle — in J, kJ, ft-lbs, cal and more
Work Result
⚡ —
Work scale — what this compares to
Energy range Scale Examples
Reference — common work & energy amounts
Action / source Work Category Notes
Calculate
Reset
Copy
Share
Embed
Info
Embed this calculator
Embed code
Copy Embed Code
Refresh Preview
Close
Live preview — identical to the main calculator
EXACT MATCH
\n';
}function generateEmbedCode() {
var toolHtml = buildToolHtml();
if (embedCodeTextarea) embedCodeTextarea.value = toolHtml;
if (embedPreview) embedPreview.srcdoc = toolHtml;
}window.toggleEmbedPanel = function () {
if (!embedPanel) return;
var isHidden = (embedPanel.style.display === 'none' || embedPanel.style.display === '');
if (isHidden) {
generateEmbedCode();
embedPanel.style.display = 'block';
try { embedPanel.scrollIntoView({ behavior:'smooth', block:'start' }); } catch (e) {}
} else { embedPanel.style.display = 'none'; }
};window.closeEmbed = function () { if (embedPanel) embedPanel.style.display = 'none'; };
window.refreshEmbed = function () { generateEmbedCode(); };window.copyEmbedCode = function () {
if (!embedCodeTextarea) return;
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'); }
}
};/* ─────────── init ─────────── */
function bindAll() {
[forceInput, distInput, angleInput, timeInput].forEach(function (el) {
if (el) {
el.addEventListener('input', calculate);
el.addEventListener('change', calculate);
}
});
[forceUnitSelect, distUnitSelect, timeUnitSelect].forEach(function (el) {
if (el) el.addEventListener('change', calculate);
});
if (presetSelect) presetSelect.addEventListener('change', onPresetChange);
}function init() {
populatePresets();
bindAll();
calculate();
if (embedPanel) embedPanel.style.display = 'none';
}if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
})();