diff -r b3cadad6ef14 -r eb4f89e2a001 2048.html
--- a/2048.html Sat Sep 20 01:16:14 2014 +0300
+++ b/2048.html Sat Sep 20 09:44:08 2014 +0300
@@ -66,7 +66,7 @@
left: 1em;
top: -1em;
}
- button#statistic {
+ button#statistic, button#statistic-clean {
display: inline-block;
float: left;
margin: 3px 4px;
@@ -276,6 +276,7 @@
times
limit to sec
+
score
turn
speed
@@ -295,6 +296,11 @@
// UI widgets.
ui.dom = {};
+ ui.dom.clearfix = function() {
+ var divDom = document.createElement('div');
+ divDom.classList.add("clearfix");
+ return divDom;
+ }
ui.dom.table = function(tbl, cols, cfg) {
var tableDom = document.createElement('table');
if (typeof cfg.tableClass === 'string')
@@ -888,10 +894,17 @@
reportDom.appendChild(tableDom);
reportsDom.insertBefore(reportDom, reportsDom.firstChild);
}
-
var statisticBtn = document.getElementById('statistic');
statisticBtn.addEventListener("click", ui.report.stat, false);
+ ui.report.statClean = function() {
+ while (reportsDom.hasChildNodes()) {
+ reportsDom.removeChild(reportsDom.lastChild);
+ }
+ reportsDom.appendChild(ui.dom.clearfix());
+ }
+ var statisticCleanBtn = document.getElementById('statistic-clean');
+ statisticCleanBtn.addEventListener("click", ui.report.statClean, false);
////////////////////////////////////////////////////////////////
// Initialise game.