aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2016-02-28 10:14:41 +0000
committerStephen Blott2016-02-28 10:14:41 +0000
commit8adfa7c4ef8357b6cb945354d6da1b7b92615119 (patch)
tree36733db872bb5812987e47e3209add67a1fa626b
parentf6a3bc3aa0c14af41a9b6035cc809071b4a27af1 (diff)
parent1cd93d83258e9dd239186983852d3a3acfc484a5 (diff)
downloadvimium-8adfa7c4ef8357b6cb945354d6da1b7b92615119.tar.bz2
Merge pull request #2014 from smblott-github/record-install-date
Add install date to logging page.
-rw-r--r--background_scripts/main.coffee5
-rw-r--r--pages/logging.coffee19
-rw-r--r--pages/logging.html10
3 files changed, 34 insertions, 0 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index a4162fc7..7c970866 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -658,5 +658,10 @@ showUpgradeMessage = ->
showUpgradeMessage()
+# The install date is shown on the logging page.
+chrome.runtime.onInstalled.addListener ({reason}) ->
+ unless reason in ["chrome_update", "shared_module_update"]
+ chrome.storage.local.set installDate: new Date().toString()
+
root.TabOperations = TabOperations
root.logMessage = logMessage
diff --git a/pages/logging.coffee b/pages/logging.coffee
new file mode 100644
index 00000000..3ccef4ff
--- /dev/null
+++ b/pages/logging.coffee
@@ -0,0 +1,19 @@
+$ = (id) -> document.getElementById id
+
+document.addEventListener "DOMContentLoaded", ->
+ $("vimiumVersion").innerText = Utils.getCurrentVersion()
+
+ chrome.storage.local.get "installDate", (items) ->
+ $("installDate").innerText = items.installDate.toString()
+
+ branchRefRequest = new XMLHttpRequest()
+ branchRefRequest.addEventListener "load", ->
+ branchRefParts = branchRefRequest.responseText.split "refs/heads/", 2
+ if branchRefParts.length == 2
+ $("branchRef").innerText = branchRefParts[1]
+ else
+ $("branchRef").innerText = "HEAD detatched at #{branchRefParts[0]}"
+ $("branchRef-wrapper").classList.add "no-hide"
+ branchRefRequest.open "GET", chrome.extension.getURL ".git/HEAD"
+ branchRefRequest.send()
+
diff --git a/pages/logging.html b/pages/logging.html
index 9d20d5d7..78095e4b 100644
--- a/pages/logging.html
+++ b/pages/logging.html
@@ -2,6 +2,7 @@
<head>
<title>Vimium Logging</title>
<script src="content_script_loader.js"></script>
+ <script src="logging.js"></script>
<style type="text/css">
body {
font: 14px "DejaVu Sans", "Arial", sans-serif;
@@ -23,6 +24,12 @@
width: 100%;
height: 80%;
}
+ #branchRef-wrapper {
+ display: none;
+ }
+ #branchRef-wrapper.no-hide {
+ display: block;
+ }
</style>
</head>
@@ -32,6 +39,9 @@
<br />
<textarea id="log-text" readonly></textarea>
<br />
+ Version: <span id="vimiumVersion"></span><br />
+ Installed: <span id="installDate"></span>
+ <div id="branchRef-wrapper">Branch: <span id="branchRef"></span></div>
</div>
</body>
</html>