Skip to content

Commit

Permalink
- added access statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
cleberar committed Feb 17, 2013
1 parent 87bee20 commit 41d56db
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 19 deletions.
9 changes: 5 additions & 4 deletions background.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
var id = 1;
var id = 100;
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.captureVisibleTab(null, function(screenshotUrl) {
var viewTabUrl = chrome.extension.getURL('pivotate.html?id=' + (id++));
var currentId = id++;
var viewTabUrl = chrome.extension.getURL('pivotate.html?id=' + (currentId));
chrome.tabs.create({url: viewTabUrl}, function(tab) {
var targetId = tab.id;
var addSnapshotImageToTab = function(tabId, changedProps) {
if (tabId != targetId || changedProps.status != "complete") {
return;
return;
}

chrome.tabs.onUpdated.removeListener(addSnapshotImageToTab);
var views = chrome.extension.getViews();
for (var i = 0; i < views.length; i++) {
var view = views[i];
if (view.location.href == viewTabUrl) {
view.pivotate.setScreenShot(screenshotUrl);
view.pivotate.setScreenShot(screenshotUrl, currentId);
break;
}
}
Expand Down
5 changes: 3 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Pivotate",
"version": "1.3",
"version": "1.4",
"description": "Submit to Pivotal Tracker with screenshot",
"background": {
"persistent": false,
Expand All @@ -16,5 +16,6 @@
"16" :"icon-16.png"
},
"permissions": [ "http://*/", "https://*/", "https://www.pivotaltracker.com/services/v3/*", "tabs" ],
"manifest_version": 2
"manifest_version": 2,
"content_security_policy": "script-src 'self' https://ssl.google-analytics.com; object-src 'self'"
}
21 changes: 13 additions & 8 deletions pivotate.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta charset="utf-8">
<title>Pivotate</title>
<link href="pivotate.css" rel="stylesheet">

</head>
<body>
<canvas id="canvas-background"></canvas>
Expand Down Expand Up @@ -38,9 +39,11 @@ <h1>
</div>
<input type="hidden" id="story_type" name="story_type"/>

<button class="btn" type="button" id="action">
<span class="btn-text"> Create Story</span>
<span class="btn-icon-right"><span></span></span>
<button class="btn" type="button" id="action" data-name="create-story">
<span class="btn-text" data-name="create-story"> Create Story</span>
<span class="btn-icon-right" data-name="create-story">
<span data-name="create-story"></span>
</span>
</button>


Expand All @@ -56,9 +59,11 @@ <h1>
</div>
<button class="btn" type="button" id="save-token">Save Token</button>
</div>
</body>

<script src="canvas.js" type="text/javascript"></script>
<script src="pivotal.js" type="text/javascript"></script>
<script src="pivotate.js" type="text/javascript"></script>

<script src="canvas.js" type="text/javascript"></script>
<script src="pivotal.js" type="text/javascript"></script>
<script src="pivotate.js" type="text/javascript"></script>
<script src="analytics.js" type="text/javascript"></script>
</body>

</html>
10 changes: 5 additions & 5 deletions pivotate.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
window.addEventListener("load", function() {

var urlParams = {};
location.search.slice(1).split("&").forEach(function(param) {
current = param.split("=", 2);
urlParams[decodeURIComponent(current[0])] = decodeURIComponent(current[1]);
});

pivotate.load(urlParams);

}, false);
Expand Down Expand Up @@ -125,9 +123,11 @@ var pivotate = {
}
},

setScreenShot: function(img) {
window.sessionStorage.setItem("img-" + this.params.id, img);
this.formatIMG.setBackground(img);
setScreenShot: function(img, id) {
window.sessionStorage.setItem("img-" + id, img);
if (this.formatIMG) {
this.formatIMG.setBackground(img);
}
},

loadProjects: function() {
Expand Down

0 comments on commit 41d56db

Please sign in to comment.