An editor and viewer for Portable Tak Notation
This is an editor and viewer for Portable Tak Notation (PTN). It aims to be...
yarn
pushd functions && npm install && popd
yarn dev
yarn emulate
yarn lint
yarn build
PTN Ninja can send and receive messages with its opening or parent window using Window.postMessage()
. These messages are objects containing an action
, as well as a value
where applicable.
For example:
{
action: "SET_UI",
value: {
showRoads: true
}
}
SET_NAME
(value: <String>
)SET_UI
(value: <Object>
)TOGGLE_UI
(value: <String>
)SET_CURRENT_PTN
(value: <String>
)DELETE_PLY
(value: <Number>
)INSERT_PLY
(value: <String>
)Sb4
)INSERT_PLIES
(value: <Object>: { plies, prev }
)plies
specified as strings in PTN (e.g. ['d5', 'e4']
, or d5 e4
) and go backward prev
pliesDELETE_BRANCH
(value: <String>
)GO_TO_PLY
(value: <Object>: { plyID, isDone }
)PLAY
PAUSE
PLAY_PAUSE
PREV
NEXT
FIRST
LAST
UNDO
REDO
PROMOTE_BRANCH
(value: <String>
)MAKE_BRANCH_MAIN
(value: <String>
)RENAME_BRANCH
(value: <Object>: { oldName, newName }
)TOGGLE_EVALUATION
(value: <Object>: { type, double }
)EDIT_NOTE
(value: <Object>: { plyID, index, message }
)ADD_NOTE
(value: <Object>: { message, plyID }
)ADD_NOTES
(value: <Object>: { [plyID]: Array(messages) }
)REMOVE_NOTE
(value: <Object>: { plyID, index }
)TRIM_BRANCHES
TRIM_TO_BOARD
TRIM_TO_PLY
CANCEL_MOVE
NOTIFY
(value: <Object>
)NOTIFY_ERROR
(value: <Object>
)NOTIFY_SUCCESS
(value: <Object>
)NOTIFY_WARNING
(value: <Object>
)NOTIFY_HINT
(value: <Object>
)ROTATE_180
ROTATE_LEFT
ROTATE_RIGHT
FLIP_HORIZONTAL
FLIP_VERTICAL
RESET_TRANSFORM
APPLY_TRANSFORM
(value: <Array>: [ int a, int b ]
)[int a, int b]
where a
is the number of clockwise rotations [0, 3], and b
is the number of horizontal flips [0, 1].HIGHLIGHT_SQUARES
(value: <Array>: [ <String> ]
)PTN Ninja uses lz-string to encode PTN and some other parameters for use in the URL. However, it will also do its best to read these parameters when passed as plaintext.
The structure of the URL is as follows:
https://ptn.ninja/<PTN>&<param1>=<value1>&<param2>=<value2>[...]
name
ply
!
means plyIsDone == true
targetBranch
theme
axisLabels
(default: true
)flatCounts
(default: true
)stackCounts
(default: true
)turnIndicator
(default: true
)highlightSquares
(default: true
)playSpeed
(default: 60
)showAllBranches
(default: false
)showControls
(default: true
)showMove
(default: true
)showPTN
(default: true
)showRoads
(default: true
)showScrubber
(default: true
)showText
(default: true
)unplayedPieces
(default: true
)© 2022 Craig Laparo
This work is licensed under a GNU AGPLv3 License.