diana0o0 Goto Github PK
Type: User
Type: User
class encn_KBBI { constructor(options) { this.options = options; this.maxexample = 2; this.word = ''; } async displayName() { return 'Kamus Besar Bahasa Indonesia'; } setOptions(options) { this.options = options; this.maxexample = options.maxexample; } async findTerm(word) { this.word = word; let results = await Promise.all([this.findKBBI(word)]); return [].concat(...results).filter(x => x); } async findKBBI(word) { const maxexample = this.maxexample; if (!word) return []; let base = 'https://kbbi.kemdikbud.go.id/entri/'; let url = base + encodeURIComponent(word); let doc = ''; try { let data = await api.fetch(url); let parser = new DOMParser(); doc = parser.parseFromString(data, 'text/html'); let definitions = getKBBIDefinitions(doc); return definitions; } catch (err) { return []; } function getKBBIDefinitions(doc) { let notes = []; // Identify the definition section let defNodes = doc.querySelectorAll('.container .daftar'); if (!defNodes || !defNodes.length) return notes; // Get headword let expression = T(doc.querySelector('.container .lema .h2font')); // Prepare definitions let definitions = []; for (const defNode of defNodes) { let definition = T(defNode); definitions.push(`<span class="tran">${definition}</span>`); } let css = ` <style> span.tran {margin:0; padding:0; color: #0d47a1;} </style>`; notes.push({ css, expression, definitions, audios: [] // No audio provided }); return notes; } function T(node) { if (!node) return ''; else return node.innerText.trim(); } } }
Config files for my GitHub profile.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.