Capture and retrigger event chrome

this is my first time posting.

I like to use “Notion”, the web note-taking application.

A feature on the Notion web app allows us to view the full screen on embedded HTML (iframe).

You can try for yourself using this published sample page to see the full-screen function: https://marbled-tarragon-577.notion.site/wiki-00390ad03f0848659bb2927fa4b3a146

On the native Notion app, it’s more of a three-step process to get the iframe in full-screen view. Here are some images to give you an idea: step 1 step 2 step 3.

I was wondering if it would be possible to create a Chrome extension to achieve the full-screen view on the native app version on command via hotkey input. I mean without having to navigate through those intermediate steps ( skipping steps 1 and 2).

I tried asking for gpt 4 and it suggested creating an extension that can track/save the necessary event listeners and retrigger them via a hotkey. It also suggested using a CSS selector or finding a unique identifier for the fullscreen button (like an ID, class, or other attributes).

It then gave the following guide:

1. Capture the XPaths

Once you already have the XPaths of the elements involved in your desired interaction. These XPaths will guide the scripting within your content script to find and interact with these elements programmatically.

2. Setup Hotkeys

The Chrome extension can listen for specific key combinations (hotkeys) defined in the manifest.json file. You would set up a listener for these hotkeys in the background script, and upon detecting the right combination, trigger a command that prompts the content script to act.

3. Navigation and Interaction Script

The content script, which can directly interact with the content of the web page, would:

Use the XPaths to find the iframe or the button that triggers the dropdown.

Programmatically mimic the user actions like hover, click, or right-click. You can use the document.evaluate() function in JavaScript to handle XPath expressions and find DOM elements directly. This function returns an XPathResult, which can be used to fetch the actual DOM node.

Depending on the complexity and the exact behaviour of the web elements (like delays in loading or rendering, animations, etc.), you might need to implement a sequence of actions with possible waits or checks to ensure each step completes before the next begins (e.g., checking if a dropdown has appeared before trying to click an option in it).

Is this the right approach or is there a better way to do this? Any suggestions or prompts to get me on the right track would be appreciated.

By the way, I have a basic understanding of HTML, CSS, and JavaScript. I have been able to transcribe code from GPT into Visual Studio Code successfully. I was even able to load an extension and it worked (although it’s unrelated to this topic).

Any help will be appreciated.

Cheers, mates!

New contributor

Sakariya Yusuf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật