Comments (16)
credits by Darian Brown (http://www.thecave.info/) and modified by me.
version 1.00 final released! =)
Looking for code? Please look below.
from muximux.
People who want this are free to add it, so I wont close the issue for the time being - however, this is beyong the scope of Muximux itself so it will most likely not be included in the official repo.
from muximux.
ok this is like add-on for muximux =)
from muximux.
Why I've a scrollbar ? :(
from muximux.
@monsieurpouet >
same problem here: #49
SOLUTION: find <nav>
then replace with <nav style='overflow-y: hidden;'>
in muximux.php
Great news! very soon to update code with click to refresh on it =)
from muximux.
It must put ' instead of ".
If not, this don't work.
Like that:
Thanks for your answer :)
from muximux.
@monsieurpouet oops.. sorry =) i made code without testing.... I'm glad you like this feature.
from muximux.
Great news! very soon to update code with click to refresh on it =)
@alienx2 Thanks for your contribution to this project. Did you find a way to refresh the disk space information with a click?
from muximux.
@judhat2... yes im completed script for click to refresh but im about to release final version with 3 mode: timer, click and regular and i'm making easy to install this feature for everyone. stay tuned! =)
from muximux.
Thanks, good to hear!
from muximux.
Diskspace Monitor Add-on for Muximux Version 1.00 final
copy and paste code to notepad and save it as "diskspace.php" to where muximux installed folder.
How to Install?
(2 Steps only)
Edit index.php with any code editor or notepad and following:
-
Add this line after "
require 'muximux.php';
":
require('diskspace.php');
-
Insert this line to
<head> </head>
:
<?php echo insertscript('install'); ?>
Added Features:
- Mode: Click, Timer, Normal
- Text format
- Easy to Install for everyone. Just 2 lines only
- Easy to config
<?php
##########################################################
##########################################################
// Created by AlienX2 //
##########################################################
##########################################################
####### HOW TO INSTALL ###################################
# * Add to index.php after "require 'muximux.php';": #
# require('diskspace.php'); #
# #
# * Add to index.php in <head> </head>: #
/* <?php echo insertscript('install'); ?> */
# #
##########################################################
##########################################################
###### SETTINGS ##########################################
#
# // 'click' = click to refresh;
# // 'time' = refresh per time;
# // 'none' = nothing, just reload page.
$mode = 'none';
#
# // 'percent' = percent of how big used of space;
# // 'ut' = Used space / Total Space;
# // 'ft' = Free space / Total Space;
# // 'free' = Free space of size;
$textbar_type = 'ft';
#
# // Required: $mode='time';
# // xxxx seconds
# // e.g. '60' seconds = 1 minute; '300' seconds = 5 mins; '900' seconds = 15mins;
$time = '5';
#
# // drive path in '' . e.g. 'd:/' or '/mnt/DownloadHDD'
$monitor_path = '/mnt/LinuxHOME';
#
##########################################################
if(isset($_GET['diskspace'])) {
echo progressbar('update');
//echo 'hello';
return;
}
if(isset($_GET['percentofspace'])) {
echo progressbar('dp').'%';
return;
}
if(isset($_GET['html'])) {
echo progressbar('html');
return;
}
function insertscript($type) {
global $mode;
global $time;
if($type=='install') {
$insertcode = "<script src='//code.jquery.com/jquery-1.12.0.min.js'></script><style type='text/css'>
.diskspace {
height:35px;
float: right !important;
margin-right: 5px;
margin-top: 3px;
}
.progress {
/* background: #747B8B;*/
background:none;
border: 2px solid #747B8B;
height: 32px;
width: 120px;
}
.progress .prgbar {
position: relative;
height: 32px;
z-index: 999;
}
.prgbar {
background:#f5f5f5 !important;
}
.progress .prgtext {
color: gray;
text-align: center;
font-size: 13px;
padding: 6px 0 0;
width: 120px;
position: absolute;
z-index: 1000;
text-shadow: 1px 1px #747B8B;
}
.progress .prginfo {
margin: 3px 0;
}
</style>
";
if ($mode == 'time') {
$insertcode .= "
<script>
$(document).ready(function() {
$('".'<li class="diskspace" style="cursor:default !important;"></li>'."').insertBefore( 'ul.cd-tabs-navigation nav li:last-child' );
$.get('diskspace.php?html', function(data){
$('li.diskspace').html(data);
});
$.get('diskspace.php?percentofspace', function(data){
$('.progress .prgbar').width(data);
});
});
</script>
<script>
var refresh = setInterval(
function (){
$.get('diskspace.php?percentofspace', function(data){
$('.progress .prgbar').width(data);
});
$.get('diskspace.php?percentofspace', function(data){
$('.progress .prgbar').width(data);
});
$('div.prgtext').load('diskspace.php?diskspace');
}, ".convertmilliseconds($time).");
</script>
";
} else if ($mode == 'click') {
$insertcode .= "<script>
$(document).ready(function() {
$('".'<li class="diskspace"></li>'."').insertBefore( 'ul.cd-tabs-navigation nav li:last-child' );
$.get('diskspace.php?html', function(data){
$('li.diskspace').html(data);
});
$.get('diskspace.php?percentofspace', function(data){
$('.progress .prgbar').width(data);
});
$('.diskspace').click(function() {
$.get('diskspace.php?percentofspace', function(data){
$('.progress .prgbar').width(data);
});
$('.diskspace div.prgtext').load('diskspace.php?diskspace');
});
});
</script>";
} else { $insertcode .= "<script>
$(document).ready(function() {
$('".'<li class="diskspace" style="cursor:default !important;"></li>'."').insertBefore( 'ul.cd-tabs-navigation nav li:last-child' );
$.get('diskspace.php?html', function(data){
$('li.diskspace').html(data);
});
$.get('diskspace.php?percentofspace', function(data){
$('.progress .prgbar').width(data);
});
});
</script>
"; }
return $insertcode;
}
}
function convertmilliseconds ($seconds) {
return $seconds * 1000;
}
function progressbar($request = '') {
global $monitor_path;
global $textbar_type;
$dfree = disk_free_space($monitor_path);
$dt = disk_total_space($monitor_path);
$du = $dt - $dfree;
$dp = sprintf('%.2f',($du / $dt) * 100);
$df = HumanSize($dfree);
$dt = HumanSize($dt);
$du = HumanSize($du);
if($textbar_type == 'percent') {
$data = $dp.' %';
} else if($textbar_type == 'ut') {
$data = $du." / ".$dt;
} else if($textbar_type == 'ft') {
$data = $df." / ".$dt;
} else if($textbar_type == 'free') {
$data = HumanSize($dfree, 2).' left';
} else {
$data = 'ERROR: $textbar_type is missing!';
}
if($request == 'dp') {
return $dp;
} else if ($request == "update") {
return $data;
//return $df .'/'. $dt;
} else if ($request == "html") {
return
'<div class="progress">
<div class="prgtext">'.$data.'</div><div class="prgbar"></div><div class="prginfo">
</div></div>';
}
}
function HumanSize($bytes, $digit = 1)
{
$types = array( 'B', 'KB', 'MB', 'GB', 'TB' );
for( $i = 0; $bytes >= 1024 && $i < ( count( $types ) -1 ); $bytes /= 1024, $i++ );
return( round( $bytes, $digit ) . " " . $types[$i] );
}
?>
from muximux.
@judhat2 @monsieurpouet i just release code. Grab it =) Don't forget to install fresh muximux.
from muximux.
@alienx2 Nice job! FYI, you're inserting an instance of jQuery, when Muximux itself already loads jQuery. This creates a javascript conflict, so perhaps you could make it work with the bundled jquery version?
from muximux.
@mescon Thanks =) and i tried tested it not working without add jQuery. that's why i added.
from muximux.
@mescon i found you put jquery in index.php but very bottom instead of put in <head></head>
... it didnt work with my code? even also jquery wont work?
from muximux.
@alienx2 All javascript is at the bottom for performance reasons. Read more here: https://developer.yahoo.com/performance/rules.html#js_bottom=
from muximux.
Related Issues (20)
- Muximux hangs forever
- Disable updates by adding override file
- multi-user config selection HOT 2
- Keyboard focus on guacamole
- Requesting http instead of https HOT 1
- Project Abandoned? HOT 3
- Settings.ini.php error HOT 4
- IMDB list is not syncing HOT 1
- Composer problem HOT 1
- Unable to connect to Sabnzbd HOT 3
- Muximux docker cert error HOT 1
- Home icon missing in Splash screen
- Question: Which URL should I be using? HOT 2
- Plex in Muximux not working HOT 1
- Add overseerr icon
- Muximux tries to load assets from root instead of subdirectory
- Manually input colour values?
- Reduce padding left and right of app icons
- settings.ini.php corruption HOT 2
- Docker image by linuxserver deprecated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from muximux.