מדיה ויקי:Gadget-pgnviewer.js: הבדלים בין גרסאות בדף

וגם
מ 85 גרסאות של הדף wikipedia:he:מדיה_ויקי:Gadget-pgnviewer.js יובאו
 
(10 גרסאות ביניים של 2 משתמשים אינן מוצגות)
שורה 42: שורה 42:
mw = window.mw,
mw = window.mw,
$ = window.$,
$ = window.$,
domParser = new DOMParser(),
mobile = mw.config.get('skin') === 'minerva';
mobile = mw.config.get('skin') === 'minerva';
שורה 86: שורה 87:
},
},
setVisible: function( visible ) {
setVisible: function( visible ) {
this.elem.toggle( visible );
this.elem.toggle( !! visible );
},
},
elem: $( '<div>' )
elem: $( '<div>' )
שורה 147: שורה 148:
game.analyzePgn();
game.analyzePgn();
this.currentGame = game;
this.currentGame = game;
this.ccButton.setVisible( game.comments.length );
this.ccButton.setVisible( game.hasComments() );
game.show();
game.show();
}
}
שורה 334: שורה 335:
var desc = $.extend({}, this.descriptions),
var desc = $.extend({}, this.descriptions),
rtl = desc['Direction'] == 'rtl',
rtl = desc['Direction'] == 'rtl',
num = '',
gs = this.gs;
gs = this.gs;
   
   
שורה 345: שורה 345:
.empty()
.empty()
.css( { direction: rtl ? 'rtl' : 'ltr', textAlign: rtl ? 'right' : 'left' } );
.css( { direction: rtl ? 'rtl' : 'ltr', textAlign: rtl ? 'right' : 'left' } );
$.each(desc, function(key, val) { gs.descriptionsDiv.append(key + ': ' + val + '<br />'); });
$.each(desc, function(key, val) {  
var line = mw.html.escape(key + ': ' + val)  + '<br />';
gs.descriptionsDiv.append(line);  
} );
   
   
// setup pgn section
// setup pgn section
שורה 559: שורה 562:
Game.prototype.description = function() {
Game.prototype.description = function() {
var d = this.descriptions,
var d = this.descriptions,
round = d['Round'] ? ' (' + d['Round'] + ')' : '',
event = d['Event'] || d['אירוע'],
s = d['Name'] ||  
round =  d['Round'] ||  d['סיבוב'],
d['שם'] || (
white = d['White'] || d['לבן'],
( d['Event'] || d['אירוע'] || '' ) + ': ' +
black = d['Black'] || d['שחור'],
( d['White'] || d['לבן'] || '' ) + ' - ' +
name = d['Name'] || d['שם'];
( d['Black'] || d['שחור'] || '' ) + round
return name
);
|| ( event ? event + ': ' : '')
return s;
+ (white ? white : '')
+ (white || black ? ' – ' : '')
+ (black ? black : '')
+ (round ? ' (' + round + ')' : '');
}
}
    
    
שורה 674: שורה 680:
}
}
function selectGame() {
Game.prototype.hasComments = function() {
var gameSet = $(this).data('gameSet');
var hasComment = function( n ){ return n.hasClass( 'pgn-comment' ); };
gameSet.selectGame(this.value);
return !! this.notations.filter( hasComment ).length;
}
}


שורה 778: שורה 784:
container
container
.append( selector || '' )
.append( selector || '' )
.append(gameSet.boardDiv)
.append($('<div>')
.append( gameSet.tabberDiv )
.append(gameSet.boardDiv)
.append(controlsDiv);
.append( gameSet.tabberDiv )
.append(controlsDiv)
);
}
}
   
   
שורה 830: שורה 838:
doIt();
doIt();
else
else
mw.loader.using( 'jquery.ui.tabs' ).done( doIt );
mw.loader.using( 'jquery.ui' ).done( doIt );
}
}
});
});