Last active
February 19, 2016 10:18
-
-
Save fraszczakszymon/5330782db874bb17aaac to your computer and use it in GitHub Desktop.
Flite component: Wikia skin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object({ | |
name: 'Wikia skin', | |
rectangle: null, | |
api: null, | |
spinner: null, | |
config: null, | |
assetUrl: null, | |
flite: { | |
initialize: function (resources) { | |
this.api = resources.api; | |
this.config = resources.config; | |
this.loadCustomAd = this.api.window && this.api.window.top && this.api.window.top.loadCustomAd; | |
// Component parameters | |
this.destinationUrl = this.config.getValue('destination_url'); | |
this.skinImage = this.config.getValue('skin_image'); | |
this.backgroundColor = (this.config.getValue('background_color') || '').replace('#', ''); | |
this.middleColor = (this.config.getValue('middle_color') || '').replace('#', ''); | |
// Preload image | |
var image = new Image(); | |
image.src = this.skinImage; | |
image.onload = function () { | |
var div = this.api.dom.getElement('div'); | |
div.css('backgroundImage', 'url("' + this.skinImage + '")'); | |
div.width(0); | |
div.height(0); | |
this.addChild(div); | |
}.bind(this); | |
}, | |
show: function () { | |
this.loadCustomAd && this.loadCustomAd({ | |
type: 'skin', | |
destUrl: this.destinationUrl, | |
skinImage: this.skinImage, | |
backgroundColor: this.backgroundColor, | |
middleColor: this.middleColor, | |
ten64: true | |
}); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment