מדיה ויקי:Gadget-pgnviewer.js: הבדלים בין גרסאות בדף
יותר מדויק |
ניסוי - שום שינוי ממשי, ניטפוקי קוד. |
||
| שורה 70: | שורה 70: | ||
} | } | ||
function Button( className, action, stateful) { | function Button( className, action, stateful ) { | ||
var button = this; | var button = this; | ||
$.extend( button, { | $.extend( button, { | ||
| שורה 104: | שורה 104: | ||
showDetails:false, | showDetails:false, | ||
timer: null, | timer: null, | ||
autoPlayDelay: 750, | |||
// actions | |||
faster: function() { | faster: function() { | ||
gameSet.autoPlayDelay -= 500; | gameSet.autoPlayDelay -= 500; | ||
| שורה 113: | שורה 115: | ||
gameSet.reportDelay(); | gameSet.reportDelay(); | ||
}, | }, | ||
reportDelay: function() { | reportDelay: function() { | ||
gameSet.toggleAutoPlay(); // no param means keep state, but use new delay | gameSet.toggleAutoPlay(); // no param means keep state, but use new delay | ||
| שורה 133: | שורה 127: | ||
left: function(file, l) { return (((this.flipButton.state ? 7 - file : file) + (l ? 0.5 : 0)) * this.blockSize + (l? boardPadding-6: boardPadding)) + 'px'; }, | left: function(file, l) { return (((this.flipButton.state ? 7 - file : file) + (l ? 0.5 : 0)) * this.blockSize + (l? boardPadding-6: boardPadding)) + 'px'; }, | ||
legendLocation: function(side, num) { | legendLocation: function(side, num) { | ||
switch (side) { | switch (side) { | ||
case 'n': | case 'n': return {top: 0, left: this.left(num, true)}; | ||
case 'e': return {top: this.top(num, true), left: this.blockSize * 8 + boardPadding + 5}; | |||
case 'e': | case 's': return {top: this.blockSize * 8 + 20, left: this.left(num, true)}; | ||
case 'w': return {top: this.top(num, true), left: 5}; | |||
case 's': | |||
case 'w': | |||
} | } | ||
}, | }, | ||
| שורה 199: | שורה 188: | ||
stopAutoPlay: function() { | stopAutoPlay: function() { | ||
gameSet.autoPlayButton.setState( false ); | gameSet.autoPlayButton.setState( false ); | ||
} | }, | ||
// bottons | |||
flipButton: new Button( flipBoardButtonClass, gameSet.doFlip, true ), | |||
slowerButton: new Button( slowerButtonClass, gameSet.slower ), | |||
fasterButton: new Button( fasterButtonClass, gameSet.faster ), | |||
autoPlayButton: new Button( playButtonClass, gameSet.toggleAutoPlay, true ), | |||
commentsToggleButton: new Button( ccButtonClass, gameSet.hideComments, true ) | |||
}); | }); | ||
} | } | ||
| שורה 581: | שורה 578: | ||
var d = this.descriptions, | var d = this.descriptions, | ||
round = d['Round'] ? ' (' + d['Round'] + ')' : '', | round = d['Round'] ? ' (' + d['Round'] + ')' : '', | ||
s = d['Name'] | s = d['Name'] || | ||
d['שם'] || ( | |||
( d['Event'] || d['אירוע'] || '' ) + ': ' + | |||
( d['White'] || d['לבן'] || '' ) + ' - ' + | |||
( d['Black'] || d['שחור'] || '' ) + round | |||
); | |||
return s; | return s; | ||
} | } | ||
Game.prototype.preAnalyzePgn = function(pgn) { | Game.prototype.preAnalyzePgn = function(pgn) { | ||
function tryMatch(regex) { | function tryMatch(regex) { | ||
| שורה 725: | שורה 725: | ||
gameSet.currentGame.drawBoard( 0 ); | gameSet.currentGame.drawBoard( 0 ); | ||
} ), | } ), | ||
tabnames = $.extend( { | tabnames = $.extend( { | ||
notation: 'Game Notation', | notation: 'Game Notation', | ||
| שורה 805: | שורה 804: | ||
container | container | ||
.append( selector || '' ) | .append( selector || '' ) | ||
.append(gameSet.boardDiv) | |||
.append( gameSet.tabberDiv ) | |||
.append(controlsDiv); | |||
} | } | ||