Skip to content

Commit

Permalink
Version 0.4 - cleaning, added Firefox Add-On support. Deployed and an…
Browse files Browse the repository at this point in the history
  • Loading branch information
klokan committed Dec 6, 2012
1 parent 7431680 commit af195d6
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 24 deletions.
8 changes: 7 additions & 1 deletion README.md
@@ -1,4 +1,10 @@
github-time-tracking
====================

Add time tracking to the GitHub Issue Tracker (Issues 2.0) with Harvest Platform.
Add time tracking to the GitHub Issue Tracker (Issues 2.0) with Harvest Platform.

Firefox Add-on:
$ cfx xpi

Chrome Extension:
$ zip -r github-time-tracking.zip manifest.json data img
34 changes: 17 additions & 17 deletions index.js → data/index.js
@@ -1,18 +1,18 @@
var div = document.createElement('div');
div.className='harvest-timer';
var el = document.getElementsByClassName('number')[0];
if (!el) {
el = document.getElementsByClassName('pull-number')[0];
div.setAttribute('style','margin-top:8px;');
}
var href = window.location.href;
var pattern = /^https:\/\/github.com\/(.*?)\/(.*?)\/(.*\d+)$/
var m = href.match(pattern);
div.setAttribute('data-account', JSON.stringify({'id':m[1]}));
div.setAttribute('data-project', JSON.stringify({'id':m[2],'name':m[2]}));
div.setAttribute('data-item', JSON.stringify({'id':m[3],'name':document.getElementsByClassName('discussion-topic-title')[0].innerHTML}));
el.appendChild(div);
var init = "window._harvestPlatformConfig = { 'applicationName': 'GitHub', 'permalink': 'https://github.com/%ACCOUNT_ID%/%PROJECT_ID%/%ITEM_ID%'}; var s = document.createElement('script');s.src = '//platform.harvestapp.com/assets/platform.js';s.async = true;var ph = document.getElementsByTagName('script')[0];ph.parentNode.insertBefore(s, ph);";
var s = document.createElement('script');s.type = 'text/javascript';s.innerHTML = init;
var ph = document.getElementsByTagName('script')[0];
var div = document.createElement('div');
div.className='harvest-timer';
var el = document.getElementsByClassName('number')[0];
if (!el) {
el = document.getElementsByClassName('pull-number')[0];
div.setAttribute('style','margin-top:8px;');
}
var href = window.location.href;
var pattern = /^https:\/\/github.com\/(.*?)\/(.*?)\/(.*\d+)$/
var m = href.match(pattern);
div.setAttribute('data-account', JSON.stringify({'id':m[1]}));
div.setAttribute('data-project', JSON.stringify({'id':m[2],'name':m[2]}));
div.setAttribute('data-item', JSON.stringify({'id':m[3],'name':document.getElementsByClassName('discussion-topic-title')[0].innerHTML}));
el.appendChild(div);
var init = "window._harvestPlatformConfig = { 'applicationName': 'GitHub', 'permalink': 'https://github.com/%ACCOUNT_ID%/%PROJECT_ID%/%ITEM_ID%', 'referral': '66lx'}; var s = document.createElement('script');s.src = '//platform.harvestapp.com/assets/platform.js';s.async = true;var ph = document.getElementsByTagName('script')[0];ph.parentNode.insertBefore(s, ph);";
var s = document.createElement('script');s.type = 'text/javascript';s.innerHTML = init;
var ph = document.getElementsByTagName('script')[0];
ph.parentNode.insertBefore(s, ph);
Binary file removed github-time-tracker-100.png
Binary file not shown.
Binary file removed github-time-tracker-128.png
Binary file not shown.
Binary file removed github-time-tracker-48.png
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added img/github-time-tracking-48.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
8 changes: 8 additions & 0 deletions lib/main.js
@@ -0,0 +1,8 @@
var data = require("self").data;
var pageMod = require("page-mod");

pageMod.PageMod({
include: [ /.*github.com\/.*\/issues\/.*/, /.*github.com\/.*\/pull\/.*/ ],
contentScriptFile: data.url("index.js"),
contentScriptWhen: "ready"
});
12 changes: 6 additions & 6 deletions manifest.json
@@ -1,17 +1,17 @@
{
"name": "GitHub Time Tracking",
"version": "0.2",
"version": "0.4",
"manifest_version": 2,

"description": "Add time tracking to the GitHub Issue Tracker (Issues 2.0) with Harvest Platform.",
"description": "Add time tracking to the GitHub Issue Tracker with Harvest.",
"icons": {
"128": "github-time-tracking-128.png",
"16": "github-time-tracker-16.png",
"48": "github-time-tracker-48.png"
"128": "img/github-time-tracking-128.png",
"48": "img/github-time-tracking-48.png",
"16": "img/github-time-tracker-16.png"
},

"content_scripts": [ {
"js": [ "index.js" ],
"js": [ "data/index.js" ],
"matches": [ "https://github.com/*/issues/*", "https://github.com/*/pull/*" ]
} ],
"content_security_policy": "script-src 'self' https://*.harvestapp.com; object-src 'self'",
Expand Down
17 changes: 17 additions & 0 deletions package.json
@@ -0,0 +1,17 @@
{
"fullName": "GitHub Time Tracking",
"name": "github-time-tracking",
"description": "Add time tracking to the GitHub Issue Tracker with Harvest.",
"license": "",
"contributors": [],
"author": "Petr Pridal Klokan Technologies GmbH",
"url": "",
"icon": "img/github-time-tracking-48.png",
"icon64": "img/github-time-tracking-128.png",
"homepage": "http://try.hrv.st/66lx",
"dependencies": ["api-utils", "addon-kit"],
"version": "0.4",
"lib": "lib",
"main": "main",
"id": "jid0-bAfvy46pqbx8KSUnGc156Ng6bVM"
}

0 comments on commit af195d6

Please sign in to comment.