This commit is contained in:
Rudis Muiznieks 2023-09-25 15:28:13 -05:00
parent e116dae900
commit 720ec20d05
Signed by: rudism
GPG Key ID: CABF2F86EF7884F9
3 changed files with 16 additions and 5 deletions

View File

@ -0,0 +1,6 @@
<?php
class FreshExtension_kagiSummarizer_Controller extends Minz_ActionController {
public function summarizeAction() {
}
}

View File

@ -5,7 +5,7 @@ class KagiSummarizerExtension extends Minz_Extension {
$this->registerTranslates();
$this->registerHook('entry_before_display', [$this, 'addSummarizeButton']);
Minz_View::appendScript($this->getFileUrl('script.js', 'js'), false, false, false);
//Minz_View::appendStyle($this->getFileUrl('style.css', 'css'));
$this->registerController('kagiSummarizer');
}
public function handleConfigureAction() {
@ -24,8 +24,13 @@ class KagiSummarizerExtension extends Minz_Extension {
public function addSummarizeButton(FreshRSS_Entry $entry): FreshRSS_Entry {
$this->registerTranslates();
$entry->_content('<p class="kagi-summary"><a class="btn" data-url="' . urlencode($entry->link()) .'" href="#">' . _t('ext.kagiSummarizer.ui.summarize_button') . '</a></p>' . $entry->content());
$url = Minz_Url::display(array(
'c' => 'kagiSummarizer',
'a' => 'summarize',
'params' => array(
'id' => $entry->id()
)));
$entry->_content('<p class="kagi-summary"><a class="btn" href="' . urlencode($entry->link()) .'">' . _t('ext.kagiSummarizer.ui.summarize_button') . '</a></p>' . $entry->content());
return $entry;
}
}

View File

@ -11,8 +11,8 @@ function configureSummarizeButtons() {
if (target.matches('.kagi-summary a.btn')) {
e.preventDefault();
e.stopPropagation();
if (target.dataset.url) {
summarizeButtonClick(target.dataset.url, target.parentNode);
if (target.href) {
summarizeButtonClick(target.href, target.parentNode);
}
break;
}