补充主题静态资源与归档模板

This commit is contained in:
kate522 committed 2026-07-03 23:15:11 +08:00
1 parent 1268a55dd0
commit 3247db7ed1
265 files changed
+59174

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
/**
* Passive event listener polyfill
*
* Patches addEventListener so scroll-blocking events (touchstart, touchmove,
* wheel, mousewheel) default to { passive: true } unless explicitly set to
* false. Eliminates Chrome Violation warnings from third-party libraries.
*/
(function () {
'use strict';
var opts = Object.defineProperty({}, 'passive', {
get: function () { window.__passiveSupported = true; }
});
window.addEventListener('test', null, opts);
if (!window.__passiveSupported) return;
var orig = EventTarget.prototype.addEventListener;
var passiveEvents = { touchstart: 1, touchmove: 1, wheel: 1, mousewheel: 1 };
EventTarget.prototype.addEventListener = function (type, listener, options) {
if (passiveEvents[type] && typeof options !== 'object') {
options = { passive: true, capture: options };
}
orig.call(this, type, listener, options);
};
})();