Last active
December 17, 2015 01:49
-
-
Save linjunpop/5530797 to your computer and use it in GitHub Desktop.
Github time tracking Chrome extension for AC.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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