/ ‘grepolis.user.js’
This commit is contained in:
parent
de4cdf4ed0
commit
a0c6a30225
@ -10,35 +10,25 @@
|
|||||||
//
|
//
|
||||||
// @match http://*.grepolis.com/game/*
|
// @match http://*.grepolis.com/game/*
|
||||||
//
|
//
|
||||||
// @version 1.0.28
|
// @version 1.0.29
|
||||||
// @updateURL http://git.javil.eu/jan/userscripts/raw/master/grepolis.user.js
|
// @updateURL http://git.javil.eu/jan/userscripts/raw/master/grepolis.user.js
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
console.logCopy = console.log.bind(console);
|
console.logCopy = console.log.bind(console);
|
||||||
console.log = function()
|
console.log = function() {
|
||||||
{
|
var date = new Date(); // Timestamp to prepend
|
||||||
// Timestamp to prepend
|
var timestamp = new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toJSON();
|
||||||
var date = new Date();
|
|
||||||
var timestamp = new Date(new Date().getTime() - (new Date().getTimezoneOffset() * 60000)).toJSON();
|
|
||||||
|
|
||||||
if (arguments.length) {
|
if (arguments.length) {
|
||||||
// True array copy so we can call .splice()
|
|
||||||
var args = Array.prototype.slice.call(arguments, 0);
|
var args = Array.prototype.slice.call(arguments, 0);
|
||||||
|
|
||||||
// If there is a format string then... it must be a string
|
// If there is a format string then... it must be a string
|
||||||
if (typeof arguments[0] === "string") {
|
if (typeof arguments[0] === "string") {
|
||||||
// Prepend timestamp to the (possibly format) string
|
|
||||||
args[0] = "%o: " + arguments[0];
|
args[0] = "%o: " + arguments[0];
|
||||||
|
|
||||||
// Insert the timestamp where it has to be
|
|
||||||
args.splice(1, 0, timestamp);
|
args.splice(1, 0, timestamp);
|
||||||
|
|
||||||
// Log the whole array
|
|
||||||
this.logCopy.apply(this, args);
|
this.logCopy.apply(this, args);
|
||||||
} else {
|
} else {
|
||||||
// "Normal" log
|
|
||||||
this.logCopy(timestamp, args);
|
this.logCopy(timestamp, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user