PageSourceSearch

https://noichinh.vn/common/v2/js/main.js

js noichinh.vn collected 2026-10-02 10:52:37 UTC 10,241 bytes, 337 lines download raw bytes

1jQuery.fn.exists = function(){return this.length>0;};
2
3
4//load menu
5$("#main-menu").html('<li class="active nav-link"><a href="/"><span class="bd"><i class="fa fa-home" aria-hidden="true"></span></i></a></li>');
6var strMenu = '';
7var strMenuFoot = '';
8var order = 1;
9var groups = {};
10$.each($("#parentcate").children(), function() {
11
12	var groupName = $(this).data('parent');
13
14		if (!groups[groupName]) {
15			groups[groupName] = [];
16		}
17
18		groups[groupName].push({title: $(this).html(), url:$(this).attr('class'), order: $(this).attr('data-order')});
19
20})
21
22myMenu = [];
23for (var groupName in groups) {
24		myMenu[groups[groupName][0].order] = {group: groupName, title: groups[groupName][0].title, url: groups[groupName][0].url,  item: groups[groupName]};
25}
26
27for (var i = 0;i < myMenu.length ; i++){
28	var obj = myMenu[i];
29	if(obj) {
30		strMenu += '<li class="nav-link">';
31			strMenu += '<a href="'+obj.url+'" ><span class="bd">'+obj.title+'</span></a>';
32			var item = obj.item;
33			if(item.length > 1) {
34				strMenu += '<ul>';
35				for (var j =0;j < item.length ;j++ ) {
36					if(j>0) {
37						if(obj.title == 'Tin tức') {
38							strMenuFoot += '<li><a href="'+item[j].url+'">'+item[j].title+'</a></li>';
39						}
40						strMenu += '<li><a href="'+item[j].url+'"><span class="bd">'+item[j].title+'</span></a></li>';
41					}
42				}
43				strMenu += '</ul>';
44			}
45		strMenu += '</li>';
46	}
47}
48$("#main-menu").append(strMenu);
49$("#menu_footer").append(strMenuFoot);
50
51jQuery(document).ready(function(){
52
53	$("#now").html(now);
54	jQuery('.scrollbar-inner').scrollbar({
55			"scrollx": "false",
56			"scrolly": "advanced"
57	});
58
59
60
61	//$("." + $("#cate-id").html()).addClass('active');
62	$('#main-menu .nav-link').click(function(){
63    $('#main-menu .nav-link').removeClass('active');
64    $(this).addClass('active');
65})
66
67	$.each( $("#main-menu >li"), function( key, value ) {
68
69		if(key == 0) $(value).addClass('first')
70	});
71	$('#main-menu').smartmenus({
72		subMenusSubOffsetX: 1,
73		subMenusSubOffsetY: -8
74	});
75
76	
77	//icon photo video
78	$(".Photo").append(' <i class="fa fa-camera" aria-hidden="true"></i>');
79	$(".Movie").append(' <i class="fa fa-video-camera" aria-hidden="true"></i>');
80	$(".Song").append(' <i class="fa fa-volume-up" aria-hidden="true"></i>');
81
82	//load_ads();
83
84	$('.carousel[data-type="multi"] .item').each(function() {
85		var next = $(this).next();
86		if (!next.length) {
87			next = $(this).siblings(':first');
88		}
89		next.children(':first-child').clone().appendTo($(this));
90
91		for (var i = 0; i < 2; i++) {
92			next = next.next();
93			if (!next.length) {
94				next = $(this).siblings(':first');
95			}
96
97			next.children(':first-child').clone().appendTo($(this));
98		}
99	});
100
101});
102
103var statVS = function () {
104	this.init = function (id, siteId) {
105		var stat_img_src = '/service/statistic/statcollector.do?u=2';
106		var title = 'NoiChinh';
107		if ($.trim($(id).find('#cate-name').html()) != "") {
108			title = $(id).find('#cate-name').html();
109		}
110		if ($.trim($(id).find('#article-title').html()) != "") {
111			title = $(id).find('#article-title').html();
112		}
113		stat_img_src += '&s=' + siteId;
114		stat_img_src += '&c=' + this.checkValue($(id).find('#cate-id').html());
115		stat_img_src += '&p=' + this.checkValue($(id).find('#article-id').html());
116		stat_img_src += '&t=' + encodeURIComponent(title);
117		stat_img_src += '&cp=' +  Math.random();
118
119		if (!$('#stat_img').is('img')) {
120			$('body').append('<img src="'+ stat_img_src + '" width="0" height="0" style="height: 0;display: none;"/>');
121		}
122	}
123	this.checkValue = function (val) {
124		if (typeof (val) == 'undefined' || val == '' || !$.isNumeric(parseInt(val))) {
125			val = 0;
126		}
127		return val;
128	}
129}
130	try {
131			var stat = new statVS();
132			stat.init('#page-info', 1060);
133		}
134		catch (e) {}
135
136// Hiển thị thời gian
137
138Date.prototype.format = function(config) {
139	this.formatString = config.format;
140	this.lang = (config.lang) ? config.lang : 'vi';
141
142	this.day = this.getDay();
143
144	this.langText = {
145		vi: [
146			'Chủ Nhật',
147			'Thứ Hai',
148			'Thứ Ba',
149			'Thứ Tư',
150			'Thứ Năm',
151			'Thứ Sáu',
152			'Thứ Bảy'
153		],
154		en: [
155			'Sunday',
156			'Monday',
157			'Tuesday',
158			'Wednesday',
159			'Thursday',
160			'Friday',
161			'Saturday'
162		]
163	};
164
165	switch (this.lang) {
166		case 'vi':
167		case 'en':
168		break;
169
170		default:
171			this.lang = 'vi';
172	}
173
174	this.day = this.langText[this.lang][this.day];
175
176	return this.formatString
177		.replace(/DAY/, this.day)
178		.replace(/DD/, this.getDate())
179		.replace(/MM/, this.getMonth() + 1)
180		.replace(/YYYY/, this.getFullYear())
181		.replace(/HH/, this.getHours())
182		.replace(/MI/, this.getMinutes())
183		.replace(/SS/, this.getSeconds())
184};
185
186var now = new Date().format({
187	format: 'DAY, DD/MM/YYYY, HH:MI '
188});
189var now_date = new Date().format({
190	format: 'DAY, DD/MM/YYYY'
191});
192
193function paserDateInt(date) {
194	var m =date.split(' ')[1].split(':')[1];
195	var h =  date.split(' ')[1].split(':')[0];
196	var strdate = date.split(' ')[0].split('/')[1] + '/' + date.split(' ')[0].split('/')[0]+ '/' + date.split(' ')[0].split('/')[2]+ ' ' + h + ':' + m;
197	return Date.parse(strdate);
198}
199
200function paserDateString(date, duration) {
201	var m =date.split(' ')[1].split(':')[1];
202	var h =  date.split(' ')[1].split(':')[0];
203	var strdate = date.split(' ')[0].split('/')[1] + '/' + date.split(' ')[0].split('/')[0]+ '/' + date.split(' ')[0].split('/')[2]+ ' ' + h + ':' + m;
204	var num = Date.parse(strdate) + duration * 60000;
205	date = new Date(num);
206	return ((date.getFullYear() - 2000) + formatDateToString(date.getMonth() + 1)  + formatDateToString(date.getDate()) + formatDateToString(date.getHours())+ formatDateToString(date.getMinutes()));
207}
208
209parseFullDateToString = function(date) {
210		var date = new Date(date);
211		var str_date = date.getFullYear().toString();
212		str_date += this.formatDateToString(date.getMonth() + 1);
213		str_date +=	this.formatDateToString(date.getDate());
214		str_date +=	this.formatDateToString(date.getHours());
215		str_date +=	this.formatDateToString(date.getMinutes());
216		str_date +=	this.formatDateToString(date.getSeconds());
217
218		return str_date;
219	}
220
221function formatDateToString(time) {
222	if (time < 10) {
223		time = '0' + time;
224	}
225	return time.toString();
226}
227
228function getSocialLink() {
229		var list_share = $('.social a');
230
231		for (var i = 0; i< list_share.length ; i++ ) {
232				if (list_share[i].className != 'email' && list_share[i].className != 'print' && list_share[i].className != 'addthis addthis_button' && list_share[i].className != 'facebook top') {
233					list_share[i].href = $(list_share[i]).attr('data-href') + window.location.href;
234				}
235			}
236			var iframeF = '<iframe src="//www.facebook.com/plugins/like.php?href='+window.location.href+'&amp;width&amp;layout=button_count&amp;action=like&amp;show_faces=false&amp;share=true&amp;height=21&amp;appId=113869198637480" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:21px;width: 155px;" allowTransparency="true"></iframe>';
237			$('.like_fb').html(iframeF);
238}
239if ($('.social').exists()) {
240	getSocialLink();
241}
242function print_article() {
243	window.open('/in/');
244}
245
246
247//if($('.article #content img').length > 0) $('.article #content img').attr('src', $('.image img').attr('src').replace('http://truyenhinhthanhhoa.vn', ''));
248
249$(".view_lead").click(function(){
250	var obj = $(this).parent();
251	var lead = obj.find('.des_show').html();
252	var leadHidden = obj.attr('data-full');
253
254	obj.find('.des_show').html(leadHidden);
255	obj.attr('data-full', lead);
256
257	var titleShow = $(this).html();
258	var titleHide = $(this).attr('data-full');
259	$(this).html(titleHide);
260	$(this).attr('data-full', titleShow);
261})
262
263$.each($(".view_lead"), function(){
264	var obj = $(this).parent();
265	var lead = obj.find('.des_show').html();
266	var leadHidden = obj.attr('data-full');
267
268	if (lead == leadHidden ) {
269		$(this).hide();
270	}
271})
272
273//responsive cho youtube
274$( "#content iframe" ).wrap( "<div class='videoWrapper'></div>" );
275$( ".truyenhinh_detail iframe" ).wrap( "<div class='videoWrapper'></div>" );
276
277//tu dong tai link youtube
278$( ".truyenhinh_detail p" ).wrap(function() {
279	if($( this ).text().indexOf('youtube.com/watch') > 0 && (new URL($( this ).text())).searchParams.get('v') !='') {
280		return '<div class="videoWrapper"><iframe allow="autoplay; encrypted-media" allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/'+ (new URL($( this ).text())).searchParams.get('v')+'" width="560"></iframe></div>';
281	}
282});
283
284$( "#content p" ).wrap(function() {
285	if($( this ).text().indexOf('youtube.com/watch') > 0 && (new URL($( this ).text())).searchParams.get('v') !='') {
286		return '<div class="videoWrapper"><iframe allow="autoplay; encrypted-media" allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/'+ (ne
286w URL($( this ).text())).searchParams.get('v')+'" width="560"></iframe></div>';
287	}
288});
289
290
291	// Ẩn hiện icon go-top
292	$(window).scroll(function(){
293		if( $(window).scrollTop() == 0 ) {
294			$('#go_top').stop(false,true).fadeOut(600);
295		}else{
296			$('#go_top').stop(false,true).fadeIn(600);
297		}
298	});
299	
300	// Cuá»™n trang lĂªn vá»›i scrollTop
301	$('#go_top').click(function(){
302		$('body,html').animate({scrollTop:0},400);
303		return false;
304	});
305var scrollTop = $(window).scrollTop();
306$( window ).scroll(function() {
307	scrollTop = $(window).scrollTop();
308	if(scrollTop = 15) {
309		$(".floating-right").css('position', 'fixed');
310	} else {
311		$(".floating-right").css('position', 'inherit');
312	}
313});
314
315/*code weblink*/
316	function isSafari() {
317		if (navigator.userAgent.toLowerCase().indexOf("safari") != -1 && navigator.userAgent.toLowerCase().indexOf("chrome") == -1) {
318			return true
319		} else {
320			return false;
321		}
322	}
323
324	function click_this(linkselect) {
325		var link = linkselect[linkselect.selectedIndex].value;
326		if (link != "") {
327			if (isSafari()) {
328				document.getElementById('btn' + linkselect.getAttribute('id')).setAttribute('onclick', 'open_win("' + link + '")');
329			} else {
330				window.open(link);
331			}
332		}
333	}
334
335	function open_win(link) {
336		window.open(link);
337	}

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.