"+s.join("")+""},e.prototype.catalog=function(e){var t=$(":header",e);if(t&&0==t.size())return!1;var n=null,i={pre:null,arr:[]},r=i;return t.each(function(e,t){var i=t.nodeName;if(n)if(n'+e+""},e.code=function(e,t,n){var i=e;if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?''+(n?e:f.default.escape(e,!0))+"\n'+(n?e:f.default.escape(e,!0))+"\n默认确认对话框内容.
"}),this},e.prototype.context=function(e){return this.aurelia=e,this},e}();e.default=new S}),define("init/index",["exports","./config","jquery","jquery.scrollto","timeago","lodash","hotkeys"],function(e,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){r.default.context(e).initGlobalVar().initAjax().initToastr().initMarked().initAnimateCss().initEmoji().initModaal()}Object.defineProperty(e,"__esModule",{value:!0}),e.configure=i;var r=n(t)}),define("resources/index",["exports"],function(e){"use strict";function t(e){e.globalResources(["resources/value-converters/vc-common","resources/binding-behaviors/bb-key","resources/attributes/attr-task","resources/attributes/attr-swipebox","resources/attributes/attr-pastable","resources/attributes/attr-autosize","resources/attributes/attr-dropzone","resources/attributes/attr-attr","resources/attributes/attr-c2c","resources/attributes/attr-dimmer","resources/attributes/attr-ui-dropdown","resources/attributes/attr-ui-dropdown-action","resources/attributes/attr-ui-dropdown-hover","resources/attributes/attr-ui-tab","resources/attributes/attr-ui-popup","resources/attributes/attr-ui-checkbox","resources/attributes/attr-tablesort","resources/attributes/attr-textcomplete","resources/attributes/attr-scrollbar","resources/attributes/attr-modaal","resources/elements/em-modal","resources/elements/em-dropdown","resources/elements/em-checkbox","resources/elements/em-confirm-modal","resources/elements/em-hotkeys-modal","resources/elements/em-chat-input","resources/elements/em-chat-top-menu","resources/elements/em-chat-sidebar-left","resources/elements/em-chat-content-item","resources/elements/em-chat-sidebar-right","resources/elements/em-chat-channel-create","resources/elements/em-chat-channel-join","resources/elements/em-chat-channel-edit","resources/elements/em-chat-channel-members-mgr","resources/elements/em-chat-channel-members-show","resources/elements/em-chat-channel-link-mgr","resources/elements/em-chat-system-link-mgr","resources/elements/em-chat-msg-popup","resources/elements/em-chat-member-popup","resources/elements/em-chat-attach","resources/elements/em-chat-schedule","resources/elements/em-chat-schedule-edit","resources/elements/em-chat-schedule-remind","resources/elements/em-chat-share","resources/elements/em-blog-write","resources/elements/em-blog-left-sidebar","resources/elements/em-blog-right-sidebar","resources/elements/em-blog-content","resources/elements/em-blog-top-menu","resources/elements/em-blog-share","resources/elements/em-blog-comment","resources/elements/em-blog-save","resources/elements/em-blog-space-create","resources/elements/em-blog-space-edit","resources/elements/em-blog-space-update","resources/elements/em-blog-history","resources/elements/em-blog-history-view","resources/elements/em-blog-history-diff","resources/elements/em-blog-comment-popup","resources/elements/em-blog-space-auth","resources/elements/em-user-avatar","resources/elements/em-user-edit","resources/elements/em-blog-comment-share"])}Object.defineProperty(e,"__esModule",{value:!0}),e.configure=t}),define("test/test-lifecycle",["exports","aurelia-framework","aurelia-event-aggregator"],function(e,t,n){"use strict";function i(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.TestLifeCycle=void 0;var o,s,l,c;e.TestLifeCycle=(c=l=function(){function e(t){r(this,e),i(this,"prop",s,this),this.eventAggregator=t,console.log("constructor")}return e.prototype.created=function(e){console.log("created")},e.prototype.bind=function(e){console.log("bind")},e.prototype.unbind=function(){console.log("unbind")},e.prototype.attached=function(){console.log("attached")},e.prototype.detached=function(){console.log("detached")},e.prototype.canActivate=function(e,t,n){console.log("canActivate")},e.prototype.activate=function(e,t,n){console.log("activate")},e.prototype.canDeactivate=function(){console.log("canDeactivate")},e.prototype.deactivate=function(){console.log("deactivate")},e}(),l.inject=[n.EventAggregator],o=c,s=a(o.prototype,"prop",[t.bindable],{enumerable:!0,initializer:function(){return null}}),o)}),define("user/user-login",["exports"],function(e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});e.UserLogin=function(){function e(){t(this,e),this.username="",this.password=""}return e.prototype.attached=function(){$(this.rememberMeRef).checkbox()},e.prototype.kdHandler=function(e){return 13===e.keyCode&&this.loginHandler(),!0},e.prototype.loginHandler=function(){var e=this,t=$(this.rememberMeRef).checkbox("is checked")?"on":"";return $.post("/admin/signin",{username:this.username,password:this.password,"remember-me":t}).done(function(){localStorage&&localStorage.setItem(nsCons.KEY_LOGIN_USERNAME,e.username);var t=utils.urlQuery("redirect");if(t)window.location=decodeURIComponent(t);else{var n=null;localStorage&&(n=localStorage.getItem(nsCons.KEY_REMEMBER_LAST_CHAT_TO)),n?window.location=wurl("path")+("#/chat/"+n):window.location=wurl("path")+("#/chat/@"+e.username)}}).fail(function(e,t,n){401==e.status?toastr.error("用户名密码不正确!"):0!=e.status&&toastr.error("网络连接错误!")}),!0},e}()}),define("user/user-pwd-reset",["exports"],function(e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});e.UserPwdReset=function(){function e(){t(this,e),this.mail="",this.pwd="",this.isReq=!1,this.token=utils.urlQuery("id")}return e.prototype.resetPwdHandler=function(){var e=this;return $(this.fm).form("is valid")?(this.isReq=!0,void http.fetch("/free/user/pwd/reset",{method:"post",body:json({mail:this.mail,baseUrl:utils.getBaseUrl(),path:wurl("path")})}).then(function(t){t.ok&&t.json().then(function(t){t.success?(toastr.success("重置密码邮件链接发送成功!"),_.delay(function(){window.location="/admin/login"},2e3)):(toastr.error(t.data,"重置密码邮件链接发送失败!"),e.isReq=!1)})})):void toastr.error("邮件地址输入不合法!")},e.prototype.newPwdHandler=function(){var e=this;return $(this.fm2).form("is valid")?(this.isReq=!0,void http.fetch("/free/user/pwd/new",{method:"post",body:json({token:this.token,pwd:this.pwd})}).then(function(t){t.ok&&t.json().then(function(t){t.success?(toastr.success("重置密码成功!"),_.delay(function(){window.location="/admin/login"},2e3)):(toastr.error(t.data,"重置密码失败!"),e.isReq=!1)})})):void toastr.error("新密码输入不合法!")},e.prototype.attached=function(){$(this.fm).form({on:"blur",inline:!0,fields:{mail:["empty","email"]}}),$(this.fm2).form({on:"blur",inline:!0,fields:{mail:["empty","minLength[8]"]}})},e}()}),define("user/user-register",["exports"],function(e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});e.ViewModel=function(){function e(){t(this,e),this.header="账户激活页面"}return e.prototype.activate=function(e,t,n){var i=this;e.id&&(this.token=e.id,this.isReq=!0,this.header="账户激活中,请稍后...!",http.fetch("/free/user/register/activate",{method:"post",body:json({ -token:this.token})}).then(function(e){e.ok&&(e.json().then(function(e){e.success?i.header="账户激活成功,请返回登录页面登录!":(i.header="账户激活失败!",toastr.error(e.data,"账户激活失败!"))}),i.isReq=!1)}))},e.prototype.attached=function(){$(this.fm).form({on:"blur",inline:!0,fields:{username:{identifier:"username",rules:[{type:"empty"},{type:"minLength[3]"},{type:"regExp",value:/^[a-z]+[a-z0-9\.\-_]*[a-z0-9]+$/,prompt:"小写字母数字.-_组合,字母开头,字母数字结尾"}]},pwd:{identifier:"pwd",rules:[{type:"empty"},{type:"minLength[8]"}]},name:{identifier:"name",rules:[{type:"empty"},{type:"maxLength[20]"}]},mail:{identifier:"mail",rules:[{type:"empty"},{type:"email"}]}}})},e.prototype.okHandler=function(){var e=this;return $(this.fm).form("is valid")?(this.isReq=!0,void http.fetch("/free/user/register",{method:"post",body:json({username:this.username,pwd:this.pwd,name:this.name,mail:this.mail,baseUrl:utils.getBaseUrl(),path:wurl("path")})}).then(function(t){t.ok&&t.json().then(function(t){t.success?(toastr.success("注册成功,请通过接收到的激活邮件激活账户!"),_.delay(function(){window.location="/admin/login"},2e3)):(toastr.error(t.data,"注册失败!"),e.isReq=!1)})})):void toastr.error("账户注册信息输入不合法!")},e}()}),define("resources/attributes/attr-attr",["exports","aurelia-framework","aurelia-dependency-injection"],function(e,t,n){"use strict";function i(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.AttrAttr=void 0;var o,s,l,c,d,u;e.AttrAttr=(o=(0,t.customAttribute)("attr"),s=(0,n.inject)(Element),o(l=s((c=function(){function e(t){r(this,e),i(this,"name",d,this),i(this,"value",u,this),this.element=t}return e.prototype.nameChanged=function(e){},e.prototype.valueChanged=function(e){this.value=e,e?$(this.element).attr(this.name,e):$(this.element).removeAttr(this.name)},e.prototype.bind=function(e){this.valueChanged(this.value)},e.prototype.unbind=function(){},e}(),d=a(c.prototype,"name",[t.bindable],{enumerable:!0,initializer:null}),u=a(c.prototype,"value",[t.bindable],{enumerable:!0,initializer:null}),l=c))||l)||l)}),define("resources/attributes/attr-autosize",["exports","aurelia-framework","aurelia-templating"],function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.AttrAutosize=void 0;var r,a,o;e.AttrAutosize=(r=(0,n.customAttribute)("autosize"),a=(0,t.inject)(Element),r(o=a(o=function(){function e(t){i(this,e),this.element=t}return e.prototype.valueChanged=function(e,t){autosize(this.element)},e.prototype.bind=function(e){this.valueChanged(this.value)},e.prototype.unbind=function(){autosize.destroy(this.elements)},e}())||o)||o)}),define("resources/attributes/attr-c2c",["exports","aurelia-framework","clipboard"],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.AttrC2cCustomAttribute=void 0;var a,o,s,l=i(n);e.AttrC2cCustomAttribute=(a=(0,t.customAttribute)("c2c"),o=(0,t.inject)(Element),a(s=o(s=function(){function e(t){r(this,e),this.element=t,this._init()}return e.prototype._init=function(){var e=this;$(this.element).append(''),this.clipboard=new l.default($(this.element).find("i.copy.icon")[0],{text:function(t){return e.value?e.value:$(e.element).text()}});var t=$(this.element).find("[data-tooltip]").hover(function(){},function(){$(this).attr("data-tooltip","复制到剪贴板!")});this.clipboard.on("success",function(e){t.attr("data-tooltip","复制成功!")}).on("error",function(e){t.attr("data-tooltip","复制失败!")}),$(this.element).hover(function(){(e.value||$(e.element).text())&&t.show()},function(){t.hide()})},e.prototype.unbind=function(){this.clipboard&&this.clipboard.destroy()},e}())||s)||s)}),define("resources/attributes/attr-dimmer",["exports","aurelia-dependency-injection","aurelia-templating"],function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.AttrDimmer=void 0;var r,a,o;e.AttrDimmer=(r=(0,n.customAttribute)("dimmer"),a=(0,t.inject)(Element),r(o=a(o=function(){function e(t){i(this,e),this.element=t,this.$dimmer=$('详情内容
\n详情内容
\n'+e.title+"吗?",onapprove:function(){$.post("/admin/channel/join",{id:e.id},function(t){t.success?(toastr.success("加入频道成功!"),e.joined=!0,ea.publish(nsCons.EVENT_CHAT_CHANNEL_JOINED,{channel:t.data})):toastr.error(t.data,"加入频道失败!")})}})},e.prototype.leaveHandler=function(e){this.confirmMd.show({content:'确定要离开频道'+e.title+"吗?",onapprove:function(){$.post("/admin/channel/leave",{id:e.id},function(t){t.success?(toastr.success("离开频道成功!"),e.joined=!1,ea.publish(nsCons.EVENT_CHAT_CHANNEL_LEAVED,{channel:t.data})):toastr.error(t.data,"离开频道失败!")})}})},e}(),s=r(o.prototype,"loginUser",[t.bindable],{enumerable:!0,initializer:null}),a=o))||a}),define("resources/elements/em-chat-channel-link-mgr",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),
-a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatChannelLinkMgr=void 0;var a,o,s,l;e.EmChatChannelLinkMgr=(0,t.containerless)((o=function(){function e(){i(this,e),n(this,"channel",s,this),n(this,"loginUser",l,this),this.links=[]}return e.prototype.channelChanged=function(e,t){var n=this;this.channel&&$.get("/admin/link/listBy",{channelId:this.channel.id},function(e){e.success?n.links=e.data:n.links=[]})},e.prototype.addHandler=function(){var e=this;$.post("/admin/link/create",{title:this.title,href:this.href,channelId:this.channel.id},function(t,n,i){t.success?(e.title="",e.href="",e.links.push(t.data),ea.publish(nsCons.EVENT_CHANNEL_LINKS_REFRESH,{})):toastr.error(t.data)})},e.prototype.delHandler=function(e){var t=this;$.post("/admin/link/delete",{id:e.id},function(n,i,r){n.success?(t.links=_.reject(t.links,{id:e.id}),ea.publish(nsCons.EVENT_CHANNEL_LINKS_REFRESH,{}),toastr.success("删除成功!")):toastr.error(n.data)})},e.prototype.editHandler=function(e){e.oldTitle=e.title,e.oldHref=e.href,e.isEditing=!0},e.prototype.updateHandler=function(e){$.post("/admin/link/update",{id:e.id,title:e.title,href:e.href},function(t,n,i){t.success?(e.isEditing=!1,ea.publish(nsCons.EVENT_CHANNEL_LINKS_REFRESH,{}),toastr.success("更新成功!")):toastr.error(t.data)})},e.prototype.showHandler=function(){this._reset()},e.prototype._reset=function(){},e.prototype.attached=function(){},e.prototype.show=function(){this.emModal.show({autoDimmer:!1})},e.prototype.approveHandler=function(e){},e}(),s=r(o.prototype,"channel",[t.bindable],{enumerable:!0,initializer:null}),l=r(o.prototype,"loginUser",[t.bindable],{enumerable:!0,initializer:null}),a=o))||a}),define("resources/elements/em-chat-channel-members-mgr",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatChannelMembersMgr=void 0;var a,o,s,l;e.EmChatChannelMembersMgr=(0,t.containerless)((o=function(){function e(){var t=this;i(this,e),n(this,"channel",s,this),n(this,"users",l,this),this.membersOpts={onAdd:function(e,n,i){t.emModal.showDimmer(),$.post("/admin/channel/addMember",{id:t.channel.id,members:e,baseUrl:utils.getBaseUrl(),path:wurl("path")},function(e,n,i){e.success?(toastr.success("添加成员成功!"),t.channel.members=e.data.members,ea.publish(nsCons.EVENT_CHAT_CHANNEL_MEMBER_ADD_OR_REMOVE,{type:"add",members:e.data.members})):toastr.error(e.data,"添加成员失败!")}).always(function(){t.emModal.hideDimmer()})},onLabelRemove:function(e){return t.channel.owner.username!=e&&(t.emModal.showDimmer(),void $.post("/admin/channel/removeMember",{id:t.channel.id,members:e,baseUrl:utils.getBaseUrl(),path:wurl("path")},function(e,n,i){e.success?(toastr.success("移除成员成功!"),t.channel.members=e.data.members,ea.publish(nsCons.EVENT_CHAT_CHANNEL_MEMBER_ADD_OR_REMOVE,{type:"remove",members:e.data.members})):toastr.error(e.data,"移除成员失败!")}).always(function(){t.emModal.hideDimmer()}))}}}return e.prototype.channelChanged=function(){var e=this;this.channel&&!function(){var t=_.sortBy(_.map(e.channel.members,"username"));_.defer(function(){$(e.membersRef).dropdown().dropdown("clear").dropdown("set selected",t).dropdown(e.membersOpts)})}()},e.prototype.attached=function(){},e.prototype.initMembersUI=function(e){var t=this;e&&_.defer(function(){t.channelChanged()})},e.prototype.showHandler=function(){$(this.membersRef).dropdown().dropdown("clear"),this.channelChanged()},e.prototype.approveHandler=function(e){},e.prototype.show=function(){this.emModal.show({hideOnApprove:!0,autoDimmer:!1})},e}(),s=r(o.prototype,"channel",[t.bindable],{enumerable:!0,initializer:null}),l=r(o.prototype,"users",[t.bindable],{enumerable:!0,initializer:null}),a=o))||a}),define("resources/elements/em-chat-channel-members-show",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatChannelMembersShow=void 0;var a,o,s;e.EmChatChannelMembersShow=(0,t.containerless)((o=function(){function e(){i(this,e),n(this,"channel",s,this)}return e.prototype.showHandler=function(){},e.prototype.approveHandler=function(e){},e.prototype.show=function(){this.emModal.show({hideOnApprove:!0,autoDimmer:!1})},e}(),s=r(o.prototype,"channel",[t.bindable],{enumerable:!0,initializer:null}),a=o))||a}),define("resources/elements/em-chat-content-item",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatContentItem=void 0;var a,o,s,l,c,d,u,m,p;e.EmChatContentItem=(a=(0,t.bindable)({defaultBindingMode:t.bindingMode.twoWay}),(0,t.containerless)((s=function(){function e(){var t=this;i(this,e),n(this,"chats",l,this),n(this,"loginUser",c,this),n(this,"isAt",d,this),n(this,"channel",u,this),n(this,"markId",m,this),n(this,"chatTo",p,this),this.members=[],this.basePath=utils.getBasePath(),this.subscribe=ea.subscribe(nsCons.EVENT_CHAT_CHANNEL_MEMBER_ADD_OR_REMOVE,function(e){t.members=[nsCtx.memberAll].concat(e.members)})}return e.prototype.unbind=function(){this.subscribe.dispose()},e.prototype.attached=function(){var e=this;$(".tms-chat-direct").on("click",".markdown-body .at-user",function(e){e.preventDefault(),ea.publish(nsCons.EVENT_CHAT_MSG_INSERT,{content:"{~"+$(e.currentTarget).attr("data-value")+"} "})}),$(".tms-chat-direct").on("mouseenter",'.markdown-body a[href*="#/chat/"]:not(.pp-not)',function(e){e.preventDefault();var t=$(e.currentTarget);ea.publish(nsCons.EVENT_CHAT_MSG_POPUP_SHOW,{id:utils.urlQuery("id",t.attr("href")),target:e.currentTarget})}),$(".tms-chat-direct").on("mouseenter",".tms-content-body .em-chat-content-item",function(e){e.preventDefault();var t=$(e.currentTarget);ea.publish(nsCons.EVENT_CHAT_MSG_WIKI_DIR,{dir:utils.dir(t.find("> .content > .markdown-body"))})}),$(".tms-chat-direct").on("click",".panel-wiki-dir .wiki-dir-item",function(e){e.preventDefault(),ea.publish(nsCons.EVENT_CHAT_CONTENT_SCROLL_TO,{target:$("#"+$(e.currentTarget).attr("data-id"))})}),$(".tms-chat-direct").on("mouseenter","span[data-value].at-user:not(.pp-not),a[data-value].author:not(.pp-not)",function(t){t.preventDefault();var n=$(t.currentTarget);ea.publish(nsCons.EVENT_CHAT_MEMBER_POPUP_SHOW,{channel:e.channel,username:n.attr("data-value"),target:t.currentTarget})}),this.initHotkeys()},e.prototype.channelChanged=function(){this.channel?this.members=[nsCtx.memberAll].concat(this.channel.members):this.members=[]},e.prototype.deleteHandler=function(e){var t=this;this.emConfirmModal.show({onapprove:function(){var n=void 0;n=t.isAt?"/admin/chat/direct/delete":"/admin/chat/channel/delete",$.post(n,{id:e.id},function(n,i,r){n.success?(t.chats=_.reject(t.chats,{id:e.id}),toastr.success("删除消息成功!")):toastr.error(n.data,"删除消息失败!")})}})},e.prototype.initHotkeys=function(){var e=this;$(document).bind("keydown","e",function(t){t.preventDefault();var n=_.findLast(e.chats,function(t){return t.creator.username==e.loginUser.username});n&&e.editHandler(n,$('.em-chat-content-item[data-id="'+n.id+'"]').find("> .content > textarea"))})},e.prototype.editHandler=function(e,t){$.get("/admin/chat/"+(this.isAt?"direct":"channel")+"/get",{id:e.id},function(n){n.success?(e.version!=n.data.version&&_.extend(e,n.data),e.isEditing=!0,e.contentOld=e.content,_.defer(function(){$(t).focus().select(),autosize.update(t)})):toastr.error(n.data)})},e.prototype.editOkHandler=function(e,t,n){this.editSave(t,n),t.isEditing=!1},e.prototype.editCancelHandler=function(e,t,n){t.content=t.contentOld,$(n).val(t.content),t.isEditing=!1},e.prototype.editSave=function(e,t){var n=this;this.sending=!0,e.content=$(t).val();var i=(utils.md2html(e.content),utils.md2html(e.contentOld),void 0),r=void 0;this.isAt?(i="/admin/chat/direct/update",r={baseUrl:utils.getBaseUrl(),path:wurl("path"),id:e.id,content:e.content,diff:utils.diffS(e.contentOld,e.content)}):(i="/admin/chat/channel/update",r={url:utils.getUrl(),id:e.id,version:e.version,usernames:utils.parseUsernames(e.content,this.members).join(","),content:e.content,diff:utils.diffS(e.contentOld,e.content)}),$.post(i,r,function(t,n,i){t.success?(toastr.success("更新消息成功!"),e.isEditing=!1,e.version=t.data.version):toastr.error(t.data,"更新消息失败!")}).always(function(){n.sending=!1})},e.prototype.eidtKeydownHandler=function(e,t,n){return!this.sending&&(e.ctrlKey&&13===e.keyCode?(this.editSave(t,n),!1):e.ctrlKey&&85===e.keyCode?($(n).next(".tms-edit-actions").find(".upload").click(),!1):(27===e.keyCode&&this.editCancelHandler(e,t,n),!0))},e.prototype.notifyRendered=function(e,t){e&&_.defer(function(){ea.publish(nsCons.EVENT_CHAT_LAST_ITEM_RENDERED,{item:t})})},e.prototype.stowHandler=function(e){$.post("/admin/chat/channel/stow",{id:e.id},function(e,t,n){e.success?toastr.success("收藏消息成功!"):toastr.error(e.data,"收藏消息失败!")})},e.prototype.openEditHandler=function(e){$.post("/admin/chat/channel/openEdit",{id:e.id,open:!e.openEdit},function(t,n,i){t.success?(e.openEdit=!e.openEdit,toastr.success((e.openEdit?"开启":"关闭")+"协作编辑成功!")):toastr.success((e.openEdit?"关闭":"开启")+"协作编辑失败!")})},e.prototype.replyHandler=function(e){ea.publish(nsCons.EVENT_CHAT_MSG_INSERT,{content:"[[回复#"+e.id+"]("+utils.getUrl()+"?id="+e.id+"){~"+e.creator.username+"}]\n\n"}),$.post("/admin/chat/channel/markAsReadedByChat",{chatId:e.id})},e.prototype.creatorNameHandler=function(e){ea.publish(nsCons.EVENT_CHAT_MSG_INSERT,{content:"{~"+e.creator.username+"} "})},e.prototype.refreshHandler=function(e){$.get("/admin/chat/channel/get",{id:e.id},function(t){e.version!=t.data.version?(_.extend(e,t.data),toastr.success("刷新同步成功!")):toastr.info("消息内容暂无变更!")})},e.prototype.likeHandler=function(e,t){t&&e.isZanVoted||!t&&e.isCaiVoted||$.post("/admin/chat/channel/vote",{id:e.id,url:utils.getUrl(),contentHtml:utils.md2html(e.content),type:t?"Zan":"Cai"},function(n,i,r){n.success?(_.extend(e,n.data),t?e.isZanVoted=!0:e.isCaiVoted=!0):toastr.error(n.data)})},e}(),l=r(s.prototype,"chats",[a],{enumerable:!0,initializer:null}),c=r(s.prototype,"loginUser",[t.bindable],{enumerable:!0,initializer:null}),d=r(s.prototype,"isAt",[t.bindable],{enumerable:!0,initializer:null}),u=r(s.prototype,"channel",[t.bindable],{enumerable:!0,initializer:null}),m=r(s.prototype,"markId",[t.bindable],{enumerable:!0,initializer:null}),p=r(s.prototype,"chatTo",[t.bindable],{enumerable:!0,initializer:null}),o=s))||o)}),define("resources/elements/em-chat-input",["exports","aurelia-framework","common/common-tips","common/common-emoji","simplemde","textcomplete"],function(e,t,n,i,r){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatInput=void 0;var c,d,u,m,p,g=a(n),h=a(i),b=a(r);e.EmChatInput=(0,t.containerless)((d=function(){function e(){var t=this;s(this,e),o(this,"chatTo",u,this),o(this,"isAt",m,this),o(this,"channel",p,this),this.members=[],this.isMobile=utils.isMobile(),this.subscribe=ea.subscribe(nsCons.EVENT_SHOW_HOTKEYS_MODAL,function(e){t.emHotkeysModal.show()}),this.subscribe1=ea.subscribe(nsCons.EVENT_CHAT_CHANNEL_MEMBER_ADD_OR_REMOVE,function(e){t.members=[nsCtx.memberAll].concat(e.members)}),this.subscribe2=ea.subscribe(nsCons.EVENT_CHAT_MSG_INSERT,function(e){t.insertContent(e.content)})}return e.prototype.channelChanged=function(){this.channel?this.members=[nsCtx.memberAll].concat(this.channel.members):this.members=[]},e.prototype.unbind=function(){this.subscribe.dispose(),this.subscribe1.dispose(),this.subscribe2.dispose()},e.prototype.initHotkeys=function(){var e=this;$(document).bind("keydown","r",function(){event.preventDefault(),e.simplemde.codemirror.focus()})},e.prototype.attached=function(){this.initSimpleMDE(this.chatInputRef),this.initDropzone(),this.initPaste(),this.initHotkeys()},e.prototype.initPaste=function(){var e=this,t=void 0;t=this.$chatMsgInputRef.is("textarea")?$(this.$chatMsgInputRef).pastableTextarea():$(this.$chatMsgInputRef).pastableContenteditable(),t&&t.on("pasteImage",function(t,n){$.post("/admin/file/base64",{dataURL:n.dataURL,type:n.blob.type,toType:nsCtx.isAt?"User":"Channel",toId:nsCtx.chatTo},function(t,n,i){t.success&&e.insertContent("".replace(/\{name\}/g,t.data.name).replace(/\{baseURL\}/g,utils.getBaseUrl()+"/").replace(/\{path\}/g,t.data.path).replace(/\{uuidName\}/g,t.data.uuidName))})}).on("pasteImageError",function(e,t){toastr.error(t.message,"剪贴板粘贴图片错误!")})},e.prototype.initDropzone=function(){var e=this;this.initUploadDropzone($(".CodeMirror-wrap",this.inputRef),function(){return e.$chatMsgInputRef},!1),this.initUploadDropzone($(this.btnItemUploadRef).children().andSelf(),function(){return e.$chatMsgInputRef},!0),$(this.chatBtnRef).popup({inline:!0,hoverable:!0,position:"bottom left",delay:{show:300,hide:300}})},e.prototype.initUploadDropzone=function(e,t,n){var i=this;$(e).dropzone({url:"/admin/file/upload",paramName:"file",clickable:!!n,dictDefaultMessage:"",maxFilesize:10,addRemoveLinks:!0,previewsContainer:this.chatStatusBarRef,previewTemplate:this.previewTemplateRef.innerHTML,dictCancelUpload:"取消上传",dictCancelUploadConfirmation:"确定要取消上传吗?",dictFileTooBig:"文件过大({{filesize}}M),最大限制:{{maxFilesize}}M",init:function(){this.on("sending",function(e,n,i){t()?(i.append("toType",nsCtx.isAt?"User":"Channel"),i.append("toId",nsCtx.chatTo)):this.removeAllFiles(!0)}),this.on("success",function(e,t){t.success?($.each(t.data,function(e,t){"Image"==t.type?i.insertContent(" ".replace(/\{name\}/g,t.name).replace(/\{baseURL\}/g,utils.getBaseUrl()+"/").replace(/\{path\}/g,t.path).replace(/\{uuidName\}/g,t.uuidName)):i.insertContent("[{name}]({baseURL}{path}{uuidName}) ".replace(/\{name\}/g,t.name).replace(/\{baseURL\}/g,utils.getBaseUrl()+"/").replace(/\{path\}/g,"admin/file/download/").replace(/\{uuidName\}/g,t.id))}),toastr.success("上传成功!")):toastr.error(t.data,"上传失败!")}),this.on("error",function(e,t,n){toastr.error(t,"上传失败!")}),this.on("complete",function(e){this.removeFile(e)})}})},e.prototype.initSimpleMDE=function(e){var t=this;this.simplemde=new b.default({element:e,spellChecker:!1,status:!1,autofocus:!0,toolbar:!1,autoDownloadFontAwesome:!1,insertTexts:{table:["","\n\n| 列1 | 列2 | 列3 |\n| ------ | ------ | ------ |\n| 文本 | 文本 | 文本 |\n\n"]},previewRender:function(e,n){return t.simplemde.markdown(utils.preParse(e))}}),this.$chatMsgInputRef=$(this.inputRef).find(".textareaWrapper .CodeMirror textarea"),0===this.$chatMsgInputRef.size()&&(this.$chatMsgInputRef=$(this.inputRef).find('.textareaWrapper .CodeMirror [contenteditable="true"]')),this.initTextcomplete()},e.prototype.initTextcomplete=function(){var e=this;$(this.$chatMsgInputRef).textcomplete([{match:/(|\b)(\/.*)$/,search:function(e,t){var n=_.keys(g.default);t($.map(n,function(t){return 0===t.indexOf(e)?t:null}))},template:function(e,t){return g.default[e].label},replace:function(t){return e.tipsActionHandler(t)?(e.setCaretPosition(g.default[t].line,g.default[t].ch),"$1"+g.default[t].value):""}},{match:/(^|\s)@(\w*)$/,search:function(t,n){n($.map(e.members,function(e){return e.enabled&&e.username.indexOf(t)>=0?e.username:null}))},template:function(t,n){var i=_.find(e.members,{username:t});return i.name+" - "+i.mails+" ("+i.username+")"},replace:function(e){return"$1{~"+e+"}"}},{match:/(^|\s):([\+\-\w]*)$/,search:function(e,t){t($.map(h.default,function(t){return _.some(t.split("_"),function(t){return 0===t.indexOf(e)})?t:null}))},template:function(e,t){if("search"==e)return"表情查找 - :search";var n=":"+e+":";return emojify.replace(n)+" - "+n},replace:function(t){return e.tipsActionHandler(t)?"$1:"+t+": ":""}}],{appendTo:".tms-chat-status-bar",maxCount:nsCons.NUM_TEXT_COMPLETE_MAX_COUNT}),this.simplemde.codemirror.on("keydown",function(t,n){_.includes([13,38,40],n.keyCode)&&e.isTipsShow()?n.preventDefault():n.ctrlKey&&13===n.keyCode?e.sendChatMsg():27===n.keyCode?e.simplemde.value(""):n.ctrlKey&&85==n.keyCode?$(e.btnItemUploadRef).find(".content").click():n.ctrlKey&&191==n.keyCode&&e.emHotkeysModal.show()})},e.prototype.setCaretPosition=function(e,t){var n=this;(e||t)&&_.delay(function(){var i=n.simplemde.codemirror.getCursor();n.simplemde.codemirror.setCursor({line:i.line-(e?e:0),ch:i.line?t?t:0:i.ch-(t?t:0)})},100)},e.prototype.sendChatMsg=function(){var e=this,t=this.simplemde.value();if(!$.trim(t))return void this.simplemde.value("");if(!this.sending){this.sending=!0;var n=utils.md2html(t),i=void 0,r=void 0;this.isAt?(i="/admin/chat/direct/create",r={baseUrl:utils.getBaseUrl(),path:wurl("path"),chatTo:this.chatTo,content:t,contentHtml:n}):(i="/admin/chat/channel/create",r={url:utils.getUrl(),channelId:this.channel.id,usernames:utils.parseUsernames(t,this.members).join(","),content:t,contentHtml:n}),$.post(i,r,function(t,n,i){t.success?(e.simplemde.value(""),ea.publish(nsCons.EVENT_CHAT_MSG_SENDED,{data:t})):toastr.error(t.data,"发送消息失败!")}).always(function(){e.sending=!1})}},e.prototype.sendChatMsgHandler=function(){this.sendChatMsg()},e.prototype.isTipsShow=function(){return 1===$(this.chatStatusBarRef).find(".textcomplete-dropdown:visible").size()},e.prototype.insertContent=function(e,t){try{var n=t?t.codemirror:this.simplemde.codemirror,i=n.getCursor();i&&(n.replaceRange(e,i,i),n.focus())}catch(e){console.log(e)}},e.prototype.tipsActionHandler=function(e){if("/upload"==e)$(this.btnItemUploadRef).find(".content").click();else if("/shortcuts"==e)this.emHotkeysModal.show();else{if("search"!=e)return!0;_.delay(function(){utils.openNewWin(nsCons.STR_EMOJI_SEARCH_URL)},200)}return!1},e}(),u=l(d.prototype,"chatTo",[t.bindable],{enumerable:!0,initializer:null}),m=l(d.prototype,"isAt",[t.bindable],{enumerable:!0,initializer:null}),p=l(d.prototype,"channel",[t.bindable],{enumerable:!0,initializer:null}),c=d))||c}),define("resources/elements/em-chat-member-popup",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatMemberPopup=void 0;var i;e.EmChatMemberPopup=(0,t.containerless)(i=function(){function e(){var t=this;n(this,e),this.members=[],this.member={},this.subscribe=ea.subscribe(nsCons.EVENT_CHAT_MEMBER_POPUP_SHOW,function(e){if(t.channel=e.channel,t.username=e.username,t.target=e.target,"all"==t.username){if(!t.channel)return;t.members=t.channel.members}else{t.member=utils.getUser(t.username);var n=utils.getUser(t.member.creator);t.member.creatorName=n&&n.name?n.name:t.member.creator}_.defer(function(){$(t.target).popup({popup:t.popup,hoverable:!0,inline:!1,silent:!0,movePopup:!1,position:"bottom left",jitter:300,prefer:"opposite",delay:{show:300,hide:300}}).popup("show")})})}return e.prototype.unbind=function(){this.subscribe.dispose()},e}())||i}),define("resources/elements/em-chat-msg-popup",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatMsgPopup=void 0;var i;e.EmChatMsgPopup=(0,t.containerless)(i=function(){function e(){var t=this;n(this,e),this.subscribe=ea.subscribe(nsCons.EVENT_CHAT_MSG_POPUP_SHOW,function(e){t.id=e.id,t.target=e.target,$(t.target).popup({popup:t.popup,hoverable:!0,inline:!1,movePopup:!1,silent:!0,position:"bottom left",jitter:300,prefer:"opposite",delay:{show:300,hide:300},onShow:function(){$.get("/admin/chat/channel/get",{id:t.id},function(e){e.success?t.chatMsg=e.data:toastr.error(e.data,"加载失败!")})}}).popup("show")})}return e.prototype.unbind=function(){this.subscribe.dispose()},e}())||i}),define("resources/elements/em-chat-schedule-edit",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatScheduleEdit=void 0;var a,o,s;e.EmChatScheduleEdit=(0,t.containerless)((o=function(){function e(){var t=this;i(this,e),n(this,"loginUser",s,this),this.actorsOpts={onAdd:function(e,n,i){$.post("/admin/schedule/addActors",{id:t.event.id,basePath:utils.getBasePath(),actors:e},function(e,t,n){e.success?(toastr.success("添加参与者成功!"),ea.publish(nsCons.EVENT_SCHEDULE_REFRESH,{})):toastr.error(e.data)})},onLabelRemove:function(e){return t.loginUser.username!=e&&void $.post("/admin/schedule/removeActors",{id:t.event.id,basePath:utils.getBasePath(),actors:e},function(e,t,n){e.success?(toastr.success("移除参与者成功!"),ea.publish(nsCons.EVENT_SCHEDULE_REFRESH,{})):toastr.error(e.data)})}}}return e.prototype.attached=function(){$(this.startRef).calendar({today:!0,endCalendar:$(this.endRef)}),$(this.endRef).calendar({today:!0,startCalendar:$(this.startRef)})},e.prototype.initMembersUI=function(e){var t=this;e&&_.defer(function(){var e=[t.loginUser.username];t.event&&(e=_.map(t.event.actors,"username")),$(t.actorsRef).dropdown().dropdown("clear").dropdown("set selected",e).dropdown(t.actorsOpts)})},e.prototype.titleKeyupHandler=function(e){e.ctrlKey&&13===e.keyCode&&this.updateHandler()},e.prototype.clearStartDateHandler=function(){$(this.startRef).calendar("clear")},e.prototype.clearEndDateHandler=function(){$(this.endRef).calendar("clear")},e.prototype.show=function(e){this.event=_.clone(e),this.showHandler(),$(this.scheduleEditRef).popup({on:"click",inline:!0,silent:!0,position:"bottom center",jitter:300,prefer:"opposite",delay:{show:300,hide:300}}).popup("show")},e.prototype.showHandler=function(){var e=this;this.users=window.tmsUsers,$(this.actorsRef).dropdown().dropdown("clear"),_.defer(function(){e.event.start?$(e.startRef).calendar("set date",e.event.start.toDate()):$(e.startRef).calendar("clear"),e.event.end?$(e.endRef).calendar("set date",e.event.end.toDate()):$(e.endRef).calendar("clear");var t=_.map(e.event.actors,"username");$(e.actorsRef).dropdown("set selected",t).dropdown(e.actorsOpts),e.event.creator.username==e.loginUser.username&&$(e.titleRef).focus(),autosize.update(e.titleRef)})},e.prototype.updateHandler=function(){var e=this;if(!this.event.title)return void toastr.error("日程内容不能为空!");var t={id:this.event.id,basePath:utils.getBasePath(),title:this.event.title},n=$(this.startRef).calendar("get date"),i=$(this.endRef).calendar("get date");n?t.startDate=n:t.startDate=new Date,i&&(t.endDate=i),$.post("/admin/schedule/update2",t,function(t,n,i){t.success?(toastr.success("更新日程成功!"),$(e.scheduleEditRef).popup("hide"),ea.publish(nsCons.EVENT_SCHEDULE_REFRESH,{})):toastr.error(t.data)})},e.prototype.delHandler=function(){var e=this;this.emConfirmModal.show({onapprove:function(){$.post("/admin/schedule/delete",{id:e.event.id,basePath:utils.getBasePath()},function(e,t,n){e.success?(toastr.success("日程删除成功!"),ea.publish(nsCons.EVENT_SCHEDULE_REFRESH,{})):toastr.error(e.data)})}})},e}(),s=r(o.prototype,"loginUser",[t.bindable],{enumerable:!0,initializer:null}),a=o))||a}),define("resources/elements/em-chat-schedule-remind",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatScheduleRemind=void 0;var a,o,s;e.EmChatScheduleRemind=(0,t.containerless)((o=function(){function e(){i(this,e),n(this,"events",s,this),this.interval=5e3,this.headOffset=6e5,this.reminded=[],this._pollCheck()}return e.prototype.unbind=function(){this.timer&&clearInterval(this.timer)},e.prototype._pollCheck=function(){var e=this;this.timer=setInterval(function(){if(e.events){var t=(new Date).getTime();_.each(e.events,function(n){if(n.start&&!_.includes(e.reminded,n.id)){var i=n.start;i>t&&i'+e.title+"吗?",onapprove:function(){$.post("/admin/channel/leave",{id:e.id},function(e){e.success?(toastr.success("离开频道成功!"),ea.publish(nsCons.EVENT_CHAT_CHANNEL_LEAVED,{channel:e.data})):toastr.error(e.data,"离开频道失败!")})}})},e.prototype.switchHandler=function(){ea.publish(nsCons.EVENT_SWITCH_CHAT_TO,{})},e.prototype.addChannelLinkHandler=function(e){this.sysLinkMgrVm.show()},e}(),s=r(o.prototype,"users",[t.bindable],{enumerable:!0,initializer:null}),l=r(o.prototype,"loginUser",[t.bindable],{enumerable:!0,initializer:null}),c=r(o.prototype,"channels",[t.bindable],{enumerable:!0,initializer:null}),d=r(o.prototype,"chatTo",[t.bindable],{enumerable:!0,initializer:null}),u=r(o.prototype,"isAt",[t.bindable],{enumerable:!0,initializer:null}),a=o))||a}),define("resources/elements/em-chat-sidebar-right",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatSidebarRight=void 0;var a,o,s,l,c;e.EmChatSidebarRight=(0,t.containerless)((o=function(){function e(){var t,r=this;i(this,e),this.last=!0,n(this,"loginUser",s,this),n(this,"isAt",l,this),n(this,"channel",c,this),this.forAction="",this.forShow="",this.basePath=utils.getBasePath(),this.headerMapping=(t={},t[nsCons.ACTION_TYPE_SEARCH]="无符合检索结果",t[nsCons.ACTION_TYPE_AT]="暂无@消息",t[nsCons.ACTION_TYPE_STOW]="暂无收藏消息",t),this.subscribe=ea.subscribe(nsCons.EVENT_CHAT_SEARCH_RESULT,function(e){r._mappingActionShow(e.action);var t=e.result;r.search=e.search,r.page=t,r.chats=t.content,r.last=t.last,r.moreCnt=t.totalElements-(t.number+1)*t.size}),this.subscribe2=ea.subscribe(nsCons.EVENT_CHAT_SHOW_AT,function(e){r._mappingActionShow(e.action);var t=e.result;r.page=t,r.chats=_.map(t.content,function(e){var t=e.chatChannel;return t.chatAt=e,t}),r.last=t.last,r.moreCnt=t.totalElements-(t.number+1)*t.size}),this.subscribe1=ea.subscribe(nsCons.EVENT_CHAT_SHOW_STOW,function(e){r._mappingActionShow(e.action),r.chats=e.result,r.last=!0}),this.subscribe3=ea.subscribe(nsCons.EVENT_CHAT_SHOW_DIR,function(e){r._mappingActionShow(e.action),$(r.dirRef).empty().append(e.result)}),this.subscribe4=ea.subscribe(nsCons.EVENT_CHAT_SHOW_ATTACH,function(e){r._mappingActionShow(e.action)}),this.subscribe5=ea.subscribe(nsCons.EVENT_CHAT_SHOW_SCHEDULE,function(e){r._mappingActionShow(e.action)})}return e.prototype.unbind=function(){this.subscribe.dispose(),this.subscribe1.dispose(),this.subscribe2.dispose(),this.subscribe3.dispose(),this.subscribe4.dispose(),this.subscribe5.dispose()},e.prototype._mappingActionShow=function(e){this.forAction=e,_.includes([nsCons.ACTION_TYPE_SEARCH,nsCons.ACTION_TYPE_STOW,nsCons.ACTION_TYPE_AT],this.forAction)?this.forShow="chat-msg":_.includes([nsCons.ACTION_TYPE_DIR],this.forAction)?this.forShow="wiki-dir":_.includes([nsCons.ACTION_TYPE_ATTACH],this.forAction)?(this.forShow="chat-attach",this.chatAttachVm.fetch()):_.includes([nsCons.ACTION_TYPE_SCHEDULE],this.forAction)&&(this.forShow="chat-schedule",this.chatScheduleVm.show())},e.prototype.attached=function(){this.initHotkeys()},e.prototype.initHotkeys=function(){var e=this;$(document).bind("keydown","o",function(t){t.preventDefault();var n=_.find(e.chats,{isHover:!0});n&&(n.isOpen=!n.isOpen)})},e.prototype.searchItemMouseleaveHandler=function(e){e.isOpen=!1,e.isHover=!1},e.prototype.searchItemMouseenterHandler=function(e){e.isHover=!0},e.prototype.gotoChatHandler=function(e){ea.publish(nsCons.EVENT_CHAT_SEARCH_GOTO_CHAT_ITEM,{chatItem:e})},e.prototype.openSearchItemHandler=function(e){e.isOpen=!e.isOpen},e.prototype.searchMoreHandler=function(){var e=this;this.forAction==nsCons.ACTION_TYPE_SEARCH?this.searchMoreP=$.get("/admin/chat/direct/search",{search:this.search,size:this.page.size,page:this.page.number+1},function(t){t.success&&(e.chats=_.concat(e.chats,t.data.content),e.page=t.data,e.last=t.data.last,e.moreCnt=t.data.totalElements-(t.data.number+1)*t.data.size)}):this.searchMoreP=$.get("/admin/chat/channel/getAts",{size:this.page.size,page:this.page.number+1},function(t){t.success&&(e.chats=_.concat(e.chats,_.map(t.data.content,function(e){var t=e.chatChannel;return t.chatAt=e,t})),e.page=t.data,e.last=t.data.last,e.moreCnt=t.data.totalElements-(t.data.number+1)*t.data.size)})},e.prototype.removeStowHandler=function(e){var t=this;$.post("/admin/chat/channel/removeStow",{id:e.chatStow.id},function(n,i,r){n.success?(t.chats=_.reject(t.chats,{id:e.id}),toastr.success("移除收藏消息成功!")):toastr.error(n.data,"移除收藏消息失败!")})},e.prototype.removeAtHandler=function(e){var t=this;$.post("/admin/chat/channel/markAsReaded",{chatAtId:e.chatAt.id},function(n,i,r){n.success?t.chats=_.reject(t.chats,{id:e.id}):toastr.error(n.data,"移除@消息失败!")})},e}(),s=r(o.prototype,"loginUser",[t.bindable],{enumerable:!0,initializer:null}),l=r(o.prototype,"isAt",[t.bindable],{enumerable:!0,initializer:null}),c=r(o.prototype,"channel",[t.bindable],{enumerable:!0,initializer:null}),a=o))||a}),define("resources/elements/em-chat-system-link-mgr",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatSystemLinkMgr=void 0;var i;e.EmChatSystemLinkMgr=(0,t.containerless)(i=function(){function e(){n(this,e),this.links=[]}return e.prototype.addHandler=function(){var e=this;$.post("/admin/link/create",{title:this.title,href:this.href,type:"App"},function(t,n,i){t.success?(e.title="",e.href="",e.links.push(t.data),ea.publish(nsCons.EVENT_SYSTEM_LINKS_REFRESH,{})):toastr.error(t.data)})},e.prototype.delHandler=function(e){var t=this;$.post("/admin/link/delete",{id:e.id},function(n,i,r){n.success?(t.links=_.reject(t.links,{id:e.id}),ea.publish(nsCons.EVENT_SYSTEM_LINKS_REFRESH,{}),toastr.success("删除成功!")):toastr.error(n.data)})},e.prototype.editHandler=function(e){e.oldTitle=e.title,e.oldHref=e.href,e.isEditing=!0},e.prototype.updateHandler=function(e){$.post("/admin/link/update",{id:e.id,title:e.title,href:e.href},function(t,n,i){t.success?(e.isEditing=!1,ea.publish(nsCons.EVENT_SYSTEM_LINKS_REFRESH,{}),toastr.success("更新成功!")):toastr.error(t.data)})},e.prototype.showHandler=function(){var e=this;$.get("/admin/link/listByApp",function(t){t.success?e.links=t.data:e.links=[]})},e.prototype.show=function(){this.emModal.show({autoDimmer:!1})},e.prototype.approveHandler=function(e){},e}())||i}),define("resources/elements/em-chat-top-menu",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatTopMenu=void 0;var a,o,s,l,c,d,u,m,p,g,h;e.EmChatTopMenu=(0,t.containerless)((o=function(){function e(){var t=this;i(this,e),n(this,"loginUser",s,this),n(this,"chatUser",l,this),n(this,"users",c,this),n(this,"channels",d,this),n(this,"channel",u,this),n(this,"loginUser",m,this),n(this,"chatId",p,this),n(this,"chatTo",g,this),n(this,"isAt",h,this),this.isRightSidebarShow=!1,this.activeType="",this.ACTION_TYPE_SEARCH=nsCons.ACTION_TYPE_SEARCH,this.ACTION_TYPE_STOW=nsCons.ACTION_TYPE_STOW,this.ACTION_TYPE_AT=nsCons.ACTION_TYPE_AT,this.ACTION_TYPE_DIR=nsCons.ACTION_TYPE_DIR,this.ACTION_TYPE_ATTACH=nsCons.ACTION_TYPE_ATTACH,this.ACTION_TYPE_SCHEDULE=nsCons.ACTION_TYPE_SCHEDULE,this.countAt=null,this.newAtCnt=0,this.channelLinks=[],this.subscribe=ea.subscribe(nsCons.EVENT_CHAT_MSG_WIKI_DIR,function(e){t.dir=e.dir,t.activeType==t.ACTION_TYPE_DIR&&t.isRightSidebarShow&&ea.publish(nsCons.EVENT_CHAT_SHOW_DIR,{action:t.activeType,result:t.dir})}),this.subscribe1=ea.subscribe(nsCons.EVENT_CHAT_POLL_UPDATE,function(e){null!==t.countAt&&t.newAtCnt<=0&&(t.newAtCnt=e.countAt-t.countAt),t.countAt=e.countAt,t.countMyRecentSchedule=e.countMyRecentSchedule}),this.subscribe2=ea.subscribe(nsCons.EVENT_SWITCH_CHAT_TO,function(e){$(t.chatToDropdownRef).dropdown("toggle")}),this.subscribe3=ea.subscribe(nsCons.EVENT_CHANNEL_LINKS_REFRESH,function(e){t._refreshChannelLinks()})}return e.prototype.loginUserChanged=function(){this.loginUser&&(this.isSuper=utils.isSuperUser(this.loginUser))},e.prototype.chatToChanged=function(){$(this.chatToDropdownRef).dropdown("set selected",this.chatId).dropdown("hide")},e.prototype.channelChanged=function(){this._refreshChannelLinks()},e.prototype._refreshChannelLinks=function(){var e=this;this.channel&&$.get("/admin/link/listBy",{channelId:this.channel.id},function(t){t.success?e.channelLinks=t.data:e.channelLinks=[]})},e.prototype.unbind=function(){this.subscribe.dispose(),this.subscribe1.dispose(),this.subscribe2.dispose(),this.subscribe3.dispose()},e.prototype.attached=function(){this.initHotkeys(),this.initSearch()},e.prototype.initSearch=function(){var e=this,t=[];if(localStorage){var n=localStorage.getItem("tms/chat-direct:search");t=n?$.parseJSON(n):[]}this.searchSource=t,$(this.searchRef).search({source:t,onSelect:function(t,n){e.searchHandler()},onResults:function(){$(e.searchRef).search("hide results")}})},e.prototype.searchHandler=function(){var e=this;$(this.searchRef).search("hide results");var t=$(this.searchInputRef).val();if(!t||t.length<2)return void toastr.error("检索条件至少需要两个字符!");this.search=t;var n=!1;$.each(this.searchSource,function(e,i){if(i.title==t)return n=!0,!1}),n||(this.searchSource.splice(0,0,{title:t}),$(this.searchRef).search({source:_.clone(this.searchSource)})),localStorage&&localStorage.setItem("tms/chat-direct:search",JSON.stringify(this.searchSource));var i=void 0,r=void 0;this.isAt?(i="/admin/chat/direct/search",r={search:this.search,size:20,page:0}):(i="/admin/chat/channel/search",r={search:this.search,channelId:this.channel.id,size:20,page:0}),this.searchingP=$.get(i,r,function(t){t.success&&(e.toggleRightSidebar(!0),ea.publish(nsCons.EVENT_CHAT_SEARCH_RESULT,{action:e.activeType,result:t.data,search:e.search}))})},e.prototype.initHotkeys=function(){var e=this;$(document).bind("keydown","s",function(t){t.preventDefault(),e.toggleRightSidebar()}).bind("keydown","ctrl+k",function(t){t.preventDefault(),$(e.chatToDropdownRef).dropdown("toggle")}),$(this.filterChatToUser).bind("keydown","ctrl+k",function(t){t.preventDefault(),$(e.chatToDropdownRef).dropdown("toggle")})},e.prototype.initChatToDropdownHandler=function(e){var t=this;e&&_.defer(function(){$(t.chatToDropdownRef).dropdown().dropdown("set selected",t.chatId).dropdown({onChange:function(e,t,n){window.location=wurl("path")+("#/chat/"+n.attr("data-id"))}})})},e.prototype.searchFocusHandler=function(){$(this.searchInputRef).css("width","auto"),$(this.searchRemoveRef).show(),this.isActiveSearch=!0},e.prototype.searchBlurHandler=function(){$(this.searchInputRef).val()||($(this.searchInputRef).css("width","95px"),$(this.searchRemoveRef).hide(),this.isActiveSearch=!1)},e.prototype.sibebarRightHandler=function(e){this.toggleRightSidebar()},e.prototype.toggleRightSidebar=function(e){_.isUndefined(e)?this.isRightSidebarShow=!this.isRightSidebarShow:this.isRightSidebarShow=e,ea.publish(nsCons.EVENT_CHAT_SIDEBAR_TOGGLE,{isShow:this.isRightSidebarShow})},e.prototype.searchKeyupHandler=function(e){return 13===e.keyCode?(this.activeType=nsCons.ACTION_TYPE_SEARCH,this.searchHandler()):27===e.keyCode&&this.clearSearchHandler(),!0},e.prototype.clearSearchHandler=function(){$(this.searchInputRef).val("").focus()},e.prototype.showStowHandler=function(e){var t=this;return this.isRightSidebarShow&&this.activeType==nsCons.ACTION_TYPE_STOW&&!e.ctrlKey?void this.toggleRightSidebar():(this.activeType=nsCons.ACTION_TYPE_STOW,void(this.ajaxStow=$.get("/admin/chat/channel/getStows",function(e){if(e.success){var n=_.map(e.data,function(e){var t=e.chatChannel;return t.chatStow=e,t});ea.publish(nsCons.EVENT_CHAT_SHOW_STOW,{action:t.activeType,result:_.reverse(n)}),t.toggleRightSidebar(!0)}else toastr.error(e.data,"获取收藏消息失败!")})))},e.prototype.showAtHandler=function(e){var t=this;return this.isRightSidebarShow&&this.activeType==nsCons.ACTION_TYPE_AT&&0==this.newAtCnt&&!e.ctrlKey?void this.toggleRightSidebar():(this.activeType=nsCons.ACTION_TYPE_AT,this.newAtCnt=0,void(this.ajaxAt=$.get("/admin/chat/channel/getAts",{page:0,size:20},function(e){e.success?(ea.publish(nsCons.EVENT_CHAT_SHOW_AT,{action:t.activeType,result:e.data}),t.toggleRightSidebar(!0)):toastr.error(e.data,"获取@消息失败!")})))},e.prototype.logoutHandler=function(){$.post("/admin/logout").always(function(){utils.redirect2Login()})},e.prototype.showWikiDirHandler=function(e){return this.isRightSidebarShow&&this.activeType==nsCons.ACTION_TYPE_DIR&&!e.ctrlKey?void this.toggleRightSidebar():(this.activeType=nsCons.ACTION_TYPE_DIR,ea.publish(nsCons.EVENT_CHAT_SHOW_DIR,{action:this.activeType,result:this.dir}),void this.toggleRightSidebar(!0))},e.prototype.showAttachHandler=function(e){return this.isRightSidebarShow&&this.activeType==nsCons.ACTION_TYPE_ATTACH&&!e.ctrlKey?void this.toggleRightSidebar():(this.activeType=nsCons.ACTION_TYPE_ATTACH,ea.publish(nsCons.EVENT_CHAT_SHOW_ATTACH,{action:this.activeType}),void this.toggleRightSidebar(!0))},e.prototype.showScheduleHandler=function(e){return this.isRightSidebarShow&&this.activeType==nsCons.ACTION_TYPE_SCHEDULE&&!e.ctrlKey?void this.toggleRightSidebar():(this.activeType=nsCons.ACTION_TYPE_SCHEDULE,ea.publish(nsCons.EVENT_CHAT_SHOW_SCHEDULE,{action:this.activeType}),void this.toggleRightSidebar(!0))},e.prototype.userEditHandler=function(){this.userEditMd.show()},e.prototype.membersShowHandler=function(e,t){t.stopImmediatePropagation(),ea.publish(nsCons.EVENT_CHANNEL_ACTIONS,{action:"membersShowHandler",item:e})},e.prototype.leaveHandler=function(e,t){t.stopImmediatePropagation(),ea.publish(nsCons.EVENT_CHANNEL_ACTIONS,{action:"leaveHandler",item:e})},e.prototype.membersMgrHandler=function(e,t){t.stopImmediatePropagation(),ea.publish(nsCons.EVENT_CHANNEL_ACTIONS,{action:"membersMgrHandler",item:e})},e.prototype.editHandler=function(e,t){t.stopImmediatePropagation(),ea.publish(nsCons.EVENT_CHANNEL_ACTIONS,{action:"editHandler",item:e})},e.prototype.delHandler=function(e,t){t.stopImmediatePropagation(),ea.publish(nsCons.EVENT_CHANNEL_ACTIONS,{action:"delHandler",item:e})},e.prototype.viewOrMgrUsersHandler=function(e){this.channel.owner.username==this.loginUser.username?this.membersMgrHandler(this.channel,e):this.membersShowHandler(this.channel,e)},e.prototype.channelInfoHandler=function(e){this.channel.owner.username==this.loginUser.username?this.editHandler(this.channel,e):e.stopImmediatePropagation()},e.prototype.userInfoHandler=function(e){e.stopImmediatePropagation()},e.prototype.stopImmediatePropagationHandler=function(e){e.stopImmediatePropagation()},e.prototype.mailToHandler=function(e){e.stopImmediatePropagation(),window.location="mailto:"+this.chatUser.mails},e.prototype.channelLinksHandler=function(e){e.stopImmediatePropagation(),$(this.channelLinksDdRef).dropdown("toggle")},e.prototype.addChannelLinkHandler=function(e){this.channelLinkMgrVm.show()},e.prototype.openChannelLinkHandler=function(e,t){e.stopImmediatePropagation(),utils.openNewWin(t.href)},e}(),s=r(o.prototype,"loginUser",[t.bindable],{enumerable:!0,initializer:null}),l=r(o.prototype,"chatUser",[t.bindable],{enumerable:!0,initializer:null}),c=r(o.prototype,"users",[t.bindable],{enumerable:!0,initializer:null}),d=r(o.prototype,"channels",[t.bindable],{enumerable:!0,initializer:null}),u=r(o.prototype,"channel",[t.bindable],{enumerable:!0,initializer:null}),m=r(o.prototype,"loginUser",[t.bindable],{enumerable:!0,initializer:null}),p=r(o.prototype,"chatId",[t.bindable],{enumerable:!0,initializer:null}),g=r(o.prototype,"chatTo",[t.bindable],{enumerable:!0,initializer:null}),h=r(o.prototype,"isAt",[t.bindable],{enumerable:!0,initializer:null}),a=o))||a}),define("resources/elements/em-checkbox",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmCheckbox=void 0;var a,o,s,l,c,d,u,m,p,g,h,b;e.EmCheckbox=(a=(0,t.bindable)({defaultBindingMode:t.bindingMode.twoWay}),(0,t.containerless)((s=function(){function e(){i(this,e),n(this,"label",l,this),n(this,"title",c,this),n(this,"classes",d,this),n(this,"onchange",u,this),n(this,"onchecked",m,this),n(this,"onunchecked",p,this),n(this,"emCheckboxAll",g,this),n(this,"checked",h,this),n(this,"signal",b,this)}return e.prototype.checkedChanged=function(e,t){e?$(this.checkbox).checkbox("set checked"):$(this.checkbox).checkbox("set unchecked"),this.signal&&bs.signal(this.signal)},e.prototype.attached=function(){var e=this;$(this.checkbox).checkbox({onChecked:function(){e.checked=!0,_.defer(function(){e.emCheckboxAll&&e.emCheckboxAll.refreshCheckedStatus(),e.onchecked&&e.onchecked(e),e.signal&&bs.signal(e.signal)})},onUnchecked:function(){e.checked=!1,_.defer(function(){e.emCheckboxAll&&e.emCheckboxAll.refreshCheckedStatus(),e.onunchecked&&e.onunchecked(e),e.signal&&bs.signal(e.signal)})},onChange:function(){_.defer(function(){e.onchange&&e.onchange(e)})}}),this.checkedChanged(this.checked)},e}(),l=r(s.prototype,"label",[t.bindable],{enumerable:!0,initializer:null}),c=r(s.prototype,"title",[t.bindable],{enumerable:!0,initializer:null}),d=r(s.prototype,"classes",[t.bindable],{enumerable:!0,initializer:function(){return"fitted"}}),u=r(s.prototype,"onchange",[t.bindable],{enumerable:!0,initializer:null}),m=r(s.prototype,"onchecked",[t.bindable],{enumerable:!0,initializer:null}),p=r(s.prototype,"onunchecked",[t.bindable],{enumerable:!0,initializer:null}),g=r(s.prototype,"emCheckboxAll",[t.bindable],{enumerable:!0,initializer:null}),h=r(s.prototype,"checked",[a],{enumerable:!0,initializer:null}),b=r(s.prototype,"signal",[t.bindable],{enumerable:!0,initializer:null}),o=s))||o)}),define("resources/elements/em-confirm-modal",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.EmConfirmModal=void 0;e.EmConfirmModal=function(){function e(){n(this,e),this.config={}}return e.prototype.detached=function(){$(this.md).remove()},e.prototype.attached=function(){var e=this;$(this.md).modal({closable:!1,allowMultiple:!0,onApprove:function(){e.onapprove&&e.onapprove()},onDeny:function(){e.ondeny&&e.ondeny()}})},e.prototype.reset=function(){this.config={title:"操作确认",content:"确定要执行该操作吗?",warning:!1}},e.prototype.show=function(e){this.reset(),e&&(this.config=_.extend(this.config,e)),e&&e.onapprove&&(this.onapprove=e.onapprove),e&&e.ondeny&&(this.ondeny=e.ondeny),$(this.md).modal("show")},e.prototype.hide=function(){$(this.md).modal("hide")},e}()}),define("resources/elements/em-dropdown",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmDropdown=void 0;var a,o,s,l,c,d,u,m,p;e.EmDropdown=(a=(0,t.bindable)({defaultBindingMode:t.bindingMode.twoWay}),o=function(){function e(){i(this,e),n(this,"name",s,this),n(this,"text",l,this),n(this,"labelProp",c,this),n(this,"valueProp",d,this),n(this,"selectedItem",u,this),n(this,"menuItems",m,this),n(this,"classes",p,this)}return e.prototype.selectedItemChanged=function(e,t){var n=this;e&&_.defer(function(){$(n.dropdown).dropdown("set selected",e)})},e.prototype.menuItemsChanged=function(e,t){_.isEmpty(e)&&($(this.dropdown).dropdown("clear"),this.selectedItem=null)},e.prototype.initDropdownHandler=function(e){var t=this;e&&_.defer(function(){$(t.dropdown).dropdown({onChange:function(e,n,i){t.selectedItem=e}}).dropdown("set selected",t.selectedItem)})},e}(),s=r(o.prototype,"name",[t.bindable],{enumerable:!0,initializer:function(){return _.uniqueId("em-dropdown-")}}),l=r(o.prototype,"text",[t.bindable],{enumerable:!0,initializer:function(){return""}}),c=r(o.prototype,"labelProp",[t.bindable],{enumerable:!0,initializer:function(){return"label"}}),d=r(o.prototype,"valueProp",[t.bindable],{enumerable:!0,initializer:function(){return"value"}}),u=r(o.prototype,"selectedItem",[a],{enumerable:!0,initializer:null}),m=r(o.prototype,"menuItems",[t.bindable],{enumerable:!0,initializer:function(){return[]}}),p=r(o.prototype,"classes",[t.bindable],{enumerable:!0,initializer:function(){return"selection"}}),o)}),define("resources/elements/em-hotkeys-modal",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.EmHotkeysModal=void 0;e.EmHotkeysModal=function(){function e(){n(this,e)}return e.prototype.attached=function(){$(this.md).modal()},e.prototype.show=function(){$(this.md).modal("show")},e}()}),define("resources/elements/em-modal",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0
-})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmModal=void 0;var a,o,s,l,c,d,u,m,p,g,h;e.EmModal=(0,t.containerless)((o=function(){function e(){i(this,e),n(this,"confirmLabel",s,this),n(this,"cancelLabel",l,this),n(this,"onapprove",c,this),n(this,"ondeny",d,this),n(this,"onshow",u,this),n(this,"onvisible",m,this),n(this,"disabled",p,this),n(this,"classes",g,this),n(this,"showConfirm",h,this),this.options={hideOnApprove:!0,autoDimmer:!0}}return e.prototype.detached=function(){$(this.modal).remove()},e.prototype.attached=function(){var e=this;$(this.modal).modal({closable:!1,autofocus:!1,observeChanges:!0,allowMultiple:!0,onShow:function(){e.onshow&&e.onshow(e)},onVisible:function(){e.onvisible&&e.onvisible(e)},onApprove:function(){return e.options.autoDimmer&&e.showDimmer(),e.onapprove&&e.onapprove(e),e.options.hideOnApprove},onDeny:function(){e.ondeny&&e.ondeny(e)}})},e.prototype.showDimmer=function(){this.loading=!0,$(this.modal).find(".dimmer").dimmer("show")},e.prototype.hideDimmer=function(){this.loading=!1,$(this.modal).find(".dimmer").dimmer("hide")},e.prototype.show=function(e){_.extend(this.options,e),$(this.modal).modal("show")},e.prototype.hide=function(){this.hideDimmer(),$(this.modal).modal("hide")},e.prototype.refresh=function(){var e=this;_.defer(function(){$(e.modal).modal("refresh")})},e}(),s=r(o.prototype,"confirmLabel",[t.bindable],{enumerable:!0,initializer:function(){return"确认"}}),l=r(o.prototype,"cancelLabel",[t.bindable],{enumerable:!0,initializer:function(){return"取消"}}),c=r(o.prototype,"onapprove",[t.bindable],{enumerable:!0,initializer:null}),d=r(o.prototype,"ondeny",[t.bindable],{enumerable:!0,initializer:null}),u=r(o.prototype,"onshow",[t.bindable],{enumerable:!0,initializer:null}),m=r(o.prototype,"onvisible",[t.bindable],{enumerable:!0,initializer:null}),p=r(o.prototype,"disabled",[t.bindable],{enumerable:!0,initializer:function(){return!1}}),g=r(o.prototype,"classes",[t.bindable],{enumerable:!0,initializer:function(){return"small"}}),h=r(o.prototype,"showConfirm",[t.bindable],{enumerable:!0,initializer:function(){return!0}}),a=o))||a}),define("resources/elements/em-user-avatar",["exports","aurelia-framework","color-hash"],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmUserAvatar=void 0;var s,l,c;i(n),e.EmUserAvatar=(0,t.containerless)((l=function(){function e(){a(this,e),r(this,"user",c,this)}return e.prototype.userChanged=function(){if(this.user){this._calcNameChar();var e=colorHash.rgb(this.user.username);this.bgColor="rgba("+e[0]+", "+e[1]+", "+e[2]+", 0.6)",this.color="rgba("+(255-e[0])+", "+(255-e[1])+", "+(255-e[2])+", 1)"}},e.prototype._calcNameChar=function(){var e=arguments.length<=0||void 0===arguments[0]||arguments[0];this.user.name?this.nameChar=e?_.last(this.user.name):_.first(this.user.name):this.nameChar=e?_.last(this.user.username):_.first(this.user.username)},e.prototype.attached=function(){var e=this;$(this.avatarRef).hover(function(){e._calcNameChar(!1)},function(){e._calcNameChar()})},e}(),c=o(l.prototype,"user",[t.bindable],{enumerable:!0,initializer:null}),s=l))||s}),define("resources/elements/em-user-edit",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmUserEdit=void 0;var a,o,s;e.EmUserEdit=(0,t.containerless)((o=function(){function e(){i(this,e),n(this,"user",s,this)}return e.prototype.show=function(){this.emModal.show({hideOnApprove:!1,autoDimmer:!0})},e.prototype.showHandler=function(){},e.prototype.attached=function(){$(this.frm).form({on:"blur",inline:!0,fields:{name:"empty",mail:["empty","email"]}})},e.prototype._chkOk=function(){var e=this.user.password;return!(e&&e.length<8)||(toastr.error("密码长度不能少于8位字符!"),!1)},e.prototype.approveHandler=function(e){var t=this;this._chkOk()&&$(this.frm).form("is valid")?$.post("/admin/user/update2",{username:this.user.username,password:this.user.password,name:this.user.name,mail:this.user.mails},function(n){e.hide(),t.user.password="",n.success?toastr.success("更新个人信息成功!"):toastr.error(n.data,"更新个人信息失败!")}):e.hideDimmer()},e}(),s=r(o.prototype,"user",[t.bindable],{enumerable:!0,initializer:null}),a=o))||a}),define("aurelia-templating-resources/compose",["exports","aurelia-dependency-injection","aurelia-task-queue","aurelia-templating","aurelia-pal"],function(e,t,n,i,r){"use strict";function a(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function o(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}function s(e,t){return Object.assign(t,{bindingContext:e.bindingContext,overrideContext:e.overrideContext,owningView:e.owningView,container:e.container,viewSlot:e.viewSlot,viewResources:e.viewResources,currentController:e.currentController,host:e.element})}function l(e,t){e.currentInstruction=null,e.compositionEngine.compose(t).then(function(t){e.currentController=t,e.currentViewModel=t?t.viewModel:null})}Object.defineProperty(e,"__esModule",{value:!0}),e.Compose=void 0;var c,d,u,m,p,g,h;e.Compose=(c=(0,i.customElement)("compose"),d=(0,t.inject)(r.DOM.Element,t.Container,i.CompositionEngine,i.ViewSlot,i.ViewResources,n.TaskQueue),c(u=(0,i.noView)(u=d((m=function(){function e(e,t,n,i,r,o){a(this,"model",p,this),a(this,"view",g,this),a(this,"viewModel",h,this),this.element=e,this.container=t,this.compositionEngine=n,this.viewSlot=i,this.viewResources=r,this.taskQueue=o,this.currentController=null,this.currentViewModel=null}return e.prototype.created=function(e){this.owningView=e},e.prototype.bind=function(e,t){this.bindingContext=e,this.overrideContext=t,l(this,s(this,{view:this.view,viewModel:this.viewModel,model:this.model}))},e.prototype.unbind=function(e,t){this.bindingContext=null,this.overrideContext=null;var n=!0,i=!0;this.viewSlot.removeAll(n,i)},e.prototype.modelChanged=function(e,t){var n=this;return this.currentInstruction?void(this.currentInstruction.model=e):void this.taskQueue.queueMicroTask(function(){if(n.currentInstruction)return void(n.currentInstruction.model=e);var t=n.currentViewModel;t&&"function"==typeof t.activate&&t.activate(e)})},e.prototype.viewChanged=function(e,t){var n=this,i=s(this,{view:e,viewModel:this.currentViewModel||this.viewModel,model:this.model});return this.currentInstruction?void(this.currentInstruction=i):(this.currentInstruction=i,void this.taskQueue.queueMicroTask(function(){return l(n,n.currentInstruction)}))},e.prototype.viewModelChanged=function(e,t){var n=this,i=s(this,{viewModel:e,view:this.view,model:this.model});return this.currentInstruction?void(this.currentInstruction=i):(this.currentInstruction=i,void this.taskQueue.queueMicroTask(function(){return l(n,n.currentInstruction)}))},e}(),p=o(m.prototype,"model",[i.bindable],{enumerable:!0,initializer:null}),g=o(m.prototype,"view",[i.bindable],{enumerable:!0,initializer:null}),h=o(m.prototype,"viewModel",[i.bindable],{enumerable:!0,initializer:null}),u=m))||u)||u)||u)}),define("aurelia-templating-resources/if",["exports","aurelia-templating","aurelia-dependency-injection"],function(e,t,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.If=void 0;var i,r,a;e.If=(i=(0,t.customAttribute)("if"),r=(0,n.inject)(t.BoundViewFactory,t.ViewSlot),i(a=(0,t.templateController)(a=r(a=function(){function e(e,t){this.viewFactory=e,this.viewSlot=t,this.showing=!1,this.view=null,this.bindingContext=null,this.overrideContext=null}return e.prototype.bind=function(e,t){this.bindingContext=e,this.overrideContext=t,this.valueChanged(this.value)},e.prototype.valueChanged=function(e){var t=this;if(this.__queuedChanges)return void this.__queuedChanges.push(e);var n=this._runValueChanged(e);n instanceof Promise&&!function(){var e=t.__queuedChanges=[],i=function n(){if(!e.length)return void(t.__queuedChanges=void 0);var i=t._runValueChanged(e.shift())||Promise.resolve();i.then(n)};n.then(i)}()},e.prototype._runValueChanged=function(e){var t=this;if(!e){var n=void 0;return null!==this.view&&this.showing&&(n=this.viewSlot.remove(this.view),n instanceof Promise?n.then(function(){return t.view.unbind()}):this.view.unbind()),this.showing=!1,n}if(null===this.view&&(this.view=this.viewFactory.create()),this.view.isBound||this.view.bind(this.bindingContext,this.overrideContext),!this.showing)return this.showing=!0,this.viewSlot.add(this.view)},e.prototype.unbind=function(){null!==this.view&&(this.view.unbind(),this.viewFactory.isCaching&&(this.showing&&(this.showing=!1,this.viewSlot.remove(this.view,!0,!0)),this.view.returnToCache(),this.view=null))},e}())||a)||a)||a)}),define("aurelia-templating-resources/with",["exports","aurelia-dependency-injection","aurelia-templating","aurelia-binding"],function(e,t,n,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.With=void 0;var r,a,o;e.With=(r=(0,n.customAttribute)("with"),a=(0,t.inject)(n.BoundViewFactory,n.ViewSlot),r(o=(0,n.templateController)(o=a(o=function(){function e(e,t){this.viewFactory=e,this.viewSlot=t,this.parentOverrideContext=null,this.view=null}return e.prototype.bind=function(e,t){this.parentOverrideContext=t,this.valueChanged(this.value)},e.prototype.valueChanged=function(e){var t=(0,i.createOverrideContext)(e,this.parentOverrideContext);this.view?this.view.bind(e,t):(this.view=this.viewFactory.create(),this.view.bind(e,t),this.viewSlot.add(this.view))},e.prototype.unbind=function(){this.parentOverrideContext=null,this.view&&this.view.unbind()},e}())||o)||o)||o)}),define("aurelia-templating-resources/repeat",["exports","aurelia-dependency-injection","aurelia-binding","aurelia-templating","./repeat-strategy-locator","./repeat-utilities","./analyze-view-factory","./abstract-repeater"],function(e,t,n,i,r,a,o,s){"use strict";function l(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function c(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.Repeat=void 0;var m,p,g,h,b,f,_,v;e.Repeat=(m=(0,i.customAttribute)("repeat"),p=(0,t.inject)(i.BoundViewFactory,i.TargetInstruction,i.ViewSlot,i.ViewResources,n.ObserverLocator,r.RepeatStrategyLocator),m(g=(0,i.templateController)(g=p((h=function(e){function t(t,n,i,r,s,d){var u=c(this,e.call(this,{local:"item",viewsRequireLifecycle:(0,o.viewsRequireLifecycle)(t)}));return l(u,"items",b,u),l(u,"local",f,u),l(u,"key",_,u),l(u,"value",v,u),u.viewFactory=t,u.instruction=n,u.viewSlot=i,u.lookupFunctions=r.lookupFunctions,u.observerLocator=s,u.key="key",u.value="value",u.strategyLocator=d,u.ignoreMutation=!1,u.sourceExpression=(0,a.getItemsSourceExpression)(u.instruction,"repeat.for"),u.isOneTime=(0,a.isOneTime)(u.sourceExpression),u.viewsRequireLifecycle=(0,o.viewsRequireLifecycle)(t),u}return d(t,e),t.prototype.call=function(e,t){this[e](this.items,t)},t.prototype.bind=function(e,t){this.scope={bindingContext:e,overrideContext:t},this.matcherBinding=this._captureAndRemoveMatcherBinding(),this.itemsChanged()},t.prototype.unbind=function(){this.scope=null,this.items=null,this.matcherBinding=null,this.viewSlot.removeAll(!0),this._unsubscribeCollection()},t.prototype._unsubscribeCollection=function(){this.collectionObserver&&(this.collectionObserver.unsubscribe(this.callContext,this),this.collectionObserver=null,this.callContext=null)},t.prototype.itemsChanged=function(){if(this._unsubscribeCollection(),this.scope){var e=this.items;if(this.strategy=this.strategyLocator.getStrategy(e),!this.strategy)throw new Error("Value for '"+this.sourceExpression+"' is non-repeatable");this.isOneTime||this._observeInnerCollection()||this._observeCollection(),this.strategy.instanceChanged(this,e)}},t.prototype._getInnerCollection=function(){var e=(0,a.unwrapExpression)(this.sourceExpression);return e?e.evaluate(this.scope,null):null},t.prototype.handleCollectionMutated=function(e,t){this.collectionObserver&&this.strategy.instanceMutated(this,e,t)},t.prototype.handleInnerCollectionMutated=function(e,t){var n=this;if(this.collectionObserver&&!this.ignoreMutation){this.ignoreMutation=!0;var i=this.sourceExpression.evaluate(this.scope,this.lookupFunctions);this.observerLocator.taskQueue.queueMicroTask(function(){return n.ignoreMutation=!1}),i===this.items?this.itemsChanged():this.items=i}},t.prototype._observeInnerCollection=function(){var e=this._getInnerCollection(),t=this.strategyLocator.getStrategy(e);return!!t&&(this.collectionObserver=t.getCollectionObserver(this.observerLocator,e),!!this.collectionObserver&&(this.callContext="handleInnerCollectionMutated",this.collectionObserver.subscribe(this.callContext,this),!0))},t.prototype._observeCollection=function(){var e=this.items;this.collectionObserver=this.strategy.getCollectionObserver(this.observerLocator,e),this.collectionObserver&&(this.callContext="handleCollectionMutated",this.collectionObserver.subscribe(this.callContext,this))},t.prototype._captureAndRemoveMatcherBinding=function(){if(this.viewFactory.viewFactory)for(var e=this.viewFactory.viewFactory.instructions,t=Object.keys(e),n=0;n| \r\n | 版本 | \r\n日期 | \r\n更新人 | \r\n操作 | \r\n
|---|---|---|---|---|
| \r\n | \r\n 当前(v.${histories.length + 1}) | \r\n${blog.updateDate | timeago} | \r\n${blog.updater.name} | \r\n\r\n |
| \r\n | \r\n v.${histories.length - $index} | \r\n${item.blogUpdateDate | timeago} | \r\n${item.blogUpdater.name} | \r\n\r\n 还原此版本 ·\r\n \r\n 删除\r\n \r\n \r\n | \r\n
| 标识 | \r\n名称 | \r\n描述 | \r\n可见性 | \r\n拥有者 | \r\n操作 | \r\n||
|---|---|---|---|---|---|---|---|
| ${item.name} | \r\n${item.title} | \r\n\r\n | \r\n | \r\n | ${item.owner.name ? item.owner.name : item.owner.username} | \r\n自己 | \r\n\r\n \r\n \r\n | \r\n
| 标题 | \r\n链接 | \r\n\r\n | 操作 | \r\n||
|---|---|---|---|---|---|
| ${item.title} | \r\n\r\n \r\n \r\n \r\n | \r\n ${item.href} | \r\n\r\n \r\n \r\n \r\n | \r\n \r\n | \r\n \r\n \r\n \r\n | \r\n
| 用户名 | \r\n姓名 | \r\n邮箱 | \r\n登录 | \r\n状态 | \r\n|
|---|---|---|---|---|---|
| ${item.username} | \r\n${item.name} | \r\n${item.mails} | \r\n${item.lastLoginDate | timeago} | \r\n\r\n 启用中 \r\n | \r\n \r\n 已停用 \r\n | \r\n
| 用户名 | \r\n姓名 | \r\n邮箱 | \r\n登录 | \r\n状态 | \r\n|
|---|---|---|---|---|---|
| ${item.username} | \r\n${item.name} | \r\n${item.mails} | \r\n${item.lastLoginDate | timeago} | \r\n\r\n 启用中 \r\n | \r\n \r\n 已停用 \r\n | \r\n
| 发起人: | \r\n${event.creator.name} | \r\n
| 起止时间: | \r\n${event.start | date} - ${event.end | date} | \r\n
| 参与成员: | \r\n\r\n ${item.name} \r\n | \r\n
| 日程内容: | \r\n\r\n |
| 标题 | \r\n链接 | \r\n操作 | \r\n||
|---|---|---|---|---|
| ${item.title} | \r\n\r\n \r\n \r\n \r\n | \r\n ${item.href} | \r\n\r\n \r\n \r\n \r\n | \r\n \r\n \r\n \r\n \r\n | \r\n
\n \n
\n"+s.join("")+""},e.prototype.catalog=function(e){var t=$(":header",e);if(t&&0==t.size())return!1;var n=null,i={pre:null,arr:[]},r=i;return t.each(function(e,t){var i=t.nodeName;if(n)if(n'+e+""},e.code=function(e,t,n){var i=e;if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?''+(n?e:f.default.escape(e,!0))+"\n'+(n?e:f.default.escape(e,!0))+"\n默认确认对话框内容.
"}),this},e.prototype.context=function(e){return this.aurelia=e,this},e}();e.default=new S}),define("init/index",["exports","./config","jquery","jquery.scrollto","timeago","lodash","hotkeys"],function(e,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){r.default.context(e).initGlobalVar().initAjax().initToastr().initMarked().initAnimateCss().initEmoji().initModaal()}Object.defineProperty(e,"__esModule",{value:!0}),e.configure=i;var r=n(t)}),define("resources/index",["exports"],function(e){"use strict";function t(e){e.globalResources(["resources/value-converters/vc-common","resources/binding-behaviors/bb-key","resources/attributes/attr-task","resources/attributes/attr-swipebox","resources/attributes/attr-pastable","resources/attributes/attr-autosize","resources/attributes/attr-dropzone","resources/attributes/attr-attr","resources/attributes/attr-c2c","resources/attributes/attr-dimmer","resources/attributes/attr-ui-dropdown","resources/attributes/attr-ui-dropdown-action","resources/attributes/attr-ui-dropdown-hover","resources/attributes/attr-ui-tab","resources/attributes/attr-ui-popup","resources/attributes/attr-ui-checkbox","resources/attributes/attr-tablesort","resources/attributes/attr-textcomplete","resources/attributes/attr-scrollbar","resources/attributes/attr-modaal","resources/elements/em-modal","resources/elements/em-dropdown","resources/elements/em-checkbox","resources/elements/em-confirm-modal","resources/elements/em-hotkeys-modal","resources/elements/em-chat-input","resources/elements/em-chat-top-menu","resources/elements/em-chat-sidebar-left","resources/elements/em-chat-content-item","resources/elements/em-chat-sidebar-right","resources/elements/em-chat-channel-create","resources/elements/em-chat-channel-join","resources/elements/em-chat-channel-edit","resources/elements/em-chat-channel-members-mgr","resources/elements/em-chat-channel-members-show","resources/elements/em-chat-channel-link-mgr","resources/elements/em-chat-system-link-mgr","resources/elements/em-chat-msg-popup","resources/elements/em-chat-member-popup","resources/elements/em-chat-attach","resources/elements/em-chat-schedule","resources/elements/em-chat-schedule-edit","resources/elements/em-chat-schedule-remind","resources/elements/em-chat-share","resources/elements/em-blog-write","resources/elements/em-blog-left-sidebar","resources/elements/em-blog-right-sidebar","resources/elements/em-blog-content","resources/elements/em-blog-top-menu","resources/elements/em-blog-share","resources/elements/em-blog-comment","resources/elements/em-blog-save","resources/elements/em-blog-space-create","resources/elements/em-blog-space-edit","resources/elements/em-blog-space-update","resources/elements/em-blog-history","resources/elements/em-blog-history-view","resources/elements/em-blog-history-diff","resources/elements/em-blog-comment-popup","resources/elements/em-blog-space-auth","resources/elements/em-user-avatar","resources/elements/em-user-edit","resources/elements/em-blog-comment-share"])}Object.defineProperty(e,"__esModule",{value:!0}),e.configure=t}),define("test/test-lifecycle",["exports","aurelia-framework","aurelia-event-aggregator"],function(e,t,n){"use strict";function i(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.TestLifeCycle=void 0;var o,s,l,c;e.TestLifeCycle=(c=l=function(){function e(t){r(this,e),i(this,"prop",s,this),this.eventAggregator=t,console.log("constructor")}return e.prototype.created=function(e){console.log("created")},e.prototype.bind=function(e){console.log("bind")},e.prototype.unbind=function(){console.log("unbind")},e.prototype.attached=function(){console.log("attached")},e.prototype.detached=function(){console.log("detached")},e.prototype.canActivate=function(e,t,n){console.log("canActivate")},e.prototype.activate=function(e,t,n){console.log("activate")},e.prototype.canDeactivate=function(){console.log("canDeactivate")},e.prototype.deactivate=function(){console.log("deactivate")},e}(),l.inject=[n.EventAggregator],o=c,s=a(o.prototype,"prop",[t.bindable],{enumerable:!0,initializer:function(){return null}}),o)}),define("user/user-login",["exports"],function(e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});e.UserLogin=function(){function e(){t(this,e),this.username="",this.password=""}return e.prototype.attached=function(){$(this.rememberMeRef).checkbox()},e.prototype.kdHandler=function(e){return 13===e.keyCode&&this.loginHandler(),!0},e.prototype.loginHandler=function(){var e=this,t=$(this.rememberMeRef).checkbox("is checked")?"on":"";return $.post("/admin/signin",{username:this.username,password:this.password,"remember-me":t}).done(function(){localStorage&&localStorage.setItem(nsCons.KEY_LOGIN_USERNAME,e.username);var t=utils.urlQuery("redirect");if(t)window.location=decodeURIComponent(t);else{var n=null;localStorage&&(n=localStorage.getItem(nsCons.KEY_REMEMBER_LAST_CHAT_TO)),n?window.location=wurl("path")+("#/chat/"+n):window.location=wurl("path")+("#/chat/@"+e.username)}}).fail(function(e,t,n){401==e.status?toastr.error("用户名密码不正确!"):0!=e.status&&toastr.error("网络连接错误!")}),!0},e}()}),define("user/user-pwd-reset",["exports"],function(e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});e.UserPwdReset=function(){function e(){t(this,e),this.mail="",this.pwd="",this.isReq=!1,this.token=utils.urlQuery("id")}return e.prototype.resetPwdHandler=function(){var e=this;return $(this.fm).form("is valid")?(this.isReq=!0,void http.fetch("/free/user/pwd/reset",{method:"post",body:json({mail:this.mail,baseUrl:utils.getBaseUrl(),path:wurl("path")})}).then(function(t){t.ok&&t.json().then(function(t){t.success?(toastr.success("重置密码邮件链接发送成功!"),_.delay(function(){window.location="/admin/login"},2e3)):(toastr.error(t.data,"重置密码邮件链接发送失败!"),e.isReq=!1)})})):void toastr.error("邮件地址输入不合法!")},e.prototype.newPwdHandler=function(){var e=this;return $(this.fm2).form("is valid")?(this.isReq=!0,void http.fetch("/free/user/pwd/new",{method:"post",body:json({token:this.token,pwd:this.pwd})}).then(function(t){t.ok&&t.json().then(function(t){t.success?(toastr.success("重置密码成功!"),_.delay(function(){window.location="/admin/login"},2e3)):(toastr.error(t.data,"重置密码失败!"),e.isReq=!1)})})):void toastr.error("新密码输入不合法!")},e.prototype.attached=function(){$(this.fm).form({on:"blur",inline:!0,fields:{mail:["empty","email"]}}),$(this.fm2).form({on:"blur",inline:!0,fields:{mail:["empty","minLength[8]"]}})},e}()}),define("user/user-register",["exports"],function(e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});e.ViewModel=function(){function e(){t(this,e),this.header="账户激活页面"}return e.prototype.activate=function(e,t,n){var i=this;e.id&&(this.token=e.id,this.isReq=!0,this.header="账户激活中,请稍后...!",http.fetch("/free/user/register/activate",{method:"post",body:json({ -token:this.token})}).then(function(e){e.ok&&(e.json().then(function(e){e.success?i.header="账户激活成功,请返回登录页面登录!":(i.header="账户激活失败!",toastr.error(e.data,"账户激活失败!"))}),i.isReq=!1)}))},e.prototype.attached=function(){$(this.fm).form({on:"blur",inline:!0,fields:{username:{identifier:"username",rules:[{type:"empty"},{type:"minLength[3]"},{type:"regExp",value:/^[a-z]+[a-z0-9\.\-_]*[a-z0-9]+$/,prompt:"小写字母数字.-_组合,字母开头,字母数字结尾"}]},pwd:{identifier:"pwd",rules:[{type:"empty"},{type:"minLength[8]"}]},name:{identifier:"name",rules:[{type:"empty"},{type:"maxLength[20]"}]},mail:{identifier:"mail",rules:[{type:"empty"},{type:"email"}]}}})},e.prototype.okHandler=function(){var e=this;return $(this.fm).form("is valid")?(this.isReq=!0,void http.fetch("/free/user/register",{method:"post",body:json({username:this.username,pwd:this.pwd,name:this.name,mail:this.mail,baseUrl:utils.getBaseUrl(),path:wurl("path")})}).then(function(t){t.ok&&t.json().then(function(t){t.success?(toastr.success("注册成功,请通过接收到的激活邮件激活账户!"),_.delay(function(){window.location="/admin/login"},2e3)):(toastr.error(t.data,"注册失败!"),e.isReq=!1)})})):void toastr.error("账户注册信息输入不合法!")},e}()}),define("resources/attributes/attr-attr",["exports","aurelia-framework","aurelia-dependency-injection"],function(e,t,n){"use strict";function i(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.AttrAttr=void 0;var o,s,l,c,d,u;e.AttrAttr=(o=(0,t.customAttribute)("attr"),s=(0,n.inject)(Element),o(l=s((c=function(){function e(t){r(this,e),i(this,"name",d,this),i(this,"value",u,this),this.element=t}return e.prototype.nameChanged=function(e){},e.prototype.valueChanged=function(e){this.value=e,e?$(this.element).attr(this.name,e):$(this.element).removeAttr(this.name)},e.prototype.bind=function(e){this.valueChanged(this.value)},e.prototype.unbind=function(){},e}(),d=a(c.prototype,"name",[t.bindable],{enumerable:!0,initializer:null}),u=a(c.prototype,"value",[t.bindable],{enumerable:!0,initializer:null}),l=c))||l)||l)}),define("resources/attributes/attr-autosize",["exports","aurelia-framework","aurelia-templating"],function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.AttrAutosize=void 0;var r,a,o;e.AttrAutosize=(r=(0,n.customAttribute)("autosize"),a=(0,t.inject)(Element),r(o=a(o=function(){function e(t){i(this,e),this.element=t}return e.prototype.valueChanged=function(e,t){autosize(this.element)},e.prototype.bind=function(e){this.valueChanged(this.value)},e.prototype.unbind=function(){autosize.destroy(this.elements)},e}())||o)||o)}),define("resources/attributes/attr-c2c",["exports","aurelia-framework","clipboard"],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.AttrC2cCustomAttribute=void 0;var a,o,s,l=i(n);e.AttrC2cCustomAttribute=(a=(0,t.customAttribute)("c2c"),o=(0,t.inject)(Element),a(s=o(s=function(){function e(t){r(this,e),this.element=t,this._init()}return e.prototype._init=function(){var e=this;$(this.element).append(''),this.clipboard=new l.default($(this.element).find("i.copy.icon")[0],{text:function(t){return e.value?e.value:$(e.element).text()}});var t=$(this.element).find("[data-tooltip]").hover(function(){},function(){$(this).attr("data-tooltip","复制到剪贴板!")});this.clipboard.on("success",function(e){t.attr("data-tooltip","复制成功!")}).on("error",function(e){t.attr("data-tooltip","复制失败!")}),$(this.element).hover(function(){(e.value||$(e.element).text())&&t.show()},function(){t.hide()})},e.prototype.unbind=function(){this.clipboard&&this.clipboard.destroy()},e}())||s)||s)}),define("resources/attributes/attr-dimmer",["exports","aurelia-dependency-injection","aurelia-templating"],function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.AttrDimmer=void 0;var r,a,o;e.AttrDimmer=(r=(0,n.customAttribute)("dimmer"),a=(0,t.inject)(Element),r(o=a(o=function(){function e(t){i(this,e),this.element=t,this.$dimmer=$('详情内容
\n详情内容
\n'+e.title+"吗?",onapprove:function(){$.post("/admin/channel/join",{id:e.id},function(t){t.success?(toastr.success("加入频道成功!"),e.joined=!0,ea.publish(nsCons.EVENT_CHAT_CHANNEL_JOINED,{channel:t.data})):toastr.error(t.data,"加入频道失败!")})}})},e.prototype.leaveHandler=function(e){this.confirmMd.show({content:'确定要离开频道'+e.title+"吗?",onapprove:function(){$.post("/admin/channel/leave",{id:e.id},function(t){t.success?(toastr.success("离开频道成功!"),e.joined=!1,ea.publish(nsCons.EVENT_CHAT_CHANNEL_LEAVED,{channel:t.data})):toastr.error(t.data,"离开频道失败!")})}})},e}(),s=r(o.prototype,"loginUser",[t.bindable],{enumerable:!0,initializer:null}),a=o))||a}),define("resources/elements/em-chat-channel-link-mgr",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatChannelLinkMgr=void 0;var a,o,s,l;e.EmChatChannelLinkMgr=(0,t.containerless)((o=function(){function e(){i(this,e),n(this,"channel",s,this),n(this,"loginUser",l,this),this.links=[]}return e.prototype.channelChanged=function(e,t){var n=this;this.channel&&$.get("/admin/link/listBy",{channelId:this.channel.id},function(e){e.success?n.links=e.data:n.links=[]})},e.prototype.addHandler=function(){var e=this;$.post("/admin/link/create",{title:this.title,href:this.href,channelId:this.channel.id},function(t,n,i){t.success?(e.title="",e.href="",e.links.push(t.data),ea.publish(nsCons.EVENT_CHANNEL_LINKS_REFRESH,{})):toastr.error(t.data)})},e.prototype.delHandler=function(e){var t=this;$.post("/admin/link/delete",{id:e.id},function(n,i,r){n.success?(t.links=_.reject(t.links,{id:e.id}),ea.publish(nsCons.EVENT_CHANNEL_LINKS_REFRESH,{}),toastr.success("删除成功!")):toastr.error(n.data)})},e.prototype.editHandler=function(e){e.oldTitle=e.title,e.oldHref=e.href,e.isEditing=!0},e.prototype.updateHandler=function(e){$.post("/admin/link/update",{id:e.id,title:e.title,href:e.href},function(t,n,i){t.success?(e.isEditing=!1,ea.publish(nsCons.EVENT_CHANNEL_LINKS_REFRESH,{}),toastr.success("更新成功!")):toastr.error(t.data)})},e.prototype.showHandler=function(){this._reset()},e.prototype._reset=function(){},e.prototype.attached=function(){},e.prototype.show=function(){this.emModal.show({autoDimmer:!1})},e.prototype.approveHandler=function(e){},e}(),s=r(o.prototype,"channel",[t.bindable],{enumerable:!0,initializer:null}),l=r(o.prototype,"loginUser",[t.bindable],{enumerable:!0,initializer:null}),a=o))||a}),define("resources/elements/em-chat-channel-members-mgr",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatChannelMembersMgr=void 0;var a,o,s,l;e.EmChatChannelMembersMgr=(0,t.containerless)((o=function(){function e(){var t=this;i(this,e),n(this,"channel",s,this),n(this,"users",l,this),this.membersOpts={onAdd:function(e,n,i){t.emModal.showDimmer(),$.post("/admin/channel/addMember",{id:t.channel.id,members:e,baseUrl:utils.getBaseUrl(),path:wurl("path")},function(e,n,i){e.success?(toastr.success("添加成员成功!"),t.channel.members=e.data.members,ea.publish(nsCons.EVENT_CHAT_CHANNEL_MEMBER_ADD_OR_REMOVE,{type:"add",members:e.data.members})):toastr.error(e.data,"添加成员失败!")}).always(function(){t.emModal.hideDimmer()})},onLabelRemove:function(e){return t.channel.owner.username!=e&&(t.emModal.showDimmer(),void $.post("/admin/channel/removeMember",{id:t.channel.id,members:e,baseUrl:utils.getBaseUrl(),
-path:wurl("path")},function(e,n,i){e.success?(toastr.success("移除成员成功!"),t.channel.members=e.data.members,ea.publish(nsCons.EVENT_CHAT_CHANNEL_MEMBER_ADD_OR_REMOVE,{type:"remove",members:e.data.members})):toastr.error(e.data,"移除成员失败!")}).always(function(){t.emModal.hideDimmer()}))}}}return e.prototype.channelChanged=function(){var e=this;this.channel&&!function(){var t=_.sortBy(_.map(e.channel.members,"username"));_.defer(function(){$(e.membersRef).dropdown().dropdown("clear").dropdown("set selected",t).dropdown(e.membersOpts)})}()},e.prototype.attached=function(){},e.prototype.initMembersUI=function(e){var t=this;e&&_.defer(function(){t.channelChanged()})},e.prototype.showHandler=function(){$(this.membersRef).dropdown().dropdown("clear"),this.channelChanged()},e.prototype.approveHandler=function(e){},e.prototype.show=function(){this.emModal.show({hideOnApprove:!0,autoDimmer:!1})},e}(),s=r(o.prototype,"channel",[t.bindable],{enumerable:!0,initializer:null}),l=r(o.prototype,"users",[t.bindable],{enumerable:!0,initializer:null}),a=o))||a}),define("resources/elements/em-chat-channel-members-show",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatChannelMembersShow=void 0;var a,o,s;e.EmChatChannelMembersShow=(0,t.containerless)((o=function(){function e(){i(this,e),n(this,"channel",s,this)}return e.prototype.showHandler=function(){},e.prototype.approveHandler=function(e){},e.prototype.show=function(){this.emModal.show({hideOnApprove:!0,autoDimmer:!1})},e}(),s=r(o.prototype,"channel",[t.bindable],{enumerable:!0,initializer:null}),a=o))||a}),define("resources/elements/em-chat-content-item",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatContentItem=void 0;var a,o,s,l,c,d,u,m,p;e.EmChatContentItem=(a=(0,t.bindable)({defaultBindingMode:t.bindingMode.twoWay}),(0,t.containerless)((s=function(){function e(){var t=this;i(this,e),n(this,"chats",l,this),n(this,"loginUser",c,this),n(this,"isAt",d,this),n(this,"channel",u,this),n(this,"markId",m,this),n(this,"chatTo",p,this),this.members=[],this.basePath=utils.getBasePath(),this.subscribe=ea.subscribe(nsCons.EVENT_CHAT_CHANNEL_MEMBER_ADD_OR_REMOVE,function(e){t.members=[nsCtx.memberAll].concat(e.members)})}return e.prototype.unbind=function(){this.subscribe.dispose()},e.prototype.attached=function(){var e=this;$(".tms-chat-direct").on("click",".markdown-body .at-user",function(e){e.preventDefault(),ea.publish(nsCons.EVENT_CHAT_MSG_INSERT,{content:"{~"+$(e.currentTarget).attr("data-value")+"} "})}),$(".tms-chat-direct").on("mouseenter",'.markdown-body a[href*="#/chat/"]:not(.pp-not)',function(e){e.preventDefault();var t=$(e.currentTarget);ea.publish(nsCons.EVENT_CHAT_MSG_POPUP_SHOW,{id:utils.urlQuery("id",t.attr("href")),target:e.currentTarget})}),$(".tms-chat-direct").on("mouseenter",".tms-content-body .em-chat-content-item",function(e){e.preventDefault();var t=$(e.currentTarget);ea.publish(nsCons.EVENT_CHAT_MSG_WIKI_DIR,{dir:utils.dir(t.find("> .content > .markdown-body"))})}),$(".tms-chat-direct").on("click",".panel-wiki-dir .wiki-dir-item",function(e){e.preventDefault(),ea.publish(nsCons.EVENT_CHAT_CONTENT_SCROLL_TO,{target:$("#"+$(e.currentTarget).attr("data-id"))})}),$(".tms-chat-direct").on("mouseenter","span[data-value].at-user:not(.pp-not),a[data-value].author:not(.pp-not)",function(t){t.preventDefault();var n=$(t.currentTarget);ea.publish(nsCons.EVENT_CHAT_MEMBER_POPUP_SHOW,{channel:e.channel,username:n.attr("data-value"),target:t.currentTarget})}),this.initHotkeys()},e.prototype.channelChanged=function(){this.channel?this.members=[nsCtx.memberAll].concat(this.channel.members):this.members=[]},e.prototype.deleteHandler=function(e){var t=this;this.emConfirmModal.show({onapprove:function(){var n=void 0;n=t.isAt?"/admin/chat/direct/delete":"/admin/chat/channel/delete",$.post(n,{id:e.id},function(n,i,r){n.success?(t.chats=_.reject(t.chats,{id:e.id}),toastr.success("删除消息成功!")):toastr.error(n.data,"删除消息失败!")})}})},e.prototype.initHotkeys=function(){var e=this;$(document).bind("keydown","e",function(t){t.preventDefault();var n=_.findLast(e.chats,function(t){return t.creator.username==e.loginUser.username});n&&e.editHandler(n,$('.em-chat-content-item[data-id="'+n.id+'"]').find("> .content > textarea"))})},e.prototype.editHandler=function(e,t){$.get("/admin/chat/"+(this.isAt?"direct":"channel")+"/get",{id:e.id},function(n){n.success?(e.version!=n.data.version&&_.extend(e,n.data),e.isEditing=!0,e.contentOld=e.content,_.defer(function(){$(t).focus().select(),autosize.update(t)})):toastr.error(n.data)})},e.prototype.editOkHandler=function(e,t,n){this.editSave(t,n),t.isEditing=!1},e.prototype.editCancelHandler=function(e,t,n){t.content=t.contentOld,$(n).val(t.content),t.isEditing=!1},e.prototype.editSave=function(e,t){var n=this;this.sending=!0,e.content=$(t).val();var i=(utils.md2html(e.content),utils.md2html(e.contentOld),void 0),r=void 0;this.isAt?(i="/admin/chat/direct/update",r={baseUrl:utils.getBaseUrl(),path:wurl("path"),id:e.id,content:e.content,diff:utils.diffS(e.contentOld,e.content)}):(i="/admin/chat/channel/update",r={url:utils.getUrl(),id:e.id,version:e.version,usernames:utils.parseUsernames(e.content,this.members).join(","),content:e.content,diff:utils.diffS(e.contentOld,e.content)}),$.post(i,r,function(t,n,i){t.success?(toastr.success("更新消息成功!"),e.isEditing=!1,e.version=t.data.version):toastr.error(t.data,"更新消息失败!")}).always(function(){n.sending=!1})},e.prototype.eidtKeydownHandler=function(e,t,n){return!this.sending&&(e.ctrlKey&&13===e.keyCode?(this.editSave(t,n),!1):e.ctrlKey&&85===e.keyCode?($(n).next(".tms-edit-actions").find(".upload").click(),!1):(27===e.keyCode&&this.editCancelHandler(e,t,n),!0))},e.prototype.notifyRendered=function(e,t){e&&_.defer(function(){ea.publish(nsCons.EVENT_CHAT_LAST_ITEM_RENDERED,{item:t})})},e.prototype.stowHandler=function(e){$.post("/admin/chat/channel/stow",{id:e.id},function(e,t,n){e.success?toastr.success("收藏消息成功!"):toastr.error(e.data,"收藏消息失败!")})},e.prototype.openEditHandler=function(e){$.post("/admin/chat/channel/openEdit",{id:e.id,open:!e.openEdit},function(t,n,i){t.success?(e.openEdit=!e.openEdit,toastr.success((e.openEdit?"开启":"关闭")+"协作编辑成功!")):toastr.success((e.openEdit?"关闭":"开启")+"协作编辑失败!")})},e.prototype.replyHandler=function(e){ea.publish(nsCons.EVENT_CHAT_MSG_INSERT,{content:"[[回复#"+e.id+"]("+utils.getUrl()+"?id="+e.id+"){~"+e.creator.username+"}]\n\n"}),$.post("/admin/chat/channel/markAsReadedByChat",{chatId:e.id})},e.prototype.creatorNameHandler=function(e){ea.publish(nsCons.EVENT_CHAT_MSG_INSERT,{content:"{~"+e.creator.username+"} "})},e.prototype.refreshHandler=function(e){$.get("/admin/chat/channel/get",{id:e.id},function(t){e.version!=t.data.version?(_.extend(e,t.data),toastr.success("刷新同步成功!")):toastr.info("消息内容暂无变更!")})},e.prototype.likeHandler=function(e,t){t&&e.isZanVoted||!t&&e.isCaiVoted||$.post("/admin/chat/channel/vote",{id:e.id,url:utils.getUrl(),contentHtml:utils.md2html(e.content),type:t?"Zan":"Cai"},function(n,i,r){n.success?(_.extend(e,n.data),t?e.isZanVoted=!0:e.isCaiVoted=!0):toastr.error(n.data)})},e}(),l=r(s.prototype,"chats",[a],{enumerable:!0,initializer:null}),c=r(s.prototype,"loginUser",[t.bindable],{enumerable:!0,initializer:null}),d=r(s.prototype,"isAt",[t.bindable],{enumerable:!0,initializer:null}),u=r(s.prototype,"channel",[t.bindable],{enumerable:!0,initializer:null}),m=r(s.prototype,"markId",[t.bindable],{enumerable:!0,initializer:null}),p=r(s.prototype,"chatTo",[t.bindable],{enumerable:!0,initializer:null}),o=s))||o)}),define("resources/elements/em-chat-input",["exports","aurelia-framework","common/common-tips","common/common-emoji","simplemde","textcomplete"],function(e,t,n,i,r){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatInput=void 0;var c,d,u,m,p,g=a(n),h=a(i),b=a(r);e.EmChatInput=(0,t.containerless)((d=function(){function e(){var t=this;s(this,e),o(this,"chatTo",u,this),o(this,"isAt",m,this),o(this,"channel",p,this),this.members=[],this.isMobile=utils.isMobile(),this.subscribe=ea.subscribe(nsCons.EVENT_SHOW_HOTKEYS_MODAL,function(e){t.emHotkeysModal.show()}),this.subscribe1=ea.subscribe(nsCons.EVENT_CHAT_CHANNEL_MEMBER_ADD_OR_REMOVE,function(e){t.members=[nsCtx.memberAll].concat(e.members)}),this.subscribe2=ea.subscribe(nsCons.EVENT_CHAT_MSG_INSERT,function(e){t.insertContent(e.content)})}return e.prototype.channelChanged=function(){this.channel?this.members=[nsCtx.memberAll].concat(this.channel.members):this.members=[]},e.prototype.unbind=function(){this.subscribe.dispose(),this.subscribe1.dispose(),this.subscribe2.dispose()},e.prototype.initHotkeys=function(){var e=this;$(document).bind("keydown","r",function(){event.preventDefault(),e.simplemde.codemirror.focus()})},e.prototype.attached=function(){this.initSimpleMDE(this.chatInputRef),this.initDropzone(),this.initPaste(),this.initHotkeys()},e.prototype.initPaste=function(){var e=this,t=void 0;t=this.$chatMsgInputRef.is("textarea")?$(this.$chatMsgInputRef).pastableTextarea():$(this.$chatMsgInputRef).pastableContenteditable(),t&&t.on("pasteImage",function(t,n){$.post("/admin/file/base64",{dataURL:n.dataURL,type:n.blob.type,toType:nsCtx.isAt?"User":"Channel",toId:nsCtx.chatTo},function(t,n,i){t.success&&e.insertContent("".replace(/\{name\}/g,t.data.name).replace(/\{baseURL\}/g,utils.getBaseUrl()+"/").replace(/\{path\}/g,t.data.path).replace(/\{uuidName\}/g,t.data.uuidName))})}).on("pasteImageError",function(e,t){toastr.error(t.message,"剪贴板粘贴图片错误!")})},e.prototype.initDropzone=function(){var e=this;this.initUploadDropzone($(".CodeMirror-wrap",this.inputRef),function(){return e.$chatMsgInputRef},!1),this.initUploadDropzone($(this.btnItemUploadRef).children().andSelf(),function(){return e.$chatMsgInputRef},!0),$(this.chatBtnRef).popup({inline:!0,hoverable:!0,position:"bottom left",delay:{show:300,hide:300}})},e.prototype.initUploadDropzone=function(e,t,n){var i=this;$(e).dropzone({url:"/admin/file/upload",paramName:"file",clickable:!!n,dictDefaultMessage:"",maxFilesize:10,addRemoveLinks:!0,previewsContainer:this.chatStatusBarRef,previewTemplate:this.previewTemplateRef.innerHTML,dictCancelUpload:"取消上传",dictCancelUploadConfirmation:"确定要取消上传吗?",dictFileTooBig:"文件过大({{filesize}}M),最大限制:{{maxFilesize}}M",init:function(){this.on("sending",function(e,n,i){t()?(i.append("toType",nsCtx.isAt?"User":"Channel"),i.append("toId",nsCtx.chatTo)):this.removeAllFiles(!0)}),this.on("success",function(e,t){t.success?($.each(t.data,function(e,t){"Image"==t.type?i.insertContent(" ".replace(/\{name\}/g,t.name).replace(/\{baseURL\}/g,utils.getBaseUrl()+"/").replace(/\{path\}/g,t.path).replace(/\{uuidName\}/g,t.uuidName)):i.insertContent("[{name}]({baseURL}{path}{uuidName}) ".replace(/\{name\}/g,t.name).replace(/\{baseURL\}/g,utils.getBaseUrl()+"/").replace(/\{path\}/g,"admin/file/download/").replace(/\{uuidName\}/g,t.id))}),toastr.success("上传成功!")):toastr.error(t.data,"上传失败!")}),this.on("error",function(e,t,n){toastr.error(t,"上传失败!")}),this.on("complete",function(e){this.removeFile(e)})}})},e.prototype.initSimpleMDE=function(e){var t=this;this.simplemde=new b.default({element:e,spellChecker:!1,status:!1,autofocus:!0,toolbar:!1,autoDownloadFontAwesome:!1,insertTexts:{table:["","\n\n| 列1 | 列2 | 列3 |\n| ------ | ------ | ------ |\n| 文本 | 文本 | 文本 |\n\n"]},previewRender:function(e,n){return t.simplemde.markdown(utils.preParse(e))}}),this.$chatMsgInputRef=$(this.inputRef).find(".textareaWrapper .CodeMirror textarea"),0===this.$chatMsgInputRef.size()&&(this.$chatMsgInputRef=$(this.inputRef).find('.textareaWrapper .CodeMirror [contenteditable="true"]')),this.initTextcomplete()},e.prototype.initTextcomplete=function(){var e=this;$(this.$chatMsgInputRef).textcomplete([{match:/(|\b)(\/.*)$/,search:function(e,t){var n=_.keys(g.default);t($.map(n,function(t){return 0===t.indexOf(e)?t:null}))},template:function(e,t){return g.default[e].label},replace:function(t){return e.tipsActionHandler(t)?(e.setCaretPosition(g.default[t].line,g.default[t].ch),"$1"+g.default[t].value):""}},{match:/(^|\s)@(\w*)$/,search:function(t,n){n($.map(e.members,function(e){return e.enabled&&e.username.indexOf(t)>=0?e.username:null}))},template:function(t,n){var i=_.find(e.members,{username:t});return i.name+" - "+i.mails+" ("+i.username+")"},replace:function(e){return"$1{~"+e+"}"}},{match:/(^|\s):([\+\-\w]*)$/,search:function(e,t){t($.map(h.default,function(t){return _.some(t.split("_"),function(t){return 0===t.indexOf(e)})?t:null}))},template:function(e,t){if("search"==e)return"表情查找 - :search";var n=":"+e+":";return emojify.replace(n)+" - "+n},replace:function(t){return e.tipsActionHandler(t)?"$1:"+t+": ":""}}],{appendTo:".tms-chat-status-bar",maxCount:nsCons.NUM_TEXT_COMPLETE_MAX_COUNT}),this.simplemde.codemirror.on("keydown",function(t,n){_.includes([13,38,40],n.keyCode)&&e.isTipsShow()?n.preventDefault():n.ctrlKey&&13===n.keyCode?e.sendChatMsg():27===n.keyCode?e.simplemde.value(""):n.ctrlKey&&85==n.keyCode?$(e.btnItemUploadRef).find(".content").click():n.ctrlKey&&191==n.keyCode&&e.emHotkeysModal.show()})},e.prototype.setCaretPosition=function(e,t){var n=this;(e||t)&&_.delay(function(){var i=n.simplemde.codemirror.getCursor();n.simplemde.codemirror.setCursor({line:i.line-(e?e:0),ch:i.line?t?t:0:i.ch-(t?t:0)})},100)},e.prototype.sendChatMsg=function(){var e=this,t=this.simplemde.value();if(!$.trim(t))return void this.simplemde.value("");if(!this.sending){this.sending=!0;var n=utils.md2html(t),i=void 0,r=void 0;this.isAt?(i="/admin/chat/direct/create",r={baseUrl:utils.getBaseUrl(),path:wurl("path"),chatTo:this.chatTo,content:t,contentHtml:n}):(i="/admin/chat/channel/create",r={url:utils.getUrl(),channelId:this.channel.id,usernames:utils.parseUsernames(t,this.members).join(","),content:t,contentHtml:n}),$.post(i,r,function(t,n,i){t.success?(e.simplemde.value(""),ea.publish(nsCons.EVENT_CHAT_MSG_SENDED,{data:t})):toastr.error(t.data,"发送消息失败!")}).always(function(){e.sending=!1})}},e.prototype.sendChatMsgHandler=function(){this.sendChatMsg()},e.prototype.isTipsShow=function(){return 1===$(this.chatStatusBarRef).find(".textcomplete-dropdown:visible").size()},e.prototype.insertContent=function(e,t){try{var n=t?t.codemirror:this.simplemde.codemirror,i=n.getCursor();i&&(n.replaceRange(e,i,i),n.focus())}catch(e){console.log(e)}},e.prototype.tipsActionHandler=function(e){if("/upload"==e)$(this.btnItemUploadRef).find(".content").click();else if("/shortcuts"==e)this.emHotkeysModal.show();else{if("search"!=e)return!0;_.delay(function(){utils.openNewWin(nsCons.STR_EMOJI_SEARCH_URL)},200)}return!1},e}(),u=l(d.prototype,"chatTo",[t.bindable],{enumerable:!0,initializer:null}),m=l(d.prototype,"isAt",[t.bindable],{enumerable:!0,initializer:null}),p=l(d.prototype,"channel",[t.bindable],{enumerable:!0,initializer:null}),c=d))||c}),define("resources/elements/em-chat-member-popup",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatMemberPopup=void 0;var i;e.EmChatMemberPopup=(0,t.containerless)(i=function(){function e(){var t=this;n(this,e),this.members=[],this.member={},this.subscribe=ea.subscribe(nsCons.EVENT_CHAT_MEMBER_POPUP_SHOW,function(e){if(t.channel=e.channel,t.username=e.username,t.target=e.target,"all"==t.username){if(!t.channel)return;t.members=t.channel.members}else{t.member=utils.getUser(t.username);var n=utils.getUser(t.member.creator);t.member.creatorName=n&&n.name?n.name:t.member.creator}_.defer(function(){$(t.target).popup({popup:t.popup,hoverable:!0,inline:!1,silent:!0,movePopup:!1,position:"bottom left",jitter:300,prefer:"opposite",delay:{show:300,hide:300}}).popup("show")})})}return e.prototype.unbind=function(){this.subscribe.dispose()},e}())||i}),define("resources/elements/em-chat-msg-popup",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatMsgPopup=void 0;var i;e.EmChatMsgPopup=(0,t.containerless)(i=function(){function e(){var t=this;n(this,e),this.subscribe=ea.subscribe(nsCons.EVENT_CHAT_MSG_POPUP_SHOW,function(e){t.id=e.id,t.target=e.target,$(t.target).popup({popup:t.popup,hoverable:!0,inline:!1,movePopup:!1,silent:!0,position:"bottom left",jitter:300,prefer:"opposite",delay:{show:300,hide:300},onShow:function(){$.get("/admin/chat/channel/get",{id:t.id},function(e){e.success?t.chatMsg=e.data:toastr.error(e.data,"加载失败!")})}}).popup("show")})}return e.prototype.unbind=function(){this.subscribe.dispose()},e}())||i}),define("resources/elements/em-chat-schedule-edit",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatScheduleEdit=void 0;var a,o,s;e.EmChatScheduleEdit=(0,t.containerless)((o=function(){function e(){var t=this;i(this,e),n(this,"loginUser",s,this),this.actorsOpts={onAdd:function(e,n,i){$.post("/admin/schedule/addActors",{id:t.event.id,basePath:utils.getBasePath(),actors:e},function(e,t,n){e.success?(toastr.success("添加参与者成功!"),ea.publish(nsCons.EVENT_SCHEDULE_REFRESH,{})):toastr.error(e.data)})},onLabelRemove:function(e){return t.loginUser.username!=e&&void $.post("/admin/schedule/removeActors",{id:t.event.id,basePath:utils.getBasePath(),actors:e},function(e,t,n){e.success?(toastr.success("移除参与者成功!"),ea.publish(nsCons.EVENT_SCHEDULE_REFRESH,{})):toastr.error(e.data)})}}}return e.prototype.attached=function(){$(this.startRef).calendar({today:!0,endCalendar:$(this.endRef)}),$(this.endRef).calendar({today:!0,startCalendar:$(this.startRef)})},e.prototype.initMembersUI=function(e){var t=this;e&&_.defer(function(){var e=[t.loginUser.username];t.event&&(e=_.map(t.event.actors,"username")),$(t.actorsRef).dropdown().dropdown("clear").dropdown("set selected",e).dropdown(t.actorsOpts)})},e.prototype.titleKeyupHandler=function(e){e.ctrlKey&&13===e.keyCode&&this.updateHandler()},e.prototype.clearStartDateHandler=function(){$(this.startRef).calendar("clear")},e.prototype.clearEndDateHandler=function(){$(this.endRef).calendar("clear")},e.prototype.show=function(e){this.event=_.clone(e),this.showHandler(),$(this.scheduleEditRef).popup({on:"click",inline:!0,silent:!0,position:"bottom center",jitter:300,prefer:"opposite",delay:{show:300,hide:300}}).popup("show")},e.prototype.showHandler=function(){var e=this;this.users=window.tmsUsers,$(this.actorsRef).dropdown().dropdown("clear"),_.defer(function(){e.event.start?$(e.startRef).calendar("set date",e.event.start.toDate()):$(e.startRef).calendar("clear"),e.event.end?$(e.endRef).calendar("set date",e.event.end.toDate()):$(e.endRef).calendar("clear");var t=_.map(e.event.actors,"username");$(e.actorsRef).dropdown("set selected",t).dropdown(e.actorsOpts),e.event.creator.username==e.loginUser.username&&$(e.titleRef).focus(),autosize.update(e.titleRef)})},e.prototype.updateHandler=function(){var e=this;if(!this.event.title)return void toastr.error("日程内容不能为空!");var t={id:this.event.id,basePath:utils.getBasePath(),title:this.event.title},n=$(this.startRef).calendar("get date"),i=$(this.endRef).calendar("get date");n?t.startDate=n:t.startDate=new Date,i&&(t.endDate=i),$.post("/admin/schedule/update2",t,function(t,n,i){t.success?(toastr.success("更新日程成功!"),$(e.scheduleEditRef).popup("hide"),ea.publish(nsCons.EVENT_SCHEDULE_REFRESH,{})):toastr.error(t.data)})},e.prototype.delHandler=function(){var e=this;this.emConfirmModal.show({onapprove:function(){$.post("/admin/schedule/delete",{id:e.event.id,basePath:utils.getBasePath()},function(e,t,n){e.success?(toastr.success("日程删除成功!"),ea.publish(nsCons.EVENT_SCHEDULE_REFRESH,{})):toastr.error(e.data)})}})},e}(),s=r(o.prototype,"loginUser",[t.bindable],{enumerable:!0,initializer:null}),a=o))||a}),define("resources/elements/em-chat-schedule-remind",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatScheduleRemind=void 0;var a,o,s;e.EmChatScheduleRemind=(0,t.containerless)((o=function(){function e(){i(this,e),n(this,"events",s,this),this.interval=5e3,this.headOffset=6e5,this.reminded=[],this._pollCheck()}return e.prototype.unbind=function(){this.timer&&clearInterval(this.timer)},e.prototype._pollCheck=function(){var e=this;this.timer=setInterval(function(){if(e.events){var t=(new Date).getTime();_.each(e.events,function(n){if(n.start&&!_.includes(e.reminded,n.id)){var i=n.start;i>t&&i'+e.title+"吗?",onapprove:function(){$.post("/admin/channel/leave",{id:e.id},function(e){e.success?(toastr.success("离开频道成功!"),ea.publish(nsCons.EVENT_CHAT_CHANNEL_LEAVED,{channel:e.data})):toastr.error(e.data,"离开频道失败!")})}})},e.prototype.switchHandler=function(){ea.publish(nsCons.EVENT_SWITCH_CHAT_TO,{})},e.prototype.addChannelLinkHandler=function(e){this.sysLinkMgrVm.show()},e}(),s=r(o.prototype,"users",[t.bindable],{enumerable:!0,initializer:null}),l=r(o.prototype,"loginUser",[t.bindable],{enumerable:!0,initializer:null}),c=r(o.prototype,"channels",[t.bindable],{enumerable:!0,initializer:null}),d=r(o.prototype,"chatTo",[t.bindable],{enumerable:!0,initializer:null}),u=r(o.prototype,"isAt",[t.bindable],{enumerable:!0,initializer:null}),a=o))||a}),define("resources/elements/em-chat-sidebar-right",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatSidebarRight=void 0;var a,o,s,l,c;e.EmChatSidebarRight=(0,t.containerless)((o=function(){function e(){var t,r=this;i(this,e),this.last=!0,n(this,"loginUser",s,this),n(this,"isAt",l,this),n(this,"channel",c,this),this.forAction="",this.forShow="",this.basePath=utils.getBasePath(),this.headerMapping=(t={},t[nsCons.ACTION_TYPE_SEARCH]="无符合检索结果",t[nsCons.ACTION_TYPE_AT]="暂无@消息",t[nsCons.ACTION_TYPE_STOW]="暂无收藏消息",t),this.subscribe=ea.subscribe(nsCons.EVENT_CHAT_SEARCH_RESULT,function(e){r._mappingActionShow(e.action);var t=e.result;r.search=e.search,r.page=t,r.chats=t.content,r.last=t.last,r.moreCnt=t.totalElements-(t.number+1)*t.size}),this.subscribe2=ea.subscribe(nsCons.EVENT_CHAT_SHOW_AT,function(e){r._mappingActionShow(e.action);var t=e.result;r.page=t,r.chats=_.map(t.content,function(e){var t=e.chatChannel;return t.chatAt=e,t}),r.last=t.last,r.moreCnt=t.totalElements-(t.number+1)*t.size}),this.subscribe1=ea.subscribe(nsCons.EVENT_CHAT_SHOW_STOW,function(e){r._mappingActionShow(e.action),r.chats=e.result,r.last=!0}),this.subscribe3=ea.subscribe(nsCons.EVENT_CHAT_SHOW_DIR,function(e){r._mappingActionShow(e.action),$(r.dirRef).empty().append(e.result)}),this.subscribe4=ea.subscribe(nsCons.EVENT_CHAT_SHOW_ATTACH,function(e){r._mappingActionShow(e.action)}),this.subscribe5=ea.subscribe(nsCons.EVENT_CHAT_SHOW_SCHEDULE,function(e){r._mappingActionShow(e.action)})}return e.prototype.unbind=function(){this.subscribe.dispose(),this.subscribe1.dispose(),this.subscribe2.dispose(),this.subscribe3.dispose(),this.subscribe4.dispose(),this.subscribe5.dispose()},e.prototype._mappingActionShow=function(e){this.forAction=e,_.includes([nsCons.ACTION_TYPE_SEARCH,nsCons.ACTION_TYPE_STOW,nsCons.ACTION_TYPE_AT],this.forAction)?this.forShow="chat-msg":_.includes([nsCons.ACTION_TYPE_DIR],this.forAction)?this.forShow="wiki-dir":_.includes([nsCons.ACTION_TYPE_ATTACH],this.forAction)?(this.forShow="chat-attach",this.chatAttachVm.fetch()):_.includes([nsCons.ACTION_TYPE_SCHEDULE],this.forAction)&&(this.forShow="chat-schedule",this.chatScheduleVm.show())},e.prototype.attached=function(){this.initHotkeys()},e.prototype.initHotkeys=function(){var e=this;$(document).bind("keydown","o",function(t){t.preventDefault();var n=_.find(e.chats,{isHover:!0});n&&(n.isOpen=!n.isOpen)})},e.prototype.searchItemMouseleaveHandler=function(e){e.isOpen=!1,e.isHover=!1},e.prototype.searchItemMouseenterHandler=function(e){e.isHover=!0},e.prototype.gotoChatHandler=function(e){ea.publish(nsCons.EVENT_CHAT_SEARCH_GOTO_CHAT_ITEM,{chatItem:e})},e.prototype.openSearchItemHandler=function(e){e.isOpen=!e.isOpen},e.prototype.searchMoreHandler=function(){var e=this;this.forAction==nsCons.ACTION_TYPE_SEARCH?this.searchMoreP=$.get("/admin/chat/direct/search",{search:this.search,size:this.page.size,page:this.page.number+1},function(t){t.success&&(e.chats=_.concat(e.chats,t.data.content),e.page=t.data,e.last=t.data.last,e.moreCnt=t.data.totalElements-(t.data.number+1)*t.data.size)}):this.searchMoreP=$.get("/admin/chat/channel/getAts",{size:this.page.size,page:this.page.number+1},function(t){t.success&&(e.chats=_.concat(e.chats,_.map(t.data.content,function(e){var t=e.chatChannel;return t.chatAt=e,t})),e.page=t.data,e.last=t.data.last,e.moreCnt=t.data.totalElements-(t.data.number+1)*t.data.size)})},e.prototype.removeStowHandler=function(e){var t=this;$.post("/admin/chat/channel/removeStow",{id:e.chatStow.id},function(n,i,r){n.success?(t.chats=_.reject(t.chats,{id:e.id}),toastr.success("移除收藏消息成功!")):toastr.error(n.data,"移除收藏消息失败!")})},e.prototype.removeAtHandler=function(e){var t=this;$.post("/admin/chat/channel/markAsReaded",{chatAtId:e.chatAt.id},function(n,i,r){n.success?t.chats=_.reject(t.chats,{id:e.id}):toastr.error(n.data,"移除@消息失败!")})},e}(),s=r(o.prototype,"loginUser",[t.bindable],{enumerable:!0,initializer:null}),l=r(o.prototype,"isAt",[t.bindable],{enumerable:!0,initializer:null}),c=r(o.prototype,"channel",[t.bindable],{enumerable:!0,initializer:null}),a=o))||a}),define("resources/elements/em-chat-system-link-mgr",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatSystemLinkMgr=void 0;var i;e.EmChatSystemLinkMgr=(0,t.containerless)(i=function(){function e(){n(this,e),this.links=[]}return e.prototype.addHandler=function(){var e=this;$.post("/admin/link/create",{title:this.title,href:this.href,type:"App"},function(t,n,i){t.success?(e.title="",e.href="",e.links.push(t.data),ea.publish(nsCons.EVENT_SYSTEM_LINKS_REFRESH,{})):toastr.error(t.data)})},e.prototype.delHandler=function(e){var t=this;$.post("/admin/link/delete",{id:e.id},function(n,i,r){n.success?(t.links=_.reject(t.links,{id:e.id}),ea.publish(nsCons.EVENT_SYSTEM_LINKS_REFRESH,{}),toastr.success("删除成功!")):toastr.error(n.data)})},e.prototype.editHandler=function(e){e.oldTitle=e.title,e.oldHref=e.href,e.isEditing=!0},e.prototype.updateHandler=function(e){$.post("/admin/link/update",{id:e.id,title:e.title,href:e.href},function(t,n,i){t.success?(e.isEditing=!1,ea.publish(nsCons.EVENT_SYSTEM_LINKS_REFRESH,{}),toastr.success("更新成功!")):toastr.error(t.data)})},e.prototype.showHandler=function(){var e=this;$.get("/admin/link/listByApp",function(t){t.success?e.links=t.data:e.links=[]})},e.prototype.show=function(){this.emModal.show({autoDimmer:!1})},e.prototype.approveHandler=function(e){},e}())||i}),define("resources/elements/em-chat-top-menu",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmChatTopMenu=void 0;var a,o,s,l,c,d,u,m,p,g,h;e.EmChatTopMenu=(0,t.containerless)((o=function(){function e(){var t=this;i(this,e),n(this,"loginUser",s,this),n(this,"chatUser",l,this),n(this,"users",c,this),n(this,"channels",d,this),n(this,"channel",u,this),n(this,"loginUser",m,this),n(this,"chatId",p,this),n(this,"chatTo",g,this),n(this,"isAt",h,this),this.isRightSidebarShow=!1,this.activeType="",this.ACTION_TYPE_SEARCH=nsCons.ACTION_TYPE_SEARCH,this.ACTION_TYPE_STOW=nsCons.ACTION_TYPE_STOW,this.ACTION_TYPE_AT=nsCons.ACTION_TYPE_AT,this.ACTION_TYPE_DIR=nsCons.ACTION_TYPE_DIR,this.ACTION_TYPE_ATTACH=nsCons.ACTION_TYPE_ATTACH,this.ACTION_TYPE_SCHEDULE=nsCons.ACTION_TYPE_SCHEDULE,this.countAt=null,this.newAtCnt=0,this.channelLinks=[],this.subscribe=ea.subscribe(nsCons.EVENT_CHAT_MSG_WIKI_DIR,function(e){t.dir=e.dir,t.activeType==t.ACTION_TYPE_DIR&&t.isRightSidebarShow&&ea.publish(nsCons.EVENT_CHAT_SHOW_DIR,{action:t.activeType,result:t.dir})}),this.subscribe1=ea.subscribe(nsCons.EVENT_CHAT_POLL_UPDATE,function(e){null!==t.countAt&&t.newAtCnt<=0&&(t.newAtCnt=e.countAt-t.countAt),t.countAt=e.countAt,t.countMyRecentSchedule=e.countMyRecentSchedule}),this.subscribe2=ea.subscribe(nsCons.EVENT_SWITCH_CHAT_TO,function(e){$(t.chatToDropdownRef).dropdown("toggle")}),this.subscribe3=ea.subscribe(nsCons.EVENT_CHANNEL_LINKS_REFRESH,function(e){t._refreshChannelLinks()})}return e.prototype.loginUserChanged=function(){this.loginUser&&(this.isSuper=utils.isSuperUser(this.loginUser))},e.prototype.chatToChanged=function(){$(this.chatToDropdownRef).dropdown("set selected",this.chatId).dropdown("hide")},e.prototype.channelChanged=function(){this._refreshChannelLinks()},e.prototype._refreshChannelLinks=function(){var e=this;this.channel&&$.get("/admin/link/listBy",{channelId:this.channel.id},function(t){t.success?e.channelLinks=t.data:e.channelLinks=[]})},e.prototype.unbind=function(){this.subscribe.dispose(),this.subscribe1.dispose(),this.subscribe2.dispose(),this.subscribe3.dispose()},e.prototype.attached=function(){this.initHotkeys(),this.initSearch()},e.prototype.initSearch=function(){var e=this,t=[];if(localStorage){var n=localStorage.getItem("tms/chat-direct:search");t=n?$.parseJSON(n):[]}this.searchSource=t,$(this.searchRef).search({source:t,onSelect:function(t,n){e.searchHandler()},onResults:function(){$(e.searchRef).search("hide results")}})},e.prototype.searchHandler=function(){var e=this;$(this.searchRef).search("hide results");var t=$(this.searchInputRef).val();if(!t||t.length<2)return void toastr.error("检索条件至少需要两个字符!");this.search=t;var n=!1;$.each(this.searchSource,function(e,i){if(i.title==t)return n=!0,!1}),n||(this.searchSource.splice(0,0,{title:t}),$(this.searchRef).search({source:_.clone(this.searchSource)})),localStorage&&localStorage.setItem("tms/chat-direct:search",JSON.stringify(this.searchSource));var i=void 0,r=void 0;this.isAt?(i="/admin/chat/direct/search",r={search:this.search,size:20,page:0}):(i="/admin/chat/channel/search",r={search:this.search,channelId:this.channel.id,size:20,page:0}),this.searchingP=$.get(i,r,function(t){t.success&&(e.toggleRightSidebar(!0),ea.publish(nsCons.EVENT_CHAT_SEARCH_RESULT,{action:e.activeType,result:t.data,search:e.search}))})},e.prototype.initHotkeys=function(){var e=this;$(document).bind("keydown","s",function(t){t.preventDefault(),e.toggleRightSidebar()}).bind("keydown","ctrl+k",function(t){t.preventDefault(),$(e.chatToDropdownRef).dropdown("toggle")}),$(this.filterChatToUser).bind("keydown","ctrl+k",function(t){t.preventDefault(),$(e.chatToDropdownRef).dropdown("toggle")})},e.prototype.initChatToDropdownHandler=function(e){var t=this;e&&_.defer(function(){$(t.chatToDropdownRef).dropdown().dropdown("set selected",t.chatId).dropdown({onChange:function(e,t,n){window.location=wurl("path")+("#/chat/"+n.attr("data-id"))}})})},e.prototype.searchFocusHandler=function(){$(this.searchInputRef).css("width","auto"),$(this.searchRemoveRef).show(),this.isActiveSearch=!0},e.prototype.searchBlurHandler=function(){$(this.searchInputRef).val()||($(this.searchInputRef).css("width","95px"),$(this.searchRemoveRef).hide(),this.isActiveSearch=!1)},e.prototype.sibebarRightHandler=function(e){this.toggleRightSidebar()},e.prototype.toggleRightSidebar=function(e){_.isUndefined(e)?this.isRightSidebarShow=!this.isRightSidebarShow:this.isRightSidebarShow=e,ea.publish(nsCons.EVENT_CHAT_SIDEBAR_TOGGLE,{isShow:this.isRightSidebarShow})},e.prototype.searchKeyupHandler=function(e){return 13===e.keyCode?(this.activeType=nsCons.ACTION_TYPE_SEARCH,this.searchHandler()):27===e.keyCode&&this.clearSearchHandler(),!0},e.prototype.clearSearchHandler=function(){$(this.searchInputRef).val("").focus()},e.prototype.showStowHandler=function(e){var t=this;return this.isRightSidebarShow&&this.activeType==nsCons.ACTION_TYPE_STOW&&!e.ctrlKey?void this.toggleRightSidebar():(this.activeType=nsCons.ACTION_TYPE_STOW,void(this.ajaxStow=$.get("/admin/chat/channel/getStows",function(e){if(e.success){var n=_.map(e.data,function(e){var t=e.chatChannel;return t.chatStow=e,t});ea.publish(nsCons.EVENT_CHAT_SHOW_STOW,{action:t.activeType,result:_.reverse(n)}),t.toggleRightSidebar(!0)}else toastr.error(e.data,"获取收藏消息失败!")})))},e.prototype.showAtHandler=function(e){var t=this;return this.isRightSidebarShow&&this.activeType==nsCons.ACTION_TYPE_AT&&0==this.newAtCnt&&!e.ctrlKey?void this.toggleRightSidebar():(this.activeType=nsCons.ACTION_TYPE_AT,this.newAtCnt=0,void(this.ajaxAt=$.get("/admin/chat/channel/getAts",{page:0,size:20},function(e){e.success?(ea.publish(nsCons.EVENT_CHAT_SHOW_AT,{action:t.activeType,result:e.data}),t.toggleRightSidebar(!0)):toastr.error(e.data,"获取@消息失败!")})))},e.prototype.logoutHandler=function(){$.post("/admin/logout").always(function(){utils.redirect2Login()})},e.prototype.showWikiDirHandler=function(e){return this.isRightSidebarShow&&this.activeType==nsCons.ACTION_TYPE_DIR&&!e.ctrlKey?void this.toggleRightSidebar():(this.activeType=nsCons.ACTION_TYPE_DIR,ea.publish(nsCons.EVENT_CHAT_SHOW_DIR,{action:this.activeType,result:this.dir}),void this.toggleRightSidebar(!0))},e.prototype.showAttachHandler=function(e){return this.isRightSidebarShow&&this.activeType==nsCons.ACTION_TYPE_ATTACH&&!e.ctrlKey?void this.toggleRightSidebar():(this.activeType=nsCons.ACTION_TYPE_ATTACH,ea.publish(nsCons.EVENT_CHAT_SHOW_ATTACH,{action:this.activeType}),void this.toggleRightSidebar(!0))},e.prototype.showScheduleHandler=function(e){return this.isRightSidebarShow&&this.activeType==nsCons.ACTION_TYPE_SCHEDULE&&!e.ctrlKey?void this.toggleRightSidebar():(this.activeType=nsCons.ACTION_TYPE_SCHEDULE,ea.publish(nsCons.EVENT_CHAT_SHOW_SCHEDULE,{action:this.activeType}),void this.toggleRightSidebar(!0))},e.prototype.userEditHandler=function(){this.userEditMd.show()},e.prototype.membersShowHandler=function(e,t){t.stopImmediatePropagation(),ea.publish(nsCons.EVENT_CHANNEL_ACTIONS,{action:"membersShowHandler",item:e})},e.prototype.leaveHandler=function(e,t){t.stopImmediatePropagation(),ea.publish(nsCons.EVENT_CHANNEL_ACTIONS,{action:"leaveHandler",item:e})},e.prototype.membersMgrHandler=function(e,t){t.stopImmediatePropagation(),ea.publish(nsCons.EVENT_CHANNEL_ACTIONS,{action:"membersMgrHandler",item:e})},e.prototype.editHandler=function(e,t){t.stopImmediatePropagation(),ea.publish(nsCons.EVENT_CHANNEL_ACTIONS,{action:"editHandler",item:e})},e.prototype.delHandler=function(e,t){t.stopImmediatePropagation(),ea.publish(nsCons.EVENT_CHANNEL_ACTIONS,{action:"delHandler",item:e})},e.prototype.viewOrMgrUsersHandler=function(e){this.channel.owner.username==this.loginUser.username?this.membersMgrHandler(this.channel,e):this.membersShowHandler(this.channel,e)},e.prototype.channelInfoHandler=function(e){this.channel.owner.username==this.loginUser.username?this.editHandler(this.channel,e):e.stopImmediatePropagation()},e.prototype.userInfoHandler=function(e){e.stopImmediatePropagation()},e.prototype.stopImmediatePropagationHandler=function(e){e.stopImmediatePropagation()},e.prototype.mailToHandler=function(e){e.stopImmediatePropagation(),window.location="mailto:"+this.chatUser.mails},e.prototype.channelLinksHandler=function(e){e.stopImmediatePropagation(),$(this.channelLinksDdRef).dropdown("toggle")},e.prototype.addChannelLinkHandler=function(e){this.channelLinkMgrVm.show()},e.prototype.openChannelLinkHandler=function(e,t){e.stopImmediatePropagation(),utils.openNewWin(t.href)},e}(),s=r(o.prototype,"loginUser",[t.bindable],{enumerable:!0,initializer:null}),l=r(o.prototype,"chatUser",[t.bindable],{enumerable:!0,initializer:null}),c=r(o.prototype,"users",[t.bindable],{enumerable:!0,initializer:null}),d=r(o.prototype,"channels",[t.bindable],{enumerable:!0,initializer:null}),u=r(o.prototype,"channel",[t.bindable],{enumerable:!0,initializer:null}),m=r(o.prototype,"loginUser",[t.bindable],{enumerable:!0,initializer:null}),p=r(o.prototype,"chatId",[t.bindable],{enumerable:!0,initializer:null}),g=r(o.prototype,"chatTo",[t.bindable],{enumerable:!0,initializer:null}),h=r(o.prototype,"isAt",[t.bindable],{enumerable:!0,initializer:null}),a=o))||a}),define("resources/elements/em-checkbox",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmCheckbox=void 0;var a,o,s,l,c,d,u,m,p,g,h,b;e.EmCheckbox=(a=(0,t.bindable)({defaultBindingMode:t.bindingMode.twoWay}),(0,t.containerless)((s=function(){function e(){i(this,e),n(this,"label",l,this),n(this,"title",c,this),n(this,"classes",d,this),n(this,"onchange",u,this),n(this,"onchecked",m,this),n(this,"onunchecked",p,this),n(this,"emCheckboxAll",g,this),n(this,"checked",h,this),n(this,"signal",b,this)}return e.prototype.checkedChanged=function(e,t){e?$(this.checkbox).checkbox("set checked"):$(this.checkbox).checkbox("set unchecked"),this.signal&&bs.signal(this.signal)},e.prototype.attached=function(){var e=this;$(this.checkbox).checkbox({onChecked:function(){e.checked=!0,_.defer(function(){e.emCheckboxAll&&e.emCheckboxAll.refreshCheckedStatus(),e.onchecked&&e.onchecked(e),e.signal&&bs.signal(e.signal)})},onUnchecked:function(){e.checked=!1,_.defer(function(){e.emCheckboxAll&&e.emCheckboxAll.refreshCheckedStatus(),e.onunchecked&&e.onunchecked(e),e.signal&&bs.signal(e.signal)})},onChange:function(){_.defer(function(){e.onchange&&e.onchange(e)})}}),this.checkedChanged(this.checked)},e}(),l=r(s.prototype,"label",[t.bindable],{enumerable:!0,initializer:null}),c=r(s.prototype,"title",[t.bindable],{enumerable:!0,initializer:null}),d=r(s.prototype,"classes",[t.bindable],{enumerable:!0,initializer:function(){return"fitted"}}),u=r(s.prototype,"onchange",[t.bindable],{enumerable:!0,initializer:null}),m=r(s.prototype,"onchecked",[t.bindable],{enumerable:!0,initializer:null}),p=r(s.prototype,"onunchecked",[t.bindable],{enumerable:!0,initializer:null}),g=r(s.prototype,"emCheckboxAll",[t.bindable],{enumerable:!0,initializer:null}),h=r(s.prototype,"checked",[a],{enumerable:!0,initializer:null}),b=r(s.prototype,"signal",[t.bindable],{enumerable:!0,initializer:null}),o=s))||o)}),define("resources/elements/em-confirm-modal",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.EmConfirmModal=void 0;e.EmConfirmModal=function(){function e(){n(this,e),this.config={}}return e.prototype.detached=function(){$(this.md).remove()},e.prototype.attached=function(){var e=this;$(this.md).modal({closable:!1,allowMultiple:!0,onApprove:function(){e.onapprove&&e.onapprove()},onDeny:function(){e.ondeny&&e.ondeny()}})},e.prototype.reset=function(){this.config={title:"操作确认",content:"确定要执行该操作吗?",warning:!1}},e.prototype.show=function(e){this.reset(),e&&(this.config=_.extend(this.config,e)),e&&e.onapprove&&(this.onapprove=e.onapprove),e&&e.ondeny&&(this.ondeny=e.ondeny),$(this.md).modal("show")},e.prototype.hide=function(){$(this.md).modal("hide")},e}()}),define("resources/elements/em-dropdown",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmDropdown=void 0;var a,o,s,l,c,d,u,m,p;e.EmDropdown=(a=(0,t.bindable)({defaultBindingMode:t.bindingMode.twoWay}),o=function(){function e(){i(this,e),n(this,"name",s,this),n(this,"text",l,this),n(this,"labelProp",c,this),n(this,"valueProp",d,this),n(this,"selectedItem",u,this),n(this,"menuItems",m,this),n(this,"classes",p,this)}return e.prototype.selectedItemChanged=function(e,t){var n=this;e&&_.defer(function(){$(n.dropdown).dropdown("set selected",e)})},e.prototype.menuItemsChanged=function(e,t){_.isEmpty(e)&&($(this.dropdown).dropdown("clear"),this.selectedItem=null)},e.prototype.initDropdownHandler=function(e){var t=this;e&&_.defer(function(){$(t.dropdown).dropdown({onChange:function(e,n,i){t.selectedItem=e}}).dropdown("set selected",t.selectedItem)})},e}(),s=r(o.prototype,"name",[t.bindable],{enumerable:!0,initializer:function(){return _.uniqueId("em-dropdown-")}}),l=r(o.prototype,"text",[t.bindable],{enumerable:!0,initializer:function(){return""}}),c=r(o.prototype,"labelProp",[t.bindable],{enumerable:!0,initializer:function(){return"label"}}),d=r(o.prototype,"valueProp",[t.bindable],{enumerable:!0,initializer:function(){return"value"}}),u=r(o.prototype,"selectedItem",[a],{enumerable:!0,initializer:null}),m=r(o.prototype,"menuItems",[t.bindable],{enumerable:!0,initializer:function(){return[]}}),p=r(o.prototype,"classes",[t.bindable],{enumerable:!0,initializer:function(){return"selection"}}),o)}),define("resources/elements/em-hotkeys-modal",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.EmHotkeysModal=void 0;e.EmHotkeysModal=function(){function e(){n(this,e)}return e.prototype.attached=function(){$(this.md).modal()},e.prototype.show=function(){$(this.md).modal("show")},e}()}),define("resources/elements/em-modal",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmModal=void 0;var a,o,s,l,c,d,u,m,p,g,h;e.EmModal=(0,t.containerless)((o=function(){function e(){i(this,e),n(this,"confirmLabel",s,this),n(this,"cancelLabel",l,this),n(this,"onapprove",c,this),n(this,"ondeny",d,this),n(this,"onshow",u,this),n(this,"onvisible",m,this),n(this,"disabled",p,this),n(this,"classes",g,this),n(this,"showConfirm",h,this),this.options={hideOnApprove:!0,autoDimmer:!0}}return e.prototype.detached=function(){$(this.modal).remove()},e.prototype.attached=function(){var e=this;$(this.modal).modal({closable:!1,autofocus:!1,observeChanges:!0,allowMultiple:!0,onShow:function(){e.onshow&&e.onshow(e)},onVisible:function(){e.onvisible&&e.onvisible(e)},onApprove:function(){return e.options.autoDimmer&&e.showDimmer(),e.onapprove&&e.onapprove(e),e.options.hideOnApprove},onDeny:function(){e.ondeny&&e.ondeny(e)}})},e.prototype.showDimmer=function(){this.loading=!0,$(this.modal).find(".dimmer").dimmer("show")},e.prototype.hideDimmer=function(){this.loading=!1,$(this.modal).find(".dimmer").dimmer("hide")},e.prototype.show=function(e){_.extend(this.options,e),$(this.modal).modal("show")},e.prototype.hide=function(){this.hideDimmer(),$(this.modal).modal("hide")},e.prototype.refresh=function(){var e=this;_.defer(function(){$(e.modal).modal("refresh")})},e}(),s=r(o.prototype,"confirmLabel",[t.bindable],{enumerable:!0,initializer:function(){return"确认"}}),l=r(o.prototype,"cancelLabel",[t.bindable],{enumerable:!0,initializer:function(){return"取消"}}),c=r(o.prototype,"onapprove",[t.bindable],{enumerable:!0,initializer:null}),d=r(o.prototype,"ondeny",[t.bindable],{enumerable:!0,initializer:null}),u=r(o.prototype,"onshow",[t.bindable],{enumerable:!0,initializer:null}),m=r(o.prototype,"onvisible",[t.bindable],{enumerable:!0,initializer:null}),p=r(o.prototype,"disabled",[t.bindable],{enumerable:!0,initializer:function(){return!1}}),g=r(o.prototype,"classes",[t.bindable],{enumerable:!0,initializer:function(){return"small"}}),h=r(o.prototype,"showConfirm",[t.bindable],{enumerable:!0,initializer:function(){return!0}}),a=o))||a}),define("resources/elements/em-user-avatar",["exports","aurelia-framework","color-hash"],function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{
-value:!0}),e.EmUserAvatar=void 0;var s,l,c;i(n),e.EmUserAvatar=(0,t.containerless)((l=function(){function e(){a(this,e),r(this,"user",c,this)}return e.prototype.userChanged=function(){if(this.user){this._calcNameChar();var e=colorHash.rgb(this.user.username);this.bgColor="rgba("+e[0]+", "+e[1]+", "+e[2]+", 0.6)",this.color="rgba("+(255-e[0])+", "+(255-e[1])+", "+(255-e[2])+", 1)"}},e.prototype._calcNameChar=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.user.name?this.nameChar=e?_.last(this.user.name):_.first(this.user.name):this.nameChar=e?_.last(this.user.username):_.first(this.user.username)},e.prototype.attached=function(){var e=this;$(this.avatarRef).hover(function(){e._calcNameChar(!1)},function(){e._calcNameChar()})},e}(),c=o(l.prototype,"user",[t.bindable],{enumerable:!0,initializer:null}),s=l))||s}),define("resources/elements/em-user-edit",["exports","aurelia-framework"],function(e,t){"use strict";function n(e,t,n,i){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(i):void 0})}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n,i,r){var a={};return Object.keys(i).forEach(function(e){a[e]=i[e]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce(function(n,i){return i(e,t,n)||n},a),r&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(r):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}Object.defineProperty(e,"__esModule",{value:!0}),e.EmUserEdit=void 0;var a,o,s;e.EmUserEdit=(0,t.containerless)((o=function(){function e(){i(this,e),n(this,"user",s,this)}return e.prototype.show=function(){this.emModal.show({hideOnApprove:!1,autoDimmer:!0})},e.prototype.showHandler=function(){},e.prototype.attached=function(){$(this.frm).form({on:"blur",inline:!0,fields:{name:"empty",mail:["empty","email"]}})},e.prototype._chkOk=function(){var e=this.user.password;return!(e&&e.length<8)||(toastr.error("密码长度不能少于8位字符!"),!1)},e.prototype.approveHandler=function(e){var t=this;this._chkOk()&&$(this.frm).form("is valid")?$.post("/admin/user/update2",{username:this.user.username,password:this.user.password,name:this.user.name,mail:this.user.mails},function(n){e.hide(),t.user.password="",n.success?toastr.success("更新个人信息成功!"):toastr.error(n.data,"更新个人信息失败!")}):e.hideDimmer()},e}(),s=r(o.prototype,"user",[t.bindable],{enumerable:!0,initializer:null}),a=o))||a}),define("resources/value-converters/vc-common",["exports","jquery-format","timeago"],function(e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.DiffHtmlValueConverter=e.Nl2brValueConverter=e.EmojiValueConverter=e.UserNameValueConverter=e.SortChannelsValueConverter=e.SortUsernamesValueConverter=e.SortUsersValueConverter=e.SortValueConverter=e.ParseMdValueConverter=e.TimeagoValueConverter=e.NumberValueConverter=e.DateValueConverter=e.LowerValueConverter=e.UpperValueConverter=void 0;var n=timeago();e.UpperValueConverter=function(){function e(){t(this,e)}return e.prototype.toView=function(e){return e&&e.toUpperCase()},e}(),e.LowerValueConverter=function(){function e(){t(this,e)}return e.prototype.toView=function(e){return e&&e.toLowerCase()},e}(),e.DateValueConverter=function(){function e(){t(this,e)}return e.prototype.toView=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"yyyy-MM-dd hh:mm:ss";return _.isInteger(_.toNumber(e))?$.format.date(new Date(e),t):e?e:""},e}(),e.NumberValueConverter=function(){function e(){t(this,e)}return e.prototype.toView=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#,##0.00";return _.isNumber(_.toNumber(e))?$.format.number(e,t):e?e:""},e}(),e.TimeagoValueConverter=function(){function e(){t(this,e)}return e.prototype.toView=function(e){return e?n.format(e,"zh_CN"):""},e}(),e.ParseMdValueConverter=function(){function e(){t(this,e)}return e.prototype.toView=function(e){return e?marked(utils.preParse(e)):""},e}(),e.SortValueConverter=function(){function e(){t(this,e)}return e.prototype.toView=function(e,t){return _.isArray(e)?_.sortBy(e,t):e},e}(),e.SortUsersValueConverter=function(){function e(){t(this,e)}return e.prototype.toView=function(e,t){if(_.isArray(e)&&t){var n=_.find(e,{username:t});if(n)return[n].concat(_.reject(e,{username:t}))}return e},e}(),e.SortUsernamesValueConverter=function(){function e(){t(this,e)}return e.prototype.toView=function(e,t){return _.isArray(e)&&t&&_.includes(e,t)?[t].concat(_.without(e,t)):e},e}(),e.SortChannelsValueConverter=function(){function e(){t(this,e)}return e.prototype.toView=function(e){if(_.isArray(e)){var t=_.find(e,{name:"all"});if(t)return[t].concat(_.reject(e,{name:"all"}))}return e},e}(),e.UserNameValueConverter=function(){function e(){t(this,e)}return e.prototype.toView=function(e){var t=_.find(window.tmsUsers,{username:e});return t?t.name:e},e}(),e.EmojiValueConverter=function(){function e(){t(this,e)}return e.prototype.toView=function(e,t){return emojify&&_.defer(function(){emojify.run(t)}),e},e}(),e.Nl2brValueConverter=function(){function e(){t(this,e)}return e.prototype.toView=function(e){return e?_.replace(e,/\n/g,"| \n | 版本 | \n日期 | \n更新人 | \n操作 | \n
|---|---|---|---|---|
| \n | \n 当前(v.${histories.length + 1}) | \n${blog.updateDate | timeago} | \n${blog.updater.name} | \n\n |
| \n | \n v.${histories.length - $index} | \n${item.blogUpdateDate | timeago} | \n${item.blogUpdater.name} | \n\n 还原此版本 ·\n \n 删除\n \n \n | \n
| 标识 | \r\n名称 | \r\n描述 | \r\n可见性 | \r\n拥有者 | \r\n操作 | \r\n||
|---|---|---|---|---|---|---|---|
| ${item.name} | \r\n${item.title} | \r\n\r\n | \r\n | \r\n | ${item.owner.name ? item.owner.name : item.owner.username} | \r\n自己 | \r\n\r\n \r\n \r\n | \r\n
| 标题 | \r\n链接 | \r\n\r\n | 操作 | \r\n||
|---|---|---|---|---|---|
| ${item.title} | \r\n\r\n \r\n \r\n \r\n | \r\n ${item.href} | \r\n\r\n \r\n \r\n \r\n | \r\n \r\n | \r\n \r\n \r\n \r\n | \r\n
| 用户名 | \r\n姓名 | \r\n邮箱 | \r\n登录 | \r\n状态 | \r\n|
|---|---|---|---|---|---|
| ${item.username} | \r\n${item.name} | \r\n${item.mails} | \r\n${item.lastLoginDate | timeago} | \r\n\r\n 启用中 \r\n | \r\n \r\n 已停用 \r\n | \r\n
| 用户名 | \r\n姓名 | \r\n邮箱 | \r\n登录 | \r\n状态 | \r\n|
|---|---|---|---|---|---|
| ${item.username} | \r\n${item.name} | \r\n${item.mails} | \r\n${item.lastLoginDate | timeago} | \r\n\r\n 启用中 \r\n | \r\n \r\n 已停用 \r\n | \r\n
| 发起人: | \r\n${event.creator.name} | \r\n
| 起止时间: | \r\n${event.start | date} - ${event.end | date} | \r\n
| 参与成员: | \r\n\r\n ${item.name} \r\n | \r\n
| 日程内容: | \r\n\r\n |
| 标题 | \r\n链接 | \r\n操作 | \r\n||
|---|---|---|---|---|
| ${item.title} | \r\n\r\n \r\n \r\n \r\n | \r\n ${item.href} | \r\n\r\n \r\n \r\n \r\n | \r\n \r\n \r\n \r\n \r\n | \r\n
\r\n \r\n
\r\n' + nodeArr.join('') + '';
- };
-
- CommonUtils.prototype.catalog = function catalog($e) {
- var $headers = $(":header", $e);
-
- if ($headers && $headers.size() == 0) {
- return false;
- }
-
- var pre = null;
-
- var link = {
- pre: null,
- arr: []
- };
- var current = link;
- $headers.each(function (index, h) {
- var name = h.nodeName;
- if (!pre) {
- current.arr.push(h);
- pre = name;
- } else {
- if (pre < name) {
- var last = current;
- current = {
- pre: last,
- arr: [h]
- };
- last.arr.push(current);
- pre = name;
- } else if (pre == name) {
- current.arr.push(h);
- } else {
- current = current.pre ? current.pre : current;
- current.arr.push(h);
- pre = name;
- }
- }
- });
-
- return link;
- };
-
- CommonUtils.prototype.generateDir = function generateDir(link, uid) {
- var $list = $('');
- this.prodDir($list, link, uid);
- return $list;
- };
-
- CommonUtils.prototype.dir = function dir($e, uid) {
- var cl = this.catalog($e);
- return cl ? this.generateDir(cl, uid) : '';
- };
-
- CommonUtils.prototype.prodDir = function prodDir($list, link, uid) {
- var _this2 = this;
-
- $.each(link.arr, function (index, item) {
- if (item.hasOwnProperty('arr')) {
- var $l = $('');
- $list.append($l);
- _this2.prodDir($l, item, uid);
- } else {
- var id = uid ? _.uniqueId(uid) : _.uniqueId('tms-wiki-dir-item-');
- var $item = $('').text($(item).attr('id', id).text()).attr('data-id', id);
- $list.append($item);
- }
- });
- };
-
- CommonUtils.prototype.isElementInViewport = function isElementInViewport(el) {
- if (typeof jQuery === "function" && el instanceof jQuery) {
- el = el[0];
- }
-
- var rect = el.getBoundingClientRect();
-
- return rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);
- };
-
- CommonUtils.prototype.getCursortPosition = function getCursortPosition(ctrl) {
- var CaretPos = 0;
- if (document.selection) {
- ctrl.focus();
- var Sel = document.selection.createRange();
- Sel.moveStart('character', -ctrl.value.length);
- CaretPos = Sel.text.length;
- } else if (ctrl.selectionStart || ctrl.selectionStart == '0') {
- CaretPos = ctrl.selectionStart;
- }
- return CaretPos;
- };
-
- CommonUtils.prototype.setCaretPosition = function setCaretPosition(ctrl, pos) {
- if (ctrl.setSelectionRange) {
- ctrl.focus();
- ctrl.setSelectionRange(pos, pos);
- } else if (ctrl.createTextRange) {
- var range = ctrl.createTextRange();
- range.collapse(true);
- range.moveEnd('character', pos);
- range.moveStart('character', pos);
- range.select();
- }
- };
-
- CommonUtils.prototype.isAbsUrl = function isAbsUrl(url) {
- if (_.startsWith(url, 'http://')) {
- return true;
- } else if (_.startsWith(url, 'https://')) {
- return true;
- } else if (_.startsWith(url, '//')) {
- return true;
- }
-
- return false;
- };
-
- CommonUtils.prototype.escape = function escape(html, encode) {
- return html.replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, ''');
- };
-
- CommonUtils.prototype.unescape = function unescape(html) {
- return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g, function (_, n) {
- n = n.toLowerCase();
- if (n === 'colon') return ':';
- if (n.charAt(0) === '#') {
- return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
- }
- return '';
- });
- };
-
- CommonUtils.prototype.openNewWin = function openNewWin(url) {
-
- if (url) {
- (function () {
- var $a = $('').appendTo('body').end();
- $('').appendTo($a).end().click();
-
- _.delay(function () {
- $a.remove();
- }, 200);
- })();
- }
- };
-
- CommonUtils.prototype.isAdminUser = function isAdminUser(user) {
- if (user && user.authorities) {
- return _.some(user.authorities, function (item) {
- return item.id.authority === 'ROLE_ADMIN';
- });
- }
- return false;
- };
-
- CommonUtils.prototype.isSuperUser = function isSuperUser(user) {
- if (user && user.authorities) {
- return _.some(user.authorities, function (item) {
- return item.id.authority === 'ROLE_SUPER';
- });
- }
- return false;
- };
-
- CommonUtils.prototype.isSBCcase = function isSBCcase(str) {
- return (/[^\x00-\xff]/.test(str)
- );
- };
-
- CommonUtils.prototype.isHanzi = function isHanzi(str) {
- return (/[\u4e00-\u9fa5]/ig.test(str)
- );
- };
-
- CommonUtils.prototype.getByteLen = function getByteLen(val) {
- var len = 0;
- for (var i = 0; i < val.length; i++) {
- if (this.isHanzi(val[i]) || this.isSBCcase(val[i])) {
- len += 2;
- } else {
- len += 1;
- }
- }
- return len;
- };
-
- CommonUtils.prototype.abbreviate = function abbreviate(value, maxLen) {
- if (value && maxLen) {
-
- var len = 0;
- for (var i = 0; i < value.length; i++) {
- if (this.isHanzi(value[i]) || this.isSBCcase(value[i])) {
- len += 2;
- } else {
- len += 1;
- }
-
- if (len > maxLen) {
- return value.substr(0, i) + '...';
- }
- }
- }
- return value;
- };
-
- CommonUtils.prototype.isMail = function isMail(mail) {
-
- var emailRegex = /^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i;
-
- return emailRegex.test(mail);
- };
-
- CommonUtils.prototype.isIE = function isIE() {
- var isIE11 = !window.ActiveXObject && 'ActiveXObject' in window,
- isIE = 'ActiveXObject' in window;
- return isIE11 || isIE;
- };
-
- CommonUtils.prototype.isIE11 = function isIE11() {
- return !window.ActiveXObject && 'ActiveXObject' in window;
- };
-
- CommonUtils.prototype.isIOS = function isIOS() {
- var userAgent = navigator.userAgent,
- isIOS = userAgent.match(this.regExpOS.ios),
- isMobileChrome = userAgent.match(this.regExpOS.mobileChrome);
- if (isIOS && !isMobileChrome) {
- return true;
- } else {
- return false;
- }
- };
-
- CommonUtils.prototype.isCellphone = function isCellphone() {
- return !!navigator.userAgent.match(this.regExpOS.cellphone);
- };
-
- CommonUtils.prototype.isMobile = function isMobile() {
- return !!navigator.userAgent.match(this.regExpOS.mobile);
- };
-
- CommonUtils.prototype.isChrome = function isChrome() {
- return (/chrome\/([\d.]+)/.test(navigator.userAgent.toLowerCase())
- );
- };
-
- CommonUtils.prototype.isSafari = function isSafari() {
- return (/version\/([\d.]+)/.test(navigator.userAgent.toLowerCase())
- );
- };
-
- CommonUtils.prototype.isFirefox = function isFirefox() {
- return (/firefox\/([\d.]+)/.test(navigator.userAgent.toLowerCase())
- );
- };
-
- CommonUtils.prototype.isOpera = function isOpera() {
- return (/opera.([\d.]+)/.test(navigator.userAgent.toLowerCase())
- );
- };
-
- CommonUtils.prototype.diffHtml = function diffHtml(html) {
-
- var tags = ['html', 'head', 'meta', 'title', 'base', 'link', 'script', 'body', 'div', 'span'];
-
- var s = '';
- if (html) {
- s = html;
- _.each(tags, function (tag) {
- s = s.replace(new RegExp('<(' + tag + ')', "gi"), '<$1');
- });
- }
-
- return s;
- };
-
- CommonUtils.prototype.encodeHtml = function encodeHtml(str) {
- var s = "";
- if (str.length == 0) return "";
- s = str.replace(/&/g, ">");
- s = s.replace(//g, ">");
- s = s.replace(/ /g, " ");
- s = s.replace(/\'/g, "'");
- s = s.replace(/\"/g, """);
- s = s.replace(/\n/g, "' + text + '';
- };
-
- renderer.code = function (code, lang, escaped) {
- var codeBk = code;
- if (this.options.highlight) {
- var out = this.options.highlight(code, lang);
- if (out != null && out !== code) {
- escaped = true;
- code = out;
- }
- }
-
- if (!lang) {
- return '' + (escaped ? code : _commonUtils2.default.escape(code, true)) + '\n' + (escaped ? code : _commonUtils2.default.escape(code, true)) + '\n默认确认对话框内容.
' - }); - return this; - }; - - Config.prototype.context = function context(aurelia) { - this.aurelia = aurelia; - return this; - }; - - return Config; - }(); - - exports.default = new Config(); -}); -define('init/index',['exports', './config', 'jquery', 'jquery.scrollto', 'timeago', 'lodash', 'hotkeys'], function (exports, _config) { - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.configure = configure; - - var _config2 = _interopRequireDefault(_config); - - function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { - default: obj - }; - } - - function configure(aurelia, params) { - - _config2.default.context(aurelia).initGlobalVar().initHttp().initAjax().initToastr().initMarked().initAnimateCss().initEmoji().initModaal(); - } -}); -define('resources/index',['exports'], function (exports) { - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.configure = configure; - function configure(aurelia) { - - aurelia.globalResources(['resources/value-converters/vc-common', 'resources/binding-behaviors/bb-key', 'resources/attributes/attr-task', 'resources/attributes/attr-swipebox', 'resources/attributes/attr-pastable', 'resources/attributes/attr-autosize', 'resources/attributes/attr-dropzone', 'resources/attributes/attr-attr', 'resources/attributes/attr-c2c', 'resources/attributes/attr-dimmer', 'resources/attributes/attr-ui-dropdown', 'resources/attributes/attr-ui-dropdown-action', 'resources/attributes/attr-ui-dropdown-hover', 'resources/attributes/attr-ui-tab', 'resources/attributes/attr-ui-popup', 'resources/attributes/attr-ui-checkbox', 'resources/attributes/attr-tablesort', 'resources/attributes/attr-textcomplete', 'resources/attributes/attr-scrollbar', 'resources/attributes/attr-modaal', 'resources/elements/em-modal', 'resources/elements/em-dropdown', 'resources/elements/em-checkbox', 'resources/elements/em-confirm-modal', 'resources/elements/em-hotkeys-modal', 'resources/elements/em-chat-input', 'resources/elements/em-chat-top-menu', 'resources/elements/em-chat-sidebar-left', 'resources/elements/em-chat-content-item', 'resources/elements/em-chat-sidebar-right', 'resources/elements/em-chat-channel-create', 'resources/elements/em-chat-channel-join', 'resources/elements/em-chat-channel-edit', 'resources/elements/em-chat-channel-members-mgr', 'resources/elements/em-chat-channel-members-show', 'resources/elements/em-chat-channel-link-mgr', 'resources/elements/em-chat-system-link-mgr', 'resources/elements/em-chat-msg-popup', 'resources/elements/em-chat-member-popup', 'resources/elements/em-chat-attach', 'resources/elements/em-chat-schedule', 'resources/elements/em-chat-msg', 'resources/elements/em-chat-schedule-edit', 'resources/elements/em-chat-schedule-remind', 'resources/elements/em-chat-share', 'resources/elements/em-chat-content-item-footbar', 'resources/elements/em-blog-write', 'resources/elements/em-blog-left-sidebar', 'resources/elements/em-blog-right-sidebar', 'resources/elements/em-blog-content', 'resources/elements/em-blog-top-menu', 'resources/elements/em-blog-share', 'resources/elements/em-blog-comment', 'resources/elements/em-blog-save', 'resources/elements/em-blog-space-create', 'resources/elements/em-blog-space-edit', 'resources/elements/em-blog-space-update', 'resources/elements/em-blog-history', 'resources/elements/em-blog-history-view', 'resources/elements/em-blog-history-diff', 'resources/elements/em-blog-comment-popup', 'resources/elements/em-blog-space-auth', 'resources/elements/em-user-avatar', 'resources/elements/em-user-edit', 'resources/elements/em-blog-comment-share']); - } -}); -define('test/test-lifecycle',['exports', 'aurelia-framework', 'aurelia-event-aggregator'], function (exports, _aureliaFramework, _aureliaEventAggregator) { - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.TestLifeCycle = undefined; - - function _initDefineProp(target, property, descriptor, context) { - if (!descriptor) return; - Object.defineProperty(target, property, { - enumerable: descriptor.enumerable, - configurable: descriptor.configurable, - writable: descriptor.writable, - value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 - }); - } - - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - - function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { - var desc = {}; - Object['ke' + 'ys'](descriptor).forEach(function (key) { - desc[key] = descriptor[key]; - }); - desc.enumerable = !!desc.enumerable; - desc.configurable = !!desc.configurable; - - if ('value' in desc || desc.initializer) { - desc.writable = true; - } - - desc = decorators.slice().reverse().reduce(function (desc, decorator) { - return decorator(target, property, desc) || desc; - }, desc); - - if (context && desc.initializer !== void 0) { - desc.value = desc.initializer ? desc.initializer.call(context) : void 0; - desc.initializer = undefined; - } - - if (desc.initializer === void 0) { - Object['define' + 'Property'](target, property, desc); - desc = null; - } - - return desc; - } - - function _initializerWarningHelper(descriptor, context) { - throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.'); - } - - var _desc, _value, _class, _descriptor, _class2, _temp; - - var TestLifeCycle = exports.TestLifeCycle = (_class = (_temp = _class2 = function () { - function TestLifeCycle(eventAggregator) { - _classCallCheck(this, TestLifeCycle); - - _initDefineProp(this, 'prop', _descriptor, this); - - this.eventAggregator = eventAggregator; - - console.log('constructor'); - } - - TestLifeCycle.prototype.created = function created(view) { - console.log('created'); - }; - - TestLifeCycle.prototype.bind = function bind(ctx) { - console.log('bind'); - }; - - TestLifeCycle.prototype.unbind = function unbind() { - console.log('unbind'); - }; - - TestLifeCycle.prototype.attached = function attached() { - console.log('attached'); - }; - - TestLifeCycle.prototype.detached = function detached() { - console.log('detached'); - }; - - TestLifeCycle.prototype.canActivate = function canActivate(params, routeConfig, navigationInstruction) { - console.log('canActivate'); - }; - - TestLifeCycle.prototype.activate = function activate(params, routeConfig, navigationInstruction) { - console.log('activate'); - }; - - TestLifeCycle.prototype.canDeactivate = function canDeactivate() { - console.log('canDeactivate'); - }; - - TestLifeCycle.prototype.deactivate = function deactivate() { - console.log('deactivate'); - }; - - return TestLifeCycle; - }(), _class2.inject = [_aureliaEventAggregator.EventAggregator], _temp), (_descriptor = _applyDecoratedDescriptor(_class.prototype, 'prop', [_aureliaFramework.bindable], { - enumerable: true, - initializer: function initializer() { - return null; - } - })), _class); -}); -define('user/user-login',['exports'], function (exports) { - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - - var UserLogin = exports.UserLogin = function () { - function UserLogin() { - _classCallCheck(this, UserLogin); - - this.username = ''; - this.password = ''; - } - - UserLogin.prototype.attached = function attached() { - $(this.rememberMeRef).checkbox(); - }; - - UserLogin.prototype.kdHandler = function kdHandler(evt) { - if (evt.keyCode === 13) { - this.loginHandler(); - } - - return true; - }; - - UserLogin.prototype.loginHandler = function loginHandler() { - var _this = this; - - var rm = $(this.rememberMeRef).checkbox('is checked') ? 'on' : ''; - - $.post('/admin/signin', { - username: this.username, - password: this.password, - "remember-me": rm - }).done(function () { - - localStorage && localStorage.setItem(nsCons.KEY_LOGIN_USERNAME, _this.username); - - var redirect = utils.urlQuery('redirect'); - if (redirect) { - window.location = decodeURIComponent(redirect); - } else { - var chatTo = null; - if (localStorage) { - chatTo = localStorage.getItem(nsCons.KEY_REMEMBER_LAST_CHAT_TO); - } - if (chatTo) { - window.location = wurl('path') + ('#/chat/' + chatTo); - } else { - window.location = wurl('path') + ('#/chat/@' + _this.username); - } - } - }).fail(function (xhr, sts, err) { - if (xhr.status == 401) { - toastr.error('用户名密码不正确!'); - } else if (xhr.status != 0) { - toastr.error('网络连接错误!'); - } - }); - - - return true; - }; - - return UserLogin; - }(); -}); -define('user/user-pwd-reset',['exports'], function (exports) { - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - - var UserPwdReset = exports.UserPwdReset = function () { - function UserPwdReset() { - _classCallCheck(this, UserPwdReset); - - this.mail = ''; - this.pwd = ''; - this.isReq = false; - this.token = utils.urlQuery('id'); - } - - UserPwdReset.prototype.resetPwdHandler = function resetPwdHandler() { - var _this = this; - - if (!$(this.fm).form('is valid')) { - toastr.error('邮件地址输入不合法!'); - return; - } - - this.isReq = true; - http.fetch('/free/user/pwd/reset', { - method: 'post', - body: json({ - mail: this.mail, - baseUrl: utils.getBaseUrl(), - path: wurl('path') - }) - }).then(function (resp) { - if (resp.ok) { - resp.json().then(function (data) { - if (data.success) { - toastr.success('重置密码邮件链接发送成功!'); - _.delay(function () { - window.location = "/admin/login"; - }, 2000); - } else { - toastr.error(data.data, '重置密码邮件链接发送失败!'); - _this.isReq = false; - } - }); - } - }); - }; - - UserPwdReset.prototype.newPwdHandler = function newPwdHandler() { - var _this2 = this; - - if (!$(this.fm2).form('is valid')) { - toastr.error('新密码输入不合法!'); - return; - } - - this.isReq = true; - http.fetch('/free/user/pwd/new', { - method: 'post', - body: json({ - token: this.token, - pwd: this.pwd - }) - }).then(function (resp) { - if (resp.ok) { - resp.json().then(function (data) { - if (data.success) { - toastr.success('重置密码成功!'); - _.delay(function () { - window.location = "/admin/login"; - }, 2000); - } else { - toastr.error(data.data, '重置密码失败!'); - _this2.isReq = false; - } - }); - } - }); - }; - - UserPwdReset.prototype.attached = function attached() { - - $(this.fm).form({ - on: 'blur', - inline: true, - fields: { - mail: ['empty', 'email'] - } - }); - - $(this.fm2).form({ - on: 'blur', - inline: true, - fields: { - mail: ['empty', 'minLength[8]'] - } - }); - }; - - return UserPwdReset; - }(); -}); -define('user/user-register',['exports'], function (exports) { - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - - var ViewModel = exports.ViewModel = function () { - function ViewModel() { - _classCallCheck(this, ViewModel); - - this.header = '账户激活页面'; - } - - ViewModel.prototype.activate = function activate(params, routeConfig, navigationInstruction) { - var _this = this; - - if (params.id) { - this.token = params.id; - - this.isReq = true; - this.header = '账户激活中,请稍后...!'; - http.fetch('/free/user/register/activate', { - method: 'post', - body: json({ - token: this.token - }) - }).then(function (resp) { - if (resp.ok) { - resp.json().then(function (data) { - if (data.success) { - _this.header = '账户激活成功,请返回登录页面登录!'; - } else { - _this.header = '账户激活失败!'; - toastr.error(data.data, '账户激活失败!'); - } - }); - _this.isReq = false; - } - }); - } - }; - - ViewModel.prototype.attached = function attached() { - - $(this.fm).form({ - on: 'blur', - inline: true, - fields: { - username: { - identifier: 'username', - rules: [{ - type: 'empty' - }, { - type: 'minLength[3]' - }, { - type: 'regExp', - value: /^[a-z]+[a-z0-9\.\-_]*[a-z0-9]+$/, - prompt: '小写字母数字.-_组合,字母开头,字母数字结尾' - }] - }, - pwd: { - identifier: 'pwd', - rules: [{ - type: 'empty' - }, { - type: 'minLength[8]' - }] - }, - name: { - identifier: 'name', - rules: [{ - type: 'empty' - }, { - type: 'maxLength[20]' - }] - }, - mail: { - identifier: 'mail', - rules: [{ - type: 'empty' - }, { - type: 'email' - }] - } - } - }); - }; - - ViewModel.prototype.okHandler = function okHandler() { - var _this2 = this; - - if (!$(this.fm).form('is valid')) { - toastr.error('账户注册信息输入不合法!'); - return; - } - - this.isReq = true; - http.fetch('/free/user/register', { - method: 'post', - body: json({ - username: this.username, - pwd: this.pwd, - name: this.name, - mail: this.mail, - baseUrl: utils.getBaseUrl(), - path: wurl('path') - }) - }).then(function (resp) { - if (resp.ok) { - resp.json().then(function (data) { - if (data.success) { - toastr.success('注册成功,请通过接收到的激活邮件激活账户!'); - _.delay(function () { - window.location = "/admin/login"; - }, 2000); - } else { - toastr.error(data.data, '注册失败!'); - _this2.isReq = false; - } - }); - } - }); - }; - - return ViewModel; - }(); -}); -define('resources/attributes/attr-attr',['exports', 'aurelia-framework', 'aurelia-dependency-injection'], function (exports, _aureliaFramework, _aureliaDependencyInjection) { - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.AttrAttr = undefined; - - function _initDefineProp(target, property, descriptor, context) { - if (!descriptor) return; - Object.defineProperty(target, property, { - enumerable: descriptor.enumerable, - configurable: descriptor.configurable, - writable: descriptor.writable, - value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 - }); - } - - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - - function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { - var desc = {}; - Object['ke' + 'ys'](descriptor).forEach(function (key) { - desc[key] = descriptor[key]; - }); - desc.enumerable = !!desc.enumerable; - desc.configurable = !!desc.configurable; - - if ('value' in desc || desc.initializer) { - desc.writable = true; - } - - desc = decorators.slice().reverse().reduce(function (desc, decorator) { - return decorator(target, property, desc) || desc; - }, desc); - - if (context && desc.initializer !== void 0) { - desc.value = desc.initializer ? desc.initializer.call(context) : void 0; - desc.initializer = undefined; - } - - if (desc.initializer === void 0) { - Object['define' + 'Property'](target, property, desc); - desc = null; - } - - return desc; - } - - function _initializerWarningHelper(descriptor, context) { - throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.'); - } - - var _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2; - - var AttrAttr = exports.AttrAttr = (_dec = (0, _aureliaFramework.customAttribute)('attr'), _dec2 = (0, _aureliaDependencyInjection.inject)(Element), _dec(_class = _dec2(_class = (_class2 = function () { - function AttrAttr(element) { - _classCallCheck(this, AttrAttr); - - _initDefineProp(this, 'name', _descriptor, this); - - _initDefineProp(this, 'value', _descriptor2, this); - - this.element = element; - } - - AttrAttr.prototype.nameChanged = function nameChanged(value) {}; - - AttrAttr.prototype.valueChanged = function valueChanged(value) { - - this.value = value; - - if (value) { - $(this.element).attr(this.name, value); - } else { - $(this.element).removeAttr(this.name); - } - }; - - AttrAttr.prototype.bind = function bind(bindingContext) { - this.valueChanged(this.value); - }; - - AttrAttr.prototype.unbind = function unbind() {}; - - return AttrAttr; - }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'name', [_aureliaFramework.bindable], { - enumerable: true, - initializer: null - }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'value', [_aureliaFramework.bindable], { - enumerable: true, - initializer: null - })), _class2)) || _class) || _class); -}); -define('resources/attributes/attr-autosize',['exports', 'aurelia-framework', 'aurelia-templating'], function (exports, _aureliaFramework, _aureliaTemplating) { - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.AttrAutosize = undefined; - - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - - var _dec, _dec2, _class; - - var AttrAutosize = exports.AttrAutosize = (_dec = (0, _aureliaTemplating.customAttribute)('autosize'), _dec2 = (0, _aureliaFramework.inject)(Element), _dec(_class = _dec2(_class = function () { - function AttrAutosize(element) { - _classCallCheck(this, AttrAutosize); - - this.element = element; - } - - AttrAutosize.prototype.valueChanged = function valueChanged(newValue, oldValue) { - autosize(this.element); - }; - - AttrAutosize.prototype.bind = function bind(bindingContext) { - this.valueChanged(this.value); - }; - - AttrAutosize.prototype.unbind = function unbind() { - autosize.destroy(this.elements); - }; - - return AttrAutosize; - }()) || _class) || _class); -}); -define('resources/attributes/attr-c2c',['exports', 'aurelia-framework', 'clipboard'], function (exports, _aureliaFramework, _clipboard) { - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.AttrC2cCustomAttribute = undefined; - - var _clipboard2 = _interopRequireDefault(_clipboard); - - function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { - default: obj - }; - } - - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - - var _dec, _dec2, _class; - - var AttrC2cCustomAttribute = exports.AttrC2cCustomAttribute = (_dec = (0, _aureliaFramework.customAttribute)('c2c'), _dec2 = (0, _aureliaFramework.inject)(Element), _dec(_class = _dec2(_class = function () { - function AttrC2cCustomAttribute(element) { - _classCallCheck(this, AttrC2cCustomAttribute); - - this.element = element; - this._init(); - } - - AttrC2cCustomAttribute.prototype._init = function _init() { - var _this = this; - - $(this.element).append(''); - this.clipboard = new _clipboard2.default($(this.element).find('i.copy.icon')[0], { - text: function text(trigger) { - return _this.value ? _this.value : $(_this.element).text(); - } - }); - var $tp = $(this.element).find('[data-tooltip]').hover(function () {}, function () { - $(this).attr('data-tooltip', '复制到剪贴板!'); - }); - this.clipboard.on('success', function (e) { - $tp.attr('data-tooltip', '复制成功!'); - }).on('error', function (e) { - $tp.attr('data-tooltip', '复制失败!'); - }); - - $(this.element).hover(function () { - if (_this.value || $(_this.element).text()) { - $tp.show(); - } - }, function () { - $tp.hide(); - }); - }; - - AttrC2cCustomAttribute.prototype.unbind = function unbind() { - this.clipboard && this.clipboard.destroy(); - }; - - return AttrC2cCustomAttribute; - }()) || _class) || _class); -}); -define('resources/attributes/attr-dimmer',['exports', 'aurelia-dependency-injection', 'aurelia-templating'], function (exports, _aureliaDependencyInjection, _aureliaTemplating) { - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.AttrDimmer = undefined; - - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - - var _dec, _dec2, _class; - - var AttrDimmer = exports.AttrDimmer = (_dec = (0, _aureliaTemplating.customAttribute)('dimmer'), _dec2 = (0, _aureliaDependencyInjection.inject)(Element), _dec(_class = _dec2(_class = function () { - function AttrDimmer(element) { - _classCallCheck(this, AttrDimmer); - - this.element = element; - this.$dimmer = $('详情内容
\n详情内容
\n' + item.title + '\u5417?',
- onapprove: function onapprove() {
- $.post('/admin/channel/join', {
- id: item.id
- }, function (data) {
- if (data.success) {
- toastr.success('加入频道成功!');
- item.joined = true;
- ea.publish(nsCons.EVENT_CHAT_CHANNEL_JOINED, { channel: data.data });
- } else {
- toastr.error(data.data, '加入频道失败!');
- }
- });
- }
- });
- };
-
- EmChatChannelJoin.prototype.leaveHandler = function leaveHandler(item) {
- this.confirmMd.show({
- content: '\u786E\u5B9A\u8981\u79BB\u5F00\u9891\u9053' + item.title + '\u5417?',
- onapprove: function onapprove() {
- $.post('/admin/channel/leave', {
- id: item.id
- }, function (data) {
- if (data.success) {
- toastr.success('离开频道成功!');
- item.joined = false;
- ea.publish(nsCons.EVENT_CHAT_CHANNEL_LEAVED, { channel: data.data });
- } else {
- toastr.error(data.data, '离开频道失败!');
- }
- });
- }
- });
- };
-
- return EmChatChannelJoin;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'loginUser', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class;
-});
-define('resources/elements/em-chat-channel-link-mgr',['exports', 'aurelia-framework'], function (exports, _aureliaFramework) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmChatChannelLinkMgr = undefined;
-
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
-
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
-
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
-
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
-
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
-
- return desc;
- }
-
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
-
- var _class, _desc, _value, _class2, _descriptor, _descriptor2;
-
- var EmChatChannelLinkMgr = exports.EmChatChannelLinkMgr = (0, _aureliaFramework.containerless)(_class = (_class2 = function () {
- function EmChatChannelLinkMgr() {
- _classCallCheck(this, EmChatChannelLinkMgr);
-
- _initDefineProp(this, 'channel', _descriptor, this);
-
- _initDefineProp(this, 'loginUser', _descriptor2, this);
-
- this.links = [];
- }
-
- EmChatChannelLinkMgr.prototype.channelChanged = function channelChanged(news, old) {
- var _this = this;
-
- if (this.channel) {
- $.get('/admin/link/listBy', {
- channelId: this.channel.id
- }, function (data) {
- if (data.success) {
- _this.links = data.data;
- } else {
- _this.links = [];
- }
- });
- }
- };
-
- EmChatChannelLinkMgr.prototype.addHandler = function addHandler() {
- var _this2 = this;
-
- $.post('/admin/link/create', {
- title: this.title,
- href: this.href,
- channelId: this.channel.id
- }, function (data, textStatus, xhr) {
- if (data.success) {
- _this2.title = '';
- _this2.href = '';
- _this2.links.push(data.data);
- ea.publish(nsCons.EVENT_CHANNEL_LINKS_REFRESH, {});
- } else {
- toastr.error(data.data);
- }
- });
- };
-
- EmChatChannelLinkMgr.prototype.delHandler = function delHandler(item) {
- var _this3 = this;
-
- $.post('/admin/link/delete', {
- id: item.id
- }, function (data, textStatus, xhr) {
- if (data.success) {
- _this3.links = _.reject(_this3.links, { id: item.id });
- ea.publish(nsCons.EVENT_CHANNEL_LINKS_REFRESH, {});
- toastr.success('删除成功!');
- } else {
- toastr.error(data.data);
- }
- });
- };
-
- EmChatChannelLinkMgr.prototype.editHandler = function editHandler(item) {
- item.oldTitle = item.title;
- item.oldHref = item.href;
- item.isEditing = true;
- };
-
- EmChatChannelLinkMgr.prototype.updateHandler = function updateHandler(item) {
- $.post('/admin/link/update', {
- id: item.id,
- title: item.title,
- href: item.href
- }, function (data, textStatus, xhr) {
- if (data.success) {
- item.isEditing = false;
- ea.publish(nsCons.EVENT_CHANNEL_LINKS_REFRESH, {});
- toastr.success('更新成功!');
- } else {
- toastr.error(data.data);
- }
- });
- };
-
- EmChatChannelLinkMgr.prototype.showHandler = function showHandler() {
- this._reset();
- };
-
- EmChatChannelLinkMgr.prototype._reset = function _reset() {};
-
- EmChatChannelLinkMgr.prototype.attached = function attached() {};
-
- EmChatChannelLinkMgr.prototype.show = function show() {
- this.channelChanged();
- this.emModal.show({ autoDimmer: false });
- };
-
- EmChatChannelLinkMgr.prototype.approveHandler = function approveHandler(modal) {};
-
- return EmChatChannelLinkMgr;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'channel', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'loginUser', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class;
-});
-define('resources/elements/em-chat-channel-members-mgr',['exports', 'aurelia-framework'], function (exports, _aureliaFramework) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmChatChannelMembersMgr = undefined;
-
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
-
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
-
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
-
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
-
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
-
- return desc;
- }
-
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
-
- var _class, _desc, _value, _class2, _descriptor, _descriptor2;
-
- var EmChatChannelMembersMgr = exports.EmChatChannelMembersMgr = (0, _aureliaFramework.containerless)(_class = (_class2 = function () {
- function EmChatChannelMembersMgr() {
- var _this = this;
-
- _classCallCheck(this, EmChatChannelMembersMgr);
-
- _initDefineProp(this, 'channel', _descriptor, this);
-
- _initDefineProp(this, 'users', _descriptor2, this);
-
- this.membersOpts = {
- onAdd: function onAdd(addedValue, addedText, $addedChoice) {
- _this.emModal.showDimmer();
- $.post('/admin/channel/addMember', {
- id: _this.channel.id,
- members: addedValue,
- baseUrl: utils.getBaseUrl(),
- path: wurl('path')
- }, function (data, textStatus, xhr) {
- if (data.success) {
- toastr.success('添加成员成功!');
- _this.channel.members = data.data.members;
- ea.publish(nsCons.EVENT_CHAT_CHANNEL_MEMBER_ADD_OR_REMOVE, {
- type: 'add',
- members: data.data.members
- });
- } else {
- toastr.error(data.data, '添加成员失败!');
- }
- }).always(function () {
- _this.emModal.hideDimmer();
- });
- },
- onLabelRemove: function onLabelRemove(removedValue) {
- if (_this.channel.owner.username == removedValue) {
- return false;
- }
-
- _this.emModal.showDimmer();
- $.post('/admin/channel/removeMember', {
- id: _this.channel.id,
- members: removedValue,
- baseUrl: utils.getBaseUrl(),
- path: wurl('path')
- }, function (data, textStatus, xhr) {
- if (data.success) {
- toastr.success('移除成员成功!');
- _this.channel.members = data.data.members;
- ea.publish(nsCons.EVENT_CHAT_CHANNEL_MEMBER_ADD_OR_REMOVE, {
- type: 'remove',
- members: data.data.members
- });
- } else {
- toastr.error(data.data, '移除成员失败!');
- }
- }).always(function () {
- _this.emModal.hideDimmer();
- });
- }
- };
- }
-
- EmChatChannelMembersMgr.prototype.channelChanged = function channelChanged() {
- var _this2 = this;
-
- if (this.channel) {
- (function () {
- var usernames = _.sortBy(_.map(_this2.channel.members, 'username'));
-
- _.defer(function () {
- $(_this2.membersRef).dropdown().dropdown('clear').dropdown('set selected', usernames).dropdown(_this2.membersOpts);
- });
- })();
- }
- };
-
- EmChatChannelMembersMgr.prototype.attached = function attached() {};
-
- EmChatChannelMembersMgr.prototype.initMembersUI = function initMembersUI(last) {
- var _this3 = this;
-
- if (last) {
- _.defer(function () {
- _this3.channelChanged();
- });
- }
- };
-
- EmChatChannelMembersMgr.prototype.showHandler = function showHandler() {
- $(this.membersRef).dropdown().dropdown('clear');
- this.channelChanged();
- };
-
- EmChatChannelMembersMgr.prototype.approveHandler = function approveHandler(modal) {};
-
- EmChatChannelMembersMgr.prototype.show = function show() {
- this.emModal.show({
- hideOnApprove: true,
- autoDimmer: false
- });
- };
-
- return EmChatChannelMembersMgr;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'channel', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'users', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class;
-});
-define('resources/elements/em-chat-channel-members-show',['exports', 'aurelia-framework'], function (exports, _aureliaFramework) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmChatChannelMembersShow = undefined;
-
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
-
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
-
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
-
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
-
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
-
- return desc;
- }
-
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
-
- var _class, _desc, _value, _class2, _descriptor;
-
- var EmChatChannelMembersShow = exports.EmChatChannelMembersShow = (0, _aureliaFramework.containerless)(_class = (_class2 = function () {
- function EmChatChannelMembersShow() {
- _classCallCheck(this, EmChatChannelMembersShow);
-
- _initDefineProp(this, 'channel', _descriptor, this);
- }
-
- EmChatChannelMembersShow.prototype.showHandler = function showHandler() {};
-
- EmChatChannelMembersShow.prototype.approveHandler = function approveHandler(modal) {};
-
- EmChatChannelMembersShow.prototype.show = function show() {
- this.emModal.show({
- hideOnApprove: true,
- autoDimmer: false
- });
- };
-
- return EmChatChannelMembersShow;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'channel', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class;
-});
-define('resources/elements/em-chat-content-item-footbar',['exports', 'aurelia-framework', 'common/common-tags'], function (exports, _aureliaFramework, _commonTags) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmChatContentItemFootbar = undefined;
-
- var _commonTags2 = _interopRequireDefault(_commonTags);
-
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
- }
-
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
-
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
-
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
-
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
-
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
-
- return desc;
- }
-
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
-
- var _class, _desc, _value, _class2, _descriptor;
-
- var EmChatContentItemFootbar = exports.EmChatContentItemFootbar = (0, _aureliaFramework.containerless)(_class = (_class2 = function () {
- function EmChatContentItemFootbar() {
- _classCallCheck(this, EmChatContentItemFootbar);
-
- _initDefineProp(this, 'chat', _descriptor, this);
-
- this.emojis = [{
- label: '赞同',
- value: ':+1:',
- type: 'emoji'
- }, {
- label: '反对',
- value: ':-1:',
- type: 'emoji'
- }, {
- label: '知悉',
- value: ':ok_hand:',
- type: 'emoji'
- }, {
- label: '关注',
- value: ':eyes:',
- type: 'emoji'
- }, {
- label: '爱心',
- value: ':heart:',
- type: 'emoji'
- }, {
- label: '开心',
- value: ':laughing:',
- type: 'emoji'
- }, {
- label: '困惑',
- value: ':confused:',
- type: 'emoji'
- }, {
- label: '悲伤',
- value: ':cry:',
- type: 'emoji'
- }];
-
- this.tags = _commonTags2.default;
- }
-
- EmChatContentItemFootbar.prototype.attached = function attached() {
- var _this = this;
-
- $([this.addEmojiRef]).popup({
- inline: true,
- hoverable: true
- });
- $([this.addTagRef]).popup({
- inline: true,
- hoverable: true,
-
- onHide: function onHide() {
- _this.isCustomTag = false;
- $(_this.tagRef).val('');
- }
- });
- };
-
- EmChatContentItemFootbar.prototype.toggleChatLabelHandler = function toggleChatLabelHandler(item) {
- var _this2 = this;
-
- $.post('/admin/chat/' + (nsCtx.isAt ? 'direct' : 'channel') + '/label/toggle', {
- url: nsCtx.isAt ? utils.getBasePath() : utils.getUrl(),
- meta: item.type == 'emoji' ? $(emojify.replace(item.value)).attr('src') : item.value,
- type: item.type == 'emoji' ? 'Emoji' : 'Tag',
- contentHtml: utils.md2html(this.chat.content),
- name: item.value,
- desc: item.label,
- id: this.chat.id
- }, function (data, textStatus, xhr) {
- if (data.success) {
- var cl = _.find(_this2.chat.chatLabels, { id: data.data.id });
- if (cl) {
- cl.voters = data.data.voters;
- } else {
- _this2.chat.chatLabels = [].concat(_this2.chat.chatLabels, [data.data]);
- }
- bs.signal('sg-chatlabel-refresh');
- } else {
- toastr.error(data.data);
- }
- });
- };
-
- EmChatContentItemFootbar.prototype.toggleCustomTagHandler = function toggleCustomTagHandler() {
- var _this3 = this;
-
- if (this.isCustomTag) {
- var v = $(this.tagRef).val();
- if (v) {
- this.toggleChatLabelHandler({
- label: v,
- value: v,
- type: 'Tag'
- });
- $(this.tagRef).val('');
- }
- } else {
- _.defer(function () {
- return $(_this3.tagRef).focus();
- });
- }
- this.isCustomTag = !this.isCustomTag;
- };
-
- EmChatContentItemFootbar.prototype.tagKeyupHandler = function tagKeyupHandler() {
- this.toggleCustomTagHandler();
- };
-
- return EmChatContentItemFootbar;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'chat', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class;
-});
-define('resources/elements/em-chat-content-item',['exports', 'aurelia-framework'], function (exports, _aureliaFramework) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmChatContentItem = undefined;
-
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
-
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
-
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
-
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
-
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
-
- return desc;
- }
-
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
-
- var _dec, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6;
-
- var EmChatContentItem = exports.EmChatContentItem = (_dec = (0, _aureliaFramework.bindable)({ defaultBindingMode: _aureliaFramework.bindingMode.twoWay }), (0, _aureliaFramework.containerless)(_class = (_class2 = function () {
- function EmChatContentItem() {
- var _this = this;
-
- _classCallCheck(this, EmChatContentItem);
-
- _initDefineProp(this, 'chats', _descriptor, this);
-
- _initDefineProp(this, 'loginUser', _descriptor2, this);
-
- _initDefineProp(this, 'isAt', _descriptor3, this);
-
- _initDefineProp(this, 'channel', _descriptor4, this);
-
- _initDefineProp(this, 'markId', _descriptor5, this);
-
- _initDefineProp(this, 'chatTo', _descriptor6, this);
-
- this.members = [];
- this.basePath = utils.getBasePath();
-
- this.subscribe = ea.subscribe(nsCons.EVENT_CHAT_CHANNEL_MEMBER_ADD_OR_REMOVE, function (payload) {
- _this.members = [nsCtx.memberAll].concat(payload.members);
- });
- }
-
- EmChatContentItem.prototype.unbind = function unbind() {
- this.subscribe.dispose();
- };
-
- EmChatContentItem.prototype.attached = function attached() {
- var _this2 = this;
-
- $('.tms-chat-direct').on('click', '.markdown-body .at-user', function (event) {
- event.preventDefault();
- ea.publish(nsCons.EVENT_CHAT_MSG_INSERT, {
- content: '{~' + $(event.currentTarget).attr('data-value') + '} '
- });
- });
-
- $('.tms-chat-direct').on('mouseenter', '.markdown-body a[href*="#/chat/"]:not(.pp-not)', function (event) {
- event.preventDefault();
- var $a = $(event.currentTarget);
- ea.publish(nsCons.EVENT_CHAT_MSG_POPUP_SHOW, {
- id: utils.urlQuery('id', $a.attr('href')),
- target: event.currentTarget
- });
- });
-
- $('.tms-chat-direct').on('mouseenter', '.tms-content-body .em-chat-content-item', function (event) {
- event.preventDefault();
- var $c = $(event.currentTarget);
-
- ea.publish(nsCons.EVENT_CHAT_MSG_WIKI_DIR, {
- dir: utils.dir($c.find('> .content > .markdown-body'))
- });
- });
-
- $('.tms-chat-direct').on('click', '.panel-wiki-dir .wiki-dir-item', function (event) {
- event.preventDefault();
- ea.publish(nsCons.EVENT_CHAT_CONTENT_SCROLL_TO, { target: $('#' + $(event.currentTarget).attr('data-id')) });
- });
-
- $('.tms-chat-direct').on('mouseenter', 'span[data-value].at-user:not(.pp-not),a[data-value].author:not(.pp-not)', function (event) {
- event.preventDefault();
- var $a = $(event.currentTarget);
- ea.publish(nsCons.EVENT_CHAT_MEMBER_POPUP_SHOW, {
- channel: _this2.channel,
- username: $a.attr('data-value'),
- target: event.currentTarget
- });
- });
-
- this.initHotkeys();
- };
-
- EmChatContentItem.prototype.channelChanged = function channelChanged() {
-
- if (this.channel) {
- this.members = [nsCtx.memberAll].concat(this.channel.members);
- } else {
- this.members = [];
- }
- };
-
- EmChatContentItem.prototype.deleteHandler = function deleteHandler(item) {
- var _this3 = this;
-
- this.emConfirmModal.show({
- onapprove: function onapprove() {
-
- var url = void 0;
-
- if (_this3.isAt) {
- url = '/admin/chat/direct/delete';
- } else {
- url = '/admin/chat/channel/delete';
- }
-
- $.post(url, {
- id: item.id
- }, function (data, textStatus, xhr) {
- if (data.success) {
- _this3.chats = _.reject(_this3.chats, {
- id: item.id
- });
- toastr.success('删除消息成功!');
- } else {
- toastr.error(data.data, '删除消息失败!');
- }
- });
- }
- });
- };
-
- EmChatContentItem.prototype.initHotkeys = function initHotkeys() {
- var _this4 = this;
-
- $(document).bind('keydown', 'e', function (evt) {
- evt.preventDefault();
- var chat = _.findLast(_this4.chats, function (c) {
- return c.creator.username == _this4.loginUser.username;
- });
- if (chat) {
- _this4.editHandler(chat, $('.em-chat-content-item[data-id="' + chat.id + '"]').find('> .content > textarea'));
- }
- });
- };
-
- EmChatContentItem.prototype.editHandler = function editHandler(item, editTxtRef) {
-
- $.get('/admin/chat/' + (this.isAt ? 'direct' : 'channel') + '/get', {
- id: item.id
- }, function (data) {
- if (data.success) {
- if (item.version != data.data.version) {
- _.extend(item, data.data);
- }
- item.isEditing = true;
- item.contentOld = item.content;
- _.defer(function () {
- $(editTxtRef).focus().select();
- autosize.update(editTxtRef);
- });
- } else {
- toastr.error(data.data);
- }
- });
- };
-
- EmChatContentItem.prototype.editOkHandler = function editOkHandler(evt, item, txtRef) {
- this.editSave(item, txtRef);
- item.isEditing = false;
- };
-
- EmChatContentItem.prototype.editCancelHandler = function editCancelHandler(evt, item, txtRef) {
- item.content = item.contentOld;
- $(txtRef).val(item.content);
- item.isEditing = false;
- };
-
- EmChatContentItem.prototype.editSave = function editSave(item, txtRef) {
- var _this5 = this;
-
- this.sending = true;
-
- item.content = $(txtRef).val();
-
- var html = utils.md2html(item.content);
- var htmlOld = utils.md2html(item.contentOld);
-
- var url = void 0;
- var data = void 0;
-
- if (this.isAt) {
- url = '/admin/chat/direct/update';
- data = {
- baseUrl: utils.getBaseUrl(),
- path: wurl('path'),
- id: item.id,
- content: item.content,
- diff: utils.diffS(item.contentOld, item.content)
- };
- } else {
- url = '/admin/chat/channel/update';
- data = {
- url: utils.getUrl(),
- id: item.id,
- version: item.version,
- usernames: utils.parseUsernames(item.content, this.members).join(','),
- content: item.content,
- diff: utils.diffS(item.contentOld, item.content)
- };
- }
-
- $.post(url, data, function (data, textStatus, xhr) {
- if (data.success) {
- toastr.success('更新消息成功!');
- item.isEditing = false;
- item.version = data.data.version;
- } else {
- toastr.error(data.data, '更新消息失败!');
- }
- }).always(function () {
- _this5.sending = false;
- });
- };
-
- EmChatContentItem.prototype.eidtKeydownHandler = function eidtKeydownHandler(evt, item, txtRef) {
-
- if (this.sending) {
- return false;
- }
-
- if (evt.ctrlKey && evt.keyCode === 13) {
-
- this.editSave(item, txtRef);
-
- return false;
- } else if (evt.ctrlKey && evt.keyCode === 85) {
- $(txtRef).next('.tms-edit-actions').find('.upload').click();
- return false;
- } else if (evt.keyCode === 27) {
- this.editCancelHandler(evt, item, txtRef);
- }
-
- return true;
- };
-
- EmChatContentItem.prototype.notifyRendered = function notifyRendered(last, item) {
- if (last) {
- _.defer(function () {
- ea.publish(nsCons.EVENT_CHAT_LAST_ITEM_RENDERED, {
- item: item
- });
- });
- }
- };
-
- EmChatContentItem.prototype.stowHandler = function stowHandler(item) {
-
- if (item.isStow) {
- this.unStowHandler(item);
- return;
- }
-
- $.post('/admin/chat/channel/stow', {
- id: item.id
- }, function (data, textStatus, xhr) {
- item.isStow = true;
- if (data.success) {
- item.stowId = data.data.id;
- toastr.success('收藏消息成功!');
- } else {
- item.stowId = data.msgs && data.msgs.length > 0 ? data.msgs[0].id : '';
- }
- });
- };
-
- EmChatContentItem.prototype.unStowHandler = function unStowHandler(item) {
- if (!item.stowId) {
- return;
- }
- $.post('/admin/chat/channel/removeStow', {
- id: item.stowId
- }, function (data, textStatus, xhr) {
- item.isStow = false;
- item.stowId = '';
- if (data.success) {
- toastr.success('移除收藏消息成功!');
- } else {}
- });
- };
-
- EmChatContentItem.prototype.openEditHandler = function openEditHandler(item) {
- $.post('/admin/chat/channel/openEdit', {
- id: item.id,
- open: !item.openEdit
- }, function (data, textStatus, xhr) {
- if (data.success) {
- item.openEdit = !item.openEdit;
- toastr.success((item.openEdit ? '开启' : '关闭') + '\u534F\u4F5C\u7F16\u8F91\u6210\u529F!');
- } else {
- toastr.success((!item.openEdit ? '开启' : '关闭') + '\u534F\u4F5C\u7F16\u8F91\u5931\u8D25!');
- }
- });
- };
-
- EmChatContentItem.prototype.replyHandler = function replyHandler(item) {
- ea.publish(nsCons.EVENT_CHAT_MSG_INSERT, {
- content: '[[\u56DE\u590D#' + item.id + '](' + utils.getUrl() + '?id=' + item.id + '){~' + item.creator.username + '}]\n\n'
- });
-
- $.post('/admin/chat/channel/markAsReadedByChat', {
- chatId: item.id
- });
- };
-
- EmChatContentItem.prototype.creatorNameHandler = function creatorNameHandler(item) {
- ea.publish(nsCons.EVENT_CHAT_MSG_INSERT, {
- content: '{~' + item.creator.username + '} '
- });
- };
-
- EmChatContentItem.prototype.refreshHandler = function refreshHandler(item) {
- $.get('/admin/chat/channel/get', {
- id: item.id
- }, function (data) {
- if (item.version != data.data.version) {
- _.extend(item, data.data);
- toastr.success('刷新同步成功!');
- } else {
- toastr.info('消息内容暂无变更!');
- }
- });
- };
-
- EmChatContentItem.prototype.likeHandler = function likeHandler(item, isLike) {
-
- if (isLike && item.isZanVoted || !isLike && item.isCaiVoted) {
- return;
- }
-
- $.post('/admin/chat/channel/vote', {
- id: item.id,
- url: utils.getUrl(),
- contentHtml: utils.md2html(item.content),
- type: isLike ? 'Zan' : 'Cai'
- }, function (data, textStatus, xhr) {
- if (data.success) {
- _.extend(item, data.data);
- if (isLike) {
- item.isZanVoted = true;
- } else {
- item.isCaiVoted = true;
- }
- } else {
- toastr.error(data.data);
- }
- });
- };
-
- EmChatContentItem.prototype.pinHandler = function pinHandler(item) {
- $.post('/admin/chat/channel/pin/toggle', {
- id: item.id,
- cid: this.channel.id
- }, function (data, textStatus, xhr) {
- if (data.success) {
- toastr.success('' + (data.code == 200 ? '固定频道消息成功!' : '解除固定频道消息成功!'));
- item.isPin = data.code == 200;
- } else {
- toastr.error(data.data);
- }
- });
- };
-
- return EmChatContentItem;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'chats', [_dec], {
- enumerable: true,
- initializer: null
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'loginUser', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'isAt', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'channel', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, 'markId', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, 'chatTo', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class);
-});
-define('resources/elements/em-chat-input',['exports', 'aurelia-framework', 'common/common-tips', 'common/common-emoji', 'simplemde', 'textcomplete'], function (exports, _aureliaFramework, _commonTips, _commonEmoji, _simplemde) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmChatInput = undefined;
-
- var _commonTips2 = _interopRequireDefault(_commonTips);
-
- var _commonEmoji2 = _interopRequireDefault(_commonEmoji);
-
- var _simplemde2 = _interopRequireDefault(_simplemde);
-
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
- }
-
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
-
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
-
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
-
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
-
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
-
- return desc;
- }
-
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
-
- var _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3;
-
- var EmChatInput = exports.EmChatInput = (0, _aureliaFramework.containerless)(_class = (_class2 = function () {
- EmChatInput.prototype.channelChanged = function channelChanged() {
-
- if (this.channel) {
- this.members = [nsCtx.memberAll].concat(this.channel.members);
- } else {
- this.members = [];
- }
- };
-
- function EmChatInput() {
- var _this2 = this;
-
- _classCallCheck(this, EmChatInput);
-
- _initDefineProp(this, 'chatTo', _descriptor, this);
-
- _initDefineProp(this, 'isAt', _descriptor2, this);
-
- _initDefineProp(this, 'channel', _descriptor3, this);
-
- this.members = [];
- this.isMobile = utils.isMobile();
-
- this.subscribe = ea.subscribe(nsCons.EVENT_SHOW_HOTKEYS_MODAL, function (payload) {
- _this2.emHotkeysModal.show();
- });
- this.subscribe1 = ea.subscribe(nsCons.EVENT_CHAT_CHANNEL_MEMBER_ADD_OR_REMOVE, function (payload) {
- _this2.members = [nsCtx.memberAll].concat(payload.members);
- });
- this.subscribe2 = ea.subscribe(nsCons.EVENT_CHAT_MSG_INSERT, function (payload) {
- _this2.insertContent(payload.content);
- });
- }
-
- EmChatInput.prototype.unbind = function unbind() {
- this.subscribe.dispose();
- this.subscribe1.dispose();
- this.subscribe2.dispose();
- };
-
- EmChatInput.prototype.initHotkeys = function initHotkeys() {
- var _this3 = this;
-
- $(document).bind('keydown', 'r', function () {
- event.preventDefault();
- _this3.simplemde.codemirror.focus();
- });
- };
-
- EmChatInput.prototype.attached = function attached() {
- this.initSimpleMDE(this.chatInputRef);
- this.initDropzone();
- this.initPaste();
- this.initHotkeys();
- };
-
- EmChatInput.prototype.initPaste = function initPaste() {
- var _this4 = this;
-
- var $paste = void 0;
- if (this.$chatMsgInputRef.is('textarea')) {
- $paste = $(this.$chatMsgInputRef).pastableTextarea();
- } else {
- $paste = $(this.$chatMsgInputRef).pastableContenteditable();
- }
-
- $paste && $paste.on('pasteImage', function (ev, data) {
-
- $.post('/admin/file/base64', {
- dataURL: data.dataURL,
- type: data.blob.type,
- toType: nsCtx.isAt ? 'User' : 'Channel',
- toId: nsCtx.chatTo
- }, function (data, textStatus, xhr) {
- if (data.success) {
- _this4.insertContent(''.replace(/\{name\}/g, data.data.name).replace(/\{baseURL\}/g, utils.getBaseUrl() + '/').replace(/\{path\}/g, data.data.path).replace(/\{uuidName\}/g, data.data.uuidName));
- }
- });
- }).on('pasteImageError', function (ev, data) {
- toastr.error(data.message, '剪贴板粘贴图片错误!');
- });
- };
-
- EmChatInput.prototype.initDropzone = function initDropzone() {
- var _this5 = this;
-
- this.initUploadDropzone($('.CodeMirror-wrap', this.inputRef), function () {
- return _this5.$chatMsgInputRef;
- }, false);
- this.initUploadDropzone($(this.btnItemUploadRef).children().andSelf(), function () {
- return _this5.$chatMsgInputRef;
- }, true);
-
- $(this.chatBtnRef).popup({
- inline: true,
- hoverable: true,
- position: 'bottom left',
- delay: {
- show: 300,
- hide: 300
- }
- });
- };
-
- EmChatInput.prototype.initUploadDropzone = function initUploadDropzone(domRef, getInputTargetCb, clickable) {
-
- var _this = this;
-
- $(domRef).dropzone({
- url: "/admin/file/upload",
- paramName: 'file',
- clickable: !!clickable,
- dictDefaultMessage: '',
- maxFilesize: 10,
- addRemoveLinks: true,
- previewsContainer: this.chatStatusBarRef,
- previewTemplate: this.previewTemplateRef.innerHTML,
- dictCancelUpload: '取消上传',
- dictCancelUploadConfirmation: '确定要取消上传吗?',
- dictFileTooBig: '文件过大({{filesize}}M),最大限制:{{maxFilesize}}M',
- init: function init() {
- this.on("sending", function (file, xhr, formData) {
- if (!getInputTargetCb()) {
- this.removeAllFiles(true);
- } else {
- formData.append('toType', nsCtx.isAt ? 'User' : 'Channel');
- formData.append('toId', nsCtx.chatTo);
- }
- });
- this.on("success", function (file, data) {
- if (data.success) {
-
- $.each(data.data, function (index, item) {
- if (item.type == 'Image') {
- _this.insertContent(' '.replace(/\{name\}/g, item.name).replace(/\{baseURL\}/g, utils.getBaseUrl() + '/').replace(/\{path\}/g, item.path).replace(/\{uuidName\}/g, item.uuidName));
- } else {
- _this.insertContent('[{name}]({baseURL}{path}{uuidName}) '.replace(/\{name\}/g, item.name).replace(/\{baseURL\}/g, utils.getBaseUrl() + '/').replace(/\{path\}/g, "admin/file/download/").replace(/\{uuidName\}/g, item.id));
- }
- });
- toastr.success('上传成功!');
- } else {
- toastr.error(data.data, '上传失败!');
- }
- });
- this.on("error", function (file, errorMessage, xhr) {
- toastr.error(errorMessage, '上传失败!');
- });
- this.on("complete", function (file) {
- this.removeFile(file);
- });
- }
- });
- };
-
- EmChatInput.prototype.initSimpleMDE = function initSimpleMDE(textareaDom) {
- var _this6 = this;
-
- this.simplemde = new _simplemde2.default({
- element: textareaDom,
- spellChecker: false,
- status: false,
- autofocus: true,
- toolbar: false,
-
- autoDownloadFontAwesome: false,
- insertTexts: {
- table: ["", "\n\n| 列1 | 列2 | 列3 |\n| ------ | ------ | ------ |\n| 文本 | 文本 | 文本 |\n\n"]
- },
- previewRender: function previewRender(plainText, preview) {
- return _this6.simplemde.markdown(utils.preParse(plainText));
- }
- });
-
- this.$chatMsgInputRef = $(this.inputRef).find('.textareaWrapper .CodeMirror textarea');
- if (this.$chatMsgInputRef.size() === 0) {
- this.$chatMsgInputRef = $(this.inputRef).find('.textareaWrapper .CodeMirror [contenteditable="true"]');
- }
-
- this.initTextcomplete();
- };
-
- EmChatInput.prototype.initTextcomplete = function initTextcomplete() {
- var _this7 = this;
-
- $(this.$chatMsgInputRef).textcomplete([{
- match: /(|\b)(\/.*)$/,
- search: function search(term, callback) {
- var keys = _.keys(_commonTips2.default);
- callback($.map(keys, function (key) {
- return key.indexOf(term) === 0 ? key : null;
- }));
- },
- template: function template(value, term) {
- return _commonTips2.default[value].label;
- },
- replace: function replace(value) {
- if (_this7.tipsActionHandler(value)) {
- _this7.setCaretPosition(_commonTips2.default[value].line, _commonTips2.default[value].ch);
- return '$1' + _commonTips2.default[value].value;
- } else {
- return '';
- }
- }
- }, {
- match: /(^|\s)@(\w*)$/,
- search: function search(term, callback) {
- callback($.map(_this7.members, function (member) {
- return member.enabled && member.username.indexOf(term) >= 0 ? member.username : null;
- }));
- },
- template: function template(value, term) {
- var user = _.find(_this7.members, { username: value });
- return user.name + ' - ' + user.mails + ' (' + user.username + ')';
- },
- replace: function replace(value) {
- return '$1{~' + value + '}';
- }
- }, {
- match: /(^|\s):([\+\-\w]*)$/,
- search: function search(term, callback) {
- callback($.map(_commonEmoji2.default, function (emoji) {
- return _.some(emoji.split('_'), function (item) {
- return item.indexOf(term) === 0;
- }) ? emoji : null;
- }));
- },
- template: function template(value, term) {
- if (value == 'search') {
- return '\u8868\u60C5\u67E5\u627E - :search';
- }
- var emojiKey = ':' + value + ':';
- return emojify.replace(emojiKey) + ' - ' + emojiKey;
- },
- replace: function replace(value) {
- if (_this7.tipsActionHandler(value)) {
- return '$1:' + value + ': ';
- } else {
- return '';
- }
- }
- }], {
- appendTo: '.tms-chat-status-bar',
- maxCount: nsCons.NUM_TEXT_COMPLETE_MAX_COUNT
- });
-
- this.simplemde.codemirror.on('keydown', function (cm, e) {
- if (_.includes([13, 38, 40], e.keyCode) && _this7.isTipsShow()) {
- e.preventDefault();
- } else if (e.ctrlKey && e.keyCode === 13) {
- _this7.sendChatMsg();
- } else if (e.keyCode === 27) {
- _this7.simplemde.value('');
- } else if (e.ctrlKey && e.keyCode == 85) {
- $(_this7.btnItemUploadRef).find('.content').click();
- } else if (e.ctrlKey && e.keyCode == 191) {
- _this7.emHotkeysModal.show();
- }
- });
- };
-
- EmChatInput.prototype.setCaretPosition = function setCaretPosition(line, ch) {
- var _this8 = this;
-
- (line || ch) && _.delay(function () {
- var cr = _this8.simplemde.codemirror.getCursor();
- _this8.simplemde.codemirror.setCursor({
- line: cr.line - (line ? line : 0),
- ch: cr.line ? ch ? ch : 0 : cr.ch - (ch ? ch : 0)
- });
- }, 100);
- };
-
- EmChatInput.prototype.sendChatMsg = function sendChatMsg() {
- var _this9 = this;
-
- var content = this.simplemde.value();
-
- if (!$.trim(content)) {
- this.simplemde.value('');
- return;
- }
-
- if (this.sending) {
- return;
- }
-
- this.sending = true;
-
- var html = utils.md2html(content);
-
- var url = void 0;
- var data = void 0;
- if (this.isAt) {
- url = '/admin/chat/direct/create';
- data = {
- baseUrl: utils.getBaseUrl(),
- path: wurl('path'),
- chatTo: this.chatTo,
- content: content,
- contentHtml: html
- };
- } else {
- url = '/admin/chat/channel/create';
- data = {
- url: utils.getUrl(),
- channelId: this.channel.id,
- usernames: utils.parseUsernames(content, this.members).join(','),
- content: content,
- contentHtml: html
- };
- }
- $.post(url, data, function (data, textStatus, xhr) {
- if (data.success) {
- _this9.simplemde.value('');
- ea.publish(nsCons.EVENT_CHAT_MSG_SENDED, {
- data: data
- });
- } else {
- toastr.error(data.data, '发送消息失败!');
- }
- }).always(function () {
- _this9.sending = false;
- });
- };
-
- EmChatInput.prototype.sendChatMsgHandler = function sendChatMsgHandler() {
- this.sendChatMsg();
- };
-
- EmChatInput.prototype.isTipsShow = function isTipsShow() {
- return $(this.chatStatusBarRef).find('.textcomplete-dropdown:visible').size() === 1;
- };
-
- EmChatInput.prototype.insertContent = function insertContent(content, mde) {
- try {
- var cm = mde ? mde.codemirror : this.simplemde.codemirror;
- var cursor = cm.getCursor();
- if (cursor) {
- cm.replaceRange(content, cursor, cursor);
- cm.focus();
- }
- } catch (err) {
- console.log(err);
- }
- };
-
- EmChatInput.prototype.tipsActionHandler = function tipsActionHandler(value) {
- if (value == '/upload') {
- $(this.btnItemUploadRef).find('.content').click();
- } else if (value == '/shortcuts') {
- this.emHotkeysModal.show();
- } else if (value == 'search') {
- _.delay(function () {
- utils.openNewWin(nsCons.STR_EMOJI_SEARCH_URL);
- }, 200);
- } else {
- return true;
- }
-
- return false;
- };
-
- EmChatInput.prototype.togglePreviewHandler = function togglePreviewHandler() {
- this.simplemde.togglePreview();
- };
-
- return EmChatInput;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'chatTo', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'isAt', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'channel', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class;
-});
-define('resources/elements/em-chat-member-popup',['exports', 'aurelia-framework'], function (exports, _aureliaFramework) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmChatMemberPopup = undefined;
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- var _class;
-
- var EmChatMemberPopup = exports.EmChatMemberPopup = (0, _aureliaFramework.containerless)(_class = function () {
- function EmChatMemberPopup() {
- var _this = this;
-
- _classCallCheck(this, EmChatMemberPopup);
-
- this.members = [];
- this.member = {};
-
- this.subscribe = ea.subscribe(nsCons.EVENT_CHAT_MEMBER_POPUP_SHOW, function (payload) {
- _this.channel = payload.channel;
- _this.username = payload.username;
- _this.target = payload.target;
- if (_this.username == 'all') {
- if (!_this.channel) {
- return;
- }
- _this.members = _this.channel.members;
- } else {
- _this.member = utils.getUser(_this.username);
- var user = utils.getUser(_this.member.creator);
- _this.member.creatorName = user && !!user.name ? user.name : _this.member.creator;
- }
- _.defer(function () {
-
- $(_this.target).popup({
- popup: _this.popup,
- hoverable: true,
- inline: false,
- silent: true,
- movePopup: false,
- position: 'bottom left',
- jitter: 300,
- prefer: 'opposite',
-
- delay: {
- show: 300,
- hide: 300
- }
- }).popup('show');
- });
- });
- }
-
- EmChatMemberPopup.prototype.unbind = function unbind() {
- this.subscribe.dispose();
- };
-
- return EmChatMemberPopup;
- }()) || _class;
-});
-define('resources/elements/em-chat-msg-popup',['exports', 'aurelia-framework'], function (exports, _aureliaFramework) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmChatMsgPopup = undefined;
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- var _class;
-
- var EmChatMsgPopup = exports.EmChatMsgPopup = (0, _aureliaFramework.containerless)(_class = function () {
- function EmChatMsgPopup() {
- var _this = this;
-
- _classCallCheck(this, EmChatMsgPopup);
-
- this.subscribe = ea.subscribe(nsCons.EVENT_CHAT_MSG_POPUP_SHOW, function (payload) {
- _this.id = payload.id;
- _this.target = payload.target;
-
- if (!_this.id) {
- return;
- }
-
- $(_this.target).popup({
- popup: _this.popup,
- hoverable: true,
- inline: false,
- movePopup: false,
-
- silent: true,
- position: 'bottom left',
- jitter: 300,
- prefer: 'opposite',
- delay: {
- show: 300,
- hide: 300
- },
- onShow: function onShow() {
- $.get('/admin/chat/channel/get', {
- id: _this.id
- }, function (data) {
- if (data.success) {
- _this.chatMsg = data.data;
- } else {
- toastr.error(data.data, "加载失败!");
- }
- });
- }
- }).popup('show');
- });
- }
-
- EmChatMsgPopup.prototype.unbind = function unbind() {
- this.subscribe.dispose();
- };
-
- return EmChatMsgPopup;
- }()) || _class;
-});
-define('resources/elements/em-chat-msg',['exports', 'aurelia-framework'], function (exports, _aureliaFramework) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmChatMsg = undefined;
-
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
-
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
-
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
-
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
-
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
-
- return desc;
- }
-
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
-
- var _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5;
-
- var EmChatMsg = exports.EmChatMsg = (0, _aureliaFramework.containerless)(_class = (_class2 = function () {
- function EmChatMsg() {
- _classCallCheck(this, EmChatMsg);
-
- this.last = true;
-
- _initDefineProp(this, 'loginUser', _descriptor, this);
-
- _initDefineProp(this, 'isAt', _descriptor2, this);
-
- _initDefineProp(this, 'channel', _descriptor3, this);
-
- _initDefineProp(this, 'chats', _descriptor4, this);
-
- _initDefineProp(this, 'actived', _descriptor5, this);
-
- this.basePath = utils.getBasePath();
- }
-
- EmChatMsg.prototype.attached = function attached() {
- this.initHotkeys();
- };
-
- EmChatMsg.prototype.initHotkeys = function initHotkeys() {
- var _this = this;
-
- $(document).bind('keydown', 'o', function (event) {
- event.preventDefault();
- var item = _.find(_this.chats, { isHover: true });
- item && (item.isOpen = !item.isOpen);
- });
- };
-
- EmChatMsg.prototype.activedChanged = function activedChanged() {
- if (!this.actived) {
- return;
- }
-
- var payload = this.actived.payload;
- var result = payload.result;
-
- if (this.actived.payload.action == nsCons.ACTION_TYPE_AT) {
- this.page = result;
- this.chats = _.map(result.content, function (item) {
- var chatChannel = item.chatChannel;
- chatChannel.chatAt = item;
- return chatChannel;
- });
- this.last = result.last;
- this.moreCnt = result.totalElements - (result.number + 1) * result.size;
- } else if (this.actived.payload.action == nsCons.ACTION_TYPE_STOW) {
- this.chats = payload.result;
- this.last = true;
- } else if (this.actived.payload.action == nsCons.ACTION_TYPE_PIN) {
- this.chats = payload.result;
- this.last = true;
- } else if (this.actived.payload.action == nsCons.ACTION_TYPE_SEARCH) {
- this.search = payload.search;
- this.page = result;
- this.chats = result.content;
- this.last = result.last;
- this.moreCnt = result.totalElements - (result.number + 1) * result.size;
- }
- };
-
- EmChatMsg.prototype.searchItemMouseleaveHandler = function searchItemMouseleaveHandler(item) {
- item.isOpen = false;
- item.isHover = false;
- };
-
- EmChatMsg.prototype.searchItemMouseenterHandler = function searchItemMouseenterHandler(item) {
- item.isHover = true;
- };
-
- EmChatMsg.prototype.gotoChatHandler = function gotoChatHandler(item) {
- ea.publish(nsCons.EVENT_CHAT_SEARCH_GOTO_CHAT_ITEM, { chatItem: item });
- };
-
- EmChatMsg.prototype.openSearchItemHandler = function openSearchItemHandler(item) {
- item.isOpen = !item.isOpen;
- };
-
- EmChatMsg.prototype.searchMoreHandler = function searchMoreHandler() {
- var _this2 = this;
-
- if (this.actived.payload.action == nsCons.ACTION_TYPE_SEARCH) {
- this.searchMoreP = $.get('/admin/chat/direct/search', {
- search: this.search,
- size: this.page.size,
- page: this.page.number + 1
- }, function (data) {
- if (data.success) {
- _this2.chats = _.concat(_this2.chats, data.data.content);
-
- _this2.page = data.data;
- _this2.last = data.data.last;
- _this2.moreCnt = data.data.totalElements - (data.data.number + 1) * data.data.size;
- }
- });
- } else {
- this.searchMoreP = $.get('/admin/chat/channel/getAts', {
- size: this.page.size,
- page: this.page.number + 1
- }, function (data) {
- if (data.success) {
- _this2.chats = _.concat(_this2.chats, _.map(data.data.content, function (item) {
- var chatChannel = item.chatChannel;
- chatChannel.chatAt = item;
- return chatChannel;
- }));
-
- _this2.page = data.data;
- _this2.last = data.data.last;
- _this2.moreCnt = data.data.totalElements - (data.data.number + 1) * data.data.size;
- }
- });
- }
- };
-
- EmChatMsg.prototype.removePinHandler = function removePinHandler(item) {
- var _this3 = this;
-
- $.post('/admin/chat/channel/pin/toggle', {
- id: item.id,
- cid: this.channel.id
- }, function (data, textStatus, xhr) {
- if (data.success) {
- _this3.chats = _.reject(_this3.chats, {
- id: item.id
- });
- toastr.success('移除固定消息成功!');
- } else {
- toastr.error(data.data, '移除固定消息失败!');
- }
- });
- };
-
- EmChatMsg.prototype.removeStowHandler = function removeStowHandler(item) {
- var _this4 = this;
-
- $.post('/admin/chat/channel/removeStow', {
- id: item.chatStow.id
- }, function (data, textStatus, xhr) {
- if (data.success) {
- _this4.chats = _.reject(_this4.chats, {
- id: item.id
- });
- toastr.success('移除收藏消息成功!');
- } else {
- toastr.error(data.data, '移除收藏消息失败!');
- }
- });
- };
-
- EmChatMsg.prototype.removeAtHandler = function removeAtHandler(item) {
- var _this5 = this;
-
- $.post('/admin/chat/channel/markAsReaded', {
- chatAtId: item.chatAt.id
- }, function (data, textStatus, xhr) {
- if (data.success) {
- _this5.chats = _.reject(_this5.chats, {
- id: item.id
- });
- } else {
- toastr.error(data.data, '移除@消息失败!');
- }
- });
- };
-
- return EmChatMsg;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'loginUser', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'isAt', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'channel', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'chats', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, 'actived', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class;
-});
-define('resources/elements/em-chat-schedule-edit',['exports', 'aurelia-framework'], function (exports, _aureliaFramework) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmChatScheduleEdit = undefined;
-
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
-
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
-
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
-
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
-
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
-
- return desc;
- }
-
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
-
- var _class, _desc, _value, _class2, _descriptor;
-
- var EmChatScheduleEdit = exports.EmChatScheduleEdit = (0, _aureliaFramework.containerless)(_class = (_class2 = function () {
- function EmChatScheduleEdit() {
- var _this = this;
-
- _classCallCheck(this, EmChatScheduleEdit);
-
- _initDefineProp(this, 'loginUser', _descriptor, this);
-
- this.actorsOpts = {
- onAdd: function onAdd(addedValue, addedText, $addedChoice) {
- $.post('/admin/schedule/addActors', {
- id: _this.event.id,
- basePath: utils.getBasePath(),
- actors: addedValue
- }, function (data, textStatus, xhr) {
- if (data.success) {
- toastr.success('添加参与者成功!');
- ea.publish(nsCons.EVENT_SCHEDULE_REFRESH, {});
- } else {
- toastr.error(data.data);
- }
- });
- },
- onLabelRemove: function onLabelRemove(removedValue) {
- if (_this.loginUser.username == removedValue) {
- return false;
- }
- $.post('/admin/schedule/removeActors', {
- id: _this.event.id,
- basePath: utils.getBasePath(),
- actors: removedValue
- }, function (data, textStatus, xhr) {
- if (data.success) {
- toastr.success('移除参与者成功!');
- ea.publish(nsCons.EVENT_SCHEDULE_REFRESH, {});
- } else {
- toastr.error(data.data);
- }
- });
- }
- };
- }
-
- EmChatScheduleEdit.prototype.attached = function attached() {
- $(this.startRef).calendar({
- today: true,
- endCalendar: $(this.endRef)
- });
- $(this.endRef).calendar({
- today: true,
- startCalendar: $(this.startRef)
- });
- };
-
- EmChatScheduleEdit.prototype.initMembersUI = function initMembersUI(last) {
- var _this2 = this;
-
- if (last) {
- _.defer(function () {
- var actors = [_this2.loginUser.username];
- if (_this2.event) {
- actors = _.map(_this2.event.actors, 'username');
- }
-
- $(_this2.actorsRef).dropdown().dropdown('clear').dropdown('set selected', actors).dropdown(_this2.actorsOpts);
- });
- }
- };
-
- EmChatScheduleEdit.prototype.titleKeyupHandler = function titleKeyupHandler(event) {
- if (event.ctrlKey && event.keyCode === 13) {
- this.updateHandler();
- }
- };
-
- EmChatScheduleEdit.prototype.clearStartDateHandler = function clearStartDateHandler() {
- $(this.startRef).calendar('clear');
- };
-
- EmChatScheduleEdit.prototype.clearEndDateHandler = function clearEndDateHandler() {
- $(this.endRef).calendar('clear');
- };
-
- EmChatScheduleEdit.prototype.show = function show(calEvent) {
- this.event = _.clone(calEvent);
-
- this.showHandler();
-
- $(this.scheduleEditRef).popup({
- on: 'click',
-
- inline: true,
- silent: true,
-
- position: 'bottom center',
- jitter: 300,
- prefer: 'opposite',
- delay: {
- show: 300,
- hide: 300
- }
- }).popup('show');
- };
-
- EmChatScheduleEdit.prototype.showHandler = function showHandler() {
- var _this3 = this;
-
- this.users = window.tmsUsers;
- $(this.actorsRef).dropdown().dropdown('clear');
- _.defer(function () {
- if (_this3.event.start) {
- $(_this3.startRef).calendar('set date', _this3.event.start.toDate());
- } else {
- $(_this3.startRef).calendar('clear');
- }
-
- if (_this3.event.end) {
- $(_this3.endRef).calendar('set date', _this3.event.end.toDate());
- } else {
- $(_this3.endRef).calendar('clear');
- }
-
- var actors = _.map(_this3.event.actors, 'username');
-
- $(_this3.actorsRef).dropdown('set selected', actors).dropdown(_this3.actorsOpts);
-
- if (_this3.event.creator.username == _this3.loginUser.username) {
- $(_this3.titleRef).focus();
- }
-
- autosize.update(_this3.titleRef);
- });
- };
-
- EmChatScheduleEdit.prototype.updateHandler = function updateHandler() {
- var _this4 = this;
-
- if (!this.event.title) {
- toastr.error('日程内容不能为空!');
- return;
- }
-
- var data = {
- id: this.event.id,
- basePath: utils.getBasePath(),
- title: this.event.title
- };
- var start = $(this.startRef).calendar('get date');
- var end = $(this.endRef).calendar('get date');
-
- if (start) {
- data.startDate = start;
- } else {
- data.startDate = new Date();
- }
-
- if (end) {
- data.endDate = end;
- }
-
- $.post('/admin/schedule/update2', data, function (data, textStatus, xhr) {
- if (data.success) {
- toastr.success('更新日程成功!');
- $(_this4.scheduleEditRef).popup('hide');
- ea.publish(nsCons.EVENT_SCHEDULE_REFRESH, {});
- } else {
- toastr.error(data.data);
- }
- });
- };
-
- EmChatScheduleEdit.prototype.delHandler = function delHandler() {
- var _this5 = this;
-
- this.emConfirmModal.show({
- onapprove: function onapprove() {
-
- $.post('/admin/schedule/delete', {
- id: _this5.event.id,
- basePath: utils.getBasePath()
- }, function (data, textStatus, xhr) {
- if (data.success) {
- toastr.success('日程删除成功!');
- ea.publish(nsCons.EVENT_SCHEDULE_REFRESH, {});
- } else {
- toastr.error(data.data);
- }
- });
- }
- });
- };
-
- return EmChatScheduleEdit;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'loginUser', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class;
-});
-define('resources/elements/em-chat-schedule-remind',['exports', 'aurelia-framework'], function (exports, _aureliaFramework) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmChatScheduleRemind = undefined;
-
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
-
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
-
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
-
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
-
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
-
- return desc;
- }
-
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
-
- var _class, _desc, _value, _class2, _descriptor;
-
- var EmChatScheduleRemind = exports.EmChatScheduleRemind = (0, _aureliaFramework.containerless)(_class = (_class2 = function () {
- function EmChatScheduleRemind() {
- _classCallCheck(this, EmChatScheduleRemind);
-
- _initDefineProp(this, 'events', _descriptor, this);
-
- this.interval = 5000;
- this.headOffset = 10 * 60 * 1000;
- this.reminded = [];
-
- this._pollCheck();
- }
-
- EmChatScheduleRemind.prototype.unbind = function unbind() {
- this.timer && clearInterval(this.timer);
- };
-
- EmChatScheduleRemind.prototype._pollCheck = function _pollCheck() {
- var _this = this;
-
- this.timer = setInterval(function () {
-
- if (!_this.events) {
- return;
- }
-
- var now = new Date().getTime();
- _.each(_this.events, function (event) {
- if (event.start && !_.includes(_this.reminded, event.id)) {
- var start = event.start;
- if (start > now && start < now + _this.headOffset) {
- _this.event = event;
- _this.reminded.push(event.id);
- _this._desktopPuh();
- _this.show();
- }
- }
- });
- }, this.interval);
- };
-
- EmChatScheduleRemind.prototype._desktopPuh = function _desktopPuh() {
- push.create('TMS日程提醒通知', {
- body: '\u5185\u5BB9: ' + this.event.title,
- icon: {
- x16: 'img/tms-x16.ico',
- x32: 'img/tms-x32.png'
- },
- timeout: 5000
- });
- };
-
- EmChatScheduleRemind.prototype.showHandler = function showHandler() {};
-
- EmChatScheduleRemind.prototype.approveHandler = function approveHandler() {};
-
- EmChatScheduleRemind.prototype.show = function show() {
- this.emModal.show({
- hideOnApprove: true,
- autoDimmer: false
- });
- };
-
- return EmChatScheduleRemind;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'events', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class;
-});
-define('resources/elements/em-chat-schedule',['exports', 'aurelia-framework', 'moment', 'fullcalendar', 'fullcalendar/dist/locale/zh-cn'], function (exports, _aureliaFramework, _moment) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmChatSchedule = undefined;
-
- var _moment2 = _interopRequireDefault(_moment);
-
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
- }
-
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
-
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
-
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
-
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
-
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
-
- return desc;
- }
-
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
-
- var _class, _desc, _value, _class2, _descriptor;
-
- var EmChatSchedule = exports.EmChatSchedule = (0, _aureliaFramework.containerless)(_class = (_class2 = function () {
- EmChatSchedule.prototype.show = function show() {
- var _this = this;
-
- this.users = window.tmsUsers;
-
- _.defer(function () {
- $(_this.scheduleRef).fullCalendar('today');
- });
- _.delay(function () {
- $(_this.scheduleRef).fullCalendar('option', 'height', 'parent');
- $(_this.scheduleRef).fullCalendar('refetchEvents');
- }, 500);
- };
-
- function EmChatSchedule() {
- var _this2 = this;
-
- _classCallCheck(this, EmChatSchedule);
-
- _initDefineProp(this, 'loginUser', _descriptor, this);
-
- this.offset = 100;
-
- this.actorsOpts = {
- onAdd: function onAdd(addedValue, addedText, $addedChoice) {},
- onLabelRemove: function onLabelRemove(removedValue) {
- if (_this2.loginUser.username == removedValue) {
- return false;
- }
- }
- };
-
- this.subscribe = ea.subscribe(nsCons.EVENT_SCHEDULE_REFRESH, function (payload) {
- $(_this2.scheduleRef).fullCalendar('refetchEvents');
- });
-
- this._getEvents();
- }
-
- EmChatSchedule.prototype._getEvents = function _getEvents(start, end, callback) {
- var _this3 = this;
-
- var data = {};
- if (start) {
- data.start = start.unix();
- }
- if (end) {
- data.start = end.unix();
- }
- $.get('/admin/schedule/listMy', data, function (data) {
- if (data.success) {
- _this3.events = _.map(data.data, function (item) {
- var event = {
- id: item.id,
- title: item.title,
- actors: item.actors,
- creator: item.creator
- };
-
- if (item.startDate) {
- event.start = item.startDate;
- } else {
- event.start = new Date().getTime();
- }
-
- if (item.endDate) {
- event.end = item.endDate;
- }
-
- return event;
- });
- callback && callback(_this3.events);
- }
- });
- };
-
- EmChatSchedule.prototype.unbind = function unbind() {
- this.subscribe.dispose();
- };
-
- EmChatSchedule.prototype.attached = function attached() {
- var _this4 = this;
-
- $(this.scheduleRef).fullCalendar({
- header: {
- left: 'prev,next today',
-
- center: 'title',
- right: 'month,agendaWeek,agendaDay,listWeek'
- },
-
- height: 'parent',
- defaultDate: new Date(),
- defaultView: 'listWeek',
- editable: true,
- eventLimit: true,
- navLinks: true,
-
- timezone: 'local',
- dayClick: function dayClick(date, jsEvent, view) {
-
- $(_this4.startRef).calendar('set date', date.toDate());
- _this4.isPopupShowForDayClick = true;
- $(_this4.addRef).popup('show');
- },
- eventClick: function eventClick(calEvent, jsEvent, view) {
- _this4.scheduleEditVm.show(calEvent);
- },
- eventMouseover: function eventMouseover(event, jsEvent, view) {},
- eventMouseout: function eventMouseout(event, jsEvent, view) {},
- events: function events(start, end, timezone, callback) {
-
- _this4._getEvents(start, end, callback);
- },
- eventDrop: function eventDrop(event, delta, revertFunc) {
-
- if (event.creator.username != _this4.loginUser.username) {
- toastr.error('您没有权限修改!');
- ea.publish(nsCons.EVENT_SCHEDULE_REFRESH, {});
- return;
- }
-
- _this4._updateDate(event.id, event.start, event.end);
- },
- eventResize: function eventResize(event, delta, revertFunc) {
-
- if (event.creator.username != _this4.loginUser.username) {
- toastr.error('您没有权限修改!');
- ea.publish(nsCons.EVENT_SCHEDULE_REFRESH, {});
- return;
- }
-
- _this4._updateDate(event.id, event.start, event.end);
- }
- });
-
- $(this.addRef).popup({
- on: 'click',
-
- inline: true,
-
- silent: true,
-
- jitter: 300,
- position: 'bottom center',
- delay: {
- show: 300,
- hide: 300
- },
- onVisible: function onVisible() {
- $(_this4.titleRef).focus();
- autosize.update(_this4.titleRef);
- if (!_this4.title && !_this4.isPopupShowForDayClick) {
- $(_this4.startRef).calendar('set date', new Date());
- }
- _this4.isPopupShowForDayClick = false;
- }
- });
-
- $(this.startRef).calendar({
- today: true,
- endCalendar: $(this.endRef)
- });
- $(this.endRef).calendar({
- today: true,
- startCalendar: $(this.startRef)
- });
-
- this._reset();
- };
-
- EmChatSchedule.prototype.titleKeyupHandler = function titleKeyupHandler(event) {
- if (event.ctrlKey && event.keyCode === 13) {
- this.addHandler();
- }
- };
-
- EmChatSchedule.prototype._updateDate = function _updateDate(id, start, end) {
- var data = {
- id: id,
- basePath: utils.getBasePath()
- };
-
- if (start) {
- data.startDate = start.toDate();
- } else {
- data.startDate = new Date();
- }
-
- if (end) {
- data.endDate = end.toDate();
- }
-
- $.post('/admin/schedule/updateStartEndDate', data, function (data, textStatus, xhr) {
- if (data.success) {
- toastr.success('更新日程成功!');
- ea.publish(nsCons.EVENT_SCHEDULE_REFRESH, {});
- } else {
- toastr.error(data.data);
- }
- });
- };
-
- EmChatSchedule.prototype.initMembersUI = function initMembersUI(last) {
- var _this5 = this;
-
- if (last) {
- _.defer(function () {
- $(_this5.actorsRef).dropdown().dropdown('clear').dropdown(_this5.actorsOpts).dropdown('set selected', [_this5.loginUser.username]);
- });
- }
- };
-
- EmChatSchedule.prototype.clearStartDateHandler = function clearStartDateHandler() {
- $(this.startRef).calendar('clear');
- };
-
- EmChatSchedule.prototype.clearEndDateHandler = function clearEndDateHandler() {
- $(this.endRef).calendar('clear');
- };
-
- EmChatSchedule.prototype.addHandler = function addHandler() {
- var _this6 = this;
-
- if (!this.title) {
- toastr.error('日程内容不能为空!');
- return;
- }
-
- var data = {
- title: this.title,
- basePath: utils.getBasePath(),
- actors: $(this.actorsRef).dropdown('get value')
- };
-
- var start = $(this.startRef).calendar('get date');
- var end = $(this.endRef).calendar('get date');
-
- if (start) {
- data.startDate = start;
- } else {
- data.startDate = new Date();
- }
-
- if (end) {
- data.endDate = end;
- }
-
- $.post('/admin/schedule/create', data, function (data, textStatus, xhr) {
- if (data.success) {
- $(_this6.scheduleRef).fullCalendar('refetchEvents');
- toastr.success('添加日程成功!');
- _this6._reset();
- $(_this6.addRef).popup('hide');
- } else {
- toastr.error(data.data);
- }
- });
- };
-
- EmChatSchedule.prototype._reset = function _reset() {
- this.title = '';
- $(this.startRef).calendar('set date', new Date());
- $(this.endRef).calendar('clear');
- $(this.actorsRef).dropdown('clear');
- if (this.loginUser && this.loginUser.username) {
- $(this.actorsRef).dropdown('set selected', [this.loginUser.username]).dropdown('set value', this.loginUser.username);
- }
- };
-
- return EmChatSchedule;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'loginUser', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class;
-});
-define('resources/elements/em-chat-share',['exports', 'aurelia-framework'], function (exports, _aureliaFramework) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmChatShare = undefined;
-
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
-
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
-
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
-
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
-
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
-
- return desc;
- }
-
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
-
- var _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4;
-
- var EmChatShare = exports.EmChatShare = (0, _aureliaFramework.containerless)(_class = (_class2 = function () {
- function EmChatShare() {
- _classCallCheck(this, EmChatShare);
-
- this.shares = [];
- this.desc = '';
-
- _initDefineProp(this, 'chat', _descriptor, this);
-
- _initDefineProp(this, 'channel', _descriptor2, this);
-
- _initDefineProp(this, 'loginUser', _descriptor3, this);
-
- _initDefineProp(this, 'isAt', _descriptor4, this);
-
- this.basePath = utils.getBasePath();
- }
-
- EmChatShare.prototype.attached = function attached() {
- var _this = this;
-
- $(this.searchRef).search({
- minCharacters: 2,
- cache: false,
- selectFirstResult: true,
- showNoResults: false,
- onSelect: function onSelect(result, response) {
- result.item._id = _.uniqueId('share-item-');
- result.item._type = result.item.username ? 'user' : 'channel';
- _this.shares.push(result.item);
- _.defer(function () {
- $(_this.inputSearchRef).val('');
- });
- },
- apiSettings: {
- onResponse: function onResponse(resp) {
- var response = {
- results: []
- };
- $.each(resp.data.users, function (index, item) {
- if (!_.find(_.filter(_this.shares, function (c) {
- return c._type == 'user';
- }), { username: item.username })) {
- response.results.push({
- item: item,
- title: ' ' + item.name + ' (' + item.username + ')'
- });
- }
- });
- $.each(resp.data.channels, function (index, item) {
- if (!_.find(_.filter(_this.shares, function (c) {
- return c._type == 'channel';
- }), { name: item.name })) {
- response.results.push({
- item: item,
- title: ' ' + item.title + ' (' + item.name + ')'
- });
- }
- });
- return response;
- },
- url: '/admin/blog/share/to/search?search={query}'
- }
- });
- $(this.shareRef).popup({
- on: 'click',
- inline: true,
- silent: true,
- position: 'bottom right',
- jitter: 300,
- delay: {
- show: 300,
- hide: 300
- },
- onVisible: function onVisible() {
- $(_this.inputSearchRef).focus();
- }
- });
- };
-
- EmChatShare.prototype.shareSearchKeyupHandler = function shareSearchKeyupHandler(event) {
- if (event.keyCode === 13 && !$(this.searchRef).search('is visible')) {
- var val = $(this.inputSearchRef).val();
- if (utils.isMail(val)) {
- if (!_.find(_.filter(this.shares, function (c) {
- return c._type == 'mail';
- }), { mail: val })) {
- this.shares.push({
- _id: _.uniqueId('share-item-'),
- _type: 'mail',
- mail: val
- });
- $(this.inputSearchRef).val('');
- }
- }
- }
- };
-
- EmChatShare.prototype.show = function show() {
- $(this.shareRef).popup('show');
- };
-
- EmChatShare.prototype.removeShareHandler = function removeShareHandler(item) {
- this.shares = _.reject(this.shares, { _id: item._id });
- };
-
- EmChatShare.prototype.cancelHandler = function cancelHandler() {
- this._reset();
- };
-
- EmChatShare.prototype._reset = function _reset() {
- this.shares = [];
- this.desc = '';
- $(this.inputSearchRef).val('');
- $(this.shareRef).popup('hide');
- };
-
- EmChatShare.prototype.shareHandler = function shareHandler() {
- var _this2 = this;
-
- if (this.shares.length === 0) {
- toastr.error('请先指定沟通消息分享用户或者频道或者邮箱!');
- return;
- }
-
- this.ajaxS = $.post('/admin/chat/' + (this.isAt ? 'direct' : 'channel') + '/share', {
- basePath: utils.getBasePath(),
- href: this.basePath + '#/chat/' + (this.isAt ? '@' + this.loginUser.username : this.channel.name) + '?id=' + this.chat.id,
- id: this.chat.id,
- desc: this.desc,
- html: utils.md2html(this.chat.content),
- users: _.chain(this.shares).filter(function (item) {
- return item._type == 'user';
- }).map('username').join().value(),
- channels: _.chain(this.shares).filter(function (item) {
- return item._type == 'channel';
- }).map('name').join().value(),
- mails: _.chain(this.shares).filter(function (item) {
- return item._type == 'mail';
- }).map('mail').join().value()
- }, function (data, textStatus, xhr) {
- if (data.success) {
- _this2._reset();
- toastr.success('沟通消息分享成功!');
- } else {
- toastr.error(data.data, '沟通消息分享失败!');
- }
- });
- };
-
- return EmChatShare;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'chat', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'channel', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'loginUser', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'isAt', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class;
-});
-define('resources/elements/em-chat-sidebar-left',['exports', 'aurelia-framework'], function (exports, _aureliaFramework) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmChatSidebarLeft = undefined;
-
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
-
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
-
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
-
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
-
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
-
- return desc;
- }
-
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
-
- var _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5;
-
- var EmChatSidebarLeft = exports.EmChatSidebarLeft = (0, _aureliaFramework.containerless)(_class = (_class2 = function () {
- EmChatSidebarLeft.prototype.usersChanged = function usersChanged() {
- this._filter();
- };
-
- EmChatSidebarLeft.prototype.channelsChanged = function channelsChanged() {
- this._filter();
- };
-
- EmChatSidebarLeft.prototype.loginUserChanged = function loginUserChanged() {
- if (this.loginUser) {
- this.isSuper = utils.isSuperUser(this.loginUser);
- }
- };
-
- function EmChatSidebarLeft() {
- var _this = this;
-
- _classCallCheck(this, EmChatSidebarLeft);
-
- _initDefineProp(this, 'users', _descriptor, this);
-
- _initDefineProp(this, 'loginUser', _descriptor2, this);
-
- _initDefineProp(this, 'channels', _descriptor3, this);
-
- _initDefineProp(this, 'chatTo', _descriptor4, this);
-
- _initDefineProp(this, 'isAt', _descriptor5, this);
-
- this.filter = '';
- this.isSuper = nsCtx.isSuper;
-
- this.subscribe = ea.subscribe(nsCons.EVENT_CHANNEL_ACTIONS, function (payload) {
- _this[payload.action](payload.item);
- });
- this.subscribe1 = ea.subscribe(nsCons.EVENT_SYSTEM_LINKS_REFRESH, function (payload) {
- _this._refreshSysLinks();
- });
- }
-
- EmChatSidebarLeft.prototype._refreshSysLinks = function _refreshSysLinks() {
- var _this2 = this;
-
- $.get('/admin/link/listByApp', function (data) {
- if (data.success) {
- _this2.sysLinks = data.data;
- } else {
- _this2.sysLinks = [];
- }
- });
- };
-
- EmChatSidebarLeft.prototype.unbind = function unbind() {
- this.subscribe.dispose();
- this.subscribe1.dispose();
- };
-
- EmChatSidebarLeft.prototype.bind = function bind(bindingCtx, overrideCtx) {
- this._refreshSysLinks();
- };
-
- EmChatSidebarLeft.prototype.attached = function attached() {
- var _this3 = this;
-
- $(this.logoRef).on('mouseenter', function (event) {
- $(_this3.logoRef).animateCss('flip');
- });
- };
-
- EmChatSidebarLeft.prototype._filter = function _filter() {
- var _this4 = this;
-
- _.each(this.users, function (item) {
- item.hidden = item.username.indexOf(_this4.filter) == -1;
- });
-
- _.each(this.channels, function (item) {
- item.hidden = item.name.indexOf(_this4.filter) == -1;
- });
- };
-
- EmChatSidebarLeft.prototype.chatToUserFilerKeyupHanlder = function chatToUserFilerKeyupHanlder(evt) {
- this._filter();
-
- if (evt.keyCode === 13) {
- var user = _.find(this.users, {
- hidden: false
- });
-
- if (user) {
- window.location = wurl('path') + ('#/chat/@' + user.username);
- return;
- }
-
- var channel = _.find(this.channels, {
- hidden: false
- });
-
- if (channel) {
- window.location = wurl('path') + ('#/chat/' + channel.name);
- return;
- }
- }
- };
-
- EmChatSidebarLeft.prototype.clearFilterHandler = function clearFilterHandler() {
- var _this5 = this;
-
- this.filter = '';
- _.each(this.users, function (item) {
- item.hidden = item.username.indexOf(_this5.filter) == -1;
- });
- _.each(this.channels, function (item) {
- item.hidden = item.name.indexOf(_this5.filter) == -1;
- });
- };
-
- EmChatSidebarLeft.prototype.editHandler = function editHandler(item) {
- this.selectedChannel = item;
- this.channelEditMd.show();
- };
-
- EmChatSidebarLeft.prototype.delHandler = function delHandler(item) {
- var _this6 = this;
-
- this.confirmMd.show({
- onapprove: function onapprove() {
- $.post('/admin/channel/delete', {
- id: item.id
- }, function (data) {
- if (data.success) {
- toastr.success('删除频道成功!');
- _.remove(_this6.channels, { id: item.id });
- ea.publish(nsCons.EVENT_CHAT_CHANNEL_DELETED, { channel: item });
- } else {
- toastr.error(data.data, '删除频道失败!');
- }
- });
- }
- });
- };
-
- EmChatSidebarLeft.prototype.membersMgrHandler = function membersMgrHandler(item) {
- this.selectedChannel = item;
- this.channelMembersMgrMd.show();
- };
-
- EmChatSidebarLeft.prototype.membersShowHandler = function membersShowHandler(item) {
- this.selectedChannel = item;
- this.channelMembersShowMd.show();
- };
-
- EmChatSidebarLeft.prototype.leaveHandler = function leaveHandler(item) {
- this.confirmMd.show({
- content: '\u786E\u5B9A\u8981\u79BB\u5F00\u9891\u9053' + item.title + '\u5417?',
- onapprove: function onapprove() {
- $.post('/admin/channel/leave', {
- id: item.id
- }, function (data) {
- if (data.success) {
- toastr.success('离开频道成功!');
- ea.publish(nsCons.EVENT_CHAT_CHANNEL_LEAVED, { channel: data.data });
- } else {
- toastr.error(data.data, '离开频道失败!');
- }
- });
- }
- });
- };
-
- EmChatSidebarLeft.prototype.switchHandler = function switchHandler() {
- ea.publish(nsCons.EVENT_SWITCH_CHAT_TO, {});
- };
-
- EmChatSidebarLeft.prototype.addChannelLinkHandler = function addChannelLinkHandler(event) {
- this.sysLinkMgrVm.show();
- };
-
- EmChatSidebarLeft.prototype.isSubscribed = function isSubscribed(item) {
- return _.some(item.subscriber, { username: this.loginUser.username });
- };
-
- EmChatSidebarLeft.prototype.subscribeHandler = function subscribeHandler(item) {
-
- var isSub = this.isSubscribed(item);
-
- $.post('/admin/channel/' + (isSub ? 'unsubscribe' : 'subscribe'), {
- id: item.id
- }, function (data) {
- if (data.success) {
- item.subscriber = data.data.subscriber;
- toastr.success((isSub ? '取消订阅' : '订阅频道') + '\u6210\u529F!');
- item.isSubscribed = !isSub;
- } else {
- toastr.error(data.data, (isSub ? '取消订阅' : '订阅频道') + '\u5931\u8D25!');
- }
- });
- };
-
- EmChatSidebarLeft.prototype.sysLinkHandler = function sysLinkHandler(item) {
- $.post('/admin/link/count/inc', { id: item.id });
- return true;
- };
-
- return EmChatSidebarLeft;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'users', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'loginUser', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'channels', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'chatTo', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, 'isAt', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class;
-});
-define('resources/elements/em-chat-sidebar-right',['exports', 'aurelia-framework'], function (exports, _aureliaFramework) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmChatSidebarRight = undefined;
-
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
-
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
-
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
-
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
-
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
-
- return desc;
- }
-
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
-
- var _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3;
-
- var EmChatSidebarRight = exports.EmChatSidebarRight = (0, _aureliaFramework.containerless)(_class = (_class2 = function () {
- function EmChatSidebarRight() {
- var _actionMapping,
- _this = this;
-
- _classCallCheck(this, EmChatSidebarRight);
-
- _initDefineProp(this, 'loginUser', _descriptor, this);
-
- _initDefineProp(this, 'isAt', _descriptor2, this);
-
- _initDefineProp(this, 'channel', _descriptor3, this);
-
- this.actionMapping = (_actionMapping = {}, _actionMapping[nsCons.ACTION_TYPE_DIR] = { handler: this.dirHandler, nodata: '', show: 'dir' }, _actionMapping[nsCons.ACTION_TYPE_AT] = { nodata: '暂无@消息', show: 'msg' }, _actionMapping[nsCons.ACTION_TYPE_STOW] = { nodata: '暂无收藏消息', show: 'msg' }, _actionMapping[nsCons.ACTION_TYPE_ATTACH] = { handler: this.attachHandler, nodata: '', show: 'attach' }, _actionMapping[nsCons.ACTION_TYPE_SCHEDULE] = { handler: this.scheduleHandler, nodata: '', show: 'schedule' }, _actionMapping[nsCons.ACTION_TYPE_SEARCH] = { nodata: '无符合检索结果', show: 'msg' }, _actionMapping[nsCons.ACTION_TYPE_PIN] = { nodata: '暂无频道固定消息', show: 'msg' }, _actionMapping);
-
-
- this.subscribe = ea.subscribe(nsCons.EVENT_CHAT_RIGHT_SIDEBAR_TOGGLE, function (payload) {
- _this.actived = _.clone(_this.actionMapping[payload.action]);
- _this.actived.payload = payload;
- if (_this.actived.handler) {
- _.bind(_this.actived.handler, _this, payload)();
- }
- });
- }
-
- EmChatSidebarRight.prototype.unbind = function unbind() {
- this.subscribe.dispose();
- };
-
- EmChatSidebarRight.prototype.attachHandler = function attachHandler(payload) {
- this.chatAttachVm.fetch();
- };
-
- EmChatSidebarRight.prototype.dirHandler = function dirHandler(payload) {
- $(this.dirRef).empty().append(payload.result);
- };
-
- EmChatSidebarRight.prototype.scheduleHandler = function scheduleHandler(payload) {
- this.chatScheduleVm.show();
- };
-
- return EmChatSidebarRight;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'loginUser', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'isAt', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'channel', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class;
-});
-define('resources/elements/em-chat-system-link-mgr',['exports', 'aurelia-framework'], function (exports, _aureliaFramework) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmChatSystemLinkMgr = undefined;
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- var _class;
-
- var EmChatSystemLinkMgr = exports.EmChatSystemLinkMgr = (0, _aureliaFramework.containerless)(_class = function () {
- function EmChatSystemLinkMgr() {
- _classCallCheck(this, EmChatSystemLinkMgr);
-
- this.links = [];
- }
-
- EmChatSystemLinkMgr.prototype.addHandler = function addHandler() {
- var _this = this;
-
- $.post('/admin/link/create', {
- title: this.title,
- href: this.href,
- type: 'App'
- }, function (data, textStatus, xhr) {
- if (data.success) {
- _this.title = '';
- _this.href = '';
- _this.links.push(data.data);
- ea.publish(nsCons.EVENT_SYSTEM_LINKS_REFRESH, {});
- } else {
- toastr.error(data.data);
- }
- });
- };
-
- EmChatSystemLinkMgr.prototype.delHandler = function delHandler(item) {
- var _this2 = this;
-
- $.post('/admin/link/delete', {
- id: item.id
- }, function (data, textStatus, xhr) {
- if (data.success) {
- _this2.links = _.reject(_this2.links, { id: item.id });
- ea.publish(nsCons.EVENT_SYSTEM_LINKS_REFRESH, {});
- toastr.success('删除成功!');
- } else {
- toastr.error(data.data);
- }
- });
- };
-
- EmChatSystemLinkMgr.prototype.editHandler = function editHandler(item) {
- item.oldTitle = item.title;
- item.oldHref = item.href;
- item.isEditing = true;
- };
-
- EmChatSystemLinkMgr.prototype.updateHandler = function updateHandler(item) {
- $.post('/admin/link/update', {
- id: item.id,
- title: item.title,
- href: item.href
- }, function (data, textStatus, xhr) {
- if (data.success) {
- item.isEditing = false;
- ea.publish(nsCons.EVENT_SYSTEM_LINKS_REFRESH, {});
- toastr.success('更新成功!');
- } else {
- toastr.error(data.data);
- }
- });
- };
-
- EmChatSystemLinkMgr.prototype.showHandler = function showHandler() {
- var _this3 = this;
-
- $.get('/admin/link/listByApp', function (data) {
- if (data.success) {
- _this3.links = data.data;
- } else {
- _this3.links = [];
- }
- });
- };
-
- EmChatSystemLinkMgr.prototype.show = function show() {
- this.emModal.show({ autoDimmer: false });
- };
-
- EmChatSystemLinkMgr.prototype.approveHandler = function approveHandler(modal) {};
-
- return EmChatSystemLinkMgr;
- }()) || _class;
-});
-define('resources/elements/em-chat-top-menu',['exports', 'aurelia-framework'], function (exports, _aureliaFramework) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmChatTopMenu = undefined;
-
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
-
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
-
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
-
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
-
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
-
- return desc;
- }
-
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
-
- var _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9;
-
- var EmChatTopMenu = exports.EmChatTopMenu = (0, _aureliaFramework.containerless)(_class = (_class2 = function () {
- EmChatTopMenu.prototype.loginUserChanged = function loginUserChanged() {
- if (this.loginUser) {
- this.isSuper = utils.isSuperUser(this.loginUser);
- }
- };
-
- EmChatTopMenu.prototype.chatToChanged = function chatToChanged() {
- $(this.chatToDropdownRef).dropdown('set selected', this.chatId).dropdown('hide');
- };
-
- EmChatTopMenu.prototype.channelChanged = function channelChanged() {
- this._refreshChannelLinks();
- };
-
- EmChatTopMenu.prototype._refreshChannelLinks = function _refreshChannelLinks() {
- var _this = this;
-
- if (this.channel) {
- $.get('/admin/link/listBy', {
- channelId: this.channel.id
- }, function (data) {
- if (data.success) {
- _this.channelLinks = data.data;
- } else {
- _this.channelLinks = [];
- }
- });
- }
- };
-
- function EmChatTopMenu() {
- var _this2 = this;
-
- _classCallCheck(this, EmChatTopMenu);
-
- _initDefineProp(this, 'loginUser', _descriptor, this);
-
- _initDefineProp(this, 'chatUser', _descriptor2, this);
-
- _initDefineProp(this, 'users', _descriptor3, this);
-
- _initDefineProp(this, 'channels', _descriptor4, this);
-
- _initDefineProp(this, 'channel', _descriptor5, this);
-
- _initDefineProp(this, 'loginUser', _descriptor6, this);
-
- _initDefineProp(this, 'chatId', _descriptor7, this);
-
- _initDefineProp(this, 'chatTo', _descriptor8, this);
-
- _initDefineProp(this, 'isAt', _descriptor9, this);
-
- this.isRightSidebarShow = false;
- this.activeType = '';
- this.ACTION_TYPE_SEARCH = nsCons.ACTION_TYPE_SEARCH;
- this.ACTION_TYPE_STOW = nsCons.ACTION_TYPE_STOW;
- this.ACTION_TYPE_PIN = nsCons.ACTION_TYPE_PIN;
- this.ACTION_TYPE_AT = nsCons.ACTION_TYPE_AT;
- this.ACTION_TYPE_DIR = nsCons.ACTION_TYPE_DIR;
- this.ACTION_TYPE_ATTACH = nsCons.ACTION_TYPE_ATTACH;
- this.ACTION_TYPE_SCHEDULE = nsCons.ACTION_TYPE_SCHEDULE;
- this.countAt = null;
- this.newAtCnt = 0;
- this.channelLinks = [];
-
- this.subscribe = ea.subscribe(nsCons.EVENT_CHAT_MSG_WIKI_DIR, function (payload) {
- _this2.dir = payload.dir;
-
- if (_this2.activeType == _this2.ACTION_TYPE_DIR && _this2.isRightSidebarShow) {
- ea.publish(nsCons.EVENT_CHAT_RIGHT_SIDEBAR_TOGGLE, {
- action: _this2.activeType,
- result: _this2.dir
- });
- }
- });
-
- this.subscribe1 = ea.subscribe(nsCons.EVENT_CHAT_POLL_UPDATE, function (payload) {
- if (_this2.countAt !== null && _this2.newAtCnt <= 0) {
- _this2.newAtCnt = payload.countAt - _this2.countAt;
- }
- _this2.countAt = payload.countAt;
- _this2.countMyRecentSchedule = payload.countMyRecentSchedule;
- });
-
- this.subscribe2 = ea.subscribe(nsCons.EVENT_SWITCH_CHAT_TO, function (payload) {
- $(_this2.chatToDropdownRef).dropdown('toggle');
- });
-
- this.subscribe3 = ea.subscribe(nsCons.EVENT_CHANNEL_LINKS_REFRESH, function (payload) {
- _this2._refreshChannelLinks();
- });
- }
-
- EmChatTopMenu.prototype.unbind = function unbind() {
- this.subscribe.dispose();
- this.subscribe1.dispose();
- this.subscribe2.dispose();
- this.subscribe3.dispose();
- };
-
- EmChatTopMenu.prototype.attached = function attached() {
- this.initHotkeys();
- this.initSearch();
- };
-
- EmChatTopMenu.prototype.initSearch = function initSearch() {
- var _this3 = this;
-
- var source = [];
- if (localStorage) {
- var v = localStorage.getItem('tms/chat-direct:search');
- source = v ? $.parseJSON(v) : [];
- }
- this.searchSource = source;
- $(this.searchRef).search({
- source: source,
- onSelect: function onSelect(result, response) {
- _this3.searchHandler();
- },
- onResults: function onResults() {
- $(_this3.searchRef).search('hide results');
- }
- });
- };
-
- EmChatTopMenu.prototype.searchHandler = function searchHandler() {
- var _this4 = this;
-
- $(this.searchRef).search('hide results');
-
- var search = $(this.searchInputRef).val();
-
- if (!search || search.length < 2) {
- toastr.error('检索条件至少需要两个字符!');
- return;
- }
-
- this.search = search;
-
- var isExists = false;
- $.each(this.searchSource, function (index, val) {
- if (val.title == search) {
- isExists = true;
- return false;
- }
- });
- if (!isExists) {
- this.searchSource.splice(0, 0, {
- title: search
- });
- $(this.searchRef).search({
- source: _.clone(this.searchSource)
- });
- }
- localStorage && localStorage.setItem('tms/chat-direct:search', JSON.stringify(this.searchSource));
-
- var url = void 0;
- var data = void 0;
- if (this.isAt) {
- url = '/admin/chat/direct/search';
- data = {
- search: this.search,
- size: 20,
- page: 0
- };
- } else {
- url = '/admin/chat/channel/search';
- data = {
- search: this.search,
- channelId: this.channel.id,
- size: 20,
- page: 0
- };
- }
-
- this.searchingP = $.get(url, data, function (data) {
- if (data.success) {
- _this4.toggleRightSidebar(true);
-
- ea.publish(nsCons.EVENT_CHAT_RIGHT_SIDEBAR_TOGGLE, {
- action: _this4.activeType,
- result: data.data,
- search: _this4.search
- });
- }
- });
- };
-
- EmChatTopMenu.prototype.initHotkeys = function initHotkeys() {
- var _this5 = this;
-
- $(document).bind('keydown', 's', function (event) {
- event.preventDefault();
- _this5.toggleRightSidebar();
- }).bind('keydown', 'ctrl+k', function (event) {
- event.preventDefault();
- $(_this5.chatToDropdownRef).dropdown('toggle');
- });
-
- $(this.filterChatToUser).bind('keydown', 'ctrl+k', function (event) {
- event.preventDefault();
- $(_this5.chatToDropdownRef).dropdown('toggle');
- });
- };
-
- EmChatTopMenu.prototype.initChatToDropdownHandler = function initChatToDropdownHandler(last) {
- var _this6 = this;
-
- if (last) {
- _.defer(function () {
- $(_this6.chatToDropdownRef).dropdown().dropdown('set selected', _this6.chatId).dropdown({
- onChange: function onChange(value, text, $choice) {
- window.location = wurl('path') + ('#/chat/' + $choice.attr('data-id'));
- }
- });
- });
- }
- };
-
- EmChatTopMenu.prototype.searchFocusHandler = function searchFocusHandler() {
- $(this.searchInputRef).css('width', 'auto');
- $(this.searchRemoveRef).show();
- this.isActiveSearch = true;
- };
-
- EmChatTopMenu.prototype.searchBlurHandler = function searchBlurHandler() {
- if (!$(this.searchInputRef).val()) {
- $(this.searchInputRef).css('width', '95px');
- $(this.searchRemoveRef).hide();
- this.isActiveSearch = false;
- }
- };
-
- EmChatTopMenu.prototype.sibebarRightHandler = function sibebarRightHandler(event) {
- this.toggleRightSidebar();
- };
-
- EmChatTopMenu.prototype.toggleRightSidebar = function toggleRightSidebar(asShow) {
- if (_.isUndefined(asShow)) {
- this.isRightSidebarShow = !this.isRightSidebarShow;
- } else {
- this.isRightSidebarShow = asShow;
- }
-
- ea.publish(nsCons.EVENT_CHAT_SIDEBAR_TOGGLE, {
- isShow: this.isRightSidebarShow
- });
- };
-
- EmChatTopMenu.prototype.searchKeyupHandler = function searchKeyupHandler(evt) {
- if (evt.keyCode === 13) {
- this.activeType = nsCons.ACTION_TYPE_SEARCH;
- this.searchHandler();
- } else if (evt.keyCode === 27) {
- this.clearSearchHandler();
- }
- return true;
- };
-
- EmChatTopMenu.prototype.clearSearchHandler = function clearSearchHandler() {
- $(this.searchInputRef).val('').focus();
- };
-
- EmChatTopMenu.prototype.showStowHandler = function showStowHandler(event) {
- var _this7 = this;
-
- if (this.isRightSidebarShow && this.activeType == nsCons.ACTION_TYPE_STOW && !event.ctrlKey) {
- this.toggleRightSidebar();
- return;
- }
-
- this.activeType = nsCons.ACTION_TYPE_STOW;
- this.ajaxStow = $.get('/admin/chat/channel/getStows', function (data) {
- if (data.success) {
- var stowChats = _.map(data.data, function (item) {
- var chatChannel = item.chatChannel;
- chatChannel.chatStow = item;
- return chatChannel;
- });
- ea.publish(nsCons.EVENT_CHAT_RIGHT_SIDEBAR_TOGGLE, {
- action: _this7.activeType,
- result: _.reverse(stowChats)
- });
- _this7.toggleRightSidebar(true);
- } else {
- toastr.error(data.data, '获取收藏消息失败!');
- }
- });
- };
-
- EmChatTopMenu.prototype.showAtHandler = function showAtHandler(event) {
- var _this8 = this;
-
- if (this.isRightSidebarShow && this.activeType == nsCons.ACTION_TYPE_AT && this.newAtCnt == 0 && !event.ctrlKey) {
- this.toggleRightSidebar();
- return;
- }
-
- this.activeType = nsCons.ACTION_TYPE_AT;
- this.newAtCnt = 0;
- this.ajaxAt = $.get('/admin/chat/channel/getAts', {
- page: 0,
- size: 20
- }, function (data) {
- if (data.success) {
- ea.publish(nsCons.EVENT_CHAT_RIGHT_SIDEBAR_TOGGLE, {
- action: _this8.activeType,
- result: data.data
- });
- _this8.toggleRightSidebar(true);
- } else {
- toastr.error(data.data, '获取@消息失败!');
- }
- });
- };
-
- EmChatTopMenu.prototype.logoutHandler = function logoutHandler() {
- $.post('/admin/logout').always(function () {
- utils.redirect2Login();
- });
- };
-
- EmChatTopMenu.prototype.showWikiDirHandler = function showWikiDirHandler(event) {
-
- if (this.isRightSidebarShow && this.activeType == nsCons.ACTION_TYPE_DIR && !event.ctrlKey) {
- this.toggleRightSidebar();
- return;
- }
-
- this.activeType = nsCons.ACTION_TYPE_DIR;
- ea.publish(nsCons.EVENT_CHAT_RIGHT_SIDEBAR_TOGGLE, {
- action: this.activeType,
- result: this.dir
- });
- this.toggleRightSidebar(true);
- };
-
- EmChatTopMenu.prototype.showAttachHandler = function showAttachHandler(event) {
-
- if (this.isRightSidebarShow && this.activeType == nsCons.ACTION_TYPE_ATTACH && !event.ctrlKey) {
- this.toggleRightSidebar();
- return;
- }
-
- this.activeType = nsCons.ACTION_TYPE_ATTACH;
- ea.publish(nsCons.EVENT_CHAT_RIGHT_SIDEBAR_TOGGLE, {
- action: this.activeType
- });
- this.toggleRightSidebar(true);
- };
-
- EmChatTopMenu.prototype.showScheduleHandler = function showScheduleHandler(event) {
-
- if (this.isRightSidebarShow && this.activeType == nsCons.ACTION_TYPE_SCHEDULE && !event.ctrlKey) {
- this.toggleRightSidebar();
- return;
- }
-
- this.activeType = nsCons.ACTION_TYPE_SCHEDULE;
- ea.publish(nsCons.EVENT_CHAT_RIGHT_SIDEBAR_TOGGLE, {
- action: this.activeType
- });
- this.toggleRightSidebar(true);
- };
-
- EmChatTopMenu.prototype.userEditHandler = function userEditHandler() {
- this.userEditMd.show();
- };
-
- EmChatTopMenu.prototype.membersShowHandler = function membersShowHandler(item, event) {
- event.stopImmediatePropagation();
- ea.publish(nsCons.EVENT_CHANNEL_ACTIONS, {
- action: 'membersShowHandler',
- item: item
- });
- };
-
- EmChatTopMenu.prototype.leaveHandler = function leaveHandler(item, event) {
- event.stopImmediatePropagation();
- ea.publish(nsCons.EVENT_CHANNEL_ACTIONS, {
- action: 'leaveHandler',
- item: item
- });
- };
-
- EmChatTopMenu.prototype.membersMgrHandler = function membersMgrHandler(item, event) {
- event.stopImmediatePropagation();
- ea.publish(nsCons.EVENT_CHANNEL_ACTIONS, {
- action: 'membersMgrHandler',
- item: item
- });
- };
-
- EmChatTopMenu.prototype.editHandler = function editHandler(item, event) {
- event.stopImmediatePropagation();
- ea.publish(nsCons.EVENT_CHANNEL_ACTIONS, {
- action: 'editHandler',
- item: item
- });
- };
-
- EmChatTopMenu.prototype.delHandler = function delHandler(item, event) {
- event.stopImmediatePropagation();
- ea.publish(nsCons.EVENT_CHANNEL_ACTIONS, {
- action: 'delHandler',
- item: item
- });
- };
-
- EmChatTopMenu.prototype.viewOrMgrUsersHandler = function viewOrMgrUsersHandler(event) {
-
- if (this.channel.owner.username == this.loginUser.username) {
- this.membersMgrHandler(this.channel, event);
- } else {
- this.membersShowHandler(this.channel, event);
- }
- };
-
- EmChatTopMenu.prototype.channelInfoHandler = function channelInfoHandler(event) {
-
- if (this.channel.owner.username == this.loginUser.username) {
- this.editHandler(this.channel, event);
- } else {
- event.stopImmediatePropagation();
- }
- };
-
- EmChatTopMenu.prototype.userInfoHandler = function userInfoHandler(event) {
- event.stopImmediatePropagation();
- };
-
- EmChatTopMenu.prototype.stopImmediatePropagationHandler = function stopImmediatePropagationHandler(event) {
- event.stopImmediatePropagation();
- };
-
- EmChatTopMenu.prototype.mailToHandler = function mailToHandler(event) {
- event.stopImmediatePropagation();
- window.location = 'mailto:' + this.chatUser.mails;
- };
-
- EmChatTopMenu.prototype.channelLinksHandler = function channelLinksHandler(event) {
- event.stopImmediatePropagation();
- $(this.channelLinksDdRef).dropdown('toggle');
- };
-
- EmChatTopMenu.prototype.addChannelLinkHandler = function addChannelLinkHandler(event) {
- this.channelLinkMgrVm.show();
- };
-
- EmChatTopMenu.prototype.openChannelLinkHandler = function openChannelLinkHandler(event, item) {
- event.stopImmediatePropagation();
- $(this.channelLinksDdRef).dropdown('hide');
- utils.openNewWin(item.href);
- $.post('/admin/link/count/inc', { id: item.id });
- };
-
- EmChatTopMenu.prototype.showPinHandler = function showPinHandler(event) {
- var _this9 = this;
-
- event.stopImmediatePropagation();
- if (this.isRightSidebarShow && this.activeType == nsCons.ACTION_TYPE_PIN && !event.ctrlKey) {
- this.toggleRightSidebar();
- return;
- }
-
- this.activeType = nsCons.ACTION_TYPE_PIN;
-
- this.ajaxPin = $.get('/admin/chat/channel/pin/list', {
- cid: this.channel.id
- }, function (data) {
- if (data.success) {
- var pinChats = _.map(data.data, function (item) {
- var chatChannel = item.chatChannel;
- chatChannel.chatPin = item;
- return chatChannel;
- });
- ea.publish(nsCons.EVENT_CHAT_RIGHT_SIDEBAR_TOGGLE, {
- action: _this9.activeType,
- result: _.reverse(pinChats)
- });
- _this9.toggleRightSidebar(true);
- } else {
- toastr.error(data.data, '获取频道固定消息失败!');
- }
- });
- };
-
- return EmChatTopMenu;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'loginUser', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'chatUser', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'users', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'channels', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, 'channel', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, 'loginUser', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, 'chatId', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, 'chatTo', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, 'isAt', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class;
-});
-define('resources/elements/em-checkbox',['exports', 'aurelia-framework'], function (exports, _aureliaFramework) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmCheckbox = undefined;
-
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
-
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
-
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
-
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
-
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
-
- return desc;
- }
-
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
-
- var _dec, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9;
-
- var EmCheckbox = exports.EmCheckbox = (_dec = (0, _aureliaFramework.bindable)({ defaultBindingMode: _aureliaFramework.bindingMode.twoWay }), (0, _aureliaFramework.containerless)(_class = (_class2 = function () {
- function EmCheckbox() {
- _classCallCheck(this, EmCheckbox);
-
- _initDefineProp(this, 'label', _descriptor, this);
-
- _initDefineProp(this, 'title', _descriptor2, this);
-
- _initDefineProp(this, 'classes', _descriptor3, this);
-
- _initDefineProp(this, 'onchange', _descriptor4, this);
-
- _initDefineProp(this, 'onchecked', _descriptor5, this);
-
- _initDefineProp(this, 'onunchecked', _descriptor6, this);
-
- _initDefineProp(this, 'emCheckboxAll', _descriptor7, this);
-
- _initDefineProp(this, 'checked', _descriptor8, this);
-
- _initDefineProp(this, 'signal', _descriptor9, this);
- }
-
- EmCheckbox.prototype.checkedChanged = function checkedChanged(news, old) {
- if (news) {
- $(this.checkbox).checkbox('set checked');
- } else {
- $(this.checkbox).checkbox('set unchecked');
- }
-
- this.signal && bs.signal(this.signal);
- };
-
- EmCheckbox.prototype.attached = function attached() {
- var _this = this;
-
- $(this.checkbox).checkbox({
- onChecked: function onChecked() {
- _this.checked = true;
- _.defer(function () {
- _this.emCheckboxAll && _this.emCheckboxAll.refreshCheckedStatus();
- _this.onchecked && _this.onchecked(_this);
- _this.signal && bs.signal(_this.signal);
- });
- },
- onUnchecked: function onUnchecked() {
- _this.checked = false;
- _.defer(function () {
- _this.emCheckboxAll && _this.emCheckboxAll.refreshCheckedStatus();
- _this.onunchecked && _this.onunchecked(_this);
- _this.signal && bs.signal(_this.signal);
- });
- },
- onChange: function onChange() {
- _.defer(function () {
- _this.onchange && _this.onchange(_this);
- });
- }
- });
- this.checkedChanged(this.checked);
- };
-
- return EmCheckbox;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'label', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'title', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'classes', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: function initializer() {
- return 'fitted';
- }
- }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'onchange', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, 'onchecked', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, 'onunchecked', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, 'emCheckboxAll', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, 'checked', [_dec], {
- enumerable: true,
- initializer: null
- }), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, 'signal', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class);
-});
-define('resources/elements/em-confirm-modal',['exports', 'aurelia-framework'], function (exports, _aureliaFramework) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmConfirmModal = undefined;
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- var EmConfirmModal = exports.EmConfirmModal = function () {
- function EmConfirmModal() {
- _classCallCheck(this, EmConfirmModal);
-
- this.config = {};
- }
-
- EmConfirmModal.prototype.detached = function detached() {
- $(this.md).remove();
- };
-
- EmConfirmModal.prototype.attached = function attached() {
- var _this = this;
-
- $(this.md).modal({
- closable: false,
- allowMultiple: true,
- onApprove: function onApprove() {
- _this.onapprove && _this.onapprove();
- },
- onDeny: function onDeny() {
- _this.ondeny && _this.ondeny();
- }
- });
- };
-
- EmConfirmModal.prototype.reset = function reset() {
- this.config = {
- title: '操作确认',
- content: '确定要执行该操作吗?',
- warning: false
- };
- };
-
- EmConfirmModal.prototype.show = function show(config) {
-
- this.reset();
-
- if (config) {
- this.config = _.extend(this.config, config);
- }
-
- if (config && config.onapprove) {
- this.onapprove = config.onapprove;
- }
-
- if (config && config.ondeny) {
- this.ondeny = config.ondeny;
- }
-
- $(this.md).modal('show');
- };
-
- EmConfirmModal.prototype.hide = function hide() {
- $(this.md).modal('hide');
- };
-
- return EmConfirmModal;
- }();
-});
-define('resources/elements/em-dropdown',['exports', 'aurelia-framework'], function (exports, _aureliaFramework) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmDropdown = undefined;
-
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
-
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
-
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
-
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
-
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
-
- return desc;
- }
-
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
-
- var _dec, _desc, _value, _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7;
-
- var EmDropdown = exports.EmDropdown = (_dec = (0, _aureliaFramework.bindable)({ defaultBindingMode: _aureliaFramework.bindingMode.twoWay }), (_class = function () {
- function EmDropdown() {
- _classCallCheck(this, EmDropdown);
-
- _initDefineProp(this, 'name', _descriptor, this);
-
- _initDefineProp(this, 'text', _descriptor2, this);
-
- _initDefineProp(this, 'labelProp', _descriptor3, this);
-
- _initDefineProp(this, 'valueProp', _descriptor4, this);
-
- _initDefineProp(this, 'selectedItem', _descriptor5, this);
-
- _initDefineProp(this, 'menuItems', _descriptor6, this);
-
- _initDefineProp(this, 'classes', _descriptor7, this);
- }
-
- EmDropdown.prototype.selectedItemChanged = function selectedItemChanged(news, old) {
- var _this = this;
-
- if (news) {
- _.defer(function () {
- $(_this.dropdown).dropdown('set selected', news);
- });
- }
- };
-
- EmDropdown.prototype.menuItemsChanged = function menuItemsChanged(news, old) {
- if (_.isEmpty(news)) {
- $(this.dropdown).dropdown('clear');
- this.selectedItem = null;
- }
- };
-
- EmDropdown.prototype.initDropdownHandler = function initDropdownHandler(last) {
- var _this2 = this;
-
- if (last) {
- _.defer(function () {
- $(_this2.dropdown).dropdown({
- onChange: function onChange(value, text, $choice) {
- _this2.selectedItem = value;
- }
- }).dropdown('set selected', _this2.selectedItem);
- });
- }
- };
-
- return EmDropdown;
- }(), (_descriptor = _applyDecoratedDescriptor(_class.prototype, 'name', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: function initializer() {
- return _.uniqueId('em-dropdown-');
- }
- }), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, 'text', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: function initializer() {
- return '';
- }
- }), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, 'labelProp', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: function initializer() {
- return 'label';
- }
- }), _descriptor4 = _applyDecoratedDescriptor(_class.prototype, 'valueProp', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: function initializer() {
- return 'value';
- }
- }), _descriptor5 = _applyDecoratedDescriptor(_class.prototype, 'selectedItem', [_dec], {
- enumerable: true,
- initializer: null
- }), _descriptor6 = _applyDecoratedDescriptor(_class.prototype, 'menuItems', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: function initializer() {
- return [];
- }
- }), _descriptor7 = _applyDecoratedDescriptor(_class.prototype, 'classes', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: function initializer() {
- return 'selection';
- }
- })), _class));
-});
-define('resources/elements/em-hotkeys-modal',['exports', 'aurelia-framework'], function (exports, _aureliaFramework) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmHotkeysModal = undefined;
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- var EmHotkeysModal = exports.EmHotkeysModal = function () {
- function EmHotkeysModal() {
- _classCallCheck(this, EmHotkeysModal);
- }
-
- EmHotkeysModal.prototype.attached = function attached() {
- $(this.md).modal();
- };
-
- EmHotkeysModal.prototype.show = function show() {
- $(this.md).modal('show');
- };
-
- return EmHotkeysModal;
- }();
-});
-define('resources/elements/em-modal',['exports', 'aurelia-framework'], function (exports, _aureliaFramework) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmModal = undefined;
-
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
-
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
-
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
-
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
-
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
-
- return desc;
- }
-
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
-
- var _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9;
-
- var EmModal = exports.EmModal = (0, _aureliaFramework.containerless)(_class = (_class2 = function () {
- function EmModal() {
- _classCallCheck(this, EmModal);
-
- _initDefineProp(this, 'confirmLabel', _descriptor, this);
-
- _initDefineProp(this, 'cancelLabel', _descriptor2, this);
-
- _initDefineProp(this, 'onapprove', _descriptor3, this);
-
- _initDefineProp(this, 'ondeny', _descriptor4, this);
-
- _initDefineProp(this, 'onshow', _descriptor5, this);
-
- _initDefineProp(this, 'onvisible', _descriptor6, this);
-
- _initDefineProp(this, 'disabled', _descriptor7, this);
-
- _initDefineProp(this, 'classes', _descriptor8, this);
-
- _initDefineProp(this, 'showConfirm', _descriptor9, this);
-
- this.options = {
- hideOnApprove: true,
- autoDimmer: true
- };
- }
-
- EmModal.prototype.detached = function detached() {
- $(this.modal).remove();
- };
-
- EmModal.prototype.attached = function attached() {
- var _this = this;
-
- $(this.modal).modal({
- closable: false,
- autofocus: false,
- observeChanges: true,
- allowMultiple: true,
-
- onShow: function onShow() {
- _this.onshow && _this.onshow(_this);
- },
- onVisible: function onVisible() {
- _this.onvisible && _this.onvisible(_this);
- },
- onApprove: function onApprove() {
- _this.options.autoDimmer && _this.showDimmer();
- _this.onapprove && _this.onapprove(_this);
- return _this.options.hideOnApprove;
- },
- onDeny: function onDeny() {
- _this.ondeny && _this.ondeny(_this);
- }
- });
- };
-
- EmModal.prototype.showDimmer = function showDimmer() {
- this.loading = true;
- $(this.modal).find('.dimmer').dimmer('show');
- };
-
- EmModal.prototype.hideDimmer = function hideDimmer() {
- this.loading = false;
- $(this.modal).find('.dimmer').dimmer('hide');
- };
-
- EmModal.prototype.show = function show(options) {
- _.extend(this.options, options);
- $(this.modal).modal('show');
- };
-
- EmModal.prototype.hide = function hide() {
- this.hideDimmer();
- $(this.modal).modal('hide');
- };
-
- EmModal.prototype.refresh = function refresh() {
- var _this2 = this;
-
- _.defer(function () {
- $(_this2.modal).modal('refresh');
- });
- };
-
- return EmModal;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'confirmLabel', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: function initializer() {
- return '确认';
- }
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'cancelLabel', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: function initializer() {
- return '取消';
- }
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'onapprove', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'ondeny', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, 'onshow', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, 'onvisible', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, 'disabled', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: function initializer() {
- return false;
- }
- }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, 'classes', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: function initializer() {
- return 'small';
- }
- }), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, 'showConfirm', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: function initializer() {
- return true;
- }
- })), _class2)) || _class;
-});
-define('resources/elements/em-user-avatar',['exports', 'aurelia-framework', 'color-hash'], function (exports, _aureliaFramework, _colorHash) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmUserAvatar = undefined;
-
- var _colorHash2 = _interopRequireDefault(_colorHash);
-
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
- }
-
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
-
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
-
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
-
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
-
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
-
- return desc;
- }
-
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
-
- var _class, _desc, _value, _class2, _descriptor;
-
- var EmUserAvatar = exports.EmUserAvatar = (0, _aureliaFramework.containerless)(_class = (_class2 = function () {
- function EmUserAvatar() {
- _classCallCheck(this, EmUserAvatar);
-
- _initDefineProp(this, 'user', _descriptor, this);
- }
-
- EmUserAvatar.prototype.userChanged = function userChanged() {
- if (this.user) {
- this._calcNameChar();
-
- var cs = colorHash.rgb(this.user.username);
- this.bgColor = 'rgba(' + cs[0] + ', ' + cs[1] + ', ' + cs[2] + ', 0.6)';
-
- this.color = 'rgba(' + (255 - cs[0]) + ', ' + (255 - cs[1]) + ', ' + (255 - cs[2]) + ', 1)';
- }
- };
-
- EmUserAvatar.prototype._calcNameChar = function _calcNameChar() {
- var lastChar = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
-
- if (this.user.name) {
- this.nameChar = lastChar ? _.last(this.user.name) : _.first(this.user.name);
- } else {
- this.nameChar = lastChar ? _.last(this.user.username) : _.first(this.user.username);
- }
- };
-
- EmUserAvatar.prototype.attached = function attached() {
- var _this = this;
-
- $(this.avatarRef).hover(function () {
- _this._calcNameChar(false);
- }, function () {
- _this._calcNameChar();
- });
- };
-
- return EmUserAvatar;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'user', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class;
-});
-define('resources/elements/em-user-edit',['exports', 'aurelia-framework'], function (exports, _aureliaFramework) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EmUserEdit = undefined;
-
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
-
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
-
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
-
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
-
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
-
- return desc;
- }
-
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
-
- var _class, _desc, _value, _class2, _descriptor;
-
- var EmUserEdit = exports.EmUserEdit = (0, _aureliaFramework.containerless)(_class = (_class2 = function () {
- function EmUserEdit() {
- _classCallCheck(this, EmUserEdit);
-
- _initDefineProp(this, 'user', _descriptor, this);
- }
-
- EmUserEdit.prototype.show = function show() {
- this.emModal.show({
- hideOnApprove: false,
- autoDimmer: true
- });
- };
-
- EmUserEdit.prototype.showHandler = function showHandler() {};
-
- EmUserEdit.prototype.attached = function attached() {
- $(this.frm).form({
- on: 'blur',
- inline: true,
- fields: {
- name: 'empty',
- mail: ['empty', 'email']
- }
- });
- };
-
- EmUserEdit.prototype._chkOk = function _chkOk() {
- var pwd = this.user.password;
- if (pwd && pwd.length < 8) {
- toastr.error('密码长度不能少于8位字符!');
- return false;
- }
-
- return true;
- };
-
- EmUserEdit.prototype.approveHandler = function approveHandler(modal) {
- var _this = this;
-
- if (this._chkOk() && $(this.frm).form('is valid')) {
- $.post('/admin/user/update2', {
- username: this.user.username,
- password: this.user.password,
- name: this.user.name,
- mail: this.user.mails
- }, function (data) {
- modal.hide();
- _this.user.password = '';
- if (data.success) {
- toastr.success('更新个人信息成功!');
- } else {
- toastr.error(data.data, '更新个人信息失败!');
- }
- });
- } else {
- modal.hideDimmer();
- }
- };
-
- return EmUserEdit;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'user', [_aureliaFramework.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class;
-});
-define('aurelia-templating-resources/compose',['exports', 'aurelia-dependency-injection', 'aurelia-task-queue', 'aurelia-templating', 'aurelia-pal'], function (exports, _aureliaDependencyInjection, _aureliaTaskQueue, _aureliaTemplating, _aureliaPal) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Compose = undefined;
-
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
-
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
-
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
-
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
-
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
-
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
-
- return desc;
- }
-
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
-
- var _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3;
-
- var Compose = exports.Compose = (_dec = (0, _aureliaTemplating.customElement)('compose'), _dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaPal.DOM.Element, _aureliaDependencyInjection.Container, _aureliaTemplating.CompositionEngine, _aureliaTemplating.ViewSlot, _aureliaTemplating.ViewResources, _aureliaTaskQueue.TaskQueue), _dec(_class = (0, _aureliaTemplating.noView)(_class = _dec2(_class = (_class2 = function () {
- function Compose(element, container, compositionEngine, viewSlot, viewResources, taskQueue) {
-
-
- _initDefineProp(this, 'model', _descriptor, this);
-
- _initDefineProp(this, 'view', _descriptor2, this);
-
- _initDefineProp(this, 'viewModel', _descriptor3, this);
-
- this.element = element;
- this.container = container;
- this.compositionEngine = compositionEngine;
- this.viewSlot = viewSlot;
- this.viewResources = viewResources;
- this.taskQueue = taskQueue;
- this.currentController = null;
- this.currentViewModel = null;
- }
-
- Compose.prototype.created = function created(owningView) {
- this.owningView = owningView;
- };
-
- Compose.prototype.bind = function bind(bindingContext, overrideContext) {
- this.bindingContext = bindingContext;
- this.overrideContext = overrideContext;
- processInstruction(this, createInstruction(this, {
- view: this.view,
- viewModel: this.viewModel,
- model: this.model
- }));
- };
-
- Compose.prototype.unbind = function unbind(bindingContext, overrideContext) {
- this.bindingContext = null;
- this.overrideContext = null;
- var returnToCache = true;
- var skipAnimation = true;
- this.viewSlot.removeAll(returnToCache, skipAnimation);
- };
-
- Compose.prototype.modelChanged = function modelChanged(newValue, oldValue) {
- var _this = this;
-
- if (this.currentInstruction) {
- this.currentInstruction.model = newValue;
- return;
- }
-
- this.taskQueue.queueMicroTask(function () {
- if (_this.currentInstruction) {
- _this.currentInstruction.model = newValue;
- return;
- }
-
- var vm = _this.currentViewModel;
-
- if (vm && typeof vm.activate === 'function') {
- vm.activate(newValue);
- }
- });
- };
-
- Compose.prototype.viewChanged = function viewChanged(newValue, oldValue) {
- var _this2 = this;
-
- var instruction = createInstruction(this, {
- view: newValue,
- viewModel: this.currentViewModel || this.viewModel,
- model: this.model
- });
-
- if (this.currentInstruction) {
- this.currentInstruction = instruction;
- return;
- }
-
- this.currentInstruction = instruction;
- this.taskQueue.queueMicroTask(function () {
- return processInstruction(_this2, _this2.currentInstruction);
- });
- };
-
- Compose.prototype.viewModelChanged = function viewModelChanged(newValue, oldValue) {
- var _this3 = this;
-
- var instruction = createInstruction(this, {
- viewModel: newValue,
- view: this.view,
- model: this.model
- });
-
- if (this.currentInstruction) {
- this.currentInstruction = instruction;
- return;
- }
-
- this.currentInstruction = instruction;
- this.taskQueue.queueMicroTask(function () {
- return processInstruction(_this3, _this3.currentInstruction);
- });
- };
-
- return Compose;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'model', [_aureliaTemplating.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'view', [_aureliaTemplating.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'viewModel', [_aureliaTemplating.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class) || _class) || _class);
-
-
- function createInstruction(composer, instruction) {
- return Object.assign(instruction, {
- bindingContext: composer.bindingContext,
- overrideContext: composer.overrideContext,
- owningView: composer.owningView,
- container: composer.container,
- viewSlot: composer.viewSlot,
- viewResources: composer.viewResources,
- currentController: composer.currentController,
- host: composer.element
- });
- }
-
- function processInstruction(composer, instruction) {
- composer.currentInstruction = null;
- composer.compositionEngine.compose(instruction).then(function (controller) {
- composer.currentController = controller;
- composer.currentViewModel = controller ? controller.viewModel : null;
- });
- }
-});
-define('aurelia-templating-resources/if',['exports', 'aurelia-templating', 'aurelia-dependency-injection'], function (exports, _aureliaTemplating, _aureliaDependencyInjection) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.If = undefined;
-
-
-
- var _dec, _dec2, _class;
-
- var If = exports.If = (_dec = (0, _aureliaTemplating.customAttribute)('if'), _dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.ViewSlot), _dec(_class = (0, _aureliaTemplating.templateController)(_class = _dec2(_class = function () {
- function If(viewFactory, viewSlot) {
-
-
- this.viewFactory = viewFactory;
- this.viewSlot = viewSlot;
- this.showing = false;
- this.view = null;
- this.bindingContext = null;
- this.overrideContext = null;
- }
-
- If.prototype.bind = function bind(bindingContext, overrideContext) {
- this.bindingContext = bindingContext;
- this.overrideContext = overrideContext;
- this.valueChanged(this.value);
- };
-
- If.prototype.valueChanged = function valueChanged(newValue) {
- var _this = this;
-
- if (this.__queuedChanges) {
- this.__queuedChanges.push(newValue);
- return;
- }
-
- var maybePromise = this._runValueChanged(newValue);
- if (maybePromise instanceof Promise) {
- (function () {
- var queuedChanges = _this.__queuedChanges = [];
-
- var runQueuedChanges = function runQueuedChanges() {
- if (!queuedChanges.length) {
- _this.__queuedChanges = undefined;
- return;
- }
-
- var nextPromise = _this._runValueChanged(queuedChanges.shift()) || Promise.resolve();
- nextPromise.then(runQueuedChanges);
- };
-
- maybePromise.then(runQueuedChanges);
- })();
- }
- };
-
- If.prototype._runValueChanged = function _runValueChanged(newValue) {
- var _this2 = this;
-
- if (!newValue) {
- var viewOrPromise = void 0;
- if (this.view !== null && this.showing) {
- viewOrPromise = this.viewSlot.remove(this.view);
- if (viewOrPromise instanceof Promise) {
- viewOrPromise.then(function () {
- return _this2.view.unbind();
- });
- } else {
- this.view.unbind();
- }
- }
-
- this.showing = false;
- return viewOrPromise;
- }
-
- if (this.view === null) {
- this.view = this.viewFactory.create();
- }
-
- if (!this.view.isBound) {
- this.view.bind(this.bindingContext, this.overrideContext);
- }
-
- if (!this.showing) {
- this.showing = true;
- return this.viewSlot.add(this.view);
- }
-
- return undefined;
- };
-
- If.prototype.unbind = function unbind() {
- if (this.view === null) {
- return;
- }
-
- this.view.unbind();
-
- if (!this.viewFactory.isCaching) {
- return;
- }
-
- if (this.showing) {
- this.showing = false;
- this.viewSlot.remove(this.view, true, true);
- }
- this.view.returnToCache();
- this.view = null;
- };
-
- return If;
- }()) || _class) || _class) || _class);
-});
-define('aurelia-templating-resources/with',['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aurelia-binding'], function (exports, _aureliaDependencyInjection, _aureliaTemplating, _aureliaBinding) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.With = undefined;
-
-
-
- var _dec, _dec2, _class;
-
- var With = exports.With = (_dec = (0, _aureliaTemplating.customAttribute)('with'), _dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.ViewSlot), _dec(_class = (0, _aureliaTemplating.templateController)(_class = _dec2(_class = function () {
- function With(viewFactory, viewSlot) {
-
-
- this.viewFactory = viewFactory;
- this.viewSlot = viewSlot;
- this.parentOverrideContext = null;
- this.view = null;
- }
-
- With.prototype.bind = function bind(bindingContext, overrideContext) {
- this.parentOverrideContext = overrideContext;
- this.valueChanged(this.value);
- };
-
- With.prototype.valueChanged = function valueChanged(newValue) {
- var overrideContext = (0, _aureliaBinding.createOverrideContext)(newValue, this.parentOverrideContext);
- if (!this.view) {
- this.view = this.viewFactory.create();
- this.view.bind(newValue, overrideContext);
- this.viewSlot.add(this.view);
- } else {
- this.view.bind(newValue, overrideContext);
- }
- };
-
- With.prototype.unbind = function unbind() {
- this.parentOverrideContext = null;
-
- if (this.view) {
- this.view.unbind();
- }
- };
-
- return With;
- }()) || _class) || _class) || _class);
-});
-define('aurelia-templating-resources/repeat',['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-templating', './repeat-strategy-locator', './repeat-utilities', './analyze-view-factory', './abstract-repeater'], function (exports, _aureliaDependencyInjection, _aureliaBinding, _aureliaTemplating, _repeatStrategyLocator, _repeatUtilities, _analyzeViewFactory, _abstractRepeater) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Repeat = undefined;
-
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
-
-
- function _possibleConstructorReturn(self, call) {
- if (!self) {
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- }
-
- return call && (typeof call === "object" || typeof call === "function") ? call : self;
- }
-
- function _inherits(subClass, superClass) {
- if (typeof superClass !== "function" && superClass !== null) {
- throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
- }
-
- subClass.prototype = Object.create(superClass && superClass.prototype, {
- constructor: {
- value: subClass,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
- }
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
-
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
-
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
-
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
-
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
-
- return desc;
- }
-
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
-
- var _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4;
-
- var Repeat = exports.Repeat = (_dec = (0, _aureliaTemplating.customAttribute)('repeat'), _dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.TargetInstruction, _aureliaTemplating.ViewSlot, _aureliaTemplating.ViewResources, _aureliaBinding.ObserverLocator, _repeatStrategyLocator.RepeatStrategyLocator), _dec(_class = (0, _aureliaTemplating.templateController)(_class = _dec2(_class = (_class2 = function (_AbstractRepeater) {
- _inherits(Repeat, _AbstractRepeater);
-
- function Repeat(viewFactory, instruction, viewSlot, viewResources, observerLocator, strategyLocator) {
-
-
- var _this = _possibleConstructorReturn(this, _AbstractRepeater.call(this, {
- local: 'item',
- viewsRequireLifecycle: (0, _analyzeViewFactory.viewsRequireLifecycle)(viewFactory)
- }));
-
- _initDefineProp(_this, 'items', _descriptor, _this);
-
- _initDefineProp(_this, 'local', _descriptor2, _this);
-
- _initDefineProp(_this, 'key', _descriptor3, _this);
-
- _initDefineProp(_this, 'value', _descriptor4, _this);
-
- _this.viewFactory = viewFactory;
- _this.instruction = instruction;
- _this.viewSlot = viewSlot;
- _this.lookupFunctions = viewResources.lookupFunctions;
- _this.observerLocator = observerLocator;
- _this.key = 'key';
- _this.value = 'value';
- _this.strategyLocator = strategyLocator;
- _this.ignoreMutation = false;
- _this.sourceExpression = (0, _repeatUtilities.getItemsSourceExpression)(_this.instruction, 'repeat.for');
- _this.isOneTime = (0, _repeatUtilities.isOneTime)(_this.sourceExpression);
- _this.viewsRequireLifecycle = (0, _analyzeViewFactory.viewsRequireLifecycle)(viewFactory);
- return _this;
- }
-
- Repeat.prototype.call = function call(context, changes) {
- this[context](this.items, changes);
- };
-
- Repeat.prototype.bind = function bind(bindingContext, overrideContext) {
- this.scope = { bindingContext: bindingContext, overrideContext: overrideContext };
- this.matcherBinding = this._captureAndRemoveMatcherBinding();
- this.itemsChanged();
- };
-
- Repeat.prototype.unbind = function unbind() {
- this.scope = null;
- this.items = null;
- this.matcherBinding = null;
- this.viewSlot.removeAll(true);
- this._unsubscribeCollection();
- };
-
- Repeat.prototype._unsubscribeCollection = function _unsubscribeCollection() {
- if (this.collectionObserver) {
- this.collectionObserver.unsubscribe(this.callContext, this);
- this.collectionObserver = null;
- this.callContext = null;
- }
- };
-
- Repeat.prototype.itemsChanged = function itemsChanged() {
- this._unsubscribeCollection();
-
- if (!this.scope) {
- return;
- }
-
- var items = this.items;
- this.strategy = this.strategyLocator.getStrategy(items);
- if (!this.strategy) {
- throw new Error('Value for \'' + this.sourceExpression + '\' is non-repeatable');
- }
-
- if (!this.isOneTime && !this._observeInnerCollection()) {
- this._observeCollection();
- }
- this.strategy.instanceChanged(this, items);
- };
-
- Repeat.prototype._getInnerCollection = function _getInnerCollection() {
- var expression = (0, _repeatUtilities.unwrapExpression)(this.sourceExpression);
- if (!expression) {
- return null;
- }
- return expression.evaluate(this.scope, null);
- };
-
- Repeat.prototype.handleCollectionMutated = function handleCollectionMutated(collection, changes) {
- if (!this.collectionObserver) {
- return;
- }
- this.strategy.instanceMutated(this, collection, changes);
- };
-
- Repeat.prototype.handleInnerCollectionMutated = function handleInnerCollectionMutated(collection, changes) {
- var _this2 = this;
-
- if (!this.collectionObserver) {
- return;
- }
-
- if (this.ignoreMutation) {
- return;
- }
- this.ignoreMutation = true;
- var newItems = this.sourceExpression.evaluate(this.scope, this.lookupFunctions);
- this.observerLocator.taskQueue.queueMicroTask(function () {
- return _this2.ignoreMutation = false;
- });
-
- if (newItems === this.items) {
- this.itemsChanged();
- } else {
- this.items = newItems;
- }
- };
-
- Repeat.prototype._observeInnerCollection = function _observeInnerCollection() {
- var items = this._getInnerCollection();
- var strategy = this.strategyLocator.getStrategy(items);
- if (!strategy) {
- return false;
- }
- this.collectionObserver = strategy.getCollectionObserver(this.observerLocator, items);
- if (!this.collectionObserver) {
- return false;
- }
- this.callContext = 'handleInnerCollectionMutated';
- this.collectionObserver.subscribe(this.callContext, this);
- return true;
- };
-
- Repeat.prototype._observeCollection = function _observeCollection() {
- var items = this.items;
- this.collectionObserver = this.strategy.getCollectionObserver(this.observerLocator, items);
- if (this.collectionObserver) {
- this.callContext = 'handleCollectionMutated';
- this.collectionObserver.subscribe(this.callContext, this);
- }
- };
-
- Repeat.prototype._captureAndRemoveMatcherBinding = function _captureAndRemoveMatcherBinding() {
- if (this.viewFactory.viewFactory) {
- var instructions = this.viewFactory.viewFactory.instructions;
- var instructionIds = Object.keys(instructions);
- for (var i = 0; i < instructionIds.length; i++) {
- var expressions = instructions[instructionIds[i]].expressions;
- if (expressions) {
- for (var ii = 0; i < expressions.length; i++) {
- if (expressions[ii].targetProperty === 'matcher') {
- var matcherBinding = expressions[ii];
- expressions.splice(ii, 1);
- return matcherBinding;
- }
- }
- }
- }
- }
-
- return undefined;
- };
-
- Repeat.prototype.viewCount = function viewCount() {
- return this.viewSlot.children.length;
- };
-
- Repeat.prototype.views = function views() {
- return this.viewSlot.children;
- };
-
- Repeat.prototype.view = function view(index) {
- return this.viewSlot.children[index];
- };
-
- Repeat.prototype.matcher = function matcher() {
- return this.matcherBinding ? this.matcherBinding.sourceExpression.evaluate(this.scope, this.matcherBinding.lookupFunctions) : null;
- };
-
- Repeat.prototype.addView = function addView(bindingContext, overrideContext) {
- var view = this.viewFactory.create();
- view.bind(bindingContext, overrideContext);
- this.viewSlot.add(view);
- };
-
- Repeat.prototype.insertView = function insertView(index, bindingContext, overrideContext) {
- var view = this.viewFactory.create();
- view.bind(bindingContext, overrideContext);
- this.viewSlot.insert(index, view);
- };
-
- Repeat.prototype.moveView = function moveView(sourceIndex, targetIndex) {
- this.viewSlot.move(sourceIndex, targetIndex);
- };
-
- Repeat.prototype.removeAllViews = function removeAllViews(returnToCache, skipAnimation) {
- return this.viewSlot.removeAll(returnToCache, skipAnimation);
- };
-
- Repeat.prototype.removeViews = function removeViews(viewsToRemove, returnToCache, skipAnimation) {
- return this.viewSlot.removeMany(viewsToRemove, returnToCache, skipAnimation);
- };
-
- Repeat.prototype.removeView = function removeView(index, returnToCache, skipAnimation) {
- return this.viewSlot.removeAt(index, returnToCache, skipAnimation);
- };
-
- Repeat.prototype.updateBindings = function updateBindings(view) {
- var j = view.bindings.length;
- while (j--) {
- (0, _repeatUtilities.updateOneTimeBinding)(view.bindings[j]);
- }
- j = view.controllers.length;
- while (j--) {
- var k = view.controllers[j].boundProperties.length;
- while (k--) {
- var binding = view.controllers[j].boundProperties[k].binding;
- (0, _repeatUtilities.updateOneTimeBinding)(binding);
- }
- }
- };
-
- return Repeat;
- }(_abstractRepeater.AbstractRepeater), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'items', [_aureliaTemplating.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'local', [_aureliaTemplating.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'key', [_aureliaTemplating.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'value', [_aureliaTemplating.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class) || _class) || _class);
-});
-define('aurelia-templating-resources/repeat-strategy-locator',['exports', './null-repeat-strategy', './array-repeat-strategy', './map-repeat-strategy', './set-repeat-strategy', './number-repeat-strategy'], function (exports, _nullRepeatStrategy, _arrayRepeatStrategy, _mapRepeatStrategy, _setRepeatStrategy, _numberRepeatStrategy) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.RepeatStrategyLocator = undefined;
-
-
-
- var RepeatStrategyLocator = exports.RepeatStrategyLocator = function () {
- function RepeatStrategyLocator() {
-
-
- this.matchers = [];
- this.strategies = [];
-
- this.addStrategy(function (items) {
- return items === null || items === undefined;
- }, new _nullRepeatStrategy.NullRepeatStrategy());
- this.addStrategy(function (items) {
- return items instanceof Array;
- }, new _arrayRepeatStrategy.ArrayRepeatStrategy());
- this.addStrategy(function (items) {
- return items instanceof Map;
- }, new _mapRepeatStrategy.MapRepeatStrategy());
- this.addStrategy(function (items) {
- return items instanceof Set;
- }, new _setRepeatStrategy.SetRepeatStrategy());
- this.addStrategy(function (items) {
- return typeof items === 'number';
- }, new _numberRepeatStrategy.NumberRepeatStrategy());
- }
-
- RepeatStrategyLocator.prototype.addStrategy = function addStrategy(matcher, strategy) {
- this.matchers.push(matcher);
- this.strategies.push(strategy);
- };
-
- RepeatStrategyLocator.prototype.getStrategy = function getStrategy(items) {
- var matchers = this.matchers;
-
- for (var i = 0, ii = matchers.length; i < ii; ++i) {
- if (matchers[i](items)) {
- return this.strategies[i];
- }
- }
-
- return null;
- };
-
- return RepeatStrategyLocator;
- }();
-});
-define('aurelia-templating-resources/null-repeat-strategy',["exports"], function (exports) {
- "use strict";
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
-
-
- var NullRepeatStrategy = exports.NullRepeatStrategy = function () {
- function NullRepeatStrategy() {
-
- }
-
- NullRepeatStrategy.prototype.instanceChanged = function instanceChanged(repeat, items) {
- repeat.removeAllViews(true);
- };
-
- NullRepeatStrategy.prototype.getCollectionObserver = function getCollectionObserver(observerLocator, items) {};
-
- return NullRepeatStrategy;
- }();
-});
-define('aurelia-templating-resources/array-repeat-strategy',['exports', './repeat-utilities', 'aurelia-binding'], function (exports, _repeatUtilities, _aureliaBinding) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.ArrayRepeatStrategy = undefined;
-
-
-
- var ArrayRepeatStrategy = exports.ArrayRepeatStrategy = function () {
- function ArrayRepeatStrategy() {
-
- }
-
- ArrayRepeatStrategy.prototype.getCollectionObserver = function getCollectionObserver(observerLocator, items) {
- return observerLocator.getArrayObserver(items);
- };
-
- ArrayRepeatStrategy.prototype.instanceChanged = function instanceChanged(repeat, items) {
- var _this = this;
-
- var itemsLength = items.length;
-
- if (!items || itemsLength === 0) {
- repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);
- return;
- }
-
- var children = repeat.views();
- var viewsLength = children.length;
-
- if (viewsLength === 0) {
- this._standardProcessInstanceChanged(repeat, items);
- return;
- }
-
- if (repeat.viewsRequireLifecycle) {
- (function () {
- var childrenSnapshot = children.slice(0);
- var itemNameInBindingContext = repeat.local;
- var matcher = repeat.matcher();
-
- var itemsPreviouslyInViews = [];
- var viewsToRemove = [];
-
- for (var index = 0; index < viewsLength; index++) {
- var view = childrenSnapshot[index];
- var oldItem = view.bindingContext[itemNameInBindingContext];
-
- if ((0, _repeatUtilities.indexOf)(items, oldItem, matcher) === -1) {
- viewsToRemove.push(view);
- } else {
- itemsPreviouslyInViews.push(oldItem);
- }
- }
-
- var updateViews = void 0;
- var removePromise = void 0;
-
- if (itemsPreviouslyInViews.length > 0) {
- removePromise = repeat.removeViews(viewsToRemove, true, !repeat.viewsRequireLifecycle);
- updateViews = function updateViews() {
- for (var _index = 0; _index < itemsLength; _index++) {
- var item = items[_index];
- var indexOfView = (0, _repeatUtilities.indexOf)(itemsPreviouslyInViews, item, matcher, _index);
- var _view = void 0;
-
- if (indexOfView === -1) {
- var overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, items[_index], _index, itemsLength);
- repeat.insertView(_index, overrideContext.bindingContext, overrideContext);
-
- itemsPreviouslyInViews.splice(_index, 0, undefined);
- } else if (indexOfView === _index) {
- _view = children[indexOfView];
- itemsPreviouslyInViews[indexOfView] = undefined;
- } else {
- _view = children[indexOfView];
- repeat.moveView(indexOfView, _index);
- itemsPreviouslyInViews.splice(indexOfView, 1);
- itemsPreviouslyInViews.splice(_index, 0, undefined);
- }
-
- if (_view) {
- (0, _repeatUtilities.updateOverrideContext)(_view.overrideContext, _index, itemsLength);
- }
- }
-
- _this._inPlaceProcessItems(repeat, items);
- };
- } else {
- removePromise = repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);
- updateViews = function updateViews() {
- return _this._standardProcessInstanceChanged(repeat, items);
- };
- }
-
- if (removePromise instanceof Promise) {
- removePromise.then(updateViews);
- } else {
- updateViews();
- }
- })();
- } else {
- this._inPlaceProcessItems(repeat, items);
- }
- };
-
- ArrayRepeatStrategy.prototype._standardProcessInstanceChanged = function _standardProcessInstanceChanged(repeat, items) {
- for (var i = 0, ii = items.length; i < ii; i++) {
- var overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, items[i], i, ii);
- repeat.addView(overrideContext.bindingContext, overrideContext);
- }
- };
-
- ArrayRepeatStrategy.prototype._inPlaceProcessItems = function _inPlaceProcessItems(repeat, items) {
- var itemsLength = items.length;
- var viewsLength = repeat.viewCount();
-
- while (viewsLength > itemsLength) {
- viewsLength--;
- repeat.removeView(viewsLength, true, !repeat.viewsRequireLifecycle);
- }
-
- var local = repeat.local;
-
- for (var i = 0; i < viewsLength; i++) {
- var view = repeat.view(i);
- var last = i === itemsLength - 1;
- var middle = i !== 0 && !last;
-
- if (view.bindingContext[local] === items[i] && view.overrideContext.$middle === middle && view.overrideContext.$last === last) {
- continue;
- }
-
- view.bindingContext[local] = items[i];
- view.overrideContext.$middle = middle;
- view.overrideContext.$last = last;
- repeat.updateBindings(view);
- }
-
- for (var _i = viewsLength; _i < itemsLength; _i++) {
- var overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, items[_i], _i, itemsLength);
- repeat.addView(overrideContext.bindingContext, overrideContext);
- }
- };
-
- ArrayRepeatStrategy.prototype.instanceMutated = function instanceMutated(repeat, array, splices) {
- var _this2 = this;
-
- if (repeat.__queuedSplices) {
- for (var i = 0, ii = splices.length; i < ii; ++i) {
- var _splices$i = splices[i];
- var index = _splices$i.index;
- var removed = _splices$i.removed;
- var addedCount = _splices$i.addedCount;
-
- (0, _aureliaBinding.mergeSplice)(repeat.__queuedSplices, index, removed, addedCount);
- }
-
- repeat.__array = array.slice(0);
- return;
- }
-
- var maybePromise = this._runSplices(repeat, array.slice(0), splices);
- if (maybePromise instanceof Promise) {
- (function () {
- var queuedSplices = repeat.__queuedSplices = [];
-
- var runQueuedSplices = function runQueuedSplices() {
- if (!queuedSplices.length) {
- repeat.__queuedSplices = undefined;
- repeat.__array = undefined;
- return;
- }
-
- var nextPromise = _this2._runSplices(repeat, repeat.__array, queuedSplices) || Promise.resolve();
- queuedSplices = repeat.__queuedSplices = [];
- nextPromise.then(runQueuedSplices);
- };
-
- maybePromise.then(runQueuedSplices);
- })();
- }
- };
-
- ArrayRepeatStrategy.prototype._runSplices = function _runSplices(repeat, array, splices) {
- var _this3 = this;
-
- var removeDelta = 0;
- var rmPromises = [];
-
- for (var i = 0, ii = splices.length; i < ii; ++i) {
- var splice = splices[i];
- var removed = splice.removed;
-
- for (var j = 0, jj = removed.length; j < jj; ++j) {
- var viewOrPromise = repeat.removeView(splice.index + removeDelta + rmPromises.length, true);
- if (viewOrPromise instanceof Promise) {
- rmPromises.push(viewOrPromise);
- }
- }
- removeDelta -= splice.addedCount;
- }
-
- if (rmPromises.length > 0) {
- return Promise.all(rmPromises).then(function () {
- var spliceIndexLow = _this3._handleAddedSplices(repeat, array, splices);
- (0, _repeatUtilities.updateOverrideContexts)(repeat.views(), spliceIndexLow);
- });
- }
-
- var spliceIndexLow = this._handleAddedSplices(repeat, array, splices);
- (0, _repeatUtilities.updateOverrideContexts)(repeat.views(), spliceIndexLow);
-
- return undefined;
- };
-
- ArrayRepeatStrategy.prototype._handleAddedSplices = function _handleAddedSplices(repeat, array, splices) {
- var spliceIndex = void 0;
- var spliceIndexLow = void 0;
- var arrayLength = array.length;
- for (var i = 0, ii = splices.length; i < ii; ++i) {
- var splice = splices[i];
- var addIndex = spliceIndex = splice.index;
- var end = splice.index + splice.addedCount;
-
- if (typeof spliceIndexLow === 'undefined' || spliceIndexLow === null || spliceIndexLow > splice.index) {
- spliceIndexLow = spliceIndex;
- }
-
- for (; addIndex < end; ++addIndex) {
- var overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, array[addIndex], addIndex, arrayLength);
- repeat.insertView(addIndex, overrideContext.bindingContext, overrideContext);
- }
- }
-
- return spliceIndexLow;
- };
-
- return ArrayRepeatStrategy;
- }();
-});
-define('aurelia-templating-resources/repeat-utilities',['exports', 'aurelia-binding'], function (exports, _aureliaBinding) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.updateOverrideContexts = updateOverrideContexts;
- exports.createFullOverrideContext = createFullOverrideContext;
- exports.updateOverrideContext = updateOverrideContext;
- exports.getItemsSourceExpression = getItemsSourceExpression;
- exports.unwrapExpression = unwrapExpression;
- exports.isOneTime = isOneTime;
- exports.updateOneTimeBinding = updateOneTimeBinding;
- exports.indexOf = indexOf;
-
-
- var oneTime = _aureliaBinding.bindingMode.oneTime;
-
- function updateOverrideContexts(views, startIndex) {
- var length = views.length;
-
- if (startIndex > 0) {
- startIndex = startIndex - 1;
- }
-
- for (; startIndex < length; ++startIndex) {
- updateOverrideContext(views[startIndex].overrideContext, startIndex, length);
- }
- }
-
- function createFullOverrideContext(repeat, data, index, length, key) {
- var bindingContext = {};
- var overrideContext = (0, _aureliaBinding.createOverrideContext)(bindingContext, repeat.scope.overrideContext);
-
- if (typeof key !== 'undefined') {
- bindingContext[repeat.key] = key;
- bindingContext[repeat.value] = data;
- } else {
- bindingContext[repeat.local] = data;
- }
- updateOverrideContext(overrideContext, index, length);
- return overrideContext;
- }
-
- function updateOverrideContext(overrideContext, index, length) {
- var first = index === 0;
- var last = index === length - 1;
- var even = index % 2 === 0;
-
- overrideContext.$index = index;
- overrideContext.$first = first;
- overrideContext.$last = last;
- overrideContext.$middle = !(first || last);
- overrideContext.$odd = !even;
- overrideContext.$even = even;
- }
-
- function getItemsSourceExpression(instruction, attrName) {
- return instruction.behaviorInstructions.filter(function (bi) {
- return bi.originalAttrName === attrName;
- })[0].attributes.items.sourceExpression;
- }
-
- function unwrapExpression(expression) {
- var unwrapped = false;
- while (expression instanceof _aureliaBinding.BindingBehavior) {
- expression = expression.expression;
- }
- while (expression instanceof _aureliaBinding.ValueConverter) {
- expression = expression.expression;
- unwrapped = true;
- }
- return unwrapped ? expression : null;
- }
-
- function isOneTime(expression) {
- while (expression instanceof _aureliaBinding.BindingBehavior) {
- if (expression.name === 'oneTime') {
- return true;
- }
- expression = expression.expression;
- }
- return false;
- }
-
- function updateOneTimeBinding(binding) {
- if (binding.call && binding.mode === oneTime) {
- binding.call(_aureliaBinding.sourceContext);
- } else if (binding.updateOneTimeBindings) {
- binding.updateOneTimeBindings();
- }
- }
-
- function indexOf(array, item, matcher, startIndex) {
- if (!matcher) {
- return array.indexOf(item);
- }
- var length = array.length;
- for (var index = startIndex || 0; index < length; index++) {
- if (matcher(array[index], item)) {
- return index;
- }
- }
- return -1;
- }
-});
-define('aurelia-templating-resources/map-repeat-strategy',['exports', './repeat-utilities'], function (exports, _repeatUtilities) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.MapRepeatStrategy = undefined;
-
-
-
- var MapRepeatStrategy = exports.MapRepeatStrategy = function () {
- function MapRepeatStrategy() {
-
- }
-
- MapRepeatStrategy.prototype.getCollectionObserver = function getCollectionObserver(observerLocator, items) {
- return observerLocator.getMapObserver(items);
- };
-
- MapRepeatStrategy.prototype.instanceChanged = function instanceChanged(repeat, items) {
- var _this = this;
-
- var removePromise = repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);
- if (removePromise instanceof Promise) {
- removePromise.then(function () {
- return _this._standardProcessItems(repeat, items);
- });
- return;
- }
- this._standardProcessItems(repeat, items);
- };
-
- MapRepeatStrategy.prototype._standardProcessItems = function _standardProcessItems(repeat, items) {
- var index = 0;
- var overrideContext = void 0;
-
- items.forEach(function (value, key) {
- overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, value, index, items.size, key);
- repeat.addView(overrideContext.bindingContext, overrideContext);
- ++index;
- });
- };
-
- MapRepeatStrategy.prototype.instanceMutated = function instanceMutated(repeat, map, records) {
- var key = void 0;
- var i = void 0;
- var ii = void 0;
- var overrideContext = void 0;
- var removeIndex = void 0;
- var record = void 0;
- var rmPromises = [];
- var viewOrPromise = void 0;
-
- for (i = 0, ii = records.length; i < ii; ++i) {
- record = records[i];
- key = record.key;
- switch (record.type) {
- case 'update':
- removeIndex = this._getViewIndexByKey(repeat, key);
- viewOrPromise = repeat.removeView(removeIndex, true, !repeat.viewsRequireLifecycle);
- if (viewOrPromise instanceof Promise) {
- rmPromises.push(viewOrPromise);
- }
- overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, map.get(key), removeIndex, map.size, key);
- repeat.insertView(removeIndex, overrideContext.bindingContext, overrideContext);
- break;
- case 'add':
- overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, map.get(key), map.size - 1, map.size, key);
- repeat.insertView(map.size - 1, overrideContext.bindingContext, overrideContext);
- break;
- case 'delete':
- if (record.oldValue === undefined) {
- return;
- }
- removeIndex = this._getViewIndexByKey(repeat, key);
- viewOrPromise = repeat.removeView(removeIndex, true, !repeat.viewsRequireLifecycle);
- if (viewOrPromise instanceof Promise) {
- rmPromises.push(viewOrPromise);
- }
- break;
- case 'clear':
- repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);
- break;
- default:
- continue;
- }
- }
-
- if (rmPromises.length > 0) {
- Promise.all(rmPromises).then(function () {
- (0, _repeatUtilities.updateOverrideContexts)(repeat.views(), 0);
- });
- } else {
- (0, _repeatUtilities.updateOverrideContexts)(repeat.views(), 0);
- }
- };
-
- MapRepeatStrategy.prototype._getViewIndexByKey = function _getViewIndexByKey(repeat, key) {
- var i = void 0;
- var ii = void 0;
- var child = void 0;
-
- for (i = 0, ii = repeat.viewCount(); i < ii; ++i) {
- child = repeat.view(i);
- if (child.bindingContext[repeat.key] === key) {
- return i;
- }
- }
-
- return undefined;
- };
-
- return MapRepeatStrategy;
- }();
-});
-define('aurelia-templating-resources/set-repeat-strategy',['exports', './repeat-utilities'], function (exports, _repeatUtilities) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.SetRepeatStrategy = undefined;
-
-
-
- var SetRepeatStrategy = exports.SetRepeatStrategy = function () {
- function SetRepeatStrategy() {
-
- }
-
- SetRepeatStrategy.prototype.getCollectionObserver = function getCollectionObserver(observerLocator, items) {
- return observerLocator.getSetObserver(items);
- };
-
- SetRepeatStrategy.prototype.instanceChanged = function instanceChanged(repeat, items) {
- var _this = this;
-
- var removePromise = repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);
- if (removePromise instanceof Promise) {
- removePromise.then(function () {
- return _this._standardProcessItems(repeat, items);
- });
- return;
- }
- this._standardProcessItems(repeat, items);
- };
-
- SetRepeatStrategy.prototype._standardProcessItems = function _standardProcessItems(repeat, items) {
- var index = 0;
- var overrideContext = void 0;
-
- items.forEach(function (value) {
- overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, value, index, items.size);
- repeat.addView(overrideContext.bindingContext, overrideContext);
- ++index;
- });
- };
-
- SetRepeatStrategy.prototype.instanceMutated = function instanceMutated(repeat, set, records) {
- var value = void 0;
- var i = void 0;
- var ii = void 0;
- var overrideContext = void 0;
- var removeIndex = void 0;
- var record = void 0;
- var rmPromises = [];
- var viewOrPromise = void 0;
-
- for (i = 0, ii = records.length; i < ii; ++i) {
- record = records[i];
- value = record.value;
- switch (record.type) {
- case 'add':
- overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, value, set.size - 1, set.size);
- repeat.insertView(set.size - 1, overrideContext.bindingContext, overrideContext);
- break;
- case 'delete':
- removeIndex = this._getViewIndexByValue(repeat, value);
- viewOrPromise = repeat.removeView(removeIndex, true, !repeat.viewsRequireLifecycle);
- if (viewOrPromise instanceof Promise) {
- rmPromises.push(viewOrPromise);
- }
- break;
- case 'clear':
- repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);
- break;
- default:
- continue;
- }
- }
-
- if (rmPromises.length > 0) {
- Promise.all(rmPromises).then(function () {
- (0, _repeatUtilities.updateOverrideContexts)(repeat.views(), 0);
- });
- } else {
- (0, _repeatUtilities.updateOverrideContexts)(repeat.views(), 0);
- }
- };
-
- SetRepeatStrategy.prototype._getViewIndexByValue = function _getViewIndexByValue(repeat, value) {
- var i = void 0;
- var ii = void 0;
- var child = void 0;
-
- for (i = 0, ii = repeat.viewCount(); i < ii; ++i) {
- child = repeat.view(i);
- if (child.bindingContext[repeat.local] === value) {
- return i;
- }
- }
-
- return undefined;
- };
-
- return SetRepeatStrategy;
- }();
-});
-define('aurelia-templating-resources/number-repeat-strategy',['exports', './repeat-utilities'], function (exports, _repeatUtilities) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.NumberRepeatStrategy = undefined;
-
-
-
- var NumberRepeatStrategy = exports.NumberRepeatStrategy = function () {
- function NumberRepeatStrategy() {
-
- }
-
- NumberRepeatStrategy.prototype.getCollectionObserver = function getCollectionObserver() {
- return null;
- };
-
- NumberRepeatStrategy.prototype.instanceChanged = function instanceChanged(repeat, value) {
- var _this = this;
-
- var removePromise = repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);
- if (removePromise instanceof Promise) {
- removePromise.then(function () {
- return _this._standardProcessItems(repeat, value);
- });
- return;
- }
- this._standardProcessItems(repeat, value);
- };
-
- NumberRepeatStrategy.prototype._standardProcessItems = function _standardProcessItems(repeat, value) {
- var childrenLength = repeat.viewCount();
- var i = void 0;
- var ii = void 0;
- var overrideContext = void 0;
- var viewsToRemove = void 0;
-
- value = Math.floor(value);
- viewsToRemove = childrenLength - value;
-
- if (viewsToRemove > 0) {
- if (viewsToRemove > childrenLength) {
- viewsToRemove = childrenLength;
- }
-
- for (i = 0, ii = viewsToRemove; i < ii; ++i) {
- repeat.removeView(childrenLength - (i + 1), true, !repeat.viewsRequireLifecycle);
- }
-
- return;
- }
-
- for (i = childrenLength, ii = value; i < ii; ++i) {
- overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, i, i, ii);
- repeat.addView(overrideContext.bindingContext, overrideContext);
- }
-
- (0, _repeatUtilities.updateOverrideContexts)(repeat.views(), 0);
- };
-
- return NumberRepeatStrategy;
- }();
-});
-define('aurelia-templating-resources/analyze-view-factory',['exports'], function (exports) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.viewsRequireLifecycle = viewsRequireLifecycle;
- var lifecycleOptionalBehaviors = exports.lifecycleOptionalBehaviors = ['focus', 'if', 'repeat', 'show', 'with'];
-
- function behaviorRequiresLifecycle(instruction) {
- var t = instruction.type;
- var name = t.elementName !== null ? t.elementName : t.attributeName;
- return lifecycleOptionalBehaviors.indexOf(name) === -1 && (t.handlesAttached || t.handlesBind || t.handlesCreated || t.handlesDetached || t.handlesUnbind) || t.viewFactory && viewsRequireLifecycle(t.viewFactory) || instruction.viewFactory && viewsRequireLifecycle(instruction.viewFactory);
- }
-
- function targetRequiresLifecycle(instruction) {
- var behaviors = instruction.behaviorInstructions;
- if (behaviors) {
- var i = behaviors.length;
- while (i--) {
- if (behaviorRequiresLifecycle(behaviors[i])) {
- return true;
- }
- }
- }
-
- return instruction.viewFactory && viewsRequireLifecycle(instruction.viewFactory);
- }
-
- function viewsRequireLifecycle(viewFactory) {
- if ('_viewsRequireLifecycle' in viewFactory) {
- return viewFactory._viewsRequireLifecycle;
- }
-
- viewFactory._viewsRequireLifecycle = false;
-
- if (viewFactory.viewFactory) {
- viewFactory._viewsRequireLifecycle = viewsRequireLifecycle(viewFactory.viewFactory);
- return viewFactory._viewsRequireLifecycle;
- }
-
- if (viewFactory.template.querySelector('.au-animate')) {
- viewFactory._viewsRequireLifecycle = true;
- return true;
- }
-
- for (var id in viewFactory.instructions) {
- if (targetRequiresLifecycle(viewFactory.instructions[id])) {
- viewFactory._viewsRequireLifecycle = true;
- return true;
- }
- }
-
- viewFactory._viewsRequireLifecycle = false;
- return false;
- }
-});
-define('aurelia-templating-resources/abstract-repeater',['exports'], function (exports) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
-
-
- var AbstractRepeater = exports.AbstractRepeater = function () {
- function AbstractRepeater(options) {
-
-
- Object.assign(this, {
- local: 'items',
- viewsRequireLifecycle: true
- }, options);
- }
-
- AbstractRepeater.prototype.viewCount = function viewCount() {
- throw new Error('subclass must implement `viewCount`');
- };
-
- AbstractRepeater.prototype.views = function views() {
- throw new Error('subclass must implement `views`');
- };
-
- AbstractRepeater.prototype.view = function view(index) {
- throw new Error('subclass must implement `view`');
- };
-
- AbstractRepeater.prototype.matcher = function matcher() {
- throw new Error('subclass must implement `matcher`');
- };
-
- AbstractRepeater.prototype.addView = function addView(bindingContext, overrideContext) {
- throw new Error('subclass must implement `addView`');
- };
-
- AbstractRepeater.prototype.insertView = function insertView(index, bindingContext, overrideContext) {
- throw new Error('subclass must implement `insertView`');
- };
-
- AbstractRepeater.prototype.moveView = function moveView(sourceIndex, targetIndex) {
- throw new Error('subclass must implement `moveView`');
- };
-
- AbstractRepeater.prototype.removeAllViews = function removeAllViews(returnToCache, skipAnimation) {
- throw new Error('subclass must implement `removeAllViews`');
- };
-
- AbstractRepeater.prototype.removeViews = function removeViews(viewsToRemove, returnToCache, skipAnimation) {
- throw new Error('subclass must implement `removeView`');
- };
-
- AbstractRepeater.prototype.removeView = function removeView(index, returnToCache, skipAnimation) {
- throw new Error('subclass must implement `removeView`');
- };
-
- AbstractRepeater.prototype.updateBindings = function updateBindings(view) {
- throw new Error('subclass must implement `updateBindings`');
- };
-
- return AbstractRepeater;
- }();
-});
-define('aurelia-templating-resources/show',['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aurelia-pal', './aurelia-hide-style'], function (exports, _aureliaDependencyInjection, _aureliaTemplating, _aureliaPal, _aureliaHideStyle) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Show = undefined;
-
-
-
- var _dec, _dec2, _class;
-
- var Show = exports.Show = (_dec = (0, _aureliaTemplating.customAttribute)('show'), _dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaPal.DOM.Element, _aureliaTemplating.Animator, _aureliaDependencyInjection.Optional.of(_aureliaPal.DOM.boundary, true)), _dec(_class = _dec2(_class = function () {
- function Show(element, animator, domBoundary) {
-
-
- this.element = element;
- this.animator = animator;
- this.domBoundary = domBoundary;
- }
-
- Show.prototype.created = function created() {
- (0, _aureliaHideStyle.injectAureliaHideStyleAtBoundary)(this.domBoundary);
- };
-
- Show.prototype.valueChanged = function valueChanged(newValue) {
- if (newValue) {
- this.animator.removeClass(this.element, _aureliaHideStyle.aureliaHideClassName);
- } else {
- this.animator.addClass(this.element, _aureliaHideStyle.aureliaHideClassName);
- }
- };
-
- Show.prototype.bind = function bind(bindingContext) {
- this.valueChanged(this.value);
- };
-
- return Show;
- }()) || _class) || _class);
-});
-define('aurelia-templating-resources/aurelia-hide-style',['exports', 'aurelia-pal'], function (exports, _aureliaPal) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.aureliaHideClassName = undefined;
- exports.injectAureliaHideStyleAtHead = injectAureliaHideStyleAtHead;
- exports.injectAureliaHideStyleAtBoundary = injectAureliaHideStyleAtBoundary;
- var aureliaHideClassName = exports.aureliaHideClassName = 'aurelia-hide';
-
- var aureliaHideClass = '.' + aureliaHideClassName + ' { display:none !important; }';
-
- function injectAureliaHideStyleAtHead() {
- _aureliaPal.DOM.injectStyles(aureliaHideClass);
- }
-
- function injectAureliaHideStyleAtBoundary(domBoundary) {
- if (_aureliaPal.FEATURE.shadowDOM && domBoundary && !domBoundary.hasAureliaHideStyle) {
- domBoundary.hasAureliaHideStyle = true;
- _aureliaPal.DOM.injectStyles(aureliaHideClass, domBoundary);
- }
- }
-});
-define('aurelia-templating-resources/hide',['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aurelia-pal', './aurelia-hide-style'], function (exports, _aureliaDependencyInjection, _aureliaTemplating, _aureliaPal, _aureliaHideStyle) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Hide = undefined;
-
-
-
- var _dec, _dec2, _class;
-
- var Hide = exports.Hide = (_dec = (0, _aureliaTemplating.customAttribute)('hide'), _dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaPal.DOM.Element, _aureliaTemplating.Animator, _aureliaDependencyInjection.Optional.of(_aureliaPal.DOM.boundary, true)), _dec(_class = _dec2(_class = function () {
- function Hide(element, animator, domBoundary) {
-
-
- this.element = element;
- this.animator = animator;
- this.domBoundary = domBoundary;
- }
-
- Hide.prototype.created = function created() {
- (0, _aureliaHideStyle.injectAureliaHideStyleAtBoundary)(this.domBoundary);
- };
-
- Hide.prototype.valueChanged = function valueChanged(newValue) {
- if (newValue) {
- this.animator.addClass(this.element, _aureliaHideStyle.aureliaHideClassName);
- } else {
- this.animator.removeClass(this.element, _aureliaHideStyle.aureliaHideClassName);
- }
- };
-
- Hide.prototype.bind = function bind(bindingContext) {
- this.valueChanged(this.value);
- };
-
- return Hide;
- }()) || _class) || _class);
-});
-define('aurelia-templating-resources/sanitize-html',['exports', 'aurelia-binding', 'aurelia-dependency-injection', './html-sanitizer'], function (exports, _aureliaBinding, _aureliaDependencyInjection, _htmlSanitizer) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.SanitizeHTMLValueConverter = undefined;
-
-
-
- var _dec, _dec2, _class;
-
- var SanitizeHTMLValueConverter = exports.SanitizeHTMLValueConverter = (_dec = (0, _aureliaBinding.valueConverter)('sanitizeHTML'), _dec2 = (0, _aureliaDependencyInjection.inject)(_htmlSanitizer.HTMLSanitizer), _dec(_class = _dec2(_class = function () {
- function SanitizeHTMLValueConverter(sanitizer) {
-
-
- this.sanitizer = sanitizer;
- }
-
- SanitizeHTMLValueConverter.prototype.toView = function toView(untrustedMarkup) {
- if (untrustedMarkup === null || untrustedMarkup === undefined) {
- return null;
- }
-
- return this.sanitizer.sanitize(untrustedMarkup);
- };
-
- return SanitizeHTMLValueConverter;
- }()) || _class) || _class);
-});
-define('aurelia-templating-resources/html-sanitizer',['exports'], function (exports) {
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
-
-
- var SCRIPT_REGEX = /