Merge changes from upstream with the CSS reload fix
This commit is contained in:
@ -1,12 +1,11 @@
|
||||
import TimelineContainer from '../mastodon/containers/timeline_container';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import loadPolyfills from '../mastodon/load_polyfills';
|
||||
import ready from '../mastodon/ready';
|
||||
|
||||
require.context('../images/', true);
|
||||
|
||||
function loaded() {
|
||||
const TimelineContainer = require('../mastodon/containers/timeline_container').default;
|
||||
const React = require('react');
|
||||
const ReactDOM = require('react-dom');
|
||||
const mountNode = document.getElementById('mastodon-timeline');
|
||||
|
||||
if (mountNode !== null) {
|
||||
@ -16,6 +15,7 @@ function loaded() {
|
||||
}
|
||||
|
||||
function main() {
|
||||
const ready = require('../mastodon/ready').default;
|
||||
ready(loaded);
|
||||
}
|
||||
|
||||
|
40
app/javascript/packs/admin.js
Normal file
40
app/javascript/packs/admin.js
Normal file
@ -0,0 +1,40 @@
|
||||
import { delegate } from 'rails-ujs';
|
||||
|
||||
function handleDeleteStatus(event) {
|
||||
const [data] = event.detail;
|
||||
const element = document.querySelector(`[data-id="${data.id}"]`);
|
||||
if (element) {
|
||||
element.parentNode.removeChild(element);
|
||||
}
|
||||
}
|
||||
|
||||
[].forEach.call(document.querySelectorAll('.trash-button'), (content) => {
|
||||
content.addEventListener('ajax:success', handleDeleteStatus);
|
||||
});
|
||||
|
||||
const batchCheckboxClassName = '.batch-checkbox input[type="checkbox"]';
|
||||
|
||||
delegate(document, '#batch_checkbox_all', 'change', ({ target }) => {
|
||||
[].forEach.call(document.querySelectorAll(batchCheckboxClassName), (content) => {
|
||||
content.checked = target.checked;
|
||||
});
|
||||
});
|
||||
|
||||
delegate(document, batchCheckboxClassName, 'change', () => {
|
||||
const checkAllElement = document.querySelector('#batch_checkbox_all');
|
||||
if (checkAllElement) {
|
||||
checkAllElement.checked = [].every.call(document.querySelectorAll(batchCheckboxClassName), (content) => content.checked);
|
||||
}
|
||||
});
|
||||
|
||||
delegate(document, '.media-spoiler-show-button', 'click', () => {
|
||||
[].forEach.call(document.querySelectorAll('.activity-stream .media-spoiler-wrapper'), (content) => {
|
||||
content.classList.add('media-spoiler-wrapper__visible');
|
||||
});
|
||||
});
|
||||
|
||||
delegate(document, '.media-spoiler-hide-button', 'click', () => {
|
||||
[].forEach.call(document.querySelectorAll('.activity-stream .media-spoiler-wrapper'), (content) => {
|
||||
content.classList.remove('media-spoiler-wrapper__visible');
|
||||
});
|
||||
});
|
@ -1,6 +1,7 @@
|
||||
import main from '../mastodon/main';
|
||||
import loadPolyfills from '../mastodon/load_polyfills';
|
||||
|
||||
loadPolyfills().then(main).catch(e => {
|
||||
loadPolyfills().then(() => {
|
||||
require('../mastodon/main').default();
|
||||
}).catch(e => {
|
||||
console.error(e);
|
||||
});
|
||||
|
@ -1,45 +1,44 @@
|
||||
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 { processBio } from '../glitch/util/bio_metadata';
|
||||
import ready from '../mastodon/ready';
|
||||
|
||||
const { localeData } = getLocale();
|
||||
localeData.forEach(IntlRelativeFormat.__addLocaleData);
|
||||
|
||||
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);
|
||||
|
||||
[].forEach.call(document.querySelectorAll('.emojify'), (content) => {
|
||||
content.innerHTML = emojify(content.innerHTML);
|
||||
});
|
||||
|
||||
[].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('time.time-ago'), (content) => {
|
||||
const datetime = new Date(content.getAttribute('datetime'));
|
||||
content.textContent = relativeFormat.format(datetime);;
|
||||
});
|
||||
}
|
||||
|
||||
function main() {
|
||||
ready(loaded);
|
||||
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;
|
||||
|
||||
const { localeData } = getLocale();
|
||||
localeData.forEach(IntlRelativeFormat.__addLocaleData);
|
||||
|
||||
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('.emojify'), (content) => {
|
||||
content.innerHTML = emojify(content.innerHTML);
|
||||
});
|
||||
|
||||
[].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('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) {
|
||||
|
Reference in New Issue
Block a user