Commit 7442a93e authored by Irina Ivanova's avatar Irina Ivanova

New style and design; refactor the code

parent 3b394938
# CHANGELOG
### v3.0 29.01.2017
* Refactor the code
* Change style and design
\ No newline at end of file
......@@ -3,25 +3,13 @@ Extension opens JIRA issue in new tab. User needs only to insert issue key.
It is useful for developers, analysts or testers who often need to open JIRA issue using its key.
[Page of JIRA Issue Opener](http://ivanova-irina.blogspot.com/p/jira-issue-opener.html "Page of JIRA Issue Opener")
[Same extension for FireFox](https://github.com/iriiiina/JIRA-Issue-Opener-FF "Same extension for FireFox")
[Same extension for FireFox](https://gitlab.com/irina-ivanova-extensions/JIRA-Issue-Opener-FF "Same extension for FireFox")
# Download and Install
* **[Install](https://chrome.google.com/webstore/detail/jira-issue-opener/koceedenfpfaogpnpplkeikokjdnlamj "Install")** last version from Google Store
or
* **[Download](https://github.com/iriiiina/JIRA-Issue-Opener "Download")** source code from GitHub and load extension manually
# Questions and Comments
Any questions or comments are welcome! You can write me an e-mail on [iriiiina@gmail.com](mailto:iriiiina@gmail.com "iriiiina@gmail.com") or leave a comment on this page.
# Source Code and Issues
Source code and issue reporting is available at GitHub: [https://github.com/iriiiina/JIRA-Issue-Opener](https://github.com/iriiiina/JIRA-Issue-Opener "https://github.com/iriiiina/JIRA-Issue-Opener")
# Screenshots
![JIRA Issue Opener](https://raw.githubusercontent.com/iriiiina/JIRA-Issue-Opener/master/screenshots/extension.png "JIRA Issue Opener") ![JIRA Issue Opener: Options](https://raw.githubusercontent.com/iriiiina/JIRA-Issue-Opener/master/screenshots/options.png "JIRA Issue Opener: Options")
Any questions or comments are welcome! You can write me an e-mail on [irina.ivanova@protonmail.com](mailto:irina.ivanova@protonmail.com "irina.ivanova@protonmail.com").
# Description
Basically extension simply adds your issue key to specified URL and opens it in new tab. `URL` is parameter, that user should specify in Options page (only one time after installation) and `KEY` is issue key that user inserts into extension field.
......@@ -43,8 +31,7 @@ You can configure hot keys for extension in the Google Chrome:
* open the extensions tab - `chrome://extensions`
* link "Configure commands" at the bottom
* choose an extension and type a shortcut
Now You can use it completely without a mouse!
* now You can use it completely without a mouse!
# Posts About JIRA Issue Opener
* *January 5, 2015* [Getting Started With FireFox Extensions](http://ivanova-irina.blogspot.com/2015/02/getting-started-with-firefox-extensions.html "Getting Started With FireFox Extensions")
......
body {
background-color: white;
font-family: Arial, sans-serif;
font-size: 14px;
color: black;
padding-left: 50px
font-family: Lucida Sans Unicode;
color: #28324e;
padding-left: 50px;
}
img {
float: left;
margin: 10px
a:link, a:visited {
color: #3D8EB9;
}
ul {
padding-left: 100px;
margin-left: 100px
a:hover {
color: #f37934;
}
h1 {
color: #205081;
padding-left: 100px
}
p {
padding-left: 50px
}
table {
border-left: 10px;
border-left-color: #205081;
border-left-style: solid
}
td {
vertical-align: top
color: #3D8EB9;
}
#button {
position: relative;
float: left;
padding-top: 20px;
width: 200px
width: 200px;
}
#status {
position: relative;
color: #006600;
color: #41A85F;
width: 200px;
padding-top: 25px;
float: left
float: left;
}
#error {
position: relative;
color: #CC0000;
color: #B8312F;
padding-top: 25px;
float: left
float: left;
height: 20px;
}
#save {
background-color: #205081;
background-color: #475577;
color: white;
border: 0px;
font-size: 20px;
width: 160px
width: 160px;
}
#save:hover {
background-color: #183656
}
a {
color: #205081
}
#contacts {
font-size: 10px;
float: right;
background-color: #f37934;
}
body {
min-width: 230px;
overflow-x: hidden;
background-color: #205081;
font-family: Arial, sans-serif;
font-size: 14px;
color: white
}
input {
font-size: 14px;
color: #000000;
margin-left: 20px
text-align: center;
background-color: #3D8EB9;
font-family: Lucida Sans Unicode;
margin-bottom: 30px;
}
#error {
font-size: 14px;
color: #CC0000;
color: #B8312F;
padding-bottom: 10px;
text-align: center
}
.description {
text-align: right;
font-size: 11px;
color: #CCCCCC
height: 20px;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<!DOCTYPE html>
<!-- Extension opens JIRA issue in new tab
Author: Irina Ivanova, iriiiina@gmail.com
11.09.2014
Tartu, Estonia -->
<html>
<head>
<title>JIRA Issue Opener</title>
<script src='js/openIssue.js' type='text/javascript' charset='utf-8'></script>
<link rel='stylesheet' type='text/css' href='css/style.css' />
<html lang="en-us">
<title>JIRA Issue Opener</title>
<script type='text/javascript' src='js/openIssue.js' charset='utf-8'></script>
<link rel='stylesheet' type='text/css' href='css/style.css' />
</head>
<body>
<div id='error'>
<br/>
</div>
<div id='keyInput'>
<input type='text' name='key' id='key' maxlength='100' size='22' placeholder='JIRA issue key' autofocus />
<br />
<br />
</div>
<div id='error'></div>
<div id='keyInput'>
<input type='text' id='key' maxlength='100' size='22' placeholder='JIRA issue key' autofocus />
</div>
</body>
</html>
\ No newline at end of file
</html>
function setErrorText(errorText) {
var divError = document.getElementById('error');
divError.innerText = errorText + '\n';
var divError=document.getElementById("error");
divError.innerText=errorText + "\n";
}
function colorBorderToRed(element) {
var border = document.getElementById(element);
border.style.borderColor = '#FF6666';
border.focus();
border.select();
}
function returnError(errorText, element) {
function returnError(errorText) {
setErrorText(errorText);
colorBorderToRed(element);
throw '';
throw "";
}
var key,
......@@ -21,31 +13,31 @@ var key,
function setUrl(urlOption) {
if (urlOption !== undefined) {
if (urlOption.charAt(urlOption.length - 1) === '/') {
url = urlOption + 'browse/';
if (urlOption.charAt(urlOption.length - 1) === "/") {
url=urlOption + "browse/";
} else {
url = urlOption + '/browse/';
url=urlOption + "/browse/";
}
}
}
function removeSpaces(string) {
while (string.charAt(string.length - 1) === ' ') {
string = string.slice(0, string.length - 1);
while (string.charAt(string.length - 1) === " ") {
string=string.slice(0, string.length - 1);
}
if (string.charAt(0) === ' ') {
var temp = string.split(' ');
string = temp[temp.length - 1];
if (string.charAt(0) === " ") {
var temp=string.split(" ");
string=temp[temp.length - 1];
}
return string;
}
function removeSkypeFormatting(string) {
if (string.charAt(0) === '[') {
var temp = string.split(' ');
string = temp[temp.length - 1];
if (string.charAt(0) === "[") {
var temp=string.split(" ");
string=temp[temp.length - 1];
}
return string;
......@@ -53,7 +45,7 @@ function removeSkypeFormatting(string) {
function addDefaultProject(string, project) {
if (string.match(/^[0-9]+$/) != null) {
string = project + '-' + string;
string=project + "-" + string;
}
return string;
......@@ -66,26 +58,26 @@ function openWindow() {
function openIssue() {
chrome.storage.sync.get(function (item) {
var urlOption = item.savedUrl;
var projectOption = item.savedProject;
var urlOption=item.savedUrl;
var projectOption=item.savedProject;
key = document.getElementById('key').value;
key=document.getElementById("key").value;
setUrl(urlOption);
key = removeSpaces(key);
key = removeSkypeFormatting(key);
key = addDefaultProject(key, projectOption);
key=removeSpaces(key);
key=removeSkypeFormatting(key);
key=addDefaultProject(key, projectOption);
if (key === '') {
returnError('Please insert key', 'key');
if (key === "") {
returnError("Please insert key", "key");
} else if (url === undefined) {
returnError('Please define URL in Options', 'key');
returnError("Please define URL in Options", "key");
} else {
openWindow();
}
});
}
var enter = 13;
var enter=13;
function inputKeyListener(e) {
if (e.keyCode === enter) {
......@@ -95,20 +87,20 @@ function inputKeyListener(e) {
function listenInputKey(inputKey) {
if (inputKey.addEventListener) {
inputKey.addEventListener('keydown', inputKeyListener, false);
inputKey.addEventListener("keydown", inputKeyListener, false);
} else if (inputKey.attachEvent) {
inputKey.attachEvent('keydown', inputKeyListener);
inputKey.attachEvent("keydown", inputKeyListener);
}
}
function listenKeys() {
listenInputKey(document.getElementById('key'));
listenInputKey(document.getElementById("key"));
}
if (window.addEventListener) {
window.addEventListener('load', listenKeys, false);
window.addEventListener("load", listenKeys, false);
} else if (window.attachEvent) {
window.attachEvent('onload', listenKeys);
window.attachEvent("onload", listenKeys);
} else {
document.addEventListener('load', listenKeys, false);
document.addEventListener("load", listenKeys, false);
}
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');
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");
if (url === '') {
error.textContent = 'Please fill URL';
border.style.borderColor = '#CC0000';
if (url === "") {
error.textContent="Please fill URL";
border.style.borderColor="#CC0000";
border.focus();
} else {
error.innerText = '\n';
border.style.border = '';
error.innerText="\n";
border.style.border="";
border.focus();
border.select();
......@@ -19,9 +19,9 @@ function save_options() {
savedUrl: url,
savedProject: project
}, function () {
status.textContent = 'Options saved';
status.textContent="Options saved";
setTimeout(function () {
status.textContent = '';
status.textContent="";
}, 2000);
});
}
......@@ -29,19 +29,19 @@ function save_options() {
function restore_options() {
chrome.storage.sync.get({
savedUrl: 'https://jira.atlassian.com',
savedProject: 'PROJECT'
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();
document.getElementById("urlOption").value=items.savedUrl;
document.getElementById("projectOption").value=items.savedProject;
document.getElementById("urlOption").select();
});
}
document.addEventListener('DOMContentLoaded', restore_options);
document.getElementById('save').addEventListener('click',
document.addEventListener("DOMContentLoaded", restore_options);
document.getElementById("save").addEventListener("click",
save_options);
var enter = 13;
var enter=13;
function inputURLListener(e) {
if (e.keyCode === enter) {
......@@ -51,20 +51,20 @@ function inputURLListener(e) {
function listenInputURL(inputURL) {
if (inputURL.addEventListener) {
inputURL.addEventListener('keydown', inputURLListener, false);
inputURL.addEventListener("keydown", inputURLListener, false);
} else if (inputURL.attachEvent) {
inputURL.attachEvent('keydown', inputURLListener);
inputURL.attachEvent("keydown", inputURLListener);
}
}
function listenURL() {
listenInputURL(document.getElementById('urlOption'));
listenInputURL(document.getElementById("urlOption"));
}
if (window.addEventListener) {
window.addEventListener('load', listenURL, false);
window.addEventListener("load", listenURL, false);
} else if (window.attachEvent) {
window.attachEvent('onload', listenURL);
window.attachEvent("onload", listenURL);
} else {
document.addEventListener('load', listenURL, false);
document.addEventListener("load", listenURL, false);
}
<!DOCTYPE html>
<html>
<html lang="en-us">
<head>
<title>Options of JIRA Issue Opener 2.1</title>
<link rel='stylesheet' type='text/css' href='css/options.css' />
<title>Options of JIRA Issue Opener 3.0</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.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: the link will be <code>URL/browse/PROJECT-KEY</code></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>
<br />
<br />
<br />
<table>
<tr>
<td colspan = '2'><div id='error'><br /></div></td>
</tr>
<tr>
<td>
<label for='urlOption'><b>URL of JIRA:</b>
</label>
</td>
<td>
<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' />&nbsp;<code>-KEY</code>
</td>
</tr>
<tr>
<td></td>
<td>
<div id='button'>
<button id='save'>Save</button>
</div>
<div id='status'></div>
</td>
</tr>
</table>
<h1>Options of JIRA Issue Opener 3.0</h1>
<p>Extension opens JIRA issue in new tab. User needs only to insert issue key</p>
<p id='contacts'>Read more on <a href='https://gitlab.com/irina-ivanova-extensions/JIRA-Issue-Opener'>GitLab repo</a> or write to <a href='mailto:irina.ivanova@protonmail.com'>irina.ivanova@protonmail.com</a></p>
<script src='js/options.js'></script>
<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: the link will be <code>URL/browse/PROJECT-KEY</code></li>
</ul>
<table>
<tr>
<td colspan = '2'><div id='error'></div></td>
</tr>
<tr>
<td>
<label for='urlOption'><b>URL of JIRA:</b>
</label>
</td>
<td>
<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' />&nbsp;<code>-KEY</code>
</td>
</tr>
<tr>
<td></td>
<td>
<div id='button'>
<button id='save'>Save</button>
</div>
<div id='status'></div>
</td>
</tr>
</table>
</body>
<script src='js/options.js'></script>
</body>
</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