Current Path : C:/xampp/htdocs/moodle/blocks/navigation/amd/build/ |
Current File : C:/xampp/htdocs/moodle/blocks/navigation/amd/build/ajax_response_renderer.min.js |
function _typeof(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){_typeof=function(a){return typeof a}}else{_typeof=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return _typeof(a)}define ("block_navigation/ajax_response_renderer",["jquery","core/templates","core/notification","core/url"],function(a,b,c,d){var f={ACTIVITY:40,RESOURCE:50};function e(g,h){var i=a("<ul></ul>");i.attr("role","group");i.attr("aria-hidden",!0);a.each(h,function(g,h){if("object"!==_typeof(h)){return}var j=a("<li></li>"),k=a("<p></p>"),l=h.id||h.key+"_tree_item",m=null,n=h.expandable||h.haschildren?!0:!1;k.addClass("tree_item");k.attr("id",l);k.attr("role","treeitem");k.attr("tabindex","-1");if(h.requiresajaxloading){k.attr("data-requires-ajax",!0);k.attr("data-node-id",h.id);k.attr("data-node-key",h.key);k.attr("data-node-type",h.type)}if(n){j.addClass("collapsed contains_branch");k.attr("aria-expanded",!1);k.addClass("branch")}var o=null;if(h.link){var p=a("<a title=\""+h.title+"\" href=\""+h.link+"\"></a>");o=p;p.append("<span class=\"item-content-wrap\">"+h.name+"</span>");if(h.hidden){p.addClass("dimmed")}k.append(p)}else{var q=a("<span></span>");o=q;q.append("<span class=\"item-content-wrap\">"+h.name+"</span>");if(h.hidden){q.addClass("dimmed")}k.append(q)}if(h.icon&&(!n||h.type===f.ACTIVITY||h.type===f.RESOURCE)){j.addClass("item_with_icon");k.addClass("hasicon");if(h.type===f.ACTIVITY||h.type===f.RESOURCE){m=a("<img/>");m.attr("alt",h.icon.alt);m.attr("title",h.icon.title);m.attr("src",d.imageUrl(h.icon.pix,h.icon.component));a.each(h.icon.classes,function(a,b){m.addClass(b)});o.prepend(m)}else{if("moodle"==h.icon.component){h.icon.component="core"}b.renderPix(h.icon.pix,h.icon.component,h.icon.title).then(function(a){o.prepend(a)}).catch(c.exception)}}j.append(k);i.append(j);if(h.children&&h.children.length){e(k,h.children)}else if(n&&!h.requiresajaxloading){j.removeClass("contains_branch");k.addClass("emptybranch")}});g.parent().append(i);var j=g.attr("id")+"_group";i.attr("id",j);g.attr("aria-owns",j);g.attr("role","treeitem")}return{render:function render(a,b){if(b.children&&b.children.length){e(a,b.children);var c=a.children("[role='treeitem']").first(),d=a.find("#"+c.attr("aria-owns"));c.attr("aria-expanded",!0);d.attr("aria-hidden",!1)}else{if(a.parent().hasClass("contains_branch")){a.parent().removeClass("contains_branch");a.addClass("emptybranch")}}}}}); //# sourceMappingURL=ajax_response_renderer.min.js.map