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-debug__js__dom__DConsole.js
/*** module: node_modules/absol-debug/js/dom/DConsole.js ***/
"use strict";

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

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

var _Core = _interopRequireDefault(require("./Core"));

require("./DString");

var _EventEmitter = _interopRequireDefault(require("absol/src/HTML5/EventEmitter"));

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


var _ = _Core.default._;
var $ = _Core.default.$;

function DConsole() {}

DConsole.tag = 'dconsole';

DConsole.render = function () {
  return _('div.ad-console');
};

DConsole.prototype._makeEventObject = function (event) {
  var eventObj = _EventEmitter.default.eventProperties.reduce(function (ac, key) {
    var value = event[key];

    if (value !== undefined) {
      ac[key] = value;
    }

    return ac;
  }, {});

  Object.assign(eventObj, event);
  return eventObj;
}; //simple with text


DConsole.prototype._makeViewOf = function (value) {
  if (value === undefined) {
    value = 'undefined';
  } else if (value === null) {
    value = "null";
  } else if (typeof value == 'string') {} else if (value.type && value.target) {
    value = JSON.stringify(this._makeEventObject(value), null, 4);
  } else {
    value = JSON.stringify(value, null, 4);
  }

  return _({
    tag: 'dstring',
    props: {
      value: value
    }
  });
};

DConsole.prototype._autoScrollIfNeed = function () {
  var thisDC = this;

  if (this.offsetHeight + this.scrollTop >= this.scrollHeight - 20) {
    setTimeout(function () {
      thisDC.scrollTop = thisDC.scrollHeight;
    }, 10);
  }
};

DConsole.prototype.showError = function (error) {
  this._autoScrollIfNeed();

  var logGroup = _({
    class: 'ad-log-error',
    child: [{
      tag: 'span',
      class: 'ad-log-error-message',
      child: {
        text: error.message + ''
      }
    }, {
      tag: "span",
      class: 'ad-log-error-at',
      child: {
        text: ' at ' + error.filename + '<' + error.lineno + ':' + error.colno + '>'
      }
    }, {
      class: 'ad-log-error-stack',
      tag: 'div',
      style: {
        display: 'none'
      },
      child: {
        text: error.stack
      }
    }]
  });

  var displayStack = false;
  var stackElt = $('.ad-log-error-stack', logGroup);
  logGroup.on('click', function () {
    displayStack = !displayStack;

    if (displayStack) {
      stackElt.removeStyle('display');
    } else {
      stackElt.addStyle('display', 'none');
    }
  });
  this.addChild(logGroup);
};

DConsole.prototype.log = function () {
  this._autoScrollIfNeed();

  var logGroup = _('.ad-log-group');

  for (var i = 0; i < arguments.length; ++i) {
    logGroup.addChild(this._makeViewOf(arguments[i]));
  }

  this.addChild(logGroup);
};

DConsole.$elt = null;

DConsole.auto = function () {
  if (this.$elt) return;

  var $elt = _({
    tag: 'dconsole',
    class: 'ad-standard-alone'
  });

  this.$shareInstance = $elt;
  console['l' + 'og'] = $elt.log.bind($elt);
  window.addEventListener('error', function (event) {
    $elt.showError({
      lineno: event.lineno,
      colno: event.colno,
      filename: event.source || event.filename,
      stack: event.error.stack,
      message: event.message
    });
  });
  var show = true;

  var $toggleBtn = _({
    tag: 'button',
    class: 'ad-console-toggle',
    child: 'span.mdi.mdi-console',
    on: {
      click: function () {
        show = !show;

        if (show) {
          $elt.removeStyle('display');
        } else {
          $elt.addStyle('display', 'none');
        }
      }
    }
  });

  _Dom.default.documentReady.then(function () {
    $elt.addTo(document.body);
    $toggleBtn.addTo(document.body);
  });
};

_Core.default.install(DConsole);

var _default = DConsole;
exports.default = _default;

VaKeR 2022