PageSourceSearch

https://www.mmc.co.jp/corporate/ja/js/topics-list.js

js mmc.co.jp collected 2026-10-02 03:05:59 UTC 3,734 bytes, 160 lines download raw bytes

1/* topics-list.js */
2function loadtopicsList_Main( sw_content, bOwn ) {
3	var $slider = $('.js-mmcNoticeSlider');
4	if(!$slider.length) {
5		console.debug('target not found');
6		return;
7	}
8
9    // 二重初期化防止
10    if($slider.hasClass('slick-initialized')) return;
11
12	var htmlItem = '';
13	htmlItem += '<div class="mmcNoticeCarousel__slider js-mmcNoticeSlider">';
14
15	for(let i=0; i<sw_content.item.length; i++) {
16		let item = sw_content.item[i];
17
18		let entrydate = '';
19		if(item.entrydate) {
20		    entrydate = ` datetime="${item.entrydate}"`;
21		}
22
23		// リンク先
24		let link_href = '';
25		if(!!item.href) {
26			link_href = ` href="${item.href}"`;
27		}
28
29		// 外窓・内窓
30		let link_target = '';
31		if(!!item.target) {
32			link_target = ` target="${item.target}"`;
33		}
34
35		// 日付
36		let itemdate = '';
37		if(!!item.date) {
38			itemdate = `<time class="mmcNoticeCard__date" ${entrydate}>${item?.date}</time>`;
39		}
40
41		let itemimg = '';
42		if(!!item.n_img && !!item.n_img?.href) {
43			let imgalt = item.n_img?.alt || '';
44			itemimg = `<img src="${item.n_img?.href}" alt="" loading="lazy">`;
45		}
46
47		// カテゴリラベル
48		let label_category = '';
49		let icon_category = '';
50		if(!!item.c_icon?.length
51		  && item.c_icon?.length >0 ) {
52			for(let i=0; i< item.c_icon.length; i++) {
53				if(item.c_icon[i].name == 'renkei') continue;
54				if(item.c_icon[i].name == 'news') continue;
55				if(item.c_icon[i].name == 'news_ja') continue;
56				if(item.c_icon[i].name == 'news_en') continue;
57				if(item.c_icon[i].name == 'view-on-topics') continue;
58				if(item.c_icon[i].name == 'hide-date-on-topics') {
59					itemdate = '';
60					continue;
61				}
62				if(item.c_icon[i].path && (item.c_icon[i].path || '').split('/').length <2 ) continue;
63				label_category = item.c_icon[i].label;
64			}
65		}
66
67		// ダウンロードアイコン(PDF)
68		let d_icon = '';
69		if(!!item.d_icon) {
70			d_icon = `<span class="d_icon"></span>`;
71		}
72
73		// ファイルサイズ
74		let filesize = '';
75		if(!!item.filesize) {
76			filesize = `<span class="filesize">${item?.filesize}</span>`;
77		}
78
79		// NEWアイコン
80		let new_icon = '';
81		if(item.n_icon) {
82			new_icon = `<span class="new"></span>`;
83		}
84
85
86		// 1件分のニュースhtml
87		htmlItem += 
88`<a class="mmcNoticeCard" ${link_href}${link_target}>
89	<div class="mmcNoticeCard__img">
90		${itemimg}
91	</div>
92
93	<div class="mmcNoticeCard__body">
94		<div class="mmcNoticeCard__meta">
95			${itemdate}
96			<span class="mmcNoticeCard__tag">${label_category}</span>
97		</div>
98		<h3 class="mmcNoticeCard__title">
99			${item.news_tx || ''} ${item.det_tx ?'<br><span>' +item.det_tx +'<span>':''}
100		</h3>
101	</div>
102</a>
103`;
104
105	}
106
107	htmlItem += '</div>';
108
109	$slider.replaceWith(htmlItem);
110
111	$slider = $('.js-mmcNoticeSlider');
112    $slider.slick({
113      infinite: true,
114      slidesToShow: 2,
115      slidesToScroll: 1,
116      dots: true,
117      arrows: true,
118
119      // append先(重要)
120      appendArrows: $('.mmcNoticeCarousel__arrows'),
121      appendDots: $('.mmcNoticeCarousel__dots'),
122
123      autoplay: true,
124      autoplaySpeed: 4000,
125      speed: 450,
126      pauseOnHover: true,
127      pauseOnFocus: true,
128      adaptiveHeight: false,
129
130      responsive: [
131        { breakpoint: 768, settings: { slidesToShow: 1, arrows: false } }
132      ]
133    });
134
135//	   console.debug(''+htmlItem);
136}
137
138function loadtopicsList( hrefSw, card ) {
139	if(!$ || !$.fn || !$.fn.slick) return;
140
141	var bOwn = false;
142	if(!hrefSw) {
143		hrefSw = $(location).attr('href');
144		bOwn = true;
145	}
146
147	getSWcontent({
148		href: hrefSw,
149		card: card,
150		type: 'multi3',
151	}, function(rcv_data) {
152//		console.debug(''+rcv_data);
153		var sw_content = JSON.parse(rcv_data);
154
155		loadtopicsList_Main( sw_content, bOwn, hrefSw );
156	}, function() {
157		// rejected
158		console.assert(false, "load fail");
159	});
160}

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.