vendor/ember-leaflet-cartodb/cartodb_noleaflet.js
function() {

    if (!this._containsCover()) return;

    var self = this;
    var $cover = this.$(".cover");
    var $img = $cover.find("img");
    var $shadow = this.$(".shadow");
    var url = this._getCoverURL();

    if (!this._isValidURL(url)) {
      $img.hide();
      $shadow.hide();
      cdb.log.info("Header image url not valid");
      return;
    }

    // configure spinner
    var target  = document.getElementById('spinner');
    var opts    = { lines: 9, length: 4, width: 2, radius: 4, corners: 1, rotate: 0, color: '#ccc', speed: 1, trail: 60, shadow: true, hwaccel: false, zIndex: 2e9 };
    var spinner = new Spinner(opts).spin(target);

    // create the image

    $img.hide(function() {
      this.remove();
    });

    $img = $("<img />").attr("src", url);
    $cover.append($img);

    $img.load(function(){
      spinner.stop();

      var w  = $img.width();
      var h  = $img.height();
      var coverWidth = $cover.width();
      var coverHeight = $cover.height();

      var ratio = h / w;
      var coverRatio = coverHeight / coverWidth;

      // Resize rules
      if ( w > coverWidth && h > coverHeight) { // bigger image
        if ( ratio < coverRatio ) $img.css({ height: coverHeight });
        else {
          var calculatedHeight = h / (w / coverWidth);
          $img.css({ width: coverWidth, top: "50%", position: "absolute", "margin-top": -1*parseInt(calculatedHeight, 10)/2 });
        }
      } else {
        var calculatedHeight = h / (w / coverWidth);
        $img.css({ width: coverWidth, top: "50%", position: "absolute", "margin-top": -1*parseInt(calculatedHeight, 10)/2 });
      }

      $img.fadeIn(300);
    })
    .error(function(){
      spinner.stop();
    });
  }
function() {

    if (!this._containsCover()) return;

    var self = this;
    var $cover = this.$(".cover");
    var $img = $cover.find("img");
    var $shadow = this.$(".shadow");
    var url = this._getCoverURL();

    if (!this._isValidURL(url)) {
      $img.hide();
      $shadow.hide();
      cdb.log.info("Header image url not valid");
      return;
    }

    // configure spinner
    var target  = document.getElementById('spinner');
    var opts    = { lines: 9, length: 4, width: 2, radius: 4, corners: 1, rotate: 0, color: '#ccc', speed: 1, trail: 60, shadow: true, hwaccel: false, zIndex: 2e9 };
    var spinner = new Spinner(opts).spin(target);

    // create the image

    $img.hide(function() {
      this.remove();
    });

    $img = $("<img />").attr("src", url);
    $cover.append($img);

    $img.load(function(){
      spinner.stop();

      var w  = $img.width();
      var h  = $img.height();
      var coverWidth = $cover.width();
      var coverHeight = $cover.height();

      var ratio = h / w;
      var coverRatio = coverHeight / coverWidth;

      // Resize rules
      if ( w > coverWidth && h > coverHeight) { // bigger image
        if ( ratio < coverRatio ) $img.css({ height: coverHeight });
        else {
          var calculatedHeight = h / (w / coverWidth);
          $img.css({ width: coverWidth, top: "50%", position: "absolute", "margin-top": -1*parseInt(calculatedHeight, 10)/2 });
        }
      } else {
        var calculatedHeight = h / (w / coverWidth);
        $img.css({ width: coverWidth, top: "50%", position: "absolute", "margin-top": -1*parseInt(calculatedHeight, 10)/2 });
      }

      $img.fadeIn(300);
    })
    .error(function(){
      spinner.stop();
    });
  }
function ( ) { if ( ! this . _containsCover ( ) ) return ; var self = this ; var $cover = this . $ ( ".cover" ) ; var $img = $cover . find ( "img" ) ; var $shadow = this . $ ( ".shadow" ) ; var url = this . _getCoverURL ( ) ; if ( ! this . _isValidURL ( url ) ) { $img . hide ( ) ; $shadow . hide ( ) ; cdb . log . info ( "Header image url not valid" ) ; return ; } // configure spinner var target = document . getElementById ( 'spinner' ) ; var opts = { lines : 9 , length : 4 , width : 2 , radius : 4 , corners : 1 , rotate : 0 , color : '#ccc' , speed : 1 , trail : 60 , shadow : true , hwaccel : false , zIndex : 2e9 } ; var spinner = new Spinner ( opts ) . spin ( target ) ; // create the image $img . hide ( function ( ) { this . remove ( ) ; } ) ; $img = $ ( "<img />" ) . attr ( "src" , url ) ; $cover . append ( $img ) ; $img . load ( function ( ) { spinner . stop ( ) ; var w = $img . width ( ) ; var h = $img . height ( ) ; var coverWidth = $cover . width ( ) ; var coverHeight = $cover . height ( ) ; var ratio = h / w ; var coverRatio = coverHeight / coverWidth ; // Resize rules if ( w > coverWidth && h > coverHeight ) { // bigger image if ( ratio < coverRatio ) $img . css ( { height : coverHeight } ) ; else { var calculatedHeight = h / ( w / coverWidth ) ; $img . css ( { width : coverWidth , top : "50%" , position : "absolute" , "margin-top" : - 1 * parseInt ( calculatedHeight , 10 ) / 2 } ) ; } } else { var calculatedHeight = h / ( w / coverWidth ) ; $img . css ( { width : coverWidth , top : "50%" , position : "absolute" , "margin-top" : - 1 * parseInt ( calculatedHeight , 10 ) / 2 } ) ; } $img . fadeIn ( 300 ) ; } ) . error ( function ( ) { spinner . stop ( ) ; } ) ; }
Attempts to load the cover URL and show it
Attempts to load the cover URL and show it