More preparation for persistent cookies

This commit is contained in:
Matthew Exon 2019-07-21 19:32:30 +01:00 committed by Matthew Exon
parent b11d820fb5
commit 98c8001be1
2 changed files with 29 additions and 7 deletions

View file

@ -587,7 +587,7 @@ function retriever_content($a) {
if (!empty($_POST["id"])) {
$retriever = get_retriever($a->argv[1], local_user(), true);
$retriever["data"] = array();
foreach (array('pattern', 'replace', 'enable', 'images', 'customxslt') as $setting) {
foreach (array('pattern', 'replace', 'enable', 'images', 'customxslt', 'storecookies', 'cookiedata') as $setting) {
if (!empty($_POST['retriever_' . $setting])) {
$retriever["data"][$setting] = $_POST['retriever_' . $setting];
}
@ -643,11 +643,16 @@ function retriever_content($a) {
L10n::t('Retrospectively Apply'),
'0',
L10n::t('Reapply the rules to this number of posts')),
'$cookies' => array(
'retriever_cookies',
L10n::t('Cookies'),
$retriever['data']['cookies'],
L10n::t("Persistent cookies for this feed. Netscape cookie file format.")),
'storecookies' => array(
'retriever_storecookies',
L10n::t('Store cookies'),
$retriever['data']['storecookies'],
L10n::t("Preserve cookie data across fetches.")),
'$cookiedata' => array(
'retriever_cookiedata',
L10n::t('Cookie Data'),
$retriever['data']['cookiedata'],
L10n::t("Latest cookie data for this feed. Netscape cookie file format.")),
'$customxslt' => array(
'retriever_customxslt',
L10n::t('Custom XSLT'),

View file

@ -40,6 +40,22 @@ function retriever_remove_row(id, number)
var row = document.getElementById(id + '-' + number);
tbody.removeChild(row);
}
function retriever_toggle_cookiedata_block()
{
var div = document.querySelector("#id_retriever_cookiedata").parentNode;
if (document.querySelector("#id_retriever_storecookies").checked) {
div.style.display = "block";
}
else {
div.style.display = "none";
}
}
document.addEventListener('DOMContentLoaded', function() {
retriever_toggle_cookiedata_block();
document.querySelector("#id_retriever_storecookies").addEventListener('change', retriever_toggle_cookiedata_block, false);
}, false);
</script>
<h2>{{$title}}</h2>
<p><a href="{{$help}}">{{$help_t}}</a></p>
@ -106,8 +122,9 @@ function retriever_remove_row(id, number)
</table>
<input type="button" onclick="retriever_add_row('retriever-exclude')" value="{{$add_t}}">
</div>
{{include file="field_textarea.tpl" field=$cookies}}
{{include file="field_textarea.tpl" field=$customxslt}}
{{include file="field_checkbox.tpl" field=$storecookies}}
{{include file="field_textarea.tpl" field=$cookiedata}}
<input type="submit" size="70" value="{{$submit_t}}">
</form>
</div>