Chess.com Custom Pieces

A simple JavaScript project where it changes the pieces of chess.com with anything you want!

目前為 2022-03-21 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Chess.com Custom Pieces
// @namespace    http://tampermonkey.net/
// @version      1.02
// @description  A simple JavaScript project where it changes the pieces of chess.com with anything you want!
// @author       SkidFace
// @match        https://www.chess.com/*
// @icon         https://www.dictionary.com/e/wp-content/uploads/2020/02/uwu_800x800-300x300.jpg
// @license      MIT
// @grant        none
// ==/UserScript==

//IMPORTANT!!!

//To use and modify this script to replace the images, simply replace the inside of the "url()" component of that const with a link to the image
//For example, if I wanted to change the White King piece to an UwU face, you would change line 31 to:

//const whiteKing = "url(https://avaazdo.s3.amazonaws.com/original_5ccdb9b8604f2.jpg)"


const blackPawn = "url()";
const blackRook = "url()";
const blackKnight = "url()";
const blackBishop = "url()";
const blackQueen = "url()";
const blackKing = "url()";


const whitePawn = "url()";
const whiteRook = "url()";
const whiteKnight = "url()";
const whiteBishop = "url()";
const whiteQueen = "url()";
const whiteKing = "url()";


//You do not need to change anything below. All you need to do is change the code above.

(function() {

    'use strict';
    setTimeout(function(){
        //black pieces
        changePiece("bp", blackPawn);
        changePiece("br", blackRook);
        changePiece("bn", blackKnight);
        changePiece("bb", blackBishop);
        changePiece("bq", blackQueen);
        changePiece("bk", blackKing);

        //white pieces
        changePiece("wp", whitePawn);
        changePiece("wr", whiteRook);
        changePiece("wn", whiteKnight);
        changePiece("wb", whiteBishop);
        changePiece("wq", whiteQueen);
        changePiece("wk", whiteKing);

    }, 100);
})();

function changePiece(piece, url){
    for (let i = 0; i < document.getElementsByClassName(piece).length; i++) {
        document.getElementsByClassName(piece)[i].style.backgroundImage = url;
        console.log("heya");
    }
}