Fork harperd1/simplyRPG for rpg.peajack.net Fork of https://github.com/harperd1/simplyRPG with multi-map scenes, token visibility toggle, Player View GM notes + reality density indicator, and dark theme.
@@ -0,0 +1,17 @@
+# simplyRPG (fork for rpg.peajack.net) + +Форк оригинального проекта **[harperd1/simplyRPG](https://github.com/harperd1/simplyRPG)** (MIT License), адаптированный для личного использования и стримов на [rpg.peajack.net](https://rpg.peajack.net/). + +- Оригинальный репозиторий: https://github.com/harperd1/simplyRPG + +## Отличия от оригинала + +- **Убрана стартовая страница:** платформа (бывший `gmView.html`) размещена напрямую в корне `index.html`, удалены маркетинговые страницы и внешние футеры; `gmView.html` оставлен редиректом на `/`. +- **Мульти-карты (сцены):** добавлена панель переключения карт (`Карта 1`, `Карта 2`, `+ Карта`, переименование, удаление) и массовый импорт фоновых изображений. Для каждой карты сохраняются фон, токены со своими координатами/подписями/поворотом/видимостью, сетка, масштаб, рисунки и линейка. Переключение карт синхронизируется с `Player View` по `BroadcastChannel`. +- **Видимость токенов:** у каждого токена в `Token Manager` добавлена кнопка-глаз. Скрытый токен полностью пропадает в `Player View`, но остаётся полупрозрачным для мастера на карте. +- **HUD для `Player View` (под стрим):** + - удалены `Dice Roller` и `Music Player`; + - добавлена панель **«Заметки мастера»** с трансляцией текста в реальном времени в `Player View`; + - добавлен **индикатор плотности реальности (`0.5–5.0 Юм`)** с ползунком у мастера и синхронной шкалой в `Player View`. +- **Формат сохранений `.ttrpg` (v2):** поддержка сохранения и загрузки всех сцен, видимости токенов, заметок мастера и уровня реальности (с обратной совместимостью для старых однокартовых файлов v1). +- **Тёмная тема и современный UI:** единая тёмная палитра со шрифтом `Iosevka` в GM View и стримерском `Player View`.
@@ -1,22 +1,105 @@
-.centering { +html, body { + height: 100%; + background-color: #16181c; +} + +.playerTopBar { + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: wrap; + gap: .75rem; + padding: .45rem 1rem; + background-color: #131519; + border-bottom: 1px solid #30363d; +} + +.playerStageLayout { display: grid; - justify-items: center; - align-items: center; - overflow: hidden; + grid-template-columns: 1fr 340px; + gap: .85rem; + padding: .75rem 1rem; + align-items: start; +} + +@media (max-width: 991px) { + .playerStageLayout { + grid-template-columns: 1fr; + } } #mirroredEncounterMap { - display: grid; - justify-items: center; + display: flex; + justify-content: center; align-items: center; - width: 100%; - min-height: 90%; - margin: 0; - padding: 0; - overflow: hidden; - background-color: white; + background-color: #101216; + border: 1px solid #30363d; + border-radius: 8px; + padding: .4rem; + min-height: 360px; +} + +#mirroredEncounterMap #canvas { + display: block; + border: 1px dashed #30363d; + border-radius: 4px; +} + +.playerHudSidebar { + display: flex; + flex-direction: column; + gap: .85rem; +} + +.hudPanel { + background-color: #1f2228; + border: 1px solid #30363d; + border-radius: 8px; + padding: .85rem 1rem; + box-shadow: 0 4px 16px rgba(0, 0, 0, 0.24); } -#canvas { - border: thin rgba(140,140,140) dashed; -}+.hudPanelTitle { + font-size: .78rem; + font-weight: 700; + letter-spacing: .06em; + text-transform: uppercase; + color: #7d8590; + margin-bottom: .5rem; +} + +.playerHumeValueRow { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: .5rem; + margin-bottom: .45rem; +} + +.playerHumeNumber { + font-size: 1.6rem; + font-weight: 700; + color: #f0f6fc; + line-height: 1.1; +} + +.playerHumeUnit { + font-size: .95rem; + color: #7d8590; + margin-left: .2rem; +} + +.playerNotesBody { + font-size: .96rem; + line-height: 1.5; + color: #e6edf3; + white-space: pre-wrap; + word-break: break-word; + max-height: 46vh; + overflow-y: auto; +} + +.playerNotesEmpty { + color: #6e7681; + font-style: italic; +}
@@ -1,77 +1,97 @@
<!DOCTYPE html> -<html> +<html lang="ru"> <head> - <!-- Global site tag (gtag.js) - Google Analytics --> - <!-- <script async src="https://www.googletagmanager.com/gtag/js?id=G-5FWK5WHN2R"></script> --> - <!-- <script> --> - <!-- window.dataLayer = window.dataLayer || []; --> - <!-- function gtag(){dataLayer.push(arguments);} --> - <!-- gtag('js', new Date()); --> - - <!-- gtag('config', 'G-5FWK5WHN2R'); --> - <!-- </script> --> - <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="robots" content="noindex"> - <meta name="description" content="The player view allows all of simplyRPG's normal canvas interactions (move,measure,draw, and erase) while minimizing on unnecessary options. This allows for a clean and professional appearance."> + <meta name="description" content="Player View — clean encounter map, reality density indicator, and GM notes for streaming."> <link rel="icon" href="assets/images/small-logo.png"> - <title>Player View</title> + <title>Player View — rpg.peajack.net</title> - <!-- boostrap CSS --> + <!-- Bootstrap CSS --> <link href="./libraries/bootstrap/bootstrap.css" rel="stylesheet"> - <!-- simplyRPG CSS --> + <!-- Modern Dark VTT CSS --> <link rel="stylesheet" type="text/css" href="gmView.css"> <link rel="stylesheet" type="text/css" href="encounterMap.css"> </head> -<body onload="init()" id="mainBody" class="grayBackground" style="padding: 0"> +<body onload="init()" id="mainBody" style="padding: 0"> - <!-- top of the encounter map --> - <div class="container"><div class="row"> - <!-- choose the interactive mode --> - <div class="col-sm-7 col-md-6 col-lg-4 col-xl-4"><div class="centering"> - <div class="btn-group btn-group-toggle" style="margin: .5rem" data-toggle="buttons"> - <label class="btn btn-secondary active"> - <input type="radio" id="circleMoving" onclick="circleMoving()" autocomplete="off" checked> Move - </label> - <label class="btn btn-secondary"> - <input type="radio" id="measureMode" onclick="measureMode()" autocomplete="off"> Measure - </label> - <label class="btn btn-secondary"> - <input type="radio" id="lineDrawing" onclick="lineDrawing()" autocomplete="off"> Draw - </label> - <label class="btn btn-secondary"> - <input type="radio" onclick="lineErasing()" autocomplete="off"> Erase - </label> + <!-- Compact top bar --> + <header id="playerTopBar" class="playerTopBar"> + <div class="d-flex align-items-center" style="gap: .65rem;"> + <img src="assets/images/logo1-white.png" class="logo" style="margin: 0; height: 22px;" alt=""> + <div class="btn-group btn-group-toggle" data-toggle="buttons"> + <label class="btn btn-secondary active"> + <input type="radio" id="circleMoving" onclick="circleMoving()" autocomplete="off" checked> Move + </label> + <label class="btn btn-secondary"> + <input type="radio" id="measureMode" onclick="measureMode()" autocomplete="off"> Measure + </label> + <label class="btn btn-secondary"> + <input type="radio" id="lineDrawing" onclick="lineDrawing()" autocomplete="off"> Draw + </label> + <label class="btn btn-secondary"> + <input type="radio" onclick="lineErasing()" autocomplete="off"> Erase + </label> </div> - </div></div> + </div> + + <div class="fieldGroup"> + <select name="drawSize" id="drawSize" class="dropdown"> + <option value="2">Small</option> + <option value="5">Medium</option> + <option value="10">Large</option> + </select> + <select name="drawColor" id="drawColor" class="dropdown"> + <option value="white">white</option> + <option value="yellow">yellow</option> + <option value="red">red</option> + <option value="blue">blue</option> + <option value="green">green</option> + <option value="black">black</option> + </select> + </div> + </header> - <!-- choose the size and color for drawing --> - <div class="col-sm-4 col-md-3 col-lg-2 col-xl-2"><div class="centering"> - <div class="verticalDiv" style="margin: .25rem 0 .4rem 0;"> - <select name="drawSize" id = "drawSize" class="dropdown"> - <option value=2>Small</option> - <option value=5>Medium</option> - <option value=10>Large</option> - </select> - <select name="drawColor" id = "drawColor" class="dropdown"> - <option value="black">black</option> - <option value="blue">blue</option> - <option value="red">red</option> - <option value="green">green</option> - </select> - </div> - </div></div> - </div></div> + <!-- Encounter map + HUD sidebar --> + <main class="playerStageLayout"> + <div id="mirroredEncounterMap"> + <canvas id="canvas" width="320" height="180"></canvas> + </div> + + <aside class="playerHudSidebar"> + <!-- Reality Density Indicator (Юм) --> + <section class="hudPanel"> + <div class="hudPanelTitle">Плотность реальности</div> + <div class="playerHumeValueRow"> + <div> + <span id="playerHumeValue" class="playerHumeNumber">1.0</span> + <span class="playerHumeUnit">Юм</span> + </div> + <span id="playerHumeStatus" class="humeStatus">Норма</span> + </div> + <div class="humeScaleBarWrap"> + <div id="playerHumeFillMask" class="humeScaleFillMask" style="width: 88.9%;"></div> + </div> + <div class="humeTicks"> + <span>0.5</span> + <span>1.0</span> + <span>2.5</span> + <span>5.0 Юм</span> + </div> + </section> - <!-- Encounter map --> - <div id="mirroredEncounterMap"> - <canvas id="canvas" width="320" height="180"></canvas> - </div> + <!-- GM Notes Broadcast --> + <section class="hudPanel"> + <div class="hudPanelTitle">Заметки мастера</div> + <div id="playerGmNotes" class="playerNotesBody playerNotesEmpty">Нет активных заметок</div> + </section> + </aside> + </main> </body> -<!-- Import boostrap javascript --> +<!-- Import bootstrap javascript --> <script src="./libraries/bootstrap/jquery-3.5.1.slim.min.js"></script> <script src="./libraries/bootstrap/bootstrap.js"></script> <!-- Import compression javascript -->@@ -92,49 +112,70 @@ createjs.Touch.enable(stage);
stage.mouseMoveOutside = true; setupCanvas(); - broadcastChannel.bc.onmessage=handleCanvasUpdates; + broadcastChannel.bc.onmessage = handleCanvasUpdates; setMirrorMapSupported(); + applyHumeValue(1.0); + applyGMNotes(""); if (supportsMirrorMap) { broadcastChannel.postMessage(['requestOppositePageElements']); } } - function handleCanvasUpdates (event) { + function applyGMNotes(text) { + const el = document.getElementById("playerGmNotes"); + if (!el) return; + const val = typeof text === "string" ? text : ""; + if (val.trim()) { + el.classList.remove("playerNotesEmpty"); + el.textContent = val; + } else { + el.classList.add("playerNotesEmpty"); + el.textContent = "Нет активных заметок"; + } + } + + function applyHumeValue(val) { + const meta = formatHumeMeta(val); + const valEl = document.getElementById("playerHumeValue"); + if (valEl) valEl.textContent = meta.clamped.toFixed(1); + const statusEl = document.getElementById("playerHumeStatus"); + if (statusEl) { + statusEl.textContent = meta.label; + statusEl.style.color = meta.color; + statusEl.style.backgroundColor = meta.bg; + } + const maskEl = document.getElementById("playerHumeFillMask"); + if (maskEl) maskEl.style.width = (100 - meta.pct).toFixed(1) + "%"; + } + + function handleCanvasUpdates(event) { let broadcastMetadata = event.data[0]; let broadcastData = event.data[1]; if (broadcastMetadata[2] == 'main') { - applyBroadcast(broadcastData,broadcastMetadata[0],broadcastMetadata[1]); + applyBroadcast(broadcastData, broadcastMetadata[0], broadcastMetadata[1]); } } - function setMirrorMapSupported () { - //If this browser doesn't support the mirror map, notify the user - //Use a global variable defined in fakeBroadcastPolyfill.js + function setMirrorMapSupported() { if (!supportsMirrorMap) { - canvas = document.getElementById('canvas'); - canvas.style.display="none"; + const canvas = document.getElementById('canvas'); + canvas.style.display = "none"; - document.getElementById('mirroredEncounterMap').style.backgroundColor = "rgb(231, 231, 231)"; + const holder = document.getElementById('mirroredEncounterMap'); + holder.style.backgroundColor = "#101216"; - warning = document.createElement('p'); - warning.innerHTML = "This browser does not support Player View. This is a known issue with Internet Explorer and Safari. We're working on a solution!" + const warning = document.createElement('p'); + warning.textContent = "This browser does not support BroadcastChannel for Player View. Please use Chrome/Chromium or Firefox."; warning.style.textAlign = 'center'; - warning.style.fontSize = "x-large" + warning.style.fontSize = "large"; warning.style.marginTop = "1em"; - document.getElementById('mirroredEncounterMap').appendChild(warning); - - warning2 = document.createElement('p'); - warning2.innerHTML = "simplyRPG works best with Google Chrome"; - warning2.style.textAlign = 'center'; - warning2.style.fontSize = "x-large"; - warning2.style.marginTop = "1em"; - document.getElementById('mirroredEncounterMap').appendChild(warning2); + holder.appendChild(warning); } else { window.onresize = resizeCanvas; } } </script> -</html>+</html>
@@ -1,164 +0,0 @@
-<!doctype html> -<html lang="en"> - <head> - <!-- Global site tag (gtag.js) - Google Analytics --> - <!-- <script async src="https://www.googletagmanager.com/gtag/js?id=G-5FWK5WHN2R"></script> --> - <!-- <script> --> - <!-- window.dataLayer = window.dataLayer || []; --> - <!-- function gtag(){dataLayer.push(arguments);} --> - <!-- gtag('js', new Date()); --> - - <!-- gtag('config', 'G-5FWK5WHN2R'); --> - <!-- </script> --> - - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> - <meta name="description" content="Have questions about simplyRPG? Here's a few of the most popular answers."> - <title>FAQ</title> - <link rel="icon" href="assets/images/small-logo.png"> - - <!-- CSS --> - <link href="libraries/bootstrap/bootstrap.css" rel="stylesheet"> - <!-- simplyRPG CSS --> - <link rel="stylesheet" type="text/css" href="gmView.css"> - </head> - -<body> - -<nav class="navbar navbar-expand-md navbar-dark fixed-top blueBackground"> - <img src="assets/images/logo1-white.png" class="logo"> - <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation"> - <span class="navbar-toggler-icon"></span> - </button> - - <div class="collapse navbar-collapse" id="navbarsExampleDefault"> - <ul class="navbar-nav mr-auto"> - <li class="nav-item"> - <a class="nav-link" href="./index.html">Home</a> - </li> - <li class="nav-item"> - <a class="nav-link" href="./gmView.html">simplyRPG</a> - </li> - <li class="nav-item "> - <a class="nav-link" href="./supportTheSite.html">Support the Site</a> - </li> - <li class="nav-item active"> - <a class="nav-link" href="./faq.html">FAQ</a> - </li> - </ul> - </div> - -</nav> - -<main> - <div class="pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center"> - <h1 class="display-4">FAQ</h1> - </div> - - <div class="container"> - - <div class="card-header col-12" style="border-radius: .25rem"> - <h4 class="my-0"><a data-toggle="collapse" href="#collapse0">Is simplyRPG free?</a></h4> - </div> - <div id="collapse0" class="collapse col-12"> - <p>Yes! simplyRPG is completely free. We don't require a subscription, use ads, or limit - features to paying users. If you're a regular user and would like to support the site, - check out our <a href="./supportTheSite.html">Support the Site</a> page.</p> - </div> - - <div class="card-header col-12" style="border-radius: .25rem"> - <h4 class="my-0"><a data-toggle="collapse" href="#collapse1">My WIFI is bad, can I use simplyRPG offline?</a></h4> - </div> - <div id="collapse1" class="collapse col-12"> - <p>Yes! We're working on an official offline version, but for now there's a simple work-around. - As long as you have an internet connection when you load the "simplyRPG" and "Player View" - webpages, they will continue to work if you lose your internet connection. So, load those - pages ahead of time and leave the tabs open!</p> - </div> - - <div class="card-header col-12" style="border-radius: .25rem"> - <h4 class="my-0"><a data-toggle="collapse" href="#collapse2">What are the dimensions of the encounter map?</a></h4> - </div> - <div id="collapse2" class="collapse col-12"> - <p>The encounter map is resized dynamically based on the size of the browser window. It always - maintains an aspect ratio of 16:9, which is a common aspect ratio for TVs, computer monitors, - and cell phones. If you want to avoid margins around your map, crop it to a 16:9 aspect ratio - before uploading to simplyRPG.</p> - </div> - - <div class="card-header col-12" style="border-radius: .25rem"> - <h4 class="my-0"><a data-toggle="collapse" href="#collapse3">Can I make the encounter full-screen?</a></h4> - </div> - <div id="collapse3" class="collapse col-12"> - <p>Yes! The "Player View" for every encounter is designed to occupy the entire window by default. - If your window is full screen, the encounter should be as well. However, if the amount of space - available to simplyRPG is not in a 16:9 aspect ratio, there will be some margins. A common cause - of this is the browser's toolbar occupying real estate at the top of the screen. This toolbar can - be hidden. For example, in Google Chrome, View > Always show toolbar in fullscreen.</p> - </div> - - <div class="card-header col-12" style="border-radius: .25rem"> - <h4 class="my-0"><a data-toggle="collapse" href="#collapse4">Can I rotate tokens?</a></h4> - </div> - <div id="collapse4" class="collapse col-12"> - <p>Yes, switch to the "Move" canvas interaction mode and hold down the "alt" key (on Windows) or - "option" key (on Mac) to rotate a token.</p> - </div> - - <div class="card-header col-12" style="border-radius: .25rem"> - <h4 class="my-0"><a data-toggle="collapse" href="#collapse5">What types of image files can I use with simplyRPG?</a></h4> - </div> - <div id="collapse5" class="collapse col-12"> - <p>simplyRPG is tested with .jpg and .png files for character tokens, custom tokens, and - background images. Other types of image files may work, but we offer no guarantees. </p> - </div> - - <div class="card-header col-12" style="border-radius: .25rem"> - <h4 class="my-0"><a data-toggle="collapse" href="#collapse6">What types of music files can I use with simplyRPG?</a></h4> - </div> - <div id="collapse6" class="collapse col-12"> - <p>simplyRPG works with .m4a, .mp3, or .mp4 music files. </p> - </div> - - <div class="card-header col-12" style="border-radius: .25rem"> - <h4 class="my-0"><a data-toggle="collapse" href="#collapse7">When I import music, the browser asks me if I trust the site?</a></h4> - </div> - <div id="collapse7" class="collapse col-12"> - <p>This is your browser doing it's job to keep your data safe. When you import a folder - containing music, the website has access to all of the data it contains. A malicious - website may be after your data for harmful reasons. For simplyRPG, we need access to these - music files to play them in the browser. Since simplyRPG is a front-end only website, - the files never actually leave your device, they are simply imported into the browser.</p> - <p>If you're the type to use an abundance of caution (we don't blame you!), you can copy - the music that you would like to use with simplyRPG to a seperate file. When you import - this copy, simplyRPG can only access the data within and cannot touch the original files.</p> - </div> - - <div class="card-header col-12" style="border-radius: .25rem"> - <h4 class="my-0"><a data-toggle="collapse" href="#collapse8">I clicked "save" on the GM View, where did the file go?</a></h4> - </div> - <div id="collapse8" class="collapse col-12"> - <p>When you save an encounter with simplyRPG, your browser downloads a .ttrpg file. This - file can typically be found in your "Downloads" folder. The .ttprg file extension is for - a custom file type which works only with simplyRPG.</p> - </div> - - <hr style="margin: 1rem 0"> - </div> - - <footer class="container footer"> - <span class="footer"> simplyRPG is powered by:</span><br> - <span class="footer"><a href="https://createjs.com/" target="_blank">createJS</a> and <a href="https://createjs.com/easeljs" target="_blank">easelJs</a></span><br> - <span class="footer"><a href="https://getbootstrap.com/" target="_blank">Bootstrap</a> and <a href="https://icons.getbootstrap.com/" target="_blank">Bootstrap Icons</a></span><br> - <span class="footer"><a href="https://fengyuanchen.github.io/compressorjs/" target="_blank">compressorJS</a></span><br> - <span class="footer">under the <a href="./license.html" target="_blank">MIT License</a></span><br><br> - <img src="assets/images/logo1-normal.png" class="logo"> - </footer> - - -<!-- Import boostrap javascript --> -<script src="libraries/bootstrap/jquery-3.5.1.slim.min.js"></script> -<script src="libraries/bootstrap/bootstrap.js"></script> -</main> -</body> -</html>
@@ -1,75 +1,275 @@
+@font-face { + font-family: 'Iosevka'; + src: url('fonts/iosevka-400.woff2') format('woff2'); + font-weight: 400; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: 'Iosevka'; + src: url('fonts/iosevka-700.woff2') format('woff2'); + font-weight: 700; + font-style: normal; + font-display: swap; +} + +:root { + --bg: #16181c; + --bg-panel: #1f2228; + --bg-item: #272b33; + --bg-input: #131519; + --bg-canvas: #101216; + --fg: #c9d1d9; + --fg-bright: #f0f6fc; + --muted: #7d8590; + --border: #30363d; + --border-strong: #444c56; + --accent: #005577; + --accent-hover: #0a6f99; + --accent-glow: rgba(14, 165, 233, 0.25); + --radius: 8px; +} + * { - font-family: Garamond; + font-family: 'Iosevka', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; + box-sizing: border-box; } +html, body { + background-color: var(--bg); + color: var(--fg); + margin: 0; +} body { - padding-top: 3rem; - padding-bottom: 3rem; - color: #5a5a5a; + padding-bottom: 2.5rem; +} + +h5, h6 { + color: var(--fg-bright); } h6 { - text-align: center; - font-size: 23pt; - margin: 0 0 .5rem 0; + text-align: left; + font-size: 1rem; + font-weight: 700; + letter-spacing: .03em; + text-transform: uppercase; + margin: 0; } hr { - height: .5rem; - margin: 0 0 .5rem 0; + height: 1px; + border: 0; + background-color: var(--border); + margin: .6rem 0; } -span, label { - color: white; +span, label, p, b, div { + color: var(--fg); } -.footer { - text-align: center; - color: gray; +/* Top bar */ +.topHeader { + background-color: rgba(19, 21, 25, 0.92); + backdrop-filter: blur(8px); + border-bottom: 1px solid var(--border); + padding: .55rem 1rem; + position: sticky; + top: 0; + z-index: 50; +} + +.topHeaderBrand { + font-weight: 700; + font-size: 1.02rem; + color: var(--fg-bright); + letter-spacing: .04em; + text-decoration: none; +} + +.topHeaderBrand:hover { + color: var(--fg-bright); + text-decoration: none; } .logo { padding: 0; - margin: 0 1rem 0 0; - height: 40px; + margin: 0 .65rem 0 0; + height: 24px; } .bold { - font-style: bold; + font-weight: 700; +} + +.panelCard { + background-color: var(--bg-panel); + border: 1px solid var(--border); + border-radius: var(--radius); + padding: .75rem .9rem; + box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22); +} + +.panelCardTitle { + font-size: .78rem; + text-transform: uppercase; + letter-spacing: .06em; + color: var(--muted); + margin-bottom: .5rem; + font-weight: 700; } -.blueBackground { - background-color: rgba(50,100,205) + +.topToolbarGrid { + display: grid; + grid-template-columns: minmax(260px, 340px) 1fr; + gap: .75rem; + margin-top: .85rem; } -.grayBackground { - background-color: rgb(231, 231, 231); +@media (max-width: 991px) { + .topToolbarGrid { + grid-template-columns: 1fr; + } } -.whiteBackground { - background-color: white; +.toolbarRow { + display: flex; + align-items: center; + flex-wrap: wrap; + gap: .55rem; } -.verticalDiv { +.fieldGroup { display: inline-flex; + align-items: center; + gap: .45rem; +} + +.fieldStack { + display: flex; flex-direction: column; - padding: 0; + gap: .2rem; +} + +.fieldLabel { + font-size: .78rem; + color: var(--muted); margin: 0; } -.interactionDiv { - margin-top: 1rem; - border-radius: .25rem; +/* Canvas card */ +.workspaceFrame { + margin-top: .85rem; + border: 1px solid var(--border); + border-radius: var(--radius); + overflow: hidden; + background-color: var(--bg-panel); + box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28); +} + +/* Scene / Map tabs bar */ +.sceneBar { + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: wrap; + gap: .5rem; + padding: .5rem .75rem; + background-color: var(--bg-input); + border-bottom: 1px solid var(--border); +} + +.sceneTabs { + display: flex; + align-items: center; + flex-wrap: wrap; + gap: .35rem; + flex: 1 1 auto; +} + +.sceneTab { + display: inline-flex; + align-items: center; + gap: .35rem; + padding: .3rem .7rem; + font-size: .85rem; + line-height: 1.3; + color: var(--fg); + background-color: var(--bg-panel); + border: 1px solid var(--border); + border-radius: 6px; + cursor: pointer; + user-select: none; + transition: background-color .15s ease, border-color .15s ease, color .15s ease; +} + +.sceneTab:hover { + background-color: var(--bg-item); + color: var(--fg-bright); + border-color: var(--border-strong); +} + +.sceneTab.active { + background-color: var(--accent); + border-color: var(--accent-hover); + color: #ffffff; + font-weight: 700; +} + +.sceneTabCount { + font-size: .74rem; + opacity: .8; + color: inherit; +} + +.sceneActions { + display: inline-flex; + align-items: center; + gap: .3rem; +} + +.sceneActionBtn { + padding: .28rem .6rem; + font-size: .84rem; + line-height: 1.3; + background-color: var(--bg-panel); + color: var(--fg-bright); + border: 1px solid var(--border); + border-radius: 6px; + cursor: pointer; + transition: background-color .15s ease, border-color .15s ease; +} + +.sceneActionBtn:hover { + background-color: var(--accent); + border-color: var(--accent-hover); + color: #ffffff; +} + +.sceneActionBtn:disabled { + opacity: .4; + cursor: not-allowed; +} + +.upperMapSettings, +.lowerMapSettings { + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: wrap; + gap: .75rem; + padding: .55rem .85rem; + background-color: var(--bg-panel); } .upperMapSettings { - margin-top: 1rem; - border-radius: .25rem .25rem 0 0; + border-bottom: 1px solid var(--border); } .lowerMapSettings { - margin-bottom: 1rem; - border-radius: 0 0 .25rem .25rem; + border-top: 1px solid var(--border); } .centering {@@ -88,273 +288,413 @@ position: absolute;
z-index: -1; } -.buttonMimic { - text-align: center; +.buttonMimic, +.btn-modern { + display: inline-flex; + align-items: center; + justify-content: center; + gap: .35rem; + color: var(--fg-bright); + background-color: var(--bg-item); + border: 1px solid var(--border-strong); + padding: 0.36rem 0.78rem; + font-size: .86rem; + line-height: 1.35; + border-radius: 6px; + cursor: pointer; + margin: 0; + transition: color .15s ease, background-color .15s ease, border-color .15s ease, transform .05s ease; +} - /*btn-light*/ - color: #212529; - background-color: #f8f9fa; - border-color: #f8f9fa; +.buttonMimic:hover, +.buttonMimic:focus, +.btn-modern:hover, +.btn-modern:focus { + color: #ffffff; + background-color: var(--accent); + border-color: var(--accent-hover); + outline: none; +} - /*btn class*/ - vertical-align: middle; - border: 1px solid transparent; - padding: 0.375rem 0.75rem; - font-size: 1rem; - line-height: 1.5; - border-radius: 0.25rem; - transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; +.btn-modern-primary { + background-color: var(--accent); + border-color: var(--accent-hover); + color: #ffffff; + font-weight: 700; } -.buttonMimic:hover { - color: #212529; - background-color: #e2e6ea; - border-color: #dae0e5; +.btn-modern-primary:hover { + background-color: var(--accent-hover); +} - cursor: pointer; +.btn-modern-sm { + padding: .24rem .55rem; + font-size: .8rem; } -.buttonMimic:focus, { - color: #212529; - background-color: #e2e6ea; - border-color: #dae0e5; - box-shadow: 0 0 0 0.2rem rgba(216, 217, 219, 0.5); +/* Segmented mode toggle */ +.btn-group-toggle { + background-color: var(--bg-input); + padding: 3px; + border-radius: 7px; + border: 1px solid var(--border); + gap: 2px; } -.dropdown { - border-radius: 0.25rem; - background-color: white; +.btn-group-toggle .btn-secondary { + background-color: transparent !important; + border: 0 !important; + color: var(--muted) !important; + border-radius: 5px !important; + font-size: .84rem; + padding: .28rem .72rem; + box-shadow: none !important; + transition: background-color .15s ease, color .15s ease; } -.scrollable { - overflow-y: scroll; - overflow-x: hidden; +.btn-group-toggle .btn-secondary:hover { + color: var(--fg-bright) !important; + background-color: rgba(255, 255, 255, 0.05) !important; } -.tilePane { - border: gray solid thin; - margin: .5rem 0; - height: 21.5rem; - border-radius: .25rem; - padding: .3rem; +.btn-group-toggle .btn-secondary.active { + background-color: var(--accent) !important; + color: #ffffff !important; + font-weight: 700; } -.tilePane p { - margin: 0; +/* Form controls */ +.form-control, +input[type="text"], +input[type="number"], +select, +textarea, +.dropdown { + background-color: var(--bg-input) !important; + color: var(--fg-bright) !important; + border: 1px solid var(--border) !important; + border-radius: 6px; + font-size: .86rem; + padding: .28rem .5rem; } -.dice { - display: flex; - justify-content: flex-end; - margin: .2em 0; - padding: 0 .5em; +.form-control:focus, +input[type="text"]:focus, +input[type="number"]:focus, +select:focus, +textarea:focus { + border-color: var(--accent-hover) !important; + box-shadow: 0 0 0 3px var(--accent-glow) !important; + outline: none; } -.dice p { - display: inline; - font-weight: bold; +.form-control::placeholder, +input::placeholder, +textarea::placeholder { + color: var(--muted); } -.dice input { - margin: 0 .3rem 0 0; +input[type="range"] { + -webkit-appearance: none; + appearance: none; + height: 5px; + border-radius: 999px; + background: var(--bg-input); + border: 1px solid var(--border); + outline: none; + cursor: pointer; } -/*Classes for the dynamic divs*/ -/*-------------------------------*/ +input[type="range"]::-webkit-slider-thumb { + -webkit-appearance: none; + appearance: none; + width: 14px; + height: 14px; + border-radius: 50%; + background: #38bdf8; + border: 2px solid #0f172a; + cursor: pointer; +} -.dynamicDiv { - min-height: 2.7rem; - border-radius: 0.25rem; - background-color: rgb(240,240,240); - position: relative; - margin: .2rem 0; +input[type="range"]::-moz-range-thumb { + width: 14px; + height: 14px; + border-radius: 50%; + background: #38bdf8; + border: 2px solid #0f172a; + cursor: pointer; } -.textbox { - border-radius: 0.25rem; - text-align: center; - min-width: 1em; - padding: .1em 0em; - font-size: small; +input[type="checkbox"] { + accent-color: #0ea5e9; + width: 16px; + height: 16px; } -.dynamicButton { - position: absolute; - width: 1.5rem; - height: 1.5rem; - border: thin black solid; - border-radius: .6rem; +.scrollable { + overflow-y: auto; + overflow-x: hidden; } -/*Classes for the token manager*/ -/*-------------------------------*/ +/* Lower panels: Token Manager + Player Broadcast HUD */ +.bottomPanelsGrid { + display: grid; + grid-template-columns: minmax(290px, 380px) 1fr; + gap: .85rem; + margin-top: .85rem; +} -.circleHandle { - width: 1.25rem; - height: 1.25rem; - border-radius: 1.25rem; - position: absolute; - left: .25rem; - top: .625rem; - overflow: hidden; +@media (max-width: 991px) { + .bottomPanelsGrid { + grid-template-columns: 1fr; + } } -.coneHandle { - width: 0; - height: 0; +.tilePane { + background-color: var(--bg-panel); + border: 1px solid var(--border); + border-radius: var(--radius); + padding: .75rem .9rem; + height: 23.5rem; + display: flex; + flex-direction: column; + box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22); +} - position: absolute; - left: .25rem; - top: .625rem; +.tileHeader { + display: flex; + align-items: center; + justify-content: space-between; + padding-bottom: .5rem; + margin-bottom: .55rem; + border-bottom: 1px solid var(--border); +} - border-top: .7217rem solid transparent; - border-bottom: .7217rem solid transparent; +#symbolListWrap { + flex: 1 1 auto; + overflow-y: auto; + padding-right: 2px; } -.squareHandle { - width: 1.25em; - height: 1.25rem; - position: absolute; - left: .25rem; - top: .625rem; - overflow: hidden; +/* Hume / Reality Density Meter */ +.humeCard { + background-color: var(--bg-input); + border: 1px solid var(--border); + border-radius: 7px; + padding: .6rem .75rem; + margin-bottom: .7rem; } -.deleteButton { - right: .25rem; - top: .6rem; - background: white url('assets/icons/trash-fill.svg'); - background-size: 1rem 1rem; - background-repeat: no-repeat; - background-position: center; +.humeHeader { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: .5rem; + margin-bottom: .35rem; } -/*Classes for the music manager*/ -/*-------------------------------*/ +.humeTitle { + font-size: .8rem; + text-transform: uppercase; + letter-spacing: .05em; + color: var(--muted); + font-weight: 700; +} -.indented { - margin-left: 5%; - width: 95%; +.humeReadout { + display: inline-flex; + align-items: baseline; + gap: .45rem; } -.playButton { - left: 75%; - top: .75rem; +.humeValue { + font-size: 1.15rem; + font-weight: 700; + color: var(--fg-bright); +} - background: white url('assets/icons/play-fill.svg'); - background-size: 1rem 1rem; - background-repeat: no-repeat; - background-position: center; +.humeStatus { + font-size: .75rem; + padding: .1rem .4rem; + border-radius: 4px; + background-color: rgba(56, 189, 248, 0.14); + color: #7dd3fc; } -.pauseButton { - left: 87.5%; - top: .75rem; +.humeScaleBarWrap { + position: relative; + height: 8px; + border-radius: 999px; + background: linear-gradient(90deg, #dc2626 0%, #c026d3 10%, #10b981 18%, #0ea5e9 45%, #f59e0b 80%, #fef08a 100%); + margin: .45rem 0 .25rem 0; + overflow: hidden; + border: 1px solid rgba(255, 255, 255, 0.12); +} - background: white url('assets/icons/pause-fill.svg'); - background-size: 1rem 1rem; - background-repeat: no-repeat; - background-position: center; +.humeScaleFillMask { + position: absolute; + top: 0; + right: 0; + bottom: 0; + background: rgba(15, 17, 22, 0.78); + transition: width .12s ease; } -.songExpander { - left: 5%; - top: .75rem; +.humeTicks { + display: flex; + justify-content: space-between; + font-size: .7rem; + color: var(--muted); +} - background: white url('assets/icons/caret-down-fill.svg'); - background-size: 1rem 1rem; - background-repeat: no-repeat; - background-position: center; +/* GM Broadcast Notes textarea */ +.notesFieldWrap { + flex: 1 1 auto; + display: flex; + flex-direction: column; + min-height: 0; } -.shufflePlay { - left: 75%; - top: .75rem; +.gmNotesTextarea { + flex: 1 1 auto; + width: 100%; + resize: none; + line-height: 1.45; + padding: .55rem .65rem !important; + font-size: .9rem !important; +} - background: white url('assets/icons/shuffle.svg'); - background-size: 1rem 1rem; - background-repeat: no-repeat; - background-position: center; +/* Dynamic token cards */ +.dynamicDiv { + min-height: 2.85rem; + border-radius: 6px; + background-color: var(--bg-item); + border: 1px solid var(--border); + position: relative; + margin: .28rem 0; + transition: opacity .15s ease, border-color .15s ease; } -.loopPlay { - left: 87.5%; - top: .75rem; +.dynamicDiv.tokenHidden { + opacity: .6; + border-style: dashed; +} - background: white url('assets/icons/arrow-repeat.svg'); - background-size: 1rem 1rem; - background-repeat: no-repeat; - background-position: center; +.textbox { + border-radius: 5px; + text-align: center; + min-width: 1em; + padding: .15em .25em; + font-size: .8rem; + background-color: var(--bg-input); + color: var(--fg-bright); + border: 1px solid var(--border); } -.songName { +.dynamicButton { position: absolute; - left: 10%; - width: 60%; - top: .2em; - color: rgb(130,130,130); - text-align: center; + width: 1.55rem; + height: 1.55rem; + background-color: var(--bg-input); + border: 1px solid var(--border); + border-radius: 5px; + cursor: pointer; + padding: 0; } -.playlistName { +.dynamicButton:hover { + background-color: var(--accent); + border-color: var(--accent-hover); +} + +.dynamicButton::after { + content: ""; position: absolute; - left: 15%; - width: 55%; - top: .75em; - color: rgb(130,130,130); - text-align: center; - font-weight: bold; + inset: 0; + background-color: var(--fg-bright); + -webkit-mask-position: center; + -webkit-mask-repeat: no-repeat; + -webkit-mask-size: .95rem .95rem; + mask-position: center; + mask-repeat: no-repeat; + mask-size: .95rem .95rem; } -.songCurrentPosition { +.dynamicButton:hover::after { + background-color: #ffffff; +} + +.circleHandle { + width: 1.25rem; + height: 1.25rem; + border-radius: 1.25rem; position: absolute; - top: 2.2em; - color: rgb(130,130,130); - text-align: center; - left: 2.5%; - width: 15%; + left: .35rem; + top: .7rem; + overflow: hidden; } -.songTotalLength { +.coneHandle { + width: 0; + height: 0; position: absolute; - top: 2.2em; - color: rgb(130,130,130); - text-align: center; - left: 62.5%; - width: 15%; + left: .35rem; + top: .65rem; + border-top: .7217rem solid transparent; + border-bottom: .7217rem solid transparent; } -.songProgressBar { +.squareHandle { + width: 1.25rem; + height: 1.25rem; position: absolute; - left: 10%; - width: 60%; - top: 1.4em; + left: .35rem; + top: .7rem; + overflow: hidden; } -#canvas { - border: thin rgba(140,140,140) dashed; +.eyeButton { + right: 2.1rem; + top: .62rem; } -#canvasHolder { - min-height: 45vh; +.eyeButton::after { + -webkit-mask-image: url('bootstrapIcons/eye-fill.svg'); + mask-image: url('bootstrapIcons/eye-fill.svg'); } -#musicExplanation { - padding: .5rem 1rem; +.eyeButton.isHidden { + background-color: #4d320e; + border-color: #b87b23; } -#musicLoadingDiv { - display: flex; - justify-content: space-between; - align-items: center; - padding: .25rem .5rem; +.eyeButton.isHidden::after { + -webkit-mask-image: url('bootstrapIcons/eye-slash-fill.svg'); + mask-image: url('bootstrapIcons/eye-slash-fill.svg'); + background-color: #f3c16c; } -#dicePane { - width: 13rem; +.deleteButton { + right: .32rem; + top: .62rem; } -#diceSubmitBox { - display: flex; - justify-content: center; +.deleteButton::after { + -webkit-mask-image: url('assets/icons/trash-fill.svg'); + mask-image: url('assets/icons/trash-fill.svg'); +} + +#canvasHolder { + min-height: 45vh; + background-color: var(--bg-canvas); + padding: .5rem; +} + +#canvas { + border: 1px dashed var(--border); + border-radius: 4px; +} + +#symbolMenu { + width: 100%; }
@@ -1,865 +1,12 @@
<!DOCTYPE html> - -<html> +<html lang="ru"> <head> - <!-- Global site tag (gtag.js) - Google Analytics --> - <!-- <script async src="https://www.googletagmanager.com/gtag/js?id=G-5FWK5WHN2R"></script> --> - <!-- <script> --> - <!-- window.dataLayer = window.dataLayer || []; --> - <!-- function gtag(){dataLayer.push(arguments);} --> - <!-- gtag('js', new Date()); --> - - <!-- gtag('config', 'G-5FWK5WHN2R'); --> - <!-- </script> --> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> - <meta name="description" content="The GM View is where simplyRPG's magic happends. Place tokens, import maps, play music and more with this convenient interface."> - <title>simplyRPG</title> - <link rel="icon" href="assets/images/small-logo.png"> - - <!-- boostrap CSS --> - <link href="./libraries/bootstrap/bootstrap.css" rel="stylesheet"> - <!-- simplyRPG CSS --> - <link rel="stylesheet" type="text/css" href="gmView.css"> + <meta http-equiv="refresh" content="0; url=/"> + <title>Redirecting...</title> + <script>window.location.replace("/");</script> </head> - -<body onload="init()" id="mainBody" class="grayBackground"> - -<nav class="navbar navbar-expand-md navbar-dark fixed-top blueBackground"> - <img src="assets/images/logo1-white.png" class="logo"> - <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation"> - <span class="navbar-toggler-icon"></span> - </button> - - <div class="collapse navbar-collapse" id="navbarsExampleDefault"> - <ul class="navbar-nav mr-auto"> - <li class="nav-item"> - <a class="nav-link" href="./index.html">Home</a> - </li> - <li class="nav-item active"> - <a class="nav-link" href="./gmView.html">simplyRPG</a> - </li> - <li class="nav-item"> - <a class="nav-link" href="./supportTheSite.html">Support the Site</a> - </li> - <li class="nav-item"> - <a class="nav-link" href="./faq.html">FAQ</a> - </li> - </ul> - </div> - -</nav> - -<main> - <div class="container"> - - <div class='row'> - <!-- File interaction --> - <div class="col-md-5 col-lg-4 interactionDiv"> - <div class="row"><div class="col-12 centering blueBackground" style="color: white; border-radius: .25rem .25rem 0 0;"><span>File Interaction:</span></div></div> - <div class="row"> - <!-- save --> - <div class="col-5 centering blueBackground" style="border-radius: 0 0 0 .25rem;"> - <span>File Name:</span> - <input type="text" name="saveName" id="saveName" class="" style="width: 6rem; margin-bottom: .4rem"> - </div> - <div class="col-3 centering blueBackground"> - <button id="save" type="button" class="btn btn-light" onclick="saveCanvas()">Save</button> - </div> - <!-- Load --> - <div class="col-4 centering blueBackground" style="border-radius: 0 0 .25rem 0;"> - <button id="load" type="button" class="btn btn-light" onclick="loadCanvas()">Load</button> - </div> - </div> - </div> - - <!-- spacer --> - <div class="col-1"></div> - - <!-- Canvas setup --> - <div class="col-md-6 col-lg-7 blueBackground interactionDiv"> - <div class="col-12 centering" style="color: white"><span>Canvas Setup:</span></div> - <div class="row"> - <!-- Import background Image --> - <div class="col-lg-5 centering"> - <label for="mapImageFile" class="buttonMimic">Import Background Image</label> - <input type="file" name="mapImageFile" id="mapImageFile" onchange="loadMapImageFromButton(event)" class="fileUpload"> - </div> - <div class="col-lg-7"><div class="row"> - <!-- Grid Draw --> - <div class="col-sm-6 centering"><div class="centering"> - <span>Draw Grid:</span> - <input type="checkbox" id="includeGrid" style="color: white; border-radius: .25rem" onchange="updateGridFromButton()"> - </div></div> - <!-- Map Scale --> - <div class="col-sm-6 centering"><div class="centering"> - <span id="canvasScaleLabel">Map Scale: 5px/ft</span> - <input type="range" min="1" max="15" value="5" id="canvasScale" oninput="updateCanvasScaleFromSlider()"> - </div></div> - </div></div> - </div> - - <div class="row"> - <!-- clear canvas --> - <div class="col-sm-6 centering"> - <button class="btn btn-light" style="margin: .5rem" onclick="clearCanvas()">Clear Canvas</button> - </div> - <!-- launch player view --> - <div class="col-sm-6 centering"> - <button class="btn btn-light" style="margin: .5rem" onclick="createMirrorWindow()">Launch Player View</button> - </div> - </div> - </div> - </div> - </div> - - <!-- top of the encounter map --> - <div class="blueBackground upperMapSettings row"> - <!-- choose the interactive mode --> - <div class="col-sm-7 col-md-5 col-lg-4 col-xl-4"><div class="centering"> - <div class="btn-group btn-group-toggle" style="margin: .5rem" data-toggle="buttons"> - <label class="btn btn-secondary active"> - <input type="radio" id="circleMoving" onclick="circleMoving()" autocomplete="off" checked> Move - </label> - <label class="btn btn-secondary"> - <input type="radio" id="measureMode" onclick="measureMode()" autocomplete="off"> Measure - </label> - <label class="btn btn-secondary"> - <input type="radio" id="lineDrawing" onclick="lineDrawing()" autocomplete="off"> Draw - </label> - <label class="btn btn-secondary"> - <input type="radio" onclick="lineErasing()" autocomplete="off"> Erase - </label> - </div> - </div></div> - - <!-- choose the size and color for drawing --> - <div class="col-sm-4 col-md-3 col-lg-2 col-xl-2"><div class="centering"> - <div class="verticalDiv" style="margin: .25rem 0 .4rem 0;"> - <select name="drawSize" id = "drawSize" class="dropdown"> - <option value=2>Small</option> - <option value=5>Medium</option> - <option value=10>Large</option> - </select> - <select name="drawColor" id = "drawColor" class="dropdown"> - <option value="black">black</option> - <option value="blue">blue</option> - <option value="red">red</option> - <option value="green">green</option> - </select> - </div> - </div></div> - </div> - - <!-- encounter map --> - <div id='canvasHolder' class="whiteBackground row centering"> - <canvas id="canvas" width="320" height="180"></canvas> - </div> - - <!-- bottom of the encounter map --> - <div class="blueBackground lowerMapSettings row"> - <div class="col-lg-7"><div class="row"> - <!-- add new token --> - <div class="col-sm-4"><div class="centering"> - <button type="button" type="button" class="btn btn-light" style="margin: .5rem 0;" onclick="drawNewCircleFromButton()">Add New Token</button> - </div></div> - <!-- choose token type --> - <div class="col-7 col-sm-4"><div class="centering"><div class="centering"> - <label for="circleShape" style="margin: 0;">Type: </label> - <select name="circleShape" id="circleShape" class="dropdown"> - <option value="circle">Circle</option> - <option value="square">Square</option> - <option value="cone">Cone</option> - <option value="customCircle">Character Token</option> - <option value="custom">Custom</option> - </select> - </div></div></div> - <!-- choose token color --> - <div class="col-5 col-sm-4"><div class="centering"><div class="centering"> - <label for="circleColor" style="margin:0;">Color: </label> - <select name="circleColor" id="circleColor" class="dropdown"> - <option value="red">Red</option> - <option value="green">Green</option> - <option value="blue">Blue</option> - <option value="black">Black</option> - </select> - </div></div></div> - </div></div> - <div class="col-lg-5"><div class="row"> - <!-- choose token opacity --> - <div class="col-6"><div class="centering"><div class="centering"> - <span for="circleTransparency" id="circleTransparencyLabel" style="margin: .5rem 0 0 0;">Opacity: 100%</span> - <input type="range" min="0" max="100" value="100" step="10" id="circleTransparency" style="margin: 0 0 .5rem 0;" oninput="updateCircleTransparencyLabel()"> - </div></div></div> - <!-- choose token size --> - <div class="col-6"><div class="centering"><div class="centering"> - <span for="circleSize" id="circleSizeLabel" style="margin: .5rem 0 0 0;">Size: 5ft</span> - <input type="range" min="2.5" max="50" value="5" step="2.5" id="circleSize" style="margin: 0 0 .5rem 0;" oninput="updateCircleSliderLabel()"> - </div></div></div> - </div></div> - </div> - - - <!-- lower half of the page --> - <div class="row"> - <!-- symbol manager --> - <div class="col-md-6 col-lg-4"><div class="centering"> - <div id='symbolMenu' class="tilePane whiteBackground scrollable" style="width: 18rem"> - <h6>Token Manager</h6> - <hr class="blueBackground"> - </div> - </div></div> - - <!-- dice roller --> - <div class="col-md-6 col-lg-4"><div class="centering"> - <div id="dicePane" class="tilePane whiteBackground" style="overflow: hidden;"> - <h6>🎲 Roller</h6> - <hr class="blueBackground"> - <div class="dice"> - <p>d4 x </p> - <input type="number" id="d4" name="d4" min="0" style="width: 2.5rem; height: 1.5rem"> - <p>= </p> - <input type="number" id="d4 total" name="d4 total" min="0" onchange="sumDiceTypes()" style="width: 2.5rem; height: 1.5rem"> - </div> - <div class="dice"> - <p>d6 x </p> - <input type="number" id="d6" name="d6" min="0" style="width: 2.5rem; height: 1.5rem"> - <p>= </p> - <input type="number" id="d6 total" name="d6 total" min="0" onchange="sumDiceTypes()" style="width: 2.5rem; height: 1.5rem"> - </div> - <div class="dice"> - <p>d8 x </p> - <input type="number" id="d8" name="d8" min="0" style="width: 2.5rem; height: 1.5rem"> - <p>= </p> - <input type="number" id="d8 total" name="d8 total" min="0" onchange="sumDiceTypes()" style="width: 2.5rem; height: 1.5rem"> - </div> - <div class="dice"> - <p>d10 x </p> - <input type="number" id="d10" name="d10" min="0" style="width: 2.5rem; height: 1.5rem"> - <p>= </p> - <input type="number" id="d10 total" name="d10 total" min="0" onchange="sumDiceTypes()" style="width: 2.5rem; height: 1.5rem"> - </div> - <div class="dice"> - <p>d12 x </p> - <input type="number" id="d12" name="d12" min="0" style="width: 2.5rem; height: 1.5rem"> - <p>= </p> - <input type="number" id="d12 total" name="d12 total" min="0" onchange="sumDiceTypes()" style="width: 2.5rem; height: 1.5rem"> - </div> - <div class="dice"> - <p>d20 x </p> - <input type="number" id="d20" name="d20" min="0" style="width: 2.5rem; height: 1.5rem"> - <p>= </p> - <input type="number" id="d20 total" name="d20 total" min="0" onchange="sumDiceTypes()" style="width: 2.5rem; height: 1.5rem"> - </div> - <div class="dice"> - <p>d100 x </p> - <input type="number" id="d100" name="d100" min="0" style="width: 2.5rem; height: 1.5rem"> - <p>= </p> - <input type="number" id="d100 total" name="d100 total" min="0" onchange="sumDiceTypes()" style="width: 2.5rem; height: 1.5rem"> - </div> - <hr style="height: .2rem; background-color: gray "> - <div class="dice"> - <p>Total: </p> - <input type="number" id="dice total" name="dice total" min="0" style="width: 3em"> - </div> - <div id="diceSubmitBox"> - <button id="diceSubmit" type="button" class="btn btn-primary btn-sm" onclick="rollDice()">Roll</button> - </div> - </div> - </div></div> - - <!-- music player --> - <div class="col-md-12 col-lg-4"><div class="centering"> - <div class="tilePane whiteBackground scrollable" id="musicMenu" style="width: 18rem"> - <h6>♪ Player</h6> - <hr class="blueBackground"> - <div id="musicLoadingDiv" class="rounded blueBackground"> - <div> - <label for="loadMusicButton" type="button" class="buttonMimic" style="margin: 0.25em 0">Import Music</label> - <input type="file" webkitdirectory mozdirectory name="loadMusicButton" id="loadMusicButton" onchange="loadMusic(event)" class="fileUpload"> - </div> - <div class="centering"><div class="centering"> - <label style="margin: 0">Volume: </label> - <input type="range" name="volumeSlider" min="0" max="1" step=".05" id="volumeSlider" oninput="updateVolume()" style="width: 6rem"> - </div></div> - </div> - <div id="musicExplanation"> - <p>Upload a folder containing music. Each music file should be in one of the following formats: .m4a, .mp3, or .mp4. - Create playlists by including subfolders. For example:</p> <br> - <p>Music Folder</p> - <p>--- Playlist 1 Folder</p> - <p>------ Song 1</p> - <p>------ Song 2</p> - <p>------ Song 3</p> - <p>--- Playlist 2 Folder</p> - <p>------ Song 1</p> - <p>------ Song 2</p> - </div> - </div> - </div></div> - </div> - <hr> - </div> -</main> - -<footer class="container footer"> - <span class="footer"> simplyRPG is powered by:</span><br> - <span class="footer"><a href="https://createjs.com/" target="_blank">createJS</a> and <a href="https://createjs.com/easeljs" target="_blank">easelJs</a></span><br> - <span class="footer"><a href="https://getbootstrap.com/" target="_blank">Bootstrap</a> and <a href="https://icons.getbootstrap.com/" target="_blank">Bootstrap Icons</a></span><br> - <span class="footer"><a href="https://fengyuanchen.github.io/compressorjs/" target="_blank">compressorJS</a></span><br> - <span class="footer">under the <a href="./license.html" target="_blank">MIT License</a></span><br><br> - <img src="assets/images/logo1-normal.png" class="logo"> -</footer> - +<body style="background:#222;color:#bbb;font-family:monospace;"> + <a href="/">Go to simplyRPG</a> </body> - -<!-- Import boostrap javascript --> -<script src="./libraries/bootstrap/jquery-3.5.1.slim.min.js"></script> -<script src="./libraries/bootstrap/bootstrap.js"></script> -<!-- Import compression javascript --> -<script src="./libraries/compressor.min.js"></script> -<!-- Import simplyRPG JavaScript --> -<script src="./libraries/fakeBroadcastPolyfill.js"></script> -<script src="./libraries/easeljs.js"></script> -<script src="./libraries/canvasModule.js"></script> -<script src="./libraries/dynamicDivModule.js"></script> - -<script> - let stage; - - globs.musicManager = { - musicHandles: [], - playlistHandles: [], - songsToPlayNext: [], - categorizedPlaylists: {}, - activeAudio: new Audio(), - activeMusicHandle: null, - activePlaylistHandle: null, - pauseAutoSliderUpdates: false, - - addMusic: function(musicObject) { - //The music object has 3 properties and is produce in the loadMusic() function - //file = an html File object - //name = the name of the music file - //playlist = the name of the playlist associated with this song, possibly non - - //Get a list the playlists that already exist - let playlists = []; - for (let i=0;i<this.playlistHandles.length;i+=1) { - playlists.push(this.playlistHandles[i].playlist) - } - - //If this type of playlist does not exist, create the Handle for it - if (!playlists.includes(musicObject.playlist)) { - let playlistHandle = new PlaylistHandle(musicObject,this.playlistHandles.length); - this.playlistHandles.push(playlistHandle); - this.categorizedPlaylists[playlistHandle.playlist] = []; - } - - let musicHandle = new MusicHandle(musicObject,this.musicHandles.length); - this.musicHandles.push(musicHandle); - this.categorizedPlaylists[musicHandle.playlist].push(musicHandle); - } - } - - function init() { - globs.windowLocation = "main"; - stage = new createjs.Stage("canvas"); - createjs.Touch.enable(stage); - stage.mouseMoveOutside = true; - - setupCanvas(); - setupAudio(); - circleMoving(); //start in circle moving mode - broadcastChannel.bc.onmessage=handleCanvasUpdates; - window.onresize = resizeCanvas; - } - - function handleCanvasUpdates (event) { - let broadcastMetadata = event.data[0]; - let broadcastData = event.data[1]; - - if (broadcastMetadata[2] == 'encounterMap') { - applyBroadcast(broadcastData,broadcastMetadata[0],broadcastMetadata[1]); - } - } - - function loadMapImageFromButton(event) { - let mapImage = event.target.files[0]; - loadMapImage(mapImage); - broadcastChannel.postMessage(['loadMap',mapImage]); - } - - function resizeCanvasFromButton() { - let sizeConverter = { - small:[320,180], - medium:[640,360], - large:[960,540], - xlarge:[1280,720] - } - xy = sizeConverter[document.getElementById('mapSize').value]; - x = xy[0];y = xy[1]; - resizeCanvas(x,y); - broadcastChannel.postMessage(["resizeCanvas",x,y]); - } - - function updateGridFromButton() { - checkboxValue = document.getElementById('includeGrid').checked; - updateGrid(checkboxValue,document.getElementById("canvasScale").value); - broadcastChannel.postMessage(['toggleGrid',checkboxValue,document.getElementById("canvasScale").value]); - } - - function updateCanvasScaleFromSlider () { - let pxPerFoot = document.getElementById("canvasScale").value; - updateCanvasScale(pxPerFoot); - updateCanvasScaleLabel() - broadcastChannel.postMessage(['updateScale',pxPerFoot]); - } - - function drawNewCircleFromButton () { - let circleDiameter = document.getElementById('circleSize').value; - let circleColor = document.getElementById("circleColor").value; - if (document.getElementById("circleText")) { - circleText = document.getElementById("circleText").value; - } else { - circleText = ''; - } - let circleType = document.getElementById("circleShape").value; - let circleTransparency = document.getElementById("circleTransparency").value; - - colorConverter = { - 'red': `rgba(255,0,0,${circleTransparency/100})`, - 'green': `rgba(0,128,0,${circleTransparency/100})`, - 'blue': `rgba(0,0,255,${circleTransparency/100})`, - 'black': `rgba(0,0,0,${circleTransparency/100})` - } - - circleColor = colorConverter[circleColor]; - - drawNewCircle(circleDiameter,circleColor,circleText,'main',circleType); - broadcastChannel.postMessage(['newCircle',circleDiameter,circleColor,circleText,circleType]); - } - - function postLabels () { - //Posts the labels of all the circles so they can be updated in the window - let message = ['labelUpdate',[]]; - for (let i=0;i<globs.circleHandles.length;i+=1) { - let circleHandle = globs.circleHandles[i]; - if (circleHandle) { - let label = circleHandle.namedSubElements.labelbox.value; - message[1].push(label) - } else { - message[1].push(null) - } - } - broadcastChannel.postMessage(message); - } - function updateCircleSliderLabel() { - let circleSize = document.getElementById("circleSize").value; - const newText = `Size: ${circleSize}ft`; - document.getElementById("circleSizeLabel").innerHTML = newText; - } - - function updateCircleTransparencyLabel() { - let circleOpacity = document.getElementById("circleTransparency").value; - const newText = `Opacity: ${circleOpacity}%`; - document.getElementById("circleTransparencyLabel").innerHTML = newText; - } - - function updateCanvasScaleLabel() { - let pxPerFoot = document.getElementById("canvasScale").value; - const newText = `Map Scale: ${pxPerFoot}px/ft`; - document.getElementById("canvasScaleLabel").innerHTML = newText; - } - - function createMirrorWindow () { - myWindow = window.open("./encounterMap.html","Encounter Map"); - } - - //Begin javascript for saving/loading the canvas - function saveCanvasState () { - //Saves the location of current tokens, measurers and lines - //Also saves metadataa like the map size, if the grid is drawn, etc. - - let saveObject = { - backgroundImageBoolean: null, - canvasSize: [globs.canvasX,globs.canvasY], - gridDrawnBoolean: document.getElementById('includeGrid').checked, - mapScale: globs.pxPerFoot, - circles: [], - lines: [], - measurer: null, - } - - //Save whether or not a background image exists - if (globs.backgroundBitmap) { - saveObject.backgroundImageBoolean = true; - } else { - saveObject.backgroundImageBoolean = false; - } - - //Save current circles - for (let i=0; i < globs.circleHandles.length; i+=1) { - let circleHandle = globs.circleHandles[i]; - if (circleHandle) { - let circle = circleHandle.namedSubElements.circle; - - let circleDiameter = circle.circleRadius*2; - let circleColor= circle.circleColor; - let circleText = circle.circleText; - let circleNotes = circleHandle.namedSubElements.notesBox.value; - let circleX = circle.dragObject.x; - let circleY = circle.dragObject.y; - let circleType = circle.circleType; - let circleRotation = circle.dragObject.rotation; - - saveObject.circles.push([circleDiameter,circleColor,circleText,circleNotes,circleX,circleY,circleType,circleRotation]); - } - } - - //Save current lines - for (let i=0; i < drawer.lineSegments.length; i+=1) { - let lineSegment = drawer.lineSegments[i]; - - let startX = lineSegment.startX; - let endX = lineSegment.endX; - let startY = lineSegment.startY; - let endY = lineSegment.endY; - let width = lineSegment.width; - let color = lineSegment.color; - - saveObject.lines.push([startX,endX,startY,endY,width,color]); - } - - //Save the current measurer - if (measurer.currentLine) { - let startX = measurer.currentLine.startX; - let endX = measurer.currentLine.endX; - let startY = measurer.currentLine.startY; - let endY = measurer.currentLine.endY; - - saveObject.measurer = [startX,endX,startY,endY]; - } - return saveObject; - } - - function loadCanvasState (saveObject, tokenImages) { - - //Load in the previous map scale - updateCanvasScale(saveObject.mapScale); - updateCanvasScaleLabel() - broadcastChannel.postMessage(['updateScale',saveObject.mapScale]); - - //Draw the grid if appropriate - document.getElementById('includeGrid').checked = saveObject.gridDrawnBoolean; - updateGridFromButton() - - //Calculate a rescale factor - let preSaveX; let preSaveY; - preSaveX = saveObject.canvasSize[0]; preSaveY = saveObject.canvasSize[1]; - - let loadRescale = globs.canvasY/preSaveY; - - //Redraw circles from memory - let imageIDX = 0; - for (let i=0; i < saveObject.circles.length; i+=1) { - let circleDiameter = saveObject.circles[i][0]; - let circleColor= saveObject.circles[i][1]; - let circleText = saveObject.circles[i][2]; - let circleNotes = saveObject.circles[i][3]; - let circleX = saveObject.circles[i][4]*loadRescale; - let circleY = saveObject.circles[i][5]*loadRescale; - let circleType = saveObject.circles[i][6]; - let circleRotation = saveObject.circles[i][7]; - - if (circleType === 'customCircle' || circleType === 'custom') { - //Save the appropirate image files and token handles for later to introduce the images - //It is important to do this last because it happens when an event listener fires, so we otherwise end up in a race condition - let tokenImage = tokenImages[imageIDX]; - drawNewCircle(circleDiameter,circleColor,circleText,'main',circleType,circleNotes,tokenImage); - broadcastChannel.postMessage(['newCircle',circleDiameter,circleColor,circleText,circleType]); - broadcastChannel.postMessage(['manuallyAppendImage',i,tokenImage]); - imageIDX += 1; - } else { - drawNewCircle(circleDiameter,circleColor,circleText,'main',circleType,circleNotes); - broadcastChannel.postMessage(['newCircle',circleDiameter,circleColor,circleText,circleType]); - } - - let circleHandle = globs.circleHandles[i]; - circleHandle.updateLocation(circleX,circleY) - broadcastChannel.postMessage(['moveCircle',i,circleX,circleY]); - circleHandle.updateRotation(circleRotation); - broadcastChannel.postMessage(['newRotation',i,circleRotation]); - } - - //Redraw lines from memory - for (let i=0; i < saveObject.lines.length; i+=1) { - let lineSegment = saveObject.lines[i]; - - let startX = lineSegment[0]*loadRescale; - let endX = lineSegment[1]*loadRescale; - let startY = lineSegment[2]*loadRescale; - let endY = lineSegment[3]*loadRescale; - let width = lineSegment[4]; - let color = lineSegment[5]; - - drawSingleLine (startX,endX,startY,endY,width,color) - broadcastChannel.postMessage(['drawLine',startX,endX,startY,endY,width,color]); - } - - //Redraw measurer from memory - if (saveObject.measurer) { - let startX = saveObject.measurer[0]*loadRescale; - let endX = saveObject.measurer[1]*loadRescale; - let startY = saveObject.measurer[2]*loadRescale; - let endY = saveObject.measurer[3]*loadRescale; - - drawSingleMeasurer(startX,endX,startY,endY); - broadcastChannel.postMessage(['drawMeasurer',startX,endX,startY,endY]); - } - } - - function saveCanvas () { - let saveObject = saveCanvasState(); - - // Generate and download a file containing all the necessary information to replicate this canvas - let filesToSave = []; - if (globs.imageSrc) { - filesToSave.push(globs.imageSrc); - saveObject.fileStartIndexes = [0,globs.imageSrc.size]; //record the beginning of each file, relative to the // sybmol - } else { - saveObject.fileStartIndexes = [0]; //record the beginning of each file, relative to the // sybmol - } - - for (let i =0; i < globs.circleHandles.length; i+= 1) { - let circleHandle = globs.circleHandles[i]; - if (circleHandle) { - let imageFile = circleHandle.namedSubElements.circle.compressedImage; - if (imageFile) { - saveObject.fileStartIndexes.push(saveObject.fileStartIndexes[saveObject.fileStartIndexes.length-1]+imageFile.size); - filesToSave.push(imageFile); - } - } - } - - - saveObject = JSON.stringify(saveObject) + '//'; - filesToSave.unshift(saveObject); //append the save object to the beginning of the file list - - let filename = document.getElementById("saveName").value; - if (!filename) { - filename = 'Unnamed' - } - - toSave = new File(filesToSave,filename); - let toSavePath = URL.createObjectURL(toSave); - download(filename+'.ttrpg',toSavePath); - } - - function loadCanvas () { - let element = document.createElement('input'); - element.setAttribute('type', 'file'); - element.style.display = 'none'; - element.onchange = handleCanvasLoad; - document.body.appendChild(element); - element.click(); - document.body.removeChild(element); - } - - function handleCanvasLoad() { - function subHandleCanvasLoad() { - globs.imageCompression = false; //turn off image compression because the images where already compressed the first time - broadcastChannel.postMessage(["toggleImageCompression"]) //turn image compression off for the encounter map, if it exists - borderIndex = fileReader.result.indexOf("//"); - - imageContents = savedFile.slice(borderIndex+2,savedFile.size) - jsonContents = fileReader.result.slice(0,borderIndex); - jsonContents = JSON.parse(jsonContents); - - let savedImages = []; - for (let i=0; i < jsonContents.fileStartIndexes.length; i+=1) { - if (i < jsonContents.fileStartIndexes.length - 1.1) { - savedImages.push(imageContents.slice(jsonContents.fileStartIndexes[i],jsonContents.fileStartIndexes[i+1])) - } else { - //The last file needs to be treated a littledifferently - savedImages.push(imageContents.slice(jsonContents.fileStartIndexes[i],imageContents.size)) - } - } - - if (jsonContents.backgroundImageBoolean) { - backgroundImage = savedImages[0]; - savedImages.splice(0,1); - loadMapImage(backgroundImage); - broadcastChannel.postMessage(['loadMap',backgroundImage]); - } - - loadCanvasState(jsonContents,savedImages); - globs.imageCompression = true; //turn image compression back on - broadcastChannel.postMessage(["toggleImageCompression"]) //turn image compression back on for the encounter map, if it exists - } - - let savedFile = event.target.files[0]; - - fileReader = new FileReader() - fileReader.onload = subHandleCanvasLoad; - fileReader.readAsText(savedFile); - } - - function download(filename, path) { - var element = document.createElement('a'); - element.setAttribute('href', path); - element.setAttribute('download', filename); - element.style.display = 'none'; - document.body.appendChild(element); - element.click(); - document.body.removeChild(element); - } - - //Begin javascript for the music - function loadMusic(event) { - musicExplanation = document.getElementById("musicExplanation"); - musicExplanation.style.display = "none"; - - let fileDict = event.target.files; - //Convert fileDict object to an array of files; - let fileArray = []; - for (let i=0;i<fileDict.length;i+=1) { - fileArray.push(fileDict[String(i)]) - } - //Filter out only music file types - function filterMusicFiles (fileName) { - const musicTypes = ['.m4a','.mp3','.mp4']; - for (let i=0;i<musicTypes.length;i+=1) { - if (fileName.webkitRelativePath.includes(musicTypes[i])) { - return true - } - } - return false - } - fileArray = fileArray.filter(filterMusicFiles); - - //Restructure as an array of objects - const fileObjectArray = []; - for (let i=0; i<fileArray.length; i+= 1) { - let tmpObject = {file:fileArray[i], - name:fileArray[i].name, - playlist:null}; - //for Mac - splitName = fileArray[i].webkitRelativePath.split("/"); - if (splitName.length > 1) { - tmpObject.playlist = splitName[splitName.length-2]; - } - //for Windows - splitName = fileArray[i].webkitRelativePath.split("\\"); - if (splitName.length > 1) { - tmpObject.playlist = splitName[splitName.length-2]; - } - globs.musicManager.addMusic(tmpObject); - } - } - - function convertSecondsToMinutes (seconds) { - let minutes = Math.floor(seconds/60); - let seconds2 = Math.round(seconds%60); - if (seconds2.toString().length <= 1) { - seconds2 = "0"+seconds2; - } - - return minutes.toString()+":"+seconds2.toString(); - } - - function setupAudio () { - function updateDuration (event) { - let musicHandle = globs.musicManager.activeMusicHandle; - let activeAudio = globs.musicManager.activeAudio; - musicHandle.updateDuration(activeAudio.duration); - } - function updateTime (event) { - if (!globs.musicManager.pauseAutoSliderUpdates) { - let musicHandle = globs.musicManager.activeMusicHandle; - let activeAudio = globs.musicManager.activeAudio; - musicHandle.updateSongTime(activeAudio.currentTime); - } - } - function handleSongEnd (event) { - let musicHandle = globs.musicManager.activeMusicHandle; - let playlistHandle = globs.musicManager.activePlaylistHandle; - let songsToPlay = globs.musicManager.songsToPlayNext; - - if (globs.musicManager.songsToPlayNext.length >= 1) { - globs.musicManager.songsToPlayNext[0].startMusic(false,false); - globs.musicManager.songsToPlayNext.shift() //eliminate the first element from the list - } else { - musicHandle.stopMusic(); - if (playlistHandle) { - playlistHandle.stop(); - } - } - } - globs.musicManager.activeAudio.addEventListener("timeupdate",updateTime); - globs.musicManager.activeAudio.addEventListener("durationchange",updateDuration); - globs.musicManager.activeAudio.addEventListener("ended",handleSongEnd); - } - - function shuffle(array) { - var currentIndex = array.length, temporaryValue, randomIndex; - - // While there remain elements to shuffle... - while (0 !== currentIndex) { - - // Pick a remaining element... - randomIndex = Math.floor(Math.random() * currentIndex); - currentIndex -= 1; - - // And swap it with the current element. - temporaryValue = array[currentIndex]; - array[currentIndex] = array[randomIndex]; - array[randomIndex] = temporaryValue; - } - - return array; - } - - function updateVolume () { - volumeSlider = document.getElementById("volumeSlider"); - globs.musicManager.activeAudio.volume = volumeSlider.value/25; - } - - //Begin javascript for dice roller - function rollDice () { - function rollSingleDie (diceType) { - maxNumber = diceType.slice(1,diceType.length); - return Math.floor(Math.random()*maxNumber)+1 - } - - let diceTypes = ['d4','d6','d8','d10','d12','d20','d100']; - for (let i = 0; i < diceTypes.length; i += 1) { - let numberOfDice = document.getElementById(diceTypes[i]); - let diceTotal = document.getElementById(diceTypes[i]+' total'); - - if (!numberOfDice.value) { - numberOfDice.value = 0; - } - let rolledValue = 0; - for (let ii = 0; ii < numberOfDice.value; ii += 1) { - rolledValue += rollSingleDie(diceTypes[i]); - } - diceTotal.value = rolledValue; - } - sumDiceTypes(); - } - - function sumDiceTypes () { - let diceTypes = ['d4','d6','d8','d10','d12','d20','d100']; - let overallRolledValue = 0; - for (let i = 0; i < diceTypes.length; i += 1) { - let diceTotal = document.getElementById(diceTypes[i]+' total'); - overallRolledValue += parseInt(diceTotal.value); - } - document.getElementById("dice total").value = overallRolledValue; - } - -</script> - -</html>+</html>
@@ -1,49 +0,0 @@
-body { - padding-top: 3rem; - padding-bottom: 3rem; - color: #5a5a5a; -} - - -/* CUSTOMIZE THE CAROUSEL --------------------------------------------------- */ - -/* Carousel base class */ -.carousel { - margin-bottom: 4rem; -} -/* Since positioning the image, we need to help out the caption */ -.carousel-caption { - bottom: 3rem; - z-index: 10; - background-color: rgba(0,0,0,.5); - border-radius: 0.25rem; -} - -/* Declare heights because of positioning of img element */ -.carousel-item { - height: 32rem; - background-color: rgb(180,180,180); -} - -.carousel-image { - width: 100%; - height:100%; - background-position: center; - background-repeat: no-repeat; -} - -.carousel-element { - margin: 1rem .5rem !important; -} - -/* RESPONSIVE CSS --------------------------------------------------- */ - -@media (min-width: 40em) { - .carousel-caption p { - margin-bottom: 1.25rem; - font-size: 1.25rem; - line-height: 1.4; - } -}
@@ -1,178 +1,856 @@
-<!doctype html> -<html lang="en"> - <head> - <!-- Global site tag (gtag.js) - Google Analytics --> - <!-- <script async src="https://www.googletagmanager.com/gtag/js?id=G-5FWK5WHN2R"></script> --> - <!-- <script> --> - <!-- window.dataLayer = window.dataLayer || []; --> - <!-- function gtag(){dataLayer.push(arguments);} --> - <!-- gtag('js', new Date()); --> - - <!-- gtag('config', 'G-5FWK5WHN2R'); --> - <!-- </script> --> +<!DOCTYPE html> +<html lang="ru"> +<head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> - <meta name="description" content="simplyRPG is a free creation tool for encounters in your favorite RPGs. Place tokens, import maps, play music and more with this simple virtual tabletop (VTT). No login or sign-up required."> - <title>simplyRPG Home</title> - <link rel="canonical" href="https://simplyrpg.com"> + <meta name="description" content="simplyRPG VTT — multi-map tabletop board, tokens with visibility toggle, reality density meter, and live GM notes in Player View."> + <title>simplyRPG — rpg.peajack.net</title> <link rel="icon" href="assets/images/small-logo.png"> - <!-- CSS --> - <link href="libraries/bootstrap/bootstrap.css" rel="stylesheet"> - <link href="index.css" rel="stylesheet"> - <!-- simplyRPG CSS --> + <!-- Bootstrap CSS --> + <link href="./libraries/bootstrap/bootstrap.css" rel="stylesheet"> + <!-- Modern Dark VTT CSS --> <link rel="stylesheet" type="text/css" href="gmView.css"> +</head> - </head> -<body> +<body onload="init()" id="mainBody"> -<nav class="navbar navbar-expand-md navbar-dark fixed-top blueBackground"> - <img src="assets/images/logo1-white.png" class="logo"> - <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation"> - <span class="navbar-toggler-icon"></span> - </button> +<header class="topHeader"> + <div class="container d-flex align-items-center justify-content-between"> + <div class="d-flex align-items-center"> + <img src="assets/images/logo1-white.png" class="logo" alt=""> + <a class="topHeaderBrand" href="./">rpg.peajack.net</a> + </div> + <div class="d-flex align-items-center" style="gap: .5rem;"> + <button type="button" class="btn-modern btn-modern-sm" onclick="clearCurrentScene()">Clear Map</button> + <button type="button" class="btn-modern btn-modern-primary btn-modern-sm" onclick="createMirrorWindow()">Launch Player View</button> + </div> + </div> +</header> + +<main> + <div class="container"> - <div class="collapse navbar-collapse" id="navbarsExampleDefault"> - <ul class="navbar-nav mr-auto"> - <li class="nav-item active"> - <a class="nav-link" href="./index.html">Home</a> - </li> - <li class="nav-item"> - <a class="nav-link" href="./gmView.html">simplyRPG</a> - </li> - <li class="nav-item"> - <a class="nav-link" href="./supportTheSite.html">Support the Site</a> - </li> - <li class="nav-item"> - <a class="nav-link" href="./faq.html">FAQ</a> - </li> - </ul> - </div> + <!-- Top Controls Grid --> + <div class="topToolbarGrid"> + <!-- Save / Load --> + <section class="panelCard"> + <div class="panelCardTitle">Session Save / Load</div> + <div class="toolbarRow"> + <input type="text" name="saveName" id="saveName" placeholder="session" style="flex: 1 1 110px; min-width: 90px;"> + <button id="save" type="button" class="btn-modern btn-modern-sm" onclick="saveCanvas()">Save</button> + <button id="load" type="button" class="btn-modern btn-modern-sm" onclick="loadCanvas()">Load</button> + </div> + </section> -</nav> + <!-- Map Setup --> + <section class="panelCard"> + <div class="panelCardTitle">Map & Grid Setup</div> + <div class="toolbarRow justify-content-between"> + <div> + <label for="mapImageFile" class="buttonMimic btn-modern-sm">Import Map Image(s)</label> + <input type="file" accept="image/*" multiple name="mapImageFile" id="mapImageFile" onchange="loadMapImageFromButton(event)" class="fileUpload"> + </div> -<main role="main"> + <div class="fieldGroup"> + <input type="checkbox" id="includeGrid" onchange="updateGridFromButton()"> + <label for="includeGrid" style="margin: 0; cursor: pointer; font-size: .86rem;">Draw Grid</label> + </div> - <div id="myCarousel" class="carousel slide mb-0" data-ride="carousel"> - <ol class="carousel-indicators"> - <li data-target="#myCarousel" data-slide-to="0" class="active"></li> - <li data-target="#myCarousel" data-slide-to="1"></li> - <li data-target="#myCarousel" data-slide-to="2"></li> - </ol> - <div class="carousel-inner"> - <div class="carousel-item active carouselBackground"> - <!-- Use a background image so it will clip from both sides --> - <div class="carousel-image" style="background-image: url(assets/homePage/desertOasis25to9.jpg)"></div> - <!-- <div class="carousel-centering"><img class="carousel-image" src="assets/homePage/desertOasis25to9.jpg"></div> --> - <div class="container"> - <div class="carousel-caption text-left"> - <h1 class="carousel-element">Build encounters in seconds with simplyRPG.</h1> - <p class="carousel-element">No sign-up, distracting ads, or paywalls. simplyRPG is a completely free virtual tabletop (VTT) for tabletop RPGs.</p> - <p class="carousel-element"><a class="btn btn-lg btn-primary" href="./gmView.html" role="button">Get Started</a></p> - </div> + <div class="fieldStack" style="min-width: 155px;"> + <span id="canvasScaleLabel" class="fieldLabel">Map Scale: 5px/ft</span> + <input type="range" min="1" max="15" value="5" id="canvasScale" oninput="updateCanvasScaleFromSlider()"> + </div> + </div> + </section> </div> - </div> - <div class="carousel-item"> - <!-- Use a background image so it will clip from both sides --> - <div class="carousel-image" style="background-image: url(assets/homePage/canalBattle25to9.jpg)"></div> - <div class="container"> - <div class="carousel-caption"> - <h1 class="carousel-element">Play better with front-end only web design.</h1> - <p class="carousel-element">Instead of requiring constant communication with a server, simplyRPG sends code directly to your device where it runs in your browser. This helps maps load quickly, music works seamlessly, and means that you don't rely on us for storage.</p> - </div> + + <!-- Unified Map Workspace --> + <section class="workspaceFrame"> + <!-- Scene / Map Switcher --> + <div id="sceneBar" class="sceneBar"> + <div class="sceneTabs" id="sceneTabs"></div> + <div class="sceneActions"> + <button type="button" id="addSceneBtn" class="sceneActionBtn" title="Добавить новую карту" onclick="addEmptyScene()">+ Карта</button> + <button type="button" id="renameSceneBtn" class="sceneActionBtn" title="Переименовать текущую карту" onclick="renameCurrentScene()">✎</button> + <button type="button" id="deleteSceneBtn" class="sceneActionBtn" title="Удалить текущую карту" onclick="deleteCurrentScene()">×</button> + </div> + </div> + + <!-- Canvas Mode & Brush --> + <div class="upperMapSettings"> + <div class="btn-group btn-group-toggle" data-toggle="buttons"> + <label class="btn btn-secondary active"> + <input type="radio" id="circleMoving" onclick="circleMoving()" autocomplete="off" checked> Move + </label> + <label class="btn btn-secondary"> + <input type="radio" id="measureMode" onclick="measureMode()" autocomplete="off"> Measure + </label> + <label class="btn btn-secondary"> + <input type="radio" id="lineDrawing" onclick="lineDrawing()" autocomplete="off"> Draw + </label> + <label class="btn btn-secondary"> + <input type="radio" onclick="lineErasing()" autocomplete="off"> Erase + </label> + </div> + + <div class="toolbarRow"> + <div class="fieldGroup"> + <span class="fieldLabel">Brush:</span> + <select name="drawSize" id="drawSize" class="dropdown"> + <option value="2">Small</option> + <option value="5">Medium</option> + <option value="10">Large</option> + </select> + <select name="drawColor" id="drawColor" class="dropdown"> + <option value="white">white</option> + <option value="yellow">yellow</option> + <option value="red">red</option> + <option value="blue">blue</option> + <option value="green">green</option> + <option value="black">black</option> + </select> + </div> + </div> + </div> + + <!-- Encounter Canvas --> + <div id='canvasHolder' class="centering"> + <canvas id="canvas" width="320" height="180"></canvas> + </div> + + <!-- Token Creator Bar --> + <div class="lowerMapSettings"> + <button type="button" class="btn-modern btn-modern-primary btn-modern-sm" onclick="drawNewCircleFromButton()">+ Add Token</button> + + <div class="fieldGroup"> + <label for="circleShape" class="fieldLabel">Type:</label> + <select name="circleShape" id="circleShape" class="dropdown"> + <option value="circle">Circle</option> + <option value="square">Square</option> + <option value="cone">Cone</option> + <option value="customCircle">Character Token</option> + <option value="custom">Custom</option> + </select> + </div> + + <div class="fieldGroup"> + <label for="circleColor" class="fieldLabel">Color:</label> + <select name="circleColor" id="circleColor" class="dropdown"> + <option value="red">Red</option> + <option value="green">Green</option> + <option value="blue">Blue</option> + <option value="black">Black</option> + </select> + </div> + + <div class="fieldStack" style="min-width: 120px;"> + <span id="circleTransparencyLabel" class="fieldLabel">Opacity: 100%</span> + <input type="range" min="0" max="100" value="100" step="10" id="circleTransparency" oninput="updateCircleTransparencyLabel()"> + </div> + + <div class="fieldStack" style="min-width: 120px;"> + <span id="circleSizeLabel" class="fieldLabel">Size: 5ft</span> + <input type="range" min="2.5" max="50" value="5" step="2.5" id="circleSize" oninput="updateCircleSliderLabel()"> + </div> + </div> + </section> + + <!-- Lower Two-Column Workspace: Token Manager + Player View HUD --> + <div class="bottomPanelsGrid"> + <!-- Token Manager --> + <section id='symbolMenu' class="tilePane scrollable"> + <div class="tileHeader"> + <h6>Token Manager</h6> + <span class="fieldLabel">👁 скрывает в Player View</span> + </div> + </section> + + <!-- Player View Broadcast Panel: Reality Density + GM Notes --> + <section class="tilePane"> + <div class="tileHeader"> + <h6>Трансляция в Player View</h6> + <button type="button" class="btn-modern btn-modern-sm" onclick="clearGMNotes()">Очистить текст</button> + </div> + + <!-- Reality Density Meter (Hume / Юм) --> + <div class="humeCard"> + <div class="humeHeader"> + <span class="humeTitle">Плотность реальности</span> + <div class="humeReadout"> + <span id="humeStatusBadge" class="humeStatus">Норма</span> + <span id="humeValueDisplay" class="humeValue">1.0 Юм</span> + </div> + </div> + <input type="range" id="humeSlider" min="0.5" max="5" step="0.1" value="1.0" style="width: 100%;" oninput="updateHumeFromSlider()"> + <div class="humeScaleBarWrap"> + <div id="humeScaleFillMask" class="humeScaleFillMask" style="width: 88.9%;"></div> + </div> + <div class="humeTicks"> + <span>0.5 Юм</span> + <span>1.0 (норма)</span> + <span>2.5</span> + <span>5.0 Юм</span> + </div> + </div> + + <!-- GM Notes Broadcast --> + <div class="notesFieldWrap"> + <label for="gmBroadcastNotes" class="fieldLabel" style="margin-bottom: .3rem;">Заметки мастера (видны игрокам в Player View):</label> + <textarea id="gmBroadcastNotes" class="gmNotesTextarea" placeholder="Введите текст для игроков — описание локации, статус аномалии, условия сцены..." oninput="updateGMNotesFromInput()"></textarea> + </div> + </section> </div> - </div> - <div class="carousel-item"> - <!-- Use a background image so it will clip from both sides --> - <div class="carousel-image" style="background-image: url(assets/homePage/iceField25to9.jpg)"></div> - <div class="container"> - <div class="carousel-caption text-right"> - <h1 class="carousel-element">Please support the site.</h1> - <p class="carousel-element">simplyRPG is and always will be completely free. If you're a fan of the service we provide, please consider supporting the site. You're free to contribute however much the site is worth to you.</p> - <p class="carousel-element"><a class="btn btn-lg btn-primary" href="./supportTheSite.html" role="button">Support the Site</a></p> - </div> - </div> - </div> + </div> - <a class="carousel-control-prev" href="#myCarousel" role="button" data-slide="prev"> - <span class="carousel-control-prev-icon" aria-hidden="true"></span> - <span class="sr-only">Previous</span> - </a> - <a class="carousel-control-next" href="#myCarousel" role="button" data-slide="next"> - <span class="carousel-control-next-icon" aria-hidden="true"></span> - <span class="sr-only">Next</span> - </a> - </div> +</main> - <div class="container"> +</body> - <div class="row align-items-center mb-3"> - <div class="col-12 col-md-4"> - <p style="text-align: center; margin: 0; padding: 0"> - Art by these amazing creators: - </p> - </div> - <div class="col-12 col-md-8 row"> - <div class="col-lg-6"> - <p style="text-align: center; margin: 0; padding: 0"> - Background Maps - <a href="https://www.patreon.com/DovekieStudios/" target="_blank">Dovekie Studios</a> - </p> - </div> - <div class="col-lg-6"> - <p style="text-align: center; margin: 0; padding: 0"> - Character Art - <a href="https://www.patreon.com/onlinetabletop/" target="_blank">Online Tabletop</a> - </p> - </div> - </div> - </div> +<!-- Import bootstrap javascript --> +<script src="./libraries/bootstrap/jquery-3.5.1.slim.min.js"></script> +<script src="./libraries/bootstrap/bootstrap.js"></script> +<!-- Import compression javascript --> +<script src="./libraries/compressor.min.js"></script> +<!-- Import simplyRPG JavaScript --> +<script src="./libraries/fakeBroadcastPolyfill.js"></script> +<script src="./libraries/easeljs.js"></script> +<script src="./libraries/canvasModule.js"></script> +<script src="./libraries/dynamicDivModule.js"></script> - <div class="row"> - <div class="col-12"> - <h1 style="text-align: center">What is simplyRPG for?</h1> - </div> - </div> +<script> + let stage; - <div class="row"><div class="col-12"> - <h2 style="text-align: center">Playing online</h2> - </div></div> - <div class="row"><div class="col-12"> - <p>simplyRPG provides a virtual tabletop (VTT) for placing (custom) character tokens, importing battlemaps, playing music, and more. Try combining it with your favorite video chat service to run your online games. The best part, only the game master (GM) needs to be on simplyRPG! Just head on over to the "simplyRPG" tab to create your encounter. When it's ready, click "launch player view" and share your screen to show your players their latest amazing encounter!</p> - </div></div> + globs.scenes = []; + globs.activeSceneIdx = 0; + globs.gmNotes = ""; + globs.humeValue = 1.0; - <div class="row"><div class="col-12"> - <h2 style="text-align: center">Playing in person</h2> - </div></div> - <div class="row"><div class="col-12"> - <p>simplyRPG is designed to display your encounter in two seperate browser tabs: one for players and one for GMs. The player view hides many of the options and buttons that are only useful for the GM, and allows for a professional interface where the encounter is full-screen. Try casting the Player View to a TV or other convenient device, while running the encounter from the GM View. If their screen supports touch, players can even move their own tokens, measure distances, and draw on the map!</p> - </div></div> + function makeBlankScene(name) { + return { + name: name || ("Карта " + (globs.scenes.length + 1)), + backgroundFile: null, + tokenImages: [], + state: { + backgroundImageBoolean: false, + canvasSize: [globs.canvasX || 640, globs.canvasY || 360], + gridDrawnBoolean: false, + mapScale: 5, + circles: [], + lines: [], + measurer: null + } + }; + } - <div class="row"><div class="col-12"> - <h2 style="text-align: center">Playing by post</h2> - </div></div> - <div class="row"><div class="col-12"> - <p>simplyRPG has built-in "save" and "load" buttons which allow you to setup encounters ahead of time and return to them later. Try screen-capturing the map and sending it to your players. When all their moves are in, you can import your save file and get right back in it for the encounter's next round!</p> - </div></div> + function init() { + globs.windowLocation = "main"; + stage = new createjs.Stage("canvas"); + createjs.Touch.enable(stage); + stage.mouseMoveOutside = true; - <hr> - </div> + setupCanvas(); + circleMoving(); + broadcastChannel.bc.onmessage = handleCanvasUpdates; + window.onresize = resizeCanvas; - </main> -</body> -<footer class="container footer"> - <span class="footer"> simplyRPG is powered by:</span><br> - <span class="footer"><a href="https://createjs.com/" target="_blank">createJS</a> and <a href="https://createjs.com/easeljs" target="_blank">easelJs</a></span><br> - <span class="footer"><a href="https://getbootstrap.com/" target="_blank">Bootstrap</a> and <a href="https://icons.getbootstrap.com/" target="_blank">Bootstrap Icons</a></span><br> - <span class="footer"><a href="https://fengyuanchen.github.io/compressorjs/" target="_blank">compressorJS</a></span><br> - <span class="footer">under the <a href="./license.html" target="_blank">MIT License</a></span><br><br> - <img src="assets/images/logo1-normal.png" class="logo"> -</footer> + globs.scenes = [makeBlankScene("Карта 1")]; + globs.activeSceneIdx = 0; + renderSceneTabs(); + renderHumeUI(globs.humeValue); + } -<!-- Import boostrap javascript --> -<script src="libraries/bootstrap/jquery-3.5.1.slim.min.js"></script> -<script src="libraries/bootstrap/bootstrap.js"></script> -</html> + function handleCanvasUpdates(event) { + let broadcastMetadata = event.data[0]; + let broadcastData = event.data[1]; + if (broadcastMetadata[2] == 'encounterMap') { + applyBroadcast(broadcastData, broadcastMetadata[0], broadcastMetadata[1]); + } + } + function renderHumeUI(val) { + const meta = formatHumeMeta(val); + const slider = document.getElementById("humeSlider"); + if (slider) slider.value = meta.clamped.toFixed(1); + const disp = document.getElementById("humeValueDisplay"); + if (disp) disp.textContent = meta.clamped.toFixed(1) + " Юм"; + const badge = document.getElementById("humeStatusBadge"); + if (badge) { + badge.textContent = meta.label; + badge.style.color = meta.color; + badge.style.backgroundColor = meta.bg; + } + const mask = document.getElementById("humeScaleFillMask"); + if (mask) { + mask.style.width = (100 - meta.pct).toFixed(1) + "%"; + } + } + function updateHumeFromSlider() { + const val = parseFloat(document.getElementById("humeSlider").value); + globs.humeValue = isNaN(val) ? 1.0 : val; + renderHumeUI(globs.humeValue); + broadcastChannel.postMessage(['setHume', globs.humeValue]); + } + function updateGMNotesFromInput() { + globs.gmNotes = document.getElementById("gmBroadcastNotes").value; + broadcastChannel.postMessage(['setGMNotes', globs.gmNotes]); + } + + function clearGMNotes() { + const el = document.getElementById("gmBroadcastNotes"); + if (el) el.value = ""; + updateGMNotesFromInput(); + } + + function broadcastHUDState() { + broadcastChannel.postMessage(['setGMNotes', globs.gmNotes || ""]); + broadcastChannel.postMessage(['setHume', globs.humeValue !== undefined ? globs.humeValue : 1.0]); + } + + function stripExtension(filename) { + if (!filename) return "Карта"; + return filename.replace(/\.[^/.]+$/, ""); + } + + function renderSceneTabs() { + const container = document.getElementById("sceneTabs"); + if (!container) return; + container.innerHTML = ""; + + globs.scenes.forEach((scene, idx) => { + const btn = document.createElement("button"); + btn.type = "button"; + btn.className = "sceneTab" + (idx === globs.activeSceneIdx ? " active" : ""); + btn.dataset.sceneIdx = String(idx); + + const nameSpan = document.createElement("span"); + nameSpan.textContent = scene.name; + btn.appendChild(nameSpan); + + const count = idx === globs.activeSceneIdx + ? globs.circleHandles.filter(Boolean).length + : (scene.state && scene.state.circles ? scene.state.circles.length : 0); + if (count > 0) { + const countSpan = document.createElement("span"); + countSpan.className = "sceneTabCount"; + countSpan.textContent = "(" + count + ")"; + btn.appendChild(countSpan); + } + + btn.onclick = function() { + switchScene(idx); + }; + container.appendChild(btn); + }); + + const delBtn = document.getElementById("deleteSceneBtn"); + if (delBtn) { + delBtn.disabled = globs.scenes.length <= 1; + } + } + + function captureCurrentScene() { + const scene = globs.scenes[globs.activeSceneIdx]; + if (!scene) return null; + + const saveObject = saveCanvasState(); + const tokenImages = []; + for (let i = 0; i < globs.circleHandles.length; i += 1) { + const circleHandle = globs.circleHandles[i]; + if (!circleHandle) continue; + const circle = circleHandle.namedSubElements.circle; + if (circle.circleType === 'customCircle' || circle.circleType === 'custom') { + const imgFile = circle.compressedImage || circle.imageFile || null; + if (imgFile) { + tokenImages.push(imgFile); + } + } + } + + const bgFile = globs.imageSrc || scene.backgroundFile || null; + saveObject.backgroundImageBoolean = Boolean(bgFile); + scene.state = saveObject; + scene.backgroundFile = bgFile; + scene.tokenImages = tokenImages; + return scene; + } + + function restoreScene(scene) { + if (!scene) return; + + _clearCanvas(); + broadcastChannel.postMessage(['clearCanvas']); + + const prevCompression = globs.imageCompression; + globs.imageCompression = false; + try { + if (scene.backgroundFile) { + loadMapImage(scene.backgroundFile); + } + loadCanvasState(scene.state, scene.tokenImages || [], false); + } finally { + globs.imageCompression = prevCompression; + } + + broadcastPageElements(); + renderSceneTabs(); + } + + function switchScene(idx) { + if (idx < 0 || idx >= globs.scenes.length) return; + if (idx === globs.activeSceneIdx) return; + + captureCurrentScene(); + globs.activeSceneIdx = idx; + restoreScene(globs.scenes[idx]); + } + + function addEmptyScene() { + captureCurrentScene(); + const nextScene = makeBlankScene("Карта " + (globs.scenes.length + 1)); + globs.scenes.push(nextScene); + globs.activeSceneIdx = globs.scenes.length - 1; + restoreScene(nextScene); + } + + function renameCurrentScene() { + const scene = globs.scenes[globs.activeSceneIdx]; + if (!scene) return; + const nextName = window.prompt("Название карты:", scene.name); + if (nextName && nextName.trim()) { + scene.name = nextName.trim(); + renderSceneTabs(); + } + } + + function deleteCurrentScene() { + if (globs.scenes.length <= 1) return; + const scene = globs.scenes[globs.activeSceneIdx]; + if (!window.confirm('Удалить карту "' + scene.name + '" и её токены?')) { + return; + } + globs.scenes.splice(globs.activeSceneIdx, 1); + if (globs.activeSceneIdx >= globs.scenes.length) { + globs.activeSceneIdx = globs.scenes.length - 1; + } + restoreScene(globs.scenes[globs.activeSceneIdx]); + } + + function clearCurrentScene() { + clearCanvas(); + const scene = globs.scenes[globs.activeSceneIdx]; + if (scene) { + scene.backgroundFile = null; + scene.tokenImages = []; + scene.state.backgroundImageBoolean = false; + scene.state.circles = []; + scene.state.lines = []; + scene.state.measurer = null; + } + document.getElementById('includeGrid').checked = false; + renderSceneTabs(); + } + + function loadMapImageFromButton(event) { + const files = Array.from(event.target.files || []); + if (!files.length) return; + + files.forEach((file, i) => { + if (i === 0) { + const active = globs.scenes[globs.activeSceneIdx]; + if (/^Карта \d+$/.test(active.name)) { + active.name = stripExtension(file.name); + } + loadMapImage(file); + broadcastChannel.postMessage(['loadMap', file]); + } else { + captureCurrentScene(); + const newScene = makeBlankScene(stripExtension(file.name)); + newScene.backgroundFile = file; + newScene.state.backgroundImageBoolean = true; + globs.scenes.push(newScene); + } + }); + + captureCurrentScene(); + renderSceneTabs(); + event.target.value = ""; + } + + function updateGridFromButton() { + const checkboxValue = document.getElementById('includeGrid').checked; + updateGrid(checkboxValue, document.getElementById("canvasScale").value); + broadcastChannel.postMessage(['toggleGrid', checkboxValue, document.getElementById("canvasScale").value]); + } + + function updateCanvasScaleFromSlider() { + let pxPerFoot = document.getElementById("canvasScale").value; + updateCanvasScale(pxPerFoot); + updateCanvasScaleLabel(); + broadcastChannel.postMessage(['updateScale', pxPerFoot]); + } + + function drawNewCircleFromButton() { + let circleDiameter = document.getElementById('circleSize').value; + let circleColor = document.getElementById("circleColor").value; + let circleText = document.getElementById("circleText") + ? document.getElementById("circleText").value + : ''; + let circleType = document.getElementById("circleShape").value; + let circleTransparency = document.getElementById("circleTransparency").value; + + const colorConverter = { + 'red': `rgba(255,0,0,${circleTransparency / 100})`, + 'green': `rgba(0,128,0,${circleTransparency / 100})`, + 'blue': `rgba(0,0,255,${circleTransparency / 100})`, + 'black': `rgba(0,0,0,${circleTransparency / 100})` + }; + + circleColor = colorConverter[circleColor]; + + drawNewCircle(circleDiameter, circleColor, circleText, 'main', circleType, "", null, true); + broadcastChannel.postMessage(['newCircle', circleDiameter, circleColor, circleText, circleType]); + renderSceneTabs(); + } + + function postLabels() { + let message = ['labelUpdate', []]; + for (let i = 0; i < globs.circleHandles.length; i += 1) { + let circleHandle = globs.circleHandles[i]; + if (circleHandle) { + let label = circleHandle.namedSubElements.labelbox.value; + message[1].push(label); + } else { + message[1].push(null); + } + } + broadcastChannel.postMessage(message); + } + + function updateCircleSliderLabel() { + let circleSize = document.getElementById("circleSize").value; + document.getElementById("circleSizeLabel").innerHTML = `Size: ${circleSize}ft`; + } + + function updateCircleTransparencyLabel() { + let circleOpacity = document.getElementById("circleTransparency").value; + document.getElementById("circleTransparencyLabel").innerHTML = `Opacity: ${circleOpacity}%`; + } + + function updateCanvasScaleLabel() { + let pxPerFoot = document.getElementById("canvasScale").value; + document.getElementById("canvasScaleLabel").innerHTML = `Map Scale: ${pxPerFoot}px/ft`; + } + + function createMirrorWindow() { + window.open("./encounterMap.html", "Encounter Map"); + } + + function saveCanvasState() { + let saveObject = { + backgroundImageBoolean: Boolean(globs.imageSrc || globs.backgroundBitmap), + canvasSize: [globs.canvasX, globs.canvasY], + gridDrawnBoolean: document.getElementById('includeGrid').checked, + mapScale: globs.pxPerFoot, + circles: [], + lines: [], + measurer: null, + }; + + for (let i = 0; i < globs.circleHandles.length; i += 1) { + let circleHandle = globs.circleHandles[i]; + if (circleHandle) { + let circle = circleHandle.namedSubElements.circle; + let circleDiameter = circle.circleRadius * 2; + let circleColor = circle.circleColor; + let circleText = circle.circleText; + let circleNotes = circleHandle.namedSubElements.notesBox.value; + let circleX = circle.dragObject.x; + let circleY = circle.dragObject.y; + let circleType = circle.circleType; + let circleRotation = circle.dragObject.rotation; + let circleVisible = circle.visible !== false; + let hasCustomImage = (circleType === 'customCircle' || circleType === 'custom') + && Boolean(circle.compressedImage || circle.imageFile); + + saveObject.circles.push([ + circleDiameter, + circleColor, + circleText, + circleNotes, + circleX, + circleY, + circleType, + circleRotation, + circleVisible, + hasCustomImage + ]); + } + } + + for (let i = 0; i < drawer.lineSegments.length; i += 1) { + let lineSegment = drawer.lineSegments[i]; + if (!lineSegment) continue; + saveObject.lines.push([ + lineSegment.startX, + lineSegment.endX, + lineSegment.startY, + lineSegment.endY, + lineSegment.width, + lineSegment.color + ]); + } + + if (measurer.currentLine) { + saveObject.measurer = [ + measurer.currentLine.startX, + measurer.currentLine.endX, + measurer.currentLine.startY, + measurer.currentLine.endY + ]; + } + return saveObject; + } + + function loadCanvasState(saveObject, tokenImages, syncBroadcast = true) { + const scale = Number(saveObject.mapScale || 5); + document.getElementById("canvasScale").value = scale; + updateCanvasScale(scale); + updateCanvasScaleLabel(); + if (syncBroadcast) { + broadcastChannel.postMessage(['updateScale', scale]); + } + + document.getElementById('includeGrid').checked = Boolean(saveObject.gridDrawnBoolean); + updateGrid(Boolean(saveObject.gridDrawnBoolean), scale); + if (syncBroadcast) { + broadcastChannel.postMessage(['toggleGrid', Boolean(saveObject.gridDrawnBoolean), scale]); + } + + const preSaveY = (saveObject.canvasSize && saveObject.canvasSize[1]) ? saveObject.canvasSize[1] : globs.canvasY; + const loadRescale = globs.canvasY / preSaveY; + + let imageIDX = 0; + const circles = saveObject.circles || []; + for (let i = 0; i < circles.length; i += 1) { + const c = circles[i]; + const circleDiameter = c[0]; + const circleColor = c[1]; + const circleText = c[2]; + const circleNotes = c[3] || ""; + const circleX = c[4] * loadRescale; + const circleY = c[5] * loadRescale; + const circleType = c[6]; + const circleRotation = c[7] || 0; + const circleVisible = c.length > 8 ? Boolean(c[8]) : true; + const hasImage = c.length > 9 + ? Boolean(c[9]) + : (circleType === 'customCircle' || circleType === 'custom'); + + if (hasImage && tokenImages && tokenImages[imageIDX]) { + const tokenImage = tokenImages[imageIDX]; + drawNewCircle(circleDiameter, circleColor, circleText, 'main', circleType, circleNotes, tokenImage, circleVisible); + if (syncBroadcast) { + broadcastChannel.postMessage(['newCircle', circleDiameter, circleColor, circleText, circleType]); + broadcastChannel.postMessage(['manuallyAppendImage', i, tokenImage]); + } + imageIDX += 1; + } else { + drawNewCircle(circleDiameter, circleColor, circleText, 'main', circleType, circleNotes, null, circleVisible); + if (syncBroadcast) { + broadcastChannel.postMessage(['newCircle', circleDiameter, circleColor, circleText, circleType]); + } + } + + const circleHandle = globs.circleHandles[i]; + circleHandle.updateLocation(circleX, circleY); + circleHandle.updateRotation(circleRotation); + if (!circleVisible) { + circleHandle.setVisibility(false); + } + if (syncBroadcast) { + broadcastChannel.postMessage(['moveCircle', i, circleX, circleY]); + broadcastChannel.postMessage(['newRotation', i, circleRotation]); + broadcastChannel.postMessage(['setCircleVisibility', i, circleVisible]); + } + } + + const lines = saveObject.lines || []; + for (let i = 0; i < lines.length; i += 1) { + const lineSegment = lines[i]; + const startX = lineSegment[0] * loadRescale; + const endX = lineSegment[1] * loadRescale; + const startY = lineSegment[2] * loadRescale; + const endY = lineSegment[3] * loadRescale; + const width = lineSegment[4]; + const color = lineSegment[5]; + + drawSingleLine(startX, endX, startY, endY, width, color); + if (syncBroadcast) { + broadcastChannel.postMessage(['drawLine', startX, endX, startY, endY, width, color]); + } + } + + if (saveObject.measurer) { + const startX = saveObject.measurer[0] * loadRescale; + const endX = saveObject.measurer[1] * loadRescale; + const startY = saveObject.measurer[2] * loadRescale; + const endY = saveObject.measurer[3] * loadRescale; + + drawSingleMeasurer(startX, endX, startY, endY); + if (syncBroadcast) { + broadcastChannel.postMessage(['drawMeasurer', startX, endX, startY, endY]); + } + } + } + + function saveCanvas() { + captureCurrentScene(); + + const filesToSave = []; + const fileStartIndexes = [0]; + const scenesPayload = globs.scenes.map(scene => { + if (scene.backgroundFile) { + filesToSave.push(scene.backgroundFile); + fileStartIndexes.push(fileStartIndexes[fileStartIndexes.length - 1] + scene.backgroundFile.size); + } + const tokenImages = scene.tokenImages || []; + for (let i = 0; i < tokenImages.length; i += 1) { + const imgFile = tokenImages[i]; + if (imgFile) { + filesToSave.push(imgFile); + fileStartIndexes.push(fileStartIndexes[fileStartIndexes.length - 1] + imgFile.size); + } + } + return { + name: scene.name, + state: scene.state, + tokenImageCount: tokenImages.length + }; + }); + + const payload = { + version: 2, + activeSceneIdx: globs.activeSceneIdx, + gmNotes: globs.gmNotes || "", + humeLevel: globs.humeValue !== undefined ? globs.humeValue : 1.0, + fileStartIndexes: fileStartIndexes, + scenes: scenesPayload + }; + + const jsonString = JSON.stringify(payload).replace(/\//g, "\\u002f") + "//"; + const headerBytes = new TextEncoder().encode(jsonString); + const parts = [headerBytes].concat(filesToSave); + + let filename = document.getElementById("saveName").value.trim(); + if (!filename) { + filename = 'session'; + } + + const toSave = new File(parts, filename); + const toSavePath = URL.createObjectURL(toSave); + download(filename + '.ttrpg', toSavePath); + } + + function loadCanvas() { + let element = document.createElement('input'); + element.setAttribute('type', 'file'); + element.setAttribute('accept', '.ttrpg'); + element.style.display = 'none'; + element.onchange = handleCanvasLoad; + document.body.appendChild(element); + element.click(); + document.body.removeChild(element); + } + + async function handleCanvasLoad(event) { + const savedFile = event.target.files[0]; + if (!savedFile) return; + + const buffer = await savedFile.arrayBuffer(); + const bytes = new Uint8Array(buffer); + let borderIdx = -1; + for (let i = 0; i < bytes.length - 1; i += 1) { + if (bytes[i] === 0x2f && bytes[i + 1] === 0x2f) { + borderIdx = i; + break; + } + } + if (borderIdx === -1) { + alert("Некорректный формат файла .ttrpg"); + return; + } + + const jsonStr = new TextDecoder("utf-8").decode(bytes.subarray(0, borderIdx)); + const jsonContents = JSON.parse(jsonStr); + const imageContents = savedFile.slice(borderIdx + 2, savedFile.size); + + const savedImages = []; + const starts = jsonContents.fileStartIndexes || [0]; + for (let i = 0; i < starts.length - 1; i += 1) { + savedImages.push(imageContents.slice(starts[i], starts[i + 1])); + } + if (jsonContents.version !== 2 && starts.length > 0) { + const lastStart = starts[starts.length - 1]; + if (lastStart < imageContents.size) { + savedImages.push(imageContents.slice(lastStart, imageContents.size)); + } + } + + if (jsonContents.version === 2 && Array.isArray(jsonContents.scenes) && jsonContents.scenes.length > 0) { + let offset = 0; + globs.scenes = jsonContents.scenes.map((s, idx) => { + let bg = null; + if (s.state && s.state.backgroundImageBoolean && offset < savedImages.length) { + bg = savedImages[offset++]; + } + const imgCount = s.tokenImageCount || 0; + const tImgs = savedImages.slice(offset, offset + imgCount); + offset += imgCount; + return { + name: s.name || ("Карта " + (idx + 1)), + backgroundFile: bg, + tokenImages: tImgs, + state: s.state + }; + }); + globs.activeSceneIdx = Math.min(jsonContents.activeSceneIdx || 0, globs.scenes.length - 1); + globs.gmNotes = jsonContents.gmNotes || ""; + globs.humeValue = jsonContents.humeLevel !== undefined ? Number(jsonContents.humeLevel) : 1.0; + document.getElementById("gmBroadcastNotes").value = globs.gmNotes; + renderHumeUI(globs.humeValue); + restoreScene(globs.scenes[globs.activeSceneIdx]); + } else { + let bg = null; + let imgs = savedImages; + if (jsonContents.backgroundImageBoolean && imgs.length > 0) { + bg = imgs[0]; + imgs = imgs.slice(1); + } + globs.scenes = [{ + name: stripExtension(savedFile.name) || "Карта 1", + backgroundFile: bg, + tokenImages: imgs, + state: jsonContents + }]; + globs.activeSceneIdx = 0; + restoreScene(globs.scenes[0]); + } + } + + function download(filename, path) { + var element = document.createElement('a'); + element.setAttribute('href', path); + element.setAttribute('download', filename); + element.style.display = 'none'; + document.body.appendChild(element); + element.click(); + document.body.removeChild(element); + } +</script> + +</html>
@@ -31,8 +31,8 @@ for (let xCoord = centerX - (gridSpacing*numLinesX)/2;
xCoord < globs.canvasX; xCoord += gridSpacing) { const line = new createjs.Shape(); //Specify top right corner with x,y,width,height - line.graphics.beginFill("black").drawRect(xCoord,0,globs.gridWidth,globs.canvasY); - stage.addChild(line); + line.graphics.beginFill("rgba(180,180,180,0.45)").drawRect(xCoord,0,globs.gridWidth,globs.canvasY); + stage.addChildAt(line, globs.backgroundBitmap ? 1 : 0); this.gridlines.push(line); }@@ -40,8 +40,8 @@ for (let yCoord = centerY - (gridSpacing*numLinesY)/2;
yCoord < globs.canvasY; yCoord += gridSpacing) { const line = new createjs.Shape(); //Specify top right corner with x,y,width,height - line.graphics.beginFill("black").drawRect(0,yCoord,globs.canvasX,globs.gridWidth); - stage.addChild(line); + line.graphics.beginFill("rgba(180,180,180,0.45)").drawRect(0,yCoord,globs.canvasX,globs.gridWidth); + stage.addChildAt(line, globs.backgroundBitmap ? 1 : 0); this.gridlines.push(line); } stage.update()@@ -130,7 +130,12 @@ updateCanvas();
} else if (broadcastData[0] === "newRotation") { let circleHandle = globs.circleHandles[broadcastData[1]]; if (circleHandle) { - globs.circleHandles[broadcastData[1]].updateRotation(broadcastData[2]); + circleHandle.updateRotation(broadcastData[2]); + } + } else if (broadcastData[0] === "setCircleVisibility") { + let circleHandle = globs.circleHandles[broadcastData[1]]; + if (circleHandle) { + circleHandle.setVisibility(broadcastData[2], false); } } else if (broadcastData[0] === "manuallyAppendImage") { globs.circleHandles[broadcastData[1]].manuallyAppendImageFile(broadcastData[2]);@@ -149,6 +154,14 @@ } else if (broadcastData[0] === "cleanUpNullLines") {
cleanUpNullLines(); } else if (broadcastData[0] === "clearCanvas") { _clearCanvas(); + } else if (broadcastData[0] === "setGMNotes") { + if (typeof applyGMNotes === 'function') { + applyGMNotes(broadcastData[1]); + } + } else if (broadcastData[0] === "setHume") { + if (typeof applyHumeValue === 'function') { + applyHumeValue(broadcastData[1]); + } } else { console.log("Broadcast message not understood! "+broadcastData[0]+' '+broadcastData[1]); }@@ -166,7 +179,11 @@ }
//Draw the grid on the new window if it's already on the current window if (globs.gridDrawn) { - broadcastChannel.postMessage(['toggleGrid',checkboxValue,globs.pxPerFoot]); + let gridChecked = true; + if (document.getElementById('includeGrid')) { + gridChecked = document.getElementById('includeGrid').checked; + } + broadcastChannel.postMessage(['toggleGrid',gridChecked,globs.pxPerFoot]); } //Update the map scale of the new window to match that of the current window@@ -183,6 +200,7 @@ let y = circle.dragObject.y;
broadcastChannel.postMessage(['moveCircle',i,x,y]); let rot = circle.dragObject.rotation; broadcastChannel.postMessage(['newRotation',i,rot]); + broadcastChannel.postMessage(['setCircleVisibility',i,circle.visible]); if (circle.imageFile) { broadcastChannel.postMessage(["manuallyAppendImage",circle.id,circle.imageFile]);@@ -208,16 +226,20 @@ }
broadcastChannel.postMessage(['updateCanvas']); broadcastChannel.postMessage(["toggleImageCompression"]) //turn image compression back on + if (typeof broadcastHUDState === 'function') { + broadcastHUDState(); + } } class DraggableCircle { - constructor(circleRadius,circleColor,circleText,windowLocation,id,circleType,askUserForFile=true) { + constructor(circleRadius,circleColor,circleText,windowLocation,id,circleType,askUserForFile=true,visible=true) { this.circleRadius = circleRadius; this.circleColor = circleColor; this.circleText = circleText; this.windowLocation = windowLocation; this.id = id; this.circleType = circleType; + this.visible = visible; this.moveable = null; this.moveEvent = null;@@ -298,12 +320,29 @@ dragger.y = y;
dragger.rotation = rotation; dragger.addChild(circle,label); stage.addChild(dragger); - stage.setChildIndex(circle,1000000); + this.applyVisibilityToContainer(dragger); stage.update(); return dragger; } + applyVisibilityToContainer(container) { + if (!container) return; + if (this.windowLocation === 'main') { + container.visible = true; + container.alpha = this.visible ? 1 : 0.35; + } else { + container.visible = Boolean(this.visible); + container.alpha = 1; + } + } + + setVisibility(isVisible) { + this.visible = Boolean(isVisible); + this.applyVisibilityToContainer(this.dragObject); + stage.update(); + } + mousedown(evt) { function pressmove(evt) { // Calculate the new X and Y based on the mouse new position plus the offset.@@ -465,6 +504,36 @@ this.preprocessImage(file);
} } +function formatHumeMeta(val) { + const clamped = Math.max(0.5, Math.min(5.0, Number(val) || 1.0)); + const pct = ((clamped - 0.5) / 4.5) * 100; + let label = "Норма"; + let color = "#34d399"; + let bg = "rgba(16, 185, 129, 0.16)"; + if (clamped < 0.8) { + label = "Сильное истончение"; + color = "#f87171"; + bg = "rgba(239, 68, 68, 0.18)"; + } else if (clamped < 0.95) { + label = "Истончение"; + color = "#e879f9"; + bg = "rgba(217, 70, 239, 0.16)"; + } else if (clamped <= 1.25) { + label = "Норма"; + color = "#34d399"; + bg = "rgba(16, 185, 129, 0.16)"; + } else if (clamped <= 2.5) { + label = "Уплотнение"; + color = "#38bdf8"; + bg = "rgba(56, 189, 248, 0.16)"; + } else { + label = "Высокая плотность"; + color = "#fbbf24"; + bg = "rgba(245, 158, 11, 0.18)"; + } + return { clamped, pct, label, color, bg }; +} + function setupCanvas () { let widthAndHeight = findCanvasScale(); globs.canvasX = widthAndHeight[0];@@ -491,27 +560,38 @@ }
} function findCanvasScale () { + let availW = window.innerWidth; + let availH = window.innerHeight; + if (globs.windowLocation === 'encounterMap') { + const holder = document.getElementById('mirroredEncounterMap'); + const header = document.getElementById('playerTopBar'); + const sideW = holder && holder.clientWidth > 100 ? holder.clientWidth : (availW >= 992 ? availW - 360 : availW - 32); + const topH = header ? header.offsetHeight + 24 : 72; + availW = Math.max(320, sideW - 16); + availH = Math.max(200, window.innerHeight - topH); + } + let height; let width; - if (window.innerWidth > window.innerHeight*(16/9)) { - height = window.innerHeight; - width = window.innerHeight*(16/9); + if (availW > availH * (16 / 9)) { + height = availH; + width = availH * (16 / 9); } else { - height = window.innerWidth*(9/16); - width = window.innerWidth; + height = availW * (9 / 16); + width = availW; } if (globs.windowLocation === 'main') { if (width > 576) { //Styling for desktops - width = width*.5; - height = height*.5; + width = width*.52; + height = height*.52; } else { //Styling for phones - width = width*.9; - height = height*.9; + width = width*.92; + height = height*.92; } return [width,height]; } else if (globs.windowLocation === 'encounterMap') { - return [width,height]; + return [Math.floor(width), Math.floor(height)]; } else { console.log(globs.windowLocation+'not recognized'); }@@ -535,17 +615,28 @@ _updateCanvas();
} function loadMapImage(mapImage) { + globs._mapLoadSeq = (globs._mapLoadSeq || 0) + 1; + const seq = globs._mapLoadSeq; + globs.imageSrc = mapImage; + function handleImageCompression (result) { - + if (seq !== globs._mapLoadSeq) { + return; + } var image = new Image(); image.src = URL.createObjectURL(result); - image.onload = handleImageLoad; + image.onload = function(event) { + if (seq !== globs._mapLoadSeq) { + return; + } + handleImageLoad(event); + }; globs.imageSrc = result; - } if (globs.backgroundBitmap) { stage.removeChild(globs.backgroundBitmap); + globs.backgroundBitmap = null; } compressImageFile(mapImage,100,handleImageCompression);@@ -554,7 +645,7 @@
function handleImageLoad(event) { var image = event.target; var bitmap = new createjs.Bitmap(image); - stage.addChild(bitmap); + stage.addChildAt(bitmap, 0); globs.backgroundBitmap = bitmap; updateCanvas(); }@@ -628,7 +719,7 @@ rescaleFactor = xRescaleFactor;
} else { rescaleFactor = yRescaleFactor; } -`` + globs.backgroundBitmap.scaleX = rescaleFactor; globs.backgroundBitmap.scaleY = rescaleFactor;@@ -639,12 +730,12 @@ stage.update();
} } -function drawNewCircle(circleDiameter,circleColor,circleText,windowLocation,circleType,notes="",circleImage=null) { - _drawNewCircle(circleDiameter,circleColor,circleText,windowLocation,circleType,notes,circleImage); +function drawNewCircle(circleDiameter,circleColor,circleText,windowLocation,circleType,notes="",circleImage=null,visible=true) { + _drawNewCircle(circleDiameter,circleColor,circleText,windowLocation,circleType,notes,circleImage,visible); updateCanvas(); } -function _drawNewCircle(circleDiameter,circleColor,circleText,windowLocation,circleType,notes,circleImage) { +function _drawNewCircle(circleDiameter,circleColor,circleText,windowLocation,circleType,notes,circleImage,visible=true) { if (circleImage) { askUserForFile = false; } else {@@ -652,7 +743,7 @@ askUserForFile = true;
} // Divide my 2 to account for the conversion from diameter to radius - circle = new DraggableCircle(circleDiameter * 1/2,circleColor,circleText,windowLocation,globs.circleHandles.length,circleType,askUserForFile); + circle = new DraggableCircle(circleDiameter * 1/2,circleColor,circleText,windowLocation,globs.circleHandles.length,circleType,askUserForFile,visible); let circleHandle = new SymbolHandle(circle,globs.circleHandles.length,notes); globs.circleHandles.push(circleHandle); if (circleImage) {@@ -699,6 +790,8 @@ circleHandle.removeFromButton();
} } + globs.grid.gridlines = []; + globs.gridDrawn = false; stage.removeAllChildren(); drawer.lineSegments = []; measurer.currentLine = null;@@ -973,7 +1066,7 @@ let lineSegment = drawer.lineSegments[i];
if (lineSegment.startX > lowerX && lineSegment.startX < upperX && lineSegment.startY > lowerY && lineSegment.startY < upperY) { trimmedLineSegments.push(lineSegment); originalLineIndexes.push(i); - } else if (lineSegment.endX > lowerY && lineSegment.endX < upperY && lineSegment.endY > lowerY && lineSegment.endY < upperY) { + } else if (lineSegment.endX > lowerX && lineSegment.endX < upperX && lineSegment.endY > lowerY && lineSegment.endY < upperY) { trimmedLineSegments.push(lineSegment); originalLineIndexes.push(i); }@@ -1087,7 +1180,7 @@ }
textX = textX + offsetX; textY = textY +offsetY; - let text = new createjs.Text(this.length+'ft', "bold 14px Garamond"); + let text = new createjs.Text(this.length+'ft', "bold 14px Iosevka, monospace", "#eeeeee"); text.x = textX; text.y = textY; text.textAlign = 'center';@@ -1096,8 +1189,8 @@ this.text = text;
let rectangleBounds = text.getBounds(); let rectangle = new createjs.Shape() - rectangle.graphics.beginFill("white").drawRect(rectangleBounds.x+text.x-2,rectangleBounds.y+text.y-2, - rectangleBounds.width+4,rectangleBounds.height) + rectangle.graphics.beginFill("#1c1c1c").drawRect(rectangleBounds.x+text.x-2,rectangleBounds.y+text.y-2, + rectangleBounds.width+4,rectangleBounds.height); this.rectangle = rectangle; stage.addChild(rectangle); return text;
@@ -109,8 +109,8 @@ this.namedSubElements.label = label;
let notesBox = this.addTextbox(); notesBox.style.position = "absolute"; - notesBox.style.left = "5.5em"; - notesBox.style.width = "12em"; + notesBox.style.left = "5.2em"; + notesBox.style.width = "9.2em"; notesBox.style.top = ".1em" notesBox.value = notes;@@ -118,19 +118,32 @@ this.namedSubElements.notesBox = notesBox;
let notesLabel = this.addText('Notes'); notesLabel.style.position = "absolute"; - notesLabel.style.left = "5.5em"; - notesLabel.style.width = "12em"; + notesLabel.style.left = "5.2em"; + notesLabel.style.width = "9.2em"; notesLabel.style.top = "2em"; - notesLabel.style.color = "rgb(130,130,130)"; + notesLabel.style.color = "#888888"; notesLabel.style.textAlign = "center"; notesLabel.style.fontSize = "small"; this.namedSubElements.notesLabel = notesLabel; + let eyeButton = this.addButton(""); + eyeButton.classList.add('eyeButton'); + eyeButton.title = "Скрыть / показать токен игрокам"; + eyeButton.id = this.id; + eyeButton.onclick = this.toggleVisibilityFromButton; + this.namedSubElements.eyeButton = eyeButton; + let button = this.addButton(""); button.classList.add('deleteButton'); + button.title = "Удалить токен"; button.id = this.id; button.onclick = this.removeFromButton; this.namedSubElements.button = button; + + if (circle && circle.visible === false) { + eyeButton.classList.add('isHidden'); + this.div.classList.add('tokenHidden'); + } } addTokenHandle(color='blue',type='circle') {@@ -185,6 +198,9 @@ thisSymbolHandle.removeCircle();
thisSymbolHandle.removeHandle(); thisSymbolHandle.removeFromMasterList(); broadcastChannel.postMessage(['removeCircle',this.id]); + if (typeof renderSceneTabs === 'function') { + renderSceneTabs(); + } } removeCircle () {@@ -199,6 +215,26 @@ removeFromMasterList () {
globs.circleHandles[this.id] = null; } + toggleVisibilityFromButton () { + let thisSymbolHandle = globs.circleHandles[this.id]; + if (!thisSymbolHandle) return; + let nextVisible = !thisSymbolHandle.namedSubElements.circle.visible; + thisSymbolHandle.setVisibility(nextVisible); + } + + setVisibility (isVisible, broadcast=true) { + let visible = Boolean(isVisible); + this.namedSubElements.circle.setVisibility(visible); + if (this.namedSubElements.eyeButton) { + this.namedSubElements.eyeButton.classList.toggle('isHidden', !visible); + } + this.div.classList.toggle('tokenHidden', !visible); + if (broadcast && this.namedSubElements.circle.windowLocation === 'main') { + broadcastChannel.postMessage(['setCircleVisibility', this.id, visible]); + } + updateCanvas(); + } + updateLocation (x,y) { this.namedSubElements.circle.updateLocation(x,y); }@@ -306,7 +342,8 @@ globs.musicManager.activeAudio.load()
globs.musicManager.activeAudio.currentTime = this.currentTime; this.active = true - this.div.style.backgroundColor = "rgba(50,100,205,.1)"; + this.div.classList.add("activeItem"); + this.div.style.backgroundColor = ""; globs.musicManager.activeAudio.play(); }@@ -317,7 +354,8 @@ }
stopMusic() { if (this.active) { - this.div.style.backgroundColor = "rgb(240,240,240)"; + this.div.classList.remove("activeItem"); + this.div.style.backgroundColor = ""; this.active = false globs.musicManager.activeAudio.pause(); if (globs.musicManager.activePlaylistHandle) {@@ -451,14 +489,16 @@ playlistHandle.loopPlaylist();
} start () { - this.div.style.backgroundColor = "rgba(50,100,205,.1)"; + this.div.classList.add("activeItem"); + this.div.style.backgroundColor = ""; globs.musicManager.activePlaylistHandle = this; this.active = true; } stop () { if (this.active) { - this.div.style.backgroundColor = "rgb(240,240,240)"; + this.div.classList.remove("activeItem"); + this.div.style.backgroundColor = ""; globs.musicManager.activePlaylistHandle = null; this.active = false; }
@@ -1,96 +0,0 @@
-<!doctype html> -<html lang="en"> - <head> - <!-- Global site tag (gtag.js) - Google Analytics --> - <!-- <script async src="https://www.googletagmanager.com/gtag/js?id=G-5FWK5WHN2R"></script> --> - <!-- <script> --> - <!-- window.dataLayer = window.dataLayer || []; --> - <!-- function gtag(){dataLayer.push(arguments);} --> - <!-- gtag('js', new Date()); --> - - <!-- gtag('config', 'G-5FWK5WHN2R'); --> - <!-- </script> --> - - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> - <meta name="description" content="simplyRPG is a free virtual tabletop (VTT) service. For it to remain that way, we need your support. Here's a few options for how you can contribute"> - <title>Support the site</title> - <link rel="icon" href="assets/images/small-logo.png"> - - <!-- CSS --> - <link href="libraries/bootstrap/bootstrap.css" rel="stylesheet"> - <!-- simplyRPG CSS --> - <link rel="stylesheet" type="text/css" href="gmView.css"> - - <style> - .bd-placeholder-img { - font-size: 1.125rem; - text-anchor: middle; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - } - - @media (min-width: 768px) { - .bd-placeholder-img-lg { - font-size: 3.5rem; - } - } - </style> - - </head> - -<body> - -<nav class="navbar navbar-expand-md navbar-dark fixed-top blueBackground"> - <img src="assets/images/logo1-white.png" class="logo"> - <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation"> - <span class="navbar-toggler-icon"></span> - </button> - - <div class="collapse navbar-collapse" id="navbarsExampleDefault"> - <ul class="navbar-nav mr-auto"> - <li class="nav-item"> - <a class="nav-link" href="./index.html">Home</a> - </li> - <li class="nav-item"> - <a class="nav-link" href="./gmView.html">simplyRPG</a> - </li> - <li class="nav-item active"> - <a class="nav-link" href="./supportTheSite.html">Support the Site</a> - </li> - <li class="nav-item"> - <a class="nav-link" href="./faq.html">FAQ</a> - </li> - </ul> - </div> - -</nav> - -<main> - <div class="container"> - <div class="pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center"> - <h1 class="display-4">Support the Site</h1> - <p class="lead">Thank you for using simplyRPG! There's currently no way to support the site. We might change that in the future, but we will always keep simplyRPG complete free. Please enjoy the site!</p> - </div> - - <hr> - </div> - - <footer class="container footer"> - <span class="footer"> simplyRPG is powered by:</span><br> - <span class="footer"><a href="https://createjs.com/" target="_blank">createJS</a> and <a href="https://createjs.com/easeljs" target="_blank">easelJs</a></span><br> - <span class="footer"><a href="https://getbootstrap.com/" target="_blank">Bootstrap</a> and <a href="https://icons.getbootstrap.com/" target="_blank">Bootstrap Icons</a></span><br> - <span class="footer"><a href="https://fengyuanchen.github.io/compressorjs/" target="_blank">compressorJS</a></span><br> - <span class="footer">under the <a href="./license.html" target="_blank">MIT License</a></span><br><br> - <img src="assets/images/logo1-normal.png" class="logo"> - </footer> - -<!-- Import boostrap javascript --> -<script src="libraries/bootstrap/jquery-3.5.1.slim.min.js"></script> -<script src="libraries/bootstrap/bootstrap.js"></script> - -</main> -</body> -</html>