qb-pc-sdk 1.3.5 → 1.3.6

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "qb-pc-sdk",
3
- "version": "1.3.5",
4
- "description": "pc广告 SDK 封装器 -优化插屏广告样式",
3
+ "version": "1.3.6",
4
+ "description": "pc广告 SDK 封装器 -防抖防连点",
5
5
  "main": "core.min.js",
6
6
  "files": [
7
7
  "core.min.js",
@@ -552,6 +552,24 @@
552
552
  videoEl
553
553
  ].filter(Boolean);
554
554
 
555
+ (function() {
556
+ var lastAdClickTime = 0;
557
+ var debounceMs = 2000;
558
+ wrapper.addEventListener('click', function(e) {
559
+ if (e.target.closest('.q-ad-close-wrap')) return;
560
+ var now = Date.now();
561
+ if (lastAdClickTime && (now - lastAdClickTime < debounceMs)) {
562
+ e.preventDefault();
563
+ e.stopPropagation();
564
+ e.stopImmediatePropagation();
565
+ return;
566
+ }
567
+ lastAdClickTime = now;
568
+ }, true);
569
+ })();
570
+
571
+ var lastOnClickTime = 0;
572
+ var onClickDebounceMs = 2000;
555
573
  ad.bindAdToView({
556
574
  containerView: wrapper,
557
575
  clickableElements: clickable,
@@ -560,6 +578,9 @@
560
578
  if (this.config.onAdExpose) this.config.onAdExpose();
561
579
  },
562
580
  onClick: () => {
581
+ var now = Date.now();
582
+ if (lastOnClickTime && (now - lastOnClickTime < onClickDebounceMs)) return;
583
+ lastOnClickTime = now;
563
584
  if (this.config.onAdClick) this.config.onAdClick();
564
585
  }
565
586
  }
@@ -600,7 +621,7 @@
600
621
  if (cta) {
601
622
  try {
602
623
  const ev = new MouseEvent('click', {
603
- bubbles: true,
624
+ bubbles: false,
604
625
  cancelable: true,
605
626
  view: typeof window !== 'undefined' ? window : null
606
627
  });