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