From c780474d6443ed3e5a4f0b0e780e646870ab8e7e Mon Sep 17 00:00:00 2001 From: flarum-bot Date: Tue, 22 Oct 2024 20:19:18 +0000 Subject: [PATCH] Bundled output for commit 1d93d14f87cdbea83c9c578e6f3b47a2a53e26ee Includes transpiled JS/TS, and Typescript declaration files (typings). [skip ci] --- js/dist-typings/@types/shims.d.ts | 43 +++++++++++++++++++ js/dist-typings/admin/extend.d.ts | 2 + .../admin/extenders/extendEditTagModal.d.ts | 1 + js/dist-typings/admin/index.d.ts | 1 + js/dist-typings/admin/util/typeOptions.d.ts | 3 ++ js/dist-typings/common/extend.d.ts | 2 + js/dist-typings/forum/addSummaryExcerpt.d.ts | 1 + js/dist-typings/forum/addUserPreference.d.ts | 1 + js/dist-typings/forum/components/Excerpt.d.ts | 18 ++++++++ js/dist-typings/forum/components/index.d.ts | 4 ++ js/dist-typings/forum/extend.d.ts | 2 + js/dist-typings/forum/index.d.ts | 2 + js/dist/admin.js | 2 +- js/dist/admin.js.map | 2 +- js/dist/forum.js | 2 +- js/dist/forum.js.map | 2 +- 16 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 js/dist-typings/@types/shims.d.ts create mode 100644 js/dist-typings/admin/extend.d.ts create mode 100644 js/dist-typings/admin/extenders/extendEditTagModal.d.ts create mode 100644 js/dist-typings/admin/index.d.ts create mode 100644 js/dist-typings/admin/util/typeOptions.d.ts create mode 100644 js/dist-typings/common/extend.d.ts create mode 100644 js/dist-typings/forum/addSummaryExcerpt.d.ts create mode 100644 js/dist-typings/forum/addUserPreference.d.ts create mode 100644 js/dist-typings/forum/components/Excerpt.d.ts create mode 100644 js/dist-typings/forum/components/index.d.ts create mode 100644 js/dist-typings/forum/extend.d.ts create mode 100644 js/dist-typings/forum/index.d.ts diff --git a/js/dist-typings/@types/shims.d.ts b/js/dist-typings/@types/shims.d.ts new file mode 100644 index 0000000..b438099 --- /dev/null +++ b/js/dist-typings/@types/shims.d.ts @@ -0,0 +1,43 @@ +import Tag from 'flarum/tags/common/models/Tag'; +import SettingsPage from 'flarum/forum/components/SettingsPage'; +import ItemList from 'flarum/common/utils/ItemList'; +import type Mithril from 'mithril'; +import EditTagModal from 'flarum/tags/admin/components/EditTagModal'; +import Stream from 'flarum/common/utils/Stream'; + +declare module 'flarum/tags/common/models/Tag' { + export default interface Tag { + richExcerpts(): boolean; + excerptLength(): number; + } +} + +declare module 'flarum/forum/components/SettingsPage' { + export default interface SettingsPage { + summariesItems(): ItemList; + showSynopsisExcerpts: Stream; + showSynopsisExcerptsOnMobile: Stream; + showSynopsisExcerptsLoading: boolean; + showSynopsisExcerptsOnMobileLoading: boolean; + } +} + +declare module 'flarum/tags/admin/components/EditTagModal' { + export default interface EditTagModal { + richExcerpts: Stream; + excerptLength: Stream; + submitData(): { + excerptLength: any; + richExcerpts: any; + name: string; + slug: string; + description: string; + color: string; + icon: string; + isHidden: boolean; + primary: boolean; + richExcerpts: boolean; + excerptLength: number; + }; + } +} diff --git a/js/dist-typings/admin/extend.d.ts b/js/dist-typings/admin/extend.d.ts new file mode 100644 index 0000000..af1fdf2 --- /dev/null +++ b/js/dist-typings/admin/extend.d.ts @@ -0,0 +1,2 @@ +declare const _default: import("flarum/common/extenders/Model").default[]; +export default _default; diff --git a/js/dist-typings/admin/extenders/extendEditTagModal.d.ts b/js/dist-typings/admin/extenders/extendEditTagModal.d.ts new file mode 100644 index 0000000..399a90f --- /dev/null +++ b/js/dist-typings/admin/extenders/extendEditTagModal.d.ts @@ -0,0 +1 @@ +export default function (): void; diff --git a/js/dist-typings/admin/index.d.ts b/js/dist-typings/admin/index.d.ts new file mode 100644 index 0000000..6d2293d --- /dev/null +++ b/js/dist-typings/admin/index.d.ts @@ -0,0 +1 @@ +export { default as extend } from './extend'; diff --git a/js/dist-typings/admin/util/typeOptions.d.ts b/js/dist-typings/admin/util/typeOptions.d.ts new file mode 100644 index 0000000..291ea56 --- /dev/null +++ b/js/dist-typings/admin/util/typeOptions.d.ts @@ -0,0 +1,3 @@ +export default function (): { + [key: string]: string; +}; diff --git a/js/dist-typings/common/extend.d.ts b/js/dist-typings/common/extend.d.ts new file mode 100644 index 0000000..af1fdf2 --- /dev/null +++ b/js/dist-typings/common/extend.d.ts @@ -0,0 +1,2 @@ +declare const _default: import("flarum/common/extenders/Model").default[]; +export default _default; diff --git a/js/dist-typings/forum/addSummaryExcerpt.d.ts b/js/dist-typings/forum/addSummaryExcerpt.d.ts new file mode 100644 index 0000000..8b3450c --- /dev/null +++ b/js/dist-typings/forum/addSummaryExcerpt.d.ts @@ -0,0 +1 @@ +export default function addSummaryExcerpt(): void; diff --git a/js/dist-typings/forum/addUserPreference.d.ts b/js/dist-typings/forum/addUserPreference.d.ts new file mode 100644 index 0000000..399a90f --- /dev/null +++ b/js/dist-typings/forum/addUserPreference.d.ts @@ -0,0 +1 @@ +export default function (): void; diff --git a/js/dist-typings/forum/components/Excerpt.d.ts b/js/dist-typings/forum/components/Excerpt.d.ts new file mode 100644 index 0000000..d64a862 --- /dev/null +++ b/js/dist-typings/forum/components/Excerpt.d.ts @@ -0,0 +1,18 @@ +import Component, { ComponentAttrs } from 'flarum/common/Component'; +import Post from 'flarum/common/models/Post'; +import type Mithril from 'mithril'; +export interface ExcerptAttrs extends ComponentAttrs { + post: Post; + length: number; + richExcerpt: boolean; +} +export default class Excerpt extends Component { + post: Post; + length: number; + richExcerpt: boolean; + oninit(vnode: Mithril.Vnode): void; + view(): JSX.Element; + getContent(): string; + contentRich(): string | null | undefined; + contentPlain(): string | null | undefined; +} diff --git a/js/dist-typings/forum/components/index.d.ts b/js/dist-typings/forum/components/index.d.ts new file mode 100644 index 0000000..47c8c2d --- /dev/null +++ b/js/dist-typings/forum/components/index.d.ts @@ -0,0 +1,4 @@ +import Excerpt from './Excerpt'; +export declare const components: { + Excerpt: typeof Excerpt; +}; diff --git a/js/dist-typings/forum/extend.d.ts b/js/dist-typings/forum/extend.d.ts new file mode 100644 index 0000000..af1fdf2 --- /dev/null +++ b/js/dist-typings/forum/extend.d.ts @@ -0,0 +1,2 @@ +declare const _default: import("flarum/common/extenders/Model").default[]; +export default _default; diff --git a/js/dist-typings/forum/index.d.ts b/js/dist-typings/forum/index.d.ts new file mode 100644 index 0000000..4c2783b --- /dev/null +++ b/js/dist-typings/forum/index.d.ts @@ -0,0 +1,2 @@ +export { default as extend } from './extend'; +export * from './components'; diff --git a/js/dist/admin.js b/js/dist/admin.js index 7277c8a..aff98c6 100755 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -1,2 +1,2 @@ -(()=>{var t={n:e=>{var s=e&&e.__esModule?()=>e.default:()=>e;return t.d(s,{a:s}),s},d:(e,s)=>{for(var n in s)t.o(s,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:s[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};(()=>{"use strict";const e=flarum.core.compat["admin/app"];var s=t.n(e);const n=flarum.core.compat["tags/components/EditTagModal"];var a=t.n(n);const r=flarum.core.compat["common/extend"],i=flarum.core.compat["tags/models/Tag"];var o=t.n(i);const p=flarum.core.compat["common/Model"];var l=t.n(p);const c=flarum.core.compat["common/utils/Stream"];var g=t.n(c);s().initializers.add("ianm-synopsis",(function(){s().extensionData.for("ianm-synopsis").registerSetting((function(){if("flarum-tags"in flarum.extensions)return m("div",{className:"Form-group"},m("p",{className:"helpText"},s().translator.trans("ianm-synopsis.admin.settings.tags-enabled")))})).registerSetting({label:s().translator.trans("ianm-synopsis.admin.settings.excerpt-length.label"),help:s().translator.trans("ianm-synopsis.admin.settings.excerpt-length.help"),setting:"ianm-synopsis.excerpt_length",type:"number"}).registerSetting({label:s().translator.trans("ianm-synopsis.admin.settings.rich-excerpts.label"),help:s().translator.trans("ianm-synopsis.admin.settings.rich-excerpts.help"),setting:"ianm-synopsis.rich-excerpts",type:"boolean"}).registerSetting({label:s().translator.trans("ianm-synopsis.admin.settings.excerpt-type.label"),help:s().translator.trans("ianm-synopsis.admin.settings.excerpt-type.help"),setting:"ianm-synopsis.excerpt-type",options:["first","last"].reduce((function(t,e){return t[e]=s().translator.trans("ianm-synopsis.admin.settings."+e+"-label"),t}),{}),type:"select"}).registerSetting({label:s().translator.trans("ianm-synopsis.admin.settings.disable-when-searching.label"),help:s().translator.trans("ianm-synopsis.admin.settings.disable-when-searching.help"),setting:"ianm-synopsis.disable-when-searching",type:"switch"}),s().initializers.has("flarum-tags")&&(o().prototype.richExcerpts=l().attribute("richExcerpts"),o().prototype.excerptLength=l().attribute("excerptLength"),(0,r.extend)(a().prototype,"oninit",(function(){this.richExcerpts=new(g())(this.tag.richExcerpts()),this.excerptLength=new(g())(this.tag.excerptLength())})),(0,r.extend)(a().prototype,"submitData",(function(t){return t.richExcerpts=this.richExcerpts(),t.excerptLength=this.excerptLength(),t})),(0,r.extend)(a().prototype,"fields",(function(t){t.add("synopsis-excerpt-length",m("div",{className:"Form-group"},m("label",null,s().translator.trans("ianm-synopsis.admin.settings.excerpt-length.label")),m("input",{className:"FormControl",type:"number",min:"0",bidi:this.excerptLength}),m("div",null,s().translator.trans("ianm-synopsis.admin.settings.excerpt-length.help"))),5),t.add("synopsis-rich-excerpts",m("div",{className:"Form-group"},m("div",null,m("label",{className:"checkbox"},m("input",{type:"checkbox",bidi:this.richExcerpts}),s().translator.trans("ianm-synopsis.admin.settings.rich-excerpts.label"))),m("div",null,s().translator.trans("ianm-synopsis.admin.settings.rich-excerpts.help"))),5)})))}))})(),module.exports={}})(); +(()=>{var t={n:e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},d:(e,n)=>{for(var s in n)t.o(n,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:n[s]})},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,{extend:()=>x});const n=flarum.core.compat["admin/app"];var s=t.n(n);const a=flarum.core.compat["tags/admin/components/EditTagModal"];var r=t.n(a);const i=flarum.core.compat["common/extend"],o=flarum.core.compat["common/utils/Stream"];var l=t.n(o);const p=flarum.core.compat["common/utils/extractText"];var c=t.n(p);const d=flarum.core.compat["common/extenders"];var g=t.n(d);const h=flarum.core.compat["tags/common/models/Tag"];var u=t.n(h);const y=[new(g().Model)(u()).attribute("richExcerpts").attribute("excerptLength")],x=[].concat(y);s().initializers.add("ianm-synopsis",(function(){s().extensionData.for("ianm-synopsis").registerSetting((function(){if("flarum-tags"in flarum.extensions)return m("div",{className:"Form-group"},m("p",{className:"helpText"},s().translator.trans("ianm-synopsis.admin.settings.tags-enabled")))})).registerSetting({label:s().translator.trans("ianm-synopsis.admin.settings.excerpt-length.label"),help:s().translator.trans("ianm-synopsis.admin.settings.excerpt-length.help"),setting:"ianm-synopsis.excerpt_length",type:"number"}).registerSetting({label:s().translator.trans("ianm-synopsis.admin.settings.rich-excerpts.label"),help:s().translator.trans("ianm-synopsis.admin.settings.rich-excerpts.help"),setting:"ianm-synopsis.rich-excerpts",type:"boolean"}).registerSetting({label:s().translator.trans("ianm-synopsis.admin.settings.excerpt-type.label"),help:s().translator.trans("ianm-synopsis.admin.settings.excerpt-type.help"),setting:"ianm-synopsis.excerpt-type",options:["first","last"].reduce((function(t,e){return t[e]=c()(s().translator.trans("ianm-synopsis.admin.settings."+e+"-label")),t}),{}),type:"select"}).registerSetting({label:s().translator.trans("ianm-synopsis.admin.settings.disable-when-searching.label"),help:s().translator.trans("ianm-synopsis.admin.settings.disable-when-searching.help"),setting:"ianm-synopsis.disable-when-searching",type:"switch"}),(0,i.extend)(r().prototype,"oninit",(function(){this.richExcerpts=new(l())(this.tag.richExcerpts()),this.excerptLength=new(l())(this.tag.excerptLength())})),(0,i.extend)(r().prototype,"submitData",(function(t){return t.richExcerpts=this.richExcerpts(),t.excerptLength=this.excerptLength(),t})),(0,i.extend)(r().prototype,"fields",(function(t){t.add("synopsis-excerpt-length",m("div",{className:"Form-group"},m("label",null,s().translator.trans("ianm-synopsis.admin.settings.excerpt-length.label")),m("input",{className:"FormControl",type:"number",min:"0",bidi:this.excerptLength}),m("div",null,s().translator.trans("ianm-synopsis.admin.settings.excerpt-length.help"))),5),t.add("synopsis-rich-excerpts",m("div",{className:"Form-group"},m("div",null,m("label",{className:"checkbox"},m("input",{type:"checkbox",bidi:this.richExcerpts}),s().translator.trans("ianm-synopsis.admin.settings.rich-excerpts.label"))),m("div",null,s().translator.trans("ianm-synopsis.admin.settings.rich-excerpts.help"))),5)}))}))})(),module.exports=e})(); //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/js/dist/admin.js.map b/js/dist/admin.js.map index bd0f01e..cc9d1d6 100755 --- a/js/dist/admin.js.map +++ b/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"file":"admin.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,I,mBCAlF,MAAM,EAA+BI,OAAOC,KAAKC,OAAO,a,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,gC,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,mB,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,gB,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,u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,gBAEnBM,CACT,KAEAL,EAAAA,EAAAA,QAAOC,IAAAA,UAAwB,UAAU,SAAUK,GACjDA,EAAMvB,IACJ,0BACAG,EAAA,OAAKC,UAAU,cACbD,EAAA,aAAQJ,IAAAA,WAAeM,MAAM,sDAC7BF,EAAA,SAAOC,UAAU,cAAcK,KAAK,SAASe,IAAI,IAAIC,KAAMN,KAAKH,gBAChEb,EAAA,WAAMJ,IAAAA,WAAeM,MAAM,sDAE7B,GAEFkB,EAAMvB,IACJ,yBACAG,EAAA,OAAKC,UAAU,cACbD,EAAA,WACEA,EAAA,SAAOC,UAAU,YACfD,EAAA,SAAOM,KAAK,WAAWgB,KAAMN,KAAKL,eACjCf,IAAAA,WAAeM,MAAM,sDAG1BF,EAAA,WAAMJ,IAAAA,WAAeM,MAAM,qDAE7B,EAEJ,IFTJ,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/external root \"flarum.core.compat['admin/app']\"","webpack://@ianm/synopsis/external root \"flarum.core.compat['tags/components/EditTagModal']\"","webpack://@ianm/synopsis/external root \"flarum.core.compat['common/extend']\"","webpack://@ianm/synopsis/external root \"flarum.core.compat['tags/models/Tag']\"","webpack://@ianm/synopsis/external root \"flarum.core.compat['common/Model']\"","webpack://@ianm/synopsis/external root \"flarum.core.compat['common/utils/Stream']\"","webpack://@ianm/synopsis/./src/admin/index.tsx","webpack://@ianm/synopsis/./src/admin/util/typeOptions.js","webpack://@ianm/synopsis/./src/admin/extendEditTagModal.tsx"],"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))","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['tags/components/EditTagModal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","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['common/utils/Stream'];","import app from 'flarum/admin/app';\nimport extendEditTagModal from './extendEditTagModal';\nimport typeOptions from './util/typeOptions';\n\napp.initializers.add('ianm-synopsis', () => {\n app.extensionData\n .for('ianm-synopsis')\n .registerSetting(function () {\n if (!('flarum-tags' in flarum.extensions)) return;\n return (\n
\n

{app.translator.trans('ianm-synopsis.admin.settings.tags-enabled')}

\n
\n );\n })\n .registerSetting({\n label: app.translator.trans('ianm-synopsis.admin.settings.excerpt-length.label'),\n help: app.translator.trans('ianm-synopsis.admin.settings.excerpt-length.help'),\n setting: 'ianm-synopsis.excerpt_length',\n type: 'number',\n })\n .registerSetting({\n label: app.translator.trans('ianm-synopsis.admin.settings.rich-excerpts.label'),\n help: app.translator.trans('ianm-synopsis.admin.settings.rich-excerpts.help'),\n setting: 'ianm-synopsis.rich-excerpts',\n type: 'boolean',\n })\n .registerSetting({\n label: app.translator.trans('ianm-synopsis.admin.settings.excerpt-type.label'),\n help: app.translator.trans('ianm-synopsis.admin.settings.excerpt-type.help'),\n setting: 'ianm-synopsis.excerpt-type',\n options: typeOptions(),\n type: 'select',\n })\n .registerSetting({\n label: app.translator.trans('ianm-synopsis.admin.settings.disable-when-searching.label'),\n help: app.translator.trans('ianm-synopsis.admin.settings.disable-when-searching.help'),\n setting: 'ianm-synopsis.disable-when-searching',\n type: 'switch',\n });\n\n extendEditTagModal();\n});\n","import app from 'flarum/admin/app';\n\nexport default function () {\n let opts;\n opts = ['first', 'last'].reduce((o, key) => {\n o[key] = app.translator.trans(`ianm-synopsis.admin.settings.${key}-label`);\n\n return o;\n }, {});\n return opts;\n}\n","import app from 'flarum/admin/app';\n/* @ts-ignore */\nimport EditTagModal from 'flarum/tags/components/EditTagModal';\nimport { extend } from 'flarum/common/extend';\nimport ItemList from 'flarum/common/utils/ItemList';\n/* @ts-ignore */\nimport Tag from 'flarum/tags/models/Tag';\nimport Model from 'flarum/common/Model';\nimport Stream from 'flarum/common/utils/Stream';\nimport type Mithril from 'mithril';\n\nexport default function () {\n if (app.initializers.has('flarum-tags')) {\n Tag.prototype.richExcerpts = Model.attribute('richExcerpts');\n Tag.prototype.excerptLength = Model.attribute('excerptLength');\n\n extend(EditTagModal.prototype, 'oninit', function () {\n this.richExcerpts = new Stream(this.tag.richExcerpts());\n this.excerptLength = new Stream(this.tag.excerptLength());\n });\n\n extend(EditTagModal.prototype, 'submitData', function (data) {\n data.richExcerpts = this.richExcerpts();\n data.excerptLength = this.excerptLength();\n\n return data;\n });\n\n extend(EditTagModal.prototype, 'fields', function (items: ItemList) {\n items.add(\n 'synopsis-excerpt-length',\n
\n \n \n
{app.translator.trans('ianm-synopsis.admin.settings.excerpt-length.help')}
\n
,\n 5\n );\n items.add(\n 'synopsis-rich-excerpts',\n
\n
\n \n
\n
{app.translator.trans('ianm-synopsis.admin.settings.rich-excerpts.help')}
\n
,\n 5\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","flarum","core","compat","app","add","registerSetting","extensions","m","className","trans","label","help","setting","type","options","reduce","has","Tag","richExcerpts","Model","excerptLength","extend","EditTagModal","this","Stream","tag","data","items","min","bidi"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"admin.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,sC,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,uB,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,4B,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,oB,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,0B,aCGxD,SACE,IAAIC,IAAAA,OAAaC,KACdC,UAAmB,gBACnBA,UAAkB,kBCHvB,EAAe,GAAfC,OAAmBC,GCGnBC,IAAAA,aAAiBC,IAAI,iBAAiB,WACpCD,IAAAA,cAAiB,IACV,iBACJE,iBAAgB,WACf,GAAM,gBAAiBV,OAAOW,WAC9B,OACEC,EAAA,OAAKC,UAAU,cACbD,EAAA,KAAG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eM,MAAM,sDAE7B,GAGFgB,EAAMrB,IACJ,yBACAG,EAAA,OAAKC,UAAU,cACbD,EAAA,WACEA,EAAA,SAAOC,UAAU,YACfD,EAAA,SAAOM,KAAK,WAAWc,KAAMR,KAAKC,eACjCjB,IAAAA,WAAeM,MAAM,sDAG1BF,EAAA,WAAMJ,IAAAA,WAAeM,MAAM,qDAE7B,EAEJ,GFEF,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['admin/app']\"","webpack://@ianm/synopsis/external root \"flarum.core.compat['tags/admin/components/EditTagModal']\"","webpack://@ianm/synopsis/external root \"flarum.core.compat['common/extend']\"","webpack://@ianm/synopsis/external root \"flarum.core.compat['common/utils/Stream']\"","webpack://@ianm/synopsis/external root \"flarum.core.compat['common/utils/extractText']\"","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/admin/extend.ts","webpack://@ianm/synopsis/./src/admin/index.tsx","webpack://@ianm/synopsis/./src/admin/util/typeOptions.ts","webpack://@ianm/synopsis/./src/admin/extenders/extendEditTagModal.tsx"],"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['admin/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['tags/admin/components/EditTagModal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/Stream'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/extractText'];","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 app from 'flarum/admin/app';\nimport extendEditTagModal from './extenders/extendEditTagModal';\nimport typeOptions from './util/typeOptions';\n\nexport { default as extend } from './extend';\n\napp.initializers.add('ianm-synopsis', () => {\n app.extensionData\n .for('ianm-synopsis')\n .registerSetting(function () {\n if (!('flarum-tags' in flarum.extensions)) return;\n return (\n
\n

{app.translator.trans('ianm-synopsis.admin.settings.tags-enabled')}

\n
\n );\n })\n .registerSetting({\n label: app.translator.trans('ianm-synopsis.admin.settings.excerpt-length.label'),\n help: app.translator.trans('ianm-synopsis.admin.settings.excerpt-length.help'),\n setting: 'ianm-synopsis.excerpt_length',\n type: 'number',\n })\n .registerSetting({\n label: app.translator.trans('ianm-synopsis.admin.settings.rich-excerpts.label'),\n help: app.translator.trans('ianm-synopsis.admin.settings.rich-excerpts.help'),\n setting: 'ianm-synopsis.rich-excerpts',\n type: 'boolean',\n })\n .registerSetting({\n label: app.translator.trans('ianm-synopsis.admin.settings.excerpt-type.label'),\n help: app.translator.trans('ianm-synopsis.admin.settings.excerpt-type.help'),\n setting: 'ianm-synopsis.excerpt-type',\n options: typeOptions(),\n type: 'select',\n })\n .registerSetting({\n label: app.translator.trans('ianm-synopsis.admin.settings.disable-when-searching.label'),\n help: app.translator.trans('ianm-synopsis.admin.settings.disable-when-searching.help'),\n setting: 'ianm-synopsis.disable-when-searching',\n type: 'switch',\n });\n\n extendEditTagModal();\n});\n","import app from 'flarum/admin/app';\nimport extractText from 'flarum/common/utils/extractText';\n\nexport default function () {\n let opts: { [key: string]: string } = {};\n opts = ['first', 'last'].reduce((o: { [key: string]: string }, key) => {\n o[key] = extractText(app.translator.trans(`ianm-synopsis.admin.settings.${key}-label`));\n\n return o;\n }, {});\n return opts;\n}\n","import app from 'flarum/admin/app';\nimport EditTagModal from 'flarum/tags/admin/components/EditTagModal';\nimport { extend } from 'flarum/common/extend';\nimport Stream from 'flarum/common/utils/Stream';\n\nexport default function () {\n extend(EditTagModal.prototype, 'oninit', function () {\n this.richExcerpts = new Stream(this.tag.richExcerpts());\n this.excerptLength = new Stream(this.tag.excerptLength());\n });\n\n extend(EditTagModal.prototype, 'submitData', function (data) {\n data.richExcerpts = this.richExcerpts();\n data.excerptLength = this.excerptLength();\n\n return data;\n });\n\n extend(EditTagModal.prototype, 'fields', function (items) {\n items.add(\n 'synopsis-excerpt-length',\n
\n \n \n
{app.translator.trans('ianm-synopsis.admin.settings.excerpt-length.help')}
\n
,\n 5\n );\n\n items.add(\n 'synopsis-rich-excerpts',\n
\n
\n \n
\n
{app.translator.trans('ianm-synopsis.admin.settings.rich-excerpts.help')}
\n
,\n 5\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","Extend","Tag","attribute","concat","commonExtend","app","add","registerSetting","extensions","m","className","trans","label","help","setting","type","options","reduce","extractText","extend","EditTagModal","this","richExcerpts","Stream","tag","excerptLength","data","items","min","bidi"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/forum.js b/js/dist/forum.js index 5daab67..1d8d2e4 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 o in e)t.o(e,o)&&!t.o(s,o)&&Object.defineProperty(s,o,{enumerable:!0,get:e[o]})},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:()=>j});const e=flarum.core.compat["forum/app"];var o=t.n(e);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,s){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,s){return t.__proto__=s,t},f(t,s)}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 s(){for(var s,e=arguments.length,o=new Array(e),n=0;n{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 {\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","className","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","summariesItems","toArray","ItemList","Switch","state","onchange","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,IAAK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C,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(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