Togetter auto expandを最近の書き方で。 らいもんさんが、 Togetter auto expand というぐりもんを書いていたので、リファクタした。 ぐりもん書いたの久々。 ただ、コード量としては増えているから、IntersectionObserverを使うよりかは、元ネタの通り、setInterval使ったほうがスマートかな。 ミニマムなIntersectionObserverのサンプルコードになるので、何かの参考になれば良い。 // ==UserScript== // @name Togetter auto expand // @description Togetterページの「この続きを読む」自動でクリック // @namespace http://sangoukan.xrea.jp/ // @match https://togetter.com/li/* // @grant none // @downloadURL https://github.com/raimon49/userscripts/raw/master/togetter_auto_expand.user.js // @updateURL https://github.com/raimon49/userscripts/raw/master/togetter_auto_expand.user.js // @noframes // @author raimon // @version 1.0.1 // ==/UserScript== (() => { function callback(entries){ entries.forEach(entry=>{ if(entry.isIntersecting){ let elem = entry.target; if( elem && typeof elem.onclick==="function"){ ...