diff --git a/composer.json b/composer.json index 6a316ff6..75eb320b 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,7 @@ "backgroundPosition": "center" } }, - "flagrow": { + "extiverse": { "discuss": "https://discuss.flarum.org/d/22690" }, "flarum-locale": { diff --git a/js/dist/forum.js b/js/dist/forum.js index ebf49c51..a53bda66 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -32,7 +32,7 @@ flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default().initializers.add('flarum args[_key - 1] = arguments[_key]; } original.apply(void 0, args); - if (isZhHans && reformatTime && this.stream.description) { + if (isZhHans && reformatTime && this.stream.description && dayjs(this.stream.description).isValid()) { this.stream.description = dayjs(this.stream.description).format('YYYY年MMM'); } }); diff --git a/js/dist/forum.js.map b/js/dist/forum.js.map index a4f10e76..25489894 100644 --- a/js/dist/forum.js.map +++ b/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"file":"forum.js","mappings":";;;;;;;;;;;;;;;;;;AAAmC;AACa;AACY;AAC5D,SAASG,MAAMA,CAACC,GAAG,EAAE;EACnB,2CAAyCA,GAAG;AAC9C;AAEAJ,oEAAgB,CAACM,GAAG,CAAC,gCAAgC,EAAE,YAAM;EAC3D,IAAMC,QAAQ,GAAGP,8DAAQ,CAACS,MAAM,KAAK,SAAS;;EAE9C;EACAR,8DAAQ,CAACC,qFAAoB,EAAE,gBAAgB,EAAE,UAAUS,QAAQ,EAAW;IAC5E,IAAMC,YAAY,GAAGZ,+DAAS,CAACQ,IAAI,CAACM,UAAU,CAACX,MAAM,CAAC,eAAe,CAAC,CAAC;IAAC,SAAAY,IAAA,GAAAC,SAAA,CAAAC,MAAA,EADFC,IAAI,OAAAC,KAAA,CAAAJ,IAAA,OAAAA,IAAA,WAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAJF,IAAI,CAAAE,IAAA,QAAAJ,SAAA,CAAAI,IAAA;IAAA;IAG1ET,QAAQ,CAAAU,KAAA,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;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D","sources":["webpack://@flarum-lang/chinese-simplified/./src/forum/index.js","webpack://@flarum-lang/chinese-simplified/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum-lang/chinese-simplified/external root \"flarum.core.compat['forum/app']\"","webpack://@flarum-lang/chinese-simplified/external root \"flarum.core.compat['forum/components/PostStream']\"","webpack://@flarum-lang/chinese-simplified/webpack/bootstrap","webpack://@flarum-lang/chinese-simplified/webpack/runtime/compat get default export","webpack://@flarum-lang/chinese-simplified/webpack/runtime/define property getters","webpack://@flarum-lang/chinese-simplified/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum-lang/chinese-simplified/webpack/runtime/make namespace object","webpack://@flarum-lang/chinese-simplified/./forum.js"],"sourcesContent":["import app from 'flarum/forum/app';\nimport { override } from 'flarum/common/extend';\nimport PostStream from 'flarum/forum/components/PostStream';\nfunction getKey(key) {\n return `flarum-lang-chinese-simplified.${key}`;\n}\n\napp.initializers.add('flarum-lang/chinese-simplified', () => {\n const isZhHans = app.data.locale === 'zh-Hans'\n\n // 调整侧边栏日期\n override(PostStream.prototype, 'updateScrubber', function (original, ...args) {\n const reformatTime = app.forum.data.attributes[getKey('reformat_time')];\n\n original(...args);\n\n if(isZhHans && reformatTime && this.stream.description) {\n this.stream.description = dayjs(this.stream.description).format('YYYY年MMM');\n }\n });\n\n override(dayjs.prototype, 'format', function (original, format, ...args) {\n const reformatTimeForce = app.forum.data.attributes[getKey('reformat_time_force')];\n\n if(reformatTimeForce && isZhHans) {\n return format === 'D MMM' ? original('MMMD日', ...args) : original(format, ...args)\n } else {\n return original(format, ...args);\n }\n });\n});\n","module.exports = flarum.core.compat['common/extend'];","module.exports = flarum.core.compat['forum/app'];","module.exports = flarum.core.compat['forum/components/PostStream'];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\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};","export * from './src/forum';\r\n"],"names":["app","override","PostStream","getKey","key","initializers","add","isZhHans","data","locale","prototype","original","reformatTime","forum","attributes","_len","arguments","length","args","Array","_key","apply","stream","description","dayjs","format","reformatTimeForce","_len2","_key2","concat"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum.js","mappings":";;;;;;;;;;;;;;;;;;AAAmC;AACa;AACY;AAC5D,SAASG,MAAMA,CAACC,GAAG,EAAE;EACnB,2CAAyCA,GAAG;AAC9C;AAEAJ,oEAAgB,CAACM,GAAG,CAAC,gCAAgC,EA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iBAAiB,IAAIpB,QAAQ,EAAE;MAChC,OAAOmB,MAAM,KAAK,OAAO,GAAGf,QAAQ,CAAAU,KAAA,UAAC,OAAO,EAAAS,MAAA,CAAKZ,IAAI,EAAC,GAAGP,QAAQ,CAAAU,KAAA,UAACK,MAAM,EAAAI,MAAA,CAAKZ,IAAI,EAAC;IACpF,CAAC,MAAM;MACL,OAAOP,QAAQ,CAAAU,KAAA,UAACK,MAAM,EAAAI,MAAA,CAAKZ,IAAI,EAAC;IAClC;EACF,CAAC,CAAC;AACJ,CAAC,CAAC;;;;;;;;;;;AC9BF;;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D","sources":["webpack://@flarum-lang/chinese-simplified/./src/forum/index.js","webpack://@flarum-lang/chinese-simplified/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum-lang/chinese-simplified/external root \"flarum.core.compat['forum/app']\"","webpack://@flarum-lang/chinese-simplified/external root \"flarum.core.compat['forum/components/PostStream']\"","webpack://@flarum-lang/chinese-simplified/webpack/bootstrap","webpack://@flarum-lang/chinese-simplified/webpack/runtime/compat get default export","webpack://@flarum-lang/chinese-simplified/webpack/runtime/define property getters","webpack://@flarum-lang/chinese-simplified/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum-lang/chinese-simplified/webpack/runtime/make namespace object"],"sourcesContent":["import app from 'flarum/forum/app';\r\nimport { override } from 'flarum/common/extend';\r\nimport PostStream from 'flarum/forum/components/PostStream';\r\nfunction getKey(key) {\r\n return `flarum-lang-chinese-simplified.${key}`;\r\n}\r\n\r\napp.initializers.add('flarum-lang/chinese-simplified', () => {\r\n const isZhHans = app.data.locale === 'zh-Hans'\r\n\r\n // 调整侧边栏日期\r\n override(PostStream.prototype, 'updateScrubber', function (original, ...args) {\r\n const reformatTime = app.forum.data.attributes[getKey('reformat_time')];\r\n\r\n original(...args);\r\n\r\n if(isZhHans && reformatTime && this.stream.description && dayjs(this.stream.description).isValid()) {\r\n this.stream.description = dayjs(this.stream.description).format('YYYY年MMM');\r\n }\r\n });\r\n\r\n override(dayjs.prototype, 'format', function (original, format, ...args) {\r\n const reformatTimeForce = app.forum.data.attributes[getKey('reformat_time_force')];\r\n\r\n if(reformatTimeForce && isZhHans) {\r\n return format === 'D MMM' ? original('MMMD日', ...args) : original(format, ...args)\r\n } else {\r\n return original(format, ...args);\r\n }\r\n });\r\n});\r\n","module.exports = flarum.core.compat['common/extend'];","module.exports = flarum.core.compat['forum/app'];","module.exports = flarum.core.compat['forum/components/PostStream'];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\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};"],"names":["app","override","PostStream","getKey","key","initializers","add","isZhHans","data","locale","prototype","original","reformatTime","forum","attributes","_len","arguments","length","args","Array","_key","apply","stream","description","dayjs","isValid","format","reformatTimeForce","_len2","_key2","concat"],"sourceRoot":""} \ No newline at end of file diff --git a/js/src/forum/index.js b/js/src/forum/index.js index 66299ebe..853a6eb6 100644 --- a/js/src/forum/index.js +++ b/js/src/forum/index.js @@ -14,7 +14,7 @@ app.initializers.add('flarum-lang/chinese-simplified', () => { original(...args); - if(isZhHans && reformatTime && this.stream.description) { + if(isZhHans && reformatTime && this.stream.description && dayjs(this.stream.description).isValid()) { this.stream.description = dayjs(this.stream.description).format('YYYY年MMM'); } });