while we keep waiting browsers to support ipfs:// protocol properly, here is a fix to redirect to localhost or any ipfs gateway of choise. we should not link to ipfs gateways directly. it should be up to the client to decide how to retrieve the content.
document.querySelectorAll("video,img").forEach(v => v.src = v.src.replace(/ipfs:\/\/([^ \/]+)(\S*)/, "http://$1.ipfs.localhost:8080/$2"))