diff --git a/Controllers/kagiSummarizerController.php b/Controllers/kagiSummarizerController.php new file mode 100644 index 0000000..fee5bf5 --- /dev/null +++ b/Controllers/kagiSummarizerController.php @@ -0,0 +1,6 @@ +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('

' . _t('ext.kagiSummarizer.ui.summarize_button') . '

' . $entry->content()); + $url = Minz_Url::display(array( + 'c' => 'kagiSummarizer', + 'a' => 'summarize', + 'params' => array( + 'id' => $entry->id() + ))); + $entry->_content('

' . _t('ext.kagiSummarizer.ui.summarize_button') . '

' . $entry->content()); return $entry; } } diff --git a/static/script.js b/static/script.js index 4977b55..eb54d03 100644 --- a/static/script.js +++ b/static/script.js @@ -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; }