PageSourceSearch

https://www.city.rikuzentakata.iwate.jp/theme/base/js/common.js

js city.rikuzentakata.iwate.jp collected 2026-10-02 03:26:24 UTC 7,528 bytes, 226 lines download raw bytes

1/**
2 * 全デザインサイト共通JS
3 * @author nagai
4 * @version 1.0
5 */
6$(function(){
7
8  //スムーズスクロール
9  $("a[href*='#'].scroll").smoothScroll();
10
11  //ファイルリンクは別窓表示
12  //$("a[href*='.*']").fileBlank('*') セレクタで拡張子指定 fileBlankの引数にクラス指定;
13  $("a[href*='.pdf']").fileBlank('pdf');
14  $("a[href*='.doc']").fileBlank('word');
15  $("a[href*='.xls']").fileBlank('excel');
16
17  // ファイルリンクのクリックイベント計測
18  $('.file-link-item a').on('click',function(){
19    var targetUrl = $(this).attr('href');
20    var targetLabel = $(this).text();
21    // ga未定義の場合は実行しない
22    if(typeof ga == 'function'){
23      ga('send', 'event', targetUrl, 'download', targetLabel);
24    }
25    // gtag未定義の場合は実行しない(GA4)
26    if(typeof gtag == 'function'){
27      gtag('event', 'sv_file_link_click', {
28        'event_category': 'file_download_category',
29        'event_label': targetLabel + ':' + targetUrl,
30        'value': 1
31      });
32    }
33  });
34
35  //ロールオーバー画像
36  $("img[src*='_off.']").rollOver({off:'_off.',on:'_on.'});
37
38
39  //tableのalign属性削除
40  $.fn.tableDeleteAlign();
41
42
43  // 元のページに戻るリファラーを自動でつける
44  $("a[href*=inquiryId]").each(function() {
45    var a = $(this);
46    var url = a.attr("href");
47    var locaUrl = location.pathname;
48    a.attr("href", url.replace(/(Init\.do\?inquiryId=[0-9]+)/, '$1&ref=www.xxxx.xxxx.xxxx.jp' + locaUrl) );
49  });
50
51
52  var location_href = location.href;
53  var now_site_domain;
54
55  if(location_href.indexOf('http://') != -1 || location_href.indexOf('https://') != -1){
56    var replace_site_domain = site_domain + '/';
57    var now_site_domain = replace_site_domain.replace( /http:/g , "" ).replace( /https:/g , "" );
58  }else{
59    now_site_domain = '';
60  }
61
62  //文字サイズ変更(標準 or 大きくする)HTML側は以下のように設定
63  if ($('.scsize').length) {
64    $.fn.styleCatcherUpNormal({btnCls: "scsize",cssID: "scsize",prAry: ['size_default.css', 'size_up.css', 'size_up2.css', 'size_up3.css'],cssPath: now_site_domain + 'theme/base/css/',def: 0});
65  }
66
67  //背景色変更(白、黒、青)HTML側は以下のように設定
68  if ($('.sccolor').length) {
69    $.fn.styleCatcher({btnCls: "sccolor",cssID: "sccolor", cssPath: now_site_domain + 'theme/base/css/',def: 2});
70  }
71
72  // ヘッダーナビのドロップメニュ
73  if (typeof $.fn.dropMenu != 'undefined') {
74    $("#header-nav").dropMenu();
75  }
76  if (typeof $.fn.dropMenu != 'undefined') {
77    $("#header-nav-issub").dropMenu();
78  }
79
80  // 文字サイズ変更監視
81  $.fn.fontSizeChange({func:function(){
82    //$("#header-nav .list2").eqGroupHeight(3);
83    $("#wrapper").show();
84  }});
85
86
87  //モーダル(検索)
88  $('.menu-btn-search').lightbox({
89    modalBg:$('.modal-search-bg'),
90    modal:$('.modal-search, .modal-menu-close'),
91    close:$('.modal-menu-close'),
92    scrollID:'sWrapper',
93    lightSpot:$('.menu-btn-search, .modal-menu-close')
94  });
95
96
97  //モーダル(メニュー)
98    $('.menu-btn-menu').lightbox({
99      modalBg:$('.modal-menu-bg'),
100      modal:$('.modal-menu, .modal-menu-close'),
101      close:$('.modal-menu-close'),
102      scrollID:'sWrapper',
103      lightSpot:$('.menu-btn-menu, .modal-menu-close')
104    });
105
106  $('.modal-menu .box').svAccordion({
107    classHead:'.title',
108    classBody:'.list',
109    classToggle:'on'
110  });
111
112  // アコーディオン(よくある質問用)
113  $('.faq-block').svAccordion({
114    classHead:'.title',
115    classBody:'.childs',
116    classToggle:'on'
117  });
118
119  //アコーディオン(分野別で探す)
120  $('.joho-tab #tab-6 .in2').svAccordion({
121    classHead:'.title',
122    classBody:'.links',
123    classToggle:'on'
124  });
125
126  //スマホプレビューに対応
127  $('.no-escape').each(function(){
128    $(this).html($(this).text());
129  });
130
131
132  // -----------------------------------------------------
133  // wysiwygの中にtableがあれば、wrapperクラスを付与する
134  // (100%を超えたときにwrapper内でスクロールさせるため)
135  // -----------------------------------------------------
136  if ($('.wysiwyg table').length){
137    $('.wysiwyg table').wrap('<div class="table-wrapper"></div>');
138  }
139
140  /**
141   IE8,9でXMLHttpRequestの代わりにXDomainRequestを使う
142   このセクションは消さないでください。
143   */
144  if ( window.XDomainRequest ) {
145      jQuery.ajaxTransport(function( s ) {
146          if ( s.crossDomain && s.async ) {
147              if ( s.timeout ) {
148                  s.xdrTimeout = s.timeout;
149                  delete s.timeout;
150              }
151              var xdr;
152              return {
153                  send: function( _, complete ) {
154                      function callback( status, statusText, responses, responseHeaders ) {
155                          xdr.onload = xdr.onerror = xdr.ontimeout = xdr.onprogress = jQuery.noop;
156                          xdr = undefined;
157                          complete( status, statusText, responses, responseHeaders );
158                      }
159                      xdr = new XDomainRequest();
160                      xdr.open( s.type, s.url );
161                      xdr.onload = function() {
162                          callback( 200, "OK", { text: xdr.responseText }, "Content-Type: " + xdr.contentType );
163                      };
164                      xdr.onerror = function() {
165                          callback( 404, "Not Found" );
166                      };
167                      xdr.onprogress = function() {};
168                      if ( s.xdrTimeout ) {
169                          xdr.ontimeout = function() {
170                              callback( 0, "timeout" );
171                          };
172                          xdr.timeout = s.xdrTimeout;
173                      }
174                      xdr.send( ( s.hasContent && s.data ) || null );
175                  },
176                  abort: function() {
177                      if ( xdr ) {
178                          xdr.onerror = jQuery.noop();
179                          xdr.abort();
180                      }
181                  }
182              };
183          }
184      });
185  }
186
187
188  //閲覧支援をタブキーで操作
189$('.accessibility .support a').on('click',function(e) {
190  e.preventDefault();
191  $('.accessibility').toggleClass('active-acc-box')
192  $('.header-subnav-area').toggleClass('active-acc')
193  $('.header-subnav-box').toggleClass('active-header-subnav-box')
194  $('#header-logo').toggleClass('active-header-logo')
195  $('.mv-side-bnr').toggleClass('acive-mv-side-bnr')
196  if($('.header-subnav-area').hasClass('active-acc')){
197    $('.unit .list li a').focus()
198  }
199})
200
201$('.accessibility .language a').on('focus', function(e) {
202  $('.header-subnav-area').addClass('active-acc')
203  $('.unit .list li a').focus()
204
205  if($('.header-subnav-area').hasClass('active-acc')){
206    $('.accessibility .support a').off('focus')
207  }
208})
209$('.to-container a').focus(function() {
210  $('.header-subnav-area').toggleClass('active-acc');
211});
212
213
214  // PC・スマホ切り替え(レスポンシブ)
215  if( typeof MutualSwitching !== 'undefined') {
216    MutualSwitching.config.setPathSettings({
217      "/": {
218      "pc_width": 1024,
219      "sp_width": 750,
220      "layout_type": 0
221      }
222    });
223    MutualSwitching.run.ready();
224  }
225
226});

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.