From da38acf76ab0b50734fa78eb3c636da9f27b3b60 Mon Sep 17 00:00:00 2001 From: Marco Colia Date: Fri, 18 Mar 2022 08:16:38 +0100 Subject: [PATCH] fix for settings --- js/dist/forum.js | 2 +- js/dist/forum.js.map | 2 +- js/src/forum/index.js | 24 +++++++++++++++++++----- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/js/dist/forum.js b/js/dist/forum.js index bedbd79..786f0c1 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -(()=>{var t={n:o=>{var e=o&&o.__esModule?()=>o.default:()=>o;return t.d(e,{a:e}),e},d:(o,e)=>{for(var n in e)t.o(e,n)&&!t.o(o,n)&&Object.defineProperty(o,n,{enumerable:!0,get:e[n]})},o:(t,o)=>Object.prototype.hasOwnProperty.call(t,o),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},o={};(()=>{"use strict";t.r(o);const e=flarum.core.compat["forum/app"];var n=t.n(e);const r=flarum.core.compat["forum/components/DiscussionList"];var s=t.n(r);const a=flarum.core.compat["common/extend"],d=flarum.core.compat["forum/components/IndexPage"];var i=t.n(d);n().initializers.add("justoverclock/random-post",(function(){(0,a.extend)(s().prototype,"oncreate",(function(){var t=this;n().current.matches(i())&&(n().store.find("posts",{include:"discussion,user"}).then((function(o){t.randomPost=o[Math.floor(Math.random()*o.length)],document.getElementById("random-post-text").innerHTML=t.randomPost.data.attributes.contentHtml.replace(/<\/?[^>]+(>|$)/g,"").substr(0,280);var e=document.getElementById("random-post-author"),r=n().route.user(t.randomPost.user()),s=t.randomPost.user().displayName(),a=t.randomPost.discussion().data.attributes.title,d=n().route.discussion(t.randomPost.discussion());e.innerHTML=""+s+" in the "+a+" "})),window.addEventListener("DOMContentLoaded",(function(t){var o=document.querySelectorAll(".DiscussionListItem").item(0);console.log(o);var e=document.createElement("div");e.innerHTML='
\n

\n
',o.appendChild(e)})))})),(0,a.extend)(s().prototype,"oncreate",(function(){var t=this;n().current.matches(i())&&(n().store.find("posts",{include:"discussion,user"}).then((function(o){m.redraw(),t.randomPost=o[Math.floor(Math.random()*o.length)],document.getElementById("random-post-text-two").innerHTML=t.randomPost.data.attributes.contentHtml.replace(/<\/?[^>]+(>|$)/g,"").substr(0,280);var e=document.getElementById("random-post-author-two"),r=n().route.user(t.randomPost.user()),s=t.randomPost.user().displayName(),a=t.randomPost.discussion().data.attributes.title,d=n().route.discussion(t.randomPost.discussion());e.innerHTML=""+s+" in the "+a+" "})),window.addEventListener("DOMContentLoaded",(function(t){var o=document.querySelectorAll(".DiscussionListItem").item(4);console.log(o);var e=document.createElement("div");e.innerHTML='
\n

\n
',o.appendChild(e)})))})),(0,a.extend)(s().prototype,"oncreate",(function(){var t=this;n().current.matches(i())&&(n().store.find("posts",{include:"discussion,user"}).then((function(o){m.redraw(),t.randomPost=o[Math.floor(Math.random()*o.length)],document.getElementById("random-post-text-three").innerHTML=t.randomPost.data.attributes.contentHtml.replace(/<\/?[^>]+(>|$)/g,"").substr(0,280);var e=document.getElementById("random-post-author-three"),r=n().route.user(t.randomPost.user()),s=t.randomPost.user().displayName(),a=t.randomPost.discussion().data.attributes.title,d=n().route.discussion(t.randomPost.discussion());e.innerHTML=""+s+" in the "+a+" "})),window.addEventListener("DOMContentLoaded",(function(t){var o=document.querySelectorAll(".DiscussionListItem").item(8);console.log(o);var e=document.createElement("div");e.innerHTML='
\n

\n
',o.appendChild(e)})))})),(0,a.extend)(s().prototype,"oncreate",(function(){var t=this;n().current.matches(i())&&(n().store.find("posts",{include:"discussion,user"}).then((function(o){m.redraw(),t.randomPost=o[Math.floor(Math.random()*o.length)],document.getElementById("random-post-text-four").innerHTML=t.randomPost.data.attributes.contentHtml.replace(/<\/?[^>]+(>|$)/g,"").substr(0,280);var e=document.getElementById("random-post-author-four"),r=n().route.user(t.randomPost.user()),s=t.randomPost.user().displayName(),a=t.randomPost.discussion().data.attributes.title,d=n().route.discussion(t.randomPost.discussion());e.innerHTML=""+s+" in the "+a+" "})),window.addEventListener("DOMContentLoaded",(function(t){var o=document.querySelectorAll(".DiscussionListItem").item(12);console.log(o);var e=document.createElement("div");e.innerHTML='
\n

\n
',o.appendChild(e)})))})),(0,a.extend)(s().prototype,"oncreate",(function(){var t=this;n().current.matches(i())&&(n().store.find("posts",{include:"discussion,user"}).then((function(o){m.redraw(),t.randomPost=o[Math.floor(Math.random()*o.length)],document.getElementById("random-post-text-five").innerHTML=t.randomPost.data.attributes.contentHtml.replace(/<\/?[^>]+(>|$)/g,"").substr(0,280);var e=document.getElementById("random-post-author-five"),r=n().route.user(t.randomPost.user()),s=t.randomPost.user().displayName(),a=t.randomPost.discussion().data.attributes.title,d=n().route.discussion(t.randomPost.discussion());e.innerHTML=""+s+" in the "+a+" "})),window.addEventListener("DOMContentLoaded",(function(t){var o=document.querySelectorAll(".DiscussionListItem").item(16);console.log(o);var e=document.createElement("div");e.innerHTML='
\n

\n
',o.appendChild(e)})))}))}))})(),module.exports=o})(); +(()=>{var t={n:o=>{var e=o&&o.__esModule?()=>o.default:()=>o;return t.d(e,{a:e}),e},d:(o,e)=>{for(var n in e)t.o(e,n)&&!t.o(o,n)&&Object.defineProperty(o,n,{enumerable:!0,get:e[n]})},o:(t,o)=>Object.prototype.hasOwnProperty.call(t,o),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},o={};(()=>{"use strict";t.r(o);const e=flarum.core.compat["forum/app"];var n=t.n(e);const r=flarum.core.compat["forum/components/DiscussionList"];var s=t.n(r);const a=flarum.core.compat["common/extend"],d=flarum.core.compat["forum/components/IndexPage"];var i=t.n(d);n().initializers.add("justoverclock/random-post",(function(){(0,a.extend)(s().prototype,"oncreate",(function(){var t=this;if(n().current.matches(i())){var o=n().forum.attribute("justoverclock-random-post.charLimitRandomPost")||280;n().store.find("posts",{include:"discussion,user"}).then((function(e){t.randomPost=e[Math.floor(Math.random()*e.length)],document.getElementById("random-post-text").innerHTML=t.randomPost.data.attributes.contentHtml.replace(/<\/?[^>]+(>|$)/g,"").substr(0,o);var r=document.getElementById("random-post-author"),s=n().route.user(t.randomPost.user()),a=t.randomPost.user().displayName(),d=t.randomPost.discussion().data.attributes.title,i=n().route.discussion(t.randomPost.discussion());r.innerHTML=""+a+" in the "+d+" "})),window.addEventListener("DOMContentLoaded",(function(t){var o=document.querySelectorAll(".DiscussionListItem").item(0);console.log(o);var e=document.createElement("div");e.innerHTML='
\n

\n
',o.appendChild(e)}))}})),(0,a.extend)(s().prototype,"oncreate",(function(){var t=this;if(n().current.matches(i())){var o=n().forum.attribute("justoverclock-random-post.charLimitRandomPost")||280;n().store.find("posts",{include:"discussion,user"}).then((function(e){m.redraw(),t.randomPost=e[Math.floor(Math.random()*e.length)],document.getElementById("random-post-text-two").innerHTML=t.randomPost.data.attributes.contentHtml.replace(/<\/?[^>]+(>|$)/g,"").substr(0,o);var r=document.getElementById("random-post-author-two"),s=n().route.user(t.randomPost.user()),a=t.randomPost.user().displayName(),d=t.randomPost.discussion().data.attributes.title,i=n().route.discussion(t.randomPost.discussion());r.innerHTML=""+a+" in the "+d+" "})),window.addEventListener("DOMContentLoaded",(function(t){var o=document.querySelectorAll(".DiscussionListItem").item(4);console.log(o);var e=document.createElement("div");e.innerHTML='
\n

\n
',o.appendChild(e)}))}})),(0,a.extend)(s().prototype,"oncreate",(function(){var t=this;if(n().current.matches(i())){var o=n().forum.attribute("justoverclock-random-post.charLimitRandomPost")||280;n().store.find("posts",{include:"discussion,user"}).then((function(e){m.redraw(),t.randomPost=e[Math.floor(Math.random()*e.length)],document.getElementById("random-post-text-three").innerHTML=t.randomPost.data.attributes.contentHtml.replace(/<\/?[^>]+(>|$)/g,"").substr(0,o);var r=document.getElementById("random-post-author-three"),s=n().route.user(t.randomPost.user()),a=t.randomPost.user().displayName(),d=t.randomPost.discussion().data.attributes.title,i=n().route.discussion(t.randomPost.discussion());r.innerHTML=""+a+" in the "+d+" "})),window.addEventListener("DOMContentLoaded",(function(t){var o=document.querySelectorAll(".DiscussionListItem").item(8);console.log(o);var e=document.createElement("div");e.innerHTML='
\n

\n
',o.appendChild(e)}))}})),(0,a.extend)(s().prototype,"oncreate",(function(){var t=this;if(n().current.matches(i())){var o=n().forum.attribute("justoverclock-random-post.charLimitRandomPost")||280;n().store.find("posts",{include:"discussion,user"}).then((function(e){m.redraw(),t.randomPost=e[Math.floor(Math.random()*e.length)],document.getElementById("random-post-text-four").innerHTML=t.randomPost.data.attributes.contentHtml.replace(/<\/?[^>]+(>|$)/g,"").substr(0,o);var r=document.getElementById("random-post-author-four"),s=n().route.user(t.randomPost.user()),a=t.randomPost.user().displayName(),d=t.randomPost.discussion().data.attributes.title,i=n().route.discussion(t.randomPost.discussion());r.innerHTML=""+a+" in the "+d+" "})),window.addEventListener("DOMContentLoaded",(function(t){var o=document.querySelectorAll(".DiscussionListItem").item(12);console.log(o);var e=document.createElement("div");e.innerHTML='
\n

\n
',o.appendChild(e)}))}})),(0,a.extend)(s().prototype,"oncreate",(function(){var t=this;if(n().current.matches(i())){var o=n().forum.attribute("justoverclock-random-post.charLimitRandomPost")||280;n().store.find("posts",{include:"discussion,user"}).then((function(e){m.redraw(),t.randomPost=e[Math.floor(Math.random()*e.length)],document.getElementById("random-post-text-five").innerHTML=t.randomPost.data.attributes.contentHtml.replace(/<\/?[^>]+(>|$)/g,"").substr(0,o);var r=document.getElementById("random-post-author-five"),s=n().route.user(t.randomPost.user()),a=t.randomPost.user().displayName(),d=t.randomPost.discussion().data.attributes.title,i=n().route.discussion(t.randomPost.discussion());r.innerHTML=""+a+" in the "+d+" "})),window.addEventListener("DOMContentLoaded",(function(t){var o=document.querySelectorAll(".DiscussionListItem").item(16);console.log(o);var e=document.createElement("div");e.innerHTML='
\n

\n
',o.appendChild(e)}))}}))}))})(),module.exports=o})(); //# sourceMappingURL=forum.js.map \ No newline at end of file diff --git a/js/dist/forum.js.map b/js/dist/forum.js.map index facd948..7c383fa 100644 --- a/js/dist/forum.js.map +++ b/js/dist/forum.js.map @@ -1 +1 @@ -{"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,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3ER,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,M,+BCLvD,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,mC,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,8B,aCKxDC,IAAAA,aAAAA,IAAqB,6BAA6B,YAClDC,EAAAA,EAAAA,QAAOC,IAAAA,UAA0B,YAAY,WAAY,WACjDF,IAAAA,QAAAA,QAAoBG,OAEtBH,IAAAA,MAAAA,KACQ,QAAS,CACbI,QAAS,oBAEVC,MAAK,SAACC,GAEL,EAAKC,WAAaD,EAAQE,KAAKC,MAAMD,KAAKE,SAAWJ,EAAQK,SAErCC,SAASC,eAAe,oBAChCC,UAAY,EAAKP,WAAWQ,KAAKC,WAAWC,YAAYC,QAAQ,kBAAmB,IAAIC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EI,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 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, 280);\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 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\n const randomPostTitle = document.getElementById('random-post-text-two');\n randomPostTitle.innerHTML = this.randomPost.data.attributes.contentHtml.replace(/<\\/?[^>]+(>|$)/g, '').substr(0, 280);\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 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-three');\n randomPostTitle.innerHTML = this.randomPost.data.attributes.contentHtml.replace(/<\\/?[^>]+(>|$)/g, '').substr(0, 280);\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 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-four');\n randomPostTitle.innerHTML = this.randomPost.data.attributes.contentHtml.replace(/<\\/?[^>]+(>|$)/g, '').substr(0, 280);\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 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 = `${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 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,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3ER,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,M,+BCLvD,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,mC,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,8B,aCKxDC,IAAAA,aAAAA,IAAqB,6BAA6B,YAClDC,EAAAA,EAAAA,QAAOC,IAAAA,UAA0B,YAAY,WAAY,WACrD,GAAIF,IAAAA,QAAAA,QAAoBG,KAAY,CAElC,IAAMC,EAAUJ,IAAAA,MAAAA,UAAoB,kDAAoD,IAExFA,IAAAA,MAAAA,KACQ,QAAS,CACbK,QAAS,oBAEVC,MAAK,SAACC,GAEL,EAAKC,WAAaD,EAAQE,KAAKC,MAAMD,KAAKE,SAAWJ,EAAQK,SAErCC,SAASC,eAAe,oBA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Q,KAAKC,WAAWC,YAAYC,QAAQ,kBAAmB,IAAIC,OAAO,EAAGhB,GAEjH,IAAMiB,EAAeR,SAASC,eAAe,2BACvCQ,EAAOtB,IAAAA,MAAAA,KAAe,EAAKQ,WAAWe,QACtCA,EAAO,EAAKf,WAAWe,OAAOC,cAC9BC,EAAa,EAAKjB,WAAWiB,aAAaT,KAAKC,WAAWS,MAC1DC,EAAiB3B,IAAAA,MAAAA,WAAqB,EAAKQ,WAAWiB,cAC5DJ,EAAaN,UAAb,WAAoCO,EAApC,IAA4CC,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 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 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 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 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 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());