Cloud of
";
var slidesDiv = $('gallery-stats');
var lastDiv = $xp('//div[@id="gallery-stats"]/div[@style="clear: both;"]');
slidesDiv.insertBefore(cloudsDiv, lastDiv);
$('__raindrop-select').addEventListener('change', function(e){
renderDeviationCloud(e.target.value);
}, false);
renderDeviationCloud($('__raindrop-select').value);
}
function renderDeviationCloud(property){
var devs = unsafeWindow.GalleryFeed.deviations
var min, max, fix = null;
var code = '';
var impactElements;
if (property.indexOf("impact") != -1){
impactElements = property.split('-');
}
for(var i = 0; i < devs.length; i++){
if (devs[i]["category"] != "Scraps"){
var value = impactElements? getImpact(i, impactElements[1]) : devs[i][property];
max = (value > max || max == null)? value : max;
min = (value < min || min == null)? value : min;
}
}
var fix = max - min == 0? 1 : max - min;
for(var i = 0; i < devs.length; i++){
if (devs[i]["category"] != "Scraps"){
var value = impactElements? getImpact(i, impactElements[1]) : devs[i][property];
var ratio = (1 - (max - value) / fix);
var fontSize = confMinFontSize + (ratio * (confMaxFontSize - confMinFontSize)) ;
if (impactElements){
value = "~ " + (value * 100).toFixed() + "%";
}
code += "