chinese-words-separator / chinese-words-separator.github.io

5 stars 1 forks source link

Only part of the text is modified #17

Closed Drazduf closed 1 year ago

Drazduf commented 1 year ago

image

Here only the main content is modified. Most of the page doesn't seem to be detected by CWS.

chinese-words-separator commented 1 year ago

I noticed that too on some sites, made a fix today (uploaded 8.24.84.1320 just now, it should be published within the day)

What is the URL of your site? Need to test if I missed something on the fix

Drazduf commented 1 year ago

https://www.msn.com/zh-tw/news/other/我是台灣人-不是中國人-二七部隊長鍾逸人今晚逝世-享嵩壽103歲/ar-AA18OVRe

chinese-words-separator commented 1 year ago

On your URL, I was able to repro the problem on older version of CWS (8.24.84.1311)

image

On latest version (8.24.84.1320), it's ok now

image

There are some pages that can't be parsed and modified by CWS, either due to the Chinese text being rendered on HTML5 canvas, or it is enclosed in Shadow DOM. Some web apps use Shadow DOM to componentized some parts of the site, others use it to protect their content

On the URL you provided, some of its headings and titles are componentized with Shadow DOM, hence CWS not being able to parse and modify them. Even other extension dictionaries cannot display definitions on those componentized headings due to those text being enclosed in Shadow DOM

image

Though CWS cannot parse and modify those Shadow DOM content, it can at least display the dictionary for those text. To do that, highlight the text; then after releasing the mouse button, CWS icon will be shown, then click that icon

image

After clicking that icon, the dictionary will be shown:

image

The dictionary is not correctly positioned though due to Shadow DOM's restrictions, hence Chinese text's information cannot be parsed, like where its content is positioned in the screen