(function(w) { var sent = 0; function _send(data) { if (!sent && navigator.sendBeacon) { navigator.sendBeacon('https://blog.hatena.ne.jp/api/security/report', JSON.stringify(data)); sent = 1; mo.disconnect(); } } function c(e) { var s = getComputedStyle(e); var r = e.getBoundingClientRect(); if (s.position === 'fixed' && r.width*r.height > w.innerWidth*w.innerHeight*0.9) { _send({ id: 'fixed', ref: location.href }); } } var mo = new MutationObserver(function(ms) { ms.forEach(function(m) { if (m.type === 'attributes') { return setTimeout(function() { c(m.target); }, 0); } m.addedNodes.forEach(function(n) { if (n.nodeType !== 1) return; var walker = document.createTreeWalker(n, NodeFilter.SHOW_ELEMENT, null, false); setTimeout(function() { c(n); }, 0); while (walker.nextNode()) { (function(el) { setTimeout(function() { c(el); }, 0); })(walker.currentNode); } }); }); }); mo.observe(document.documentElement, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class', 'id'], }); })(window);