PageSourceSearch

https://g-startup.jp/js/news.js?ver=1.0.1

js g-startup.jp collected 2026-10-04 14:46:50 UTC 3,578 bytes, 120 lines download raw bytes

1$(function () {
2
3	<!-- microcms-js-sdkを正しく読み込む -->
4	  // デバッグ用のログ
5  
6	  // microCMSクライアントを作成
7	  const client = microcms.createClient({
8		serviceDomain: 'hodai-globis',
9		apiKey: '64c82bfcd18c4ee7b78d5b76d20263dba708',
10	  });
11  
12	  // デバッグ用のログ
13  
14	  // ニュースを取得して表示
15	  function fetchNews() {
16		
17		client.get({
18		  endpoint: 'article',
19		  queries: {
20			limit: 500,
21			fields: ['id', 'name', 'publishedAt', 'tag', 'category', 'image', 'main_image'],
22			filters: 'publishedAt[greater_than]2024-01-01',
23			orders: '-publishedAt'
24		  },
25		})
26		.then((res) => {
27		  if (!res || !res.contents || !Array.isArray(res.contents)) {
28			console.error('予期しないレスポンス形式:', res);
29			return;
30		  }
31  
32  
33		  // G-STARTUPタグを持つ記事をフィルタリング
34		  const filteredContents = res.contents.filter(news => {
35			if (!news.tag || !Array.isArray(news.tag)) return false;
36			
37			// 各記事のタグをログ出力
38			
39			return news.tag.some(tag => {
40			  // タグの構造をログ出力
41			  
42			  if (typeof tag === 'string') {
43				return tag === 'G-STARTUP';
44			  }
45			  if (typeof tag === 'object' && tag !== null) {
46				return tag.name === 'G-STARTUP';
47			  }
48			  return false;
49			});
50		  });
51  
52  
53		  // 最初の3件に制限
54		  const limitedContents = filteredContents.slice(0, 3);
55  
56		  if (limitedContents.length === 0) {
57			console.log('該当するコンテンツが存在しません');
58			const newsList = document.getElementById('news-list');
59			newsList.innerHTML = '<li>2024年以降のG-STARTUP記事は見つかりません</li>';
60			return;
61		  }
62  
63		  const newsList = document.getElementById('news-list');
64		  newsList.innerHTML = '';
65		  limitedContents.forEach(news => {
66			const listItem = document.createElement('li');
67			// listItem.style.marginBottom = '20px';
68			
69  
70			// 記事のコンテナを作成
71			const contentDiv = document.createElement('div');
72			contentDiv.style.display = 'inline-block';
73			contentDiv.style.verticalAlign = 'middle';
74  
75			// タイトルをリンクにする
76			const titleLink = document.createElement('a');
77			titleLink.href = `https://globis.jp/article/${news.id}`; // URLを修正
78			titleLink.target = '_blank';
79			titleLink.textContent = news.name || '無題';
80			titleLink.style.textDecoration = 'none';
81			// titleLink.style.color = '#333';
82			// titleLink.style.fontWeight = 'bold';
83			contentDiv.appendChild(titleLink);
84  
85			// 日付を追加
86			const date = new Date(news.publishedAt);
87			const formattedDate = `${date.getFullYear()}.${date.getMonth() + 1}.${date.getDate()}`;
88			const dateSpan = document.createElement('span');
89			dateSpan.textContent = ` ${formattedDate}`;
90			dateSpan.style.color = '#666';
91			contentDiv.appendChild(dateSpan);
92  
93			// タグ情報を追加
94			// if (news.tag && Array.isArray(news.tag)) {
95			//   const tagNames = news.tag.map(tag => 
96			// 	typeof tag === 'string' ? tag : (tag.name || 'Unknown tag')
97			//   );
98			//   const tagSpan = document.createElement('span');
99			//   tagSpan.textContent = ` [Tags: ${tagNames.join(', ')}]`;
100			//   tagSpan.style.color = '#888';
101			//   contentDiv.appendChild(tagSpan);
102			// }
103  
104			listItem.appendChild(contentDiv);
105			newsList.appendChild(listItem);
106		  });
107  
108		  // リストのスタイルを調整
109		  newsList.style.listStyle = 'none';
110		  newsList.style.padding = '0';
111		})
112		.catch((error) => {
113		  console.error('エラーの詳細:', error);
114		});
115	  }
116  
117	  // 即時実行
118	  fetchNews();
119  
120});

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.