';\n firstEl.appendChild(newEl);\n });\n }\n });\n extend(DiscussionList.prototype, 'oncreate', function () {\n if (app.current.matches(IndexPage)) {\n app.store\n .find('posts', {\n include: 'discussion,user',\n })\n .then((results) => {\n m.redraw();\n this.randomPost = results[Math.floor(Math.random() * results.length)];\n\n const randomPostTitle = document.getElementById('random-post-text-five');\n randomPostTitle.innerHTML = this.randomPost.data.attributes.contentHtml.replace(/<\\/?[^>]+(>|$)/g, '').substr(0, 280);\n\n const randomAuthor = document.getElementById('random-post-author-five');\n const link = app.route.user(this.randomPost.user());\n const user = this.randomPost.user().displayName();\n const discussion = this.randomPost.discussion().data.attributes.title;\n const discussionLink = app.route.discussion(this.randomPost.discussion());\n randomAuthor.innerHTML = `
`;\n });\n\n window.addEventListener('DOMContentLoaded', (event) => {\n const elements = document.querySelectorAll('.DiscussionListItem');\n const firstEl = elements.item(16); //\n console.log(firstEl);\n\n const newEl = document.createElement('div');\n newEl.innerHTML =\n '
\\n' +\n '
\\n' +\n '
\\n' +\n '
\\n' +\n '
\\n' +\n '
' +\n '
';\n firstEl.appendChild(newEl);\n });\n }\n });\n});\n\n\n\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","app","extend","DiscussionList","IndexPage","include","then","results","randomPost","Math","floor","random","length","document","getElementById","innerHTML","data","attributes","contentHtml","replace","substr","randomAuthor","link","user","displayName","discussion","title","discussionLink","window","addEventListener","event","firstEl","querySelectorAll","item","console","log","newEl","createElement","appendChild","m","redraw"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRF,EAAwB,CAACM,EAASC,K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C,EAA5C,uBAAuEI,EAAvE,IAAyFF,EAAzF,WAGJG,OAAOC,iBAAiB,oBAAoB,SAACC,GAC3C,IACMC,EADWlB,SAASmB,iBAAiB,uBAClBC,KAAK,IAC9BC,QAAQC,IAAIJ,GAEZ,IAAMK,EAAQvB,SAASwB,cAAc,OACrCD,EAAMrB,UACJ,yRAOFgB,EAAQO,YAAYF,c","sources":["webpack://@justoverclock/random-post/webpack/bootstrap","webpack://@justoverclock/random-post/webpack/runtime/compat get default export","webpack://@justoverclock/random-post/webpack/runtime/define property getters","webpack://@justoverclock/random-post/webpack/runtime/hasOwnProperty shorthand","webpack://@justoverclock/random-post/webpack/runtime/make namespace object","webpack://@justoverclock/random-post/external root \"flarum.core.compat['forum/app']\"","webpack://@justoverclock/random-post/external root \"flarum.core.compat['forum/components/DiscussionList']\"","webpack://@justoverclock/random-post/external root \"flarum.core.compat['common/extend']\"","webpack://@justoverclock/random-post/external root \"flarum.core.compat['forum/components/IndexPage']\"","webpack://@justoverclock/random-post/./src/forum/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\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};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/IndexPage'];","import app from 'flarum/forum/app';\nimport DiscussionList from 'flarum/forum/components/DiscussionList';\nimport { extend } from 'flarum/common/extend';\nimport IndexPage from \"flarum/forum/components/IndexPage\";\n\napp.initializers.add('justoverclock/random-post', () => {\nextend(DiscussionList.prototype, 'oncreate', function () {\n if (app.current.matches(IndexPage)) {\n\n const charLim = app.forum.attribute('justoverclock-random-post.charLimitRandomPost') || 280;\n\n app.store\n .find('posts', {\n include: 'discussion,user',\n })\n .then((results) => {\n\n this.randomPost = results[Math.floor(Math.random() * results.length)];\n\n const randomPostTitle = document.getElementById('random-post-text');\n randomPostTitle.innerHTML = this.randomPost.data.attributes.contentHtml.replace(/<\\/?[^>]+(>|$)/g, '').substr(0, charLim);\n\n const randomAuthor = document.getElementById('random-post-author');\n const link = app.route.user(this.randomPost.user());\n const user = this.randomPost.user().displayName();\n const discussion = this.randomPost.discussion().data.attributes.title;\n const discussionLink = app.route.discussion(this.randomPost.discussion());\n randomAuthor.innerHTML = `
${user} in the
${discussion} `;\n });\n\n window.addEventListener('DOMContentLoaded', (event) => {\n const elements = document.querySelectorAll('.DiscussionListItem');\n const firstEl = elements.item(0); //\n console.log(firstEl);\n\n const newEl = document.createElement('div');\n newEl.innerHTML =\n '
\\n' +\n '
\\n' +\n '
\\n' +\n '
\\n' +\n '
\\n' +\n '
' +\n '
';\n firstEl.appendChild(newEl);\n });\n }\n });\n extend(DiscussionList.prototype, 'oncreate', function () {\n if (app.current.matches(IndexPage)) {\n\n const charLim = app.forum.attribute('justoverclock-random-post.charLimitRandomPost') || 280;\n\n app.store\n .find('posts', {\n include: 'discussion,user',\n })\n .then((results) => {\n m.redraw();\n this.randomPost = results[Math.floor(Math.random() * results.length)];\n\n\n const randomPostTitle = document.getElementById('random-post-text-two');\n randomPostTitle.innerHTML = this.randomPost.data.attributes.contentHtml.replace(/<\\/?[^>]+(>|$)/g, '').substr(0, charLim);\n\n const randomAuthor = document.getElementById('random-post-author-two');\n const link = app.route.user(this.randomPost.user());\n const user = this.randomPost.user().displayName();\n const discussion = this.randomPost.discussion().data.attributes.title;\n const discussionLink = app.route.discussion(this.randomPost.discussion());\n randomAuthor.innerHTML = `
${user} in the
${discussion} `;\n });\n\n window.addEventListener('DOMContentLoaded', (event) => {\n const elements = document.querySelectorAll('.DiscussionListItem');\n const firstEl = elements.item(4); //\n console.log(firstEl);\n\n const newEl = document.createElement('div');\n newEl.innerHTML =\n '
\\n' +\n '
\\n' +\n '
\\n' +\n '
\\n' +\n '
\\n' +\n '
' +\n '
';\n firstEl.appendChild(newEl);\n });\n }\n });\n extend(DiscussionList.prototype, 'oncreate', function () {\n if (app.current.matches(IndexPage)) {\n\n const charLim = app.forum.attribute('justoverclock-random-post.charLimitRandomPost') || 280;\n\n app.store\n .find('posts', {\n include: 'discussion,user',\n })\n .then((results) => {\n m.redraw();\n this.randomPost = results[Math.floor(Math.random() * results.length)];\n\n const randomPostTitle = document.getElementById('random-post-text-three');\n randomPostTitle.innerHTML = this.randomPost.data.attributes.contentHtml.replace(/<\\/?[^>]+(>|$)/g, '').substr(0, charLim);\n\n const randomAuthor = document.getElementById('random-post-author-three');\n const link = app.route.user(this.randomPost.user());\n const user = this.randomPost.user().displayName();\n const discussion = this.randomPost.discussion().data.attributes.title;\n const discussionLink = app.route.discussion(this.randomPost.discussion());\n randomAuthor.innerHTML = `
${user} in the
${discussion} `;\n });\n\n window.addEventListener('DOMContentLoaded', (event) => {\n const elements = document.querySelectorAll('.DiscussionListItem');\n const firstEl = elements.item(8); //\n console.log(firstEl);\n\n const newEl = document.createElement('div');\n newEl.innerHTML =\n '
\\n' +\n '
\\n' +\n '
\\n' +\n '
\\n' +\n '
\\n' +\n '
' +\n '
';\n firstEl.appendChild(newEl);\n });\n }\n });\n extend(DiscussionList.prototype, 'oncreate', function () {\n if (app.current.matches(IndexPage)) {\n\n const charLim = app.forum.attribute('justoverclock-random-post.charLimitRandomPost') || 280;\n\n app.store\n .find('posts', {\n include: 'discussion,user',\n })\n .then((results) => {\n m.redraw();\n this.randomPost = results[Math.floor(Math.random() * results.length)];\n\n const randomPostTitle = document.getElementById('random-post-text-four');\n randomPostTitle.innerHTML = this.randomPost.data.attributes.contentHtml.replace(/<\\/?[^>]+(>|$)/g, '').substr(0, charLim);\n\n const randomAuthor = document.getElementById('random-post-author-four');\n const link = app.route.user(this.randomPost.user());\n const user = this.randomPost.user().displayName();\n const discussion = this.randomPost.discussion().data.attributes.title;\n const discussionLink = app.route.discussion(this.randomPost.discussion());\n randomAuthor.innerHTML = `
${user} in the
${discussion} `;\n });\n\n window.addEventListener('DOMContentLoaded', (event) => {\n const elements = document.querySelectorAll('.DiscussionListItem');\n const firstEl = elements.item(12); //\n console.log(firstEl);\n\n const newEl = document.createElement('div');\n newEl.innerHTML =\n '
\\n' +\n '
\\n' +\n '
\\n' +\n '
\\n' +\n '
\\n' +\n '
' +\n '
';\n firstEl.appendChild(newEl);\n });\n }\n });\n extend(DiscussionList.prototype, 'oncreate', function () {\n if (app.current.matches(IndexPage)) {\n\n const charLim = app.forum.attribute('justoverclock-random-post.charLimitRandomPost') || 280;\n\n app.store\n .find('posts', {\n include: 'discussion,user',\n })\n .then((results) => {\n m.redraw();\n this.randomPost = results[Math.floor(Math.random() * results.length)];\n\n const randomPostTitle = document.getElementById('random-post-text-five');\n randomPostTitle.innerHTML = this.randomPost.data.attributes.contentHtml.replace(/<\\/?[^>]+(>|$)/g, '').substr(0, charLim);\n\n const randomAuthor = document.getElementById('random-post-author-five');\n const link = app.route.user(this.randomPost.user());\n const user = this.randomPost.user().displayName();\n const discussion = this.randomPost.discussion().data.attributes.title;\n const discussionLink = app.route.discussion(this.randomPost.discussion());\n randomAuthor.innerHTML = `
${user} in the
${discussion} `;\n });\n\n window.addEventListener('DOMContentLoaded', (event) => {\n const elements = document.querySelectorAll('.DiscussionListItem');\n const firstEl = elements.item(16); //\n console.log(firstEl);\n\n const newEl = document.createElement('div');\n newEl.innerHTML =\n '
\\n' +\n '
\\n' +\n '
\\n' +\n '
\\n' +\n '
\\n' +\n '
' +\n '
';\n firstEl.appendChild(newEl);\n });\n }\n });\n});\n\n\n\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","app","extend","DiscussionList","IndexPage","charLim","include","then","results","randomPost","Math","floor","random","length","document","getElementById","innerHTML","data","attributes","contentHtml","replace","substr","randomAuthor","link","user","displayName","discussion","title","discussionLink","window","addEventListener","event","firstEl","querySelectorAll","item","console","log","newEl","createElement","appendChild","m","redraw"],"sourceRoot":""}
\ No newline at end of file
diff --git a/js/src/forum/index.js b/js/src/forum/index.js
index 00c119e..455082c 100644
--- a/js/src/forum/index.js
+++ b/js/src/forum/index.js
@@ -7,6 +7,8 @@ app.initializers.add('justoverclock/random-post', () => {
extend(DiscussionList.prototype, 'oncreate', function () {
if (app.current.matches(IndexPage)) {
+ const charLim = app.forum.attribute('justoverclock-random-post.charLimitRandomPost') || 280;
+
app.store
.find('posts', {
include: 'discussion,user',
@@ -16,7 +18,7 @@ extend(DiscussionList.prototype, 'oncreate', function () {
this.randomPost = results[Math.floor(Math.random() * results.length)];
const randomPostTitle = document.getElementById('random-post-text');
- randomPostTitle.innerHTML = this.randomPost.data.attributes.contentHtml.replace(/<\/?[^>]+(>|$)/g, '').substr(0, 280);
+ randomPostTitle.innerHTML = this.randomPost.data.attributes.contentHtml.replace(/<\/?[^>]+(>|$)/g, '').substr(0, charLim);
const randomAuthor = document.getElementById('random-post-author');
const link = app.route.user(this.randomPost.user());
@@ -46,6 +48,9 @@ extend(DiscussionList.prototype, 'oncreate', function () {
});
extend(DiscussionList.prototype, 'oncreate', function () {
if (app.current.matches(IndexPage)) {
+
+ const charLim = app.forum.attribute('justoverclock-random-post.charLimitRandomPost') || 280;
+
app.store
.find('posts', {
include: 'discussion,user',
@@ -56,7 +61,7 @@ extend(DiscussionList.prototype, 'oncreate', function () {
const randomPostTitle = document.getElementById('random-post-text-two');
- randomPostTitle.innerHTML = this.randomPost.data.attributes.contentHtml.replace(/<\/?[^>]+(>|$)/g, '').substr(0, 280);
+ randomPostTitle.innerHTML = this.randomPost.data.attributes.contentHtml.replace(/<\/?[^>]+(>|$)/g, '').substr(0, charLim);
const randomAuthor = document.getElementById('random-post-author-two');
const link = app.route.user(this.randomPost.user());
@@ -86,6 +91,9 @@ extend(DiscussionList.prototype, 'oncreate', function () {
});
extend(DiscussionList.prototype, 'oncreate', function () {
if (app.current.matches(IndexPage)) {
+
+ const charLim = app.forum.attribute('justoverclock-random-post.charLimitRandomPost') || 280;
+
app.store
.find('posts', {
include: 'discussion,user',
@@ -95,7 +103,7 @@ extend(DiscussionList.prototype, 'oncreate', function () {
this.randomPost = results[Math.floor(Math.random() * results.length)];
const randomPostTitle = document.getElementById('random-post-text-three');
- randomPostTitle.innerHTML = this.randomPost.data.attributes.contentHtml.replace(/<\/?[^>]+(>|$)/g, '').substr(0, 280);
+ randomPostTitle.innerHTML = this.randomPost.data.attributes.contentHtml.replace(/<\/?[^>]+(>|$)/g, '').substr(0, charLim);
const randomAuthor = document.getElementById('random-post-author-three');
const link = app.route.user(this.randomPost.user());
@@ -125,6 +133,9 @@ extend(DiscussionList.prototype, 'oncreate', function () {
});
extend(DiscussionList.prototype, 'oncreate', function () {
if (app.current.matches(IndexPage)) {
+
+ const charLim = app.forum.attribute('justoverclock-random-post.charLimitRandomPost') || 280;
+
app.store
.find('posts', {
include: 'discussion,user',
@@ -134,7 +145,7 @@ extend(DiscussionList.prototype, 'oncreate', function () {
this.randomPost = results[Math.floor(Math.random() * results.length)];
const randomPostTitle = document.getElementById('random-post-text-four');
- randomPostTitle.innerHTML = this.randomPost.data.attributes.contentHtml.replace(/<\/?[^>]+(>|$)/g, '').substr(0, 280);
+ randomPostTitle.innerHTML = this.randomPost.data.attributes.contentHtml.replace(/<\/?[^>]+(>|$)/g, '').substr(0, charLim);
const randomAuthor = document.getElementById('random-post-author-four');
const link = app.route.user(this.randomPost.user());
@@ -164,6 +175,9 @@ extend(DiscussionList.prototype, 'oncreate', function () {
});
extend(DiscussionList.prototype, 'oncreate', function () {
if (app.current.matches(IndexPage)) {
+
+ const charLim = app.forum.attribute('justoverclock-random-post.charLimitRandomPost') || 280;
+
app.store
.find('posts', {
include: 'discussion,user',
@@ -173,7 +187,7 @@ extend(DiscussionList.prototype, 'oncreate', function () {
this.randomPost = results[Math.floor(Math.random() * results.length)];
const randomPostTitle = document.getElementById('random-post-text-five');
- randomPostTitle.innerHTML = this.randomPost.data.attributes.contentHtml.replace(/<\/?[^>]+(>|$)/g, '').substr(0, 280);
+ randomPostTitle.innerHTML = this.randomPost.data.attributes.contentHtml.replace(/<\/?[^>]+(>|$)/g, '').substr(0, charLim);
const randomAuthor = document.getElementById('random-post-author-five');
const link = app.route.user(this.randomPost.user());