GitHub Stars

Get Total of GitHub stars

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         GitHub Stars
// @namespace    http
// @version      1.0
// @description  Get Total of GitHub stars
// @author       AdemKouki
// @include      /^(https?:\/\/)?(www\.)?github\.com\/[a-zA-Z0-9_]{1,25}$/
// @grant        none
// @require      https://code.jquery.com/jquery-3.3.1.min.js
// ==/UserScript==


function AddText(text){
    let el = document.querySelector(".vcard-username");
    let newNode = document.createElement('span');
    // add class
    newNode.classList.add("p-nickname");
    newNode.classList.add("vcard-username");
    newNode.classList.add("d-blockkkkkk");
    // insert new span after username
    el.parentNode.insertBefore(newNode, el.nextSibling);

    newNode.textContent += text + " ⭐";
}

function getInfos(){
  let total_stars = 0;
  let username = window.location.pathname.replace("/", "");

  var jqxhr = $.ajax( 'https://api.github.com/users/'+username+'/repos?per_page=100' )
  .done(function(res) {
    res.forEach(function (sandwich, index) {
            let stargazers_count = sandwich.stargazers_count;
            total_stars += stargazers_count;
       });
      AddText(total_stars);
  })
  .fail(function() {

  });


}

getInfos();