Created
April 14, 2012 15:42
-
-
Save gmilby/2385296 to your computer and use it in GitHub Desktop.
BRANKO: amd - bad idea to sub-template....
This file contains 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
var t_stats = '<li class="bar {{this_color}}" style="height: {{css_px}}px;"><div class="top"></div><div class="bottom"></div><span>{{lang}}-{{lang_math}}%</span></li>'; | |
$frag = ''; | |
$.each( data, function( idx, obj ) { | |
$frag += | |
t_stats | |
//.replace( /{{this_idx}}/ig, idx+1 ) | |
.replace( /{{this_color}}/ig, 'red') //rand(root.bar_colors) ) | |
.replace( /{{lang}}/ig, obj.lang) | |
.replace( /{{css_px}}/ig, obj.css_px) | |
.replace( /{{lang_math}}/ig, obj.percent); | |
}); | |
frag = $frag.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); | |
$('body').append(template.render(tMain,{time: new Date(),stats:frag})); | |
console.log(frag); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment