Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit bb6ded8

Browse files
committed
Remove remaining use of template function
1 parent df1a353 commit bb6ded8

File tree

2 files changed

+4
-42
lines changed

2 files changed

+4
-42
lines changed

Diff for: index.html

+4-5
Original file line numberDiff line numberDiff line change
@@ -210,16 +210,15 @@ <h3>Help us improve HTML5 test by donating</h3>
210210
finalizePage();
211211
});
212212

213-
213+
214214
function showResults(r, c, m) {
215215
/* Update total score */
216216
var container = document.getElementById('score');
217217

218-
container.innerHTML = tim(
218+
container.innerHTML =
219219
"<div class='pointsPanel'>" +
220-
"<h2><span>Your browser scores</span> <strong>{{score}}</strong> <span>out of {{maximum}} points</span></h2>" +
221-
"</div>",
222-
c);
220+
"<h2><span>Your browser scores</span> <strong>" + c.score + "</strong> <span>out of " + c.maximum + " points</span></h2>" +
221+
"</div>";
223222

224223
/* Show box for confirming useragent detection */
225224
new Confirm(container, {

Diff for: scripts/base.js

-37
Original file line numberDiff line numberDiff line change
@@ -215,43 +215,6 @@
215215
alert('Could not submit results: ' + e.message);
216216
}
217217
}
218-
219-
var tim = (function(){
220-
var starts = "\\{\\{",
221-
ends = "\\}\\}",
222-
path = "[a-z0-9_][\\.a-z0-9_]*", // e.g. config.person.name
223-
pattern = new RegExp(starts + "("+ path +")" + ends, "gim"),
224-
undef;
225-
226-
return function(template, data, notFound){
227-
// Merge the data into the template string
228-
return template.replace(pattern, function(tag, ref){
229-
var path = ref.split("."),
230-
len = path.length,
231-
lookup = data,
232-
i = 0;
233-
234-
for (; i < len; i++){
235-
lookup = lookup[path[i]];
236-
237-
// Error handling for when the property is not found
238-
if (lookup === undef){
239-
// If specified, substitute with the "not found" arg
240-
if (notFound !== undef){
241-
return notFound;
242-
}
243-
// Throw error
244-
throw "Tim: '" + path[i] + "' not found in " + tag;
245-
}
246-
247-
// Success! Return the required value
248-
if (i === len - 1){
249-
return lookup;
250-
}
251-
}
252-
});
253-
};
254-
}());
255218

256219
function escapeSlashes(string) {
257220
return string.replace(/\\/g, '\\\\').

0 commit comments

Comments
 (0)