Scratch Toplam İzlenme Sayacı - @ygnJavascript

Türkçe Scratch istatistik gösterici.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Scratch Toplam İzlenme Sayacı - @ygnJavascript
// @namespace    none
// @version      1.1
// @description  Türkçe Scratch istatistik gösterici.
// @author       YGN
// @match        *://scratch.mit.edu/*
// @grant        none
// ==/UserScript==

//Bir Scratch kullanıcısının profil sayfasına girmeniz yeterli.

var w=window,d=document,i,getstats,allview=0,url,duzenlisayi,name,xmlhttp,projects,ygn=(x)=>{return x[0] == "#"?document.querySelector(x):x.indexOf(" ")!=-1?document.getElementsByClassName(x.split(".")[1]):document.querySelectorAll(x)};
w.onload=()=>{
    xmlhttp=new XMLHttpRequest();
    name = document.querySelector("h2").innerText;
    console.log(name);
    url="https://api.scratch.mit.edu/users/"+name+"/projects";
    xmlhttp.onreadystatechange=function(){
        if(this.readyState==4&&this.status==200){
            projects=JSON.parse(this.responseText);
            for(i in projects){
                allview=allview+parseInt(projects[i].stats.views);
            }
            duzenlisayi = allview.toString().replace(/(\d)(?=(\d{3})+$)/g, '$1.');
            document.querySelector("h2").innerHTML+='&nbsp;&nbsp; - &nbsp;&nbsp;<font style="color:lightblue;font-size:13px;font-weight:bold;">Toplam <font style="color:lightgreen;">'+duzenlisayi+'</font> izlenme</font>';
        }
    };
    xmlhttp.open("GET",url,true);
    xmlhttp.send();
}
//http://yazilimcity.net/ sitesine teşekkürler.