PageSourceSearch

https://daohang-c5k.pages.dev//assets/js/tooltip-extend.js?v=1789212342

js daohang-c5k.pages.dev collected 2026-10-03 06:39:44 UTC 15,307 bytes, 531 lines download raw bytes

1var public_vars = public_vars || {};
2jQuery.extend(public_vars, {
3	breakpoints: {
4		largescreen: [991, -1],
5		tabletscreen: [768, 990],
6		devicescreen: [420, 767],
7		sdevicescreen: [0, 419]
8	},
9	lastBreakpoint: null
10});
11
12function get_current_breakpoint() {
13	var width = jQuery(window).width(),
14		breakpoints = public_vars.breakpoints;
15	for (var label in breakpoints) {
16		var bp = breakpoints[label],
17			min = bp[0],
18			max = bp[1];
19		if (max == -1) max = width;
20		if (min <= width && max >= width) return label;
21	}
22	return null;
23}
24function is(screen_label) {
25	return get_current_breakpoint() == screen_label;
26}
27function isxs() {
28	return is('devicescreen') || is('sdevicescreen');
29}
30function ismdxl() {
31	return is('tabletscreen') || is('largescreen');
32}
33function trigger_resizable() {
34	if (public_vars.lastBreakpoint != get_current_breakpoint()) {
35		public_vars.lastBreakpoint = get_current_breakpoint();
36		jQuery(window).trigger('xenon.resize');
37	}
38	jQuery(window).trigger('xenon.resized');
39}
40
41(function ($, window) {
42	"use strict";
43	$(document).ready(function () {
44		var tooltipInit = function(el){
45			var $this = $(el);
46			if ($this.data('bs.tooltip')) return;
47			var placement = $this.data('placement') || 'top';
48			var trigger = $this.data('trigger') || 'hover';
49			var delay = $this.data('delay') || { show: 0, hide: 0 };
50			var html = !!$this.data('html');
51			var animation = $this.data('animation');
52			$this.tooltip({
53				placement: placement,
54				trigger: trigger,
55				delay: delay,
56				html: html,
57				animation: typeof animation === 'undefined' ? false : !!animation,
58				container: 'body'
59			});
60		};
61		$(document).on('mouseenter', '[data-toggle="tooltip"]', function(){
62			tooltipInit(this);
63		});
64		$(document).on('focus', '[data-toggle="tooltip"]', function(){
65			tooltipInit(this);
66		});
67		// 侧边栏菜单收起/展开
68		$('a[data-toggle="sidebar"]').on('click', function (ev) {
69			ev.preventDefault();
70			var $sidebarMenu = $('.sidebar-menu');
71			$sidebarMenu.toggleClass('collapsed');
72			$(window).trigger('xenon.resize');
73		});
74	});
75	// 响应式调整
76	var resizeTicking = false;
77	window.addEventListener('resize', function(){
78		if (resizeTicking) return;
79		resizeTicking = true;
80		window.requestAnimationFrame(function(){
81			trigger_resizable();
82			resizeTicking = false;
83		});
84	}, { passive: true });
85})(jQuery, window);
86
87/**
88 *	Xenon Main
89 *
90 **/
91var public_vars = public_vars || {};
92;(function($, window, undefined){
93	"use strict";
94	$(document).ready(function()
95	{
96		// Main Vars
97		public_vars.$body                 = $("body");
98		public_vars.$pageContainer        = public_vars.$body.find(".page-container");
99		public_vars.$chat                 = public_vars.$pageContainer.find("#chat");
100		public_vars.$sidebarMenu          = public_vars.$pageContainer.find('.sidebar-menu');
101		public_vars.$sidebarProfile       = public_vars.$sidebarMenu.find('.sidebar-user-info');
102		public_vars.$mainMenu             = public_vars.$sidebarMenu.find('.main-menu');
103		public_vars.$horizontalNavbar     = public_vars.$body.find('.navbar.horizontal-menu');
104		public_vars.$horizontalMenu       = public_vars.$horizontalNavbar.find('.navbar-nav');
105		public_vars.$mainContent          = public_vars.$pageContainer.find('.main-content');
106		public_vars.$mainFooter           = public_vars.$body.find('footer.main-footer');
107		public_vars.$userInfoMenuHor      = public_vars.$body.find('.navbar.horizontal-menu');
108		public_vars.$userInfoMenu         = public_vars.$body.find('nav.navbar.user-info-navbar');
109		public_vars.$settingsPane         = public_vars.$body.find('.settings-pane');
110		public_vars.$settingsPaneIn       = public_vars.$settingsPane.find('.settings-pane-inner');
111		public_vars.wheelPropagation      = true; // used in Main menu (sidebar)
112		public_vars.$pageLoadingOverlay   = public_vars.$body.find('.page-loading-overlay');
113		public_vars.defaultColorsPalette = ['#68b828','#7c38bc','#0e62c7','#fcd036','#4fcdfc','#00b19d','#ff6264','#f7aa47'];
114		// Setup Sidebar Menu
115		setup_sidebar_menu();
116		// Setup Horizontal Menu
117		setup_horizontal_menu();
118		// Sticky Footer
119		if(public_vars.$mainFooter.hasClass('sticky'))
120		{
121			stickFooterToBottom();
122			$(window).on('xenon.resized', stickFooterToBottom);
123		}
124		// Perfect Scrollbar
125		if($.isFunction($.fn.perfectScrollbar))
126		{
127			if(public_vars.$sidebarMenu.hasClass('fixed'))
128				ps_init();
129			$(".ps-scrollbar").each(function(i, el)
130			{
131				var $el = $(el);
132				if($el.hasClass('ps-scroll-down'))
133				{
134					$el.scrollTop($el.prop('scrollHeight'));
135				}
136				$el.perfectScrollbar({
137					wheelPropagation: false
138				});
139			});
140			// Chat Scrollbar
141			var $chat_inner = public_vars.$pageContainer.find('#chat .chat-inner');
142			if($chat_inner.parent().hasClass('fixed'))
143				$chat_inner.css({maxHeight: $(window).height()}).perfectScrollbar();
144			// User info opening dropdown trigger PS update
145			$(".dropdown:has(.ps-scrollbar)").each(function(i, el)
146			{
147				var $scrollbar = $(this).find('.ps-scrollbar');
148				$(this).on('click', '[data-toggle="dropdown"]', function(ev)
149				{
150					ev.preventDefault();
151					setTimeout(function()
152					{
153						$scrollbar.perfectScrollbar('update');
154					}, 1);
155				});
156			});
157			// Scrollable
158			$("div.scrollable").each(function(i, el)
159			{
160				var $this = $(el),
161					max_height = parseInt(attrDefault($this, 'max-height', 200), 10);
162				max_height = max_height < 0 ? 200 : max_height;
163				$this.css({maxHeight: max_height}).perfectScrollbar({
164					wheelPropagation: true
165				});
166			});
167		}
168		// Go to top links
169		$('body').on('click', 'a[rel="go-top"]', function(ev)
170		{
171			ev.preventDefault();
172			var obj = {pos: $(window).scrollTop()};
173			TweenLite.to(obj, .3, {pos: 0, ease:Power4.easeOut, onUpdate: function()
174			{
175				$(window).scrollTop(obj.pos);
176			}});
177		});
178		// Auto hidden breadcrumbs
179		$(".breadcrumb.auto-hidden").each(function(i, el)
180		{
181			var $bc = $(el),
182				$as = $bc.find('li a'),
183				collapsed_width = $as.width(),
184				expanded_width = 0;
185			$as.each(function(i, el)
186			{
187				var $a = $(el);
188				expanded_width = $a.outerWidth(true) + 5;
189				$a.addClass('collapsed').width(expanded_width);
190				$a.hover(function()
191				{
192					$a.removeClass('collapsed');
193				},
194				function()
195				{
196					$a.addClass('collapsed');
197				});
198			});
199		});
200	});
201	// Enable/Disable Resizable Event
202	var resizeTicking2 = false;
203	window.addEventListener('resize', function(){
204		if (resizeTicking2) return;
205		resizeTicking2 = true;
206		window.requestAnimationFrame(function(){
207			trigger_resizable();
208			resizeTicking2 = false;
209		});
210	}, { passive: true });
211})(jQuery, window);
212// Sideber Menu Setup function
213var sm_duration = .2,
214	sm_transition_delay = 150;
215function setup_sidebar_menu()
216{
217	if(public_vars.$sidebarMenu.length)
218	{
219		var $items_with_subs = public_vars.$sidebarMenu.find('li:has(> ul)'),
220			toggle_others = public_vars.$sidebarMenu.hasClass('toggle-others');
221		$items_with_subs.filter('.active').addClass('expanded');
222		// On larger screens collapse sidebar when the window is tablet screen
223		if(is('largescreen') && public_vars.$sidebarMenu.hasClass('collapsed') == false)
224		{
225			$(window).on('resize', function()
226			{
227				if(is('tabletscreen'))
228				{
229					public_vars.$sidebarMenu.addClass('collapsed');
230					ps_destroy();
231				}
232				else
233				if(is('largescreen'))
234				{
235					public_vars.$sidebarMenu.removeClass('collapsed');
236					ps_init();
237				}
238			});
239		}
240		$items_with_subs.each(function(i, el)
241		{
242			var $li = jQuery(el),
243				$a = $li.children('a'),
244				$sub = $li.children('ul');
245			$li.addClass('has-sub');
246			$a.on('click', function(ev)
247			{
248				ev.preventDefault();
249				if(toggle_others)
250				{
251					sidebar_menu_close_items_siblings($li);
252				}
253				if($li.hasClass('expanded') || $li.hasClass('opened'))
254					sidebar_menu_item_collapse($li, $sub);
255				else
256					sidebar_menu_item_expand($li, $sub);
257			});
258		});
259	}
260}
261function sidebar_menu_item_expand($li, $sub)
262{
263	if($li.data('is-busy'))
264		return;
265
266	var $sub_items = $sub.children(),
267		sub_height;
268
269	$li.addClass('expanded').data('is-busy', true);
270	$sub_items.addClass('hidden-item');
271
272	$sub.css({display: 'block', height: 'auto', visibility: 'hidden'});
273	sub_height = $sub.outerHeight();
274	$sub.css({height: 0, visibility: 'visible'});
275
276	if (typeof TweenMax !== 'undefined' && TweenMax && typeof TweenMax.to === 'function')
277	{
278		TweenMax.to($sub, sm_duration, {css: {height: sub_height}, onUpdate: ps_update, onComplete: function()
279		{
280			$li.data('is-busy', false).addClass('opened');
281			$sub.attr('style', '').show();
282			$sub_items.removeClass('hidden-item');
283			ps_update(true);
284		}});
285	}
286	else
287	{
288		$sub.attr('style', '').hide().stop(true, true).slideDown(200, function() {
289			$li.data('is-busy', false).addClass('opened');
290			$sub_items.removeClass('hidden-item');
291			ps_update(true);
292		});
293	}
294}
295function sidebar_menu_item_collapse($li, $sub)
296{
297	if($li.data('is-busy'))
298		return;
299	var $sub_items = $sub.children();
300	$li.removeClass('expanded').data('is-busy', true);
301	$sub_items.addClass('hidden-item');
302	if (typeof TweenMax !== 'undefined' && TweenMax && typeof TweenMax.to === 'function')
303	{
304		TweenMax.to($sub, sm_duration, {css: {height: 0}, onUpdate: ps_update, onComplete: function()
305		{
306			$li.data('is-busy', false).removeClass('opened');
307			$sub.attr('style', '').hide();
308			$sub_items.removeClass('hidden-item');
309			$li.find('li.expanded ul').attr('style', '').hide().parent().removeClass('expanded');
310			ps_update(true);
311		}});
312	}
313	else
314	{
315		$sub.stop(true, true).slideUp(200, function() {
316			$li.data('is-busy', false).removeClass('opened');
317			$sub.attr('style', '').hide();
318			$sub_items.removeClass('hidden-item');
319			$li.find('li.expanded ul').attr('style', '').hide().parent().removeClass('expanded');
320			ps_update(true);
321		});
322	}
323}
324function sidebar_menu_close_items_siblings($li)
325{
326	$li.siblings().not($li).filter('.expanded, .opened').each(function(i, el)
327	{
328		var $_li = jQuery(el),
329			$_sub = $_li.children('ul');
330		sidebar_menu_item_collapse($_li, $_sub);
331	});
332}
333// Horizontal Menu
334function setup_horizontal_menu()
335{
336	if(public_vars.$horizontalMenu.length)
337	{
338		var $items_with_subs = public_vars.$horizontalMenu.find('li:has(> ul)'),
339			click_to_expand = public_vars.$horizontalMenu.hasClass('click-to-expand');
340		if(click_to_expand)
341		{
342			public_vars.$mainContent.add( public_vars.$sidebarMenu ).on('click', function(ev)
343			{
344				$items_with_subs.removeClass('hover');
345			});
346		}
347		$items_with_subs.each(function(i, el)
348		{
349			var $li = jQuery(el),
350				$a = $li.children('a'),
351				$sub = $li.children('ul'),
352				is_root_element = $li.parent().is('.navbar-nav');
353			$li.addClass('has-sub');
354			// Mobile Only
355			$a.on('click', function(ev)
356			{
357				if(isxs())
358				{
359					ev.preventDefault();
360					// Automatically will toggle other menu items in mobile view
361					if(true)
362					{
363						sidebar_menu_close_items_siblings($li);
364					}
365					if($li.hasClass('expanded') || $li.hasClass('opened'))
366						sidebar_menu_item_collapse($li, $sub);
367					else
368						sidebar_menu_item_expand($li, $sub);
369				}
370			});
371			// Click To Expand
372			if(click_to_expand)
373			{
374				$a.on('click', function(ev)
375				{
376					ev.preventDefault();
377					if(isxs())
378						return;
379					// For parents only
380					if(is_root_element)
381					{
382						$items_with_subs.filter(function(i, el){ return jQuery(el).parent().is('.navbar-nav'); }).not($li).removeClass('hover');
383						$li.toggleClass('hover');
384					}
385					// Sub menus
386					else
387					{
388						var sub_height;
389						// To Expand
390						if($li.hasClass('expanded') == false)
391						{
392							$li.addClass('expanded');
393							$sub.addClass('is-visible');
394							sub_height = $sub.outerHeight();
395							$sub.height(0);
396							TweenLite.to($sub, .15, {css: {height: sub_height}, ease: Sine.easeInOut, onComplete: function(){ $sub.attr('style', ''); }});
397							// Hide Existing in the list
398							$li.siblings().find('> ul.is-visible').not($sub).each(function(i, el)
399							{
400								var $el = jQuery(el);
401								sub_height = $el.outerHeight();
402								$el.removeClass('is-visible').height(sub_height);
403								$el.parent().removeClass('expanded');
404								TweenLite.to($el, .15, {css: {height: 0}, onComplete: function(){ $el.attr('style', ''); }});
405							});
406						}
407						// To Collapse
408						else
409						{
410							sub_height = $sub.outerHeight();
411							$li.removeClass('expanded');
412							$sub.removeClass('is-visible').height(sub_height);
413							TweenLite.to($sub, .15, {css: {height: 0}, onComplete: function(){ $sub.attr('style', ''); }});
414						}
415					}
416				});
417			}
418			// Hover To Expand
419			else
420			{
421				$li.hoverIntent({
422					over: function()
423					{
424						if(isxs())
425							return;
426						if(is_root_element)
427						{
428							$li.addClass('hover');
429						}
430						else
431						{
432							$sub.addClass('is-visible');
433							sub_height = $sub.outerHeight();
434							$sub.height(0);
435							TweenLite.to($sub, .25, {css: {height: sub_height}, ease: Sine.easeInOut, onComplete: function(){ $sub.attr('style', ''); }});
436						}
437					},
438					out: function()
439					{
440						if(isxs())
441							return;
442						if(is_root_element)
443						{
444							$li.removeClass('hover');
445						}
446						else
447						{
448							sub_height = $sub.outerHeight();
449							$li.removeClass('expanded');
450							$sub.removeClass('is-visible').height(sub_height);
451							TweenLite.to($sub, .25, {css: {height: 0}, onComplete: function(){ $sub.attr('style', ''); }});
452						}
453					},
454					timeout: 200,
455					interval: is_root_element ? 10 : 100
456				});
457			}
458		});
459	}
460}
461function stickFooterToBottom()
462{
463	public_vars.$mainFooter.add( public_vars.$mainContent ).add( public_vars.$sidebarMenu ).attr('style', '');
464	if(isxs())
465		return false;
466	if(public_vars.$mainFooter.hasClass('sticky'))
467	{
468		var win_height				 = jQuery(window).height(),
469			footer_height			= public_vars.$mainFooter.outerHeight(true),
470			main_content_height	  = public_vars.$mainFooter.position().top + footer_height,
471			main_content_height_only = main_content_height - footer_height,
472			extra_height			 = public_vars.$horizontalNavbar.outerHeight();
473		if(win_height > main_content_height - parseInt(public_vars.$mainFooter.css('marginTop'), 10))
474		{
475			public_vars.$mainFooter.css({
476				marginTop: win_height - main_content_height - extra_height
477			});
478		}
479	}
480}
481// Perfect scroll bar functions by Arlind Nushi
482function ps_update(destroy_init)
483{
484	//if(isxs())
485	//	return;
486	if(jQuery.isFunction(jQuery.fn.perfectScrollbar))
487	{
488		if(public_vars.$sidebarMenu.hasClass('collapsed'))
489		{
490			return;
491		}
492		public_vars.$sidebarMenu.find('.sidebar-menu-inner').perfectScrollbar('update');
493		if(destroy_init)
494		{
495			ps_destroy();
496			ps_init();
497		}
498	}
499}
500function ps_init()
501{
502	//if(isxs())
503	//	return;
504	if(jQuery.isFunction(jQuery.fn.perfectScrollbar))
505	{
506		if(public_vars.$sidebarMenu.hasClass('collapsed') || ! public_vars.$sidebarMenu.hasClass('fixed'))
507		{
508			return;
509		}
510		public_vars.$sidebarMenu.find('.sidebar-menu-inner').perfectScrollbar({
511			wheelSpeed: 1,
512			wheelPropagation: public_vars.wheelPropagation
513		});
514	}
515}
516function ps_destroy()
517{
518	if(jQuery.isFunction(jQuery.fn.perfectScrollbar))
519	{
520		public_vars.$sidebarMenu.find('.sidebar-menu-inner').perfectScrollbar('destroy');
521	}
522}
523// Element Attribute Helper
524function attrDefault($el, data_var, default_val)
525{
526	if(typeof $el.data(data_var) != 'undefined')
527	{
528		return $el.data(data_var);
529	}
530	return default_val;
531}

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.