Skip to content

Commit f05104c

Browse files
clean up comments in index.html
1 parent 2e33ff3 commit f05104c

File tree

1 file changed

+0
-34
lines changed
  • web-integrations/prebid-integrations/client-server/public

1 file changed

+0
-34
lines changed

web-integrations/prebid-integrations/client-server/public/index.html

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<script>
1010
console.log('Initializing example.');
1111

12-
// Store the UID2 identity in localStorage
1312
const UID2_STORAGE_KEY = '__uid2_advertising_token';
1413
let currentIdentity = null;
1514

@@ -35,7 +34,6 @@
3534
value: {
3635
uid2: {
3736
id: currentIdentity.advertising_token,
38-
// Include additional fields for token refresh if available
3937
...(currentIdentity.refresh_token && {
4038
refresh_token: currentIdentity.refresh_token,
4139
refresh_from: currentIdentity.refresh_from,
@@ -53,13 +51,9 @@
5351
});
5452
}
5553

56-
/**
57-
* Update the UI elements based on current identity state
58-
*/
5954
function updateGuiElements() {
6055
console.log('Updating displayed values.');
6156

62-
// Check if user has opted out
6357
const storedToken = localStorage.getItem(UID2_STORAGE_KEY);
6458
let isOptedOut = false;
6559

@@ -90,9 +84,6 @@
9084
}
9185
}
9286

93-
/**
94-
* Handle login button click - call server to generate UID2 token
95-
*/
9687
async function handleLogin() {
9788
const email = $('#email').val();
9889

@@ -103,7 +94,6 @@
10394
console.log('Generating UID2 token for email:', email);
10495

10596
try {
106-
// Call the server's /login endpoint
10797
const response = await fetch('/login', {
10898
method: 'POST',
10999
headers: {
@@ -114,7 +104,6 @@
114104

115105
const data = await response.json();
116106

117-
// Check for opt-out (server returns 200 with status: 'optout')
118107
if (data.status === 'optout') {
119108
console.log('UID2 status: optout');
120109
localStorage.setItem(UID2_STORAGE_KEY, JSON.stringify({ status: 'optout' }));
@@ -123,7 +112,6 @@
123112
return;
124113
}
125114

126-
// Check for other errors
127115
if (!response.ok) {
128116
console.error('Token generation failed:', data);
129117
return;
@@ -132,35 +120,26 @@
132120
console.log('UID2 token received:', data);
133121

134122
if (data.identity) {
135-
// Store the identity
136123
currentIdentity = data.identity;
137124
localStorage.setItem(UID2_STORAGE_KEY, JSON.stringify(currentIdentity));
138125

139-
// Configure Prebid with the new token
140126
setPrebidConfig();
141127
}
142128

143-
// Update the UI
144129
updateGuiElements();
145130

146131
} catch (error) {
147132
console.error('Error calling login endpoint:', error);
148133
}
149134
}
150135

151-
/**
152-
* Handle clear storage button - clear UID2 token and refresh page
153-
*/
154136
function handleClearStorage() {
155137
console.log('Clearing UID2 storage.');
156138
localStorage.removeItem(UID2_STORAGE_KEY);
157139
currentIdentity = null;
158140
location.reload();
159141
}
160142

161-
/**
162-
* Load identity from localStorage on page load
163-
*/
164143
function loadStoredIdentity() {
165144
const storedToken = localStorage.getItem(UID2_STORAGE_KEY);
166145
if (storedToken) {
@@ -178,27 +157,14 @@
178157
}
179158
}
180159

181-
/**
182-
* Initialize the page
183-
*/
184160
function onDocumentReady() {
185161
console.log('Setting up interface handlers.');
186162

187-
// Set up event handlers
188163
$('#login').click(handleLogin);
189164
$('#clear_storage').click(handleClearStorage);
190165

191-
// Allow Enter key to submit
192-
$('#email').keypress(function(e) {
193-
if (e.which === 13) {
194-
handleLogin();
195-
}
196-
});
197-
198-
// Load any stored identity
199166
loadStoredIdentity();
200167

201-
// Update UI
202168
updateGuiElements();
203169
}
204170

0 commit comments

Comments
 (0)