0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

GitHub の Conversation で hidden を開いて未解決のコメントをカウントする。

Posted at

ここを参考に作成しました。

javascript:(function() {
  function countNoResolve() {
    let buttons = document.querySelectorAll('button');
    let count = 0;
    buttons.forEach(function(button) {
      if (button.textContent.includes('Resolve conversation')) {
        count++;
      }
    });
    alert("未解決: " + count);
  }

  let openCount = 0;
  function clickButtons() {
    const buttons = [
      /* hidden [items|conversations] を開く(ref: https://qiita.com/the_red/items/f7d2d498b2e15e82aad5) */
      'ajax-pagination-btn',
    ].flatMap((className) => {
      const arr = Array.from(document.getElementsByClassName(className));
      console.log(`${className}: ${arr.length}`);
      return arr;
    });

    openCount += buttons.length;
    if (buttons.length === 0) {
      if ( openCount === 0 ) {
        /* alert("該当するボタンがありません。"); */
      } else {
        /* alert(`オープン完了しました。${openCount}`); */
      }
      countNoResolve();
      return;
    }
    buttons.forEach(function(button) {
      button.click();
    });
    setTimeout(function() {
      clickButtons();
    }, 2000);
  }
  clickButtons();
})();
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?