From 2fea567284e61c0deca598af701a7ac442652663 Mon Sep 17 00:00:00 2001 From: flarum-bot Date: Tue, 11 Jan 2022 10:41:36 +0000 Subject: [PATCH] Bundled output for commit 542fac888d3aa5eedc9d437381caf101e8e4c1a5 Includes transpiled JS/TS. [skip ci] --- extensions/likes/js/dist/admin.js | 2 +- extensions/likes/js/dist/admin.js.map | 2 +- extensions/likes/js/dist/forum.js | 2 +- extensions/likes/js/dist/forum.js.map | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/likes/js/dist/admin.js b/extensions/likes/js/dist/admin.js index 67f3a0902..c11b42840 100644 --- a/extensions/likes/js/dist/admin.js +++ b/extensions/likes/js/dist/admin.js @@ -1,2 +1,2 @@ -module.exports=function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=17)}({0:function(e,r){e.exports=flarum.core.compat.app},1:function(e,r){e.exports=flarum.core.compat.extend},15:function(e,r){e.exports=flarum.core.compat["components/PermissionGrid"]},17:function(e,r,t){"use strict";t.r(r);t(1);var n=t(0),o=t.n(n);t(15);o.a.initializers.add("flarum-likes",(function(){o.a.extensionData.for("flarum-likes").registerPermission({icon:"far fa-thumbs-up",label:o.a.translator.trans("flarum-likes.admin.permissions.like_posts_label"),permission:"discussion.likePosts"},"reply")}))}}); +module.exports=function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=17)}({17:function(e,r,t){"use strict";t.r(r);var n=t(5),o=t.n(n);o.a.initializers.add("flarum-likes",(function(){o.a.extensionData.for("flarum-likes").registerPermission({icon:"far fa-thumbs-up",label:o.a.translator.trans("flarum-likes.admin.permissions.like_posts_label"),permission:"discussion.likePosts"},"reply")}))},5:function(e,r){e.exports=flarum.core.compat["admin/app"]}}); //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/extensions/likes/js/dist/admin.js.map b/extensions/likes/js/dist/admin.js.map index 8910b0115..1972b9334 100644 --- a/extensions/likes/js/dist/admin.js.map +++ b/extensions/likes/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://@flarum/likes/webpack/bootstrap","webpack://@flarum/likes/external \"flarum.core.compat['app']\"","webpack://@flarum/likes/external \"flarum.core.compat['extend']\"","webpack://@flarum/likes/external \"flarum.core.compat['components/PermissionGrid']\"","webpack://@flarum/likes/./src/admin/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","app","initializers","add","extensionData","registerPermission","icon","label","translator","trans","permission"],"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,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOrB,EAAoBU,EAAEe,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIRzB,EAAoB6B,EAAI,SAAS1B,GAChC,IAAIS,EAAST,GAAUA,EAAOqB,WAC7B,WAAwB,OAAOrB,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAH,EAAoBU,EAAEE,EAAQ,IAAKA,GAC5BA,GAIRZ,EAAoBa,EAAI,SAASiB,EAAQC,GAAY,OAAOjB,OAAOkB,UAAUC,eAAe1B,KAAKuB,EAAQC,IAGzG/B,EAAoBkC,EAAI,GAIjBlC,EAAoBA,EAAoBmC,EAAI,I,kBClFrDhC,EAAOD,QAAUkC,OAAOC,KAAKC,OAAY,K,gBCAzCnC,EAAOD,QAAUkC,OAAOC,KAAKC,OAAe,Q,iBCA5CnC,EAAOD,QAAUkC,OAAOC,KAAKC,OAAO,8B,sECIpCC,IAAIC,aAAaC,IAAI,gBAAgB,WACnCF,IAAIG,cAAJ,IACO,gBACJC,mBAAmB,CAClBC,KAAM,mBACNC,MAAON,IAAIO,WAAWC,MAAM,mDAC5BC,WAAY,wBACX","file":"admin.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 = 17);\n","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['components/PermissionGrid'];","import { extend } from 'flarum/extend';\nimport app from 'flarum/app';\nimport PermissionGrid from 'flarum/components/PermissionGrid';\n\napp.initializers.add('flarum-likes', () => {\n app.extensionData\n .for('flarum-likes')\n .registerPermission({\n icon: 'far fa-thumbs-up',\n label: app.translator.trans('flarum-likes.admin.permissions.like_posts_label'),\n permission: 'discussion.likePosts'\n }, 'reply');\n});\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@flarum/likes/webpack/bootstrap","webpack://@flarum/likes/./src/admin/index.ts","webpack://@flarum/likes/external \"flarum.core.compat['admin/app']\""],"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","app","initializers","add","extensionData","registerPermission","icon","label","translator","trans","permission","flarum","core","compat"],"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,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOrB,EAAoBU,EAAEe,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIRzB,EAAoB6B,EAAI,SAAS1B,GAChC,IAAIS,EAAST,GAAUA,EAAOqB,WAC7B,WAAwB,OAAOrB,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAH,EAAoBU,EAAEE,EAAQ,IAAKA,GAC5BA,GAIRZ,EAAoBa,EAAI,SAASiB,EAAQC,GAAY,OAAOjB,OAAOkB,UAAUC,eAAe1B,KAAKuB,EAAQC,IAGzG/B,EAAoBkC,EAAI,GAIjBlC,EAAoBA,EAAoBmC,EAAI,I,6DChFrDC,IAAIC,aAAaC,IAAI,gBAAgB,WACnCF,IAAIG,cAAJ,IAAsB,gBAAgBC,mBACpC,CACEC,KAAM,mBACNC,MAAON,IAAIO,WAAWC,MAAM,mDAC5BC,WAAY,wBAEd,a,gBCTJ1C,EAAOD,QAAU4C,OAAOC,KAAKC,OAAO","file":"admin.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 = 17);\n","import app from 'flarum/admin/app';\n\napp.initializers.add('flarum-likes', () => {\n app.extensionData.for('flarum-likes').registerPermission(\n {\n icon: 'far fa-thumbs-up',\n label: app.translator.trans('flarum-likes.admin.permissions.like_posts_label'),\n permission: 'discussion.likePosts',\n },\n 'reply'\n );\n});\n","module.exports = flarum.core.compat['admin/app'];"],"sourceRoot":""} \ No newline at end of file diff --git a/extensions/likes/js/dist/forum.js b/extensions/likes/js/dist/forum.js index c0914ea53..f0d973cc0 100644 --- a/extensions/likes/js/dist/forum.js +++ b/extensions/likes/js/dist/forum.js @@ -1,2 +1,2 @@ -module.exports=function(t){var e={};function o(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=t,o.c=e,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=16)}([function(t,e){t.exports=flarum.core.compat.app},function(t,e){t.exports=flarum.core.compat.extend},function(t,e){t.exports=flarum.core.compat["components/CommentPost"]},function(t,e){t.exports=flarum.core.compat["components/Link"]},function(t,e){t.exports=flarum.core.compat["helpers/username"]},function(t,e){t.exports=flarum.core.compat["models/Post"]},function(t,e){t.exports=flarum.core.compat.Model},function(t,e){t.exports=flarum.core.compat["components/NotificationGrid"]},function(t,e){t.exports=flarum.core.compat["components/Button"]},function(t,e){t.exports=flarum.core.compat["helpers/punctuateSeries"]},function(t,e){t.exports=flarum.core.compat["helpers/icon"]},function(t,e){t.exports=flarum.core.compat["components/Modal"]},function(t,e){t.exports=flarum.core.compat["helpers/avatar"]},function(t,e){t.exports=flarum.core.compat["components/Notification"]},function(t,e){t.exports=flarum.core.compat["utils/string"]},,function(t,e,o){"use strict";o.r(e);var n=o(1),r=o(0),a=o.n(r),s=o(5),i=o.n(s),u=o(6),c=o.n(u),l=o(7),f=o.n(l),p=o(8),d=o.n(p),k=o(2),h=o.n(k),y=o(3),b=o.n(y),x=o(9),v=o.n(x),_=o(4),j=o.n(_),O=o(10),g=o.n(O);function P(t,e){return(P=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function M(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,P(t,e)}var L=o(11),N=o.n(L),S=o(12),B=o.n(S),T=function(t){function e(){return t.apply(this,arguments)||this}M(e,t);var o=e.prototype;return o.className=function(){return"PostLikesModal Modal--small"},o.title=function(){return app.translator.trans("flarum-likes.forum.post_likes.title")},o.content=function(){return m("div",{className:"Modal-body"},m("ul",{className:"PostLikesModal-list"},this.attrs.post.likes().map((function(t){return m("li",null,m(b.a,{href:app.route.user(t)},B()(t)," "," ",j()(t)))}))))},e}(N.a),w=o(13),C=o.n(w),I=o(14),z=function(t){function e(){return t.apply(this,arguments)||this}M(e,t);var o=e.prototype;return o.icon=function(){return"far fa-thumbs-up"},o.href=function(){return app.route.post(this.attrs.notification.subject())},o.content=function(){var t=this.attrs.notification.fromUser();return app.translator.trans("flarum-likes.forum.notifications.post_liked_text",{user:t,count:1})},o.excerpt=function(){return Object(I.truncate)(this.attrs.notification.subject().contentPlain(),200)},e}(C.a);a.a.initializers.add("flarum-likes",(function(){a.a.notificationComponents.postLiked=z,i.a.prototype.canLike=c.a.attribute("canLike"),i.a.prototype.likes=c.a.hasMany("likes"),Object(n.extend)(h.a.prototype,"actionItems",(function(t){var e=this.attrs.post;if(!e.isHidden()&&e.canLike()){var o=e.likes(),n=a.a.session.user&&o&&o.some((function(t){return t===a.a.session.user}));t.add("like",d.a.component({className:"Button Button--link",onclick:function(){n=!n,e.save({isLiked:n});var t=e.data.relationships.likes.data;t.some((function(e,o){if(e.id===a.a.session.user.id())return t.splice(o,1),!0})),n&&t.unshift({type:"users",id:a.a.session.user.id()})}},a.a.translator.trans(n?"flarum-likes.forum.post.unlike_link":"flarum-likes.forum.post.like_link")))}})),Object(n.extend)(h.a.prototype,"footerItems",(function(t){var e=this.attrs.post,o=e.likes();if(o&&o.length){var n=o.length>4,r=o.sort((function(t){return t===a.a.session.user?-1:1})).slice(0,n?3:4).map((function(t){return m(b.a,{href:a.a.route.user(t)},t===a.a.session.user?a.a.translator.trans("flarum-likes.forum.post.you_text"):j()(t))}));if(n){var s=o.length-r.length;r.push(m("a",{href:"#",onclick:function(t){t.preventDefault(),a.a.modal.show(T,{post:e})}},a.a.translator.trans("flarum-likes.forum.post.others_link",{count:s})))}t.add("liked",m("div",{className:"Post-likedBy"},g()("far fa-thumbs-up"),a.a.translator.trans("flarum-likes.forum.post.liked_by"+(o[0]===a.a.session.user?"_self":"")+"_text",{count:r.length,users:v()(r)})))}})),Object(n.extend)(f.a.prototype,"notificationTypes",(function(t){t.add("postLiked",{name:"postLiked",icon:"far fa-thumbs-up",label:a.a.translator.trans("flarum-likes.forum.settings.notify_post_liked_label")})}))}))}]); +module.exports=function(t){var o={};function n(e){if(o[e])return o[e].exports;var r=o[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=o,n.d=function(t,o,e){n.o(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:e})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,o){if(1&o&&(t=n(t)),8&o)return t;if(4&o&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(n.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&o&&"string"!=typeof t)for(var r in t)n.d(e,r,function(o){return t[o]}.bind(null,r));return e},n.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(o,"a",o),o},n.o=function(t,o){return Object.prototype.hasOwnProperty.call(t,o)},n.p="",n(n.s=16)}([function(t,o){t.exports=flarum.core.compat["forum/app"]},function(t,o){t.exports=flarum.core.compat["common/extend"]},function(t,o){t.exports=flarum.core.compat["forum/components/CommentPost"]},function(t,o){t.exports=flarum.core.compat["common/components/Link"]},function(t,o){t.exports=flarum.core.compat["common/helpers/username"]},,function(t,o){t.exports=flarum.core.compat["common/models/Post"]},function(t,o){t.exports=flarum.core.compat["common/Model"]},function(t,o){t.exports=flarum.core.compat["forum/components/NotificationGrid"]},function(t,o){t.exports=flarum.core.compat["common/components/Button"]},function(t,o){t.exports=flarum.core.compat["common/helpers/punctuateSeries"]},function(t,o){t.exports=flarum.core.compat["common/helpers/icon"]},function(t,o){t.exports=flarum.core.compat["common/components/Modal"]},function(t,o){t.exports=flarum.core.compat["common/helpers/avatar"]},function(t,o){t.exports=flarum.core.compat["forum/components/Notification"]},function(t,o){t.exports=flarum.core.compat["common/utils/string"]},function(t,o,n){"use strict";n.r(o);var e=n(1),r=n(0),a=n.n(r),s=n(6),i=n.n(s),u=n(7),c=n.n(u),f=n(8),l=n.n(f),p=n(9),d=n.n(p),k=n(2),h=n.n(k),y=n(3),b=n.n(y),x=n(10),v=n.n(x),_=n(4),j=n.n(_),O=n(11),g=n.n(O);function P(t,o){return(P=Object.setPrototypeOf||function(t,o){return t.__proto__=o,t})(t,o)}function M(t,o){t.prototype=Object.create(o.prototype),t.prototype.constructor=t,P(t,o)}var L=n(12),N=n.n(L),S=n(13),B=n.n(S),T=function(t){function o(){return t.apply(this,arguments)||this}M(o,t);var n=o.prototype;return n.className=function(){return"PostLikesModal Modal--small"},n.title=function(){return a.a.translator.trans("flarum-likes.forum.post_likes.title")},n.content=function(){return m("div",{className:"Modal-body"},m("ul",{className:"PostLikesModal-list"},this.attrs.post.likes().map((function(t){return m("li",null,m(b.a,{href:a.a.route.user(t)},B()(t)," ",j()(t)))}))))},o}(N.a),w=n(14),C=n.n(w),I=n(15),z=function(t){function o(){return t.apply(this,arguments)||this}M(o,t);var n=o.prototype;return n.icon=function(){return"far fa-thumbs-up"},n.href=function(){return a.a.route.post(this.attrs.notification.subject())},n.content=function(){var t=this.attrs.notification.fromUser();return a.a.translator.trans("flarum-likes.forum.notifications.post_liked_text",{user:t,count:1})},n.excerpt=function(){return Object(I.truncate)(this.attrs.notification.subject().contentPlain(),200)},o}(C.a);a.a.initializers.add("flarum-likes",(function(){a.a.notificationComponents.postLiked=z,i.a.prototype.canLike=c.a.attribute("canLike"),i.a.prototype.likes=c.a.hasMany("likes"),Object(e.extend)(h.a.prototype,"actionItems",(function(t){var o=this.attrs.post;if(!o.isHidden()&&o.canLike()){var n=o.likes(),e=a.a.session.user&&n&&n.some((function(t){return t===a.a.session.user}));t.add("like",d.a.component({className:"Button Button--link",onclick:function(){e=!e,o.save({isLiked:e});var t=o.data.relationships.likes.data;t.some((function(o,n){if(o.id===a.a.session.user.id())return t.splice(n,1),!0})),e&&t.unshift({type:"users",id:a.a.session.user.id()})}},a.a.translator.trans(e?"flarum-likes.forum.post.unlike_link":"flarum-likes.forum.post.like_link")))}})),Object(e.extend)(h.a.prototype,"footerItems",(function(t){var o=this.attrs.post,n=o.likes();if(n&&n.length){var e=n.length>4,r=n.sort((function(t){return t===a.a.session.user?-1:1})).slice(0,e?3:4).map((function(t){return m(b.a,{href:a.a.route.user(t)},t===a.a.session.user?a.a.translator.trans("flarum-likes.forum.post.you_text"):j()(t))}));if(e){var s=n.length-r.length;r.push(m("a",{href:"#",onclick:function(t){t.preventDefault(),a.a.modal.show(T,{post:o})}},a.a.translator.trans("flarum-likes.forum.post.others_link",{count:s})))}t.add("liked",m("div",{className:"Post-likedBy"},g()("far fa-thumbs-up"),a.a.translator.trans("flarum-likes.forum.post.liked_by"+(n[0]===a.a.session.user?"_self":"")+"_text",{count:r.length,users:v()(r)})))}})),Object(e.extend)(l.a.prototype,"notificationTypes",(function(t){t.add("postLiked",{name:"postLiked",icon:"far fa-thumbs-up",label:a.a.translator.trans("flarum-likes.forum.settings.notify_post_liked_label")})}))}))}]); //# sourceMappingURL=forum.js.map \ No newline at end of file diff --git a/extensions/likes/js/dist/forum.js.map b/extensions/likes/js/dist/forum.js.map index 7ea0f03bc..6a7b6cc92 100644 --- a/extensions/likes/js/dist/forum.js.map +++ b/extensions/likes/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://@flarum/likes/webpack/bootstrap","webpack://@flarum/likes/external \"flarum.core.compat['app']\"","webpack://@flarum/likes/external \"flarum.core.compat['extend']\"","webpack://@flarum/likes/external \"flarum.core.compat['components/CommentPost']\"","webpack://@flarum/likes/external \"flarum.core.compat['components/Link']\"","webpack://@flarum/likes/external \"flarum.core.compat['helpers/username']\"","webpack://@flarum/likes/external \"flarum.core.compat['models/Post']\"","webpack://@flarum/likes/external \"flarum.core.compat['Model']\"","webpack://@flarum/likes/external \"flarum.core.compat['components/NotificationGrid']\"","webpack://@flarum/likes/external \"flarum.core.compat['components/Button']\"","webpack://@flarum/likes/external \"flarum.core.compat['helpers/punctuateSeries']\"","webpack://@flarum/likes/external \"flarum.core.compat['helpers/icon']\"","webpack://@flarum/likes/external \"flarum.core.compat['components/Modal']\"","webpack://@flarum/likes/external \"flarum.core.compat['helpers/avatar']\"","webpack://@flarum/likes/external \"flarum.core.compat['components/Notification']\"","webpack://@flarum/likes/external \"flarum.core.compat['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,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CAAMC,KAAMV,IAAIW,MAAMF,KAAKA,IACxBA,IAAST,IAAIuC,QAAQ9B,KAAOT,IAAIC,WAAWC,MAAM,oCAAsCW,IAASJ,OAQzG,GAAI4C,EAAW,CACb,IAAMjC,EAAQb,EAAM6C,OAASE,EAAMF,OAEnCE,EAAMK,KACJ,OAAGjD,KAAK,IAAIiC,QAAS,SAAAiB,GACnBA,EAAEC,iBACF7D,IAAI8D,MAAMC,KAAKlE,EAAgB,CAACS,WAE/BN,IAAIC,WAAWC,MAAM,sCAAuC,CAACkB,YAKpEgB,EAAMV,IAAI,QACR,SAAK5B,UAAU,gBACZkB,IAAK,oBACLhB,IAAIC,WAAWC,MAAM,oCAAsCK,EAAM,KAAOP,IAAIuC,QAAQ9B,KAAO,QAAU,IAAM,QAAS,CACnHW,MAAOkC,EAAMF,OACbY,MAAOC,IAAgBX,WFjCjCpB,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['app'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['components/CommentPost'];","module.exports = flarum.core.compat['components/Link'];","module.exports = flarum.core.compat['helpers/username'];","module.exports = flarum.core.compat['models/Post'];","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['components/NotificationGrid'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['helpers/punctuateSeries'];","module.exports = flarum.core.compat['helpers/icon'];","module.exports = flarum.core.compat['components/Modal'];","module.exports = flarum.core.compat['helpers/avatar'];","module.exports = flarum.core.compat['components/Notification'];","module.exports = flarum.core.compat['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 Modal from 'flarum/components/Modal';\nimport Link from 'flarum/components/Link';\nimport avatar from 'flarum/helpers/avatar';\nimport username from 'flarum/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
\n \n
\n );\n }\n}\n","import Notification from 'flarum/components/Notification';\nimport { truncate } from 'flarum/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/extend';\nimport app from 'flarum/app';\nimport Post from 'flarum/models/Post';\nimport Model from 'flarum/Model';\nimport NotificationGrid from 'flarum/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/extend';\nimport app from 'flarum/app';\nimport Button from 'flarum/components/Button';\nimport CommentPost from 'flarum/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('like',\n Button.component({\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 }, app.translator.trans(isLiked ? 'flarum-likes.forum.post.unlike_link' : 'flarum-likes.forum.post.like_link'))\n );\n });\n}\n","import { extend } from 'flarum/extend';\nimport app from 'flarum/app';\nimport CommentPost from 'flarum/components/CommentPost';\nimport Link from 'flarum/components/Link';\nimport punctuateSeries from 'flarum/helpers/punctuateSeries';\nimport username from 'flarum/helpers/username';\nimport icon from 'flarum/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.sort(a => a === app.session.user ? -1 : 1)\n .slice(0, overLimit ? limit - 1 : limit)\n .map(user => {\n return (\n \n {user === app.session.user ? app.translator.trans('flarum-likes.forum.post.you_text') : username(user)}\n \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 {\n e.preventDefault();\n app.modal.show(PostLikesModal, {post});\n }}>\n {app.translator.trans('flarum-likes.forum.post.others_link', {count})}\n \n );\n }\n\n items.add('liked', (\n
\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
\n ));\n }\n });\n}\n"],"sourceRoot":""} \ No newline at end of file +{"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,EA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YK,EAPV,GAQXlD,KAAI,SAACC,GACJ,OACE,EAAC,IAAD,CAAMC,KAAMV,IAAIW,MAAMF,KAAKA,IACxBA,IAAST,IAAIuC,QAAQ9B,KAAOT,IAAIC,WAAWC,MAAM,oCAAsCW,IAASJ,OAQzG,GAAI4C,EAAW,CACb,IAAMjC,EAAQb,EAAM6C,OAASE,EAAMF,OAEnCE,EAAMK,KACJ,OACEjD,KAAK,IACLiC,QAAS,SAACiB,GACRA,EAAEC,iBACF7D,IAAI8D,MAAMC,KAAKlE,EAAgB,CAAES,WAGlCN,IAAIC,WAAWC,MAAM,sCAAuC,CAAEkB,YAKrEgB,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
\n \n
\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 \n {user === app.session.user ? app.translator.trans('flarum-likes.forum.post.you_text') : username(user)}\n \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 {\n e.preventDefault();\n app.modal.show(PostLikesModal, { post });\n }}\n >\n {app.translator.trans('flarum-likes.forum.post.others_link', { count })}\n \n );\n }\n\n items.add(\n 'liked',\n
\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
\n );\n }\n });\n}\n"],"sourceRoot":""} \ No newline at end of file