make 24h time option

merge-requests/208/head
fatchan 5 years ago
parent c073622eb6
commit c45baea1a4
  1. 1
      gulp/res/css/style.css
  2. 2
      gulp/res/js/modal.js
  3. 14
      gulp/res/js/time.js
  4. 4
      views/mixins/modal.pug

@ -430,6 +430,7 @@ td, th {
padding: 5px;
border: 1px solid var(--post-outline-color);
align-self: center;
overflow-x: scroll;
}
details.actions div {

@ -95,7 +95,7 @@ pug_html = pug_html + "\u003Coption" + (pug_attr("value", theme, true, false)) +
}
}).call(this);
pug_html = pug_html + "\u003C\u002Fselect\u003E\u003C\u002Fdiv\u003E\u003Cdiv class=\"row\"\u003E\u003Cdiv class=\"label\"\u003EDefault volume\u003C\u002Fdiv\u003E\u003Clabel class=\"postform-style ph-5\"\u003E\u003Cinput id=\"volume-setting\" type=\"range\" min=\"0\" max=\"100\"\u002F\u003E\u003C\u002Flabel\u003E\u003C\u002Fdiv\u003E\u003Cdiv class=\"row\"\u003E\u003Cdiv class=\"label\"\u003ELive posts\u003C\u002Fdiv\u003E\u003Clabel class=\"postform-style ph-5\"\u003E\u003Cinput id=\"live-setting\" type=\"checkbox\"\u002F\u003E\u003C\u002Flabel\u003E\u003C\u002Fdiv\u003E\u003Cdiv class=\"row\"\u003E\u003Cdiv class=\"label\"\u003ENotifications\u003C\u002Fdiv\u003E\u003Clabel class=\"postform-style ph-5\"\u003E\u003Cinput id=\"notification-setting\" type=\"checkbox\"\u002F\u003E\u003C\u002Flabel\u003E\u003C\u002Fdiv\u003E\u003Cdiv class=\"row\"\u003E\u003Cdiv class=\"label\"\u003EScroll to new posts\u003C\u002Fdiv\u003E\u003Clabel class=\"postform-style ph-5\"\u003E\u003Cinput id=\"scroll-setting\" type=\"checkbox\"\u002F\u003E\u003C\u002Flabel\u003E\u003C\u002Fdiv\u003E\u003Cdiv class=\"row\"\u003E\u003Cdiv class=\"label\"\u003ELocal time\u003C\u002Fdiv\u003E\u003Clabel class=\"postform-style ph-5\"\u003E\u003Cinput id=\"time-setting\" type=\"checkbox\"\u002F\u003E\u003C\u002Flabel\u003E\u003C\u002Fdiv\u003E\u003C\u002Fdiv\u003E";
pug_html = pug_html + "\u003C\u002Fselect\u003E\u003C\u002Fdiv\u003E\u003Cdiv class=\"row\"\u003E\u003Cdiv class=\"label\"\u003EDefault volume\u003C\u002Fdiv\u003E\u003Clabel class=\"postform-style ph-5\"\u003E\u003Cinput id=\"volume-setting\" type=\"range\" min=\"0\" max=\"100\"\u002F\u003E\u003C\u002Flabel\u003E\u003C\u002Fdiv\u003E\u003Cdiv class=\"row\"\u003E\u003Cdiv class=\"label\"\u003ELive posts\u003C\u002Fdiv\u003E\u003Clabel class=\"postform-style ph-5\"\u003E\u003Cinput id=\"live-setting\" type=\"checkbox\"\u002F\u003E\u003C\u002Flabel\u003E\u003C\u002Fdiv\u003E\u003Cdiv class=\"row\"\u003E\u003Cdiv class=\"label\"\u003ENotifications\u003C\u002Fdiv\u003E\u003Clabel class=\"postform-style ph-5\"\u003E\u003Cinput id=\"notification-setting\" type=\"checkbox\"\u002F\u003E\u003C\u002Flabel\u003E\u003C\u002Fdiv\u003E\u003Cdiv class=\"row\"\u003E\u003Cdiv class=\"label\"\u003EScroll to new posts\u003C\u002Fdiv\u003E\u003Clabel class=\"postform-style ph-5\"\u003E\u003Cinput id=\"scroll-setting\" type=\"checkbox\"\u002F\u003E\u003C\u002Flabel\u003E\u003C\u002Fdiv\u003E\u003Cdiv class=\"row\"\u003E\u003Cdiv class=\"label\"\u003ELocal time\u003C\u002Fdiv\u003E\u003Clabel class=\"postform-style ph-5\"\u003E\u003Cinput id=\"time-setting\" type=\"checkbox\"\u002F\u003E\u003C\u002Flabel\u003E\u003C\u002Fdiv\u003E\u003Cdiv class=\"row\"\u003E\u003Cdiv class=\"label\"\u003E24h time\u003C\u002Fdiv\u003E\u003Clabel class=\"postform-style ph-5\"\u003E\u003Cinput id=\"hour12-setting\" type=\"checkbox\"\u002F\u003E\u003C\u002Flabel\u003E\u003C\u002Fdiv\u003E\u003C\u002Fdiv\u003E";
}
pug_html = pug_html + "\u003C\u002Fdiv\u003E\u003C\u002Fdiv\u003E";
};

@ -1,9 +1,11 @@
!localStorage.getItem('localtime') ? setLocalStorage('localtime', true) : void 0;
!localStorage.getItem('hour12') ? setLocalStorage('hour12', false) : void 0;
let localTime = localStorage.getItem('localtime') == 'true';
let hour12 = localStorage.getItem('hour12') == 'true';
const makeDateLocal = (date) => {
date.innerText = new Date(date.dateTime).toLocaleString(0, {hour12:false});
date.innerText = new Date(date.dateTime).toLocaleString(0, {hour12: !hour12});
}
if (localTime) {
@ -16,6 +18,8 @@ if (localTime) {
window.addEventListener('settingsReady', function(event) {
const timeSetting = document.getElementById('time-setting');
const hour12Setting = document.getElementById('hour12-setting');
const toggleLocalTime = () => {
localTime = !localTime;
setLocalStorage('localtime', localTime);
@ -24,6 +28,14 @@ window.addEventListener('settingsReady', function(event) {
timeSetting.checked = localTime;
timeSetting.addEventListener('change', toggleLocalTime, false);
const toggleHour12 = () => {
hour12 = !hour12;
setLocalStorage('hour12', hour12);
console.log('toggling 24h time', hour12);
}
hour12Setting.checked = hour12;
hour12Setting.addEventListener('change', toggleHour12, false);
});
window.addEventListener('addPost', function(e) {

@ -51,3 +51,7 @@ mixin modal(data)
.label Local time
label.postform-style.ph-5
input#time-setting(type='checkbox')
.row
.label 24h time
label.postform-style.ph-5
input#hour12-setting(type='checkbox')

Loading…
Cancel
Save