Skip to content

Commit

Permalink
Merge pull request #3 from Aer0naut/Settings
Browse files Browse the repository at this point in the history
Settings
  • Loading branch information
Aer0naut authored Aug 9, 2017
2 parents 1f90548 + 9ed8b1a commit a142578
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 10 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "VSTS GO",
"short_name": "VSTS GO",
"description": "This extension will send you to a specific workitem in your VSTS, given the id",
"version": "1.5",
"version": "1.5.2",
"icons": {
"128": "VSTS-GO.png"
},
Expand Down
14 changes: 13 additions & 1 deletion options.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function save_options() {
userCollection: inCollection.value
}, function() {
// Update status to let user know options were saved.
txtStatus.textContent = '> Options saved!';
txtStatus.textContent = '> Options saved, you are good to GO!';
// reset status message
setTimeout(function() {
txtStatus.textContent = '';
Expand Down Expand Up @@ -56,9 +56,21 @@ function restoreOptions() {
});
}

function focusInAccessToken(){
if(inAccessToken.value=='<insert>')
inAccessToken.value='';
}

function blurInAccessToken(){
if(inAccessToken.value=='')
inAccessToken.value='<insert>';
}

function whenPageHasLoaded()
{
btnSave.addEventListener('click', save_options);
inAccessToken.addEventListener('focus', focusInAccessToken);
inAccessToken.addEventListener('blur', blurInAccessToken);
restoreOptions();
}

Expand Down
29 changes: 21 additions & 8 deletions popup.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
var accesstoken;
var domain;
var collection;
var analyticsId = 'UA-102907431-1';
var analyticsService = 'vsts-go';
var vstsApiVersion = "?api-version=3.0";
var vstsApiUrl = "_apis/wit/workItems/";

var err = new errMsg();
var recentItems = [];

var settings = {

analytics:{
id: 'UA-102907431-1',
service: 'vsts-go'
},
vsts:{
apiVersion: 'api-version=3.0',
apiUrl: '_apis/wit/workItems',
}
}


//----------------Chrome Platform Analytics------------------------
// https://github.com/GoogleChrome/chrome-platform-analytics/wiki
var service = analytics.getService(analyticsService);
var tracker = service.getTracker(analyticsId);
var service = analytics.getService(settings.analytics.service);
var tracker = service.getTracker(settings.analytics.id);
tracker.sendAppView('MainView');
//----------------Chrome Platform Analytics-------------------------

Expand Down Expand Up @@ -81,7 +90,11 @@ function showRecentItems(){
}

function formVstsApiUrl(wId){
var fullVstsApiUrl = domain+"/"+collection+"/"+vstsApiUrl+wId+vstsApiVersion;
var fullVstsApiUrl = domain +
"/" + collection +
"/" + settings.vsts.apiUrl +
"/" + wId +
"?" +settings.vsts.apiVersion;
return fullVstsApiUrl;
}

Expand Down Expand Up @@ -115,9 +128,9 @@ function getAccountName(strDomainUrl){
}
//If the url doesn't contain a '.', return the URL
return strDomainUrl;

}


function idIsValid(id){
if(id && id>1 && id<999999999){
return true;
Expand Down

0 comments on commit a142578

Please sign in to comment.