[BridgeCard] add example value to info hint and allow using it by right click (#3726)

This commit is contained in:
User123698745 2023-10-02 03:02:57 +02:00 committed by GitHub
parent 64582a64f1
commit 59dd49671d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View File

@ -177,9 +177,18 @@ This bridge is not fetching its content through a secure connection</div>';
$form .= self::getCheckboxInput($inputEntry, $idArg, $id);
}
$infoText = [];
$infoTextScript = '';
if (isset($inputEntry['title'])) {
$title_filtered = filter_var($inputEntry['title'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$form .= '<i class="info" title="' . $title_filtered . '">i</i>';
$infoText[] = filter_var($inputEntry['title'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
}
if ($inputEntry['exampleValue'] !== '') {
$infoText[] = "Example (right click to use):\n" . filter_var($inputEntry['exampleValue'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$infoTextScript = 'rssbridge_use_placeholder_value(this);';
}
if (count($infoText) > 0) {
$form .= '<i class="info" data-for="' . $idArg . '" title="' . implode("\n\n", $infoText) . '" oncontextmenu="' . $infoTextScript . 'return false">i</i>';
} else {
$form .= '<i class="no-info"></i>';
}

View File

@ -48,6 +48,12 @@ function rssbridge_toggle_bridge(){
}
}
function rssbridge_use_placeholder_value(sender) {
let inputId = sender.getAttribute('data-for');
let inputElement = document.getElementById(inputId);
inputElement.value = inputElement.getAttribute("placeholder");
}
var rssbridge_feed_finder = (function() {
/*
* Code for "Find feed by URL" feature