PageSourceSearch

https://www.city.fujimino.saitama.jp/theme/base/js/top.js

js city.fujimino.saitama.jp collected 2026-10-02 03:00:10 UTC 12,947 bytes, 392 lines download raw bytes

1$(function(){
2  if($('#wrapper').data('ver') == '2') {
3    // 新バージョンのjs
4
5  /**
6   * テキストタブ
7   * ※classHideは設定してください、tabsとpagesは一つだけ存在するmodを指定してください(id指定が最適)
8   * $.fn.textTab({defaultSelect:0,cookie:'topTab',tabs:$("#topTab .titleList li"),pages:$("#topTab .box")});
9   *
10   * @param object 設定
11   */
12    $.fn.textTabCustom = function(config) {
13      var targetJ = this;
14
15      config = $.extend({
16        tabs: null,
17        pages: null,
18        defaultSelect: 0,
19        cookie: 'tab',
20        classHover: 'hover',
21        classHide: 'hide'
22      }, config);
23
24      if (config.tabs == null || config.pages == null) {
25        return;
26      }
27
28      var ClassTab = function() {}
29      ClassTab.prototype = {
30        rollOver: function(select) {
31          config.tabs.unbind("mouseenter").unbind("mouseleave"); //img.unbind('hover');ではできない
32          config.tabs.removeClass(config.classHover);
33          config.tabs.each(function(idx) {
34            var tabJ = $(this);
35
36            if (select == idx) {
37              tabJ.addClass(config.classHover);
38            } else {
39              tabJ.hover(function() {
40                tabJ.addClass(config.classHover);
41              }, function() {
42                tabJ.removeClass(config.classHover);
43              });
44            }
45          });
46        },
47        showpage: function(select) {
48
49          config.pages.each(function(idx) {
50            if (idx == select) {
51              $(this).removeClass(config.classHide);
52            } else {
53              $(this).addClass(config.classHide);
54            }
55          });
56        },
57        init: function() {
58          var cls = this;
59
60          config.pages.each(function(idx) {
61            if (idx == config.defaultSelect) {
62              $(this).removeClass(config.classHide);
63            } else {
64              $(this).addClass(config.classHide);
65            }
66          });
67
68          config.tabs.click(function() {
69            var idx = config.tabs.index(this);
70            cls.rollOver(idx);
71            cls.showpage(idx);
72            // アクセシブル対応
73            ariaTabCustom(config.tabs, config.pages, idx);
74            //選択されたタブの番号をクッキーに保存
75            $.cookie(config.cookie, idx, {path: '/', expires: 30 });
76            return false;
77          });
78
79          config.tabs.keydown(function(e) {
80            var type = 'keydown';
81            var $prev = $(this).prev('[role="tab"]');
82            var $next = $(this).next('[role="tab"]');
83            var $target;
84            switch (e.keyCode) {
85              case 37: //左矢印(←)
86                $target = $prev;
87                break;
88              case 39: //右矢印(→)
89                $target = $next;
90                break;
91              default:
92                $target = false;
93                break;
94            }
95            if ($target.length) {
96              var idx = config.tabs.index($target);
97              cls.rollOver(idx);
98              cls.showpage(idx);
99              // アクセシブル対応
100              ariaTabCustom(config.tabs, config.pages, idx, type);
101              //選択されたタブの番号をクッキーに保存
102              $.cookie(config.cookie, idx, {path: '/', expires: 30 });
103              return false;
104            }
105          });
106
107          cls.rollOver(config.defaultSelect);
108          // アクセシブル対応
109          ariaTabCustom(config.tabs, config.pages, config.defaultSelect);
110        }
111      };
112
113      // 前回選択タブ復元
114      if ($.cookie(config.cookie)) {
115        config.defaultSelect = $.cookie(config.cookie);
116      }
117      // タブ作成
118      var tab = new ClassTab();
119      tab.init();
120
121    };
122
123
124    // タブのアクセシビリティ対応
125    function ariaTabCustom(tabList, tabPanel, defaultSelect, actionType) {
126
127      // 切替タブへrole、aria-controls、aria-selectedの追加
128      var tabListParent = $(tabList).parent();
129      $(tabListParent).attr('role', 'tablist');
130      tabList.attr('role', 'tab');
131
132      tabList.each(function(idx) {
133        if ($('a', this).attr('href')) {
134          var hrefString = $(this).find('a').attr('href').substr(1);
135          var tabRoleId = hrefString + '-tab-role';
136          if (idx == defaultSelect) {
137            $(this).attr({
138              'id': tabRoleId,
139              'aria-controls': hrefString,
140              'aria-selected': 'true'
141            });
142            $('a',this).removeAttr('tabindex');
143            if( actionType == "keydown") {
144              $('a',this).focus();
145            }
146          } else {
147            $(this).attr({
148              'id': tabRoleId,
149              'aria-controls': hrefString,
150              'aria-selected': 'false'
151            });
152            $('a',this).attr('tabindex','-1');
153          }
154        }
155      });
156
157      // タブパネルのrole、aria-labelledby、aria-hiddenの追加
158      tabPanel.each(function(idx){
159        $(this).attr({"role":"tabpanel"});
160        $(this).attr({"aria-labelledby":tabList[idx].id});
161        if (idx == defaultSelect) {
162          $(this).attr("aria-hidden","false");
163        }
164        else{
165          $(this).attr("aria-hidden","true");
166        }
167      });
168    }
169
170    // テキストタブ
171    $.fn.textTabCustom({defaultSelect:0,cookie:'top-tab',tabs:$("#top-tab .list li"),pages:$("#top-tab .box")});
172
173    // 広告クリックをカウントする
174    $('.js-kb-click .list a').bannerClick({});
175
176    // 広告クリックをカウントする(GA4)
177    $('.js-kb-click .list a').bannerClick2({});
178    
179    //トップスライダー
180    $('.slider-area .bxslider .list').smartSlider({
181      auto: true
182      ,mode: 'fade'
183      ,autoControls: true
184      ,controls: false
185      ,speed:1000
186      ,pause:5000
187      ,maxSlides: 1
188      ,minSlides: 1
189      ,slideMargin:0
190      ,autoControlsCombine: true
191      ,pagerSelector:'#slider1 .slide-pager'
192      ,autoControlsSelector:'#slider1 .slide-control-btn'
193    });
194
195    var width = window.innerWidth;
196
197    if(2 <= $('.main-slider-item').length) {
198      $('.main-slider').bxSlider({
199        auto: true
200        ,autoControls: true
201        ,speed:1000
202        ,pause:5000
203        ,slideWidth: 770
204        ,slideMargin: 0
205        ,maxSlides: 1
206        ,moveSlides: 1
207        ,autoControlsCombine: true
208        ,captions: true
209        ,onSliderLoad:function(currentIndex){
210          if(768 < width)
211            $('.main-section .bx-controls-direction').insertBefore($('.main-section .main-slider'));
212          else
213            $('.main-section .bx-controls-direction').insertBefore($('.main-section .bx-viewport'));
214        }
215      });
216    }
217
218    if(2 <= $('.link-slider-item').length) {
219      $('.link-slider').bxSlider({
220        auto: true
221        ,autoControls: true
222        ,speed:1000
223        ,pause:5000
224        ,slideWidth: 340
225        ,slideMargin: 50
226        ,maxSlides: 3
227        ,moveSlides: 1
228        ,slideMargin:0
229        ,autoControlsCombine: true
230        ,captions: true
231        ,onSliderLoad:function(currentIndex){
232          $('.link-section .bx-controls-direction').insertBefore($('.link-section .bx-viewport'));
233        }
234      });
235    }
236
237    //トップスライダーのキャプション 36文字以上は...になる
238    var $setElm = $('.bx-caption span');
239    var cutFigure = '36'; // カットする文字数
240    var afterTxt = ' …'; // 文字カット後に表示するテキスト
241
242    $setElm.each(function(){
243      var textLength = $(this).text().length;
244      var textTrim = $(this).text().substr(0,(cutFigure))
245
246      if(cutFigure < textLength) {
247        $(this).html(textTrim + afterTxt).css({visibility:'visible'});
248      } else if(cutFigure >= textLength) {
249        $(this).css({visibility:'visible'});
250      }
251    });
252
253    // /**
254    //  * JAlert
255    //  * @param ...
256    //  * @return ... Returns {@ code}
257    //  */
258    // var renkei_no = 1; //連携設定No
259    // $(".j-alert-section").customjAlertListView({
260    //   // データパス
261    //   // rssPath: site_domain + '/cgi-bin/smart_alert.php/' + renkei_no,
262    //   historyClass:'.btn',
263    //   historyPath:site_domain + '/cgi-bin/smart_alert.php/' + renkei_no +'/list',
264    //   listClass:'.list',
265    //   limit:'15', //テンプレート設計書からセット
266    //   html:'<div class="section-in clearfix"><h2 class="title">J-ALERT</h2><div class="list-container"><ul class="list"></ul></div><p class="btn"></p></div>'
267    // });
268
269    // SMARTALERTの出力
270    var renkei_no = 1 //連携設定No
271    $('#smartalert-wrap').smartAlertListView({
272      rssPath: site_domain + '/cgi-bin/smart_alert.php/' + renkei_no,
273      // rssPath: site_domain + '/smart_alert.json', //開発
274      historyPath: site_domain + '/cgi-bin/smart_alert.php/' + renkei_no +'/list',
275      historyClass: '.more',
276      ulClass: '.list',
277      textClass: '.text',
278      dateClass: '.date',
279      limit: 15, //最大表示数
280      dateformat: 'YYYY年MM月DD日hh時mm分', //YYYY年MM月DD日(WW) hh時mm分ss秒
281      noDataView: 0, //アラートが無い場合 0:エリアごと非表示 1:エリアは表示
282      noDataClass: '.no-data', //アラートが無い場合の文言クラス
283    })
284  }
285  else {
286    // 旧バージョンのjs
287    
288    // object fit images
289    objectFitImages();
290
291    // テキストタブ
292    $.fn.textTab({defaultSelect:0,cookie:'top-tab',tabs:$("#top-tab .list li"),pages:$("#top-tab .box")});
293
294    // 広告クリックをカウントする
295    $('.js-kb-click .list a').bannerClick({});
296
297    // 広告クリックをカウントする(GA4)
298    $('.js-kb-click .list a').bannerClick2({});
299    
300    //トップスライダー
301    $('#slider .bxslider .list').bxSlider({
302      auto: true
303      ,autoControls: true
304      ,speed:1000
305      ,pause:5000
306      ,slideWidth: 768
307      ,maxSlides: 1
308      ,minSlides: 1
309      ,slideMargin:0
310      ,autoControlsCombine: true
311      ,captions: true
312      ,nextSelector: '.slide-next'
313      ,prevSelector: '.slide-back'
314      ,onSliderLoad:function(currentIndex){
315      }
316    });
317
318    var width = window.innerWidth;
319
320    if(2 <= $('.main-slider-item').length) {
321      $('.main-slider').bxSlider({
322        auto: true
323        ,autoControls: true
324        ,speed:1000
325        ,pause:5000
326        ,slideWidth: 770
327        ,slideMargin: 0
328        ,maxSlides: 1
329        ,moveSlides: 1
330        ,autoControlsCombine: true
331        ,captions: true
332        ,onSliderLoad:function(currentIndex){
333          if(768 < width)
334            $('.main-section .bx-controls-direction').insertBefore($('.main-section .main-slider'));
335          else
336            $('.main-section .bx-controls-direction').insertBefore($('.main-section .bx-viewport'));
337        }
338      });
339    }
340
341    if(2 <= $('.link-slider-item').length) {
342      $('.link-slider').bxSlider({
343        auto: true
344        ,autoControls: true
345        ,speed:1000
346        ,pause:5000
347        ,slideWidth: 340
348        ,slideMargin: 50
349        ,maxSlides: 3
350        ,moveSlides: 1
351        ,slideMargin:0
352        ,autoControlsCombine: true
353        ,captions: true
354        ,onSliderLoad:function(currentIndex){
355          $('.link-section .bx-controls-direction').insertBefore($('.link-section .bx-viewport'));
356        }
357      });
358    }
359
360    //トップスライダーのキャプション 36文字以上は...になる
361    var $setElm = $('.bx-caption span');
362    var cutFigure = '36'; // カットする文字数
363    var afterTxt = ' …'; // 文字カット後に表示するテキスト
364
365    $setElm.each(function(){
366      var textLength = $(this).text().length;
367      var textTrim = $(this).text().substr(0,(cutFigure))
368
369      if(cutFigure < textLength) {
370        $(this).html(textTrim + afterTxt).css({visibility:'visible'});
371      } else if(cutFigure >= textLength) {
372        $(this).css({visibility:'visible'});
373      }
374    });
375
376    /**
377     * JAlert
378     * @param ...
379     * @return ... Returns {@ code}
380     */
381    var renkei_no = 1; //連携設定No
382    $(".j-alert-section").customjAlertListView({
383      // データパス
384      rssPath: site_domain + '/cgi-bin/smart_alert.php/' + renkei_no,
385      historyClass:'.btn',
386      historyPath:site_domain + '/cgi-bin/smart_alert.php/' + renkei_no +'/list',
387      listClass:'.list',
388      limit:'15', //テンプレート設計書からセット
389      html:'<div class="section-in clearfix"><h2 class="title">J-ALERT</h2><div class="list-container"><ul class="list"></ul></div><p class="btn"></p></div>'
390    });
391  }
392});

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.