PageSourceSearch

https://inq.finance/wp-content/themes/inq/assets/js/common.js?1764657902

js inq.finance collected 2026-10-02 05:25:31 UTC 7,596 bytes, 248 lines download raw bytes

1$(document).ready(function(){
2	//初期設定
3	var height = $(window).height();
4	var w = $(window).width();
5	var x = 768;
6
7	if(w > x){ 
8			wresize();
9			$("body").addClass('pcmode');
10		}else{
11			wresize_sp();
12			$("body").addClass('spmode');
13	}
14	
15	//リサイズ処理
16	$(window).resize(function(){
17		var ww = $(window).width();
18		if(w != ww) {
19			w = ww;
20			if(w > x){ 
21				wresize();
22				$("body").addClass('pcmode');
23				$("body").removeClass('spmode');
24			}else{
25				wresize_sp();
26				$("body").addClass('spmode');
27				$("body").removeClass('pcmode');
28			}
29		}
30	});
31	
32	function wresize(){
33		height = $(window).height();
34		w = $(window).width();
35		$('.fixed_header .header_nav').removeAttr('style');
36	}
37	
38	function wresize_sp(){
39		height = $(window).height();
40		w = $(window).width();
41	}
42
43	$("#sp_menu a").click(function () {
44		if($("body").hasClass('spmode')){
45		height = $(window).height();
46		trg = $(".header_right");
47			if (trg.css('display') == 'block') {
48				trg.stop(true,true).hide();
49				$("#sp_menu").removeClass('is-open');
50				$("header").removeClass('open');
51				$('body').css('overflow','visible');
52			}else{
53				trg.stop(true,true).fadeIn('slow');
54				$('body').css('overflow','hidden');
55				$("header").addClass('open');
56				$("#sp_menu").addClass('is-open');
57			}
58		return false;
59		}
60	});
61	
62	
63	jQuery.event.add(window, "load scroll resize", function(){
64		w = $(window).width();
65		height = $(window).height();
66		scrollx = $(this).scrollTop();
67		header_h = $("header").outerHeight();
68		if (jQuery(this).scrollTop() > header_h) {
69			$("header").addClass('fixed_header');
70		} else {
71			$("header").removeClass('fixed_header');
72		}
73	});
74	
75
76	jQuery('.scroll').click(function(event) {
77		var object = jQuery(this).attr('href');
78		if($("body").hasClass('spmode')){
79			var offset = 34;
80				$(".header_right").stop(true,true).fadeOut();
81				$("#sp_menu").removeClass('is-open');
82				$("header").removeClass('open');
83				$('body').css('overflow','visible');
84		}else{
85			var offset = $("header").outerHeight()-55;
86		}
87		if(jQuery(object).length){
88			var position = jQuery(object).offset().top;
89		}else{
90			var position = 0;
91		}
92		position = position -offset;
93		jQuery('html, body').animate({scrollTop: position}, 600);
94		event.preventDefault();
95	})
96	
97	jQuery.event.add(window, "load scroll resize", function(){
98		if($("body").hasClass('spmode')){
99			var offset = 80;
100		}else{
101			var offset = $(window).height()/2 - $('.index_grade_box').outerHeight()/2;
102		}
103		var scrollp = $(window).scrollTop()+ $(window).height() - offset;
104		$('.blue_back').each(function(index, element){
105			blue_back = $(element).offset().top;
106			if(scrollp >= blue_back){
107				index_grade2_p = scrollp - blue_back - $('.index_grade_box').outerHeight();
108				$('.index_grade2').css('top',index_grade2_p);
109				console.log(scrollp + '/' +blue_back );
110			}
111		});
112		
113		if($("body").hasClass('spmode')){
114			height = $(window).height();
115			height2 = height -80;
116			$('.index_grade').css('height',height2);
117			$('.index_main .contents_inner').css('height',height2);
118		
119		}
120	});
121
122	$('.index_grade_slide').slick({
123		fade: true,
124		dots: false,
125		arrows: false,
126		autoplay: true,
127		autoplaySpeed: 2000,
128		speed: 2000
129	});
130
131$('.index_sec_voice_container').slick({
132	arrows: true, // true に変更して矢印を表示
133	dots: true,
134	// ▼以下2行を追加
135	appendArrows: $('.voice-slider-controls'), // 矢印を.voice-slider-controlsの中に出力
136	appendDots: $('.voice-slider-controls'),   // ドットも.voice-slider-controlsの中に出力
137	
138	centerMode: true,
139	centerPadding: '200px',
140	slidesToShow: 1,
141	responsive: [
142		{
143			breakpoint: 768,
144			settings: {
145				centerPadding: '20px',
146			}
147		}
148	]
149});
150	$('.index_sec_voice_container').on('beforeChange', function(event, slick, currentSlide, nextSlide){
151		if($("body").hasClass('pcmode')){
152			var slide_num = $('.slick-dots li').length;
153			var before_slide = slide_num - 1;
154			console.log(nextSlide , slide_num);
155		$('.slick-slide[data-slick-index="-1"]').addClass('slick-big');
156		if(currentSlide == before_slide){
157			$('.slick-slide[data-slick-index="'+slide_num+'"]').addClass('slick-big');
158		} else {
159			$('.slick-slide[data-slick-index="'+slide_num+'"]').removeClass('slick-big');
160		}
161		if( currentSlide > 0 ){
162			$('.slick-slide[data-slick-index="-1"]').removeClass('slick-big');
163		}
164		}
165	});
166
167
168	$(".index_sec_service_movie a").modaal({type: 'video'});
169	$('.index_sec_voice_more_btn').on('click', function() {
170		// .index_sec_voice_hidden要素の表示・非表示を切り替える
171		$('.index_sec_voice_hidden').toggleClass('visible');
172	
173		// ボタンのテキストを「more」と「close」で切り替える
174		var $span = $(this).find('span');
175		if ($span.text() === 'more') {
176			$span.text('close');
177		} else {
178			$span.text('more');
179		}
180	});
181
182});
183
184$(window).on('load', function(){
185	$('.blue_back').each(function(index, element){
186		content = $(element).find('.blue_back_contents');
187		memheight = content.outerHeight();
188		$(element).find('.blue_back_color').css('height',memheight);
189		$(element).css('height',memheight);
190	});
191	$('#loading').delay(1000).fadeOut(300);
192});
193	// DOMが読み込まれたら実行
194document.addEventListener('DOMContentLoaded', function() {
195
196	// 1. 記事を表示させるためのHTML要素を取得
197	const container = document.getElementById('news-list-container');
198	if (!container) return; // コンテナがなければ何もしない
199
200	// 2. 指定したタグIDの記事を取得するように変更
201	const tagId = 129; // ← ここに「トップページ掲載」タグのID(数字)を入力してください
202	const numberOfPosts = 6; // 表示したい記事の件数を指定します(お好みで変更してください)
203
204	// 3. WordPress REST APIのエンドポイントURLを作成
205	const apiUrl = `https://magazine.inq.finance/wp-json/wp/v2/posts?tags=${tagId}&per_page=${numberOfPosts}&_embed`;
206	// 4. APIにリクエストを送り、データを取得してHTMLを生成
207	fetch(apiUrl)
208		.then(response => {
209			if (!response.ok) {
210				throw new Error('Network response was not ok');
211			}
212			return response.json();
213		})
214		.then(posts => {
215			let html = '';
216			
217			// sortedPostsの行を削除し、 यहांを posts.forEach に変更
218			posts.forEach(post => {
219				// アイキャッチ画像のURLを取得
220				const imageUrl = post._embedded?.['wp:featuredmedia']?.[0]?.source_url || 'https://placehold.jp/320x240.png?text=No Image';
221
222				// 日付を「YYYY.MM.DD」形式にフォーマット
223				const postDate = new Date(post.date);
224				const formattedDate = `${postDate.getFullYear()}.${String(postDate.getMonth() + 1).padStart(2, '0')}.${String(postDate.getDate()).padStart(2, '0')}`;
225
226				// カテゴリー名を取得
227				const category = post._embedded?.['wp:term']?.[0]?.[0]?.name || '未分類';
228
229				// 記事一件ごとのHTMLを組み立てる
230				html += `
231					<div class="index_sec_news_box">
232						<div class="index_sec_news_thumb"><img src="${imageUrl}" alt="${post.title.rendered}"></div>
233						<div class="index_sec_news_cat"><span>${category}</span></div>
234						<div class="index_sec_news_title">${post.title.rendered}</div>
235						<div class="index_sec_news_date">${formattedDate}</div>
236						<a href="${post.link}" target="_blank" class="boxlink">${post.title.rendered}</a>
237					</div>
238				`;
239			});
240			
241			// 生成したHTMLをコンテナに挿入
242			container.innerHTML = html;
243		})
244		.catch(error => {
245			console.error('記事の取得に失敗しました:', error);
246			container.innerHTML = '<p>ニュース記事を読み込めませんでした。</p>';
247		});
248});

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.