1/********************************************************************************* 2å ¨æ¡ä»¶å ±éã§ä½¿ç¨ãã颿° 3*********************************************************************************/ 4 5// URLæååã¨ã¹ã±ã¼ãï¼escapeurl.jsï¼ 6/********************************************************************************/ 7function htmlspecialchars_URL(str) { 8 return (str + '').replace(/"/g,'%26quot;') 9 .replace(/'/g,'%26#039;') 10 .replace(/</g,'%26lt;') 11 .replace(/>/g,'%26gt;') 12 .replace(/&/g,'&'); 13} 14 15// è¦ç´ ã®åå¨å¤å® 16/********************************************************************************* 17 æ¦è¦ï¼ 18 è¦ç´ ã®åå¨å¤å® 19 使ç¨ä¾ï¼ 20 if(domExistCheck(elements)) { 21 è¦ç´ ããã¹ã¦åå¨ããã¨ãã®å¦ç 22 } 23 弿°ï¼ 24 é åãæ¸¡ãã¾ãã 25 ä¾1ï¼è¦ç´ ãä¸ã¤ã®ã¨ã 26 let element1 = document.querySelector("#main"); 27 let elements = [element1]; 28 if(domExistCheck(elements)){ 29 // element1ãåå¨ããæ 30 } 31 ã¾ã㯠32 if(domExistCheck([element1])){ 33 element1ãããã¨ã 34 } 35 ä¾2ï¼è¦ç´ ãè¤æ°ã®ã¨ã 36 let spMenuElement = document.querySelector('#spm_menu'); 37 let targetElement = document.querySelector('#container'); 38 let existChk = [spMenuElement, targetElement]; 39 if(domExistCheck(elements)){ 40 // #spm_menuã¨#containerã両æ¹ã¨ãåå¨ããæ 41 } 42 è¿ãå¤ï¼ 43 ãã¹ã¦ã®è¦ç´ ãåå¨ããã° true,è¦ç´ ãä¸ã¤ã§ãåå¨ããªããã° falseãè¿ãã¾ãã 44*********************************************************************************/ 45function domExistCheck(elements) { 46 return elements.every(element => element); 47} 48 49// ã»ãã·ã§ã³ã¹ãã¬ã¼ã¸å¯å¦å¤å® 50/********************************************************************************* 51 æ¦è¦ï¼ 52 ã»ãã·ã§ã³ã¹ãã¬ã¼ã¸ä½¿ç¨å¯ä¸å¯ã®å¤å® 53 使ç¨ä¾ï¼ 54 isSessionStorageAvailable(); 55 弿° 56 ç¡ã 57 è¿ãå¤ï¼ 58 true ã¾ã㯠falase 59 è©³ç´°ï¼ 60 ã»ãã·ã§ã³ã¹ãã¬ã¼ã¸ã使ç¨ã§ããç°å¢ãã©ããã®å¤å®ã 61 使ç¨ã§ããç°å¢ã§ããã°true,使ç¨ã§ããªããã°falseãè¿ãã¾ãã 62*********************************************************************************/ 63function isSessionStorageAvailable() { 64 try { 65 const test = '__sessionStorage__'; 66 sessionStorage.setItem(test, test); 67 sessionStorage.removeItem(test); 68 return true; 69 } catch (e) { 70 return false; 71 } 72} 73 74// éå¸¸ã®æåãµã¤ãºã§å°å· 75/********************************************************************************* 76 æ¦è¦ï¼ 77 å°å·ç¨ãã¼ã¸è¡¨ç¤º 78 使ç¨ä¾ï¼ 79 print_normal(); 80 <a id="print_mode_link" href="javascript:print_normal();">å°å·ãã¼ã¸è¡¨ç¤º</a> 81 弿° 82 ç¡ã 83 è©³ç´°ï¼ 84 - bodyããã³#print_mode_linkã«ã¯ã©ã¹view_print_modeã追å ããã 85 ãã®éãããã¹ãã®å 容ãé常ãã¼ã¸ã¸ã®æ¡å ããã¹ãã«æ¸ãæããã 86 - /ssi/css/print-preview.css ãheadã«èªã¿è¾¼ã¿/åé¤ 87*********************************************************************************/ 88function print_normal() { 89 const bodyElement = document.body; 90 const headElement = document.head; 91 const printLinkElement = document.querySelector('#print_mode_link'); 92 93 if (!printLinkElement) { 94 return; 95 } 96 97 const isPrintMode = printLinkElement.classList.contains('view_print_mode'); 98 const printCssElement = document.querySelector('link[href*="print-preview.css"]'); 99 100 const printLinkText = isPrintMode ? 'å°å·ãã¼ã¸è¡¨ç¤º' : 'é常ãã¼ã¸ã¸æ»ã'; 101 printLinkElement.textContent = printLinkText; 102 103 if (isPrintMode) { 104 // é常ãã¼ã¸ã¸æ»ãå¦ç 105 initColorMode(); 106 printCssElement?.remove(); 107 bodyElement.classList.remove('view_print_mode'); 108 printLinkElement.classList.remove('view_print_mode'); 109 } else { 110 // å°å·ãã¼ã¸ã¸é²ãå¦ç 111 initColorMode(true); 112 const link = document.createElement('link'); 113 link.rel = 'stylesheet'; 114 link.href = '/ssi/css/print-preview.css'; 115 headElement.append(link); 116 bodyElement.classList.add('view_print_mode'); 117 printLinkElement.classList.add('view_print_mode'); 118 } 119 window.scroll({ top: 0 }); 120} 121 122// è²å¤æ´ 123/********************************************************************************* 124 æ¦è¦ï¼ 125 èæ¯è²å¤æ´ 126 使ç¨ä¾ã»è©³ç´°ï¼ 127 colorChange('blue'); 128 - éï¼bodyã«ã¯ã©ã¹ color_change,color_blue ã追å ãããï¼ 129 colorChange('black'); 130 - é»ï¼bodyã«ã¯ã©ã¹ color_change,color_black ã追å ãããï¼ 131 132 colorChange(); 133 colorChange('init'); 134 colorChange('white'); 135 - ä¸è¨ã¯3ã¤ã¨ããé常ã®ãã¼ã¸ã«åæåã 136*********************************************************************************/ 137function colorChange(strColorMode = 'init') { 138 const bodyElement = document.querySelector('body'); 139 const headElement = document.querySelector('head'); 140 const colorCssElement = document.querySelector('link[href*="/ssi/css/color-"]'); 141 colorCssElement?.remove(); // åå¨ããã°åé¤ 142 143 bodyElement.classList.remove('color_change','color_blue','color_black'); 144 switch (strColorMode) { 145 case 'blue': 146 bodyElement.classList.add('color_change','color_blue'); 147 headElement.insertAdjacentHTML('beforeend', '<link rel="stylesheet" href="/ssi/css/color-common.css" media="screen">'); 148 if (isSessionStorageAvailable()) { 149 sessionStorage.setItem('colorMode', 'blue'); 150 } 151 break; 152 case 'black': 153 bodyElement.classList.add('color_change','color_black'); 154 headElement.insertAdjacentHTML('beforeend', '<link rel="stylesheet" href="/ssi/css/color-common.css" media="screen">'); 155 if (isSessionStorageAvailable()) { 156 sessionStorage.setItem('colorMode', 'black'); 157 } 158 break; 159 case 'white': 160 case 'init': 161 default: 162 if (isSessionStorageAvailable()) {
163 sessionStorage.removeItem('colorMode'); 164 } 165 break; 166 } 167} 168 169// è²å¤æ´ããã¦ããã°ããã¼ã¸èªã¿è¾¼ã¿æã«ãããåæ 170/********************************************************************************* 171 æ¦è¦ï¼ 172 èæ¯è²å¤æ´ã®èªã¿è¾¼ã¿ 173 使ç¨ä¾ã»è©³ç´°ï¼ 174 initColorMode(); 175 - ãã¼ã¸èªã¿è¾¼ã¿æã«ãè¨å®ããã¦ããèæ¯è²å¤æ´ãé©ç¨ 176 initColorMode(0); 177 - èæ¯è²å¤æ´ãåæåï¼ä¿åã¯ãããããã¼ã¸é·ç§»ã»åèªã¿è¾¼ã¿çã§åã³èæ¯è²ãé©ç¨ãããã 178 å°å·ãã¼ã¸è¡¨ç¤ºãªã©ã䏿çã«èæ¯è²ãåæåãããã¨ãã«ä½¿ç¨ã 179*********************************************************************************/ 180function initColorMode(arg) { 181 if (arg == 0) { 182 // èæ¯è²ã®ä¸æçãªåæå 183 const colorCssElement = document.querySelector('link[href*="/ssi/css/color-"]'); 184 colorCssElement?.remove(); // åå¨ããã°åé¤ 185 } else { 186 // è¨å®ããã¦ããèæ¯è²ãèªã¿è¾¼ã¿ 187 if( isSessionStorageAvailable()) { 188 if(sessionStorage.getItem('colorMode')){ 189 colorChange(sessionStorage.getItem('colorMode')); 190 } 191 } 192 } 193} 194 195// è²å¤æ´ï¼åã¹ã¯ãªããã¨ã®äºææ§ä¿æï¼ 196/********************************************************************************* 197 æ¦è¦ï¼ 198 èæ¯è²å¤æ´ 199 â»å¤ããã¼ã¸ã§ã³ã®CMSã¨äºææ§ãä¿ã¤ããã«é¢æ°åãåãã«ãã¦ããã 200 使ç¨ä¾ã»è©³ç´°ï¼ 201 <a id="haikei_white" href="javascript:SetCss(1);" title="èæ¯è²ãç½è²ã«å¤æ´ãã">ç½</a> 202 <a id="haikei_black" href="javascript:SetCss(2);" title="èæ¯è²ãé»è²ã«å¤æ´ãã">é»</a> 203 <a id="haikei_blue" href="javascript:SetCss(3);" title="èæ¯è²ãéè²ã«å¤æ´ãã">é</a> 204 SetCss(1); â èæ¯è²ãç½è²ã«ãããï¼æ¨æºï¼ 205 SetCss(2); â èæ¯è²ãé»è²ã«ãããï¼æ¨æºï¼ 206 SetCss(3); â èæ¯è²ãéè²ã«ãããï¼æ¨æºï¼ 207 SetCss(); â èæ¯è²ãç½è²ã«ãããï¼å¼æ°ãçç¥ããã¨ãã¯1ãä»£å ¥ï¼ 208 弿°ï¼ 209 åè§æ°å¤ï¼1ï½3ï¼ 210 ããã©ã«ãã¯1ã 211 è¿ãå¤ï¼ 212 ç¡ã 213*********************************************************************************/ 214function SetCss(cssNumber = 1) { 215 switch (cssNumber) { 216 case 1: colorChange('white');break; 217 case 2: colorChange('black');break; 218 case 3: colorChange('blue');break; 219 default: break; 220 } 221} 222 223// æåãµã¤ãºå¤æ´ 224/********************************************************************************* 225 æ¦è¦ï¼ 226 æåãµã¤ãºã夿´ããã 227 æ¡å¤§ã¯3åã¾ã§ãï¼å¤æ´ããå ´åã¯maxFontSizeStepã®å¤ãå¤ãã¦ãã ããï¼ 228 使ç¨ä¾ï¼ 229 fontSizeChange('large'); â - æåã大ããããã 230 fontSizeChange('small'); â - æåãå°ããããã 231 fontSizeChange(); â - æåãµã¤ãºãåæåï¼å¼æ°ããªãå ´åã¯ãdefault ãé©ç¨ããããï¼ 232 fontSizeChange('default'); â - æåãµã¤ãºå¤æ´ãåæå 233 弿°ï¼ 234 'large' , 'small' , 'default' 235 è¿ãå¤ï¼ 236 ç¡ã 237*********************************************************************************/ 238function fontSizeChange(changeType = 'default') { 239 const stepNum = 1.25; // æ¡å¤§ç 240 const maxFontSizeStep = 3; // æ¡å¤§ãæ¼ããæå¤§åæ° 241 const bodyElement = document.querySelector('body'); 242 let classChk = bodyElement.classList.contains('font_size_changed'); // åå¨ããã°true,åå¨ããªããã°falseãè¿ã£ã¦ãã 243 let htmlElement = document.querySelector('html'); 244 let htmlSTyle = window.getComputedStyle(htmlElement); 245 let currentFontSize = 10; 246 // const maxFontSize = 20; 247 // const minFontSize = 10; 248 let fontSizeStep = 0; 249 const fontSizeLargeButton = document.querySelector('#moji_large'); 250 const fontSizeSmallButton = document.querySelector('#moji_small'); 251 252 if (fontSizeLargeButton !== null) { 253 // ãã©ã³ãæ¡å¤§åæ°ã®èªã¿è¾¼ã¿ 254 if (isSessionStorageAvailable() && sessionStorage.getItem('fontSizeStep')) { 255 fontSizeStep = parseInt(sessionStorage.getItem('fontSizeStep')); 256 } 257 258 switch(changeType) { 259 case 'large': 260 currentFontSize = parseInt(htmlSTyle.getPropertyValue('font-size'));
261 currentFontSize = currentFontSize * stepNum; 262 fontSizeStep = fontSizeStep + 1; 263 if (fontSizeStep <= maxFontSizeStep) { 264 htmlElement.style.fontSize = currentFontSize + 'px'; 265 if (isSessionStorageAvailable()) { 266 sessionStorage.setItem('fontSize', currentFontSize); 267 sessionStorage.setItem('fontSizeStep', fontSizeStep); 268 } 269 } else { 270 break; 271 } 272 if (!classChk) { 273 bodyElement.classList.add('font_size_changed'); 274 } 275 break; 276 case 'small': 277 currentFontSize = parseInt(htmlSTyle.getPropertyValue('font-size')); 278 currentFontSize = currentFontSize / stepNum; 279 fontSizeStep = fontSizeStep - 1; 280 if (fontSizeStep > 0) { 281 htmlElement.style.fontSize = currentFontSize + 'px'; 282 if (isSessionStorageAvailable()) { 283 sessionStorage.setItem('fontSize', currentFontSize); 284 sessionStorage.setItem('fontSizeStep', fontSizeStep); 285 } 286 } else if (fontSizeStep == 0) { 287 htmlElement.style.fontSize = ''; 288 if (isSessionStorageAvailable()) { 289 sessionStorage.removeItem('fontSize'); 290 sessionStorage.removeItem('fontSizeStep'); 291 } 292 if (fontSizeSmallButton !== null) { 293 fontSizeSmallButton.inert = true; 294 fontSizeSmallButton.setAttribute('aria-disabled', 'true'); 295 } 296 } else { 297 break; 298 } 299 if (typeof classChk !== 'undefined') { 300 bodyElement.classList.add('font_size_changed'); 301 } 302 break; 303 case 'default': 304 default: 305 htmlElement.style.fontSize = ''; 306 if (isSessionStorageAvailable()) { 307 sessionStorage.removeItem('fontSize'); 308 sessionStorage.removeItem('fontSizeStep'); 309 } 310 if (fontSizeSmallButton !== null) { 311 fontSizeSmallButton.inert = true; 312 fontSizeSmallButton.setAttribute('aria-disabled', 'true'); 313 314 } 315 fontSizeLargeButton.inert = false; 316 fontSizeLargeButton.removeAttribute('aria-disabled'); 317 fontSizeStep = 0; 318 if (typeof classChk !== 'undefined') { 319 bodyElement.classList.remove('font_size_changed','font_size_limit_max'); 320 } 321 break; 322 } 323 // æ¡å¤§ãæå¤§åæ°ã®æã«inert屿§ã¨ã¯ã©ã¹ã追å 324 if (fontSizeStep >= maxFontSizeStep) { 325 fontSizeLargeButton.inert = true; 326 fontSizeLargeButton.setAttribute('aria-disabled', 'true'); 327 bodyElement.classList.add('font_size_limit_max'); 328 } else { 329 fontSizeLargeButton.inert = false; 330 fontSizeLargeButton.removeAttribute('aria-disabled'); 331 332 } 333 // 縮å°ãã¿ã³ 334 if (fontSizeStep <= 0) { 335 if (fontSizeSmallButton !== null) { 336 fontSizeSmallButton.inert = true; 337 fontSizeSmallButton.setAttribute('aria-disabled', 'true'); 338 } 339 } else { 340 if (fontSizeSmallButton !== null) { 341 fontSizeSmallButton.inert = false; 342 fontSizeSmallButton.removeAttribute('aria-disabled'); 343 } 344 } 345 } 346} 347 348// æåãµã¤ãºå¤æ´ã®èªã¿è¾¼ã¿ 349/********************************************************************************* 350 æ¦è¦ï¼ 351 æåãµã¤ãºã®å¤æ´ãèªã¿è¾¼ã¿ 352 使ç¨ä¾ï¼ 353 initFontSize(); 354 弿°ï¼ 355 ç¡ã 356 è¿ãå¤ï¼ 357 ç¡ã 358 è©³ç´°ï¼ 359 - ãã¼ã¸è¡¨ç¤ºæã«å®è¡ãããï¼DomContentLoadedã§å®è¡ãããã¨ãï¼ 360*********************************************************************************/ 361function initFontSize() { 362 if( isSessionStorageAvailable()) { 363 if (sessionStorage.getItem('fontSize')) { 364 let bodyElement = document.querySelector('body'); 365 let currentFontSize = sessionStorage.getItem('fontSize'); 366 let fontSizeLargeButton = document.querySelector('#moji_large'); 367 let currentFontSizeStep = parseInt(sessionStorage.getItem('fontSizeStep')); 368 // æ¡å¤§åæ°ãæå¤§ã®ã¨ãã¯æ¡å¤§ãã¿ã³ãæ¼ããªãããã«ããã 369 if (currentFontSizeStep === 3) { 370 if (fontSizeLargeButton != null) { 371 fontSizeLargeButton.inert = true; 372 bodyElement.classList.add('font_size_limit_max'); 373 } 374 } 375 bodyElement.classList.add('font_size_changed'); 376 document.querySelector('html').style.fontSize = currentFontSize + 'px'; 377 } else { 378 // ãã©ã³ããµã¤ãºã®è¨å®ããªãå ´åã¯ç¸®å°ãã¿ã³ãéæ´»æ§ã«ã
379 let fontSizeSmallButton = document.querySelector('#moji_small'); 380 if (fontSizeSmallButton !== null) { 381 fontSizeSmallButton.inert = true; 382 } 383 } 384 } 385} 386// æåãµã¤ãºå¤æ´ï¼åã¹ã¯ãªããã¨ã®äºææ§ä¿æï¼ 387function fsc(str = 'default') { 388 switch(str) { 389 case 'larger' : fontSizeChange('large'); break; 390 case 'small' : fontSizeChange('small'); break; 391 case 'default' : 392 default: fontSizeChange('default'); break; 393 } 394} 395 396// ã¢ã¯ã»ã·ããªãã£ãã§ãã¯ç»é¢ã®å¤å® 397/********************************************************************************* 398 æ¦è¦ï¼ 399 ã¢ã¯ã»ã·ããªãã£ãã§ãã¯ç»é¢ãã©ããã®å¤å® 400 使ç¨ä¾ï¼ 401 if(accCheckerChk()){ 402 // ã¢ã¯ã»ã·ããªãã£ãã§ãã¯ç»é¢ã®ã¨ãã®å¦ç 403 } 404 弿°ï¼ 405 ç¡ã 406 è¿ãå¤ï¼ 407 true , false 408 è©³ç´°ï¼ 409 ã¢ã¯ã»ã·ããªãã£ãã§ãã¯ç»é¢ãã©ããã®å¤å® 410 ã¯ã©ã¹errrangeãå¤å®ããåå¨ããã°ï¼ï¼ã¢ã¯ã»ã·ããªãã£ãã§ãã¯ç»é¢ã§ããï¼true, 411 åå¨ããªããã°ï¼ï¼ã¢ã¯ã»ã·ããªãã£ãã§ãã¯ç»é¢ã§ã¯ãªãfalseãè¿ãã 412*********************************************************************************/ 413function accElementChk() { 414 const accElement = document.getElementsByClassName('errrange'); 415 return accElement.length > 0 ? true : false; 416} 417 418// ã¢ã¯ã»ã·ããªãã£ãã§ãã¯ç»é¢ã®ã¨ãã«ãbodyã¿ã°ã«ã¯ã©ã¹'acc_check_view'ã追å ããã 419/********************************************************************************* 420 æ¦è¦ï¼ 421 ã¢ã¯ã»ã·ããªãã£ãã§ãã¯ç»é¢ã®ã¨ãã«bodyã«ã¯ã©ã¹'acc_check_view'ã追å ããã 422 使ç¨ä¾ï¼ 423 accCheckerChk(); 424 弿°ï¼ 425 ç¡ã 426 è¿ãå¤ï¼ 427 ç¡ã 428 è©³ç´°ï¼ 429 å®è¡ããã¨ãbodyã¿ã°ã«ã¯ã©ã¹'acc_check_view'ã追å ããã 430*********************************************************************************/ 431function accCheckerChk() { 432 const bodyElement = document.querySelector('body'); 433 if (accElementChk()) { 434 bodyElement.classList.add('acc_check_view'); 435 } 436} 437 438// è²ç¡ãã§ç¢ºèªç»é¢ã®å¤å® 439/********************************************************************************* 440 æ¦è¦ï¼ 441 è²ç¡ãã§ç¢ºèªç»é¢ãã©ããã®å¤å® 442 使ç¨ä¾ï¼ 443 accGrayCheck(); 444 弿°ï¼ 445 ç¡ã 446 è¿ãå¤ï¼ 447 ç¡ã 448 è©³ç´°ï¼ 449 URLã«ç¹å®ã®æååãå«ã¾ããã°å°ç¨ã®CSSãèªã¿è¾¼ãã 450 â»filterã¿ã°ãé©ç¨ãããã¨position:fixed;ãæ¨æºç¶æ ã¨ç°ãªãå使³å®å¤ã«ãªãããã®å¯¾å¿ã 451 â»ä¸»ã«é表示ã«ããã 452*********************************************************************************/ 453function accGrayCheck() { 454 const bodyTag = document.querySelector('body'); 455 const headTag = document.querySelector('head'); 456 const chkUrl = location.pathname; 457 const compareStr = '/checker/GraceViewer'; 458 const grayCSSTag = '<link rel="stylesheet" href="/ssi/css/acc-grayscale.css">'; 459 460 // è²ç¡ãã§ç¢ºèªç»é¢ã®ã¨ãã«ãbodyã¿ã°ã«ã¯ã©ã¹'accGrayscale'ã追å ããã 461 if (chkUrl.indexOf(compareStr) != -1) { 462 bodyTag.classList.add('accGrayscale'); 463 headTag.insertAdjacentHTML('beforeend', grayCSSTag); 464 } 465} 466 467// æ°çæ å ±ä¸è¦§ã®å¤å® 468/********************************************************************************* 469 æ¦è¦ï¼ 470 URLãæ°çä¸è¦§ãã¼ã¸(index-2.html)ã§ããã°ã¯ã©ã¹ã追å ã 471 使ç¨ä¾ï¼ 472 chkIndexListAll(); 473 弿°ï¼ 474 ç¡ã 475 è¿ãå¤ï¼ 476 ç¡ã 477 è©³ç´°ï¼ 478 URLä¸ã«'/index-2.html'ãå«ã¾ãã¦ããã°ããã¼ã¸å ã®æåã®div.tpl_ããã«ã¯ã©ã¹index-2ã追å 479*********************************************************************************/ 480function chkIndexListAll() { 481 const tplElm = document.querySelector('div[class*="tpl_"]'); 482 if(tplElm !== null && location.pathname.includes('/index-2.html') === true){ // URLãä¸è¦§ãã¼ã¸ãã©ãã 483 tplElm.classList.add('index-2'); 484 } 485} 486 487// ãã¼ã¸å è¦åºã 488/********************************************************************************* 489 æ¦è¦ï¼ 490 ãã¼ã¸å è¦åºã使 491 使ç¨ä¾ï¼ 492 addTocToDetail('#main_body'); 493 addTocToDetail('#main_body , #sidebar2'); 494 495 è¨äºãã¼ã¸,ãµããµã¤ãããããã¼ã¸,ãµããµã¤ãè¨äºãã¼ã¸,æå±ããããã¼ã¸ã®#main_bodyã¨#sidebar2ããããã«ç®æ¬¡ï¼Table of contentsï¼ã使ï¼ç¡ãå ´åã¯ä½æãããªãï¼ 496 if (document.querySelectorAll('.tpl_detail,.tpl_site_index,.tpl_site_detail,.tpl_soshiki_kakuka') > 0) { 497 addTocToDetail('#main_body,#sidebar2'); 498 } 499 弿°ï¼ 500 ãã¼ã¸å ç®æ¬¡ãæ¿å ¥ãããè¦ç´ ï¼è¤æ°å¯ï¼ 501 è¿ãå¤ï¼ 502 ç¡ã 503*********************************************************************************/ 504function addTocToDetail(targetArg) { 505 if (typeof targetArg === 'undefined') { 506 // 弿°ãç¡ãã£ããæ»ãã 507 return; 508 } else { 509 const targetElement = Array.from(document.querySelectorAll(targetArg)); // targetArg æå®ã«ãããããè¦ç´ ã®ã¿ãåå¾ããããåå¨ããªãè¦ç´ ã¯åå¾ããã
509ªãã 510 const mainBodyH2Element = document.querySelectorAll('#main_body h2'); 511 512 if (mainBodyH2Element.length > 0) { 513 // #main_bodyå ã®h2ããh6ã¾ã§ã®ã¿ã°ããã¹ã¦åå¾ã 514 const htagAll = Array.from(document.querySelectorAll('#main_body h2,#main_body h3,#main_body h4,#main_body h5,#main_body h6')); 515 let htag = ''; 516 let linkElement = ''; 517 518 htagAll.forEach((element, index) => { 519 index += 1; // èªç¶æ°ã«ããããã«+1 520 htag = element.tagName.toLowerCase(); // è¦åºãã¿ã°ã®ã¿ã°åï¼h2,h3ãªã©ï¼ã®æååãå°æåã«ã 521 element.insertAdjacentHTML('beforebegin', '<span id="toc' + index + '"></span>'); // ã¢ã³ã«ã¼ãªã³ã¯å ã®è¨ç½® 522 linkElement = linkElement + '<li class="toc_type_'+ htag + '"><a href="#toc' + index + '">' + element.textContent + '</a></li>'; // ãªã¹ãï¼ã¢ã³ã«ã¼ãªã³ã¯ãªã³ã¯ã¿ã°ã®ä½æ 523 }); 524 /* 525 ç®æ¬¡ã®HTMLã使ãï¼ãã³ãã¬ã¼ããªãã©ã«ï¼ 526 å²ã¿ãããã¯ã¯ã©ã¼ãã¼ã·ã§ã³ã§ããç¹ã«æ³¨æãï¼shift + @ ã§å ¥åããï¼ 527 ${linkElement} ã«ãä¸ã§å¦çããlinkElementå ã®ã¿ã°ãåºåãããã 528 */ 529 let templateToc = ` 530 <details class="toc_link_wrap"> 531 <summary class="toc_link_toggle">ãã¼ã¸å ç®æ¬¡</summary> 532 <ul class="toc_link">${linkElement}</ul> 533 </details>`; 534 535 // ä¸ã®ãã³ãã¬ã¼ããªãã©ã«ã§ä½æããç®æ¬¡ã#main_bodyã®éå§ã¿ã°ç´å¾ã«è¨ç½®ã 536 for (let index = 0; index < targetElement.length; index++) { 537 targetElement[index].insertAdjacentHTML('afterbegin', templateToc); 538 } 539 } 540 } 541} 542 543// ãã¼ã¸å è¦åºãã¸ã®ã¢ã³ã«ã¼ãªã³ã¯ 544/********************************************************************************* 545 æ¦è¦ï¼ 546 å¥ãã¼ã¸ããã®ãªã³ã¯ã«ãã¼ã¸å ç®æ¬¡ã®ã¢ã³ã«ã¼ãªã³ã¯ããã£ãã¨ãã«ãè¦åºãã¾ã§ç§»åããã 547 使ç¨ä¾ï¼ 548 tocAnchor(); 549 弿°ï¼ 550 ç¡ã 551 è¿ãå¤ï¼ 552 ç¡ã 553 è©³ç´°ï¼ 554 loadæã«çºç«ãããã㨠555*********************************************************************************/ 556function tocAnchor() { 557 let hashStr = location.hash; 558 if (hashStr.includes('#toc')) { 559 let targetElement = document.querySelector(hashStr); 560 if (targetElement !== null) { 561 window.scrollTo({ top: targetElement.offsetTop, behavior: 'smooth' }); 562 } 563 } 564} 565 566// iframeã¿ã°ã¹ãã¼ããã©ã³å¯¾å¿ 567/********************************************************************************* 568 æ¦è¦ï¼ 569 Youtube,Googlemapã®iframeã¿ã°ã¹ãã¼ããã©ã³å¯¾å¿ 570 使ç¨ä¾ï¼ 571 ytIrameResponsive(); 572 弿°ï¼ 573 ç¡ã 574 è¿ãå¤ï¼ 575 ç¡ã 576*********************************************************************************/ 577function ytIrameResponsive() { 578 // iframeã¿ã°ãåå¾ã 579 let ytIframesArr = Array.from(document.querySelectorAll('iframe[src^="https://www.youtube"]')); 580 let gmIframeArr = Array.from(document.querySelectorAll('iframe[src^="https://www.google"]')); 581 582 // åå¾ããiframeã¿ã°ã«å¯¾ããaspect-ratioãiframeã¿ã°ã®width屿§ã¨height屿§ã®å¤ã§è¨å®ã 583 ytIframesArr.forEach(element => { 584 if (element.hasAttribute('width') && element.hasAttribute('height')) { 585 element.style.aspectRatio = element.getAttribute('width') + '/' + element.getAttribute('height'); 586 } 587 }); 588 gmIframeArr.forEach(element => { 589 if (element.hasAttribute('width') && element.hasAttribute('height')) { 590 element.style.aspectRatio = element.getAttribute('width') + '/' + element.getAttribute('height'); 591 } 592 }); 593} 594 595// setTitletoGMIframe颿° 596/********************************************************************************* 597 æ¦è¦ï¼ 598 title屿§ãæããªãGoogle mapã®iframeåãè¾¼ã¿ã¿ã°ã«title屿§ã追å ããã 599 has()ã®ãã©ã¦ã¶å¯¾å¿åº¦åãã«ãã£ã¦ã¯ãåå¾ããè¦ç´ ã 600 iframe[src^="https://www.google.com/maps/embed"]:not(:has([title])) 601 ã§çµãè¾¼ãã§ãå¯ã 602 åå¾ããGooglemapã®ã»ã¬ã¯ã¿ãytIrameResponsive()ã¨åããã¦ããã 603 弿°ï¼ 604 ç¡ã 605 è¿ãå¤ï¼ 606 ç¡ã 607 使ç¨ä¾ï¼ 608 setTitletoGMIframe(); 609*********************************************************************************/ 610function setTitletoGMIframe() { 611 const iframes = document.querySelectorAll('iframe[src^="https://www.google.com/maps/embed"]');
612 iframes.forEach((elm)=>{ 613 // title屿§ãç¡ããã°title屿§ã追å 614 if(!elm.hasAttribute('title')){ 615 elm.setAttribute('title','Google map'); 616 } 617 }); 618} 619function setTitletoGMIframebyAPI() { 620 const mapCanvasIframe = document.querySelector('.gm-style iframe:not([title])'); 621 if (mapCanvasIframe !== null) { 622 mapCanvasIframe.setAttribute('title', 'Google map'); 623 } 624} 625 626// tableã¿ã°ã«ã¹ã¯ãã¼ã«ãã¼ã追å 627/********************************************************************************* 628 æ¦è¦ï¼ 629 ã³ã³ãã³ãã¨ãªã¢ä»¥ä¸ã®å¹ ããã¤tableã¿ã°ã«ã¹ã¯ãã¼ã«ãã¼ã追å ããã 630 使ç¨ä¾ï¼ 631 detailFreeTable(); 632 弿°ï¼ 633 ç¡ã 634 è¿ãå¤ï¼ç¡ã 635*********************************************************************************/ 636function detailFreeTable() { 637 let tableElement = document.querySelectorAll('#main_body div[class*="detail_"] > table'); 638 const btnElement = '<button type="button" class="sw_large_table sp_button">表ã®ãµã¤ãºãåãæ¿ãã</button>'; 639 if (tableElement) { 640 tableElement.forEach((element) => { 641 element.outerHTML = `<div class="sp_table_wrap2">${btnElement}<div class="sp_table_wrap">${element.outerHTML}</div></div>` 642 }); 643 let buttons = document.querySelectorAll('#main_body div[class*="detail_"] .sw_large_table'); 644 buttons.forEach((btnElm) => { 645 btnElm.addEventListener('click', () => { 646 btnElm.parentElement.classList.toggle('sp_large_table'); 647 }); 648 }); 649 } 650} 651 652// tableã¿ã°ã®å¹ ã®æ¸ãæã 653/********************************************************************************* 654 æ¦è¦ï¼ 655 ã¯ã¼ããã©ã¤ã¯ä¸ã®tabelã¿ã°ãã³ã³ãã³ãå¹ ããã大ããå¹ ãã¤ã³ã©ã¤ã³ã¹ã¿ã¤ã«ã§æå®ããã¦ããæã 656 ã¤ã³ã©ã¤ã³ã¹ã¿ã¤ã«ã®å¹ ã100%ã«æ¸ãæãã 657 弿°ï¼ 658 ç¡ã 659 è¿ãå¤ï¼ 660 ç¡ã 661 è©³ç´°ï¼ 662 safariå¯¾å¿ 663*********************************************************************************/ 664function rewriteTableWidth() { 665 const mainBody = document.querySelector('#main_body'); 666 if (!mainBody) { // #main_bodyãåå¨ããªãå ´åã¯æ»ãã 667 return; 668 } 669 670 const contentW = parseInt(mainBody.clientWidth); 671 const tables = document.querySelectorAll('#main_body .detail_free table'); 672 673 tables.forEach((elm) => { 674 const elmW = parseInt(elm.style.width); 675 if (elmW > contentW) { 676 elm.style.width = '100%'; 677 } 678 }); 679} 680 681 682/* ================================================== 683htmlèªã¿è¾¼ã¿å¾ã«å®è¡ãããå¦ç 684================================================== */ 685document.addEventListener('DOMContentLoaded', function () { 686 // ãã§ãã¯é¢ä¿ 687 accCheckerChk(); 688 accGrayCheck(); 689 chkIndexListAll(); 690 // ç»é¢åæåé¢ä¿ 691 initColorMode(); 692 initFontSize(); 693 694 detailFreeTable(); 695 ytIrameResponsive(); 696 setTitletoGMIframe(); 697 tocAnchor(); 698 699 // ã¯ã¼ããã©ã¤ã¯ãåå¨ãããã¼ã¸ã§å®è¡ 700 if (document.querySelector('#main_body div[class*="detail_"]') != null) { 701 rewriteTableWidth(); 702 } 703}); 704/* ================================================== 705htmlèªã¿è¾¼ã¿å¾ã«å®è¡ãããå¦ç ããã¾ã§ 706================================================== */ 707 708 709/* ================================================== 710ãã¼ã¸èªã¿è¾¼ã¿å®äºæã«å®è¡ãããå¦ç 711================================================== */ 712window.addEventListener('load', (event) => { 713 setTimeout(setTitletoGMIframebyAPI, 1000); 714}); 715 716 717try{ 718 window.ChatConfig = { 719 baseURL: "https://api.izanai.ai", 720 wwwBaseURL: "https://chat.izanai.ai", 721 key: "373696d78f929cf5", 722 id: "1oe0wvtpyc4k", 723 } 724 var st = document.createElement("script"); 725 st.type = "text/javascript"; 726 st.async = true; 727 st.src = "https://chat.izanai.ai/static/public/chatcata_widget.js"; 728 var header = document.getElementsByTagName("head")[0]; 729 header.appendChild(st); 730 }catch (e){ 731} 732 733/* ================================================== 734ãã¼ã¸èªã¿è¾¼ã¿å®äºæã«å®è¡ãããå¦ç ããã¾ã§ 735================================================== */
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.