Skip to content

Commit 59dd496

Browse files
[BridgeCard] add example value to info hint and allow using it by right click (RSS-Bridge#3726)
1 parent 64582a6 commit 59dd496

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

lib/BridgeCard.php

+11-2
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,18 @@ private static function getForm(
177177
$form .= self::getCheckboxInput($inputEntry, $idArg, $id);
178178
}
179179

180+
$infoText = [];
181+
$infoTextScript = '';
180182
if (isset($inputEntry['title'])) {
181-
$title_filtered = filter_var($inputEntry['title'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
182-
$form .= '<i class="info" title="' . $title_filtered . '">i</i>';
183+
$infoText[] = filter_var($inputEntry['title'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
184+
}
185+
if ($inputEntry['exampleValue'] !== '') {
186+
$infoText[] = "Example (right click to use):\n" . filter_var($inputEntry['exampleValue'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
187+
$infoTextScript = 'rssbridge_use_placeholder_value(this);';
188+
}
189+
190+
if (count($infoText) > 0) {
191+
$form .= '<i class="info" data-for="' . $idArg . '" title="' . implode("\n\n", $infoText) . '" oncontextmenu="' . $infoTextScript . 'return false">i</i>';
183192
} else {
184193
$form .= '<i class="no-info"></i>';
185194
}

static/rss-bridge.js

+6
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ function rssbridge_toggle_bridge(){
4848
}
4949
}
5050

51+
function rssbridge_use_placeholder_value(sender) {
52+
let inputId = sender.getAttribute('data-for');
53+
let inputElement = document.getElementById(inputId);
54+
inputElement.value = inputElement.getAttribute("placeholder");
55+
}
56+
5157
var rssbridge_feed_finder = (function() {
5258
/*
5359
* Code for "Find feed by URL" feature

0 commit comments

Comments
 (0)