Please turn on javascript in your browser to play chess.
Site Ideas Forum

Site Ideas Forum

  1. 30 Jan '08 08:55
    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.
  2. 31 Jan '08 21:30
    Originally posted by Mahout
    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.
    Try this -


    // ==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;
    }
  3. 31 Jan '08 23:10
    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;
    }
  4. Subscriber ouroboros
    Digital Alchemist
    01 Feb '08 05:23
    Thanks orangutan. I've posted your script at the bottom of:

    http://members.shaw.ca/ouroboros/RHP/

    And I've incorporated your code into my version of the analysis board script.
  5. 01 Feb '08 09:51
    Originally posted by ouroboros
    Thanks orangutan. I've posted your script at the bottom of:

    http://members.shaw.ca/ouroboros/RHP/

    And I've incorporated your code into my version of the analysis board script.
    Nice one.
  6. 02 Feb '08 01:39
    Originally posted by orangutan
    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;
    }
    Wow...thanks!
  7. 07 Feb '08 04:08
    Why would you want this?

    I had this on for a while, but noticed it slowed the screen load and since I never use the FEN for anything.. I turned it off again