новые иконки в OpenBoard
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
OpenBoard/resources/library/interactive/barre_prof.wgt/scripts/tpl.js

41 lines
709 B

function Tpl( obj )
{
var templates = {};
this.load = function( obj )
{
templates = obj;
};
this.get = function( name )
{
return templates[name];
};
this.getParsed = function( name, obj )
{
var s = templates[name];
for( var i in obj ){
s = s.replaceAll( "{"+i+"}", obj[i] );
}
return s;
};
this.getParsedMulti = function( nao ) // nao = names and objects array
{
var html = "";
for( var i = 0; i < nao.length; i++ )
{
if( nao[i].length > 1 ){
html += this.getParsed( nao[i][0], nao[i][1] );
}
else{
html += this.get( nao[i][0] );
}
}
return html;
};
if( arguments.length > 0 ){
this.load( obj );
}
}