mirror of
https://github.com/chinchang/web-maker.git
synced 2025-02-23 22:53:18 +01:00
screenslog.js: Fix parent reference fixes #92
This commit is contained in:
parent
2879758ae0
commit
c044513e90
@ -1,20 +1,19 @@
|
|||||||
(function () {
|
(function() {
|
||||||
|
|
||||||
var logEl,
|
var logEl,
|
||||||
isInitialized = false,
|
isInitialized = false,
|
||||||
_console = {}; // backup console obj to contain references of overridden fns.
|
_console = {}; // backup console obj to contain references of overridden fns.
|
||||||
_options = {
|
_options = {
|
||||||
bgColor: 'black',
|
bgColor: 'black',
|
||||||
logColor: 'lightgreen',
|
logColor: 'lightgreen',
|
||||||
infoColor: 'blue',
|
infoColor: 'blue',
|
||||||
warnColor: 'orange',
|
warnColor: 'orange',
|
||||||
errorColor: 'red',
|
errorColor: 'red',
|
||||||
freeConsole: false,
|
freeConsole: false,
|
||||||
css: '',
|
css: '',
|
||||||
autoScroll: true,
|
autoScroll: true,
|
||||||
proxyCallback: null,
|
proxyCallback: null,
|
||||||
noUi: false
|
noUi: false
|
||||||
};
|
};
|
||||||
|
|
||||||
function createElement(tag, css) {
|
function createElement(tag, css) {
|
||||||
var element = document.createElement(tag);
|
var element = document.createElement(tag);
|
||||||
@ -23,7 +22,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createPanel() {
|
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);
|
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
|
||||||
|
);
|
||||||
return div;
|
return div;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,18 +175,19 @@
|
|||||||
destroy: checkInitDecorator(destroy)
|
destroy: checkInitDecorator(destroy)
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
var mainWindow = window.parent.onMessageFromConsole ? window.parent : window.parent.opener;
|
||||||
screenLog.init({
|
screenLog.init({
|
||||||
noUi: true,
|
noUi: true,
|
||||||
proxyCallback: function () {
|
proxyCallback: function () {
|
||||||
window.parent.onMessageFromConsole.apply(null, arguments);
|
mainWindow.onMessageFromConsole.apply(null, arguments);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
window._wmEvaluate = function _wmEvaluate(expr) {
|
window._wmEvaluate = function _wmEvaluate(expr) {
|
||||||
try {
|
try {
|
||||||
var result = eval(expr);
|
var result = eval(expr);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
window.parent.onMessageFromConsole.call(null, e);
|
mainWindow.onMessageFromConsole.call(null, e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
window.parent.onMessageFromConsole.call(null, result);
|
mainWindow.onMessageFromConsole.call(null, result);
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user