Roleplaying Game Injury Tracker
Info
Created On: April 11, 2023
Created By:
AI
Model: gpt-4-0314
Time: 1681186093 seconds
Prompt Tokens: 2369
Completion Tokens: 1488
Total Token Cost: 3857
Get This App On Your Website
Copy Code
1. Copy the code above with the iframe and link.
2. Paste the code into your website.
3. Resize the iframe to fit your website.
Javascript, HTML, CSS Code
Copy
<html>
<head>
<script type="text/javascript"> window.addEventListener('error', function(event) { var message = JSON.parse(JSON.stringify(event.message)); var source = event.filename; var lineno = event.lineno; var colno = event.colno; var error = event.error; window.parent.postMessage({ type: 'iframeError', details: { message: message, source: source, lineno: lineno, colno: colno, error: error ? error.stack : '' } }, '*'); }); window.addEventListener('unhandledrejection', function(event) { window.parent.postMessage({ type: 'iframePromiseRejection', details: { reason: event.reason } }, '*'); }); </script>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Roleplaying Game Injury Tracker</title>
<meta name="description" content="An app to track injuries on a roleplaying game character's body.">
<meta name="keywords" content="roleplaying, game, injury, tracker, character, body">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<script type="text/javascript">
var localStoragePrefix = "ct-168116526971198";
var lastSave = 0;
function saveLocal(data) {
if (Date.now() - lastSave < 1000) {
return;
}
let cookie = localStoragePrefix + "=" + JSON.stringify(data) + "; path=" + window.location.pathname + "'; SameSite=Strict";
cookie += "; expires=" + new Date(Date.now() + 1000 * 60 * 60 * 24 * 365 * 1000).toUTCString();
document.cookie = cookie;
lastSave = Date.now();
}
function loadLocal() {
var cookiePrefix = localStoragePrefix + "=";
var cookieStart = document.cookie.indexOf(cookiePrefix);
if (cookieStart > -1) {
let cookieEnd = document.cookie.indexOf(";", cookieStart);
if (cookieEnd == -1) {
cookieEnd = document.cookie.length;
}
var cookieData = document.cookie.substring(cookieStart + cookiePrefix.length, cookieEnd);
return JSON.parse(cookieData);
}
}
</script>
<script type="text/javascript">
const bodyParts = ['head', 'neck', 'chest', 'hands', 'arms', 'eyes', 'legs', 'feet', 'back'];
let injuries = {};
function updateInjuryDisplay() {
bodyParts.forEach(part => {
if (injuries[part]) {
$(`#${part}-injury`).text(injuries[part]);
} else {
$(`#${part}-injury`).text('');
}
});
}
function triggerInjury(part, level) {
injuries[part] = level;
updateInjuryDisplay();
saveLocal(injuries);
}
function clearInjuries() {
bodyParts.forEach(part => {
injuries[part] = 0;
});
updateInjuryDisplay();
saveLocal(injuries);
}
function createTriggerButtons() {
bodyParts.forEach(part => {
let btnGroup = $('<div class="btn-group mb-2"></div>');
let label = $(`<h4>${part.charAt(0).toUpperCase() + part.slice(1)}</h4>`);
btnGroup.append(label);
for (let i = 1; i <= 3; i++) {
let btn = $(`<button class="btn btn-success ms-2">${i}</button>`);
btn.on('click', () => {
triggerInjury(part, i);
btn.removeClass('btn-success').addClass('btn-danger');
});
btnGroup.append(btn);
}
$('#trigger-buttons').append(btnGroup);
});
}
$(document).ready(function() {
const loadedData = loadLocal();
if (loadedData) {
injuries = loadedData;
updateInjuryDisplay();
}
createTriggerButtons();
});
</script>
<style>
body {
font-family: 'Comic Sans MS', cursive;
}
.body-part {
position: absolute;
}
.injury-level {
background-color: red;
border-radius: 50%;
color: white;
font-weight: bold;
line-height: 20px;
text-align: center;
width: 20px;
height: 20px;
}
</style>
<link rel="canonical" href="https://calculator.tools/prompt/199/">
<meta charset="utf-8">
</head>
<body>
<div id="main-container" class="container">
<h1 class="text-center">🤕 Roleplaying Game Injury Tracker 🤕</h1>
<div class="d-flex justify-content-center">
<div style="position: relative; width: 200px; height: 400px;">
<img src="https://i.imgur.com/8jU6j3U.png" alt="Human Body Outline" width="200" height="400">
<div id="head-injury" class="body-part injury-level" style="left: 90px; top: 20px;"></div>
<div id="neck-injury" class="body-part injury-level" style="left: 90px; top: 60px;"></div>
<div id="chest-injury" class="body-part injury-level" style="left: 90px; top: 100px;"></div>
<div id="hands-injury" class="body-part injury-level" style="left: 50px; top: 180px;"></div>
<div id="arms-injury" class="body-part injury-level" style="left: 140px; top: 180px;"></div>
<div id="eyes-injury" class="body-part injury-level" style="left: 90px; top: 40px;"></div>
<div id="legs-injury" class="body-part injury-level" style="left: 90px; top: 260px;"></div>
<div id="feet-injury" class="body-part injury-level" style="left: 90px; top: 320px;"></div>
<div id="back-injury" class="body-part injury-level" style="left: 90px; top: 140px;"></div>
</div>
</div>
<div class="text-center mt-4">
<h2>🔘 Trigger Injuries 🔘</h2>
<div id="trigger-buttons" class="d-flex justify-content-center flex-wrap">
</div>
</div>
<div class="text-center mt-4">
<h2>🔘 Clear Injuries 🔘</h2>
<button onclick="clearInjuries()" class="btn btn-primary">Clear All Injuries</button>
</div>
</div>
<script type="text/javascript"> var localStoragePrefix = "ct-{{ cachebreaker }}"; var lastSave = 0; function saveLocal(data) { if (Date.now() - lastSave < 1000) { return; } let cookie = localStoragePrefix + "=" + JSON.stringify(data) + "; path=" + window.location.pathname + "'; SameSite=Strict"; cookie += "; expires=" + new Date(Date.now() + 1000 * 60 * 60 * 24 * 365 * 1000).toUTCString(); document.cookie = cookie; lastSave = Date.now(); } function loadLocal() { var cookiePrefix = localStoragePrefix + "="; var cookieStart = document.cookie.indexOf(cookiePrefix); if (cookieStart > -1) { let cookieEnd = document.cookie.indexOf(";", cookieStart); if (cookieEnd == -1) { cookieEnd = document.cookie.length; } var cookieData = document.cookie.substring(cookieStart + cookiePrefix.length, cookieEnd); return JSON.parse(cookieData); } } </script>
<script type="text/javascript"> window.addEventListener('load', function() { var observer = new MutationObserver(function() { window.parent.postMessage({height: document.documentElement.scrollHeight || document.body.scrollHeight},"*"); }); observer.observe(document.body, {attributes: true, childList: true, subtree: true}); window.parent.postMessage({height: document.documentElement.scrollHeight || document.body.scrollHeight},"*"); }); </script>
</body>
</html>