粤语审音配词字库播放器替换

把文字读音播放软件从QuickTime替换为浏览器内置播放器,无须安装QuickTime即可播放读音

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        粤语审音配词字库播放器替换
// @namespace   yhj.com
// @include     http://humanum.arts.cuhk.edu.hk/Lexis/lexi-can/search.php*
// @include     https://humanum.arts.cuhk.edu.hk/Lexis/lexi-can/search.php*
// @version     1.03
// @grant       none
// @description 把文字读音播放软件从QuickTime替换为浏览器内置播放器,无须安装QuickTime即可播放读音
// ==/UserScript==

var d = document;
var alist = d.querySelectorAll('a[target="sound"]');
for(var i = 0;i<alist.length;i++){
  let player = d.createElement('audio');
  player.preload = "none";
  player.src = "/Lexis/lexi-can/sound/" + alist[i].href.match(/=(.+)$/)[1] + ".wav";
  player.volume = 1;
  alist[i].parentNode.appendChild(player,alist[i]);
  alist[i].onclick = function(e){
    player.play();
    return false;
  }
}