@ -1,44 +1,43 @@
import { length } from 'stringz' ;
import IntlRelativeFormat from 'intl-relativeformat' ;
import { delegate } from 'rails-ujs' ;
import emojify from '../mastodon/emoji' ;
import { getLocale } from '../mastodon/locales' ;
import loadPolyfills from '../mastodon/load_polyfills' ;
import ready from '../mastodon/ready' ;
const { localeData } = getLocale ( ) ;
localeData . forEach ( IntlRelativeFormat . __addLocaleData ) ;
function main ( ) {
const { length } = require ( 'stringz' ) ;
const IntlRelativeFormat = require ( 'intl-relativeformat' ) . default ;
const { delegate } = require ( 'rails-ujs' ) ;
const emojify = require ( '../mastodon/emoji' ) . default ;
const { getLocale } = require ( '../mastodon/locales' ) ;
const ready = require ( '../mastodon/ready' ) . default ;
function loaded ( ) {
const locale = document . documentElement . lang ;
const dateTimeFormat = new Intl . DateTimeFormat ( locale , {
year : 'numeric' ,
month : 'long' ,
day : 'numeric' ,
hour : 'numeric' ,
minute : 'numeric' ,
} ) ;
const relativeFormat = new IntlRelativeFormat ( locale ) ;
const { localeData } = getLocale ( ) ;
localeData . forEach ( IntlRelativeFormat . __addLocaleData ) ;
[ ] . forEach . call ( document . querySelectorAll ( '.emojify' ) , ( content ) => {
content . innerHTML = emojify ( content . innerHTML ) ;
} ) ;
ready ( ( ) => {
const locale = document . documentElement . lang ;
const dateTimeFormat = new Intl . DateTimeFormat ( locale , {
year : 'numeric' ,
month : 'long' ,
day : 'numeric' ,
hour : 'numeric' ,
minute : 'numeric' ,
} ) ;
const relativeFormat = new IntlRelativeFormat ( locale ) ;
[ ] . forEach . call ( document . querySelectorAll ( 'time.formatted' ) , ( content ) => {
const datetime = new Date ( content . getAttribute ( 'datetime' ) ) ;
const formattedDate = dateTimeFormat . format ( datetime ) ;
content . title = formattedDate ;
content . textContent = formattedDate ;
} ) ;
[ ] . forEach . call ( document . querySelectorAll ( '.emojify' ) , ( content ) => {
content . innerHTML = emojify ( content . innerHTML ) ;
} ) ;
[ ] . forEach . call ( document . querySelectorAll ( 'time.time-ago' ) , ( content ) => {
const datetime = new Date ( content . getAttribute ( 'datetime' ) ) ;
content . textContent = relativeFormat . format ( datetime ) ; ;
} ) ;
}
[ ] . forEach . call ( document . querySelectorAll ( 'time.formatted' ) , ( content ) => {
const datetime = new Date ( content . getAttribute ( 'datetime' ) ) ;
const formattedDate = dateTimeFormat . format ( datetime ) ;
content . title = formattedDate ;
content . textContent = formattedDate ;
} ) ;
function main ( ) {
ready ( loaded ) ;
[ ] . forEach . call ( document . querySelectorAll ( 'time.time-ago' ) , ( content ) => {
const datetime = new Date ( content . getAttribute ( 'datetime' ) ) ;
content . textContent = relativeFormat . format ( datetime ) ; ;
} ) ;
} ) ;
delegate ( document , '.video-player video' , 'click' , ( { target } ) => {
if ( target . paused ) {