Skip to content

Commit b5f8321

Browse files
author
Francisco Moreno
committed
Fix open image in new tab
1 parent a03357b commit b5f8321

4 files changed

Lines changed: 31 additions & 32 deletions

File tree

HTMLReport/loadData.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,19 +160,21 @@ function loadTable() {
160160
tr.appendChild(td);
161161

162162
td = document.createElement("td");
163-
var screenshotLink = annotaions[i].getImageURL();
163+
let screenshotLink = annotaions[i].getImageURL();
164164

165165
if (screenshotLink != "") {
166-
var img = document.createElement("img");
166+
let img = document.createElement("img");
167167
img.setAttribute("class", "rounded mx-auto d-block");
168-
var link = document.createElement("a");
168+
let link = document.createElement("a");
169169
link.setAttribute("class", "preview");
170170
link.setAttribute("title", "Click to open in a new window");
171171

172172
img.src = "../images/device-camera.svg";
173-
link.onclick = function() {
173+
174+
link.addEventListener('click',function() {
174175
openNewWindow(annotationType, screenshotLink);
175-
};
176+
},false);
177+
176178

177179
link.href = screenshotLink;
178180
link.appendChild(img);
@@ -191,13 +193,15 @@ function loadTable() {
191193
}
192194

193195
function openNewWindow(annotationType, data) {
194-
var image = new Image();
196+
let image = new Image();
195197
image.src = data;
196198

197-
var w = window.open(data,annotationType);
198-
199+
let w = window.open(data, '_blank');
199200
w.document.write("<title>" + annotationType + " ScreenShot</title>");
201+
200202
w.document.write(image.outerHTML);
203+
204+
w.focus();
201205
}
202206

203207
function addTableFilters() {
@@ -465,9 +469,9 @@ this.imagePreview = function(){
465469
/* END CONFIG */
466470
$("a.preview").hover(function(e){
467471
this.t = this.title;
468-
this.title = "";
472+
this.title = "";
469473
var c = (this.t != "") ? "<br/>" + this.t : "";
470-
$("body").append("<p id='preview'><img id='imgPreview' src='"+ this.href +"' alt='Image preview' />"+ c +"</p>");
474+
$("body").append("<p id='preview'><img id='imgPreview' src='"+ e.currentTarget.href +"' alt='Image preview' />"+ c +"</p>");
471475
$("#preview")
472476
.css("top",(e.pageY - xOffset) + "px")
473477
.css("left",(e.pageX + yOffset) + "px")

js/popup.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -273,14 +273,15 @@ document.addEventListener('DOMContentLoaded', function () {
273273
var newBugDescription = document.getElementById("newBugDescription");
274274
newBugDescription.addEventListener("keypress", function (e) {
275275
var key = e.which || e.keyCode;
276+
// if ((e.keyCode == 10 || e.keyCode == 13) && e.ctrlKey) {
277+
// $('#newBugDescription').val($('#newBugDescription').val() + '\n');
278+
// }
276279
if ((e.keyCode == 10 || e.keyCode == 13) && e.ctrlKey) {
277-
$('#newBugDescription').val($('#newBugDescription').val() + '\n');
280+
addNewBug("");
278281
}
279282
if (key == 13) { // 13 is enter
280283
if (e.shiftKey == true) {
281284
addNewAnnotationWithScreenShot("bug");
282-
} else {
283-
addNewBug(""); // code for enter
284285
}
285286
}
286287
}, false);
@@ -291,13 +292,11 @@ document.addEventListener('DOMContentLoaded', function () {
291292
newIdeaDescription.addEventListener("keypress", function (e) {
292293
var key = e.which || e.keyCode;
293294
if ((e.keyCode == 10 || e.keyCode == 13) && e.ctrlKey) {
294-
$('#newIdeaDescription').val($('#newIdeaDescription').val() + '\n');
295+
addNewIdea("");
295296
}
296297
if (key == 13) { // 13 is enter
297298
if (e.shiftKey == true) {
298299
addNewAnnotationWithScreenShot("idea");
299-
} else {
300-
addNewIdea(""); // code for enter
301300
}
302301
}
303302
}, false);
@@ -308,13 +307,11 @@ document.addEventListener('DOMContentLoaded', function () {
308307
newNoteDescription.addEventListener("keypress", function (e) {
309308
var key = e.which || e.keyCode;
310309
if ((e.keyCode == 10 || e.keyCode == 13) && e.ctrlKey) {
311-
$('#newNoteDescription').val($('#newNoteDescription').val() + '\n');
310+
addNewNote("");
312311
}
313312
if (key == 13) { // 13 is enter
314313
if (e.shiftKey == true) {
315314
addNewAnnotationWithScreenShot("note");
316-
} else {
317-
addNewNote(""); // code for enter
318315
}
319316
}
320317
}, false);
@@ -325,13 +322,11 @@ document.addEventListener('DOMContentLoaded', function () {
325322
newQuestionDescription.addEventListener("keypress", function (e) {
326323
var key = e.which || e.keyCode;
327324
if ((e.keyCode == 10 || e.keyCode == 13) && e.ctrlKey) {
328-
$('#newQuestionDescription').val($('#newQuestionDescription').val() + '\n');
325+
addNewQuestion("");
329326
}
330327
if (key == 13) { // 13 is enter
331328
if (e.shiftKey == true) {
332329
addNewAnnotationWithScreenShot("question");
333-
} else {
334-
addNewQuestion(""); // code for enter
335330
}
336331
}
337332
}, false);

manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"short_name": "Chrome Exploratory Testing",
55
"description": "Exploratory testing session using Chrome",
66
"author": "@morvader",
7-
"version": "2.1.0",
7+
"version": "2.1.1",
88
"icons": {
99
"16": "/icons/iconbig.png",
1010
"48": "/icons/iconbig.png",
@@ -27,7 +27,7 @@
2727
"tabs"
2828
],
2929
"browser_action": {
30-
"default_icon": "/icons/icon.png",
30+
"default_icon": "/icons/iconbig.png",
3131
"default_popup": "popup.html"
3232
}
3333
}

popup.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
</div>
2121
<div id="addNewBug" class="reportAnnotation card-body">
2222
<div class="form-group">
23-
<textarea id="newBugDescription" rows="4" placeholder="Bug description..." title="[Crtl + Enter] to add a new line" class="form-control-sm"></textarea>
23+
<textarea id="newBugDescription" rows="4" placeholder="Bug description..." title="[Enter] to add a new line" class="form-control-sm"></textarea>
2424
</div>
2525
<div class="card-footer">
2626
<div class="btn-group-sm annotation-group" role="group" aria-label="Annotation Options">
27-
<button id="addNewBugBtn" class="btn btn-outline-danger add" title="Add new Bug [Enter]" data-toggle="tooltip" data-placement="top">&nbsp;</button>
27+
<button id="addNewBugBtn" class="btn btn-outline-danger add" title="Add new Bug [Crtl + Enter]" data-toggle="tooltip" data-placement="top">&nbsp;</button>
2828
<button id="addNewBugSCBtn" class="btn btn-outline-danger screenshot" title="Add new Bug with screenshot [Shift + Enter]" data-toggle="tooltip" data-placement="top">&nbsp;</button>
2929
<button name="Cancel" class="btn btn-outline-secondary btn-sm cancel" title="Cancel annotation">Cancel</button>
3030
</div>
@@ -38,11 +38,11 @@
3838
</div>
3939
<div id="addNewNote" class="reportAnnotation card-body">
4040
<div class="form-group">
41-
<textarea id="newNoteDescription" rows="4" placeholder="Note description..." title="[Crtl + Enter] to add a new line" class="form-control-sm"></textarea>
41+
<textarea id="newNoteDescription" rows="4" placeholder="Note description..." title="[Enter] to add a new line" class="form-control-sm"></textarea>
4242
</div>
4343
<div class="card-footer">
4444
<div class="btn-group-sm annotation-group" role="group" aria-label="Annotation Options">
45-
<button id="addNewNoteBtn" class="btn btn-outline-warning add" title="Add new Note [Enter]" data-toggle="tooltip" data-placement="top">&nbsp;</button>
45+
<button id="addNewNoteBtn" class="btn btn-outline-warning add" title="Add new Note [Crtl + Enter]" data-toggle="tooltip" data-placement="top">&nbsp;</button>
4646
<button id="addNewNoteSCBtn" class="btn btn-outline-warning screenshot" title="Add new Note with screenshot [Shift + Enter]" data-toggle="tooltip" data-placement="top">&nbsp;</button>
4747
<button name="Cancel" class="btn btn-outline-secondary btn-sm cancel" title="Cancel annotation">Cancel</button>
4848
</div>
@@ -56,11 +56,11 @@
5656
</div>
5757
<div id="addNewQuestion" class="reportAnnotation card-body">
5858
<div class="form-group">
59-
<textarea id="newQuestionDescription" rows="4" placeholder="Question description..." title="[Crtl + Enter] to add a new line" class="form-control-sm"></textarea>
59+
<textarea id="newQuestionDescription" rows="4" placeholder="Question description..." title="[Enter] to add a new line" class="form-control-sm"></textarea>
6060
</div>
6161
<div class="card-footer">
6262
<div class="btn-group-sm annotation-group" role="group" aria-label="Annotation Options">
63-
<button id="addNewQuestionBtn" class="btn btn-outline-success add" title="Add new Question [Enter]" data-toggle="tooltip" data-placement="top">&nbsp;</button>
63+
<button id="addNewQuestionBtn" class="btn btn-outline-success add" title="Add new Question [Crtl + Enter]" data-toggle="tooltip" data-placement="top">&nbsp;</button>
6464
<button id="addNewQuestionSCBtn" class="btn btn-outline-success screenshot" title="Add new Question with screenshot [Shift + Enter]" data-toggle="tooltip" data-placement="top">&nbsp;</button>
6565
<button name="Cancel" class="btn btn-outline-secondary btn-sm cancel" title="Cancel annotation">Cancel</button>
6666
</div>
@@ -74,11 +74,11 @@
7474
</div>
7575
<div id="addNewIdea" class="reportAnnotation card-body">
7676
<div class="form-group">
77-
<textarea id="newIdeaDescription" rows="4" placeholder="Idea description..." title="[Crtl + Enter] to add a new line" class="form-control-sm"></textarea>
77+
<textarea id="newIdeaDescription" rows="4" placeholder="Idea description..." title="[Enter] to add a new line" class="form-control-sm"></textarea>
7878
</div>
7979
<div class="card-footer">
8080
<div class="btn-group-sm annotation-group" role="group" aria-label="Annotation Options">
81-
<button id="addNewIdeaBtn" class="btn btn-outline-info add" title="Add new Idea [Enter]" data-toggle="tooltip" data-placement="top">&nbsp;</button>
81+
<button id="addNewIdeaBtn" class="btn btn-outline-info add" title="Add new Idea [Crtl + Enter]" data-toggle="tooltip" data-placement="top">&nbsp;</button>
8282
<button id="addNewIdeaSCBtn" class="btn btn-outline-info screenshot" title="Add new Idea with screenshot [Shift + Enter]" data-toggle="tooltip" data-placement="top">&nbsp;</button>
8383
<button name="Cancel" class="btn btn-outline-secondary btn-sm cancel" title="Cancel annotation">Cancel</button>
8484
</div>

0 commit comments

Comments
 (0)