MCPcopy
hub / github.com/ocsjs/ocsjs / getType

Function getType

packages/scripts/src/projects/icve.ts:790–808  ·  view source on GitHub ↗
(options: HTMLElement[])

Source from the content-addressed store, hash-verified

788 let resolvedCount = 0;
789
790 function getType(options: HTMLElement[]) {
791 const radio_len = options
792 .map((o) => o.querySelector('[type="radio"]'))
793 .reduce((a, b) => {
794 return a + (b ? 1 : 0);
795 }, 0);
796
797 return radio_len > 0
798 ? radio_len === 2
799 ? 'judgement'
800 : 'single'
801 : options.some((o) => o.querySelector('[type="checkbox"]'))
802 ? 'multiple'
803 : options.some((o) => o.querySelector('textarea'))
804 ? 'completion'
805 : options.some((o) => o.querySelector('.fillblank_input input'))
806 ? 'fill-blank'
807 : undefined;
808 }
809
810 const worker = new OCSWorker({
811 root: '.q_content',

Callers 2

workFunction · 0.85
aiWorkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected