PageSourceSearch

https://moldfootball.com/front-assets/js/add.js?v=38.12

js moldfootball.com collected 2026-10-02 17:43:06 UTC 9,714 bytes, 237 lines download raw bytes

1var MF_COMMENT_LOGIN_KEY = "mf_comment_login";
2
3function mfSaveCommentLogin(e) {
4    var t = $.trim(String($(e).find("input[name=login]").val() || ""));
5    if (t) try {
6        localStorage.setItem(MF_COMMENT_LOGIN_KEY, t)
7    } catch (e) {}
8}
9
10function mfPrepareCommentForm(e) {
11    var t = $(e),
12        a = $.trim(String(t.find("input[name=password]").val() || ""));
13    a && (t.find("input[name=register_check]").prop("checked", !0), t.find("#comment_register").show())
14}
15
16function mfRestoreCommentLogin() {
17    var e;
18    try {
19        e = localStorage.getItem(MF_COMMENT_LOGIN_KEY)
20    } catch (t) {
21        return
22    }
23    if (!e) return;
24    $("input.comment_login[name=login]:not(:disabled)").each(function () {
25        var t = $(this);
26        $.trim(String(t.val() || "")) || (t.val(e), typeof updateCommentFormCounters === "function" && updateCommentFormCounters(t.closest("form")))
27    })
28}
29
30function mfHideFeedbackResponse() {
31    $(".feedback_response").removeClass("feedback_visible"), $(".feedback_response").html(""), setTimeout(function () {
32        $(".feedback_response").html("")
33    }, 400)
34}
35
36function addComment(e) {
37	var btn = $(e);
38    var t = $(e).data("form-id");
39    $("#" + t).submit(function (e) {
40        e.preventDefault()
41    });
42	
43	if(!btn.attr("disabled")) {
44		btn.attr("disabled", "disabled");
45		var a, s = $("#" + $(e).data("form-id"));
46		mfPrepareCommentForm(s);
47		mfSaveCommentLogin(s);
48		var registeredViaForm = s.find("input[name=register_check]").prop("checked");
49		var n = new FormData(s[0]);
50		$(s) && (a = s.outerHeight(), $("#" + t + " .loader-list").css({
51			height: a,
52			bottom: 0
53		}), $(".error-input").removeClass("error-input"), $.ajax({
54			method: "POST",
55			url: $(s).attr("action"),
56			data: n,
57			enctype: "multipart/form-data",
58			processData: !1,
59			contentType: !1,
60			cache: !1,
61			success: function (e) {
62				btn.removeAttr("disabled");
63				1 == e.status ? (null != e.user && mfSaveCommentLogin(s), null == e.user && ($(s).find("input[type=text], textarea").val(""), mfRestoreCommentLogin()), $(".error-input").removeClass("error-input"), $(".feedback_response").html(e.text), $(".feedback_response").addClass("feedback_visible"), $("textarea[name=comment]").val(""), $("#comments").html(e.comments), typeof updateCommentFormCounters === "function" && updateCommentFormCounters(s), setTimeout(function () {
64					null != e.user && registeredViaForm ? location.reload() : mfHideFeedbackResponse()
65				}, 2e3)) : null != e.messages ? ($.each(e.messages, function (e, t) {
66					$(s).find("[name='" + e + "']").addClass("error-input")
67				}), setTimeout(function () {
68					$(".error-input").removeClass("error-input")
69				}, 4e3)) : ($(".feedback_response").html(e.text), $(".feedback_response").addClass("feedback_err_visible"), setTimeout(function () {
70					$(".feedback_response").removeClass("feedback_err_visible"), setTimeout(function () {
71						$(".feedback_response").html("")
72					}, 400)
73				}, 4e3))
74			},
75			error: function () {
76				btn.removeAttr("disabled");
77				$(".feedback_response").html("Ошибка отправки. Обновите страницу и попробуйте снова.");
78				$(".feedback_response").addClass("feedback_err_visible");
79				setTimeout(function () {
80					$(".feedback_response").removeClass("feedback_err_visible");
81					setTimeout(function () {
82						$(".feedback_response").html("")
83					}, 400)
84				}, 4e3)
85			}
86		}))
87	}
88}
89
90function saveForm(e) {
91    var t = $(e).data("form-id");
92    $("#" + t).submit(function (e) {
93        e.preventDefault()
94    });
95    var a, s = $("#" + $(e).data("form-id")),
96        n = new FormData(s[0]);
97        n.append("payment_data", $("#payment_data").val());
98    $(s) && (a = s.outerHeight(), $("#" + t + " .loader-list").css({
99        height: a,
100        bottom: 0
101    }), $(".error-input").removeClass("error-input"), $.ajax({
102        method: "POST",
103        url: $(s).attr("action"),
104        data: n,
105        enctype: "multipart/form-data",
106        processData: !1,
107        contentType: !1,
108        cache: !1,
109        success: function (e) {
110            1 == e.status ? ($(".feedback_response").html(e.text), $(".feedback_response").addClass("feedback_visible"), setTimeout(function () {
111                $(".feedback_response").removeClass("feedback_visible"), null != e.redirect && window.location.replace(e.redirect)
112            }, 2e3), null != e.chat && $(".discutConcurs").html(e.chat), null == e.score && $(s).find("input[type=text], textarea").val(""), $(".error-input").removeClass("error-input")) : null != e.messages ? ($.each(e.messages, function (e, t) {
113                $(s).find("[name='" + e + "']").addClass("error-input")
114            }), setTimeout(function () {
115                $(".error-input").removeClass("error-input")
116            }, 4e3)) : ($(".feedback_response").html(e.text), $(".feedback_response").addClass("feedback_err_visible"), setTimeout(function () {
117                $(".feedback_response").removeClass("feedback_err_visible"), setTimeout(function () {
118                    location.reload()
119                }, 1e3)
120            }, 4e3))
121        },
122        error: function () {
123            $(".feedback_response").html(response.text), $(".feedback_response").addClass("feedback_err_visible"), setTimeout(function () {
124                $(".feedback_response").removeClass("feedback_err_visible")
125            }, 4e3)
126        }
127    }))
128}
129
130$(document).ready(function () {
131	$("body").removeClass("no-transition");
132    mfRestoreCommentLogin();
133    $(document).on("blur", "input.comment_login[name=login]", function () {
134        mfSaveCommentLogin($(this).closest("form"))
135    });
136    $("html").attr("lang");
137    $("#register_check").on("change", function () {
138        $(this).is(":checked") ? $("#comment_register").fadeIn() : $("#comment_register").fadeOut()
139    }), $(".bonusCheck").on("click", function () {
140        var e = $(this).data("match-id");
141        $("input[name=x2]").val(e)
142    }), $(document).on("click", ".liveMicro", function () {
143        $.ajax({
144            method: "POST",
145            url: "/checkSound/livescoreSound",
146            enctype: "multipart/form-data",
147            processData: !1,
148            contentType: !1,
149            cache: !1,
150            success: function (e) {
151                1 == e.no_sound ? $(".liveMicro").addClass("noSound") : $(".liveMicro").removeClass("noSound")
152            }
153        })
154    })
155});
156
157$(document).ready(function () {
158    $(document).on("click", ".update_comment", function (e) {
159        e.preventDefault();
160        var t = $(this);
161        if (t.hasClass("is-loading")) return;
162        var a = "/" + $("html").attr("lang") + "/updateComments",
163            n = t.data("id"),
164            o = $("#comments");
165        t.addClass("is-loading").attr("aria-busy", "true"), o.addClass("is-updating"), $.ajaxSetup({
166            headers: {
167                "X-CSRF-TOKEN": $('meta[name="_token"]').attr("content")
168            }
169        }), $.ajax({
170            type: "POST",
171            dataType: "JSON",
172            url: a,
173            data: {
174                news_id: n
175            },
176            timeout: 15e3
177        }).done(function (e) {
178            !0 === e.status ? (o.html(e.view), o.removeClass("is-updating").addClass("is-refreshed"), t.addClass("is-success").removeClass("is-error"), setTimeout(function () {
179                o.removeClass("is-refreshed"), t.removeClass("is-success")
180            }, 1200)) : (o.removeClass("is-updating"), t.addClass("is-error"), setTimeout(function () {
181                t.removeClass("is-error")
182            }, 2e3))
183        }).fail(function () {
184            o.removeClass("is-updating"), t.addClass("is-error"), setTimeout(function () {
185                t.removeClass("is-error")
186            }, 2e3)
187        }).always(function () {
188            t.removeClass("is-loading").attr("aria-busy", "false")
189        })
190    })
191});
192
193function mfCommentCharLen(str) {
194	if (!str) return 0;
195	str = String(str).replace(/\r\n/g, "\n").replace(/\r/g, "\n");
196	return Array.from(str).length;
197}
198
199function updateCommentFormCounters(root) {
200	var $scope = root ? $(root) : $(document);
201	$scope.find("textarea[name=comment]").each(function () {
202		var $ta = $(this);
203		var max = parseInt($ta.attr("maxlength"), 10) || 1600;
204		var normalized = String($ta.val() || "").replace(/\r\n/g, "\n").replace(/\r/g, "\n");
205		var chars = Array.from(normalized);
206		if (chars.length > max) {
207			$ta.val(chars.slice(0, max).join(""));
208			chars = Array.from(String($ta.val() || "").replace(/\r\n/g, "\n").replace(/\r/g, "\n"));
209		}
210		var len = chars.length;
211		var $count = $ta.siblings(".comment-char-count");
212		$count.find(".comment-char-count__val").text(len);
213		$count.toggleClass("is-limit", len >= max);
214	});
215	$scope.find("input.comment_login[name=login]").each(function () {
216		$(this).toggleClass("comment_login--warn", mfCommentCharLen($(this).val()) >= 14);
217	});
218}
219
220$(document).ready(function () {
221	updateCommentFormCounters(".formBlock");
222	$(document).on("input", ".formBlock textarea[name=comment]", function () {
223		updateCommentFormCounters($(this).closest("form"));
224	});
225	$(document).on("input", ".formBlock input.comment_login[name=login]", function () {
226		updateCommentFormCounters($(this).closest("form"));
227	});
228});
229
230//запрет на переключение X2 в конкурсной таблице, если уже была сыграна ставка с X2
231$(document).ready(function() {
232    var checked = $(".concursTable input[name='bonus']:checked");
233    var count = $("[name='home_" + checked.data("match-id") + "']").length;
234    if(count == 0 && checked.length != 0) {
235        $(".concursTable input[name='bonus']").attr("disabled", "disabled");
236    }
237})

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.