about summary refs log tree commit diff
path: root/app/javascript/packs/public.js
diff options
context:
space:
mode:
authorOndřej Hruška <ondra@ondrovo.com>2017-07-18 18:59:00 +0200
committerOndřej Hruška <ondra@ondrovo.com>2017-07-18 18:59:00 +0200
commitdf74e26baf3c639d0419a7b809208636e81d93f3 (patch)
treeef0462e5fcc8cc7962ef42d80f7dd520a574a7c5 /app/javascript/packs/public.js
parentc727eae4412ac9e4f1bafdc68fe89dcd46d602ca (diff)
parentd69fa9e1f40124279ec9d772e5f54d1e11724e2d (diff)
Merge branch 'tootsuite-master'
Diffstat (limited to 'app/javascript/packs/public.js')
-rw-r--r--app/javascript/packs/public.js67
1 files changed, 33 insertions, 34 deletions
diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js
index 39daef761..1e89660f2 100644
--- a/app/javascript/packs/public.js
+++ b/app/javascript/packs/public.js
@@ -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 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) {