מדיה ויקי:Gadget-pgnviewer.js: הבדלים בין גרסאות בדף
יותר מדויק |
מ 85 גרסאות של הדף wikipedia:he:מדיה_ויקי:Gadget-pgnviewer.js יובאו |
||
| (8 גרסאות ביניים של 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>' ) | ||
| שורה 145: | שורה 146: | ||
var game = this.allGames[val]; | var game = this.allGames[val]; | ||
if (game) { | if (game) { | ||
game.analyzePgn(); | game.analyzePgn(); | ||
this.currentGame = game; | this.currentGame = game; | ||
this.ccButton.setVisible( hasComments ); | this.ccButton.setVisible( game.hasComments() ); | ||
game.show(); | game.show(); | ||
} | } | ||
| שורה 336: | שורה 335: | ||
var desc = $.extend({}, this.descriptions), | var desc = $.extend({}, this.descriptions), | ||
rtl = desc['Direction'] == 'rtl', | rtl = desc['Direction'] == 'rtl', | ||
gs = this.gs; | gs = this.gs; | ||
| שורה 347: | שורה 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) { | $.each(desc, function(key, val) { | ||
var line = mw.html.escape(key + ': ' + val) + '<br />'; | |||
gs.descriptionsDiv.append(line); | |||
} ); | |||
// setup pgn section | // setup pgn section | ||
| שורה 561: | שורה 562: | ||
Game.prototype.description = function() { | Game.prototype.description = function() { | ||
var d = this.descriptions, | var d = this.descriptions, | ||
event = d['Event'] || d['אירוע'], | |||
round = d['Round'] || d['סיבוב'], | |||
white = d['White'] || d['לבן'], | |||
black = d['Black'] || d['שחור'], | |||
( | name = d['Name'] || d['שם']; | ||
( | return name | ||
|| ( event ? event + ': ' : '') | |||
+ (white ? white : '') | |||
+ (white || black ? ' – ' : '') | |||
+ (black ? black : '') | |||
+ (round ? ' (' + round + ')' : ''); | |||
} | } | ||
| שורה 676: | שורה 680: | ||
} | } | ||
function | Game.prototype.hasComments = function() { | ||
var | var hasComment = function( n ){ return n.hasClass( 'pgn-comment' ); }; | ||
return !! this.notations.filter( hasComment ).length; | |||
} | } | ||
| שורה 834: | שורה 838: | ||
doIt(); | doIt(); | ||
else | else | ||
mw.loader.using( 'jquery.ui | mw.loader.using( 'jquery.ui' ).done( doIt ); | ||
} | } | ||
}); | }); | ||