From a8ab022311133a83ae5e5865ba03b8b0cecd2656 Mon Sep 17 00:00:00 2001 From: flarum-bot Date: Wed, 27 Nov 2024 12:22:41 +0000 Subject: [PATCH] Bundled output for commit cb1030e4ff86df35048eb76fdddf6b94ed6059b7 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 1d8d2e4..12316d5 100755 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -(()=>{var t={n:s=>{var e=s&&s.__esModule?()=>s.default:()=>s;return t.d(e,{a:e}),e},d:(s,e)=>{for(var n in e)t.o(e,n)&&!t.o(s,n)&&Object.defineProperty(s,n,{enumerable:!0,get:e[n]})},o:(t,s)=>Object.prototype.hasOwnProperty.call(t,s),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},s={};(()=>{"use strict";t.r(s),t.d(s,{components:()=>C,extend:()=>I});const e=flarum.core.compat["forum/app"];var n=t.n(e);const o=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 a=t.n(c);function p(t,s){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,s){return t.__proto__=s,t},p(t,s)}const u=flarum.core.compat["common/Component"];var l=t.n(u);const h=flarum.core.compat["common/utils/string"];var f=function(t){function s(){for(var s,e=arguments.length,n=new Array(e),o=0;o{var t={n:s=>{var e=s&&s.__esModule?()=>s.default:()=>s;return t.d(e,{a:e}),e},d:(s,e)=>{for(var n in e)t.o(e,n)&&!t.o(s,n)&&Object.defineProperty(s,n,{enumerable:!0,get:e[n]})},o:(t,s)=>Object.prototype.hasOwnProperty.call(t,s),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},s={};(()=>{"use strict";t.r(s),t.d(s,{components:()=>C,extend:()=>I});const e=flarum.core.compat["forum/app"];var n=t.n(e);const o=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 a=t.n(c);function p(t,s){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,s){return t.__proto__=s,t},p(t,s)}const u=flarum.core.compat["common/Component"];var l=t.n(u);const h=flarum.core.compat["common/utils/string"];var d=function(t){function s(){for(var s,e=arguments.length,n=new Array(e),o=0;o {\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'];","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'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extenders'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['tags/common/models/Tag'];","import Extend from 'flarum/common/extenders';\nimport Tag from 'flarum/tags/common/models/Tag';\n\nexport default [\n new Extend.Model(Tag) //\n .attribute('richExcerpts')\n .attribute('excerptLength'),\n];\n","import Extend from 'flarum/common/extenders';\nimport commonExtend from '../common/extend';\n\nexport default [...commonExtend];\n","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 { default as extend } from './extend';\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 ItemList from 'flarum/common/utils/ItemList';\nimport type Mithril from 'mithril';\nimport Excerpt from './components/Excerpt';\n\nexport default function addSummaryExcerpt() {\n extend(DiscussionListState.prototype, 'requestParams', function (params) {\n if (typeof params.include === 'string') {\n params.include = [params.include];\n } else {\n params.include = params.include || [];\n }\n\n if (app.forum.attribute('synopsis.excerpt_type') === 'first') {\n params.include.push('firstPost');\n } else {\n params.include.push('lastPost');\n }\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 // @ts-expect-error\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 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';\nimport type Mithril from 'mithril';\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) {\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 if (!this.user) return items;\n\n const prefs = this.user.preferences();\n\n items.add(\n 'synopsis-excerpts',\n Switch.component(\n {\n state: prefs?.showSynopsisExcerpts,\n onchange: (value: boolean) => {\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 (prefs?.showSynopsisExcerpts) {\n items.add(\n 'synopsis-excerpts-mobile',\n Switch.component(\n {\n state: prefs?.showSynopsisExcerptsOnMobile,\n disabled: !prefs?.showSynopsisExcerpts,\n onchange: (value: boolean) => {\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","className","trust","getContent","_this$contentRich","_this$contentPlain","truncate","contentRich","contentPlain","contentHtml","Component","Extend","Tag","attribute","commonExtend","components","app","add","extend","DiscussionListState","params","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","excerptLength","richExcerpts","onMobile","showSynopsisExcerptsOnMobile","excerpt","SettingsPage","_this$user","_this$user2","Stream","FieldSet","label","trans","summariesItems","toArray","ItemList","prefs","Switch","state","onchange","_this$user3","showSynopsisExcerptsLoading","savePreferences","then","redraw","loading","disabled","_this$user4","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,I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AAmB,IAAAkG,EAC5BtF,EAAKuF,qCAAsC,EAElC,OAATD,EAAAtF,EAAKoD,OAALkC,EAAWL,gBAAgB,CAAElB,6BAA8B3E,IAAS8F,MAAK,WACvElF,EAAKuF,qCAAsC,EAC3CC,OAAOC,SAASC,QAClB,GACF,EACAN,QAASpE,KAAKuE,qCAEhBpD,IAAAA,WAAeoC,MAAM,6DAKpB5B,CACT,CFjEF,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/./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/external root \"flarum.core.compat['common/extenders']\"","webpack://@ianm/synopsis/external root \"flarum.core.compat['tags/common/models/Tag']\"","webpack://@ianm/synopsis/./src/common/extend.ts","webpack://@ianm/synopsis/./src/forum/extend.ts","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'];","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'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extenders'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['tags/common/models/Tag'];","import Extend from 'flarum/common/extenders';\nimport Tag from 'flarum/tags/common/models/Tag';\n\nexport default [\n new Extend.Model(Tag) //\n .attribute('richExcerpts')\n .attribute('excerptLength'),\n];\n","import Extend from 'flarum/common/extenders';\nimport commonExtend from '../common/extend';\n\nexport default [...commonExtend];\n","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 { default as extend } from './extend';\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 ItemList from 'flarum/common/utils/ItemList';\nimport type Mithril from 'mithril';\nimport Excerpt from './components/Excerpt';\n\nexport default function addSummaryExcerpt() {\n extend(DiscussionListState.prototype, 'requestParams', function (params) {\n if (typeof params.include === 'string') {\n params.include = [params.include];\n } else {\n params.include = params.include || [];\n }\n\n if (app.forum.attribute('synopsis.excerpt_type') === 'first') {\n params.include.push('firstPost');\n } else {\n params.include.push('lastPost');\n }\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 // @ts-expect-error\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('excerpt', excerpt, -100);\n onMobile && items.add('excerptM', excerpt, -100);\n }\n });\n}\n","import 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';\nimport type Mithril from 'mithril';\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) {\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 if (!this.user) return items;\n\n const prefs = this.user.preferences();\n\n items.add(\n 'synopsis-excerpts',\n Switch.component(\n {\n state: prefs?.showSynopsisExcerpts,\n onchange: (value: boolean) => {\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 (prefs?.showSynopsisExcerpts) {\n items.add(\n 'synopsis-excerpts-mobile',\n Switch.component(\n {\n state: prefs?.showSynopsisExcerptsOnMobile,\n disabled: !prefs?.showSynopsisExcerpts,\n onchange: (value: boolean) => {\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","className","trust","getContent","_this$contentRich","_this$contentPlain","truncate","contentRich","contentPlain","contentHtml","Component","Extend","Tag","attribute","commonExtend","components","app","add","extend","DiscussionListState","params","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","excerptLength","richExcerpts","onMobile","showSynopsisExcerptsOnMobile","excerpt","SettingsPage","_this$user","_this$user2","Stream","FieldSet","label","trans","summariesItems","toArray","ItemList","prefs","Switch","state","onchange","_this$user3","showSynopsisExcerptsLoading","savePreferences","then","redraw","loading","disabled","_this$user4","showSynopsisExcerptsOnMobileLoading","window","location","reload"],"sourceRoot":""} \ No newline at end of file