From aaa6439ac7589c45ed69ad8851766524a9bb7dcb Mon Sep 17 00:00:00 2001 From: Sawood Alam Date: Wed, 19 Sep 2018 15:27:32 -0400 Subject: [PATCH 1/9] Split date from time and position it before URI-R in listing --- ipwb/assets/webui.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ipwb/assets/webui.js b/ipwb/assets/webui.js index 4583dea6..01407c5e 100644 --- a/ipwb/assets/webui.js +++ b/ipwb/assets/webui.js @@ -15,6 +15,10 @@ function hideURIs () { window.localStorage.setItem('showURIs', 'false') } +function splitDatetime (datetime) { + return datetime.replace(/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/, '$1-$2-$3 $4:$5:$6') +} + function addURIListToDOM () { let ul = document.getElementById('uriList') const uriKeys = Object.keys(uris).sort(shortestFirst) @@ -25,10 +29,10 @@ function addURIListToDOM () { let a = document.createElement('a') a.href = 'memento/' + memento['datetime'] + '/' + urir a.appendChild(document.createTextNode(urir)) - dt = document.createTextNode(' (' + memento['datetime'] + ')') + dt = document.createTextNode('[' + splitDatetime(memento['datetime']) + '] ') - li.appendChild(a) li.appendChild(dt) + li.appendChild(a) li.setAttribute('data-mime', memento['mime']) li.setAttribute('data-status', memento['status']) From c019eca50dc06451e7648802bdc524320783ba7d Mon Sep 17 00:00:00 2001 From: Sawood Alam Date: Tue, 25 Sep 2018 11:08:02 -0400 Subject: [PATCH 2/9] Add title in listing when available --- ipwb/assets/webui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipwb/assets/webui.js b/ipwb/assets/webui.js index 01407c5e..09b03833 100644 --- a/ipwb/assets/webui.js +++ b/ipwb/assets/webui.js @@ -28,7 +28,7 @@ function addURIListToDOM () { let li = document.createElement('li') let a = document.createElement('a') a.href = 'memento/' + memento['datetime'] + '/' + urir - a.appendChild(document.createTextNode(urir)) + a.appendChild(document.createTextNode(memento['title'] || urir)) dt = document.createTextNode('[' + splitDatetime(memento['datetime']) + '] ') li.appendChild(dt) From 0fcfac90d7b4e79d7169d575df357d9cdc48c6f0 Mon Sep 17 00:00:00 2001 From: Sawood Alam Date: Tue, 25 Sep 2018 11:41:42 -0400 Subject: [PATCH 3/9] Wrap datetime in a span and add a class to it for styling --- ipwb/assets/webui.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ipwb/assets/webui.js b/ipwb/assets/webui.js index 09b03833..a4b1e6bf 100644 --- a/ipwb/assets/webui.js +++ b/ipwb/assets/webui.js @@ -27,9 +27,11 @@ function addURIListToDOM () { uris[urir].forEach(function (memento) { let li = document.createElement('li') let a = document.createElement('a') + let span = document.createElement('span') a.href = 'memento/' + memento['datetime'] + '/' + urir a.appendChild(document.createTextNode(memento['title'] || urir)) - dt = document.createTextNode('[' + splitDatetime(memento['datetime']) + '] ') + span.setAttribute('class', 'datetime') + let dt = span.appendChild(document.createTextNode(memento['datetime'])) li.appendChild(dt) li.appendChild(a) From 22c1a428df0619c36de0c7f0742fa9ba8a6d71e3 Mon Sep 17 00:00:00 2001 From: Sawood Alam Date: Tue, 25 Sep 2018 11:48:05 -0400 Subject: [PATCH 4/9] Add datetime formatting back that was accidentally removed --- ipwb/assets/webui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipwb/assets/webui.js b/ipwb/assets/webui.js index a4b1e6bf..9fd42621 100644 --- a/ipwb/assets/webui.js +++ b/ipwb/assets/webui.js @@ -31,7 +31,7 @@ function addURIListToDOM () { a.href = 'memento/' + memento['datetime'] + '/' + urir a.appendChild(document.createTextNode(memento['title'] || urir)) span.setAttribute('class', 'datetime') - let dt = span.appendChild(document.createTextNode(memento['datetime'])) + let dt = span.appendChild(document.createTextNode(splitDatetime(memento['datetime']))) li.appendChild(dt) li.appendChild(a) From 00c8d266886d0eee68c2d843a3c110b59a0b8915 Mon Sep 17 00:00:00 2001 From: Sawood Alam Date: Tue, 25 Sep 2018 11:50:07 -0400 Subject: [PATCH 5/9] Sort the list by path depth --- ipwb/assets/webui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipwb/assets/webui.js b/ipwb/assets/webui.js index 9fd42621..de9d6b2f 100644 --- a/ipwb/assets/webui.js +++ b/ipwb/assets/webui.js @@ -6,7 +6,7 @@ function handleSubmit () { } function shortestFirst (a, b) { - return a.length - b.length + return a.split('/').length - b.split('/').length } function hideURIs () { From 44367a06d5427c32330081908a6eb2faa7109e21 Mon Sep 17 00:00:00 2001 From: Sawood Alam Date: Tue, 25 Sep 2018 11:58:38 -0400 Subject: [PATCH 6/9] Fix datetime span element --- ipwb/assets/webui.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ipwb/assets/webui.js b/ipwb/assets/webui.js index de9d6b2f..6f0ac7c7 100644 --- a/ipwb/assets/webui.js +++ b/ipwb/assets/webui.js @@ -27,11 +27,11 @@ function addURIListToDOM () { uris[urir].forEach(function (memento) { let li = document.createElement('li') let a = document.createElement('a') - let span = document.createElement('span') + let dt = document.createElement('span') a.href = 'memento/' + memento['datetime'] + '/' + urir a.appendChild(document.createTextNode(memento['title'] || urir)) - span.setAttribute('class', 'datetime') - let dt = span.appendChild(document.createTextNode(splitDatetime(memento['datetime']))) + dt.setAttribute('class', 'datetime') + dt.appendChild(document.createTextNode(splitDatetime(memento['datetime']))) li.appendChild(dt) li.appendChild(a) From 1b98c3b836714c3b41b9be83826a331ef8c6f738 Mon Sep 17 00:00:00 2001 From: Mat Kelly Date: Tue, 25 Sep 2018 12:05:45 -0400 Subject: [PATCH 7/9] Style datetime --- ipwb/assets/webui.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ipwb/assets/webui.css b/ipwb/assets/webui.css index 67b04796..bbafd000 100644 --- a/ipwb/assets/webui.css +++ b/ipwb/assets/webui.css @@ -36,3 +36,5 @@ details label#daemonStatusLabel {height: 10px; margin-top: 0; vertical-align: to details label.twoRowLabel {height: 2.0em;} form input[type=submit] {display: block; clear: both; margin: 0.5em auto 0 auto;} + +span.datetime {color: #999; font-size: 0.8em; margin-right: 5px;} \ No newline at end of file From a8344a24c587ba985749c2dc76ad68cc9325ac45 Mon Sep 17 00:00:00 2001 From: Sawood Alam Date: Tue, 25 Sep 2018 12:07:34 -0400 Subject: [PATCH 8/9] Remove trailing slashes for sorting --- ipwb/assets/webui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipwb/assets/webui.js b/ipwb/assets/webui.js index 6f0ac7c7..44ae6da1 100644 --- a/ipwb/assets/webui.js +++ b/ipwb/assets/webui.js @@ -6,7 +6,7 @@ function handleSubmit () { } function shortestFirst (a, b) { - return a.split('/').length - b.split('/').length + return a.replace(/\/$+/, '').split('/').length - b.replace(/\/+$/, '').split('/').length } function hideURIs () { From 971249af943a9b3c90620acdf3d292c31cfc3ab7 Mon Sep 17 00:00:00 2001 From: Sawood Alam Date: Tue, 25 Sep 2018 12:13:08 -0400 Subject: [PATCH 9/9] Fix a RegEx typo --- ipwb/assets/webui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipwb/assets/webui.js b/ipwb/assets/webui.js index 44ae6da1..32bc7ab9 100644 --- a/ipwb/assets/webui.js +++ b/ipwb/assets/webui.js @@ -6,7 +6,7 @@ function handleSubmit () { } function shortestFirst (a, b) { - return a.replace(/\/$+/, '').split('/').length - b.replace(/\/+$/, '').split('/').length + return a.replace(/\/+$/, '').split('/').length - b.replace(/\/+$/, '').split('/').length } function hideURIs () {