PageSourceSearch

https://nagoyajin.nagoya/wp-content/themes/jin/js/common.js?ver=7.0.6

js nagoyajin.nagoya collected 2026-10-05 03:23:24 UTC 5,248 bytes, 182 lines download raw bytes

1// JavaScript Document
2
3
4// Androidのユーザーエージェント判別(CSSハック用)
5(function($){
6	if ( navigator.userAgent.indexOf('Android') > 0 ) {
7		$("body").addClass("android");
8	}
9})(jQuery);
10
11
12//YouTubeの全画面表示対策
13(function($){
14	var remove = function(){
15		$('#sidebar').removeClass('animate');
16	};
17	setTimeout(remove, 1700);
18})(jQuery);
19
20
21//トップペ戻るボタン
22(function($){
23  $(window).scroll(function(){
24	  
25    var now = $(window).scrollTop();
26    //最上部から現在位置までの距離(now)が600以上
27    if(now > 600){
28      //[#page-top]をゆっくりフェードインする
29      $('#page-top').fadeIn('slow');
30      //それ以外だったらフェードアウトする
31    }else{
32      $('#page-top').fadeOut('slow');
33    }
34  });
35  //ボタン(id:move-page-top)のクリックイベント
36  $(document).on('click', '.totop', function(){
37  //ページトップへ移動する
38  $('body,html').animate({
39          scrollTop: 0
40      }, 200);
41  });
42})(jQuery);
43
44	
45// タブ高さ管理(vanilla JS)
46(function(){
47	'use strict';
48	
49	var parentDiv = document.querySelector('.toppost-list-box-inner');
50	if(!parentDiv) return;
51	
52	// 初期化済みチェック
53	if(parentDiv.getAttribute('data-initialized') === 'true') return;
54	parentDiv.setAttribute('data-initialized', 'true');
55	
56	// 各タブの高さを保持する配列(JavaScript変数なので外部スクリプトから触れない)
57	var tabHeights = [];
58	// 現在適用すべき高さ
59	var correctHeight = null;
60	var isProtecting = false;
61	
62	// 高さを強制的に設定する関数
63	function forceHeight(){
64		if(correctHeight && correctHeight > 0){
65			parentDiv.style.setProperty('height', correctHeight + 'px', 'important');
66		}
67	}
68	
69	// MutationObserverで外部スクリプトの上書きを即座に修正
70	var styleObserver = new MutationObserver(function(){
71		if(!isProtecting || correctHeight === null) return;
72		requestAnimationFrame(forceHeight);
73	});
74	styleObserver.observe(parentDiv, { attributes: true, attributeFilter: ['style'] });
75	
76	// 高さを適用する関数
77	function applyHeight(tabIndex){
78		if(tabIndex < 0 || tabIndex >= tabHeights.length) return;
79		var h = tabHeights[tabIndex];
80		if(h && h > 0){
81			correctHeight = h;
82			isProtecting = true;
83			forceHeight();
84		}
85	}
86	
87	// ロード完了時に実行
88	window.addEventListener('load', function(){
89		var tabs = document.querySelectorAll('.toppost-list-box .autoheight');
90		var tabBtns = document.querySelectorAll('.tabBtn-mag li');
91		
92		// 各タブの高さをJavaScript配列に保存(一度だけ)
93		tabs.forEach(function(tab){
94			var h = tab.offsetHeight;
95			tabHeights.push(h > 0 ? h : 0);
96		});
97		
98		// 現在選択されているタブを特定
99		var checkedInput = document.querySelector('input[name="switch"]:checked');
100		var tabIndex = 0;
101		if(checkedInput && checkedInput.id){
102			var num = parseInt(checkedInput.id.replace('tab-', ''), 10);
103			if(num > 0 && num <= tabs.length) tabIndex = num - 1;
104		}
105		
106		// .hFindクラスを設定
107		document.querySelectorAll('.hFind').forEach(function(el){ el.classList.remove('hFind'); });
108		if(tabs[tabIndex]) tabs[tabIndex].classList.add('hFind');
109		
110		// 高さを適用
111		applyHeight(tabIndex);
112		
113		// クリックイベント
114		tabBtns.forEach(function(btn){
115			btn.addEventListener('click', function(){
116				setTimeout(function(){
117					var tabs = document.querySelectorAll('.toppost-list-box .autoheight');
118					var checkedInput = document.querySelector('input[name="switch"]:checked');
119					var tabIndex = 0;
120					if(checkedInput && checkedInput.id){
121						var num = parseInt(checkedInput.id.replace('tab-', ''), 10);
122						if(num > 0 && num <= tabs.length) tabIndex = num - 1;
123					}
124					
125					// .hFindクラスの更新
126					document.querySelectorAll('.hFind').forEach(function(el){ el.classList.remove('hFind'); });
127					if(tabs[tabIndex]) tabs[tabIndex].classList.add('hFind');
128					
129					// 高さを適用
130					applyHeight(tabIndex);
131				}, 10);
132				
133				// first-tabクラスの更新
134				if(!this.classList.contains('first-tab')){
135					document.querySelectorAll('.first-tab').forEach(function(el){ el.classList.remove('first-tab'); });
136					this.classList.add('first-tab');
137				}
138			});
139		});
140	}, {once: true});
141})();
142
143
144
145//マガジンタイプのインフィード広告のタブレット端末の非表示設定
146(function($){
147	$(document).ready(function() {
148		var w_Size = window.innerWidth;
149		if( w_Size <= 838 ){
150			$(".pconly").remove();
151		}
152	});
153})(jQuery);
154
155
156//シンタックスハイライターの行番号クラスをつける
157(function($){
158	$(document).ready(function() {
159		$('.cps-post-main-box pre').addClass('line-numbers');
160	});
161})(jQuery);
162
163
164//アコーディオンボックスの開閉
165(function($){
166    $('.jin-ac-box01-title').click(function(){
167		$(this).toggleClass("open");
168        $(this).next().toggleClass("open");
169    });
170	$('.jin-ac-box02-title').click(function(){
171		$(this).toggleClass("open");
172        $(this).next().toggleClass("open");
173    });
174})(jQuery);
175
176/*画像の外部リンクの後ろにアイコンがつかないようにする
177(function($){
178	$(document).ready(function() {
179		$('a').has('img').addClass('remove-icon');
180	});
181})(jQuery);
182*/

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.