Skip to content
Snippets Groups Projects
Commit cec62ea3 authored by srosse's avatar srosse
Browse files

OO-4414: fix solution of responsive hotspots under bootstrap collapsable

parent ab228411
No related branches found
No related tags found
No related merge requests found
......@@ -13,16 +13,14 @@
#if($print || $pdf)
<div class="o_button_group o_button_group_right">
<script>
/* <![CDATA[ */
function print() {
try {
var ww = window.open("$r.commandURI("print")", "$winid", "height=800,left=100,top=100,width=800,toolbar=no,titlebar=0,status=0,menubar=yes,location=no,scrollbars=1");
ww.focus();
} catch(e) {
if(window.console) console.log('Error when trying to dock div id::$r.getId("undck")');
}
function print() {
try {
var ww = window.open("$r.commandURI("print")", "$winid", "height=800,left=100,top=100,width=800,toolbar=no,titlebar=0,status=0,menubar=yes,location=no,scrollbars=1");
ww.focus();
} catch(e) {
if(window.console) console.log('Error when trying to dock div id::$r.getId("undck")');
}
/* ]]> */
}
</script>
#if($print && $pdf) <div class='btn-group'> #end
#if($print)
......@@ -499,10 +497,9 @@
<div id="o_c$itemResult.interactionResults.solutionFormItem.component.dispatchID" class="o_qti21_solution">
<h4 onclick="jQuery('#collapse_${itemResult.interactionResults.solutionFormItem.name}').collapse('toggle')">
#if($toggleSolution)<i id="collapse_${itemResult.interactionResults.solutionFormItem.name}_toggler" class="o_icon o_icon-fw o_icon_open_togglebox"> </i>#end $r.translate("solution")</h4>
<div id="collapse_${itemResult.interactionResults.solutionFormItem.name}" class="#if($toggleSolution) collapse #end">$r.render($itemResult.interactionResults.solutionFormItem.name)</div>
<div id="collapse_${itemResult.interactionResults.solutionFormItem.name}" class="#if($toggleSolution) collapse #end o_qti21_collapsable_solution">$r.render($itemResult.interactionResults.solutionFormItem.name)</div>
</div>
<script>
/* <![CDATA[ */
jQuery(function() {
jQuery('#collapse_${itemResult.interactionResults.solutionFormItem.name}').on('hide.bs.collapse', function () {
jQuery('#collapse_${itemResult.interactionResults.solutionFormItem.name}_toggler').removeClass('o_icon_close_togglebox').addClass('o_icon_open_togglebox');
......@@ -525,7 +522,6 @@
});
})
});
/* ]]> */
</script>
#end
#end
......
......@@ -25,7 +25,6 @@
</map>
</div>
<script>
/* <![CDATA[ */
var maphilightSettings;
#if($r.hasCssClass($interaction, "hotspot-light"))
maphilightSettings = {
......@@ -116,6 +115,5 @@
maphilightSettings: maphilightSettings
});
});
/* ]]> */
</script>
</div>
\ No newline at end of file
(function ($) {
"use strict";
$.fn.hotspotInteraction = function(options) {
var settings = $.extend({
responseIdentifier: null,
......@@ -28,7 +29,7 @@
var divContainer = jQuery('#' + containerId);
var areaIds = settings.responseValue.split(',');
for(i=areaIds.length; i-->0; ) {
for(var i=areaIds.length; i-->0; ) {
var areaEl = jQuery('#ac_' + settings.responseIdentifier + '_' + areaIds[i]);
var data = areaEl.data('maphilight') || {};
data.selectedOn = true;
......@@ -49,7 +50,7 @@
clickHotspotArea(this, containerId, settings.responseIdentifier, settings.maxChoices, settings.singleChoice, settings.maphilightSettings);
});
})
};
}
function clickHotspotArea(spot, containerId, responseIdentifier, maxChoices, singleChoice, maphilightSettings) {
var areaEl = jQuery(spot);
......@@ -101,7 +102,7 @@
divContainer.append(inputElement);
}
});
};
}
/*
* Color the data based on the selectedOn flag
......
......@@ -9,6 +9,7 @@
* Licensed under the MIT license
*/
;(function($) {
"use strict";
$.fn.rwdImageMaps = function(options) {
var settings = $.extend({
fillColor: 'bbbbbb',
......@@ -20,6 +21,7 @@
var $img = this;
var loaded = null;
var windowWidth = 0;
var hotSpotContainerWidth = 0;
var rwdImageMap = function() {
$img.each(function() {
......@@ -32,7 +34,6 @@
var attrW = 'width',
attrH = 'height';
var $this = $(this);
if (!$that.data(attrW)) // size are backuped
$that.data(attrW, $that.attr(attrW));
if (!$that.data(attrH)) // size are backuped
......@@ -64,7 +65,13 @@
th = ((containerWidth * ratio)|0);
$that.width(tw);
$that.height(th);
}
} else if(tw == 0 && th == 0) {
// image was hidden
tw = w;
th = h;
$that.width(tw);
$that.height(th);
}
var wPercent = tw/100,
hPercent = th/100,
......@@ -104,19 +111,23 @@
var that = this,
$that = $(that);
var containerWidth = $that.closest(".o_oo_hotcontainer").width();
if(loaded) {
if(windowWidth != window.innerWidth) {
if(windowWidth != window.innerWidth || hotSpotContainerWidth != containerWidth) {
recalculateMap(that, $that);
windowWidth = window.innerWidth;
hotSpotContainerWidth = containerWidth
}
} else {
windowWidth = window.innerWidth;
hotSpotContainerWidth = containerWidth;
recalculateMap(that, $that);
}
});
};
$(window).resize(rwdImageMap).trigger('resize');
$($img).closest('.o_qti21_collapsable_solution').on('shown.bs.collapse', rwdImageMap);
return this;
};
......
(function(g){g.fn.associateInteraction=function(m){var n=g.extend({responseIdentifier:null,formDispatchFieldId:null,responseValue:null,opened:false,unrestricted:false},m);try{if(typeof n.responseValue!="undefined"&&n.responseValue.length>0){c(this,n)}if(n.opened){a(this,n)}}catch(o){if(window.console){console.log(o)}}return this};function c(m,q){var t=m.attr("id");var w=q.responseValue.split(",");var u=jQuery("#"+t+"_panel .association");for(var r=0;r<w.length;r++){var p=w[r].split(" ");var s=jQuery(u.get(r));if(s.length==0){var v=d(t,q);s=jQuery("#"+v)}var o=jQuery("#"+t+"_items div[data-qti-id='"+p[0]+"']");if(e(o,t)){o=jQuery(o).clone()}var n=jQuery("#"+t+"_items div[data-qti-id='"+p[1]+"']");if(e(n,t)){n=jQuery(n).clone()}jQuery(o).addClass("oo-choosed");jQuery(n).addClass("oo-choosed");jQuery(s.find(".association_box.left")).addClass("oo-filled").append(o);jQuery(s.find(".association_box.right")).addClass("oo-filled").append(n)}l(t,q);if(q.unrestricted&&q.opened){i(t,q)}}function a(q,o){var m=q.attr("id");var n=jQuery("#"+m+" .o_associate_item");b(n,m,o);var p=jQuery("#"+m+"_panel .association_box");k(p,m,o)}function b(n,m,o){n.on("click",function(r,q){var p=jQuery(this);if(!p.hasClass("oo-choosed")&&!p.hasClass("oo-selected")){p.addClass("oo-selected")}}).draggable({containment:"#"+m,scroll:false,revert:"invalid",stop:function(p,q){jQuery(this).css({left:"0px",top:"0px"});jQuery(q.helper).removeClass("oo-drag")},helper:function(){var q=jQuery(this);var r=q.parent(".association_box").length>0;if(!r&&e(this,m)){q.removeClass("oo-selected");var p=q.clone();jQuery(p).attr("id","n"+j()).data("qti-cloned","true").addClass("oo-drag");return p}q.addClass("oo-drag");return q}}).on("click",{formId:o.formDispatchFieldId},setFlexiFormDirtyByListener)}function e(r,n){var q=jQuery(r);var p=q.data("qti-match-max");var m=q.data("qti-id");var o=jQuery("#"+n+"_panel div[data-qti-id='"+m+"']").length;return(p==0||o+1<p)}function k(n,m,o){n.on("click",function(r,p){var q=jQuery(this);var s=jQuery(".o_associate_item",this).length;if(s==1){jQuery(".o_associate_item",this).each(function(t,u){h(u,q,m)})}else{jQuery("#"+m+"_items .o_associate_item.oo-selected").each(function(t,v){var u=jQuery(v);if(e(v,m)){u.removeClass("oo-selected");f(u.clone(),q,m)}else{f(u,q,m)}})}l(m,o);setFlexiFormDirty(o.formDispatchFieldId,false)}).droppable({drop:function(r,s){var q=jQuery(this);var t=jQuery(".o_associate_item",this).length;if(t>0){jQuery(".o_associate_item",this).each(function(u,v){h(v,q,m)})}var p;if(s.helper!=null&&jQuery(s.helper).data("qti-cloned")=="true"){var p=jQuery(s.draggable);p.removeClass("oo-selected").removeClass("oo-drag");p=p.clone();b(p,m,o);f(p,q,m)}else{var p=jQuery(s.draggable);p.removeClass("oo-selected").removeClass("oo-drag");f(p,q,m)}l(m,o);setFlexiFormDirty(o.formDispatchFieldId,false)}}).on("click",{formId:o.formDispatchFieldId},setFlexiFormDirtyByListener)}function f(o,n,m){o.removeClass("oo-selected").css({left:"0px",top:"0px"}).addClass("oo-choosed").appendTo(n);n.addClass("oo-filled")}function h(r,q,n){q.removeClass("oo-filled");var p=jQuery(r);p.removeClass("oo-choosed");var m=p.data("qti-id");var o=jQuery("#"+n+"_items div[data-qti-id='"+m+"']").length;if(o==0){p.appendTo(jQuery("#"+n+"_items"))}else{p.remove()}}function j(){function m(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return m()+m()+m()+m()+m()+m()+m()}function l(m,o){var n=jQuery("#"+m+"_panel");n.find("input[type='hidden']").remove();jQuery("#"+m+"_panel .association").each(function(p,u){var r=jQuery(u).find(".o_associate_item");if(r.length==2){var s=jQuery(r.get(0)).data("qti-id");var q=jQuery(r.get(1)).data("qti-id");var t=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+o.responseIdentifier).attr("value",s+" "+q);n.prepend(t)}else{if(r.length==0&&o.unrestricted){u.remove()}else{jQuery(u).find(".association_box").each(function(x,w){var v=jQuery(w).find(".o_associate_item").length;if(v==0&&jQuery(w).hasClass("oo-filled")){jQuery(w).removeClass("oo-filled")}})}}});i(m,o)}function i(m,p){if(!p.unrestricted||!p.opened){return}var n=jQuery("#"+m+"_panel");var o=true;jQuery("#"+m+"_panel .association").each(function(s,u){var t=jQuery(u).find(".o_associate_item");if(t.length!=2){o=false}});if(o){var r=d(m,p);var q=jQuery("#"+r+" .association_box");k(q,m,p)}}function d(m,n){var o=j();var p='<div id="'+o+'" class="association" style="">\n <div class="association_box left" style="width: 100px; height:50px; float:left;"></div>\n <div class="association_box right" style="width: 100px; height:50px; float:right;"></div>\n <div style="clear:both; "></div>\n</div>\n';jQuery("#"+m+"_panel").append(p);jQuery("#"+m+"_panel").append('<div style="clear:both; "></div>\n');return o}}(jQuery));(function(b){b.fn.choiceInteraction=function(d){var f=b.extend({responseIdentifier:null,formDispatchFieldId:null,maxChoices:0,},d);try{if(f.maxChoices>0){a(this,f);c(f)}}catch(g){if(window.console){console.log(g)}}return this};function a(f,d){var e=jQuery("#qti_container_"+d.responseIdentifier+" input[type=checkbox]");e.on("click",function(g,h){c(d)})}function c(d){var f=jQuery("#qti_container_"+d.responseIdentifier+" input[type=checkbox]");var e=0;f.each(function(g,h){if(h.checked){e++}});if(e>=d.maxChoices){f.each(function(g,h){if(h.checked){h.disabled=false}else{h.disabled=true}})}else{f.each(function(g,h){h.disabled=false})}}}(jQuery));(function(f){f.fn.gapMatchInteraction=function(h){var j=f.extend({responseIdentifier:null,formDispatchFieldId:null,gapChoiceData:{},gapData:{},opened:false,gapChoiceMap:{},gapMap:{},matched:{}},h);for(var i in j.gapChoiceData){var k=jQuery("#qtiworks_id_"+j.responseIdentifier+"_"+i);j.gapChoiceMap[i]={matchMax:j.gapChoiceData[i],matchCount:0,query:k,text:k.text()}}for(var i in j.gapData){var k=jQuery("#qtiworks_id_"+j.responseIdentifier+"_"+i);j.gapMap[i]={required:j.gapData[i],matched:false,matchedGapChoice:null,query:k,label:k.text()}}try{d(this,j)}catch(l){if(window.console){console.log(l)}}return this};function b(j,k,n){var m=k.value;var i=m.split(" ");var h=j.gapChoiceMap[i[0]];var l=j.gapMap[i[1]];n(j,k,m,h,l)}function d(i,h){if(h.opened){e(h.responseIdentifier).on("click",function(){a(h,this);setFlexiFormDirty(h.formDispatchFieldId)})}c(h);g(h)}function e(h){return jQuery("input[name=qtiworks_response_"+h+"]")}function c(j){j.matchCount=0;for(var i in j.gapChoiceMap){j.gapChoiceMap[i].matchCount=0}for(var i in j.gapMap){j.gapMap[i].matched=false;j.gapMap[i].matchedGapChoice=null}e(j.responseIdentifier).each(function(l,m){b(j,this,function(o,p,r,n,q){if(p.checked){n.matchCount++;q.matched=true;q.matchedGapChoice=n;o.matched[r]=true}})});for(var i in j.gapMap){var k=j.gapMap[i];var h;if(k.matched){h=k.matchedGapChoice.text}else{h=k.label}k.query.text(h)}}function g(h){e(h.responseIdentifier).each(function(){b(h,this,function(j,k,m,i,l){if(!j.opened){k.disabled=true}else{if(k.checked){k.disabled=false}else{if(l.matched||(i.matchMax!=0&&i.matchCount>=i.matchMax)){k.disabled=true}else{k.disabled=false}}}})})}function a(h,i){b(h,i,function(k,l,n,j,m){if(l.checked){if(m.matched||(j.matchMax!=0&&j.matchMax<=j.matchCount)){l.checked=false}else{j.matchCount++;m.matched=true;m.matchedGapChoice=j}m.query.text(j.text)}else{j.matchCount--;m.matched=false;m.matchedGapChoice=null;m.query.text(m.label)}g(k)})}}(jQuery));(function(d){d.fn.graphicAssociateInteraction=function(g){var h=d.extend({responseIdentifier:null,formDispatchFieldId:null,responseValue:null,maxAssociations:1,opened:false},g);try{if(!(typeof h.responseValue==="undefined")&&h.responseValue.length>0){e(this,h.responseValue,h.responseIdentifier)}if(h.opened){c(this,h.maxAssociations,h.responseIdentifier)}}catch(j){if(window.console){console.log(j)}}return this};function c(k,j,h){var g=k.attr("id");jQuery("#"+g+"_container area").on("click",function(t){var l=8;var q=jQuery("#"+g+"_container").data("openolat")||{};if(q.listOfPairs==undefined){q.currentSpot="";q.listOfPairs=[];jQuery("#"+g+"_container").data("openolat",q)}var w=jQuery(this).data("qti-id");if(q.currentSpot==""||q.currentSpot==w){q.currentSpot=w}else{var A=[q.currentSpot,w];q.listOfPairs.push(A);q.currentSpot=""}var m=document.getElementById(g+"_canvas");var u=m.getContext("2d");u.clearRect(0,0,jQuery(m).width(),jQuery(m).height());var B=jQuery("#"+g+"_container");B.find("input[type='hidden']").remove();var z=[];if(q.currentSpot!=""){b(u,"ac_"+h+"_"+q.currentSpot);z.push(q.currentSpot)}for(var p=q.listOfPairs.length;p-->0;){var o=q.listOfPairs[p];for(var n=o.length;n-->0;){if(0>z.indexOf(o[n])){b(u,"ac_"+h+"_"+o[n]);z.push(o[n])}}var s=jQuery("#ac_"+h+"_"+o[1]);var v=jQuery("#ac_"+h+"_"+o[0]);var C=f(s);var y=f(v);u.beginPath();u.moveTo(C[0],C[1]);u.lineTo(y[0],y[1]);u.lineWidth=3;u.stroke();var x=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+h).attr("value",v.data("qti-id")+" "+s.data("qti-id"));B.prepend(x)}})}function e(g,v,t){var o=g.attr("id");var x=jQuery("#"+o+"_container");var k=document.getElementById(o+"_canvas");var q=k.getContext("2d");q.clearRect(0,0,jQuery(k).width(),jQuery(k).height());var w=[];var h=v.split(",");for(var n=h.length;n-->0;){var m=h[n].split(" ");for(var l=m.length;l-->0;){if(0>w.indexOf(m[l])){b(q,"ac_"+t+"_"+m[l]);w.push(m[l])}}if(m.length==2){var p=jQuery("#ac_"+t+"_"+m[1]);var r=jQuery("#ac_"+t+"_"+m[0]);var y=f(p);var u=f(r);q.beginPath();q.moveTo(y[0],y[1]);q.lineTo(u[0],u[1]);q.lineWidth=3;q.stroke();var s=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+t).attr("value",r.data("qti-id")+" "+p.data("qti-id"));x.prepend(s)}}}function b(h,g){jQuery("#"+g).each(function(k,m){var l=jQuery(m);var n=f(l);var j=l.attr("shape");a(h,j,n,0,0)})}function a(j,g,k,h,l){h=h||0;l=l||0;j.beginPath();if(g=="rect"){j.rect(k[0]+h,k[1]+l,k[2]-k[0],k[3]-k[1])}else{if(g=="poly"){j.moveTo(k[0]+h,k[1]+l);for(i=2;i<k.length;i+=2){j.lineTo(k[i]+h,k[i+1]+l)}}else{if(g=="circ"||g=="circle"){j.arc(k[0]+h,k[1]+l,k[2]-2,0,Math.PI*2,false)}}}j.closePath();j.lineWidth=4;j.strokeStyle="#003300";j.stroke();j.fillStyle="green";j.fill()}function f(g){var h=g.attr("coords").split(",");for(i=h.length;i-->0;){h[i]=parseFloat(h[i])}return h}}(jQuery));(function(f){f.fn.graphicGapInteraction=function(j){var k=f.extend({maphilight:null,responseIdentifier:null,formDispatchFieldId:null,responseValue:null,opened:false},j);try{if(!(typeof k.responseValue==="undefined")&&k.responseValue.length>0){b(this,k)}if(k.opened){c(this,k)}}catch(l){if(window.console){console.log(l)}}return this};function b(j,m){var q=j.attr("id");var v=jQuery("#"+q);var l=m.responseValue.split(",");for(var n=l.length;n-->0;){var k=l[n].split(" ");var p=jQuery("#ac_"+m.responseIdentifier+"_"+k[0]);var o=jQuery("#ac_"+m.responseIdentifier+"_"+k[1]);var r,u;if(p.hasClass("gap_item")){r=p;u=o}else{r=o;u=p}var s=g(u);r.css("position","absolute");r.css("left",s[0]+"px");r.css("top",s[1]+"px");r.addClass("oo-choosed");var t=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+m.responseIdentifier).attr("value",r.data("qti-id")+" "+u.data("qti-id"));v.prepend(t)}}function c(l,k){var j=l.attr("id");jQuery(".gap_item").on("click",function(q,p){var o=jQuery(this);if(o.hasClass("oo-choosed")){var n=o.data("drop-timestamp");if(!(typeof n==="undefined")&&n!=null){if((Date.now()-n)<1500){o.data("drop-timestamp",null);return}}o.removeClass("oo-choosed");var m=o.data("qti-id");jQuery("#"+j).find("input[type='hidden']").each(function(r,s){var t=jQuery(s).val();if(t.indexOf(m+" ")==0){jQuery(s).remove()}});o.css({position:"relative",left:"0px",top:"0px"})}else{o.addClass("oo-selected")}}).draggable({containment:"#"+j,scroll:false,revert:"invalid",stop:function(m,n){if(!jQuery(this).hasClass("oo-choosed")){jQuery(this).css({position:"relative",left:"0px",top:"0px"})}}}).mousemove(function(m,s){var u=jQuery(this);if(u.hasClass("ui-draggable-dragging")){var q=jQuery("#"+j+"_img");var p=q.offset();var o=u.offset();var n=o.left+(u.width()/2)-p.left;var t=o.top+(u.height()/2)-p.top;var r=h(n,t,j);if("invalid"!=r){jQuery("#"+j+" area").each(function(v,x){var w=jQuery(x);var y=w.attr("id");if(r==y){w.mouseover()}else{w.mouseout()}});jQuery("#"+r).mouseover()}else{jQuery("#"+j+" area").each(function(v,w){jQuery(w).mouseout()})}}});jQuery("#"+j).droppable({drop:function(m,t){var r=jQuery("#"+j+"_img");var p=r.offset();var u=jQuery(t.draggable);var o=u.offset();var n=o.left+(u.width()/2)-p.left;var w=o.top+(u.height()/2)-p.top;var s=h(n,w,j);if("invalid"!=s){var z=jQuery("#"+s);var v=g(z);var x=z.data("qti-id");var q=u.data("qti-id");u.css("position","absolute");u.css("left",v[0]+"px");u.css("top",v[1]+"px");u.css("border","none");u.removeClass("oo-selected");u.addClass("oo-choosed");var y=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+k.responseIdentifier).attr("value",q+" "+x);jQuery(this).prepend(y);jQuery(z).mouseout();u.data("drop-timestamp",Date.now())}}});jQuery("#"+j+" area").on("click",function(o,n){var m=jQuery(this);jQuery(".gap_item.oo-selected").each(function(q,s){var r=jQuery(s);var t=g(m);var w=m.data("qti-id");var v=r.data("qti-id");r.css("position","absolute");r.css("left",t[0]+"px");r.css("top",t[1]+"px");r.css("border","none");r.removeClass("oo-selected");r.addClass("oo-choosed");var p=jQuery("#"+j);var u=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+k.responseIdentifier).attr("value",v+" "+w);p.prepend(u)})})}function h(l,k,j){var m="invalid";jQuery("#"+j+" area").each(function(r,o){var v=jQuery(o);var u=v.attr("id");var t=v.attr("coords");var s=v.attr("shape");var w=g(v);if("circle"==s){if(a(l,k,w[0],w[1],w[2])){m=u}}else{if("rect"==s){if(d(l,k,w[0],w[1],w[2],w[3])){m=u}}else{if("poly"==s){var n={};n.x=[];n.y=[];var q=w.length/2;var p=0;for(ix=0;ix<q;ix++){n.x[ix]=w[p];n.y[ix]=w[p+1];p+=2}for(i=0;i<n.length;i++){if(e(n.x.length,n.x,n.y,l,k)){m=n.id;break}}}}}});return m}function a(k,o,m,l,j){var n=Math.pow(k-m,2)+Math.pow(o-l,2);return Math.pow(j,2)>=n}function d(j,o,n,l,k,m){if((n<=j)&&(j<=k)&&(l<=o)&&(o<=m)){return true}else{return false}}function e(l,p,o,k,r){var n,m,q=false;for(n=0,m=l-1;n<l;m=n++){if(((o[n]>r)!=(o[m]>r))&&(k<(p[m]-p[n])*(r-o[n])/(o[m]-o[n])+p[n])){q=!q}}return q}function g(j){var k=j.attr("coords").split(",");for(i=k.length;i-->0;){k[i]=parseFloat(k[i])}return k}}(jQuery));(function(c){c.fn.graphicOrderInteraction=function(d){var f=c.extend({responseIdentifier:null,formDispatchFieldId:null,responseValue:null,maxChoices:1,opened:false},d);try{if(!(typeof f.responseValue==="undefined")&&f.responseValue.length>0){b(this,f)}if(f.opened){a(this,f)}}catch(g){if(window.console){console.log(g)}}return this};function b(d,h){var m=d.attr("id");var r=jQuery("#"+m+"_container");var e=document.getElementById(m+"_canvas");var o=e.getContext("2d");o.clearRect(0,0,jQuery(e).width(),jQuery(e).height());var n=h.responseValue.split(",");for(var k=n.length;k-->0;){if(n[k].length==0){continue}var q=jQuery("#ac_"+h.responseIdentifier+"_"+n[k]);var f=q.data("qti-id");var l=q.attr("coords").split(",");var j=l[0];var g=l[1];o.font="16px Arial";o.fillText(""+(k+1),j,g);var p=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+h.responseIdentifier).attr("value",f);r.prepend(p)}}function a(f,e){var d=f.attr("id");jQuery("#"+d+"_container area").on("click",function(v){var h=8;var x=jQuery(this).attr("id");var l=jQuery(this).data("qti-id");var u=jQuery(this).attr("coords").split(",");var o=u[0];var n=u[1];var t=jQuery("#"+d+"_container").data("openolat")||{};if(t.listOfPoints==undefined){t.listOfPoints=[];jQuery("#"+d+"_container").data("openolat",t)}var s=false;var m=[];for(var q=t.listOfPoints.length;q-->0;){var j=t.listOfPoints[q];var g=((j.x-o)*(j.x-o))+((j.y-n)*(j.y-n));if(h*h>g){s=true}else{m.push(j)}}if(s){t.listOfPoints=m}else{if(t.listOfPoints.length>=e.maxChoices){return false}else{t.listOfPoints.push({x:o,y:n,areaId:x,spotQtiId:l})}}var k=document.getElementById(d+"_canvas");var w=k.getContext("2d");w.clearRect(0,0,jQuery(k).width(),jQuery(k).height());var z=jQuery("#"+d+"_container");z.find("input[type='hidden']").remove();for(var q=t.listOfPoints.length;q-->0;){var j=t.listOfPoints[q];w.font="16px Arial";w.fillText(""+(q+1),j.x,j.y);var y=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+e.responseIdentifier).attr("value",j.spotQtiId);z.prepend(y)}})}}(jQuery));(function(c){c.fn.hotspotInteraction=function(f){var g=c.extend({responseIdentifier:null,formDispatchFieldId:null,maxChoices:1,singleChoice:false,responseValue:null,opened:false,maphilightSettings:{}},f);try{if(!(typeof g.responseValue==="undefined")&&g.responseValue.length>0){a(this,g)}if(g.opened){e(this,g)}}catch(h){if(window.console){console.log(h)}}return this};function a(n,k){var f=n.attr("id");var g=jQuery("#"+f);var j=k.responseValue.split(",");for(i=j.length;i-->0;){var h=jQuery("#ac_"+k.responseIdentifier+"_"+j[i]);var l=h.data("maphilight")||{};l.selectedOn=true;b(l,k.maphilightSettings);h.data("maphilight",l).trigger("alwaysOn.maphilight");var m=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+k.responseIdentifier).attr("value",h.data("qti-id"));g.append(m)}}function e(h,g){var f=h.attr("id");jQuery("#"+f+" map area").each(function(j,k){jQuery(k).on("click",function(){d(this,f,g.responseIdentifier,g.maxChoices,g.singleChoice,g.maphilightSettings)})})}function d(l,j,o,k,q,m){var n=jQuery(l);var h=n.data("maphilight")||{};if((typeof h.selectedOn==="undefined")||!h.selectedOn){if(q){jQuery("area","map[name='"+j+"_map']").each(function(r,t){var s=jQuery(t).data("maphilight")||{};if(s.selectedOn){s.selectedOn=false;b(s,m);jQuery(t).data("maphilight",s).trigger("alwaysOn.maphilight")}})}var f=k;if(f>0){var g=0;jQuery("area","map[name='"+j+"_map']").each(function(r,t){var s=jQuery(t).data("maphilight")||{};if(s.selectedOn){g++}});if(g>=f){return false}}}if(typeof h.selectedOn==="undefined"){h.selectedOn=true}else{h.selectedOn=!h.selectedOn}b(h,m);n.data("maphilight",h).trigger("alwaysOn.maphilight");var p=jQuery("#"+j);p.find("input[type='hidden']").remove();jQuery("area","map[name='"+j+"_map']").each(function(r,t){var u=jQuery(t);var s=u.data("maphilight")||{};if(s.selectedOn){var v=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+o).attr("value",u.data("qti-id"));p.append(v)}})}function b(g,f){if(g.selectedOn){g.fillColor=f.selectedFillColor;g.fillOpacity=f.selectedFillOpacity;g.strokeColor=f.selectedStrokeColor;g.strokeOpacity=f.selectedStrokeOpacity;g.shadow=f.selectedShadow;g.shadowX=0;g.shadowY=0;g.shadowRadius=7;g.shadowColor="000000";g.shadowOpacity=0.8;g.shadowPosition="outside"}else{g.fillColor=f.fillColor;g.fillOpacity=f.fillOpacity;g.strokeColor=f.strokeColor;g.strokeOpacity=f.strokeOpacity;g.shadow=false}}}(jQuery));(function(a){a.fn.rwdImageMaps=function(d){var g=a.extend({fillColor:"bbbbbb",fillOpacity:0.5,strokeColor:"6E6E6E",strokeOpacity:1,},d);var f=this;var c=null;var e=0;var b=function(){f.each(function(){if(typeof(a(this).attr("usemap"))=="undefined"){return}var i=function(l,k){a("<img />").on("load",function(){var o="width",x="height";var v=a(this);if(!k.data(o)){k.data(o,k.attr(o))}if(!k.data(x)){k.data(x,k.attr(x))}var z=k.data(o),q=k.data(x);if(!z||!q){var A=new Image();A.src=k.attr("src");if(!z){z=A.width;k.data(o,q)}if(!q){q=A.height;k.data(x,q)}}var y=k.closest(".o_oo_hotcontainer").width();var r=k.width(),p=k.height();if(y<z){var t=q/z;r=y;p=((y*t)|0);k.width(r);k.height(p)}var m=r/100,s=p/100,n=k.attr("usemap").replace("#",""),u="coords";a('map[name="'+n+'"]').find("area").each(function(){var D=a(this);if(!D.data(u)){D.data(u,D.attr(u))}var C=D.data(u).split(","),B=new Array(C.length);for(var w=0;w<B.length;++w){if(w%2===0){B[w]=parseInt(((C[w]/z)*100)*m)}else{B[w]=parseInt(((C[w]/q)*100)*s)}}D.attr(u,B.toString())});c=true;k.maphilight({fillColor:g.fillColor,fillOpacity:g.fillOpacity,strokeColor:g.strokeColor,strokeOpacity:g.strokeOpacity,strokeWidth:3,alwaysOn:true})}).attr("src",k.attr("src"))};var j=this,h=a(j);if(c){if(e!=window.innerWidth){i(j,h);e=window.innerWidth}}else{e=window.innerWidth;i(j,h)}})};a(window).resize(b).trigger("resize");return this}})(jQuery);(function(f){f.fn.matchInteraction=function(i){var k=f.extend({responseIdentifier:null,formDispatchFieldId:null,maxAssociations:1,unansweredColumn:null,leftData:{},rightData:{},leftMap:{},rightMap:{},matched:[]},i);for(var j in k.leftData){k.leftMap[j]={matchMax:k.leftData[j],matchCount:0}}for(var j in k.rightData){k.rightMap[j]={matchMax:k.rightData[j],matchCount:0}}try{d(this,k)}catch(l){if(window.console){console.log(l)}}return this};function d(j,i){e(i.responseIdentifier).on("click",function(){a(i,this)});c(i);h(i)}function e(i){return jQuery("input[name=qtiworks_response_"+i+"]")}function b(k,m,o){var n=m.value;var i=n.split(" ");var l=k.leftMap[i[0]];var j=k.rightMap[i[1]];o(m,n,l,j)}function c(j){j.matchCount=0;j.matched={};for(var i in j.leftMap){j.leftMap[i].matchCount=0}for(var i in j.rightMap){j.rightMap[i].matchCount=0}e(j.responseIdentifier).each(function(){b(j,this,function(m,n,l,k){if(m.checked){j.matchCount++;l.matchCount++;k.matchCount++;j.matched[n]=true}})})}function h(i){e(i.responseIdentifier).each(function(){b(i,this,function(l,m,k,j){if(l.checked){l.disabled=false}else{if(i.maxAssociations!=0&&i.matchCount>=i.maxAssociations){l.disabled=true}else{if(k.matchMax!=0&&k.matchCount>=k.matchMax){if(k.matchMax!=1&&k.matchCount!=1){l.disabled=true}else{l.disabled=false}}else{if(j.matchMax!=0&&j.matchCount>=j.matchMax){l.disabled=true}else{l.disabled=false}}}}})})}function a(i,j){b(i,j,function(q,r,p,n){if(q.checked){var m=false;if(p.matchMax==1){var o=jQuery(q);var l=o.attr("id");var k=o.attr("value").split(" ")[0];e(i.responseIdentifier).each(function(){b(i,this,function(t,x,w,s){var v=jQuery(t);if(l!==v.attr("id")&&t.checked){var u=v.attr("value").split(" ")[0];if(k===u){t.checked=false;w.matchCount--;i.matchCount--}}})});p.matchCount++;i.matchCount++;m=true}else{if(p.matchMax!=0&&p.matchMax<=p.matchCount){q.checked=false}else{p.matchCount++;i.matchCount++;m=true}}if(n.matchMax!=0&&n.matchMax<=n.matchCount){q.checked=false}else{n.matchCount++;if(!m){i.matchCount++}}}else{i.matchCount--;p.matchCount--;n.matchCount--}h(i);if(!q.checked&&i.unansweredColumn!=null){g(i,q)}})}function g(l,n){var m=jQuery(n);var j=m.attr("value").split(" ")[0];var k=0;var i=null;e(l.responseIdentifier).each(function(){b(l,this,function(p,t,s,o){var r=jQuery(p);var q=r.attr("value").split(" ")[0];if(j===q){if(p.checked){k++}else{if(r.closest("."+l.unansweredColumn).length==1){i=p}}}})});if(k==0&&i!=null){i.checked=true}}}(jQuery));(function(h){h.fn.matchInteractionDnd=function(m){var n=h.extend({responseIdentifier:null,formDispatchFieldId:null,maxAssociations:1,responseValue:null,opened:false},m);try{if(typeof n.responseValue!="undefined"&&n.responseValue.length>0){f(this,n)}if(n.opened){i(this,n)}}catch(o){if(window.console){console.log(o)}}return this};function f(m,o){var q=m.attr("id");var w=o.responseValue.split(",");var r=jQuery("#"+q);for(var p=0;p<w.length;p++){var n=w[p].split(" ");var t=n[0];var s=n[1];var v=jQuery("#"+q+" .o_match_dnd_sources li[data-qti-id='"+t+"']");if(g(v,q)){v=jQuery(v).clone()}var u=jQuery("#"+q+" .o_match_dnd_targets ul[data-qti-id='"+s+"']");jQuery(v).addClass("oo-choosed");jQuery(u).addClass("oo-choosed");jQuery(u).addClass("oo-filled").append(v)}l(q,o);if(o.unrestricted&&o.opened){addNewAssociationBoxAndEvents(q,o)}}function i(q,p){var n=q.attr("id");a(n,p);var o=jQuery("#"+n+" .o_match_dnd_source");e(o,n,p);var m=jQuery("#"+n+" .o_match_dnd_target");k(m,n,p)}function a(m,n){jQuery("#"+m+" .o_match_dnd_sources").droppable({tolerance:"pointer",over:function(o,p){jQuery(this).addClass("oo-accepted")},out:function(o,p){jQuery(this).removeClass("oo-accepted")},drop:function(s,t){var r=jQuery(this);r.removeClass("oo-accepted");var q=jQuery(t.draggable);var o=q.data("qti-id");var p=r.find("li[data-qti-id='"+o+"']");if(p.length>0){if(q.parents(".o_match_dnd_sources").length==0){q.remove()}}else{q.appendTo(r)}l(m,n);setFlexiFormDirty(n.formDispatchFieldId,false)}}).on("click",{formId:n.formDispatchFieldId},setFlexiFormDirtyByListener)}function e(n,m,o){n.on("click",function(r,q){var p=jQuery(this);if(!p.hasClass("oo-choosed")&&!p.hasClass("oo-selected")){jQuery("#"+m+" .o_match_dnd_sources .o_match_dnd_source").each(function(s,t){jQuery(t).removeClass("oo-selected")});p.addClass("oo-selected")}else{if(p.parents(".o_match_dnd_targets").length>0&&!p.hasClass("oo-dropped-mrk")){d(p,m);l(m,o);setFlexiFormDirty(o.formDispatchFieldId,false)}}}).draggable({containment:"#"+m,scroll:false,revert:"invalid",cursorAt:{left:5,top:5},start:function(p,q){jQuery(q.helper).removeClass("oo-dropped-mrk")},stop:function(p,q){jQuery(this).css({left:"0px",top:"0px","z-index":""});jQuery(q.helper).removeClass("oo-drag")},helper:function(){var q=jQuery(this);var r=q.parent(".o_match_dnd_target").length>0;if(!r&&g(this,m)){q.removeClass("oo-selected");var p=q.clone();jQuery(p).attr("id","n"+j()).data("qti-cloned","true").addClass("oo-drag").addClass("oo-drag-mrk").css("z-index",10).css("width",q.width()).css("height",q.height());return p}q.addClass("oo-drag").addClass("oo-drag-mrk").css("z-index",10);return q}}).on("click",{formId:o.formDispatchFieldId},setFlexiFormDirtyByListener)}function j(){function m(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return m()+m()+m()+m()+m()+m()+m()}function g(r,n){var q=jQuery(r);if(q.parents(".o_match_dnd_target").length>0){return false}var o=q.data("qti-match-max");var m=q.data("qti-id");var p=jQuery("#"+n+" .o_match_dnd_targets li[data-qti-id='"+m+"']").length;return(o==0||p+1<o)}function k(n,m,o){n.on("click",function(s,q){var r=this;var p=jQuery(r);var t=jQuery(".o_associate_item",this).length;if(t==0){jQuery("#"+m+" .o_match_dnd_sources .oo-selected").each(function(x,B){var y=jQuery(B);var w=y.data("qti-id");var v=jQuery(".o_match_dnd_source[data-qti-id='"+w+"']",r).length;var u=v==0;var A=jQuery(r).data("qti-match-max");if(A>0){var z=jQuery(".o_match_dnd_source",r).length;if(z>=A){u&=false}}if(u){if(g(B,m)){y.removeClass("oo-selected");y=y.clone();b(y,p,m);e(y,m,o)}else{b(y,p,m)}}})}l(m,o);setFlexiFormDirty(o.formDispatchFieldId,false)}).droppable({tolerance:"pointer",accept:function(q){var p=jQuery(q).data("qti-id");var r=jQuery(".o_match_dnd_source[data-qti-id='"+p+"']",this).length==0;if(r){var t=jQuery(this).data("qti-match-max");if(t>0){var s=jQuery(".o_match_dnd_source",this).length;if(s>=t){r=false}}}return r},over:function(p,q){jQuery(this).addClass("oo-accepted")},out:function(p,q){jQuery(this).removeClass("oo-accepted")},drop:function(t,u){var s=jQuery(this);s.removeClass("oo-accepted");var r=jQuery(u.draggable);var q=r.data("qti-id");var p=jQuery(".o_match_dnd_source[data-qti-id='"+q+"']",this).length;if(p>0){return}if(u.helper!=null&&jQuery(u.helper).data("qti-cloned")=="true"){r.removeClass("oo-selected").removeClass("oo-drag");r=r.clone();e(r,m,o);b(r,s,m)}else{r.removeClass("oo-selected").removeClass("oo-drag");b(r,s,m)}r.addClass("oo-dropped-mrk");setTimeout(function(){r.removeClass("oo-dropped-mrk")},100);l(m,o);setFlexiFormDirty(o.formDispatchFieldId,false)}}).on("click",{formId:o.formDispatchFieldId},setFlexiFormDirtyByListener)}function b(o,p,n){var m=p.find("ul.o_match_dnd_target_drop_zone");o.removeClass("oo-selected").css({width:"auto",left:"0px",top:"0px","z-index":""}).addClass("oo-choosed").appendTo(m);p.addClass("oo-filled")}function d(q,n){var p=jQuery(q);p.removeClass("oo-choosed");var m=p.data("qti-id");var o=jQuery("#"+n+" .o_match_dnd_sources li[data-qti-id='"+m+"']").length;if(o==0){p.css({width:"auto",left:"0px",top:"0px","z-index":""}).appendTo(jQuery("#"+n+" .o_match_dnd_sources"))}else{p.remove()}}function l(m,p){p.matchCount=0;p.matched={};for(var o in p.leftMap){p.leftMap[o].matchCount=0}for(var o in p.rightMap){p.rightMap[o].matchCount=0}var n=jQuery("#"+m);n.find("input[type='hidden']").remove();jQuery("#"+m+" .o_match_dnd_target_drop_zone").each(function(r,q){jQuery(q).find(".o_match_dnd_source").each(function(w,s){var u=jQuery(s).data("qti-id");var t=jQuery(q).data("qti-id");var v=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+p.responseIdentifier).attr("value",u+" "+t);n.prepend(v)})})}function c(m,n){withCheckbox(m,n,function(r,s,q,p){if(r.checked){var o=false;if(q.matchMax!=0&&q.matchMax<=q.matchCount){r.checked=false}else{q.matchCount++;m.matchCount++;o=true}if(p.matchMax!=0&&p.matchMax<=p.matchCount){r.checked=false}else{p.matchCount++;if(!o){m.matchCount++}}}else{m.matchCount--;q.matchCount--;p.matchCount--}updateDisabledStates(m)})}}(jQuery));(function(c){c.fn.orderInteraction=function(d){var f=c.extend({responseIdentifier:null,formDispatchFieldId:null,minChoices:null,maxChoices:null,responseValue:null,opened:false},d);try{if(typeof f.responseValue!="undefined"&&f.responseValue.length>0){b(f)}if(f.opened){a(this,f)}}catch(g){if(window.console){console.log(g)}}return this};function a(k,g){var d="#qtiworks_response_"+g.responseIdentifier;var i=jQuery(d+" div.source ul");var j=jQuery(d+" div.target ul");var h=jQuery(d+" div.source ul").get(0);var f=jQuery(d+" div.target ul").get(0);var e=dragula([h,f],{copy:function(l,m){return false},accepts:function(l,m){return m!==h}});e.on("drag",function(m,l){}).on("over",function(m,l,n){if(l===f){jQuery(l).addClass("oo-accepted")}}).on("drop",function(m,o,n,l){b(g);setFlexiFormDirty(g.formDispatchFieldId)}).on("dragend",function(l){jQuery(f).removeClass("oo-accepted")}).on("out",function(l){jQuery(f).removeClass("oo-accepted")})}function b(h){var d="#qtiworks_response_"+h.responseIdentifier;var i=jQuery(d+" div.source ul");var j=jQuery(d+" div.target ul");var e=jQuery(d+" div.target");var g=jQuery(d+" div.hiddenInputContainer");var f=j.children("li").length;if(h.minChoices!=null&&h.maxChoices!=null){if(f<h.minChoices||f>h.maxChoices){if(h.minChoices!=h.maxChoices){alert("You must select and order between "+h.minChoices+" and "+h.maxChoices+" items")}else{alert("You must select and order exactly "+h.minChoices+" item"+(minChoices>1?"s":""))}e.toggleClass("highlight",true);return false}else{e.toggleClass("highlight",false)}}var g=jQuery(d+" div.hiddenInputContainer");g.empty();j.children("li").each(function(l){var k=this.id.substring("qtiworks_response_".length);var m=jQuery('<input type="hidden">');m.attr("name","qtiworks_response_"+h.responseIdentifier);m.attr("value",k);g.append(m)})}}(jQuery));(function(b){b.fn.positionObjectStage=function(f){var g=b.extend({responseIdentifier:null,formDispatchFieldId:null,responseValue:null,maxChoices:1,opened:false},f);try{var d=this.attr("id");jQuery("#"+d+" .items_container .o_item.o_"+g.responseIdentifier).each(function(e,i){jQuery(i).attr("id","object-item-"+e)});if(!(typeof g.responseValue==="undefined")&&g.responseValue.length>0){c(this,g)}if(g.opened){a(this,g)}}catch(h){if(window.console){console.log(h)}}return this};function c(d,f){var k=d.attr("id");var r=jQuery("#"+k);var j=f.responseValue.split(":");var l=jQuery("#"+k+" .items_container .o_item.o_"+f.responseIdentifier);for(var h=j.length;h-->0;){var n=j[h].split(" ");var g=n[0];var e=n[1];var q=jQuery(l.get(h));q.css("position","absolute");q.css("top",e+"px");q.css("left",g+"px");var m=q.attr("id");var o="in-"+m+"-"+f.responseIdentifier;var p=jQuery('<input type="hidden"/>').attr("id",o).attr("name","qtiworks_response_"+f.responseIdentifier).attr("value",g+" "+e);r.prepend(p)}}function a(g,f){var d=g.attr("id");var e=jQuery("#"+d);jQuery("#"+d+" .items_container .o_item.o_"+f.responseIdentifier).draggable({containment:"#"+d,scroll:false,stop:function(h,p){var i=jQuery("#"+d+"_img");var k=jQuery(i).offset().top-jQuery(window).scrollTop();var n=jQuery(i).offset().left-jQuery(window).scrollLeft();var m=jQuery(this).offset().top-jQuery(window).scrollTop();var q=jQuery(this).offset().left-jQuery(window).scrollLeft();var l=Math.round((q-n));var j=Math.round((m-k));var o=jQuery(this).attr("id");var r="in-"+o+"-"+f.responseIdentifier;var s=e.find("#"+r);if(s.length==0){var t=jQuery('<input type="hidden"/>').attr("id",r).attr("name","qtiworks_response_"+f.responseIdentifier).attr("value",l+" "+j);e.prepend(t)}else{s.val(l+" "+j)}setFlexiFormDirty(f.formDispatchFieldId)}})}}(jQuery));(function(a){a.fn.selectPointInteraction=function(d){var f=a.extend({responseIdentifier:null,formDispatchFieldId:null,responseValue:null,maxChoices:1,opened:false},d);try{if(!(typeof f.responseValue==="undefined")&&f.responseValue.length>0){b(this,f)}if(f.opened){c(this,f)}}catch(g){if(window.console){console.log(g)}}return this};function b(d,h){var e=8;var j=d.attr("id");var q=jQuery("#"+j);var n=h.responseValue.split(":");var g=document.getElementById(j+"_canvas");var k=g.getContext("2d");k.clearRect(0,0,jQuery(g).width(),jQuery(g).height());for(i=n.length;i-->0;){if(n[i].length==0){continue}var f=n[i].split(" ");var m=f[0];var l=f[1];k.beginPath();k.arc(m,l,e,0,Math.PI*2,false);k.stroke();k.closePath();var o=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+h.responseIdentifier).attr("value",m+" "+l);q.append(o)}}function c(f,e){var d=f.attr("id");jQuery("#"+d+"_canvas").on("click",function(u,z){var h=8;var q=jQuery(this).offset().top-jQuery(window).scrollTop();var w=jQuery(this).offset().left-jQuery(window).scrollLeft();var n=Math.round((u.clientX-w));var m=Math.round((u.clientY-q));var s=jQuery("#"+d).data("openolat")||{};if(s.listOfPoints==undefined){s.listOfPoints=[];jQuery("#"+d).data("openolat",s)}var o=false;var l=[];for(i=s.listOfPoints.length;i-->0;){var j=s.listOfPoints[i];var g=((j.x-n)*(j.x-n))+((j.y-m)*(j.y-m));if(Math.pow(h,2)>g){o=true}else{l.push(j)}}if(o){s.listOfPoints=l}else{if(s.listOfPoints.length>=e.maxChoices){return false}else{s.listOfPoints.push({x:n,y:m})}}var k=document.getElementById(d+"_canvas");var v=k.getContext("2d");v.clearRect(0,0,jQuery(k).width(),jQuery(k).height());var y=jQuery("#"+d);y.find("input[type='hidden']").remove();for(i=s.listOfPoints.length;i-->0;){var j=s.listOfPoints[i];v.beginPath();v.arc(j.x,j.y,h,0,Math.PI*2,false);v.stroke();v.closePath();var x=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+e.responseIdentifier).attr("value",j.x+" "+j.y);y.append(x)}setFlexiFormDirty(e.formDispatchFieldId)})}}(jQuery));(function(b){b.fn.sliderInteraction=function(c){var d=b.extend({responseIdentifier:null,formDispatchFieldId:null,responseValue:null,min:1,max:1,step:1,orientation:null,isReversed:false,isDiscrete:false,opened:false,initialValue:null},c);try{a(this,d)}catch(f){if(window.console){console.log(f)}}return this};function a(g,d){var e=jQuery("#qtiworks_id_slider_"+d.responseIdentifier);var f=jQuery('input[name="qtiworks_response_'+d.responseIdentifier+'"]');var c=f.get(0).value||d.min;e.slider({value:c,step:d.step,disabled:!d.opened,orientation:d.orientation,min:d.isReversed?-d.max:d.min,max:d.isReversed?-d.min:d.max,slide:function(h,j){var i=d.isReversed?-j.value:j.value;var l=jQuery("#qtiworks_id_slidervalue_"+d.responseIdentifier);var k=jQuery('input[name="qtiworks_response_'+d.responseIdentifier+'"]');k.get(0).value=i;l.text(i);e.slider("value",d.isReversed?-i:i);setFlexiFormDirty(d.formDispatchFieldId)}})}}(jQuery));
\ No newline at end of file
(function(g){g.fn.associateInteraction=function(m){var n=g.extend({responseIdentifier:null,formDispatchFieldId:null,responseValue:null,opened:false,unrestricted:false},m);try{if(typeof n.responseValue!="undefined"&&n.responseValue.length>0){c(this,n)}if(n.opened){a(this,n)}}catch(o){if(window.console){console.log(o)}}return this};function c(m,q){var t=m.attr("id");var w=q.responseValue.split(",");var u=jQuery("#"+t+"_panel .association");for(var r=0;r<w.length;r++){var p=w[r].split(" ");var s=jQuery(u.get(r));if(s.length==0){var v=d(t,q);s=jQuery("#"+v)}var o=jQuery("#"+t+"_items div[data-qti-id='"+p[0]+"']");if(e(o,t)){o=jQuery(o).clone()}var n=jQuery("#"+t+"_items div[data-qti-id='"+p[1]+"']");if(e(n,t)){n=jQuery(n).clone()}jQuery(o).addClass("oo-choosed");jQuery(n).addClass("oo-choosed");jQuery(s.find(".association_box.left")).addClass("oo-filled").append(o);jQuery(s.find(".association_box.right")).addClass("oo-filled").append(n)}l(t,q);if(q.unrestricted&&q.opened){i(t,q)}}function a(q,o){var m=q.attr("id");var n=jQuery("#"+m+" .o_associate_item");b(n,m,o);var p=jQuery("#"+m+"_panel .association_box");k(p,m,o)}function b(n,m,o){n.on("click",function(r,q){var p=jQuery(this);if(!p.hasClass("oo-choosed")&&!p.hasClass("oo-selected")){p.addClass("oo-selected")}}).draggable({containment:"#"+m,scroll:false,revert:"invalid",stop:function(p,q){jQuery(this).css({left:"0px",top:"0px"});jQuery(q.helper).removeClass("oo-drag")},helper:function(){var q=jQuery(this);var r=q.parent(".association_box").length>0;if(!r&&e(this,m)){q.removeClass("oo-selected");var p=q.clone();jQuery(p).attr("id","n"+j()).data("qti-cloned","true").addClass("oo-drag");return p}q.addClass("oo-drag");return q}}).on("click",{formId:o.formDispatchFieldId},setFlexiFormDirtyByListener)}function e(r,n){var q=jQuery(r);var p=q.data("qti-match-max");var m=q.data("qti-id");var o=jQuery("#"+n+"_panel div[data-qti-id='"+m+"']").length;return(p==0||o+1<p)}function k(n,m,o){n.on("click",function(r,p){var q=jQuery(this);var s=jQuery(".o_associate_item",this).length;if(s==1){jQuery(".o_associate_item",this).each(function(t,u){h(u,q,m)})}else{jQuery("#"+m+"_items .o_associate_item.oo-selected").each(function(t,v){var u=jQuery(v);if(e(v,m)){u.removeClass("oo-selected");f(u.clone(),q,m)}else{f(u,q,m)}})}l(m,o);setFlexiFormDirty(o.formDispatchFieldId,false)}).droppable({drop:function(r,s){var q=jQuery(this);var t=jQuery(".o_associate_item",this).length;if(t>0){jQuery(".o_associate_item",this).each(function(u,v){h(v,q,m)})}var p;if(s.helper!=null&&jQuery(s.helper).data("qti-cloned")=="true"){var p=jQuery(s.draggable);p.removeClass("oo-selected").removeClass("oo-drag");p=p.clone();b(p,m,o);f(p,q,m)}else{var p=jQuery(s.draggable);p.removeClass("oo-selected").removeClass("oo-drag");f(p,q,m)}l(m,o);setFlexiFormDirty(o.formDispatchFieldId,false)}}).on("click",{formId:o.formDispatchFieldId},setFlexiFormDirtyByListener)}function f(o,n,m){o.removeClass("oo-selected").css({left:"0px",top:"0px"}).addClass("oo-choosed").appendTo(n);n.addClass("oo-filled")}function h(r,q,n){q.removeClass("oo-filled");var p=jQuery(r);p.removeClass("oo-choosed");var m=p.data("qti-id");var o=jQuery("#"+n+"_items div[data-qti-id='"+m+"']").length;if(o==0){p.appendTo(jQuery("#"+n+"_items"))}else{p.remove()}}function j(){function m(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return m()+m()+m()+m()+m()+m()+m()}function l(m,o){var n=jQuery("#"+m+"_panel");n.find("input[type='hidden']").remove();jQuery("#"+m+"_panel .association").each(function(p,u){var r=jQuery(u).find(".o_associate_item");if(r.length==2){var s=jQuery(r.get(0)).data("qti-id");var q=jQuery(r.get(1)).data("qti-id");var t=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+o.responseIdentifier).attr("value",s+" "+q);n.prepend(t)}else{if(r.length==0&&o.unrestricted){u.remove()}else{jQuery(u).find(".association_box").each(function(x,w){var v=jQuery(w).find(".o_associate_item").length;if(v==0&&jQuery(w).hasClass("oo-filled")){jQuery(w).removeClass("oo-filled")}})}}});i(m,o)}function i(m,p){if(!p.unrestricted||!p.opened){return}var n=jQuery("#"+m+"_panel");var o=true;jQuery("#"+m+"_panel .association").each(function(s,u){var t=jQuery(u).find(".o_associate_item");if(t.length!=2){o=false}});if(o){var r=d(m,p);var q=jQuery("#"+r+" .association_box");k(q,m,p)}}function d(m,n){var o=j();var p='<div id="'+o+'" class="association" style="">\n <div class="association_box left" style="width: 100px; height:50px; float:left;"></div>\n <div class="association_box right" style="width: 100px; height:50px; float:right;"></div>\n <div style="clear:both; "></div>\n</div>\n';jQuery("#"+m+"_panel").append(p);jQuery("#"+m+"_panel").append('<div style="clear:both; "></div>\n');return o}}(jQuery));(function(b){b.fn.choiceInteraction=function(d){var f=b.extend({responseIdentifier:null,formDispatchFieldId:null,maxChoices:0,},d);try{if(f.maxChoices>0){a(this,f);c(f)}}catch(g){if(window.console){console.log(g)}}return this};function a(f,d){var e=jQuery("#qti_container_"+d.responseIdentifier+" input[type=checkbox]");e.on("click",function(g,h){c(d)})}function c(d){var f=jQuery("#qti_container_"+d.responseIdentifier+" input[type=checkbox]");var e=0;f.each(function(g,h){if(h.checked){e++}});if(e>=d.maxChoices){f.each(function(g,h){if(h.checked){h.disabled=false}else{h.disabled=true}})}else{f.each(function(g,h){h.disabled=false})}}}(jQuery));(function(f){f.fn.gapMatchInteraction=function(h){var j=f.extend({responseIdentifier:null,formDispatchFieldId:null,gapChoiceData:{},gapData:{},opened:false,gapChoiceMap:{},gapMap:{},matched:{}},h);for(var i in j.gapChoiceData){var k=jQuery("#qtiworks_id_"+j.responseIdentifier+"_"+i);j.gapChoiceMap[i]={matchMax:j.gapChoiceData[i],matchCount:0,query:k,text:k.text()}}for(var i in j.gapData){var k=jQuery("#qtiworks_id_"+j.responseIdentifier+"_"+i);j.gapMap[i]={required:j.gapData[i],matched:false,matchedGapChoice:null,query:k,label:k.text()}}try{d(this,j)}catch(l){if(window.console){console.log(l)}}return this};function b(j,k,n){var m=k.value;var i=m.split(" ");var h=j.gapChoiceMap[i[0]];var l=j.gapMap[i[1]];n(j,k,m,h,l)}function d(i,h){if(h.opened){e(h.responseIdentifier).on("click",function(){a(h,this);setFlexiFormDirty(h.formDispatchFieldId)})}c(h);g(h)}function e(h){return jQuery("input[name=qtiworks_response_"+h+"]")}function c(j){j.matchCount=0;for(var i in j.gapChoiceMap){j.gapChoiceMap[i].matchCount=0}for(var i in j.gapMap){j.gapMap[i].matched=false;j.gapMap[i].matchedGapChoice=null}e(j.responseIdentifier).each(function(l,m){b(j,this,function(o,p,r,n,q){if(p.checked){n.matchCount++;q.matched=true;q.matchedGapChoice=n;o.matched[r]=true}})});for(var i in j.gapMap){var k=j.gapMap[i];var h;if(k.matched){h=k.matchedGapChoice.text}else{h=k.label}k.query.text(h)}}function g(h){e(h.responseIdentifier).each(function(){b(h,this,function(j,k,m,i,l){if(!j.opened){k.disabled=true}else{if(k.checked){k.disabled=false}else{if(l.matched||(i.matchMax!=0&&i.matchCount>=i.matchMax)){k.disabled=true}else{k.disabled=false}}}})})}function a(h,i){b(h,i,function(k,l,n,j,m){if(l.checked){if(m.matched||(j.matchMax!=0&&j.matchMax<=j.matchCount)){l.checked=false}else{j.matchCount++;m.matched=true;m.matchedGapChoice=j}m.query.text(j.text)}else{j.matchCount--;m.matched=false;m.matchedGapChoice=null;m.query.text(m.label)}g(k)})}}(jQuery));(function(d){d.fn.graphicAssociateInteraction=function(g){var h=d.extend({responseIdentifier:null,formDispatchFieldId:null,responseValue:null,maxAssociations:1,opened:false},g);try{if(!(typeof h.responseValue==="undefined")&&h.responseValue.length>0){e(this,h.responseValue,h.responseIdentifier)}if(h.opened){c(this,h.maxAssociations,h.responseIdentifier)}}catch(j){if(window.console){console.log(j)}}return this};function c(k,j,h){var g=k.attr("id");jQuery("#"+g+"_container area").on("click",function(t){var l=8;var q=jQuery("#"+g+"_container").data("openolat")||{};if(q.listOfPairs==undefined){q.currentSpot="";q.listOfPairs=[];jQuery("#"+g+"_container").data("openolat",q)}var w=jQuery(this).data("qti-id");if(q.currentSpot==""||q.currentSpot==w){q.currentSpot=w}else{var A=[q.currentSpot,w];q.listOfPairs.push(A);q.currentSpot=""}var m=document.getElementById(g+"_canvas");var u=m.getContext("2d");u.clearRect(0,0,jQuery(m).width(),jQuery(m).height());var B=jQuery("#"+g+"_container");B.find("input[type='hidden']").remove();var z=[];if(q.currentSpot!=""){b(u,"ac_"+h+"_"+q.currentSpot);z.push(q.currentSpot)}for(var p=q.listOfPairs.length;p-->0;){var o=q.listOfPairs[p];for(var n=o.length;n-->0;){if(0>z.indexOf(o[n])){b(u,"ac_"+h+"_"+o[n]);z.push(o[n])}}var s=jQuery("#ac_"+h+"_"+o[1]);var v=jQuery("#ac_"+h+"_"+o[0]);var C=f(s);var y=f(v);u.beginPath();u.moveTo(C[0],C[1]);u.lineTo(y[0],y[1]);u.lineWidth=3;u.stroke();var x=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+h).attr("value",v.data("qti-id")+" "+s.data("qti-id"));B.prepend(x)}})}function e(g,v,t){var o=g.attr("id");var x=jQuery("#"+o+"_container");var k=document.getElementById(o+"_canvas");var q=k.getContext("2d");q.clearRect(0,0,jQuery(k).width(),jQuery(k).height());var w=[];var h=v.split(",");for(var n=h.length;n-->0;){var m=h[n].split(" ");for(var l=m.length;l-->0;){if(0>w.indexOf(m[l])){b(q,"ac_"+t+"_"+m[l]);w.push(m[l])}}if(m.length==2){var p=jQuery("#ac_"+t+"_"+m[1]);var r=jQuery("#ac_"+t+"_"+m[0]);var y=f(p);var u=f(r);q.beginPath();q.moveTo(y[0],y[1]);q.lineTo(u[0],u[1]);q.lineWidth=3;q.stroke();var s=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+t).attr("value",r.data("qti-id")+" "+p.data("qti-id"));x.prepend(s)}}}function b(h,g){jQuery("#"+g).each(function(k,m){var l=jQuery(m);var n=f(l);var j=l.attr("shape");a(h,j,n,0,0)})}function a(j,g,k,h,l){h=h||0;l=l||0;j.beginPath();if(g=="rect"){j.rect(k[0]+h,k[1]+l,k[2]-k[0],k[3]-k[1])}else{if(g=="poly"){j.moveTo(k[0]+h,k[1]+l);for(i=2;i<k.length;i+=2){j.lineTo(k[i]+h,k[i+1]+l)}}else{if(g=="circ"||g=="circle"){j.arc(k[0]+h,k[1]+l,k[2]-2,0,Math.PI*2,false)}}}j.closePath();j.lineWidth=4;j.strokeStyle="#003300";j.stroke();j.fillStyle="green";j.fill()}function f(g){var h=g.attr("coords").split(",");for(i=h.length;i-->0;){h[i]=parseFloat(h[i])}return h}}(jQuery));(function(f){f.fn.graphicGapInteraction=function(j){var k=f.extend({maphilight:null,responseIdentifier:null,formDispatchFieldId:null,responseValue:null,opened:false},j);try{if(!(typeof k.responseValue==="undefined")&&k.responseValue.length>0){b(this,k)}if(k.opened){c(this,k)}}catch(l){if(window.console){console.log(l)}}return this};function b(j,m){var q=j.attr("id");var v=jQuery("#"+q);var l=m.responseValue.split(",");for(var n=l.length;n-->0;){var k=l[n].split(" ");var p=jQuery("#ac_"+m.responseIdentifier+"_"+k[0]);var o=jQuery("#ac_"+m.responseIdentifier+"_"+k[1]);var r,u;if(p.hasClass("gap_item")){r=p;u=o}else{r=o;u=p}var s=g(u);r.css("position","absolute");r.css("left",s[0]+"px");r.css("top",s[1]+"px");r.addClass("oo-choosed");var t=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+m.responseIdentifier).attr("value",r.data("qti-id")+" "+u.data("qti-id"));v.prepend(t)}}function c(l,k){var j=l.attr("id");jQuery(".gap_item").on("click",function(q,p){var o=jQuery(this);if(o.hasClass("oo-choosed")){var n=o.data("drop-timestamp");if(!(typeof n==="undefined")&&n!=null){if((Date.now()-n)<1500){o.data("drop-timestamp",null);return}}o.removeClass("oo-choosed");var m=o.data("qti-id");jQuery("#"+j).find("input[type='hidden']").each(function(r,s){var t=jQuery(s).val();if(t.indexOf(m+" ")==0){jQuery(s).remove()}});o.css({position:"relative",left:"0px",top:"0px"})}else{o.addClass("oo-selected")}}).draggable({containment:"#"+j,scroll:false,revert:"invalid",stop:function(m,n){if(!jQuery(this).hasClass("oo-choosed")){jQuery(this).css({position:"relative",left:"0px",top:"0px"})}}}).mousemove(function(m,s){var u=jQuery(this);if(u.hasClass("ui-draggable-dragging")){var q=jQuery("#"+j+"_img");var p=q.offset();var o=u.offset();var n=o.left+(u.width()/2)-p.left;var t=o.top+(u.height()/2)-p.top;var r=h(n,t,j);if("invalid"!=r){jQuery("#"+j+" area").each(function(v,x){var w=jQuery(x);var y=w.attr("id");if(r==y){w.mouseover()}else{w.mouseout()}});jQuery("#"+r).mouseover()}else{jQuery("#"+j+" area").each(function(v,w){jQuery(w).mouseout()})}}});jQuery("#"+j).droppable({drop:function(m,t){var r=jQuery("#"+j+"_img");var p=r.offset();var u=jQuery(t.draggable);var o=u.offset();var n=o.left+(u.width()/2)-p.left;var w=o.top+(u.height()/2)-p.top;var s=h(n,w,j);if("invalid"!=s){var z=jQuery("#"+s);var v=g(z);var x=z.data("qti-id");var q=u.data("qti-id");u.css("position","absolute");u.css("left",v[0]+"px");u.css("top",v[1]+"px");u.css("border","none");u.removeClass("oo-selected");u.addClass("oo-choosed");var y=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+k.responseIdentifier).attr("value",q+" "+x);jQuery(this).prepend(y);jQuery(z).mouseout();u.data("drop-timestamp",Date.now())}}});jQuery("#"+j+" area").on("click",function(o,n){var m=jQuery(this);jQuery(".gap_item.oo-selected").each(function(q,s){var r=jQuery(s);var t=g(m);var w=m.data("qti-id");var v=r.data("qti-id");r.css("position","absolute");r.css("left",t[0]+"px");r.css("top",t[1]+"px");r.css("border","none");r.removeClass("oo-selected");r.addClass("oo-choosed");var p=jQuery("#"+j);var u=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+k.responseIdentifier).attr("value",v+" "+w);p.prepend(u)})})}function h(l,k,j){var m="invalid";jQuery("#"+j+" area").each(function(r,o){var v=jQuery(o);var u=v.attr("id");var t=v.attr("coords");var s=v.attr("shape");var w=g(v);if("circle"==s){if(a(l,k,w[0],w[1],w[2])){m=u}}else{if("rect"==s){if(d(l,k,w[0],w[1],w[2],w[3])){m=u}}else{if("poly"==s){var n={};n.x=[];n.y=[];var q=w.length/2;var p=0;for(ix=0;ix<q;ix++){n.x[ix]=w[p];n.y[ix]=w[p+1];p+=2}for(i=0;i<n.length;i++){if(e(n.x.length,n.x,n.y,l,k)){m=n.id;break}}}}}});return m}function a(k,o,m,l,j){var n=Math.pow(k-m,2)+Math.pow(o-l,2);return Math.pow(j,2)>=n}function d(j,o,n,l,k,m){if((n<=j)&&(j<=k)&&(l<=o)&&(o<=m)){return true}else{return false}}function e(l,p,o,k,r){var n,m,q=false;for(n=0,m=l-1;n<l;m=n++){if(((o[n]>r)!=(o[m]>r))&&(k<(p[m]-p[n])*(r-o[n])/(o[m]-o[n])+p[n])){q=!q}}return q}function g(j){var k=j.attr("coords").split(",");for(i=k.length;i-->0;){k[i]=parseFloat(k[i])}return k}}(jQuery));(function(c){c.fn.graphicOrderInteraction=function(d){var f=c.extend({responseIdentifier:null,formDispatchFieldId:null,responseValue:null,maxChoices:1,opened:false},d);try{if(!(typeof f.responseValue==="undefined")&&f.responseValue.length>0){b(this,f)}if(f.opened){a(this,f)}}catch(g){if(window.console){console.log(g)}}return this};function b(d,h){var m=d.attr("id");var r=jQuery("#"+m+"_container");var e=document.getElementById(m+"_canvas");var o=e.getContext("2d");o.clearRect(0,0,jQuery(e).width(),jQuery(e).height());var n=h.responseValue.split(",");for(var k=n.length;k-->0;){if(n[k].length==0){continue}var q=jQuery("#ac_"+h.responseIdentifier+"_"+n[k]);var f=q.data("qti-id");var l=q.attr("coords").split(",");var j=l[0];var g=l[1];o.font="16px Arial";o.fillText(""+(k+1),j,g);var p=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+h.responseIdentifier).attr("value",f);r.prepend(p)}}function a(f,e){var d=f.attr("id");jQuery("#"+d+"_container area").on("click",function(v){var h=8;var x=jQuery(this).attr("id");var l=jQuery(this).data("qti-id");var u=jQuery(this).attr("coords").split(",");var o=u[0];var n=u[1];var t=jQuery("#"+d+"_container").data("openolat")||{};if(t.listOfPoints==undefined){t.listOfPoints=[];jQuery("#"+d+"_container").data("openolat",t)}var s=false;var m=[];for(var q=t.listOfPoints.length;q-->0;){var j=t.listOfPoints[q];var g=((j.x-o)*(j.x-o))+((j.y-n)*(j.y-n));if(h*h>g){s=true}else{m.push(j)}}if(s){t.listOfPoints=m}else{if(t.listOfPoints.length>=e.maxChoices){return false}else{t.listOfPoints.push({x:o,y:n,areaId:x,spotQtiId:l})}}var k=document.getElementById(d+"_canvas");var w=k.getContext("2d");w.clearRect(0,0,jQuery(k).width(),jQuery(k).height());var z=jQuery("#"+d+"_container");z.find("input[type='hidden']").remove();for(var q=t.listOfPoints.length;q-->0;){var j=t.listOfPoints[q];w.font="16px Arial";w.fillText(""+(q+1),j.x,j.y);var y=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+e.responseIdentifier).attr("value",j.spotQtiId);z.prepend(y)}})}}(jQuery));(function(c){c.fn.hotspotInteraction=function(f){var g=c.extend({responseIdentifier:null,formDispatchFieldId:null,maxChoices:1,singleChoice:false,responseValue:null,opened:false,maphilightSettings:{}},f);try{if(!(typeof g.responseValue==="undefined")&&g.responseValue.length>0){a(this,g)}if(g.opened){e(this,g)}}catch(h){if(window.console){console.log(h)}}return this};function a(f,g){var k=f.attr("id");var o=jQuery("#"+k);var l=g.responseValue.split(",");for(var j=l.length;j-->0;){var n=jQuery("#ac_"+g.responseIdentifier+"_"+l[j]);var h=n.data("maphilight")||{};h.selectedOn=true;b(h,g.maphilightSettings);n.data("maphilight",h).trigger("alwaysOn.maphilight");var m=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+g.responseIdentifier).attr("value",n.data("qti-id"));o.append(m)}}function e(h,g){var f=h.attr("id");jQuery("#"+f+" map area").each(function(i,j){jQuery(j).on("click",function(){d(this,f,g.responseIdentifier,g.maxChoices,g.singleChoice,g.maphilightSettings)})})}function d(k,i,n,j,p,l){var m=jQuery(k);var h=m.data("maphilight")||{};if((typeof h.selectedOn==="undefined")||!h.selectedOn){if(p){jQuery("area","map[name='"+i+"_map']").each(function(q,s){var r=jQuery(s).data("maphilight")||{};if(r.selectedOn){r.selectedOn=false;b(r,l);jQuery(s).data("maphilight",r).trigger("alwaysOn.maphilight")}})}var f=j;if(f>0){var g=0;jQuery("area","map[name='"+i+"_map']").each(function(q,s){var r=jQuery(s).data("maphilight")||{};if(r.selectedOn){g++}});if(g>=f){return false}}}if(typeof h.selectedOn==="undefined"){h.selectedOn=true}else{h.selectedOn=!h.selectedOn}b(h,l);m.data("maphilight",h).trigger("alwaysOn.maphilight");var o=jQuery("#"+i);o.find("input[type='hidden']").remove();jQuery("area","map[name='"+i+"_map']").each(function(q,s){var t=jQuery(s);var r=t.data("maphilight")||{};if(r.selectedOn){var u=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+n).attr("value",t.data("qti-id"));o.append(u)}})}function b(g,f){if(g.selectedOn){g.fillColor=f.selectedFillColor;g.fillOpacity=f.selectedFillOpacity;g.strokeColor=f.selectedStrokeColor;g.strokeOpacity=f.selectedStrokeOpacity;g.shadow=f.selectedShadow;g.shadowX=0;g.shadowY=0;g.shadowRadius=7;g.shadowColor="000000";g.shadowOpacity=0.8;g.shadowPosition="outside"}else{g.fillColor=f.fillColor;g.fillOpacity=f.fillOpacity;g.strokeColor=f.strokeColor;g.strokeOpacity=f.strokeOpacity;g.shadow=false}}}(jQuery));(function(a){a.fn.rwdImageMaps=function(d){var g=a.extend({fillColor:"bbbbbb",fillOpacity:0.5,strokeColor:"6E6E6E",strokeOpacity:1,},d);var f=this;var c=null;var e=0;var h=0;var b=function(){f.each(function(){if(typeof(a(this).attr("usemap"))=="undefined"){return}var j=function(n,m){a("<img />").on("load",function(){var q="width",y="height";if(!m.data(q)){m.data(q,m.attr(q))}if(!m.data(y)){m.data(y,m.attr(y))}var A=m.data(q),s=m.data(y);if(!A||!s){var B=new Image();B.src=m.attr("src");if(!A){A=B.width;m.data(q,s)}if(!s){s=B.height;m.data(y,s)}}var z=m.closest(".o_oo_hotcontainer").width();var t=m.width(),r=m.height();if(z<A){var v=s/A;t=z;r=((z*v)|0);m.width(t);m.height(r)}else{if(t==0&&r==0){t=A;r=s;m.width(t);m.height(r)}}var o=t/100,u=r/100,p=m.attr("usemap").replace("#",""),x="coords";a('map[name="'+p+'"]').find("area").each(function(){var E=a(this);if(!E.data(x)){E.data(x,E.attr(x))}var D=E.data(x).split(","),C=new Array(D.length);for(var w=0;w<C.length;++w){if(w%2===0){C[w]=parseInt(((D[w]/A)*100)*o)}else{C[w]=parseInt(((D[w]/s)*100)*u)}}E.attr(x,C.toString())});c=true;m.maphilight({fillColor:g.fillColor,fillOpacity:g.fillOpacity,strokeColor:g.strokeColor,strokeOpacity:g.strokeOpacity,strokeWidth:3,alwaysOn:true})}).attr("src",m.attr("src"))};var k=this,i=a(k);var l=i.closest(".o_oo_hotcontainer").width();if(c){if(e!=window.innerWidth||h!=l){j(k,i);e=window.innerWidth;h=l}}else{e=window.innerWidth;h=l;j(k,i)}})};a(window).resize(b).trigger("resize");a(f).closest(".o_qti21_collapsable_solution").on("shown.bs.collapse",b);return this}})(jQuery);(function(f){f.fn.matchInteraction=function(i){var k=f.extend({responseIdentifier:null,formDispatchFieldId:null,maxAssociations:1,unansweredColumn:null,leftData:{},rightData:{},leftMap:{},rightMap:{},matched:[]},i);for(var j in k.leftData){k.leftMap[j]={matchMax:k.leftData[j],matchCount:0}}for(var j in k.rightData){k.rightMap[j]={matchMax:k.rightData[j],matchCount:0}}try{d(this,k)}catch(l){if(window.console){console.log(l)}}return this};function d(j,i){e(i.responseIdentifier).on("click",function(){a(i,this)});c(i);h(i)}function e(i){return jQuery("input[name=qtiworks_response_"+i+"]")}function b(k,m,o){var n=m.value;var i=n.split(" ");var l=k.leftMap[i[0]];var j=k.rightMap[i[1]];o(m,n,l,j)}function c(j){j.matchCount=0;j.matched={};for(var i in j.leftMap){j.leftMap[i].matchCount=0}for(var i in j.rightMap){j.rightMap[i].matchCount=0}e(j.responseIdentifier).each(function(){b(j,this,function(m,n,l,k){if(m.checked){j.matchCount++;l.matchCount++;k.matchCount++;j.matched[n]=true}})})}function h(i){e(i.responseIdentifier).each(function(){b(i,this,function(l,m,k,j){if(l.checked){l.disabled=false}else{if(i.maxAssociations!=0&&i.matchCount>=i.maxAssociations){l.disabled=true}else{if(k.matchMax!=0&&k.matchCount>=k.matchMax){if(k.matchMax!=1&&k.matchCount!=1){l.disabled=true}else{l.disabled=false}}else{if(j.matchMax!=0&&j.matchCount>=j.matchMax){l.disabled=true}else{l.disabled=false}}}}})})}function a(i,j){b(i,j,function(q,r,p,n){if(q.checked){var m=false;if(p.matchMax==1){var o=jQuery(q);var l=o.attr("id");var k=o.attr("value").split(" ")[0];e(i.responseIdentifier).each(function(){b(i,this,function(t,x,w,s){var v=jQuery(t);if(l!==v.attr("id")&&t.checked){var u=v.attr("value").split(" ")[0];if(k===u){t.checked=false;w.matchCount--;i.matchCount--}}})});p.matchCount++;i.matchCount++;m=true}else{if(p.matchMax!=0&&p.matchMax<=p.matchCount){q.checked=false}else{p.matchCount++;i.matchCount++;m=true}}if(n.matchMax!=0&&n.matchMax<=n.matchCount){q.checked=false}else{n.matchCount++;if(!m){i.matchCount++}}}else{i.matchCount--;p.matchCount--;n.matchCount--}h(i);if(!q.checked&&i.unansweredColumn!=null){g(i,q)}})}function g(l,n){var m=jQuery(n);var j=m.attr("value").split(" ")[0];var k=0;var i=null;e(l.responseIdentifier).each(function(){b(l,this,function(p,t,s,o){var r=jQuery(p);var q=r.attr("value").split(" ")[0];if(j===q){if(p.checked){k++}else{if(r.closest("."+l.unansweredColumn).length==1){i=p}}}})});if(k==0&&i!=null){i.checked=true}}}(jQuery));(function(h){h.fn.matchInteractionDnd=function(m){var n=h.extend({responseIdentifier:null,formDispatchFieldId:null,maxAssociations:1,responseValue:null,opened:false},m);try{if(typeof n.responseValue!="undefined"&&n.responseValue.length>0){f(this,n)}if(n.opened){i(this,n)}}catch(o){if(window.console){console.log(o)}}return this};function f(m,o){var q=m.attr("id");var w=o.responseValue.split(",");var r=jQuery("#"+q);for(var p=0;p<w.length;p++){var n=w[p].split(" ");var t=n[0];var s=n[1];var v=jQuery("#"+q+" .o_match_dnd_sources li[data-qti-id='"+t+"']");if(g(v,q)){v=jQuery(v).clone()}var u=jQuery("#"+q+" .o_match_dnd_targets ul[data-qti-id='"+s+"']");jQuery(v).addClass("oo-choosed");jQuery(u).addClass("oo-choosed");jQuery(u).addClass("oo-filled").append(v)}l(q,o);if(o.unrestricted&&o.opened){addNewAssociationBoxAndEvents(q,o)}}function i(q,p){var n=q.attr("id");a(n,p);var o=jQuery("#"+n+" .o_match_dnd_source");e(o,n,p);var m=jQuery("#"+n+" .o_match_dnd_target");k(m,n,p)}function a(m,n){jQuery("#"+m+" .o_match_dnd_sources").droppable({tolerance:"pointer",over:function(o,p){jQuery(this).addClass("oo-accepted")},out:function(o,p){jQuery(this).removeClass("oo-accepted")},drop:function(s,t){var r=jQuery(this);r.removeClass("oo-accepted");var q=jQuery(t.draggable);var o=q.data("qti-id");var p=r.find("li[data-qti-id='"+o+"']");if(p.length>0){if(q.parents(".o_match_dnd_sources").length==0){q.remove()}}else{q.appendTo(r)}l(m,n);setFlexiFormDirty(n.formDispatchFieldId,false)}}).on("click",{formId:n.formDispatchFieldId},setFlexiFormDirtyByListener)}function e(n,m,o){n.on("click",function(r,q){var p=jQuery(this);if(!p.hasClass("oo-choosed")&&!p.hasClass("oo-selected")){jQuery("#"+m+" .o_match_dnd_sources .o_match_dnd_source").each(function(s,t){jQuery(t).removeClass("oo-selected")});p.addClass("oo-selected")}else{if(p.parents(".o_match_dnd_targets").length>0&&!p.hasClass("oo-dropped-mrk")){d(p,m);l(m,o);setFlexiFormDirty(o.formDispatchFieldId,false)}}}).draggable({containment:"#"+m,scroll:false,revert:"invalid",cursorAt:{left:5,top:5},start:function(p,q){jQuery(q.helper).removeClass("oo-dropped-mrk")},stop:function(p,q){jQuery(this).css({left:"0px",top:"0px","z-index":""});jQuery(q.helper).removeClass("oo-drag")},helper:function(){var q=jQuery(this);var r=q.parent(".o_match_dnd_target").length>0;if(!r&&g(this,m)){q.removeClass("oo-selected");var p=q.clone();jQuery(p).attr("id","n"+j()).data("qti-cloned","true").addClass("oo-drag").addClass("oo-drag-mrk").css("z-index",10).css("width",q.width()).css("height",q.height());return p}q.addClass("oo-drag").addClass("oo-drag-mrk").css("z-index",10);return q}}).on("click",{formId:o.formDispatchFieldId},setFlexiFormDirtyByListener)}function j(){function m(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return m()+m()+m()+m()+m()+m()+m()}function g(r,n){var q=jQuery(r);if(q.parents(".o_match_dnd_target").length>0){return false}var o=q.data("qti-match-max");var m=q.data("qti-id");var p=jQuery("#"+n+" .o_match_dnd_targets li[data-qti-id='"+m+"']").length;return(o==0||p+1<o)}function k(n,m,o){n.on("click",function(s,q){var r=this;var p=jQuery(r);var t=jQuery(".o_associate_item",this).length;if(t==0){jQuery("#"+m+" .o_match_dnd_sources .oo-selected").each(function(x,B){var y=jQuery(B);var w=y.data("qti-id");var v=jQuery(".o_match_dnd_source[data-qti-id='"+w+"']",r).length;var u=v==0;var A=jQuery(r).data("qti-match-max");if(A>0){var z=jQuery(".o_match_dnd_source",r).length;if(z>=A){u&=false}}if(u){if(g(B,m)){y.removeClass("oo-selected");y=y.clone();b(y,p,m);e(y,m,o)}else{b(y,p,m)}}})}l(m,o);setFlexiFormDirty(o.formDispatchFieldId,false)}).droppable({tolerance:"pointer",accept:function(q){var p=jQuery(q).data("qti-id");var r=jQuery(".o_match_dnd_source[data-qti-id='"+p+"']",this).length==0;if(r){var t=jQuery(this).data("qti-match-max");if(t>0){var s=jQuery(".o_match_dnd_source",this).length;if(s>=t){r=false}}}return r},over:function(p,q){jQuery(this).addClass("oo-accepted")},out:function(p,q){jQuery(this).removeClass("oo-accepted")},drop:function(t,u){var s=jQuery(this);s.removeClass("oo-accepted");var r=jQuery(u.draggable);var q=r.data("qti-id");var p=jQuery(".o_match_dnd_source[data-qti-id='"+q+"']",this).length;if(p>0){return}if(u.helper!=null&&jQuery(u.helper).data("qti-cloned")=="true"){r.removeClass("oo-selected").removeClass("oo-drag");r=r.clone();e(r,m,o);b(r,s,m)}else{r.removeClass("oo-selected").removeClass("oo-drag");b(r,s,m)}r.addClass("oo-dropped-mrk");setTimeout(function(){r.removeClass("oo-dropped-mrk")},100);l(m,o);setFlexiFormDirty(o.formDispatchFieldId,false)}}).on("click",{formId:o.formDispatchFieldId},setFlexiFormDirtyByListener)}function b(o,p,n){var m=p.find("ul.o_match_dnd_target_drop_zone");o.removeClass("oo-selected").css({width:"auto",left:"0px",top:"0px","z-index":""}).addClass("oo-choosed").appendTo(m);p.addClass("oo-filled")}function d(q,n){var p=jQuery(q);p.removeClass("oo-choosed");var m=p.data("qti-id");var o=jQuery("#"+n+" .o_match_dnd_sources li[data-qti-id='"+m+"']").length;if(o==0){p.css({width:"auto",left:"0px",top:"0px","z-index":""}).appendTo(jQuery("#"+n+" .o_match_dnd_sources"))}else{p.remove()}}function l(m,p){p.matchCount=0;p.matched={};for(var o in p.leftMap){p.leftMap[o].matchCount=0}for(var o in p.rightMap){p.rightMap[o].matchCount=0}var n=jQuery("#"+m);n.find("input[type='hidden']").remove();jQuery("#"+m+" .o_match_dnd_target_drop_zone").each(function(r,q){jQuery(q).find(".o_match_dnd_source").each(function(w,s){var u=jQuery(s).data("qti-id");var t=jQuery(q).data("qti-id");var v=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+p.responseIdentifier).attr("value",u+" "+t);n.prepend(v)})})}function c(m,n){withCheckbox(m,n,function(r,s,q,p){if(r.checked){var o=false;if(q.matchMax!=0&&q.matchMax<=q.matchCount){r.checked=false}else{q.matchCount++;m.matchCount++;o=true}if(p.matchMax!=0&&p.matchMax<=p.matchCount){r.checked=false}else{p.matchCount++;if(!o){m.matchCount++}}}else{m.matchCount--;q.matchCount--;p.matchCount--}updateDisabledStates(m)})}}(jQuery));(function(c){c.fn.orderInteraction=function(d){var f=c.extend({responseIdentifier:null,formDispatchFieldId:null,minChoices:null,maxChoices:null,responseValue:null,opened:false},d);try{if(typeof f.responseValue!="undefined"&&f.responseValue.length>0){b(f)}if(f.opened){a(this,f)}}catch(g){if(window.console){console.log(g)}}return this};function a(k,g){var d="#qtiworks_response_"+g.responseIdentifier;var i=jQuery(d+" div.source ul");var j=jQuery(d+" div.target ul");var h=jQuery(d+" div.source ul").get(0);var f=jQuery(d+" div.target ul").get(0);var e=dragula([h,f],{copy:function(l,m){return false},accepts:function(l,m){return m!==h}});e.on("drag",function(m,l){}).on("over",function(m,l,n){if(l===f){jQuery(l).addClass("oo-accepted")}}).on("drop",function(m,o,n,l){b(g);setFlexiFormDirty(g.formDispatchFieldId)}).on("dragend",function(l){jQuery(f).removeClass("oo-accepted")}).on("out",function(l){jQuery(f).removeClass("oo-accepted")})}function b(h){var d="#qtiworks_response_"+h.responseIdentifier;var i=jQuery(d+" div.source ul");var j=jQuery(d+" div.target ul");var e=jQuery(d+" div.target");var g=jQuery(d+" div.hiddenInputContainer");var f=j.children("li").length;if(h.minChoices!=null&&h.maxChoices!=null){if(f<h.minChoices||f>h.maxChoices){if(h.minChoices!=h.maxChoices){alert("You must select and order between "+h.minChoices+" and "+h.maxChoices+" items")}else{alert("You must select and order exactly "+h.minChoices+" item"+(minChoices>1?"s":""))}e.toggleClass("highlight",true);return false}else{e.toggleClass("highlight",false)}}var g=jQuery(d+" div.hiddenInputContainer");g.empty();j.children("li").each(function(l){var k=this.id.substring("qtiworks_response_".length);var m=jQuery('<input type="hidden">');m.attr("name","qtiworks_response_"+h.responseIdentifier);m.attr("value",k);g.append(m)})}}(jQuery));(function(b){b.fn.positionObjectStage=function(f){var g=b.extend({responseIdentifier:null,formDispatchFieldId:null,responseValue:null,maxChoices:1,opened:false},f);try{var d=this.attr("id");jQuery("#"+d+" .items_container .o_item.o_"+g.responseIdentifier).each(function(e,i){jQuery(i).attr("id","object-item-"+e)});if(!(typeof g.responseValue==="undefined")&&g.responseValue.length>0){c(this,g)}if(g.opened){a(this,g)}}catch(h){if(window.console){console.log(h)}}return this};function c(d,f){var k=d.attr("id");var r=jQuery("#"+k);var j=f.responseValue.split(":");var l=jQuery("#"+k+" .items_container .o_item.o_"+f.responseIdentifier);for(var h=j.length;h-->0;){var n=j[h].split(" ");var g=n[0];var e=n[1];var q=jQuery(l.get(h));q.css("position","absolute");q.css("top",e+"px");q.css("left",g+"px");var m=q.attr("id");var o="in-"+m+"-"+f.responseIdentifier;var p=jQuery('<input type="hidden"/>').attr("id",o).attr("name","qtiworks_response_"+f.responseIdentifier).attr("value",g+" "+e);r.prepend(p)}}function a(g,f){var d=g.attr("id");var e=jQuery("#"+d);jQuery("#"+d+" .items_container .o_item.o_"+f.responseIdentifier).draggable({containment:"#"+d,scroll:false,stop:function(h,p){var i=jQuery("#"+d+"_img");var k=jQuery(i).offset().top-jQuery(window).scrollTop();var n=jQuery(i).offset().left-jQuery(window).scrollLeft();var m=jQuery(this).offset().top-jQuery(window).scrollTop();var q=jQuery(this).offset().left-jQuery(window).scrollLeft();var l=Math.round((q-n));var j=Math.round((m-k));var o=jQuery(this).attr("id");var r="in-"+o+"-"+f.responseIdentifier;var s=e.find("#"+r);if(s.length==0){var t=jQuery('<input type="hidden"/>').attr("id",r).attr("name","qtiworks_response_"+f.responseIdentifier).attr("value",l+" "+j);e.prepend(t)}else{s.val(l+" "+j)}setFlexiFormDirty(f.formDispatchFieldId)}})}}(jQuery));(function(a){a.fn.selectPointInteraction=function(d){var f=a.extend({responseIdentifier:null,formDispatchFieldId:null,responseValue:null,maxChoices:1,opened:false},d);try{if(!(typeof f.responseValue==="undefined")&&f.responseValue.length>0){b(this,f)}if(f.opened){c(this,f)}}catch(g){if(window.console){console.log(g)}}return this};function b(d,h){var e=8;var j=d.attr("id");var q=jQuery("#"+j);var n=h.responseValue.split(":");var g=document.getElementById(j+"_canvas");var k=g.getContext("2d");k.clearRect(0,0,jQuery(g).width(),jQuery(g).height());for(i=n.length;i-->0;){if(n[i].length==0){continue}var f=n[i].split(" ");var m=f[0];var l=f[1];k.beginPath();k.arc(m,l,e,0,Math.PI*2,false);k.stroke();k.closePath();var o=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+h.responseIdentifier).attr("value",m+" "+l);q.append(o)}}function c(f,e){var d=f.attr("id");jQuery("#"+d+"_canvas").on("click",function(u,z){var h=8;var q=jQuery(this).offset().top-jQuery(window).scrollTop();var w=jQuery(this).offset().left-jQuery(window).scrollLeft();var n=Math.round((u.clientX-w));var m=Math.round((u.clientY-q));var s=jQuery("#"+d).data("openolat")||{};if(s.listOfPoints==undefined){s.listOfPoints=[];jQuery("#"+d).data("openolat",s)}var o=false;var l=[];for(i=s.listOfPoints.length;i-->0;){var j=s.listOfPoints[i];var g=((j.x-n)*(j.x-n))+((j.y-m)*(j.y-m));if(Math.pow(h,2)>g){o=true}else{l.push(j)}}if(o){s.listOfPoints=l}else{if(s.listOfPoints.length>=e.maxChoices){return false}else{s.listOfPoints.push({x:n,y:m})}}var k=document.getElementById(d+"_canvas");var v=k.getContext("2d");v.clearRect(0,0,jQuery(k).width(),jQuery(k).height());var y=jQuery("#"+d);y.find("input[type='hidden']").remove();for(i=s.listOfPoints.length;i-->0;){var j=s.listOfPoints[i];v.beginPath();v.arc(j.x,j.y,h,0,Math.PI*2,false);v.stroke();v.closePath();var x=jQuery('<input type="hidden"/>').attr("name","qtiworks_response_"+e.responseIdentifier).attr("value",j.x+" "+j.y);y.append(x)}setFlexiFormDirty(e.formDispatchFieldId)})}}(jQuery));(function(b){b.fn.sliderInteraction=function(c){var d=b.extend({responseIdentifier:null,formDispatchFieldId:null,responseValue:null,min:1,max:1,step:1,orientation:null,isReversed:false,isDiscrete:false,opened:false,initialValue:null},c);try{a(this,d)}catch(f){if(window.console){console.log(f)}}return this};function a(g,d){var e=jQuery("#qtiworks_id_slider_"+d.responseIdentifier);var f=jQuery('input[name="qtiworks_response_'+d.responseIdentifier+'"]');var c=f.get(0).value||d.min;e.slider({value:c,step:d.step,disabled:!d.opened,orientation:d.orientation,min:d.isReversed?-d.max:d.min,max:d.isReversed?-d.min:d.max,slide:function(h,j){var i=d.isReversed?-j.value:j.value;var l=jQuery("#qtiworks_id_slidervalue_"+d.responseIdentifier);var k=jQuery('input[name="qtiworks_response_'+d.responseIdentifier+'"]');k.get(0).value=i;l.text(i);e.slider("value",d.isReversed?-i:i);setFlexiFormDirty(d.formDispatchFieldId)}})}}(jQuery));
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment