PageSourceSearch

https://www.kanazawa-u.ac.jp/wp/wp-content/themes/KU/assets/js/ku.js?ver=202304

js kanazawa-u.ac.jp collected 2026-09-24 08:47:27 UTC 8,419 bytes, 258 lines download raw bytes

1jQuery(function() {
2  jQuery(document).ready(function(){
3    /*
4    jQuery(".pagetop").hide();
5    jQuery(window).on("scroll", function() {
6      if (jQuery(this).scrollTop() > 300) {
7        jQuery(".pagetop").fadeIn("fast");
8      } else {
9        jQuery(".pagetop").fadeOut("fast");
10      }
11    });
12    */
13
14    jQuery('.pagetop').click(function () {
15      jQuery('html,body').animate({
16      scrollTop: 0
17      }, 400);
18      return false;
19    });
20  });
21
22
23  // TELリンク
24  var ua = navigator.userAgent.toLowerCase();
25  var isMobile = /iphone/.test(ua)||/android(.+)?mobile/.test(ua);
26  if (!isMobile) {
27    jQuery('a[href^="tel:"]').on('click', function(e) {
28      e.preventDefault();
29    });
30  }
31
32 // GoogleMapスクロース無効
33  var map = jQuery('iframe[src$="embed"]');
34  map.css('pointer-events', 'none');
35  jQuery('.googlemap').click(function() {
36    map.css('pointer-events', 'auto');
37  });
38  map.mouseout(function() {
39    map.css('pointer-events', 'none');
40  })
41
42
43  jQuery('.tab-category li').on('click', function() {
44    jQuery('.tab-category li, .news-img').removeClass('active');
45    jQuery(this).addClass('active');
46    var index = jQuery('.tab-category li').index(this);
47    jQuery('.news-img').eq(index).addClass('active');
48  });
49
50  jQuery(document).ready(function(){
51    // クリックして開閉
52    jQuery('.op-btn').on('click', function(){
53      jQuery(this).next('.op-cont').slideToggle('fast');
54      jQuery(this).parent('.ch-inner').next('.op-cont').slideToggle('fast');
55    });
56
57    // クリック後アイコン差替え
58    jQuery('.op-btn').on('click', function(){
59      jQuery(this).toggleClass('open');
60    });
61
62    // クリック後スマホメニュー表示
63    jQuery('.nv-btn').on('click', function(){
64      jQuery('.site-header').toggleClass('open-nv');
65    });
66
67    // メニュー表示、背景スクロール固定
68    /*
69    jQuery('.nv-btn').on('click', function(){
70      //jQuery('.site').toggleClass('open-nv');
71      if(jQuery('.site').hasClass('open-nv')){
72        jQuery('.site').removeClass('open-nv').css('top',0 + 'px');
73        window.scrollTo( 0 , scrollPos );//初期化
74      } else {
75        scrollPos = jQuery(window).scrollTop();//現在のスクロール位置
76        jQuery('.site').addClass('open-nv').css('top',-scrollPos + 'px');
77      }
78    });
79    */
80  });
81
82
83  // テーブル(スマホ横スクロール用)
84  if (window.matchMedia( '(min-width: 1200px)' ).matches) { //横幅1025px以上のとき
85  } else {
86    jQuery('table').wrap('<div class="table-wrap"></div>');
87  }
88
89  // サイドバーカレント
90  /*
91  var url = window.location;
92  //jQuery('.side-area a[href="'+url+'"]').parent().addClass('selected');
93  jQuery('.side-area a[href="'+url+'"]').parent().parent('li').addClass('selected');
94  jQuery('.side-area a[href="'+url+'"]').parent('li').addClass('selected');
95  jQuery('.side-area a[href="'+url+'"]').parents('.has-children').addClass('p-selected');
96  //jQuery('.side-area a[href="'+url+'"]').addClass('current');
97  */
98
99  //ヘッダーカレント
100  //var url = window.location;
101  //jQuery('.main-menu a[href="'+url+'"]').parent('li').addClass('current_page_item');
102
103  // ドロップダウンメニュー
104  /*
105  jQuery('nav > ul > li')
106  .mouseover(function(e) {
107    jQuery('.ch-list', this).stop().slideDown('fast');
108  })
109  .mouseout(function(e) {
110    jQuery('.ch-list', this).stop().slideUp('fast');
111  });
112  */
113
114  // スクロールでヘッダーサイズを変更
115  jQuery(window).scroll(function () {
116    var winTop = jQuery(window).scrollTop();
117    var headerTop = jQuery(".site-header");
118
119    if (window.matchMedia( '(min-width: 1025px)' ).matches) { //横幅1025px以上のとき
120      //fixedクラスがついていないときだけ、offset()で値を取得する
121      if ( !headerTop.hasClass("is-fixed") ) {
122        navPos = jQuery(".site-header").offset().top;
123      }
124
125      if (navPos < winTop) {
126        headerTop.addClass("is-fixed");
127      } else {
128        headerTop.removeClass("is-fixed");
129      }
130    }
131  });
132
133  /*
134  jQuery(window).scroll(function () {
135    var value = jQuery(window).scrollTop();
136    if (window.matchMedia( '(min-width: 1025px)' ).matches) { //横幅1025px以上のとき
137      if ( value > 150 ) {
138        jQuery('.site-header').addClass('is-fixed');
139      } else if ( jQuery('.site-header').hasClass('is-fixed') ) {
140        jQuery('.site-header').removeClass('is-fixed');
141      }
142    }
143  });
144  */
145
146
147  //anchorのズレ解消(参考:https://tadabi.tokyo/2021/header-fixed-anchor-scroll/   木下さã
147‚“修正)
148  jQuery("a").on('click', function() { //同一ページ
149    let anchorLink = jQuery(this).attr("href");
150    func_scroll(anchorLink);
151  });
152  jQuery(window).on('load', function() { //別ページ
153    let url = jQuery(location).attr('href');
154    func_scroll(url);
155  });
156  function func_scroll(url){
157    // urlに「#」が含まれていれば
158    if(url.indexOf("#") != -1){
159      // headerの高さを取得してそれに30px追加した値をheaderHeightに代入
160      const headerHeight = jQuery('.site-header').outerHeight() + 30;
161
162      // urlを#で分割して配列に格納
163      const anchor = url.split("#"),
164      // 分割した最後の文字列(#◯◯の部分)をtargetに代入
165      target = jQuery('#' + anchor[anchor.length - 1]),
166      // リンク先の位置からheaderHeightの高さを引いた値をpositionに代入
167      position = Math.floor(target.offset().top) - headerHeight;
168      // positionの位置に移動
169      jQuery("html, body").animate({
170        scrollTop: position
171      }, 550);
172    }
173  }
174
175  // スムーズスクロール(アンカー)
176  /*
177  jQuery('a[href^="#"]').on('click', function() {
178    var speed = 400;
179    var href = jQuery(this).attr("href");
180    var target = jQuery(href == "#" || href == "" ? 'html' : href);
181    var position = target.offset().top;
182    jQuery('body,html').animate({
183      scrollTop: position
184    }, speed, 'swing');
185    return false;
186  });
187  */
188
189  // リサイズ後にスタイル削除
190  /*
191  jQuery(window).on('load resize', function() {
192    var windowWidth = window.innerWidth;
193    if (windowWidth < 960) {
194      //jQuery('.hd-link').removeAttr('style');
195      jQuery('.op-btn').removeClass('open');
196      jQuery('.entry-list').removeAttr('style');
197    }
198  });
199  */
200  var w = jQuery(window).width();
201  var w_resize;
202  var timer = false;
203  //Responsive();
204  jQuery(window).on("orientationchange resize",function() {
205    if (timer !== false) {
206      clearTimeout(timer);
207    }
208    timer = setTimeout(function() {
209      w_resize = jQuery(window).width();
210      if (w != w_resize){
211        Responsive();
212        w = jQuery(window).width();
213      }
214    }, 200);
215    function Responsive () {
216      jQuery('.op-btn').removeClass('open');
217      jQuery('.entry-list').removeAttr('style');
218    }
219  });
220
221
222
223
224
225});
226
227
228
229
230
231
232
233// UserAgentで振り分けてhtmlにclassを振る
234// 変数
235var agent       = navigator.userAgent; // ユーザーエージェント
236var htmlElement = document.documentElement; // html要素
237if (navigator.platform.search("Mac") != -1) { htmlElement.className += 'pc mac'; }
238if(agent.search("Windows") != -1){
239  htmlElement.className += 'pc  win';
240  if((agent.search("Trident") != -1) || ((agent.search("MSIE") != -1))) {
241    htmlElement.className += ' ie';
242    if(agent.search("Trident") != -1) { htmlElement.className += ' gte_ie8'; }
243    if(agent.search("Trident") == -1) { htmlElement.className += ' lte_ie8'; }
244    if(agent.search("MSIE 7") != -1){ htmlElement.className += ' ie7'; }
245    if(agent.search("MSIE 8") != -1){ htmlElement.className += ' ie8'; }
246    if(agent.search("MSIE 9") != -1){ htmlElement.className += ' ie9'; }
247    if(agent.search("MSIE 10") != -1){ htmlElement.className += ' ie10'; }
248    if(agent.search("Trident/7") != -1){ htmlElement.className += ' ie11'; }
249  }
250}
251if((agent.search("Chrome") != -1) && (agent.search("OPR") == -1)){ htmlElement.className += ' chrome'; }
252if((agent.search("Safari") != -1) && (agent.search("Chrome") == -1) && (agent.search("OPR") == -1) && (agent.search("Presto") == -1)) { htmlElement.className += ' safari'; }
253if(agent.search("Firefox") != -1) { htmlElement.className += ' firefox'; }
254if(agent.search("iPad") != -1){ htmlElement.className += ' ipad'; }
255if(agent.search("iPhone") != -1){ htmlElement.className += ' iphone'; }
256if(agent.search("Android") != -1){ htmlElement.className += ' android'; }
257
258

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.