Skip to content

Advanced Usage of Pake

santree edited this page Jun 25, 2023 · 5 revisions

1. How do I rewrite the style, e.g. to remove ads from the original site, or even redesign it?

  • Start the debugging mode by using npm run dev and open the devtools by right-clicking. Find the name of the style you want to modify and verify the effect in the devtools first.

  • Locate the style position in src-tauri/src/inject/style.js by using the variable const css = /* styles */, and write the style you want to override into the css variable. You can use this file as an example. example

2. How to inject js code, e.g. to implement event listeners, e.g. keyboard shortcuts?

Refer to the event listener in src-tauri/src/inject/event.js with document.addEventListener, and write it directly, it's more of a basic front-end technique here. example

3. How to communicate with Pake about events in containers, such as dragging and dropping, scrolling, special clicks on the Web, etc.?

Refer to the communication code in index.js with invoke, write the event listener and then use invoke to pass the event and its parameters, then refer to the container to receive events invoke_handler and handle them yourself.