mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-02 17:23:15 +01:00
* fix some conditional display bugs in crowdfund * bump flatpickr * make clear button show up even with flatpickt fake input ui * update uis to specify date value in specific format and use custom format for flatpickr display and use moment to parse date instead * fix remaining public ui date issues
49 lines
1.4 KiB
JavaScript
49 lines
1.4 KiB
JavaScript
$(function () {
|
|
$(".localizeDate").each(function (index) {
|
|
var serverDate = $(this).text();
|
|
var localDate = new Date(serverDate);
|
|
|
|
var dateString = localDate.toLocaleDateString() + " " + localDate.toLocaleTimeString();
|
|
$(this).text(dateString);
|
|
});
|
|
|
|
|
|
$(".input-group-clear").on("click", function () {
|
|
$(this).parents(".input-group").find("input").val(null);
|
|
handleInputGroupClearButtonDisplay(this);
|
|
});
|
|
|
|
$(".input-group-clear").each(function () {
|
|
var inputGroupClearBtn = this;
|
|
handleInputGroupClearButtonDisplay(inputGroupClearBtn);
|
|
$(this).parents(".input-group").find("input").on("change input", function () {
|
|
handleInputGroupClearButtonDisplay(inputGroupClearBtn);
|
|
})
|
|
});
|
|
|
|
|
|
$(".only-for-js").show();
|
|
|
|
function handleInputGroupClearButtonDisplay(element) {
|
|
var inputs =$(element).parents(".input-group").find("input");
|
|
|
|
$(element).hide();
|
|
for (var i = 0; i < inputs.length; i++) {
|
|
var el = inputs.get(i);
|
|
if($(el).val() || el.attributes.value){
|
|
$(element).show();
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
function switchTimeFormat() {
|
|
$(".switchTimeFormat").each(function (index) {
|
|
var htmlVal = $(this).html();
|
|
var switchVal = $(this).attr("data-switch");
|
|
|
|
$(this).html(switchVal);
|
|
$(this).attr("data-switch", htmlVal);
|
|
});
|
|
}
|