mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
doc: how to debug dictionary js
This commit is contained in:
parent
c415d35010
commit
8b88955159
42
website/docs/howto/how to debug dictionary js.md
Normal file
42
website/docs/howto/how to debug dictionary js.md
Normal file
|
@ -0,0 +1,42 @@
|
|||
# background
|
||||
When some js functions do not work as expected, this article tries to give a debug solution to pinpoint the problem.
|
||||
|
||||
|
||||
|
||||
# goldendict-ng inspector
|
||||
|
||||
Goldendict-ng has embedded an inspector, you can trigger it manually using `F12`.
|
||||
|
||||
Screenshot:
|
||||
![Inspector](../img/inspector.png)
|
||||
|
||||
# How to navigate to the specified element
|
||||
|
||||
Click the find element and move mouse to the specified element, click the element will navigate the source panel to the very place.
|
||||
![steps](../img/inspector-steps.png)
|
||||
|
||||
# Modify the css style
|
||||
|
||||
you can play around with the css to modify the appearance of the html and check the results.
|
||||
|
||||
![style](../img/inspector-style.png)
|
||||
|
||||
# check javascript events
|
||||
|
||||
- navigate to the specified element
|
||||
- check eventlisterner panel
|
||||
- pay attention to the click events
|
||||
- in the following screenshot ,there are two registered event listeners, one from the goldendict `gd-custom.js` and one from the html itself.
|
||||
- click the above event listener location will locate to the right place in the javascript.
|
||||
|
||||
![event](../img/inspector-event.png)
|
||||
|
||||
|
||||
If some desired event does not triggered , it can first check does the event listeners has been successfully registered. then set a breakpoint in the right place to check whether the event has been triggered and if it can executed successfully.
|
||||
![breakpoint](../img/inspector-breakpoint.png)
|
||||
|
||||
|
||||
# reproduce the issue in the goldendit
|
||||
|
||||
following your normal operations and debugging the javascript code and pay attention to the console output. Whether any errors happened.
|
||||
![Alt text](../img/inspector-console.png)
|
BIN
website/docs/img/inspector-breakpoint.png
Normal file
BIN
website/docs/img/inspector-breakpoint.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 121 KiB |
BIN
website/docs/img/inspector-console.png
Normal file
BIN
website/docs/img/inspector-console.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 53 KiB |
BIN
website/docs/img/inspector-event.png
Normal file
BIN
website/docs/img/inspector-event.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 162 KiB |
BIN
website/docs/img/inspector-steps.png
Normal file
BIN
website/docs/img/inspector-steps.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 194 KiB |
BIN
website/docs/img/inspector-style.png
Normal file
BIN
website/docs/img/inspector-style.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 267 KiB |
BIN
website/docs/img/inspector.png
Normal file
BIN
website/docs/img/inspector.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 214 KiB |
|
@ -44,6 +44,7 @@ nav:
|
|||
- Custom transliteration: topic_transliteration.md
|
||||
- Customize Dictionary: custom_dictionary.md
|
||||
- OCR Integration: howto/ocr.md
|
||||
- How to debug dictionary js: howto/how to debug dictionary js.md
|
||||
- Report Bugs & Feedbacks: feedbacks.md
|
||||
- Contributor Guides:
|
||||
- Developer: developer.md
|
||||
|
|
Loading…
Reference in a new issue