Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions screenlog.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var logEl,
isInitialized = false,
_console = {}; // backup console obj to contain references of overridden fns.
_console = {}, // backup console obj to contain references of overridden fns.
_options = {
bgColor: 'black',
logColor: 'lightgreen',
Expand All @@ -11,7 +11,8 @@
errorColor: 'red',
freeConsole: false,
css: '',
autoScroll: true
autoScroll: true,
draggable: true
};

function createElement(tag, css) {
Expand All @@ -22,6 +23,17 @@

function createPanel() {
var div = createElement('div', 'z-index:2147483647;font-family:Helvetica,Arial,sans-serif;font-size:10px;font-weight:bold;padding:5px;text-align:left;opacity:0.8;position:fixed;right:0;top:0;min-width:200px;max-height:50vh;overflow:auto;background:' + _options.bgColor + ';' + _options.css);

if(_options.draggable) {
div.onmousedown = function(e) {
var offsetX = this.offsetLeft - e.clientX;
var offsetY = this.offsetTop - e.clientY;

this.onmousemove = function(e) { this.style.top = (e.clientY + offsetY) + "px"; this.style.right = (window.innerWidth - (e.clientX + offsetX + this.offsetWidth)) + "px"; };
};
div.onmouseup = function(e) { this.onmousemove = null; };
}

return div;
}

Expand Down