Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@koyo-miyamura 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