From 7d806b15865593a77c57c833108a7881a6f90b2b Mon Sep 17 00:00:00 2001 From: Koushik Date: Sun, 25 Oct 2020 20:20:18 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20TEST:=201.0.5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/icons/copy.svg | 1 + panel/panel.js | 15 ++++++++++++--- panelconfig.js | 12 ++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 assets/icons/copy.svg diff --git a/assets/icons/copy.svg b/assets/icons/copy.svg new file mode 100644 index 0000000..7c68a51 --- /dev/null +++ b/assets/icons/copy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/panel/panel.js b/panel/panel.js index 6d06714..31c8020 100644 --- a/panel/panel.js +++ b/panel/panel.js @@ -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 = `
+

Please select any element to get XPath/CSS

+

more new patterns coming soon :)

+

Did you know LetXPath is an open-source, if you found something wrong fix it :)

+
`; + jQuery("#addXPath").append(ui); generateAxes(req); return true; case "axes": @@ -99,6 +107,7 @@ function generateAxes(req) {

Parent Element

${sourceElement(req.data.src)} +

Child Element

${targetElement(req.data.dst)} @@ -154,10 +163,10 @@ function targetElement(element) { function buildUI(data) { jQuery("#addXPath").empty(); if (data.webtabledetails != null) { - let table = `
+ let table = `
Table Info - Total no.of table ${data.webtabledetails.totalTables}
-
+
${data.webtabledetails.tableLocator}
@@ -167,7 +176,7 @@ function buildUI(data) {
-
+
${data.webtabledetails.tableData}
diff --git a/panelconfig.js b/panelconfig.js index 5c87b6f..3f620b7 100644 --- a/panelconfig.js +++ b/panelconfig.js @@ -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; @@ -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 {