Skip to content

Commit

Permalink
馃 TEST: 1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
ortoniKC committed Oct 25, 2020
1 parent affae41 commit 7d806b1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions assets/icons/copy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 12 additions & 3 deletions panel/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ chrome.runtime.onMessage.addListener((req, rec, res) => {
}
return true;
case "anchor":
document.getElementById("xpbadge").attributes.getNamedItem('data-badge').value = 0;
jQuery("#addXPath").empty();
let ui = `<div class="empty">
<p class="empty-title h5">Please select any element to get XPath/CSS</p>
<p class="empty-subtitle">more new patterns coming soon :)</p>
<p class="empty-subtitle">Did you know LetXPath is an open-source, if you found something wrong fix it :)</p>
</div>`;
jQuery("#addXPath").append(ui);
generateAxes(req);
return true;
case "axes":
Expand Down Expand Up @@ -99,6 +107,7 @@ function generateAxes(req) {
<p class="chip bg-success">Parent Element</p>
${sourceElement(req.data.src)}
</div>
<div class="divider-vert" data-content="Axes"></div>
<div class="column col-xs-6">
<p class="chip bg-success">Child Element</p>
${targetElement(req.data.dst)}
Expand Down Expand Up @@ -154,10 +163,10 @@ function targetElement(element) {
function buildUI(data) {
jQuery("#addXPath").empty();
if (data.webtabledetails != null) {
let table = `<div class="form-horizontal bg-secondary">
let table = `<div class="form-horizontal bg-gray">
<span class="label label-rounded sm">Table Info - Total no.of table ${data.webtabledetails.totalTables}</span>
<div class="form-group">
<div class="col-8">
<div class="col-11">
<code class="form-label" id="tablelocator">${data.webtabledetails.tableLocator}</code>
</div>
<div class="col-1 p-centered text-center">
Expand All @@ -167,7 +176,7 @@ function buildUI(data) {
</div>
</div>
<div class="form-group">
<div class="col-8">
<div class="col-11">
<code class="form-label" id="tabledata">${data.webtabledetails.tableData}</code>
</div>
<div class="col-1 p-centered text-center">
Expand Down
12 changes: 12 additions & 0 deletions panelconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ $(document).ready(function () {
copyToClipBoard(range, from);
} catch (error) { }
})
// click to copy axes xpath
$('body').on('click', '#anxp', (e) => {
try {
let t = e.target;
Expand All @@ -81,6 +82,17 @@ $(document).ready(function () {
copyToClipBoard(range, from);
} catch (error) { }
})
// click to copy table values
$('body').on('click', '.btn.btn-link.btn-sm', (e) => {
try {
let t = e.target;
let c = t.dataset.copytarget;
c = c.replace("#", "");
var from = document.getElementById(c);
var range = document.createRange();
copyToClipBoard(range, from);
} catch (error) { }
})
});
function copyToClipBoard(range, node) {
try {
Expand Down

0 comments on commit 7d806b1

Please sign in to comment.