wip
This commit is contained in:
parent
e116dae900
commit
720ec20d05
|
@ -0,0 +1,6 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class FreshExtension_kagiSummarizer_Controller extends Minz_ActionController {
|
||||||
|
public function summarizeAction() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,7 +5,7 @@ class KagiSummarizerExtension extends Minz_Extension {
|
||||||
$this->registerTranslates();
|
$this->registerTranslates();
|
||||||
$this->registerHook('entry_before_display', [$this, 'addSummarizeButton']);
|
$this->registerHook('entry_before_display', [$this, 'addSummarizeButton']);
|
||||||
Minz_View::appendScript($this->getFileUrl('script.js', 'js'), false, false, false);
|
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() {
|
public function handleConfigureAction() {
|
||||||
|
@ -24,8 +24,13 @@ class KagiSummarizerExtension extends Minz_Extension {
|
||||||
|
|
||||||
public function addSummarizeButton(FreshRSS_Entry $entry): FreshRSS_Entry {
|
public function addSummarizeButton(FreshRSS_Entry $entry): FreshRSS_Entry {
|
||||||
$this->registerTranslates();
|
$this->registerTranslates();
|
||||||
|
$url = Minz_Url::display(array(
|
||||||
$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());
|
'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;
|
return $entry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@ function configureSummarizeButtons() {
|
||||||
if (target.matches('.kagi-summary a.btn')) {
|
if (target.matches('.kagi-summary a.btn')) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (target.dataset.url) {
|
if (target.href) {
|
||||||
summarizeButtonClick(target.dataset.url, target.parentNode);
|
summarizeButtonClick(target.href, target.parentNode);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue