forked from CGM_Public/pretix_original
Do not render time before JS locale file is loaded
This commit is contained in:
@@ -3,8 +3,14 @@
|
|||||||
var cart = {
|
var cart = {
|
||||||
_deadline: null,
|
_deadline: null,
|
||||||
_deadline_interval: null,
|
_deadline_interval: null,
|
||||||
|
_deadline_call: 0,
|
||||||
|
|
||||||
draw_deadline: function () {
|
draw_deadline: function () {
|
||||||
|
cart._deadline_call++;
|
||||||
|
if ((typeof django === 'undefined' || typeof django.gettext === 'undefined') && cart._deadline_call < 5) {
|
||||||
|
// Language files are not loaded yet, don't run during the first seconds
|
||||||
|
return;
|
||||||
|
}
|
||||||
var diff = Math.floor(cart._deadline.diff(moment()) / 1000 / 60);
|
var diff = Math.floor(cart._deadline.diff(moment()) / 1000 / 60);
|
||||||
if (diff < 0) {
|
if (diff < 0) {
|
||||||
$("#cart-deadline").text(gettext("The items in your cart are no longer reserved for you."));
|
$("#cart-deadline").text(gettext("The items in your cart are no longer reserved for you."));
|
||||||
|
|||||||
Reference in New Issue
Block a user