PageSourceSearch

https://miyabitei.jp/wp/wp-content/themes/toho-miyabitei/assets/js/module.js?ver=1732866540

js miyabitei.jp collected 2026-10-04 05:44:19 UTC 9,056 bytes, 312 lines download raw bytes

1var break_sp = '(max-width:599px)';
2var break_tb = '(min-width:600px) and (max-width: 1599px)';
3var break_pc = '(min-width:1600px)';
4
5var scroll_to_top = 200;
6// var scroll_fix_header = 100;
7
8jQuery(function($) {
9  
10  $(window).on('load resize', function(){
11
12    // フッターメニュー高さ制御
13    if( ( window.matchMedia( break_tb ).matches || window.matchMedia( break_pc ).matches ) ) {
14      // SP以外では最も大きなリスト項目の高さを最大に
15      var li_max_h = 0;
16      $( '#footer .foot_menu .menu_list > li' ).each(function(){
17        if( $(this).outerHeight() > li_max_h ) {
18          li_max_h = $(this).outerHeight();
19        }
20        $( '#footer .foot_menu .menu_list' ).height( li_max_h );
21      });
22    } else {
23      // SP時は高さ自動
24      $( '#footer .foot_menu .menu_list' ).height( 'auto' );
25    }
26
27    // スライドブロック
28    
29
30  });
31
32  // グロナビ制御
33  $('#gnav a').click(function(element) {
34    $('#gnav_switch').prop('checked',false);
35  });
36  $(window).bind("unload",function(){
37    $('#gnav_switch').prop('checked',false);
38  });
39
40
41  // SPLIT MAIL
42  $( 'body' ).delegate( '[data-mailto="true"].split_mail' , 'click', function() {
43    var mail_d = $( this ).children( '.mail_d' ).text();
44    var mail_a = $( this ).children( '.mail_a' ).text();
45    location.href = "mailto:" + mail_a + '@' + mail_d;
46  });
47  
48  // SCROLL
49  var startP = 0;
50  $(window).scroll(function () {
51    var windowP = $(this).scrollTop();
52    
53    // TO TOP
54    var BtnPagetop = $( '.totop_btn' );
55    if ( windowP > scroll_to_top) {
56      BtnPagetop.addClass('-active');
57    } else {
58      BtnPagetop.removeClass('-active');
59    }
60    
61    var $header = $('.site_header');
62    var $content = $('.site_content');
63    if ( windowP >= $content.offset().top ) {
64      $header.addClass('-outside');
65    } else {
66      $header.removeClass('-outside');
67    }
68    startP = windowP;
69    /*
70    startP = windowP;
71    var header = $( '#header' );
72    var fix_mode = header.data('fix');
73    if( fix_mode != undefined ){
74			if ($(this).scrollTop() > header.outerHeight() ) {
75        if( ( window.matchMedia( break_pc ).matches && fix_mode.indexOf('pc') != -1 ) 
76           || ( window.matchMedia( break_tb ).matches && fix_mode.indexOf('tb') != -1 ) 
77           || ( window.matchMedia( break_sp ).matches && fix_mode.indexOf('sp') != -1 ) 
78          ) {
79          header.addClass('-fix');
80        }
81      } else {
82        header.removeClass('-fix');
83      }
84    }
85    */
86
87  });
88
89  
90	$(document).ready(function(){
91
92    // SVG SIZE(viewBox参照)
93    // svg_viewBox_size();
94
95		var hash = location.hash;
96		if( hash.length > 0 ){
97			scrollToAnchor( hash );
98		}
99
100	});
101
102
103  /* INVIEW ////////////////////////////// */
104  $(document).ready(function() {
105    $('section:not(.no_inview), [data-inview]').attr( 'data-inview', false );
106  });
107  $('section:not(.no_inview), [data-inview]').on('inview', function( event, isInView ) {
108    if ( isInView ) { 
109      $(this).attr( 'data-inview', true );
110    } 
111    else {
112      if( $(this).attr( 'data-inview_each' ) == 'true' ) {
113        $(this).attr( 'data-inview', false );
114      }
115    }
116  });
117  
118
119  /* ANCHOR CLICK ////////////////////////////// */
120  $( 'a[href^="#"]').click(function(element) {
121		if( $(this).data('scroll-ancor') != false ) {
122      element.preventDefault();
123      $( 'html' ).removeClass('-fixed');
124      $('#header_switch:checked').prop( 'checked', false );
125      var anchor = $(this).attr('href');
126
127      var tab_controls = $( anchor ).attr('aria-controls');
128      if ( tab_controls != undefined && $( '#' + tab_controls ).length > 0 ) {
129      var tablist = $( this ).parents( '[role="tablist"]' );
130        $( '#' + tab_controls ).attr( 'aria-hidden', 'true' );
131        window.globalFunction.tab_accordion( tablist, anchor );
132      }
133
134			scrollToAnchor( anchor );
135		}
136  });
137  
138
139  /* POPUP ////////////////////////////// */
140
141  $('.popup_image > a, [data-popup="image"], a[href$=".jpg"]:not([data-popup="false"]):not([download]), a[href$=".png"]:not([data-popup="false"]):not([download])').magnificPopup({ 
142    type: 'image',
143  });
144  $('.popup_iframe > a, [data-popup="iframe"]').magnificPopup({ 
145    type: 'iframe'
146  });
147  $('.popup_inline > a, [data-popup="inline"]').magnificPopup({ 
148    type: 'inline'
149  });
150  $('.popup_ajax > a, [data-popup^="ajax"]').each(function(){
151    var target = $( this ).data( 'popup' );
152    target = target.replace(/^ajax/g, '');
153    if( target == '' ){
154      $( this ).magnificPopup({ 
155        type: 'ajax'
156      });
157    } else {
158      $( this ).magnificPopup({ 
159        type: 'ajax', 
160        callbacks: {
161          parseAjax: function(mfpResponse) {
162            mfpResponse.data = $(mfpResponse.data).find( target );
163          }
164        }
165      });
166    }
167  });
168  
169
170  if( $('.gallery').length > 0 ) {
171    var wp_gallery_num = 1;
172    $( '.gallery' ).each(function(){
173      var gallery_id = $( this ).attr( 'id' );
174      if( gallery_id == undefined ) {
175        gallery_id = 'wp_gallery_' + wp_gallery_num;
176        $( this ).attr( 'id', gallery_id );
177        wp_gallery_num++;
178      }
179      $('#' + gallery_id + ' figure.gallery-item a' ).magnificPopup({ 
180        type: 'image',
181        gallery: {
182          enabled:true
183        }, 
184        image: {
185          titleSrc: function(item) {
186            var caption = item.el.parents('figure').find('figcaption').text();
187            return caption;
188          }
189        }
190      });
191    });
192  }
193
194  if( $('[data-popup="gallery"]').length > 0 ) {
195    var gallery_num = 1;
196    $( '[data-popup="gallery"]' ).each(function(){
197      var gallery_id = $( this ).attr( 'id' );
198      if( gallery_id == undefined ) {
199        gallery_id = 'popup_gallery_' + gallery_num;
200        $( this ).attr( 'id', gallery_id );
201        gallery_num++;
202      }
203      $('#' + gallery_id ).magnificPopup({ 
204        delegate: 'a', 
205        type: 'image', 
206        gallery: {
207          enabled:true
208        }
209      });
210    });
211  }
212
213  $(document).ready(function() {
214    
215		$( '.wp-block-file__button' ).removeAttr('download');
216		$( '.wp-block-file__button' ).attr('target', '_blank');
217
218		$( '.wp-block-file__button' ).each(function(){
219      var elm = $(this);
220      var fileurl = $(this).attr('href');
221      var filetxt = $(this).prev('a[id^="wp-block-file"]').html();
222      if( filetxt.length > 0 ) {
223        $(this).attr('download',filetxt);
224      }
225      if( fileurl != undefined ) {
226        $.ajax({
227          type: 'POST', 
228          url: ajaxurl, 
229          dataType: 'json', 
230          data: {
231            'action': 'ajaxfileinfo', 
232            'fileurl': fileurl
233          }, 
234          success: function( response ){
235						var filetype = response.type;
236						filetype = filetype.replace( ' file', '' );
237						filetype = filetype.replace( ' image', '' );
238            var html = filetype;
239            if (response.size != undefined) {
240              html+= '/' + response.size;
241            }
242						html = '<small class="fileinfo">(' + html + ')</small>';
243            elm.append( html );
244          }, 
245          error: function( response ){
246            console.log('Ajax "File Info" Error');
247          }
248        });
249      }
250    });
251
252  });
253
254});
255
256// SCROLL to ANCHOR
257function scrollToAnchor( anchor ) {
258  jQuery(function($) {
259    
260    if( !$('#header').hasClass('-active') ) {
261      $('#header').addClass('-active');
262    }
263    
264    var speed = 400;
265		var target = $( anchor == "#" || anchor == '' ? 'html' : anchor );
266    if( target.length > 0 ){
267			var position = target.offset().top;
268			position = Math.round(position);
269			var fix_mode = $( '#header' ).data('fix');
270			if( fix_mode != undefined ){
271				if( ( window.matchMedia( break_pc ).matches && fix_mode.indexOf('pc') != -1 ) 
272					 || ( window.matchMedia( break_tb ).matches && fix_mode.indexOf('tb') != -1 ) 
273					 || ( window.matchMedia( break_sp ).matches && fix_mode.indexOf('sp') != -1 ) 
274					) {
275					var header_h = $( '#header' ).outerHeight();
276					position = position - header_h - 30;
277				}
278			}
279			// console.log(position);
280			$("html").animate({scrollTop:position}, speed, "swing");
281    }
282    return false;
283  });
284}
285
286// SVG VIEWBOX SIZE ※viewBox値を参照し、「32 = 1em」としてサイズCSS付与
287/*
288function svg_viewBox_size() {
289  jQuery(function($) {
290
291    var svg_list = document.getElementsByTagName( 'svg' );
292    for( var i = 0; i < svg_list.length; i++ ){
293      var svg_obj = svg_list[i];
294      var flag = svg_obj.getAttribute( 'data-svgsize' );
295      if( $( svg_obj ).data( 'icon' ) == 'instagram' || $( svg_obj ).data( 'icon' ) == 'clone' ){
296        flag = 'false';
297      }
298      if( flag != 'false' ){
299        var viewBox = svg_obj.getAttribute( 'viewBox' );
300        if( viewBox != undefined && viewBox.length > 0 ){
301          var svg_size = viewBox.match(/^(\d{1,4}) (\d{1,4}) (\d{1,4}) (\d{1,4})$/g);
302          var svg_w = ( RegExp.$3 - RegExp.$1 ) / 32;
303          var svg_h = ( RegExp.$4 - RegExp.$2 ) / 32;
304          svg_obj.style.width = svg_w + 'em';
305          svg_obj.style.height = svg_h + 'em';
306        }
307      }
308    }  
309
310  });
311}
312*/

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.