Firefox 终于要支持 WebP 了

in #cn6 years ago

Firefox to support Google's WebP image format for a faster web - CNET

桌面版还好说,只用 WebP 的页面很少,手机版就麻烦了,移动版 Chrome 一家独大,Firefox for Android 的占有率太低,被忽视是理所当然的事情。
前段时间我就发现美篇——就是引发鸿毛药酒事件的那篇小文的首发地——就默认使用 WebP 图片格式,在 Android 上只有 Firefox 无法浏览。当时排查了很久才发现是这个坑爹的问题……

最后没办法,写了段脚本

// 美篇 https://www.meipian.cn/1m3oighe?share_depth=3&from=timeline
if (location.host === 'www.meipian.cn') {
  // 清理 URL
  if (location.search.length > 0) {
    location.search = '';
  }
  // 隐藏文末打开APP条;隐藏部分推荐条目的APP打开;隐藏移动版底部APP推广
  addStyle('.more, .recommend-label.label-download, #bottom-header-box {display: none !important;}');
  // 显示真实图片,主要解决移动版 Firefox 无法显示 WebP 的问题。
  function realimgs_meipian() {
    const imgs = document.getElementsByTagName('img')
    for (const img of imgs) {
      if (img.src.includes('-mobile')) {
        img.src = img.src.split('-mobile')[0];
        clearInterval(realimgs_MP);
        console.log('realimgs_MP')
      }
    }
  }
  realimgs_MP = setInterval(realimgs_meipian, 1000);
  // 自动显示全文
  function readmore_meipian() {
    if (document.getElementsByClassName('readmore')[0].style.display === 'block') {
      document.getElementsByClassName('readmore')[0].click();
      clearInterval(readmore_MP);
      console.log('readmore_MP')
    }
  }
  readmore_MP = setInterval(readmore_meipian, 1000);
}

暴力将所有图片改为原图——反正这年头流量不值钱。

今后终于可以轻松点了。

Sort:  

以前一直用Firefox,后来一直用Chrome....

chrome太弱了,Google又没事耍流氓

有段时间觉得Firefox用起来变慢了,所以我就转向了Chrome