about summary refs log tree commit diff
path: root/app/javascript/packs
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-09-18 16:45:58 +0200
committerGitHub <noreply@github.com>2018-09-18 16:45:58 +0200
commitf4d549d30081478b1fe2bde9d340262e132bb891 (patch)
treed920447e62986f1ec47ce88084cf58a7abcad312 /app/javascript/packs
parentf8b54d229f70cb726511bcd35e1440618e487672 (diff)
Redesign forms, verify link ownership with rel="me" (#8703)
* Verify link ownership with rel="me"

* Add explanation about verification to UI

* Perform link verifications

* Add click-to-copy widget for verification HTML

* Redesign edit profile page

* Redesign forms

* Improve responsive design of settings pages

* Restore landing page sign-up form

* Fix typo

* Support <link> tags, add spec

* Fix links not being verified on first discovery and passive updates
Diffstat (limited to 'app/javascript/packs')
-rw-r--r--app/javascript/packs/public.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js
index c83e2889a..22a8643d9 100644
--- a/app/javascript/packs/public.js
+++ b/app/javascript/packs/public.js
@@ -68,6 +68,7 @@ function main() {
     });
 
     const reactComponents = document.querySelectorAll('[data-component]');
+
     if (reactComponents.length > 0) {
       import(/* webpackChunkName: "containers/media_container" */ '../mastodon/containers/media_container')
         .then(({ default: MediaContainer }) => {
@@ -80,6 +81,7 @@ function main() {
     }
 
     const parallaxComponents = document.querySelectorAll('.parallax');
+
     if (parallaxComponents.length > 0 ) {
       new Rellax('.parallax', { speed: -1 });
     }
@@ -87,6 +89,7 @@ function main() {
     const history = createHistory();
     const detailedStatuses = document.querySelectorAll('.public-layout .detailed-status');
     const location = history.location;
+
     if (detailedStatuses.length === 1 && (!location.state || !location.state.scrolledToDetailedStatus)) {
       detailedStatuses[0].scrollIntoView();
       history.replace(location.pathname, { ...location.state, scrolledToDetailedStatus: true });
@@ -175,6 +178,30 @@ function main() {
       lock.style.display = 'none';
     }
   });
+
+  delegate(document, '.input-copy input', 'click', ({ target }) => {
+    target.select();
+  });
+
+  delegate(document, '.input-copy button', 'click', ({ target }) => {
+    const input = target.parentNode.querySelector('input');
+
+    input.focus();
+    input.select();
+
+    try {
+      if (document.execCommand('copy')) {
+        input.blur();
+        target.parentNode.classList.add('copied');
+
+        setTimeout(() => {
+          target.parentNode.classList.remove('copied');
+        }, 700);
+      }
+    } catch (err) {
+      console.error(err);
+    }
+  });
 }
 
 loadPolyfills().then(main).catch(error => {