PageSourceSearch

https://www.town.mamurogawa.yamagata.jp/theme/base/js/common_lib.js

js town.mamurogawa.yamagata.jp collected 2026-10-02 16:38:50 UTC 61,074 bytes, 2,262 lines download raw bytes

1/**
2 * SMART CMS共通関数
3 * @version 1.1
4 */
5
6/**
7 * ファイルリンクは別窓表示
8 */
9//$.fn.fileBlank = function() {
10//  var target = this;
11//
12//  target.each(function() {
13//    $(this).attr("target", "_blank");
14//  });
15//};
16
17$.fn.fileBlank = function(ext_) {
18
19  var target = this;
20
21  this.addClass(ext_);
22  this.attr("target", "_blank");
23
24
25};
26
27
28
29/**
30 * class名で別窓表示(外部リンク付)
31 */
32$.fn.jsBlankAddText = function() {
33  var target = this;
34
35  target.each(function() {
36    $(this).prepend('(外部リンク)');
37    //$(this).append('&nbsp;<img height="14" width="15" alt="外部サイトへ" src="./img_page/icon_blank.gif">');
38    $(this).click(function(){
39      window.open(this.href,'_blank');
40      return false;
41    });
42  });
43};
44
45/**
46 * class名で別窓表示
47 */
48$.fn.jsBlank = function() {
49  var target = this;
50
51  target.each(function() {
52    $(this).click(function(){
53      window.open(this.href,'_blank');
54      return false;
55    });
56  });
57};
58
59/**
60 * スムーズスクロール
61 * $('a[href*=#].smoothCom').smoothScroll();
62 */
63$.fn.smoothScroll = function() {
64  var target = this;
65
66  target.each(function(){
67    var href = $(this).attr("href");
68
69
70    if(href=='#') {
71      $(this).click(function() {
72        return false;
73      });
74      return true;
75    }
76
77    var hrefAry = href.match(/^([^#]*)#([^#]+)$/,function(whole,$1){ return $1 });
78
79    if(hrefAry) {
80      var j = $( "#" + hrefAry[2] );
81      if(j.size() > 0) {
82
83        jQuery.data($(this).get(0), "pos", j);
84
85        $(this).click(function() {
86
87          $('html,body').animate({scrollTop: jQuery.data($(this).get(0), "pos").offset().top}, 400, "linear", function(){
88            location.hash = hrefAry[2];
89          });
90          return false;
91        });
92      }
93    }
94  });
95};
96
97/**
98 * 現在のカテゴリを_onにする
99 * 
100 *  $("#header-nav .list li > a").categoryOn('^(/[^/]+/).*$');
101 *  $("#header-nav .list li > a").categoryOn('^/[^/]+(/[^/]+/).*$');(特別コンテンツ)
102 *
103 * @param string 判定するパス範囲(正規表現)
104 */
105$.fn.categoryOn = function(path) {
106  var target = this;
107
108  var regPath = new RegExp(path, "i");
109
110  var req = location.pathname;
111  req = req.replace(regPath, '$1');
112
113  target.each(function(idx){
114    var href = $(this).attr("href");
115    // ドメイン付きリンクでも反転できるようにする
116    if(href.indexOf(req) > -1) {
117      var imgJ = $(this).find('img');
118      imgJ.unbind('mouseenter').unbind('mouseleave');
119      imgJ.attr('src', imgJ.attr('src').replace(/_off(\.gif|\.jpg|\.png)/,"_on"+'$1') );
120      return false;
121    }
122  });
123};
124
125/**
126 * ._offの画像をロールオーバー
127 * @param object 設定
128 */
129$.fn.rollOver = function(_cfg) {
130  var target = this;
131
132  target.each(function(){
133    $(this).hover(function () {
134      $(this).attr("src", $(this).attr("src").replace(_cfg.off, _cfg.on));
135    },function () {
136      $(this).attr("src", $(this).attr("src").replace(_cfg.on, _cfg.off));
137    });
138  });
139};
140
141/**
142 * ドメインの表記をIPアドレスに変換
143 * @param object 設定
144 */
145$.fn.urlTranslate = function(_cfg) {
146  var target = this;
147
148  target.each(function(){
149      $(this).attr("href", $(this).attr("href").replace(_cfg.before, _cfg.after));
150  });
151};
152
153/**
154 * 透過ロールオーバー
155 */
156$.fn.rollOverAlpha = function() {
157  var target = this;
158
159  target.hover(function(){
160    $(this).fadeTo(100, 0.7); // マウスオーバーで透明度を60%にする
161  },function(){
162    $(this).fadeTo(100, 1.0); // マウスアウトで透明度を100%に戻す
163  });
164};
165
166/**
167 * 文字サイズ変更(標準 or 大きくする)背景色変更
168 * $.fn.styleCatcherUpNormal({btnCls: "scsize",cssID: "scsize",prAry: ['size_default.css', 'size_up.css', 'size_up2.css', 'size_up3.css'],cssPath: '/theme/base/css/',def: 0});
169 *
170 * @param object 設定
171 */
172$.fn.styleCatcherUpNormal = function(config) {
173  config = $.extend({
174    btnCls: "scsize",
175    cssID: "scsize",
176    prAry: ['0.css', '1.css', '2.css', '3.css'],
177    cssPath: '/theme/base/css/',
178    def: 0,
179    imgCls: ['.normal-on', '.normal-off', '.big-on', '.big-off']
180  },config);
181
182  var cssTag = $('<link rel="stylesheet" />');
183  cssTag.attr('id', config.cssID);
184  $("body").append(cssTag);
185
186  //parameter number
187  var prNum;
188  if($.cookie(config.cssID)) {
189    prNum = Number($.cookie(config.cssID));
190  } else {
191    prNum = Number(config.def);
192  }
193
194  function offRollOver() {
195    $('.' + config.btnCls).each(function(){
196      var img = $(this).find("img");
197      img.unbind();
198    });
199  }
200  offRollOver();
201
202  $('.' + config.btnCls).css("cursor", "pointer").css("cursor", "hand");
203  
204  $('.' + config.btnCls).click(function(){
205    var j = $(this);
206    var img = j.find("img");
207    var cl = j.attr("class");
208
209    if(cl.indexOf("up") != -1) {
210      prNum++;
211      if(config.prAry.length-1 <= prNum) {
212        prNum = config.prAry.length-1;
213        $(config.imgCls[0] + ',' + config.imgCls[3]).addClass('hide');
214        $(config.imgCls[1] + ',' + config.imgCls[2]).removeClass('hide');
215      } else {
216        $(config.imgCls[0] + ',' + config.imgCls[2]).addClass('hide');
217        $(config.imgCls[1] + ',' + config.imgCls[3]).removeClass('hide');
218      }
219
220    } else if(cl.indexOf("normal") != -1) {
221      prNum = 0;
222      $(config.imgCls[1] + ',' + config.imgCls[2]).addClass('hide');
223      $(config.imgCls[0] + ',' + config.imgCls[3]).removeClass('hide');
224    }
225
226    $('#' + config.cssID).attr("href", config.cssPath + config.prAry[prNum]);
227
228    //prNumを保存
229    $.cookie(config.cssID, prNum, {path:'/'});
230
231    return false;
232  });
233
234  $('#' + config.cssID).attr("href", config.cssPath + config.prAry[prNum]);
235};
236
237/**
238 * 文字サイズ(小、中、大)背景色変更
239 * $.fn.styleCatcher({btnCls: "scColor",cssID: "scColor", cssPath:'/theme/base/css/',def: 2});
240 *
241 * @param object 設定
242 */
243$.fn.styleCatcher = function (config) {
244  config = $.extend({
245    attr: 'id',
246    btnCls: 'scsize',
247    cssID: 'scsize',
248    cssPath: '/theme/base/css/',
249    def: 0
250  }, config);
251  var cssTag = $('<link rel="stylesheet">');
252  cssTag.attr('id', config.cssID);
253  $('body').append(cssTag);
254 
255  function offRollAndOn(_id) {
256    $('.' + config.btnCls).each(function (idx) {
257      var id = $(this).attr(config.attr);
258      var img = $(this).find('img');
259      img.unbind();
260      if (_id == id) {
261        img.attr('src', img.attr('src').replace('_off.', '_on.'));
262      } else {
263        img.attr('src', img.attr('src').replace('_on.', '_off.'));
264        img.hover(function () {
265          $(this).attr('src', $(this).attr('src').replace('_off.', '_on.'));
266        }, function () {
267          $(this).attr('src', $(this).attr('src').replace('_on.', '_off.'));
268        });
269      }
270    });
271  }
272  $('.' + config.btnCls).attr('href', '#');
273  $('.' + config.btnCls).click(function () {
274    var id = $(this).attr(config.attr);
275    var img = $(this).find('img');
276    offRollAndOn(id);
277    $('#' + config.cssID).attr('href', config.cssPath + id + '.css');
278    $.cookie(config.cssID, id, {
279      path: '/'
280    });
281    return false;
282  });
283  var fileName;
284  if ($.cookie(config.cssID)) {
285    fileName = $.cookie(config.cssID);
286  } else {
287    fileName = $($('.' + config.btnCls).get(config.def)).attr(config.attr);
288  }
289  offRollAndOn(fileName);
290  $('#' + config.cssID).attr('href', config.cssPath + fileName + '.css');
291};
292
293/**
294 * 文字サイズ変更(標準 or 大きくする)
295 * HTMLカスタムデータ属性版
296 * $.fn.fontSizeSwitch();
297 *
298 * @param object 設定
299 */
300$.fn.fontSizeSwitch = function(config) {
301  config = $.extend({
302    attr: 'data-fontsize',
303    switchID: 'scsize',
304    sizeAry: ['default', 'up', 'up2', 'up3'],
305    def: 0,
306    imgCls: {
307      normalOn:  '.normal-on',
308      normalOff: '.normal-off',
309      bigOn:     '.big-on',
310      bigOff:    '.big-off'
311    },
312  },config);
313
314  //targetEl
315  var $switch = $('.' + config.switchID);
316
317  //parameter number
318  var prNum;
319  if($.cookie(config.switchID)) {
320    prNum = Number($.cookie(config.switchID)) < config.sizeAry.length ?
321              Number($.cookie(config.switchID)) :
322              config.sizeAry.length - 1;
323  } else {
324    prNum = Number(config.def);
325  }
326
327  function isMax(prNum) {
328    return prNum >= config.sizeAry.length - 1;
329  }
330
331  function isMin(prNum) {
332    return prNum === 0;
333  }
334
335  function offRollOver() {
336    $switch.each(function(){
337      var img = $(this).find("img");
338      img.unbind();
339    });
340  }
341  offRollOver();
342
343  //フォントサイズ識別用データ属性付与
344  function setData(prNum) {
345    $('html').attr(config.attr, config.sizeAry[prNum]);
346    //標準ボタン
347    $(config.imgCls.normalOff).toggleClass('hide', isMin(prNum));
348    $(config.imgCls.normalOn).toggleClass('hide', !isMin(prNum));
349    //拡大ボタン
350    $(config.imgCls.bigOff).toggleClass('hide', isMax(prNum));
351    $(config.imgCls.bigOn).toggleClass('hide', !isMax(prNum));    
352  }
353  
354  $switch.click(function(){
355    if($(this).hasClass('up') && !isMax(prNum)) {
356      prNum++;
357    } else if($(this).hasClass('normal')) {
358      prNum = 0;
359    }
360    //フォントサイズ変更
361    setData(prNum);
362    //prNumを保存
363    $.cookie(config.switchID, prNum, {path:'/'});
364
365    return false;
366  });
367
368  //フォントサイズ初期値
369  setData(prNum);
370};
371
372/**
373 * 背景色変更
374 * カスタムデータ属性版
375 * $.fn.bgColorSwitch();
376 *
377 * @param object 設定
378 */
379$.fn.bgColorSwitch = function (config) {
380  config = $.extend({
381    attr: 'data-bgcolor',
382    switchID: 'sccolor',
383    def: 'color_normal',
384  }, config);
385
386  //targetEl
387  var $switch = $('.' + config.switchID);
388
389  //background ID
390  var bgId;
391  if ($.cookie(config.switchID)) {
392    bgId = $.cookie(config.switchID);
393  } else {
394    bgId = config.def;
395  }
396
397  //背景色識別用データ属性付与
398  function setData(bgId) {
399    $('html').attr(config.attr, bgId);
400  }
401
402  $($switch).click(function () {
403    bgId = $(this).attr(config.attr);
404    setData(bgId);
405    $.cookie(config.switchID, bgId, {path: '/'});
406    return false;
407  });
408
409  setData(bgId);
410};
411
412/**
413 * XPのIE7と他のOSにメイリオのフォント指定
414 */
415$.fn.fontMeiryo = function() {
416  function getUserAgent() {
417    var obj = {};
418    obj['userAgent'] = navigator.userAgent;
419    obj['os'] = null;
420    obj['osVersion'] = null;
421    obj['browser'] = null;
422    obj['browserVersion'] = null;
423
424    if(obj['userAgent'].match(/Win/)) {
425      obj['os']='win';
426    }
427
428    if(obj['userAgent'].match(/Win(dows)?[ ]*(NT[ ]*5\.1|XP)/)) {
429      obj['osVersion']='xp';
430    }
431
432    if(obj['userAgent'].match(/MSIE/)) {
433      obj['browser']='ie';
434      var ary = obj['userAgent'].match(/MSIE[ ]*([0-9]+)/);
435      if(ary != null) {
436        obj['browserVersion']=Number(ary[1]);
437      }
438    }
439
440    return obj;
441  }
442
443  var userAgent = getUserAgent();
444  if(  (userAgent['osVersion'] == 'xp' && userAgent['browserVersion'] == '7') || userAgent['osVersion'] != 'xp'  ) {
445    $("body").append('<style>body {font-family: "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", "メイリオ", Meiryo, Osaka, "MS Pゴシック", "MS PGothic", sans-serif !important;} </style>');
446
447  }
448};
449
450/**
451 * 段組の個々に高さを設定する
452 * ※文字の高さなどが変わるためフォントを変更してから実行すること
453 * $(".level1Row2Mod").eqGroupHeight(2);
454 *
455 * @param integer 段組数
456 */
457$.fn.eqGroupHeight = function(turn_) {
458  var target = this;
459  target.each(function(){
460    //揃えたい分確保した後、高さ揃える…ループ
461    var ary = new Array();
462
463    //一旦、高さをリセット
464    $(this).find("> *").css('height', 'auto');
465
466    $(this).find("> *").each(function(idx2_){
467      ary.push($(this));
468      if(ary.length >= turn_) {
469        var max = 0;
470        for (var i=0; i < ary.length; i++){
471          max = Math.max(ary[i].height(), max);
472        }
473        for (var j=0; j < ary.length; j++){
474          ary[j].height(max);
475        }
476        ary[0].addClass("first-left");//最初の要素にだけClassを振る
477        ary = new Array();
478      }
479    });
480    //未だ配列に残っている分を高さ揃える
481    if(ary.length > 0) {
482      var max = 0;
483      for (var i=0; i < ary.length; i++){
484        max = Math.max(ary[i].height(), max);
485      }
486      for (var j=0; j < ary.length; j++){
487        ary[j].height(max);
488      }
489      ary[0].addClass("first-left");//最初の要素にだけClassを振る
490    }
491  });
492};
493
494/**
495 * 2階層1列
496 * $(".level2Row1Mod").level2Row1();
497 */
498$.fn.level2Col1 = function(config) {
499  config = $.extend({
500    boxClass1: ".box",
501    boxClass2: ".box2",
502  },config);
503
504  var targetsJ = this;
505  var getUl = function(boxJ) {
506    return boxJ.find('ul');
507  }
508  var getLi = function(boxJ) {
509    return boxJ.find('li');
510  }
511
512  // box2のグループは一つにまとめる(ページ一覧)
513  targetsJ.each(function(){
514    var targetJ = $(this);
515    var boxes = targetJ.find('> ' + config.boxClass1 + ',> ' + config.boxClass2);
516
517    var tmpIsBox2 = false;
518    var tmpBox2;
519    boxes.each(function(idx_){
520      var boxJ = $(this);
521
522      var isBox2 = boxJ.is(config.boxClass2);
523      if(!isBox2) {
524        tmpIsBox2 = false;
525      }
526
527      if(tmpIsBox2 && isBox2) {
528        tmpBox2.append(getLi(boxJ));
529        boxJ.remove();
530      }
531
532      if(!tmpIsBox2 && isBox2) {
533        tmpBox2 = getUl(boxJ);
534        tmpIsBox2 = true;
535      }
536    });
537  });
538
539  // box2の上下にボーダーを入れる
540  targetsJ.each(function(){
541    var targetJ = $(this);
542    var boxes = targetJ.find('> ' + config.boxClass2);
543
544    boxes.each(function(idx_){
545      var boxJ = $(this);
546
547      // 上か下にボーダーを入れる
548      if(boxJ.prev().is(config.boxClass + ',' + config.boxClass2)) {boxJ.addClass('borderTopCom');}
549      if(boxJ.next().is(config.boxClass + ',' + config.boxClass2)) {boxJ.addClass('borderBtmCom');}
550    });
551  });
552
553}
554
555/**
556 * 2階層2列
557 * $(".level2Row2Mod").level2Col2();
558 */
559$.fn.level2Col2 = function(config){
560  config = $.extend({
561    boxClass1: ".box",
562    boxClass2: ".box2",
563    floatClassL: "left-col",
564    floatClassR: "right-col"
565  },config);
566
567  var targetsJ = this;
568
569  targetsJ.each(function(){
570    var parent = $(this);
571
572    var boxes = parent.find('> ' + config.boxClass1);
573    var col;
574
575    // 挿入目印を置く
576    var marker = $('<div />');
577    boxes.filter(':last').after(marker);
578
579    boxes.each(function(idx_){
580      var box = $(this);
581      var parent = box.parent();
582
583      if(idx_ % 2 == 0) {
584        col = $('<div class="col" />');
585        marker.before(col);
586        box.addClass(config.floatClassL);
587        col.append(box);
588      }
589      if(idx_ % 2 == 1) {
590        box.addClass(config.floatClassR);
591        col.append(box);
592      }
593    });
594
595    // 挿入目印を削除
596    marker.remove();
597  });
598
599  // box2の上下にボーダーを入れる
600  targetsJ.each(function(){
601    var targetJ = $(this);
602    var boxes = targetJ.find('> ' + config.boxClass1);
603
604    boxes.each(function(idx_){
605      var boxJ = $(this);
606
607      // 上か下にボーダーを入れる
608      if(boxJ.prev().is('.col')) {boxJ.addClass('border-top-com');}
609      if(boxJ.next().is('.col')) {boxJ.addClass('border-btm-com');}
610    });
611  });
612
613};
614
615/**
616 * 文字サイズ変更監視
617 * $.fn.fontSizeChange({func:function(){
618 *  $(".level1Row2Mod").eqGroupHeight(2);
619 *  $(".level2Row1Mod .list").eqGroupHeight(2);
620 *  $("#wrapper").show();
621 * }});
622 *
623 * @param object 設定
624 */
625$.fn.fontSizeChange = function(cfg_) {
626  function setFontSizeListener(func_) {
627    var s = $("<span />")
628      .text(" ")
629      .hide()
630      .appendTo("body");
631    s.data("size", s.css("font-size"));
632    s.data("timer", setInterval(function(){
633      if(s.css("font-size") != s.data("size")) {
634        s.data("size", s.css("font-size"));
635        func_();
636      }
637    }, 1000));
638
639  };
640
641  cfg_.func();
642  setFontSizeListener(cfg_.func);
643};
644
645/**
646 * 横並び画像※ie6 zoom:0.97で画像が落ちる現象を解消、下のキャプションが折り返すため
647 */
648$.fn.colImgSetWidth = function() {
649
650    var target = this;
651    var windowWidth = $(window).innerWidth();
652    var windowSm = 768;//ブレークポイント 
653
654    target.each(function(){
655
656        var L = $(this).find(".left-col");
657        var R = $(this).find(".right-col");
658
659        var LImg = L.find("img");
660        var RImg = R.find("img");
661
662      if (!$.browser.msie && windowSm <= windowWidth || $.browser.msie && $.browser.version < 9) {
663
664        L.width(LImg.width());
665        R.width(RImg.width());
666        
667      }else{
668
669        L.removeAttr('style');;
670        R.removeAttr('style');;
671
672      }
673
674    });
675
676};
677
678/**
679 * 市長の予定表の土日祝に色づけ
680 */
681$.fn.shichoDonichi = function() {
682  var target = this;
683
684  target.each(function(){
685    var day = $(this).find("td:eq(1)").text();
686
687    if(day.indexOf("土") > -1) {
688      $(this).addClass("sat");
689    }
690    if(day.indexOf("祝") > -1 || day.indexOf("日") > -1) {
691      $(this).addClass("sun");
692    }
693  });
694};
695
696/**
697 * tableのalign属性削除
698 */
699$.fn.tableDeleteAlign = function() {
700  $("table").removeAttr("align");
701};
702
703/**
704 * スマートフォンへのリンク
705 * $.fn.smartphoneLink({smphDir:'i', img:'<img src="/theme/base/img_pc_common/smartphone.png" width="960" height="114" alt="スマートフォン専用サイトへ" />'});
706 *
707 * @param object 設定
708 */
709$.fn.smartphoneLink = function(cfg_) {
710  if ((navigator.userAgent.indexOf('iPhone') > 0 && navigator.userAgent.indexOf('iPad') == -1) ||
711    navigator.userAgent.indexOf('iPod') > 0 || navigator.userAgent.indexOf('Android') > 0) {
712    if(location.pathname.match(/^\/i\//) == null) {
713      $("body").prepend('<p id="smartphone"><a href="/' + cfg_.smphDir + location.pathname + '">' + cfg_.img + '</a></p>');
714    }
715  }
716};
717
718/**
719 * スマートフォンへリダイレクト
720 * $.fn.smartphoneRedirect({smphDir:'i', img:'<img src="/theme/base/img_pc_common/smartphone.png" width="960" height="114" alt="スマートフォン専用サイトへ" />'});
721 *
722 * @param object 設定
723 */
724$.fn.smartphoneRedirect = function(cfg_) {
725  if ((navigator.userAgent.indexOf('iPhone') > 0 && navigator.userAgent.indexOf('iPad') == -1) ||
726    navigator.userAgent.indexOf('iPod') > 0 || navigator.userAgent.indexOf('Android') > 0) {
727    if(location.pathname.match(/^\/i\//) == null) {
728      if($.cookie('pclink') != null) {
729        $('body').prepend('<p id="smartphone"><a href="/' + cfg_.smphDir + location.pathname + '">' + cfg_.img + '</a></p>');
730        $('#smartphone a').on('click', function() {
731          $.cookie('pclink', null);
732          return true;
733        });
734        return;
735      }
736      location.pathname = '/' + cfg_.smphDir + location.pathname;
737    }
738  }
739};
740
741/**
742 * スマホからPCに戻るリンク
743 * $('.smph2PcCom').smph2Pc({
744 *  cookie: false
745 * });
746 *
747 * @param object 設定
748 */
749$.fn.smph2Pc = function(config_) {
750  config_ = $.extend({
751    // クリックしたことを保持する
752    cookie: false
753  },config_);
754
755  var targetsJ = this;
756  targetsJ.attr('href', location.pathname.replace(/^\/i/,""));
757  targetsJ.on('click', function() {
758    if(config_.cookie) {
759      $.cookie('pclink', '1', { path: '/'});
760    }
761    return true;
762  });
763}
764
765/**
766 * 画像タブ
767 * ※classHideは設定してください、tabsとpagesは一つだけ存在するmodを指定してください(id指定が最適)
768 * $.fn.imgTab({defaultSelect:0,cookie:'topTab',tabs:$("#topTab .list li"),pages:$("#topTab .box")});
769 *
770 * @param object 設定
771 */
772$.fn.imgTab = function(config) {
773  var targetJ = this;
774
775  config = $.extend({
776    tabs: null,
777    pages: null,
778    defaultSelect: 0,
779    cookie: 'tab',
780    off: '_off.',
781    on: '_on.',
782    classHide: 'hide'
783  }, config);
784
785  if (config.tabs == null || config.pages == null) {
786    return;
787  }
788
789  var ClassTab = function() {}
790
791  ClassTab.prototype = {
792
793    rollOver: function(select) {
794      var lis = config.tabs;
795      lis.each(function(idx){
796        var index = lis.index(this);
797        var img = $(this).find("img");
798        img.unbind("mouseenter").unbind("mouseleave"); //img.unbind('hover');ではできないらしい
799
800        var replaceOn = function(j) {
801          j.each(function(){
802            $(this).attr("src", $(this).attr("src").replace(config.off, config.on));
803          });
804          
805        };
806        var replaceOff = function(j) {
807          j.each(function(){
808            $(this).attr("src", $(this).attr("src").replace(config.on, config.off));
809          });
810        };
811        replaceOff(img);
812        if (select == idx) {
813          replaceOn(img);
814        } else {
815          img.hover(function() {
816            replaceOn(img);
817          }, function() {
818            replaceOff(img);
819          });
820        }
821      });
822    },
823    showpage: function(select) {
824      config.pages.each(function(idx) {
825        if (idx == select) {
826          $(this).removeClass(config.classHide);
827        } else {
828          $(this).addClass(config.classHide);
829        }
830      });
831    },
832    init: function() {
833
834      var cls = this;
835
836      config.pages.each(function(idx) {
837        if (idx == config.defaultSelect) {
838          $(this).removeClass(config.classHide);
839        } else {
840          $(this).addClass(config.classHide);
841        }
842      });
843
844      config.tabs.click(function() {
845        var idx = config.tabs.index(this);
846        cls.rollOver(idx);
847        cls.showpage(idx);
848        // アクセシブル対応
849        ariaTab(config.tabs, config.pages, idx);
850        //選択されたタブの番号をクッキーに保存
851        $.cookie(config.cookie, idx, {path: '/', expires: 30 });
852        return false;
853      });
854
855      config.tabs.keydown(function(e) {
856        var type = 'keydown';
857        var $prev = $(this).prev('[role="tab"]');
858        var $next = $(this).next('[role="tab"]');
859        var $target;
860        switch (e.keyCode) {
861          case 37: //左矢印(←)
862            $target = $prev;
863            break;
864          case 39: //右矢印(→)
865            $target = $next;
866            break;
867          default:
868            $target = false;
869            break;
870        }
871        if ($target.length) {
872          var idx = config.tabs.index($target);
873          cls.rollOver(idx);
874          cls.showpage(idx);
875          // アクセシブル対応
876          ariaTab(config.tabs, config.pages, idx, type);
877          //選択されたタブの番号をクッキーに保存
878          $.cookie(config.cookie, idx, {path: '/', expires: 30 });
879          return false;
880        }
881      });
882
883      cls.rollOver(config.defaultSelect);
884      // アクセシブル対応
885      ariaTab(config.tabs, config.pages, config.defaultSelect);
886    }
887  };
888
889
890  // 前回選択タブ復元
891  if ($.cookie(config.cookie)) {
892    config.defaultSelect = $.cookie(config.cookie);
893  }
894  // タブ作成
895  var tab = new ClassTab();
896  tab.init();
897
898};
899
900/**
901 * テキストタブ
902 * ※classHideは設定してください、tabsとpagesは一つだけ存在するmodを指定してください(id指定が最適)
903 * $.fn.textTab({defaultSelect:0,cookie:'topTab',tabs:$("#topTab .titleList li"),pages:$("#topTab .box")});
904 *
905 * @param object 設定
906 */
907$.fn.textTab = function(config) {
908  var targetJ = this;
909
910  config = $.extend({
911    tabs: null,
912    pages: null,
913    defaultSelect: 0,
914    cookie: 'tab',
915    classHover: 'hover',
916    classHide: 'hide'
917  }, config);
918
919  if (config.tabs == null || config.pages == null) {
920    return;
921  }
922
923  var ClassTab = function() {}
924  ClassTab.prototype = {
925    rollOver: function(select) {
926      config.tabs.unbind("mouseenter").unbind("mouseleave"); //img.unbind('hover');ではできない
927      config.tabs.removeClass(config.classHover);
928      config.tabs.each(function(idx) {
929        var tabJ = $(this);
930
931        if (select == idx) {
932          tabJ.addClass(config.classHover);
933        } else {
934          tabJ.hover(function() {
935            tabJ.addClass(config.classHover);
936          }, function() {
937            tabJ.removeClass(config.classHover);
938          });
939        }
940      });
941    },
942    showpage: function(select) {
943
944      config.pages.each(function(idx) {
945        if (idx == select) {
946          $(this).removeClass(config.classHide);
947        } else {
948          $(this).addClass(config.classHide);
949        }
950      });
951    },
952    init: function() {
953      var cls = this;
954
955      config.pages.each(function(idx) {
956        if (idx == config.defaultSelect) {
957          $(this).removeClass(config.classHide);
958        } else {
959          $(this).addClass(config.classHide);
960        }
961      });
962
963      config.tabs.click(function() {
964        var idx = config.tabs.index(this);
965        cls.rollOver(idx);
966        cls.showpage(idx);
967        // アクセシブル対応
968        ariaTab(config.tabs, config.pages, idx);
969        //選択されたタブの番号をクッキーに保存
970        $.cookie(config.cookie, idx, {path: '/', expires: 30 });
971        return false;
972      });
973
974      config.tabs.keydown(function(e) {
975        var type = 'keydown';
976        var $prev = $(this).prev('[role="tab"]');
977        var $next = $(this).next('[role="tab"]');
978        var $target;
979        switch (e.keyCode) {
980          case 37: //左矢印(←)
981            $target = $prev;
982            break;
983          case 39: //右矢印(→)
984            $target = $next;
985            break;
986          default:
987            $target = false;
988            break;
989        }
990        if ($target.length) {
991          var idx = config.tabs.index($target);
992          cls.rollOver(idx);
993          cls.showpage(idx);
994          // アクセシブル対応
995          ariaTab(config.tabs, config.pages, idx, type);
996          //選択されたタブの番号をクッキーに保存
997          $.cookie(config.cookie, idx, {path: '/', expires: 30 });
998          return false;
999        }
1000      });
1001
1002      cls.rollOver(config.defaultSelect);
1003      // アクセシブル対応
1004      ariaTab(config.tabs, config.pages, config.defaultSelect);
1005    }
1006  };
1007
1008  // 前回選択タブ復元
1009  if ($.cookie(config.cookie)) {
1010    config.defaultSelect = $.cookie(config.cookie);
1011  }
1012  // タブ作成
1013  var tab = new ClassTab();
1014  tab.init();
1015
1016};
1017
1018
1019// タブのアクセシビリティ対応
1020function ariaTab(tabList, tabPanel, defaultSelect, actionType) {
1021
1022  // 切替タブへrole、aria-controls、aria-selectedの追加
1023  var tabListParent = $(tabList).parent();
1024  $(tabListParent).attr('role', 'tablist');
1025  tabList.attr('role', 'tab');
1026
1027  tabList.each(function(idx) {
1028    if ($('a', this).attr('href')) {
1029      if (idx == defaultSelect) {
1030        $(this).attr({
1031          'aria-controls': $(this).find('a').attr('href').substr(1),
1032          'aria-selected': 'true'
1033        });
1034        $('a',this).removeAttr('tabindex');
1035        if( actionType == "keydown") {
1036          $('a',this).focus();
1037        }
1038      } else {
1039        $(this).attr({
1040          'aria-controls': $(this).find('a').attr('href').substr(1),
1041          'aria-selected': 'false'
1042        });
1043        $('a',this).attr('tabindex','-1');
1044      }
1045    }
1046  });
1047
1048  // タブパネルのrole、aria-hiddenの追加
1049  tabPanel.each(function(idx){
1050    $(this).attr({"role":"tabpanel"});
1051    if (idx == defaultSelect) {
1052      $(this).attr("aria-hidden","false");
1053    }
1054    else{
1055      $(this).attr("aria-hidden","true");
1056    }
1057  });
1058}
1059
1060
1061
1062
1063/**
1064 * シーズンの画像差し替え
1065 * //             1  2  3  4  5  6  7  8  9  10 11 12
1066 * var seasons = [3, 3, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3];
1067 * $('#headerGraphic').seasonClass({
1068 *  seasons:seasons
1069 * });
1070 * ex.otsu
1071 *
1072 * @param object 設定
1073 */
1074$.fn.seasonClass = function(config) {
1075  config = $.extend({
1076    //        1  2  3  4  5  6  7  8  9  10 11 12
1077    seasons: [3, 3, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3]
1078    ,imgs: ['springCom', 'summerCom', 'autumnCom', 'winterCom']
1079  },config);
1080
1081  // 季節の画像取得
1082  var month = (new Date()).getMonth();
1083  var seasonNum = config.seasons[month];
1084  var newImg = config.imgs[seasonNum];
1085
1086  var targetsJ = this;
1087
1088  targetsJ.each(function() {
1089    var targetJ = $(this);
1090    targetJ.addClass(newImg);
1091  });
1092};
1093
1094/**
1095 * アコーディオン
1096 * $('.accordionMod > li').accordion({
1097 *  classHead:'.title',
1098 *  classBody:'.childs',
1099 *  classToggle:'on'
1100 * });
1101 * ex.fujii sp
1102 *
1103 * @param object 設定
1104 */
1105$.fn.svAccordion = function(config) {
1106  var targetsJ = this;
1107
1108  config = $.extend({
1109    classHead: '.head',
1110    classBody: '.body',
1111    classToggle: 'minus'
1112  },config);
1113
1114  var applyAccordion = function(targetJ) {
1115
1116    var headJ = targetJ.find(config.classHead);
1117    var bodyJ = targetJ.find(config.classBody);
1118
1119    // 元々開いているかチェック
1120    if(!headJ.hasClass(config.classToggle)) {
1121      bodyJ.hide();
1122    }
1123
1124    headJ.click(function() {
1125      if(bodyJ.is(':animated')) {
1126        return false;
1127      }
1128
1129      bodyJ.slideToggle("normal",function(){
1130        if(bodyJ.is(':visible')) {
1131          headJ.addClass(config.classToggle);
1132        } else {
1133          headJ.removeClass(config.classToggle);
1134        }
1135      });
1136
1137      return false;
1138    });
1139  }
1140
1141  targetsJ.each(function(){
1142    applyAccordion($(this));
1143  });
1144};
1145
1146/**
1147 * フェード スライダー
1148 * $('#slider').smartSlider2({
1149 *  slider: '.list',
1150 *  nav: '.navs',
1151 *  play: '.ichiji',
1152 *  playHTML: '<img width="21" height="20" alt="画像を開始する" src="/theme/base/img_pc_top/slider_play.png"/>',
1153 *  stopHTML: '<img width="21" height="20" alt="画像を停止する" src="/theme/base/img_pc_top/slider_ichiji.png"/>',
1154 *  interval: 8000,
1155 *  duration: 1000
1156 * });
1157 * ex.odai
1158 *
1159 * @param object 設定
1160 */
1161$.fn.fadeSlider = function (config) {
1162  var target = this;
1163  config = jQuery.extend({
1164    slider: null,
1165    nav: null,
1166    play: null,
1167    playHTML:'スライドする',
1168    stopHTML:'一時停止',
1169    interval:8000,
1170    duration:1000
1171  },config);
1172
1173  var sliderJ = target.find(config.slider);
1174  var sliderNum = 0;//slideしていく番号
1175  var sliderMax = sliderJ.find('li').size();
1176  var navJ = target.find(config.nav);
1177  var playJ = target.find(config.play);
1178
1179  // 自動切換え
1180  var autoPlayID;
1181  var autoPlay = function () {
1182    clearInterval(autoPlayID);
1183    autoPlayID = setInterval(function () {
1184      nextSlide();
1185    }, config.interval);
1186  };
1187  autoPlay();
1188
1189  // 自動切換え停止
1190  var autoStop = function () {
1191    clearInterval(autoPlayID);
1192  };
1193
1194  // 現在位置ナビ作成
1195  var createNav = function() {
1196    sliderJ.find('li').each(function() {
1197      navJ.append('<span />');
1198    });
1199    navJ.find('span').each(function() {
1200      var li = $(this);
1201      li.hover(function() {
1202        sliderNum = $(this).index();
1203        slide();
1204        autoStop();
1205      },
1206      function() {
1207        if(autoPlayState) {
1208          autoPlay();
1209        }
1210
1211
1212      });
1213    });
1214  };
1215  createNav();
1216
1217  // 一時停止
1218  var autoPlayState = true;
1219  var applyPlay = function() {
1220    if(autoPlayState) {
1221      playJ.html(config.stopHTML);
1222    } else {
1223      playJ.html(config.playHTML);
1224    }
1225  };
1226  var settingPlay = function() {
1227    playJ.click(function() {
1228      autoPlayState = !autoPlayState;
1229      if(autoPlayState) {
1230        autoPlay();
1231      } else {
1232        autoStop();
1233      }
1234      applyPlay();
1235    });
1236    applyPlay();
1237  };
1238  settingPlay();
1239
1240  // スライダ初期化
1241  var initSlide = function() {
1242    var liJ = sliderJ.find('li').eq(sliderNum);
1243    sliderJ.find('li:visible').hide();
1244    //sliderJ.find('li').eq(sliderNum).show();;
1245    navJ.find('span').eq(sliderNum).addClass('active');
1246    liJ.show();
1247
1248  };
1249  initSlide();
1250
1251  // 高さ適用
1252  var apllyImgH = function() {
1253    var liJ = sliderJ.find('li').eq(sliderNum);
1254    var ulJ = liJ.parent();
1255    ulJ.height(liJ.height());
1256  }
1257  apllyImgH();
1258
1259  // アクティブな画像にスライド
1260  var slide = function() {
1261    var liJ = sliderJ.find('li').eq(sliderNum);
1262    var ulJ = liJ.parent();
1263    ulJ.stop(true,true).animate({height:liJ.height()+'px'}, config.duration);
1264
1265    sliderJ.find('li:visible').stop(true,true).animate({ opacity: 'hide'}, config.duration);
1266    //sliderJ.find('li').eq(sliderNum).stop(true,true).animate({ opacity: 'show'}, config.duration);
1267    liJ.stop(true,true).animate({ opacity: 'show'}, config.duration);
1268
1269    navJ.find('span').removeClass('active');
1270    navJ.find('span').eq(sliderNum).addClass('active');
1271
1272  };
1273
1274  // 次のスライド画像へ
1275  var nextSlide = function() {
1276    //alert('test');
1277    sliderNum++;
1278    if(sliderNum >= sliderMax) {
1279      sliderNum = 0;
1280    }
1281    slide();
1282  };
1283}
1284
1285/**
1286 * フェード スライダー
1287 * $('#slider').simpleLoopSlider({autoSlide : true,interval : 8000,easing : 'easeInOutExpo',duration : 1500});
1288 * ex.honjo
1289 *
1290 * @param object 設定
1291 */
1292$.fn.slideSlider = function (options) {
1293  var self = $(this);
1294  var li = self.find("li");
1295  if(li.size() <= 1) {
1296    options.controller = false;
1297    options.pagination = false;
1298  }
1299
1300  var defaults = {
1301    controller: true,
1302    pagination: true,
1303    interval  : 3000,
1304    duration  : 300,
1305    easing    : 'linear'
1306  };
1307
1308  var o = $.extend(defaults, options);
1309
1310  var ichiji = false;
1311  var over = false;
1312
1313  this.each(function () {
1314
1315    var $slider   = $(this),
1316      $prev   = $slider.find('.slL'),
1317      $next   = $slider.find('.slR'),
1318      $view   = $slider.find('.box'),
1319      $container  = $view.find('.list'),
1320      $contents = $container.find('li'),
1321      $firstChild = $contents.filter(':first-child'),
1322      $lastChild  = $contents.filter(':last-child'),
1323      $stop   = $slider.find('.ichiji a');
1324
1325    var size = {
1326      width : $view.width(),
1327      height: $view.height()
1328    };
1329
1330    var count = {
1331      min  : 0,
1332      max  : $contents.length,
1333      current: 0
1334    };
1335
1336    $container.css({
1337      width    :  size.width * ($contents.length + 2)
1338    });
1339
1340    // slider
1341    var distance;
1342
1343    // 連打されたときにアニメーション終わりの補正が走らず次が走って表示がおかしくなる現象回避
1344    var apllyBefore = function() {
1345      if(count.current == 0) {
1346        $firstChild.css('left', 0);
1347        $container.css('left', 0);
1348      }
1349      if(count.current == (count.max -1)) {
1350          $lastChild.css('left', '');
1351          $container.css('left', -(size.width * ($contents.length - 1)));
1352      }
1353    };
1354
1355    var apply = function() {
1356      distance = size.width * count.current;
1357
1358      if((count.current >= count.min) && (count.current < count.max)) {
1359        $container.stop(true, false).animate({left: -distance}, o.duration, o.easing);
1360      }
1361      else {
1362        if(count.current < count.min) {
1363          $lastChild.css('left', -(size.width * $contents.length));
1364          $container.stop(true, false).animate({left: -distance}, o.duration, o.easing,function () {
1365            $lastChild.css('left', '');
1366            $container.css('left', -(size.width * ($contents.length - 1)));
1367          });
1368          count.current = count.max -1 ;
1369
1370        }
1371        else if(count.current >= count.max) {
1372          $firstChild.css('left', size.width * $contents.length);
1373          $container.stop(true, false).animate({left: -distance}, o.duration, o.easing,function () {
1374            $firstChild.css('left', 0);
1375            $container.css('left', 0);
1376          });
1377          count.current = 0;
1378        }
1379      }
1380
1381      $pagination.children('a').removeClass('current');
1382      $pagination.children('a:eq(' + count.current + ')').addClass('current');
1383    }
1384
1385    var next = function () {
1386      apllyBefore();
1387      count.current++;
1388      apply();
1389    };
1390
1391    var index = function (index) {
1392      apllyBefore();
1393      count.current = index;
1394      apply();
1395    };
1396
1397    var prev = function () {
1398      apllyBefore();
1399      count.current--;
1400      apply();
1401    };
1402
1403    var $pagination = $slider.find('.navs');
1404    $contents.each(function (i) {
1405      $('<a/>').attr('href', '#')
1406      .text(i + 1)
1407      .appendTo($pagination)
1408      .click(function (e) {
1409        e.preventDefault();
1410        index(i);
1411        ichiji = false;
1412        play();
1413        setItiji();
1414      });
1415    });
1416
1417    $pagination.find('a:first-child').addClass('current');
1418
1419    // 繰り返しをリセットしてスタート
1420    var timerID;
1421    var play = function () {
1422      clearInterval(timerID);
1423      timerID = setInterval(function () {
1424        if(ichiji) {
1425          return;
1426        }
1427        if(over) {
1428          return;
1429        }
1430        next();
1431      }, o.interval);
1432    };
1433
1434    $prev.click(function () {
1435      prev();
1436      ichiji = false;
1437      play();
1438      setItiji();
1439      return false;
1440    });
1441    $next.click(function () {
1442      next();
1443      ichiji = false;
1444      play();
1445      setItiji();
1446      return false;
1447    });
1448
1449    $stop.click(function () {
1450      if(ichiji) {
1451        ichiji = false;
1452        play();
1453        setItiji();
1454      }
1455      else {
1456        ichiji = true;
1457        setItiji2();
1458      }
1459      return false;
1460    });
1461
1462    var setItiji = function() {
1463      var img = $stop.find('img');
1464      var src = img.attr('src');
1465      src = src.replace('itiji2.', 'itiji.');
1466      img.attr('src', src);
1467    };
1468
1469    var setItiji2 = function() {
1470      var img = $stop.find('img');
1471      var src = img.attr('src');
1472      src = src.replace('itiji.', 'itiji2.');
1473      img.attr('src', src);
1474    };
1475
1476    $contents.hover(
1477      function () {
1478        over = true;
1479      },
1480      function () {
1481        over = false;
1482        play();
1483      }
1484    );
1485    play();
1486  });
1487};
1488
1489
1490
1491
1492/**
1493 * スマホ向けライトボックス
1494 *
1495 * @param object 設定
1496 */
1497$.fn.lightbox = function(config) {
1498  var targetJ = this;
1499
1500  config = $.extend({
1501    modalBg:null,
1502    modal:null,
1503    close:null,
1504    scrollID:'sWrapper',
1505    lightSpot:null
1506  },config);
1507
1508  if(config.modalBg == null || config.modal == null) {
1509    return;
1510  }
1511
1512  // 簡易スクロール
1513  var anchorScroll = function(id){
1514    var j = $( "#" + id);
1515    if(j.size() == 0) {
1516      return;
1517    }
1518    $('html,body').animate({scrollTop: j.offset().top}, 200, "linear");
1519  }
1520
1521
1522  var applyModal = function(targetJ) {
1523
1524
1525    var showModal = function() {
1526      var docH = $(document).height();
1527      config.modalBg.height(docH);
1528      config.modalBg.fadeIn(200);
1529      config.modal.fadeIn(200);
1530      config.lightSpot.css({'z-index': '99'});
1531    };
1532
1533    var hideModal = function() {
1534      config.modalBg.hide();
1535      config.modal.hide();
1536      anchorScroll(config.scrollID);
1537      config.lightSpot.css({'z-index': 'auto'});
1538    };
1539
1540
1541
1542    targetJ.click(function() {
1543      showModal();
1544      return false;
1545    });
1546    config.close.click(function() {
1547      hideModal();
1548      return false;
1549    });
1550    config.modalBg.click(function() {
1551      hideModal();
1552      return false;
1553    });
1554
1555
1556  }
1557
1558  applyModal(targetJ);
1559};
1560
1561/**
1562 * バナークリック数カウント
1563 * $('.kokokuMod .list a').bannerClick({
1564 *  title:'広告クリック数'
1565 * });
1566 *
1567 * @param object 設定
1568 */
1569$.fn.bannerClick = function(config_) {
1570  var targetJ = this;
1571
1572  config_ = $.extend({
1573    title:'広告クリック数'
1574  },config_);
1575
1576  targetJ.click(function(){
1577    //_gaq.push(['_trackEvent', config_.title, $(this).find("img").attr('alt'), $(this).attr('href')]);// old(旧)
1578    if(typeof ga == 'function'){
1579      ga('send', 'event', config_.title, 'click', $(this).find("img").attr('alt') + ':' + $(this).attr('href'));// new(ユニバーサル)
1580    }
1581  });
1582};
1583
1584/**
1585 * バナークリック数カウント(GA4用)
1586 * $('.kokokuMod .list a').bannerClick2({
1587 *  category:'広告クリック数'
1588 * });
1589 *
1590 * @param object 設定
1591 */
1592$.fn.bannerClick2 = function(config_) {
1593  var targetJ = this;
1594
1595  config_ = $.extend({
1596    action:'sv_banner_click',
1597    category:'広告クリック数',
1598    label:'',
1599    value: 1
1600  },config_);
1601
1602  targetJ.click(function(){
1603    //GA4用
1604    if(typeof gtag == 'function'){
1605      gtag('event', config_.action, {
1606        'event_category': config_.category,
1607        'event_label': $(this).find("img").attr('alt') + ':' + $(this).attr('href'),
1608        'value': config_.value
1609      });
1610    }
1611  });
1612};
1613
1614
1615
1616/**
1617 * snsボタン
1618 * $("body").snsConstraction();
1619 *
1620 */
1621
1622$.fn.snsConstraction = function() {
1623    //opacityはie9以降からさポートしているので
1624  if(jQuery.support.opacity){
1625    //IE8未満は出さない
1626    var socialJ = $('#social');
1627    // twitter
1628    var twitterJ = socialJ.find('#twitter');
1629
1630    if (twitterJ.size() > 0) {
1631      twitterJ.socialbutton('twitter', {
1632        button: 'horizontal'
1633      });
1634    }
1635
1636    // google
1637    var google_plusoneJ = socialJ.find('#google_plusone');
1638
1639    if (google_plusoneJ.size() > 0) {
1640      google_plusoneJ.socialbutton('google_plusone', {
1641        lang: 'ja',
1642        size: 'medium'
1643      });
1644    }
1645
1646    // facebook_like
1647    var facebook_likeJ = socialJ.find('#facebook_like');
1648
1649    if (facebook_likeJ.size() > 0) {
1650      facebook_likeJ.socialbutton('facebook_like', {
1651        button: 'button_count'
1652      });
1653    }
1654  }
1655};
1656
1657
1658
1659
1660
1661/**
1662 * イベントスライダー
1663 * $("body").snsConstraction();
1664 *
1665 */
1666$.fn.eventSlider = function() {
1667
1668//関連イベントスライダー(device width で枚数切り替え。)
1669
1670  (function(){
1671
1672    var sliderOption = function(){
1673
1674      //device width別に枚数を決める
1675      var windowWidth = $(window).innerWidth();
1676      var windowSm = 768;//ブレークポイント
1677      var optionArry;
1678
1679      //[maxSlidesとminSlides,slideMargin]
1680      if ($.browser.msie && $.browser.version < 9) {
1681        optionArry = [2,15];
1682      }else if(windowWidth <= windowSm){
1683        optionArry = [1,0];
1684      }else{
1685        optionArry = [2,15];
1686      }
1687      return optionArry;
1688    }
1689
1690    var optionValue = sliderOption();
1691
1692    //bxスライダー動かすときのオプション
1693    var sliderPageMove = {
1694      auto: true
1695      ,autoControls: true
1696      ,speed:1000
1697      ,pause:5000
1698      ,slideWidth: 638
1699      ,maxSlides: optionValue[0]
1700      ,minSlides: optionValue[0]
1701      ,slideMargin: optionValue[1]
1702      ,pager:false
1703      ,moveSlides:1
1704      ,responsive: true
1705    }
1706
1707    var sliderTarget =  $('#event-page-slider .bxslider .list,#slider-parts .bxslider .list');
1708    var slider1 = sliderTarget.bxSlider(sliderPageMove); 
1709
1710
1711    //リサイズしたら、device width別に枚数を決め直して、リロードする
1712    $(window).on('resize',function(e){
1713
1714      if(sliderTarget.length){
1715        e.preventDefault();
1716
1717        //スライダーが動いてないと、reloadSliderメソッドが使えないので、再びスライダーを実行。
1718        optionValue = sliderOption();
1719
1720        //bxスライダー動かすときのオプションを設定し直す
1721        sliderPageMove['maxSlides'] = optionValue[0];
1722        sliderPageMove['minSlides'] = optionValue[0];
1723        sliderPageMove['slideMargin'] = optionValue[1];
1724
1725        //リロード
1726        slider1.reloadSlider(sliderPageMove);
1727      }
1728
1729    });
1730
1731  })();
1732
1733
1734  (function(){
1735
1736    //イベント目次スライダー
1737    var sliderListMove = {
1738
1739      auto: true
1740      ,autoControls: true
1741      ,speed:1000
1742      ,pause:5000
1743      ,maxSlides: 1
1744      ,minSlides: 1
1745      ,pager:false
1746      ,moveSlides:1
1747      ,responsive: true
1748
1749    }
1750
1751    var slider2 = $('.event-pickup-area .bxslider .list').bxSlider(sliderListMove);  
1752    var slider3 = $('.event-today-area .bxslider .list').bxSlider(sliderListMove); 
1753
1754  })();
1755
1756}; 
1757
1758
1759/**
1760 * Jalert 取得表示
1761 * @param ...
1762 * @version 0.1
1763 * @return ... Returns {@ code}
1764 */
1765 $.fn.jAlertListView = function(config){
1766    config = $.extend({
1767      rssPath:'',
1768      historyPath:'',
1769      historyClass:'.more',
1770      listClass:'.list',
1771      limit:'5',
1772      type:'1',
1773      html:''
1774    },config);
1775
1776    $.ajax({
1777      url:config.rssPath,
1778      timeout: 10000,
1779      dataType: "json",
1780      context:this,
1781      success:function(json){
1782      if(json.success) {
1783        //取得成功
1784
1785        //デフォルトのJalert
1786        var defalt_html = '<div class="jalert-area"><dl><dt class="title"><span class="bg"><span class="bg2">J-ALERT(全国瞬時警報システム)</span></span></dt><dd class="in"><ul class="list"></ul><p class="more"></p></dd></dl></div>';
1787
1788        //xml配列を変数に格納
1789        var itemList = json.data; 
1790        //発布されていなければなにもしない
1791        if(itemList.length == 0){
1792          return;
1793        }
1794
1795        //カスタムされたJalertHTMLを確認
1796          var $parentBox = $(this);
1797          var $jAlertBox = function(){
1798              //htmlが無ければデフォルト出す
1799              var $jalert_html = $(defalt_html);
1800              if(config.html==''){
1801                return $jalert_html;
1802              }else{
1803                return config.html;
1804              }
1805          };
1806          //JAlertのボックス生成
1807          $parentBox.append($jAlertBox);
1808          //履歴リンク設置
1809          var $historyLink = $($parentBox).find(config.historyClass);
1810          var $historyA = $('<a href="#">過去の配信履歴を見る</a>')
1811          $historyA.attr('href',config.historyPath);
1812          $historyLink.append($historyA);
1813
1814          //発布されたJAlertリストの格納ボックスを定義
1815         var $jalertListBox = $($parentBox).find(config.listClass);
1816
1817          //xmlデータをまわす
1818          $(itemList).each(function(idx){
1819
1820
1821              if(config.limit!='0'){
1822                if(idx >= config.limit){
1823                  return false;//break
1824                }
1825              }
1826
1827              var jalertTitle = this.title;
1828              var jalertLink = this.link;
1829              var jalertDate = this.pubDate;
1830              var date = new Date(jalertDate);
1831              var dateText = '(配信日:' + date.getFullYear() + '年' + (date.getMonth() + 1) + '月' + date.getDate() + '日)';
1832              //リスト生成
1833              var $li = $('<li><a href="#"></a></li>');
1834              //リンク生成
1835              var $liA = $li.find('a');
1836              $liA.attr('href', jalertLink);
1837              $liA.html(jalertTitle + dateText);
1838              $jalertListBox.append($li);
1839
1840          });
1841           }
1842        }
1843      });};
1844
1845
1846/**
1847 * SmartAlert
1848 * @param ...
1849 * @return ... Returns {@ code}
1850*/
1851$.fn.smartAlertListView = function(config){
1852
1853  // 初期値
1854  config = $.extend({
1855    rssPath: site_domain + '/cgi-bin/smart_alert.php/1',
1856    historyPath: site_domain + '/cgi-bin/smart_alert.php/1/list',
1857    historyClass: '.more',
1858    ulClass: '.list',
1859    textClass: '.text',
1860    dateClass: '.date',
1861    limit: 3,
1862    dateformat: 'YYYY年MM月DD日(WW) hh時mm分ss秒',
1863    noDataView: 1,
1864  },config);
1865
1866  // パラメーターのエラー判定
1867  var errorMsg = '';
1868  for(key in config) {
1869    var value = config[key];
1870    // 空文字の判定
1871    if(value === '') {
1872      errorMsg += 'エラー:' + key + 'に空文字が入っています\n';
1873    } else {
1874      // 数値かどうかの判定
1875      if(key === 'limit' || key === 'noDataView') {
1876        if($.type(value) !== 'number'){
1877          errorMsg += 'エラー:' + key + 'に文字列が入っています\n';
1878        }
1879      // 文字列かどうかの判定
1880      } else {
1881        if($.type(value) !== 'string') {
1882          errorMsg += 'エラー:' + key + 'に数値が入っています\n';
1883        }
1884      }
1885    }
1886  }
1887  // エラーあれば実行しない
1888  if(errorMsg) {
1889    console.error(errorMsg);
1890  // エラーなければ実行
1891  } else {
1892    $.ajax({
1893      url:config.rssPath,
1894      timeout: 10000,
1895      dataType: 'json',
1896      context:this,
1897      success:function(json){
1898        var itemList = json.data; //xml配列を変数に格納
1899        var $parentBox = this; //表示エリアを選択
1900        var $smartAlertUlBox = $parentBox.find(config.ulClass); //ulタグを選択
1901        var $li = $smartAlertUlBox.find('li:first'); //liタグを選択
1902        var litags = '';
1903        // --------------------------------------------
1904        //アラートがあれば
1905        if(itemList.length){
1906          //一覧ページへのリンク先設定
1907          $($parentBox).find(config.historyClass + ' a').attr('href', config.historyPath);
1908          //xmlデータをまわす
1909          $(itemList).each(function(idx){
1910            if(idx >= config.limit){
1911              return false;
1912            }
1913            //アラート内容の作成
1914            var smartAlertTitle = this.title;
1915            var smartAlertLink = this.link;
1916            //アラート日付の作成
1917            var date = new Date(this.pubDate);
1918            var weekday = ['日', '月', '火', '水', '木', '金', '土'];
1919            var dateText = config.dateformat;
1920            dateText = dateText.replace(/YYYY/, date.getFullYear());
1921            dateText = dateText.replace(/MM/, ('0' + (date.getMonth() + 1)).slice(-2));
1922            dateText = dateText.replace(/DD/, ('0' + date.getDate()).slice(-2));
1923            dateText = dateText.replace(/WW/, weekday[date.getDay()]);
1924            dateText = dateText.replace(/hh/, ('0' + date.getHours()).slice(-2));
1925            dateText = dateText.replace(/mm/, ('0' + date.getMinutes()).slice(-2));
1926            dateText = dateText.replace(/ss/, ('0' + date.getSeconds()).slice(-2));
1927            dateText = dateText.replace(/M/, date.getMonth() + 1);
1928            dateText = dateText.replace(/D/, date.getDate());
1929            dateText = dateText.replace(/h/, date.getHours());
1930            dateText = dateText.replace(/m/, date.getMinutes());
1931            dateText = dateText.replace(/s/, date.getSeconds());
1932            //リンクの挿入
1933            if($li.find('a').length) {
1934              $li.find('a').attr('href', smartAlertLink);
1935            }
1936            //アラート内容の挿入
1937            if($li.find(config.textClass).length) {
1938              $li.find(config.textClass).text(smartAlertTitle);
1939            }
1940            //アラート日付の挿入
1941            if($li.find(config.dateClass).length) {
1942              $li.find(config.dateClass).text(dateText);
1943            }
1944            litags += $li.prop('outerHTML');
1945          });
1946          //追加
1947          $smartAlertUlBox.html(litags);
1948          // エリアの表示
1949          $parentBox.css('display', 'block');
1950
1951        // --------------------------------------------
1952        //アラートがなければ
1953        // --------------------------------------------
1954        } else {
1955          if(config.noDataView) {
1956            $parentBox.css('display', 'block');
1957            $li = config.noDataClass ? $(config.noDataClass) : '<li>データがありません</li>';
1958            $smartAlertUlBox.html($li);
1959            $parentBox.find(config.historyClass).remove(); //一覧ページへのボタンを削除
1960          } else {
1961            $parentBox.remove(); //エリアごと削除
1962          }
1963        }
1964      }
1965    });
1966  }
1967  return this;
1968};
1969
1970
1971
1972 /**
1973 * ajax通信
1974 * url: ajax通信するURL
1975 * param: パラメータ(オブジェクトで指定)
1976 * successHandler: 成功ハンドラ
1977 * errorHandler: 失敗ハンドラ
1978 * completeHandler: 完了ハンドラ
1979 * contextObj: コールバック関数のthisとして受け取る
1980 **/
1981function ajax(url, param, successHandler, errorHandler, completeHandler, contextObj) {
1982    $.ajax({
1983        type: 'get',
1984        url: url,
1985        data: param,
1986        dataType: 'json',
1987        context:contextObj,
1988        success: function(data) {
1989            if(successHandler != undefined && successHandler != null) {
1990                successHandler(data);
1991            }
1992        },
1993        error: function(data) {
1994            if(errorHandler != undefined && errorHandler != null) {
1995                errorHandler(data);
1996            }
1997        },
1998        complete: function(data) {
1999            if(completeHandler != undefined && completeHandler != null) {
2000                completeHandler(data);
2001            }
2002        }
2003    });
2004}
2005
2006/**
2007 * GoogleAnalyticsページランキング(GA4対応済)
2008 * @version 1.1
2009 * @param num viewNo,num limit,string element
2010 */
2011
2012$.fn.gaRanking = function(config){
2013
2014  config = $.extend({
2015    titleName:"よく見られるページ",
2016    profileNo: "",
2017    limit:5,
2018    printError:"",
2019    replaceStr:""
2020  },config);
2021
2022  var target = this;
2023
2024  var errorMessageTarget;
2025  if(config.printError !=""){
2026    errorMessageTarget = $(config.printError);
2027  }else{
2028    errorMessageTarget = $(this).find('.in');
2029  }
2030
2031  var hostName;
2032  if(site_domain.length > 0){
2033    hostName=site_domain;
2034  }else{
2035    hostName='http://'+location.hostname;
2036  }
2037
2038  if(config.profileNo != ""){
2039    //プロファイルNoが指定されていなければ動かさない
2040    var JSON_PATH = hostName + '/ga_ranking.' + config.profileNo + '.json';
2041
2042      //Ajax通信開始
2043      ajax(JSON_PATH,{},function(entry){
2044
2045      var $ul = $(target).find('.list');
2046      $ul.html('');
2047
2048      if(entry.success){
2049
2050        if(entry.data.length > 0){
2051
2052          for(var i in entry.data){
2053
2054            if(config.limit!=0){
2055              if(i >= config.limit) {
2056                return false;// break
2057              }
2058            }
2059
2060            var gaList = entry.data[i];
2061            var keyArray = Object.keys(gaList);
2062            var gaUrl,gaTitle;
2063
2064            if (keyArray[0]==="screenPageViews"){
2065              // GA4用
2066              gaUrl = entry.data[i]['pagePath'];
2067              gaTitle = entry.data[i]['pageTitle'];
2068            } else {
2069              // UA用
2070              gaUrl = entry.data[i]['ga:pagePath'];
2071              gaTitle = entry.data[i]['ga:pageTitle'];
2072            }
2073
2074            //削除したい文言があれば削除
2075            if(config.replaceStr!=""){
2076              gaTitle = gaTitle.replace(new RegExp(config.replaceStr,'g'),"");
2077            }
2078
2079            //DOMを生成して内容を出力
2080            var $li = $('<li><a href="#"></a></li>');
2081            $liA = $li.find('a');
2082            $liA.attr('href',gaUrl);
2083            $liA.html(gaTitle);
2084            $ul.append($li);
2085
2086          }
2087        }else{
2088          //取得件数0
2089          showErrorMessage(errorMessageTarget, '<p>現在、' + config.titleName + 'はございません</p>');
2090        }
2091
2092      }else{
2093        //取得失敗
2094        showErrorMessage(errorMessageTarget, '<p>'+ config.titleName + 'を取得できませんでした。<br>再読み込みしてください。</p>');
2095      }
2096
2097    },function(error){
2098      //通信失敗
2099      showErrorMessage(errorMessageTarget, '<p>' + config.titleName + 'を取得できませんでした。<br>再読み込みしてください。</p>');
2100    },function(success){},target);
2101
2102
2103  }
2104
2105};
2106
2107/**
2108 * Object.entries() の shim
2109 */
2110if (!Object.entries) {
2111  Object.entries = function (obj) {
2112    var ownProps = Object.keys(obj),
2113      i = ownProps.length,
2114      resArray = new Array(i); // preallocate the Array
2115    while (i--) resArray[i] = [ownProps[i], obj[ownProps[i]]];
2116
2117    return resArray;
2118  };
2119}
2120
2121/**
2122 * スロットル(同イベントのハンドリングの絞り/間引き)
2123 * スクロールイベントなど、連続で起きるイベントのハンドリングを間引き、
2124 * ブラウザの負荷を軽減します。
2125 * スクロールなど、連続的、大メモリの副作用を伴うイベント処理に適しています。
2126 *
2127 * 使い方)
2128 * 通常のイベントリッスン開始後、ドットチェーンで間引く頻度をミリ秒で指定します。
2129 *
2130 * 例)
2131 * $('.selecter').on('scroll', handler).throttle(200);
2132 *
2133 * @param {number} [interval=100] 間引く頻度しのきい値(ミリ秒)
2134 * @returns {jQuery} jQueryオブジェクト(ドットチェーン用)
2135 */
2136$.fn.throttle = function(interval) {
2137  // ホイスティング対策のため変数宣言をスコープの先頭で行う。
2138  var eventArray,
2139      destruction,
2140      eventName,
2141      data,
2142      next,
2143      now,
2144      lastTime,
2145      timerId,
2146      context;
2147
2148  // デフォルト引数のshim
2149  if (interval === null || interval === undefined) {
2150    interval = 100;
2151  }
2152
2153  // 連結されているイベント列を得る
2154  eventArray = Object.entries($._data(this.get(0), 'events'));
2155  
2156  // イベント列の最新を対象として得る
2157  destruction = eventArray[eventArray.length - 1];
2158
2159  // 分割代入のshim
2160  eventName = destruction[0];
2161  data = destruction[1];
2162  
2163  next = data[0].handler;
2164  this.off(eventName, next);
2165  context = this;
2166
2167  now = Date.now();
2168  lastTime = now - interval;
2169
2170  this.on(eventName, { next: next }, function(e) {
2171    var now = Date.now();
2172    
2173    // 最後の一回の予約判定
2174    if (timerId) {
2175      // 予約中であれば、再実行判定のため、一度予約を取り消す
2176      clearTimeout(timerId);
2177    }
2178    // しきい値判定
2179    if (lastTime + interval < now) {
2180      // しきい値を超えていたら、絞っていたハンドラを実行
2181      lastTime = now;
2182      e.data.next.bind(context)(e);
2183    } else {
2184      // 超えてないなら、最後の一回を予約
2185      timerId = setTimeout(function() {
2186        lastTime = now;
2187        e.data.next.bind(context)(e);
2188      }, interval - (now - lastTime));
2189    }
2190  });
2191
2192  return this;
2193};
2194
2195/**
2196 * デバウンス(同イベントの発火の据え置き)
2197 * キーストロークによるAjax通信などの際、イベント発火が一定時間内に
2198 * 連続で発生したとき、「最後の一回」だけハンドラを実行することで
2199 * ブラウザと副作用の負荷を軽減します。
2200 * 通信など、長時間の副作用を伴うイベント処理に適しています。
2201 *
2202 * 使い方)
2203 * 通常のイベントリッスン開始後、ドットチェーンで据え置く間隔をミリ秒で指定します。
2204 *
2205 * 例)
2206 * $('.selecter').on('input', handler).debounce(200);
2207 *
2208 * @param {number} [interval=100] 連続発火と判定するしきい値(ミリ秒)
2209 * @returns {jQuery} jQueryオブジェクト(ドットチェーン用)
2210 */
2211$.fn.debounce = function(interval) {
2212  // ホイスティング対策のため変数宣言をスコープの先頭で行う。
2213  var eventArray,
2214      destruction,
2215      eventName,
2216      data,
2217      next,
2218      timerId,
2219      context;
2220
2221  // デフォルト引数のshim
2222  if (interval === null || interval === undefined) {
2223    interval = 100;
2224  }
2225
2226  // 連結されているイベント列を得る
2227  eventArray = Object.entries($._data(this.get(0), 'events'));
2228  
2229  // イベント列の最新を対象として得る
2230  destruction = eventArray[eventArray.length - 1];
2231
2232  // 分割代入のshim
2233  eventName = destruction[0];
2234  data = destruction[1];
2235
2236  next = data[0].handler;
2237
2238  this.off(eventName, next);
2239  context = this;
2240
2241  this.on(eventName, { next: next }, function(e) {
2242    clearTimeout(timerId);
2243
2244    timerId = setTimeout(function() {
2245      e.data.next.bind(context)(e);
2246    }, interval);
2247  });
2248
2249  return this;
2250};
2251
2252// エラーメッセージ表示関数
2253function showErrorMessage(target, message){
2254    $(target).hide();
2255    $(target).html(message);
2256    $(target).show();
2257}
2258
2259// jqueryプラグインの存在チェック
2260function pluginExists( pluginName ){
2261     return [pluginName] || $.fn[pluginName] ? true : false;
2262}

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.