From 085f9177f623f42f91f2b7a9a730263464c12ab5 Mon Sep 17 00:00:00 2001 From: Bengt Brodersen Date: Thu, 19 May 2016 15:37:47 +0200 Subject: [PATCH] feat: read jira base url --- bookmarklet.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bookmarklet.js b/bookmarklet.js index fa2e03a..ffe5f3f 100644 --- a/bookmarklet.js +++ b/bookmarklet.js @@ -565,6 +565,12 @@ var jiraFunctions = (function(module) { module.name = "JIRA"; + + module.baseUrl = function() { + var jiraBaseUrl = window.location.origin; + try { jiraBaseUrl = $("meta[name='ajs-jira-base-url']").attr('content'); } catch(ex){} + return jiraBaseUrl + } module.isEligible = function(){ return $("meta[name='application-name'][ content='JIRA']").length > 0; @@ -638,8 +644,8 @@ issueData.superIssue.summary = data.fields.epicName; })); } - - issueData.url = window.location.origin + "/browse/" + issueData.key; + + issueData.url = module.baseUrl() + "/browse/" + issueData.key; //LRS Specific field mapping if (true) { @@ -657,7 +663,7 @@ module.getIssueData = function(issueKey) { //https://docs.atlassian.com/jira/REST/latest/ - var url = '/rest/api/2/issue/' + issueKey + '?expand=renderedFields,names'; + var url = module.baseUrl() + '/rest/api/2/issue/' + issueKey + '?expand=renderedFields,names'; console.log("IssueUrl: " + url); //console.log("Issue: " + issueKey + " Loading..."); return httpGetJSON(url).then(function(responseData) {