Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2025
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Lichess Isepic-Chess-Font
  3. // @author ajax333221
  4. // @description overwrites the chess font images with Isepic-Chess-Font
  5. // @version 1.1
  6. // @include https://lichess.org
  7. // @include https://lichess.org/*
  8. // ==/UserScript==
  9.  
  10. window.onload=function(){
  11. ownCss=document.createElement("style");
  12. ownCss.type="text/css";
  13.  
  14. var baseImageUrl="https://ajax333221.github.io/isepic-chess-ui/css/images/chess-fonts/isepic";
  15.  
  16. var baseCss="background-position: center center;";
  17. baseCss+="background-size: 70%;";
  18. baseCss+="background-repeat: no-repeat;";
  19.  
  20. var pieces = [
  21. {className: ".is2d .black.pawn", imageName: "bp.png"},
  22. {className: ".is2d .black.knight", imageName: "bn.png"},
  23. {className: ".is2d .black.bishop", imageName: "bb.png"},
  24. {className: ".is2d .black.rook", imageName: "br.png"},
  25. {className: ".is2d .black.queen", imageName: "bq.png"},
  26. {className: ".is2d .black.king", imageName: "bk.png"},
  27. {className: ".is2d .white.pawn", imageName: "wp.png"},
  28. {className: ".is2d .white.knight", imageName: "wn.png"},
  29. {className: ".is2d .white.bishop", imageName: "wb.png"},
  30. {className: ".is2d .white.rook", imageName: "wr.png"},
  31. {className: ".is2d .white.queen", imageName: "wq.png"},
  32. {className: ".is2d .white.king", imageName: "wk.png"}
  33. ];
  34.  
  35. var styleInnerHtml="";
  36. for(let i=0, len=pieces.length; i<len; i++){
  37. styleInnerHtml+=pieces[i].className+" {";
  38. styleInnerHtml+="background-image: url('"+baseImageUrl+"/"+pieces[i].imageName+"');";
  39. styleInnerHtml+=baseCss;
  40. styleInnerHtml+="}";
  41. }
  42.  
  43. ownCss.innerHTML=styleInnerHtml;
  44. document.body.appendChild(ownCss);
  45. };
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement