text: var saveData = (function () {
      var a = document.createElement("a");
      document.body.appendChild(a);
      a.style = "display: none";
      return function (data, fileName) {
          var blob = new Blob(['\ufeff' + ls.getItem(code + "_text")], {type: 'text/plain;charset = utf-8'}),
              url = window.URL.createObjectURL(blob);
          a.href = url;
          a.download = fileName;
          a.click();
          window.URL.revokeObjectURL(url);
      };
  }());
  
  var date = new Date();
  var day = ((date.getDate() > 9) ? date.getDate() : ('0' + date.getDate()));
  var month = ((date.getMonth() > 8) ? (date.getMonth() + 1) : ('0' + (date.getMonth() + 1)));
  var dateStr = day + '-' + month + '-' +   date.getFullYear();
  var timeStr = date.toLocaleTimeString().replace(/([\d]+:[\d]{2})(:[\d]{2})(.*)/, "$1$3").replace(":", "-");
  saveData(ls.getItem(code + "_text"), "attendance " + dateStr + " " + timeStr + ".csv");
  