Banner.prototype._createNodes = function()

in static/js/com/banners-rotator.js [88:131]


Banner.prototype._createNodes = function () {
  var banner = this,
    nodes;

  var nodesClasses = {
    container: [
      'jb-promotion',
      'jb-' + banner.type + '-promotion',
      'id_' + banner.id,
      banner.type === Banner.TYPE.slideup ? 'is_hidden' : ''
    ],
    body: [
      'jb-promotion__body',
      'jb-' + banner.type + '-promotion__body'
    ],
    closeButton: [
      'jb-promotion__close-button',
      'jb-' + banner.type + '-promotion__close-button'
    ],
    link: [
      'jb-promotion__link',
      'jb-' + banner.type + '-promotion__link'
    ]
  };

  nodes = {
    container: $('<div class="' + nodesClasses.container.join(' ') + '"></div>'),
    body: $('<div class="' + nodesClasses.body.join(' ') + '"></div>'),
    link: banner.url ? $('<a href="' + banner.url + '" class="' + nodesClasses.link.join(' ') + '" target="' + banner.target + '"></a>') : '',
    closeButton: $('<div class="' + nodesClasses.closeButton.join(' ') + '" title="Close"></div>')
  };

  nodes.body.css({
    width: banner.width,
    height: banner.height,
    backgroundImage: banner.imageUrl ? 'url("' + banner.imageUrl + '")' : 'none'
  });

  if (banner.url && banner.linkCss) nodes.link.css(banner.linkCss);
  if (banner.closeButtonCss) nodes.closeButton.css(banner.closeButtonCss);
  if (banner.template) nodes.body.html(banner.template);

  return nodes;
};