Commit 975429c7 authored by Irina's avatar Irina Committed by GitHub

Merge pull request #8 from 0x62ash/master

Add default project option
parents 9c92ca09 5fbe4884
......@@ -34,6 +34,7 @@ Where `URL` is parameter, that user should specify in Options page (only one tim
* `KEY` is case insensitive
* All spaces in the beginning and in the end will be trimmed
* Skype formatting will be trimmed: `[16.09.2014 13:34:34] Irina Ivanova: KEY-776` will be recognized as `KEY-776`
* If key contains only numbers it will be prepended with PROJECT option
# Chrome Tip
You can configure hot keys for extension in the Google Chrome:
......
......@@ -51,6 +51,12 @@ function removeSkypeFormatting(string) {
return string;
}
function maybeAddProject(string, project) {
if (string.match(/^[0-9]+$/) != null) {
string = project + '-' + string;
}
return string;
}
function openWindow() {
window.open(url + key);
......@@ -60,11 +66,13 @@ function openIssue() {
chrome.storage.sync.get(function (item) {
var urlOption = item.savedUrl;
var projectOption = item.savedProject;
key = document.getElementById('key').value;
setUrl(urlOption);
key = removeSpaces(key);
key = removeSkypeFormatting(key);
key = maybeAddProject(key, projectOption);
if (key === '') {
returnError('Please insert key', 'key');
......@@ -102,4 +110,4 @@ if (window.addEventListener) {
window.attachEvent('onload', listenKeys);
} else {
document.addEventListener('load', listenKeys, false);
}
\ No newline at end of file
}
function save_options() {
var url = document.getElementById('urlOption').value;
var project = document.getElementById('projectOption').value;
var status = document.getElementById('status');
var error = document.getElementById('error');
var border = document.getElementById('urlOption');
......@@ -15,9 +16,10 @@ function save_options() {
border.select();
chrome.storage.sync.set({
savedUrl: url
savedUrl: url,
savedProject: project
}, function () {
status.textContent = 'URL is saved';
status.textContent = 'Options saved';
setTimeout(function () {
status.textContent = '';
}, 2000);
......@@ -27,9 +29,11 @@ function save_options() {
function restore_options() {
chrome.storage.sync.get({
savedUrl: 'https://jira.atlassian.com'
savedUrl: 'https://jira.atlassian.com',
savedProject: 'PROJECT'
}, function (items) {
document.getElementById('urlOption').value = items.savedUrl;
document.getElementById('projectOption').value = items.savedProject;
document.getElementById('urlOption').select();
});
}
......@@ -65,4 +69,4 @@ if (window.addEventListener) {
window.attachEvent('onload', listenURL);
} else {
document.addEventListener('load', listenURL, false);
}
\ No newline at end of file
}
{
"name": "JIRA Issue Opener",
"short_name": "JIRA Issue Opener",
"version": "2.0",
"version": "2.1",
"manifest_version": 2,
"description": "Extension opens JIRA issue in new tab",
"homepage_url": "http://ivanova-irina.blogspot.com/p/jira-issue-opener.html",
......@@ -23,4 +23,4 @@
"name": "Irina Ivanova",
"email": "iriiiina@gmail.com"
}
}
\ No newline at end of file
}
......@@ -2,19 +2,20 @@
<html>
<head>
<title>Options of JIRA Issue Opener 2.0</title>
<title>Options of JIRA Issue Opener 2.1</title>
<link rel='stylesheet' type='text/css' href='css/options.css' />
</head>
<body>
<img src='icons/big.jpg' width='130' alt='Fisheye icon' />
<h1>Options of JIRA Issue Opener 2.0</h1>
<h1>Options of JIRA Issue Opener 2.1</h1>
<p>Extension opens JIRA issue in new tab. User needs only to insert issue key.</p>
<ul>
<li>KEY is case insensitive</li>
<li>All spaces in the beginning and in the end will be trimmed</li>
<li>Skype formatting will be trimmed: <code>[16.09.2014 13:34:34] Irina Ivanova: KEY-776</code> will be recognized as <code>KEY-776</code></li>
<li>If key contains only numbers it will be prepended with PROJECT option</li>
</ul>
<p id='contacts'>Read more on <a href='http://ivanova-irina.blogspot.com/p/jira-issue-opener.html' target='_blank'>JIRA Issue Opener page</a> or write to <a href='mailto:iriiiina@gmail.com'>iriiiina@gmail.com</a>
</p>
......@@ -34,6 +35,15 @@
<input type='text' name='urlOption' id='urlOption' maxlength='255' size='30' autofocus />&nbsp;<code>/browse/KEY</code>
</td>
</tr>
<tr>
<td>
<label for='urlOption'><b>Default project:</b>
</label>
</td>
<td>
<input type='text' name='projectOption' id='projectOption' maxlength='255' size='30' autofocus />&nbsp;<code>PROJECT-123</code>
</td>
</tr>
<tr>
<td></td>
<td>
......@@ -49,4 +59,4 @@
</body>
</html>
\ No newline at end of file
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment