/** * Initializes graphs on the website. * * @param {Array<[id: string, commands: string[], initializer: (any) => void]>} graphs * The graphs to initialize. */ window.graphs = (graphs) => { window.addEventListener( "load", () => { for (let entry of graphs) { new GGBApplet( { height: 250, preventFocus: true, perspective: "G", enableFileFeatures: false, appletOnLoad: (api) => { for (let command of entry[1]) { api.evalCommand(command); } (entry[2] ?? (() => {}))(api); api.evalCommand("ZoomIn()"); (entry[3] ?? (() => {}))(api); for (let object of api.getAllObjectNames()) { api.evalCommand(`ShowLabel(${object}, true)`); } }, ...(entry[2] ?? {}) }, true).inject(entry[0]); } }); }