PageSourceSearch

https://nairu.jp/common/js/common.js?v=1

js nairu.jp collected 2026-10-08 09:14:00 UTC 16,327 bytes, 527 lines download raw bytes

1/* ヘッダー:ドロップナビ
2----------------------------------------------------------------------------- */
3$(function(){
4    $(".header-menu-nav-btn").on("click",function(){
5        $(".header-menu-nav-drop").toggleClass("is-open");
6    });
7});
8
9/* SPナビ
10----------------------------------------------------------------------------- */
11
12$(function(){
13    
14    /* サイドメニュー */
15    $(".side-btn button").on("click",function(){
16        $(".side").toggleClass("is-open");
17    });
18    
19});
20
21/* タブ切り替え
22----------------------------------------------------------------------------- */
23$(function() {
24    if($(".tab").length){
25        $(".tab-btn li").on("click",function(){
26            var index = $('.tab-btn li').index(this);
27            $(".tab-main .tab-main-box").hide();
28            $(".tab-main .tab-main-box").eq(index).fadeIn();
29            $(".tab-btn li").removeClass("is-current");
30            $(this).addClass("is-current");
31        });
32    };
33});
34
35/* バリデートチェック
36----------------------------------------------------------------------------- */
37$(function($) {
38  $("form").validationEngine({
39        focusFirstField: true,
40        scroll: true
41  });
42});
43
44/* モーダルウィンドウ
45----------------------------------------------------------------------------- */
46$(function(){
47    if($(".modal").length){
48        
49        /* 選択中のテキスト抽出 */
50        $(".main .modal-open").each(function(){
51            var modal_id = $(this).attr("id");
52            chkSelected(modal_id);
53        });
54        
55        /* モーダルを開く */
56        $(".modal-open").on("click",function(){
57            var id = $(this).attr("id");
58            var tgt = "#tgt-" + id;
59            $(tgt).fadeIn();
60            
61            // 選択した項目の表示
62            $(".modal-window").find("input[type='radio'],input[type='checkbox']").on("change",function(){
63                chkSelected(id);
64            });
65        });
66        
67        /* モーダルを閉じる */
68        $(".modal-close").on("click",function(){
69            $(this).parents(".modal").fadeOut();
70        })
71    }
72    
73    // 項目チェック
74    function chkSelected(id){
75        
76        var window = "#tgt-" + id + " .modal-window";
77        
78        if($(window).find("table").length){
79            // テーブル形式(table)の場合
80            var tgt = $(window).find("table tr");
81            
82        }else if($(window).find("ul").length){
83            // リスト形式(ul)の場合
84            var tgt = $(window).find("ul li");
85        }
86        
87        var result = "#res-" + id;
88        var resTxt = "";
89        
90        // 選択中項目の取得
91        $(tgt).each(function(){
92            var result = "";
93            var input = $(this).find("input[type='radio'],input[type='checkbox']");
94            var txt = $(this).find("label").text();
95            
96            if($(input).prop("checked") === true){
97                resTxt = resTxt + txt + " / ";
98            }
99        });
100        
101        // 表示テキスト形成
102        if(resTxt === ""){
103            resTxt = "未選択";
104        }else{
105            resTxt = resTxt.slice(0,-2);
106        }
107        
108        // 対象エリアにテキスト表示
109        $(result).text(resTxt);
110    };
111    
112});
113
114/* ダイアログ
115----------------------------------------------------------------------------- */
116$(function(){
117    $(document).on("click", ".dialog-close", function(){
118        $(this).parents(".dialog").fadeOut();
119    })
120});
121
122/* 広告スライダー
123----------------------------------------------------------------------------- */
124$(function(){
125    if($(".ad-slider").length){
126        $('.ad-slider ul').slick({
127            arrows:true,
128            dots:false,
129            autoplay:true,
130            autoplaySpeed:8000,
131            slidesToShow:5,
132            slidesToScroll:5,
133            prevArrow:'<button type="button" class="btn-prev"><i class="fas fa-chevron-left"></i></button>',
134            nextArrow:'<button type="button" class="btn-next"><i class="fas fa-chevron-right"></i></button>',
135            responsive: [{
136                breakpoint: 769,
137                settings: {
138                    slidesToShow:3,
139                    slidesToScroll:3,
140                }
141            }]
142        });
143    } 
144});
145
146/* 汎用アコーディオン
147----------------------------------------------------------------------------- */
148$(function(){
149   if($(".accordion").length){
150       $(".accordion-btn").on("click",function(){
151           $(this).parents(".accordion").find(".accordion-tgt").slideToggle();
152       });
153   };
154});
155
156/* スムーススクロール
157----------------------------------------------------------------------------- */
158$(function(){
159  $('a[href^="#"]').click(function(){
160    var speed = 500;
161    var href= $(this).attr("href");
162    var target = $(href == "#" || href == "" ? 'html' : href);
163    var position = target.offset().top;
164    $("html, body").animate({scrollTop:position}, speed, "swing");
165    return false;
166  });
167});
168
169/* ページネーション
170----------------------------------------------------------------------------- */
171
172$(function(){
173    if($("#paging").length){
174        
175        $(".paged-content").hide();
176        $(".paged-content:first-child").show();
177        $("#paging").pagination({
178            items: 5,
179            //displayedPages: 1,
180            cssStyle: 'light-theme',
181            prevText: '',
182            nextText: '',
183            onPageClick: function(pageNumber){show(pageNumber)}
184        });
185        rankingPager();
186    }
187});
188
189function show(pageNumber){
190    var page="#page-"+pageNumber;
191    $('.paged-content').hide()
192    $(page).show();
193    rankingPager();
194};
195
196function rankingPager(){
197    if($(".ranking-main-num").length){
198        $(".ranking-main-num ul li:nth-child(1)").find("a,span").text("1〜20位");
199        $(".ranking-main-num ul li:nth-child(2)").find("a,span").text("21〜40位");
200        $(".ranking-main-num ul li:nth-child(3)").find("a,span").text("41〜60位");
201        $(".ranking-main-num ul li:nth-child(4)").find("a,span").text("61〜80位");
202        $(".ranking-main-num ul li:nth-child(5)").find("a,span").text("81〜100位");
203   };
204};
205
206/* レビュー投稿用パーツ
207----------------------------------------------------------------------------- */
208$(function(){
209    
210    if($(".review").length){
211        
212        /* 初期値チェック */
213        var val = 0;
214        $(".review").each(function(){
215            val = $(this).find("input[type='radio']:checked").val();
216        });
217        reviewCheck(val);
218        
219        /* ホバー時 */
220        $(".review label").hover(
221            function(){
222                val = $(this).find("input[type=radio]").val();
223                reviewCheck(val);
224            },
225            function(){
226                val = $(this).parents(".review").find("input[type='radio']:checked").val();
227                reviewCheck(val);
228            }
229        );
230    };
231    
232    function reviewCheck(num){
233        if(num !== 0){
234            $(".review").each(function(){
235                $("label").each(function(){
236                    var tgt = $(this).find("input").val();
237                    if(tgt <= num){
238                        $(this).addClass("is-on");
239                    }else{
240                        $(this).removeClass("is-on");
241                    }
242                });
243            });
244        }
245    }
246});
247
248/* エディタ
249----------------------------------------------------------------------------- */
250$(function(){
251    if($(".is-editor").length){
252        $('.is-editor').trumbowyg({
253            btns: [
254                ['viewHTML'],
255                ['undo', 'redo'],
256                ['fontsize', 'foreColor', 'backColor'],
257                ['strong', 'em', 'del'],
258                ['superscript', 'subscript'],
259                ['link'],
260                ['justifyLeft', 'justifyCenter', 'justifyRight'],
261                ['horizontalRule'],
262                ['fullscreen']
263            ],
264            plugins:{
265                fontsize:{
266//                    sizeList: [
267//                        '極小',
268//                        '小',
269//                        '中',
270//                        '大',
271//                        '極大'
272//                    ],
273                    allowCustomSize: false
274                }
275            }
276            
277        });
278    }
279});
280
281/* 郵便番号自動入力
282----------------------------------------------------------------------------- */
283$(function(){
284   if($(".autozip").length){
285       $('.autozip-btn').on('click', function(){
286        AjaxZip3.zip2addr('zip','','pref','address');
287
288        //成功時に実行する処理
289        AjaxZip3.onSuccess = function() {
290            $('.address').focus();
291        };
292
293        //失敗時に実行する処理
294        AjaxZip3.onFailure = function() {
295            alert('郵便番号に該当する住所が見つかりません');
296        };
297
298        return false;
299    });
300   }
301});
302
303
304/* 画像アップローダー
305----------------------------------------------------------------------------- */
306/*
307 * ファイルアップロード時操作
308 * upload          :1ファイルをアップロードするためのまとまã
308‚Š
309 * upload-input-file      :ファイルをアップロードするinputタグ
310 * upload-input-file-btn  :ファイル選択画面を開く為のボタン
311 *                          (input[type=file]は表示文字編集不可の為hideする)
312 * upload-input-file-clear:クリアボタンの押下情報を保持
313 *                         サーバー登録済ファイルのコピー,削除に使用
314 * upload-input-file-name :サーバー登録済のファイル名,選択されたファイル名を表示
315 */
316
317$(function(){
318     
319    var defaultMsg = '選択されていません';
320
321    // ボタン押下時、input[type=file] を開く
322    $(document).on('click','.upload-input-file-btn,.upload-preview',function(){
323        $(this).parents(".upload").find('.upload-input-file').click();
324    }); 
325  
326  	// アップロード済みファイル名描画
327    $('.upload-input-file-name').each(function(){
328        var fileName = $(this).data('fname');
329        if (fileName){
330            $(this).text(fileName);
331        } else{
332            $(this).text(defaultMsg);
333        }
334    });
335
336    // プレビュー表示
337    $(document).on('change','.upload-input-file',function(e){
338        var fileName = $(this).prop('files')[0].name;
339        $(this).siblings('.upload-input-file-name').text(fileName);
340        $(this).siblings('.upload-input-file-clear').val(false);
341        var fileImg = e.target.files[0],
342            reader = new FileReader(),
343            $preview = $(this).parents(".upload").find('.upload-preview');
344            t = this;
345        if(fileImg.type.indexOf("image") < 0){
346            return false;
347        }
348        reader.onload = (function(fileImg) {
349            return function(e) {
350            $preview.empty();
351            $preview.append($('<img>').attr({
352                    src: e.target.result,
353                    title: fileImg.name
354                }));
355            };
356        })(fileImg);
357        reader.readAsDataURL(fileImg);
358    });
359    // ファイルをクリア
360    $(".upload-clear").on('click',function() {
361        $(this).siblings('.upload-input-file').val("");
362        $(this).siblings('.upload-input-file-name').text(defaultMsg);
363        $(this).siblings('.upload-input-file-clear').val(true);
364        $(this).parents(".upload").find('.upload-preview').empty(); // ★追加(プレビュー画像のクリア)
365    });
366});
367
368/* ドラックアンドドロップ背景色
369----------------------------------------------------------------------------- */
370$(function(){
371    
372    // ドラッグしている要素が領域にあるとき
373    $('.f-drop').on('dragenter dragover', function (event) {
374        event.stopPropagation();
375        event.preventDefault();
376        $(this).addClass("active");
377    });
378    
379    // ドラッグしている要素がドロップ領域から外れたとき
380    $('.f-drop').on('dragleave', function (event) {
381        event.stopPropagation();
382        event.preventDefault();
383        $(this).removeClass("active");
384    });
385    
386});
387
388/* 一括登録(.submit-list)
389----------------------------------------------------------------------------- */
390$(function(){
391    if($(".submit-list").length){
392        
393        var tgtForm = $(".submit-list").parents("form")
394        var tgtList = tgtForm.find("table");
395        
396        /* リスト内inputが編集されたら該当行にクラス .is-changed を追加 */
397        $(tgtList).find("input,select").on("change",function(){
398            $(this).parents("tr").addClass("is-changed");
399        });
400        
401        /* submit時 */
402        $(tgtForm).on("submit",function(){
403            $(tgtList).find("tr").each(function(){
404                if(!$(this).hasClass("is-changed")){
405                    $(this).remove();
406                }
407            });
408        });
409        
410    }
411});
412
413/* 課金リスト(.payment-list)
414----------------------------------------------------------------------------- */
415$(function(){
416    if($(".payment-list").length){
417        
418        
419        
420        $(".payment-list .btn-submit").on("click",function(){
421            
422            $(this).parents("tr").addClass("is-target");
423            $(".payment-list tr").not(".is-target").remove();
424        });
425        
426        
427    }
428});
429
430/* 検索エリア開閉
431----------------------------------------------------------------------------- */
432$(function(){
433    if($(".search-close").length){
434        $(".search-close").on("click",function(){
435            var tgt = $(this).parents(".admin-search,.shop-search");
436            
437            if($(tgt).hasClass("is-close")){
438                $(tgt).removeClass("is-close");
439                $(tgt).find("form").slideDown();
440            }else{
441                $(tgt).addClass("is-close");
442                $(tgt).find("form").slideUp();
443            }
444        });
445    };
446});
447
448/* 登録完了ダイアログ
449----------------------------------------------------------------------------- */
450/* サブミット後 */
451window.onload = function(){
452    // 登録後
453    if($("header").hasClass("submit")){
454        msgDialog("登録が完了しました。");
455    };
456    // 削除後
457    if($("header").hasClass("delete")){
458        msgDialog("削除が完了しました。");
459    };
460}
461
462/* ダイアログ表示関数 */
463function msgDialog(msg){
464    addDialog(msg);   // window開く
465    setTimeout(closeDialog,2000);   // フェードアウト
466    setTimeout(afterDialog,2500);   // Class削除
467
468    // クリックでもクローズ可に
469    $(".popup").click(function(){
470        closeDialog();
471        setTimeout(afterDialog,500);
472    });
473};
474
475/* ダイアログ表示 */
476function addDialog(msg){
477    // ダイアログDOM生成
478    $("body").prepend('<div class="popup"><p></p></div>');
479    $(".popup p").text(msg);
480}
481
482/* ダイアログ非表示 */
483function closeDialog(){
484    $(".popup").slideUp();
485};
486
487/* 要素を削除 */
488function afterDialog(){
489    $(".popup").remove();
490};
491
492/* 削除確認
493----------------------------------------------------------------------------- */
494$(function(){
495    $('button[name="btnDel"]').on("click",function(){
496        if(!confirm('削除を実行しますか?(この操作は取り消せません。)')){
497            /* キャンセルの時の処理 */
498            return false;
499        }
500    });
501});
502// =======================================================================
503// ページジャンプ関数
504// =======================================================================
505/* [引数]
506 *     ① 連想配列
507 *     
508 * [戻り値]
509 *     無し
510 *     
511 * -----------------------------------------------------------------------
512 */
513function ctrlPage(href){
514    window.location.href = href;
515    return;
516}
517function ctrlPageJump(href){
518    // スクロールの速度
519    var speed = 400; // ミリ秒
520    // 移動先を取得
521    var target = $(href == "#" || href == "" ? 'html' : href);
522    // 移動先を数値で取得
523    var position = target.offset().top;
524    // スムーススクロール
525    $('body,html').animate({scrollTop:position}, speed, 'swing');
526    return false;
527}

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.