Add users count to people nav when on users page

https://github.com/thegreatmichael/canvas-people-count-badge

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Add users count to people nav when on users page
// @namespace    http://canvas.vt.edu/
// @version      0.2
// @description  https://github.com/thegreatmichael/canvas-people-count-badge
// @author       Michael Stewart 
// @match        https://canvas.vt.edu/courses/*/users
// @grant        none
// ==/UserScript==
$(function () {
    var timerId = window.setInterval(function(){
  function addBadge () {
    if ($('table.roster tbody tr').length > 0) {
      $('nav li.section a.people').append('<span class="badge pull-right">'+$('table.roster tbody tr').length+'</span>');
    }
  }
  if ($._data(window).events.scroll && $._data(window).events.scroll.length > 0 && $('.paginatedLoadingIndicator').is(":visible"))  {
    $._data(window).events.scroll[0].handler();
  } else {
    addBadge();
  }
}, 250);
});