templates/front/social-media/index.html.twig line 1

Open in your IDE?
  1. <style>
  2.     #share-buttons a {
  3.         font-size: 20px;
  4.         margin-right: 15px;
  5.         color: #fff;
  6.         text-align: center;
  7.         border-radius: 50%;
  8.         box-shadow: 4px 6px 20px rgb(0 0 0 / 8%);
  9.         padding: 6px 10px;
  10.     }
  11.     .facebook-color {
  12.         background: #3b5998;
  13.     }
  14.     .twitter-color {
  15.         background: #55acee;
  16.     }
  17.     .linkedin-color {
  18.         background: #0077b5;
  19.     }
  20.     .reddit-color {
  21.         background: #cb2027;
  22.     }
  23.     .whatsapp-color {
  24.         background: #25D366;
  25.     }
  26.     .telegram-color {
  27.         background: #229ED9;
  28.     }
  29. </style>
  30. <div id="share-buttons">
  31.     <!-- facebook -->
  32.     <a class="facebook facebook-color"> <i class="fab fa-facebook"></i> </a>
  33.     <!-- twitter -->
  34.     <a class="twitter twitter-color" target="blank"><i class="fab fa-twitter"></i></a>
  35.     <!-- linkedin -->
  36.     <a class="linkedin linkedin-color" target="blank"><i class="fab fa-linkedin"></i></a>
  37.     <!-- reddit -->
  38.     {#     <a class="reddit" target="blank"><i class="fab fa-reddit"></i></a> #}
  39.     <!-- whatsapp-->
  40.     <a class="whatsapp whatsapp-color" target="blank"><i class="fab fa-whatsapp"></i></a>
  41.     <!-- telegram-->
  42.     {#      <a class="telegram" target="blank"><i class="fab fa-telegram"></i></a> #}
  43. </div>
  44. <script>
  45.     const link = encodeURI(window.location.href);
  46.     const msg = encodeURIComponent('Hey, I found this article');
  47.     const title = encodeURIComponent('Article or Post Title Here');
  48.     $(document).ready(function () {
  49.         $('.facebook').click(function (e) {
  50.             e.preventDefault();
  51.             window.open(`https://www.facebook.com/share.php?u=${link}`, 'fbShareWindow', 'height=450, width=550, top=' + ($(window).height() / 2 - 275) + ', left=' + ($(window).width() / 2 - 225) + ', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0');
  52.             return false;
  53.         });
  54.     });
  55.     const twitter = document.querySelector('.twitter');
  56.     twitter.href = `http://twitter.com/share?&url=${link}&text=${msg}`; /* &hashtags=javascript,programming */
  57.     const linkedIn = document.querySelector('.linkedin');
  58.     linkedIn.href = `https://www.linkedin.com/sharing/share-offsite/?url=${link}`;
  59.     /* const fb = document.querySelector('.facebook');
  60.         fb.href = `https://www.facebook.com/share.php?u=${link}`;*/
  61.     /* const reddit = document.querySelector('.reddit');
  62.     reddit.href = `http://www.reddit.com/submit?url=${link}&title=${title}`;*/
  63.     const whatsapp = document.querySelector('.whatsapp');
  64.     whatsapp.href = `https://api.whatsapp.com/send?text=${msg}: ${link}`;
  65.     /* const telegram = document.querySelector('.telegram');
  66.      telegram.href = `https://telegram.me/share/url?url=${link}&text=${msg}`;*/
  67. </script>