PageSourceSearch

https://gori.me/wp-content/themes/gorime-2019/js/functions.js?ver=20260302074229

js gori.me collected 2026-10-02 03:16:08 UTC 9,248 bytes, 334 lines download raw bytes

1jQuery(function($) {
2
3	var header       = $( '.header' );
4	var searchToggle = $( '.header-search-toggle' );
5
6	if ( header.length ) {
7		var set_pos = 0;
8		searchToggle.on('click', function(){
9			searchpanel();
10		});
11
12		$( window ).keydown( function( e ){
13
14			if ( e.keyCode == 27 ) {
15				$( 'body' ).removeClass( 'search-mode' );
16				$( 'html, body' ).removeAttr( 'style' ).animate({ scrollTop : set_pos }, 1, 'swing');
17			}
18
19			if ( e.keyCode == 191 ) {
20				if( e.shiftKey ){
21					return true;
22				}
23				searchpanel();
24				return false;
25			}
26
27		});
28	}
29
30	function searchpanel() {
31		$( 'body' ).toggleClass( 'search-mode' );
32		if ( $( 'body' ).hasClass( 'search-mode' ) ) {
33			set_pos = $( window ).scrollTop();
34			$( 'body' ).css({
35				'top' : -set_pos,
36				'position' : 'fixed'
37			});
38			$( '#s' ).focus();
39		} else {
40			$( 'html, body' ).removeAttr( 'style' ).animate({ scrollTop : set_pos }, 1, 'swing');
41			$( '#s' ).blur();
42		}
43	}
44
45	$( 'a[href^="#"]' ).on('click', function(){
46    var target = $( $(this).attr('href') );
47    var position = target.offset().top - 60;
48    $( 'html, body' ).animate({ scrollTop : position }, 500, 'swing');
49    return false;
50	});
51
52	var comment_toggle = $( '.comment-toggle' );
53	if ( comment_toggle.length > 0 ) {
54		var comment_textarea = $( '.comment-area-text textarea' );
55		var comment_submit   = $( '.form-submit-button' );
56		var comment_author   = $( '' );
57
58
59		comment_textarea.focusin( function() {
60			comment_toggle.slideDown(200);
61		}).focusout( function() {
62			if ( comment_textarea.val() ) {
63				comment_submit.prop( 'disabled', false );
64			}
65		});
66
67		$( document ).on( 'click', function( event ) {
68			if ( $( event.target ).closest( '.comment-area-author input' ).length === 0 && $( event.target ).closest( '.comment-area-text textarea' ).length === 0 && ! comment_textarea.val() ) {
69				comment_toggle.slideUp(200);
70			}
71		});
72
73		comment_textarea.on('input', function(){
74			if ( comment_textarea.val().length ) {
75				comment_submit.prop( 'disabled', false );
76			} else {
77				comment_submit.prop( 'disabled', true );
78			}
79		});
80
81	}
82
83	var form_trigger = $( '.contactform-trigger' );
84	if ( form_trigger.length ) {
85		form_trigger.on('click', function(){
86			$( '.wpcf7-submit' ).trigger( 'click' );
87		});
88	}
89
90	var term_toggle = $( '.term-list-item' );
91	if ( term_toggle.length ) {
92		term_toggle.find( '.term-item-header' ).on('click', function(){
93			$(this).parent().toggleClass( 'is-open' );
94			$(this).next().slideToggle(300);
95		});
96
97		var term_close = $( '.term-item-close' );
98		if ( term_close.length ) {
99			term_close.on('click', function(){
100				$(this).parent().prev().trigger( 'click' );
101			});
102		}
103	}
104
105	var slider = $( '.slider' );
106	if( slider.length > 0 ){
107		slider.slick({
108			dots: true,
109			slidesToShow: 3,
110			prevArrow: '<div class="slide-arrow slide-prev" title="前へ"><svg viewBox="0 0 5 10" xmlns="http://www.w3.org/2000/svg"><path d="M0 10L5 5L0 0L0 10Z"/></svg></div>',
111			nextArrow: '<div class="slide-arrow slide-next" title="次へ"><svg viewBox="0 0 5 10" xmlns="http://www.w3.org/2000/svg"><path d="M0 10L5 5L0 0L0 10Z"/></svg></div>',
112		});
113	}
114
115	var select = $( '.select-items' );
116	if( select.length > 0 ){
117		select.slick({
118		  infinite: false,
119			slidesToShow: 4,
120 	    variableWidth: true,
121			prevArrow: '<div class="slide-arrow slide-prev" title="前へ"><svg viewBox="0 0 5 10" xmlns="http://www.w3.org/2000/svg"><path d="M0 10L5 5L0 0L0 10Z"/></svg></div><div class="slide-shadow"></div>',
122			nextArrow: '<div class="slide-arrow slide-next" title="次へ"><svg viewBox="0 0 5 10" xmlns="http://www.w3.org/2000/svg"><path d="M0 10L5 5L0 0L0 10Z"/></svg></div><div class="slide-shadow"></div>',
123		});
124	}
125
126	var gallery = $( '.main-gallery' );
127	if ( gallery.length ) {
128		var _gaq = _gaq || [];
129
130		 gallery.slick({
131	 	  infinite: true,
132		  slidesToShow: 1,
133		  slidesToScroll: 1,
134			prevArrow: '<div class="slide-arrow slide-prev" title="前へ"><svg viewBox="0 0 5 10" xmlns="http://www.w3.org/2000/svg"><path d="M0 10L5 5L0 0L0 10Z"/></svg></div>',
135			nextArrow: '<div class="slide-arrow slide-next" title="次へ"><svg viewBox="0 0 5 10" xmlns="http://www.w3.org/2000/svg"><path d="M0 10L5 5L0 0L0 10Z"/></svg></div>',
136		});
137
138		var current_num = $( '.gallery-count-current' );
139
140		var thumbnails = $( '.post-gallery-thumbnails' ).find( '.image-gallery-item' );
141		thumbnails.on('click', function(){
142			thumbnails.removeClass( 'is-active' );
143			$(this).addClass( 'is-active' );
144			var index = thumbnails.index(this);
145			gallery.slick( 'slickGoTo', index, false );
146			current_num.text( index + 1 );
147		});
148
149		var current = $( '.current' );
150		var num = current.parent().data( 'history' );
151		if ( num !== 1 ) {
152			thumbnails.removeClass( 'is-active' );
153			thumbnails.eq( num - 1 ).trigger( 'click' );
154		}
155
156		 gallery.on('afterChange', function(){
157		 	var changed = $( '.slick-current' ).data( 'slick-index' );
158
159			var url = changed + 1;
160			history.pushState(null, null, url);
161			var path = location.pathname;
162			var trackingUrl = path.replace(/(\d+)\/?$/g, url);
163
164			if (typeof ga !== 'undefined') {
165				ga("set", "page", trackingUrl);
166				ga('send', 'pageview');
167			}
168
169			thumbnails.removeClass( 'is-active' );
170			thumbnails.eq( changed ).trigger( 'click' );
171		 });
172	}
173
174});
175
176(function($) {
177jQuery(window).on('load', function(){
178
179	var header        = $( '.header' );
180	var single_ad     = $( '.ad-above-content' );
181	if ( single_ad.length > 0 ) {
182		var single_ad_top = single_ad.offset().top;
183		var single_ad_h   = 0;
184		var side_ad     = $( '.sidebar-single-ad' );
185		var	side_ad_top = 0;
186	}
187	if ( side_ad ) {
188		single_ad_h = single_ad.outerHeight();
189		side_ad_h = side_ad.offset().top;
190
191		const ad_layer = single_ad.find( '.ad-above-content-layer' )
192		ad_layer.css({ 'width' : $(window).width() });
193
194		const resize = ()=>{
195			let timeoutID = 0;
196			window.addEventListener( 'resize', () => {
197				clearTimeout(timeoutID);
198				timeoutID = setTimeout( () => {
199					ad_layer.css({ 'width' : $(window).width() });
200				}, 300 );
201			}, false );
202		};
203		resize();
204
205	}
206	$( window ).on('load scroll', function(){
207		var scrolled = $( window ).scrollTop();
208
209		if ( header.length ) {
210			if ( scrolled < 100 ) {
211				$( 'body' ).removeClass( 'release fixed');
212			}
213			if ( scrolled >= 355 ) {
214				$( 'body' ).addClass( 'fixed' ).removeClass( 'release' );
215			}
216		}
217
218		if ( single_ad.length && side_ad_h > 0 ) {
219			if ( scrolled >= 110 ) {
220				single_ad.addClass( 'sticky' );
221			} else {
222				single_ad.removeClass( 'sticky' );
223			}
224
225			if ( scrolled + single_ad_h >= side_ad_h ) {
226				single_ad.addClass( 'scrolled' );
227			} else {
228				single_ad.removeClass( 'scrolled' );
229			}
230		}
231	});
232
233	var review_meter = $( '.meter-area' );
234	if ( review_meter.length ) {
235		var review_pos = review_meter.offset().top - $(window).height()/2;
236		var meter_val  = parseFloat( $( '.rating-score' ).text() );
237		var meter_per  = 150 * meter_val;
238
239		$(window).on('resize', function() {
240			var timer = false;
241	    if ( timer !== false ) {
242	      clearTimeout( timer );
243	    }
244	    timer = setTimeout(function() {
245	    	review_pos = review_meter.offset().top - $(window).height()/2;
246	    }, 200);
247		});
248
249		$(window).on('scroll', function(){
250			if ( $( window ).scrollTop() >= review_pos ) {
251				review_meter.addClass( 'active' ).delay(meter_per).queue(function(){
252		     $(this).addClass( 'stop' );
253				});
254			}
255		});
256
257	}
258
259	var timeline = $( '.post-timeline-expander' );
260	if ( timeline.length ) {
261		timeline.on('click', function(){
262			timeline.prev().addClass( 'expand' );
263		});
264	}
265
266});
267
268	// ========================================
269	// タグ一覧ページ:フィルター検索
270	// ========================================
271	var tagFilterInput = $( '#tag-filter-input' );
272	if ( tagFilterInput.length ) {
273		var tagItems = $( '.taxonomy-tag-item, .taxonomy-popular-item' );
274		var tagGroups = $( '#tag-groups-container .taxonomy-group' );
275		var popularSection = $( '#tag-popular-section' );
276		var jumpNav = $( '#tag-jump-nav' );
277		var noResults = $( '#tag-no-results' );
278		var visibleCount = $( '#tag-visible-count' );
279		var totalCount = $( '#tag-groups-container .taxonomy-tag-item' ).length;
280
281		tagFilterInput.on( 'input', function() {
282			var query = $(this).val().toLowerCase().trim();
283
284			if ( query === '' ) {
285				// 検索クエリが空:すべて表示
286				tagItems.show();
287				tagGroups.show();
288				popularSection.show();
289				jumpNav.show();
290				noResults.hide();
291				visibleCount.text( totalCount );
292				return;
293			}
294
295			// 人気タグセクションとジャンプナビを非表示
296			popularSection.hide();
297			jumpNav.hide();
298
299			var matchCount = 0;
300
301			// 各グループ内のタグをフィルター
302			tagGroups.each( function() {
303				var group = $(this);
304				var groupVisible = false;
305
306				group.find( '.taxonomy-tag-item' ).each( function() {
307					var tagName = $(this).data( 'tag-name' ).toLowerCase();
308					if ( tagName.indexOf( query ) !== -1 ) {
309						$(this).show();
310						groupVisible = true;
311						matchCount++;
312					} else {
313						$(this).hide();
314					}
315				});
316
317				if ( groupVisible ) {
318					group.show();
319				} else {
320					group.hide();
321				}
322			});
323
324			visibleCount.text( matchCount );
325
326			if ( matchCount === 0 ) {
327				noResults.show();
328			} else {
329				noResults.hide();
330			}
331		});
332	}
333
334})(jQuery);

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.