diff --git a/corsscripts/stacksortable.min.js b/corsscripts/stacksortable.min.js new file mode 100644 index 00000000000..875c1f03a1a --- /dev/null +++ b/corsscripts/stacksortable.min.js @@ -0,0 +1,4 @@ + +export const stack_sortable=class{constructor(state,inputid,options={animation:50}){this.state=state;this.inputid=inputid;this.options={...{ghostClass:"list-group-item-info",group:"shared"},...options};} +generate_available(proofSteps,availableId){let availableList=document.getElementById(availableId);for(const key in this.state.available){let li=document.createElement("li");li.innerText=proofSteps[this.state.available[key]];li.setAttribute("data-id",key);li.className="list-group-item";availableList.append(li);};} +update_state(newUsed,newAvailable){var newState={used:[],available:[]};newState.used=newUsed.toArray();newState.available=newAvailable.toArray();let input=document.getElementById(this.inputid);input.dispatchEvent(new Event('change'));input.value=JSON.stringify(newState);this.state=newState;}};export default{stack_sortable}; \ No newline at end of file