Skip to content

Instantly share code, notes, and snippets.

@thejambi
Last active January 5, 2021 00:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thejambi/2ba5fac1341c8b807f10939863b1300b to your computer and use it in GitHub Desktop.
Save thejambi/2ba5fac1341c8b807f10939863b1300b to your computer and use it in GitHub Desktop.
PlayTak.com current game to PTN Ninja Bookmarklet
javascript: (function () {
var p1 = $('.player1-name:first').html(); var p2 = $('.player2-name:first').html(); var now = new Date(); var dt = (now.getYear()-100)+'.'+(now.getMonth()+1)+'.'+now.getDate()+' '+now.getHours()+'.'+getZero(now.getMinutes()); $('#download_notation').attr('download', p1+' vs '+p2+' '+dt+'.ptn'); var res=''; res += getHeader('Site', 'PlayTak.com'); res += getHeader('Date', '20'+(now.getYear()-100)+'.'+(now.getMonth()+1)+'.'+now.getDate()); res += getHeader('Player1', p1); res += getHeader('Player2', p2); res += getHeader('Size', board.size); res += getHeader('Result', board.result); res += '\r\n'; var count=1; $('#moveslist tr').each(function() { $('td', this).each(function() { var val = $(this).text(); res += val; if(count%3 === 0) res += '\r\n'; else res += ' '; count++; }) });
window.open('http://ptn.ninja/' + encodeURIComponent(res),'_blank');
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment