Skip to content

Conversation

@JoeGermuska
Copy link
Member

I used some Claude Code credits to modernize the code base. The goal is to not have any visible changes. So far it seems to work, but since it's not urgent, i'll wait to merge until some more testing can happen.

claude and others added 3 commits November 4, 2025 20:20
This is a comprehensive modernization of the TimelineJS3 codebase to use
modern JavaScript patterns and APIs while maintaining backward compatibility
with the existing data model.

## Major Changes

### Event System
- Replace custom Events class with native EventTarget
- All classes now extend EventTarget for standard browser event handling
- Maintains backward-compatible API (on/off/fire methods)

### Class Inheritance
- Remove custom TLClass.extend() pattern
- Convert all classes to ES6 class syntax with native extends
- Remove classMixin() pattern in favor of proper inheritance chain
- Create clear inheritance: EventTarget → Events → I18NMixins → DOMMixins

### Animation System
- Replace legacy Morpheus-based animation (420+ lines) with modern implementation
- Use Web Animations API with CSS transitions fallback
- Simpler, more performant, and standards-compliant
- Maintains same API for backward compatibility

### Browser Support
- Remove all IE-specific detection and workarounds
- Remove obsolete browser checks (IE9, Opera, etc.)
- Use modern browser APIs exclusively
- Simplified Browser.js from 68 to 44 lines

### DOM Utilities
- Modernize DOM.js to use current browser APIs
- Use getBoundingClientRect() for positioning
- Simplify transform handling with modern CSS
- Better JSDoc documentation

### Async Patterns
- Convert callback-based makeConfig() to return Promises
- Maintain backward compatibility with deprecated callback support
- Use async/await throughout for cleaner async code
- Replace ajax() calls with modern fetch()

### Date Classes
- Convert TLDate, BigDate, BigYear from TLClass.extend to ES6 classes
- Use const/let instead of var
- Maintain all functionality and data model compatibility

## Files Modified (25 files)
- Core: Events.js, Browser.js, ConfigFactory.js, Util.js (removed TLClass.js)
- DOM: DOM.js, DOMMixins.js
- Animation: Animate.js
- Date: TLDate.js
- Language: I18NMixins.js
- UI: Draggable.js, MenuBar.js, Message.js, Swipable.js
- Timeline: Timeline.js
- TimeNav: TimeAxis.js, TimeEra.js, TimeGroup.js, TimeMarker.js, TimeNav.js
- Slider: Slide.js, SlideNav.js, StorySlider.js
- Media: Media.js, types/Text.js

## Backward Compatibility
- Public Timeline API unchanged
- Data model completely unchanged
- Legacy callback support maintained with deprecation warnings
- All existing timelines will continue to work

## Benefits
- Modern, maintainable codebase
- Better IDE support and autocomplete
- Smaller bundle size (removed 400+ lines of legacy code)
- Standards-compliant with native browser APIs
- Easier to contribute to and understand
Modern browsers no longer need IE-specific handling for PDFs.
Simplified logic to only use Google Docs viewer for Dropbox URLs
which need special handling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants