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

Difference between revisions of "User:Dragonjet/scripts/FleetReporting.js"

From Kancolle Wiki
Jump to navigation Jump to search
m (b8)
m (hey start dash)
Line 1: Line 1:
 
(function($){
 
(function($){
 
"use strict";
 
"use strict";
console.log("Fleet Reporting v0.8");
+
console.log("Fleet Reporting v0.9");
 
 
 
var routes = {};
 
var routes = {};
Line 30: Line 30:
 
$(".FleetCompilation").append("<div style='font-size:16px; font-weight:bold;'>"+routeName+"</div>");
 
$(".FleetCompilation").append("<div style='font-size:16px; font-weight:bold;'>"+routeName+"</div>");
 
for(compoName in routes[routeName]){
 
for(compoName in routes[routeName]){
$(".FleetCompilation").append("<div style=''>");
+
$(".FleetCompilation").append("<div style='margin:0px 0px 5px 0px;'>");
 
$(".FleetCompilation").append("<div style='width:100px; font-size:14px; font-weight:bold; float:left;'>"+compoName+"</div>");
 
$(".FleetCompilation").append("<div style='width:100px; font-size:14px; font-weight:bold; float:left;'>"+compoName+"</div>");
 
 
Line 37: Line 37:
 
$(".FleetCompilation").append("</div>");
 
$(".FleetCompilation").append("</div>");
 
 
$(".FleetCompilation").append("<div style='width:100px; float:left;'>"+routes[routeName][compoName]+"</div>");
+
$(".FleetCompilation").append("<div style='width:100px; float:left; font-weight:bold;'>"+routes[routeName][compoName]+"</div>");
$(".FleetCompilation").append("</div>");
 
 
 
 
$(".FleetCompilation").append("<div style='clear:both;'></div>");
 
$(".FleetCompilation").append("<div style='clear:both;'></div>");
 +
$(".FleetCompilation").append("</div>");
 
}
 
}
 
$(".FleetCompilation").append("</div></div>");
 
$(".FleetCompilation").append("</div></div>");

Revision as of 02:47, 31 January 2015

(function($){
	"use strict";
	console.log("Fleet Reporting v0.9");
	
	var routes = {};
	var routeName = "";
	var compoName = "";
	var thisRoute = [];
	var thisFleet = [];
	var fleetIndexer = "";
	
	$(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]++;
			});
			for(routeName in routes){
				$(".FleetCompilation").append("<div style='margin:0px 10px 10px; background:#fff; border:1px solid #ccc;'>");
				$(".FleetCompilation").append("<div style='padding:5px 10px;'>");
				$(".FleetCompilation").append("<div style='font-size:16px; font-weight:bold;'>"+routeName+"</div>");
				for(compoName in routes[routeName]){
					$(".FleetCompilation").append("<div style='margin:0px 0px 5px 0px;'>");
					$(".FleetCompilation").append("<div style='width:100px; font-size:14px; font-weight:bold; float:left;'>"+compoName+"</div>");
					
					$(".FleetCompilation").append("<div style='width:200px; height:16px; border:1px solid #000; background:#444;  float:left;'>");
					$(".FleetCompilation").append("<div style='width:"+routes[routeName][compoName]+"px; height:16px; background:#0f0;'></div>");
					$(".FleetCompilation").append("</div>");
					
					$(".FleetCompilation").append("<div style='width:100px; float:left; font-weight:bold;'>"+routes[routeName][compoName]+"</div>");
					
					$(".FleetCompilation").append("<div style='clear:both;'></div>");
					$(".FleetCompilation").append("</div>");
				}
				$(".FleetCompilation").append("</div></div>");
			}
			console.log(routes);
		}
	});

}(jQuery));