PageSourceSearch

https://tadaaa.co.uk/assets/controllers/referrals_share_controller-68dae06e.js

js tadaaa.co.uk collected 2026-10-01 02:57:49 UTC 1,545 bytes, 60 lines download raw bytes

1import BaseController from "controllers/base_controller";
2
3export default class extends BaseController {
4  static targets = ["linkInput", "copyIcon", "checkIcon", "copyButton", "copyCtaButton"];
5
6  async copyLink() {
7    await navigator.clipboard.writeText(this.linkInputTarget.value);
8    this.showSuccessState();
9  }
10
11  async shareLink() {
12    const url = this.linkInputTarget.value;
13
14    if (!navigator.share) {
15      this.copyLink();
16      return;
17    }
18
19    try {
20      await navigator.share({
21        title: 'Join TADAAA with my referral',
22        text: 'Get £10 off your first order when you sign up with my referral link!',
23        url: url
24      });
25    } catch (_error) {
26      this.copyLink();
27    }
28  }
29
30  showCheckboxIcon() {
31    this.copyIconTarget.classList.add('hidden');
32    this.checkIconTarget.classList.remove('hidden');
33  }
34
35  showCopyIcon() {
36    this.copyIconTarget.classList.remove('hidden');
37    this.checkIconTarget.classList.add('hidden');
38  }
39
40  async showSuccessState() {
41    if (this.hasCopyIconTarget && this.hasCheckIconTarget) {
42      this.showCheckboxIcon();
43    }
44
45    let originalText;
46    if (this.hasCopyCtaButtonTarget) {
47      originalText = this.copyCtaButtonTarget.textContent;
48      this.copyCtaButtonTarget.textContent = "Copied";
49    }
50
51    await this.delay(1000);
52
53    if (this.hasCopyIconTarget && this.hasCheckIconTarget) {
54      this.showCopyIcon();
55    }
56    if (this.hasCopyCtaButtonTarget && originalText !== undefined) {
57      this.copyCtaButtonTarget.textContent = originalText;
58    }
59  }
60}

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.