framework/extensions/lock/js/dist/forum.js
2020-09-24 02:50:35 +00:00

2 lines
3.8 KiB
JavaScript

module.exports=function(o){var t={};function n(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return o[e].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=o,n.c=t,n.d=function(o,t,e){n.o(o,t)||Object.defineProperty(o,t,{enumerable:!0,get:e})},n.r=function(o){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},n.t=function(o,t){if(1&t&&(o=n(o)),8&t)return o;if(4&t&&"object"==typeof o&&o&&o.__esModule)return o;var e=Object.create(null);if(n.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:o}),2&t&&"string"!=typeof o)for(var r in o)n.d(e,r,function(t){return o[t]}.bind(null,r));return e},n.n=function(o){var t=o&&o.__esModule?function(){return o.default}:function(){return o};return n.d(t,"a",t),t},n.o=function(o,t){return Object.prototype.hasOwnProperty.call(o,t)},n.p="",n(n.s=12)}([function(o,t){o.exports=flarum.core.compat.extend},function(o,t){o.exports=flarum.core.compat.app},function(o,t){o.exports=flarum.core.compat["models/Discussion"]},function(o,t){o.exports=flarum.core.compat.Model},function(o,t){o.exports=flarum.core.compat["utils/DiscussionControls"]},function(o,t){o.exports=flarum.core.compat["components/NotificationGrid"]},function(o,t){o.exports=flarum.core.compat["components/EventPost"]},function(o,t){o.exports=flarum.core.compat["components/Notification"]},function(o,t){o.exports=flarum.core.compat["components/Badge"]},function(o,t){o.exports=flarum.core.compat["components/DiscussionPage"]},function(o,t){o.exports=flarum.core.compat["components/Button"]},,function(o,t,n){"use strict";n.r(t);var e=n(0),r=n(1),c=n.n(r),i=n(3),a=n.n(i),s=n(2),u=n.n(s),f=n(5),p=n.n(f);function l(o,t){o.prototype=Object.create(t.prototype),o.prototype.constructor=o,o.__proto__=t}var d=n(6),k=function(o){function t(){return o.apply(this,arguments)||this}l(t,o);var n=t.prototype;return n.icon=function(){return this.attrs.post.content().locked?"fas fa-lock":"fas fa-unlock"},n.descriptionKey=function(){return this.attrs.post.content().locked?"flarum-lock.forum.post_stream.discussion_locked_text":"flarum-lock.forum.post_stream.discussion_unlocked_text"},t}(n.n(d).a),b=n(7),y=function(o){function t(){return o.apply(this,arguments)||this}l(t,o);var n=t.prototype;return n.icon=function(){return"fas fa-lock"},n.href=function(){var o=this.attrs.notification;return app.route.discussion(o.subject(),o.content().postNumber)},n.content=function(){return app.translator.trans("flarum-lock.forum.notifications.discussion_locked_text",{user:this.attrs.notification.fromUser()})},t}(n.n(b).a),_=n(8),x=n.n(_);var h=n(4),v=n.n(h),L=n(9),g=n.n(L),j=n(10),O=n.n(j);c.a.initializers.add("flarum-lock",(function(){c.a.postComponents.discussionLocked=k,c.a.notificationComponents.discussionLocked=y,u.a.prototype.isLocked=a.a.attribute("isLocked"),u.a.prototype.canLock=a.a.attribute("canLock"),Object(e.extend)(u.a.prototype,"badges",(function(o){this.isLocked()&&o.add("locked",x.a.component({type:"locked",label:app.translator.trans("flarum-lock.forum.badge.locked_tooltip"),icon:"fas fa-lock"}))})),Object(e.extend)(v.a,"moderationControls",(function(o,t){t.canLock()&&o.add("lock",O.a.component({icon:"fas fa-lock",onclick:this.lockAction.bind(t)},app.translator.trans(t.isLocked()?"flarum-lock.forum.discussion_controls.unlock_button":"flarum-lock.forum.discussion_controls.lock_button")))})),v.a.lockAction=function(){this.save({isLocked:!this.isLocked()}).then((function(){app.current.matches(g.a)&&app.current.get("stream").update(),m.redraw()}))},Object(e.extend)(p.a.prototype,"notificationTypes",(function(o){o.add("discussionLocked",{name:"discussionLocked",icon:"fas fa-lock",label:c.a.translator.trans("flarum-lock.forum.settings.notify_discussion_locked_label")})}))}))}]);
//# sourceMappingURL=forum.js.map