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

User:Dragonjet/scripts/FleetReporting.js

From Kancolle Wiki
< User:Dragonjet
Revision as of 02:07, 31 January 2015 by Dragonjet (talk | contribs) (test)
Jump to navigation Jump to search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
(function($){
	"use strict";
	console.log("Fleet Reporting v0.3");
	
	var routes = {};
	var thisRoute = [];
	var thisFleet = [];
	var fleetIndexer = "";
	
	$(document).ready(function(){
		if($(".FleetCompilation").length > 0){
			$(".FleetReport").each(function(){
				thisRoute = $(this).data("route");
				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[] == "undefined"){
					routes[$(this).data("route")] = {};
				}
				if(typeof routes[$(this).data("route")][fleetIndexer] == "undefined"){
					routes[$(this).data("route")][fleetIndexer] = 0;
				}
				routes[$(this).data("route")][fleetIndexer]++;
			});
			console.log(routes);
		}
	});

}(jQuery));