19 lines
472 B
JavaScript
19 lines
472 B
JavaScript
/**
|
|
* Common utility functions.
|
|
*/
|
|
(function(context,$) {
|
|
context.JK = context.JK || {};
|
|
|
|
// Uber-simple templating
|
|
// var template = "Hey {name}";
|
|
// var vals = { name: "Jon" };
|
|
// _fillTemplate(template, vals);
|
|
// --> "Hey Jon"
|
|
context.JK.fillTemplate = function(template, vals) {
|
|
for(var val in vals)
|
|
template=template.replace(new RegExp('{'+val+'}','g'), vals[val]);
|
|
return template;
|
|
};
|
|
|
|
|
|
})(window,jQuery); |