I use the greasemonkey add-on in my firefox browser so I get an FEN below the analyze board. However the FEN doesn't progress in accordance with the pieces as I move them on the analyze board. I was wondering if this is something that might be possible...or if there were another way of obtaining a FEN from a position you've arrived at on the analyze board...other than transcribing it manually.
Originally posted by MahoutTry this -
I use the greasemonkey add-on in my firefox browser so I get an FEN below the analyze board. However the FEN doesn't progress in accordance with the pieces as I move them on the analyze board. I was wondering if this is something that might be possible...or if there were another way of obtaining a FEN from a position you've arrived at on the analyze board...other than transcribing it manually.
// ==UserScript==
// @name RHP Analysis Board
// @namespace orangutan
// @description Adds updating FEN to the analysis board
// @include http://www.redhotpawn.com/gameanalysis/boardanalysis.php*
// @include http://www.chessatwork.com/gameanalysis/boardanalysis.php*
// @include http://www.timeforchess.com/gameanalysis/boardanalysis.php*
// @include http://www.redhotchess.com/gameanalysis/boardanalysis.php*
// @include http://www.playtheimmortalgame.com/gameanalysis/boardanalysis.php*
// ==/UserScript==
addFenBox();
document.addEventListener(
'click',
function (e) {
var fenHandle = document.getElementById('fenStr'😉;
if (fenHandle) {
fenHandle.innerHTML = unsafeWindow.JSExp_GetFenFromBoardState(unsafeWindow.g_boardState);
}
}, false);
function addFenBox() {
var captureDiv = document.getElementById('capturedwhiteid'😉.parentNode.parentNode;
if (captureDiv) {
var fen = unsafeWindow.JSExp_GetFenFromBoardState(unsafeWindow.g_boardState);
var fenString = document.createElement('div'😉;
fenString.setAttribute('id', 'fenStr'😉;
fenString.setAttribute('style', 'border: none; width: 100%;'😉;
fenString.innerHTML = fen;
var fenBox = document.createElement('div'😉;
fenBox.setAttribute('class', 'consolecontent'😉;
fenBox.setAttribute('id', 'fenBox'😉;
fenBox.appendChild(fenString);
captureDiv.parentNode.insertBefore(fenBox, captureDiv.nextSibling);
}
return true;
}
I've just noticed that the FEN does not update the move number, whose go it is and castling rights etc. - as these come from the last position reached on the game itself.
The analysis window turns off the logic to validate moves - you can move pieces around as you see fit - so the end portion of the FEN does not get updated.
With that in mind here's another version that has an incomplete FEN showing just the positional field.
---
// ==UserScript==
// @name RHP Analysis Board
// @namespace orangutan
// @description Adds updating FEN to the analysis board
// @include http://www.redhotpawn.com/gameanalysis/boardanalysis.php*
// @include http://www.chessatwork.com/gameanalysis/boardanalysis.php*
// @include http://www.timeforchess.com/gameanalysis/boardanalysis.php*
// @include http://www.redhotchess.com/gameanalysis/boardanalysis.php*
// @include http://www.playtheimmortalgame.com/gameanalysis/boardanalysis.php*
// ==/UserScript==
addFenBox();
document.addEventListener(
'click',
function (e) {
var fenHandle = document.getElementById('fenStr'😉;
if (fenHandle) {
var pieces = unsafeWindow.JSExp_GetFenFromBoardState(unsafeWindow.g_boardState).split(' '😉;
fenHandle.innerHTML = pieces[0];
}
}, false);
function addFenBox() {
var captureDiv = document.getElementById('capturedwhiteid'😉.parentNode.parentNode;
if (captureDiv) {
var fen = unsafeWindow.JSExp_GetFenFromBoardState(unsafeWindow.g_boardState).split(' '😉;
var fenString = document.createElement('div'😉;
fenString.setAttribute('id', 'fenStr'😉;
fenString.setAttribute('style', 'border: none; width: 100%;'😉;
fenString.innerHTML = fen[0];
var fenBox = document.createElement('div'😉;
fenBox.setAttribute('class', 'consolecontent'😉;
fenBox.setAttribute('id', 'fenBox'😉;
fenBox.appendChild(fenString);
captureDiv.parentNode.insertBefore(fenBox, captureDiv.nextSibling);
}
return true;
}
Originally posted by orangutanWow...thanks!
I've just noticed that the FEN does not update the move number, whose go it is and castling rights etc. - as these come from the last position reached on the game itself.
The analysis window turns off the logic to validate moves - you can move pieces around as you see fit - so the end portion of the FEN does not get updated.
With that in mind here's ...[text shortened]... e(fenBox, captureDiv.nextSibling);
}
return true;
}