nicegoing
V2EX  ›  问与答

移动端 zaker,pocket 是怎么实现对网页进行重新排版的? android 有没有类似开源实现?

  •  
  •   nicegoing · May 28, 2015 · 2654 views
    This topic created in 4051 days ago, the information mentioned may be changed or developed.
    很好奇,它们如何把排版做这么好的。
    3 replies    2015-05-28 16:59:03 +08:00
    JoyNeop
        1
    JoyNeop  
       May 28, 2015
    text = (function(d){
    var result = '';
    for (var i = 0; i < d.length; i++) {
    result += d.innerText + '\n\n';
    };
    return result;
    })(document.querySelectorAll('p'));
    JoyNeop
        2
    JoyNeop  
       May 28, 2015
    Line 4 漏了个 iterator……
    nicegoing
        3
    nicegoing  
    OP
       May 28, 2015
    @JoyNeop 这好像只能处理文本,很多文章还有图片。图片要放在文本中。还有很多东西要过滤的,比如文章外面的评论,广告等
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3306 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 11:14 · PVG 19:14 · LAX 04:14 · JFK 07:14
    ♥ Do have faith in what you're doing.