PageSourceSearch

https://www.mfg.cj-exhibition.com/en/js2/P251217_common.js

js cj-exhibition.com collected 2026-09-30 05:49:35 UTC 5,701 bytes, 186 lines download raw bytes

1var Common = Common || {};
2
3Common.init = function () {
4    this.scrollhead();
5    this.pageLinks();
6};
7
8Common.scrollhead = function (){
9    var nav = $('.header'),
10    offset = nav.offset();
11    $(window).scroll(function () {
12        if($(window).scrollTop() > offset.top) {
13            nav.addClass('navbar-fixed-top');
14        } else {
15            nav.removeClass('navbar-fixed-top');
16        }
17    });
18};
19
20Common.hashUrlAccess = function() {
21		var headerHight = $('.header').outerHeight();
22    var scrollElement = $(Common.getScrollElement());
23    if( location.hash !== '' ) {
24				$('#fix-side-nav ul li a').removeClass('active');
25        var p = $(location.hash).offset().top - headerHight - headerHight;
26        scrollElement.animate({ scrollTop: p }, 'fast');
27				setTimeout(function(){
28				var fix = document.getElementsByClassName("getLink");
29				var href;
30				for (var item of fix) {
31					href = $(item).attr("href");
32					if (location.hash == href) {
33						$(item).addClass('active')
34					} else {
35						$(item).removeClass('active')
36					}
37				}
38				},500);
39    }
40};
41
42Common.pageLinks = function(){
43    var p;
44    var scrollElement = $(Common.getScrollElement());
45    $('.pageLink a, .nav a, .footer-nav a').on( 'click', function(e) {
46        var link = Common.convertAbsUrl ($(this).attr('href') );
47				var headerHight = $('.header').outerHeight();
48        if( location.href === link ) {
49            e.preventDefault();
50        }else {
51            if( location.hash !== '' ) {
52                var before = location.href.split('#');
53                var after  = link.split('#');
54                if( before[0] === after[0] ) {
55                    if ( $('#howto, #askul_amita, #co2, #expo, #outline, #target, #privacy01, #law01, #about, #press24012302, #prev2024, #for-media, #film, #panac, #nbc').offset().top <= 321 ){
56                        p = $('#'+after[1]).offset().top - headerHight;
57                    }else {
58                        p = $('#'+after[1]).offset().top - headerHight - headerHight;
59                    }
60                    scrollElement.animate({ scrollTop: p }, 'fast');
61                }
62            }else {
63                var before = location.href;
64                var after  = link.split('#');
65                if( before === after[0] ) {
66                    if ( $('#howto, #askul_amita, #co2, #expo, #outline, #target, #privacy01, #law01, #about, #press24012302, #prev2024, #for-media, #film, #panac, #nbc').offset().top <= 321 ){
67                        p = $('#'+after[1]).offset().top - headerHight;
68                    }else {
69                        p = $('#'+after[1]).offset().top - headerHight - headerHight;
70                    }
71                    scrollElement.animate({ scrollTop: p }, 'fast');
72                }
73            }
74        }
75			$('#fix-side-nav ul li a').removeClass('active');
76			$(this).addClass('active');
77			setTimeout(function(){
78				var fix = document.getElementsByClassName("getLink");
79				var href;
80				for (var item of fix) {
81					href = $(item).attr("href");
82					if (location.hash == href) {
83						$(item).addClass('active')
84					} else {
85						$(item).removeClass('active')
86					}
87				}			
88			},500);
89    });
90};
91
92Common.getScrollElement = function() {
93    if('scrollingElement' in document) {
94        return document.scrollingElement;
95    }
96    if(navigator.userAgent.indexOf('WebKit') != -1) {
97        return document.body;
98    }
99    return document.documentElement;
100};
101
102Common.convertAbsUrl= function(path){
103    var anchor = document.createElement("a");
104    anchor.href = path;
105    return anchor.href;
106};
107
108/* DOM Ready */
109$(function($){ Common.init(); });
110
111var elemTop = [];
112
113function PositionCheck(){
114  var headerH = $(".header").outerHeight(true);
115  $(".scroll-point").each(function(i) {
116    elemTop[i] =Math.round(parseInt($(this).offset().top-headerH));
117  });
118}
119
120function ScrollAnime() {
121	$("#fix-side-nav li a").removeClass('active');
122  var headerH = $(".header").outerHeight(true);
123  var scroll = Math.round($(window).scrollTop());
124  $("#fix-side-nav li").removeClass('active');
125  if(scroll >= 0 && scroll < elemTop[1]) {
126      $('#fix-side-nav li:first-of-type').addClass('active');
127    }
128	else {
129		var cnt = $("#fix-side-nav li").length;
130		for(var i = 2; i <= cnt; i++){
131      if($(".scroll-point:nth-child(" + i + ")").offset().top < $(window).scrollTop() + headerH){
132				$("#fix-side-nav li a").removeClass('active');
133        $("#fix-side-nav li:nth-child(" + i + ") a").addClass("active");
134      }
135    }
136	}
137}
138
139$(window).on('load', function(){
140    Common.hashUrlAccess();
141});
142
143$(window).scroll(function () {
144  PositionCheck();
145  ScrollAnime();
146});
147
148$(window).resize(function() {
149  PositionCheck()
150});
151
152$(function(){
153  $('.sp-menubtn').on('click',function(){
154    if($(this).hasClass('active')){
155      $(this).removeClass('active');
156      $('.sp-menu').removeClass('open');
157      $('.sp-menu02 > div').removeClass('open');
158      $('.overlay').removeClass('open');
159    } else {
160      $(this).addClass('active');
161      $('.sp-menu').addClass('open');
162      $('.overlay').addClass('open');
163    }
164  });
165	$('.nav-cnt li a').on('click',function(){
166		var m = $(this).data('name');
167    $(m).addClass('open');
168  });
169	$('.prev').on('click',function(){
170		var m = $(this).data('name');
171    $(m).removeClass('open');
172  });
173  $('.overlay').on('click',function(){
174    if($(this).hasClass('open')){
175      $(this).removeClass('open');
176      $('.sp-menubtn').removeClass('active');
177      $('.sp-menu').removeClass('open');      
178      $('.sp-menu02 > div').removeClass('open');      
179    }
180  });
181});
182
183$('.toggle-title').on('click' , function(){
184	$(this).next('.toggle-content').slideToggle();
185	$(this).toggleClass('open');
186});

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.