@duckduckgo/autoconsent 16.42.0 → 16.43.0

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.
@@ -410,6 +410,24 @@ var snippets = {
410
410
  });
411
411
  return true;
412
412
  },
413
+ EVAL_SOURCEPOINT_RESTORE_SCROLL: () => {
414
+ const root = document.documentElement;
415
+ const saved = root.dataset.previousScrollY;
416
+ if (saved && saved !== "null") {
417
+ root.dataset.previousScrollY = "null";
418
+ const y = -parseInt(saved, 10);
419
+ if (y > 0 && window.scrollY === 0) {
420
+ const behavior = root.style.scrollBehavior;
421
+ root.style.scrollBehavior = "auto";
422
+ window.scrollTo(0, y);
423
+ root.style.scrollBehavior = behavior;
424
+ }
425
+ }
426
+ window.addEventListener("pagehide", () => {
427
+ if (root.dataset.previousScrollY) root.dataset.previousScrollY = "null";
428
+ });
429
+ return true;
430
+ },
413
431
  EVAL_STEAMPOWERED_0: () => JSON.parse(
414
432
  decodeURIComponent(
415
433
  document.cookie.split(";").find((s) => s.trim().startsWith("cookieSettings")).split("=")[1]
@@ -380,6 +380,24 @@ var snippets = {
380
380
  });
381
381
  return true;
382
382
  },
383
+ EVAL_SOURCEPOINT_RESTORE_SCROLL: () => {
384
+ const root = document.documentElement;
385
+ const saved = root.dataset.previousScrollY;
386
+ if (saved && saved !== "null") {
387
+ root.dataset.previousScrollY = "null";
388
+ const y = -parseInt(saved, 10);
389
+ if (y > 0 && window.scrollY === 0) {
390
+ const behavior = root.style.scrollBehavior;
391
+ root.style.scrollBehavior = "auto";
392
+ window.scrollTo(0, y);
393
+ root.style.scrollBehavior = behavior;
394
+ }
395
+ }
396
+ window.addEventListener("pagehide", () => {
397
+ if (root.dataset.previousScrollY) root.dataset.previousScrollY = "null";
398
+ });
399
+ return true;
400
+ },
383
401
  EVAL_STEAMPOWERED_0: () => JSON.parse(
384
402
  decodeURIComponent(
385
403
  document.cookie.split(";").find((s) => s.trim().startsWith("cookieSettings")).split("=")[1]
@@ -382,6 +382,24 @@
382
382
  });
383
383
  return true;
384
384
  },
385
+ EVAL_SOURCEPOINT_RESTORE_SCROLL: () => {
386
+ const root = document.documentElement;
387
+ const saved = root.dataset.previousScrollY;
388
+ if (saved && saved !== "null") {
389
+ root.dataset.previousScrollY = "null";
390
+ const y = -parseInt(saved, 10);
391
+ if (y > 0 && window.scrollY === 0) {
392
+ const behavior = root.style.scrollBehavior;
393
+ root.style.scrollBehavior = "auto";
394
+ window.scrollTo(0, y);
395
+ root.style.scrollBehavior = behavior;
396
+ }
397
+ }
398
+ window.addEventListener("pagehide", () => {
399
+ if (root.dataset.previousScrollY) root.dataset.previousScrollY = "null";
400
+ });
401
+ return true;
402
+ },
385
403
  EVAL_STEAMPOWERED_0: () => JSON.parse(
386
404
  decodeURIComponent(
387
405
  document.cookie.split(";").find((s) => s.trim().startsWith("cookieSettings")).split("=")[1]