refactor: complete professional redesign of dice roller modal for mobile
BREAKING CHANGES: Dice roller now uses modern ES6 class architecture Features: - Mobile-first CSS with fluid responsive units (clamp, min, max) - ES6 DiceModal class with proper state management (IDLE, ROLLING, SHOWING_RESULT) - Semantic HTML with ARIA attributes for accessibility - CSS state classes (.is-open, .is-closing, .is-animating) - Touch-friendly 44px minimum tap targets - Desktop enhancement with @media (min-width: 1001px) Fixes: - Fixed mobile viewport overflow with min-height: 0 on flex children - Reduced max-height to 70vh for guaranteed mobile fit - Removed all jQuery .show()/.hide() inline style injections - Removed !important CSS hacks from mobile media query - Fixed transparent modal background (80% opaque neutral gray) - Darkened backdrop overlay (85% opaque black) Technical: - Backdrop uses ::before pseudo-element (no wrapper div needed) - Flattened HTML structure with proper semantic elements - Backwards compatible wrapper functions preserved - Grid layout for inputs (stacked mobile, side-by-side desktop) - Proper CSS specificity hierarchy (no !important needed) - Removed .rpg-dice-popup-overlay div dependency Accessibility: - role="dialog" with aria-modal="true" - aria-labelledby for dialog title - aria-live regions for dynamic content - aria-busy for loading states - Proper focus management on open/close
This commit is contained in:
@@ -651,22 +651,174 @@ async function sendPlotProgression(type) {
|
|||||||
$('#rpg-plot-random, #rpg-plot-natural').prop('disabled', false).css('opacity', '1');
|
$('#rpg-plot-random, #rpg-plot-natural').prop('disabled', false).css('opacity', '1');
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
}/**
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modern DiceModal ES6 Class
|
||||||
|
* Manages dice roller modal with proper state management and CSS classes
|
||||||
|
*/
|
||||||
|
class DiceModal {
|
||||||
|
constructor() {
|
||||||
|
this.modal = document.getElementById('rpg-dice-popup');
|
||||||
|
this.animation = document.getElementById('rpg-dice-animation');
|
||||||
|
this.result = document.getElementById('rpg-dice-result');
|
||||||
|
this.resultValue = document.getElementById('rpg-dice-result-value');
|
||||||
|
this.resultDetails = document.getElementById('rpg-dice-result-details');
|
||||||
|
this.rollBtn = document.getElementById('rpg-dice-roll-btn');
|
||||||
|
|
||||||
|
this.state = 'IDLE'; // IDLE, ROLLING, SHOWING_RESULT
|
||||||
|
this.isAnimating = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens the modal with proper animation
|
||||||
|
*/
|
||||||
|
open() {
|
||||||
|
if (this.isAnimating) return;
|
||||||
|
|
||||||
|
// Apply theme
|
||||||
|
const theme = extensionSettings.theme;
|
||||||
|
this.modal.setAttribute('data-theme', theme);
|
||||||
|
|
||||||
|
// Apply custom theme if needed
|
||||||
|
if (theme === 'custom') {
|
||||||
|
this._applyCustomTheme();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset to initial state
|
||||||
|
this._setState('IDLE');
|
||||||
|
|
||||||
|
// Open modal with CSS class
|
||||||
|
this.modal.classList.add('is-open');
|
||||||
|
this.modal.classList.remove('is-closing');
|
||||||
|
|
||||||
|
// Focus management
|
||||||
|
this.modal.querySelector('#rpg-dice-popup-close')?.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes the modal with animation
|
||||||
|
*/
|
||||||
|
close() {
|
||||||
|
if (this.isAnimating) return;
|
||||||
|
|
||||||
|
this.isAnimating = true;
|
||||||
|
this.modal.classList.add('is-closing');
|
||||||
|
this.modal.classList.remove('is-open');
|
||||||
|
|
||||||
|
// Wait for animation to complete
|
||||||
|
setTimeout(() => {
|
||||||
|
this.modal.classList.remove('is-closing');
|
||||||
|
this.isAnimating = false;
|
||||||
|
|
||||||
|
// Clear pending roll
|
||||||
|
pendingDiceRoll = null;
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts the rolling animation
|
||||||
|
*/
|
||||||
|
startRolling() {
|
||||||
|
this._setState('ROLLING');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows the result
|
||||||
|
* @param {number} total - The total roll value
|
||||||
|
* @param {Array<number>} rolls - Individual roll values
|
||||||
|
*/
|
||||||
|
showResult(total, rolls) {
|
||||||
|
this._setState('SHOWING_RESULT');
|
||||||
|
|
||||||
|
// Update result values
|
||||||
|
this.resultValue.textContent = total;
|
||||||
|
this.resultValue.classList.add('is-animating');
|
||||||
|
|
||||||
|
// Remove animation class after it completes
|
||||||
|
setTimeout(() => {
|
||||||
|
this.resultValue.classList.remove('is-animating');
|
||||||
|
}, 500);
|
||||||
|
|
||||||
|
// Show details if multiple rolls
|
||||||
|
if (rolls && rolls.length > 1) {
|
||||||
|
this.resultDetails.textContent = `Rolls: ${rolls.join(', ')}`;
|
||||||
|
} else {
|
||||||
|
this.resultDetails.textContent = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manages modal state changes
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_setState(newState) {
|
||||||
|
this.state = newState;
|
||||||
|
|
||||||
|
switch (newState) {
|
||||||
|
case 'IDLE':
|
||||||
|
this.rollBtn.hidden = false;
|
||||||
|
this.animation.hidden = true;
|
||||||
|
this.result.hidden = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'ROLLING':
|
||||||
|
this.rollBtn.hidden = true;
|
||||||
|
this.animation.hidden = false;
|
||||||
|
this.result.hidden = true;
|
||||||
|
this.animation.setAttribute('aria-busy', 'true');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'SHOWING_RESULT':
|
||||||
|
this.rollBtn.hidden = true;
|
||||||
|
this.animation.hidden = true;
|
||||||
|
this.result.hidden = false;
|
||||||
|
this.animation.setAttribute('aria-busy', 'false');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies custom theme colors
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_applyCustomTheme() {
|
||||||
|
const content = this.modal.querySelector('.rpg-dice-popup-content');
|
||||||
|
if (content && extensionSettings.customColors) {
|
||||||
|
content.style.setProperty('--rpg-bg', extensionSettings.customColors.bg);
|
||||||
|
content.style.setProperty('--rpg-accent', extensionSettings.customColors.accent);
|
||||||
|
content.style.setProperty('--rpg-text', extensionSettings.customColors.text);
|
||||||
|
content.style.setProperty('--rpg-highlight', extensionSettings.customColors.highlight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Global instance
|
||||||
|
let diceModal = null;
|
||||||
|
|
||||||
|
/**
|
||||||
* Sets up the dice roller functionality.
|
* Sets up the dice roller functionality.
|
||||||
*/
|
*/
|
||||||
function setupDiceRoller() {
|
function setupDiceRoller() {
|
||||||
|
// Initialize DiceModal instance
|
||||||
|
diceModal = new DiceModal();
|
||||||
// Click dice display to open popup
|
// Click dice display to open popup
|
||||||
$('#rpg-dice-display').on('click', function() {
|
$('#rpg-dice-display').on('click', function() {
|
||||||
openDicePopup();
|
openDicePopup();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Close popup
|
// Close popup - handle both close button and backdrop clicks
|
||||||
$('#rpg-dice-popup-close, .rpg-dice-popup-overlay').on('click', function() {
|
$('#rpg-dice-popup-close').on('click', function() {
|
||||||
// Discard pending roll without saving
|
|
||||||
pendingDiceRoll = null;
|
|
||||||
closeDicePopup();
|
closeDicePopup();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Close on backdrop click (clicking outside content)
|
||||||
|
$('#rpg-dice-popup').on('click', function(e) {
|
||||||
|
if (e.target === this) {
|
||||||
|
closeDicePopup();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Roll dice button
|
// Roll dice button
|
||||||
$('#rpg-dice-roll-btn').on('click', async function() {
|
$('#rpg-dice-roll-btn').on('click', async function() {
|
||||||
await rollDice();
|
await rollDice();
|
||||||
@@ -709,54 +861,45 @@ function clearDiceRoll() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens the dice rolling popup.
|
* Opens the dice rolling popup.
|
||||||
|
* Backwards compatible wrapper for DiceModal class.
|
||||||
*/
|
*/
|
||||||
function openDicePopup() {
|
function openDicePopup() {
|
||||||
// Apply current theme to popup
|
if (diceModal) {
|
||||||
const theme = extensionSettings.theme;
|
diceModal.open();
|
||||||
$('#rpg-dice-popup').attr('data-theme', theme);
|
|
||||||
|
|
||||||
$('#rpg-dice-popup').fadeIn(200);
|
|
||||||
$('#rpg-dice-animation').hide();
|
|
||||||
$('#rpg-dice-result').hide();
|
|
||||||
$('#rpg-dice-roll-btn').show();
|
|
||||||
|
|
||||||
// Apply custom theme if selected
|
|
||||||
if (theme === 'custom') {
|
|
||||||
applyCustomThemeToPopup();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies custom theme colors to the dice popup.
|
* Closes the dice rolling popup.
|
||||||
|
* Backwards compatible wrapper for DiceModal class.
|
||||||
*/
|
*/
|
||||||
function applyCustomThemeToPopup() {
|
function closeDicePopup() {
|
||||||
const $popup = $('#rpg-dice-popup');
|
if (diceModal) {
|
||||||
$popup.find('.rpg-dice-popup-content').css({
|
diceModal.close();
|
||||||
'--rpg-bg': extensionSettings.customColors.bg,
|
}
|
||||||
'--rpg-accent': extensionSettings.customColors.accent,
|
|
||||||
'--rpg-text': extensionSettings.customColors.text,
|
|
||||||
'--rpg-highlight': extensionSettings.customColors.highlight
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the dice rolling popup.
|
* @deprecated Legacy function - use diceModal._applyCustomTheme() instead
|
||||||
*/
|
*/
|
||||||
function closeDicePopup() {
|
function applyCustomThemeToPopup() {
|
||||||
$('#rpg-dice-popup').fadeOut(200);
|
if (diceModal) {
|
||||||
|
diceModal._applyCustomTheme();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rolls the dice and displays result.
|
* Rolls the dice and displays result.
|
||||||
|
* Refactored to use DiceModal class.
|
||||||
*/
|
*/
|
||||||
async function rollDice() {
|
async function rollDice() {
|
||||||
|
if (!diceModal) return;
|
||||||
|
|
||||||
const count = parseInt(String($('#rpg-dice-count').val())) || 1;
|
const count = parseInt(String($('#rpg-dice-count').val())) || 1;
|
||||||
const sides = parseInt(String($('#rpg-dice-sides').val())) || 20;
|
const sides = parseInt(String($('#rpg-dice-sides').val())) || 20;
|
||||||
|
|
||||||
// Hide roll button and show animation
|
// Start rolling animation
|
||||||
$('#rpg-dice-roll-btn').hide();
|
diceModal.startRolling();
|
||||||
$('#rpg-dice-animation').show();
|
|
||||||
$('#rpg-dice-result').hide();
|
|
||||||
|
|
||||||
// Wait for animation (simulate rolling)
|
// Wait for animation (simulate rolling)
|
||||||
await new Promise(resolve => setTimeout(resolve, 1200));
|
await new Promise(resolve => setTimeout(resolve, 1200));
|
||||||
@@ -777,16 +920,8 @@ async function rollDice() {
|
|||||||
timestamp: Date.now()
|
timestamp: Date.now()
|
||||||
};
|
};
|
||||||
|
|
||||||
// Hide animation and show result
|
// Show result
|
||||||
$('#rpg-dice-animation').hide();
|
diceModal.showResult(total, rolls);
|
||||||
$('#rpg-dice-result').show();
|
|
||||||
$('#rpg-dice-result-value').text(total);
|
|
||||||
|
|
||||||
if (rolls.length > 1) {
|
|
||||||
$('#rpg-dice-result-details').text(`Rolls: ${rolls.join(', ')}`);
|
|
||||||
} else {
|
|
||||||
$('#rpg-dice-result-details').text('');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't update sidebar display yet - only update when user clicks "Save Roll"
|
// Don't update sidebar display yet - only update when user clicks "Save Roll"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2115,47 +2115,299 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
|
|||||||
.rpg-stat-row:nth-child(5) { animation-delay: 0.3s; }
|
.rpg-stat-row:nth-child(5) { animation-delay: 0.3s; }
|
||||||
|
|
||||||
/* ============================================
|
/* ============================================
|
||||||
DICE ROLL POPUP
|
DICE ROLL MODAL - MOBILE FIRST
|
||||||
============================================ */
|
============================================ */
|
||||||
|
|
||||||
|
/* CSS Custom Properties for Responsive Scaling */
|
||||||
|
.rpg-dice-popup {
|
||||||
|
/* Fluid spacing that scales with viewport */
|
||||||
|
--modal-padding: clamp(0.5rem, 2vw, 0.75rem);
|
||||||
|
--modal-gap: clamp(0.375rem, 1.5vw, 0.5rem);
|
||||||
|
--modal-border-width: 2px;
|
||||||
|
|
||||||
|
/* Fluid typography */
|
||||||
|
--modal-font-base: clamp(0.8rem, 3vw, 0.9rem);
|
||||||
|
--modal-font-small: clamp(0.7rem, 2.5vw, 0.8rem);
|
||||||
|
--modal-font-large: clamp(1.25rem, 6vw, 1.75rem);
|
||||||
|
--modal-font-huge: clamp(1.5rem, 8vw, 2.5rem);
|
||||||
|
|
||||||
|
/* Touch-friendly sizing */
|
||||||
|
--modal-button-height: 44px;
|
||||||
|
--modal-input-height: 44px;
|
||||||
|
|
||||||
|
/* Content constraints - MUCH more conservative */
|
||||||
|
--modal-max-width: min(90vw, 360px);
|
||||||
|
--modal-max-height: 70vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Modal Container - Hidden by default */
|
||||||
.rpg-dice-popup {
|
.rpg-dice-popup {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
inset: 0;
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
z-index: 10000;
|
z-index: 10000;
|
||||||
|
display: none;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Open state - managed by JavaScript classList */
|
||||||
|
.rpg-dice-popup.is-open {
|
||||||
|
display: flex;
|
||||||
|
animation: fadeIn 0.2s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Closing state - allows exit animation */
|
||||||
|
.rpg-dice-popup.is-closing {
|
||||||
|
display: flex;
|
||||||
|
animation: fadeOut 0.2s ease-in;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Backdrop overlay - using ::before pseudo-element */
|
||||||
|
.rpg-dice-popup::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background: rgba(0, 0, 0, 0.85);
|
||||||
|
backdrop-filter: blur(5px);
|
||||||
|
-webkit-backdrop-filter: blur(5px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Modal Content Box */
|
||||||
|
.rpg-dice-popup-content {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
max-width: var(--modal-max-width);
|
||||||
|
height: auto;
|
||||||
|
max-height: var(--modal-max-height);
|
||||||
|
min-height: 0;
|
||||||
|
background: rgba(30, 30, 30, 0.8);
|
||||||
|
border: var(--modal-border-width) solid var(--rpg-border);
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
|
||||||
|
color: var(--rpg-text);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
animation: slideInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
||||||
|
margin: auto 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Header */
|
||||||
|
.rpg-dice-popup-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: var(--modal-padding);
|
||||||
|
background: var(--rpg-accent);
|
||||||
|
border-bottom: var(--modal-border-width) solid var(--rpg-border);
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rpg-dice-popup-header h3 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: var(--modal-font-base);
|
||||||
|
color: var(--rpg-highlight);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--modal-gap);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Close button - touch-friendly */
|
||||||
|
#rpg-dice-popup-close {
|
||||||
|
min-width: 44px;
|
||||||
|
min-height: 44px;
|
||||||
|
padding: 0.5rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rpg-dice-popup-overlay {
|
/* Scrollable Body */
|
||||||
position: absolute;
|
.rpg-dice-popup-body {
|
||||||
top: 0;
|
padding: var(--modal-padding);
|
||||||
left: 0;
|
overflow-y: auto;
|
||||||
right: 0;
|
overflow-x: hidden;
|
||||||
bottom: 0;
|
-webkit-overflow-scrolling: touch;
|
||||||
background: rgba(0, 0, 0, 0.7);
|
flex: 1 1 auto;
|
||||||
backdrop-filter: blur(5px);
|
min-height: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rpg-dice-popup-content {
|
/* Input Container */
|
||||||
position: relative;
|
.rpg-dice-selector-container {
|
||||||
width: 90%;
|
padding: var(--modal-padding);
|
||||||
max-width: 31.25rem;
|
background: rgba(0, 0, 0, 0.3);
|
||||||
background: var(--rpg-bg);
|
border-radius: 0.5rem;
|
||||||
border: 3px solid var(--rpg-border);
|
border: var(--modal-border-width) solid var(--rpg-border);
|
||||||
border-radius: 0.938em;
|
margin-bottom: var(--modal-gap);
|
||||||
box-shadow: 0 10px 50px rgba(0, 0, 0, 0.9);
|
}
|
||||||
overflow: hidden;
|
|
||||||
animation: popupSlideIn 0.3s ease-out;
|
/* Input Grid - Stacked on mobile */
|
||||||
|
.rpg-dice-selector {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
gap: var(--modal-gap);
|
||||||
|
margin-bottom: var(--modal-gap);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rpg-dice-input-group {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rpg-dice-input-group label {
|
||||||
|
font-size: var(--modal-font-small);
|
||||||
|
font-weight: 600;
|
||||||
color: var(--rpg-text);
|
color: var(--rpg-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes popupSlideIn {
|
.rpg-dice-input-group input,
|
||||||
|
.rpg-dice-input-group select {
|
||||||
|
width: 100%;
|
||||||
|
min-height: var(--modal-input-height);
|
||||||
|
padding: 0.5rem;
|
||||||
|
border: var(--modal-border-width) solid var(--rpg-border);
|
||||||
|
border-radius: 0.375rem;
|
||||||
|
background: var(--rpg-accent);
|
||||||
|
color: var(--rpg-text);
|
||||||
|
font-size: var(--modal-font-base);
|
||||||
|
font-weight: 600;
|
||||||
|
text-align: center;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rpg-dice-input-group input:focus,
|
||||||
|
.rpg-dice-input-group select:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: var(--rpg-highlight);
|
||||||
|
box-shadow: 0 0 0 3px rgba(var(--rpg-highlight-rgb, 255, 0, 100), 0.2);
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Roll Button - touch-friendly */
|
||||||
|
#rpg-dice-roll-btn {
|
||||||
|
width: 100%;
|
||||||
|
min-height: var(--modal-button-height);
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
background: linear-gradient(135deg, var(--rpg-highlight), var(--rpg-accent));
|
||||||
|
border: var(--modal-border-width) solid var(--rpg-highlight);
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
color: var(--rpg-text);
|
||||||
|
font-size: var(--modal-font-base);
|
||||||
|
font-weight: 700;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#rpg-dice-roll-btn:active {
|
||||||
|
transform: scale(0.98);
|
||||||
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Animation Section */
|
||||||
|
.rpg-dice-animation {
|
||||||
|
text-align: center;
|
||||||
|
padding: var(--modal-padding);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rpg-dice-rolling i {
|
||||||
|
font-size: var(--modal-font-large);
|
||||||
|
color: var(--rpg-highlight);
|
||||||
|
animation: diceRoll 0.8s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rpg-dice-rolling-text {
|
||||||
|
margin-top: var(--modal-gap);
|
||||||
|
font-size: var(--modal-font-base);
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--rpg-highlight);
|
||||||
|
animation: pulseGlow 1s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Result Section */
|
||||||
|
.rpg-dice-result {
|
||||||
|
text-align: center;
|
||||||
|
padding: var(--modal-padding);
|
||||||
|
background: rgba(0, 0, 0, 0.3);
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
border: var(--modal-border-width) solid var(--rpg-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rpg-dice-result-label {
|
||||||
|
font-size: var(--modal-font-small);
|
||||||
|
color: var(--rpg-text);
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rpg-dice-result-value {
|
||||||
|
font-size: var(--modal-font-huge);
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--rpg-highlight);
|
||||||
|
text-shadow: 0 0 20px var(--rpg-highlight);
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rpg-dice-result-value.is-animating {
|
||||||
|
animation: resultPop 0.5s cubic-bezier(0.16, 1, 0.3, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rpg-dice-result-details {
|
||||||
|
margin-top: var(--modal-gap);
|
||||||
|
font-size: var(--modal-font-small);
|
||||||
|
color: var(--rpg-text);
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Save Button */
|
||||||
|
.rpg-dice-save-btn {
|
||||||
|
margin-top: var(--modal-gap);
|
||||||
|
width: 100%;
|
||||||
|
min-height: var(--modal-button-height);
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
background: linear-gradient(135deg, #28a745, #20c997);
|
||||||
|
border: var(--modal-border-width) solid #28a745;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
color: white;
|
||||||
|
font-size: var(--modal-font-base);
|
||||||
|
font-weight: 700;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rpg-dice-save-btn:active {
|
||||||
|
transform: scale(0.98);
|
||||||
|
box-shadow: 0 2px 8px rgba(40, 167, 69, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Animations */
|
||||||
|
@keyframes fadeIn {
|
||||||
|
from { opacity: 0; }
|
||||||
|
to { opacity: 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fadeOut {
|
||||||
|
from { opacity: 1; }
|
||||||
|
to { opacity: 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes slideInUp {
|
||||||
from {
|
from {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: translateY(-3.125rem) scale(0.9);
|
transform: translateY(20px) scale(0.95);
|
||||||
}
|
}
|
||||||
to {
|
to {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
@@ -2163,216 +2415,20 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.rpg-dice-popup-header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
padding: 1.25em;
|
|
||||||
background: var(--rpg-accent);
|
|
||||||
border-bottom: 2px solid var(--rpg-border);
|
|
||||||
}
|
|
||||||
|
|
||||||
.rpg-dice-popup-header h3 {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 1.25rem;
|
|
||||||
color: var(--rpg-highlight);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.625em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rpg-dice-popup-body {
|
|
||||||
padding: 1.562em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rpg-dice-selector-container {
|
|
||||||
padding: 1.25em;
|
|
||||||
background: rgba(0, 0, 0, 0.3);
|
|
||||||
border-radius: 0.75em;
|
|
||||||
border: 2px solid var(--rpg-border);
|
|
||||||
margin-bottom: 1.25em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rpg-dice-selector {
|
|
||||||
display: flex;
|
|
||||||
gap: 0.938em;
|
|
||||||
margin-bottom: 0.938em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rpg-dice-input-group {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rpg-dice-input-group label {
|
|
||||||
display: block;
|
|
||||||
margin-bottom: 0.5em;
|
|
||||||
font-size: 0.812rem;
|
|
||||||
font-weight: bold;
|
|
||||||
color: var(--rpg-text);
|
|
||||||
}
|
|
||||||
|
|
||||||
.rpg-dice-input-group input,
|
|
||||||
.rpg-dice-input-group select {
|
|
||||||
width: 100%;
|
|
||||||
padding: 0.625em;
|
|
||||||
border: 2px solid var(--rpg-border);
|
|
||||||
border-radius: 0.5em;
|
|
||||||
background: var(--rpg-accent);
|
|
||||||
color: var(--rpg-text);
|
|
||||||
font-size: 1rem;
|
|
||||||
font-weight: bold;
|
|
||||||
text-align: center;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rpg-dice-input-group input:focus,
|
|
||||||
.rpg-dice-input-group select:focus {
|
|
||||||
outline: none;
|
|
||||||
border-color: var(--rpg-highlight);
|
|
||||||
box-shadow: 0 0 10px var(--rpg-highlight);
|
|
||||||
background: rgba(0, 0, 0, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
#rpg-dice-roll-btn {
|
|
||||||
width: 100%;
|
|
||||||
padding: 0.75em 1.25em;
|
|
||||||
background: linear-gradient(135deg, var(--rpg-highlight), var(--rpg-accent));
|
|
||||||
border: 2px solid var(--rpg-highlight);
|
|
||||||
border-radius: 0.625em;
|
|
||||||
color: var(--rpg-text);
|
|
||||||
font-size: 1rem;
|
|
||||||
font-weight: bold;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 0.625em;
|
|
||||||
}
|
|
||||||
|
|
||||||
#rpg-dice-roll-btn:hover {
|
|
||||||
transform: translateY(-0.125rem);
|
|
||||||
box-shadow: 0 6px 20px var(--rpg-highlight);
|
|
||||||
background: var(--rpg-highlight);
|
|
||||||
}
|
|
||||||
|
|
||||||
#rpg-dice-roll-btn:active {
|
|
||||||
transform: translateY(0);
|
|
||||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
|
|
||||||
}
|
|
||||||
|
|
||||||
.rpg-dice-animation {
|
|
||||||
text-align: center;
|
|
||||||
padding: 2.5em 1.25em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rpg-dice-rolling i {
|
|
||||||
font-size: 5rem;
|
|
||||||
color: var(--rpg-highlight);
|
|
||||||
animation: diceRoll 0.8s ease-in-out infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes diceRoll {
|
@keyframes diceRoll {
|
||||||
0%, 100% {
|
0%, 100% { transform: rotate(0deg); }
|
||||||
transform: rotate(0deg) scale(1);
|
25% { transform: rotate(90deg) scale(1.1); }
|
||||||
}
|
50% { transform: rotate(180deg); }
|
||||||
25% {
|
75% { transform: rotate(270deg) scale(1.1); }
|
||||||
transform: rotate(90deg) scale(1.1);
|
|
||||||
}
|
|
||||||
50% {
|
|
||||||
transform: rotate(180deg) scale(1);
|
|
||||||
}
|
|
||||||
75% {
|
|
||||||
transform: rotate(270deg) scale(1.1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.rpg-dice-rolling-text {
|
|
||||||
margin-top: 1.25em;
|
|
||||||
font-size: 1.125rem;
|
|
||||||
font-weight: bold;
|
|
||||||
color: var(--rpg-highlight);
|
|
||||||
animation: pulseGlow 1s ease-in-out infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rpg-dice-result {
|
|
||||||
text-align: center;
|
|
||||||
padding: 1.875em 1.25em;
|
|
||||||
background: rgba(0, 0, 0, 0.3);
|
|
||||||
border-radius: 0.75em;
|
|
||||||
border: 2px solid var(--rpg-border);
|
|
||||||
}
|
|
||||||
|
|
||||||
.rpg-dice-result-label {
|
|
||||||
font-size: 0.875rem;
|
|
||||||
color: var(--rpg-text);
|
|
||||||
margin-bottom: 0.625em;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.062em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rpg-dice-result-value {
|
|
||||||
font-size: 3.75rem;
|
|
||||||
font-weight: bold;
|
|
||||||
color: var(--rpg-highlight);
|
|
||||||
text-shadow: 0 0 20px var(--rpg-highlight);
|
|
||||||
animation: resultPop 0.5s ease-out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes resultPop {
|
@keyframes resultPop {
|
||||||
0% {
|
0% { transform: scale(0); opacity: 0; }
|
||||||
transform: scale(0);
|
50% { transform: scale(1.1); }
|
||||||
opacity: 0;
|
100% { transform: scale(1); opacity: 1; }
|
||||||
}
|
|
||||||
50% {
|
|
||||||
transform: scale(1.2);
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
transform: scale(1);
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.rpg-dice-result-details {
|
/* Theme Support - CSS Custom Properties */
|
||||||
margin-top: 0.938em;
|
|
||||||
font-size: 0.875rem;
|
|
||||||
color: var(--rpg-text);
|
|
||||||
opacity: 0.8;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rpg-dice-save-btn {
|
|
||||||
margin-top: 1.25em;
|
|
||||||
width: 100%;
|
|
||||||
max-width: 12.5rem;
|
|
||||||
padding: 0.625em 1.25em;
|
|
||||||
background: linear-gradient(135deg, #28a745, #20c997);
|
|
||||||
border: 2px solid #28a745;
|
|
||||||
border-radius: 0.625em;
|
|
||||||
color: white;
|
|
||||||
font-size: 0.938rem;
|
|
||||||
font-weight: bold;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rpg-dice-save-btn:hover {
|
|
||||||
transform: translateY(-0.125rem);
|
|
||||||
box-shadow: 0 6px 20px rgba(40, 167, 69, 0.6);
|
|
||||||
background: #28a745;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rpg-dice-save-btn:active {
|
|
||||||
transform: translateY(0);
|
|
||||||
box-shadow: 0 2px 10px rgba(40, 167, 69, 0.4);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Theme-specific popup styles */
|
|
||||||
.rpg-dice-popup[data-theme="sci-fi"] .rpg-dice-popup-content {
|
.rpg-dice-popup[data-theme="sci-fi"] .rpg-dice-popup-content {
|
||||||
--rpg-bg: #0a0e27;
|
--rpg-bg: #0a0e27;
|
||||||
--rpg-accent: #1a1f3a;
|
--rpg-accent: #1a1f3a;
|
||||||
@@ -2397,6 +2453,35 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
|
|||||||
--rpg-border: #ff00ff;
|
--rpg-border: #ff00ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Desktop Enhancement (1001px+) */
|
||||||
|
@media (min-width: 1001px) {
|
||||||
|
.rpg-dice-popup {
|
||||||
|
--modal-padding: 1.5rem;
|
||||||
|
--modal-gap: 1rem;
|
||||||
|
--modal-font-base: 1rem;
|
||||||
|
--modal-font-small: 0.875rem;
|
||||||
|
--modal-font-large: 3rem;
|
||||||
|
--modal-font-huge: 3.75rem;
|
||||||
|
--modal-max-width: 500px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Side-by-side inputs on desktop */
|
||||||
|
.rpg-dice-selector {
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hover effects on desktop */
|
||||||
|
#rpg-dice-roll-btn:hover,
|
||||||
|
.rpg-dice-save-btn:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 6px 20px currentColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rpg-dice-save-btn {
|
||||||
|
max-width: 200px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ============================================
|
/* ============================================
|
||||||
HTML PROMPT TOGGLE
|
HTML PROMPT TOGGLE
|
||||||
============================================ */
|
============================================ */
|
||||||
|
|||||||
+23
-19
@@ -211,27 +211,29 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Dice Roll Popup -->
|
<!-- Dice Roll Modal -->
|
||||||
<div id="rpg-dice-popup" class="rpg-dice-popup" style="display: none;">
|
<div id="rpg-dice-popup" class="rpg-dice-popup" role="dialog" aria-modal="true" aria-labelledby="rpg-dice-title">
|
||||||
<div class="rpg-dice-popup-overlay"></div>
|
|
||||||
<div class="rpg-dice-popup-content">
|
<div class="rpg-dice-popup-content">
|
||||||
<div class="rpg-dice-popup-header">
|
<header class="rpg-dice-popup-header">
|
||||||
<h3><i class="fa-solid fa-dice-d20"></i> Roll Dice</h3>
|
<h3 id="rpg-dice-title">
|
||||||
<button id="rpg-dice-popup-close" class="rpg-btn-icon">
|
<i class="fa-solid fa-dice-d20" aria-hidden="true"></i>
|
||||||
<i class="fa-solid fa-times"></i>
|
<span>Roll Dice</span>
|
||||||
|
</h3>
|
||||||
|
<button id="rpg-dice-popup-close" class="rpg-btn-icon" type="button" aria-label="Close dialog">
|
||||||
|
<i class="fa-solid fa-times" aria-hidden="true"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</header>
|
||||||
|
|
||||||
<div class="rpg-dice-popup-body">
|
<div class="rpg-dice-popup-body">
|
||||||
<div class="rpg-dice-selector-container">
|
<div class="rpg-dice-selector-container">
|
||||||
<div class="rpg-dice-selector">
|
<div class="rpg-dice-selector">
|
||||||
<div class="rpg-dice-input-group">
|
<div class="rpg-dice-input-group">
|
||||||
<label for="rpg-dice-count">Number of Dice:</label>
|
<label for="rpg-dice-count">Number of Dice:</label>
|
||||||
<input type="number" id="rpg-dice-count" min="1" max="20" value="1" class="rpg-input" />
|
<input type="number" id="rpg-dice-count" name="dice-count" min="1" max="20" value="1" class="rpg-input" />
|
||||||
</div>
|
</div>
|
||||||
<div class="rpg-dice-input-group">
|
<div class="rpg-dice-input-group">
|
||||||
<label for="rpg-dice-sides">Dice Type:</label>
|
<label for="rpg-dice-sides">Dice Type:</label>
|
||||||
<select id="rpg-dice-sides" class="rpg-select">
|
<select id="rpg-dice-sides" name="dice-sides" class="rpg-select">
|
||||||
<option value="4">d4</option>
|
<option value="4">d4</option>
|
||||||
<option value="6">d6</option>
|
<option value="6">d6</option>
|
||||||
<option value="8">d8</option>
|
<option value="8">d8</option>
|
||||||
@@ -242,24 +244,26 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button id="rpg-dice-roll-btn" class="rpg-btn-primary">
|
<button id="rpg-dice-roll-btn" class="rpg-btn-primary" type="button">
|
||||||
<i class="fa-solid fa-dice"></i> Roll Dice
|
<i class="fa-solid fa-dice" aria-hidden="true"></i>
|
||||||
|
<span>Roll Dice</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="rpg-dice-animation" class="rpg-dice-animation" style="display: none;">
|
<div id="rpg-dice-animation" class="rpg-dice-animation" hidden aria-live="polite" aria-busy="true">
|
||||||
<div class="rpg-dice-rolling">
|
<div class="rpg-dice-rolling">
|
||||||
<i class="fa-solid fa-dice-d20 fa-spin"></i>
|
<i class="fa-solid fa-dice-d20 fa-spin" aria-hidden="true"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="rpg-dice-rolling-text">Rolling...</div>
|
<div class="rpg-dice-rolling-text">Rolling...</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="rpg-dice-result" class="rpg-dice-result" style="display: none;">
|
<div id="rpg-dice-result" class="rpg-dice-result" hidden aria-live="polite">
|
||||||
<div class="rpg-dice-result-label">Result:</div>
|
<div class="rpg-dice-result-label">Result:</div>
|
||||||
<div id="rpg-dice-result-value" class="rpg-dice-result-value">0</div>
|
<output id="rpg-dice-result-value" class="rpg-dice-result-value" for="rpg-dice-count rpg-dice-sides">0</output>
|
||||||
<div id="rpg-dice-result-details" class="rpg-dice-result-details"></div>
|
<div id="rpg-dice-result-details" class="rpg-dice-result-details" role="status"></div>
|
||||||
<button id="rpg-dice-save-btn" class="rpg-btn-primary rpg-dice-save-btn">
|
<button id="rpg-dice-save-btn" class="rpg-btn-primary rpg-dice-save-btn" type="button">
|
||||||
<i class="fa-solid fa-check"></i> Save Roll
|
<i class="fa-solid fa-check" aria-hidden="true"></i>
|
||||||
|
<span>Save Roll</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user