/*********************************************************************** adr_customizations.js ************************************************************************ Only add in functions here that need to be changed. Do not add anything else. Do not copy this file to new framesets. concat(ancestor::section/[@webtemplate][1]/@webtemplate,'_figuretext figuretext') Needs to be added to the normal elearnign style ************************************************************************/ //Small changes for tobii since they don't use overlay Content.prototype.template_createDragDropQuiz = function() { var c = this; c.helper_showNormalElements();//Needed in case we go directly to this page after a start page //Prevent draggable text from being highlighted $('.lcDraggable').bind('mousedown', function(event) { event.preventDefault() }); //Create a scrollable section that includes the header $(".Quiz_Drag_Drop_Heading").appendTo($(".dragdrop_p_wrapper")); //Move all p elements into the editor created wrapper $(".Quiz_Drag_Drop_p").appendTo($(".dragdrop_p_wrapper")); //Fill with content c.helper_makeDraggable(); c.helper_makeDroppable(); c.helper_moveGraphics(); c.quiz_resizeDragDrop(); }; /*Created for a special version of dragable images... tobii doesn't put the img inside the graphic class here for some reason, it puts them next to it...*/ Content.prototype.helper_makeDraggable = function(){ var c = this; $(".lcDraggable").each(function(i,v){ if($(v).find("img").length > 0){ $(v).find("img").addClass("DragImg"); } $(v).draggable({ snap:false, containment: $("#at_main"), scroll: 'true', zIndex: 500, opacity: 0.7, handle:".DragDropText, .DragImg" }); }); } /*Change where section1 title is placed*/ Content.prototype.template_setSection1Title = function(title) { var c = this; var currTemplate = c.currentPageItem.template; if(currTemplate == "Start"){ $("#sectionTitles").hide(); } else { //Sets the courseTitle here too & creates links to both the first page in the chapter and the first page in the subchapter. var tempHTML = '' + c.currentPageItem.chaptername + ''; } else { tempHTML += ' title="'+c.currentPageItem.chaptername+'">' + c.currentPageItem.chaptername + ' | ' + c.currentPageItem.subchaptername + ''; } } else{ if(!c.currentPageItem.subchaptername.length){ tempHTML += ' title="'+c.currentPageItem.chaptername+'">' + c.currentPageItem.chaptername + ''; } else{ tempHTML += ' title="'+c.currentPageItem.chapNr + ". " + c.currentPageItem.chaptername + '">' + c.currentPageItem.chapNr + ". " + c.currentPageItem.chaptername + ' | ' + c.currentPageItem.subchaptername + ''; } } $("#sectionTitles").html(tempHTML); $("#sectionTitles").show(); } }; /*Change where course title is placed*/ Content.prototype.template_setCourseTitle = function() { var c = this; //sets what is seen at the top of the browser document.title = c.courseTitle; $("#upperTitle").text(c.courseTitle); }; Content.prototype.toggleMenu = function(){ //Get window height: var screenHeight = $('html').height(); var menuHeight = Math.floor(screenHeight*0.9); $('#toc_div').height(menuHeight); var c = this; if(c.menuState == 0){ //Show menu $(".TOCParent").css("z-index",80); $(".TOCParent").css("width",'20rem'); $("#at_menu_container").show("slow",function(e){ c.menuState = 1; $('html').click(function() { //Hide the menus if visible c.toggleMenu(); }); }); }else{ //Hide menu $("#at_menu_container").hide("slow",function(e){ $('html').unbind('click'); c.menuState = 0; }); } //We unbind this button as soon as it is clicked on. This prevents double clicks. //Now we rebind the button $("#menuBtn").click(function(e){ $("#menuBtn").unbind(); c.toggleMenu(); }); }; /*Change of width in dialog boxes for the fordjupnings*/ Content.prototype.createDialogues = function(fordjupning){ if(dialogsCreated){ //Prevents duplicate dialogs from being created return; } //Create a short link to the content object var c = this; var id; $(fordjupning).each(function(i,v){ id = $(this).attr("id"); //This code prevents anything in the box from being highlighted. Previously the first link would be highlighted (forcing the dialog to scroll down to it when opened), or the x button would be highlighted in an ugly blue color on default. This small line of code fixes that. $(this).prepend(''); //figure out the window width var winW = $(window).width(); //Save 80% of the width for the dialog width var winW = Math.floor(winW*(0.80)); //$(this).removeClass("Extra_Info_section"); $(this).detach().appendTo($("body")).hide(); $("#"+id).dialog({ autoOpen: false, width:winW, modal: true, position: { my: "center", at: "center"}, closeText: false, dialogClass: "clickoncloseoutside" }); //Handle iframes var listOfIframes = $(this).find("div.inlineframe"); if( $(listOfIframes).length){ c.createIframes(listOfIframes); } }); //Set the dialogs created variable to true (prevents dialogs from being created more than once) dialogsCreated = true; //Closes the dialog box if the user clicks outside it. $("body") .on("click", "div.ui-widget-overlay:visible", function() { $(".ui-dialog.clickoncloseoutside:visible").find(".ui-dialog-content").dialog("close"); }); } //ADR doesn't care if the user goes onwards without answering the question if this is an exercise. Content.prototype.quiz_noQuizResponse = function(isTest){ var c = this; if(isTest){ //If this is a test, force the user to respond alert(GENTEXT_QUIZ_ERR_NORESPONSE); } else { //If this isn't a test, just tell the user that they haven't responded yet alert(GENTEXT_QUIZ_ERR_NORESPONSE2); } } /*Change in what is shown in the TOC*/ /*Do not call this until after loadcontent!*/ Content.prototype.createTOC_div = function(){ var c = this; var curChapTitle =""; var curChapLink = ""; var curSubChapTitle =""; var curSubChapLink = ""; var courseTitle = ""; var chapterCounter = 0; var subChapterCounter = 0; var toc_html = '
'+chapterCounter+' | '+curChapTitle+' | |
'+ chapterCounter+'.'+subChapterCounter +' | '+ " " + curSubChapTitle+' | |
'+c.pageArray[i].pagetitle+' |