Created
November 18, 2014 00:24
-
-
Save amit-g/a3f5a1ad3a8e968d116a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name ChessboardsPrinting | |
// @namespace http://www.chess.com | |
// @description Adds a PRINT CHESSBOARDS button to Chess.com for chessboards printing | |
// @include http://www.chess.com/* | |
// @version 1 | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js | |
// @grant none | |
// ==/UserScript== | |
(function () { | |
run(); | |
function run() { | |
addPrintMenu(removeEverythingExceptChessBoards); | |
} | |
function addPrintMenu(callback) { | |
var $nav = $("#nav"); | |
var li = "<li><a href='#' class='print-chessboards'>PRINT CHESSBOARDS</a></li>"; | |
$nav.append(li); | |
$(".print-chessboards").on("click", callback); | |
} | |
function removeEverythingExceptChessBoards() { | |
var $chessDiagrams = $(".chessDiagram_Main"); | |
$("body").empty(); | |
$("body").css('background', 'none'); | |
$("body").append($chessDiagrams); | |
$(".chess_boardprompt").remove(); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment