Commit cde9de0b authored by Irina's avatar Irina

v1.2

parent 330253d2
......@@ -2,7 +2,8 @@ body {
background-color: white;
font-family: Arial, sans-serif;
font-size: 14px;
color: black
color: black;
padding-left: 50px
}
img {
float: left;
......@@ -37,6 +38,12 @@ td {
padding-top: 25px;
float: left
}
#error {
position: relative;
color: #CC0000;
padding-top: 25px;
float: left
}
#save {
background-color: #205081;
color: white;
......
......@@ -12,7 +12,8 @@ input {
}
#error {
font-size: 14px;
color: #FF6666;
color: #CC0000;
padding-bottom: 10px;
text-align: center
}
#info {
......
......@@ -28,7 +28,7 @@ Tartu, Estonia -->
<p class='description'>JIRA issue will be opened in new tab</p>
</div>
<div id='info'>
<p>iriiiina@gmail.com v1.1</p>
<p>iriiiina@gmail.com v1.2</p>
</div>
</body>
......
......@@ -23,24 +23,24 @@ function returnError(errorText, element) {
}
var key,
url,
isError = 0;
url;
function setUrl(urlOption) {
'use strict';
if (urlOption.charAt(urlOption.length - 1) === '/') {
url = urlOption + 'browse/';
} else {
url = urlOption + '/browse/';
}
if (urlOption !== undefined) {
if (urlOption.charAt(urlOption.length - 1) === '/') {
url = urlOption + 'browse/';
} else {
url = urlOption + '/browse/';
}
}
}
function removeSpaces(string) {
'use strict';
if (string.charAt(0) === ' ') {
//string = string.slice(1, string.length);
var temp = string.split(' ');
string = temp[temp.length - 1];
}
......@@ -83,18 +83,13 @@ function openIssue() {
key = removeSkypeFormatting(key);
if (key === '') {
isError = 1;
returnError('Please insert key', 'key');
} else {
} else if (url === undefined) {
returnError('Please define URL in Options', 'key');
} else {
openWindow();
}
});
setTimeout(function () {
if (isError === 0) {
returnError('Please define URL in Options', 'key');
}
}, 500);
}
var enter = 13;
......
function save_options() {
var url = document.getElementById('urlOption').value;
var status = document.getElementById('status');
var error = document.getElementById('error');
var border = document.getElementById('urlOption');
chrome.storage.sync.set({
savedUrl: url
}, function () {
var status = document.getElementById('status');
status.textContent = 'URL is saved';
setTimeout(function () {
status.textContent = '';
}, 2000);
});
if (url === '') {
error.textContent = 'Please fill URL';
border.style.borderColor = '#CC0000';
border.focus();
} else {
error.innerText = '\n';
border.style.border = '';
border.focus();
border.select();
chrome.storage.sync.set({
savedUrl: url
}, function () {
status.textContent = 'URL is saved';
setTimeout(function () {
status.textContent = '';
}, 2000);
});
}
}
function restore_options() {
......@@ -22,4 +35,40 @@ function restore_options() {
}
document.addEventListener('DOMContentLoaded', restore_options);
document.getElementById('save').addEventListener('click',
save_options);
\ No newline at end of file
save_options);
var enter = 13;
function inputURLListener(e) {
'use strict';
if (e.keyCode === enter) {
save_options();
}
}
function listenInputURL(inputURL) {
'use strict';
if (inputURL.addEventListener) {
inputURL.addEventListener('keydown', inputURLListener, false);
} else if (inputURL.attachEvent) {
inputURL.attachEvent('keydown', inputURLListener);
}
}
function listenURL() {
'use strict';
listenInputURL(document.getElementById('urlOption'));
}
if (window.addEventListener) {
window.addEventListener('load', listenURL, false);
} else if (window.attachEvent) {
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": "1.1",
"version": "1.2",
"manifest_version": 2,
"description": "Extension opens JIRA issue in new tab",
"homepage_url": "http://ivanova-irina.blogspot.com/p/jira-issue-opener.html",
......
......@@ -19,6 +19,9 @@
<br />
<br />
<table>
<tr>
<td colspan = '2'><div id='error'><br /></div></td>
</tr>
<tr>
<td>
<label for='urlOption'><b>URL of JIRA:</b>
......
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