Favorites: hide item when no favorites are present

This commit is contained in:
bergware
2024-01-03 12:14:21 +01:00
parent 0d2690abd1
commit 25340cc3be
+7 -7
View File
@@ -1,6 +1,7 @@
Menu="Tasks:2"
Type="xmenu"
Code="e970"
Code="f08a"
Cond="@filesize('/boot/config/favorites.cfg')"
---
<script>
function delPage(page) {
@@ -8,12 +9,11 @@ function delPage(page) {
}
$(function(){
$('i.PanelIcon').each(function(){
var icon = $(this);
var page = icon.closest('a').prop('href').split('/').pop();
icon.after('<i class="fa fa-heartbeat favo" title="_(Remove from favorites)_" onclick="delPage(&quot;'+page+'&quot;);return false"></i>');
icon.parent().parent().parent().hover(function(){icon.next().show();},function(){icon.next().hide();});
$('div.Panel').each(function(){
var page = $(this).find('a').prop('href').split('/').pop();
$(this).find('span').append('<i class="fa fa-heartbeat favo" title="_(Remove from favorites)_" onclick="delPage(&quot;'+page+'&quot;);return false"></i>');
$(this).hover(function(){$(this).find('i.favo').show();},function(){$(this).find('i.favo').hide();});
});
if ($('i.PanelIcon').length==0) $('#nofavs').show();
if ($('div.Panel').length==0) $('#nofavs').show();
});
</script>