const projectVersion = "1.20.24";
if (!customElements.get('material-beautify-chinese-study')) {
console.log('Custom element does not exist - Creating script to pull it in');
var script = document.createElement('script');
script.setAttribute('id', 'import-script');
script.setAttribute('type', 'module');
script.setAttribute('src', `https://cdn.jsdelivr.net/npm/beautify-chinese-study@${projectVersion}/dist/beautify-chinese-study/beautify-chinese-study.esm.js`);
document.body.appendChild(script);
} else {
console.log('Custom element exists.');
}
var beautify = document.querySelector('material-beautify-chinese-study');
if (beautify !== null) {
beautify.remove();
}
var beautify = document.createElement('material-beautify-chinese-study');
beautify.setAttribute('id', 'beautify');
beautify.setAttribute('primary-character', '天气');
beautify.setAttribute('primary-character-sentence', '今天天气很好。');
beautify.setAttribute('meaning', "The weather today is good.");
// card type can be changed here to view another type
// available types found here under the attribute card-type
// https://github.com/LoganConnor44/anki-templates/blob/master/src/components/material-beautify-chinese-study/readme.md#properties
beautify.setAttribute('card-type', 'recognition');
beautify.setAttribute('card-orientation', 'question');
// if pinyin is desired this next line can be omitted completely
beautify.setAttribute('preferred-phonic', 'zhuyin');
/* beautify.setAttribute('phonic-orientation', 'over') */
// this value is for generating secondary characters and pinyin/zhuyin
beautify.setAttribute('force-auto-generation', 'force-auto-generation');
document.body.appendChild(beautify);
// set card orientation to answer automatically after 5 seconds for demonstration purposes
setTimeout(() => {
beautify.setAttribute('card-orientation', 'answer');
}, 5000);
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.