AOS.init(); //initialize tooltips $('[data-toggle="tooltip"]').tooltip({ offset: '0, 20%' }); $('#discord').bind('click touchend', function() { if (navigator.clipboard.writeText("despawningbone#4078")) { $(this).tooltip('hide'); $('#discord').attr('data-original-title', "(copied!)"); setTimeout(() => $('#discord').attr('data-original-title', "despawningbone#4078"), 400); $(this).tooltip('show'); } }); //relative data-target patch for accordions, and also to add .show back into the button $('body').on('click', '[data-toggle=collapse]', function (e) { var $parent = $(this).parents('.ctf-info'); $parent.find('.ctf-table').collapse('toggle'); $parent.toggleClass('show') }); //ctf diary comment popup dynamically load content //TODO allow use of url#data-comment to load modal $('.ctf-table tbody tr').on('click',function(){ href = $(this).attr('href'); //if full writeup is available, redirect if(href) { window.location=href; } else { //else open comment popup href = $(this).attr('data-comment'); //set comment title to chall name $('#commentTitle').text('Comments - ' + this.firstElementChild.textContent) //only load if attr is found, which means a comment should be found if(href) { console.log('ctf/' + href + '.html') $('.ctf-comment').load('ctf/' + href + '.html', function(res, status, xhr){ if(status !== "error") //only show if we can load it, otherwise treat as no comment $('#comment').modal({show:true}); }); } } });