From ab88c0fc6cf8aa32fc52980da89fabe33910866f Mon Sep 17 00:00:00 2001 From: Agath21 Date: Mon, 20 Jan 2025 15:05:41 +0100 Subject: [PATCH] Add options to share app in modal #24 --- css/storymap.css | 67 ++++++++++++++++++++++++++++++++++++++++++++++++ index.html | 22 +++++++++++++++- js/storymap.js | 17 ++++++++++++ 3 files changed, 105 insertions(+), 1 deletion(-) diff --git a/css/storymap.css b/css/storymap.css index 5ab221a..cf7c204 100644 --- a/css/storymap.css +++ b/css/storymap.css @@ -75,3 +75,70 @@ audio { } } +/* Share panel */ +.is-hidden { + display: none; +} + +.iconShare__list > a { + display: flex; + flex-direction: column; + align-items: center; + margin-right: 2em; + font-size: small; + text-decoration: none; + color: currentColor; + transition: 0.3s; +} + +.iconShare__list > a:hover { + cursor: pointer; + opacity: .8; +} + +.iconShare__list { + display: flex; +} + +.iconShare__list > a > i { + font-size: large; + background-color: #212529; + color: white; + border-radius: 2em; + width: 45px; + height: 45px; + display: flex; + justify-content: center; + align-items: center; +} + +#block__ShareLink { + display: flex; + flex-direction: row; + align-content: center; + align-items: center; + justify-content: flex-start; + border: 1px solid #d1d1d1; + padding: 0.5em .5em; + border-radius: .7em; +} + +#urlShare__link { + border: none; + width: 100%; +} + +#blockIframe > div { + display: flex; + align-items: center; + align-content: center; + justify-content: space-between; +} + +#blockIframe > .textEdit { + border: 1px solid #d1d1d1; + padding: 0.5em .5em; + border-radius: .7em; + font-family: monospace; + font-size: smaller; +} diff --git a/index.html b/index.html index 40fb817..af92304 100755 --- a/index.html +++ b/index.html @@ -107,10 +107,30 @@ diff --git a/js/storymap.js b/js/storymap.js index c4d1b10..7e3fee0 100755 --- a/js/storymap.js +++ b/js/storymap.js @@ -116,6 +116,23 @@ ks = (function() { } else { $("#menu").addClass("no-visible"); } + //Url to panel share + const currentUrlApp = window.location.href; + $("#urlShare__link").val(currentUrlApp); + let urlEmail = `mailto:?&body=` + encodeURIComponent(currentUrlApp); + let urlFacebook = "https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(currentUrlApp); + let urlX = "https://twitter.com/intent/post?url=" + encodeURIComponent(currentUrlApp); + let urlWhatapp = "https://wa.me/?text=" + encodeURIComponent(currentUrlApp); + const btnEmail = document.getElementById('btnShareEmail'); + const btnFacebook = document.getElementById('btnShareFacebook'); + const btnX = document.getElementById('btnShareX'); + const btnWhatapp = document.getElementById('btnShareWhatapp'); + btnFacebook.setAttribute("href", urlFacebook); + btnX.setAttribute("href", urlX); + btnWhatapp.setAttribute("href", urlWhatapp); + btnEmail.setAttribute("href", urlEmail); + let urlIframe = ``; + document.getElementById("block__IframeUrl").innerText = urlIframe; //splash config if (options.splash && !options.splash.iframe) { $("#splash").prepend('

');