Chess.com Game Preview Styling

Applies custom styling to Chess.com board components.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

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

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         Chess.com Game Preview Styling
// @namespace    http://tampermonkey.net/
// @version      1.6
// @description  Applies custom styling to Chess.com board components.
// @author       SaberSpeed77
// @match        https://www.chess.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=chess.com
// @grant        none
// @license      MIT
// ==/UserScript==
 
const imgs = new Map([
  /* White Pieces */
  ["wp", ""],
  ["wn", ""],
  ["wb", ""],
  ["wr", ""],
  ["wq", ""],
  ["wk", ""],

  /* Black Pieces */
  ["bp", ""],
  ["bn", ""],
  ["bb", ""],
  ["br", ""],
  ["bq", ""],
  ["bk", ""],
]);

/* Background */
const background = "";

/*========= ↑ STYLE / CODE ↓ =========*/

const styleElement = document.createElement("style");
const CSS = `
*:not(svg) {
  --theme-piece-set-wp: url(${imgs.get("wp")});
  --theme-piece-set-wn: url(${imgs.get("wn")});
  --theme-piece-set-wb: url(${imgs.get("wb")});
  --theme-piece-set-wr: url(${imgs.get("wr")});
  --theme-piece-set-wq: url(${imgs.get("wq")});
  --theme-piece-set-wk: url(${imgs.get("wk")});

  --theme-piece-set-bp: url(${imgs.get("bp")});
  --theme-piece-set-bn: url(${imgs.get("bn")});
  --theme-piece-set-bb: url(${imgs.get("bb")});
  --theme-piece-set-br: url(${imgs.get("br")});
  --theme-piece-set-bq: url(${imgs.get("bq")});
  --theme-piece-set-bk: url(${imgs.get("bk")});

  --theme-board-style-image: url(${background});
}
`

styleElement.appendChild(document.createTextNode(CSS));
document.head.appendChild(styleElement);