User:Jgirault/Kartodeveloper/helpers/HTML.js

(function ( mw, $ ) {

mw.Kartodeveloper.helpers.HTML = (function {

var Html = { createMapCard: function ( style ) { var computed;

style = style || {}; style.borderWidth = style.borderWidth || '1px'; style.padding = style.padding || '.5em 1em'; style.margin = style.margin || '.5em 1em'; style.float = style.float || 'none'; style.display = style.display || 'inline-block';

computed = [ 'border: ' + style.borderWidth + ' solid #c8ccd1', 'border-radius: 2px', 'padding: ' + style.padding, 'margin: ' + style.margin, 'float: ' + style.float, 'display: ' + style.display ];

return $( mw.html.element( 'div', { class: 'wd-map-card', style: computed.join( '; ' ) } ) );			},

createMapContainer: function ( options ) { var computed;

options = options || {};

options.className = [ 'wd-map' ].concat( [ options.className || '' ] ).join( ' ' ); options.width = options.width || '336px'; options.height = options.height || '448px';

computed = [ 'width: ' + options.width, 'max-width: ' + options.width, 'height: ' + options.height, 'max-height: ' + options.height ];

return $( mw.html.element( 'div', { class: options.className, style: computed.join( '; ' ) } ) );			}		};

return Html;

});

})( mediaWiki, jQuery );