framework/extensions/likes/js/dist/forum.js
flarum-bot 2fea567284 Bundled output for commit 542fac888d
Includes transpiled JS/TS.

[skip ci]
2022-01-11 10:41:36 +00:00

2 lines
5.0 KiB
JavaScript
Generated

module.exports=function(t){var o={};function n(e){if(o[e])return o[e].exports;var r=o[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=o,n.d=function(t,o,e){n.o(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:e})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,o){if(1&o&&(t=n(t)),8&o)return t;if(4&o&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(n.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&o&&"string"!=typeof t)for(var r in t)n.d(e,r,function(o){return t[o]}.bind(null,r));return e},n.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(o,"a",o),o},n.o=function(t,o){return Object.prototype.hasOwnProperty.call(t,o)},n.p="",n(n.s=16)}([function(t,o){t.exports=flarum.core.compat["forum/app"]},function(t,o){t.exports=flarum.core.compat["common/extend"]},function(t,o){t.exports=flarum.core.compat["forum/components/CommentPost"]},function(t,o){t.exports=flarum.core.compat["common/components/Link"]},function(t,o){t.exports=flarum.core.compat["common/helpers/username"]},,function(t,o){t.exports=flarum.core.compat["common/models/Post"]},function(t,o){t.exports=flarum.core.compat["common/Model"]},function(t,o){t.exports=flarum.core.compat["forum/components/NotificationGrid"]},function(t,o){t.exports=flarum.core.compat["common/components/Button"]},function(t,o){t.exports=flarum.core.compat["common/helpers/punctuateSeries"]},function(t,o){t.exports=flarum.core.compat["common/helpers/icon"]},function(t,o){t.exports=flarum.core.compat["common/components/Modal"]},function(t,o){t.exports=flarum.core.compat["common/helpers/avatar"]},function(t,o){t.exports=flarum.core.compat["forum/components/Notification"]},function(t,o){t.exports=flarum.core.compat["common/utils/string"]},function(t,o,n){"use strict";n.r(o);var e=n(1),r=n(0),a=n.n(r),s=n(6),i=n.n(s),u=n(7),c=n.n(u),f=n(8),l=n.n(f),p=n(9),d=n.n(p),k=n(2),h=n.n(k),y=n(3),b=n.n(y),x=n(10),v=n.n(x),_=n(4),j=n.n(_),O=n(11),g=n.n(O);function P(t,o){return(P=Object.setPrototypeOf||function(t,o){return t.__proto__=o,t})(t,o)}function M(t,o){t.prototype=Object.create(o.prototype),t.prototype.constructor=t,P(t,o)}var L=n(12),N=n.n(L),S=n(13),B=n.n(S),T=function(t){function o(){return t.apply(this,arguments)||this}M(o,t);var n=o.prototype;return n.className=function(){return"PostLikesModal Modal--small"},n.title=function(){return a.a.translator.trans("flarum-likes.forum.post_likes.title")},n.content=function(){return m("div",{className:"Modal-body"},m("ul",{className:"PostLikesModal-list"},this.attrs.post.likes().map((function(t){return m("li",null,m(b.a,{href:a.a.route.user(t)},B()(t)," ",j()(t)))}))))},o}(N.a),w=n(14),C=n.n(w),I=n(15),z=function(t){function o(){return t.apply(this,arguments)||this}M(o,t);var n=o.prototype;return n.icon=function(){return"far fa-thumbs-up"},n.href=function(){return a.a.route.post(this.attrs.notification.subject())},n.content=function(){var t=this.attrs.notification.fromUser();return a.a.translator.trans("flarum-likes.forum.notifications.post_liked_text",{user:t,count:1})},n.excerpt=function(){return Object(I.truncate)(this.attrs.notification.subject().contentPlain(),200)},o}(C.a);a.a.initializers.add("flarum-likes",(function(){a.a.notificationComponents.postLiked=z,i.a.prototype.canLike=c.a.attribute("canLike"),i.a.prototype.likes=c.a.hasMany("likes"),Object(e.extend)(h.a.prototype,"actionItems",(function(t){var o=this.attrs.post;if(!o.isHidden()&&o.canLike()){var n=o.likes(),e=a.a.session.user&&n&&n.some((function(t){return t===a.a.session.user}));t.add("like",d.a.component({className:"Button Button--link",onclick:function(){e=!e,o.save({isLiked:e});var t=o.data.relationships.likes.data;t.some((function(o,n){if(o.id===a.a.session.user.id())return t.splice(n,1),!0})),e&&t.unshift({type:"users",id:a.a.session.user.id()})}},a.a.translator.trans(e?"flarum-likes.forum.post.unlike_link":"flarum-likes.forum.post.like_link")))}})),Object(e.extend)(h.a.prototype,"footerItems",(function(t){var o=this.attrs.post,n=o.likes();if(n&&n.length){var e=n.length>4,r=n.sort((function(t){return t===a.a.session.user?-1:1})).slice(0,e?3:4).map((function(t){return m(b.a,{href:a.a.route.user(t)},t===a.a.session.user?a.a.translator.trans("flarum-likes.forum.post.you_text"):j()(t))}));if(e){var s=n.length-r.length;r.push(m("a",{href:"#",onclick:function(t){t.preventDefault(),a.a.modal.show(T,{post:o})}},a.a.translator.trans("flarum-likes.forum.post.others_link",{count:s})))}t.add("liked",m("div",{className:"Post-likedBy"},g()("far fa-thumbs-up"),a.a.translator.trans("flarum-likes.forum.post.liked_by"+(n[0]===a.a.session.user?"_self":"")+"_text",{count:r.length,users:v()(r)})))}})),Object(e.extend)(l.a.prototype,"notificationTypes",(function(t){t.add("postLiked",{name:"postLiked",icon:"far fa-thumbs-up",label:a.a.translator.trans("flarum-likes.forum.settings.notify_post_liked_label")})}))}))}]);
//# sourceMappingURL=forum.js.map