framework/extensions/likes/js/dist/forum.js.map
flarum-bot 2fea567284 Bundled output for commit 542fac888d
Includes transpiled JS/TS.

[skip ci]
2022-01-11 10:41:36 +00:00

1 line
18 KiB
Plaintext
Generated

{"version":3,"sources":["webpack://@flarum/likes/webpack/bootstrap","webpack://@flarum/likes/external \"flarum.core.compat['forum/app']\"","webpack://@flarum/likes/external \"flarum.core.compat['common/extend']\"","webpack://@flarum/likes/external \"flarum.core.compat['forum/components/CommentPost']\"","webpack://@flarum/likes/external \"flarum.core.compat['common/components/Link']\"","webpack://@flarum/likes/external \"flarum.core.compat['common/helpers/username']\"","webpack://@flarum/likes/external \"flarum.core.compat['common/models/Post']\"","webpack://@flarum/likes/external \"flarum.core.compat['common/Model']\"","webpack://@flarum/likes/external \"flarum.core.compat['forum/components/NotificationGrid']\"","webpack://@flarum/likes/external \"flarum.core.compat['common/components/Button']\"","webpack://@flarum/likes/external \"flarum.core.compat['common/helpers/punctuateSeries']\"","webpack://@flarum/likes/external \"flarum.core.compat['common/helpers/icon']\"","webpack://@flarum/likes/external \"flarum.core.compat['common/components/Modal']\"","webpack://@flarum/likes/external \"flarum.core.compat['common/helpers/avatar']\"","webpack://@flarum/likes/external \"flarum.core.compat['forum/components/Notification']\"","webpack://@flarum/likes/external \"flarum.core.compat['common/utils/string']\"","webpack://@flarum/likes/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@flarum/likes/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@flarum/likes/./src/forum/components/PostLikesModal.js","webpack://@flarum/likes/./src/forum/components/PostLikedNotification.js","webpack://@flarum/likes/./src/forum/index.js","webpack://@flarum/likes/./src/forum/addLikeAction.js","webpack://@flarum/likes/./src/forum/addLikesList.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","_setPrototypeOf","setPrototypeOf","__proto__","_inheritsLoose","subClass","superClass","constructor","PostLikesModal","className","title","app","translator","trans","content","this","attrs","post","likes","map","user","href","route","avatar","username","Modal","PostLikedNotification","icon","notification","subject","fromUser","count","excerpt","truncate","contentPlain","Notification","initializers","add","notificationComponents","postLiked","Post","canLike","Model","attribute","hasMany","extend","CommentPost","items","isHidden","isLiked","session","some","Button","component","onclick","save","data","relationships","like","id","splice","unshift","type","length","overLimit","names","sort","a","slice","limit","push","e","preventDefault","modal","show","users","punctuateSeries","NotificationGrid","label"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBkB,EAA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EAAMV,IACJ,QACA,SAAK5B,UAAU,gBACZkB,IAAK,oBACLhB,IAAIC,WAAWC,MAAM,oCAAsCK,EAAM,KAAOP,IAAIuC,QAAQ9B,KAAO,QAAU,IAAM,QAAS,CACnHW,MAAOkC,EAAMF,OACbY,MAAOC,IAAgBX,WFtCjCpB,iBAAOgC,IAAiBnF,UAAW,qBAAqB,SAAUqD,GAChEA,EAAMV,IAAI,YAAa,CACrBhE,KAAM,YACNsD,KAAM,mBACNmD,MAAOnE,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 = 16);\n","module.exports = flarum.core.compat['forum/app'];","module.exports = flarum.core.compat['common/extend'];","module.exports = flarum.core.compat['forum/components/CommentPost'];","module.exports = flarum.core.compat['common/components/Link'];","module.exports = flarum.core.compat['common/helpers/username'];","module.exports = flarum.core.compat['common/models/Post'];","module.exports = flarum.core.compat['common/Model'];","module.exports = flarum.core.compat['forum/components/NotificationGrid'];","module.exports = flarum.core.compat['common/components/Button'];","module.exports = flarum.core.compat['common/helpers/punctuateSeries'];","module.exports = flarum.core.compat['common/helpers/icon'];","module.exports = flarum.core.compat['common/components/Modal'];","module.exports = flarum.core.compat['common/helpers/avatar'];","module.exports = flarum.core.compat['forum/components/Notification'];","module.exports = flarum.core.compat['common/utils/string'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","import app from 'flarum/forum/app';\nimport Modal from 'flarum/common/components/Modal';\nimport Link from 'flarum/common/components/Link';\nimport avatar from 'flarum/common/helpers/avatar';\nimport username from 'flarum/common/helpers/username';\n\nexport default class PostLikesModal extends Modal {\n className() {\n return 'PostLikesModal Modal--small';\n }\n\n title() {\n return app.translator.trans('flarum-likes.forum.post_likes.title');\n }\n\n content() {\n return (\n <div className=\"Modal-body\">\n <ul className=\"PostLikesModal-list\">\n {this.attrs.post.likes().map((user) => (\n <li>\n <Link href={app.route.user(user)}>\n {avatar(user)} {username(user)}\n </Link>\n </li>\n ))}\n </ul>\n </div>\n );\n }\n}\n","import app from 'flarum/forum/app';\nimport Notification from 'flarum/forum/components/Notification';\nimport { truncate } from 'flarum/common/utils/string';\n\nexport default class PostLikedNotification extends Notification {\n icon() {\n return 'far fa-thumbs-up';\n }\n\n href() {\n return app.route.post(this.attrs.notification.subject());\n }\n\n content() {\n const notification = this.attrs.notification;\n const user = notification.fromUser();\n\n return app.translator.trans('flarum-likes.forum.notifications.post_liked_text', { user, count: 1 });\n }\n\n excerpt() {\n return truncate(this.attrs.notification.subject().contentPlain(), 200);\n }\n}\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport Post from 'flarum/common/models/Post';\nimport Model from 'flarum/common/Model';\nimport NotificationGrid from 'flarum/forum/components/NotificationGrid';\n\nimport addLikeAction from './addLikeAction';\nimport addLikesList from './addLikesList';\nimport PostLikedNotification from './components/PostLikedNotification';\n\napp.initializers.add('flarum-likes', () => {\n app.notificationComponents.postLiked = PostLikedNotification;\n\n Post.prototype.canLike = Model.attribute('canLike');\n Post.prototype.likes = Model.hasMany('likes');\n\n addLikeAction();\n addLikesList();\n\n extend(NotificationGrid.prototype, 'notificationTypes', function (items) {\n items.add('postLiked', {\n name: 'postLiked',\n icon: 'far fa-thumbs-up',\n label: app.translator.trans('flarum-likes.forum.settings.notify_post_liked_label'),\n });\n });\n});\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport Button from 'flarum/common/components/Button';\nimport CommentPost from 'flarum/forum/components/CommentPost';\n\nexport default function () {\n extend(CommentPost.prototype, 'actionItems', function (items) {\n const post = this.attrs.post;\n\n if (post.isHidden() || !post.canLike()) return;\n\n const likes = post.likes();\n\n let isLiked = app.session.user && likes && likes.some((user) => user === app.session.user);\n\n items.add(\n 'like',\n Button.component(\n {\n className: 'Button Button--link',\n onclick: () => {\n isLiked = !isLiked;\n\n post.save({ isLiked });\n\n // We've saved the fact that we do or don't like the post, but in order\n // to provide instantaneous feedback to the user, we'll need to add or\n // remove the like from the relationship data manually.\n const data = post.data.relationships.likes.data;\n data.some((like, i) => {\n if (like.id === app.session.user.id()) {\n data.splice(i, 1);\n return true;\n }\n });\n\n if (isLiked) {\n data.unshift({ type: 'users', id: app.session.user.id() });\n }\n },\n },\n app.translator.trans(isLiked ? 'flarum-likes.forum.post.unlike_link' : 'flarum-likes.forum.post.like_link')\n )\n );\n });\n}\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport Link from 'flarum/common/components/Link';\nimport punctuateSeries from 'flarum/common/helpers/punctuateSeries';\nimport username from 'flarum/common/helpers/username';\nimport icon from 'flarum/common/helpers/icon';\n\nimport PostLikesModal from './components/PostLikesModal';\n\nexport default function () {\n extend(CommentPost.prototype, 'footerItems', function (items) {\n const post = this.attrs.post;\n const likes = post.likes();\n\n if (likes && likes.length) {\n const limit = 4;\n const overLimit = likes.length > limit;\n\n // Construct a list of names of users who have liked this post. Make sure the\n // current user is first in the list, and cap a maximum of 4 items.\n const names = likes\n .sort((a) => (a === app.session.user ? -1 : 1))\n .slice(0, overLimit ? limit - 1 : limit)\n .map((user) => {\n return (\n <Link href={app.route.user(user)}>\n {user === app.session.user ? app.translator.trans('flarum-likes.forum.post.you_text') : username(user)}\n </Link>\n );\n });\n\n // If there are more users that we've run out of room to display, add a \"x\n // others\" name to the end of the list. Clicking on it will display a modal\n // with a full list of names.\n if (overLimit) {\n const count = likes.length - names.length;\n\n names.push(\n <a\n href=\"#\"\n onclick={(e) => {\n e.preventDefault();\n app.modal.show(PostLikesModal, { post });\n }}\n >\n {app.translator.trans('flarum-likes.forum.post.others_link', { count })}\n </a>\n );\n }\n\n items.add(\n 'liked',\n <div className=\"Post-likedBy\">\n {icon('far fa-thumbs-up')}\n {app.translator.trans('flarum-likes.forum.post.liked_by' + (likes[0] === app.session.user ? '_self' : '') + '_text', {\n count: names.length,\n users: punctuateSeries(names),\n })}\n </div>\n );\n }\n });\n}\n"],"sourceRoot":""}