Show APM in Ultra

Show APM in the Ultra gamemode

当前为 2019-06-18 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Show APM in Ultra
// @namespace    http://tampermonkey.net/
// @version      0.1
// @author       Oki
// @description  Show APM in the Ultra gamemode
// @match        https://*.jstris.jezevec10.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    window.addEventListener('load', function(){



/**************************
       APM in Ultra
**************************/

var loc=window.location.href
if(loc.endsWith("?play=5") || ~loc.indexOf("?play=3") || ~loc.indexOf("?play=1") ){

    var apmStat= document.createElement("tr");
    apmStat.innerHTML = '<td class="ter">APM</td><td class="sval"><span id="apms">0</span></td>'
    aux2.parentNode.parentNode.insertBefore(apmStat, aux2.parentNode);
    
        Game['prototype']['getAPM2'] = function() {
            return ((this['gamedata']['linesSent'] / (this['clock'] / 60))).toFixed(2)
        };
    
        var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}
    
        var updateTextBarFunc = Game['prototype']["updateTextBar"].toString()
        updateTextBarFunc = "apms.innerHTML=this['getAPM2']();" + trim(updateTextBarFunc)
        Game['prototype']["updateTextBar"] = new Function(updateTextBarFunc);
}

    });
})();