/* cookie.js
KC3改 Cookie Writer

Injected on URLs matching pattern: "*://*.dmm.com/*"
See Manifest File [manifest.json] under "content_scripts"

Waits and listens for trigger to write cookies.
Redirects to KanColle game page after writing
*/
(function(){
	"use strict";
	
	// New Cookie Hack
	function writeCookies(){
		var expireTime = function(){
			var now = new Date();
			now.setFullYear(now.getFullYear() + 1);
			return now.toGMTString();
		}();
		var buildCookie = function(key, value, domain, path){
			return key + "=" + value + ";expires=" + expireTime + ";domain=" + domain + ";path=" + path;
		};
		document.cookie = buildCookie("cklg", "ja", ".dmm.com", "/");
		document.cookie = buildCookie("cklg", "ja", ".dmm.com", "/netgame/");
		document.cookie = buildCookie("cklg", "ja", ".dmm.com", "/netgame_s/");
		document.cookie = buildCookie("cklg", "ja", ".dmm.com", "/play/");
		document.cookie = buildCookie("ckcy", "1", ".dmm.com", "/");
		document.cookie = buildCookie("ckcy", "1", ".dmm.com", "/netgame/");
		document.cookie = buildCookie("ckcy", "1", ".dmm.com", "/netgame_s/");
		document.cookie = buildCookie("ckcy", "1", ".dmm.com", "/play/");
		document.cookie = buildCookie("ckcy", "1", "www.dmm.com", "/");
		document.cookie = buildCookie("ckcy", "1", "osapi.dmm.com", "/");
		document.cookie = buildCookie("ckcy", "1", "log-netgame.dmm.com", "/");
		console.log("Hacked cookies written!");
	}
	
	// Check if "Force Cookies" enabled
	chrome.runtime.sendMessage({
		identifier: "kc3_service",
		action: "getConfig",
		id: "dmm_forcecookies"
	}, function(response){
		if(response.value){
			writeCookies();
		}else{
			console.log("KC3改 forcing cookies disabled, enjoy error areas.");
		}
	});
	
})();
@@ -658,34 +658,39 @@
 Cookie(%22cklg%22, %22
-ja
+welcome
 %22, %22.dmm.com%22, %22
@@ -728,34 +728,39 @@
 Cookie(%22cklg%22, %22
-ja
+welcome
 %22, %22.dmm.com%22, %22
@@ -806,34 +806,39 @@
 Cookie(%22cklg%22, %22
-ja
+welcome
 %22, %22.dmm.com%22, %22
@@ -898,10 +898,15 @@
 %22, %22
-ja
+welcome
 %22, %22

Update cookie hacks