Optimize website to show reader view in Firefox

前端 未结 2 2060
死守一世寂寞
死守一世寂寞 2020-12-04 18:34

Firefox 38.0.5 added a \"Reader View\" to the address bar:

\"enter

But not all

2条回答
  •  广开言路
    2020-12-04 18:44

    As the code stands in May '20 the trigger function (isProbablyReaderable) scores only p or pre elements and div elements that contain at least one decedent br.

    A slight oversimplification of the scoring heuristic is:

    • For each element in ['p', 'pre', 'div > br']:
      • If textContent length is > 140 chars, increase score by sqrt(length - 140)
    • if cumulative score > 20, return true

提交回复
热议问题