Skip to content

Instantly share code, notes, and snippets.

@koyo-miyamura
Last active September 16, 2019 06:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koyo-miyamura/41539f265d650b625db051a1860263cd to your computer and use it in GitHub Desktop.
Save koyo-miyamura/41539f265d650b625db051a1860263cd to your computer and use it in GitHub Desktop.
cometsでコメント数を取得する拡張ブックマークレット
javascript:void function(){document.body.appendChild(document.createElement("script")).src="//comets.nabettu.com/presenter/script.js";document.body.appendChild(document.createElement("script")).appendChild(document.createTextNode("let count = -1;setTimeout(() => {$(document).on('animationstart', '.comment',function(){count++;$('.status').text(`コメント数 ${count}`)})},2000)"));document.body.appendChild(document.createElement("style")).appendChild(document.createTextNode(".status{font-size: 32px !important;}"));}();
@koyo-miyamura
Copy link
Author

koyo-miyamura commented Sep 16, 2019

setTimeoutしてるのは動的に読み込んだcometsの実行完了を待っている(中で読み込んでいるjQueryとDOM要素の生成待ち)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment