1/** 2 * Cocoon WordPress Theme 3 * @author: yhira 4 * @link: https://wp-cocoon.com/ 5 * @license: http://www.gnu.org/licenses/gpl-2.0.html GPL v2 or later 6 */ 7///////////////////////////////// 8// JavaScriptã³ã¼ã 9///////////////////////////////// 10 11( function ( $ ) { 12 ///////////////////////////////// 13 //TOPã¸æ»ããã¿ã³ 14 ///////////////////////////////// 15 var prevScrollTop = -1; 16 var $window = $( window ); 17 $window.scroll( function () { 18 //æä¸é¨ããç¾å¨ä½ç½®ã¾ã§ã®è·é¢ãåå¾ãã¦ã夿°[scrollTop]ã«æ ¼ç´ 19 var scrollTop = $window.scrollTop(); 20 var threashold = 600; 21 var s1 = prevScrollTop > threashold; 22 var s2 = scrollTop > threashold; 23 24 // ã¹ã¬ãã·ã§ã«ããè·¨ãã æã®ã¿å¦çããã 25 if ( s1 ^ s2 ) { 26 if ( s2 ) { 27 // ãããã¸æ»ããã¿ã³ãè¦ãã¦ããæ 28 $( '.body' ).addClass( 'go-to-top-visible' ); 29 30 // //[.go-to-to]ããã£ãããã§ã¼ãã¤ã³ãã 31 // $('.go-to-top').fadeIn('slow'); 32 } else { 33 //ãããã¸æ»ãéã ã追å ããã¯ã©ã¹ãé¤å» 34 $( '.go-to-top-common' ).removeClass( 'go-to-top-up' ); 35 // ãããã¸æ»ããã¿ã³ãè¦ãã¦ããªãæ 36 $( '.body' ).removeClass( 'go-to-top-visible' ); 37 38 // //ãã以å¤ã ã£ãããã§ã¼ãã¢ã¦ããã 39 // $('.go-to-top').fadeOut('slow'); 40 } 41 } 42 43 prevScrollTop = scrollTop; 44 } ); 45 46 //ãã¿ã³(.go-to-top-common)ã®ã¯ãªãã¯ã¤ãã³ã 47 $( '.go-to-top-common' ).click( function () { 48 //ãããã¸æ»ãéã ãã¯ã©ã¹ã追å 49 $( this ).addClass( 'go-to-top-up' ); 50 //ãã¼ã¸ãããã¸ç§»åãã 51 $( 'body,html' ).animate( 52 { 53 scrollTop: 1, 54 }, 55 800 56 ); 57 } ); 58 //ãã¿ã³(.go-to-toc-common)ã®ã¯ãªãã¯ã¤ãã³ã 59 $( '.go-to-toc-common' ).click( function () { 60 //ç®æ¬¡ã¸ç§»åãã 61 $( 'body,html' ).animate( 62 { 63 scrollTop: $( '.entry-content .toc' ).offset().top, 64 }, 65 800 66 ); 67 } ); 68 69 //æ¤ç´¢ãã¿ã³ã¯ãªãã¯ã§ãã©ã¼ã«ã¹ãå ¥åã¨ãªã¢ã«ç§»ã 70 $( '#search-menu-input' ).change( function ( e ) { 71 var searchEdit = $( '#search-menu-content .search-edit' ).first(); 72 if ( e.target.checked ) { 73 searchEdit.focus(); 74 } else { 75 searchEdit.blur(); 76 } 77 } ); 78 79 //ä¸ã«ã¹ã¯ãã¼ã«ã§ç®¡çããã«ãé ã 80 //ä¸ã«ã¹ã¯ãã¼ã«ã§ç®¡çããã«ã表示 81 var adminMenu = $( '#admin-panel' ); 82 var adminHeight = adminMenu.outerHeight(); 83 var adminStartPos = 0; 84 $( window ).scroll( function () { 85 var adminCurrentPos = $( this ).scrollTop(); 86 if ( adminCurrentPos > adminStartPos ) { 87 if ( adminCurrentPos >= 200 ) { 88 adminMenu.css( 'bottom', '-' + adminHeight + 'px' ); 89 } 90 } else { 91 adminMenu.css( 'bottom', 0 ); 92 } 93 adminStartPos = adminCurrentPos; 94 } ); 95 96 //ã¢ãã¤ã«ãã¿ã³ãåºå®ãããªãå ´å 97 if ( cocoon_localize_script_options.is_fixed_mobile_buttons_enable != 1 ) { 98 //ãããã¼ã¢ãã¤ã«ã¡ãã¥ã¼ 99 var headerMenu = $( '.mobile-header-menu-buttons' ); 100 var headerHight = headerMenu.outerHeight(); 101 var headerStartPos = 0; 102 $( window ).scroll( function () { 103 var headerCurrentPos = $( this ).scrollTop(); 104 // ç»é¢å¹ ã600px以ä¸ã®å ´åã¯ã--wp-admin--admin-bar--heightãèæ ®ããªãï¼WordPressã¢ããã³ãã¼ãåºå®ã¨ãªããªãããããããã¼ã¡ãã¥ã¼ã®ä½ç½®ã0ã«ããï¼ 105 if ( window.innerWidth <= 600 ) { 106 if ( headerCurrentPos > headerStartPos ) { 107 if ( headerCurrentPos >= 100 ) { 108 headerMenu.css( 'top', '-' + headerHight + 'px' ); 109 } 110 } else { 111 headerMenu.css( 'top', 0 ); 112 } 113 } else { 114 // CSS夿°--wp-admin--admin-bar--heightã®å¤ãåå¾ 115 var adminBarHeight = 116 getComputedStyle( document.documentElement ) 117 .getPropertyValue( '--wp-admin--admin-bar--height' ) 118 .trim() || '0px'; 119 if ( headerCurrentPos > headerStartPos ) { 120 if ( headerCurrentPos >= 100 ) { 121 // 管çãã¼ã®é«ããèæ ®ãã¦topãè¨å® 122 headerMenu.css( 123 'top', 124 'calc(' + adminBarHeight + ' - ' + headerHight + 'px)' 125 ); 126 } 127 } else { 128 // 管çãã¼ã®é«ããèæ ®ãã¦topãè¨å®
129 headerMenu.css( 'top', 'calc(' + adminBarHeight + ')' ); 130 } 131 } 132 headerStartPos = headerCurrentPos; 133 } ); 134 135 //ããã¿ã¼ã¢ãã¤ã«ã¡ãã¥ã¼ 136 var footerMenu = $( '.mobile-footer-menu-buttons' ); 137 var footerHeight = footerMenu.outerHeight(); 138 var footerStartPos = 0; 139 $( window ).scroll( function () { 140 var footerCurrentPos = $( this ).scrollTop(); 141 142 if ( footerCurrentPos > footerStartPos ) { 143 if ( footerCurrentPos >= 100 ) { 144 footerMenu.css( 145 'bottom', 146 'calc( -1 * (env(safe-area-inset-bottom) + ' + 147 footerHeight + 148 'px) )' 149 ); 150 } 151 } else if ( footerCurrentPos - footerStartPos < -8 ) { 152 footerMenu.css( 'bottom', 0 ); 153 } 154 155 footerStartPos = footerCurrentPos; 156 } ); 157 158 var headerButtons = $( '.mobile-header-menu-buttons' ); 159 var footerButtons = $( '.mobile-footer-menu-buttons' ); 160 headerButtons.click( function () { 161 headerButtons.css( 'z-index', '3' ); 162 footerButtons.css( 'z-index', '2' ); 163 } ); 164 165 footerButtons.click( function () { 166 headerButtons.css( 'z-index', '2' ); 167 footerButtons.css( 'z-index', '3' ); 168 } ); 169 } 170 171 //ã³ã¡ã³ããã¿ã³ãã¯ãªãã¯ãããã¨ã 172 const clickEventType = window.ontouchstart !== null ? 'click' : 'touchend'; 173 $( document ).on( 174 clickEventType, 175 '#comment-reply-btn, .comment-reply-link', 176 function () { 177 $( '#comment-reply-btn' ).slideUp(); 178 const respond = document.getElementById( 'respond' ); 179 const styles = { 180 inset: 'auto', 181 position: 'static', 182 visibility: 'visible', 183 }; 184 Object.entries( styles ).forEach( ( [ key, value ] ) => { 185 respond.style[ key ] = value; 186 } ); 187 $( '#respond' ).slideDown(); 188 } 189 ); 190 191 //Googleæ¤ç´¢ãã¿ã³ 192 $( '.sbtn' ).click( function () { 193 var w = $( this ).prev( '.sform' ).text(); 194 if ( w ) 195 window.open( 196 'https://www.google.co.jp/search?q=' + encodeURIComponent( w ), 197 '_blank' 198 ); 199 } ); 200 201 //ã¹ã©ã¤ãã¤ã³ãµã¤ããã¼ã®ã¢ã¼ã«ã¤ãã»ã¬ã¯ãããã¯ã¹é¸æå¦ç 202 $( '.sidebar-menu-content .widget_archive select' ).change( function () { 203 document.location.href = this.options[ this.selectedIndex ].value; 204 } ); 205 206 //ã¹ã©ã¤ãã¤ã³ãµã¤ããã¼ã®ã«ãã´ãªã¼ã»ã¬ã¯ãããã¯ã¹é¸æå¦ç 207 $( '.sidebar-menu-content .widget_categories select' ).change( function () { 208 if ( this.options[ this.selectedIndex ].value > 0 ) { 209 this.parentNode.submit(); 210 } 211 } ); 212 213 function drawerCloser( selecter, checkbox ) { 214 $( selecter ).click( function () { 215 $( checkbox ).prop( 'checked', false ); 216 // const href = $(this).attr('href'); 217 // if (href.match(/#/)) { 218 // $(checkbox).prop('checked', false); 219 // } 220 } ); 221 } 222 223 //ã¢ãã¤ã«ã¡ãã¥ã¼ãã¯ãªãã¯ãããéãã 224 drawerCloser( '.menu-drawer .menu-item a', '#navi-menu-input' ); 225 226 //ã¢ãã¤ã«ãµã¤ããã¼ãã¯ãªãã¯ãããéãã 227 drawerCloser( '#slide-in-sidebar a', '#sidebar-menu-input' ); 228 229 //ã¢ãã¤ã«ãããã¼ã¡ãã¥ã¼ã®ãã´å¦ç 230 $( '.mobile-menu-buttons' ).each( function () { 231 if ( $( this ).has( '.logo-menu-button' ).length ) { 232 $( this ).addClass( 'has-logo-button' ); 233 } 234 } ); 235 236 $( window ).on( 'load', function () { 237 $( '#carousel' ).addClass( 'loaded' ); 238 } ); 239 240 //FAQããã¯ã¹ã®ã¢ã³ã¼ãã£ãªã³åç¨ 241 $( '.is-style-accordion > .faq > .faq-answer' ).hide(); 242 $( '.is-style-accordion > .faq > .faq-question' ).click( function () { 243 $( this ).next( '.is-style-accordion .faq-answer' ).slideToggle(); 244 $( this ).toggleClass( 'active' ); 245 } ); 246 247 //ã¢ãã¤ã«ãµã¤ããã¼è¡¨ç¤ºæã«ãµã¤ããã¼ãç§»åããã»ã¢ãã¤ã«ãµã¤ããã¼ãéããæã«å ã®ä½ç½®ã«æ»ã 248 $( document ).on( 'change', '#sidebar-menu-input', function () { 249 if ( $( this ).prop( 'checked' ) ) { 250 $( '#sidebar' ).appendTo( '#sidebar-menu-content' ); 251 $( '#sidebar' ).attr( 'id', 'slide-in-sidebar' ); 252 $( '#sidebar' ).addClass( 'slide-in-sidebar' ); 253 //ã¢ãã¤ã«ãµã¤ããã¼ã®ãªã³ã¯ãã¯ãªãã¯ãããéãã 254 drawerCloser( '#slide-in-sidebar a', '#sidebar-menu-input' ); 255 } else { 256 $( '#sidebar' ).removeClass( 'slide-in-sidebar' ); 257 $( '#slide-in-sidebar' ).attr( 'id', 'sidebar' ); 258 $( '#sidebar' ).insertAfter( '#main' ); 259 } 260 } ); 261 262 //ãªãµã¤ãºããæã¯ãµã¤ããã¼ãå ã«æ»ã 263 var vw = window.innerWidth; 264 $( window ).resize( function () { 265 if ( vw != window.innerWidth ) { 266 $( '#sidebar-menu-input' ).prop( 'checked', false ).change(); 267 } 268 vw = window.innerWidth; 269 } ); 270} )( jQuery ); 271 272/* 273* Cocoon WordPress Theme incorporates code from "Youtube SpeedLoad" WordPress Plugin, Copyright 2017 Alexufo[http://habrahabr.ru/users/alexufo/] 274"Youtube SpeedLoad" WordPress Plugin is distributed under the terms of the GNU GPL v2 275*/ 276( function () { 277 var f = document.querySelectorAll( '.video-click' ); 278 for ( var i = 0; i < f.length; ++i ) { 279 f[ i ].onclick = function () { 280 var iframe = this.getAttribute( 'data-iframe' ); 281 this.parentElement.innerHTML = '<div class="video">' + iframe + '</div>'; 282 }; 283 } 284} )(); 285 286// ãããã¼ã®ä½ç½®ãªãã»ãããæ´æ° 287( function () { 288 function updateHeaderOffset() { 289 const header = document.getElementById( 'header-container' ); 290 291 let offset = 0; 292 293 if ( header && header.classList.contains( 'fixed-header' ) ) { 294 offset = header.offsetHeight; 295 } 296 297 // .mobile-header-menu-buttonsã®topãåå¾ãã¦å¦ç 298 const mobileHeaderMenuButtons = document.querySelector( 299 '.mobile-header-menu-buttons' 300 ); 301 if ( mobileHeaderMenuButtons ) { 302 const computedStyle = window.getComputedStyle( mobileHeaderMenuButtons ); 303 const topValue = parseFloat( computedStyle.top ); 304 305 if ( topValue >= 0 ) { 306 // topã0以ä¸ã®å ´åã¯ããã®è¦ç´ ã®é«ããåæ 307 offset += mobileHeaderMenuButtons.offsetHeight; 308 } else { 309 // topã0æªæºã®å ´åã¯ã0pxã¨ãã¦æ±ãï¼offsetã¯å¤æ´ããªãï¼ 310 // å¿ è¦ã«å¿ãã¦ãããã§è¿½å ã®å¦çãè¡ã 311 } 312 } 313 314 document.documentElement.style.setProperty(
315 '--cocoon--header-container--position-offset', 316 offset + 'px' 317 ); 318 } 319 320 document.addEventListener( 'DOMContentLoaded', updateHeaderOffset ); 321 322 // ãã©ã¦ã¶ãµã¤ãºå¤æ´æã«æ´æ°ï¼ãªãµã¤ãºå¦çãå®äºãã¦ããå®è¡ãããããå°ãé å»¶ãããï¼ 323 let resizeTimer; 324 window.addEventListener( 'resize', function () { 325 clearTimeout( resizeTimer ); 326 resizeTimer = setTimeout( function () { 327 updateHeaderOffset(); 328 }, 100 ); 329 } ); 330 331 // ã¹ã¯ãã¼ã«æã«ãæ´æ°ï¼.mobile-header-menu-buttonsã®topã夿´ãããå¯è½æ§ãããããï¼ 332 window.addEventListener( 'scroll', updateHeaderOffset ); 333} )(); 334
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.