diff --git a/js/dist/forum.js b/js/dist/forum.js index 2e2c3ef..8365450 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -(()=>{var t={n:o=>{var e=o&&o.__esModule?()=>o.default:()=>o;return t.d(e,{a:e}),e},d:(o,e)=>{for(var s in e)t.o(e,s)&&!t.o(o,s)&&Object.defineProperty(o,s,{enumerable:!0,get:e[s]})},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:()=>Y});const e=flarum.core.compat["forum/app"];var s=t.n(e);const n=flarum.core.compat["common/extend"],r=flarum.core.compat["forum/states/DiscussionListState"];var i=t.n(r);const a=flarum.core.compat["forum/components/DiscussionListItem"];var u=t.n(a);const c=flarum.core.compat["forum/components/DiscussionList"];var l=t.n(c);const d=flarum.core.compat["common/utils/abbreviateNumber"];var p=t.n(d);const f=flarum.core.compat["common/components/Button"];var v=t.n(f);const h=flarum.core.compat["forum/utils/DiscussionControls"];var b=t.n(h);function w(t,o){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,o){return t.__proto__=o,t},w(t,o)}function y(t,o){t.prototype=Object.create(o.prototype),t.prototype.constructor=t,w(t,o)}const g=flarum.core.compat["common/components/Modal"];var _=t.n(g),N=function(t){function o(){return t.apply(this,arguments)||this}y(o,t);var e=o.prototype;return e.content=function(){return m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("p",null,s().translator.trans("michaelbelgium-discussion-views.forum.modal_resetviews.label",{count:this.attrs.discussion.viewCount()})),m("div",{className:"Form-group"},v().component({className:"Button Button--primary Button--block",type:"submit",loading:this.loading},s().translator.trans("michaelbelgium-discussion-views.forum.modal_resetviews.submit_button")))))},e.title=function(){return s().translator.trans("michaelbelgium-discussion-views.forum.modal_resetviews.title")},e.className=function(){return"Modal--small"},e.onsubmit=function(t){var o=this;t.preventDefault(),this.loading=!0,this.attrs.discussion.save({resetViews:!0}).catch((function(){o.loaded()})),this.hide()},o}(_());const M=flarum.core.compat["common/helpers/username"];var D=t.n(M);const O=flarum.core.compat["common/helpers/icon"];var V=t.n(O);const x=flarum.core.compat["common/helpers/punctuateSeries"];var P=t.n(x);const L=flarum.core.compat["common/helpers/avatar"];var S=t.n(L);const j=flarum.core.compat["common/utils/ItemList"];var C=t.n(j);const k=flarum.core.compat["common/utils/humanTime"];var F=t.n(k);const A=flarum.core.compat["forum/components/CommentPost"];var B=t.n(A);const I=flarum.core.compat["common/components/Link"];var q=t.n(I);const U=flarum.core.compat["forum/components/DiscussionPage"];var T=t.n(U);const R=flarum.core.compat["common/components/FieldSet"];var z=t.n(R),E=function(t){function o(){return t.apply(this,arguments)||this}y(o,t);var e=o.prototype;return e.className=function(){return"Modal--small"},e.title=function(){return s().translator.trans("michaelbelgium-discussion-views.forum.post.modal_title_text")},e.content=function(){var t=this.attrs.post.discussion().uniqueViews().map((function(t){var o=t.user();return m("li",null,m(q(),{href:s().route.user(o)},S()(o)," ",D()(o)))}));return m("div",{className:"Modal-body"},m("ul",{className:"PostLikesModal-list"},t))},o}(_());const G=flarum.core.compat["common/extenders"];var H=t.n(G);const J=flarum.core.compat["common/models/Discussion"];var K=t.n(J);const Q=flarum.core.compat["common/Model"];var W=t.n(Q),X=function(t){function o(){for(var o,e=arguments.length,s=new Array(e),n=0;n0&&t.add("reset",v().component({icon:"far fa-eye-slash",onclick:function(){return s().modal.show(N,{discussion:o})}},s().translator.trans("michaelbelgium-discussion-views.forum.discussion_controls.resetviews_button")))})),(0,n.extend)(T().prototype,"sidebarItems",(function(t){if(0!=s().forum.attribute("showViewList")){var o=this.discussion.latestViews(),e=new(C());o.forEach((function(t,o){var n=!1===t.user()?s().translator.trans("michaelbelgium-discussion-views.forum.viewlist.guest"):t.user().username(),r=m("div",{className:"item-lastUser-content"},[S()(t.user()),m("div",[n,m("span",{className:"lastUser-visited",title:t.visitedAt().toLocaleString()},F()(t.visitedAt()))])]);!1!==t.user()&&(r=q().component({href:s().route.user(t.user())},r)),e.add("lastUser-"+o,r)})),t.add("lastDiscussionViewers",z().component({className:"LastDiscussionUsers",label:s().translator.trans("michaelbelgium-discussion-views.forum.viewlist.title")},e.toArray()))}})),(0,n.extend)(B().prototype,"footerItems",(function(t){if(0!=s().forum.attribute("showFooterViewList")){var o=this.attrs.post,e=o.discussion(),n=e.uniqueViews(),r=e.posts()[0];if(void 0!==r&&r.id()===o.id()&&n&&n.length>0){var i=n.map((function(t){return q().component({href:s().route.user(t.user())},t.user()===s().session.user?s().translator.trans("michaelbelgium-discussion-views.forum.post.you"):D()(t.user()))}));if(n.length>5){var a=n.length-5;i.push(q().component({href:"#",onclick:function(t){t.preventDefault(),s().modal.show(E,{post:o})}},s().translator.trans("michaelbelgium-discussion-views.forum.post.others_link",{count:a})))}i.length>0&&t.add("viewed",m("div",{className:"Post-Discussion-viewedBy"},[V()("fas fa-eye"),s().translator.trans("michaelbelgium-discussion-views.forum.post.viewed_by",{users:P()(i)})]))}}}))}))})(),module.exports=o})(); +(()=>{var t={n:o=>{var e=o&&o.__esModule?()=>o.default:()=>o;return t.d(e,{a:e}),e},d:(o,e)=>{for(var s in e)t.o(e,s)&&!t.o(o,s)&&Object.defineProperty(o,s,{enumerable:!0,get:e[s]})},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:()=>Y});const e=flarum.core.compat["forum/app"];var s=t.n(e);const n=flarum.core.compat["common/extend"],r=flarum.core.compat["forum/states/DiscussionListState"];var i=t.n(r);const a=flarum.core.compat["forum/components/DiscussionListItem"];var u=t.n(a);const c=flarum.core.compat["forum/components/DiscussionList"];var l=t.n(c);const d=flarum.core.compat["common/utils/abbreviateNumber"];var p=t.n(d);const f=flarum.core.compat["common/helpers/icon"];var v=t.n(f);const h=flarum.core.compat["common/components/Button"];var b=t.n(h);const w=flarum.core.compat["forum/utils/DiscussionControls"];var y=t.n(w);function g(t,o){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,o){return t.__proto__=o,t},g(t,o)}function _(t,o){t.prototype=Object.create(o.prototype),t.prototype.constructor=t,g(t,o)}const N=flarum.core.compat["common/components/Modal"];var M=t.n(N),D=function(t){function o(){return t.apply(this,arguments)||this}_(o,t);var e=o.prototype;return e.content=function(){return m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("p",null,s().translator.trans("michaelbelgium-discussion-views.forum.modal_resetviews.label",{count:this.attrs.discussion.viewCount()})),m("div",{className:"Form-group"},b().component({className:"Button Button--primary Button--block",type:"submit",loading:this.loading},s().translator.trans("michaelbelgium-discussion-views.forum.modal_resetviews.submit_button")))))},e.title=function(){return s().translator.trans("michaelbelgium-discussion-views.forum.modal_resetviews.title")},e.className=function(){return"Modal--small"},e.onsubmit=function(t){var o=this;t.preventDefault(),this.loading=!0,this.attrs.discussion.save({resetViews:!0}).catch((function(){o.loaded()})),this.hide()},o}(M());const O=flarum.core.compat["common/helpers/username"];var V=t.n(O);const x=flarum.core.compat["common/helpers/punctuateSeries"];var P=t.n(x);const L=flarum.core.compat["common/helpers/avatar"];var S=t.n(L);const j=flarum.core.compat["common/utils/ItemList"];var C=t.n(j);const k=flarum.core.compat["common/utils/humanTime"];var F=t.n(k);const A=flarum.core.compat["forum/components/CommentPost"];var B=t.n(A);const I=flarum.core.compat["common/components/Link"];var q=t.n(I);const U=flarum.core.compat["forum/components/DiscussionPage"];var T=t.n(U);const R=flarum.core.compat["common/components/FieldSet"];var z=t.n(R),E=function(t){function o(){return t.apply(this,arguments)||this}_(o,t);var e=o.prototype;return e.className=function(){return"Modal--small"},e.title=function(){return s().translator.trans("michaelbelgium-discussion-views.forum.post.modal_title_text")},e.content=function(){var t=this.attrs.post.discussion().uniqueViews().map((function(t){var o=t.user();return m("li",null,m(q(),{href:s().route.user(o)},S()(o)," ",V()(o)))}));return m("div",{className:"Modal-body"},m("ul",{className:"PostLikesModal-list"},t))},o}(M());const G=flarum.core.compat["common/extenders"];var H=t.n(G);const J=flarum.core.compat["common/models/Discussion"];var K=t.n(J);const Q=flarum.core.compat["common/Model"];var W=t.n(Q),X=function(t){function o(){for(var o,e=arguments.length,s=new Array(e),n=0;n0&&t.add("reset",b().component({icon:"far fa-eye-slash",onclick:function(){return s().modal.show(D,{discussion:o})}},s().translator.trans("michaelbelgium-discussion-views.forum.discussion_controls.resetviews_button")))})),(0,n.extend)(T().prototype,"sidebarItems",(function(t){if(0!=s().forum.attribute("showViewList")){var o=this.discussion.latestViews(),e=new(C());o.forEach((function(t,o){var n=!1===t.user()?s().translator.trans("michaelbelgium-discussion-views.forum.viewlist.guest"):t.user().username(),r=m("div",{className:"item-lastUser-content"},[S()(t.user()),m("div",[n,m("span",{className:"lastUser-visited",title:t.visitedAt().toLocaleString()},F()(t.visitedAt()))])]);!1!==t.user()&&(r=q().component({href:s().route.user(t.user())},r)),e.add("lastUser-"+o,r)})),t.add("lastDiscussionViewers",z().component({className:"LastDiscussionUsers",label:s().translator.trans("michaelbelgium-discussion-views.forum.viewlist.title")},e.toArray()))}})),(0,n.extend)(B().prototype,"footerItems",(function(t){if(0!=s().forum.attribute("showFooterViewList")){var o=this.attrs.post,e=o.discussion(),n=e.uniqueViews(),r=e.posts()[0];if(void 0!==r&&r.id()===o.id()&&n&&n.length>0){var i=n.map((function(t){return q().component({href:s().route.user(t.user())},t.user()===s().session.user?s().translator.trans("michaelbelgium-discussion-views.forum.post.you"):V()(t.user()))}));if(n.length>5){var a=n.length-5;i.push(q().component({href:"#",onclick:function(t){t.preventDefault(),s().modal.show(E,{post:o})}},s().translator.trans("michaelbelgium-discussion-views.forum.post.others_link",{count:a})))}i.length>0&&t.add("viewed",m("div",{className:"Post-Discussion-viewedBy"},[v()("fas fa-eye"),s().translator.trans("michaelbelgium-discussion-views.forum.post.viewed_by",{users:P()(i)})]))}}}))}))})(),module.exports=o})(); //# sourceMappingURL=forum.js.map \ No newline at end of file diff --git a/js/dist/forum.js.map b/js/dist/forum.js.map index 54dc821..388ff26 100644 --- a/js/dist/forum.js.map +++ b/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,qDCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,oC,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,uC,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,mC,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,iC,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,4B,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,kC,aCAxD,SAASC,EAAgB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KC,QACnB,IAGH,GAAI2B,EAAMnB,OAbI,EAaY,CACxB,IAAM/B,EAAQkD,EAAMnB,OAdR,EAgBZb,EAAMsC,KACJhC,IAAAA,UACE,CACEC,KAAM,IACNmC,QAAS,SAAC7E,GACRA,EAAE4B,iBACFb,IAAAA,MAAU+D,KAAK5C,EAA0B,CAAEE,KAAAA,GAC7C,GAEFrB,IAAAA,WAAeC,MACb,yDACA,CAAEC,MAAAA,KAIV,CAEIkB,EAAMa,OAAS,GACjBiB,EAAMT,IACJ,SACA3C,EAAE,MAAO,CAAEC,UAAW,4BAA8B,CAClD8D,IAAK,cACL7D,IAAAA,WAAeC,MACb,uDACA,CACEgF,MAAOC,IAAgB9D,OAMnC,CA1DwD,CA4D5D,GJvHF,G","sources":["webpack://@michaelbelgium/flarum-discussion-views/webpack/bootstrap","webpack://@michaelbelgium/flarum-discussion-views/webpack/runtime/compat get default export","webpack://@michaelbelgium/flarum-discussion-views/webpack/runtime/define property getters","webpack://@michaelbelgium/flarum-discussion-views/webpack/runtime/hasOwnProperty shorthand","webpack://@michaelbelgium/flarum-discussion-views/webpack/runtime/make namespace object","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['forum/app']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/extend']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['forum/states/DiscussionListState']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['forum/components/DiscussionListItem']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['forum/components/DiscussionList']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/utils/abbreviateNumber']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/components/Button']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['forum/utils/DiscussionControls']\"","webpack://@michaelbelgium/flarum-discussion-views/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@michaelbelgium/flarum-discussion-views/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/components/Modal']\"","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/components/ResetDiscussionViewsModal.tsx","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/helpers/username']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/helpers/icon']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/helpers/punctuateSeries']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/helpers/avatar']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/utils/ItemList']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/utils/humanTime']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['forum/components/CommentPost']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/components/Link']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['forum/components/DiscussionPage']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/components/FieldSet']\"","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/components/PostDiscussionViewsModal.tsx","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/extenders']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/models/Discussion']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/Model']\"","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/models/DiscussionView.ts","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/extend.ts","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/index.js","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/components/AddPopularSort.ts","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/components/AddViewsToModelAndDisplay.ts","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/components/AddModerationControl.ts","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/components/AddLists.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/states/DiscussionListState'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionListItem'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/abbreviateNumber'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/DiscussionControls'];","function _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nexport { _setPrototypeOf as default };","import setPrototypeOf from \"./setPrototypeOf.js\";\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, setPrototypeOf(t, o);\n}\nexport { _inheritsLoose as default };","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Modal'];","import Modal, { IInternalModalAttrs } from \"flarum/common/components/Modal\";\nimport Button from \"flarum/common/components/Button\";\nimport Mithril from \"mithril\";\nimport app from \"flarum/forum/app\";\nimport Discussion from \"flarum/common/models/Discussion\";\n\nexport interface IResetDiscussionViewsModalAttrs extends IInternalModalAttrs {\n discussion: Discussion;\n}\n\nexport default class ResetDiscussionViewsModal<\n CustomAttrs extends\n IResetDiscussionViewsModalAttrs = IResetDiscussionViewsModalAttrs,\n> extends Modal {\n content(): Mithril.Children {\n return (\n
\n
\n

\n {app.translator.trans(\n \"michaelbelgium-discussion-views.forum.modal_resetviews.label\",\n { count: this.attrs.discussion.viewCount() },\n )}\n

\n
\n {Button.component(\n {\n className: \"Button Button--primary Button--block\",\n type: \"submit\",\n loading: this.loading,\n },\n app.translator.trans(\n \"michaelbelgium-discussion-views.forum.modal_resetviews.submit_button\",\n ),\n )}\n
\n
\n
\n );\n }\n\n title(): Mithril.Children {\n return app.translator.trans(\n \"michaelbelgium-discussion-views.forum.modal_resetviews.title\",\n );\n }\n\n className(): string {\n return \"Modal--small\";\n }\n\n onsubmit(e: SubmitEvent) {\n e.preventDefault();\n this.loading = true;\n\n this.attrs.discussion.save({ resetViews: true }).catch(() => {\n this.loaded();\n });\n\n this.hide();\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/username'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/icon'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/punctuateSeries'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/avatar'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/ItemList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/humanTime'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/CommentPost'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Link'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/FieldSet'];","import Modal, { IInternalModalAttrs } from \"flarum/common/components/Modal\";\nimport Link from \"flarum/common/components/Link\";\nimport username from \"flarum/common/helpers/username\";\nimport avatar from \"flarum/common/helpers/avatar\";\nimport app from \"flarum/forum/app\";\nimport Mithril from \"mithril\";\nimport Post from \"flarum/common/models/Post\";\n\nexport interface IPostDiscussionViewsModalAttrs extends IInternalModalAttrs {\n post: Post;\n}\nexport default class PostDiscussionViewsModal<\n CustomAttrs extends\n IPostDiscussionViewsModalAttrs = IPostDiscussionViewsModalAttrs,\n> extends Modal {\n className(): string {\n return \"Modal--small\";\n }\n\n title(): Mithril.Children {\n return app.translator.trans(\n \"michaelbelgium-discussion-views.forum.post.modal_title_text\",\n );\n }\n\n content(): Mithril.Children {\n const views = this.attrs.post.discussion().uniqueViews();\n\n const names = views.map((view: any) => {\n const user = view.user();\n\n return (\n
  • \n \n {avatar(user)} {username(user)}\n \n
  • \n );\n });\n\n return (\n
    \n
      {names}
    \n
    \n );\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extenders'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Discussion'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Model'];","import Model from \"flarum/common/Model\";\nimport User from \"flarum/common/models/User\";\nimport Discussion from \"flarum/common/models/Discussion\";\n\nexport default class DiscussionView extends Model {\n //comes from DiscussionViewSerializer (user(), discussion(), visited_at)\n visitedAt = Model.attribute(\"visited_at\", Model.transformDate);\n user = Model.hasOne(\"user\");\n discussion = Model.hasOne(\"discussion\");\n}\n","import Extend from \"flarum/common/extenders\";\nimport Discussion from \"flarum/common/models/Discussion\";\nimport DiscussionView from \"./models/DiscussionView\";\n\nexport default [\n new Extend.Store().add(\"discussionviews\", DiscussionView),\n\n new Extend.Model(Discussion)\n .attribute(\"canReset\")\n .attribute(\"viewCount\")\n .attribute(\"canViewNumber\")\n .hasMany(\"latestViews\")\n .hasMany(\"uniqueViews\"),\n];\n","import app from \"flarum/forum/app\";\nimport AddPopularSort from \"./components/AddPopularSort\";\nimport AddViewsToModelAndDisplay from \"./components/AddViewsToModelAndDisplay\";\nimport AddModerationControl from \"./components/AddModerationControl\";\nimport AddLists from \"./components/AddLists\";\n\nexport { default as extend } from \"./extend\";\n\napp.initializers.add(\"michaelbelgium-discussion-views\", function () {\n AddPopularSort();\n AddViewsToModelAndDisplay();\n AddModerationControl();\n AddLists();\n});\n","import { extend } from \"flarum/common/extend\";\nimport DiscussionListState from \"flarum/forum/states/DiscussionListState\";\nimport app from \"flarum/forum/app\";\n\nexport default function () {\n extend(DiscussionListState.prototype, \"sortMap\", function (map) {\n if (app.forum.attribute(\"toggleFilter\") == 1) {\n map.popular = \"-view_count\";\n map.unpopular = \"view_count\";\n }\n });\n}\n","import { extend } from \"flarum/common/extend\";\nimport DiscussionListItem from \"flarum/forum/components/DiscussionListItem\";\nimport DiscussionList from \"flarum/forum/components/DiscussionList\";\nimport abbreviateNumber from \"flarum/common/utils/abbreviateNumber\";\nimport app from \"flarum/forum/app\";\n\nexport default function () {\n extend(DiscussionListItem.prototype, \"infoItems\", function (items) {\n if (this.attrs.discussion.canViewNumber()) {\n const views = this.attrs.discussion.viewCount();\n\n const number =\n app.forum.attribute(\"abbrNumber\") == 1\n ? abbreviateNumber(views)\n : views;\n\n items.add(\"discussion-views\", m(\"span\", number));\n }\n });\n\n extend(DiscussionList.prototype, \"requestParams\", function (params) {\n params.include.push(\"latestViews\"); //fixes not loading relationship when navigating back to the discussion list if you directly went to a discussion or another page\n });\n}\n","import { extend } from \"flarum/common/extend\";\nimport Button from \"flarum/common/components/Button\";\nimport DiscussionControls from \"flarum/forum/utils/DiscussionControls\";\nimport ResetDiscussionViewsModal from \"./ResetDiscussionViewsModal\";\nimport app from \"flarum/forum/app\";\n\nexport default function () {\n extend(\n DiscussionControls,\n \"moderationControls\",\n function (items, discussion) {\n if (discussion.canReset() && discussion.viewCount() > 0) {\n items.add(\n \"reset\",\n Button.component(\n {\n icon: \"far fa-eye-slash\",\n onclick: () =>\n app.modal.show(ResetDiscussionViewsModal, { discussion }),\n },\n app.translator.trans(\n \"michaelbelgium-discussion-views.forum.discussion_controls.resetviews_button\",\n ),\n ),\n );\n }\n },\n );\n}\n","import { extend } from \"flarum/common/extend\";\nimport app from \"flarum/forum/app\";\nimport username from \"flarum/common/helpers/username\";\nimport icon from \"flarum/common/helpers/icon\";\nimport punctuateSeries from \"flarum/common/helpers/punctuateSeries\";\nimport avatar from \"flarum/common/helpers/avatar\";\nimport ItemList from \"flarum/common/utils/ItemList\";\nimport humanTime from \"flarum/common/utils/humanTime\";\nimport CommentPost from \"flarum/forum/components/CommentPost\";\nimport Link from \"flarum/common/components/Link\";\nimport DiscussionPage from \"flarum/forum/components/DiscussionPage\";\nimport FieldSet from \"flarum/common/components/FieldSet\";\nimport PostDiscussionViewsModal from \"./PostDiscussionViewsModal\";\nimport User from \"flarum/common/models/User\";\n\nexport default function () {\n extend(DiscussionPage.prototype, \"sidebarItems\", function (items) {\n if (app.forum.attribute(\"showViewList\") == 0) return;\n\n const views = this.discussion!.latestViews();\n const viewList = new ItemList();\n\n views.forEach((view, key) => {\n const userName =\n view.user() === false\n ? app.translator.trans(\n \"michaelbelgium-discussion-views.forum.viewlist.guest\",\n )\n : view.user().username();\n\n let listitem = m(\"div\", { className: \"item-lastUser-content\" }, [\n avatar(view.user()),\n m(\"div\", [\n userName,\n m(\n \"span\",\n {\n className: \"lastUser-visited\",\n title: view.visitedAt()!.toLocaleString(),\n },\n humanTime(view.visitedAt()),\n ),\n ]),\n ]);\n\n if (view.user() !== false) {\n listitem = Link.component(\n {\n href: app.route.user(view.user()),\n },\n listitem,\n );\n }\n\n viewList.add(\"lastUser-\" + key, listitem);\n });\n\n items.add(\n \"lastDiscussionViewers\",\n FieldSet.component(\n {\n className: \"LastDiscussionUsers\",\n label: app.translator.trans(\n \"michaelbelgium-discussion-views.forum.viewlist.title\",\n ),\n },\n viewList.toArray(),\n ),\n );\n });\n\n extend(CommentPost.prototype, \"footerItems\", function (items) {\n if (app.forum.attribute(\"showFooterViewList\") == 0) return;\n\n const post = this.attrs.post;\n const discussion = post.discussion();\n const views = discussion.uniqueViews();\n const firstPost = discussion.posts()[0];\n\n if (firstPost === undefined) return; //if first post isn't loaded\n\n if (firstPost.id() === post.id()) {\n if (views && views.length > 0) {\n const limit = 5;\n\n const names = views.map((view) =>\n Link.component(\n { href: app.route.user(view.user()) },\n view.user() === app.session.user\n ? app.translator.trans(\n \"michaelbelgium-discussion-views.forum.post.you\",\n )\n : username(view.user()),\n ),\n );\n\n if (views.length > limit) {\n const count = views.length - limit;\n\n names.push(\n Link.component(\n {\n href: \"#\",\n onclick: (e: Event) => {\n e.preventDefault();\n app.modal.show(PostDiscussionViewsModal, { post });\n },\n },\n app.translator.trans(\n \"michaelbelgium-discussion-views.forum.post.others_link\",\n { count },\n ),\n ),\n );\n }\n\n if (names.length > 0) {\n items.add(\n \"viewed\",\n m(\"div\", { className: \"Post-Discussion-viewedBy\" }, [\n icon(\"fas fa-eye\"),\n app.translator.trans(\n \"michaelbelgium-discussion-views.forum.post.viewed_by\",\n {\n users: punctuateSeries(names),\n },\n ),\n ]),\n );\n }\n }\n }\n });\n}\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","_setPrototypeOf","t","e","setPrototypeOf","bind","__proto__","_inheritsLoose","create","constructor","ResetDiscussionViewsModal","_Modal","apply","arguments","_proto","content","m","className","app","trans","count","this","attrs","discussion","viewCount","Button","type","loading","title","onsubmit","_this","preventDefault","save","resetViews","loaded","hide","Modal","PostDiscussionViewsModal","names","post","uniqueViews","map","view","user","Link","href","avatar","username","DiscussionView","_Model","_len","length","args","Array","_key","concat","visitedAt","Model","Extend","add","Discussion","attribute","hasMany","extend","DiscussionListState","popular","unpopular","DiscussionListItem","items","canViewNumber","views","number","abbreviateNumber","DiscussionList","params","include","push","DiscussionControls","canReset","icon","onclick","show","DiscussionPage","latestViews","viewList","ItemList","forEach","userName","listitem","toLocaleString","humanTime","FieldSet","label","toArray","CommentPost","firstPost","posts","undefined","id","users","punctuateSeries"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,qDCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAA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AkBC,IAAdF,GAEAA,EAAUG,OAAS3D,EAAK2D,MACtB5B,GAASA,EAAMnB,OAAS,EAAG,CAC7B,IAEMb,EAAQgC,EAAM7B,KAAI,SAACC,GAAI,OAC3BE,IAAAA,UACE,CAAEC,KAAM3B,IAAAA,MAAUyB,KAAWD,EAAKC,SAClCD,EAAKC,SAAWzB,IAAAA,QAAYyB,KACxBzB,IAAAA,WAAeC,MACb,kDAEF4B,IAASL,EAAKC,QACnB,IAGH,GAAI2B,EAAMnB,OAbI,EAaY,CACxB,IAAM/B,EAAQkD,EAAMnB,OAdR,EAgBZb,EAAMuC,KACJjC,IAAAA,UACE,CACEC,KAAM,IACNmC,QAAS,SAAC7E,GACRA,EAAE4B,iBACFb,IAAAA,MAAU+D,KAAK5C,EAA0B,CAAEE,KAAAA,GAC7C,GAEFrB,IAAAA,WAAeC,MACb,yDACA,CAAEC,MAAAA,KAIV,CAEIkB,EAAMa,OAAS,GACjBiB,EAAMT,IACJ,SACA3C,EAAE,MAAO,CAAEC,UAAW,4BAA8B,CAClDwD,IAAK,cACLvD,IAAAA,WAAeC,MACb,uDACA,CACEgF,MAAOC,IAAgB9D,OAMnC,CA1DwD,CA4D5D,GJvHF,G","sources":["webpack://@michaelbelgium/flarum-discussion-views/webpack/bootstrap","webpack://@michaelbelgium/flarum-discussion-views/webpack/runtime/compat get default export","webpack://@michaelbelgium/flarum-discussion-views/webpack/runtime/define property getters","webpack://@michaelbelgium/flarum-discussion-views/webpack/runtime/hasOwnProperty shorthand","webpack://@michaelbelgium/flarum-discussion-views/webpack/runtime/make namespace object","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['forum/app']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/extend']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['forum/states/DiscussionListState']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['forum/components/DiscussionListItem']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['forum/components/DiscussionList']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/utils/abbreviateNumber']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/helpers/icon']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/components/Button']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['forum/utils/DiscussionControls']\"","webpack://@michaelbelgium/flarum-discussion-views/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@michaelbelgium/flarum-discussion-views/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/components/Modal']\"","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/components/ResetDiscussionViewsModal.tsx","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/helpers/username']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/helpers/punctuateSeries']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/helpers/avatar']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/utils/ItemList']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/utils/humanTime']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['forum/components/CommentPost']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/components/Link']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['forum/components/DiscussionPage']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/components/FieldSet']\"","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/components/PostDiscussionViewsModal.tsx","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/extenders']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/models/Discussion']\"","webpack://@michaelbelgium/flarum-discussion-views/external root \"flarum.core.compat['common/Model']\"","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/models/DiscussionView.ts","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/extend.ts","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/index.js","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/components/AddPopularSort.ts","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/components/AddViewsToModelAndDisplay.ts","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/components/AddModerationControl.ts","webpack://@michaelbelgium/flarum-discussion-views/./src/forum/components/AddLists.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/states/DiscussionListState'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionListItem'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/abbreviateNumber'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/icon'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/DiscussionControls'];","function _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nexport { _setPrototypeOf as default };","import setPrototypeOf from \"./setPrototypeOf.js\";\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, setPrototypeOf(t, o);\n}\nexport { _inheritsLoose as default };","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Modal'];","import Modal, { IInternalModalAttrs } from \"flarum/common/components/Modal\";\nimport Button from \"flarum/common/components/Button\";\nimport Mithril from \"mithril\";\nimport app from \"flarum/forum/app\";\nimport Discussion from \"flarum/common/models/Discussion\";\n\nexport interface IResetDiscussionViewsModalAttrs extends IInternalModalAttrs {\n discussion: Discussion;\n}\n\nexport default class ResetDiscussionViewsModal<\n CustomAttrs extends\n IResetDiscussionViewsModalAttrs = IResetDiscussionViewsModalAttrs,\n> extends Modal {\n content(): Mithril.Children {\n return (\n
    \n
    \n

    \n {app.translator.trans(\n \"michaelbelgium-discussion-views.forum.modal_resetviews.label\",\n { count: this.attrs.discussion.viewCount() },\n )}\n

    \n
    \n {Button.component(\n {\n className: \"Button Button--primary Button--block\",\n type: \"submit\",\n loading: this.loading,\n },\n app.translator.trans(\n \"michaelbelgium-discussion-views.forum.modal_resetviews.submit_button\",\n ),\n )}\n
    \n
    \n
    \n );\n }\n\n title(): Mithril.Children {\n return app.translator.trans(\n \"michaelbelgium-discussion-views.forum.modal_resetviews.title\",\n );\n }\n\n className(): string {\n return \"Modal--small\";\n }\n\n onsubmit(e: SubmitEvent) {\n e.preventDefault();\n this.loading = true;\n\n this.attrs.discussion.save({ resetViews: true }).catch(() => {\n this.loaded();\n });\n\n this.hide();\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/username'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/punctuateSeries'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/avatar'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/ItemList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/humanTime'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/CommentPost'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Link'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/FieldSet'];","import Modal, { IInternalModalAttrs } from \"flarum/common/components/Modal\";\nimport Link from \"flarum/common/components/Link\";\nimport username from \"flarum/common/helpers/username\";\nimport avatar from \"flarum/common/helpers/avatar\";\nimport app from \"flarum/forum/app\";\nimport Mithril from \"mithril\";\nimport Post from \"flarum/common/models/Post\";\n\nexport interface IPostDiscussionViewsModalAttrs extends IInternalModalAttrs {\n post: Post;\n}\nexport default class PostDiscussionViewsModal<\n CustomAttrs extends\n IPostDiscussionViewsModalAttrs = IPostDiscussionViewsModalAttrs,\n> extends Modal {\n className(): string {\n return \"Modal--small\";\n }\n\n title(): Mithril.Children {\n return app.translator.trans(\n \"michaelbelgium-discussion-views.forum.post.modal_title_text\",\n );\n }\n\n content(): Mithril.Children {\n const views = this.attrs.post.discussion().uniqueViews();\n\n const names = views.map((view: any) => {\n const user = view.user();\n\n return (\n
  • \n \n {avatar(user)} {username(user)}\n \n
  • \n );\n });\n\n return (\n
    \n
      {names}
    \n
    \n );\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extenders'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Discussion'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Model'];","import Model from \"flarum/common/Model\";\nimport User from \"flarum/common/models/User\";\nimport Discussion from \"flarum/common/models/Discussion\";\n\nexport default class DiscussionView extends Model {\n //comes from DiscussionViewSerializer (user(), discussion(), visited_at)\n visitedAt = Model.attribute(\"visited_at\", Model.transformDate);\n user = Model.hasOne(\"user\");\n discussion = Model.hasOne(\"discussion\");\n}\n","import Extend from \"flarum/common/extenders\";\nimport Discussion from \"flarum/common/models/Discussion\";\nimport DiscussionView from \"./models/DiscussionView\";\n\nexport default [\n new Extend.Store().add(\"discussionviews\", DiscussionView),\n\n new Extend.Model(Discussion)\n .attribute(\"canReset\")\n .attribute(\"viewCount\")\n .attribute(\"canViewNumber\")\n .hasMany(\"latestViews\")\n .hasMany(\"uniqueViews\"),\n];\n","import app from \"flarum/forum/app\";\nimport AddPopularSort from \"./components/AddPopularSort\";\nimport AddViewsToModelAndDisplay from \"./components/AddViewsToModelAndDisplay\";\nimport AddModerationControl from \"./components/AddModerationControl\";\nimport AddLists from \"./components/AddLists\";\n\nexport { default as extend } from \"./extend\";\n\napp.initializers.add(\"michaelbelgium-discussion-views\", function () {\n AddPopularSort();\n AddViewsToModelAndDisplay();\n AddModerationControl();\n AddLists();\n});\n","import { extend } from \"flarum/common/extend\";\nimport DiscussionListState from \"flarum/forum/states/DiscussionListState\";\nimport app from \"flarum/forum/app\";\n\nexport default function () {\n extend(DiscussionListState.prototype, \"sortMap\", function (map) {\n if (app.forum.attribute(\"toggleFilter\") == 1) {\n map.popular = \"-view_count\";\n map.unpopular = \"view_count\";\n }\n });\n}\n","import { extend } from \"flarum/common/extend\";\nimport DiscussionListItem from \"flarum/forum/components/DiscussionListItem\";\nimport DiscussionList from \"flarum/forum/components/DiscussionList\";\nimport abbreviateNumber from \"flarum/common/utils/abbreviateNumber\";\nimport app from \"flarum/forum/app\";\nimport icon from \"flarum/common/helpers/icon\";\n\nexport default function () {\n extend(DiscussionListItem.prototype, \"infoItems\", function (items) {\n if (this.attrs.discussion.canViewNumber()) {\n const views = this.attrs.discussion.viewCount();\n\n const number =\n app.forum.attribute(\"abbrNumber\") == 1\n ? abbreviateNumber(views)\n : views;\n\n items.add(\"discussion-views\", m(\"span\", [icon(\"far fa-eye\"), number]));\n }\n });\n\n extend(DiscussionList.prototype, \"requestParams\", function (params) {\n params.include.push(\"latestViews\"); //fixes not loading relationship when navigating back to the discussion list if you directly went to a discussion or another page\n });\n}\n","import { extend } from \"flarum/common/extend\";\nimport Button from \"flarum/common/components/Button\";\nimport DiscussionControls from \"flarum/forum/utils/DiscussionControls\";\nimport ResetDiscussionViewsModal from \"./ResetDiscussionViewsModal\";\nimport app from \"flarum/forum/app\";\n\nexport default function () {\n extend(\n DiscussionControls,\n \"moderationControls\",\n function (items, discussion) {\n if (discussion.canReset() && discussion.viewCount() > 0) {\n items.add(\n \"reset\",\n Button.component(\n {\n icon: \"far fa-eye-slash\",\n onclick: () =>\n app.modal.show(ResetDiscussionViewsModal, { discussion }),\n },\n app.translator.trans(\n \"michaelbelgium-discussion-views.forum.discussion_controls.resetviews_button\",\n ),\n ),\n );\n }\n },\n );\n}\n","import { extend } from \"flarum/common/extend\";\nimport app from \"flarum/forum/app\";\nimport username from \"flarum/common/helpers/username\";\nimport icon from \"flarum/common/helpers/icon\";\nimport punctuateSeries from \"flarum/common/helpers/punctuateSeries\";\nimport avatar from \"flarum/common/helpers/avatar\";\nimport ItemList from \"flarum/common/utils/ItemList\";\nimport humanTime from \"flarum/common/utils/humanTime\";\nimport CommentPost from \"flarum/forum/components/CommentPost\";\nimport Link from \"flarum/common/components/Link\";\nimport DiscussionPage from \"flarum/forum/components/DiscussionPage\";\nimport FieldSet from \"flarum/common/components/FieldSet\";\nimport PostDiscussionViewsModal from \"./PostDiscussionViewsModal\";\nimport User from \"flarum/common/models/User\";\n\nexport default function () {\n extend(DiscussionPage.prototype, \"sidebarItems\", function (items) {\n if (app.forum.attribute(\"showViewList\") == 0) return;\n\n const views = this.discussion!.latestViews();\n const viewList = new ItemList();\n\n views.forEach((view, key) => {\n const userName =\n view.user() === false\n ? app.translator.trans(\n \"michaelbelgium-discussion-views.forum.viewlist.guest\",\n )\n : view.user().username();\n\n let listitem = m(\"div\", { className: \"item-lastUser-content\" }, [\n avatar(view.user()),\n m(\"div\", [\n userName,\n m(\n \"span\",\n {\n className: \"lastUser-visited\",\n title: view.visitedAt()!.toLocaleString(),\n },\n humanTime(view.visitedAt()),\n ),\n ]),\n ]);\n\n if (view.user() !== false) {\n listitem = Link.component(\n {\n href: app.route.user(view.user()),\n },\n listitem,\n );\n }\n\n viewList.add(\"lastUser-\" + key, listitem);\n });\n\n items.add(\n \"lastDiscussionViewers\",\n FieldSet.component(\n {\n className: \"LastDiscussionUsers\",\n label: app.translator.trans(\n \"michaelbelgium-discussion-views.forum.viewlist.title\",\n ),\n },\n viewList.toArray(),\n ),\n );\n });\n\n extend(CommentPost.prototype, \"footerItems\", function (items) {\n if (app.forum.attribute(\"showFooterViewList\") == 0) return;\n\n const post = this.attrs.post;\n const discussion = post.discussion();\n const views = discussion.uniqueViews();\n const firstPost = discussion.posts()[0];\n\n if (firstPost === undefined) return; //if first post isn't loaded\n\n if (firstPost.id() === post.id()) {\n if (views && views.length > 0) {\n const limit = 5;\n\n const names = views.map((view) =>\n Link.component(\n { href: app.route.user(view.user()) },\n view.user() === app.session.user\n ? app.translator.trans(\n \"michaelbelgium-discussion-views.forum.post.you\",\n )\n : username(view.user()),\n ),\n );\n\n if (views.length > limit) {\n const count = views.length - limit;\n\n names.push(\n Link.component(\n {\n href: \"#\",\n onclick: (e: Event) => {\n e.preventDefault();\n app.modal.show(PostDiscussionViewsModal, { post });\n },\n },\n app.translator.trans(\n \"michaelbelgium-discussion-views.forum.post.others_link\",\n { count },\n ),\n ),\n );\n }\n\n if (names.length > 0) {\n items.add(\n \"viewed\",\n m(\"div\", { className: \"Post-Discussion-viewedBy\" }, [\n icon(\"fas fa-eye\"),\n app.translator.trans(\n \"michaelbelgium-discussion-views.forum.post.viewed_by\",\n {\n users: punctuateSeries(names),\n },\n ),\n ]),\n );\n }\n }\n }\n });\n}\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","_setPrototypeOf","t","e","setPrototypeOf","bind","__proto__","_inheritsLoose","create","constructor","ResetDiscussionViewsModal","_Modal","apply","arguments","_proto","content","m","className","app","trans","count","this","attrs","discussion","viewCount","Button","type","loading","title","onsubmit","_this","preventDefault","save","resetViews","loaded","hide","Modal","PostDiscussionViewsModal","names","post","uniqueViews","map","view","user","Link","href","avatar","username","DiscussionView","_Model","_len","length","args","Array","_key","concat","visitedAt","Model","Extend","add","Discussion","attribute","hasMany","extend","DiscussionListState","popular","unpopular","DiscussionListItem","items","canViewNumber","views","number","abbreviateNumber","icon","DiscussionList","params","include","push","DiscussionControls","canReset","onclick","show","DiscussionPage","latestViews","viewList","ItemList","forEach","userName","listitem","toLocaleString","humanTime","FieldSet","label","toArray","CommentPost","firstPost","posts","undefined","id","users","punctuateSeries"],"sourceRoot":""} \ No newline at end of file diff --git a/js/src/forum/components/AddViewsToModelAndDisplay.ts b/js/src/forum/components/AddViewsToModelAndDisplay.ts index 8fcd299..b1f43f0 100644 --- a/js/src/forum/components/AddViewsToModelAndDisplay.ts +++ b/js/src/forum/components/AddViewsToModelAndDisplay.ts @@ -3,6 +3,7 @@ import DiscussionListItem from "flarum/forum/components/DiscussionListItem"; import DiscussionList from "flarum/forum/components/DiscussionList"; import abbreviateNumber from "flarum/common/utils/abbreviateNumber"; import app from "flarum/forum/app"; +import icon from "flarum/common/helpers/icon"; export default function () { extend(DiscussionListItem.prototype, "infoItems", function (items) { @@ -14,7 +15,7 @@ export default function () { ? abbreviateNumber(views) : views; - items.add("discussion-views", m("span", number)); + items.add("discussion-views", m("span", [icon("far fa-eye"), number])); } }); diff --git a/less/extension.less b/less/extension.less index 92a6bf4..6aaf3fc 100644 --- a/less/extension.less +++ b/less/extension.less @@ -5,10 +5,7 @@ width: 50px; color: var(--muted-color); - ::before { - font-family: 'Font Awesome 5 Free'; - font-size: inherit; - content: "\f06e"; + .icon { margin-right: 5px; } }