VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
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,
Directory :  /var/www/html/libs/absol-full/dist/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/libs/absol-full/dist/js/mdls__absol-acomp__js__CPUViewer.js
/*** module: node_modules/absol-acomp/js/CPUViewer.js ***/
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _ACore = _interopRequireWildcard(require("../ACore"));

var _Dom = _interopRequireDefault(require("absol/src/HTML5/Dom"));

require("../css/cpuviewer.css");




/***
 * @extends AElement
 * @constructor
 */
function CPUViewer() {
  /***
   *
   * @type {HTMLCanvasElement}
   */
  this.$canvas = (0, _ACore.$)('canvas', this);
  this.ctx = this.$canvas.getContext('2d');
  this.offsetTime = 0;
  this.inv = -1;
  this.usage = Array(120).fill(0);
  this.holdStart = 0;
  this.holdTime = 0;
  this.logOffset = 0;
  this.counter = 0;
  this['tick'] = this.tick.bind(this);
}

CPUViewer.tag = 'CPUViewer'.toLowerCase();

CPUViewer.render = function () {
  return (0, _ACore._)({
    class: 'as-cpu-viewer',
    child: {
      tag: 'canvas',
      attr: {
        width: '120px',
        height: '50px'
      }
    }
  });
};

CPUViewer.prototype.start = function () {
  if (this.inv < 0) {
    this.offsetTime = new Date().getTime();
    setInterval(this.tick, 250);
  }
};

CPUViewer.prototype.stop = function () {
  if (this.inv > 0) {
    clearInterval(this.inv);
    this.inv = -1;
  }
};

CPUViewer.prototype.tick = function () {
  while (this.holdTime > 250) {
    this.holdTime -= 250;
    this.usage.push(100);
  }

  this.usage.push(this.holdTime * 100 / 250);

  while (this.usage.length > 120) {
    this.usage.shift();
  }

  this.ctx.fillStyle = 'black';
  this.ctx.fillRect(0, 0, 120, 50);
  var y;
  this.ctx.fillStyle = 'yellow';

  for (var x = 0; x < this.usage.length; ++x) {
    y = this.usage[x] / 2;
    this.ctx.fillRect(x, 50 - y, 1, y);
  }

  var now = new Date().getTime();
  this.logOffset = now;
  this.holdStart = now;
  this.holdTime = 0;
};

CPUViewer.prototype.hold = function () {
  if (this.counter === 0) {
    this.holdStart = new Date().getTime();
  }

  this.counter++;
};

CPUViewer.prototype.release = function () {
  if (this.counter <= 0) return;
  this.counter--;

  if (this.counter === 0) {
    this.holdTime += new Date().getTime() - this.holdStart;
  }
};
/***
 *
 * @type {CPUViewer}
 */


CPUViewer.instance = null;
CPUViewer.state = 'NOT_INIT';

CPUViewer.start = function () {
  if (!this.instance) {
    this.instance = (0, _ACore._)('cpuviewer');
    this.state = "NOT_ATTACHED";
  }

  if (this.state === "NOT_ATTACHED") {
    this.state = "RUNNING";

    _Dom.default.documentReady.then(function () {
      document.body.appendChild(this.instance);
    }.bind(this));
  }

  this.instance.start();

  CPUViewer.hold = function () {
    this.instance.hold();
  };

  CPUViewer.release = function () {
    this.instance.release();
  };
};

CPUViewer.stop = function () {
  if (!this.instance) return;
  if (this.state !== "RUNNING") return;
  this.instance.stop();
  this.instance.remove();
  this.state = 'NOT_ATTACHED';
};

CPUViewer.hold = function () {};

CPUViewer.release = function () {};

_ACore.default.install(CPUViewer);

var _default = CPUViewer;
exports.default = _default;

function AttachHookView() {}

_Dom.default.documentReady.then(() => {
  return;

  if (!window.ABSOL_DEBUG && location.href.indexOf('localhost') < 0) {
    return;
  }

  var elt = (0, _ACore._)({
    class: 'as-pending-attachhook-count'
  }).addTo(document.body);
  setInterval(() => {
    elt.innerHTML = '' + Object.keys(pendingAttachHooks).length;
  }, 2000);
});

VaKeR 2022