let t={flag:!1,selector:"",index:0};chrome.runtime.onMessage.addListener((e,o,a)=>{if(e.action==="set-captured-temporary")t=e.data,a({flag:!0});else if(e.action==="clear-captured-temporary")t={flag:!1,selector:"",index:0},a({flag:!0});else if(e.action==="update-captured-temporary"){const{selector:l,index:r}=e.data;t.selector=l,t.index=r,a({flag:!0})}else e.action==="get-captured"&&a(t)});chrome.runtime.onInstalled.addListener(()=>{chrome.contextMenus.create({id:"tablecopy-root",title:"Table Copy",contexts:["all"]}),chrome.contextMenus.create({id:"tablecopy-enable-toolbar",parentId:"tablecopy-root",title:"开启表格工具栏",contexts:["all"]}),chrome.contextMenus.create({id:"tablecopy-disable-toolbar",parentId:"tablecopy-root",title:"关闭表格工具栏",contexts:["all"]})});chrome.contextMenus.onClicked.addListener((e,o)=>{e.menuItemId==="tablecopy-enable-toolbar"?chrome.tabs.sendMessage(o.id,{action:"enable-table-toolbar"}):e.menuItemId==="tablecopy-disable-toolbar"&&chrome.tabs.sendMessage(o.id,{action:"disable-table-toolbar"})});
