PageSourceSearch

https://ush.edu.vn/assets/js/global.js?t=1782977348

js ush.edu.vn collected 2026-10-02 22:58:50 UTC 16,277 bytes, 468 lines download raw bytes

1
2/**
3 * TMS Content Management System
4 * @version 4.x
5 * @author Tập Đoàn TMS Holdings <[email protected]>
6 * @copyright (C) 2009-2021 Tập Đoàn TMS Holdings. All rights reserved
7 * @license GNU/GPL version 2 or any later version
8 * @see https://tms.vn
9 */
10var nv_base_siteurl, nv_assets_dir, nv_lang_data, nv_lang_interface, nv_name_variable, nv_fc_variable, nv_lang_variable, nv_module_name, nv_func_name, nv_is_user, nv_area_admin, nv_my_ofs, nv_my_dst, nv_my_abbr, nv_cookie_prefix, nv_check_pass_mstime, theme_responsive, nv_safemode;
11var OP = -1 != navigator.userAgent.indexOf("Opera"),
12    IE = -1 != navigator.userAgent.indexOf("MSIE") && !OP,
13    GK = -1 != navigator.userAgent.indexOf("Gecko"),
14    SA = -1 != navigator.userAgent.indexOf("Safari"),
15    DOM = document.getElementById,
16    NS4 = document.layers,
17    nv_mailfilter = /^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,
18    nv_numcheck = /^([0-9])+$/,
19    nv_namecheck = /^([a-zA-Z0-9_-])+$/,
20    nv_uname_filter = /^([\p{L}\p{Mn}\p{Pd}'][\p{L}\p{Mn}\p{Pd}',\s]*)*$/u,
21    nv_unicode_login_pattern = /^[\p{L}\p{Mn}0-9]+([\s]+[\p{L}\p{Mn}0-9]+)*$/u,
22    nv_md5check = /^[a-z0-9]{32}$/,
23    nv_imgexts = /^.+\.(jpg|gif|png|bmp)$/,
24    nv_iChars = "!@#$%^&*()+=-[]\\';,./{}|\":<>?",
25    nv_specialchars = /\$|,|@|#|~|`|\%|\*|\^|\&|\(|\)|\+|\=|\[|\-|\_|\]|\[|\}|\{|\;|\:|\'|\"|\<|\>|\?|\||\\|\!|\$|\./g,
26    nv_old_Minute = -1,
27    strHref = window.location.href,
28    script_name = strHref,
29    query_string = "";
30
31void 0 === nv_base_siteurl && (nv_base_siteurl = "/");
32void 0 === nv_assets_dir && (nv_assets_dir = "assets");
33void 0 === nv_lang_data && (nv_lang_data = "en");
34void 0 === nv_lang_interface && (nv_lang_interface = "en");
35void 0 === nv_name_variable && (nv_name_variable = "nv");
36void 0 === nv_fc_variable && (nv_fc_variable = "op");
37void 0 === nv_lang_variable && (nv_lang_variable = "language");
38void 0 === nv_module_name && (nv_module_name = "");
39void 0 === nv_func_name && (nv_func_name = "");
40void 0 === nv_is_user && (nv_is_user = 0);
41void 0 === nv_area_admin && (nv_area_admin = 0);
42void 0 === nv_my_ofs && (nv_my_ofs = 7);
43void 0 === nv_my_dst && (nv_my_dst = !1);
44void 0 === nv_my_abbr && (nv_my_abbr = "ICT");
45void 0 === nv_cookie_prefix && (nv_cookie_prefix = "nv4");
46void 0 === nv_check_pass_mstime && (nv_check_pass_mstime = 1738E3);
47void 0 === theme_responsive && (theme_responsive = 0);
48void 0 === nv_safemode && (nv_safemode = 0);
49
50-
511 < strHref.indexOf("?") && ([script_name, query_string] = strHref.split("?"));
52
53function nv_email_check(field_id) {
54    return 7 <= field_id.value.length && nv_mailfilter.test(field_id.value)
55}
56
57function nv_num_check(field_id) {
58    return 1 <= field_id.value.length && nv_numcheck.test(field_id.value)
59}
60
61function nv_name_check(field_id) {
62    return "" != field_id.value && nv_namecheck.test(field_id.value)
63}
64
65function nv_md5_check(field_id) {
66    return nv_md5check.test(field_id.value)
67}
68
69function nv_iChars_check(field_id) {
70    for (var a = 0; a < field_id.value.length; a++)
71        if (-1 != nv_iChars.indexOf(field_id.value.charAt(a))) return !0;
72    return !1
73}
74
75function nv_iChars_Remove(str) {
76    return str.replace(nv_specialchars, "");
77}
78
79function nv_setCookie(name, value, expiredays, secure, SameSite) {
80    var a, domainName = document.domain;
81    expiredays = expiredays ? ((a = new Date).setDate(a.getDate() + expiredays), "; expires=" + a.toGMTString()) : "";
82    domainName = domainName.replace(/www\./g, "");
83    domainName = /^([0-9a-z][0-9a-z-]+\.)+[a-z]{2,}$/i.test(domainName) ? "; domain=." + domainName : "";
84    secure = void 0 !== secure && secure ? "; secure" : "";
85    SameSite = void 0 !== SameSite && ("Lax" == SameSite || "Strict" == SameSite || "None" == SameSite && "" != secure) ? "; SameSite=" + SameSite : "";
86    document.cookie = name + "=" + escape(value) + expiredays + domainName + "; path=" + nv_base_siteurl + SameSite + secure
87}
88
89function nv_getCookie(name) {
90    var cookie = " " + document.cookie,
91        search = " " + name + "=",
92        offset = 0,
93        end = 0;
94    return 0 < cookie.length && (offset = cookie.indexOf(search), -1 != offset) ? (offset += search.length, end = cookie.indexOf(";", offset), -1 == end && (end = cookie.length), unescape(cookie.substring(offset, end))) : null
95}
96
97function nv_check_timezone() {
98    var domainName = document.domain,
99        cookieName = nv_cookie_prefix + '_cltz',
100        currentTime = new Date(),
101        summerTime = new Date(Date.UTC(2005, 6, 30, 0, 0, 0, 0)),
102        winterTime = new Date(Date.UTC(2005, 12, 30, 0, 0, 0, 0)),
103        cookieVal;
104    domainName = domainName.replace(/www\./g, "");
105    domainName = /^([0-9a-z][0-9a-z-]+\.)+[a-z]{2,}$/i.test(domainName) ? "." + domainName : "";
106    cookieVal = -summerTime.getTimezoneOffset() + "." + -winterTime.getTimezoneOffset() + "." + -currentTime.getTimezoneOffset() + "|" + nv_base_siteurl + "|" + domainName;
107    rawurldecode(nv_getCookie(cookieName)) != cookieVal && nv_setCookie(cookieName, rawurlencode(cookieVal), 365, "https:" === location.protocol ? !0 : !1, "Strict")
108}
109
110function is_array(mixed_var) {
111    return (mixed_var instanceof Array);
112}
113
114function strip_tags(str, allowed_tags) {
115    var key = '',
116        allowed = false,
117        matches = [],
118        allowed_array = [],
119        allowed_tag = '',
120        i = 0,
121        k = '',
122        html = '';
123    var replacer = function(search, replace, str) {
124        return str.split(search).join(replace);
125    };
126    // Build allowes tags associative array
127    if (allowed_tags) {
128        allowed_array = allowed_tags.match(/([a-zA-Z0-9]+)/gi);
129    }
130
131    str += '';
132
133    // Match tags
134    matches = str.match(/(<\/?[\S][^>]*>)/gi);
135
136    // Go through all HTML tags
137    for (key in matches) {
138        if (isNaN(key)) {
139            // IE7 Hack
140            continue;
141        }
142
143        // Save HTML tag
144        html = matches[key].toString();
145
146        // Is tag not in allowed list ? Remove from str !
147        allowed = false;
148
149        // Go through all allowed tags
150        for (k in allowed_array) {
151            // Init
152            allowed_tag = allowed_array[k];
153            i = -1;
154
155            if (i != 0) {
156                i = html.toLowerCase().indexOf('<' + allowed_tag + '>');
157            }
158            if (i != 0) {
159                i = html.toLowerCase().indexOf('<' + allowed_tag + ' ');
160            }
161            if (i != 0) {
162                i = html.toLowerCase().indexOf('</' + allowed_tag);
163            }
164
165            // Determine
166            if (i == 0) {
167                allowed = true;
168                break;
169            }
170        }
171
172        if (!allowed) {
173            str = replacer(html, "", str);
174            // Custom replace. No regexing
175        }
176    }
177
178    return str;
179}
180
181// trim(' Kevin van Zonneveld ');
182function trim(str, charlist) {
183    var whitespace,
184        l = 0,
185        i = 0;
186
187    str += '';
188
189    if (!charlist) {
190        whitespace = " \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000";
191    } else {
192        charlist += '';
193        whitespace = charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '$1');
194    }
195
196    l = str.length;
197    for (i = 0; i < l; i++) {
198        if (whitespace.indexOf(str.charAt(i)) === -1) {
199            str = str.substring(i);
200            break;
201        }
202    }
203
204    l = str.length;
205    for (i = l - 1; i >= 0; i--) {
206        if (whitespace.indexOf(str.charAt(i)) === -1) {
207            str = str.substring(0, i + 1);
208            break;
209        }
210    }
211
212    return whitespace.indexOf(str.charAt(0)) === -1 ? str : '';
213}
214
215// rawurlencode('Kevin van Zonneveld!'); = > 'Kevin%20van%20Zonneveld%21'
216function rawurlencode(str) {
217    str = (str + '').toString();
218    return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%5B').replace(/\)/g, '%5D').replace(/\*/g, '%2A');
219}
220
221// rawurldecode('Kevin+van+Zonneveld%21'); = > 'Kevin+van+Zonneveld!'
222function rawurldecode(str) {
223    return decodeURIComponent(str);
224}
225
226function is_numeric(mixed_var) {
227    return !isNaN(mixed_var);
228}
229
230function intval(mixed_var, base) {
231    var type = typeof(mixed_var);
232
233    if (type === 'boolean') {
234        return (mixed_var) ? 1 : 0;
235    } else if (type === 'string') {
236        tmp = parseInt(mixed_var, base || 10);
237        return (isNaN(tmp) || !isFinite(tmp)) ? 0 : tmp;
238    } else if (type === 'number' && isFinite(mixed_var)) {
239        return Math.floor(mixed_var);
240    } else {
241        return 0;
242    }
243}
244
245/**
246 * This function is same as PHP's nl2br() with default parameters.
247 *
248 * @param {string} str Input text
249 * @param {boolean} replaceMode Use replace instead of insert
250 * @param {boolean} isXhtml Use XHTML 
251 * @return {string} Filtered text
252 */
253function nl2br(str, replaceMode, isXhtml) {
254    var breakTag = (isXhtml) ? '<br />' : '<br>';
255    var replaceStr = (replaceMode) ? '$1' + breakTag : '$1' + breakTag + '$2';
256    return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, replaceStr);
257}
258
259/**
260 * This function inverses text from PHP's nl2br() with default parameters.
261 *
262 * @param {string} str Input text
263 * @param {boolean} replaceMode Use replace instead of insert
264 * @return {string} Filtered text
265 */
266function br2nl(str, replaceMode) {
267    var replaceStr = (replaceMode) ? "\n" : '';
268    // Includes <br>, <BR>, <br />, </br>
269    return (str + '').replace(/<\s*\/?br\s*[\/]?>/gi, replaceStr);
270}
271
272function nv_is_dst() {
273    var now = new Date();
274    var dst_start = new Date();
275    var dst_end = new Date();
276    // Set dst start to 2AM 2nd Sunday of March
277    dst_start.setMonth(2);
278    // March
279    dst_start.setDate(1);
280    // 1st
281    dst_start.setHours(2);
282    dst_start.setMinutes(0);
283    dst_start.setSeconds(0);
284    // 2AM
285    // Need to be on first Sunday
286    if (dst_start.getDay())
287        dst_start.setDate(dst_start.getDate() + (7 - dst_start.getDay()));
288    // Set to second Sunday
289    dst_start.setDate(dst_start.getDate() + 7);
290    // Set dst end to 2AM 1st Sunday of November
291    dst_end.setMonth(10);
292    dst_end.setDate(1);
293    dst_end.setHours(2);
294    dst_end.setMinutes(0);
295    dst_end.setSeconds(0);
296    // 2AM
297    // Need to be on first Sunday
298    if (dst_end.getDay())
299        dst_end.setDate(dst_end.getDate() + (7 - dst_end.getDay()));
300    return (now > dst_start && now < dst_end);
301}
302
303function nv_DigitalClock(div_id) {
304    if (document.getElementById(div_id)) {
305        nv_my_dst && nv_is_dst() && (nv_my_ofs += 1);
306
307        var newDate = new Date();
308        newDate.setHours(newDate.getHours() + (newDate.getTimezoneOffset() / 60) + nv_my_ofs);
309
310        var intMinutes = newDate.getMinutes(),
311            intSeconds = newDate.getSeconds();
312
313        if (intMinutes != nv_old_Minute) {
314            nv_old_Minute = intMinutes;
315            var intHours = newDate.getHours(),
316                intDay = newDate.getDay(),
317                intMonth = newDate.getMonth(),
318                intWeekday = newDate.getDate(),
319                intYear = newDate.getYear();
320
321            200 > intYear && (intYear += 1900);
322            var strDayName = new String(nv_aryDayName[intDay]);
323            var strMonthNumber = intMonth + 1;
324            9 >= intHours && (intHours = "0" + intHours);
325            9 >= intMinutes && (intMinutes = "0" + intMinutes);
326            9 >= strMonthNumber && (strMonthNumber = "0" + strMonthNumber);
327            9 >
327= intWeekday && (intWeekday = "0" + intWeekday);
328
329            document.getElementById(div_id).innerHTML = intHours + ':' + intMinutes + ' ' + nv_my_abbr + ' &nbsp; ' + strDayName + ', ' + intWeekday + '/' + strMonthNumber + '/' + intYear;
330        }
331        setTimeout('nv_DigitalClock("' + div_id + '")', (60 - intSeconds) * 1000);
332    }
333}
334
335function nv_show_hidden(div_id, st) {
336    var divid = document.getElementById(div_id);
337    if (st == 2) {
338        if (divid.style.visibility == 'hidden' || divid.style.display == 'none') {
339            divid.style.visibility = 'visible';
340            divid.style.display = 'block';
341        } else {
342            divid.style.visibility = 'hidden';
343            divid.style.display = 'none';
344        }
345    } else if (st == 1) {
346        divid.style.visibility = 'visible';
347        divid.style.display = 'block';
348    } else {
349        divid.style.visibility = 'hidden';
350        divid.style.display = 'none';
351    }
352    return;
353}
354
355function nv_checkAll(oForm, cbName, caName, check_value) {
356    if (typeof oForm == 'undefined' || typeof oForm[cbName] == 'undefined') {
357        return false;
358    }
359    if (oForm[cbName].length) {
360        for (var i = 0; i < oForm[cbName].length; i++) {
361            oForm[cbName][i].checked = check_value;
362        }
363    } else {
364        oForm[cbName].checked = check_value;
365    }
366
367    if (oForm[caName].length) {
368        for (var j = 0; j < oForm[caName].length; j++) {
369            oForm[caName][j].checked = check_value;
370        }
371    } else {
372        oForm[caName].checked = check_value;
373    }
374}
375
376function nv_UncheckAll(oForm, cbName, caName, check_value) {
377    if (typeof oForm == 'undefined' || typeof oForm[cbName] == 'undefined') {
378        return false;
379    }
380    var ts = 0;
381
382    if (oForm[cbName].length) {
383        for (var i = 0; i < oForm[cbName].length; i++) {
384            if (oForm[cbName][i].checked != check_value) {
385                ts = 1;
386                break;
387            }
388        }
389    }
390
391    var chck = false;
392    if (ts == 0) {
393        chck = check_value;
394    }
395
396    if (oForm[caName].length) {
397        for (var j = 0; j < oForm[caName].length; j++) {
398            oForm[caName][j].checked = chck;
399        }
400    } else {
401        oForm[caName].checked = chck;
402    }
403}
404
405function nv_set_disable_false(sid) {
406    if (document.getElementById(sid)) {
407        var sd = document.getElementById(sid);
408        sd.disabled = false;
409    }
410
411}
412
413function nv_settimeout_disable(sid, tm) {
414    var sd = document.getElementById(sid);
415    sd.disabled = true;
416    nv_timer = setTimeout('nv_set_disable_false("' + sid + '")', tm);
417    return nv_timer;
418}
419
420function nv_randomPassword(plength) {
421    var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
422    var pass = "";
423    for (var z = 0; z < plength; z++) {
424        pass += chars.charAt(Math.floor(Math.random() * 62));
425    }
426    return pass;
427}
428
429function nv_urldecode_ajax(my_url, containerid) {
430    my_url = rawurldecode(my_url);
431    $("#" + containerid).load(my_url);
432    return;
433}
434
435function nv_isExternal(url) {
436    var host = window.location.hostname.toLowerCase(),
437        regex = new RegExp('^(?:(?:f|ht)tp(?:s)?\:)?//(?:[^\@]+\@)?([^:/]+)', 'im'),
438        match = url.match(regex),
439        domain = ((match ? match[1].toString() : ((url.indexOf(':') < 0) ? host : ''))).toLowerCase();
440    return domain != host
441}
442
443function nv_open_browse(theURL, winName, w, h, features) {
444    var LeftPosition = (screen.width) ? (screen.width - w) / 2 : 0,
445        TopPosition = (screen.height) ? (screen.height - h) / 2 : 0,
446        settings = 'height=' + h + ',width=' + w + ',top=' + TopPosition + ',left=' + LeftPosition;
447    if (features != '') {
448        settings += ',' + features;
449    }
450    window.open(theURL, winName, settings).focus()
451}
452
453function nv_setIframeHeight(iframeId) {
454    var ifDoc, ifRef = document.getElementById(iframeId);
455    try {
456        ifDoc = ifRef.contentWindow.document.documentElement;
457    } catch (e) {
458        try {
459            ifDoc = ifRef.contentDocument.documentElement;
460        } catch (ee) {}
461    }
462    if (ifDoc) {
463        ifRef.height = 1;
464        ifRef.height = ifDoc.scrollHeight;
465    }
466}
467
468nv_check_timezone();

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.