about summary refs log tree commit diff
path: root/app/javascript/packs
diff options
context:
space:
mode:
authorkibigo! <marrus-sh@users.noreply.github.com>2017-07-12 02:03:17 -0700
committerkibigo! <marrus-sh@users.noreply.github.com>2017-07-12 02:03:17 -0700
commit79d898ae0ad8c0e66bd63ec3e0904e9e5e7894e8 (patch)
treeee8d832ed2f11e9afe62daf0e586a86004eb8d98 /app/javascript/packs
parentbcf7ee48e94cd2e4d2de28e8854e7f0e2b5cad1f (diff)
parent056b5ed72f6d980bceeb49eb249b8365fe8fce66 (diff)
Merge upstream!! #64 <3 <3
Diffstat (limited to 'app/javascript/packs')
-rw-r--r--app/javascript/packs/common.js5
-rw-r--r--app/javascript/packs/public.js18
2 files changed, 21 insertions, 2 deletions
diff --git a/app/javascript/packs/common.js b/app/javascript/packs/common.js
index 9d63d8f98..a0cb91ae4 100644
--- a/app/javascript/packs/common.js
+++ b/app/javascript/packs/common.js
@@ -1,2 +1,7 @@
 import { start } from 'rails-ujs';
+
+// import default stylesheet with variables
+require('font-awesome/css/font-awesome.css');
+require('mastodon-application-style');
+
 start();
diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js
index 8a3ae0b3c..06cc1b53a 100644
--- a/app/javascript/packs/public.js
+++ b/app/javascript/packs/public.js
@@ -5,6 +5,9 @@ import emojify from '../mastodon/emoji';
 import { getLocale } from '../mastodon/locales';
 import loadPolyfills from '../mastodon/load_polyfills';
 import { processBio } from '../glitch/util/bio_metadata';
+import TimelineContainer from '../mastodon/containers/timeline_container';
+import React from 'react';
+import ReactDOM from 'react-dom';
 
 require.context('../images/', true);
 
@@ -37,6 +40,13 @@ function loaded() {
     const datetime = new Date(content.getAttribute('datetime'));
     content.textContent = relativeFormat.format(datetime);;
   });
+
+  const mountNode = document.getElementById('mastodon-timeline');
+
+  if (mountNode !== null) {
+    const props = JSON.parse(mountNode.getAttribute('data-props'));
+    ReactDOM.render(<TimelineContainer {...props} />, mountNode);
+  }
 }
 
 function main() {
@@ -54,8 +64,12 @@ function main() {
     }
   });
 
-  delegate(document, '.media-spoiler', 'click', ({ target }) => {
-    target.style.display = 'none';
+  delegate(document, '.activity-stream .media-spoiler-wrapper .media-spoiler', 'click', function() {
+    this.parentNode.classList.add('media-spoiler-wrapper__visible');
+  });
+
+  delegate(document, '.activity-stream .media-spoiler-wrapper .spoiler-button', 'click', function() {
+    this.parentNode.classList.remove('media-spoiler-wrapper__visible');
   });
 
   delegate(document, '.webapp-btn', 'click', ({ target, button }) => {