Support inline searching for items in <Requires>

This commit is contained in:
Squidly271 2022-02-05 11:47:00 -05:00
parent 288522ad6e
commit b56adb18a1
6 changed files with 36 additions and 7 deletions

View File

@ -892,6 +892,11 @@ function myCloseAlert() {
enableSearch();
}
function doSidebarSearch(newSearch) {
closeSidebar();
doSearch(false,newSearch);
}
function doSearch(button,newSearch) {
if ( data.searchInProgress )
return;

View File

@ -1,9 +1,9 @@
333d17e796611bb83591a16927b9e2f4 ./Apps.page
f61e702efe387f35cccab36ac39bc16c ./Apps.page
4e55f7483b661af21a25b677179baffe ./CA_notices.page
c7c6da0a4a4a7ac33f387ea178319bae ./ca_settings.page
ed2883d6c44c19304c431079596a1731 ./default.cfg
800135166b003221870a39d78f2b2e9e ./include/exec.php
ca00c01cbdf0a3ea5df05df23627d57c ./include/helpers.php
2c1babf5b937925bb47dce1b0566c25d ./include/helpers.php
d827ebdf8c29aa6a9818df043a37721e ./include/paths.php
532fffdf939594c143e679da02bd841e ./javascript/libraries.js
b398273cf7daa62ab00d2de2336ca25f ./README.md
@ -19,6 +19,6 @@ a1401a0bed89c182b69f0c7508282c1f ./scripts/pluginInstall.php
36556fb8fcd17118600d3d226c50567d ./scripts/showStatistics.php
4425f8fd4ef662a7dc65cee01de3e419 ./scripts/updatePLG.sh
34554a56611dfe625889c82afd5138de ./scripts/updatePluginSupport.php
c24d0b89815a4416b56b5b963c46984b ./skins/Narrow/css.php
549fb44e30554bfba0a6ead71ececa65 ./skins/Narrow/css.php
7d827147dc8ede3d518b2cacae1d385b ./skins/Narrow/skin.html
c69e2c5533cc5e1fdee740bd01f13659 ./skins/Narrow/skin.php
94c43c2253078ad18bd088f1114f4852 ./skins/Narrow/skin.php

View File

@ -254,6 +254,13 @@ function makeXML($template) {
fixAttributes($template,"Network");
fixAttributes($template,"Config");
# Sanitize the Requires entry if there is any CA links within it
preg_match_all("/\/\/(.*?)&#92;/m",$template['Requires'],$searchMatches);
if ( count($searchMatches[1]) ) {
foreach ($searchMatches[1] as $searchResult) {
$template['Requires'] = str_replace("//$searchResult\\\\",$searchResult,$template['Requires']);
}
}
$Array2XML = new Array2XML();
$xml = $Array2XML->createXML("Container",$template);
return $xml->saveXML();

View File

@ -297,6 +297,11 @@ input[type=button]{background:none;font-size:1.5rem;}
input:hover[type=button]{color:<?=$unRaid66color?>;background:none !important;}
input:hover[type=button][disabled]{background:none !important;color:currentColor !important;font-size:1.5rem;}
input[type=button][disabled]{background:none;}
.linkButton{color:<?=$supportPopupText?>!important;background: <?=$supportPopupBackground?>;background: -webkit-linear-gradient(top, transparent 0%, rgba(0,0,0,0.4) 100%),-webkit-linear-gradient(left, lighten(<?=$donateBackground?>, 15%) 0%, <?=$donateBackground?> 50%, lighten(<?=$donateBackground?>, 15%) 100%); background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.4) 100%),linear-gradient(to right, lighten(#E68321, 15%) 0%, #E68321 50%, lighten(#E68321, 15%) 100%); background-position: 0 0; background-size: 200% 100%; border-radius: 15px; color: #000000; padding: 1px 10px 1px 10px;}
.linkButton:hover{text-decoration:none;background-color:<?=$unRaid66color?>;}
.linkButton a{text-decoration:none;color:<?=$supportPopupText?>}
.mainArea{position:absolute;left:18.5rem;right:0px;top:2rem;display:block;overflow-x:hidden;min-height:90vh;}
.menuHeader{ font-size:2rem; margin-bottom:1rem;margin-top:1rem;}
.menuItems{position:absolute;top:2rem;left:0px;width:14rem;height:auto;}

View File

@ -186,8 +186,16 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
$buttonTitle = $template['InstallPath'] ? tr("Reinstall") : tr("Install");
if ( ! $template['InstallPath'] ) {
$installComment = $template['CAComment'];
if ( ! $installComment && $template['Requires'] )
if ( ! $installComment && $template['Requires'] ){
// Remove the flags to indicate a search taking place
preg_match_all("/\/\/(.*?)\\\\/m",$template['Requires'],$searchMatches);
if ( count($searchMatches[1]) ) {
foreach ($searchMatches[1] as $searchResult) {
$template['Requires'] = str_replace("//$searchResult\\\\",$searchResult,$template['Requires']);
}
}
$installComment = tr("This application has additional requirements")."<br>".markdown($template['Requires']);
}
}
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>$buttonTitle,"action"=>"installPlugin('{$template['PluginURL']}','','".str_replace(" ","&#32",htmlspecialchars($installComment))."');");
if ( $template['InstallPath'] ) {
@ -459,7 +467,6 @@ function getPopupDescriptionSkin($appNumber) {
rsort($allTrends);
$trendRank = array_search($template['trending'],$allTrends) + 1;
}
$template['Category'] = categoryList($template['Category'],true);
$template['Icon'] = $template['Icon'] ? $template['Icon'] : "/plugins/dynamix.docker.manager/images/question.png";
if ( $template['Overview'] )
@ -504,8 +511,13 @@ function getPopupDescriptionSkin($appNumber) {
if ( $template['Requires'] ) {
$template['Requires'] = Markdown(strip_tags(str_replace(["\r","\n","&#xD;"],["","<br>",""],trim($template['Requires'])),"<br>"));
preg_match_all("/\/\/(.*?)&#92;/m",$template['Requires'],$searchMatches);
if ( count($searchMatches[1]) ) {
foreach ($searchMatches[1] as $searchResult) {
$template['Requires'] = str_replace("//$searchResult&#92;","<a style='cursor:pointer;' onclick='doSidebarSearch(&quot;$searchResult&quot;);'>$searchResult</a>",$template['Requires']);
}
}
}
$actionsContext = [];
if ( ! $template['Language'] ) {
if ( ! $template['NoInstall'] && ! $caSettings['NoInstalls']) {