This commit is contained in:
Rudis Muiznieks 2023-09-25 15:07:33 -05:00
parent 57c7ea88ba
commit e116dae900
Signed by: rudism
GPG Key ID: CABF2F86EF7884F9
1 changed files with 9 additions and 3 deletions

View File

@ -5,17 +5,23 @@ if (document.readyState && document.readyState !== 'loading') {
}
function configureSummarizeButtons() {
console.log('registering kagi handler');
document.getElementById('global').addEventListener('click', function(e) {
console.log('kagi handler triggered');
for (var target = e.target; target && target != this; target = target.parentNode) {
if (target.matches('.kagi-summary a.btn')) {
e.preventDefault();
e.stopPropagation();
console.log('kagi button clicked', target.dataset.url);
if (target.dataset.url) {
summarizeButtonClick(target.dataset.url, target.parentNode);
}
break;
}
}
console.log('kagi handler ignoring click');
}, false);
}
function summarizeButtonClick(url, container) {
container.innerHTML = url;
container.classList.add('alert');
container.classList.add('alert-success');
}