Current Path : C:/xampp/htdocs/moodle/mod/lti/amd/build/ |
Current File : C:/xampp/htdocs/moodle/mod/lti/amd/build/cartridge_registration_form.min.js |
define ("mod_lti/cartridge_registration_form",["jquery","core/ajax","core/notification","mod_lti/tool_type","mod_lti/events","mod_lti/keys","core/str"],function(a,b,c,d,f,g,h){var i={CARTRIDGE_URL:"#cartridge-url",CONSUMER_KEY:"#registration-key",SHARED_SECRET:"#registration-secret",REGISTRATION_FORM:"#cartridge-registration-form",REGISTRATION_SUBMIT_BUTTON:"#cartridge-registration-submit",REGISTRATION_CANCEL_BUTTON:"#cartridge-registration-cancel"},j=function(){return a(i.REGISTRATION_FORM).attr("data-cartridge-url")},k=function(){return a(i.REGISTRATION_SUBMIT_BUTTON)},l=function(){return a(i.REGISTRATION_CANCEL_BUTTON)},m=function(){return a(i.CONSUMER_KEY).val()},n=function(){return a(i.SHARED_SECRET).val()},o=function(){k().addClass("loading")},p=function(){k().removeClass("loading")},q=function(){return k().hasClass("loading")},r=function(){if(q()){return!1}var b=j();if(""===b){return!1}o();var e=m(),g=n(),i=d.create({cartridgeurl:b,key:e,secret:g});i.done(function(){h.get_string("successfullycreatedtooltype","mod_lti").done(function(b){a(document).trigger(f.NEW_TOOL_TYPE);a(document).trigger(f.STOP_CARTRIDGE_REGISTRATION);a(document).trigger(f.REGISTRATION_FEEDBACK,{message:b})}).fail(c.exception)}).fail(function(){h.get_string("failedtocreatetooltype","mod_lti").done(function(b){a(document).trigger(f.NEW_TOOL_TYPE);a(document).trigger(f.STOP_CARTRIDGE_REGISTRATION);a(document).trigger(f.REGISTRATION_FEEDBACK,{message:b,error:!0})}).fail(c.exception)}).always(function(){p()});return i},s=function(){var b=a(i.REGISTRATION_FORM);b.submit(function(a){a.preventDefault();r()});var c=l();c.click(function(b){b.preventDefault();a(document).trigger(f.STOP_CARTRIDGE_REGISTRATION)});c.keypress(function(a){if(!a.metaKey&&!a.shiftKey&&!a.altKey&&!a.ctrlKey){if(a.keyCode==g.ENTER||a.keyCode==g.SPACE){a.preventDefault();c.click()}}})};return{init:function init(){s()}}}); //# sourceMappingURL=cartridge_registration_form.min.js.map