mirror of
https://github.com/flarum/framework.git
synced 2024-11-29 21:11:55 +08:00
1 line
17 KiB
Plaintext
1 line
17 KiB
Plaintext
{"version":3,"sources":["webpack://@flarum/suspend/webpack/bootstrap","webpack://@flarum/suspend/external \"flarum.core.compat['app']\"","webpack://@flarum/suspend/external \"flarum.core.compat['extend']\"","webpack://@flarum/suspend/external \"flarum.core.compat['components/Button']\"","webpack://@flarum/suspend/external \"flarum.core.compat['components/Notification']\"","webpack://@flarum/suspend/external \"flarum.core.compat['Model']\"","webpack://@flarum/suspend/external \"flarum.core.compat['models/User']\"","webpack://@flarum/suspend/external \"flarum.core.compat['helpers/username']\"","webpack://@flarum/suspend/external \"flarum.core.compat['helpers/humanTime']\"","webpack://@flarum/suspend/external \"flarum.core.compat['utils/UserControls']\"","webpack://@flarum/suspend/external \"flarum.core.compat['components/Badge']\"","webpack://@flarum/suspend/external \"flarum.core.compat['components/Modal']\"","webpack://@flarum/suspend/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@flarum/suspend/./src/forum/components/SuspendUserModal.js","webpack://@flarum/suspend/./src/forum/components/UserSuspendedNotification.js","webpack://@flarum/suspend/./src/forum/components/UserUnsuspendedNotification.js","webpack://@flarum/suspend/./src/forum/index.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","_inheritsLoose","subClass","superClass","constructor","__proto__","SuspendUserModal","init","_Modal","this","until","props","user","suspendedUntil","status","Date","getFullYear","prop","daysRemaining","moment","diff","className","title","app","translator","trans","content","_this","type","checked","onclick","withAttr","e","target","redraw","$","select","strategy","min","oninput","Button_default","a","loading","onsubmit","_this2","preventDefault","add","toDate","save","then","hide","loaded","Modal","UserSuspendedNotification","icon","href","route","notification","subject","timeReadable","date","from","createdAt","fromUser","Notification","UserUnsuspendedNotification","initializers","notificationComponents","userSuspended","userUnsuspended","User","canSuspend","Model","attribute","transformDate","extend","UserControls","items","Button","component","children","modal","show","Badge","label"],"mappings":"2BACA,IAAAA,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,GAAA,CACAG,EAAAH,EACAI,GAAA,EACAH,QAAA,IAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QA0DA,OArDAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,EAAA,CAA0CK,YAAA,EAAAC,IAAAL,KAK1CZ,EAAAkB,EAAA,SAAAhB,GACA,oBAAAiB,eAAAC,aACAN,OAAAC,eAAAb,EAAAiB,OAAAC,YAAA,CAAwDC,MAAA,WAExDP,OAAAC,eAAAb,EAAA,cAAiDmB,OAAA,KAQjDrB,EAAAsB,EAAA,SAAAD,EAAAE,GAEA,GADA,EAAAA,IAAAF,EAAArB,EAAAqB,IACA,EAAAE,EAAA,OAAAF,EACA,KAAAE,GAAA,iBAAAF,QAAAG,WAAA,OAAAH,EACA,IAAAI,EAAAX,OAAAY,OAAA,MAGA,GAFA1B,EAAAkB,EAAAO,GACAX,OAAAC,eAAAU,EAAA,WAAyCT,YAAA,EAAAK,UACzC,EAAAE,GAAA,iBAAAF,EAAA,QAAAM,KAAAN,EAAArB,EAAAU,EAAAe,EAAAE,EAAA,SAAAA,GAAgH,OAAAN,EAAAM,IAAqBC,KAAA,KAAAD,IACrI,OAAAF,GAIAzB,EAAA6B,EAAA,SAAA1B,GACA,IAAAS,EAAAT,KAAAqB,WACA,WAA2B,OAAArB,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAH,EAAAU,EAAAE,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I0D,MAAMC,KAAK,IAAI5E,EAAiB,CAACM,gBAK1D+D,iBAAOL,IAAK5E,UAAW,SAAU,SAASmF,GACxC,IAAMnE,EAAQD,KAAKI,iBAEf,IAAIE,KAASL,GACfmE,EAAM/B,IAAI,YAAaqC,IAAMJ,UAAU,CACrCzB,KAAM,aACN1B,KAAM,YACNwD,MAAO7D,IAAIC,WAAWC,MAAM","file":"forum.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 12);\n","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['components/Notification'];","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['models/User'];","module.exports = flarum.core.compat['helpers/username'];","module.exports = flarum.core.compat['helpers/humanTime'];","module.exports = flarum.core.compat['utils/UserControls'];","module.exports = flarum.core.compat['components/Badge'];","module.exports = flarum.core.compat['components/Modal'];","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","import Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\n\nexport default class SuspendUserModal extends Modal {\n init() {\n super.init();\n\n let until = this.props.user.suspendedUntil();\n let status = null;\n\n if (new Date() > until) until = null;\n\n if (until) {\n if (until.getFullYear() === 9999) status = 'indefinitely';\n else status = 'limited';\n }\n\n this.status = m.prop(status);\n this.daysRemaining = m.prop(status === 'limited' && -moment().diff(until, 'days') + 1);\n }\n\n className() {\n return 'SuspendUserModal Modal--small';\n }\n\n title() {\n return app.translator.trans('flarum-suspend.forum.suspend_user.title', {user: this.props.user});\n }\n\n content() {\n return (\n <div className=\"Modal-body\">\n <div className=\"Form\">\n <div className=\"Form-group\">\n <label>{app.translator.trans('flarum-suspend.forum.suspend_user.status_heading')}</label>\n <div>\n <label className=\"checkbox\">\n <input type=\"radio\" name=\"status\" checked={!this.status()} value=\"\" onclick={m.withAttr('value', this.status)}/>\n {app.translator.trans('flarum-suspend.forum.suspend_user.not_suspended_label')}\n </label>\n\n <label className=\"checkbox\">\n <input type=\"radio\" name=\"status\" checked={this.status() === 'indefinitely'} value='indefinitely' onclick={m.withAttr('value', this.status)}/>\n {app.translator.trans('flarum-suspend.forum.suspend_user.indefinitely_label')}\n </label>\n\n <label className=\"checkbox SuspendUserModal-days\">\n <input type=\"radio\" name=\"status\" checked={this.status() === 'limited'} value='limited' onclick={e => {\n this.status(e.target.value);\n m.redraw(true);\n this.$('.SuspendUserModal-days-input input').select();\n m.redraw.strategy('none');\n }}/>\n {app.translator.trans('flarum-suspend.forum.suspend_user.limited_time_label')}\n {this.status() === 'limited' ? (\n <div className=\"SuspendUserModal-days-input\">\n <input type=\"number\"\n min=\"0\"\n value={this.daysRemaining()}\n oninput={m.withAttr('value', this.daysRemaining)}\n className=\"FormControl\"/>\n {app.translator.trans('flarum-suspend.forum.suspend_user.limited_time_days_text')}\n </div>\n ) : ''}\n </label>\n </div>\n </div>\n\n <div className=\"Form-group\">\n <Button className=\"Button Button--primary\" loading={this.loading} type=\"submit\">\n {app.translator.trans('flarum-suspend.forum.suspend_user.submit_button')}\n </Button>\n </div>\n </div>\n </div>\n );\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n let suspendedUntil = null;\n switch (this.status()) {\n case 'indefinitely':\n suspendedUntil = new Date('2038-01-01');\n break;\n\n case 'limited':\n suspendedUntil = moment().add(this.daysRemaining(), 'days').toDate();\n break;\n\n default:\n // no default\n }\n\n this.props.user.save({suspendedUntil}).then(\n () => this.hide(),\n this.loaded.bind(this)\n );\n }\n}\n","import Notification from 'flarum/components/Notification';\nimport username from 'flarum/helpers/username';\nimport humanTime from 'flarum/helpers/humanTime';\n\nexport default class UserSuspendedNotification extends Notification {\n icon() {\n return 'ban';\n }\n\n href() {\n return app.route.user(this.props.notification.subject());\n }\n\n content() {\n const notification = this.props.notification;\n const suspendedUntil = notification.content();\n const timeReadable = moment(suspendedUntil.date).from(notification.createdAt(), true);\n\n return app.translator.trans('flarum-suspend.forum.notifications.user_suspended_text', {\n user: notification.fromUser(),\n timeReadable,\n });\n }\n}\n","import Notification from 'flarum/components/Notification';\nimport username from 'flarum/helpers/username';\nimport humanTime from 'flarum/helpers/humanTime';\n\nexport default class UserUnsuspendedNotification extends Notification {\n icon() {\n return 'ban';\n }\n\n href() {\n return app.route.user(this.props.notification.subject());\n }\n\n content() {\n const notification = this.props.notification;\n\n return app.translator.trans('flarum-suspend.forum.notifications.user_unsuspended_text', {\n user: notification.fromUser(),\n });\n }\n}\n","import { extend } from 'flarum/extend';\nimport app from 'flarum/app';\nimport UserControls from 'flarum/utils/UserControls';\nimport Button from 'flarum/components/Button';\nimport Badge from 'flarum/components/Badge';\nimport Model from 'flarum/Model';\nimport User from 'flarum/models/User';\n\nimport SuspendUserModal from './components/SuspendUserModal';\nimport UserSuspendedNotification from './components/UserSuspendedNotification';\nimport UserUnsuspendedNotification from './components/UserUnsuspendedNotification';\n\napp.initializers.add('flarum-suspend', () => {\n app.notificationComponents.userSuspended = UserSuspendedNotification;\n app.notificationComponents.userUnsuspended = UserUnsuspendedNotification;\n\n User.prototype.canSuspend = Model.attribute('canSuspend');\n User.prototype.suspendedUntil = Model.attribute('suspendedUntil', Model.transformDate);\n\n extend(UserControls, 'moderationControls', (items, user) => {\n if (user.canSuspend()) {\n items.add('suspend', Button.component({\n children: app.translator.trans('flarum-suspend.forum.user_controls.suspend_button'),\n icon: 'fas fa-ban',\n onclick: () => app.modal.show(new SuspendUserModal({user}))\n }));\n }\n });\n\n extend(User.prototype, 'badges', function(items) {\n const until = this.suspendedUntil();\n\n if (new Date() < until) {\n items.add('suspended', Badge.component({\n icon: 'fas fa-ban',\n type: 'suspended',\n label: app.translator.trans('flarum-suspend.forum.user_badge.suspended_tooltip')\n }));\n }\n });\n});\n"],"sourceRoot":""} |