Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

/**
 * unilabel type topicteaser
 *
 * @author      Andreas Grabs <info@grabs-edv.de>
 * @copyright   2022 onwards Grabs EDV {@link https://www.grabs-edv.de}
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
define("unilabeltype_topicteaser/content_loader",["jquery","core/fragment","core/templates","core/notification"],(function($,fragment,templates,notification){var ContentLoader=function(contentcontainerselector,fragmentcall,serviceparams,contextid){this.contentcontainerselector=contentcontainerselector,this.fragmentcall=fragmentcall,this.serviceparams=void 0===serviceparams?{}:serviceparams,this.contextid=contextid,this.isshown=!1};return ContentLoader.prototype.loadContent=function(){this._load()},ContentLoader.prototype.replaceContent=function(){this._load(!0)},ContentLoader.prototype._load=function(replace){var _this=this;$(_this.contentcontainerselector).html("");return $(_this.contentcontainerselector).prepend('<div class="text-center" id="myspinner"><i class="fa fa-spinner fa-2x fa-spin"></i></div>'),fragment.loadFragment("unilabeltype_topicteaser",_this.fragmentcall,_this.contextid,_this.serviceparams).then((function(html,js){replace?$(_this.contentcontainerselector).replaceWith(html):$(_this.contentcontainerselector).html(html),js&&templates.runTemplateJS(js),_this.isshown=!0,$("#myspinner").remove()})).fail(notification.exception)},ContentLoader.prototype.autoload=function(triggerselector,triggerevent){var _this=this;$(triggerselector).on(triggerevent,(function(){0==_this.isshown&&(_this.loadContent(),_this.isshown=!0)}))},{init:function(contentcontainerselector,fragmentcall,serviceparams,contextid,triggerselector,triggerevent){new ContentLoader(contentcontainerselector,fragmentcall,serviceparams,contextid).autoload(triggerselector,triggerevent)}}}));

//# sourceMappingURL=content_loader.min.js.map