Krunker Features

Simple script to add client features to Krunker including: Game timer in the menu and find new game

当前为 2020-12-12 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Krunker Features
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Simple script to add client features to Krunker including: Game timer in the menu and find new game
// @author       KLZX121
// @match        https://krunker.io/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    //Menu Timer
    setInterval(()=>{

        //move spectateButton
        document.getElementById('spectButton').setAttribute('style', 'top: 20px;left: 550px')

        //create element menuTimer
        let menuTimer = document.createElement("div")
        menuTimer.setAttribute('id', 'menuTimer')
        menuTimer.setAttribute('style', "margin-bottom: 50px;color: cyan")

        //append to instructions element
        document.getElementById('instructions').appendChild(menuTimer)

        //update menuTimer
        let time = document.getElementById('timerVal').innerHTML
        document.getElementById('menuTimer').innerHTML = time

    }, 1000)

    //Find New Game on F4
    document.onkeydown = findNewGame;

    function findNewGame(a){
        if (a.code !== 'F4') return;
        window.location.href = 'https://krunker.io';
    }

})();