aboutsummaryrefslogtreecommitdiff
path: root/app/views/helpers/feed/update.phtml
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2024-10-13 15:28:45 +0200
committerGravatar GitHub <noreply@github.com> 2024-10-13 15:28:45 +0200
commitccb132523a4ee740d5b576574e9f44668021fbe6 (patch)
tree0b6977a345c56eff277abb0bc9199b0010f003a8 /app/views/helpers/feed/update.phtml
parent91624037c7d73eb545478aab2f8abc55fc224453 (diff)
New feed mode: HTML + XPath + JSON dot notation (JSON in HTML) (#6888)
* New feed mode: HTML + XPath + JSON dot notation (JSON in HTML) Same as `JSON+DotNotation` but first extracting the JSON string from an HTML document thanks to an XPath expression. Example: `//script[@type='application/json']` fix https://github.com/FreshRSS/FreshRSS/discussions/6876 * JavaScript UI to show/hide new field * Casing xPathToJson * Slight renaming
Diffstat (limited to 'app/views/helpers/feed/update.phtml')
-rw-r--r--app/views/helpers/feed/update.phtml14
1 files changed, 13 insertions, 1 deletions
diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml
index 5a14eff0f..780e9667a 100644
--- a/app/views/helpers/feed/update.phtml
+++ b/app/views/helpers/feed/update.phtml
@@ -416,7 +416,10 @@
<option value="<?= FreshRSS_Feed::KIND_HTML_XPATH ?>" <?= $this->feed->kind() === FreshRSS_Feed::KIND_HTML_XPATH ? 'selected="selected"' : '' ?> data-show="html_xpath"><?= _t('sub.feed.kind.html_xpath') ?></option>
<option value="<?= FreshRSS_Feed::KIND_XML_XPATH ?>" <?= $this->feed->kind() === FreshRSS_Feed::KIND_XML_XPATH ? 'selected="selected"' : '' ?> data-show="html_xpath"><?= _t('sub.feed.kind.xml_xpath') ?></option>
<option value="<?= FreshRSS_Feed::KIND_JSONFEED ?>" <?= $this->feed->kind() === FreshRSS_Feed::KIND_JSONFEED ? 'selected="selected"' : '' ?>><?= _t('sub.feed.kind.jsonfeed') ?></option>
- <option value="<?= FreshRSS_Feed::KIND_JSON_DOTNOTATION ?>" <?= $this->feed->kind() === FreshRSS_Feed::KIND_JSON_DOTNOTATION ? 'selected="selected"' : '' ?> data-show="json_dotnotation"><?= _t('sub.feed.kind.json_dotnotation') ?></option>
+ <option value="<?= FreshRSS_Feed::KIND_JSON_DOTNOTATION ?>" <?= $this->feed->kind() === FreshRSS_Feed::KIND_JSON_DOTNOTATION ? 'selected="selected"' : '' ?>
+ data-show="json_dotnotation"><?= _t('sub.feed.kind.json_dotnotation') ?></option>
+ <option value="<?= FreshRSS_Feed::KIND_HTML_XPATH_JSON_DOTNOTATION ?>" <?= $this->feed->kind() === FreshRSS_Feed::KIND_HTML_XPATH_JSON_DOTNOTATION ? 'selected="selected"' : '' ?>
+ data-show="json_dotnotation xPathToJsonGroup"><?= _t('sub.feed.kind.html_json') ?></option>
</select>
</div>
</div>
@@ -522,7 +525,16 @@
<?php
/** @var array<string,string> $jsonSettings */
$jsonSettings = Minz_Helper::htmlspecialchars_utf8($this->feed->attributeArray('json_dotnotation') ?? []);
+ $xPathToJson = Minz_Helper::htmlspecialchars_utf8($this->feed->attributeString('xPathToJson'));
?>
+ <div class="form-group" id="xPathToJsonGroup">
+ <label class="group-name" for="xPathToJson"><?= _t('sub.feed.kind.html_json.xpath') ?></label>
+ <div class="group-controls">
+ <textarea class="valid-xpath w100" name="xPathToJson" id="xPathToJson" rows="2" cols="64" spellcheck="false" data-leave-validation="<?= $xPathToJson ?>"><?= $xPathToJson ?? '' ?></textarea>
+ <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_json.xpath.help') ?></p>
+ </div>
+ </div>
+
<p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.json_dotnotation.help') ?></p>
<div class="form-group">
<label class="group-name" for="jsonItem"><small><?= _t('sub.feed.kind.json_dotnotation.json') ?></small><br />