1/*Copy page's link*/ 2function copyToClipboard( text ) { 3 var copytext = document.createElement( 'input' ) 4 copytext.value = text || window.location.href 5 document.body.appendChild( copytext ) 6 copytext.select() 7 document.execCommand( 'copy' ) 8 document.body.removeChild( copytext ) 9 let divTeext = document.createElement( 'span' ); 10 divTeext.className = "alert-copy"; 11 divTeext.innerHTML = "<span>Copied<span>"; 12 event.target.before( divTeext ); 13 setTimeout( () => divTeext.remove(), 1000 ); 14} 15 16function getConverterSettingsPermalink() { 17 try { 18 var currentPrimary = +document.querySelector( '.converter-page .js-primary [data-active]' ).dataset.active; 19 var currentSecondary = +document.querySelector( '.converter-page .js-secondary [data-active]' ).dataset.active; 20 var currentAmount = +document.querySelector( '.converter-page .find-area' ).value; 21 var shareParams = '?primary=' + currentPrimary + '&secondary=' + currentSecondary + '&amount=' + ( currentAmount ? currentAmount : 1 ); 22 23 return window.location.origin + '/converter/' + shareParams; 24 } 25 catch ( e ) { 26 return false; 27 } 28} 29 30/*Copy code on event's page and remove from 2 seconds*/ 31var tooltipCopy = document.getElementsByClassName( 'tooltip' ); 32for ( var i = 0; i < tooltipCopy.length; i++ ) { 33 tooltipCopy[ i ].onclick = function () { 34 var a = this.getAttribute( 'data-code-name' ); 35 var textArea = document.createElement( "input" ); 36 textArea.value = a; 37 document.body.appendChild( textArea ); 38 textArea.select(); 39 try { 40 var successful = document.execCommand( 'copy' ); 41 var msg = successful ? 'successful' : 'unsuccessful'; 42 } 43 catch ( err ) { 44 console.log( 'Oops, unable to copy' ); 45 } 46 document.body.removeChild( textArea ); 47 } 48 49} 50 51$( "#cn-close-notice" ).click( function () { 52 $( ".js_fixed-social ul" ).css( {'bottom': '0'} ); 53} ); 54$( "#cn-accept-cookie" ).click( function () { 55 $( ".js_fixed-social ul" ).css( {'bottom': '0'} ); 56} ); 57$( ".cookies-set .js_fixed-social ul" ).css( {'bottom': '0'} ); 58$( document ).ready( function () { 59 /*FAQ for topics*/ 60 var action = 'click'; 61 var speed = "500"; 62 $( '.faq_group' ).on( action, function () { 63 64 // gets next element 65 // opens .a of selected question 66 $( this ).children( '.faq_answer' ).slideToggle( speed ) 67 68 // selects all other answers and slides up any open answer 69 .parent().siblings().children( '.faq_answer' ).slideUp(); 70 71 // Grab img from clicked question 72 var faq_plus = $( this ).children().children( '.faq_plus' ); 73 74 // remove Rotate class from all images except the active 75 $( '.faq_plus' ).not( faq_plus ).removeClass( 'rotate' ); 76 77 // toggle rotate class 78 faq_plus.toggleClass( 'rotate' ); 79 80 } ); 81 /* /END/ FAQ for topics*/ 82 83 /*for no image on server*/ 84 $( '.loaded' ).parent().addClass( 'add-no-image' ); 85 86 /*Top Menu*/ 87 if ( $( window ).width() > 1200 ) { 88 $( '.nav-header ul li' ).hover( 89 function () { 90 $( 'ul', this ).stop().fadeIn( 400 ); 91 }, 92 function () { 93 $( 'ul', this ).stop().fadeOut( 400 ); 94 } 95 ); 96 } 97 if ( $( window ).width() < 1199 ) { 98 $( '.nav-header ul li .menu-arrow' ).click( function () { 99 $( this ).parent().find( 'ul' ).stop().fadeToggle( 400 ); 100 $( this ).toggleClass( 'active' ); 101 } ); 102 } 103 104 var coinDesc = $( 'meta[property="og:description"]' ).attr( 'content' ); 105 $( '#js_coin-desc' ).text( coinDesc ); 106 107 108 /*API for coin graph*/ 109 $( '.chartTypeTabLinks' ).parent().addClass( 'chartTypeTabLinks-wrapp' ); 110 $( '.chartTypeTabLinks-wrapp' ).next().addClass( "chartTable" ); 111 /*List meni in main-menu*/ 112 $( '.has-list > span' ).click( function () { 113 $( this ).toggleClass( 'active' ); 114 $( this ).parent( '.has-list' ).find( ">ul" ).slideToggle( 600 ); 115 } ); 116 117 /*for validate searchform*/ 118 $( '#searchform' ).submit( function () { 119 120 var inquiry = $( '.input-search' ).val(); 121 $( ".error" ).remove(); 122 if ( inquiry.length < 2 ) { 123 $( '#searchform .search-body .input-search' ).after( '<span class="error">enter at least 2 characters</span>' ); 124 return false;
125 $( ".error" ).remove(); 126 } 127 } ); 128 129 var postion = $( '.wrapp_header-nav' ).offset().top, 130 height = $( '.wrapp_header-nav' ).height(); 131 $( document ).on( 'scroll', function () { 132 var scroll = $( document ).scrollTop(); 133 if ( scroll > postion ) { 134 $( '.wrapp_header-nav' ).addClass( 'fixed' ) 135 } 136 else { 137 $( '.wrapp_header-nav' ).removeClass( 'fixed' ) 138 } 139 } ) 140 141 var activeurl = window.location; 142 var activeInMEnu = $( '.aside-grouped-nav ul li a[href="' + activeurl + '"]' ).addClass( 'active' ); 143 $( '.aside-grouped-nav ul li.have-child > ul li span' ).parent().parent().addClass( 'active' ); 144 145 activeInMEnu.replaceWith( function () { 146 return $( '<span/>', { 147 html: $( this ).html() 148 } ); 149 } ); 150 var liHaveChildSpanActive = $( '.aside-grouped-nav ul li.have-child > ul li span' ).parent().parent().addClass( 'active' ); 151 liHaveChildSpanActive.parent().find( 'button' ).addClass( 'active' ); 152 153 154 var url = window.location.href.toLowerCase(); 155 156 $( ".content-top-menu ul li a" ).each( function () { 157 158 var $this = $( this ); 159 160 var href = $this.attr( "href" ).toLowerCase(); 161 162 if ( url.indexOf( href ) > -1 ) { 163 $this.parent().addClass( "active" ); 164 } 165 166 } ); 167 168 //scroll to anchor 169 $( "body" ).on( 'click', '[href*="#"]', function ( e ) { 170 var fixed_offset = 10; 171 $( 'html,body' ).stop().animate( {scrollTop: $( this.hash ).offset().top - fixed_offset}, 1000 ); 172 e.preventDefault(); 173 } ); 174 175 $( '.js-wrapp-content-nav .content h2, .js-wrapp-content-nav .content h3' ).each( function () { 176 var thisText = $( this ).text(); 177 var anchorText = thisText.replace( /[.,\/#!?%\^&\*;:{}=\-_`~() ]/g, "" ); 178 var anchorLink = '<a id="' + anchorText + '" class="toc_link"></a>'; 179 if ( $( this ).is( 'h2' ) ) { 180 var anchorText = '<li><a href="#' + anchorText + '">' + thisText + '</a></li>'; 181 } 182 else if ( $( this ).is( 'h3' ) ) { 183 var anchorText = '<li class="nav_h3"><a href="#' + anchorText + '">' + thisText + '</a></li>'; 184 } 185 $( this ).before( anchorLink ); 186 $( anchorText ).appendTo( '.js-content-nav' ); 187 188 if ( $( this ).length ) { 189 $( '.concent-nav' ).addClass( 'active' ); 190 } 191 } ); 192 193 194 //======TOOLTIP WITH CLICK========// 195 $( '.wrapp_tooltip-button .btn-tooltip' ).click( function () { 196 $( this ).parent().find( '.tooltip' ).toggleClass( 'active' ); 197 } ); 198 $( '.wrapp_tooltip-button .tooltip' ).on( 'click', function () { 199 var removeTool = setInterval( function () { 200 $( '.wrapp_tooltip-button .tooltip' ).removeClass( 'active' ); 201 clearInterval( removeTool ); 202 }, 2000 ); 203 } ); 204 //======/END/===TOOLTIP WITH CLICK========// 205 206 //======ASIDE GROUPED #MENU========// 207 $( '.js-aside-groupedMenu .have-child button' ).click( function () { 208 $( this ).toggleClass( 'active' ); 209 $( this ).parent( '.have-child' ).find( ">ul" ).slideToggle( 600 ); 210 } ); 211 //======/END/===ASIDE GROUPED #MENU========// 212 213 //======ASIDE GROUPED #MENU DROPDOWN ========// 214 $( '.js-aside-groupedMenu.dropdown .menu ul.children' ).parent().addClass( 'have-child' ); 215 $( '<span class="plus"></span>' ).prependTo( $( ".js-aside-groupedMenu.dropdown .menu li.have-child" ) ); 216 217 $( ".js-aside-groupedMenu.dropdown .menu li.have-child .plus" ).click( function () { 218 $( this ).toggleClass( 'active' ); 219 $( this ).parent( '.have-child' ).find( ">ul.children" ).slideToggle( 600 ); 220 } ); 221 222 $( '.js-aside-groupedMenu.dropdown li.title i' ).click( function () { 223 $( this ).toggleClass( 'active' ); 224 $( this ).parent().find( ">ul.child-upper-level" ).slideToggle( 600 ); 225 } ); 226 227 $( ".js-aside-groupedMenu.dropdown .menu li.current-cat-parent, .js-aside-groupedMenu.dropdown .menu li.current-cat" ).parent().addClass( 'active' ); 228 $( '.current-cat-ancestor' ).parent().addClass( 'active' ); 229 230 $( '.child-upper-level.active' ).parent().find( '.js-drop-arrow' ).addClass( 'active' ); 231 232 //for 4th active level add class "active" for plus 233 $( '.menu > li > ul.child-upper-level.active > li.current-cat-ancestor.have-child > ul.children.active > li.current-cat-ancestor.have-child > ul.children.active > li.current-cat > span' ).parents().eq( 2 ).find( '>.plus' ).addClass( 'active' ); 234 $( '.menu > li > ul.child-upper-level.active > li.current-cat-ancestor.have-child > ul.children.active > li.current-cat-ancestor.have-child > ul.children.active > li.current-cat > span' ).parents().eq( 4 ).find( '>.plus' ).addClass( 'active' ); 235 236 //for 3 active level add class "active" for plus 237 $( '.menu > li > ul.child-upper-level.active > li.current-cat-ancestor.have-child > ul.children.active > li.current-cat.have-child > span' ).parents().eq( 2 ).find( '>.plus' ).addClass( 'active' ); 238 //======/END/=== ASIDE GROUPED #MENU DROPDOWN ========// 239 240 //TOP SEARCH 241 $( '.wrapp_header-nav .header-right .show-search' ).click( function () { 242 $( this ).toggleClass( 'active' ); 243 $( '.popup-search' ).fadeIn( 400 ); 244 $( '.app' ).addClass( 'blur' ); 245 $( '.popup-search .search-body .input-search' ).focus(); 246 247 } ); 248 $( '.close-search' ).click( function () { 249 $( '.popup-search' ).fadeOut( 400 ); 250 $( '.wrapp_header-nav .header-right .error' ).toggleClass( 'hide' ); 251 $( '.app' ).removeClass( 'blur' ); 252 } ); 253 //#TOP SEARCH 254 255 //TABS 256 $( '.js-tabs ul.js-tabs-nav' ).on( 'click', 'li:not(.active)', function () { 257 $( this ) 258 .addClass( 'active' ).siblings().removeClass( 'active' ) 259 .closest( 'div.js-tabs' ).find( '.js-tabs-item' ).removeClass( 'active' ).eq( $( this ).index() ).addClass( 'active' ); 260 } ); 261 //#TABS 262 263 //For fly <lebel> 264 $( '.fly-lab input, .fly-lab textarea' ).on( 'focus blur', function ( e ) { 265 if ( ! $( this ).val() ) $( this ).parent()[ e.type === 'focus' ? 'addClass' : 'removeClass' ]( 'focused' ); 266 } ); 267 268 //js-slide-choose
269 $( '.js-slide-choose .next' ).click( function () { 270 var thisParent = $( this ).closest( '.js-slide-choose' ), 271 activeElement = thisParent.find( '.js-slide-choose_body div.active' ), 272 activeElementIndex = thisParent.find( '.js-slide-choose_body div.active' ).index(), 273 nextElementIndex = activeElementIndex + 1, 274 nextElement = thisParent.find( '.js-slide-choose_body div' ).eq( nextElementIndex ); 275 activeElement.fadeOut( 500 ); 276 activeElement.removeClass( 'active' ); 277 if ( nextElementIndex == ( thisParent.find( '.js-slide-choose_body div:last' ).index() + 1 ) ) { 278 thisParent.find( '.js-slide-choose_body div' ).eq( 0 ).fadeIn( 500 ); 279 thisParent.find( '.js-slide-choose_body div' ).eq( 0 ).addClass( 'active' ); 280 } 281 else { 282 nextElement.fadeIn( 500 ); 283 nextElement.addClass( 'active' ); 284 } 285 } ); 286 287 $( '.js-slide-choose .prev' ).click( function () { 288 var thisParent = $( this ).closest( '.js-slide-choose' ), 289 activeElement = thisParent.find( '.js-slide-choose_body div.active' ), 290 activeElementIndex = thisParent.find( '.js-slide-choose_body div.active' ).index(), 291 prevElementIndex = activeElementIndex - 1, 292 prevElement = thisParent.find( '.js-slide-choose_body div' ).eq( prevElementIndex ); 293 activeElement.fadeOut( 500 ); 294 activeElement.removeClass( 'active' ); 295 prevElement.fadeIn( 500 ); 296 prevElement.addClass( 'active' ); 297 } ); 298 299 //.js-dropdown 300 $( '.js-dropdown' ).click( function () { 301 $( this ).toggleClass( 'open' ); 302 $( this ).children( '.js-options' ).toggleClass( 'open' ); 303 } ); 304 $( '.evenst-index .js-dropdown_event > div' ).click( function () { 305 $( this ).parent().toggleClass( 'open' ); 306 $( this ).parent().children( 'ul' ).toggleClass( 'open' ); 307 } ); 308 309 $( '.js-dropdown_menu span' ).click( function () { 310 $( this ).parent().toggleClass( 'open' ); 311 $( this ).parent().children( '.js-dropdown_menu-body' ).slideToggle( 600 ); 312 } ); 313 314 $( '.js-options li' ).click( function () { 315 var selection = $( this ).text(); 316 $( this ).closest( '.js-dropdown' ).find( 'span' ).text( selection ); 317 $( this ).addClass( 'active' ).siblings().removeClass( 'active' ); 318 } ); 319 $( '.js-options li a' ).click( function () { 320 var selection = $( this ).text(); 321 $( this ).closest( '.js-dropdown' ).find( 'span' ).text( selection ); 322 $( this ).parent().addClass( 'active' ).siblings().removeClass( 'active' ); 323 $( this ).parents().eq( 1 ).removeClass( 'open' ); 324 $( this ).parents().eq( 2 ).removeClass( 'open' ); 325 } ); 326 327 $( '.evenst-index .js-options li a' ).click( function () { 328 $( this ).parents().eq( 3 ).find( '.js-slide-choose_body > div.all' ).css( 'display', 'block' ).siblings().css( 'display', 'none' ); 329 } ); 330 331 //======Dropdown content==================/ 332 $('.js-dropdown_content').each(function () { 333 const $container = $(this); 334 335 $container.find("p:first").nextUntil('.js-see_more').hide(); 336 $container.find('p:first + div:empty + .js-see_more').hide(); 337 $container.find('p:first + div:has(div:empty) + .js-see_more').hide(); 338 $container.find('p:first + .js-see_more').hide(); 339 }); 340 341 $('.js-dropdown_content .js-see_more').on('click', function () { 342 const $container = $(this).closest('.js-dropdown_content'); 343 const $firstP = $container.find('p:first'); 344 345 $(this).find('span').toggleClass('hide'); 346 $('html, body').animate({ 347 scrollTop: $firstP.offset().top - 80 348 }, 800); 349 $firstP.nextUntil('.js-see_more').slideToggle(900); 350 351 setTimeout(function () { 352 $container.find('.twitter-tweet-rendered').toggleClass("twitter-box-hide"); 353 }, 100); 354 }); 355 356 //Dropdown block for currency 357 $( '.js_dropdown-currency' ).click( function () { 358 $( this ).toggleClass( 'open' ); 359 $( this ).parent().parent().children( '.js_dropdown-currency_body' ).toggleClass( 'open' ); 360 $( this ).parent().parent().children( '.js_dropdown-currency_body' ).slideToggle( 600 ); 361 } ); 362 363 $( '.js_dropdown-currency-top' ).click( function () { 364 $( this ).toggleClass( 'open' ); 365 $( this ).parent().children( '.js_dropdown-currency_body-top' ).toggleClass( 'open' ); 366 $( this ).parent().children( '.js_dropdown-currency_body-top' ).slideToggle( 600 ); 367 } ); 368 369 //======For Tablet ==================/ 370 if ( $( window ).width() < 991.98 ) { 371 var activeText = $( '.js-find-text-active_tablet li.active a, .js-find-text-active_tablet li > span' ).text() 372 $( '.js-active-text_menu-tablet' ).text( activeText ); 373 374 375 var activeElement = $( '.js-find-element-active_tablet li.active' ).html() 376 $( '.js-active-element-tablet' ).html( activeElement ); 377 378 $( '.js-find-element-active_tablet.add-text-active li' ).click( function () { 379 $( '.js-active-element-tablet' ).empty(); 380 $( this ).children().clone().appendTo( '.js-active-element-tablet' ); 381 $( '.js-dropdown_tablet' ).removeClass( 'open' ); 382 $( this ).parent().slideToggle( 600 ) 383 } ); 384 385 $( '.js-dropdown_tablet section' ).click( function () { 386 $( this ).parent().toggleClass( 'open' ); 387 $( this ).parent().children( '.js-options_tablet' ).toggleClass( 'open' ); 388 $( this ).parent().children( '.js-options_tablet' ).slideToggle( 600 ); 389 } ); 390 391 $( '.js-options_mobile li' ).click( function () { 392 var selection = $( this ).text(); 393 $( this ).closest( '.js-dropdown_mobile' ).find( 'span' ).html( selection ); 394 $( this ).addClass( 'active' ).siblings().removeClass( 'active' ); 395 } ); 396 $( '.single-article aside.aside' ).parent().remove(); 397 } 398 //======/end/===For Tablet=========/ 399 400 //======For mobile==================/ 401 if ( $( window ).width() < 767.98 ) { 402 $( '.js-find-text-active_mobile li.active a' ).appendTo( $( '.js-active-text_menu-mobile' ) ); 403 404 $( '.js-dropdown_mobile' ).click( function () { 405 $( this ).toggleClass( 'open' ); 406 $( this ).children( '.js-options_mobile' ).toggleClass( 'open' ); 407 $( this ).children( '.js-options_mobile' ).slideToggle( 600 ); 408 } ); 409 410 $( '.js-options_mobile li' ).click( function () { 411 var selection = $( this ).text(); 412 $( this ).closest( '.js-dropdown_mobile' ).find( 'span' ).html( selection ); 413 $( this ).addClass( 'active' ).siblings().removeClass( 'active' ); 414 } ); 415 } 416 //======/end/===For mobile=========/ 417} ); 418 419 420//hide menu click out of 421$( document ).mouseup( function ( e ) { 422 var menuBlock = $( ".wrapp_main-menu.active .main-menu" ), 423 closeBtn = $( ".wrapp_main-menu.active .main-menu a.close-btn .cross" ); 424 if ( ! menuBlock.is( e.target ) && menuBlock.has( e.target ).length == 0 ) { 425 $( '.wrapp_main-menu' ).removeClass( 'active' ); 426 $( 'body' ).removeClass( 'body-lock' ); 427 } 428} ); 429 430//hide search click out of 431$( document ).mouseup( function ( s ) { 432 var searchBlock = $( ".wrapp_header-nav .header-right form.search" ); 433 if ( ! searchBlock.is( s.target ) && searchBlock.has( s.target ).length === 0 ) { 434 $( '.wrapp_header-nav .header-right form.search' ).removeClass( 'active' ); 435 $( '.wrapp_header-nav .header-right .show-search' ).removeClass( 'active' ); 436 } 437} ); 438 439//hide search click out of 440$( document ).mouseup( function ( evenst ) { 441 var optionsBlock = $( ".evenst-index .js-options" ); 442 if ( ! optionsBlock.is( evenst.target ) && optionsBlock.has( evenst.target ).length === 0 ) { 443 $( '.evenst-index .js-options' ).removeClass( 'open' ); 444 $( '.evenst-index .js-options' ).parent().removeClass( 'open' ); 445 } 446} ); 447 448const stickyElement = document.querySelector('.single-guide-toc-new'); 449const originalOffsetTop = stickyElement.getBoundingClientRect().top + window.scrollY; 450const stickyTopOffset = 100; 451 452window.addEventListener('scroll', function () { 453 const scrollTop = window.scrollY || document.documentElement.scrollTop; 454 455 if (scrollTop >= originalOffsetTop - stickyTopOffset) { 456 stickyElement.style.position = 'fixed'; 457 stickyElement.style.top = stickyTopOffset + 'px'; 458 } else { 459 stickyElement.style.position = 'relative'; 460 stickyElement.style.top = '0'; 461 } 462}); 463 464//Fixed body when menu opened 465document.addEventListener( 'DOMContentLoaded', function () { 466 document.querySelectorAll( '.tickerwidget__name' ).forEach( node => { 467 let nodeWidth = node.offsetWidth; 468 let childsWidth = Array.from( node.querySelectorAll( '.tickerwidget__symbol, .tickerwidget__full' ) ).reduce( ( accumulator, node ) => { 469 return accumulator + node.scrollWidth 470 }, 0 ); 471 472 if ( childsWidth + 9 <= nodeWidth ) { 473 node.classList.add( 'disable-fade' ); 474 } 475 } ); 476 477 478 let topCryptoWidget = document.querySelector( '.transportable-js' ); 479 if ( topCryptoWidget ) { 480 topCryptoWidget.style.display = 'block'; 481 482 const sidebar = topCryptoWidget.parentNode; 483 const main = topCryptoWidget.closest( '.row' ).querySelector( '.col-lg-8' ); 484 485 const swapWidgetBasedScreenSize = () => { 486 if ( window.innerWidth < 992 ) { 487 main.appendChild( topCryptoWidget ); 488 } 489 else { 490 sidebar.appendChild( topCryptoWidget ); 491 } 492 } 493 494 swapWidgetBasedScreenSize(); 495 window.addEventListener( 'resize', swapWidgetBasedScreenSize ); 496 } 497 498 if ( document.querySelector( '.coinlive' ) ) { 499 document.body.addEventListener( 'click', function ( e ) { 500 let closestWidget = e.target.closest( '.coinlive' ); 501 502 if ( closestWidget ) { 503 if ( window.innerWidth < 768 ) { 504 if ( getComputedStyle( closestWidget.querySelector( '.coinlive__dropdown' ) ).visibility === 'hidden' ) { 505 e.preventDefault(); 506 } 507 } 508 } 509 } ); 510 } 511 512 function sendGAEvent( eventCategory, eventAction, eventLabel ) { 513 if ( typeof ga !== 'undefined' ) { 514 ga( 'send', 'event', eventCategory, eventAction, eventLabel ); 515 } 516 else if ( typeof gtag !== 'undefined' ) { 517 gtag( 'event', eventAction, { 518 'event_category': eventCategory, 519 'event_label': eventLabel 520 } ); 521 } 522 } 523 524 document.addEventListener( 'DOMContentLoaded', function () { 525 var elements = document.querySelectorAll( '.top-sidebar-banner' );
526 elements.forEach( function ( element ) { 527 element.addEventListener( 'click', function () { 528 sendGAEvent( 'User Interaction', 'Click on top-sidebar-banner', 'Top Sidebar Banner' ); 529 } ); 530 } ); 531 } ); 532} ); 533 534document.querySelectorAll('.tab__label').forEach(label => { 535 label.addEventListener('click', () => { 536 const tab = label.parentElement; 537 tab.classList.toggle('closed'); 538 }); 539 }); 540// toc content new js 541$(document).ready(function () { 542 const accordionContainer = $('.js-content-nav-guide'); 543 const maxVisibleItems = 5; 544 const allAccordionItems = []; 545 const seeAllText = $('.sidebar-section .js-content-nav-guide').attr('data-see-all-text'); 546 const arrowImageUrl = accordionContainer.data('arrow-image'); 547 548 $('.js-wrapp-content-nav-guide .content h2').each(function () { 549 var h2 = $(this); 550 var h2Title = h2.text().trim(); 551 552 h2Title = h2Title.replace(/ââ¬â|â|â|â/g, "-"); 553 h2Title = h2Title.replace(/[.,\/#!?%\^&\*;:{}=\-_`~() ]+/g, "-"); 554 555 h2Title = h2Title.replace(/\$/g, "_"); 556 var anchorText = h2Title.replace(/[^a-zA-Z0-9\-_]+/g, ""); 557 558 anchorText = anchorText.replace(/^[-_]+|[-_]+$/g, ""); 559 560 // Create anchor and accordion item 561 var anchorLink = '<a id="' + anchorText + '" class="toc_link"></a>'; 562 var accordionItem = $('<div class="accordion-item"></div>'); 563 var toggleArrow = '<span class="arrow"><img src="' + arrowImageUrl + '" alt=""></span>'; 564 var accordionHeader = $('<div class="accordion-header"></div>'); 565 var link = $('<a href="#' + anchorText + '"></a>').text(h2.text().trim()); 566 accordionHeader.append(link); 567 accordionItem.append(accordionHeader); 568 569 // Process h3 items under h2 570 var h3List = h2.nextUntil('h2', 'h3'); 571 if (h3List.length > 0) { 572 accordionHeader.append(toggleArrow); 573 var accordionContent = $('<div class="accordion-content"></div>'); 574 var ul = $('<ul></ul>'); 575 576 h3List.each(function () { 577 var h3 = $(this); 578 var fullTitle = h3.text().trim(); 579 580 if (h3.find('.mini-review-heading').length) { 581 var mainTitle = h3.find('.mini-review-heading').text().trim(); 582 var extraText = h3.find('.mini-review-text').text().trim(); 583 fullTitle = mainTitle; 584 if (extraText) { 585 fullTitle += " â " + extraText; 586 } 587 } 588 589 var idSource = h3.find('.mini-review-heading').length 590 ? h3.find('.mini-review-heading').text().trim() 591 : h3.text().trim(); 592 idSource = idSource.replace(/ââ¬â|â|â|â/g, "-"); 593 idSource = idSource.replace(/[.,\/#!?%\^&\*;:{}=\-_`~() ]+/g, "-"); 594 idSource = idSource.replace(/\$/g, "_"); 595 var h3Id = idSource.replace(/[^a-zA-Z0-9\-_]+/g, ""); 596 h3Id = h3Id.replace(/^[-_]+|[-_]+$/g, ""); 597 h3.attr('id', h3Id); 598 599 var li = $('<li></li>'); 600 var liLink = $('<a href="#' + h3Id + '" class="toc_sub_link"></a>').text(fullTitle); 601 li.append(liLink); 602 ul.append(li); 603 }); 604 605 accordionContent.append(ul); 606 accordionItem.append(accordionContent); 607 } 608 609 // Insert anchor before heading for smooth scroll 610 $(this).before(anchorLink); 611 allAccordionItems.push(accordionItem); 612 613 if ($(this).length) { 614 $('.concent-nav-guide').addClass('active'); 615 } 616 }); 617 618 // Append visible accordion items, hide the rest 619 allAccordionItems.forEach((item, index) => { 620 if (index < maxVisibleItems) { 621 item.appendTo('.js-content-nav-guide'); 622 } else { 623 item.hide().appendTo('.js-content-nav-guide'); 624 } 625 }); 626 627 // Show "See All" button if more items than maxVisibleItems 628 if (allAccordionItems.length > maxVisibleItems) { 629 var seeAllBtn = $('<button class="see-all-btn">' + seeAllText + '</button>'); 630 $('.js-options_tablet').append(seeAllBtn); 631 seeAllBtn.on('click', function () { 632 $('.accordion-item:hidden').slideDown(); 633 $(this).remove(); 634 }); 635 } 636 637 // Accordion toggle functionality 638 $('.sub-accordion-main').on('click', '.accordion-header .arrow', function (e) { 639 var header = $(this).closest('.accordion-header'); 640 var content = header.next('.accordion-content'); 641 content.slideToggle(); 642 }); 643 644 // Smooth scroll on anchor link click 645 $('a[href^="#"]').on('click', function (e) { 646 e.preventDefault(); 647 var target = $(this.getAttribute('href')); 648 if (target.length) { 649 $('html, body').animate({ 650 scrollTop: target.offset().top - 60 651 }, 800); 652 } 653 }); 654}); 655// loadMore Crypto js 656jQuery(document).ready(function($) { 657 var batchSize = 5; 658 var $items = $('.crypto-row-item.d-none'); 659 var total = $items.length; 660 var visible = 0; 661 662 $('#loadMoreCrypto').on('click', function(e) { 663 e.preventDefault(); 664 665 $items.slice(visible, visible + batchSize).removeClass('d-none'); 666 visible += batchSize; 667 668 if (visible >= total) { 669 $(this).hide(); 670 } 671 }); 672});
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.