Coder Social home page Coder Social logo

Comments (4)

ninja33 avatar ninja33 commented on June 16, 2024

你就把音频用fastwordquery查询到一个字段,比如叫audio字段。 然后把这个字段放在卡片模板的正面,就好了。anki看到这个字段里是离线音频,自动会显示一个播放按钮出来

from anki-templates.

lasdfp avatar lasdfp commented on June 16, 2024

你就把音频用fastwordquery查询到一个字段,比如叫audio字段。 然后把这个字段放在卡片模板的正面,就好了。anki看到这个字段里是离线音频,自动会显示一个播放按钮出来

首先谢谢您的答复!但是,我特别喜欢您做的可以开关自动播放的功能,所以我还是想通过改css来实现。请问是不是改下面这段就可以了,是的话,请问怎么改?

//play audio
function playAudio() {
//var base = "http://dict.youdao.com/dictvoice?audio=";
var base = "http://fanyi.baidu.com/gettts?lan=en&text=";
var word = document.getElementById("front").innerText;
var audioSrc = base + encodeURI(word);
//check if it is desktop client
if(typeof(py)=="object"){
//if it is desktop client, need install addon #498789867 as dependency
py.link("ankiplay"+audioSrc)
}else{
//mobile client (iOS or Android)
var audio=document.getElementById('player')
player.src=audioSrc
player.play()
}
}

from anki-templates.

ninja33 avatar ninja33 commented on June 16, 2024

如果是离线的音频,那个播放按钮的样式是anki程序自动决定的。模板的css样式也许可以改,也许不能。我没有仔细研究过。你可以试试看。你上面贴的那段函数是模板里用于播放在线音频的代码,对离线音频应该不起作用吧。

from anki-templates.

lasdfp avatar lasdfp commented on June 16, 2024

如果是离线的音频,那个播放按钮的样式是anki程序自动决定的。模板的css样式也许可以改,也许不能。我没有仔细研究过。你可以试试看。你上面贴的那段函数是模板里用于播放在线音频的代码,对离线音频应该不起作用吧。

我试了,没有弄成。老黄大神css js之类这么优秀,能您有空的时候,能不能请您出山试一下?🙏

from anki-templates.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.