MtoG

修正校园网流量显示错误的问题

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         MtoG
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  修正校园网流量显示错误的问题
// @author       xujingguo
// @include      http*://ipgw.neu.edu.cn/srun_portal_pc.php?url=&ac_id=1
// @include      http*://ipgw.neu.edu.cn/srun_portal_pc.php?ac_id=1&
// @require      https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js
// @grant        none
// ==/UserScript==

(function() {
    	var t = setTimeout(function(){
		var flux = $("#sum_bytes").html();
		//var flux = " 22380.78M";
		var pat = /\*M/i;
		var newFlux = flux.slice(0,flux.length-1);
		newFlux = parseFloat(newFlux);
		if(pat.test(pat) && newFlux > 1024)
			newFlux = newFlux * 1000 * 1000;
			newFlux = newFlux/(1024 * 1024 * 1024);
			newFlux = newFlux.toFixed(3);
            newFlux = newFlux+"G";
            //$("#sum_bytes").html(newFlux);
            $("#sum_bytes").css("text-decoration","line-through","color","red");
            $("<span> "+newFlux+"</span>").insertAfter($("#sum_bytes"));
			//alert(newFlux);
	},3000);
})();