מדיה ויקי: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();  
},
},
flipButton: new Button( flipBoardButtonClass, function( state ) {
gameSet.doFlip( state );
}, true ),
slowerButton:  new Button( slowerButtonClass, function() { gameSet.slower(); } ),
autoPlayButton: new Button( playButtonClass, function( state ) { gameSet.toggleAutoPlay( state ); }, true ),
fasterButton:  new Button( fasterButtonClass, function() { gameSet.faster(); } ),
commentsToggleButton: new Button( ccButtonClass, function( state ) { gameSet.hideComments( state ) }, true ),
autoPlayDelay: 750,
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) {
var n = 0.5 + num;
switch (side) {  
switch (side) {  
case 'n':
case 'n': return {top: 0, left: this.left(num, true)};
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)};
return {top: this.top(num, true), left: this.blockSize * 8 + boardPadding + 5};
case 'w': return {top: this.top(num, true), left: 5};
case 's':
return {top: this.blockSize * 8 + 20, left: this.left(num, true)};
case 'w':
return {top: this.top(num, true), left: 5};
}
}
},
},
שורה 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['שם'] || (  
|| ( (d['Event'] || d['אירוע'] || '') + ': ' + (d['White'] || d['לבן'] || '') + ' - ' + (d['Black'] || d['שחור'] || '') + round);
( 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 );
} ),
} ),
collapsibleDiv = $( '<div>' ),  // residue. to be renamed or remove
tabnames = $.extend( {
tabnames = $.extend( {
notation: 'Game Notation',
notation: 'Game Notation',
שורה 805: שורה 804:
container
container
.append( selector || '' )
.append( selector || '' )
.append( collapsibleDiv
.append(gameSet.boardDiv)
.append(gameSet.boardDiv)
.append( gameSet.tabberDiv )
.append( gameSet.tabberDiv )
.append(controlsDiv);
.append(controlsDiv)
);
}
}