Skip to content

Commit

Permalink
Update uncompressed JS.
Browse files Browse the repository at this point in the history
Result of #51.
  • Loading branch information
flibbertigibbet committed Jun 7, 2016
1 parent 43b4d98 commit a4ed5e2
Showing 1 changed file with 98 additions and 2 deletions.
100 changes: 98 additions & 2 deletions vendor/assets/javascripts/cartodb.uncompressed.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// cartodb.js version: 3.15.9
// uncompressed version: cartodb.uncompressed.js
// sha: 5bee7c8c6c6b2a62ec29c598f9c4331a9cb831fb
// sha: 3415ddd07ee8b6c04237025cc8a1d164192ae5a8
(function() {
var define; // Undefine define (require.js), see https://github.com/CartoDB/cartodb.js/issues/543
var root = this;
Expand Down Expand Up @@ -30984,9 +30984,36 @@ cdb.geo.ui.Header = cdb.core.View.extend({

className: 'cartodb-header',

defaults: {
style: {
textAlign: "left",
zIndex: 4,
color: "#ffffff",
fontSize: "20",
fontFamilyName: "Helvetica",
boxColor: 'rgba(0,0,0,0.5)',
boxOpacity: 0.7,
boxPadding: 10
}
},

initialize: function() {
var extra = this.model.get("extra");

this._cleanStyleProperties(this.options.style);

if (this.model.get("description")) {
this.defaults.style.fontSize = "12";
}

_.defaults(this.options.style, this.defaults.style);

this.style = new cdb.core.Model(this.options.style);

this.style.on("change", this._applyStyle, this);

this.add_related_model(this.style);

this.model.set({
title: extra.title,
description: extra.description,
Expand All @@ -31007,6 +31034,68 @@ cdb.geo.ui.Header = cdb.core.View.extend({
}
},

_getStandardPropertyName: function(name) {
if (!name) {
return;
}

var parts = name.split("-");

if (parts.length === 1) {
return name;
} else {
return parts[0] + _.map(parts.slice(1), function(l) {
return l.slice(0,1).toUpperCase() + l.slice(1);
}).join("");
}
},

_cleanStyleProperties: function(hash) {

var standardProperties = {};

_.each(hash, function(value, key) {
standardProperties[this._getStandardPropertyName(key)] = value;
}, this);

this.options.style = standardProperties;

},

_getRGBA: function(color, opacity) {
return 'rgba(' + parseInt(color.slice(-6,-4),16) + ',' + parseInt(color.slice(-4,-2),16) +
',' + parseInt(color.slice(-2),16) + ',' + opacity + ' )';
},

_applyStyle: function() {

var textColor = this.style.get("color");
var textAlign = this.style.get("textAlign");
var boxColor = this.style.get("boxColor");
var boxOpacity = this.style.get("boxOpacity");
var boxPadding = this.style.get("boxPadding");
var lineWidth = this.style.get("lineWidth");
var lineColor = this.style.get("lineColor");
var fontFamily = this.style.get("fontFamilyName");

this.$content = this.$el.find(".content");

if (this.model.get("description")) {
this.$text = this.$el.find(".description");
} else {
this.$text = this.$el.find(".title");
}

this.$content.css("padding", boxPadding);
this.$text.css("font-size", this.style.get("fontSize") + "px");
this.$el.css("z-index", this.style.get("zIndex"));
this.$text.css('font-family', fontFamily);
this.$content.css('text-align', textAlign);
$(".cartodb-header").css("background-color", "transparent");
this.$content.css("background-color", this._getRGBA(boxColor, boxOpacity));
this.$text.css("color", this._getRGBA(textColor, 1));
},

// Add target attribute to all links
_setLinksTarget: function(str) {
if (!str) return str;
Expand Down Expand Up @@ -31035,8 +31124,14 @@ cdb.geo.ui.Header = cdb.core.View.extend({
this.hide();
}

return this;
var self = this;
// Delay applying styles to prevent rendering issues with other elements;
// annotations also do this.
setTimeout(function() {
self._applyStyle();
}, 500);

return this;
}

});
Expand Down Expand Up @@ -40702,6 +40797,7 @@ cdb.vis.Overlay.register('header', function(data, vis) {
model: new cdb.core.Model(options),
transitions: data.transitions,
slides: vis.slides,
style: options.style,
template: template
});

Expand Down

0 comments on commit a4ed5e2

Please sign in to comment.