PageSourceSearch

https://landforces.com.au/static/cookie_permissions.js?ver=ccbf187f8af070703a82b9c8ed00833d7a12ec12

js landforces.com.au collected 2026-09-28 10:35:34 UTC 3,493 bytes, 131 lines download raw bytes

1(function () {
2
3
4function delete_cookie (cookie_name) {
5  document.cookie = `${cookie_name}=; path=/; max-age=0; SameSite=Lax`;
6}
7
8
9function delete_analytics_cookies () {
10  delete_cookie('_ga');
11  delete_cookie('_gid');
12  delete_cookie('_gat');
13
14  document.cookie.split(';').forEach(function (cookie) {
15    const cookie_name = cookie.split('=')[0].trim();
16
17    if (
18      cookie_name.indexOf('_ga_') === 0 ||
19      cookie_name.indexOf('_hj') === 0
20    ) {
21      delete_cookie(cookie_name);
22    }
23  });
24}
25
26
27function render_cookie_permissions () {
28  if (!window_api_data.cookie_permissions) {
29    return;
30  }
31
32  if (window_api_data.cookie_permissions.choice_made) {
33    return;
34  }
35
36  const banner = document.createElement('div');
37  banner.className = 'cookie_permissions';
38
39  const heading = document.createElement('h4');
40  heading.className = 'cookie_permissions_heading';
41  heading.textContent = 'We value your privacy';
42
43  const text = document.createElement('div');
44  text.className = 'cookie_permissions_text';
45  text.innerHTML = "We use cookies to understand how visitors use this site and improve their experience, as detailed in our <a href='/privacy/'>Privacy Policy</a>.";
46
47  const buttons = document.createElement('div');
48  buttons.className = 'cookie_permissions_buttons';
49
50  const reject_button = document.createElement('button');
51  reject_button.type = 'button';
52  reject_button.className = 'cookie_permissions_button cookie_permissions_button_reject';
53  reject_button.textContent = 'Reject cookies';
54
55  const accept_button = document.createElement('button');
56  accept_button.type = 'button';
57  accept_button.className = 'cookie_permissions_button cookie_permissions_button_accept';
58  accept_button.textContent = 'Accept All';
59
60  reject_button.addEventListener('click', function () {
61    set_cookie_permissions(false);
62  });
63
64  accept_button.addEventListener('click', function () {
65    set_cookie_permissions(true);
66  });
67
68  buttons.appendChild(reject_button);
69  buttons.appendChild(accept_button);
70
71  banner.appendChild(heading);
72  banner.appendChild(text);
73  banner.appendChild(buttons);
74
75  document.body.appendChild(banner);
76}
77
78
79function set_cookie_permissions (allowed) {
80  const cookie_name = window_api_data.cookie_permissions.cookie_name;
81  const cookie_value = allowed ? 'true' : 'false';
82  const max_age = 60 * 60 * 24 * 365;
83
84  document.cookie = `${cookie_name}=${cookie_value}; path=/; max-age=${max_age}; SameSite=Lax`;
85
86  if (!allowed) {
87    delete_analytics_cookies();
88  }
89
90  window.location.reload();
91}
92
93
94function render_reset_button () {
95  if (!window_api_data.cookie_permissions) {
96    return;
97  }
98
99  // Never inside the Wagtail admin preview pane — that's an editing tool,
100  // not a real visit.
101  if (window_api_data.is_preview) {
102    return;
103  }
104
105  // Only shown once a choice has been made — while the consent popup itself
106  // is up, there's nothing to redo yet.
107  if (!window_api_data.cookie_permissions.choice_made) {
108    return;
109  }
110
111  const button = document.createElement('button');
112  button.type = 'button';
113  button.className = 'cookie_permissions_reset';
114  button.setAttribute('aria-label', 'Manage cookie consent');
115  button.title = 'Manage cookie consent';
116
117  button.addEventListener('click', function () {
118    delete_cookie(window_api_data.cookie_permissions.cookie_name);
119    delete_analytics_cookies();
120    window.location.reload();
121  });
122
123  document.body.appendChild(button);
124}
125
126
127render_cookie_permissions();
128render_reset_button();
129
130
131})();

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.