Lichess Chess.com Full Pack

gg

当前为 2015-04-02 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Lichess Chess.com Full Pack
// @namespace   http://example.com
// @description gg
// @include     http://*.lichess.org/*
// @version     1.3
// @grant       none
// ==/UserScript==
 
 
 
 
 
 
 
 
 
 $.sound = (function() {
     
  
     var MoveW = new Audio();
   MoveW.src = 'http://images.chesscomfiles.com/chess-themes/sounds/_MP3_/default/move-self.mp3';
     
   
   
     var MoveB = new Audio();
   MoveB.src = 'http://images.chesscomfiles.com/chess-themes/sounds/_MP3_/default/move-opponent.mp3';
    
    
    
    
     
      
        var Take = new Audio();
   Take.src = 'http://images.chesscomfiles.com/chess-themes/sounds/_MP3_/default/capture.mp3';
    
    
     
      
        var Dong = new Audio();
    Dong.src = 'http://images.chesscomfiles.com/chess-themes/sounds/_MP3_/default/game-end.mp3';
   
   
   var Lowtime = new Audio();
   Lowtime.src = 'http://images.chesscomfiles.com/chess-themes/sounds/_MP3_/default/move-check.mp3';
   
       
   
      
      
      
      
        
     
      
 
      
     var baseUrl = $('body').data('sound-dir') + '/';
    Howler.volume(lichess.storage.get('sound-volume') || 0.1);
    var audio = {
      dong: 'dong',
      moveW: 'move',
      moveB: 'move',
      take: 'take',
      lowtime: 'lowtime',
    };
    var volumes = {
      lowtime: 0.5
    };
    var get = new $.lazy(function(k) {
      return new Howl({
        src: ['ogg', 'mp3'].map(function(ext) {
          return baseUrl + audio[k] + '.' + ext;
        }),
        volume: volumes[k] || 0.1
      });
    });
    var $control = $('#sound_control');
    var $toggle = $('#sound_state');
    var enabled = function() {
      return !!lichess.storage.get('sound');
    };
    $control.add($toggle).toggleClass('sound_state_on', enabled());
    var play = {
      move: function(white) {
        if (enabled()) {
          if (white) MoveW.play();
          else MoveB.play();
        }
      },
      take: function() {
        if (enabled()) Take.play();
      },
      dong: function() {
        if (enabled()) Dong.play();
      },
      lowtime: function() {
        if (enabled()) Lowtime.play();
      }
     
    };
    var setVolume = function(v) {
      lichess.storage.set('sound-volume', v);
      Howler.volume(v);
    };
    var manuallySetVolume = $.fp.debounce(function(v) {
      setVolume(v);
      play.move(true);
    }, 50);
    $toggle.click(function() {
      var enab = !enabled();
      if (enab) lichess.storage.set('sound', 1);
      else lichess.storage.remove('sound');
      $control.add($toggle).toggleClass('sound_state_on', enab);
      play.dong();
      return false;
    });
    $toggle.one('mouseover', function() {
      $toggle.parent().find('.slider').slider({
        orientation: "vertical",
        min: 0,
        max: 1,
        range: 'min',
        step: 0.01,
        value: Howler.volume(),
        slide: function(e, ui) {
          manuallySetVolume(ui.value);
        }
      });
    });
 
    return play;
  })();







function addGlobalStyle(css) {
    var head, style;
    head = document.getElementsByTagName('head')[0];
    if (!head) { return; }
    style = document.createElement('style');
    style.type = 'text/css';
    style.innerHTML = css;
    head.appendChild(style);
};







addGlobalStyle('.cg-piece.knight.black { background-image: url("http://images.chesscomfiles.com/chess-themes/pieces/classic/80/bn.png")!important;} ');
addGlobalStyle('.cg-piece.bishop.black { background-image: url("http://images.chesscomfiles.com/chess-themes/pieces/classic/80/bb.png")!important;} ');
addGlobalStyle('.cg-piece.queen.black { background-image: url("http://images.chesscomfiles.com/chess-themes/pieces/classic/80/bq.png")!important;} ');
addGlobalStyle('.cg-piece.rook.black { background-image: url("http://images.chesscomfiles.com/chess-themes/pieces/classic/80/br.png")!important;} ');
addGlobalStyle('.cg-piece.pawn.black { background-image: url("http://images.chesscomfiles.com/chess-themes/pieces/classic/80/bp.png")!important;} ');
addGlobalStyle('.cg-piece.king.black { background-image: url("http://images.chesscomfiles.com/chess-themes/pieces/classic/80/bk.png")!important;} ');
addGlobalStyle('.cg-piece.knight.white { background-image: url("http://images.chesscomfiles.com/chess-themes/pieces/classic/80/wn.png")!important;} ');
addGlobalStyle('.cg-piece.bishop.white { background-image: url("http://images.chesscomfiles.com/chess-themes/pieces/classic/80/wb.png")!important;} ');
addGlobalStyle('.cg-piece.queen.white { background-image: url("http://images.chesscomfiles.com/chess-themes/pieces/classic/80/wq.png")!important;} ');
addGlobalStyle('.cg-piece.rook.white { background-image: url("http://images.chesscomfiles.com/chess-themes/pieces/classic/80/wr.png")!important;} ');
addGlobalStyle('.cg-piece.pawn.white { background-image: url("http://images.chesscomfiles.com/chess-themes/pieces/classic/80/wp.png")!important;} ');
addGlobalStyle('.cg-piece.king.white { background-image: url("http://images.chesscomfiles.com/chess-themes/pieces/classic/80/wk.png")!important;} ');


addGlobalStyle('.cg-board { background-image: url("http://images.chesscomfiles.com/chess-themes/boards/translucent/80.png")!important;} ');

addGlobalStyle('.cg-square.last-move { background-color:rgba(255, 0, 0, 0.41) !important;box-sizing:border-box;border:2px solid red;} ');

addGlobalStyle('.cg-square.check {background-color:red !important;}');






$('.cg-board').css({"border-color": "#ccc", 
             "border-width":"3px", 
               "border-style":"solid"});