wip
This commit is contained in:
parent
57c7ea88ba
commit
e116dae900
|
@ -5,17 +5,23 @@ if (document.readyState && document.readyState !== 'loading') {
|
||||||
}
|
}
|
||||||
|
|
||||||
function configureSummarizeButtons() {
|
function configureSummarizeButtons() {
|
||||||
console.log('registering kagi handler');
|
|
||||||
document.getElementById('global').addEventListener('click', function(e) {
|
document.getElementById('global').addEventListener('click', function(e) {
|
||||||
console.log('kagi handler triggered');
|
console.log('kagi handler triggered');
|
||||||
for (var target = e.target; target && target != this; target = target.parentNode) {
|
for (var target = e.target; target && target != this; target = target.parentNode) {
|
||||||
if (target.matches('.kagi-summary a.btn')) {
|
if (target.matches('.kagi-summary a.btn')) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
console.log('kagi button clicked', target.dataset.url);
|
if (target.dataset.url) {
|
||||||
|
summarizeButtonClick(target.dataset.url, target.parentNode);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log('kagi handler ignoring click');
|
|
||||||
}, false);
|
}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function summarizeButtonClick(url, container) {
|
||||||
|
container.innerHTML = url;
|
||||||
|
container.classList.add('alert');
|
||||||
|
container.classList.add('alert-success');
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue