hypertrons / hypertrons-crx

A browser extension for insights into GitHub, Gitee projects and developers.
https://hypercrx.cn
Apache License 2.0
357 stars 102 forks source link

feat: improve fast pr in selecting text #918

Closed wangyantong2000 closed 2 weeks ago

wangyantong2000 commented 2 weeks ago

Brief Information

This pull request is in the type of (more info about types):

Related issues (all available keywords):

Details

https://github.com/user-attachments/assets/4f172172-bd80-475f-9845-188ae9f7d016

When the user selects text, the button will move to the last position of the mouse. When the mouse scrolls, the button will return to its original position.Scroll back to its original position only after selecting text, and remain in the dragged position after dragging. Except https://www.kaiwudb.com/kaiwudb_docs. Because the construction of their document website is an iframe, it cannot obtain mouse operations.

image

Checklist

Others

frank-zsy commented 2 weeks ago

I noticed that you use MutationObserver to observe the change of document DOM, this will be effective on single page web application because the content is in a single page and change of pages will trigger DOM update rather than jump into another web file. But for multiple page web application, this will not take effect because change of pages is loading another file on the web server.

Actually FastPR is tend to check the change of the URL of current tab. So we should observe the tab URL change rather than DOM change. Can you try chrome.tabs.onUpdated function and listen to the change of the URL, this should take effect for both single page application and multiple page application.

wangyantong2000 commented 2 weeks ago

I noticed that you use MutationObserver to observe the change of document DOM, this will be effective on single page web application because the content is in a single page and change of pages will trigger DOM update rather than jump into another web file. But for multiple page web application, this will not take effect because change of pages is loading another file on the web server.

Actually FastPR is tend to check the change of the URL of current tab. So we should observe the tab URL change rather than DOM change. Can you try chrome.tabs.onUpdated function and listen to the change of the URL, this should take effect for both single page application and multiple page application.

Thank you for your guidance.

frank-zsy commented 2 weeks ago

You are welcome, looks great now~