From 2e52b5be2a41269066ec4d79d7172918be95e59e Mon Sep 17 00:00:00 2001 From: Tag Date: Fri, 17 Feb 2023 17:07:23 -0800 Subject: [PATCH] Removed janky datepicker --- package.nw/GridTracker.html | 9 +- package.nw/i18n/cn-t.json | 20 --- package.nw/i18n/cn.json | 20 --- package.nw/i18n/en.json | 20 --- package.nw/lib/README-3rdparty.md | 11 -- package.nw/lib/datepicker.js | 273 ------------------------------ package.nw/lib/dp-dark.css | 74 -------- package.nw/lib/gt.js | 14 +- 8 files changed, 7 insertions(+), 434 deletions(-) delete mode 100644 package.nw/lib/datepicker.js delete mode 100644 package.nw/lib/dp-dark.css diff --git a/package.nw/GridTracker.html b/package.nw/GridTracker.html index a5be164..15481db 100644 --- a/package.nw/GridTracker.html +++ b/package.nw/GridTracker.html @@ -34,7 +34,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. GridTracker - @@ -48,7 +47,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - @@ -1594,11 +1592,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - Time
-
- Date
- -
+ Date + Time diff --git a/package.nw/i18n/cn-t.json b/package.nw/i18n/cn-t.json index d0d5648..5ed3707 100644 --- a/package.nw/i18n/cn-t.json +++ b/package.nw/i18n/cn-t.json @@ -692,26 +692,6 @@ "callsigns.Downloading": "下載中...", "callsigns.never": "從不", "callsigns.processing": "處理中...", - "COMMENT_datepicker.js": "", - "datepicker.month.Jan": "一月", - "datepicker.month.Feb": "二月", - "datepicker.month.Mar": "三月", - "datepicker.month.Apr": "四月", - "datepicker.month.May": "五月", - "datepicker.month.Jun": "六月", - "datepicker.month.Jul": "七月", - "datepicker.month.Aug": "八月", - "datepicker.month.Sep": "九月", - "datepicker.month.Oct": "十月", - "datepicker.month.Nov": "十一月", - "datepicker.month.Dec": "十二月", - "datepicker.day.Sun": "日", - "datepicker.day.Mon": "一", - "datepicker.day.Tue": "二", - "datepicker.day.Wed": "三", - "datepicker.day.Thu": "四", - "datepicker.day.Fri": "五", - "datepicker.day.Sat": "六", "COMMENT_gt.js": "", "gt.gridView.live": "實時", "gt.gridView.logbook": "日誌", diff --git a/package.nw/i18n/cn.json b/package.nw/i18n/cn.json index 496a574..1c9d957 100644 --- a/package.nw/i18n/cn.json +++ b/package.nw/i18n/cn.json @@ -692,26 +692,6 @@ "callsigns.Downloading": "下载中...", "callsigns.never": "Never", "callsigns.processing": "处理中...", - "COMMENT_datepicker.js": "", - "datepicker.month.Jan": "一月", - "datepicker.month.Feb": "二月", - "datepicker.month.Mar": "三月", - "datepicker.month.Apr": "四月", - "datepicker.month.May": "五月", - "datepicker.month.Jun": "六月", - "datepicker.month.Jul": "七月", - "datepicker.month.Aug": "八月", - "datepicker.month.Sep": "九月", - "datepicker.month.Oct": "十月", - "datepicker.month.Nov": "十一月", - "datepicker.month.Dec": "十二月", - "datepicker.day.Sun": "星期日", - "datepicker.day.Mon": "星期一", - "datepicker.day.Tue": "星期二", - "datepicker.day.Wed": "星期三", - "datepicker.day.Thu": "星期四", - "datepicker.day.Fri": "星期五", - "datepicker.day.Sat": "星期六", "COMMENT_gt.js": "", "gt.gridView.live": "实时数据", "gt.gridView.logbook": "日志数据", diff --git a/package.nw/i18n/en.json b/package.nw/i18n/en.json index f1f1659..40a2151 100644 --- a/package.nw/i18n/en.json +++ b/package.nw/i18n/en.json @@ -692,26 +692,6 @@ "callsigns.Downloading": "Downloading...", "callsigns.never": "Never", "callsigns.processing": "Processing...", - "COMMENT_datepicker.js": "", - "datepicker.month.Jan": "Jan", - "datepicker.month.Feb": "Feb", - "datepicker.month.Mar": "Mar", - "datepicker.month.Apr": "Apr", - "datepicker.month.May": "May", - "datepicker.month.Jun": "Jun", - "datepicker.month.Jul": "Jul", - "datepicker.month.Aug": "Aug", - "datepicker.month.Sep": "Sep", - "datepicker.month.Oct": "Oct", - "datepicker.month.Nov": "Nov", - "datepicker.month.Dec": "Dec", - "datepicker.day.Sun": "Sun", - "datepicker.day.Mon": "Mon", - "datepicker.day.Tue": "Tue", - "datepicker.day.Wed": "Wed", - "datepicker.day.Thu": "Thur", - "datepicker.day.Fri": "Fri", - "datepicker.day.Sat": "Sat", "COMMENT_gt.js": "", "gt.gridView.live": "Live", "gt.gridView.logbook": "Logbook", diff --git a/package.nw/lib/README-3rdparty.md b/package.nw/lib/README-3rdparty.md index c78e571..9423ab3 100644 --- a/package.nw/lib/README-3rdparty.md +++ b/package.nw/lib/README-3rdparty.md @@ -18,17 +18,6 @@ Not entirely part of openlayers, but conglomerated together from other stuff: - lib/shadow.js -## DatePicker - calendar display - -- https://code-boxx.com/simple-datepicker-pure-javascript-css/ -- https://code-boxx.com/wp-content/uploads/2020/06/datepicker-js.zip - -- lib/datepicker.js -- lib/dp-dark.css - -Code has been hacked a bit, origin not reflected in version control so be -careful when upgrading. - ## Other Third Party routines lib/third-party.js diff --git a/package.nw/lib/datepicker.js b/package.nw/lib/datepicker.js deleted file mode 100644 index de313e6..0000000 --- a/package.nw/lib/datepicker.js +++ /dev/null @@ -1,273 +0,0 @@ -// FIXME ****************************************************************************** // -// The datepicker's "Time" section doesn't work. This really needs to be fixed before -// the next big RTTY Roundup or Field Day where there may be a lot of hams that want -// to use this feature to only reference their log starting when the contest starts. -// Which isn't always 00:00 UTC. -// ************************************************************************************ // -var picker = { - attach: function (opt) - { - // attach() : attach datepicker to target - // opt : options (object) - // target : datepicker will populate this field - // container : datepicker will be generated in this container - // startmon : start on Monday (default false) - // disableday : array of days to disable, e.g. [2,7] to disable Tue and Sun - - // (A) Create new datepicker - var dp = document.createElement("div"); - dp.dataset.target = opt.target; - dp.dataset.fire = opt.fire; - dp.dataset.startmon = opt.startmon ? "1" : "0"; - dp.classList.add("picker"); - if (opt.disableday) - { - dp.dataset.disableday = JSON.stringify(opt.disableday); - } - - // (B) Default to current month + year - // ! NOTE: UTC+0 ! - var today = new Date(0), - thisMonth = today.getUTCMonth(), // Note: Jan is 0 - thisYear = parseInt(today.getUTCFullYear()), - months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; - - // (C) Month select - var select = document.createElement("select"), - option = null; - select.classList.add("picker-m"); - for (var mth in months) - { - option = document.createElement("option"); - option.value = parseInt(mth) + 1; - option.text = months[mth]; - select.appendChild(option); - } - select.selectedIndex = thisMonth; - select.addEventListener("change", function() { picker.draw(this); }); - dp.appendChild(select); - - // (D) Year select - var yRange = 100; // Year range to show, I.E. from thisYear-yRange to thisYear+yRange - select = document.createElement("select"); - select.classList.add("picker-y"); - for (var y = thisYear; y < thisYear + yRange; y++) - { - option = document.createElement("option"); - option.value = y; - option.text = y; - select.appendChild(option); - } - select.selectedIndex = 0; - select.addEventListener("change", function() { picker.draw(this); }); - dp.appendChild(select); - - // (E) Day select - var days = document.createElement("div"); - days.classList.add("picker-d"); - dp.appendChild(days); - - // (F) Attach date picker to target container + draw the dates - picker.draw(select); - - // (F1) Popup datepicker - if (opt.container == 1) - { - // Mark this as a "popup" - var uniqueID = 0; - while (document.getElementById("picker-" + uniqueID) != null) - { - uniqueID = Math.floor(Math.random() * (100 - 2)) + 1; - } - dp.dataset.popup = "1"; - dp.dataset.dpid = uniqueID; - - // Create wrapper - var wrapper = document.createElement("div"); - wrapper.id = "picker-" + uniqueID; - wrapper.classList.add("picker-wrap"); - wrapper.appendChild(dp); - - // Attach onclick to show/hide datepicker - var target = document.getElementById(opt.target); - target.dataset.dp = uniqueID; - target.onfocus = function () - { - document.getElementById("picker-" + this.dataset.dp).classList.add("show"); - }; - wrapper.addEventListener("click", function (evt) - { - if (evt.target.classList.contains("picker-wrap")) - { - this.classList.remove("show"); - } - }); - - // Attach popup datepicker to document - document.documentElement.appendChild(wrapper); - } - - // (F2) Inline datepicker - else - { - document.getElementById(opt.container).appendChild(dp); - } - }, - - draw: function (el) - { - // draw() : draw the days in month - // el : HTML reference to either year or month selector - - // (A) Get date picker components - var parent = el.parentElement, - year = parent.getElementsByClassName("picker-y")[0].value, - month = parent.getElementsByClassName("picker-m")[0].value, - days = parent.getElementsByClassName("picker-d")[0]; - - // (B) Date range calculation - // ! NOTE: UTC+0 ! - var daysInMonth = new Date(Date.UTC(year, month, 0)).getUTCDate(), - startDay = new Date(Date.UTC(year, month - 1, 1)).getUTCDay(), // Note: Sun = 0 - endDay = new Date(Date.UTC(year, month - 1, daysInMonth)).getUTCDay(), - startDay = startDay == 0 ? 7 : startDay, - endDay = endDay == 0 ? 7 : endDay; - - // (C) Generate date squares (in array first) - var squares = [], - disableday = null; - if (parent.dataset.disableday) - { - disableday = JSON.parse(parent.dataset.disableday); - } - - // (C1) Empty squares before first day of month - if (parent.dataset.startmon == "1" && startDay != 1) - { - for (var i = 1; i < startDay; i++) { squares.push("B"); } - } - if (parent.dataset.startmon == "0" && startDay != 7) - { - for (var i = 0; i < startDay; i++) { squares.push("B"); } - } - - // (C2) Days of month - // All days enabled, just add - if (disableday == null) - { - for (var i = 1; i <= daysInMonth; i++) { squares.push([i, false]); } - } - // Some days disabled - else - { - var thisday = startDay; - for (var i = 1; i <= daysInMonth; i++) - { - // Check if day is disabled - var disabled = disableday.includes(thisday); - // Day of month, disabled - squares.push([i, disabled]); - // Next day - thisday++; - if (thisday == 8) { thisday = 1; } - } - } - - // (C2) Empty squares after last day of month - if (parent.dataset.startmon == "1" && endDay != 7) - { - for (var i = endDay; i < 7; i++) { squares.push("B"); } - } - if (parent.dataset.startmon == "0" && endDay != 6) - { - for (var i = endDay; i < (endDay == 7 ? 13 : 6); i++) { squares.push("B"); } - } - - // (D) Draw HTML - var daynames = ["Mon", "Tue", "Wed", "Thur", "Fri", "Sat"]; - if (parent.dataset.startmon == "1") { daynames.push("Sun"); } - else { daynames.unshift("Sun"); } - - // (D1) Header - var table = document.createElement("table"), - row = table.insertRow() - cell = null; - row.classList.add("picker-d-h"); - for (let d of daynames) - { - cell = row.insertCell(); - cell.innerHTML = d; - } - - // (D2) Date cells - var total = squares.length; - row = table.insertRow(); - for (var i = 0; i < total; i++) - { - if (i != total && i % 7 == 0) { row = table.insertRow(); } - cell = row.insertCell(); - if (squares[i] == "B") - { - cell.classList.add("picker-d-b"); - } - else - { - cell.innerHTML = squares[i][0]; - // Not allowed to choose this day - if (squares[i][1]) - { - cell.classList.add("picker-d-dd"); - } - // Allowed to choose this day - else - { - cell.classList.add("picker-d-d"); - cell.addEventListener("click", function() { picker.pick(this); }); - } - } - } - - // (D3) Attach new calendar to datepicker - days.innerHTML = ""; - days.appendChild(table); - }, - - pick: function (el) - { - // pick() : choose a date - // el : HTML reference to selected date cell - - // (A) Get all components - var parent = el.parentElement; - while (!parent.classList.contains("picker")) - { - parent = parent.parentElement; - } - - // (B) Get full selected year month day - var year = parent.getElementsByClassName("picker-y")[0].value, - month = parent.getElementsByClassName("picker-m")[0].value, - day = el.innerHTML; - - // YYYY-MM-DD Format - // ! CHANGE FORMAT HERE IF YOU WANT ! - if (parseInt(month) < 10) { month = "0" + month; } - if (parseInt(day) < 10) { day = "0" + day; } - var fullDate = year + "-" + month + "-" + day; - - // (C) Update selected date - document.getElementById(parent.dataset.target).value = fullDate; - - if (parent.dataset.fire.length > 0) - { - window[parent.dataset.fire](); - } - - // (D) Popup only - close the popup - if (parent.dataset.popup == "1") - { - document.getElementById("picker-" + parent.dataset.dpid).classList.remove("show"); - } - } -}; diff --git a/package.nw/lib/dp-dark.css b/package.nw/lib/dp-dark.css deleted file mode 100644 index 9fe3c6b..0000000 --- a/package.nw/lib/dp-dark.css +++ /dev/null @@ -1,74 +0,0 @@ -/* [POPUP] */ -.picker-wrap { - position: fixed; - top: 0; - left: 0; - width: 100vw; - height: 100vh; - background: rgba(0, 0, 0, 0.5); - opacity: 0; - visibility: hidden; - transition: opacity 0.2s; -} -.picker-wrap.show { - opacity: 1; - visibility: visible; -} -.picker-wrap .picker { - margin: 50vh auto 0 auto; - transform: translateY(-50%); -} - -/* [CONTAINER] */ -.picker { - max-width: 200px; - border: 1px solid #444; - -webkit-border-radius: 6px; - background: #444; - border-style: outset; - padding: 5px; -} - -.picker:hover { - border: 1px solid #888; -} - -/* [MONTH + YEAR] */ -.picker-m, -.picker-y { - width: 25%; - padding: 5px; - box-sizing: border-box; - /*font-size: 16px;*/ -} - -/* [DAY] */ -.picker-d table { - color: #fff; - border-collapse: separate; - width: 100%; - margin-top: 5px; -} -.picker-d table td { - width: 2em; /* 7 equal columns */ - padding: 2px; - text-align: center; -} -/* Header cells */ -.picker-d-h td { - font-weight: bold; -} -/* Blank dates */ -.picker-d-b { - background: #4e4e4e; -} -/* Pickable Dates */ -.picker-d-d:hover { - cursor: pointer; - background: #a33c3c; -} -/* Unpickable Dates */ -.picker-d-dd { - color: #888; - background: #4e4e4e; -} diff --git a/package.nw/lib/gt.js b/package.nw/lib/gt.js index 4866936..88d3cbc 100644 --- a/package.nw/lib/gt.js +++ b/package.nw/lib/gt.js @@ -11429,6 +11429,11 @@ function workingDateChanged() { workingTimeValue.value = "00:00"; } + if (workingTimeValue.value.length == 0) + { + workingTimeValue.value = "1970-01-01"; + } + var fields = workingDateValue.value.split("-"); var time = workingTimeValue.value.split(":"); @@ -16049,15 +16054,6 @@ function makeScreenshots() ); } -window.addEventListener("load", function () -{ - picker.attach({ - target: "workingDateValue", - container: "pick-inline", - fire: "workingDateChanged" - }); -}); - function refreshSpotsNoTx() { redrawSpots();