framework/extensions/sticky/js/dist/forum.js
flarum-bot 08dead81ce Bundled output for commit 47b670aa29
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2023-02-08 20:19:47 +00:00

2 lines
3.3 KiB
JavaScript
Generated

(()=>{var t={n:o=>{var s=o&&o.__esModule?()=>o.default:()=>o;return t.d(s,{a:s}),s},d:(o,s)=>{for(var n in s)t.o(s,n)&&!t.o(o,n)&&Object.defineProperty(o,n,{enumerable:!0,get:s[n]})},o:(t,o)=>Object.prototype.hasOwnProperty.call(t,o),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},o={};(()=>{"use strict";t.r(o),t.d(o,{extend:()=>L});const s=flarum.core.compat["forum/app"];var n=t.n(s);const e=flarum.core.compat["common/extend"],r=flarum.core.compat["common/models/Discussion"];var c=t.n(r);const i=flarum.core.compat["common/components/Badge"];var a=t.n(i);const u=flarum.core.compat["forum/utils/DiscussionControls"];var f=t.n(u);const p=flarum.core.compat["forum/components/DiscussionPage"];var l=t.n(p);const d=flarum.core.compat["common/components/Button"];var y=t.n(d);const k=flarum.core.compat["forum/states/DiscussionListState"];var v=t.n(k);const b=flarum.core.compat["forum/components/DiscussionListItem"];var h=t.n(b);const _=flarum.core.compat["forum/components/IndexPage"];var S=t.n(_);const P=flarum.core.compat["common/utils/string"],x=flarum.core.compat["common/utils/classList"];var g=t.n(x);const O=flarum.core.compat["common/extenders"];var j=t.n(O);function D(t,o){return D=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,o){return t.__proto__=o,t},D(t,o)}const w=flarum.core.compat["forum/components/EventPost"];var I=function(t){var o,s;function n(){return t.apply(this,arguments)||this}s=t,(o=n).prototype=Object.create(s.prototype),o.prototype.constructor=o,D(o,s);var e=n.prototype;return e.icon=function(){return"fas fa-thumbtack"},e.descriptionKey=function(){return this.attrs.post.content().sticky?"flarum-sticky.forum.post_stream.discussion_stickied_text":"flarum-sticky.forum.post_stream.discussion_unstickied_text"},n}(t.n(w)());const L=[(new(j().PostTypes)).add("discussionStickied",I),new(j().Model)(c()).attribute("isSticky").attribute("canSticky")];n().initializers.add("flarum-sticky",(function(){(0,e.extend)(c().prototype,"badges",(function(t){this.isSticky()&&t.add("sticky",a().component({type:"sticky",label:n().translator.trans("flarum-sticky.forum.badge.sticky_tooltip"),icon:"fas fa-thumbtack"}),10)})),(0,e.extend)(f(),"moderationControls",(function(t,o){o.canSticky()&&t.add("sticky",y().component({icon:"fas fa-thumbtack",onclick:this.stickyAction.bind(o)},n().translator.trans(o.isSticky()?"flarum-sticky.forum.discussion_controls.unsticky_button":"flarum-sticky.forum.discussion_controls.sticky_button")))})),f().stickyAction=function(){this.save({isSticky:!this.isSticky()}).then((function(){n().current.matches(l())&&n().current.get("stream").update(),m.redraw()}))},(0,e.extend)(v().prototype,"requestParams",(function(t){(n().current.matches(S())||n().current.matches(l()))&&t.include.push("firstPost")})),(0,e.extend)(h().prototype,"infoItems",(function(t){var o=this.attrs.discussion;if(o.isSticky()&&!this.attrs.params.q&&!o.lastReadPostNumber()){var s=o.firstPost();if(s){var n=(0,P.truncate)(s.contentPlain(),175);t.add("excerpt",m("div",null,n),-100)}}})),(0,e.extend)(h().prototype,"elementAttrs",(function(t){this.attrs.discussion.isSticky()&&(t.className=g()(t.className,"DiscussionListItem--sticky"))}))}))})(),module.exports=o})();
//# sourceMappingURL=forum.js.map