修复Linux系统有道词典无法发音问题
// ==UserScript== // @name 修复Linux系统下有道词典无法发音问题 // @namespace http://tampermonkey.net/ // @version 0.2 // @description 修复Linux系统有道词典无法发音问题 // @author You // @match *://dict.youdao.com/* // @match *youdao.com/w/* // @grant none // @name:zh-TW 修復Linux系統下有道詞典無法發音的問題 // @description:zh-tw 修復Linux系統有道詞典無法發音的問題 // ==/UserScript== (function() { 'use strict'; var newItem=document.createElement("audio"); var demo = document.getElementsByClassName("s-btn")[0]; demo.insertBefore(newItem,demo.childNodes[0]); var voice233 = document.getElementsByClassName('sp dictvoice voice-js log-js'); for(let i=0; i<=voice233.length-1; i++){ voice233[i].onclick = function(){ document.getElementsByTagName('audio')[0].src = 'http://dict.youdao.com/dictvoice?audio=' + voice233[i].dataset.rel; document.getElementsByTagName('audio')[0].currentTime = 0; document.getElementsByTagName('audio')[0].play(); } } })();