framework/extensions/nicknames/js/dist/forum.js
2020-12-02 22:30:38 +00:00

2 lines
4.0 KiB
JavaScript

module.exports=function(t){var n={};function e(a){if(n[a])return n[a].exports;var r=n[a]={i:a,l:!1,exports:{}};return t[a].call(r.exports,r,r.exports,e),r.l=!0,r.exports}return e.m=t,e.c=n,e.d=function(t,n,a){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:a})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(e.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var r in t)e.d(a,r,function(n){return t[n]}.bind(null,r));return a},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=11)}([function(t,n){t.exports=flarum.core.compat.extend},function(t,n){t.exports=flarum.core.compat["components/Button"]},function(t,n){t.exports=flarum.core.compat["utils/Stream"]},function(t,n){t.exports=flarum.core.compat["components/EditUserModal"]},,function(t,n){t.exports=flarum.core.compat["components/SettingsPage"]},function(t,n){t.exports=flarum.core.compat.Model},function(t,n){t.exports=flarum.core.compat["models/User"]},function(t,n){t.exports=flarum.core.compat["utils/extractText"]},function(t,n){t.exports=flarum.core.compat["components/Modal"]},,function(t,n,e){"use strict";e.r(n);var a=e(0),r=e(1),o=e.n(r),i=e(3),c=e.n(i),s=e(5),u=e.n(s),p=e(6),l=e.n(p),f=e(7),d=e.n(f),b=e(8),h=e.n(b),k=e(2),y=e.n(k);var v=e(9),x=function(t){var n,e;function a(){return t.apply(this,arguments)||this}e=t,(n=a).prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e;var r=a.prototype;return r.oninit=function(n){t.prototype.oninit.call(this,n),this.nickname=y()(app.session.user.displayName())},r.className=function(){return"NickameModal Modal--small"},r.title=function(){return app.translator.trans("flarum-nicknames.forum.change_nickname.title")},r.content=function(){return m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("div",{className:"Form-group"},m("input",{type:"text",autocomplete:"off",name:"nickname",className:"FormControl",bidi:this.nickname,disabled:this.loading})),m("div",{className:"Form-group"},o.a.component({className:"Button Button--primary Button--block",type:"submit",loading:this.loading},app.translator.trans("flarum-nicknames.forum.change_nickname.submit_button")))))},r.onsubmit=function(t){var n=this;t.preventDefault(),this.nickname()!==app.session.user.displayName()?(this.loading=!0,app.session.user.save({nickname:this.nickname()},{errorHandler:this.onerror.bind(this)}).then(this.hide.bind(this)).catch((function(){n.loading=!1,m.redraw()}))):this.hide()},a}(e.n(v).a);app.initializers.add("flarum/nicknames",(function(){d.a.prototype.canEditOwnNickname=l.a.attribute("canEditOwnNickname"),Object(a.extend)(u.a.prototype,"accountItems",(function(t){"nickname"===app.forum.attribute("displayNameDriver")&&this.user.canEditOwnNickname()&&t.add("changeNickname",m(o.a,{className:"Button",onclick:function(){return app.modal.show(x)}},app.translator.trans("flarum-nicknames.forum.settings.change_nickname_button")))})),Object(a.extend)(c.a.prototype,"oninit",(function(){"nickname"===app.forum.attribute("displayNameDriver")&&(this.nickname=y()(this.attrs.user.displayName()))})),Object(a.extend)(c.a.prototype,"fields",(function(t){"nickname"===app.forum.attribute("displayNameDriver")&&t.add("nickname",m("div",{className:"Form-group"},m("label",null,app.translator.trans("flarum-nicknames.forum.edit_user.nicknames_heading")),m("input",{className:"FormControl",placeholder:h()(app.translator.trans("flarum-nicknames.forum.edit_user.nicknames_text")),bidi:this.nickname})),100)})),Object(a.extend)(c.a.prototype,"data",(function(t){if("nickname"===app.forum.attribute("displayNameDriver")){this.attrs.user;this.nickname()!==this.attrs.user.username()&&(t.nickname=this.nickname())}}))}))}]);
//# sourceMappingURL=forum.js.map