MediaWiki:FleetReporting.js

(function($){	"use strict";	console.log("Fleet Reporting v014");	var routes = {};	var routeName = "";	var compoName = "";	var thisRoute = [];	var thisFleet = [];	var fleetIndexer = "";	var CompilationString = "";	$(document).ready(function{ if($(".FleetCompilation").length > 0){ $(".FleetReport").each(function{				thisRoute = $(this).data("route").replace(/\W+/g, "");				thisFleet = [ $(this).data("ship1"), $(this).data("ship2"), $(this).data("ship3"), $(this).data("ship4"), $(this).data("ship5"), $(this).data("ship6"), ];				thisFleet.sort;				fleetIndexer = thisFleet.join("-");				if(typeof routes[thisRoute] == "undefined"){					routes[thisRoute] = {};				}				if(typeof routes[thisRoute][fleetIndexer] == "undefined"){					routes[thisRoute][fleetIndexer] = 0;				}				routes[thisRoute][fleetIndexer]++;			}); CompilationString = ""; for(routeName in routes){ CompilationString += " "; CompilationString += " "; CompilationString += " "+routeName+" "; for(compoName in routes[routeName]){ CompilationString += " "+compoName+"   "+routes[routeName][compoName]+"   "; }				CompilationString += " "; }			$(".FleetCompilation").append(CompilationString); console.log(routes); }	});

}(jQuery));