PageSourceSearch

https://fosacha.vn/admin/js/customize.js?ver=1790260121

js fosacha.vn collected 2026-09-24 14:29:23 UTC 4,035 bytes, 96 lines download raw bytes

1$(document).ready(function () {
2    if ($('.select2').length) {
3        $('.select2').select2({
4            height: '34px'
5        });
6    }
7
8    if ($('.fixed-top').length) {
9        $('.fixed-top').delay(5000).slideUp();
10    }
11
12    let filterMenuValue = localStorage.getItem('filterMenuValue');
13    if (filterMenuValue && filterMenuValue.length > 0) {
14        filterMenuSidebar(filterMenuValue);
15        $('#filterMenuValue').val(filterMenuValue.trim());
16    }
17    $('.auto__generate_slug').on('keyup', function(){
18        const detectElement = $(this).attr('data-slug');
19        const value = $(this).val();
20        if(detectElement && $('#' + detectElement).length){
21            $('#' + detectElement).val(nonAccentVietnamese(value).replaceAll(' ', '-'));
22        }
23    })
24});
25
26function nonAccentVietnamese(str) {
27    str = str.toLowerCase();
28//     We can also use this instead of from line 11 to line 17
29//     str = str.replace(/\u00E0|\u00E1|\u1EA1|\u1EA3|\u00E3|\u00E2|\u1EA7|\u1EA5|\u1EAD|\u1EA9|\u1EAB|\u0103|\u1EB1|\u1EAF|\u1EB7|\u1EB3|\u1EB5/g, "a");
30//     str = str.replace(/\u00E8|\u00E9|\u1EB9|\u1EBB|\u1EBD|\u00EA|\u1EC1|\u1EBF|\u1EC7|\u1EC3|\u1EC5/g, "e");
31//     str = str.replace(/\u00EC|\u00ED|\u1ECB|\u1EC9|\u0129/g, "i");
32//     str = str.replace(/\u00F2|\u00F3|\u1ECD|\u1ECF|\u00F5|\u00F4|\u1ED3|\u1ED1|\u1ED9|\u1ED5|\u1ED7|\u01A1|\u1EDD|\u1EDB|\u1EE3|\u1EDF|\u1EE1/g, "o");
33//     str = str.replace(/\u00F9|\u00FA|\u1EE5|\u1EE7|\u0169|\u01B0|\u1EEB|\u1EE9|\u1EF1|\u1EED|\u1EEF/g, "u");
34//     str = str.replace(/\u1EF3|\u00FD|\u1EF5|\u1EF7|\u1EF9/g, "y");
35//     str = str.replace(/\u0111/g, "d");
36    str = str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g, "a");
37    str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g, "e");
38    str = str.replace(/ì|í|ị|ỉ|ĩ/g, "i");
39    str = str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g, "o");
40    str = str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g, "u");
41    str = str.replace(/ỳ|ý|ỵ|ỷ|ỹ/g, "y");
42    str = str.replace(/đ/g, "d");
43    // Some system encode vietnamese combining accent as individual utf-8 characters
44    str = str.replace(/\u0300|\u0301|\u0303|\u0309|\u0323/g, ""); // Huyền sắc hỏi ngã nặng 
45    str = str.replace(/\u02C6|\u0306|\u031B/g, ""); // Â, Ê, Ă, Ơ, Ư
46    return str;
47}
48
49// $(document).tooltip({
50//     position: { my: "center bottom", at: "center top-5",  collision: "flipfit" },
51// });
52
53function to_slug(str='')
54{
55    if (!str) {
56        str = '';
57    }
58    // Chuyển hết sang chữ thường
59    str = str.toLowerCase().trim();     
60    // xóa dấu
61    str = str.replace(/(à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ)/g, 'a');
62    str = str.replace(/(è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ)/g, 'e');
63    str = str.replace(/(ì|í|ị|ỉ|ĩ)/g, 'i');
64    str = str.replace(/(ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ)/g, 'o');
65    str = str.replace(/(ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ)/g, 'u');
66    str = str.replace(/(ỳ|ý|ỵ|ỷ|ỹ)/g, 'y');
67    str = str.replace(/(đ)/g, 'd');
68 
69    // Xóa ký tự đặc biệt
70    str = str.replace(/([^0-9a-z-\s])/g, '');
71 
72    // Xóa khoảng trắng thay bằng ký tự -
73    str = str.replace(/(\s+)/g, '-');
74 
75    // xóa phần dự - ở đầu
76    str = str.replace(/^-+/g, '');
77 
78    // xóa phần dư - ở cuối
79    str = str.replace(/-+$/g, '');
80    // return
81    return str;
82}
83
84function filterMenuSidebar(value='') {
85    $('.sidebar-nav ul li.nav-item').not(':first').filter(function (){
86        if ($(this).hasClass('nav-dropdown')) {
87            if (!$(this).hasClass('open')) {
88                $(this).addClass('open');
89            }
90        }
91        let item = to_slug($(this).text());
92        localStorage.setItem('filterMenuValue', value);
93        $(this).toggle(item.indexOf(to_slug(value)) > -1);
94    });
95}
96

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.