-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpopup.js
1 lines (1 loc) · 2.12 KB
/
popup.js
1
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=208)}({208:function(e,t){const n=["prod","dev"];let r=[];function o(e,t){let n=document.getElementById("links"),r="";e.forEach(e=>{r+=c(e,t)}),n.innerHTML=r}function c(e,t){return innerHtml=`<tr class="collection-item">\n <td class="truncate-text"><p>${e.url}</p></td>`,n.forEach(n=>{let r=t[n];null==r&&(r={name:n,url:null}),innerHtml+=`<td>${function(e,t){let n;n=t.url?`<a href="${t.url.replace("${traceid}",e.traceparent.traceId)}" target="_blank">${t.name}</a>`:`<p>${t.name}</p>`;return n}(e,r)}</td>`}),innerHtml+="</tr>",innerHtml}chrome.storage.local.get((function(e){const t=e.traceData||[];chrome.storage.sync.get((function(e){r=e.tools||[],o(t,r)}))})),chrome.runtime.onMessage.addListener((e,t,n)=>{"changeTraceData"===e.action&&o(e.traceData,r)}),document.addEventListener("DOMContentLoaded",(function(){const e=document.querySelector('input[type="checkbox"]');e.addEventListener("change",(function(){e.checked&&chrome.tabs.query({active:!0,currentWindow:!0},(function(e){let t=e[0];chrome.runtime.sendMessage({action:"startTraceRquest",tab:t})})),chrome.storage.sync.set({enabled:e.checked})})),chrome.runtime.onMessage.addListener((t,n,r)=>{"finishTraceRquest"===t.action&&(e.checked=!1,chrome.storage.sync.set({enabled:e.checked}))})}))}});