You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
865 B
1 line
865 B
2 years ago
|
define(["jquery","core/ajax"],function(a,b){var c=function(a,c,d,e){var f=[];for(var g in e)f.push({name:g,value:e[g]});return b.call([{methodname:"core_get_fragment",args:{component:a,callback:c,contextid:d,args:f}}])[0]};return{loadFragment:function(b,d,e,f){var g=a.Deferred();return c(b,d,e,f).then(function(b){var c=a(b.javascript),d="";c.each(function(b,c){c=a(c);var e=c.prop("tagName");if(e&&"script"==e.toLowerCase())if(c.attr("src")){var f=!1;a("script").each(function(b,d){return a(d).attr("src")==c.attr("src")&&(f=!0),!f}),f||(d+=" { ",d+=' node = document.createElement("script"); ',d+=' node.type = "text/javascript"; ',d+=' node.src = decodeURI("'+encodeURI(c.attr("src"))+'"); ',d+=' document.getElementsByTagName("head")[0].appendChild(node); ',d+=" } ")}else d+=" "+c.text()}),g.resolve(b.html,d)}).fail(function(a){g.reject(a)}),g.promise()}}});
|