PageSourceSearch

https://www.city.tendo.yamagata.jp/tourism/scripts/textresize.js

js city.tendo.yamagata.jp collected 2026-09-24 21:41:09 UTC 4,704 bytes, 133 lines download raw bytes

1
2var docCookies = {
3  getItem: function (sKey) {
4    if (!sKey) { return null; }
5    return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null;
6  },
7  setItem: function (sKey, sValue, vEnd, sPath, sDomain, bSecure) {
8    if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) { return false; }
9    var sExpires = "";
10    if (vEnd) {
11      switch (vEnd.constructor) {
12        case Number:
13          sExpires = vEnd === Infinity ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; max-age=" + vEnd;
14          /*
15          Note: Despite officially defined in RFC 6265, the use of `max-age` is not compatible with any
16          version of Internet Explorer, Edge and some mobile browsers. Therefore passing a number to
17          the end parameter might not work as expected. A possible solution might be to convert the the
18          relative time to an absolute time. For instance, replacing the previous line with:
19          */
20          /*
21          sExpires = vEnd === Infinity ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; expires=" + (new Date(vEnd * 1e3 + Date.now())).toUTCString();
22          */
23          break;
24        case String:
25          sExpires = "; expires=" + vEnd;
26          break;
27        case Date:
28          sExpires = "; expires=" + vEnd.toUTCString();
29          break;
30      }
31    }
32    document.cookie = encodeURIComponent(sKey) + "=" + encodeURIComponent(sValue) + sExpires + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "") + (bSecure ? "; secure" : "");
33    return true;
34  },
35  removeItem: function (sKey, sPath, sDomain) {
36    if (!this.hasItem(sKey)) { return false; }
37    document.cookie = encodeURIComponent(sKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "");
38    return true;
39  },
40  hasItem: function (sKey) {
41    if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) { return false; }
42    return (new RegExp("(?:^|;\\s*)" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=")).test(document.cookie);
43  },
44  keys: function () {
45    var aKeys = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "").split(/\s*(?:\=[^;]*)?;\s*/);
46    for (var nLen = aKeys.length, nIdx = 0; nIdx < nLen; nIdx++) { aKeys[nIdx] = decodeURIComponent(aKeys[nIdx]); }
47    return aKeys;
48  }
49};
50
51//標準ボタンのHTML取得
52const BtnFsNormal = document.getElementById('js-fs-normal');
53//拡大ボタンのHTML取得
54const BtnFsLarge = document.getElementById('js-fs-large');
55// htmlタグ取得
56const RootTag = document.documentElement;
57// alert出力文
58const MaxMessage = encodeURIComponent('これ以上文字のサイズを大きくできません。');
59const ResetMessage = encodeURIComponent('標準文字サイズに戻しますか?');
60
61//拡大回数カウント用
62let fsUpCount = 0;
63
64// 標準ボタン
65BtnFsNormal.addEventListener('click', function(){
66  setFsReset();
67  return false;
68});
69// 拡大ボタン
70BtnFsLarge.addEventListener('click', function(){
71  setFsUp();
72  return false;
73});
74
75function setFsUp(){
76  if(fsUpCount === 5) {
77    alert(decodeURIComponent(MaxMessage));
78  }else if(fsUpCount === 4) {
79    RootTag.classList.add('is-fs-xxxl');
80    RootTag.classList.remove('is-fs-xxl');
81    fsUpCount = 5;
82  }else if(fsUpCount === 3) {
83    RootTag.classList.add('is-fs-xxl');
84    RootTag.classList.remove('is-fs-xl');
85    fsUpCount = 4;
86  }else if(fsUpCount === 2) {
87    RootTag.classList.add('is-fs-xl');
88    RootTag.classList.remove('is-fs-l');
89    fsUpCount = 3;
90  }else if(fsUpCount === 1) {
91    RootTag.classList.add('is-fs-l');
92    RootTag.classList.remove('is-fs-m');
93    fsUpCount = 2;
94  }else if(fsUpCount === 0) {
95    RootTag.classList.add('is-fs-m');
96    fsUpCount = 1;
97  }else if(fsUpCount === null) {
98    RootTag.classList.add('is-fs-m');
99    fsUpCount = 1;
100  }
101  BtnFsNormal.classList.remove('is-active');
102  BtnFsLarge.classList.add('is-active');
103
104  // cookieに保存
105  docCookies.setItem('fsCookies', fsUpCount, 30, '/');
106}
107
108function setFsReset(){
109  let resetModal = confirm(decodeURIComponent(ResetMessage));
110  if (resetModal) {
111    fsUpCount = 0;
112    RootTag.removeAttribute('class');
113  }
114  // cookieに保存
115  docCookies.setItem('fsCookies', fsUpCount, 30, '/');
116}
117
118function getCookie(){
119  fsUpCount = docCookies.getItem('fsCookies');
120  if(fsUpCount > 0) {
121    setFsUp();
122  }
123}
124
125window.addEventListener('load', getCookie, false);
126
127if (!window.console){
128    window.console = {
129        log : function(msg){
130            // do nothing.
131        }
132    };
133}

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.