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 //[.go-to-to]ããã£ãããã§ã¼ãã¤ã³ãã 28 $('.go-to-top').fadeIn('slow'); 29 } else { 30 //ãããã¸æ»ãéã ã追å ããã¯ã©ã¹ãé¤å» 31 $('.go-to-top-common').removeClass('go-to-top-up') 32 //ãã以å¤ã ã£ãããã§ã¼ãã¢ã¦ããã 33 $('.go-to-top').fadeOut('slow'); 34 } 35 } 36 37 prevScrollTop = scrollTop; 38 }); 39 40 //ãã¿ã³(.go-to-top-common)ã®ã¯ãªãã¯ã¤ãã³ã 41 $('.go-to-top-common').click(function () { 42 //ãããã¸æ»ãéã ãã¯ã©ã¹ã追å 43 $(this).addClass('go-to-top-up'); 44 //ãã¼ã¸ãããã¸ç§»åãã 45 $('body,html').animate({ 46 scrollTop: 1 47 }, 800); 48 }); 49 //ãã¿ã³(.go-to-toc-common)ã®ã¯ãªãã¯ã¤ãã³ã 50 $('.go-to-toc-common').click(function () { 51 //ç®æ¬¡ã¸ç§»åãã 52 $('body,html').animate({ 53 scrollTop: $('.entry-content .toc').offset().top 54 }, 800); 55 }); 56 57 //æ¤ç´¢ãã¿ã³ã¯ãªãã¯ã§ãã©ã¼ã«ã¹ãå ¥åã¨ãªã¢ã«ç§»ã 58 $('#search-menu-input').change(function (e) { 59 var searchEdit = $('#search-menu-content .search-edit').first(); 60 if (e.target.checked) { 61 searchEdit.focus(); 62 } else { 63 searchEdit.blur(); 64 } 65 }); 66 67 //ä¸ã«ã¹ã¯ãã¼ã«ã§ç®¡çããã«ãé ã 68 //ä¸ã«ã¹ã¯ãã¼ã«ã§ç®¡çããã«ã表示 69 var adminMenu = $("#admin-panel"); 70 var adminHeight = adminMenu.outerHeight(); 71 var adminStartPos = 0; 72 $(window).scroll(function () { 73 var adminCurrentPos = $(this).scrollTop(); 74 if (adminCurrentPos > adminStartPos) { 75 if (adminCurrentPos >= 200) { 76 adminMenu.css("bottom", "-" + adminHeight + "px"); 77 } 78 } else { 79 adminMenu.css("bottom", 0); 80 } 81 adminStartPos = adminCurrentPos; 82 }); 83 84 //ã¢ãã¤ã«ãã¿ã³ãåºå®ãããªãå ´å 85 if (cocoon_localize_script_options.is_fixed_mobile_buttons_enable != 1) { 86 //ãããã¼ã¢ãã¤ã«ã¡ãã¥ã¼ 87 var headerMenu = $('.mobile-header-menu-buttons'); 88 var headerHight = headerMenu.outerHeight(); 89 var headerStartPos = 0; 90 $(window).scroll(function () { 91 var headerCurrentPos = $(this).scrollTop(); 92 if (headerCurrentPos > headerStartPos) { 93 if (headerCurrentPos >= 100) { 94 headerMenu.css('top', '-' + headerHight + 'px'); 95 } 96 } else { 97 headerMenu.css('top', 0); 98 } 99 headerStartPos = headerCurrentPos; 100 }); 101 102 //ããã¿ã¼ã¢ãã¤ã«ã¡ãã¥ã¼ 103 var footerMenu = $(".mobile-footer-menu-buttons"); 104 var footerHeight = footerMenu.outerHeight(); 105 var footerStartPos = 0; 106 $(window).scroll(function () { 107 var footerCurrentPos = $(this).scrollTop(); 108 109 if (footerCurrentPos > footerStartPos) { 110 if (footerCurrentPos >= 100) { 111 footerMenu.css("bottom", "calc( -1 * (env(safe-area-inset-bottom) + " + footerHeight + "px) )"); 112 } 113 } else if (footerCurrentPos - footerStartPos < -8) { 114 footerMenu.css("bottom", 0); 115 } 116 117 footerStartPos = footerCurrentPos; 118 }); 119 120 var headerButtons = $(".mobile-header-menu-buttons"); 121 var footerButtons = $(".mobile-footer-menu-buttons"); 122 headerButtons.click(function () { 123 headerButtons.css("z-index", "3"); 124 footerButtons.css("z-index", "2"); 125 }); 126 127 footerButtons.click(function () { 128 headerButtons.css("z-index", "2"); 129 footerButtons.css("z-index", "3"); 130 }) 131 } 132 133 //ã³ã¡ã³ããã¿ã³ãã¯ãªãã¯ãããã¨ã 134 const clickEventType = ((window.ontouchstart !== null) ? 'click' : 'touchend'); 135 $(document).on(clickEventType,'#comment-reply-btn, .comment-reply-link', function() {
136 $('#comment-reply-btn').slideUp(); 137 const respond = document.getElementById('respond'); 138 const styles = { inset: 'auto', position: 'static', visibility: 'visible' }; 139 Object.entries(styles).forEach(([key, value]) => { 140 respond.style[key] = value; 141 }); 142 $('#respond').slideDown(); 143 }); 144 145 //Googleæ¤ç´¢ãã¿ã³ 146 $('.sbtn').click(function () { 147 var w = $(this).prev('.sform').text(); 148 if (w) window.open('https://www.google.co.jp/search?q=' + encodeURIComponent(w), '_blank'); 149 }); 150 151 //ã¹ã©ã¤ãã¤ã³ãµã¤ããã¼ã®ã¢ã¼ã«ã¤ãã»ã¬ã¯ãããã¯ã¹é¸æå¦ç 152 $('.sidebar-menu-content .widget_archive select').change(function () { 153 document.location.href = this.options[this.selectedIndex].value; 154 }); 155 156 //ã¹ã©ã¤ãã¤ã³ãµã¤ããã¼ã®ã«ãã´ãªã¼ã»ã¬ã¯ãããã¯ã¹é¸æå¦ç 157 $('.sidebar-menu-content .widget_categories select').change(function () { 158 if (this.options[this.selectedIndex].value > 0) { 159 this.parentNode.submit(); 160 } 161 }); 162 163 function drawerCloser(selecter, checkbox) { 164 $(selecter).click(function () { 165 $(checkbox).prop('checked', false); 166 // const href = $(this).attr('href'); 167 // if (href.match(/#/)) { 168 // $(checkbox).prop('checked', false); 169 // } 170 }) 171 } 172 173 //ã¢ãã¤ã«ã¡ãã¥ã¼ãã¯ãªãã¯ãããéãã 174 drawerCloser('.menu-drawer .menu-item a', '#navi-menu-input'); 175 176 //ã¢ãã¤ã«ãµã¤ããã¼ãã¯ãªãã¯ãããéãã 177 drawerCloser('#slide-in-sidebar a', '#sidebar-menu-input'); 178 179 //ã¢ãã¤ã«ãããã¼ã¡ãã¥ã¼ã®ãã´å¦ç 180 $('.mobile-menu-buttons').each(function () { 181 if ($(this).has('.logo-menu-button').length) { 182 $(this).addClass('has-logo-button'); 183 } 184 }); 185 186 $(window).on('load', function () { 187 $('#carousel').addClass('loaded'); 188 }); 189 190 //FAQããã¯ã¹ã®ã¢ã³ã¼ãã£ãªã³åç¨ 191 $('.is-style-accordion > .faq > .faq-answer').hide(); 192 $('.is-style-accordion > .faq > .faq-question').click(function () { 193 $(this).next('.is-style-accordion .faq-answer').slideToggle(); 194 $(this).toggleClass('active'); 195 }); 196 197 //ã¢ãã¤ã«ãµã¤ããã¼è¡¨ç¤ºæã«ãµã¤ããã¼ãç§»åããã»ã¢ãã¤ã«ãµã¤ããã¼ãéããæã«å ã®ä½ç½®ã«æ»ã 198 $(document).on("change", '#sidebar-menu-input', function () { 199 if ($(this).prop('checked')) { 200 $('#sidebar').appendTo('#sidebar-menu-content'); 201 $('#sidebar').attr('id', 'slide-in-sidebar'); 202 $('#sidebar').addClass('slide-in-sidebar'); 203 //ã¢ãã¤ã«ãµã¤ããã¼ã®ãªã³ã¯ãã¯ãªãã¯ãããéãã 204 drawerCloser('#slide-in-sidebar a', '#sidebar-menu-input'); 205 } else { 206 $('#sidebar').removeClass('slide-in-sidebar'); 207 $('#slide-in-sidebar').attr('id', 'sidebar'); 208 $('#sidebar').insertAfter('#main'); 209 } 210 }); 211 212 //ãªãµã¤ãºããæã¯ãµã¤ããã¼ãå ã«æ»ã 213 var vw = window.innerWidth; 214 $(window).resize(function () { 215 if (vw != window.innerWidth) { 216 $('#sidebar-menu-input').prop('checked', false).change(); 217 } 218 vw = window.innerWidth; 219 }); 220})(jQuery); 221 222/* 223* Cocoon WordPress Theme incorporates code from "Youtube SpeedLoad" WordPress Plugin, Copyright 2017 Alexufo[http://habrahabr.ru/users/alexufo/] 224"Youtube SpeedLoad" WordPress Plugin is distributed under the terms of the GNU GPL v2 225*/ 226(function () { 227 var f = document.querySelectorAll(".video-click"); 228 for (var i = 0; i < f.length; ++i) { 229 f[i].onclick = function () { 230 var iframe = this.getAttribute("data-iframe"); 231 this.parentElement.innerHTML = '<div class="video">' + iframe + '</div>'; 232 } 233 } 234})();
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.