PageSourceSearch

https://medcafedra.ru/bitrix/templates/aspro-allcorp3-med/js/jquery.countdown.min.js

js medcafedra.ru collected 2026-10-01 12:38:41 UTC 21,419 bytes, 568 lines download raw bytes

1!(function (e) {
2  var t = "countdown",
3    i = 0,
4    s = 1,
5    n = 2,
6    o = 3,
7    r = 4,
8    a = 5,
9    l = 6;
10  e.JQPlugin.createPlugin({
11    name: t,
12    defaultOptions: {
13      until: null,
14      since: null,
15      timezone: null,
16      serverSync: null,
17      format: "dHMS",
18      layout: "",
19      compact: !1,
20      padZeroes: !1,
21      significant: 0,
22      description: "",
23      expiryUrl: "",
24      expiryText: "",
25      alwaysExpire: !1,
26      onExpiry: null,
27      onTick: null,
28      tickInterval: 1,
29    },
30    regionalOptions: {
31      "": {
32        labels: ["Years", "Months", "Weeks", "Days", "Hours", "Minutes", "Seconds"],
33        labels1: ["Year", "Month", "Week", "Day", "Hour", "Minute", "Second"],
34        compactLabels: ["y", "m", "w", "d"],
35        whichLabels: null,
36        digits: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
37        timeSeparator: ":",
38        isRTL: !1,
39      },
40    },
41    _getters: ["getTimes"],
42    _rtlClass: t + "-rtl",
43    _sectionClass: t + "-section",
44    _amountClass: t + "-amount",
45    _periodClass: t + "-period",
46    _rowClass: t + "-row",
47    _holdingClass: t + "-holding",
48    _showClass: t + "-show",
49    _descrClass: t + "-descr",
50    _timerElems: [],
51    _init: function () {
52      function t(e) {
53        var a = 1e12 > e ? (n ? performance.now() + performance.timing.navigationStart : s()) : e || s();
54        a - r >= 1e3 && (i._updateElems(), (r = a)), o(t);
55      }
56      var i = this;
57      this._super(), (this._serverSyncs = []);
58      
59    //   console.log(i);
60      var s =
61          "function" == typeof Date.now
62            ? Date.now
63            : function () {
64                return new Date().getTime();
65              },
66        n = window.performance && "function" == typeof window.performance.now,
67        o =
68          window.requestAnimationFrame ||
69          window.webkitRequestAnimationFrame ||
70          window.mozRequestAnimationFrame ||
71          window.oRequestAnimationFrame ||
72          window.msRequestAnimationFrame ||
73          null,
74        r = 0;
75      !o || e.noRequestAnimationFrame
76        ? ((e.noRequestAnimationFrame = null),
77          setInterval(function () {
78            i._updateElems();
79          }, 980))
80        : ((r =
81            window.animationStartTime ||
82            window.webkitAnimationStartTime ||
83            window.mozAnimationStartTime ||
84            window.oAnimationStartTime ||
85            window.msAnimationStartTime ||
86            s()),
87          o(t));
88    },
89    UTCDate: function (e, t, i, s, n, o, r, a) {
90      "object" == typeof t &&
91        t.constructor == Date &&
92        ((a = t.getMilliseconds()),
93        (r = t.getSeconds()),
94        (o = t.getMinutes()),
95        (n = t.getHours()),
96        (s = t.getDate()),
97        (i = t.getMonth()),
98        (t = t.getFullYear()));
99      var l = new Date();
100      return (
101        l.setUTCFullYear(t),
102        l.setUTCDate(1),
103        l.setUTCMonth(i || 0),
104        l.setUTCDate(s || 1),
105        l.setUTCHours(n || 0),
106        l.setUTCMinutes((o || 0) - (Math.abs(e) < 30 ? 60 * e : e)),
107        l.setUTCSeconds(r || 0),
108        l.setUTCMilliseconds(a || 0),
109        l
110      );
111    },
112    periodsToSeconds: function (e) {
113      return 31557600 * e[0] + 2629800 * e[1] + 604800 * e[2] + 86400 * e[3] + 3600 * e[4] + 60 * e[5] + e[6];
114    },
115    resync: function () {
116      var t = this;
117      e("." + this._getMarker()).each(function () {
118        var i = e.data(this, t.name);
119        if (i.options.serverSync) {
120          for (var s = null, n = 0; n < t._serverSyncs.length; n++)
121            if (t._serverSyncs[n][0] == i.options.serverSync) {
122              s = t._serverSyncs[n];
123              break;
124            }
125          if (null == s[2]) {
126            var o = e.isFunction(i.options.serverSync) ? i.options.serverSync.apply(this, []) : null;
127            s[2] = (o ? new Date().getTime() - o.getTime() : 0) - s[1];
128          }
129          i._since && i._since.setMilliseconds(i._since.getMilliseconds() + s[2]),
130            i._until.setMilliseconds(i._until.getMilliseconds() + s[2]);
131        }
132      });
133      for (var i = 0; i < t._serverSyncs.length; i++)
134        null != t._serverSyncs[i][2] && ((t._serverSyncs[i][1] += t._serverSyncs[i][2]), delete t._serverSyncs[i][2]);
135    },
136    _instSettings: function (e, t) {
137      return { _periods: [0, 0, 0, 0, 0, 0, 0] };
138    },
139    _addElem: function (e) {
140        // console.log(e);
141      this._hasElem(e) || this._timerElems.push(e);
142      
143    },
144    _hasElem: function (t) {
145      return e.inArray(t, this._timerElems) > -1;
146    },
147    _removeElem: function (t) {
148      this._timerElems = e.map(this._timerElems, function (e) {
149        return e == t ? null : e;
150      });
151    },
152    _updateElems: function () {
153      for (var e = this._timerElems.length - 1; e >= 0; e--) this._updateCountdown(this._timerElems[e]);
154    },
155    _optionsChanged: function (t, i, s) {
156      s.layout && (s.layout = s.layout.replace(/&lt;/g, "<").replace(/&gt;/g, ">")),
157        this._resetExtraLabels(i.options, s);
158      var n = i.options.timezone != s.timezone;
159      e.extend(i.options, s), this._adjustSettings(t, i, null != s.until || null != s.since || n);
160      var o = new Date();
161      ((i._since && i._since < o) || (i._until && i._until > o)) && this._addElem(t[0]), this._updateCountdown(t, i);
162    },
163    _updateCountdown: function (t, i) {
164      if (((t = t.jquery ? t : e(t)), (i = i || this._getInst(t)), i && i.options)) {
165        if (
166          (t.html(this._generateHTML(i)).toggleClass(this._rtlClass, i.options.isRTL), e.isFunction(i.options.onT
166ick))
167        ) {
168          var s = "lap" != i._hold ? i._periods : this._calculatePeriods(i, i._show, i.options.significant, new Date());
169          (1 == i.options.tickInterval || this.periodsToSeconds(s) % i.options.tickInterval == 0) &&
170            i.options.onTick.apply(t[0], [s]);
171        }
172        var n =
173          "pause" != i._hold &&
174          (i._since ? i._now.getTime() < i._since.getTime() : i._now.getTime() >= i._until.getTime());
175        if (n && !i._expiring) {
176          if (((i._expiring = !0), this._hasElem(t[0]) || i.options.alwaysExpire)) {
177            if (
178              (this._removeElem(t[0]),
179              e.isFunction(i.options.onExpiry) && i.options.onExpiry.apply(t[0], []),
180              i.options.expiryText)
181            ) {
182              var o = i.options.layout;
183              (i.options.layout = i.options.expiryText), this._updateCountdown(t[0], i), (i.options.layout = o);
184            }
185            i.options.expiryUrl && (window.location = i.options.expiryUrl);
186          }
187          i._expiring = !1;
188        } else "pause" == i._hold && this._removeElem(t[0]);
189      }
190    },
191    _resetExtraLabels: function (e, t) {
192      for (var i in t) i.match(/[Ll]abels[02-9]|compactLabels1/) && (e[i] = t[i]);
193      for (var i in e) i.match(/[Ll]abels[02-9]|compactLabels1/) && "undefined" == typeof t[i] && (e[i] = null);
194    },
195    _adjustSettings: function (t, i, s) {
196      for (var n = null, o = 0; o < this._serverSyncs.length; o++)
197        if (this._serverSyncs[o][0] == i.options.serverSync) {
198          n = this._serverSyncs[o][1];
199          break;
200        }
201      if (null != n)
202        var r = i.options.serverSync ? n : 0,
203          a = new Date();
204      else {
205        var l = e.isFunction(i.options.serverSync) ? i.options.serverSync.apply(t[0], []) : null,
206          a = new Date(),
207          r = l ? a.getTime() - l.getTime() : 0;
208        this._serverSyncs.push([i.options.serverSync, r]);
209      }
210      var _ = i.options.timezone;
211      (_ = null == _ ? -a.getTimezoneOffset() : _),
212        (s || (!s && null == i._until && null == i._since)) &&
213          ((i._since = i.options.since),
214          null != i._since &&
215            ((i._since = this.UTCDate(_, this._determineTime(i._since, null))),
216            i._since && r && i._since.setMilliseconds(i._since.getMilliseconds() + r)),
217          (i._until = this.UTCDate(_, this._determineTime(i.options.until, a))),
218          r && i._until.setMilliseconds(i._until.getMilliseconds() + r)),
219        (i._show = this._determineShow(i));
220    },
221    _preDestroy: function (e, t) {
222      this._removeElem(e[0]), e.empty();
223    },
224    pause: function (e) {
225      this._hold(e, "pause");
226    },
227    lap: function (e) {
228      this._hold(e, "lap");
229    },
230    resume: function (e) {
231      this._hold(e, null);
232    },
233    toggle: function (t) {
234      var i = e.data(t, this.name) || {};
235      this[i._hold ? "resume" : "pause"](t);
236    },
237    toggleLap: function (t) {
238      var i = e.data(t, this.name) || {};
239      this[i._hold ? "resume" : "lap"](t);
240    },
241    _hold: function (t, i) {
242      var s = e.data(t, this.name);
243      if (s) {
244        if ("pause" == s._hold && !i) {
245          s._periods = s._savePeriods;
246          var n = s._since ? "-" : "+";
247          (s[s._since ? "_since" : "_until"] = this._determineTime(
248            n +
249              s._periods[0] +
250              "y" +
251              n +
252              s._periods[1] +
253              "o" +
254              n +
255              s._periods[2] +
256              "w" +
257              n +
258              s._periods[3] +
259              "d" +
260              n +
261              s._periods[4] +
262              "h" +
263              n +
264              s._periods[5] +
265              "m" +
266              n +
267              s._periods[6] +
268              "s"
269          )),
270            this._addElem(t);
271        }
272        (s._hold = i),
273          (s._savePeriods = "pause" == i ? s._periods : null),
274          e.data(t, this.name, s),
275          this._updateCountdown(t, s);
276      }
277    },
278    getTimes: function (t) {
279      var i = e.data(t, this.name);
280      return i
281        ? "pause" == i._hold
282          ? i._savePeriods
283          : i._hold
284          ? this._calculatePeriods(i, i._show, i.options.significant, new Date())
285          : i._periods
286        : null;
287    },
288    _determineTime: function (e, t) {
289      var i = this,
290        s = function (e) {
291          var t = new Date();
292          return t.setTime(t.getTime() + 1e3 * e), t;
293        },
294        n = function (e) {
295          e = e.toLowerCase();
296          for (
297            var t = new Date(),
298              s = t.getFullYear(),
299              n = t.getMonth(),
300              o = t.getDate(),
301              r = t.getHours(),
302              a = t.getMinutes(),
303              l = t.getSeconds(),
304              _ = /([+-]?[0-9]+)\s*(s|m|h|d|w|o|y)?/g,
305              p = _.exec(e);
306            p;
307
308          ) {
309            switch (p[2] || "s") {
310              case "s":
311                l += parseInt(p[1], 10);
312                break;
313              case "m":
314                a += parseInt(p[1], 10);
315                break;
316              case "h":
317                r += parseInt(p[1], 10);
318                break;
319              case "d":
320                o += parseInt(p[1], 10);
321                break;
322              case "w":
323                o += 7 * parseInt(p[1], 10);
324                break;
325              case "o":
326                (n += parseInt(p[1], 10)), (o = Math.min(o, i._getDaysInMonth(s, n)));
327                break;
328              case "y":
329                (s += parseInt(p[1], 10)), (o = Math.min(o, i._getDaysInMonth(s, n)));
330            }
331            p = _.exec(e);
332          }
333          return new Date(s, n, o, r, a, l, 0);
334        },
335        o = null == e ? t : "string" == typeof e ? n(e) : "number" == typeof e ? s(e) : e;
336      return o && o.setMilliseconds(0), o;
337    },
338    _getDaysInMonth: function (e, t) {
339      return 32 - new Date(e, t, 32).getDate();
340    },
341    _normalLabels: function (e) {
342      return e;
343    },
344    _generateHTML: function (t) {
345      var _ = this;
346      t._periods = t._hold ? t._periods : this._calculatePeriods(t, t._show, t.options.significant, new Date());
347      for (var p = !1, c = 0, u = t.options.significant, d = e.extend({}, t._show), h = i; l >= h; h++)
348        (p |= "?" == t._show[h] && t._periods[h] > 0),
349          (d[h] = "?" != t._show[h] || p ? t._show[h] : null),
350          (c += d[h] ? 1 : 0),
351          (u -= t._periods[h] > 0 ? 1 : 0);
352      for (var m = [!1, !1, !1, !1, !1, !1, !1], h = l; h >= i; h--)
353        t._show[h] && (t._periods[h] ? (m[h] = !0) : ((m[h] = u > 0), u--));
354      var g = t.options.compact ? t.options.compactLabels : t.options.labels,
355        f = t.options.whichLabels || this._normalLabels,
356        w = function (e) {
357          var i = t.options["compactLabels" + f(t._periods[e])];
358          return d[e] ? _._translateDigits(t, t._periods[e]) + (i ? i[e] : g[e]) + " " : "";
359        },
360        y = t.options.padZeroes ? 2 : 1,
361        v = function (e) {
362          var i = t.options["labels" + f(t._periods[e])];
363          return (!t.options.significant && d[e]) || (t.options.significant && m[e])
364            ? '<span class="' +
365                _._sectionClass +
366                '"><span class="' +
367                _._amountClass +
368                '">' +
369                _._minDigits(t, t._periods[e], y) +
370                '</span><span class="' +
371                _._periodClass +
372                '">' +
373                (i ? i[e] : g[e]) +
374                "</span></span>"
375            : "";
376        };
377      return t.options.layout
378        ? this._buildLayout(t, d, t.options.layout, t.options.compact, t.options.significant, m)
379        : (t.options.compact
380            ? '<span class="' +
381              this._rowClass +
382              " " +
383              this._amountClass +
384              (t._hold ? " " + this._holdingClass : "") +
385              '">' +
386              w(i) +
387              w(s) +
388              w(n) +
389              w(o) +
390              (d[r] ? this._minDigits(t, t._periods[r], 2) : "") +
391              (d[a] ? (d[r] ? t.options.timeSeparator : "") + this._minDigits(t, t._periods[a], 2) : "") +
392              (d[l] ? (d[r] || d[a] ? t.options.timeSeparator : "") + this._minDigits(t, t._periods[l], 2) : "")
393            : '<span class="' +
394              this._rowClass +
395              " " +
396              this._showClass +
397              (t.options.significant || c) +
398              (t._hold ? " " + this._holdingClass : "") +
399              '">' +
400              v(i) +
401              v(s) +
402              v(n) +
403              v(o) +
404              v(r) +
405              v(a) +
406              v(l)) +
407            "</span>" +
408            (t.options.description
409              ? '<span class="' + this._rowClass + " " + this._descrClass + '">' + t.options.description + "</span>"
410              : "");
411    },
412    _buildLayout: function (t, _, p, c, u, d) {
413      for (
414        var h = t.options[c ? "compactLabels" : "labels"],
415          m = t.options.whichLabels || this._normalLabels,
416          g = function (e) {
417            return (t.options[(c ? "compactLabels" : "labels") + m(t._periods[e])] || h)[e];
418          },
419          f = function (e, i) {
420            return t.options.digits[Math.floor(e / i) % 10];
421          },
422          w = {
423            desc: t.options.description,
424            sep: t.options.timeSeparator,
425            yl: g(i),
426            yn: this._minDigits(t, t._periods[i], 1),
427            ynn: this._minDigits(t, t._periods[i], 2),
428            ynnn: this._minDigits(t, t._periods[i], 3),
429            y1: f(t._periods[i], 1),
430            y10: f(t._periods[i], 10),
431            y100: f(t._periods[i], 100),
432            y1000: f(t._periods[i], 1e3),
433            ol: g(s),
434            on: this._minDigits(t, t._periods[s], 1),
435            onn: this._minDigits(t, t._periods[s], 2),
436            onnn: this._minDigits(t, t._periods[s], 3),
437            o1: f(t._periods[s], 1),
438            o10: f(t._periods[s], 10),
439            o100: f(t._periods[s], 100),
440            o1000: f(t._periods[s], 1e3),
441            wl: g(n),
442            wn: this._minDigits(t, t._periods[n], 1),
443            wnn: this._minDigits(t, t._periods[n], 2),
444            wnnn: this._minDigits(t, t._periods[n], 3),
445            w1: f(t._periods[n], 1),
446            w10: f(t._periods[n], 10),
447            w100: f(t._periods[n], 100),
448            w1000: f(t._periods[n], 1e3),
449            dl: g(o),
450            dn: this._minDigits(t, t._periods[o], 1),
451            dnn: this._minDigits(t, t._periods[o], 2),
452            dnnn: this._minDigits(t, t._periods[o], 3),
453            d1: f(t._periods[o], 1),
454            d10: f(t._periods[o], 10),
455            d100: f(t._periods[o], 100),
456            d1000: f(t._periods[o], 1e3),
457            hl: g(r),
458            hn: this._minDigits(t, t._periods[r], 1),
459            hnn: this._minDigits(t, t._periods[r], 2),
460            hnnn: this._minDigits(t, t._periods[r], 3),
461            h1: f(t._periods[r], 1),
462            h10: f(t._periods[r], 10),
463            h100: f(t._periods[r], 100),
464            h1000: f(t._periods[r], 1e3),
465            ml: g(a),
466            mn: this._minDigits(t, t._periods[a], 1),
467            mnn: this._minDigits(t, t._periods[a], 2),
468            mnnn: this._minDigits(t, t._periods[a], 3),
469            m1: f(t._periods[a], 1),
470            m10: f(t._periods[a], 10),
471            m100: f(t._periods[a], 100),
472            m1000: f(t._periods[a], 1e3),
473            sl: g(l),
474            sn: this._minDigits(t, t._periods[l], 1),
475            snn: this._minDigits(t, t._periods[l], 2),
476            snnn: this._minDigits(t, t._periods[l], 3),
477            s1: f(t._periods[l], 1),
478            s10: f(t._periods[l], 10),
479            s100: f(t._periods[l], 100),
480            s1000: f(t._periods[l], 1e3),
481          },
482          y = p,
483          v = i;
484        l >= v;
485        v++
486      ) {
487        var D = "yowdhms".charAt(v),
488          T = new RegExp("\\{" + D + "<\\}([\\s\\S]*)\\{" + D + ">\\}", "g");
489        y = y.replace(T, (!u && _[v]) || (u && d[v]) ? "$1" : "");
490      }
491      return (
492        e.each(w, function (e, t) {
493          var i = new RegExp("\\{" + e + "\\}", "g");
494          y = y.replace(i, t);
495        }),
496        y
497      );
498    },
499    _minDigits: function (e, t, i) {
500      return (
501        (t = "" + t),
502        t.length >= i
503          ? this._translateDigits(e, t)
504          : ((t = "0000000000" + t), this._translateDigits(e, t.substr(t.length - i)))
505      );
506    },
507    _translateDigits: function (e, t) {
508      return ("" + t).replace(/[0-9]/g, function (t) {
509        return e.options.digits[t];
510      });
511    },
512    _determineShow: function (e) {
513      var t = e.options.format,
514        _ = [];
515      return (
516        (_[i] = t.match("y") ? "?" : t.match("Y") ? "!" : null),
517        (_[s] = t.match("o") ? "?" : t.match("O") ? "!" : null),
518        (_[n] = t.match("w") ? "?" : t.match("W") ? "!" : null),
519        (_[o] = t.match("d") ? "?" : t.match("D") ? "!" : null),
520        (_[r] = t.match("h") ? "?" : t.match("H") ? "!" : null),
521        (_[a] = t.match("m") ? "?" : t.match("M") ? "!" : null),
522        (_[l] = t.match("s") ? "?" : t.match("S") ? "!" : null),
523        _
524      );
525    },
526    _calculatePeriods: function (e, t, _, p) {
527      (e._now = p), e._now.setMilliseconds(0);
528      var c = new Date(e._now.getTime());
529      e._since
530        ? p.getTime() < e._since.getTime()
531          ? (e._now = p = c)
532          : (p = e._since)
533        : (c.setTime(e._until.getTime()), p.getTime() > e._until.getTime() && (e._now = p = c));
534      var u = [0, 0, 0, 0, 0, 0, 0];
535      if (t[i] || t[s]) {
536        var d = this._getDaysInMonth(p.getFullYear(), p.getMonth()),
537          h = this._getDaysInMonth(c.getFullYear(), c.getMonth()),
538          m = c.getDate() == p.getDate() || (c.getDate() >= Math.min(d, h) && p.getDate() >= Math.min(d, h)),
539          g = function (e) {
540            return 60 * (60 * e.getHours() + e.getMinutes()) + e.getSeconds();
541          },
542          f = Math.max(
543            0,
544            12 * (c.getFullYear() - p.getFullYear()) +
545              c.getMonth() -
546              p.getMonth() +
547              ((c.getDate() < p.getDate() && !m) || (m && g(c) < g(p)) ? -1 : 0)
548          );
549        (u[i] = t[i] ? Math.floor(f / 12) : 0), (u[s] = t[s] ? f - 12 * u[i] : 0), (p = new Date(p.getTime()));
550        var w = p.getDate() == d,
551          y = this._getDaysInMonth(p.getFullYear() + u[i], p.getMonth() + u[s]);
552        p.getDate() > y && p.setDate(y),
553          p.setFullYear(p.getFullYear() + u[i]),
554          p.setMonth(p.getMonth() + u[s]),
555          w && p.setDate(y);
556      }
557      var v = Math.floor((c.getTime() - p.getTime()) / 1e3),
558        D = function (e, i) {
559          (u[e] = t[e] ? Math.floor(v / i) : 0), (v -= u[e] * i);
560        };
561      if ((D(n, 604800), D(o, 86400), D(r, 3600), D(a, 60), D(l, 1), v > 0 && !e._since))
562        for (var T = [1, 12, 4.3482, 7, 24, 60, 60], M = l, S = 1, b = l; b >= i; b--)
563          t[b] && (u[M] >= S && ((u[M] = 0), (v = 1)), v > 0 && (u[b]++, (v = 0), (M = b), (S = 1))), (S *= T[b]);
564      if (_) for (var b = i; l >= b; b++) _ && u[b] ? _-- : _ || (u[b] = 0);
565      return u;
566    },
567  });
568})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.