PageSourceSearch

https://ush.edu.vn/themes/default/js/comment.js?t=1782977348

js ush.edu.vn collected 2026-10-02 22:59:12 UTC 7,112 bytes, 186 lines download raw bytes

1/**
2 * TMS Content Management System
3 * @version 4.x
4 * @author Tập Đoàn TMS Holdings <[email protected]>
5 * @copyright (C) 2009-2021 Tập Đoàn TMS Holdings. All rights reserved
6 * @license GNU/GPL version 2 or any later version
7 * @see https://tms.vn
8 */
9
10function commReset(form) {
11    formChangeCaptcha(form);
12    $("[name=pid]", form).val(0);
13    $(form)[0].reset();
14    if ($(form).data('editor')) {
15        CKEDITOR.instances['commentcontent'].setData('', function() {
16            this.updateElement()
17        })
18    }
19}
20
21function commFeedback(cid, post_name) {
22    if ($('#formcomment form').length) {
23        $("#formcomment form [name=pid]").val(cid);
24        var data = $('#formcomment form').data();
25        if (data.editor) {
26            CKEDITOR.instances['commentcontent'].insertText("@" + post_name + " ");
27        } else {
28            $("#formcomment form [name=content]").focus();
29            $("#formcomment form [name=content]").val("@" + post_name + " ");
30        }
31    }
32}
33
34function commLike(cid, checkss, like) {
35    $.post(nv_base_siteurl + 'index.php?' + nv_lang_variable + '=' + nv_lang_data + '&' + nv_name_variable + '=comment&' + nv_fc_variable + '=like&nocache=' + new Date().getTime(), 'cid=' + cid + '&like=' + like + '&checkss=' + checkss, function(res) {
36        var rs = res.split('_');
37        if (rs[0] == 'OK') {
38            $("#" + rs[1]).text(rs[2]);
39        } else if (rs[0] == 'ERR') {
40            alert(rs[1]);
41        }
42    });
43}
44
45function commentDelete(cid, checkss) {
46    if (confirm(nv_is_del_confirm[0])) {
47        $.post(nv_base_siteurl + 'index.php?' + nv_lang_variable + '=' + nv_lang_data + '&' + nv_name_variable + '=comment&' + nv_fc_variable + '=delete&nocache=' + new Date().getTime(), 'cid=' + cid + '&checkss=' + checkss, function(res) {
48            var rs = res.split('_');
49            if (rs[0] == 'OK') {
50                var data = $('#idcomment').data();
51                $("#showcomment").load(nv_base_siteurl + 'index.php?' + nv_lang_variable + '=' + nv_lang_data + '&' + nv_name_variable + '=comment&module=' + data.module + '&area=' + data.area + '&id=' + data.id + '&allowed=' + data.allowed + '&checkss=' + data.checkss + '&comment_load=1&nocache=' + new Date().getTime());
52            } else if (rs[0] == 'ERR') {
53                alert(rs[1]);
54            }
55        });
56    }
57}
58
59function nv_commment_reload(res) {
60    var rs = res.split('_');
61    var data = $('#idcomment').data();
62    if (rs[0] == 'OK') {
63        $("#showcomment").load(nv_base_siteurl + 'index.php?' + nv_lang_variable + '=' + nv_lang_data + '&' + nv_name_variable + '=comment&module=' + data.module + '&area=' + data.area + '&id=' + data.id + '&allowed=' + data.allowed + '&status_comment=' + rs[1] + '&checkss=' + data.checkss + '&comment_load=1&nocache=' + new Date().getTime(), function() {
64            $("#formcomment form .reset").trigger("click")
65        });
66        $('html, body').animate({
67            scrollTop: $("#idcomment").offset().top
68        }, 800);
69    } else {
70        formChangeCaptcha( $("#formcomment form"));
71        if (rs[0] == 'ERR') {
72            alert(rs[2]);
73            "" != rs[1] && $("#formcomment form [name=" + rs[1] + "]:visible").length && $("#formcomment form [name=" + rs[1] + "]").focus()
74        } else {
75            alert(nv_content_failed);
76        }
77    }
78}
79
80function commFormSubmit(form) {
81    var name = strip_tags(trim($("[name=name]", form).val()));
82    if ("" == name) {
83        alert(nv_fullname);
84        $("[name=name]", form).focus();
85        return !1
86    }
87
88    var email = trim($("[name=email]", form).val());
89    if (!(email.length >= 7 && nv_mailfilter.test(email))) {
90        alert(nv_error_email);
91        $("[name=email]", form).focus();
92        return !1
93    }
94
95    if ($(form).data('editor')) {
96        CKEDITOR.instances['commentcontent'].updateElement()
97    }
98    var content = strip_tags(trim($("[name=content]", form).val()));
99    if ("" == content) {
100        alert(nv_content);
101        $("[name=content]", form).focus();
102        return !1
103    }
104
105    if ($("[name=code]:visible", form).length) {
106        var gfx_count = parseInt($("[name=code]", form).attr('maxlength')),
107            code = trim($("[name=code]", form).val());
108        if (gfx_count != code.length) {
109            error = nv_error_seccode.replace(/\[num\]/g, gfx_count);
110            alert(error);
111            $("[name=code]", form).focus();
112            return !1
113        }
114    }
115    return !0
116}
117
118function nv_comment_sort_change(sel) {
119    var data = $('#idcomment').data();
120    $.post(nv_base_siteurl + 'index.php?' + nv_lang_variable + '=' + nv_lang_data + '&' + nv_name_variable + '=comment&module=' + data.module + '&area=' + data.area + '&id=' + data.id + '&allowed=' + data.allowed + '&checkss=' + data.checkss + '&comment_load=1' + '&nocache=' + new Date().getTime(), 'sortcomm=' + $(sel).val(), function(res) {
121        $('#showcomment').html(res);
122    });
123}
124
125$(function() {
126    var commentform = $('#formcomment form');
127    if (commentform.length) {
128        // Gửi comment khi ấn Ctrl + Enter
129        var data = commentform.data();
130        if (data.editor) {
131            CKEDITOR.instances['commentcontent'].on('key', function(event) {
132                if (event.data.keyCode === 1114125) {
133                    $('[type=submit]', commentform).trigger('click')
134                }
135            });
136        } else {
137            $('#commentcontent').on("keydown", function(e) {
138                if (e.ctrlKey && e.keyCode == 13) {
139                    $('[type=submit]', commentform).trigger('click')
140                }
141            });
142        }
143
144        // Comment form submit button
145        commentform.on('submit', function() {
146            return commFormSubmit(this)
147        });
148
149        // Comment form reset button
150        $('[data-toggle=commReset]', commentform).on('click', function(e) {
151            e.preventDefault();
152            commReset($(this).parents('form'))
153        });
154    }
155
156    // Sắp xếp comments
157    $('[data-toggle=nv_comment_sort_change]').on('change', function(e) {
158        e.preventDefault();
159        nv_comment_sort_change(this)
160    });
161
162    // Hiển thị/giấu danh sách comments
163    $('[data-toggle=commListShow][data-obj]').on('click', function(e) {
164        e.preventDefault();
165        $('[class*=fa-]', this).toggleClass('fa-eye fa-eye-slash');
166        $($(this).data('obj')).toggleClass('hidden')
167    });
168
169    // Xóa comment
170    $('body').on('click', '[data-toggle=commDelete][data-cid][data-checkss]', function(e) {
171        e.preventDefault();
172        commentDelete($(this).data('cid'), $(this).data('checkss'))
173    });
174
175    // Trả lời comment
176    $('body').on('click', '[data-toggle=commFeedback][data-cid][data-postname]', function(e) {
177        e.preventDefault();
178        commFeedback($(this).data('cid'), $(this).data('postname'))
179    });
180
181    // Like/dislike
182    $('body').on('click', '[data-toggle=commLike][data-cid][data-checkss][data-like]', function(e) {
183        e.preventDefault();
184        commLike($(this).data('cid'), $(this).data('checkss'), $(this).data('like'))
185    });
186});

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.