Compare commits
110 Commits
f0ce3b29d6
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 38e16687cb | |||
| 2ade28e9cd | |||
| a9b90729ff | |||
| ce17d2d5bf | |||
| 8f570ca4d3 | |||
| da56bfce7a | |||
| f38f4af4ca | |||
| ff5d2a7816 | |||
| 3961bc3345 | |||
| 3974237f42 | |||
| 3822b0cdf7 | |||
| 8451fa9f54 | |||
| 26cfa8b868 | |||
| 3f7a343b17 | |||
| 217c0b0028 | |||
| a63ed16871 | |||
| 6e45dca49a | |||
| 1ec09e1b76 | |||
| cf30e830a0 | |||
| 65b85f1575 | |||
| 49b30a69e9 | |||
| 6c75140533 | |||
| 1002456a0c | |||
| f6f1502f1a | |||
| 615a14b5a8 | |||
| 08a4ef346a | |||
| 1fab01ffb9 | |||
| 441eec4e0c | |||
| d671e64c85 | |||
| 6c868f3768 | |||
| 7a8a463169 | |||
| 0f7f83c618 | |||
| bf04c9569a | |||
| 483b20e13d | |||
| 757aa60ec4 | |||
| ead5d58d21 | |||
| 3a591be7dc | |||
| 7f706f12cd | |||
| b2d8754c7e | |||
| 1a61d7b3cc | |||
| 93fe6bcdd2 | |||
| 456f0744c4 | |||
| 7bfee30e71 | |||
| 2e6d870c0f | |||
| 88c37b566a | |||
| 47d4a66b0f | |||
| 38a7de5ef8 | |||
| 5e2ec31e4f | |||
| ec8f238a05 | |||
| 01f06b84b2 | |||
| c991a58296 | |||
| 13dd3ec664 | |||
| 7e060760e7 | |||
| d32b672289 | |||
| 5e703813d7 | |||
| d11b8cf19f | |||
| 51aaa52112 | |||
| 3a2df03eb3 | |||
| 3ea7f1e69f | |||
| bc39eb3169 | |||
| ebbfc215b1 | |||
| 65e8457359 | |||
| f4d4f518c6 | |||
| 1d887cf2ca | |||
| 80e58578fc | |||
| 9256d5ecb7 | |||
| 4b8b29a657 | |||
| b749cfe5f4 | |||
| 342e5c9c72 | |||
| a486b97a2a | |||
| 81c93710ed | |||
| db3b93fc1b | |||
| 9031736f7a | |||
| a6375d4148 | |||
| 7e4e4af00e | |||
| 1e1a961dc2 | |||
| 356e904abc | |||
| a1f987ff59 | |||
| 8789b96ada | |||
| d8874f1164 | |||
| fb5cec7837 | |||
| 979acd4483 | |||
| d7ba0479f4 | |||
| 794631dcba | |||
| fe8fa11f91 | |||
| 85e5979414 | |||
| c7c1823594 | |||
| f40f3b8425 | |||
| 69e426d9ce | |||
| 4f7f47dc1c | |||
| 40a7d87832 | |||
| 433c4e6a75 | |||
| eb3e206006 | |||
| 3005465d1d | |||
| 0a55bba1c9 | |||
| b4c0799676 | |||
| a39c7216b3 | |||
| 59ba29e5a0 | |||
| 31b326b090 | |||
| 3a765e01a8 | |||
| 2c90b77885 | |||
| dbbb21b3d8 | |||
| b7a074a75d | |||
| d1514ee828 | |||
| efbb9513da | |||
| 8ac0d4943d | |||
| bde1f36642 | |||
| 2838d9373c | |||
| aa2cca60b1 | |||
| 3a63ced4e6 |
@@ -0,0 +1,3 @@
|
|||||||
|
# Build artifacts
|
||||||
|
CoBiEClock.wdgt
|
||||||
|
build-widget/
|
||||||
@@ -54,15 +54,29 @@ An interactive web app that visualizes the **CosmoChron Binary Epoch (CoBiE)** t
|
|||||||
|
|
||||||
```
|
```
|
||||||
├── index.html # Main HTML markup
|
├── index.html # Main HTML markup
|
||||||
├── analog.html # Analog clock interface
|
|
||||||
├── clock.js # Clock logic
|
├── clock.js # Clock logic
|
||||||
|
├── cobie.js # CoBiE time system utilities
|
||||||
|
├── utils.js # Generic helper functions
|
||||||
|
├── animate.js # Shared animations
|
||||||
|
├── events.js # Sample calendar events
|
||||||
├── style.css # Separated styles
|
├── style.css # Separated styles
|
||||||
├── script.js # JavaScript logic
|
├── script.js # Page interactions
|
||||||
├── README.md # This documentation
|
├── README.md # This documentation
|
||||||
└── assets/ # (Optional) images or external CSS/JS
|
└── test/ # Unit tests
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## macOS Widget
|
||||||
|
|
||||||
|
The repository provides a SwiftUI widget inside the Xcode project
|
||||||
|
located at `CoBiE/CoBiE.xcodeproj`.
|
||||||
|
|
||||||
|
1. Open the project in Xcode.
|
||||||
|
2. Select the `CoBiE Analog Clock` scheme.
|
||||||
|
3. Build and run to install the widget on macOS 13 or later.
|
||||||
|
|
||||||
|
The widget displays the analog CoBiE clock directly on your desktop or
|
||||||
|
in Notification Center.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
1. Fork the repository.
|
1. Fork the repository.
|
||||||
|
|||||||
+83
@@ -0,0 +1,83 @@
|
|||||||
|
(function(){
|
||||||
|
const lastAngles = {
|
||||||
|
handXeno: 0,
|
||||||
|
handQuantic: 0,
|
||||||
|
handChronon: 0,
|
||||||
|
handEonstrip: 0,
|
||||||
|
handMegasequence: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
function rotateHand(id, angle) {
|
||||||
|
const el = document.getElementById(id);
|
||||||
|
if (!el) return;
|
||||||
|
const prev = lastAngles[id];
|
||||||
|
|
||||||
|
if (angle < prev) {
|
||||||
|
const target = angle + 360;
|
||||||
|
const handle = () => {
|
||||||
|
el.removeEventListener('transitionend', handle);
|
||||||
|
el.style.transition = 'none';
|
||||||
|
el.style.transform = `translateX(-50%) translateZ(0) rotate(${angle}deg)`;
|
||||||
|
void el.offsetWidth;
|
||||||
|
el.style.transition = '';
|
||||||
|
};
|
||||||
|
el.addEventListener('transitionend', handle, { once: true });
|
||||||
|
el.style.transform = `translateX(-50%) translateZ(0) rotate(${target}deg)`;
|
||||||
|
} else {
|
||||||
|
el.style.transform = `translateX(-50%) translateZ(0) rotate(${angle}deg)`;
|
||||||
|
}
|
||||||
|
lastAngles[id] = angle;
|
||||||
|
}
|
||||||
|
|
||||||
|
function animateSwipe(direction, onDone) {
|
||||||
|
const grid = document.getElementById('eonstripGrid');
|
||||||
|
if (!grid) { onDone(); return; }
|
||||||
|
|
||||||
|
grid.style.transition = 'none';
|
||||||
|
grid.style.transform = 'translateX(0)';
|
||||||
|
void grid.offsetWidth;
|
||||||
|
|
||||||
|
grid.style.transition = 'transform 0.3s ease';
|
||||||
|
grid.style.transform = `translateX(${direction > 0 ? '-100%' : '100%'})`;
|
||||||
|
|
||||||
|
function afterOut() {
|
||||||
|
grid.removeEventListener('transitionend', afterOut);
|
||||||
|
grid.style.transition = 'none';
|
||||||
|
grid.style.transform = `translateX(${direction > 0 ? '100%' : '-100%'})`;
|
||||||
|
onDone();
|
||||||
|
void grid.offsetWidth;
|
||||||
|
grid.style.transition = 'transform 0.3s ease';
|
||||||
|
grid.style.transform = 'translateX(0)';
|
||||||
|
}
|
||||||
|
grid.addEventListener('transitionend', afterOut);
|
||||||
|
}
|
||||||
|
|
||||||
|
function animateDetailSwipe(direction, onDone) {
|
||||||
|
const tl = document.getElementById('detailTimeline');
|
||||||
|
if (!tl) { onDone(); return; }
|
||||||
|
|
||||||
|
tl.style.transition = 'none';
|
||||||
|
tl.style.transform = 'translateX(0)';
|
||||||
|
void tl.offsetWidth;
|
||||||
|
|
||||||
|
tl.style.transition = 'transform 0.3s ease';
|
||||||
|
tl.style.transform = `translateX(${direction > 0 ? '-100%' : '100%'})`;
|
||||||
|
|
||||||
|
function afterOut() {
|
||||||
|
tl.removeEventListener('transitionend', afterOut);
|
||||||
|
tl.style.transition = 'none';
|
||||||
|
tl.style.transform = `translateX(${direction > 0 ? '100%' : '-100%'})`;
|
||||||
|
onDone();
|
||||||
|
void tl.offsetWidth;
|
||||||
|
tl.style.transition = 'transform 0.3s ease';
|
||||||
|
tl.style.transform = 'translateX(0)';
|
||||||
|
}
|
||||||
|
tl.addEventListener('transitionend', afterOut);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.Animate = {
|
||||||
|
rotateHand,
|
||||||
|
animateSwipe,
|
||||||
|
animateDetailSwipe
|
||||||
|
};
|
||||||
|
})();
|
||||||
@@ -9,11 +9,45 @@
|
|||||||
toCobiets
|
toCobiets
|
||||||
} = window.Cobie;
|
} = window.Cobie;
|
||||||
|
|
||||||
// CoBiE helpers pulled from cobie.js
|
function getMarkerOffset(width) {
|
||||||
|
const points = [
|
||||||
|
{ width: 1024, value: 2 },
|
||||||
|
{ width: 450, value: 1.3 },
|
||||||
|
{ width: 200, value: 0.8 }
|
||||||
|
];
|
||||||
|
|
||||||
|
// Sort points by width descending for easier handling
|
||||||
|
points.sort((a, b) => b.width - a.width);
|
||||||
|
|
||||||
|
for (let i = 0; i < points.length - 1; i++) {
|
||||||
|
const p1 = points[i];
|
||||||
|
const p2 = points[i + 1];
|
||||||
|
if (width <= p1.width && width >= p2.width) {
|
||||||
|
// Linear interpolation
|
||||||
|
const t = (width - p2.width) / (p1.width - p2.width);
|
||||||
|
return p2.value + t * (p1.value - p2.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extrapolation for width > max known
|
||||||
|
if (width > points[0].width) {
|
||||||
|
const p1 = points[0];
|
||||||
|
const p2 = points[1];
|
||||||
|
const slope = (p1.value - p2.value) / (p1.width - p2.width);
|
||||||
|
return p1.value + slope * (width - p1.width);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extrapolation for width < min known
|
||||||
|
const p1 = points[points.length - 2];
|
||||||
|
const p2 = points[points.length - 1];
|
||||||
|
const slope = (p2.value - p1.value) / (p2.width - p1.width);
|
||||||
|
return p2.value + slope * (width - p2.width);
|
||||||
|
}
|
||||||
|
|
||||||
function placeMarkers() {
|
function placeMarkers() {
|
||||||
const clock = document.getElementById('clock');
|
const clock = document.getElementById('clock');
|
||||||
let markers = clock.querySelectorAll('.marker');
|
let markers = clock.querySelectorAll('.marker');
|
||||||
|
let ticks = clock.querySelectorAll('.tick');
|
||||||
|
|
||||||
// Create markers if they don't exist yet
|
// Create markers if they don't exist yet
|
||||||
if (markers.length === 0) {
|
if (markers.length === 0) {
|
||||||
@@ -26,71 +60,95 @@
|
|||||||
markers = clock.querySelectorAll('.marker');
|
markers = clock.querySelectorAll('.marker');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Position markers based on the current clock size
|
// Create tick marks once
|
||||||
const radius = clock.offsetWidth / 2 - 20;
|
if (ticks.length === 0) {
|
||||||
|
for (let i = 0; i < 256; i++) {
|
||||||
|
const t = document.createElement('div');
|
||||||
|
t.classList.add('tick');
|
||||||
|
if (i % 16 === 0) t.classList.add('big');
|
||||||
|
else if (i % 8 === 0) t.classList.add('mid');
|
||||||
|
// insert before markers so digits sit on top
|
||||||
|
clock.insertBefore(t, clock.firstChild);
|
||||||
|
}
|
||||||
|
ticks = clock.querySelectorAll('.tick');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unified radius based on the actual clock size
|
||||||
|
const baseRadius = clock.offsetWidth / 2;
|
||||||
|
|
||||||
|
// Tick lengths relative to the clock radius
|
||||||
|
const lenBig = baseRadius * 0.12;
|
||||||
|
const lenMid = baseRadius * 0.08;
|
||||||
|
const lenSmall = baseRadius * 0.05;
|
||||||
|
|
||||||
|
const outerR = baseRadius - 2; // just inside the border
|
||||||
|
|
||||||
|
// Distance from center so marker's outer edge sits just inside the big tick
|
||||||
|
const markerSize = markers[0] ? markers[0].offsetWidth : 0;
|
||||||
|
const inset = baseRadius * 0.001; // 0.1% of the radius
|
||||||
|
const markerRadius = outerR - lenBig - inset + markerSize / 2;
|
||||||
|
|
||||||
markers.forEach((m, i) => {
|
markers.forEach((m, i) => {
|
||||||
const angle = (i / 16) * 2 * Math.PI;
|
const angle = (i / 16) * 2 * Math.PI;
|
||||||
const x = radius * Math.sin(angle);
|
m.style.left = '50%';
|
||||||
const y = -radius * Math.cos(angle);
|
m.style.top = '50%';
|
||||||
m.style.left = `${clock.offsetWidth / 2 + x}px`;
|
m.style.transform =
|
||||||
m.style.top = `${clock.offsetHeight / 2 + y}px`;
|
`translate(-50%, -50%) rotate(${angle}rad) translate(0, -${markerRadius}px) rotate(${-angle}rad)`;
|
||||||
|
});
|
||||||
|
|
||||||
|
ticks.forEach((t, i) => {
|
||||||
|
let len = lenSmall;
|
||||||
|
if (t.classList.contains('big')) len = lenBig;
|
||||||
|
else if (t.classList.contains('mid')) len = lenMid;
|
||||||
|
const innerR = outerR - len;
|
||||||
|
const angle = ((i + 1) / 256) * 2 * Math.PI;
|
||||||
|
t.style.height = `${len}px`;
|
||||||
|
t.style.left = '50%';
|
||||||
|
t.style.top = '50%';
|
||||||
|
t.style.transform = `translate(-50%, 0) rotate(${angle}rad) translate(0, -${innerR}px)`;
|
||||||
|
if (clock.offsetWidth < 200 && !t.classList.contains('big') && !t.classList.contains('mid')) {
|
||||||
|
t.style.display = 'none';
|
||||||
|
} else {
|
||||||
|
t.style.display = '';
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const lastAngles = {
|
|
||||||
handXeno: 0,
|
|
||||||
handQuantic: 0,
|
|
||||||
handChronon: 0,
|
|
||||||
handEonstrip: 0,
|
|
||||||
handMegasequence: 0
|
|
||||||
};
|
|
||||||
|
|
||||||
function rotateHand(id, angle) {
|
function renderClock(cob) {
|
||||||
const el = document.getElementById(id);
|
|
||||||
if (!el) return;
|
|
||||||
const prev = lastAngles[id];
|
|
||||||
|
|
||||||
if (angle < prev) {
|
|
||||||
// When wrapping around (e.g. 15 → 0), animate to one full turn
|
|
||||||
// and then snap back to the new angle to avoid a jump.
|
|
||||||
const target = angle + 360;
|
|
||||||
const handle = () => {
|
|
||||||
el.removeEventListener('transitionend', handle);
|
|
||||||
// Snap back without animation
|
|
||||||
el.style.transition = 'none';
|
|
||||||
el.style.transform = `rotate(${angle}deg)`;
|
|
||||||
void el.offsetWidth;
|
|
||||||
el.style.transition = '';
|
|
||||||
};
|
|
||||||
el.addEventListener('transitionend', handle, { once: true });
|
|
||||||
el.style.transform = `rotate(${target}deg)`;
|
|
||||||
} else {
|
|
||||||
el.style.transform = `rotate(${angle}deg)`;
|
|
||||||
}
|
|
||||||
|
|
||||||
lastAngles[id] = angle;
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateClock() {
|
|
||||||
const now = new Date();
|
|
||||||
const cob = toCobiets(now);
|
|
||||||
// Use fractional progress within each unit so angles stay small
|
// Use fractional progress within each unit so angles stay small
|
||||||
const xf = (cob % COBIE_UNITS.quantic) / COBIE_UNITS.quantic;
|
const xf = (cob % COBIE_UNITS.quantic) / COBIE_UNITS.quantic;
|
||||||
const qf = (cob % COBIE_UNITS.chronon) / COBIE_UNITS.chronon;
|
const qf = (cob % COBIE_UNITS.chronon) / COBIE_UNITS.chronon;
|
||||||
const cf = (cob % COBIE_UNITS.eonstrip) / COBIE_UNITS.eonstrip;
|
const cf = (cob % COBIE_UNITS.eonstrip) / COBIE_UNITS.eonstrip;
|
||||||
const ef = (cob % COBIE_UNITS.megasequence) / COBIE_UNITS.megasequence;
|
const ef = (cob % COBIE_UNITS.megasequence) / COBIE_UNITS.megasequence;
|
||||||
const mf = (cob % COBIE_UNITS.cosmocycle) / COBIE_UNITS.cosmocycle;
|
const mf = (cob % COBIE_UNITS.cosmocycle) / COBIE_UNITS.cosmocycle;
|
||||||
rotateHand('handXeno', xf * 360);
|
Animate.rotateHand('handXeno', xf * 360);
|
||||||
rotateHand('handQuantic', qf * 360);
|
Animate.rotateHand('handQuantic', qf * 360);
|
||||||
rotateHand('handChronon', cf * 360);
|
Animate.rotateHand('handChronon', cf * 360);
|
||||||
rotateHand('handEonstrip', ef * 360);
|
Animate.rotateHand('handEonstrip', ef * 360);
|
||||||
rotateHand('handMegasequence', mf * 360);
|
Animate.rotateHand('handMegasequence', mf * 360);
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateClock() {
|
||||||
|
renderClock(toCobiets(new Date()));
|
||||||
|
}
|
||||||
|
|
||||||
|
let intervalId = null;
|
||||||
|
|
||||||
|
function startClock() {
|
||||||
|
clearInterval(intervalId);
|
||||||
|
updateClock();
|
||||||
|
intervalId = setInterval(updateClock, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
function showTime(cob) {
|
||||||
|
clearInterval(intervalId);
|
||||||
|
renderClock(cob);
|
||||||
}
|
}
|
||||||
|
|
||||||
function initClock() {
|
function initClock() {
|
||||||
placeMarkers();
|
placeMarkers();
|
||||||
updateClock();
|
startClock();
|
||||||
setInterval(updateClock, 1000);
|
|
||||||
const clk = document.getElementById('clock');
|
const clk = document.getElementById('clock');
|
||||||
if (clk) {
|
if (clk) {
|
||||||
clk.addEventListener('click', () => {
|
clk.addEventListener('click', () => {
|
||||||
@@ -100,6 +158,10 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
window.addEventListener('resize', placeMarkers);
|
window.addEventListener('resize', placeMarkers);
|
||||||
|
window.CobieClock = {
|
||||||
|
start: startClock,
|
||||||
|
showTime
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document.readyState === 'loading') {
|
if (document.readyState === 'loading') {
|
||||||
|
|||||||
@@ -19,6 +19,20 @@ const COBIE_UNITS = {
|
|||||||
astralmillennia: 0x1000000000000000
|
astralmillennia: 0x1000000000000000
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const EONSTRIP_NAMES = [
|
||||||
|
'Solprime', 'Lunex', 'Terros', 'Aquarion',
|
||||||
|
'Ventaso', 'Ignisar', 'Crystalos', 'Floraen',
|
||||||
|
'Faunor', 'Nebulus', 'Astraeus', 'Umbranox',
|
||||||
|
'Electros', 'Chronar', 'Radiantae', 'Etherion'
|
||||||
|
];
|
||||||
|
|
||||||
|
const MEGASEQUENCE_NAMES = [
|
||||||
|
'Azurean Tide', 'Sable Gleam', 'Verdanth Starfall', 'Crimson Dusk',
|
||||||
|
'Cobalt Frost', 'Amber Blaze', 'Viridian Bloom', 'Argent Veil',
|
||||||
|
'Helian Rise', 'Nocturne Shade', 'Celestine Aura', 'Pyralis Light',
|
||||||
|
'Zephyrine Whisper', 'Lustran Bounty', 'Umbral Echo', 'Mythran Epoch'
|
||||||
|
];
|
||||||
|
|
||||||
function floorDiv(a, b) {
|
function floorDiv(a, b) {
|
||||||
return Math.trunc(a / b);
|
return Math.trunc(a / b);
|
||||||
}
|
}
|
||||||
@@ -172,7 +186,9 @@ const Cobie = {
|
|||||||
toCobiets,
|
toCobiets,
|
||||||
fromCobiets,
|
fromCobiets,
|
||||||
formatCobieTimestamp,
|
formatCobieTimestamp,
|
||||||
breakdownNonNeg
|
breakdownNonNeg,
|
||||||
|
EONSTRIP_NAMES,
|
||||||
|
MEGASEQUENCE_NAMES
|
||||||
};
|
};
|
||||||
|
|
||||||
if (typeof module !== 'undefined' && module.exports) {
|
if (typeof module !== 'undefined' && module.exports) {
|
||||||
|
|||||||
@@ -1,14 +1,27 @@
|
|||||||
// Configuration of periodic events in CoBiE time
|
// Configuration of periodic events in CoBiE time
|
||||||
// Each event repeats every cosmocycle.
|
// Each object describes when the event occurs and how often it repeats.
|
||||||
// "cobie" is the timestamp within the cosmocycle when the event occurs.
|
//
|
||||||
// "tag" is a short label that will be displayed on the calendar.
|
// Fields:
|
||||||
|
// start - CoBiE timestamp when the first occurrence happens.
|
||||||
|
// end - optional CoBiE timestamp after which the event stops.
|
||||||
|
// unit - the unit of the recurrence ("second", "xenocycle", "quantic",
|
||||||
|
// "chronon", "eonstrip", "megasequence", "cosmocycle", ...).
|
||||||
|
// interval - how many units between occurrences (1 = every unit,
|
||||||
|
// 2 = every second unit, ...).
|
||||||
|
// label - short description displayed on the calendar.
|
||||||
|
// duration - optional length of the event in seconds.
|
||||||
|
// showMega - optional boolean, show label on the megasequence view (default true).
|
||||||
|
// showDetail - optional boolean, show event in the detail view (default true).
|
||||||
|
// color - optional hex color for the event (used in detail view)
|
||||||
|
|
||||||
window.SPECIAL_EVENTS = [
|
window.SPECIAL_EVENTS = [
|
||||||
{ cobie: '49f4.9332', label: 'Afina', megasequence: 'Mythran Epoch', eonstrip: 'Ventaso' },
|
{ cobie: '49f4.9332', label: 'Afina', color: '#e57373', unit: 'cosmocycle', interval: 1 },
|
||||||
{ cobie: '11e5.f552', label: 'Oleks', megasequence: 'Umbral Echo', eonstrip: 'Ignisar' },
|
{ cobie: '11e5.f552', label: 'Oleks', color: '#64b5f6', unit: 'cosmocycle', interval: 1 },
|
||||||
{ cobie: '4d07.a2b2', label: 'Vincent', megasequence: 'Azurean Tide', eonstrip: 'Floraen' },
|
{ cobie: '4d07.a2b2', label: 'Vincent', color: '#81c784', unit: 'cosmocycle', interval: 1 },
|
||||||
{ cobie: '3edc.d430', label: 'Hochzeitstag', megasequence: 'Lustran Bounty', eonstrip: 'Electros' },
|
{ cobie: '3edc.d430', label: 'Hochzeitstag', color: '#ffb74d', unit: 'cosmocycle', interval: 1 },
|
||||||
{ cobie: '330d.d4ae', label: 'Zusammentag', megasequence: 'Azurean Tide', eonstrip: 'Chronar' },
|
{ cobie: '330d.d4ae', label: 'Zusammentag', color: '#ba68c8', unit: 'cosmocycle', interval: 1 },
|
||||||
{ cobie: '11de.0c52', label: 'Anna', megasequence: 'Lustran Bounty', eonstrip: 'Radiantae' },
|
{ cobie: '11de.0c52', label: 'Anna', color: '#4db6ac', unit: 'cosmocycle', interval: 1 },
|
||||||
{ cobie: '467f.ae61', label: 'Iris', megasequence: 'Argent Veil', eonstrip: 'Etherion' }
|
{ cobie: '467f.ae61', label: 'Iris', color: '#7986cb', unit: 'cosmocycle', interval: 1 },
|
||||||
|
{ cobie: '6854.7a75', label: 'Sleep', color: '#546e7a', unit: 'second', interval: 86400, duration: 28800, showMega: false },
|
||||||
|
{ cobie: '6854.9695', label: 'Night', color: '#212121', unit: 'second', interval: 86400, duration: 28800, showMega: false, shiftWithTimezone: true }
|
||||||
];
|
];
|
||||||
|
|||||||
+18
-2
@@ -31,7 +31,8 @@
|
|||||||
<div class="hand chronon" id="handChronon"></div>
|
<div class="hand chronon" id="handChronon"></div>
|
||||||
<div class="hand quantic" id="handQuantic"></div>
|
<div class="hand quantic" id="handQuantic"></div>
|
||||||
<div class="hand xeno" id="handXeno"></div>
|
<div class="hand xeno" id="handXeno"></div>
|
||||||
<div class="clock-label">CoBiE Time</div>
|
<div class="clock-center"></div>
|
||||||
|
<div class="clock-label">CoBiE</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -60,11 +61,24 @@
|
|||||||
<button onclick="goToNow()">Now</button>
|
<button onclick="goToNow()">Now</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="calendar-view">
|
<div class="calendar-view" id="calendarView">
|
||||||
<div class="calendar-header" id="calendarHeader">Loading...</div>
|
<div class="calendar-header" id="calendarHeader">Loading...</div>
|
||||||
<div class="eonstrip-grid" id="eonstripGrid"></div>
|
<div class="eonstrip-grid" id="eonstripGrid"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="eonstripDetailView" class="detail-view" style="display:none;">
|
||||||
|
<div class="detail-header">
|
||||||
|
<button id="backToCalendar" class="back-btn">Back</button>
|
||||||
|
<div class="detail-nav">
|
||||||
|
<button id="detailPrev" class="back-btn">←</button>
|
||||||
|
<button id="detailNow" class="back-btn">Now</button>
|
||||||
|
<button id="detailNext" class="back-btn">→</button>
|
||||||
|
</div>
|
||||||
|
<span id="detailTitle"></span>
|
||||||
|
</div>
|
||||||
|
<div class="detail-timeline" id="detailTimeline"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="time-details">
|
<div class="time-details">
|
||||||
<h3 style="text-align: center; margin-bottom: 20px; color: #00ffff;">Time Breakdown</h3>
|
<h3 style="text-align: center; margin-bottom: 20px; color: #00ffff;">Time Breakdown</h3>
|
||||||
|
|
||||||
@@ -153,6 +167,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="cobie.js"></script>
|
<script src="cobie.js"></script>
|
||||||
|
<script src="utils.js"></script>
|
||||||
|
<script src="animate.js"></script>
|
||||||
<script src="events.js"></script>
|
<script src="events.js"></script>
|
||||||
<script src="script.js"></script>
|
<script src="script.js"></script>
|
||||||
<script src="clock.js"></script>
|
<script src="clock.js"></script>
|
||||||
|
|||||||
@@ -20,19 +20,7 @@ const {
|
|||||||
breakdownNonNeg
|
breakdownNonNeg
|
||||||
} = window.Cobie;
|
} = window.Cobie;
|
||||||
|
|
||||||
const EONSTRIP_NAMES = [
|
const { EONSTRIP_NAMES, MEGASEQUENCE_NAMES } = window.Cobie;
|
||||||
'Solprime', 'Lunex', 'Terros', 'Aquarion',
|
|
||||||
'Ventaso', 'Ignisar', 'Crystalos', 'Floraen',
|
|
||||||
'Faunor', 'Nebulus', 'Astraeus', 'Umbranox',
|
|
||||||
'Electros', 'Chronar', 'Radiantae', 'Etherion'
|
|
||||||
];
|
|
||||||
|
|
||||||
const MEGASEQUENCE_NAMES = [
|
|
||||||
'Azurean Tide', 'Sable Gleam', 'Verdanth Starfall', 'Crimson Dusk',
|
|
||||||
'Cobalt Frost', 'Amber Blaze', 'Viridian Bloom', 'Argent Veil',
|
|
||||||
'Helian Rise', 'Nocturne Shade', 'Celestine Aura', 'Pyralis Light',
|
|
||||||
'Zephyrine Whisper', 'Lustran Bounty', 'Umbral Echo', 'Mythran Epoch'
|
|
||||||
];
|
|
||||||
|
|
||||||
let currentOffset = 0;
|
let currentOffset = 0;
|
||||||
let currentTimezone = 'UTC';
|
let currentTimezone = 'UTC';
|
||||||
@@ -42,13 +30,53 @@ let compareManualMode = false;
|
|||||||
let compareCobiets = 0;
|
let compareCobiets = 0;
|
||||||
let updateInterval;
|
let updateInterval;
|
||||||
let lastRenderedEonstrip = null;
|
let lastRenderedEonstrip = null;
|
||||||
|
let currentDetailCob = null;
|
||||||
|
|
||||||
function fmt(d, o) {
|
// ── Utility color helpers (in utils.js) ───────────────────────────────────
|
||||||
// shift if TAI, then format
|
const {
|
||||||
const shifted = currentTimezone==='TAI'
|
parseColor,
|
||||||
? new Date(d.getTime() + getTAIOffsetAt(d)*1000)
|
hexToRgba,
|
||||||
: d;
|
getContrastColor,
|
||||||
return shifted.toLocaleString('en-US', o);
|
lightenColor,
|
||||||
|
getHumanDiff
|
||||||
|
} = window.Utils;
|
||||||
|
|
||||||
|
const dateOptions = (long = true) => ({
|
||||||
|
timeZone: currentTimezone === 'TAI' ? 'UTC' : currentTimezone,
|
||||||
|
weekday: 'long',
|
||||||
|
year: 'numeric',
|
||||||
|
month: long ? 'long' : 'short',
|
||||||
|
day: 'numeric',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit',
|
||||||
|
second: '2-digit',
|
||||||
|
hour12: false
|
||||||
|
});
|
||||||
|
|
||||||
|
function applyEventColors(elem, color, alpha) {
|
||||||
|
if (!color || !elem) return;
|
||||||
|
elem.style.setProperty('--bg-color', hexToRgba(color, alpha));
|
||||||
|
// Use a lighter shade for the border so it stands out even for dark colors
|
||||||
|
elem.style.setProperty('--border-color', lightenColor(color, 0.4));
|
||||||
|
elem.style.setProperty('--text-color', getContrastColor(color));
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTimezoneOffsetSeconds(date) {
|
||||||
|
if (currentTimezone === 'UTC') return 0;
|
||||||
|
if (currentTimezone === 'TAI') return getTAIOffsetAt(date);
|
||||||
|
const dtf = new Intl.DateTimeFormat('en-US', {
|
||||||
|
timeZone: currentTimezone,
|
||||||
|
year: 'numeric', month: '2-digit', day: '2-digit',
|
||||||
|
hour: '2-digit', minute: '2-digit', second: '2-digit',
|
||||||
|
hour12: false
|
||||||
|
});
|
||||||
|
const parts = dtf.formatToParts(date).reduce((acc, p) => {
|
||||||
|
if (p.type !== 'literal') acc[p.type] = parseInt(p.value, 10);
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
const utcTime = Date.UTC(parts.year, parts.month - 1, parts.day,
|
||||||
|
parts.hour, parts.minute, parts.second);
|
||||||
|
return (utcTime - date.getTime()) / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatSafeDate(rawDate, cobSeconds, intlOptions) {
|
function formatSafeDate(rawDate, cobSeconds, intlOptions) {
|
||||||
@@ -70,74 +98,45 @@ function formatSafeDate(rawDate, cobSeconds, intlOptions) {
|
|||||||
|
|
||||||
// parseCobiets, floorDiv and other CoBiE helpers are provided by cobie.js
|
// parseCobiets, floorDiv and other CoBiE helpers are provided by cobie.js
|
||||||
|
|
||||||
function getCurrentTAIOffset() {
|
|
||||||
return getTAIOffsetAt(new Date());
|
|
||||||
}
|
|
||||||
|
|
||||||
function getHumanDiff(d1, d2) {
|
|
||||||
// make sure start ≤ end
|
|
||||||
let start = d1 < d2 ? d1 : d2;
|
|
||||||
let end = d1 < d2 ? d2 : d1;
|
|
||||||
|
|
||||||
// 1) year/month/day difference
|
// ── Event utilities ──────────────────────────────────────────────────────
|
||||||
let years = end.getUTCFullYear() - start.getUTCFullYear();
|
const normalizeEvent = ev => {
|
||||||
let months = end.getUTCMonth() - start.getUTCMonth();
|
const baseStart = parseCobiets(ev.start || ev.cobie);
|
||||||
let days = end.getUTCDate() - start.getUTCDate();
|
if (baseStart === null) return null;
|
||||||
|
const tzShift = ev.shiftWithTimezone ?
|
||||||
// if day roll-under, borrow from month
|
getTimezoneOffsetSeconds(fromCobiets(baseStart)) : 0;
|
||||||
if (days < 0) {
|
const startCob = baseStart - tzShift;
|
||||||
months--;
|
const endCob = ev.end ? parseCobiets(ev.end) - tzShift : Number.POSITIVE_INFINITY;
|
||||||
// days in the month *before* `end`’s month:
|
const unitVal = COBIE_UNITS[ev.unit] || COBIE_UNITS.cosmocycle;
|
||||||
let prevMonthDays = new Date(Date.UTC(
|
const interval = (ev.interval || 1) * unitVal;
|
||||||
end.getUTCFullYear(),
|
let duration = 0;
|
||||||
end.getUTCMonth(), 0
|
if (typeof ev.duration === 'string') {
|
||||||
)).getUTCDate();
|
const d = parseCobiets(ev.duration);
|
||||||
days += prevMonthDays;
|
if (d !== null) duration = d;
|
||||||
}
|
} else if (typeof ev.duration === 'number') {
|
||||||
// if month roll-under, borrow from year
|
duration = ev.duration;
|
||||||
if (months < 0) {
|
|
||||||
years--;
|
|
||||||
months += 12;
|
|
||||||
}
|
}
|
||||||
|
return { startCob, endCob, interval, duration };
|
||||||
|
};
|
||||||
|
|
||||||
// 2) now handle hours/min/sec by “aligning” a Date at start+Y/M/D
|
function collectEventOccurrences(start, end, predicate = () => true) {
|
||||||
let aligned = new Date(Date.UTC(
|
const out = [];
|
||||||
start.getUTCFullYear() + years,
|
if (!Array.isArray(window.SPECIAL_EVENTS)) return out;
|
||||||
start.getUTCMonth() + months,
|
window.SPECIAL_EVENTS.forEach(ev => {
|
||||||
start.getUTCDate() + days,
|
if (!predicate(ev)) return;
|
||||||
start.getUTCHours(),
|
const meta = normalizeEvent(ev);
|
||||||
start.getUTCMinutes(),
|
if (!meta || start > meta.endCob) return;
|
||||||
start.getUTCSeconds()
|
let n = Math.floor((start - meta.startCob) / meta.interval);
|
||||||
));
|
if (n < 0) n = 0;
|
||||||
let diffMs = end.getTime() - aligned.getTime();
|
let occ = meta.startCob + n * meta.interval;
|
||||||
|
if (occ + meta.duration <= start) occ += meta.interval;
|
||||||
// if we overshot (negative), borrow one day
|
while (occ < end && occ <= meta.endCob) {
|
||||||
if (diffMs < 0) {
|
out.push({ event: ev, meta, occ });
|
||||||
// borrow 24 h
|
occ += meta.interval;
|
||||||
diffMs += 24 * 3600e3;
|
|
||||||
if (days > 0) {
|
|
||||||
days--;
|
|
||||||
} else {
|
|
||||||
// days was zero, so borrow a month
|
|
||||||
months--;
|
|
||||||
if (months < 0) {
|
|
||||||
years--;
|
|
||||||
months += 12;
|
|
||||||
}
|
}
|
||||||
// set days to length of the previous month of `end`
|
});
|
||||||
days = new Date(Date.UTC(
|
return out;
|
||||||
end.getUTCFullYear(),
|
|
||||||
end.getUTCMonth(), 0
|
|
||||||
)).getUTCDate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3) extract h/m/s
|
|
||||||
let hours = Math.floor(diffMs / 3600e3); diffMs -= hours * 3600e3;
|
|
||||||
let minutes = Math.floor(diffMs / 60e3); diffMs -= minutes * 60e3;
|
|
||||||
let seconds = Math.floor(diffMs / 1e3);
|
|
||||||
|
|
||||||
return { years, months, days, hours, minutes, seconds };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// getTAIOffsetAt, toCobiets, fromCobiets, breakdownNonNeg and
|
// getTAIOffsetAt, toCobiets, fromCobiets, breakdownNonNeg and
|
||||||
@@ -155,17 +154,7 @@ function updateCurrentTime() {
|
|||||||
const cobieElem = document.getElementById('cobieTime');
|
const cobieElem = document.getElementById('cobieTime');
|
||||||
if (cobieElem) cobieElem.textContent = formatCobieTimestamp(cobiets);
|
if (cobieElem) cobieElem.textContent = formatCobieTimestamp(cobiets);
|
||||||
|
|
||||||
const options = {
|
const options = dateOptions();
|
||||||
timeZone: currentTimezone === 'TAI' ? 'UTC' : currentTimezone,
|
|
||||||
weekday: 'long',
|
|
||||||
year: 'numeric',
|
|
||||||
month: 'long',
|
|
||||||
day: 'numeric',
|
|
||||||
hour: '2-digit',
|
|
||||||
minute: '2-digit',
|
|
||||||
second: '2-digit',
|
|
||||||
hour12: false
|
|
||||||
};
|
|
||||||
|
|
||||||
const taiOffset = getTAIOffsetAt(baseDate);
|
const taiOffset = getTAIOffsetAt(baseDate);
|
||||||
let displayDate = baseDate;
|
let displayDate = baseDate;
|
||||||
@@ -175,9 +164,9 @@ function updateCurrentTime() {
|
|||||||
|
|
||||||
document.getElementById('regularTime').textContent = currentTimezone + ': ' + displayDate.toLocaleString('en-US', options);
|
document.getElementById('regularTime').textContent = currentTimezone + ': ' + displayDate.toLocaleString('en-US', options);
|
||||||
|
|
||||||
options.timeZone = 'UTC';
|
const optionsUTC = { ...options, timeZone: 'UTC' };
|
||||||
const taiDate = new Date(baseDate.getTime() + taiOffset * 1000);
|
const taiDate = new Date(baseDate.getTime() + taiOffset * 1000);
|
||||||
document.getElementById('taiTime').textContent = 'TAI UTC: ' + taiDate.toLocaleString('en-US', options) + ' (UTC + ' + taiOffset + 's)';
|
document.getElementById('taiTime').textContent = 'TAI UTC: ' + taiDate.toLocaleString('en-US', optionsUTC) + ' (UTC + ' + taiOffset + 's)';
|
||||||
|
|
||||||
|
|
||||||
const bd = breakdownNonNeg(Math.abs(cobiets));
|
const bd = breakdownNonNeg(Math.abs(cobiets));
|
||||||
@@ -188,6 +177,7 @@ function updateCurrentTime() {
|
|||||||
} else {
|
} else {
|
||||||
updateTimeBreakdown(cobiets);
|
updateTimeBreakdown(cobiets);
|
||||||
}
|
}
|
||||||
|
updateDetailCurrentTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTimeBreakdown(cobiets) {
|
function updateTimeBreakdown(cobiets) {
|
||||||
@@ -213,17 +203,7 @@ function updateTimeBreakdown(cobiets) {
|
|||||||
const eosEnd = eosStart + COBIE_UNITS.eonstrip - 1;
|
const eosEnd = eosStart + COBIE_UNITS.eonstrip - 1;
|
||||||
|
|
||||||
// 4) Intl formatting options
|
// 4) Intl formatting options
|
||||||
const dateOptions = {
|
const optsLong = dateOptions();
|
||||||
timeZone: currentTimezone === 'TAI' ? 'UTC' : currentTimezone,
|
|
||||||
weekday: 'long',
|
|
||||||
year: 'numeric',
|
|
||||||
month: 'long',
|
|
||||||
day: 'numeric',
|
|
||||||
hour: '2-digit',
|
|
||||||
minute: '2-digit',
|
|
||||||
second: '2-digit',
|
|
||||||
hour12: false
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// ── Build the “core” units (always visible): Galactic Year → Second ──────────────
|
// ── Build the “core” units (always visible): Galactic Year → Second ──────────────
|
||||||
@@ -240,8 +220,8 @@ function updateTimeBreakdown(cobiets) {
|
|||||||
const rawStart = fromCobiets(gyrStart);
|
const rawStart = fromCobiets(gyrStart);
|
||||||
const rawEnd = fromCobiets(gyrEnd);
|
const rawEnd = fromCobiets(gyrEnd);
|
||||||
return `
|
return `
|
||||||
<span>Started: ${formatSafeDate(rawStart, gyrStart, dateOptions)}</span><br>
|
<span>Started: ${formatSafeDate(rawStart, gyrStart, optsLong)}</span><br>
|
||||||
<span>Ends: ${formatSafeDate(rawEnd, gyrEnd, dateOptions)}</span>
|
<span>Ends: ${formatSafeDate(rawEnd, gyrEnd, optsLong)}</span>
|
||||||
`;
|
`;
|
||||||
})()}
|
})()}
|
||||||
</div>
|
</div>
|
||||||
@@ -257,8 +237,8 @@ function updateTimeBreakdown(cobiets) {
|
|||||||
const rawStart = fromCobiets(ccyStart);
|
const rawStart = fromCobiets(ccyStart);
|
||||||
const rawEnd = fromCobiets(ccyEnd);
|
const rawEnd = fromCobiets(ccyEnd);
|
||||||
return `
|
return `
|
||||||
<span>Started: ${formatSafeDate(rawStart, ccyStart, dateOptions)}</span><br>
|
<span>Started: ${formatSafeDate(rawStart, ccyStart, optsLong)}</span><br>
|
||||||
<span>Ends: ${formatSafeDate(rawEnd, ccyEnd, dateOptions)}</span>
|
<span>Ends: ${formatSafeDate(rawEnd, ccyEnd, optsLong)}</span>
|
||||||
`;
|
`;
|
||||||
})()}
|
})()}
|
||||||
</div>
|
</div>
|
||||||
@@ -274,8 +254,8 @@ function updateTimeBreakdown(cobiets) {
|
|||||||
const rawStart = fromCobiets(mqsStart);
|
const rawStart = fromCobiets(mqsStart);
|
||||||
const rawEnd = fromCobiets(mqsEnd);
|
const rawEnd = fromCobiets(mqsEnd);
|
||||||
return `
|
return `
|
||||||
<span>Started: ${formatSafeDate(rawStart, mqsStart, dateOptions)}</span><br>
|
<span>Started: ${formatSafeDate(rawStart, mqsStart, optsLong)}</span><br>
|
||||||
<span>Ends: ${formatSafeDate(rawEnd, mqsEnd, dateOptions)}</span>
|
<span>Ends: ${formatSafeDate(rawEnd, mqsEnd, optsLong)}</span>
|
||||||
`;
|
`;
|
||||||
})()}
|
})()}
|
||||||
</div>
|
</div>
|
||||||
@@ -291,8 +271,8 @@ function updateTimeBreakdown(cobiets) {
|
|||||||
const rawStart = fromCobiets(eosStart);
|
const rawStart = fromCobiets(eosStart);
|
||||||
const rawEnd = fromCobiets(eosEnd);
|
const rawEnd = fromCobiets(eosEnd);
|
||||||
return `
|
return `
|
||||||
<span>Started: ${formatSafeDate(rawStart, eosStart, dateOptions)}</span><br>
|
<span>Started: ${formatSafeDate(rawStart, eosStart, optsLong)}</span><br>
|
||||||
<span>Ends: ${formatSafeDate(rawEnd, eosEnd, dateOptions)}</span>
|
<span>Ends: ${formatSafeDate(rawEnd, eosEnd, optsLong)}</span>
|
||||||
`;
|
`;
|
||||||
})()}
|
})()}
|
||||||
</div>
|
</div>
|
||||||
@@ -341,8 +321,8 @@ function updateTimeBreakdown(cobiets) {
|
|||||||
const rawStart = fromCobiets(startAmt);
|
const rawStart = fromCobiets(startAmt);
|
||||||
const rawEnd = fromCobiets(endAmt);
|
const rawEnd = fromCobiets(endAmt);
|
||||||
return `
|
return `
|
||||||
<span>Started: ${formatSafeDate(rawStart, startAmt, dateOptions)}</span><br>
|
<span>Started: ${formatSafeDate(rawStart, startAmt, optsLong)}</span><br>
|
||||||
<span>Ends: ${formatSafeDate(rawEnd, endAmt, dateOptions)}</span>
|
<span>Ends: ${formatSafeDate(rawEnd, endAmt, optsLong)}</span>
|
||||||
`;
|
`;
|
||||||
})()}
|
})()}
|
||||||
</div>
|
</div>
|
||||||
@@ -360,8 +340,8 @@ function updateTimeBreakdown(cobiets) {
|
|||||||
const rawStart = fromCobiets(startAmt);
|
const rawStart = fromCobiets(startAmt);
|
||||||
const rawEnd = fromCobiets(endAmt);
|
const rawEnd = fromCobiets(endAmt);
|
||||||
return `
|
return `
|
||||||
<span>Started: ${formatSafeDate(rawStart, startAmt, dateOptions)}</span><br>
|
<span>Started: ${formatSafeDate(rawStart, startAmt, optsLong)}</span><br>
|
||||||
<span>Ends: ${formatSafeDate(rawEnd, endAmt, dateOptions)}</span>
|
<span>Ends: ${formatSafeDate(rawEnd, endAmt, optsLong)}</span>
|
||||||
`;
|
`;
|
||||||
})()}
|
})()}
|
||||||
</div>
|
</div>
|
||||||
@@ -379,8 +359,8 @@ function updateTimeBreakdown(cobiets) {
|
|||||||
const rawStart = fromCobiets(startAmt);
|
const rawStart = fromCobiets(startAmt);
|
||||||
const rawEnd = fromCobiets(endAmt);
|
const rawEnd = fromCobiets(endAmt);
|
||||||
return `
|
return `
|
||||||
<span>Started: ${formatSafeDate(rawStart, startAmt, dateOptions)}</span><br>
|
<span>Started: ${formatSafeDate(rawStart, startAmt, optsLong)}</span><br>
|
||||||
<span>Ends: ${formatSafeDate(rawEnd, endAmt, dateOptions)}</span>
|
<span>Ends: ${formatSafeDate(rawEnd, endAmt, optsLong)}</span>
|
||||||
`;
|
`;
|
||||||
})()}
|
})()}
|
||||||
</div>
|
</div>
|
||||||
@@ -398,8 +378,8 @@ function updateTimeBreakdown(cobiets) {
|
|||||||
const rawStart = fromCobiets(startAmt);
|
const rawStart = fromCobiets(startAmt);
|
||||||
const rawEnd = fromCobiets(endAmt);
|
const rawEnd = fromCobiets(endAmt);
|
||||||
return `
|
return `
|
||||||
<span>Started: ${formatSafeDate(rawStart, startAmt, dateOptions)}</span><br>
|
<span>Started: ${formatSafeDate(rawStart, startAmt, optsLong)}</span><br>
|
||||||
<span>Ends: ${formatSafeDate(rawEnd, endAmt, dateOptions)}</span>
|
<span>Ends: ${formatSafeDate(rawEnd, endAmt, optsLong)}</span>
|
||||||
`;
|
`;
|
||||||
})()}
|
})()}
|
||||||
</div>
|
</div>
|
||||||
@@ -417,8 +397,8 @@ function updateTimeBreakdown(cobiets) {
|
|||||||
const rawStart = fromCobiets(startAmt);
|
const rawStart = fromCobiets(startAmt);
|
||||||
const rawEnd = fromCobiets(endAmt);
|
const rawEnd = fromCobiets(endAmt);
|
||||||
return `
|
return `
|
||||||
<span>Started: ${formatSafeDate(rawStart, startAmt, dateOptions)}</span><br>
|
<span>Started: ${formatSafeDate(rawStart, startAmt, optsLong)}</span><br>
|
||||||
<span>Ends: ${formatSafeDate(rawEnd, endAmt, dateOptions)}</span>
|
<span>Ends: ${formatSafeDate(rawEnd, endAmt, optsLong)}</span>
|
||||||
`;
|
`;
|
||||||
})()}
|
})()}
|
||||||
</div>
|
</div>
|
||||||
@@ -434,8 +414,8 @@ function updateTimeBreakdown(cobiets) {
|
|||||||
const rawStart = fromCobiets(eocStart);
|
const rawStart = fromCobiets(eocStart);
|
||||||
const rawEnd = fromCobiets(eocEnd);
|
const rawEnd = fromCobiets(eocEnd);
|
||||||
return `
|
return `
|
||||||
<span>Started: ${formatSafeDate(rawStart, eocStart, dateOptions)}</span><br>
|
<span>Started: ${formatSafeDate(rawStart, eocStart, optsLong)}</span><br>
|
||||||
<span>Ends: ${formatSafeDate(rawEnd, eocEnd, dateOptions)}</span>
|
<span>Ends: ${formatSafeDate(rawEnd, eocEnd, optsLong)}</span>
|
||||||
`;
|
`;
|
||||||
})()}
|
})()}
|
||||||
</div>
|
</div>
|
||||||
@@ -451,8 +431,8 @@ function updateTimeBreakdown(cobiets) {
|
|||||||
const rawStart = fromCobiets(cerStart);
|
const rawStart = fromCobiets(cerStart);
|
||||||
const rawEnd = fromCobiets(cerEnd);
|
const rawEnd = fromCobiets(cerEnd);
|
||||||
return `
|
return `
|
||||||
<span>Started: ${formatSafeDate(rawStart, cerStart, dateOptions)}</span><br>
|
<span>Started: ${formatSafeDate(rawStart, cerStart, optsLong)}</span><br>
|
||||||
<span>Ends: ${formatSafeDate(rawEnd, cerEnd, dateOptions)}</span>
|
<span>Ends: ${formatSafeDate(rawEnd, cerEnd, optsLong)}</span>
|
||||||
`;
|
`;
|
||||||
})()}
|
})()}
|
||||||
</div>
|
</div>
|
||||||
@@ -468,8 +448,8 @@ function updateTimeBreakdown(cobiets) {
|
|||||||
const rawStart = fromCobiets(ueoStart);
|
const rawStart = fromCobiets(ueoStart);
|
||||||
const rawEnd = fromCobiets(ueoEnd);
|
const rawEnd = fromCobiets(ueoEnd);
|
||||||
return `
|
return `
|
||||||
<span>Started: ${formatSafeDate(rawStart, ueoStart, dateOptions)}</span><br>
|
<span>Started: ${formatSafeDate(rawStart, ueoStart, optsLong)}</span><br>
|
||||||
<span>Ends: ${formatSafeDate(rawEnd, ueoEnd, dateOptions)}</span>
|
<span>Ends: ${formatSafeDate(rawEnd, ueoEnd, optsLong)}</span>
|
||||||
`;
|
`;
|
||||||
})()}
|
})()}
|
||||||
</div>
|
</div>
|
||||||
@@ -586,12 +566,7 @@ function updateCalendar() {
|
|||||||
grid.innerHTML = '';
|
grid.innerHTML = '';
|
||||||
|
|
||||||
// reuse the same dateOpts you use elsewhere:
|
// reuse the same dateOpts you use elsewhere:
|
||||||
const dateOpts = {
|
const dateOpts = dateOptions(false);
|
||||||
timeZone: currentTimezone==='TAI' ? 'UTC' : currentTimezone,
|
|
||||||
year: 'numeric', month: 'short', day: 'numeric',
|
|
||||||
hour: '2-digit', minute: '2-digit', second: '2-digit',
|
|
||||||
hour12: false
|
|
||||||
};
|
|
||||||
|
|
||||||
for (let i = 0; i < 16; i++) {
|
for (let i = 0; i < 16; i++) {
|
||||||
const cellCob = baseCob + i * COBIE_UNITS.eonstrip;
|
const cellCob = baseCob + i * COBIE_UNITS.eonstrip;
|
||||||
@@ -612,36 +587,26 @@ function updateCalendar() {
|
|||||||
${startDate.toLocaleDateString('en-US', dateOpts)}
|
${startDate.toLocaleDateString('en-US', dateOpts)}
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
if (Array.isArray(window.SPECIAL_EVENTS)) {
|
collectEventOccurrences(
|
||||||
const offsetStart = ((cellCob % COBIE_UNITS.cosmocycle) + COBIE_UNITS.cosmocycle) % COBIE_UNITS.cosmocycle;
|
cellCob,
|
||||||
const offsetEnd = offsetStart + COBIE_UNITS.eonstrip;
|
cellCob + COBIE_UNITS.eonstrip,
|
||||||
window.SPECIAL_EVENTS.forEach(ev => {
|
ev => ev.showMega !== false
|
||||||
const evCob = parseCobiets(ev.cobie);
|
).forEach(({ event }) => {
|
||||||
if (evCob === null) return;
|
|
||||||
const evOffset = ((evCob % COBIE_UNITS.cosmocycle) + COBIE_UNITS.cosmocycle) % COBIE_UNITS.cosmocycle;
|
|
||||||
if (evOffset >= offsetStart && evOffset < offsetEnd) {
|
|
||||||
const tag = document.createElement('div');
|
const tag = document.createElement('div');
|
||||||
tag.className = 'event-tag';
|
tag.className = 'event-tag';
|
||||||
tag.textContent = ev.label;
|
tag.textContent = event.label;
|
||||||
card.appendChild(tag);
|
card.appendChild(tag);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
const tooltip = document.createElement('div');
|
const tooltip = document.createElement('div');
|
||||||
tooltip.className = 'tooltip';
|
tooltip.className = 'tooltip';
|
||||||
tooltip.innerHTML = showEonstripDetails(i, cellCob, dateOpts);
|
tooltip.innerHTML = showEonstripDetails(i, cellCob, dateOpts);
|
||||||
card.appendChild(tooltip);
|
card.appendChild(tooltip);
|
||||||
grid.appendChild(card);
|
grid.appendChild(card);
|
||||||
(function(cob) {
|
(function(cob, idx) {
|
||||||
card.addEventListener('click', () => {
|
card.addEventListener('click', () => {
|
||||||
currentOffset = 0;
|
showEonstripDetail(idx, cob);
|
||||||
manualMode = true;
|
|
||||||
manualCobiets = cob;
|
|
||||||
clearInterval(updateInterval);
|
|
||||||
document.querySelector('.current-time').classList.add('manual');
|
|
||||||
updateCurrentTime();
|
|
||||||
});
|
});
|
||||||
})(cellCob + currentTime);
|
})(cellCob, i);
|
||||||
}
|
}
|
||||||
updateTimeBreakdown(currentCob);
|
updateTimeBreakdown(currentCob);
|
||||||
}
|
}
|
||||||
@@ -650,17 +615,7 @@ function showEonstripDetails(index, startCobiets, opts) {
|
|||||||
const startDate = fromCobiets(startCobiets);
|
const startDate = fromCobiets(startCobiets);
|
||||||
const endDate = fromCobiets(startCobiets + COBIE_UNITS.eonstrip - 1);
|
const endDate = fromCobiets(startCobiets + COBIE_UNITS.eonstrip - 1);
|
||||||
|
|
||||||
const options = opts || {
|
const options = opts || dateOptions();
|
||||||
timeZone: currentTimezone === 'TAI' ? 'UTC' : currentTimezone,
|
|
||||||
weekday: 'long',
|
|
||||||
year: 'numeric',
|
|
||||||
month: 'long',
|
|
||||||
day: 'numeric',
|
|
||||||
hour: '2-digit',
|
|
||||||
minute: '2-digit',
|
|
||||||
second: '2-digit',
|
|
||||||
hour12: false
|
|
||||||
};
|
|
||||||
|
|
||||||
return `
|
return `
|
||||||
<strong>${EONSTRIP_NAMES[index]} (0x${index.toString(16).toUpperCase()})</strong><br>
|
<strong>${EONSTRIP_NAMES[index]} (0x${index.toString(16).toUpperCase()})</strong><br>
|
||||||
@@ -670,6 +625,175 @@ function showEonstripDetails(index, startCobiets, opts) {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showEonstripDetail(index, startCob) {
|
||||||
|
if (startCob === undefined) {
|
||||||
|
startCob = index;
|
||||||
|
const bdTmp = breakdownNonNeg(Math.abs(startCob));
|
||||||
|
index = bdTmp.eonstrip;
|
||||||
|
}
|
||||||
|
currentDetailCob = startCob;
|
||||||
|
const calendar = document.getElementById('calendarView');
|
||||||
|
const detail = document.getElementById('eonstripDetailView');
|
||||||
|
const timeline = document.getElementById('detailTimeline');
|
||||||
|
const title = document.getElementById('detailTitle');
|
||||||
|
calendar.style.display = 'none';
|
||||||
|
detail.style.display = 'block';
|
||||||
|
timeline.innerHTML = '';
|
||||||
|
|
||||||
|
const bd = breakdownNonNeg(Math.abs(startCob));
|
||||||
|
const sign = startCob < 0 ? '-' : '+';
|
||||||
|
title.textContent = `${sign}${bd.galactic_year.toString(16)}${bd.cosmocycle.toString(16)}${bd.megasequence.toString(16)}${index.toString(16)} – ${EONSTRIP_NAMES[index]}`;
|
||||||
|
|
||||||
|
for (let c = 0; c <= 16; c++) {
|
||||||
|
const block = document.createElement('div');
|
||||||
|
block.className = 'timeline-block';
|
||||||
|
block.style.top = (c / 16 * 100) + '%';
|
||||||
|
if (c < 16) block.textContent = c.toString(16).toUpperCase();
|
||||||
|
timeline.appendChild(block);
|
||||||
|
}
|
||||||
|
|
||||||
|
const line = document.createElement('div');
|
||||||
|
line.className = 'current-time-line';
|
||||||
|
line.id = 'detailCurrentTime';
|
||||||
|
timeline.appendChild(line);
|
||||||
|
updateDetailCurrentTime();
|
||||||
|
|
||||||
|
if (Array.isArray(window.SPECIAL_EVENTS)) {
|
||||||
|
const start = startCob;
|
||||||
|
const end = startCob + COBIE_UNITS.eonstrip;
|
||||||
|
const events = collectEventOccurrences(start, end, ev => ev.showDetail !== false)
|
||||||
|
.map(({ event, meta, occ }) => ({
|
||||||
|
label: event.label,
|
||||||
|
color: event.color,
|
||||||
|
start: (occ - start) / COBIE_UNITS.eonstrip,
|
||||||
|
end: (occ + meta.duration - start) / COBIE_UNITS.eonstrip,
|
||||||
|
cobStart: occ,
|
||||||
|
cobEnd: occ + meta.duration,
|
||||||
|
seriesStart: meta.startCob,
|
||||||
|
seriesEnd: meta.endCob
|
||||||
|
}));
|
||||||
|
events.sort((a,b)=>a.start-b.start);
|
||||||
|
|
||||||
|
const groups = [];
|
||||||
|
let active = [];
|
||||||
|
events.forEach(ev=>{
|
||||||
|
active = active.filter(a=>a.end>ev.start);
|
||||||
|
if (active.length===0) {
|
||||||
|
groups.push({events:[],columns:[],maxCols:0});
|
||||||
|
}
|
||||||
|
const g = groups[groups.length-1];
|
||||||
|
let col=0;
|
||||||
|
while(g.columns[col] && g.columns[col] > ev.start) col++;
|
||||||
|
g.columns[col] = ev.end;
|
||||||
|
ev.col = col;
|
||||||
|
g.maxCols = Math.max(g.maxCols, col+1);
|
||||||
|
g.events.push(ev);
|
||||||
|
active.push(ev);
|
||||||
|
});
|
||||||
|
groups.forEach(g=>{
|
||||||
|
const width = 100/(g.maxCols||1);
|
||||||
|
g.events.forEach(ev=>ev.width=width);
|
||||||
|
});
|
||||||
|
|
||||||
|
events.forEach(ev=>{
|
||||||
|
const left = ev.col * ev.width;
|
||||||
|
const displayStart = Math.max(0, ev.start);
|
||||||
|
const displayEnd = Math.min(1, ev.end);
|
||||||
|
const elem = document.createElement('div');
|
||||||
|
if (ev.end > ev.start) {
|
||||||
|
elem.className = 'event-box';
|
||||||
|
const h = (displayEnd - displayStart) * 100;
|
||||||
|
if (h < 2) {
|
||||||
|
elem.classList.add('small-event');
|
||||||
|
elem.style.height = '4px';
|
||||||
|
} else {
|
||||||
|
elem.style.height = (h > 0 ? h : 0) + '%';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
elem.className = 'event-line';
|
||||||
|
}
|
||||||
|
elem.style.top = (displayStart * 100) + '%';
|
||||||
|
elem.style.left = `calc(var(--scale-width) + ${left}%)`;
|
||||||
|
elem.style.width = `calc(${ev.width}% - 2px)`;
|
||||||
|
|
||||||
|
if (ev.color) applyEventColors(elem, ev.color, 0.4);
|
||||||
|
|
||||||
|
if (elem.classList.contains('small-event') || elem.className === 'event-line') {
|
||||||
|
const label = document.createElement('span');
|
||||||
|
label.className = 'event-label';
|
||||||
|
if (displayStart < 0.05) {
|
||||||
|
label.classList.add('below');
|
||||||
|
}
|
||||||
|
label.textContent = ev.label;
|
||||||
|
elem.appendChild(label);
|
||||||
|
if (ev.color) applyEventColors(label, ev.color, 0.5);
|
||||||
|
} else {
|
||||||
|
elem.textContent = ev.label;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tooltip = document.createElement('div');
|
||||||
|
tooltip.className = 'tooltip';
|
||||||
|
const optsShort = dateOptions(false);
|
||||||
|
|
||||||
|
const startStr = formatCobieTimestamp(ev.cobStart);
|
||||||
|
const endStr = formatCobieTimestamp(ev.cobEnd);
|
||||||
|
const startDate = fromCobiets(ev.cobStart).toLocaleString('en-US', optsShort);
|
||||||
|
const endDate = fromCobiets(ev.cobEnd).toLocaleString('en-US', optsShort);
|
||||||
|
const seriesStart = formatCobieTimestamp(ev.seriesStart);
|
||||||
|
const seriesEnd = isFinite(ev.seriesEnd) ? formatCobieTimestamp(ev.seriesEnd) : '∞';
|
||||||
|
|
||||||
|
tooltip.innerHTML =
|
||||||
|
`<strong>${ev.label}</strong><br>` +
|
||||||
|
`Start: ${startStr} (${startDate})<br>` +
|
||||||
|
(ev.cobEnd > ev.cobStart ? `End: ${endStr} (${endDate})<br>` : '') +
|
||||||
|
`Series: ${seriesStart} – ${seriesEnd}`;
|
||||||
|
elem.appendChild(tooltip);
|
||||||
|
timeline.appendChild(elem);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateDetailCurrentTime() {
|
||||||
|
if (currentDetailCob === null) return;
|
||||||
|
const line = document.getElementById('detailCurrentTime');
|
||||||
|
if (!line) return;
|
||||||
|
const nowCob = manualMode ? manualCobiets : toCobiets(new Date());
|
||||||
|
const rel = (nowCob - currentDetailCob) / COBIE_UNITS.eonstrip;
|
||||||
|
if (rel >= 0 && rel <= 1) {
|
||||||
|
line.style.display = 'block';
|
||||||
|
line.style.top = (rel * 100) + '%';
|
||||||
|
line.textContent = formatCobieTimestamp(nowCob);
|
||||||
|
} else {
|
||||||
|
line.style.display = 'none';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function detailPrev() {
|
||||||
|
if (currentDetailCob === null) return;
|
||||||
|
Animate.animateDetailSwipe(-1, () => {
|
||||||
|
showEonstripDetail(currentDetailCob - COBIE_UNITS.eonstrip);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function detailNext() {
|
||||||
|
if (currentDetailCob === null) return;
|
||||||
|
Animate.animateDetailSwipe(1, () => {
|
||||||
|
showEonstripDetail(currentDetailCob + COBIE_UNITS.eonstrip);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function detailNow() {
|
||||||
|
const now = toCobiets(new Date());
|
||||||
|
const start = now - (now % COBIE_UNITS.eonstrip);
|
||||||
|
showEonstripDetail(start);
|
||||||
|
}
|
||||||
|
|
||||||
|
function exitDetailView() {
|
||||||
|
document.getElementById('eonstripDetailView').style.display = 'none';
|
||||||
|
document.getElementById('calendarView').style.display = 'block';
|
||||||
|
currentDetailCob = null;
|
||||||
|
}
|
||||||
|
|
||||||
function getStep(mods) {
|
function getStep(mods) {
|
||||||
// base step = 1 megasequence
|
// base step = 1 megasequence
|
||||||
let step = 1;
|
let step = 1;
|
||||||
@@ -697,46 +821,32 @@ function getStep(mods) {
|
|||||||
function navigatePeriod(evt, direction) {
|
function navigatePeriod(evt, direction) {
|
||||||
const step = getStep(evt);
|
const step = getStep(evt);
|
||||||
|
|
||||||
animateSwipe(direction, () => {
|
if (currentDetailCob !== null) {
|
||||||
|
exitDetailView();
|
||||||
|
}
|
||||||
|
|
||||||
|
Animate.animateSwipe(direction, () => {
|
||||||
currentOffset += direction * step;
|
currentOffset += direction * step;
|
||||||
updateCalendar();
|
updateCalendar();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function animateSwipe(direction, onDone) {
|
|
||||||
const grid = document.getElementById('eonstripGrid');
|
|
||||||
if (!grid) { onDone(); return; }
|
|
||||||
|
|
||||||
// slide out
|
|
||||||
grid.style.transition = 'transform 0.3s ease';
|
|
||||||
grid.style.transform = `translateX(${direction > 0 ? '-100%' : '100%'})`;
|
|
||||||
|
|
||||||
function afterOut() {
|
|
||||||
grid.removeEventListener('transitionend', afterOut);
|
|
||||||
// prepare new position off-screen on the other side
|
|
||||||
grid.style.transition = 'none';
|
|
||||||
grid.style.transform = `translateX(${direction > 0 ? '100%' : '-100%'})`;
|
|
||||||
onDone();
|
|
||||||
// force reflow to apply position instantly
|
|
||||||
void grid.offsetWidth;
|
|
||||||
// slide in with transition
|
|
||||||
grid.style.transition = 'transform 0.3s ease';
|
|
||||||
grid.style.transform = 'translateX(0)';
|
|
||||||
}
|
|
||||||
|
|
||||||
grid.addEventListener('transitionend', afterOut);
|
|
||||||
}
|
|
||||||
|
|
||||||
function goToNow() {
|
function goToNow() {
|
||||||
manualMode = false;
|
manualMode = false;
|
||||||
manualCobiets = 0;
|
manualCobiets = 0;
|
||||||
compareManualMode = false;
|
compareManualMode = false;
|
||||||
currentOffset = 0;
|
currentOffset = 0;
|
||||||
|
if (currentDetailCob !== null) {
|
||||||
|
exitDetailView();
|
||||||
|
}
|
||||||
updateCurrentTime();
|
updateCurrentTime();
|
||||||
updateCalendar();
|
updateCalendar();
|
||||||
clearInterval(updateInterval);
|
clearInterval(updateInterval);
|
||||||
updateInterval = setInterval(updateCurrentTime, 1000);
|
updateInterval = setInterval(updateCurrentTime, 1000);
|
||||||
document.querySelector('.current-time').classList.remove('manual');
|
document.querySelector('.current-time').classList.remove('manual');
|
||||||
|
if (window.CobieClock) {
|
||||||
|
window.CobieClock.start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function enterEdit() {
|
function enterEdit() {
|
||||||
@@ -794,6 +904,9 @@ function commitInput() {
|
|||||||
updateCurrentTime();
|
updateCurrentTime();
|
||||||
updateCalendar();
|
updateCalendar();
|
||||||
document.querySelector('.current-time').classList.add('manual');
|
document.querySelector('.current-time').classList.add('manual');
|
||||||
|
if (window.CobieClock) {
|
||||||
|
window.CobieClock.showTime(manualCobiets);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// swap elements
|
// swap elements
|
||||||
@@ -807,6 +920,9 @@ document.getElementById('timezone').addEventListener('change', (e) => {
|
|||||||
currentTimezone = e.target.value;
|
currentTimezone = e.target.value;
|
||||||
updateCurrentTime();
|
updateCurrentTime();
|
||||||
updateCalendar();
|
updateCalendar();
|
||||||
|
if (currentDetailCob !== null) {
|
||||||
|
showEonstripDetail(currentDetailCob);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set default timezone based on user's locale
|
// Set default timezone based on user's locale
|
||||||
@@ -819,6 +935,11 @@ if (matchingOption) {
|
|||||||
currentTimezone = userTimezone;
|
currentTimezone = userTimezone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.getElementById('backToCalendar').addEventListener('click', exitDetailView);
|
||||||
|
document.getElementById('detailPrev').addEventListener('click', detailPrev);
|
||||||
|
document.getElementById('detailNext').addEventListener('click', detailNext);
|
||||||
|
document.getElementById('detailNow').addEventListener('click', detailNow);
|
||||||
|
|
||||||
updateCurrentTime();
|
updateCurrentTime();
|
||||||
updateCalendar();
|
updateCalendar();
|
||||||
updateInterval = setInterval(updateCurrentTime, 1000);
|
updateInterval = setInterval(updateCurrentTime, 1000);
|
||||||
@@ -852,6 +973,7 @@ let swipeStartY = null;
|
|||||||
let swipeMods = { altKey: false, shiftKey: false, ctrlKey: false };
|
let swipeMods = { altKey: false, shiftKey: false, ctrlKey: false };
|
||||||
let isSwiping = false;
|
let isSwiping = false;
|
||||||
let swipeGrid = null;
|
let swipeGrid = null;
|
||||||
|
let swipeContext = 'calendar';
|
||||||
|
|
||||||
function swipeStart(e) {
|
function swipeStart(e) {
|
||||||
const touch = e.touches ? e.touches[0] : e;
|
const touch = e.touches ? e.touches[0] : e;
|
||||||
@@ -862,7 +984,17 @@ function swipeStart(e) {
|
|||||||
shiftKey: e.shiftKey || false,
|
shiftKey: e.shiftKey || false,
|
||||||
ctrlKey: e.ctrlKey || false
|
ctrlKey: e.ctrlKey || false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const detailView = document.getElementById('eonstripDetailView');
|
||||||
|
const detailOpen = detailView && detailView.style.display === 'block';
|
||||||
|
if (detailOpen) {
|
||||||
|
swipeGrid = document.getElementById('detailTimeline');
|
||||||
|
swipeContext = 'detail';
|
||||||
|
} else {
|
||||||
swipeGrid = document.getElementById('eonstripGrid');
|
swipeGrid = document.getElementById('eonstripGrid');
|
||||||
|
swipeContext = 'calendar';
|
||||||
|
}
|
||||||
|
|
||||||
if (swipeGrid) {
|
if (swipeGrid) {
|
||||||
swipeGrid.style.transition = 'none';
|
swipeGrid.style.transition = 'none';
|
||||||
}
|
}
|
||||||
@@ -899,9 +1031,19 @@ function swipeEnd(e) {
|
|||||||
// prepare opposite side
|
// prepare opposite side
|
||||||
swipeGrid.style.transition = 'none';
|
swipeGrid.style.transition = 'none';
|
||||||
swipeGrid.style.transform = `translateX(${dx < 0 ? width : -width}px)`;
|
swipeGrid.style.transform = `translateX(${dx < 0 ? width : -width}px)`;
|
||||||
|
|
||||||
|
if (swipeContext === 'calendar') {
|
||||||
const step = getStep(swipeMods);
|
const step = getStep(swipeMods);
|
||||||
currentOffset += direction * step;
|
currentOffset += direction * step;
|
||||||
updateCalendar();
|
updateCalendar();
|
||||||
|
} else if (swipeContext === 'detail') {
|
||||||
|
if (direction === 1) {
|
||||||
|
currentDetailCob !== null && showEonstripDetail(currentDetailCob + COBIE_UNITS.eonstrip);
|
||||||
|
} else {
|
||||||
|
currentDetailCob !== null && showEonstripDetail(currentDetailCob - COBIE_UNITS.eonstrip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void swipeGrid.offsetWidth;
|
void swipeGrid.offsetWidth;
|
||||||
swipeGrid.style.transition = 'transform 0.3s ease';
|
swipeGrid.style.transition = 'transform 0.3s ease';
|
||||||
swipeGrid.style.transform = 'translateX(0)';
|
swipeGrid.style.transform = 'translateX(0)';
|
||||||
@@ -926,8 +1068,16 @@ document.addEventListener('mouseup', swipeEnd);
|
|||||||
function wheelNavigate(e) {
|
function wheelNavigate(e) {
|
||||||
if (Math.abs(e.deltaX) > Math.abs(e.deltaY) && Math.abs(e.deltaX) > 10) {
|
if (Math.abs(e.deltaX) > Math.abs(e.deltaY) && Math.abs(e.deltaX) > 10) {
|
||||||
const direction = e.deltaX > 0 ? 1 : -1;
|
const direction = e.deltaX > 0 ? 1 : -1;
|
||||||
|
if (currentDetailCob !== null) {
|
||||||
|
if (direction === 1) {
|
||||||
|
detailNext();
|
||||||
|
} else {
|
||||||
|
detailPrev();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
navigatePeriod(e, direction);
|
navigatePeriod(e, direction);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('wheel', wheelNavigate);
|
document.addEventListener('wheel', wheelNavigate);
|
||||||
@@ -942,4 +1092,7 @@ if (document.readyState === 'loading') {
|
|||||||
|
|
||||||
window.navigatePeriod = navigatePeriod;
|
window.navigatePeriod = navigatePeriod;
|
||||||
window.goToNow = goToNow;
|
window.goToNow = goToNow;
|
||||||
|
window.detailPrev = detailPrev;
|
||||||
|
window.detailNext = detailNext;
|
||||||
|
window.detailNow = detailNow;
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
height: 40vmin;
|
height: var(--clock-size);
|
||||||
}
|
}
|
||||||
|
|
||||||
.current-time.manual::before {
|
.current-time.manual::before {
|
||||||
@@ -360,6 +360,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.eonstrip-grid {
|
.eonstrip-grid {
|
||||||
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
|
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
|
||||||
transform: translateX(0);
|
transform: translateX(0);
|
||||||
@@ -367,8 +368,145 @@
|
|||||||
will-change: transform;
|
will-change: transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.detail-view {
|
||||||
|
margin-top: 20px;
|
||||||
|
background: rgba(255, 255, 255, 0.05);
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-nav {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-btn {
|
||||||
|
background: linear-gradient(45deg, #00ffff, #0080ff);
|
||||||
|
border: none;
|
||||||
|
border-radius: 5px;
|
||||||
|
color: #fff;
|
||||||
|
padding: 6px 12px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 0.9em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-timeline {
|
||||||
|
position: relative;
|
||||||
|
--scale-width: 24px;
|
||||||
|
height: 400px;
|
||||||
|
border-left: 3px solid #00ffff;
|
||||||
|
margin-right: 40px;
|
||||||
|
margin-left: 0;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-block {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
width: calc(100% + 40px);
|
||||||
|
text-align: left;
|
||||||
|
padding-left: 4px;
|
||||||
|
border-top: 1px dashed rgba(0,255,255,0.5);
|
||||||
|
color: #00ffff;
|
||||||
|
font-size: 0.9em;
|
||||||
|
font-weight: 600;
|
||||||
|
padding-top: 2px;
|
||||||
|
text-shadow: 0 0 4px #00ffff;
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.current-time-line {
|
||||||
|
position: absolute;
|
||||||
|
left: var(--scale-width);
|
||||||
|
width: calc(100% + 40px - var(--scale-width));
|
||||||
|
border-top: 2px solid #ff00ff;
|
||||||
|
color: #ff00ff;
|
||||||
|
font-size: 0.9em;
|
||||||
|
font-weight: 600;
|
||||||
|
padding-top: 2px;
|
||||||
|
text-shadow: 0 0 4px #ff00ff;
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-box, .event-line {
|
||||||
|
position: absolute;
|
||||||
|
left: var(--scale-width);
|
||||||
|
background: var(--bg-color, rgba(255,0,255,0.4));
|
||||||
|
border: 1px solid var(--border-color, rgba(0,255,255,0.7));
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 2px 4px;
|
||||||
|
color: var(--text-color, #fff);
|
||||||
|
font-size: 0.75em;
|
||||||
|
overflow: visible;
|
||||||
|
white-space: nowrap;
|
||||||
|
z-index: 3;
|
||||||
|
box-shadow: 0 0 4px var(--border-color, rgba(0,255,255,0.9));
|
||||||
|
}
|
||||||
|
.event-box {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-line {
|
||||||
|
height: 4px;
|
||||||
|
padding: 0;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-box.small-event {
|
||||||
|
overflow: visible;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-line .event-label,
|
||||||
|
.event-box.small-event .event-label {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 100%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -2px);
|
||||||
|
margin-bottom: 2px;
|
||||||
|
background: var(--bg-color, rgba(255,0,255,0.5));
|
||||||
|
border: 1px solid var(--border-color, rgba(0,255,255,0.8));
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 2px 6px;
|
||||||
|
white-space: nowrap;
|
||||||
|
color: var(--text-color, #fff);
|
||||||
|
font-size: 0.75em;
|
||||||
|
font-weight: 600;
|
||||||
|
text-shadow: 0 0 4px var(--border-color, #ff00ff);
|
||||||
|
z-index: 4;
|
||||||
|
box-shadow: 0 0 4px var(--border-color, rgba(0,255,255,0.9));
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-line .event-label.below,
|
||||||
|
.event-box.small-event .event-label.below {
|
||||||
|
bottom: auto;
|
||||||
|
top: 100%;
|
||||||
|
transform: translate(-50%, 2px);
|
||||||
|
margin-bottom: 0;
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-box:hover .tooltip,
|
||||||
|
.event-line:hover .tooltip {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Layout combining current time and analog clock */
|
/* Layout combining current time and analog clock */
|
||||||
.time-display {
|
.time-display {
|
||||||
|
--clock-size: 40vmin;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
@@ -378,7 +516,6 @@
|
|||||||
|
|
||||||
|
|
||||||
.analog-clock-container {
|
.analog-clock-container {
|
||||||
--clock-size: 40vmin;
|
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
width: var(--clock-size);
|
width: var(--clock-size);
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
@@ -397,28 +534,35 @@
|
|||||||
box-shadow: 0 0 25px rgba(0, 255, 255, 0.2), inset 0 0 40px rgba(255, 0, 255, 0.2);
|
box-shadow: 0 0 25px rgba(0, 255, 255, 0.2), inset 0 0 40px rgba(255, 0, 255, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#clock::after {
|
.clock-center {
|
||||||
content: '';
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
width: 1.2em;
|
width: calc(var(--clock-size) * 0.13);
|
||||||
height: 1.2em;
|
height: calc(var(--clock-size) * 0.13);
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%) translateZ(0);
|
||||||
background: url('logo.svg') center/contain no-repeat;
|
background: url('logo.svg') center/contain no-repeat;
|
||||||
background-color: #ffffff;
|
background-color: transparent;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
box-shadow: 0 0 8px rgba(0, 255, 255, 0.8);
|
/* box-shadow: 0 0 8px rgba(0, 255, 255, 0.8); */
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width: 1200px) {
|
||||||
|
.clock-center {
|
||||||
|
width: calc(var(--clock-size) * 0.085);
|
||||||
|
height: calc(var(--clock-size) * 0.085);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.clock-label {
|
.clock-label {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 23%;
|
bottom: 30%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translateX(-50%);
|
transform: translateX(-50%);
|
||||||
font-family: 'Great Vibes', cursive;
|
font-family: 'Great Vibes', cursive;
|
||||||
font-size: calc(var(--clock-size) * 0.08);
|
font-size: calc(var(--clock-size) * 0.06);
|
||||||
color: #ffaaff;
|
color: #ffaaff;
|
||||||
text-shadow: 0 0 6px rgba(255, 0, 255, 0.6);
|
text-shadow: 0 0 6px rgba(255, 0, 255, 0.6);
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
@@ -431,13 +575,14 @@ body.fullscreen-clock .clock-label {
|
|||||||
|
|
||||||
.marker {
|
.marker {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 2em;
|
width: calc(var(--clock-size) * 0.13);
|
||||||
height: 2em;
|
height: calc(var(--clock-size) * 0.13);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 2em;
|
line-height: calc(var(--clock-size) * 0.13);
|
||||||
/* Use a futuristic font for the clock markers */
|
/* Use a futuristic font for the clock markers */
|
||||||
font-family: 'Orbitron', 'Trebuchet MS', 'Lucida Sans', Arial, sans-serif;
|
font-family: 'Orbitron', 'Trebuchet MS', 'Lucida Sans', Arial, sans-serif;
|
||||||
font-size: 1.2em;
|
/* 1% of the clock radius */
|
||||||
|
font-size: calc(var(--clock-size) * 0.05);
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #00ffff;
|
color: #00ffff;
|
||||||
background: none;
|
background: none;
|
||||||
@@ -445,16 +590,37 @@ body.fullscreen-clock .clock-label {
|
|||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
text-shadow: 0 0 6px rgba(0, 255, 255, 0.9), 0 0 12px rgba(0, 255, 255, 0.7);
|
text-shadow: 0 0 6px rgba(0, 255, 255, 0.9), 0 0 12px rgba(0, 255, 255, 0.7);
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
transform: translate(-50%, -50%);
|
transform-origin: center;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
user-select: none;
|
||||||
|
pointer-events: none;
|
||||||
|
will-change: transform;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tick {
|
||||||
|
position: absolute;
|
||||||
|
width: 2px;
|
||||||
|
background: #00ffff;
|
||||||
|
transform-origin: center top;
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tick.mid {
|
||||||
|
background: #66ffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tick.big {
|
||||||
|
background: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
.hand {
|
.hand {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 50%;
|
bottom: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform-origin: bottom;
|
transform-origin: bottom center;
|
||||||
transition: transform 0.5s ease-in-out;
|
transform: translateX(-50%);
|
||||||
|
transition: transform 1s linear;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
@@ -462,47 +628,55 @@ body.fullscreen-clock .clock-label {
|
|||||||
|
|
||||||
.hand.xeno {
|
.hand.xeno {
|
||||||
width: 2px;
|
width: 2px;
|
||||||
height: 40%;
|
height: 44%;
|
||||||
background: linear-gradient(to top, #66ccff, #0044ff);
|
background: linear-gradient(to top, #66ccff, #0044ff);
|
||||||
box-shadow: 0 0 8px #66ccff;
|
box-shadow: 0 0 8px #66ccff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hand.quantic {
|
.hand.quantic {
|
||||||
width: 3px;
|
width: 3px;
|
||||||
height: 34%;
|
height: 40%;
|
||||||
background: linear-gradient(to top, #ff66ff, #9900ff);
|
background: linear-gradient(to top, #ff66ff, #9900ff);
|
||||||
box-shadow: 0 0 8px #ff66ff;
|
box-shadow: 0 0 8px #ff66ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hand.chronon {
|
.hand.chronon {
|
||||||
width: 4px;
|
width: 4px;
|
||||||
height: 30%;
|
height: 34%;
|
||||||
background: linear-gradient(to top, #ff4444, #880000);
|
background: linear-gradient(to top, #ff4444, #880000);
|
||||||
box-shadow: 0 0 8px #ff4444;
|
box-shadow: 0 0 8px #ff4444;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hand.eonstrip {
|
.hand.eonstrip {
|
||||||
width: 5px;
|
width: 5px;
|
||||||
height: 20%;
|
height: 30%;
|
||||||
background: linear-gradient(to top, #33ff99, #006633);
|
background: linear-gradient(to top, #33ff99, #006633);
|
||||||
box-shadow: 0 0 8px #33ff99;
|
box-shadow: 0 0 8px #33ff99;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.hand.megasequence {
|
.hand.megasequence {
|
||||||
width: 6px;
|
width: 6px;
|
||||||
height: 16%;
|
height: 26%;
|
||||||
background: linear-gradient(to top, #ffbb33, #aa5500);
|
background: linear-gradient(to top, #ffbb33, #aa5500);
|
||||||
box-shadow: 0 0 8px #ffbb33;
|
box-shadow: 0 0 8px #ffbb33;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-height: 430px) and (orientation: landscape) {
|
||||||
|
.time-display {
|
||||||
|
--clock-size: 70vmin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
body.fullscreen-clock .header,
|
body.fullscreen-clock .header,
|
||||||
body.fullscreen-clock .current-time,
|
body.fullscreen-clock .current-time,
|
||||||
body.fullscreen-clock .timezone-selector,
|
body.fullscreen-clock .timezone-selector,
|
||||||
body.fullscreen-clock .calendar-controls,
|
body.fullscreen-clock .calendar-controls,
|
||||||
body.fullscreen-clock .calendar-view,
|
body.fullscreen-clock .calendar-view,
|
||||||
|
body.fullscreen-clock .detail-view,
|
||||||
body.fullscreen-clock .time-details,
|
body.fullscreen-clock .time-details,
|
||||||
body.fullscreen-clock .explanations {
|
body.fullscreen-clock .explanations {
|
||||||
display: none;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.fullscreen-clock .time-display {
|
body.fullscreen-clock .time-display {
|
||||||
|
|||||||
@@ -0,0 +1,92 @@
|
|||||||
|
(function(){
|
||||||
|
function parseColor(hex) {
|
||||||
|
if (!hex) return [255, 255, 255];
|
||||||
|
let c = hex.replace('#', '');
|
||||||
|
if (c.length === 3) c = c.split('').map(x => x + x).join('');
|
||||||
|
const num = parseInt(c, 16);
|
||||||
|
return [(num >> 16) & 255, (num >> 8) & 255, num & 255];
|
||||||
|
}
|
||||||
|
|
||||||
|
const toHex = v => v.toString(16).padStart(2, '0');
|
||||||
|
|
||||||
|
function hexToRgba(hex, a = 1) {
|
||||||
|
const [r, g, b] = parseColor(hex);
|
||||||
|
return `rgba(${r},${g},${b},${a})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getContrastColor(hex) {
|
||||||
|
const [r, g, b] = parseColor(hex);
|
||||||
|
const yiq = (r * 299 + g * 587 + b * 114) / 1000;
|
||||||
|
return yiq >= 128 ? '#000' : '#fff';
|
||||||
|
}
|
||||||
|
|
||||||
|
function lightenColor(hex, p) {
|
||||||
|
const [r, g, b] = parseColor(hex).map(v =>
|
||||||
|
Math.min(255, Math.round(v + (255 - v) * p))
|
||||||
|
);
|
||||||
|
return '#' + [r, g, b].map(toHex).join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
function getHumanDiff(d1, d2) {
|
||||||
|
let start = d1 < d2 ? d1 : d2;
|
||||||
|
let end = d1 < d2 ? d2 : d1;
|
||||||
|
|
||||||
|
let years = end.getUTCFullYear() - start.getUTCFullYear();
|
||||||
|
let months = end.getUTCMonth() - start.getUTCMonth();
|
||||||
|
let days = end.getUTCDate() - start.getUTCDate();
|
||||||
|
|
||||||
|
if (days < 0) {
|
||||||
|
months--;
|
||||||
|
let prevMonthDays = new Date(Date.UTC(
|
||||||
|
end.getUTCFullYear(),
|
||||||
|
end.getUTCMonth(), 0
|
||||||
|
)).getUTCDate();
|
||||||
|
days += prevMonthDays;
|
||||||
|
}
|
||||||
|
if (months < 0) {
|
||||||
|
years--;
|
||||||
|
months += 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
let aligned = new Date(Date.UTC(
|
||||||
|
start.getUTCFullYear() + years,
|
||||||
|
start.getUTCMonth() + months,
|
||||||
|
start.getUTCDate() + days,
|
||||||
|
start.getUTCHours(),
|
||||||
|
start.getUTCMinutes(),
|
||||||
|
start.getUTCSeconds()
|
||||||
|
));
|
||||||
|
let diffMs = end.getTime() - aligned.getTime();
|
||||||
|
|
||||||
|
if (diffMs < 0) {
|
||||||
|
diffMs += 24 * 3600e3;
|
||||||
|
if (days > 0) {
|
||||||
|
days--;
|
||||||
|
} else {
|
||||||
|
months--;
|
||||||
|
if (months < 0) {
|
||||||
|
years--;
|
||||||
|
months += 12;
|
||||||
|
}
|
||||||
|
days = new Date(Date.UTC(
|
||||||
|
end.getUTCFullYear(),
|
||||||
|
end.getUTCMonth(), 0
|
||||||
|
)).getUTCDate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let hours = Math.floor(diffMs / 3600e3); diffMs -= hours * 3600e3;
|
||||||
|
let minutes = Math.floor(diffMs / 60e3); diffMs -= minutes * 60e3;
|
||||||
|
let seconds = Math.floor(diffMs / 1e3);
|
||||||
|
|
||||||
|
return { years, months, days, hours, minutes, seconds };
|
||||||
|
}
|
||||||
|
|
||||||
|
window.Utils = {
|
||||||
|
parseColor,
|
||||||
|
hexToRgba,
|
||||||
|
getContrastColor,
|
||||||
|
lightenColor,
|
||||||
|
getHumanDiff
|
||||||
|
};
|
||||||
|
})();
|
||||||
Reference in New Issue
Block a user