מדיה ויקי:Gadget-pgnviewer.js: הבדלים בין גרסאות בדף
יותר מדויק |
ניסוי |
||
| שורה 15: | שורה 15: | ||
mw = window.mw, | mw = window.mw, | ||
brainDamage = /MSIE|Trident/.test( window.navigator.userAgent ), | brainDamage = /MSIE|Trident/.test( window.navigator.userAgent ), | ||
mobile = mw.config.get('skin') === 'minerva', | |||
images = {}, | images = {}, | ||
pieceImageUrl = {}, | pieceImageUrl = {}, | ||
| שורה 173: | שורה 174: | ||
widthPxPlus = widthPx + 40, | widthPxPlus = widthPx + 40, | ||
widthPxPlusPlus = widthPx + 80; | widthPxPlusPlus = widthPx + 80; | ||
this.tabberDiv // disgusting, but i could not get heightStyle of jquery tabs to do what i need. | if ( !mobile ) | ||
this.tabberDiv // disgusting, but i could not get heightStyle of jquery tabs to do what i need. | |||
.css( { height: widthPxPlus } ) | |||
.find( 'div' ).css( { height: widthPx - 20 } ); | |||
this.blockSize = width; | this.blockSize = width; | ||
this.boardImg.css({width: widthPx, height: widthPx}); | this.boardImg.css({width: widthPx, height: widthPx}); | ||
| שורה 733: | שורה 735: | ||
infoId = 'pgn-info-' + id, | infoId = 'pgn-info-' + id, | ||
fenId = 'pgn-fen-' + id, | fenId = 'pgn-fen-' + id, | ||
descriptionsDiv = $('<div>', {'class': 'pgn-descriptions', id: infoId }), | descriptionsDiv = $('<div>', {'class': 'pgn-descriptions', id: infoId }), | ||
controlsDiv, | controlsDiv, | ||
| שורה 759: | שורה 760: | ||
fen: 'FEN' }, | fen: 'FEN' }, | ||
config.tab_names ); | config.tab_names ); | ||
anim = config.anim || anim; | anim = config.anim || anim; | ||
if ( $( '#' + notationId ) ) notationId += '_1'; | |||
gameSet.pgnDiv = $('<div>', {'class': 'pgn-pgndiv', id: notationId } ); | |||
gameSet.blockSize = Math.max( minBlockSize, Math.min( maxBlockSize, config.squareSize || defaultBlockSize ) ); | gameSet.blockSize = Math.max( minBlockSize, Math.min( maxBlockSize, config.squareSize || defaultBlockSize ) ); | ||
gameSet.fenDiv = $('<div>', { id: fenId } ) | gameSet.fenDiv = $('<div>', { id: fenId } ) | ||
.css( { 'word-wrap': 'break-word' } ); | .css( { 'word-wrap': 'break-word' } ); | ||
gameSet.tabberDiv = $( '<div>', { 'class': 'pgn-tabber' } ) | if ( ! mobile ) { | ||
gameSet.tabberDiv = $( '<div>', { 'class': 'pgn-tabber' } ) | |||
.append($( '<ul>' ) | |||
.append( $( '<li>' ).append( $( '<a>', { href: '#' + notationId } ).text( tabnames.notation ) ) ) | |||
.append($('<li>').append($('<a>', { href: '#' + infoId }).text( tabnames.metadata ) ) ) | |||
.append($('<li>').append($('<a>', { href:'#' + fenId }).text( tabnames.fen ) ) ) | |||
) | |||
.append( gameSet.pgnDiv ) | |||
.append( descriptionsDiv ) | |||
.append( gameSet.fenDiv ) | |||
.tabs(); | |||
} | |||
controlsDiv = $('<div>', {'class': 'pgn-controls'}) | controlsDiv = $('<div>', {'class': 'pgn-controls'}) | ||
.css({clear: 'both', textAlign: 'center'}) | .css({clear: 'both', textAlign: 'center'}) | ||
| שורה 811: | שורה 817: | ||
.append( collapsibleDiv | .append( collapsibleDiv | ||
.append(gameSet.boardDiv) | .append(gameSet.boardDiv) | ||
.append(gameSet.tabberDiv) | .append( mobile ? gameSet.pgnDiv : gameSet.tabberDiv ) | ||
.append(controlsDiv) | .append(controlsDiv) | ||
); | ); | ||
| שורה 817: | שורה 823: | ||
collapser.click(); | collapser.click(); | ||
collapseSpeed = 1500; | collapseSpeed = 1500; | ||
return { boardDiv: gameSet.boardDiv, pgnDiv: pgnDiv, descriptionsDiv: descriptionsDiv }; | return { boardDiv: gameSet.boardDiv, pgnDiv: gameSet.pgnDiv, descriptionsDiv: descriptionsDiv }; | ||
} | } | ||
| שורה 904: | שורה 910: | ||
if ( $(wrapperSelector, $content).length) | if ( $(wrapperSelector, $content).length) | ||
mw.loader.using( | mw.loader.using( 'mediawiki.api').done( function() { | ||
if ( mobile ) | |||
mw.loader.using( 'jquery.ui.tabs' ).done( populateImages ); | |||
else | |||
populateImages(); | |||
} ); | |||
}); | }); | ||