25 lines
675 B
JavaScript
25 lines
675 B
JavaScript
if (document.readyState && document.readyState !== 'loading') {
|
|
configureSummarizeButtons();
|
|
} else {
|
|
document.addEventListener('DOMContentLoaded', configureSummarizeButtons, false);
|
|
}
|
|
|
|
function configureSummarizeButtons() {
|
|
var buttons = document.querySelectorAll('.kagi-summary a.btn');
|
|
console.log(`configuring ${buttons.length} buttons`);
|
|
for (var i = 0; i < buttons.length; i++) {
|
|
let button = buttons[i];
|
|
let url = button.dataset.url;
|
|
button.addEventListener('click', function(e) {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
|
|
if (url) {
|
|
console.log(url);
|
|
} else {
|
|
console.log('no url');
|
|
}
|
|
});
|
|
}
|
|
}
|