Current Path : C:/xampp/htdocs/moodle/admin/tool/templatelibrary/amd/build/ |
Current File : C:/xampp/htdocs/moodle/admin/tool/templatelibrary/amd/build/display.min.js |
define ("tool_templatelibrary/display",["jquery","core/ajax","core/log","core/notification","core/templates","core/config","core/str"],function(a,b,c,d,e,f,g){var h=function(a,b){if(!a){return!1}var c="@template "+b,d=0,e=[];e=a.match(/{{!([\s\S]*?)}}/g);if(null!==e){for(d=0;d<e.length;d++){var f=e[d],g=f.indexOf(c);if(-1!==g){var h=g+c.length+1;f=f.substr(h,f.length-2-h);return f}}}return!1},i=function(b,f,i){g.get_string("templateselected","tool_templatelibrary",b).done(function(b){a("[data-region=\"displaytemplateheader\"]").text(b)}).fail(d.exception);var j=h(f,b);if(!1===j){j=h(i,b)}if(j){f=j}a("[data-region=\"displaytemplatesource\"]").text(f);var k=f.match(/Example context \(json\):([\s\S]*)/),l=!1;if(k){var m=k[1].trim();try{l=a.parseJSON(m)}catch(a){c.debug("Could not parse json example context for template.");c.debug(a)}}if(l){e.render(b,l).done(function(b,c){e.replaceNodeContents(a("[data-region=\"displaytemplateexample\"]"),b,c)}).fail(d.exception)}else{g.get_string("templatehasnoexample","tool_templatelibrary").done(function(b){a("[data-region=\"displaytemplateexample\"]").text(b)}).fail(d.exception)}},j=function(c){var e=c.split("/"),g=e.shift(),h=e.join("/"),j=b.call([{methodname:"core_output_load_template",args:{component:g,template:h,themename:f.theme,includecomments:!0}},{methodname:"tool_templatelibrary_load_canonical_template",args:{component:g,template:h}}],!0,!1);a.when.apply(a,j).done(function(a,b){i(c,a,b)}).fail(d.exception)};a("[data-region=\"list-templates\"]").on("click","[data-templatename]",function(b){var c=a(this).data("templatename");b.preventDefault();j(c)});return{}}); //# sourceMappingURL=display.min.js.map