From 623a1812cab217ec3379163fe53ffbba9c00f29e Mon Sep 17 00:00:00 2001 From: Stephan Kergomard Date: Thu, 28 Nov 2024 15:45:02 +0100 Subject: [PATCH] Test: Fix Drag'n'Drop in Chromium-Browsers See: https://mantis.ilias.de/view.php?id=42979 --- .../class.ilAssNestedOrderingElementsInputGUI.php | 1 - .../TestQuestionPool/resources/js/dist/matching.js | 2 +- .../resources/js/dist/orderinghorizontal.js | 2 +- .../resources/js/dist/orderingvertical.js | 2 +- .../TestQuestionPool/resources/js/src/makeDraggable.js | 10 ++++++---- .../resources/js/src/matching/rollup.config.js | 4 ++-- .../js/src/orderinghorizontal/rollup.config.js | 4 ++-- .../resources/js/src/orderingvertical/rollup.config.js | 4 ++-- 8 files changed, 15 insertions(+), 14 deletions(-) diff --git a/components/ILIAS/TestQuestionPool/classes/forms/class.ilAssNestedOrderingElementsInputGUI.php b/components/ILIAS/TestQuestionPool/classes/forms/class.ilAssNestedOrderingElementsInputGUI.php index 0a7283521fcc..dbd0f215cff7 100755 --- a/components/ILIAS/TestQuestionPool/classes/forms/class.ilAssNestedOrderingElementsInputGUI.php +++ b/components/ILIAS/TestQuestionPool/classes/forms/class.ilAssNestedOrderingElementsInputGUI.php @@ -384,7 +384,6 @@ function (string $c, array $v) use ($sort_closure): string { public function render(string $a_mode = ''): string { if (!$this->styling_disabled) { - $this->getGlobalTpl()->addCss('assets/css/nested_ordering.css'); $this->getGlobalTpl()->addCss('assets/css/content.css'); } diff --git a/components/ILIAS/TestQuestionPool/resources/js/dist/matching.js b/components/ILIAS/TestQuestionPool/resources/js/dist/matching.js index 827896c13780..5a2f1d5a0356 100644 --- a/components/ILIAS/TestQuestionPool/resources/js/dist/matching.js +++ b/components/ILIAS/TestQuestionPool/resources/js/dist/matching.js @@ -12,4 +12,4 @@ * https://www.ilias.de * https://github.com/ILIAS-eLearning */ -!function(e){"use strict";const t="1:1",n="n:n",o="sourceArea",s="ilMatchingQuestionTerm",l="c-test__definition",r="c-test__term",i="c-test__dropzone";let c,a,d;function u(e,l,u){c===n&&function(e,t,n){n.parentNode.classList.contains(s)&&n.remove(),t.parentNode.id===o&&e.remove()}(e,l,u),a.querySelectorAll(`.${s}`).forEach((e=>{var n;c!==t?null!==(n=e).firstElementChild&&n.lastElementChild.classList.contains(i)||n.append(d.cloneNode()):function(e){const t=e.firstElementChild;null!==t?t.classList.contains(r)&&null!==t.nextElementSibling&&t.nextElementSibling.remove():e.prepend(d.cloneNode())}(e)}))}function f(e,t,n){!function(e,t,n){const s=t.dataset;if(n.parentNode.id===o){t.id=`${s.type}_${s.id}`;const n=e.closest(`.${l}`).querySelector("input"),o=JSON.parse(n.value),r=o.indexOf(s.id);return r>-1&&o.splice(r,1),void(n.value=JSON.stringify(o))}const r=n.closest(`.${l}`);t.id=`${r.id}_${s.type}_${s.id}`;const i=JSON.parse(r.querySelector("input").value);i.push(s.id),r.querySelector("input").value=JSON.stringify(i)}(n,e,t),u(e,t,n)}function h(e){const t=a.querySelector(`#${o}`);t.firstElementChild.classList.contains(i)||t.prepend(d.cloneNode()),e.parentNode.querySelectorAll(`.${i}`).forEach((e=>{e.remove()})),c===n&&a.querySelectorAll(`.${s}`).forEach((t=>{null!==t.lastElementChild&&t.lastElementChild.classList.contains(i)||t.append(d.cloneNode()),null!==t.querySelector(`[data-id='${e.dataset.id}']`)&&t.querySelector(`.${i}`)?.remove()}))}function v(e,n,o){a=e,c=o,function(){const e=a.querySelectorAll(`.${r}`);let t=0;e.forEach((e=>{e.offsetHeight{t.style.height=`${e.item(0).offsetHeight}px`})),d=a.querySelector(`.${i}`)}(),n(c===t?"move":"copy",a,r,i,f,h)}const p="c-test__dropzone--active",m="c-test__dropzone--hover";let g,y,E,L,$,S,q,N,A;function _(e){D(e.target),e.dataTransfer.dropEffect=g,e.dataTransfer.effectAllowed=g,e.dataTransfer.setDragImage(q,0,0)}function x(e){e.preventDefault(),e.stopPropagation(),D(e.target.closest(`.${E}`));const t=q.offsetWidth,n=q.offsetHeight;N=q.cloneNode(!0),q.parentNode.insertBefore(N,q),q.style.position="fixed",q.style.left=e.touches[0].clientX-t/2+"px",q.style.top=e.touches[0].clientY-n/2+"px",q.style.width=`${t}px`,q.style.height=`${n}px`,q.addEventListener("touchmove",T),q.addEventListener("touchend",O)}function D(e){q=e,q.style.opacity=.5,S(q),y.querySelectorAll(`.${L}`).forEach((e=>{z(e),e.classList.add(p)})),q.querySelectorAll(`.${L}`).forEach((e=>{e.classList.remove(p)}))}function T(e){e.preventDefault(),q.style.left=e.touches[0].clientX-q.offsetWidth/2+"px",q.style.top=e.touches[0].clientY-q.offsetHeight/2+"px";const{documentElement:t}=y.ownerDocument;e.touches[0].clientY>.8*t.clientHeight&&t.scroll({left:0,top:.8*e.touches[0].pageY,behavior:"smooth"}),e.touches[0].clientY<.2*t.clientHeight&&t.scroll({left:0,top:.8*e.touches[0].pageY,behavior:"smooth"});const n=y.ownerDocument.elementsFromPoint(e.changedTouches[0].clientX,e.changedTouches[0].clientY).filter((e=>e.classList.contains(L)));0===n.length&&void 0!==A&&(A.classList.remove(m),A=void 0),1===n.length&&A!==n[0]&&(void 0!==A&&A.classList.remove(m),[A]=n,A.classList.add(m))}function Y(e){e.preventDefault()}function H(e){e.target.classList.add(m)}function C(e){e.target.classList.remove(m)}function b(){q.removeAttribute("style"),y.querySelectorAll(`.${L}`).forEach((e=>{e.classList.remove(p),e.classList.remove(m)}))}function w(e){e.preventDefault(),J(e.target)}function O(e){e.preventDefault();const t=y.ownerDocument.elementsFromPoint(e.changedTouches[0].clientX,e.changedTouches[0].clientY).filter((e=>e.classList.contains(L)));b(),N.remove(),1===t.length&&J(t[0])}function J(e){let t=q;"move"!==g&&(t=q.cloneNode(!0),t.style.opacity=null,X(t)),e.parentNode.insertBefore(t,e),$(t,e,q)}function X(e){e.addEventListener("dragstart",_),e.addEventListener("dragend",b),e.addEventListener("touchstart",x)}function z(e){e.removeEventListener("dragover",Y),e.removeEventListener("dragenter",H),e.removeEventListener("dragleave",C),e.removeEventListener("drop",w),e.addEventListener("dragover",Y),e.addEventListener("dragenter",H),e.addEventListener("dragleave",C),e.addEventListener("drop",w)}function P(e,t,n,o,s,l){g=e,y=t,E=n,L=o,$=s,S=l,y.querySelectorAll(`.${E}`).forEach(X),y.querySelectorAll(`.${L}`).forEach(z)}e.test=e.test||{},e.test.matching=e.test.matching||{},e.test.matching.init=(e,t)=>v(e,P,t)}(il); +!function(e){"use strict";const t="1:1",n="n:n",o="sourceArea",s="ilMatchingQuestionTerm",i="c-test__definition",l="c-test__term",r="c-test__dropzone";let c,a,d;function u(e,i,u){c===n&&function(e,t,n){n.parentNode.classList.contains(s)&&n.remove(),t.parentNode.id===o&&e.remove()}(e,i,u),a.querySelectorAll(`.${s}`).forEach((e=>{var n;c!==t?null!==(n=e).firstElementChild&&n.lastElementChild.classList.contains(r)||n.append(d.cloneNode()):function(e){const t=e.firstElementChild;null!==t?t.classList.contains(l)&&null!==t.nextElementSibling&&t.nextElementSibling.remove():e.prepend(d.cloneNode())}(e)}))}function f(e,t,n){!function(e,t,n){const s=t.dataset;if(n.parentNode.id===o){t.id=`${s.type}_${s.id}`;const n=e.closest(`.${i}`).querySelector("input"),o=JSON.parse(n.value),l=o.indexOf(s.id);return l>-1&&o.splice(l,1),void(n.value=JSON.stringify(o))}const l=n.closest(`.${i}`);t.id=`${l.id}_${s.type}_${s.id}`;const r=JSON.parse(l.querySelector("input").value);r.push(s.id),l.querySelector("input").value=JSON.stringify(r)}(n,e,t),u(e,t,n)}function h(e){const t=a.querySelector(`#${o}`);t.firstElementChild.classList.contains(r)||t.prepend(d.cloneNode()),e.parentNode.querySelectorAll(`.${r}`).forEach((e=>{e.remove()})),c===n&&a.querySelectorAll(`.${s}`).forEach((t=>{null!==t.lastElementChild&&t.lastElementChild.classList.contains(r)||t.append(d.cloneNode()),null!==t.querySelector(`[data-id='${e.dataset.id}']`)&&t.querySelector(`.${r}`)?.remove()}))}function v(e,n,o){a=e,c=o,function(){const e=a.querySelectorAll(`.${l}`);let t=0;e.forEach((e=>{e.offsetHeight{t.style.height=`${e.item(0).offsetHeight}px`})),d=a.querySelector(`.${r}`)}(),n(c===t?"move":"copy",a,l,r,f,h)}const p="c-test__dropzone--active",m="c-test__dropzone--hover";let g,y,E,L,$,S,q,N,A;function _(e){setTimeout((()=>{D(e.target),e.dataTransfer.dropEffect=g,e.dataTransfer.effectAllowed=g,e.dataTransfer.setDragImage(q,0,0)}),0)}function x(e){e.preventDefault(),e.stopPropagation(),D(e.target.closest(`.${E}`));const t=q.offsetWidth,n=q.offsetHeight;N=q.cloneNode(!0),q.parentNode.insertBefore(N,q),q.style.position="fixed",q.style.left=e.touches[0].clientX-t/2+"px",q.style.top=e.touches[0].clientY-n/2+"px",q.style.width=`${t}px`,q.style.height=`${n}px`,q.addEventListener("touchmove",T),q.addEventListener("touchend",O)}function D(e){q=e,q.style.opacity=.5,S(q),y.querySelectorAll(`.${L}`).forEach((e=>{z(e),e.classList.add(p)})),q.querySelectorAll(`.${L}`).forEach((e=>{e.classList.remove(p)}))}function T(e){e.preventDefault(),q.style.left=e.touches[0].clientX-q.offsetWidth/2+"px",q.style.top=e.touches[0].clientY-q.offsetHeight/2+"px";const{documentElement:t}=y.ownerDocument;e.touches[0].clientY>.8*t.clientHeight&&t.scroll({left:0,top:.8*e.touches[0].pageY,behavior:"smooth"}),e.touches[0].clientY<.2*t.clientHeight&&t.scroll({left:0,top:.8*e.touches[0].pageY,behavior:"smooth"});const n=y.ownerDocument.elementsFromPoint(e.changedTouches[0].clientX,e.changedTouches[0].clientY).filter((e=>e.classList.contains(L)));0===n.length&&void 0!==A&&(A.classList.remove(m),A=void 0),1===n.length&&A!==n[0]&&(void 0!==A&&A.classList.remove(m),[A]=n,A.classList.add(m))}function Y(e){e.preventDefault()}function H(e){e.target.classList.add(m)}function C(e){e.target.classList.remove(m)}function b(){q.removeAttribute("style"),y.querySelectorAll(`.${L}`).forEach((e=>{e.classList.remove(p),e.classList.remove(m)}))}function w(e){e.preventDefault(),J(e.target)}function O(e){e.preventDefault();const t=y.ownerDocument.elementsFromPoint(e.changedTouches[0].clientX,e.changedTouches[0].clientY).filter((e=>e.classList.contains(L)));b(),N.remove(),1===t.length&&J(t[0])}function J(e){let t=q;"move"!==g&&(t=q.cloneNode(!0),t.style.opacity=null,X(t)),e.parentNode.insertBefore(t,e),$(t,e,q)}function X(e){e.addEventListener("dragstart",_),e.addEventListener("dragend",b),e.addEventListener("touchstart",x)}function z(e){e.removeEventListener("dragover",Y),e.removeEventListener("dragenter",H),e.removeEventListener("dragleave",C),e.removeEventListener("drop",w),e.addEventListener("dragover",Y),e.addEventListener("dragenter",H),e.addEventListener("dragleave",C),e.addEventListener("drop",w)}function P(e,t,n,o,s,i){g=e,y=t,E=n,L=o,$=s,S=i,y.querySelectorAll(`.${E}`).forEach(X),y.querySelectorAll(`.${L}`).forEach(z)}e.test=e.test||{},e.test.matching=e.test.matching||{},e.test.matching.init=(e,t)=>v(e,P,t)}(il); diff --git a/components/ILIAS/TestQuestionPool/resources/js/dist/orderinghorizontal.js b/components/ILIAS/TestQuestionPool/resources/js/dist/orderinghorizontal.js index 2f9f8af40eb0..570d32f17974 100644 --- a/components/ILIAS/TestQuestionPool/resources/js/dist/orderinghorizontal.js +++ b/components/ILIAS/TestQuestionPool/resources/js/dist/orderinghorizontal.js @@ -12,4 +12,4 @@ * https://www.ilias.de * https://github.com/ILIAS-eLearning */ -!function(e){"use strict";const t="{::}",n="answers",o="c-test__dropzone";let s;function r(){const e=[],r=s.querySelector(`.${o}`);s.querySelectorAll(`.${n}`).forEach((e=>{e.previousElementSibling?.classList.contains(o)||e.parentNode.insertBefore(r.cloneNode(),e),e.nextElementSibling?.classList.contains(o)||e.parentNode.insertBefore(r.cloneNode(),e.nextElementSibling)})),s.querySelectorAll(`.${o} + .${o}`).forEach((e=>{e.remove()})),s.querySelectorAll(`.${n} > div > span`).forEach((t=>{e.push(t.textContent)})),s.nextElementSibling.value=e.join(t)}function i(e){e.previousElementSibling?.classList.contains(o)&&e.previousElementSibling.remove(),e.nextElementSibling?.classList.contains(o)&&e.nextElementSibling.remove()}function l(e,t){s=e,function(){const e=s.querySelectorAll(`.${n}`);let t=0;e.forEach((e=>{t+=e.offsetWidth})),s.querySelectorAll(`.${o}`).forEach((n=>{n.style.width=t/e.length+"px",n.style.height=`${e.item(0).offsetHeight}px`}))}(),t("move",s,n,o,r,i)}const c="c-test__dropzone--active",a="c-test__dropzone--hover";let d,f,u,h,v,g,m,p,E;function L(e){S(e.target),e.dataTransfer.dropEffect=d,e.dataTransfer.effectAllowed=d,e.dataTransfer.setDragImage(m,0,0)}function y(e){e.preventDefault(),e.stopPropagation(),S(e.target.closest(`.${u}`));const t=m.offsetWidth,n=m.offsetHeight;p=m.cloneNode(!0),m.parentNode.insertBefore(p,m),m.style.position="fixed",m.style.left=e.touches[0].clientX-t/2+"px",m.style.top=e.touches[0].clientY-n/2+"px",m.style.width=`${t}px`,m.style.height=`${n}px`,m.addEventListener("touchmove",$),m.addEventListener("touchend",N)}function S(e){m=e,m.style.opacity=.5,g(m),f.querySelectorAll(`.${h}`).forEach((e=>{T(e),e.classList.add(c)})),m.querySelectorAll(`.${h}`).forEach((e=>{e.classList.remove(c)}))}function $(e){e.preventDefault(),m.style.left=e.touches[0].clientX-m.offsetWidth/2+"px",m.style.top=e.touches[0].clientY-m.offsetHeight/2+"px";const{documentElement:t}=f.ownerDocument;e.touches[0].clientY>.8*t.clientHeight&&t.scroll({left:0,top:.8*e.touches[0].pageY,behavior:"smooth"}),e.touches[0].clientY<.2*t.clientHeight&&t.scroll({left:0,top:.8*e.touches[0].pageY,behavior:"smooth"});const n=f.ownerDocument.elementsFromPoint(e.changedTouches[0].clientX,e.changedTouches[0].clientY).filter((e=>e.classList.contains(h)));0===n.length&&void 0!==E&&(E.classList.remove(a),E=void 0),1===n.length&&E!==n[0]&&(void 0!==E&&E.classList.remove(a),[E]=n,E.classList.add(a))}function x(e){e.preventDefault()}function A(e){e.target.classList.add(a)}function b(e){e.target.classList.remove(a)}function q(){m.removeAttribute("style"),f.querySelectorAll(`.${h}`).forEach((e=>{e.classList.remove(c),e.classList.remove(a)}))}function D(e){e.preventDefault(),Y(e.target)}function N(e){e.preventDefault();const t=f.ownerDocument.elementsFromPoint(e.changedTouches[0].clientX,e.changedTouches[0].clientY).filter((e=>e.classList.contains(h)));q(),p.remove(),1===t.length&&Y(t[0])}function Y(e){let t=m;"move"!==d&&(t=m.cloneNode(!0),t.style.opacity=null,w(t)),e.parentNode.insertBefore(t,e),v(t,e,m)}function w(e){e.addEventListener("dragstart",L),e.addEventListener("dragend",q),e.addEventListener("touchstart",y)}function T(e){e.removeEventListener("dragover",x),e.removeEventListener("dragenter",A),e.removeEventListener("dragleave",b),e.removeEventListener("drop",D),e.addEventListener("dragover",x),e.addEventListener("dragenter",A),e.addEventListener("dragleave",b),e.addEventListener("drop",D)}function z(e,t,n,o,s,r){d=e,f=t,u=n,h=o,v=s,g=r,f.querySelectorAll(`.${u}`).forEach(w),f.querySelectorAll(`.${h}`).forEach(T)}e.test=e.test||{},e.test.orderinghorizontal=e.test.orderinghorizontal||{},e.test.orderinghorizontal.init=e=>l(e,z)}(il); +!function(e){"use strict";const t="{::}",n="answers",o="c-test__dropzone";let s;function r(){const e=[],r=s.querySelector(`.${o}`);s.querySelectorAll(`.${n}`).forEach((e=>{e.previousElementSibling?.classList.contains(o)||e.parentNode.insertBefore(r.cloneNode(),e),e.nextElementSibling?.classList.contains(o)||e.parentNode.insertBefore(r.cloneNode(),e.nextElementSibling)})),s.querySelectorAll(`.${o} + .${o}`).forEach((e=>{e.remove()})),s.querySelectorAll(`.${n} > div > span`).forEach((t=>{e.push(t.textContent)})),s.nextElementSibling.value=e.join(t)}function i(e){e.previousElementSibling?.classList.contains(o)&&e.previousElementSibling.remove(),e.nextElementSibling?.classList.contains(o)&&e.nextElementSibling.remove()}function l(e,t){s=e,function(){const e=s.querySelectorAll(`.${n}`);let t=0;e.forEach((e=>{t+=e.offsetWidth})),s.querySelectorAll(`.${o}`).forEach((n=>{n.style.width=t/e.length+"px",n.style.height=`${e.item(0).offsetHeight}px`}))}(),t("move",s,n,o,r,i)}const c="c-test__dropzone--active",a="c-test__dropzone--hover";let d,f,u,h,v,g,m,p,E;function L(e){setTimeout((()=>{S(e.target),e.dataTransfer.dropEffect=d,e.dataTransfer.effectAllowed=d,e.dataTransfer.setDragImage(m,0,0)}),0)}function y(e){e.preventDefault(),e.stopPropagation(),S(e.target.closest(`.${u}`));const t=m.offsetWidth,n=m.offsetHeight;p=m.cloneNode(!0),m.parentNode.insertBefore(p,m),m.style.position="fixed",m.style.left=e.touches[0].clientX-t/2+"px",m.style.top=e.touches[0].clientY-n/2+"px",m.style.width=`${t}px`,m.style.height=`${n}px`,m.addEventListener("touchmove",$),m.addEventListener("touchend",N)}function S(e){m=e,m.style.opacity=.5,g(m),f.querySelectorAll(`.${h}`).forEach((e=>{w(e),e.classList.add(c)})),m.querySelectorAll(`.${h}`).forEach((e=>{e.classList.remove(c)}))}function $(e){e.preventDefault(),m.style.left=e.touches[0].clientX-m.offsetWidth/2+"px",m.style.top=e.touches[0].clientY-m.offsetHeight/2+"px";const{documentElement:t}=f.ownerDocument;e.touches[0].clientY>.8*t.clientHeight&&t.scroll({left:0,top:.8*e.touches[0].pageY,behavior:"smooth"}),e.touches[0].clientY<.2*t.clientHeight&&t.scroll({left:0,top:.8*e.touches[0].pageY,behavior:"smooth"});const n=f.ownerDocument.elementsFromPoint(e.changedTouches[0].clientX,e.changedTouches[0].clientY).filter((e=>e.classList.contains(h)));0===n.length&&void 0!==E&&(E.classList.remove(a),E=void 0),1===n.length&&E!==n[0]&&(void 0!==E&&E.classList.remove(a),[E]=n,E.classList.add(a))}function x(e){e.preventDefault()}function A(e){e.target.classList.add(a)}function b(e){e.target.classList.remove(a)}function q(){m.removeAttribute("style"),f.querySelectorAll(`.${h}`).forEach((e=>{e.classList.remove(c),e.classList.remove(a)}))}function D(e){e.preventDefault(),T(e.target)}function N(e){e.preventDefault();const t=f.ownerDocument.elementsFromPoint(e.changedTouches[0].clientX,e.changedTouches[0].clientY).filter((e=>e.classList.contains(h)));q(),p.remove(),1===t.length&&T(t[0])}function T(e){let t=m;"move"!==d&&(t=m.cloneNode(!0),t.style.opacity=null,Y(t)),e.parentNode.insertBefore(t,e),v(t,e,m)}function Y(e){e.addEventListener("dragstart",L),e.addEventListener("dragend",q),e.addEventListener("touchstart",y)}function w(e){e.removeEventListener("dragover",x),e.removeEventListener("dragenter",A),e.removeEventListener("dragleave",b),e.removeEventListener("drop",D),e.addEventListener("dragover",x),e.addEventListener("dragenter",A),e.addEventListener("dragleave",b),e.addEventListener("drop",D)}function z(e,t,n,o,s,r){d=e,f=t,u=n,h=o,v=s,g=r,f.querySelectorAll(`.${u}`).forEach(Y),f.querySelectorAll(`.${h}`).forEach(w)}e.test=e.test||{},e.test.orderinghorizontal=e.test.orderinghorizontal||{},e.test.orderinghorizontal.init=e=>l(e,z)}(il); diff --git a/components/ILIAS/TestQuestionPool/resources/js/dist/orderingvertical.js b/components/ILIAS/TestQuestionPool/resources/js/dist/orderingvertical.js index d0da8d94358b..b5601dbe8238 100644 --- a/components/ILIAS/TestQuestionPool/resources/js/dist/orderingvertical.js +++ b/components/ILIAS/TestQuestionPool/resources/js/dist/orderingvertical.js @@ -12,4 +12,4 @@ * https://www.ilias.de * https://github.com/ILIAS-eLearning */ -!function(e){"use strict";const t='[name*="[position]"',n='[name*="[indentation]"',o="dd-item",r="c-test__dropzone";let l;function s(e,s){!function(){const e=l.querySelector(`.${r}`);l.querySelectorAll(`.${o}`).forEach((t=>{t.previousElementSibling?.classList.contains(r)||t.parentNode.insertBefore(e.cloneNode(),t),t.nextElementSibling?.classList.contains(r)||t.parentNode.insertBefore(e.cloneNode(),t.nextElementSibling)})),l.querySelectorAll(`.${r} + .${r}`).forEach((e=>{e.remove()}))}(),function(e,t){let r=0,s=t.parentElement.parentElement;for(;s!==l;)s=s.parentElement.parentElement,r+=1;e.querySelector(n).value=r,e.querySelectorAll(`.${o}`).forEach((e=>{r+=1,e.querySelector(n).value=r}))}(e,s),function(){let e=0;l.querySelectorAll(`.${o}`).forEach((n=>{n.querySelector(t).value=e,e+=1}))}()}function i(e){e.previousElementSibling?.classList.contains(r)&&e.previousElementSibling.remove(),e.nextElementSibling?.classList.contains(r)&&e.nextElementSibling.remove()}function c(e,t){l=e,function(){const e=l.querySelectorAll(`.${o}`);let t=0;e.forEach((e=>{e.offsetHeight{t.style.height=`${e.item(0).offsetHeight}px`}))}(),t("move",l,o,r,s,i)}const a="c-test__dropzone--active",f="c-test__dropzone--hover";let d,u,v,h,m,g,p,E,y;function L(e){$(e.target),e.dataTransfer.dropEffect=d,e.dataTransfer.effectAllowed=d,e.dataTransfer.setDragImage(p,0,0)}function S(e){e.preventDefault(),e.stopPropagation(),$(e.target.closest(`.${v}`));const t=p.offsetWidth,n=p.offsetHeight;E=p.cloneNode(!0),p.parentNode.insertBefore(E,p),p.style.position="fixed",p.style.left=e.touches[0].clientX-t/2+"px",p.style.top=e.touches[0].clientY-n/2+"px",p.style.width=`${t}px`,p.style.height=`${n}px`,p.addEventListener("touchmove",q),p.addEventListener("touchend",Y)}function $(e){p=e,p.style.opacity=.5,g(p),u.querySelectorAll(`.${h}`).forEach((e=>{_(e),e.classList.add(a)})),p.querySelectorAll(`.${h}`).forEach((e=>{e.classList.remove(a)}))}function q(e){e.preventDefault(),p.style.left=e.touches[0].clientX-p.offsetWidth/2+"px",p.style.top=e.touches[0].clientY-p.offsetHeight/2+"px";const{documentElement:t}=u.ownerDocument;e.touches[0].clientY>.8*t.clientHeight&&t.scroll({left:0,top:.8*e.touches[0].pageY,behavior:"smooth"}),e.touches[0].clientY<.2*t.clientHeight&&t.scroll({left:0,top:.8*e.touches[0].pageY,behavior:"smooth"});const n=u.ownerDocument.elementsFromPoint(e.changedTouches[0].clientX,e.changedTouches[0].clientY).filter((e=>e.classList.contains(h)));0===n.length&&void 0!==y&&(y.classList.remove(f),y=void 0),1===n.length&&y!==n[0]&&(void 0!==y&&y.classList.remove(f),[y]=n,y.classList.add(f))}function A(e){e.preventDefault()}function x(e){e.target.classList.add(f)}function b(e){e.target.classList.remove(f)}function D(){p.removeAttribute("style"),u.querySelectorAll(`.${h}`).forEach((e=>{e.classList.remove(a),e.classList.remove(f)}))}function N(e){e.preventDefault(),H(e.target)}function Y(e){e.preventDefault();const t=u.ownerDocument.elementsFromPoint(e.changedTouches[0].clientX,e.changedTouches[0].clientY).filter((e=>e.classList.contains(h)));D(),E.remove(),1===t.length&&H(t[0])}function H(e){let t=p;"move"!==d&&(t=p.cloneNode(!0),t.style.opacity=null,T(t)),e.parentNode.insertBefore(t,e),m(t,e,p)}function T(e){e.addEventListener("dragstart",L),e.addEventListener("dragend",D),e.addEventListener("touchstart",S)}function _(e){e.removeEventListener("dragover",A),e.removeEventListener("dragenter",x),e.removeEventListener("dragleave",b),e.removeEventListener("drop",N),e.addEventListener("dragover",A),e.addEventListener("dragenter",x),e.addEventListener("dragleave",b),e.addEventListener("drop",N)}function w(e,t,n,o,r,l){d=e,u=t,v=n,h=o,m=r,g=l,u.querySelectorAll(`.${v}`).forEach(T),u.querySelectorAll(`.${h}`).forEach(_)}e.test=e.test||{},e.test.orderingvertical=e.test.orderingvertical||{},e.test.orderingvertical.init=(e,t)=>c(e,w)}(il); +!function(e){"use strict";const t='[name*="[position]"',n='[name*="[indentation]"',o="dd-item",r="c-test__dropzone";let l;function s(e,s){!function(){const e=l.querySelector(`.${r}`);l.querySelectorAll(`.${o}`).forEach((t=>{t.previousElementSibling?.classList.contains(r)||t.parentNode.insertBefore(e.cloneNode(),t),t.nextElementSibling?.classList.contains(r)||t.parentNode.insertBefore(e.cloneNode(),t.nextElementSibling)})),l.querySelectorAll(`.${r} + .${r}`).forEach((e=>{e.remove()}))}(),function(e,t){let r=0,s=t.parentElement.parentElement;for(;s!==l;)s=s.parentElement.parentElement,r+=1;e.querySelector(n).value=r,e.querySelectorAll(`.${o}`).forEach((e=>{r+=1,e.querySelector(n).value=r}))}(e,s),function(){let e=0;l.querySelectorAll(`.${o}`).forEach((n=>{n.querySelector(t).value=e,e+=1}))}()}function i(e){e.previousElementSibling?.classList.contains(r)&&e.previousElementSibling.remove(),e.nextElementSibling?.classList.contains(r)&&e.nextElementSibling.remove()}function c(e,t){l=e,function(){const e=l.querySelectorAll(`.${o}`);let t=0;e.forEach((e=>{e.offsetHeight{t.style.height=`${e.item(0).offsetHeight}px`}))}(),t("move",l,o,r,s,i)}const a="c-test__dropzone--active",f="c-test__dropzone--hover";let u,d,v,h,m,g,p,E,y;function L(e){setTimeout((()=>{$(e.target),e.dataTransfer.dropEffect=u,e.dataTransfer.effectAllowed=u,e.dataTransfer.setDragImage(p,0,0)}),0)}function S(e){e.preventDefault(),e.stopPropagation(),$(e.target.closest(`.${v}`));const t=p.offsetWidth,n=p.offsetHeight;E=p.cloneNode(!0),p.parentNode.insertBefore(E,p),p.style.position="fixed",p.style.left=e.touches[0].clientX-t/2+"px",p.style.top=e.touches[0].clientY-n/2+"px",p.style.width=`${t}px`,p.style.height=`${n}px`,p.addEventListener("touchmove",q),p.addEventListener("touchend",T)}function $(e){p=e,p.style.opacity=.5,g(p),d.querySelectorAll(`.${h}`).forEach((e=>{_(e),e.classList.add(a)})),p.querySelectorAll(`.${h}`).forEach((e=>{e.classList.remove(a)}))}function q(e){e.preventDefault(),p.style.left=e.touches[0].clientX-p.offsetWidth/2+"px",p.style.top=e.touches[0].clientY-p.offsetHeight/2+"px";const{documentElement:t}=d.ownerDocument;e.touches[0].clientY>.8*t.clientHeight&&t.scroll({left:0,top:.8*e.touches[0].pageY,behavior:"smooth"}),e.touches[0].clientY<.2*t.clientHeight&&t.scroll({left:0,top:.8*e.touches[0].pageY,behavior:"smooth"});const n=d.ownerDocument.elementsFromPoint(e.changedTouches[0].clientX,e.changedTouches[0].clientY).filter((e=>e.classList.contains(h)));0===n.length&&void 0!==y&&(y.classList.remove(f),y=void 0),1===n.length&&y!==n[0]&&(void 0!==y&&y.classList.remove(f),[y]=n,y.classList.add(f))}function A(e){e.preventDefault()}function x(e){e.target.classList.add(f)}function b(e){e.target.classList.remove(f)}function D(){p.removeAttribute("style"),d.querySelectorAll(`.${h}`).forEach((e=>{e.classList.remove(a),e.classList.remove(f)}))}function N(e){e.preventDefault(),Y(e.target)}function T(e){e.preventDefault();const t=d.ownerDocument.elementsFromPoint(e.changedTouches[0].clientX,e.changedTouches[0].clientY).filter((e=>e.classList.contains(h)));D(),E.remove(),1===t.length&&Y(t[0])}function Y(e){let t=p;"move"!==u&&(t=p.cloneNode(!0),t.style.opacity=null,H(t)),e.parentNode.insertBefore(t,e),m(t,e,p)}function H(e){e.addEventListener("dragstart",L),e.addEventListener("dragend",D),e.addEventListener("touchstart",S)}function _(e){e.removeEventListener("dragover",A),e.removeEventListener("dragenter",x),e.removeEventListener("dragleave",b),e.removeEventListener("drop",N),e.addEventListener("dragover",A),e.addEventListener("dragenter",x),e.addEventListener("dragleave",b),e.addEventListener("drop",N)}function w(e,t,n,o,r,l){u=e,d=t,v=n,h=o,m=r,g=l,d.querySelectorAll(`.${v}`).forEach(H),d.querySelectorAll(`.${h}`).forEach(_)}e.test=e.test||{},e.test.orderingvertical=e.test.orderingvertical||{},e.test.orderingvertical.init=(e,t)=>c(e,w)}(il); diff --git a/components/ILIAS/TestQuestionPool/resources/js/src/makeDraggable.js b/components/ILIAS/TestQuestionPool/resources/js/src/makeDraggable.js index 71312e7450a3..56fc2f13bff3 100644 --- a/components/ILIAS/TestQuestionPool/resources/js/src/makeDraggable.js +++ b/components/ILIAS/TestQuestionPool/resources/js/src/makeDraggable.js @@ -72,10 +72,12 @@ let currentHoverElementForTouch; * @param {Event} event */ function dragstartHandler(event) { - startMoving(event.target); - event.dataTransfer.dropEffect = dragType; - event.dataTransfer.effectAllowed = dragType; - event.dataTransfer.setDragImage(draggedElement, 0, 0); + setTimeout(() => { + startMoving(event.target); + event.dataTransfer.dropEffect = dragType; + event.dataTransfer.effectAllowed = dragType; + event.dataTransfer.setDragImage(draggedElement, 0, 0); + }, 0); } /** diff --git a/components/ILIAS/TestQuestionPool/resources/js/src/matching/rollup.config.js b/components/ILIAS/TestQuestionPool/resources/js/src/matching/rollup.config.js index 4e5d5f62590c..cb3eabc33fe5 100644 --- a/components/ILIAS/TestQuestionPool/resources/js/src/matching/rollup.config.js +++ b/components/ILIAS/TestQuestionPool/resources/js/src/matching/rollup.config.js @@ -1,6 +1,6 @@ import terser from '@rollup/plugin-terser'; -import copyright from '../../../../../../../scripts/Copyright-Checker/copyright'; -import preserveCopyright from '../../../../../../../scripts/Copyright-Checker/preserveCopyright'; +import copyright from '../../../../../../../scripts/Copyright-Checker/copyright.js'; +import preserveCopyright from '../../../../../../../scripts/Copyright-Checker/preserveCopyright.js'; export default { external: [ diff --git a/components/ILIAS/TestQuestionPool/resources/js/src/orderinghorizontal/rollup.config.js b/components/ILIAS/TestQuestionPool/resources/js/src/orderinghorizontal/rollup.config.js index e138e5c43041..63007d0a0583 100644 --- a/components/ILIAS/TestQuestionPool/resources/js/src/orderinghorizontal/rollup.config.js +++ b/components/ILIAS/TestQuestionPool/resources/js/src/orderinghorizontal/rollup.config.js @@ -1,6 +1,6 @@ import terser from '@rollup/plugin-terser'; -import copyright from '../../../../../../../scripts/Copyright-Checker/copyright'; -import preserveCopyright from '../../../../../../../scripts/Copyright-Checker/preserveCopyright'; +import copyright from '../../../../../../../scripts/Copyright-Checker/copyright.js'; +import preserveCopyright from '../../../../../../../scripts/Copyright-Checker/preserveCopyright.js'; export default { external: [ diff --git a/components/ILIAS/TestQuestionPool/resources/js/src/orderingvertical/rollup.config.js b/components/ILIAS/TestQuestionPool/resources/js/src/orderingvertical/rollup.config.js index 0ba14cf0dc88..be6f53800e9b 100644 --- a/components/ILIAS/TestQuestionPool/resources/js/src/orderingvertical/rollup.config.js +++ b/components/ILIAS/TestQuestionPool/resources/js/src/orderingvertical/rollup.config.js @@ -1,6 +1,6 @@ import terser from '@rollup/plugin-terser'; -import copyright from '../../../../../../../scripts/Copyright-Checker/copyright'; -import preserveCopyright from '../../../../../../../scripts/Copyright-Checker/preserveCopyright'; +import copyright from '../../../../../../../scripts/Copyright-Checker/copyright.js'; +import preserveCopyright from '../../../../../../../scripts/Copyright-Checker/preserveCopyright.js'; export default { external: [