/ ‘grepolis.user.js’

This commit is contained in:
Jan Bader 2014-06-04 19:11:00 +02:00
parent e2aa2d0d9e
commit 0b42685d08

View File

@ -10,30 +10,12 @@
//
// @match http://*.grepolis.com/game/*
//
// @version 1.0.48
// @version 1.0.49
// @updateURL http://git.javil.eu/jan/userscripts/raw/master/grepolis.user.js
// ==/UserScript==
(function() {
console.logCopy = console.log.bind(console);
console.log = function() {
var date = new Date(); // Timestamp to prepend
var timestamp = new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toJSON();
if (arguments.length) {
var args = Array.prototype.slice.call(arguments, 0);
// If there is a format string then... it must be a string
if (typeof arguments[0] === "string") {
args[0] = "%s: " + arguments[0];
args.splice(1, 0, timestamp);
this.logCopy.apply(this, args);
} else {
this.logCopy(timestamp, args);
}
}
};
lastAmounts = "";
console.log("Initializing...");
windows = {};
@ -61,10 +43,9 @@
logWindowElement.empty();
function log(xText) {
console.log(xText);
var date = new Date(); // Timestamp to prepend
var timestamp = new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toJSON();
logWindowElement.append(timestamp + ": " + xText + "<br />");
logWindowElement.append('<span title="' + timestamp +'">' + xText + "</span><br />");
logWindowElement.scrollTop(logWindowElement[0].scrollHeight);
}