CSSの最適化や内部挙動の改良

This commit is contained in:
2026-04-23 00:03:55 +09:00
parent 2f061f8bcd
commit 5ef801aae1
22 changed files with 1092 additions and 1019 deletions

View File

@@ -1,5 +1,3 @@
/* Custom styles for Homework Manager */
:root {
--primary-color: #4361ee;
--secondary-color: #3f37c9;
@@ -13,8 +11,8 @@ body {
display: flex;
flex-direction: column;
background-color: #f8f9fa;
margin-top: 0 !important;
padding-top: 0 !important;
margin-top: 0;
padding-top: 0;
}
.countdown {
@@ -27,7 +25,6 @@ main {
flex: 1;
}
/* Card enhancements */
.card {
border: none;
border-radius: 0.75rem;
@@ -44,7 +41,6 @@ main {
font-weight: 600;
}
/* Navbar customization */
.navbar {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
@@ -53,7 +49,6 @@ main {
font-weight: 700;
}
/* Table improvements */
.table {
background-color: #fff;
border-radius: 0.5rem;
@@ -69,7 +64,6 @@ main {
background-color: rgba(67, 97, 238, 0.05);
}
/* Button styles */
.btn {
border-radius: 0.5rem;
font-weight: 500;
@@ -85,25 +79,21 @@ main {
border-color: var(--secondary-color);
}
/* Badge styles */
.badge {
font-weight: 500;
padding: 0.4em 0.8em;
}
/* Form styles */
.form-control:focus {
border-color: var(--primary-color);
box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.25);
}
/* Alert enhancements */
.alert {
border: none;
border-radius: 0.5rem;
}
/* Stats cards */
.card.bg-primary,
.card.bg-warning,
.card.bg-info,
@@ -119,27 +109,38 @@ main {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
/* Tabs - Removed conflicted specific styles as they are managed in templates */
.nav-tabs .nav-link {
font-weight: 500;
font-size: 0.9rem;
padding: 0.5rem 1rem;
color: #6c757d;
border: none;
}
.nav-tabs .nav-link:hover {
color: #000;
border: none;
}
.nav-tabs .nav-link.active {
color: #000;
font-weight: 700;
border-bottom: 3px solid #000;
background: transparent;
}
/* Footer */
.footer {
border-top: 1px solid #e9ecef;
}
/* Login/Register cards */
.card.shadow {
border-radius: 1rem;
}
/* Empty states */
.text-muted.display-1 {
color: #dee2e6 !important;
color: #dee2e6;
}
/* Responsive adjustments */
@media (max-width: 768px) {
.card-body {
padding: 0.75rem;
@@ -150,68 +151,12 @@ main {
}
}
.table td,
.table th {
padding: 0.35rem 0.5rem !important;
}
.page-header {
margin-bottom: 0.75rem !important;
}
/* Animations for Anxiety/Urgency */
@keyframes pulse-bg {
0%,
100% {
background-color: #fff3cd;
}
50% {
background-color: #ffe69c;
}
}
@keyframes pulse-bg-danger {
0%,
100% {
background-color: #f8d7da;
}
50% {
background-color: #f5c2c7;
}
}
@keyframes blink-text {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.7;
}
}
.anxiety-warning {
animation: pulse-bg 2s infinite;
}
.anxiety-danger {
animation: pulse-bg-danger 1s infinite;
}
/* Custom Table Styles - Compact */
.custom-table thead th {
border-bottom: 2px solid #dee2e6;
font-size: 0.8rem;
color: #495057;
font-weight: 600;
padding-top: 0.5rem !important;
padding-bottom: 0.5rem !important;
padding: 0.35rem 0.5rem;
white-space: nowrap;
}
@@ -222,8 +167,7 @@ main {
.custom-table tbody td {
border-bottom: 1px solid #dee2e6;
vertical-align: middle;
padding-top: 0.5rem !important;
padding-bottom: 0.5rem !important;
padding: 0.35rem 0.5rem;
font-size: 0.9rem;
}
@@ -231,7 +175,10 @@ main {
border-bottom: none;
}
/* Compact form elements */
.page-header {
margin-bottom: 0.75rem;
}
.form-control-custom,
.form-select-custom,
.btn-custom {
@@ -240,41 +187,87 @@ main {
border-radius: 0.25rem;
}
/* Custom Tab Styles */
.nav-tabs .nav-link {
font-size: 0.9rem;
padding: 0.5rem 1rem;
color: #6c757d;
/* text-muted */
border: none;
}
.nav-tabs .nav-link:hover {
color: #000;
border: none;
}
.nav-tabs .nav-link.active {
color: #000 !important;
font-weight: 700;
border-bottom: 3px solid #000 !important;
background: transparent;
}
/* Status Icon Size */
.bi-circle,
.bi-check-circle-fill {
font-size: 1rem;
}
/* Urgency styles for countdown */
.countdown-urgent {
color: #dc3545;
font-weight: 700;
animation: blink-text 1s infinite;
}
.countdown-warning {
color: #fd7e14;
font-weight: 700;
}
}
@keyframes pulse-bg {
0%, 100% { background-color: #fff3cd; }
50% { background-color: #ffe69c; }
}
@keyframes pulse-bg-danger {
0%, 100% { background-color: #f8d7da; }
50% { background-color: #f5c2c7; }
}
@keyframes blink-text {
0%, 100% { opacity: 1; }
50% { opacity: 0.7; }
}
@keyframes blink-banner {
0%, 100% { opacity: 1; }
50% { opacity: 0.75; }
}
.anxiety-warning {
animation: pulse-bg 2s infinite;
}
.anxiety-danger {
animation: pulse-bg-danger 1s infinite;
}
.urgent-banner {
position: relative;
animation: blink-banner 1.5s infinite;
}
@media (prefers-reduced-motion: reduce) {
*, ::before, ::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}
#weekday_group,
#day_group {
display: none;
}
.btn-touch {
min-width: 44px;
min-height: 44px;
display: inline-flex;
align-items: center;
justify-content: center;
}
.copy-feedback {
position: fixed;
bottom: 1.5rem;
right: 1.5rem;
z-index: 9999;
opacity: 0;
transform: translateY(0.5rem);
transition: opacity 0.2s ease, transform 0.2s ease;
pointer-events: none;
}
.copy-feedback.show {
opacity: 1;
transform: translateY(0);
}

View File

@@ -7,9 +7,7 @@ const XSS = {
},
setTextSafe: function (element, text) {
if (element) {
element.textContent = text;
}
if (element) element.textContent = text;
},
sanitizeUrl: function (url) {
@@ -17,13 +15,9 @@ const XSS = {
const cleaned = String(url).replace(/[\x00-\x1F\x7F]/g, '').trim();
try {
const parsed = new URL(cleaned, window.location.origin);
if (parsed.protocol === 'http:' || parsed.protocol === 'https:') {
return parsed.href;
}
if (parsed.protocol === 'http:' || parsed.protocol === 'https:') return parsed.href;
} catch (e) {
if (cleaned.startsWith('/') && !cleaned.startsWith('//')) {
return cleaned;
}
if (cleaned.startsWith('/') && !cleaned.startsWith('//')) return cleaned;
}
return '';
}
@@ -31,26 +25,73 @@ const XSS = {
window.XSS = XSS;
let _pendingConfirmForm = null;
function showConfirmModal(message, onOk) {
const bodyEl = document.getElementById('confirmModalBody');
const okBtn = document.getElementById('confirmModalOk');
if (!bodyEl || !okBtn) { if (onOk) onOk(); return; }
bodyEl.textContent = message;
const handler = function () {
okBtn.removeEventListener('click', handler);
bootstrap.Modal.getInstance(document.getElementById('confirmModal')).hide();
if (onOk) onOk();
};
okBtn.addEventListener('click', handler);
new bootstrap.Modal(document.getElementById('confirmModal')).show();
}
window.showConfirmModal = showConfirmModal;
function setupFormSubmitOnce(form) {
form.addEventListener('submit', function () {
const btn = form.querySelector('[type=submit]');
if (!btn || btn.disabled) return;
btn.disabled = true;
const orig = btn.innerHTML;
btn.innerHTML = '<span class="spinner-border spinner-border-sm me-1" role="status" aria-hidden="true"></span>処理中...';
window.addEventListener('pageshow', function () {
btn.disabled = false;
btn.innerHTML = orig;
}, { once: true });
});
}
function showCopyFeedback(message) {
let el = document.getElementById('globalCopyFeedback');
if (!el) {
el = document.createElement('div');
el.id = 'globalCopyFeedback';
el.className = 'copy-feedback alert alert-success shadow-sm py-2 px-3';
document.body.appendChild(el);
}
el.textContent = message;
el.classList.add('show');
clearTimeout(el._timeout);
el._timeout = setTimeout(function () { el.classList.remove('show'); }, 2000);
}
window.showCopyFeedback = showCopyFeedback;
document.addEventListener('DOMContentLoaded', function () {
const alerts = document.querySelectorAll('.alert:not(.alert-danger):not(.modal .alert)');
alerts.forEach(function (alert) {
setTimeout(function () {
alert.classList.add('fade');
setTimeout(function () {
alert.remove();
}, 150);
setTimeout(function () { alert.remove(); }, 150);
}, 5000);
});
const confirmForms = document.querySelectorAll('form[data-confirm]');
confirmForms.forEach(function (form) {
document.querySelectorAll('form[data-confirm]').forEach(function (form) {
form.addEventListener('submit', function (e) {
if (!confirm(form.dataset.confirm)) {
e.preventDefault();
}
e.preventDefault();
const msg = form.dataset.confirm;
showConfirmModal(msg, function () { form.submit(); });
});
});
document.querySelectorAll('form:not([data-confirm])').forEach(setupFormSubmitOnce);
const dueDateInput = document.getElementById('due_date');
if (dueDateInput && !dueDateInput.value) {
const tomorrow = new Date();