2
현재 마우스로 마우스를 올리고있는 요소의 ID를 가져와야하는 크롬 확장 프로그램을 만들고 있습니다. 본질적으로, 마우스가 버튼 위에 있고 키보드 단축키를 사용하면 버튼의 ID와 함께 경고를 표시 할 수 있어야합니다. 여기 Chrome 확장 프로그램 : 마우스로 HTML 요소를 클릭하는 방법
내가 할 것으로 예상하고있어 무엇 :의 manifest.json에게
"commands": {
"Display ID": {
"suggested_key": {
"default": "Ctrl+Shift+1",
"mac": "Command+Shift+1"
},
"description": "Display ID"
},
background.js을
chrome.commands.onCommand.addListener(function(command) {
// Get the active tab when the command was fired
chrome.tabs.query({active:true, currentWindow: true}, function(arrayOfTabs) {
currentTabId = arrayOfTabs[0].id;
});
// Display the ID of the HTML element where the mouse is currently hovering
alert("This is the element's id:" + elementId); // How to do this part???
});
이 가능인지 아닌지 알려주세요 !!!