added a custom css config for summary content

This commit is contained in:
Rudis Muiznieks 2024-09-25 14:24:23 -05:00
parent 093471cda7
commit 6070cdfda0
Signed by: rudism
GPG Key ID: CABF2F86EF7884F9
3 changed files with 14 additions and 1 deletions

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,11 +20,13 @@ 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 {
$custom_css = $this->getUserConfigurationValue('kagi_custom_css');
$this->registerTranslates();
$url_summary = Minz_Url::display(array(
'c' => 'kagiSummarizer',
@ -46,7 +48,8 @@ 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" style="' . $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',