PageSourceSearch

https://lamire.jp/wp-content/themes/lamire-theme/asset/js/pc.js?ver=6.9.9&ts=1uudt3s

js lamire.jp collected 2026-10-02 11:41:27 UTC 7,765 bytes, 301 lines download raw bytes

1console.log("sp script loaded");
2
3(function ($) {
4	"use strict";
5
6	/**
7	 * グローバルナビ
8	 */
9	$(function () {
10		$(".page-header-nav .open-menu")
11			.on("mouseover", function (e) {
12				var elm = $(this).find("ul");
13				elm.addClass("open");
14				return false;
15			})
16			.on("mouseout", function (e) {
17				var elm = $(this).find("ul");
18				elm.removeClass("open");
19				return false;
20			});
21
22		$(".page-header-nav .open-menu > a").on("click", function (e) {
23			if ($(this).html().indexOf("きぶん") >= 0) {
24				return false;
25			}
26		});
27	});
28
29	/**
30	 * aタグタップ時にclass=activeを設定
31	 */
32	$(function () {
33
34		function touchStartHandler(e) {
35			$(this).addClass("active");
36		}
37
38		function touchEndHandler(e) {
39			$(this).removeClass("active");
40		}
41
42		$('a')
43			.on('touchstart', touchStartHandler)
44			.on('touchend', touchEndHandler);
45	});
46
47	/**
48	 * ピックアップのスライドショー
49	 */
50	//オプションパラメータ、イベント一覧
51	//http://ithat.me/2016/10/17/how-to-use-slick-jquery-plugin
52	$(function () {
53		var titleIndex = -1;
54
55		function setSlideTitle(title) {
56			if (titleIndex === -1 || titleIndex === 2) {
57				$(".pickup-slide-title1")
58					.addClass("show")
59					.html(title);
60				$(".pickup-slide-title2").removeClass("show");
61				titleIndex = 1;
62			} else {
63				$(".pickup-slide-title2")
64					.addClass("show")
65					.html(title);
66				$(".pickup-slide-title1").removeClass("show");
67				titleIndex = 2;
68			}
69		}
70
71		if($.fn.slick){
72			$('.pickup-slide')
73				.on('init', function (event, slick) {
74					var title = $(slick.$slides.get(0)).attr('data-title');
75					setSlideTitle(title);
76				})
77
78				.on('beforeChange', function (event, slick, currentSlide, nextSlide) {
79					var title = $(slick.$slides.get(nextSlide)).attr('data-title');
80					setSlideTitle(title);
81				})
82
83				.slick({
84					dots: true,
85					infinite: true,
86					slidesToShow: 1,
87					centerMode: true,
88					centerPadding: "60px",
89					variableWidth: true,
90					arrows: true,
91					autoplay: true,
92					autoplaySpeed: 2000,
93					speed: 600,
94				});
95			$(".pickup").animate({opacity: 1}, 1000);
96		}
97        
98         $('.pickup-slide1').slick({
99					dots: true,
100					infinite: true,
101					slidesToShow: 1,
102					centerMode: true,
103					centerPadding: "60px",
104					variableWidth: true,
105					arrows: false,
106					autoplay: true,
107					autoplaySpeed: 2000,
108					speed: 600
109        });
110        
111		/**
112		 * クリップのヒント表示
113		 */
114		(function () {
115			// トップのみ表示
116			if (location.href.replace(location.protocol + "//" + location.host, '') === '/') {
117
118				if (!localStorage.getItem("assist-clip")) {
119					$('a.clip-btn').first().baloonTip({
120						content: "クリップすると<br>あとで読むことができます",
121						id: "clip-btn-in-article",
122						direction: "top",
123						showTimeout: 8000,
124						singleton: true,
125						delay: 1000,
126						offset: {
127							top: -7,
128							left: -10
129						},
130						width: '200px',
131						onShow: function () {
132							localStorage.setItem("assist-clip", true);
133						}
134					});
135				}
136
137				// クリップ押された時
138				if (!localStorage.getItem("assist-clip-list")) {
139
140					var onClipBtnClick = function () {
141						$(".page-header-btn-clip").baloonTip({
142							content: "クリップした記事を<br>見ることができます",
143							direction: "top-right",
144							showTimeout: 5000,
145							animationTimeout: 7000,
146							delay: 1000,
147							offset: {
148								top: 3,
149								left: -10
150							},
151							fixed: true,
152							width: '200px',
153							singleton: true,
154							hideOthers: true,
155							onShow: function () {
156								localStorage.setItem("assist-clip-list", true);
157								$('.clip-btn').off('click', onClipBtnClick);
158							}
159						});
160					};
161
162					$('.clip-btn').on('click', onClipBtnClick);
163				}
164			}
165
166		})();
167
168	});
169
170	/**
171	 * IE/edgeのonject-fit-img対応用
172	 */
173	var userAgent = window.navigator.userAgent.toLowerCase();
174	var isIE = (userAgent.indexOf('msie') >= 0 || userAgent.indexOf('trident') >= 0);
175	var isEdge = userAgent.indexOf('edge') >= 0;
176	if (isIE || isEdge) {
177		$(function () {
178			objectFitImages('img.object-fit-img');
179		});
180	}
181
182	/**
183	 * 検索フォーム:オートコンプリート
184	 */
185	$(function(){
186		var searchForm = $('#s');
187		var keywordData = {};
188
189		/*
190		$.Deferred().resolve()
191			.then(function() {
192				var d = new $.Deferred();
193				$.ajax({
194					url: 'https://s3-ap-northeast-1.amazonaws.com/xzmedia-content/app-resources/search/popular-keyword-list.json',
195					type:'get',
196					dataType: 'json',
197					timeout:10000,
198				}).done(function(data) {
199					d.resolve(data);
200				}).fail(function(XMLHttpRequest, textStatus, errorThrown) {
201					console.log("error");
202					d.restore();
203				});
204				return d.promise();
205			})
206			.then(function(data) {
207				//非同期でのデータ取得完了
208				keywordData = data;
209				if(searchForm.val() == ''){
210					//検索フォームが空なら人気のキーワードを表示
211					setAutoCompletePopularKeyword(keywordData);
212				}
213
214				searchForm.on('change', function(){
215					if(searchForm.val() == ''){
216						//検索フォームが空なら人気のキーワードを表示
217						setAutoCompletePopularKeyword(keywordData);
218					}else{
219						$("#s").off('focus blur');
220						$("#autocomplete-popular-keyword").remove();
221					}
222				});
223			});
224		*/
225
226		function setAutoCompletePopularKeyword(data){
227			var topOffset = searchForm.offset().top + searchForm.outerHeight() + 10;
228			var leftOffset = searchForm.offset().left;
229			var width = 300;
230
231			$("#s").on('focus', function(){
232				var autoCompletePopularKeyword = $("#autocomplete-popular-keyword");
233				if(autoCompletePopularKeyword.length){
234					autoCompletePopularKeyword.show();
235
236				}else{
237					var popularKeywordArea = $("<div>")
238						.addClass("popular_keyword_area")
239						.attr("id", "autocomplete-popular-keyword")
240						.css({top:topOffset+"px", left:leftOffset+"px", width:width+"px"});
241					popularKeywordArea.append($("<p>").text("人気のキーワード"));
242
243					var popularKeywordList = $("<ul>").addClass("popular_keyword_list").attr("tabindex", "0");
244					$.each(data, function(i, item) {
245						var li = '<li class="ui-menu-item">';
246						li += '<span><img src="'+item.thumb+'" alt="'+item.keyword+'" /></span>';
247						li += '<span class="ui-menu-keyword">'+item.keyword+'</span></li>';
248						popularKeywordList.append(li);
249					});
250					popularKeywordArea.append(popularKeywordList);
251
252					$("body").append(popularKeywordArea);
253
254					$(".ui-menu-item").on("click", function(){
255						$("#s").val($(this).find(".ui-menu-keyword").text());
256						$('.searchform').submit();
257					});
258				}
259
260			}).on('blur', function(){
261				$("#autocomplete-popular-keyword").fadeOut(200);
262			});
263		}
264
265		searchForm.autocomplete({
266			appendTo:".search-sub-container",
267			source: function(req, resp){
268				$.ajax({
269					url: autoCompleteApiUrl,
270					type: "POST",
271					cache: false,
272					dataType: "json",
273					data: {
274						query: req.term
275					},
276					timeout:10000,
277				}).done(function(data) {
278					resp(data.result);
279
280				}).fail(function(XMLHttpRequest, textStatus, errorThrown) {
281					console.log("error");
282					resp(['']);
283				});
284			},
285			search: function(event, ui){
286				$("#autocomplete-popular-keyword").fadeOut(200);
287			},
288			select: function(e, ui){
289				$('#s').val(ui.item.value);
290				$('.searchform').submit();
291			},
292			position: {
293				my: "left top+5"
294			},
295			autoFocus: true,
296			delay: 500,
297			minLength: 2
298		});
299	});
300
301})(jQuery.noConflict());

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.