Guest User

Show Embed URLs

a guest
Sep 30th, 2026
4
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. /* This goes to User JS */
  2.  
  3. function wrapVideoAndAddUrl() {
  4. document.querySelectorAll('.video-container').forEach(container => {
  5. if (container.parentElement.classList.contains('video-wrapper')) return;
  6.  
  7. const link = container.querySelector('a[href]');
  8. if (!link) return;
  9. const url = link.href;
  10. if (!url) return;
  11.  
  12. const wrapper = document.createElement('div');
  13. wrapper.classList.add('video-wrapper');
  14.  
  15. container.parentNode.insertBefore(wrapper, container);
  16. wrapper.appendChild(container);
  17.  
  18. const urlTextLink = document.createElement('a');
  19. urlTextLink.href = url;
  20. urlTextLink.textContent = url;
  21. urlTextLink.classList.add('embed-url');
  22. urlTextLink.target = '_blank';
  23. urlTextLink.rel = 'noopener noreferrer';
  24. wrapper.appendChild(urlTextLink);
  25. });
  26. }
  27. window.addEventListener('DOMContentLoaded', wrapVideoAndAddUrl);
  28.  
  29.  
  30. /* This goes to User CSS */
  31.  
  32. .video-wrapper {
  33. display: inline-flex;
  34. flex-direction: column;
  35. align-items: flex-start;
  36. }
  37. .embed-url {
  38. margin-top: -5px;
  39. margin-left: 5px;
  40. font-size: 0.75em;
  41. color: #666 !important;
  42. text-decoration: underline;
  43. }
  44. .embed-url:hover {
  45. color: #777 !important;
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment