Skip to content

Instantly share code, notes, and snippets.

@linjunpop
Last active December 17, 2015 01:49
Show Gist options
  • Select an option

  • Save linjunpop/5530797 to your computer and use it in GitHub Desktop.

Select an option

Save linjunpop/5530797 to your computer and use it in GitHub Desktop.
Github time tracking Chrome extension for AC.
chrome.tabs.query(
{'active': true, 'currentWindow': true},
function (tabs) {
var tab = tabs[0]
var url = tab.url;
var title = tab.title;
var pattern = /https:\/\/github.com\/pracstrat\/(\w+)\/issues\/(\w+)/
var search = tab.url.match(pattern)
jQuery.ajax({
url: 'http://ac.dev/api/timers',
type: 'POST',
data: {
project: search[1],
issue_title: title,
issue_number: search[2],
auth_token: 'zzxeAyyy3HqXzwU4W5qk' // TODO: store in option.
},
dataType: 'json'
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment