ivysrono avatar

Firefox 终于要支持 WebP 了

ivysrono

Published: 07 Oct 2018 › Updated: 07 Oct 2018Firefox 终于要支持 WebP 了

Firefox 终于要支持 WebP 了

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);
}

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

今后终于可以轻松点了。

Leave Firefox 终于要支持 WebP 了 to:

Written by

NULL

Read more #cn posts


Best Posts From ivysrono

We have not curated any of ivysrono's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From ivysrono