• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Changes

Jump to navigation Jump to search
no edit summary
Line 513: Line 513:  
var newpp = $(".mw-parser-output").contents().filter(function () { return this.nodeType === 8 && this.data.match(/Post‐expand include size: (\d+)\/(\d+) bytes/); });
 
var newpp = $(".mw-parser-output").contents().filter(function () { return this.nodeType === 8 && this.data.match(/Post‐expand include size: (\d+)\/(\d+) bytes/); });
 
if (!newpp.length) return;
 
if (!newpp.length) return;
var sizes = newpp[0].data.match(/Post‐expand include size: (\d+)\/(\d+) bytes/);
+
newpp = newpp[0].data;
var usage = +sizes[1] / +sizes[2];
+
var page_size = newpp.match(/Post‐expand include size: (.+?)\/(.+?) bytes/) || [0, 0, 1];
if (usage >= 0.95) {
+
var lua_time = newpp.match(/Lua time usage: (.+?)\/(.+?) seconds/) || [0, 0, 1];
$('#content').prepend('<pre style="color: red; text-align: center;">Warning: post‐expand include size is over 95%</pre>');
+
var lua_memory = newpp.match(/Lua memory usage: (.+?) MB\/(.+?) MB/) || [0, 0, 1];
 +
var page_size_usage = Math.round(100 * +page_size[1] / +page_size[2]);
 +
var lua_time_usage = Math.round(100 * +lua_time[1] / +lua_time[2]);
 +
var lua_memory_usage = Math.round(100 * +lua_memory[1] / +lua_memory[2]);
 +
if (page_size_usage >= 90) {
 +
$('#content').prepend('<pre style="color: red; margin: auto; width: 50%; text-align: center;">Page size: ' + page_size_usage + '%</pre>');
 +
} else {
 +
$('#content').append('<pre style="color: green; margin: auto; width: 50%; text-align: center;">Page size: ' + page_size_usage + '%</pre>');
 +
}
 +
if (lua_time_usage >= 90) {
 +
$('#content').prepend('<pre style="color: red; margin: auto; width: 50%; text-align: center;">Lua time: ' + lua_time_usage + '%</pre>');
 +
} else {
 +
$('#content').append('<pre style="color: green; margin: auto; width: 50%; text-align: center;">Lua time: ' + lua_time_usage + '%</pre>');
 +
}
 +
if (lua_memory_usage >= 90) {
 +
$('#content').prepend('<pre style="color: red; margin: auto; width: 50%; text-align: center;">Lua memory: ' + lua_memory_usage + '%</pre>');
 +
} else {
 +
$('#content').append('<pre style="color: green; margin: auto; width: 50%; text-align: center;">Lua memory: ' + lua_memory_usage + '%</pre>');
 
}
 
}
 
}
 
}
7,212

edits

Navigation menu