2023-09-25 14:03:51 -05:00
|
|
|
if (document.readyState && document.readyState !== 'loading') {
|
2023-09-25 14:44:28 -05:00
|
|
|
configureSummarizeButtons();
|
2023-09-25 14:03:51 -05:00
|
|
|
} else {
|
2023-09-25 14:44:28 -05:00
|
|
|
document.addEventListener('DOMContentLoaded', configureSummarizeButtons, false);
|
2023-09-25 14:03:51 -05:00
|
|
|
}
|
|
|
|
|
2023-09-25 14:44:28 -05:00
|
|
|
function configureSummarizeButtons() {
|
|
|
|
var buttons = document.querySelectorAll('.kagi-summary a.btn');
|
|
|
|
console.log(`configuring ${buttons.length} buttons`);
|
2023-09-25 14:51:24 -05:00
|
|
|
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');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2023-09-25 13:30:27 -05:00
|
|
|
}
|