Wire styleguide.css and ajax.js into root.mako globally

- Load styleguide.css before style.css so new design tokens are
  available app-wide and new styles take precedence
- Load ajax.js after scripts.min.js — provides qs(), onReady(),
  onDelegate(), setCookie(), getCookie(), and other vanilla utilities
- Keep jQuery's $ intact via qs() alias to avoid breaking existing code
- Add no-js class to <html> for capability-driven presentation
- Update error_document.mako with same CSS/JS stack
This commit is contained in:
russell@unturf.com 2026-02-19 20:18:09 -05:00
parent dc3502fed0
commit 1dac65fc8a
3 changed files with 18 additions and 12 deletions

View file

@ -8,10 +8,13 @@
DOM UTILITIES
===================================================================== */
/** Query single element */
window.$ = function(selector, context) {
/** Query single element — only override $ if jQuery is not loaded */
window.qs = function(selector, context) {
return (context || document).querySelector(selector);
};
if (!window.jQuery) {
window.$ = window.qs;
}
/** Query all elements */
window.$$ = function(selector, context) {
@ -89,17 +92,17 @@
===================================================================== */
window.show = function(el) {
if (typeof el === 'string') el = $(el);
if (typeof el === 'string') el = qs(el);
if (el) el.style.display = '';
};
window.hide = function(el) {
if (typeof el === 'string') el = $(el);
if (typeof el === 'string') el = qs(el);
if (el) el.style.display = 'none';
};
window.toggle = function(el) {
if (typeof el === 'string') el = $(el);
if (typeof el === 'string') el = qs(el);
if (!el) return;
el.style.display = (el.style.display === 'none') ? '' : 'none';
};
@ -128,14 +131,14 @@
===================================================================== */
window.openDialog = function(selector) {
var dialog = typeof selector === 'string' ? $(selector) : selector;
var dialog = typeof selector === 'string' ? qs(selector) : selector;
if (dialog && dialog.showModal) {
dialog.showModal();
}
};
window.closeDialog = function(selector) {
var dialog = typeof selector === 'string' ? $(selector) : selector;
var dialog = typeof selector === 'string' ? qs(selector) : selector;
if (dialog && dialog.close) {
dialog.close();
}
@ -166,7 +169,7 @@
===================================================================== */
window.tooltip = function(el, text) {
if (typeof el === 'string') el = $(el);
if (typeof el === 'string') el = qs(el);
if (!el) return;
el.setAttribute('title', text);
};
@ -184,7 +187,7 @@
===================================================================== */
window.dismissAlert = function(el) {
if (typeof el === 'string') el = $(el);
if (typeof el === 'string') el = qs(el);
if (!el) return;
el.style.transition = 'opacity 0.2s';
el.style.opacity = '0';
@ -196,7 +199,7 @@
===================================================================== */
window.scrollToElement = function(selector) {
var el = typeof selector === 'string' ? $(selector) : selector;
var el = typeof selector === 'string' ? qs(selector) : selector;
if (el) {
el.scrollIntoView({ behavior: 'smooth', block: 'start' });
}