PageSourceSearch

https://visitrunavik.fo/views/whatson/views/js/utils/socials.js

js visitrunavik.fo collected 2026-09-25 09:30:31 UTC 1,101 bytes, 39 lines download raw bytes

1/**
2 * Share a page on Facebook
3 *
4 * Opens Facebook's share page in a popup, the same dialog FB.ui shows, without loading the
5 * Facebook SDK (~90 KB) on every page view. Opened synchronously from the click, so popup
6 * blockers let it through.
7 *
8 * @param {string} [url] Page to share, the current page by default
9 */
10export function shareOnFacebook(url = window.location.href) {
11  window.open(
12    "https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(url),
13    "facebook-share",
14    "width=626,height=436"
15  );
16}
17
18function setCopyState(eventTarget) {
19  const container = eventTarget.querySelector('.copy-url-msg-container');
20
21  if (container && eventTarget) {
22    container.style.display = 'block';
23    eventTarget.classList.add('active');
24
25    setTimeout(() => {
26      container.style.display = 'none';
27      eventTarget.classList.remove('active');
28    }, 2000);
29  }
30}
31
32export async function copyURL(event) {
33  try {
34    await navigator.clipboard.writeText(window.location.href);
35    setCopyState(event.target);
36  } catch (err) {
37    console.error("Failed to copy: ", err);
38  }
39}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.