Yaroslav222333,
пробуйте, может получится
<script>
define("countdown", [], function () {
var e = {
start: 20, storage: !0, init: function () {
var t, r, n, i;
this.$el = $(".countdown"), this.$descr = $(".countdown-descr"), this.placesTotal = $(".places-total"), this.$place1 = $(".place-1"), this.$place2 = $(".place-2"), this.$place3 = $(".place-3");
try {
localStorage.setItem("item", "text"), localStorage.removeItem("item")
} catch (a) {
e.storage = !1
}
localStorage.countdownValue && localStorage.countdownDate ? (this.value = localStorage.countdownValue,
this.$el.html(this.value),
n = new Date(localStorage.countdownDate),
r = new Date,
i = Math.round(Math.abs((r.getTime() - n.getTime()) / 864e5)),
i > 0 && this.value > 3 && (i + 1 > this.value && (i = 1),
this.value -= i+2,
this.save()),
localStorage.setItem("countdownDate", new Date)) : (this.value = this.start, this.save()),
this.value > 20 && (t = setInterval(function () { e.value > 20 ? (e.value = e.value - 3, localStorage.setItem("countdownDate", new Date), e.save()) : clearInterval(t)
}, 200)), this.saveDescr()
}, save: function () {
localStorage.setItem("countdownValue", this.value), this.$el.html(this.value), this.value === this.start ? this.placesTotal.hide() : this.placesTotal.show()
}, reducePlaces: function () {
for (var e, t = this.$place1.html(), r = this.$place2.html(), n = this.$place3.html(), i = !1; 0 == i;)if (e = Math.round(3 * Math.random() + 1), 1 == e) {
if (3 > t)continue;
this.$place1.html(--t), i = !0
} else if (3 == e) {
if (3 > n)continue;
this.$place3.html(--n), i = !0
} else if (3 == e || 4 == e) {
if (3 > r)continue;
this.$place2.html(--r), i = !0
}
}, saveDescr: function () {
this.value < 3 && this.$descr.html("места")
}
};
return e
})
</script>