PageSourceSearch

https://www.cnterm.cn/images/scripts-2023.js

js cnterm.cn collected 2026-10-02 19:09:56 UTC 4,390 bytes, 145 lines download raw bytes

1(function($){
2  "use strict";
3	
4  // nav
5	(function($) {
6		var $nav = $('#main-nav');
7		var $toggle = $('.toggle');
8		var defaultData = {
9			maxWidth: false,
10			customToggle: $toggle,
11			navTitle: '<img src="//www.cnctst.cn/images/mcw2023-logo.png">',
12			labelClose: "关闭",
13			levelTitles: true,
14			levelOpen:'expand',
15			levelSpacing:25
16		};
17		var $clone = null;
18		var data = {};
19		const initNav = function(conf) {
20			if ($clone) {
21				$clone.remove();
22			}
23			$toggle.off('click');
24			$clone = $nav.clone();
25			$.extend(data, conf)
26			$clone.hcMobileNav($.extend({}, defaultData, data));
27		}
28		initNav({});
29	})(jQuery);
30	
31	$(".nav-parent").each(function(){
32		if($(this).find(".nav-wrapper").find("ul").find("a").length==0){
33			$(this).find(".nav-next").remove();
34		}
35	})
36
37	$('.search-trigger').on('click', function(e){
38		$('.up-search-box').addClass('active')
39	});
40
41	$('.search-box').on('click', function(e){
42		e.stopPropagation();
43	});
44	$('.up-close').on('click', function(e){
45		$('.up-search-box').removeClass('active')
46	});
47	
48	// 导航
49	$(function(){
50       $(".bread-item").find("span:last-child").remove();
51        var len = "";
52        var curChannel = $(".bread-item").find("a:eq(1)").text();
53        var curChannelSub = $(".bread-item").find("a:eq(2)").text();
54        var curChannelThree = $(".bread-item").find("a:last-child").html();
55        $(".dropdown").each(function(){
56            len = $(this).children(".dropdown-menu").children("li").length;
57            if(len<1){
58                $(this).removeClass("dropdown");
59                $(this).children(".dropdown-menu").remove();
60                $(this).children("a").removeAttr("data-toggle").removeClass("dropdown-toggle");
61                $(this).find("i").remove();
62                $("a", this).off('click');
63                $("a.dropdown-toggle", this).on('click', function (e) {});
64            }
65            if($(this).children("a").text()==curChannel){
66                $(this).addClass("active").siblings().removeClass('active');
67            }
68        });
69		
70		//右侧三级栏目高亮开始
71		$(".ny-right-title a").each(function(){
72			var channelDesc=$(this).text().trim();
73			if(channelDesc==curChannelThree){
74				$(this).addClass("active").siblings().removeClass("active");
75			}
76		});
77		//右侧三级栏目点击高亮
78		$(".ny-right-title a").click(function(){
79			$(this).addClass("active").siblings().removeClass("active");
80		});
81		
82        //右侧四级栏目高亮开始
83		$(".mcw-sub-menu a").each(function(){
84			var channelDesc=$(this).text().trim();
85			if(channelDesc==curChannelThree){
86				$(this).addClass("active").siblings().removeClass("active");
87			}
88		});
89		//右侧四级栏目点击高亮
90		$(".mcw-sub-menu a").click(function(){
91			$(this).addClass("active").siblings().removeClass("active");
92		});
93    });
94	
95  // LeftNav
96	$('.sub-menu').each(function(){
97		$(this).click(function(){
98			if($(this).hasClass('active')) {
99				$(this).removeClass('active')
100			} else {
101				$(this).addClass('active')
102			}
103		})
104	})
105
106  //向上滑动显示返回顶部
107	$("#goTopBtn").click(function() {
108		var sc = $(window).scrollTop();
109		$('body,html').animate({
110			scrollTop: 0
111		}, 500);
112	})
113	$(document).on("mousewheel DOMMouseScroll", function (e) {
114			// jq 获取dom 事件对象要通过originalEvent 
115			var delta = (e.originalEvent.wheelDelta && (e.originalEvent.wheelDelta > 0 ? 1 : -1)) ||
116					// chrome & ie
117					(e.originalEvent.detail && (e.originalEvent.detail > 0 ? -1 : 1)); // firefox
118			if (delta > 0) {
119					// 向上滚
120					if ($(window).scrollTop() >= 0) {
121						$("#goTopBtn").css("display", "block");
122					}
123			} else if (delta < 0) {
124					// 向下滚
125					$("#goTopBtn").css("display", "none");	
126			}
127	})
128	var touchStart, touchEnd, touchDiff = 80;
129	$(window).on({
130		'touchstart': function (e) {
131			touchStart = e.originalEvent.changedTouches[0].clientY;
132		},
133		'touchend': function (e) {
134			touchEnd = e.originalEvent.changedTouches[0].clientY;
135			var diff = touchStart - touchEnd;
136			if (diff >= touchDiff) { // direction down
137				$("#goTopBtn").css("display", "none");
138			} else if (diff <= -touchDiff) { // direction up
139				if ($(window).scrollTop() >= 0) {
140					$("#goTopBtn").css("display", "block");
141				}
142			}
143		}
144	});
145})(jQuery);

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.