%PDF- %PDF-
| Direktori : /opt/bitnami/apps/moodle/htdocs/course__d9c9c01/format/tiles/amd/build/ |
| Current File : /opt/bitnami/apps/moodle/htdocs/course__d9c9c01/format/tiles/amd/build/course.min.js |
define ("format_tiles/course",["jquery","core/templates","core/ajax","format_tiles/browser_storage","core/notification","core/str","format_tiles/tile_fitter"],function(a,b,c,d,e,f,g){"use strict";var h=a("body"),i=a("body, html"),j,k,l=[],m,n,o=!1,p=!1,q=60,r=!1,s=0,t,u=!1,v,w=0,x={PAGE:"#page",TILE:".tile",TILEID:"#tile-",MOVEABLE_SECTION:".moveablesection",FILTER_BUTTON:".filterbutton",TILE_LOADING_ICON:".tile-loading-icon",TILE_LOADING_ICON_ID:"#loading-icon-",TILE_COLLAPSED:".tile-collapsed",TILE_CLICKABLE:".tile-clickable",TILES:"ul.tiles",ACTIVITY:".activity",SPACER:".spacer",SECTION_MOVEABLE:".moveablesection",SECTION_ID:"#section-",SECTION_TITLE:".sectiontitle",SECTION_MAIN:".section.main",SECTION_BUTTONS:"#sectionbuttons",CLOSE_SEC_BTN:".closesectionbtn",HIDE_SEC0_BTN:"#buttonhidesec0",SECTION_ZERO:"#section-0",MOODLE_VIDEO:".mediaplugin.mediaplugin_videojs",LAUNCH_STANDARD:"[data-action=\"launch-tiles-standard\"]",TOOLTIP:"[data-toggle=tooltip]",HEADER_BAR:["header.navbar","nav.fixed-top.navbar","#essentialnavbar.moodle-has-zindex","#navwrap","nav.navbar-fixed-top","#main-navbar"]},y={SELECTED:"selected",HEADER_OVERLAY:"header-overlay",OPEN:"open",CLOSED:"closed",LAUNCH_CM_MODAL:"launch-tiles-cm-modal",STATE_VISIBLE:"state-visible"},z={CLICK:"click",KEYDOWN:"keydown",SCROLL:"scroll"},A={DISPLAY:"display",Z_INDEX:"z-index",HEIGHT:"height",BG_COLOUR:"background-color"},B={ESCAPE:27,TAB:9,RETURN:13},C=function(a){if(n===void 0){return!1}else{if(!0===a){n.fadeIn(300)}else{n.fadeOut(300)}return!0}},D=function(b){var c=a(x.SECTION_ID+b);c.find("iframe").each(function(b,c){c=a(c);if(c.attr("src")){c.attr("data-src",c.attr("src"));c.attr("src","")}});var d=c.find(x.MOODLE_VIDEO);if(0<d.length){c.html("")}},E=function(b){a(x.MOVEABLE_SECTION).each(function(b,c){c=a(c);if(c.is(":visible")){D(c.attr("data-section"));c.slideUp().removeClass(y.STATE_VISIBLE)}});a(x.TILE).removeClass(y.SELECTED).css(A.Z_INDEX,"").css(A.BG_COLOUR,"");a(".section "+y.SELECTED).removeClass(y.SELECTED).css(A.Z_INDEX,"");m.fadeOut(300);C(!1);if(b!==void 0&&0!==b){a(x.TILEID+b).focus()}a(x.TILE_LOADING_ICON).fadeOut(300,function(){a(x.TILE_LOADING_ICON).html("")});p=!1;w=0},F=function(b,c){if(c){b.html(c);a(x.TILE_LOADING_ICON).fadeOut(300,function(){a(x.TILE_LOADING_ICON).html("")});if(b.attr("id")!==x.SECTION_ZERO){var e=b.find(x.ACTIVITY).not(x.SPACER);b.on(z.KEYDOWN,function(c){if(c.keyCode===B.ESCAPE){d.setLastVisitedSection(0);E(0);a(x.TILEID+b.attr("data-section")).focus()}});e.on(z.KEYDOWN,function(b){if(b.keyCode===B.RETURN){var c=a(b.currentTarget).find("a");if(c.hasClass(y.LAUNCH_CM_MODAL)){c.click()}else if(c.attr("href")!==void 0){window.location=c.attr("href")}}});if(!j){e.last().on(z.KEYDOWN,function(c){if(c.keyCode===B.TAB&&!c.shiftKey&&a(c.relatedTarget).closest(x.SECTION_MAIN).attr("id")!==b.attr("id")){setTimeout(function(){b.find(x.SECTION_TITLE).focus();i.animate({scrollTop:b.offset().top-q},"slow");b.find("#sectionbuttons").css("top","")},200)}});b.find(x.SECTION_TITLE).on(z.KEYDOWN,function(c){if(c.keyCode===B.TAB&&c.shiftKey&&a(c.relatedTarget).closest(x.SECTION_MAIN).attr("id")!==b.attr("id")){setTimeout(function(){e.last().focus()},200)}})}}if(!j){setTimeout(function(){try{var a=b.find(".togglecompletion, .completioncheckbox, .badge-info");if(0<a.length){a.tooltip()}}catch(a){require(["core/log"],function(b){b.debug(a)})}},500)}if(0!==b.find(x.MOODLE_VIDEO).length){require(["media_videojs/loader"],function(a){a.setUp()})}return!0}return!1},G=function(b,c){var d=function(){var d=a("#tileText-"+c).offset().top-q;if(d===a(window).scrollTop){d+=1}b.find(x.SECTION_TITLE).focus();h.on("scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove",function(){h.stop()});i.animate({scrollTop:d},"slow",function(){i.off("scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove",function(){i.stop()})});p=!0;w=c;b.find(x.ACTIVITY).first().focus();var e=b.find("iframe");if(0<e.length){e.each(function(b,c){c=a(c);if(""===c.attr("src")&&c.attr("data-src")!==void 0){c.attr("src",c.attr("data-src"))}});if(v){require(["format_tiles/completion"],function(a){setTimeout(function(){a.updateTileInformation()},1e3)})}}},e=function(){var c=b.find(x.SECTION_BUTTONS);a(window).on(z.SCROLL,function(){if(!o&&p){o=!0;c.fadeOut(300);setTimeout(function(){var d=a(window).scrollTop(),e=d-b.offset().top+50;if(0<e&&e<b.outerHeight()-100){e=d-b.offset().top+50;c.css("top",e);if("none"===m.css(A.DISPLAY)){m.fadeIn(300)}}else if(0>e){c.css("top",0)}if(d>b.offset().top+b.outerHeight()-50){if("block"===m.css(A.DISPLAY)){m.fadeOut(300);C(!1)}c.css("top",0)}else if(b.offset().top>d+a(window).outerHeight()){if("block"===m.css(A.DISPLAY)){m.fadeOut(300);C(!1)}c.css("top",0)}else if("none"===m.css(A.DISPLAY)){m.fadeIn(300)}c.fadeIn(300,function(){o=!1})},500)}});if(!o&&!p&&m.is(":visible")){m.fadeOut(300)}};b.addClass(y.STATE_VISIBLE);b.slideDown(350,function(){d();e()});w=c},H=function(b,c){var d=new a.Deferred,e=a(".moveablesection:visible"),f=0;if(0<e.length){f=e.attr("data-section");E()}var h=function(a){g.runReOrg(a).done(function(a){if(0!==f){G(e,f)}d.resolve(a)}).fail(function(a){if(0!==f){G(e,f)}d.reject(a)})};if(c){setTimeout(function(){g.resizeTilesDivWidth(t).done(function(){h(!1)},b)})}else{h(b)}return d.promise()},I=function(a,b,c){if(b){e.confirm(l.sectionerrortitle,l.sectionerrorstring,l.refresh,l.cancel,function(){window.location.reload()},null);c.html("")}else{F(c,"<p>"+l.noconnectionerror+"</p>");setTimeout(function(){G(c,a)},500)}require(["core/log"],function(a){a.debug(b)});throw new Error("Not successful retrieving tile content by AJAX for section "+a)},J=function(a,b){return c.call([{methodname:"format_tiles_get_single_section_page_html",args:{courseid:a,sectionid:b,setjsusedsession:!0}}])[0]},K=function(a,c,d,e){var f=0>e?0:255,h=0>e?-1*e:e,i=Math.round((f-a)*h)+a,j=Math.round((f-c)*h)+c,g=Math.round((f-d)*h)+d;return"rgb("+i+","+j+","+g+")"},L=function(b){m.fadeIn(300);s=parseInt(m.css(A.Z_INDEX));var c=a(x.TILEID+b);c.css(A.Z_INDEX,s+1);C(!0);a(x.SECTION_ID+b).css(A.Z_INDEX,s+1);if(c.css(A.BG_COLOUR)&&"rgba"===c.css(A.BG_COLOUR).substr(0,4)){var d=c.css(A.BG_COLOUR).replace("rgba(","").replace(")","").replace(" ","").split(",");c.css(A.BG_COLOUR,K(parseInt(d[0]),parseInt(d[1]),parseInt(d[2]),.95))}},M=function(b){var c=a(b.currentTarget);if("window-overlay"===c.attr("id")||c.attr("id")===y.HEADER_OVERLAY){c.hide();var d=a(document.elementFromPoint(b.clientX,b.clientY));c.show();if("window-overlay"===c.attr("id")){if(d.hasClass("filterbutton")||d.hasClass("list-group-item")){d.click()}else{var e=d.closest(x.TILE);if(e){e.click()}}}else{E(0);d.click()}}},N=function(){var b=a(x.HIDE_SEC0_BTN),c=a(x.SECTION_ZERO);if(d.storageEnabledLocal()){if(!0===d.getSecZeroCollapseStatus()){c.slideUp(0);b.addClass(y.CLOSED).removeClass(y.OPEN)}else{c.slideDown(300);b.addClass(y.OPEN).removeClass(y.CLOSED)}}else{b.addClass(y.OPEN).removeClass(y.CLOSED);c.slideDown(300)}},O=function(b,f,g,h){L(g);a(x.TILE).removeClass(y.SELECTED);f.addClass(y.SELECTED);w=g;a(x.MOVEABLE_SECTION).each(function(b,c){c=a(c);if(c.is(":visible")){D(c.attr("data-section"));c.slideUp(200).removeClass(y.STATE_VISIBLE)}});c.call([{methodname:"format_tiles_log_tile_click",args:{courseid:b,sectionid:g}}])[0].fail(e.exception);var i=a(x.SECTION_ID+g);if(0<i.find(x.ACTIVITY).length){G(i,g);if(d.getStoredContentAge(b,g)>h||!d.getStoredContentAge(b,g)){J(b,g).done(function(c){if(d.storageEnabledSession()){d.storeCourseContent(b,g,a(c.html).html())}})}}else{i.html(k);if(d.storageEnabledLocal()){var j=d.getStoredContentAge(b,g);if(j){F(i,d.getCourseContent(b,g));G(i,g)}if(!j||j>h){var l=a(x.TILE_LOADING_ICON_ID+g);if(l!==void 0){l.html(k).fadeIn(200)}else{l=a("<div>").html(k);i.html(l)}J(b,g).done(function(c){var e=a(c.html).html();F(i,e);G(i,g);if(d.storageEnabledSession()){d.storeCourseContent(b,g,e)}}).fail(function(a){I(g,a,i);E(g)})}}else{J(b,g).done(function(b){F(i,a(b.html).html());G(i,g)}).fail(function(a){I(g,a,i);E(g)})}}d.setLastVisitedSection(g)};return{init:function init(e,i,o,p,C,D,G,I,K,L,P,Q,R,S){t=e;j=p;r="1"===L;I=1===I;K="1"===K;v="1"===S;d.init(t,o,!1,C,G,K,P);a(document).ready(function(){var e=a("#page-content");if(0===e.length){e=a("#region-main")}if(0!==C){w=C}else{if(r&&d.storageEnabledLocal){w=d.getLastVisitedSection()}}if(0!==w){g.init(t,w,Q,!1)}else{a(x.TILEID+"1").focus();g.init(t,null,Q,!1)}var o=a(window).outerWidth();if(i){m=a("<div></div>").addClass("modal-backdrop fade in").hide().attr("id","window-overlay").appendTo(h);m.click(function(a){E(0);M(a)});e.on(z.CLICK,x.TILE_CLICKABLE,function(b){if(!i){return}b.preventDefault();a(window).off(z.SCROLL);a(x.TILE_LOADING_ICON).fadeOut(300,function(){a(x.TILE_LOADING_ICON).html()});var c=a(b.currentTarget).closest(x.TILE),e=parseInt(c.attr("data-section"));if(c.hasClass(y.SELECTED)){E(e);d.setLastVisitedSection(0)}else{O(t,c,e,D)}var f=a(x.SECTION_ID+(e+1));if(!j&&!R&&f.length&&0<e){setTimeout(function(){var b=d.getStoredContentAge(t,e+1);if(b){F(f,d.getCourseContent(t,e+1))}if(!b||b>D){J(t,e+1).done(function(b){F(f,a(b.html).html());if(d.storageEnabledSession()){d.storeCourseContent(t,e+1,a(b.html).html())}})}},2e3)}});a(window).on("resize",function(){if(u||o===a(window).outerWidth()){return}u=!0;setTimeout(function(){var b=!0,c=a(".moveablesection:visible");if(0!==c.length){var d=c.find(".mediaplugin iframe");if(0!==d.length){d.each(function(d,e){e=a(e);if(e.outerWidth()>c.outerWidth()){b=!1}})}}if(b){o=a(window).outerWidth();H(!0,Q)}u=!1},600)});var p=parseInt(m.css(A.Z_INDEX)),v=a(x.HEADER_BAR.find(function(b){return 0<a(b).length}));if(v!==void 0&&0!==v.length){v.css(A.Z_INDEX,p+2);if("navwrap"!==v.attr("id")){if(v.outerHeight()!==void 0){q=v.outerHeight();n=a("<div></div>").addClass(y.HEADER_OVERLAY).attr("id",y.HEADER_OVERLAY).css(A.DISPLAY,"none");n.insertAfter(x.PAGE).css(A.Z_INDEX,p+3).css(A.HEIGHT,q).click(function(a){E(0);M(a)})}else{require(["core/log"],function(a){a.debug("Failed to get navbar. Ensure theme's navbar selector is included in global HEADER_BAR")})}}}e.on(z.CLICK,x.CLOSE_SEC_BTN,function(b){E(a(b.currentTarget).attr("data-section"))});e.on(z.CLICK,x.LAUNCH_STANDARD,function(b){var c=a(b.currentTarget);if(c.attr("href")!==void 0){window.location=c.attr("href")}else if(c.find("a").attr("href")!==void 0){window.location=c.find("a").attr("href")}});N()}e.on(z.CLICK,x.HIDE_SEC0_BTN,function(b){var c=a(x.SECTION_ZERO);if("none"===c.css(A.DISPLAY)){c.slideDown(250);a(b.currentTarget).addClass(y.OPEN).removeClass(y.CLOSED);d.setSecZeroCollapseStatus("collapsed")}else{c.slideUp(250);a(b.currentTarget).addClass(y.CLOSED).removeClass(y.OPEN);d.setSecZeroCollapseStatus("expanded")}});if(I){require(["format_tiles/filter_buttons"],function(a){a.init(t,d.storageEnabledLocal)});if(i){e.on(z.CLICK,x.FILTER_BUTTON,function(){E(0);H(!0,!1)})}}a(".tiles_coursenav").removeClass("hidden");b.render("format_tiles/loading",{}).done(function(a){k=a});var G=[{key:"sectionerrortitle",component:"format_tiles"},{key:"sectionerrorstring",component:"format_tiles"},{key:"refresh"},{key:"cancel"},{key:"noconnectionerror",component:"format_tiles"},{key:"show"},{key:"hide"},{key:"other",component:"format_tiles"},{key:"blockedpopuptitle",component:"format_tiles"}];f.get_strings(G).done(function(a){a.forEach(function(b,c){if(b){l[G[c].key]=b}else{l[G[c].key]="Error.";require(["core/log"],function(b){b.debug("Format tiles get_strings error ".concat(c));b.debug(a)})}})}).fail(function(a){require(["core/log"],function(b){b.debug(a)})});if(j){e.on(z.CLICK,x.ACTIVITY+".video a",function(b){var d=a(b.currentTarget),e=d.closest(x.ACTIVITY).attr("data-url-secondary");if(e!==void 0){b.preventDefault();b.stopPropagation();var f=d.closest(x.ACTIVITY);c.call([{methodname:"format_tiles_log_mod_view",args:{courseid:t,cmid:f.attr("data-cmid")}}])[0].done(function(){require(["format_tiles/completion"],function(a){a.markAsAutoCompleteInUI(t,f)})});window.location=e}})}else{a(x.TILE).on(z.KEYDOWN,function(b){if(b.keyCode===B.RETURN){a(b.currentTarget).click()}});a("ul.tiles .tile").first().focus()}a(document).on("filter-content-updated",function(b,c){if(0<c.length){var d=a(c[0]);if(d.hasClass("moodle-dialogue")&&d.css("z-index")<s){d.css("z-index",s+1)}}})})}}});
//# sourceMappingURL=course.min.js.map