Permalink
Browse files

Record running instead of installed extension version in game logs.

  • Loading branch information...
1 parent a295555 commit a22f13e1d470746964c2be6866f087bc3f9af2de @drheld committed May 10, 2011
Showing with 10 additions and 1 deletion.
  1. +2 −1 background.js
  2. +8 −0 dominion.js
View
@@ -8,7 +8,6 @@ function getVersion() {
}
function handleLogRequest(request) {
- request['version'] = getVersion();
$.post("http://dominion-point-counter.appspot.com/log_game", request);
}
@@ -26,6 +25,8 @@ function(request, sender, sendResponse) {
if (type == "log") {
handleLogRequest(request);
+ } else if (type == "version") {
+ sendResponse(getVersion());
} else if (type == "fetch") {
handleFetchRequest(request, sendResponse);
} else {
View
@@ -37,6 +37,9 @@ var last_gain_player = null;
// Track scoping of actions in play such as Watchtower.
var scopes = [];
+// The version of the extension currently loaded.
+var extension_version = 'Unknown';
+
// Quotes a string so it matches literally in a regex.
RegExp.quote = function(str) {
return str.replace(/([.?*+^$[\]\\(){}-])/g, "\\$1");
@@ -848,6 +851,7 @@ function handleGameEnd(doc) {
correct_score: has_correct_score,
state_strings: optional_state_strings,
log: document.body.innerHTML,
+ version: extension_version,
settings: settingsString() });
break;
}
@@ -960,3 +964,7 @@ setTimeout("setupLobbyStatusHandling()", 500);
document.body.addEventListener('DOMNodeInserted', function(ev) {
handle(ev.target);
});
+
+chrome.extension.sendRequest({ type: "version" }, function(response) {
+ extension_version = response;
+});

0 comments on commit a22f13e

Please sign in to comment.