WaniKani Prefetch Audio

6/8/2024, 8:10:39 PM

当前为 2024-08-06 提交的版本,查看 最新版本

// ==UserScript==
// @name        WaniKani Prefetch Audio 
// @namespace   WaniKani_Prefetch_Audio
// @match       https://www.wanikani.com/subjects/review*
// @grant       none
// @version     1.0
// @author      Flipp Fuzz
// @description 6/8/2024, 8:10:39 PM
// @run-at      document-idle
// @license MIT
// ==/UserScript==

window.addEventListener('willShowNextQuestion', (ev) => {
  console.log(ev)
  if(ev["detail"]["subject"]["readings"]) {
    for(const reading of ev["detail"]["subject"]["readings"]) {
	  const pronunciation = reading["pronunciation"];
	  for(const source of pronunciation["sources"]) {
		var audio = source["url"];
		console.log("Pre-fetching " + audio);
        fetch(audio, {mode: 'no-cors'});
      }
    }
  }
})

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址