[Glitch] Dont use CommonJS (require
, module.exports
) anywhere
Port 955179fc55
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import 'packs/public-path';
|
||||
import ready from 'flavours/glitch/ready';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
|
||||
ready(() => {
|
||||
const React = require('react');
|
||||
const ReactDOM = require('react-dom');
|
||||
|
||||
[].forEach.call(document.querySelectorAll('[data-admin-component]'), element => {
|
||||
const componentName = element.getAttribute('data-admin-component');
|
||||
const { locale, ...componentProps } = JSON.parse(element.getAttribute('data-props'));
|
||||
|
@@ -5,6 +5,14 @@ import loadKeyboardExtensions from 'flavours/glitch/load_keyboard_extensions';
|
||||
import axios from 'axios';
|
||||
import { throttle } from 'lodash';
|
||||
import { defineMessages } from 'react-intl';
|
||||
import * as IntlMessageFormat from 'intl-messageformat';
|
||||
import { timeAgoString } from 'flavours/glitch/components/relative_timestamp';
|
||||
import { delegate } from '@rails/ujs';
|
||||
import emojify from 'flavours/glitch/features/emoji/emoji';
|
||||
import { getLocale } from 'locales';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { createBrowserHistory } from 'history';
|
||||
|
||||
const messages = defineMessages({
|
||||
usernameTaken: { id: 'username.taken', defaultMessage: 'That username is taken. Try another' },
|
||||
@@ -13,15 +21,7 @@ const messages = defineMessages({
|
||||
});
|
||||
|
||||
function main() {
|
||||
const IntlMessageFormat = require('intl-messageformat').default;
|
||||
const { timeAgoString } = require('flavours/glitch/components/relative_timestamp');
|
||||
const { delegate } = require('@rails/ujs');
|
||||
const emojify = require('flavours/glitch/features/emoji/emoji').default;
|
||||
const { getLocale } = require('locales');
|
||||
const { localeData } = getLocale();
|
||||
const React = require('react');
|
||||
const ReactDOM = require('react-dom');
|
||||
const { createBrowserHistory } = require('history');
|
||||
|
||||
const scrollToDetailedStatus = () => {
|
||||
const history = createBrowserHistory();
|
||||
|
@@ -1,11 +1,10 @@
|
||||
import 'packs/public-path';
|
||||
import loadPolyfills from 'flavours/glitch/load_polyfills';
|
||||
import loadKeyboardExtensions from 'flavours/glitch/load_keyboard_extensions';
|
||||
import { delegate } from '@rails/ujs';
|
||||
import 'cocoon-js-vanilla';
|
||||
|
||||
function main() {
|
||||
const { delegate } = require('@rails/ujs');
|
||||
|
||||
const toggleSidebar = () => {
|
||||
const sidebar = document.querySelector('.sidebar ul');
|
||||
const toggleButton = document.querySelector('.sidebar__toggle__icon');
|
||||
|
@@ -1,20 +1,23 @@
|
||||
import 'packs/public-path';
|
||||
import loadPolyfills from 'flavours/glitch/load_polyfills';
|
||||
import ComposeContainer from 'flavours/glitch/containers/compose_container';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import ready from 'flavours/glitch/ready';
|
||||
|
||||
function loaded() {
|
||||
const ComposeContainer = require('flavours/glitch/containers/compose_container').default;
|
||||
const React = require('react');
|
||||
const ReactDOM = require('react-dom');
|
||||
const mountNode = document.getElementById('mastodon-compose');
|
||||
|
||||
if (mountNode !== null) {
|
||||
const props = JSON.parse(mountNode.getAttribute('data-props'));
|
||||
if (mountNode) {
|
||||
const attr = mountNode.getAttribute('data-props');
|
||||
if(!attr) return;
|
||||
|
||||
const props = JSON.parse(attr);
|
||||
ReactDOM.render(<ComposeContainer {...props} />, mountNode);
|
||||
}
|
||||
}
|
||||
|
||||
function main() {
|
||||
const ready = require('flavours/glitch/ready').default;
|
||||
ready(loaded);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user