|
|
@ -37,7 +37,7 @@ $(document).ready(function() {
|
|
|
|
|
|
|
|
|
|
|
|
var newHistory = '<div class="event-wrapper">';
|
|
|
|
var newHistory = '<div class="event-wrapper">';
|
|
|
|
for (var i = 0; i < eventHistory.length; i++) {
|
|
|
|
for (var i = 0; i < eventHistory.length; i++) {
|
|
|
|
var dateString = (new Date(eventHistory[i].time*1000)).toLocaleString();
|
|
|
|
var dateString = (new Date(eventHistory[i].time*1000)).toLocaleString('sv-SE');
|
|
|
|
var newElement = '<div class="event" card-id="' + eventHistory[i].cardID + '">\
|
|
|
|
var newElement = '<div class="event" card-id="' + eventHistory[i].cardID + '">\
|
|
|
|
<div class="time">' + dateString + '</div>\
|
|
|
|
<div class="time">' + dateString + '</div>\
|
|
|
|
<div class="name">';
|
|
|
|
<div class="name">';
|
|
|
@ -77,25 +77,42 @@ $(document).ready(function() {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$('.search-bar').on('keyup', function() {
|
|
|
|
$('.search-bar').on('keyup', function() {
|
|
|
|
var newHistory = '<div class="event-wrapper">';
|
|
|
|
var newHistory = '<div class="event-wrapper">';
|
|
|
|
for (var i = 0; i < eventHistory.length; i++) {
|
|
|
|
var args = $('.search-bar').val().split(' ');
|
|
|
|
var eventDate = new Date(eventHistory[i].time*1000);
|
|
|
|
var toMatch = [-1,-1,-1];
|
|
|
|
var mdy = $('.search-bar').val().split('/');
|
|
|
|
var nameToMatch = '';
|
|
|
|
var dateMatch = false;
|
|
|
|
for (var j = 0; j < args.length; j++) {
|
|
|
|
switch(mdy.length) {
|
|
|
|
if(args[j].charAt(0) == '-') {
|
|
|
|
case 1:
|
|
|
|
switch(args[j].charAt(1)) {
|
|
|
|
dateMatch = parseInt(mdy[0])==(eventDate.getMonth()+1);
|
|
|
|
case 'y':
|
|
|
|
|
|
|
|
toMatch[0] = parseInt(args[j].substring(2));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
case 'm':
|
|
|
|
dateMatch = (parseInt(mdy[0])==(eventDate.getMonth()+1)) && (parseInt(mdy[1])==eventDate.getDate());
|
|
|
|
toMatch[1] = parseInt(args[j].substring(2));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
case 'd':
|
|
|
|
dateMatch = (parseInt(mdy[0])==(eventDate.getMonth()+1)) && (parseInt(mdy[1])==eventDate.getDate()) && (parseInt(mdy[2])==eventDate.getFullYear());
|
|
|
|
toMatch[2] = parseInt(args[j].substring(2));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (eventHistory[i].name.match($('.search-bar').val()) || dateMatch) {
|
|
|
|
} else {
|
|
|
|
var dateString = eventDate.toLocaleString();
|
|
|
|
nameToMatch += args[j] + ' ';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
nameToMatch = nameToMatch.substring(0, nameToMatch.length - 1);
|
|
|
|
|
|
|
|
for (var i = 0; i < eventHistory.length; i++) {
|
|
|
|
|
|
|
|
var dateMatch = true;
|
|
|
|
|
|
|
|
var eventDate = new Date(eventHistory[i].time*1000);
|
|
|
|
|
|
|
|
if (toMatch[0] > 0)
|
|
|
|
|
|
|
|
dateMatch = dateMatch && (toMatch[0] == eventDate.getFullYear());
|
|
|
|
|
|
|
|
if (toMatch[1] > 0)
|
|
|
|
|
|
|
|
dateMatch = dateMatch && (toMatch[1] == (eventDate.getMonth() + 1));
|
|
|
|
|
|
|
|
if (toMatch[2] > 0)
|
|
|
|
|
|
|
|
dateMatch = dateMatch && (toMatch[2] == eventDate.getDate());
|
|
|
|
|
|
|
|
/*if (toMatch[0]<0 && toMatch[1]<0 && toMatch[2]<0)
|
|
|
|
|
|
|
|
dateMatch = false;*/
|
|
|
|
|
|
|
|
if ((eventHistory[i].name.match(nameToMatch) != null) && dateMatch) {
|
|
|
|
|
|
|
|
var dateString = eventDate.toLocaleString('sv-SE');
|
|
|
|
var newElement = '<div class="event" card-id="' + eventHistory[i].cardID + '">\
|
|
|
|
var newElement = '<div class="event" card-id="' + eventHistory[i].cardID + '">\
|
|
|
|
<div class="time">' + dateString + '</div>\
|
|
|
|
<div class="time">' + dateString + '</div>\
|
|
|
|
<div class="name">';
|
|
|
|
<div class="name">';
|
|
|
|