From e2a40a5aeb8a6bec8850853b3c1dd9d46ab562cc Mon Sep 17 00:00:00 2001 From: flarum-bot Date: Sun, 22 Sep 2024 08:30:14 +0000 Subject: [PATCH] Bundled output for commit 9b990382b88da31cd2e39fd68edd8d8dbd8cc988 Includes transpiled JS/TS, and Typescript declaration files (typings). [skip ci] --- js/dist/forum.js | 2 +- js/dist/forum.js.map | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/dist/forum.js b/js/dist/forum.js index bfaf602..396c9d4 100755 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -(()=>{var s={n:e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},d:(e,t)=>{for(var o in t)s.o(t,o)&&!s.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},o:(s,e)=>Object.prototype.hasOwnProperty.call(s,e)};(()=>{"use strict";const e=flarum.core.compat["forum/app"];var t=s.n(e);const o=flarum.core.compat["common/extend"],n=flarum.core.compat["forum/states/DiscussionListState"];var r=s.n(n);const i=flarum.core.compat["forum/components/DiscussionListItem"];var c=s.n(i);const a=flarum.core.compat["common/utils/string"],p=flarum.core.compat["tags/models/Tag"];var u=s.n(p);const l=flarum.core.compat["common/Model"];var f=s.n(l);const h=flarum.core.compat["forum/components/SettingsPage"];var d=s.n(h);const y=flarum.core.compat["common/components/FieldSet"];var x=s.n(y);const g=flarum.core.compat["common/utils/ItemList"];var v=s.n(g);const w=flarum.core.compat["common/components/Switch"];var b=s.n(w);const S=flarum.core.compat["common/utils/Stream"];var E=s.n(S);t().initializers.add("ianm-synopsis",(function(){t().initializers.has("flarum-tags")&&(u().prototype.richExcerpts=f().attribute("richExcerpts"),u().prototype.excerptLength=f().attribute("excerptLength")),(0,o.extend)(r().prototype,"requestParams",(function(s){"first"===t().forum.attribute("synopsis.excerpt_type")?s.include.push("firstPost"):s.include.push("lastPost")})),(0,o.extend)(c().prototype,"infoItems",(function(s){var e,o,n,r,i,c;if(!t().forum.attribute("synopsis.disable_when_searching")||!t().discussions.params.q){var p=this.attrs.discussion;if(!t().session.user||null!=(e=t().session.user.preferences())&&e.showSynopsisExcerpts){var u,l=p.tags();l&&(u=l[l.length-1]);var f="first"===t().forum.attribute("synopsis.excerpt_type")?p.firstPost():p.lastPost(),h="number"==typeof(null==(o=u)?void 0:o.excerptLength())?null==(n=u)?void 0:n.excerptLength():t().forum.attribute("synopsis.excerpt_length"),d="number"==typeof(null==(r=u)?void 0:r.richExcerpts())?null==(i=u)?void 0:i.richExcerpts():t().forum.attribute("synopsis.rich_excerpts"),y=!!t().session.user&&(null==(c=t().session.user.preferences())?void 0:c.showSynopsisExcerptsOnMobile);if(0!==h&&null!=f&&null!=f.contentHtml&&f.contentHtml()){var x=d?m.trust((0,a.truncate)(f.contentHtml(),h)):(0,a.truncate)(f.contentPlain(),h);if(f){var g=m("div",null,x);s.add(y?"excerptM":"excerpt",g,-100)}}}}})),(0,o.extend)(d().prototype,"oninit",(function(){this.showSynopsisExcerpts=E()(this.user.preferences().showSynopsisExcerpts),this.showSynopsisExcerptsOnMobile=E()(this.user.preferences().showSynopsisExcerptsOnMobile)})),(0,o.extend)(d().prototype,"settingsItems",(function(s){s.add("synopsis",x().component({label:t().translator.trans("ianm-synopsis.forum.user.settings.summaries-heading"),className:"Settings-Synopsis"},this.summariesItems().toArray()))})),d().prototype.summariesItems=function(){var s=this,e=new(v());return e.add("synopsis-excerpts",b().component({state:this.user.preferences().showSynopsisExcerpts,onchange:function(e){s.showSynopsisExcerptsLoading=!0,s.user.savePreferences({showSynopsisExcerpts:e}).then((function(){s.showSynopsisExcerptsLoading=!1,m.redraw()}))},loading:this.showSynopsisExcerptsLoading},t().translator.trans("ianm-synopsis.forum.user.settings.show-summaries"))),this.user.preferences().showSynopsisExcerpts&&e.add("synopsis-excerpts-mobile",b().component({state:this.user.preferences().showSynopsisExcerptsOnMobile,disabled:!this.user.preferences().showSynopsisExcerpts,onchange:function(e){s.showSynopsisExcerptsOnMobileLoading=!0,s.user.savePreferences({showSynopsisExcerptsOnMobile:e}).then((function(){s.showSynopsisExcerptsOnMobileLoading=!1,window.location.reload()}))},loading:this.showSynopsisExcerptsOnMobileLoading},t().translator.trans("ianm-synopsis.forum.user.settings.show-summaries-mobile"))),e}}))})(),module.exports={}})(); +(()=>{var t={n:e=>{var s=e&&e.__esModule?()=>e.default:()=>e;return t.d(s,{a:s}),s},d:(e,s)=>{for(var o in s)t.o(s,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:s[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};(()=>{"use strict";t.r(e),t.d(e,{components:()=>j});const s=flarum.core.compat["forum/app"];var o=t.n(s);const n=flarum.core.compat["common/extend"],r=flarum.core.compat["forum/states/DiscussionListState"];var i=t.n(r);const c=flarum.core.compat["forum/components/DiscussionListItem"];var p=t.n(c);const a=flarum.core.compat["tags/models/Tag"];var u=t.n(a);const l=flarum.core.compat["common/Model"];var h=t.n(l);function f(t,e){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},f(t,e)}const y=flarum.core.compat["common/Component"];var d=t.n(y);const x=flarum.core.compat["common/utils/string"];var g=function(t){function e(){for(var e,s=arguments.length,o=new Array(s),n=0;n {\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))","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['common/utils/string'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['tags/models/Tag'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Model'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/SettingsPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/FieldSet'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/ItemList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Switch'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/Stream'];","import app from 'flarum/forum/app';\n\nimport addSummaryExcerpt from './addSummaryExcerpt';\nimport addUserPreference from './addUserPreference';\n\napp.initializers.add('ianm-synopsis', () => {\n addSummaryExcerpt();\n addUserPreference();\n});\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport DiscussionListState from 'flarum/forum/states/DiscussionListState';\nimport DiscussionListItem from 'flarum/forum/components/DiscussionListItem';\nimport { truncate } from 'flarum/common/utils/string';\nimport ItemList from 'flarum/common/utils/ItemList';\n/* @ts-ignore */\nimport Tag from 'flarum/tags/models/Tag';\nimport Model from 'flarum/common/Model';\nimport type Mithril from 'mithril';\n\nexport default function addSummaryExcerpt() {\n if (app.initializers.has('flarum-tags')) {\n Tag.prototype.richExcerpts = Model.attribute('richExcerpts');\n Tag.prototype.excerptLength = Model.attribute('excerptLength');\n }\n\n extend(DiscussionListState.prototype, 'requestParams', function (params: any) {\n if (app.forum.attribute('synopsis.excerpt_type') === 'first') params.include.push('firstPost');\n else params.include.push('lastPost');\n });\n\n extend(DiscussionListItem.prototype, 'infoItems', function (items: ItemList) {\n // Skip if we are searching to preserve most relevant post content as excerpt,\n // that way we also preserve highlighting of search terms in the most relevant post.\n if (app.forum.attribute('synopsis.disable_when_searching') && app.discussions.params.q) return;\n\n const discussion = this.attrs.discussion;\n\n if (app.session.user && !app.session.user.preferences()?.showSynopsisExcerpts) {\n return;\n }\n\n const tags = discussion.tags();\n let tag;\n if (tags) {\n tag = tags[tags.length - 1];\n }\n\n const excerptPost = app.forum.attribute('synopsis.excerpt_type') === 'first' ? discussion.firstPost() : discussion.lastPost();\n const excerptLength = typeof tag?.excerptLength() === 'number' ? tag?.excerptLength() : app.forum.attribute('synopsis.excerpt_length');\n const richExcerpt = typeof tag?.richExcerpts() === 'number' ? tag?.richExcerpts() : app.forum.attribute('synopsis.rich_excerpts');\n const onMobile = app.session.user ? app.session.user.preferences()?.showSynopsisExcerptsOnMobile : false;\n\n // A length of zero means we don't want a synopsis for this discussion, so do nothing.\n if (excerptLength === 0) {\n return;\n }\n\n if (!excerptPost?.contentHtml?.()) return;\n const content = richExcerpt ? m.trust(truncate(excerptPost.contentHtml(), excerptLength)) : truncate(excerptPost.contentPlain(), excerptLength);\n\n if (excerptPost) {\n const excerpt =
{content}
;\n\n items.add(onMobile ? 'excerptM' : 'excerpt', excerpt, -100);\n }\n });\n}\n","import type Mithril from 'mithril';\nimport app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport SettingsPage from 'flarum/forum/components/SettingsPage';\nimport FieldSet from 'flarum/common/components/FieldSet';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport Switch from 'flarum/common/components/Switch';\nimport Stream from 'flarum/common/utils/Stream';\n\nexport default function () {\n extend(SettingsPage.prototype, 'oninit', function () {\n this.showSynopsisExcerpts = Stream(this.user.preferences().showSynopsisExcerpts);\n this.showSynopsisExcerptsOnMobile = Stream(this.user.preferences().showSynopsisExcerptsOnMobile);\n });\n\n extend(SettingsPage.prototype, 'settingsItems', function (items: ItemList) {\n items.add(\n 'synopsis',\n FieldSet.component(\n {\n label: app.translator.trans('ianm-synopsis.forum.user.settings.summaries-heading'),\n className: 'Settings-Synopsis',\n },\n this.summariesItems().toArray()\n )\n );\n });\n\n SettingsPage.prototype['summariesItems'] = function () {\n const items = new ItemList();\n\n items.add(\n 'synopsis-excerpts',\n Switch.component(\n {\n state: this.user.preferences().showSynopsisExcerpts,\n onchange: (value) => {\n this.showSynopsisExcerptsLoading = true;\n\n this.user.savePreferences({ showSynopsisExcerpts: value }).then(() => {\n this.showSynopsisExcerptsLoading = false;\n m.redraw();\n });\n },\n loading: this.showSynopsisExcerptsLoading,\n },\n app.translator.trans('ianm-synopsis.forum.user.settings.show-summaries')\n )\n );\n\n if (this.user.preferences().showSynopsisExcerpts) {\n items.add(\n 'synopsis-excerpts-mobile',\n Switch.component(\n {\n state: this.user.preferences().showSynopsisExcerptsOnMobile,\n disabled: !this.user.preferences().showSynopsisExcerpts,\n onchange: (value) => {\n this.showSynopsisExcerptsOnMobileLoading = true;\n\n this.user.savePreferences({ showSynopsisExcerptsOnMobile: value }).then(() => {\n this.showSynopsisExcerptsOnMobileLoading = false;\n window.location.reload();\n });\n },\n loading: this.showSynopsisExcerptsOnMobileLoading,\n },\n app.translator.trans('ianm-synopsis.forum.user.settings.show-summaries-mobile')\n )\n );\n }\n\n return items;\n };\n}\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","flarum","core","compat","app","add","has","Tag","richExcerpts","Model","excerptLength","extend","DiscussionListState","params","attribute","include","push","DiscussionListItem","items","_app$session$user$pre","_tag","_tag2","_tag3","_tag4","_app$session$user$pre2","q","discussion","this","attrs","user","preferences","showSynopsisExcerpts","tag","tags","length","excerptPost","firstPost","lastPost","richExcerpt","onMobile","showSynopsisExcerptsOnMobile","contentHtml","content","m","trust","truncate","contentPlain","excerpt","SettingsPage","Stream","FieldSet","label","trans","className","summariesItems","toArray","_this","ItemList","Switch","state","onchange","value","showSynopsisExcerptsLoading","savePreferences","then","redraw","loading","disabled","showSynopsisExcerptsOnMobileLoading","window","location","reload"],"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,yDCL9D,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,mB,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,gB,aCAxD,SAASC,EAAgBC,EAAGC,GAC1B,OAAOF,EAAkBf,OAAOkB,eAAiBlB,OAAOkB,eAAeC,OAAS,SAAUH,EAAGC,GAC3F,OAAOD,EAAEI,UAAYH,EAAGD,CAC1B,EAAGD,EAAgBC,EAAGC,EAC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Q,6BAC/BmB,UAAWjE,KAAKqC,KAAKC,cAAcC,qBACnCoB,SAAU,SAACvF,GACTY,EAAKkF,qCAAsC,EAE3ClF,EAAKqD,KAAKwB,gBAAgB,CAAEf,6BAA8B1E,IAAS0F,MAAK,WACtE9E,EAAKkF,qCAAsC,EAC3CC,OAAOC,SAASC,QAClB,GACF,EACAL,QAAShE,KAAKkE,qCAEhBpD,IAAAA,WAAesC,MAAM,6DAKpBxB,CACT,CFhEF,G","sources":["webpack://@ianm/synopsis/webpack/bootstrap","webpack://@ianm/synopsis/webpack/runtime/compat get default export","webpack://@ianm/synopsis/webpack/runtime/define property getters","webpack://@ianm/synopsis/webpack/runtime/hasOwnProperty shorthand","webpack://@ianm/synopsis/webpack/runtime/make namespace object","webpack://@ianm/synopsis/external root \"flarum.core.compat['forum/app']\"","webpack://@ianm/synopsis/external root \"flarum.core.compat['common/extend']\"","webpack://@ianm/synopsis/external root \"flarum.core.compat['forum/states/DiscussionListState']\"","webpack://@ianm/synopsis/external root \"flarum.core.compat['forum/components/DiscussionListItem']\"","webpack://@ianm/synopsis/external root \"flarum.core.compat['tags/models/Tag']\"","webpack://@ianm/synopsis/external root \"flarum.core.compat['common/Model']\"","webpack://@ianm/synopsis/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@ianm/synopsis/external root \"flarum.core.compat['common/Component']\"","webpack://@ianm/synopsis/external root \"flarum.core.compat['common/utils/string']\"","webpack://@ianm/synopsis/./src/forum/components/Excerpt.tsx","webpack://@ianm/synopsis/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@ianm/synopsis/external root \"flarum.core.compat['forum/components/SettingsPage']\"","webpack://@ianm/synopsis/external root \"flarum.core.compat['common/components/FieldSet']\"","webpack://@ianm/synopsis/external root \"flarum.core.compat['common/utils/ItemList']\"","webpack://@ianm/synopsis/external root \"flarum.core.compat['common/components/Switch']\"","webpack://@ianm/synopsis/external root \"flarum.core.compat['common/utils/Stream']\"","webpack://@ianm/synopsis/./src/forum/components/index.ts","webpack://@ianm/synopsis/./src/forum/index.ts","webpack://@ianm/synopsis/./src/forum/addSummaryExcerpt.tsx","webpack://@ianm/synopsis/./src/forum/addUserPreference.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['tags/models/Tag'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Model'];","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 };","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Component'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/string'];","import Component, { ComponentAttrs } from 'flarum/common/Component';\nimport Post from 'flarum/common/models/Post';\nimport { truncate } from 'flarum/common/utils/string';\nimport type Mithril from 'mithril';\n\nexport interface ExcerptAttrs extends ComponentAttrs {\n post: Post;\n length: number;\n richExcerpt: boolean;\n}\n\nexport default class Excerpt extends Component {\n post!: Post;\n length!: number;\n richExcerpt!: boolean;\n\n oninit(vnode: Mithril.Vnode) {\n super.oninit(vnode);\n\n this.post = this.attrs.post;\n this.length = this.attrs.length;\n this.richExcerpt = this.attrs.richExcerpt;\n }\n\n view() {\n return
{m.trust(this.getContent())}
;\n }\n\n getContent(): string {\n return this.richExcerpt ? truncate(this.contentRich() ?? '', this.length) : truncate(this.contentPlain() ?? '', this.length);\n }\n\n contentRich() {\n return this.post.contentHtml();\n }\n\n contentPlain() {\n return this.post.contentPlain();\n }\n}\n","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['forum/components/SettingsPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/FieldSet'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/ItemList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Switch'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/Stream'];","import Excerpt from './Excerpt';\n\nexport const components = {\n Excerpt,\n};\n","import app from 'flarum/forum/app';\nimport addSummaryExcerpt from './addSummaryExcerpt';\nimport addUserPreference from './addUserPreference';\n\nexport * from './components';\n\napp.initializers.add('ianm-synopsis', () => {\n addSummaryExcerpt();\n addUserPreference();\n});\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport DiscussionListState from 'flarum/forum/states/DiscussionListState';\nimport DiscussionListItem from 'flarum/forum/components/DiscussionListItem';\nimport { truncate } from 'flarum/common/utils/string';\nimport ItemList from 'flarum/common/utils/ItemList';\n/* @ts-ignore */\nimport Tag from 'flarum/tags/models/Tag';\nimport Model from 'flarum/common/Model';\nimport type Mithril from 'mithril';\nimport Excerpt from './components/Excerpt';\n\nexport default function addSummaryExcerpt() {\n if (app.initializers.has('flarum-tags')) {\n Tag.prototype.richExcerpts = Model.attribute('richExcerpts');\n Tag.prototype.excerptLength = Model.attribute('excerptLength');\n }\n\n extend(DiscussionListState.prototype, 'requestParams', function (params: any) {\n if (app.forum.attribute('synopsis.excerpt_type') === 'first') params.include.push('firstPost');\n else params.include.push('lastPost');\n });\n\n extend(DiscussionListItem.prototype, 'infoItems', function (items: ItemList) {\n // Skip if we are searching to preserve most relevant post content as excerpt,\n // that way we also preserve highlighting of search terms in the most relevant post.\n if (app.forum.attribute('synopsis.disable_when_searching') && app.discussions.params.q) return;\n\n const discussion = this.attrs.discussion;\n\n if (app.session.user && !app.session.user.preferences()?.showSynopsisExcerpts) {\n return;\n }\n\n const tags = discussion.tags();\n let tag;\n if (tags) {\n tag = tags[tags.length - 1];\n }\n\n const excerptPost = app.forum.attribute('synopsis.excerpt_type') === 'first' ? discussion.firstPost() : discussion.lastPost();\n const excerptLength = typeof tag?.excerptLength() === 'number' ? tag?.excerptLength() : app.forum.attribute('synopsis.excerpt_length');\n const richExcerpt = typeof tag?.richExcerpts() === 'number' ? tag?.richExcerpts() : app.forum.attribute('synopsis.rich_excerpts');\n const onMobile = app.session.user ? app.session.user.preferences()?.showSynopsisExcerptsOnMobile : false;\n\n // A length of zero means we don't want a synopsis for this discussion, so do nothing.\n if (excerptLength === 0) {\n return;\n }\n\n if (excerptPost) {\n const excerpt = ;\n\n items.add(onMobile ? 'excerptM' : 'excerpt', excerpt, -100);\n }\n });\n}\n","import type Mithril from 'mithril';\nimport app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport SettingsPage from 'flarum/forum/components/SettingsPage';\nimport FieldSet from 'flarum/common/components/FieldSet';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport Switch from 'flarum/common/components/Switch';\nimport Stream from 'flarum/common/utils/Stream';\n\nexport default function () {\n extend(SettingsPage.prototype, 'oninit', function () {\n this.showSynopsisExcerpts = Stream(this.user.preferences().showSynopsisExcerpts);\n this.showSynopsisExcerptsOnMobile = Stream(this.user.preferences().showSynopsisExcerptsOnMobile);\n });\n\n extend(SettingsPage.prototype, 'settingsItems', function (items: ItemList) {\n items.add(\n 'synopsis',\n FieldSet.component(\n {\n label: app.translator.trans('ianm-synopsis.forum.user.settings.summaries-heading'),\n className: 'Settings-Synopsis',\n },\n this.summariesItems().toArray()\n )\n );\n });\n\n SettingsPage.prototype['summariesItems'] = function () {\n const items = new ItemList();\n\n items.add(\n 'synopsis-excerpts',\n Switch.component(\n {\n state: this.user.preferences().showSynopsisExcerpts,\n onchange: (value) => {\n this.showSynopsisExcerptsLoading = true;\n\n this.user.savePreferences({ showSynopsisExcerpts: value }).then(() => {\n this.showSynopsisExcerptsLoading = false;\n m.redraw();\n });\n },\n loading: this.showSynopsisExcerptsLoading,\n },\n app.translator.trans('ianm-synopsis.forum.user.settings.show-summaries')\n )\n );\n\n if (this.user.preferences().showSynopsisExcerpts) {\n items.add(\n 'synopsis-excerpts-mobile',\n Switch.component(\n {\n state: this.user.preferences().showSynopsisExcerptsOnMobile,\n disabled: !this.user.preferences().showSynopsisExcerpts,\n onchange: (value) => {\n this.showSynopsisExcerptsOnMobileLoading = true;\n\n this.user.savePreferences({ showSynopsisExcerptsOnMobile: value }).then(() => {\n this.showSynopsisExcerptsOnMobileLoading = false;\n window.location.reload();\n });\n },\n loading: this.showSynopsisExcerptsOnMobileLoading,\n },\n app.translator.trans('ianm-synopsis.forum.user.settings.show-summaries-mobile')\n )\n );\n }\n\n return items;\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__","Excerpt","_Component","_this","_len","arguments","length","args","Array","_key","apply","concat","post","richExcerpt","create","constructor","_proto","oninit","vnode","this","attrs","view","m","trust","getContent","_this$contentRich","_this$contentPlain","truncate","contentRich","contentPlain","contentHtml","Component","components","app","add","has","Tag","richExcerpts","Model","excerptLength","extend","DiscussionListState","params","attribute","include","push","DiscussionListItem","items","_app$session$user$pre","_tag","_tag2","_tag3","_tag4","_app$session$user$pre2","q","discussion","user","preferences","showSynopsisExcerpts","tag","tags","excerptPost","firstPost","lastPost","onMobile","showSynopsisExcerptsOnMobile","excerpt","SettingsPage","Stream","FieldSet","label","trans","className","summariesItems","toArray","ItemList","Switch","state","onchange","showSynopsisExcerptsLoading","savePreferences","then","redraw","loading","disabled","showSynopsisExcerptsOnMobileLoading","window","location","reload"],"sourceRoot":""} \ No newline at end of file