define("sharelink",["jquery"],function(e){return function(e){function n(s){if(a[s])return a[s].exports;var t=a[s]={i:s,l:!1,exports:{}};return e[s].call(t.exports,t,t.exports,n),t.l=!0,t.exports}var a={};return n.m=e,n.c=a,n.i=function(e){return e},n.d=function(e,a,s){n.o(e,a)||Object.defineProperty(e,a,{configurable:!1,enumerable:!0,get:s})},n.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(a,"a",a),a},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="/components/",n(n.s="./assets/js/sharelink.js")}({"./assets/js/sharelink.js":function(e,n,a){var s=a("./web/intranet/share/js/sharelink.js"),t=new s;e.exports=t},"./web/intranet/share/js/sharelink.js":function(e,n,a){var s,t;s=[a(0)],void 0!==(t=function(e){return function(){this.canonical_url="",this.Init=function(n){self=this,e("#shareButton").on("click",self.ShowModal),this.canonical_url=n},this.ShowModal=function(n){n.preventDefault(),self.canonical_url="";var a=e("#shareButton").data("canonical-url");void 0!==a&&(self.canonical_url=a);if(0!==e("#sharelink_modal_container").length){var s=window.location.toString();""!==self.canonical_url&&(s=self.canonical_url),e("#sharelink_message").val(s),self.GenerateMailto(),window.jQuery("#sharelink_modal").modal("show")}else{e(document.body).append('<div id="sharelink_modal_container"></div>'),e("#sharelink_modal_container").load("/share/link",function(n,a,s){if("success"===a){e("#sharelink_subject").val(document.title.toString());var t=window.location.toString();""!==self.canonical_url&&(t=self.canonical_url),e("#sharelink_message").val(t),self.GenerateMailto(),e("#sharelink_close").on("click",function(e){e.preventDefault(),window.jQuery("#sharelink_modal").modal("hide")}),e("#sharelink_subject").on("change",function(e){self.GenerateMailto()}),e("#sharelink_message").on("change",function(e){self.GenerateMailto()}),e("#sharelink_send_message").on("click",function(e){e.preventDefault();var n=self.GetMessageDataObj();if(!self.ValidateForm(n))return!1;self.SendNotification(n)}),window.jQuery("#sharelink_modal").modal("show")}else console.error(lmsg("common.file_upload.could_not_get_modal"))})}},this.SendNotification=function(n){e.post("/share/link/send",n,function(n,a,s){window.jQuery("#sharelink_modal").modal("hide"),e("#sharelink_send_to").empty(),"OK"===n.status?cla.showMessage(n.message,!1):cla.showMessage(n.message,!0)},"json").fail(function(e,n,a){cla.showMessage(e.message,!0)})},this.ValidateForm=function(n){var a=e("#sharelink_error");return a.hide(),null==n.send_to||n.send_to.length<1?(a.show(),!1):""!==n.subject&&""!==n.message||(a.show(),!1)},this.GenerateMailto=function(){var n=this.GetMessageDataObj(),a="mailto:?subject="+encodeURIComponent(n.subject)+"&body="+encodeURIComponent(n.message);e("#sharelink_mailto").prop("href",a)},this.GetMessageDataObj=function(){return{send_to:e("#sharelink_send_to").val(),subject:e("#sharelink_subject").val(),message:e("#sharelink_message").val()}}}}.apply(n,s))&&(e.exports=t)},0:function(n,a){n.exports=e}})});
//# sourceMappingURL=sharelink.js.map