PageSourceSearch

https://aston.co.uk/astonassets/new/js/share.js

js aston.co.uk collected 2026-09-24 23:09:15 UTC 1,719 bytes, 50 lines download raw bytes

1const shareButton = document.querySelector('.share-button');
2const shareDialog = document.querySelector('.share-dialog');
3const closeButton = document.querySelector('.close-button');
4const page_title = document.title;
5const page_url = document.querySelector('link[rel=canonical]') ? document.querySelector('link[rel=canonical]').href : document.location.href;
6
7shareButton.addEventListener('click', event => {
8  if (navigator.share) {
9    navigator.share({
10      title: page_title,
11      url: page_url
12    }).then(() => {
13      console.log('Thanks for sharing!');
14    })
15    .catch(console.error);
16  } else {
17    setShareLinks(page_url);
18    shareDialog.classList.add('is-open');
19  }
20});
21
22closeButton.addEventListener('click', event => {
23  shareDialog.classList.remove('is-open');
24});
25
26let copyBtn = document.getElementById('copy-link');
27copyBtn.addEventListener('click', copyText);
28function copyText(ev){
29  let div = document.getElementById('page-url');
30  let text = div.innerText;
31  let textArea  = document.createElement('textarea');
32  textArea.width  = "1px"; 
33  textArea.height = "1px";
34  textArea.background =  "transparents" ;
35  textArea.value = text;
36  document.body.append(textArea);
37  textArea.select();
38  document.execCommand('copy');
39  document.body.removeChild(textArea);
40}
41
42let el_url = document.getElementById('page-url');
43el_url.innerText = page_url;
44
45function setShareLinks(url) {
46    var pageUrl = encodeURIComponent(url);
47    jQuery(".fb_btn").attr('href', "https://www.facebook.com/sharer.php?u=" + pageUrl);
48    jQuery(".tw_btn").attr('href', "https://twitter.com/intent/tweet?url=" + pageUrl);
49    jQuery(".li_btn").attr('href', "https://www.linkedin.com/shareArticle?mini=true&url=" + pageUrl);
50}

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.