Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 18.217.185.57
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/2/task/2/cwd/usr/lib/node_modules/pm2/node_modules/pm2-multimeter/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/2/task/2/cwd/usr/lib/node_modules/pm2/node_modules/pm2-multimeter/lib/bar.js
var Bar = module.exports = function (charm, x, y, params) {
    this.charm = charm;
    this.x = x;
    this.y = y;
    this.width = params.width || 10;
    this.offset = params.offset || 0;
    
    this.before = params.before || '[';
    this.after = params.after || '] ';
    
    this.solid = params.solid || {
        background : 'blue',
        foreground : 'white',
        text : '|'
    };
    
    this.empty = params.empty || {
        background : null,
        foreground : null,
        text : ' '
    };
    
    this.progress = {
        percent : 0,
        ratio : 0
    };
}

Bar.prototype.draw = function (bars, msg) {
    bars = Math.floor(bars);
    this.charm.push(true);
    
    if (this.y.toString().match(/^[+-]/)) {
        if (this.y.toString().match(/^-/)) {
            this.charm.up(-this.y + this.offset);
        }
        else if (this.y.toString().match(/^\+/)) {
            this.charm.down(+this.y - this.offset);
        }
        this.charm.column(+this.x);
    }
    else {
        this.charm.position(this.x, this.y);
    }
    
    this.charm.write(this.before);
    
    if (this.solid.background) {
        this.charm.background(this.solid.background);
    }
    if (this.solid.foreground) {
        this.charm.foreground(this.solid.foreground);
    }
    
    this.charm
        .write(Array(bars + 1).join(this.solid.text))
        .display('reset')
    ;
    
    if (this.empty.background) {
        this.charm.background(this.empty.background);
    }
    if (this.empty.foreground) {
        this.charm.foreground(this.empty.foreground);
    }
    
    this.charm
        .write(Array(this.width - bars + 1).join(this.empty.text))
        .write(this.after + msg)
    ;
    
    this.charm.pop(true);
    
    return this;
};

Bar.prototype.percent = function (p, msg) {
    if (p === undefined) {
        return this.progress.percent;
    }
    else {
        p = Math.min(100, p);
        this.progress.percent = p;
        this.progress.ratio = [ p, 100 ];
        
        this.draw(
            this.width * p / 100,
            msg || (Math.floor(p) + ' %')
        );
        
        return this;
    }
};

Bar.prototype.ratio = function (n, d, msg) {
    if (n === undefined && d === undefined) {
        return this.progress.ratio;
    }
    else {
        var f = n / d;
        this.progress.ratio = [ n, d ];
        this.progress.percent = f * 100;
        
        this.draw(
            this.width * f,
            msg || (n + ' / ' + d)
        );
        
        return this;
    }
};

Anon7 - 2022
AnonSec Team