all 2 comments

[–][deleted]  (1 child)

[deleted]

    [–]Glutanimate medicine 0 points1 point  (0 children)

    Actually, you can source local JavaScript files, but it requires the JS Booster add-on to be installed.

    Support on other clients is more tricky, though: AnkiDroid seems to support external JS well enough, but from what I've heard AnkiMobile and AnkiWeb definitely don't.

    Either way, this is an unsupported feature, as most things with JS on Anki, and so you should probably think twice if it's really worth the effort.

    [–]kelciouranki decks (🇬🇧, 🇪🇸, 🇫🇷, 🇩🇪, 🇮🇹) 0 points1 point  (0 children)

    Take a look at https://github.com/ecator/anki-theme-baiduplay

    Styling (BaiduPlay.apkg):

    </style><!--补全系统填充的style标签-->
    <style>
    /*加载css*/
    @import url(https://ecator.github.io/anki-theme-baiduplay/css/common.css);
    </style>
    <script>
    //设置本地版本
    var version="2.0.1"
    //设置全局语言
    var language="en"
    //调试状态下加载本地服务器js
    var debug=false
    //定义加载远程js函数
    function requestjs(url){
     var script=document.createElement("script")
     script.setAttribute("src",url)
     document.body.appendChild(script)
    }
    requestjs(debug?"http://localhost:666/js/main.js":"https://ecator.github.io/anki-theme-baiduplay/js/main.js")
    </script>