Your IP : 216.73.216.95


Current Path : /var/www/ljmtc/cbt/lib/form/amd/build/
Upload File :
Current File : /var/www/ljmtc/cbt/lib/form/amd/build/showadvanced.min.js

define ("core_form/showadvanced",["jquery","core/log","core/str","core/notification"],function(a,b,c,d){var f={FIELDSETCONTAINSADVANCED:"fieldset.containsadvancedelements",DIVFITEMADVANCED:"div.fitem.advanced",DIVADVANCEDSECTION:"div#form-advanced-div",DIVFCONTAINER:"div.fcontainer",MORELESSLINK:"fieldset.containsadvancedelements .moreless-toggler"},g={SHOW:"show",MORELESSACTIONS:"moreless-actions",MORELESSTOGGLER:"moreless-toggler",SHOWLESS:"moreless-less"},h={FITEM:"<div class=\"fitem\"></div>",FELEMENT:"<div class=\"felement\"></div>",ADVANCEDDIV:"<div id=\"form-advanced-div\"></div>"},i=0,j=function(b){this.id=b;var c=a(document.getElementById(b));this.enhanceForm(c)};j.prototype.id="";j.prototype.enhanceForm=function(b){var c=b.find(f.FIELDSETCONTAINSADVANCED);c.each(function(b,c){this.enhanceFieldset(a(c))}.bind(this));b.on("click",f.MORELESSLINK,this.switchState);b.on("keydown",f.MORELESSLINK,function(a){if(13==a.which||32==a.which){return this.switchState(a)}return!0}.bind(this));return this};j.prototype.generateId=function(a){var b=a.prop("id");if("undefined"==typeof b){b="showadvancedid-"+i++;a.prop("id",b)}return b};j.prototype.enhanceFieldset=function(e){var i=a("input[name=mform_showmore_"+e.prop("id")+"]");if(!i.length){b.debug("M.form.showadvanced::processFieldset was called on an fieldset without a status field: '"+e.prop("id")+"'");return this}c.get_strings([{key:"showmore",component:"core_form"},{key:"showless",component:"core_form"}]).then(function(b){var c=b[0],d=b[1],j=a("<a href=\"#\"></a>");j.addClass(g.MORELESSTOGGLER);if("0"===i.val()){j.html(c);j.attr("aria-expanded","false")}else{j.html(d);j.attr("aria-expanded","true");j.addClass(g.SHOWLESS);e.find(f.DIVFITEMADVANCED).addClass(g.SHOW)}var k=[];e.find(f.DIVFITEMADVANCED).each(function(b,c){k[k.length]=this.generateId(a(c))}.bind(this));j.attr("role","button");j.attr("aria-controls","form-advanced-div");var l=a(h.ADVANCEDDIV);e.find(f.DIVFITEMADVANCED).wrapAll(l);var m=a(h.FITEM);m.addClass(g.MORELESSACTIONS);var n=a(h.FELEMENT);n.append(j);m.append(n);e.find(f.DIVADVANCEDSECTION).before(m);return!0}.bind(this)).fail(d.exception);return this};j.prototype.switchState=function(b){b.preventDefault();c.get_strings([{key:"showmore",component:"core_form"},{key:"showless",component:"core_form"}]).then(function(c){var d=c[0],e=c[1],h=a(b.target).closest(f.FIELDSETCONTAINSADVANCED);h.find(f.DIVFITEMADVANCED).toggleClass(g.SHOW);var i=a("input[name=mform_showmore_"+h.prop("id")+"]");if("0"===i.val()){i.val(1);a(b.target).addClass(g.SHOWLESS);a(b.target).html(e);a(b.target).attr("aria-expanded","true")}else{i.val(0);a(b.target).removeClass(g.SHOWLESS);a(b.target).html(d);a(b.target).attr("aria-expanded","false")}return!0}).fail(d.exception);return this};return{init:function init(a){return new j(a)}}});
//# sourceMappingURL=showadvanced.min.js.map