Skip to content

Instantly share code, notes, and snippets.

@Grantismo
Last active December 23, 2015 09:59
Show Gist options
  • Save Grantismo/6618017 to your computer and use it in GitHub Desktop.
Save Grantismo/6618017 to your computer and use it in GitHub Desktop.
Bookmarklet for extracting PGN from live chess.com game
javascript:(function(){ pgn = ""; currentBoard = $(".boardContainer:not(.chess_com_hidden, .visibilityHidden)"); pgn += '[White "' + currentBoard.find("[id^=white_player_name_]").text() + '"]\n[Black "' + currentBoard.find("[id^=black_player_name_]").text() + '"]\n[Result "*"]\n\n'; $(".dijitVisible").find('.gotomove').each(function(index, element){if(index % 2 == 0){pgn += ((index + 2) / 2) + ". "};pgn += $(this).text() + " "});pgn += " *"; alert(pgn); })();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment