PageSourceSearch

https://printrider.jp/wp-content/themes/insatu/js/common.js?ver=3.5-bp20260323

js printrider.jp collected 2026-10-07 23:02:34 UTC 13,704 bytes, 453 lines download raw bytes

1let In2Common = {};
2
3// remodalの複数重ねの対応
4let g_arrStackModal = [];
5
6jQuery(document).ready(function(){
7    /**
8     * 管理画面のヘッダーバーがある場合の調整
9     */
10    if(document.getElementById("wpadminbar")) {
11        let contents_padding = parseInt(jQuery("#contents").css("padding-top").replace("px", ""));
12
13        // 管理画面のバーの高さ分プラスする
14        contents_padding += 32;
15
16        // paddingを入れる
17        jQuery("header").css("top", 32);
18        jQuery("#contents").css("padding-top", contents_padding);
19        jQuery("#header_submenu").css("padding-top", contents_padding);
20    }
21
22    // 画像遅延読込み
23    in2cart_lazy();
24
25	//ページTOPへ戻る
26	//topBtnは10行目ぐらい下の「$(window).on('scroll', function()」で使用している
27    var topBtn = $('p.pagetop');
28    topBtn.hide();
29	jQuery('p.pagetop a').click(function(){
30		jQuery('html,body').animate({
31			scrollTop: 0
32		}, 300);
33		return false;
34	});
35
36	//--------------------------------------------------------
37	//ヘッダスクロールfix
38	//--------------------------------------------------------
39    $header = $('header');
40	jQuery(window).on('scroll load', function() {
41        let scrollTop = $(this).scrollTop();
42		if (scrollTop > 100) {
43			$header.addClass('fixed');
44		} else {
45			$header.removeClass('fixed');
46		}
47
48        // TOPへも戻るボタン
49        if ($(this).scrollTop() > 100) {
50            topBtn.fadeIn();
51        } else {
52            topBtn.fadeOut();
53        }
54	});
55
56	// 郵便番号の自動保管
57    try {
58        jQuery('#zip').jpostal({
59            postcode : [
60                '#zip'
61            ],
62            address : {
63                '#pref' : '%3',
64                '#address1' : '%4%5', 
65            }
66        });
67        jQuery('#delivery_zip').jpostal({
68            postcode : [
69                '#delivery_zip'
70            ],
71            address : {
72                '#delivery_pref' : '%3',
73                '#delivery_address1' : '%4%5', 
74            }
75        });
76        jQuery('#shipper_zip').jpostal({
77            postcode : [
78                '#shipper_zip'
79            ],
80            address : {
81                '#shipper_pref' : '%3',
82                '#shipper_address1' : '%4%5', 
83            }
84        });
85    } catch(e) {}
86
87	//MW WP Formのセクレクトの「選択してください」のエラー
88    jQuery('div[id^=mw_wp_form_mw-wp-form-] select option[value=""]').html('選択してください');
89
90	//アンカー移動の調整
91	try {
92	    var headerHight = (g_is_pc) ? 130 : 170;
93        jQuery('a[href^="#"]').click(function(){
94			// Smart Sliderは除外
95			if($(this).hasClass("n2-ow")) return false;
96            var href= $(this).attr("href");
97            var target = $(href == "#" || href == "" ? 'html' : href);
98            var position = target.offset().top - headerHight;
99            $("html, body").animate({scrollTop:position}, 550, "swing");
100            return false;
101        });
102	} catch(e){}
103
104	//画像のhover
105	$("a img").not('.online_design_list .thumbnail img').hover(function(){
106		$(this).fadeTo(200, 0.6);
107	},function(){
108		$(this).fadeTo(200, 1.0);
109	});
110
111	//ライトボックス
112	$(".boxer").boxer();
113
114	// 折りたたみ
115	jQuery("dl.toggle dt").click(function() {
116		jQuery(this).next().slideToggle();
117		if(jQuery(this).hasClass("open")) {
118			jQuery(this).removeClass("open");
119		} else {
120			jQuery(this).addClass("open");
121		}
122	});
123
124    /**
125     * ヘッダーメニューの制御
126     */
127    if(!g_is_step_page) {
128        // サブメニューを移動
129        jQuery("#menu-header nav.children").each(function() {
130            jQuery("#header_submenu").append(jQuery(this).clone(true).hide());
131            jQuery(this).remove();
132        });
133
134        // クリック
135        jQuery("#menu-header li").click(function() {
136            let $li = jQuery(this);
137
138            // ヘッダーに装飾
139            jQuery("header").removeClass("menu_click");
140
141            // オーバーレイ削除
142            jQuery("#header_overlay_id").remove();
143
144            // メニューの表示位置を取得
145            let menu_order = jQuery($li).data("menu_order");
146
147            // 要素を取得
148            let $window = jQuery(window),
149                $html = jQuery('html'),
150                $body = jQuery('body'),
151                $header = jQuery('header'),
152                scrollbar_width = window.innerWidth - document.body.scrollWidth,
153                touch_start_y;
154
155            // 表示判定
156            if(jQuery("#menu_panel_" + menu_order).is(":hidden")) {
157
158                // 一旦全て非表示
159                jQuery("#header_submenu nav.children").hide();
160                jQuery("#menu-header li").removeClass("active");
161
162                // 表示
163                jQuery("#menu_panel_" + menu_order).show();
164
165                // オーバーレイ
166                jQuery("body").append('<div id="header_overlay_i
166d" class="header_overlay"></div>');
167
168                // ヘッダーに装飾
169                jQuery("header").addClass("menu_click");
170
171                // メニュー表示
172                jQuery("#header_submenu").slideDown("normal", function() {
173                    jQuery("#header_submenu").scrollTop(0);
174
175                    // header_submenuの高さを設定する
176                    // 設定する事により高さが短い場合は、後ろのbodyが見えるようになる
177                    let panel_height = jQuery("#menu_panel_" + menu_order).outerHeight(true);
178                    let header_height = jQuery("header").height();
179                    let window_height = jQuery(window).height();
180                    if(window_height < (header_height + panel_height)) {
181                        jQuery("#header_submenu").css("height", "auto");
182                        jQuery("#header_submenu").css("bottom", 0);
183
184                    } else {
185                        jQuery("#header_submenu").css("height", header_height + panel_height);
186                        jQuery("#header_submenu").css("bottom", "");
187                    }
188                });
189
190                // ヘッダーメニューのボタンのデザインクラス
191                $li.addClass("active");
192
193                // 後ろのbodyがスクロールしないように制御
194                jQuery('html, body').css('overflow', 'hidden');
195                $html.css('padding-right', scrollbar_width);
196                $header.css('padding-right', scrollbar_width);
197            } else {
198                // メニュー非表示
199                jQuery("#menu_panel_" + menu_order).hide();
200                jQuery("#header_submenu").slideUp();
201                jQuery("#menu-header li").removeClass("active");
202                
203                // 後ろのbodyがスクロールしないように制御
204                $html.removeAttr('style');
205                $header.css('padding-right', 0);
206                $body.removeAttr('style');
207            }
208        });
209    }
210
211    // Modaal(システム用、背景クリックのロック化)
212    jQuery(".modaal_trigger_lock").each(function(index, element) {
213        let id = jQuery(element).attr("id");
214        jQuery("#" + id).modaal({
215            hide_close: true, 
216            is_locked: true
217        });
218    });
219});
220
221/**
222 * モーダルを閉じる
223 * @param {element} self 
224 */
225In2Common.closeModal = function(self) {
226    // let that = this;
227    let id = jQuery(self).closest(".modaal-wrapper").attr("id");
228    jQuery('[data-modaal-scope="' + id + '"]').modaal("close");
229}
230
231// remodaの閉じるイベント
232jQuery(document).on('closed', '.remodal', function (e) {
233    // 複数モーダルの重ねた時の閉じるモーダルの処理
234    if(0 < g_arrStackModal.length) {
235        jQuery("#" + g_arrStackModal[g_arrStackModal.length - 1]).remodal().open();
236        g_arrStackModal.pop();
237    }
238});
239
240/**
241 * サブメニューの閉じるボタン
242 * 
243 * @param {element} self 
244 */
245function in2cart_submenu_close(self) {
246    let arrId = jQuery(self).closest("nav.children").attr("id").split("_");
247    if(arrId.length == 3) {
248        let menu_order = arrId[2];
249
250        jQuery("#menu-header li").each(function() {
251            if(jQuery(this).data("menu_order") == menu_order) {
252                jQuery(this).click();
253                return false;
254            }
255        });
256    }
257}
258
259/**
260 * プライバシーの同意
261 * 
262 * @param {string} key 
263 */
264function in2cart_privacy(self) {
265    jQuery(self).closest(".cookie_privacy").fadeOut("normal", function() {
266        jQuery("footer").removeClass("privacy_doui_not");
267    });
268    jQuery.cookie("privacy_doui", 1, {expires: 365, path: "/"});
269}
270
271/**
272 * 重要なお知らせの閉じるボタン
273 * 
274 * @param {string} str_now_time 
275 */
276function in2cart_news_important(str_now_time) {
277    jQuery.cookie("news_notice", str_now_time, {expires: 365, path: "/"});
278    jQuery("#notice_box").fadeOut("normal", function() {
279        jQuery("body").removeClass("notice");
280    });
281}
282
283/**
284 * フォームのエラー出力
285 *
286 * @param {array} hshError
287 * @param {boolean} IsError
288 */
289function in2FormError(hshError, IsError) {
290	if(IsError) {
291		for(var key in hshError) {
292			jQuery("#" + key).addClass("in2form_input_error");
293			var span = "<span class=\"in2form_input_error_message\">
293" + hshError[key] + "</span>";
294			jQuery("#" + key).before(span);
295		}
296	} else {
297		jQuery(".in2form_input_error").removeClass("in2form_input_error");
298		jQuery(".in2form_input_error_message").remove();
299	}
300}
301
302/**
303 * 料金表やカートなどで使用するオーバーレイ
304 *
305 * @param {string} type
306 */
307function in2cart_create_overlay(type) {
308	if(type == "close") {
309		jQuery("#overlay").remove();
310	} else {
311		var arrHtml = new Array();
312		arrHtml.push('<div id="overlay"><img src="' + g_template_directory + '/images/loading_big.png"></div>');
313		jQuery("body").append(arrHtml.join(""));
314	}
315}
316
317/**
318 * モーダル閉じる
319 *
320 * @param {element} self
321 */
322function in2cart_close_modal(self) {
323	var id = jQuery(self).closest(".remodal").attr("id");
324	var modal = jQuery("#" + id).remodal();
325	modal.close();
326}
327
328/**
329 * モーダルの表示
330 *
331 * @param {string} id
332 */
333function in2cart_open_modal(id) {
334	var modal = jQuery("#" + id).remodal();
335	modal.open();
336}
337
338/**
339 * URLのパラメーター取得
340 *
341 * @param  name {string} パラメータのキー文字列
342 * @return  url {url} 対象のURL文字列(任意)
343 */
344function in2cart_get_param(name, url) {
345    if (!url) url = window.location.href;
346    name = name.replace(/[\[\]]/g, "\\$&");
347    var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
348        results = regex.exec(url);
349    if (!results) return null;
350    if (!results[2]) return '';
351    return decodeURIComponent(results[2].replace(/\+/g, " "));
352}
353
354/**
355 * マイページなどのページングのクリック
356 *
357 * @param {string} page
358 */
359function in2cart_pageing_click(page) {
360    jQuery('input[name=tpage]').val(page);
361    document.forms["form_search"].submit();
362}
363
364/**
365 * 改行コードをbrに変換
366 *
367 * @param {string} val
368 * @returns
369 */
370function in2cart_convert_br(val) {
371    val = val.replace(/\r\n/g, '\n');
372    val = val.replace(/\r/g, '\n');
373    val = val.replace(/\n/g, '<br>');
374    return val;
375}
376
377/**
378 * 投稿/お知らせのsingleページでの月の選択のチェンジイベント
379 * @param {element} self 
380 * @param {integer} term_id 
381 */
382function in2cart_change_archive_month(self, term_id) {
383    let url = jQuery(self).val();
384
385    // カテゴリー情報を付加
386    let cat = "";
387    if(0 < term_id) cat = "?cat=" + term_id;
388    document.location.href = url + cat;
389}
390
391/**
392 * 画像の遅延読込み
393 *
394 */
395function in2cart_lazy() {
396    var lazyImages = [].slice.call(document.querySelectorAll("img.lazy"));
397
398    if ("IntersectionObserver" in window) {
399        let lazyImageObserver = new IntersectionObserver(function(entries, observer) {
400            entries.forEach(function(entry) {
401                if (entry.isIntersecting) {
402                    let lazyImage = entry.target;
403                    lazyImage.src = lazyImage.dataset.src;
404                //   lazyImage.srcset = lazyImage.dataset.srcset;
405                    lazyImage.classList.remove("lazy");
406                    lazyImageObserver.unobserve(lazyImage);
407                    // jQuery(lazyImage).hide().fadeIn();
408
409                    jQuery(lazyImage).css('opacity','1');
410                    jQuery(lazyImage).css('transform','translateY(0)');
411                }
412            });
413        });
414
415        lazyImages.forEach(function(lazyImage) {
416            lazyImage.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
417            lazyImage.classList.add("fadein");
418            lazyImageObserver.observe(lazyImage);
419        });
420    } else {
421        // Possibly fall back to a more compatible method here
422    }
423}
424
425/**
426 * ユーザーエージェントを取得
427 */
428function in2cart_get_useragent() {
429    let userAgent = window.navigator.userAgent.toLowerCase();
430    let result = "none";
431    if(userAgent.indexOf('msie') != -1 || userAgent.indexOf('trident') != -1) {
432        result = "ie";
433    } else if(userAgent.indexOf('edge') != -1) {
434        result = "edge";
435    } else if(userAgent.indexOf('chrome') != -1) {
436        result = "chrome";
437    } else if(userAgent.indexOf('safari') != -1) {
438        result = "safari";
439    } else if(userAgent.indexOf('firefox') != -1) {
440        result = "firefox";
441    } else if(userAgent.indexOf('opera') != -1) {
442        result = "opera";
443    }
444
445    return result;
446}
447
448/**
449 * ブラウザ判定、safariか
450 */
451function in2cart_browser_is_safari() {
452    return (in2cart_get_useragent() == "safari") ? true : false;
vendor: 1 bytes, line 453
453}

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.