added a custom css config for summary content #3

Merged
rudism merged 1 commit from custom-css into main 2024-09-25 15:14:26 -05:00
5 changed files with 15 additions and 2 deletions
Showing only changes of commit 23b05cbcb1 - Show all commits

View file

@ -1,6 +1,7 @@
<?php
$kagi_token = FreshRSS_Context::$user_conf->kagi_token;
$kagi_language = FreshRSS_Context::$user_conf->kagi_language;
$kagi_custom_css = FreshRSS_Context::$user_conf->kagi_custom_css;
function printLanguageOption($lang, $selected) {
echo '<option ' . ($selected == $lang ? 'selected ' : '') . 'value="'. $lang . '">'
. _t('ext.kagiSummarizer.configure.lang.' . strtolower($lang == '' ? 'default' : $lang))
@ -54,6 +55,13 @@
</select>
</div>
</div>
<div class="form-group">
<label class="group-name" for="kagi_custom_css"><?php echo _t('ext.kagiSummarizer.configure.kagi_custom_css'); ?></label>
<div class="group-controls">
<input type="text" name="kagi_custom_css" id="kagi_custom_css" value="<?php echo $kagi_custom_css; ?>">
<p><small><?php echo _t('ext.kagiSummarizer.configure.kagi_custom_css_help'); ?></small></p>
</div>
</div>
<div class="form-group form-actions">
<div class="group-controls">
<button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button>

View file

@ -20,12 +20,14 @@ class KagiSummarizerExtension extends Minz_Extension {
}
FreshRSS_Context::$user_conf->kagi_token = $kagi_token;
FreshRSS_Context::$user_conf->kagi_language = Minz_Request::param('kagi_language', '');
FreshRSS_Context::$user_conf->kagi_custom_css = Minz_Request::param('kagi_custom_css', '');
FreshRSS_Context::$user_conf->save();
}
}
public function addSummarizeButton(FreshRSS_Entry $entry): FreshRSS_Entry {
$this->registerTranslates();
$custom_css = FreshRSS_Context::$user_conf->kagi_custom_css;
$url_summary = Minz_Url::display(array(
'c' => 'kagiSummarizer',
'a' => 'summarize',
@ -46,7 +48,7 @@ class KagiSummarizerExtension extends Minz_Extension {
. '<a class="btn" href="' . $url_key_moments . '">'
. _t('ext.kagiSummarizer.ui.key_moments_button') . '</a>'
. '<p class="kagi-status hidden alert"></p>'
. '<blockquote class="kagi-content hidden"></blockquote></div>'
. '<blockquote class="kagi-content hidden" data-css="' . $custom_css . '"></blockquote></div>'
. $entry->content());
return $entry;
}

View file

@ -6,6 +6,8 @@ return array(
'kagi_token' => 'Kagi Token',
'kagi_token_help' => 'Copy and paste the "Session Link" from your <a href="https://kagi.com/settings?p=user_details" target="_blank">Kagi Account</a> settings.',
'kagi_language' => 'Output Language',
'kagi_custom_css' => 'Custom CSS',
'kagi_custom_css_help' => 'Applied to the summary container element.',
'lang' => array(
'default' => 'Default',
'bg' => 'Bulgarian',

View file

@ -2,7 +2,7 @@
"name": "Kagi Summarizer",
"author": "Rudis Muiznieks",
"description": "Add buttons to summarize articles with the Kagi Universal Summarizer.",
"version": 0.2,
"version": 0.3,
"entrypoint": "KagiSummarizer",
"type": "user"
}

View file

@ -22,6 +22,7 @@ function configureSummarizeButtons() {
function setKagiState(container, statusType, statusMsg, summaryText) {
var kstatus = container.querySelector('.kagi-status');
var content = container.querySelector('.kagi-content');
content.style.cssText = content.dataset.css;
switch(statusType) {
case 0: