mirror of
https://github.com/unraid/webgui.git
synced 2026-04-23 18:48:49 -05:00
Merge pull request #1571 from bergware/master
Favorites: fixes and enhancements
This commit is contained in:
@@ -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("'+page+'");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("'+page+'");return false"></i>');
|
||||
$(this).hover(function(){$(this).find('i.favo').show();},function(){$(this).find('i.favo').hide();});
|
||||
});
|
||||
if ($('i.PanelIcon').length==0) $('#nofavs').show();
|
||||
$.post('/webGui/include/MyFavorites.php',{action:'clear'},function(){if ($('div.Panel').length==0) $('#nofavs').show();});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Menu="Favorites"
|
||||
Type="menu"
|
||||
Title="My Favorites"
|
||||
Tag="icon-u-star"
|
||||
Tag="heart"
|
||||
---
|
||||
<div id="nofavs" style="display:none;width:100%"><center>_(No favorites available)_</center></div>
|
||||
|
||||
@@ -6,16 +6,15 @@ Code="e924"
|
||||
<script>
|
||||
function addPage(page) {
|
||||
$.post('/webGui/include/MyFavorites.php',{action:'add',page:page},function(){
|
||||
swal({title:"_(Added to Favorites)_",text:"",type:"success",html:true,confirmButtonText:"_(Ok)_"});
|
||||
swal({title:"_(Added to Favorites)_",text:"",type:"success",html:true,confirmButtonText:"_(Ok)_"},function(x){refresh();});
|
||||
});
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$('i.PanelIcon').each(function(){
|
||||
var icon = $(this);
|
||||
var page = icon.closest('a').prop('href').split('/').pop();
|
||||
icon.after('<i class="fa fa-heart favo" title="_(Add to favorites)_" onclick="addPage("'+page+'");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-heart favo" title="_(Add to favorites)_" onclick="addPage("'+page+'");return false"></i>');
|
||||
$(this).hover(function(){$(this).find('i.favo').show();},function(){$(this).find('i.favo').hide();});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -6,16 +6,15 @@ Code="e909"
|
||||
<script>
|
||||
function addPage(page) {
|
||||
$.post('/webGui/include/MyFavorites.php',{action:'add',page:page},function(){
|
||||
swal({title:"_(Added to Favorites)_",text:"",type:"success",html:true,confirmButtonText:"_(Ok)_"});
|
||||
swal({title:"_(Added to Favorites)_",text:"",type:"success",html:true,confirmButtonText:"_(Ok)_"},function(x){refresh();});
|
||||
});
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$('i.PanelIcon').each(function(){
|
||||
var icon = $(this);
|
||||
var page = icon.closest('a').prop('href').split('/').pop();
|
||||
icon.after('<i class="fa fa-heart favo" title="_(Add to favorites)_" onclick="addPage("'+page+'");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-heart favo" title="_(Add to favorites)_" onclick="addPage("'+page+'");return false"></i>');
|
||||
$(this).hover(function(){$(this).find('i.favo').show();},function(){$(this).find('i.favo').hide();});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -14,10 +14,21 @@
|
||||
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
|
||||
$permit = ['del','add'];
|
||||
$action = $_POST['action']??'';
|
||||
$page = glob("$docroot/plugins/*/{$_POST['page']}.page",GLOB_NOSORT)[0];
|
||||
$cfg = '/boot/config/favorites.cfg';
|
||||
|
||||
// remove non-existing pages
|
||||
if ($action=='clear') {
|
||||
if (file_exists($cfg)) foreach (file($cfg,FILE_IGNORE_NEW_LINES) as $page) {
|
||||
if (!file_exists($page)) {
|
||||
$page = str_replace('/','\/',$page);
|
||||
exec("sed -i '/$page/d' $cfg 2>/dev/null");
|
||||
}
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
// validate input
|
||||
$page = glob("$docroot/plugins/*/{$_POST['page']}.page",GLOB_NOSORT)[0];
|
||||
if (!$page || !in_array($action,$permit)) exit;
|
||||
|
||||
$file = fopen($page,'r');
|
||||
|
||||
@@ -54,7 +54,7 @@ i[class^="icon-u-"]{font-size:inherit}
|
||||
i#mycase[class^="case-"]{font-size:128px}
|
||||
i#mycase[class^="fa "]{font-size:96px}
|
||||
a.cpu_close,span.hand{cursor:pointer;z-index:1001}
|
||||
a.info{white-space:normal;word-spacing:92px;word-break:break-all}
|
||||
a.info{white-space:normal;word-spacing:100px;word-break:break-word}
|
||||
a.info span{word-spacing:normal}
|
||||
tr#var0,tr#var1,tr#var2,tr#var3,tr#var4{cursor:alias}
|
||||
tr#var1,tr#var4,tr#cpu_chart,.cpu_open{display:none}
|
||||
|
||||
Reference in New Issue
Block a user