framework/extensions/pusher/js/dist/forum.js.map
2018-09-21 01:03:43 +00:00

1 line
14 KiB
Plaintext

{"version":3,"sources":["webpack://@flarum/flarum-ext-pusher/webpack/bootstrap","webpack://@flarum/flarum-ext-pusher/external \"flarum.core.compat['app']\"","webpack://@flarum/flarum-ext-pusher/external \"flarum.core.compat['extend']\"","webpack://@flarum/flarum-ext-pusher/external \"flarum.core.compat['components/DiscussionList']\"","webpack://@flarum/flarum-ext-pusher/external \"flarum.core.compat['components/IndexPage']\"","webpack://@flarum/flarum-ext-pusher/external \"flarum.core.compat['components/DiscussionPage']\"","webpack://@flarum/flarum-ext-pusher/external \"flarum.core.compat['components/Button']\"","webpack://@flarum/flarum-ext-pusher/./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","app","initializers","add","loadPusher","deferred","$","getScript","socket","Pusher","forum","attribute","authEndpoint","cluster","auth","headers","X-CSRF-Token","session","csrfToken","resolve","main","subscribe","user","id","pusher","promise","pushedUpdates","extend","DiscussionList","x","isInitialized","context","_this","this","then","channels","data","params","props","q","sort","filter","tags","tag","store","getBy","tagIds","indexOf","String","discussionId","current","discussion","push","IndexPage","setTitleCount","length","redraw","unbind","vdom","_this2","count","children","unshift","Button","component","className","onclick","refresh","loadingUpdated","loading","translator","transChoice","returned","index","splice","DiscussionPage","_this3","stream","oldCount","commentsCount","find","update","document","hasFocus","Math","max","window","one","items","remove","pushAttributes","unreadNotificationsCount","newNotificationsCount","cache","notifications"],"mappings":"2BACA,IAAAA,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,IACAG,EAAAH,EACAI,GAAA,EACAH,YAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC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T,EAAKzB,WAAW4B,gBAAkBD,IAEhExE,EAAEgF,QAAQC,IAAI,QAAS,kBAAMtF,IAAIqD,cAAc,WAMvD3B,iBAAOI,EAAS,WAAY,kBAAMI,EAASf,KAAKqC,OAAO,iBAI3D9B,iBAAO0B,IAAU3D,UAAW,cAAe,SAAA8F,GACzCA,EAAMC,OAAO,aAGfxF,IAAIuB,OAAOU,KAAK,SAAAC,GACVA,EAASb,MACXa,EAASb,KAAKhC,KAAK,eAAgB,WACjCW,IAAIgB,QAAQK,KAAKoE,gBACfC,yBAA0B1F,IAAIgB,QAAQK,KAAKqE,2BAA6B,EACxEC,sBAAuB3F,IAAIgB,QAAQK,KAAKsE,wBAA0B,WAE7D3F,IAAI4F,MAAMC,cACjB5H,EAAEsF","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 = 8);\n","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['components/DiscussionList'];","module.exports = flarum.core.compat['components/IndexPage'];","module.exports = flarum.core.compat['components/DiscussionPage'];","module.exports = flarum.core.compat['components/Button'];","/*global Pusher*/\n\nimport { extend } from 'flarum/extend';\nimport app from 'flarum/app';\nimport DiscussionList from 'flarum/components/DiscussionList';\nimport DiscussionPage from 'flarum/components/DiscussionPage';\nimport IndexPage from 'flarum/components/IndexPage';\nimport Button from 'flarum/components/Button';\n\napp.initializers.add('flarum-pusher', () => {\n const loadPusher = m.deferred();\n\n $.getScript('//js.pusher.com/3.0/pusher.min.js', () => {\n const socket = new Pusher(app.forum.attribute('pusherKey'), {\n authEndpoint: app.forum.attribute('apiUrl') + '/pusher/auth',\n cluster: app.forum.attribute('pusherCluster'),\n auth: {\n headers: {\n 'X-CSRF-Token': app.session.csrfToken\n }\n }\n });\n\n loadPusher.resolve({\n main: socket.subscribe('public'),\n user: app.session.user ? socket.subscribe('private-user' + app.session.user.id()) : null\n });\n });\n\n app.pusher = loadPusher.promise;\n app.pushedUpdates = [];\n\n extend(DiscussionList.prototype, 'config', function(x, isInitialized, context) {\n if (isInitialized) return;\n\n app.pusher.then(channels => {\n channels.main.bind('newPost', data => {\n const params = this.props.params;\n\n if (!params.q && !params.sort && !params.filter) {\n if (params.tags) {\n const tag = app.store.getBy('tags', 'slug', params.tags);\n\n if (data.tagIds.indexOf(tag.id()) === -1) return;\n }\n\n const id = String(data.discussionId);\n\n if ((!app.current.discussion || id !== app.current.discussion.id()) && app.pushedUpdates.indexOf(id) === -1) {\n app.pushedUpdates.push(id);\n\n if (app.current instanceof IndexPage) {\n app.setTitleCount(app.pushedUpdates.length);\n }\n\n m.redraw();\n }\n }\n });\n\n extend(context, 'onunload', () => channels.main.unbind('newPost'));\n });\n });\n\n extend(DiscussionList.prototype, 'view', function(vdom) {\n if (app.pushedUpdates) {\n const count = app.pushedUpdates.length;\n\n if (count) {\n vdom.children.unshift(\n Button.component({\n className: 'Button Button--block DiscussionList-update',\n onclick: () => {\n this.refresh(false).then(() => {\n this.loadingUpdated = false;\n app.pushedUpdates = [];\n app.setTitleCount(0);\n m.redraw();\n });\n this.loadingUpdated = true;\n },\n loading: this.loadingUpdated,\n children: app.translator.transChoice('flarum-pusher.forum.discussion_list.show_updates_text', count, {count})\n })\n );\n }\n }\n });\n\n // Prevent any newly-created discussions from triggering the discussion list\n // update button showing.\n // TODO: Might be better pause the response to the push updates while the\n // composer is loading? idk\n extend(DiscussionList.prototype, 'addDiscussion', function(returned, discussion) {\n const index = app.pushedUpdates.indexOf(discussion.id());\n\n if (index !== -1) {\n app.pushedUpdates.splice(index, 1);\n }\n\n if (app.current instanceof IndexPage) {\n app.setTitleCount(app.pushedUpdates.length);\n }\n\n m.redraw();\n });\n\n extend(DiscussionPage.prototype, 'config', function(x, isInitialized, context) {\n if (isInitialized) return;\n\n app.pusher.then(channels => {\n channels.main.bind('newPost', data => {\n const id = String(data.discussionId);\n\n if (this.discussion && this.discussion.id() === id && this.stream) {\n const oldCount = this.discussion.commentsCount();\n\n app.store.find('discussions', this.discussion.id()).then(() => {\n this.stream.update();\n\n if (!document.hasFocus()) {\n app.setTitleCount(Math.max(0, this.discussion.commentsCount() - oldCount));\n\n $(window).one('focus', () => app.setTitleCount(0));\n }\n });\n }\n });\n\n extend(context, 'onunload', () => channels.main.unbind('newPost'));\n });\n });\n\n extend(IndexPage.prototype, 'actionItems', items => {\n items.remove('refresh');\n });\n\n app.pusher.then(channels => {\n if (channels.user) {\n channels.user.bind('notification', () => {\n app.session.user.pushAttributes({\n unreadNotificationsCount: app.session.user.unreadNotificationsCount() + 1,\n newNotificationsCount: app.session.user.newNotificationsCount() + 1\n });\n delete app.cache.notifications;\n m.redraw();\n });\n }\n });\n});\n"],"sourceRoot":""}