From 59dd49671d4b301f64cc1299c3156f6a31d5fd00 Mon Sep 17 00:00:00 2001 From: User123698745 Date: Mon, 2 Oct 2023 03:02:57 +0200 Subject: [PATCH] [BridgeCard] add example value to info hint and allow using it by right click (#3726) --- lib/BridgeCard.php | 13 +++++++++++-- static/rss-bridge.js | 6 ++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/BridgeCard.php b/lib/BridgeCard.php index b2fda192..4781ebc1 100644 --- a/lib/BridgeCard.php +++ b/lib/BridgeCard.php @@ -177,9 +177,18 @@ This bridge is not fetching its content through a secure connection'; $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'; + $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'; } else { $form .= ''; } diff --git a/static/rss-bridge.js b/static/rss-bridge.js index 2c45294c..b9b466d6 100644 --- a/static/rss-bridge.js +++ b/static/rss-bridge.js @@ -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