PageSourceSearch

https://www.e-gov.go.jp/styleguide/styleguide.js

js e-gov.go.jp collected 2026-09-24 07:25:13 UTC 5,413 bytes, 175 lines download raw bytes

1$(function () {
2
3  /*----------------------------------------
4   アコーディオン
5  ----------------------------------------*/
6  var target = $('.egovui-sg-mod-accordion-head');
7  var activeClass = 'egovui-sg-active';
8  target.each(function(){
9    if($(this).hasClass(activeClass)){
10    } else {
11      $(this).next().hide();
12    }
13  });
14
15  target.click(function(){
16    $(this).toggleClass(activeClass);
17    $(this).next().slideToggle('3000','swing');
18  });
19
20
21
22  /*----------------------------------------
23   パラメーター
24  ----------------------------------------*/
25  $(".egovui-sg-mod-pager-select").change(function(){
26    var selectVal = $(this).val();
27    location.search = "?page=" + selectVal;
28  });
29
30  $(document).ready(function(){
31    var str = location.search
32    var str2 = str.split('=');
33    $('.egovui-sg-mod-pager-select').find('option').eq(str2[1]-1).prop('selected', 'selected');
34    $('.egovui-sg-mod-pager-select').each(function(){
35      $(this).find('option').eq(str2[1]-1).prop('selected', 'selected');
36    });
37  });
38
39
40
41  /*----------------------------------------
42   タブ切り替え
43  ----------------------------------------*/
44  $('.egovui-sg-mod-tab-button').click(function(){
45    var text = $(this).text();
46    var target = $(this).attr('data-tab');
47    var listItem = $(this).parents('.egovui-sg-mod-tab-item').siblings();
48    var button = $(this).parents('.egovui-sg-mod-tab-item').siblings().children('.egovui-sg-mod-tab-button');
49
50    // strongタグ付け替え
51    $(this).html('<strong>'+ text + '</strong>');
52    button.not($(this)).children().contents().unwrap();
53
54    // aria-current属性付け替え
55    $(this).parents('.egovui-sg-mod-tab-item').attr('aria-current', 'page');
56    listItem.removeAttr('aria-current');
57
58    // activeクラス付与・削除
59    $(this).addClass('active');
60    listItem.children('.egovui-sg-mod-tab-button').removeClass('active');
61
62    // コンテンツの切り替え
63    $('.egovui-sg-mod-tab-toggle-item').removeClass('egovui-sg-active');
64    $('#'+target).addClass('egovui-sg-active');
65
66  });
67
68
69
70  /*----------------------------------------
71   hiraku.js
72  ----------------------------------------*/
73  $(".egovui-nav").hiraku({
74    btn:".egovui-menu",
75    direction:"left",
76    breakpoint: 599
77  });
78  $(document).on('click','.egovui-menu-close',function(event){
79    event.preventDefault;
80    $('.js-hiraku-offcanvas-close-btn').click();
81  });
82
83
84  /*----------------------------------------
85   重要なお知らせ
86  ----------------------------------------*/
87  $('.egovui-sg-mod-important-close').click(function(){
88    $('.egovui-sg-mod-important-wrap').css('display', 'none');
89  });
90
91
92  /*----------------------------------------
93   モーダル
94  ----------------------------------------*/
95  (function(){
96    var $dialogTriggers = $('.egovui-sg-mod-dialog-trigger');
97    for (i = 0; i < $dialogTriggers.length; i++) {
98      var $dialogTrigger = $($dialogTriggers[i]);
99      var $dialogContent = $($dialogTrigger.data('dialogSelector'));
100      $dialogTrigger.data('dialogContent', $dialogContent);
101      if ($dialogContent.length !== 0) {
102        $dialogContent.on('click', '.egovui-dialog-close', onClickDialogClose.bind($dialogContent));
103        $dialogTrigger.on('click', onClickDialogTrigger.bind($dialogContent));
104      }
105    }
106  })();
107
108
109  /**
110   * ダイアログクローズ時
111   */
112  function onClickDialogClose() {
113    this.dialog('close');
114  }
115
116  /**
117   * ダイアログクリック時
118   */
119  function onClickDialogTrigger() {
120    this.dialog({
121      modal: true,
122      classes: {
123        'ui-dialog': 'egovui-dialog',
124        'ui-dialog-titlebar': 'egovui-dialog-title'
125      },
126      resizable: false
127    });
128  }
129
130
131  /*----------------------------------------
132   パスワード表示
133  ----------------------------------------*/
134  var isIOS = navigator.userAgent.match(/iPhone;|iPad;/) != null;
135  var startEvent = isIOS ? 'touchstart' : 'pointerdown';
136  var endEvent = isIOS ? 'touchend' : 'pointerup';
137  var cancelEvent = isIOS ? 'touchcancel' : 'pointercancel';
138  var passwordShowButtons = document.querySelectorAll('.egovui-sg-form-password-button');
139  for (i = 0; i < passwordShowButtons.length; i++) {
140    var passwordShowButton = passwordShowButtons[i];
141      passwordShowButton.addEventListener(startEvent, onPointerDownShowPassword);
142      passwordShowButton.addEventListener(endEvent, onPointerUpCancelShowPassword);
143      passwordShowButton.addEventListener(cancelEvent, onPointerUpCancelShowPassword);
144  }
145
146  /**
147   * パスワード表示ボタンマウスダウン
148   * @param {*} event
149   */
150  function onPointerDownShowPassword(event) {
151    if (event.pointerId !== undefined) {
152      event.currentTarget.setPointerCapture(event.pointerId);
153    }
154    event.currentTarget.previousElementSibling.setAttribute('type', 'text');
155  }
156
157  /**
158   * パスワード表示ボタンマウスアップ
159   * @param {*} event
160   */
161  function onPointerUpCancelShowPassword(event) {
162    if (event.pointerId !== undefined) {
163      event.currentTarget.releasePointerCapture(event.pointerId);
164    }
165    event.currentTarget.previousElementSibling.setAttribute('type', 'password');
166  }
167
168  /**
169   * パスワード表示ボタンタッチエンド(iOS)
170   * @param {*} event
171   */
172  function onTouchEndShowPassword(event) {
173    event.currentTarget.previousElementSibling.setAttribute('type', 'password');
174  }
175});

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.