diff --git a/js/dist/admin.js b/js/dist/admin.js index 4612d14..3e07c0b 100644 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -1,2 +1,2 @@ -module.exports=function(t){var e={};function n(a){if(e[a])return e[a].exports;var i=e[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,a){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},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,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(a,i,function(e){return t[e]}.bind(null,i));return a},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=10)}([function(t,e){t.exports=flarum.core.compat["components/Button"]},function(t,e){t.exports=flarum.core.compat.Model},function(t,e){t.exports=flarum.core.compat.Component},function(t,e){t.exports=flarum.core.compat.app},function(t,e){t.exports=flarum.core.compat["utils/Stream"]},function(t,e){t.exports=flarum.core.compat["components/ExtensionPage"]},function(t,e){t.exports=flarum.core.compat["components/LoadingIndicator"]},function(t,e){t.exports=flarum.core.compat["components/Placeholder"]},function(t,e){t.exports=flarum.core.compat["components/Switch"]},function(t,e){t.exports=flarum.core.compat["components/Modal"]},function(t,e,n){"use strict";n.r(e);var a=n(3),i=n.n(a);function o(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var r=n(5),l=n.n(r),s=n(2),c=n.n(s),u=n(6),p=n.n(u),d=n(7),h=n.n(d),f=n(0),b=n.n(f),g=n(8),v=n.n(g),y=n(9),x=n.n(y),N=n(4),_=n.n(N),P=function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.item=this.attrs.item||app.store.createRecord("html-headers"),this.description=_()(this.item.description()||""),this.header=_()(this.item.header()||""),this.loading=!1},n.className=function(){return"Modal--medium"},n.title=function(){return this.item.exists?app.translator.trans("ianm-html-head.admin.modal.edit_title"):app.translator.trans("ianm-html-head.admin.modal.create_title")},n.content=function(){return m("div",{className:"Modal-body"},m("p",null,app.translator.trans("ianm-html-head.admin.modal.text")),m("div",{className:"Form-group"},m("label",{className:"label"},app.translator.trans("ianm-html-head.admin.modal.description_label")),m("input",{type:"text",className:"FormControl",bidi:this.description,required:!0})),m("div",{className:"Form-group"},m("label",{className:"label"},app.translator.trans("ianm-html-head.admin.modal.header_label")),m("input",{type:"text",className:"FormControl",bidi:this.header,required:!0,placeholder:''})),m("div",{className:"Form-group"},m(b.a,{className:"Button Button--primary",type:"submit",loading:this.loading},app.translator.trans("ianm-html-head.admin.modal.save_button"))))},n.onsubmit=function(t){if(t.preventDefault(),this.header()){this.loading=!0;var e={description:this.description(),header:this.header()};this.item.save(e).then(this.hide.bind(this),this.onerror.bind(this),this.loaded.bind(this))}},e}(x.a),w=function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.item=this.attrs.headItem},n.view=function(){var t=this;return m("tr",null,m("td",null,this.item.description()),m("td",null,m("code",null,this.item.header())),m("td",null,v.a.component({state:this.item.data.attributes.active,onchange:function(e){t.activeLoading=!0,app.request({method:"PATCH",url:app.forum.attribute("apiUrl")+"/html-headers/"+t.item.id(),body:{active:e}}).then((function(e){t.item.data=e.data,t.activeLoading=!1,m.redraw()}))},loading:this.activeLoading})),m("td",null,m("div",{className:"Button--group"},b.a.component({className:"Button Button--secondary",onclick:function(){return app.modal.show(P,{item:t.item})}},app.translator.trans("ianm-html-head.admin.table.edit_button")),b.a.component({className:"Button Button--danger",onclick:function(){t.deleting=!0,t.item.delete().then((function(){t.deleting=!1,m.redraw()}))},loading:this.deleting},app.translator.trans("ianm-html-head.admin.table.delete_button")))))},e}(c.a),B=function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.loading=!0,this.page=0,this.pageSize=20},n.oncreate=function(e){t.prototype.oncreate.call(this,e),this.refresh()},n.view=function(){var t,e;return!0===this.nextResults&&(t=b.a.component({className:"Button Button--PageList-next",icon:"fas fa-angle-right",onclick:this.loadNext.bind(this)})),!0===this.prevResults&&(e=b.a.component({className:"Button Button--PageList-prev",icon:"fas fa-angle-left",onclick:this.loadPrev.bind(this)})),m("div",null,m("div",{className:"HtmlHeadSettingsPage--controls"},b.a.component({className:"Button Button--primary",icon:"fas fa-plus",onclick:function(){return app.modal.show(P)}},app.translator.trans("ianm-html-head.admin.create_button"))),m("br",null),m("div",{className:"HtmlHeadSettingsPage-table"},this.loading?p.a.component():app.store.all("html-headers").length?m("table",{style:{width:"100%",textAlign:"left"},className:"table"},m("thead",null,m("tr",null,m("th",null,app.translator.trans("ianm-html-head.admin.table.description_label")),m("th",null,app.translator.trans("ianm-html-head.admin.table.header_label")),m("th",null,app.translator.trans("ianm-html-head.admin.table.active_label")),m("th",null))),m("tbody",null,app.store.all("html-headers").slice(this.page,this.page+this.pageSize).map((function(t){return w.component({headItem:t})})))):m("div",null,h.a.component({text:app.translator.trans("ianm-html-head.admin.table.empty_text")}))),m("div",null,t,e))},n.refresh=function(){return this.loadResults().then(this.parseResults.bind(this))},n.loadResults=function(){var t=this.page*this.pageSize;return app.store.find("html-headers",{page:{offset:t,limit:this.pageSize}})},n.loadNext=function(){!0===this.nextResults&&(this.page++,this.refresh())},n.loadPrev=function(){!0===this.prevResults&&(this.page--,this.refresh())},n.parseResults=function(t){this.loading=!1,this.nextResults=!!t.payload.links.next,this.prevResults=!!t.payload.links.prev,m.redraw()},e}(c.a),S=function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e)},n.content=function(){return[m("div",{className:"container"},m("div",{className:"HtmlHeadSettingsPage"},B.component()))]},e}(l.a);function R(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function j(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var O=n(1),k=n.n(O),M=function(t){function e(){for(var e,n=arguments.length,a=new Array(n),i=0;i'})),m("div",{className:"Form-group"},m(b.a,{className:"Button Button--primary",type:"submit",loading:this.loading},app.translator.trans("ianm-html-head.admin.modal.save_button"))))},n.onsubmit=function(t){if(t.preventDefault(),this.header()){this.loading=!0;var e={description:this.description(),header:this.header()};this.item.save(e).then(this.hide.bind(this),this.onerror.bind(this),this.loaded.bind(this))}},e}(x.a),w=function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.item=this.attrs.headItem},n.view=function(){var t=this;return m("tr",null,m("td",null,this.item.description()),m("td",null,m("code",null,this.item.header())),m("td",null,v.a.component({state:this.item.data.attributes.active,onchange:function(e){t.activeLoading=!0,app.request({method:"PATCH",url:app.forum.attribute("apiUrl")+"/html-headers/"+t.item.id(),body:{active:e}}).then((function(e){t.item.data=e.data,t.activeLoading=!1,m.redraw()}))},loading:this.activeLoading})),m("td",null,m("div",{className:"Button--group"},b.a.component({className:"Button Button--secondary",onclick:function(){return app.modal.show(P,{item:t.item})}},app.translator.trans("ianm-html-head.admin.table.edit_button")),b.a.component({className:"Button Button--danger",onclick:function(){t.deleting=!0,t.item.delete().then((function(){t.deleting=!1,m.redraw()}))},loading:this.deleting},app.translator.trans("ianm-html-head.admin.table.delete_button")))))},e}(c.a),B=function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.loading=!0,this.page=0,this.pageSize=20},n.oncreate=function(e){t.prototype.oncreate.call(this,e),this.refresh()},n.view=function(){var t,e;return!0===this.nextResults&&(t=b.a.component({className:"Button Button--PageList-next",icon:"fas fa-angle-right",onclick:this.loadNext.bind(this)})),!0===this.prevResults&&(e=b.a.component({className:"Button Button--PageList-prev",icon:"fas fa-angle-left",onclick:this.loadPrev.bind(this)})),m("div",null,m("div",{className:"HtmlHeadSettingsPage--controls"},b.a.component({className:"Button Button--primary",icon:"fas fa-plus",onclick:function(){return app.modal.show(P)}},app.translator.trans("ianm-html-head.admin.create_button"))),m("br",null),m("div",{className:"HtmlHeadSettingsPage-table"},this.loading?p.a.component():app.store.all("html-headers").length?m("table",{style:{width:"100%",textAlign:"left"},className:"table"},m("thead",null,m("tr",null,m("th",null,app.translator.trans("ianm-html-head.admin.table.description_label")),m("th",null,app.translator.trans("ianm-html-head.admin.table.header_label")),m("th",null,app.translator.trans("ianm-html-head.admin.table.active_label")),m("th",null))),m("tbody",null,app.store.all("html-headers").slice(this.page,this.page+this.pageSize).map((function(t){return w.component({headItem:t})})))):m("div",null,h.a.component({text:app.translator.trans("ianm-html-head.admin.table.empty_text")}))),m("div",null,t,e))},n.refresh=function(){return this.loadResults().then(this.parseResults.bind(this))},n.loadResults=function(){var t=this.page*this.pageSize;return app.store.find("html-headers",{page:{offset:t,limit:this.pageSize}})},n.loadNext=function(){!0===this.nextResults&&(this.page++,this.refresh())},n.loadPrev=function(){!0===this.prevResults&&(this.page--,this.refresh())},n.parseResults=function(t){this.loading=!1,this.nextResults=!!t.payload.links.next,this.prevResults=!!t.payload.links.prev,m.redraw()},e}(c.a),S=function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e)},n.content=function(){return[m("div",{className:"container"},m("div",{className:"HtmlHeadSettingsPage"},B.component()))]},e}(l.a);function R(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function j(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var O=n(1),k=n.n(O),M=function(t){function e(){for(var e,n=arguments.length,a=new Array(n),i=0;i\n

{app.translator.trans('ianm-html-head.admin.modal.text')}

\n\n
\n \n \n
\n\n
\n \n \n
\n\n
\n \n
\n \n );\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n if (!this.header()) return;\n\n this.loading = true;\n\n const attrs = {\n description: this.description(),\n header: this.header(),\n };\n\n this.item.save(attrs).then(this.hide.bind(this), this.onerror.bind(this), this.loaded.bind(this));\n }\n}\n","import Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport Switch from 'flarum/components/Switch';\nimport CreateHeadItemModal from './CreateHeadItemModal';\n\nexport default class HeadItemListItem extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.item = this.attrs.headItem;\n }\n\n view() {\n return (\n \n {this.item.description()}\n \n {this.item.header()}\n \n \n {Switch.component({\n state: this.item.data.attributes.active,\n onchange: (value) => {\n this.activeLoading = true;\n\n app.request({\n method: 'PATCH',\n url: `${app.forum.attribute('apiUrl')}/html-headers/${this.item.id()}`,\n body: {\n active: value,\n },\n }).then((response) => {\n this.item.data = response.data;\n this.activeLoading = false;\n\n m.redraw();\n });\n },\n loading: this.activeLoading,\n })}\n \n \n
\n {Button.component(\n {\n className: 'Button Button--secondary',\n onclick: () => app.modal.show(CreateHeadItemModal, {item: this.item}),\n },\n app.translator.trans('ianm-html-head.admin.table.edit_button')\n )}\n {Button.component(\n {\n className: 'Button Button--danger',\n onclick: () => {\n this.deleting = true;\n this.item.delete().then(() => {\n this.deleting = false;\n m.redraw();\n });\n },\n loading: this.deleting,\n },\n app.translator.trans('ianm-html-head.admin.table.delete_button')\n )}\n
\n \n \n );\n }\n}\n","import Component from 'flarum/Component';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport Placeholder from 'flarum/components/Placeholder';\nimport Button from 'flarum/components/Button';\nimport HeadItemListItem from './HeadItemListItem';\nimport CreateHeadItemModal from './CreateHeadItemModal';\n\nexport default class HeadItemList extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loading = true;\n\n this.page = 0;\n this.pageSize = 20;\n }\n\n oncreate(vnode) {\n super.oncreate(vnode);\n\n this.refresh();\n }\n\n view() {\n let next, prev;\n\n if (this.nextResults === true) {\n next = Button.component({\n className: 'Button Button--PageList-next',\n icon: 'fas fa-angle-right',\n onclick: this.loadNext.bind(this),\n });\n }\n\n if (this.prevResults === true) {\n prev = Button.component({\n className: 'Button Button--PageList-prev',\n icon: 'fas fa-angle-left',\n onclick: this.loadPrev.bind(this),\n });\n }\n\n return (\n
\n
\n {Button.component(\n {\n className: 'Button Button--primary',\n icon: 'fas fa-plus',\n onclick: () => app.modal.show(CreateHeadItemModal),\n },\n app.translator.trans('ianm-html-head.admin.create_button')\n )}\n
\n
\n
\n {this.loading ? (\n LoadingIndicator.component()\n ) : app.store.all('html-headers').length ? (\n \n \n \n \n \n \n \n \n \n {app.store\n .all('html-headers')\n .slice(this.page, this.page + this.pageSize)\n .map((headItem) => HeadItemListItem.component({ headItem }))}\n \n
{app.translator.trans('ianm-html-head.admin.table.description_label')}{app.translator.trans('ianm-html-head.admin.table.header_label')}{app.translator.trans('ianm-html-head.admin.table.active_label')}\n
\n ) : (\n
{Placeholder.component({ text: app.translator.trans('ianm-html-head.admin.table.empty_text') })}
\n )}\n
\n
\n {next}\n {prev}\n
\n
\n );\n }\n\n refresh() {\n return this.loadResults().then(this.parseResults.bind(this));\n }\n\n /**\n * Load a new page of HeadItem results.\n *\n * @param {Integer} page number.\n * @return {Promise}\n */\n loadResults() {\n const offset = this.page * this.pageSize;\n\n return app.store.find('html-headers', { page: { offset, limit: this.pageSize } });\n }\n\n /**\n * Load the next page of results.\n *\n * @public\n */\n loadNext() {\n if (this.nextResults === true) {\n this.page++;\n this.refresh();\n }\n }\n\n /**\n * Load the previous page of results.\n *\n * @public\n */\n loadPrev() {\n if (this.prevResults === true) {\n this.page--;\n this.refresh();\n }\n }\n\n /**\n * Parse results and append them to the page list.\n *\n * @param {Page[]} results\n * @return {Page[]}\n */\n parseResults(results) {\n this.loading = false;\n\n this.nextResults = !!results.payload.links.next;\n this.prevResults = !!results.payload.links.prev;\n\n m.redraw();\n }\n}\n","import ExtensionPage from 'flarum/components/ExtensionPage';\nimport HeadItem from './components/HeadItemList';\n\nexport default class HtmlHeadSettingsPage extends ExtensionPage {\n oninit(vnode) {\n super.oninit(vnode);\n }\n\n content() {\n return [\n
\n
{HeadItem.component()}
\n
,\n ];\n }\n}\n","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","import Model from 'flarum/Model';\n\nexport default class HeadItem extends Model {\n id = Model.attribute('id');\n description = Model.attribute('description');\n header = Model.attribute('header');\n active = Model.attribute('active');\n}\n","import app from 'flarum/app';\nimport HtmlHeadSettingsPage from './htmlHeadSettingsPage';\nimport HeadItem from './model/HeadItem';\n\napp.initializers.add('ianm-html-head', () => {\n app.store.models['html-headers'] = HeadItem;\n app.extensionData.for('ianm-html-head').registerPage(HtmlHeadSettingsPage);\n});\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@ianm/html-head/webpack/bootstrap","webpack://@ianm/html-head/external \"flarum.core.compat['common/components/Button']\"","webpack://@ianm/html-head/external \"flarum.core.compat['common/Model']\"","webpack://@ianm/html-head/external \"flarum.core.compat['common/Component']\"","webpack://@ianm/html-head/external \"flarum.core.compat['common/app']\"","webpack://@ianm/html-head/external \"flarum.core.compat['common/utils/Stream']\"","webpack://@ianm/html-head/external \"flarum.core.compat['common/components/ExtensionPage']\"","webpack://@ianm/html-head/external \"flarum.core.compat['common/components/LoadingIndicator']\"","webpack://@ianm/html-head/external \"flarum.core.compat['common/components/Placeholder']\"","webpack://@ianm/html-head/external \"flarum.core.compat['common/components/Switch']\"","webpack://@ianm/html-head/external \"flarum.core.compat['common/components/Modal']\"","webpack://@ianm/html-head/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@ianm/html-head/./src/admin/components/CreateHeadItemModal.js","webpack://@ianm/html-head/./src/admin/components/HeadItemListItem.js","webpack://@ianm/html-head/./src/admin/components/HeadItemList.js","webpack://@ianm/html-head/./src/admin/htmlHeadSettingsPage.js","webpack://@ianm/html-head/./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","webpack://@ianm/html-head/./node_modules/@babel/runtime/helpers/esm/defineProperty.js","webpack://@ianm/html-head/./src/admin/model/HeadItem.js","webpack://@ianm/html-head/./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","_inheritsLoose","subClass","superClass","constructor","__proto__","CreateHeadItemModal","oninit","vnode","this","item","attrs","app","store","createRecord","description","Stream","header","loading","className","title","exists","translator","trans","content","type","bidi","required","placeholder","onsubmit","e","preventDefault","save","then","hide","onerror","loaded","Modal","HeadItemListItem","headItem","view","Switch","component","state","data","attributes","active","onchange","activeLoading","request","method","url","forum","attribute","id","body","response","redraw","Button","onclick","modal","show","deleting","Component","HeadItemList","page","pageSize","oncreate","refresh","next","prev","nextResults","icon","loadNext","prevResults","loadPrev","LoadingIndicator","all","length","style","width","textAlign","slice","map","Placeholder","text","loadResults","parseResults","offset","find","limit","results","payload","links","HtmlHeadSettingsPage","HeadItem","ExtensionPage","_assertThisInitialized","self","ReferenceError","_defineProperty","obj","configurable","writable","Model","initializers","add","models","extensionData","registerPage"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,G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,EAGNsH,E,oBCVYN,E,6JACZS,IAAMnD,UAAU,O,qBACPmD,IAAMnD,UAAU,gB,gBACrBmD,IAAMnD,UAAU,W,gBAChBmD,IAAMnD,UAAU,W,mBAJSmD,KCEtC5F,IAAI6F,aAAaC,IAAI,kBAAkB,WACnC9F,IAAIC,MAAM8F,OAAO,gBAAkBZ,EACnCnF,IAAIgG,cAAJ,IAAsB,kBAAkBC,aAAaf","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 = 10);\n","module.exports = flarum.core.compat['common/components/Button'];","module.exports = flarum.core.compat['common/Model'];","module.exports = flarum.core.compat['common/Component'];","module.exports = flarum.core.compat['common/app'];","module.exports = flarum.core.compat['common/utils/Stream'];","module.exports = flarum.core.compat['common/components/ExtensionPage'];","module.exports = flarum.core.compat['common/components/LoadingIndicator'];","module.exports = flarum.core.compat['common/components/Placeholder'];","module.exports = flarum.core.compat['common/components/Switch'];","module.exports = flarum.core.compat['common/components/Modal'];","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","import Modal from 'flarum/common/components/Modal';\nimport Button from 'flarum/common/components/Button';\nimport Stream from 'flarum/common/utils/Stream';\n\nexport default class CreateHeadItemModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.item = this.attrs.item || app.store.createRecord('html-headers');\n\n this.description = Stream(this.item.description() || '');\n this.header = Stream(this.item.header() || '');\n\n this.loading = false;\n }\n\n className() {\n return 'Modal--medium';\n }\n\n title() {\n return this.item.exists\n ? app.translator.trans('ianm-html-head.admin.modal.edit_title')\n : app.translator.trans('ianm-html-head.admin.modal.create_title');\n }\n\n content() {\n return (\n
\n

{app.translator.trans('ianm-html-head.admin.modal.text')}

\n\n
\n \n \n
\n\n
\n \n \n
\n\n
\n \n
\n
\n );\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n if (!this.header()) return;\n\n this.loading = true;\n\n const attrs = {\n description: this.description(),\n header: this.header(),\n };\n\n this.item.save(attrs).then(this.hide.bind(this), this.onerror.bind(this), this.loaded.bind(this));\n }\n}\n","import Component from 'flarum/common/Component';\nimport Button from 'flarum/common/components/Button';\nimport Switch from 'flarum/common/components/Switch';\nimport CreateHeadItemModal from './CreateHeadItemModal';\n\nexport default class HeadItemListItem extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.item = this.attrs.headItem;\n }\n\n view() {\n return (\n \n {this.item.description()}\n \n {this.item.header()}\n \n \n {Switch.component({\n state: this.item.data.attributes.active,\n onchange: (value) => {\n this.activeLoading = true;\n\n app.request({\n method: 'PATCH',\n url: `${app.forum.attribute('apiUrl')}/html-headers/${this.item.id()}`,\n body: {\n active: value,\n },\n }).then((response) => {\n this.item.data = response.data;\n this.activeLoading = false;\n\n m.redraw();\n });\n },\n loading: this.activeLoading,\n })}\n \n \n
\n {Button.component(\n {\n className: 'Button Button--secondary',\n onclick: () => app.modal.show(CreateHeadItemModal, { item: this.item }),\n },\n app.translator.trans('ianm-html-head.admin.table.edit_button')\n )}\n {Button.component(\n {\n className: 'Button Button--danger',\n onclick: () => {\n this.deleting = true;\n this.item.delete().then(() => {\n this.deleting = false;\n m.redraw();\n });\n },\n loading: this.deleting,\n },\n app.translator.trans('ianm-html-head.admin.table.delete_button')\n )}\n
\n \n \n );\n }\n}\n","import Component from 'flarum/common/Component';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport Placeholder from 'flarum/common/components/Placeholder';\nimport Button from 'flarum/common/components/Button';\nimport HeadItemListItem from './HeadItemListItem';\nimport CreateHeadItemModal from './CreateHeadItemModal';\n\nexport default class HeadItemList extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loading = true;\n\n this.page = 0;\n this.pageSize = 20;\n }\n\n oncreate(vnode) {\n super.oncreate(vnode);\n\n this.refresh();\n }\n\n view() {\n let next, prev;\n\n if (this.nextResults === true) {\n next = Button.component({\n className: 'Button Button--PageList-next',\n icon: 'fas fa-angle-right',\n onclick: this.loadNext.bind(this),\n });\n }\n\n if (this.prevResults === true) {\n prev = Button.component({\n className: 'Button Button--PageList-prev',\n icon: 'fas fa-angle-left',\n onclick: this.loadPrev.bind(this),\n });\n }\n\n return (\n
\n
\n {Button.component(\n {\n className: 'Button Button--primary',\n icon: 'fas fa-plus',\n onclick: () => app.modal.show(CreateHeadItemModal),\n },\n app.translator.trans('ianm-html-head.admin.create_button')\n )}\n
\n
\n
\n {this.loading ? (\n LoadingIndicator.component()\n ) : app.store.all('html-headers').length ? (\n \n \n \n \n \n \n \n \n \n {app.store\n .all('html-headers')\n .slice(this.page, this.page + this.pageSize)\n .map((headItem) => HeadItemListItem.component({ headItem }))}\n \n
{app.translator.trans('ianm-html-head.admin.table.description_label')}{app.translator.trans('ianm-html-head.admin.table.header_label')}{app.translator.trans('ianm-html-head.admin.table.active_label')}\n
\n ) : (\n
{Placeholder.component({ text: app.translator.trans('ianm-html-head.admin.table.empty_text') })}
\n )}\n
\n
\n {next}\n {prev}\n
\n
\n );\n }\n\n refresh() {\n return this.loadResults().then(this.parseResults.bind(this));\n }\n\n /**\n * Load a new page of HeadItem results.\n *\n * @param {Integer} page number.\n * @return {Promise}\n */\n loadResults() {\n const offset = this.page * this.pageSize;\n\n return app.store.find('html-headers', { page: { offset, limit: this.pageSize } });\n }\n\n /**\n * Load the next page of results.\n *\n * @public\n */\n loadNext() {\n if (this.nextResults === true) {\n this.page++;\n this.refresh();\n }\n }\n\n /**\n * Load the previous page of results.\n *\n * @public\n */\n loadPrev() {\n if (this.prevResults === true) {\n this.page--;\n this.refresh();\n }\n }\n\n /**\n * Parse results and append them to the page list.\n *\n * @param {Page[]} results\n * @return {Page[]}\n */\n parseResults(results) {\n this.loading = false;\n\n this.nextResults = !!results.payload.links.next;\n this.prevResults = !!results.payload.links.prev;\n\n m.redraw();\n }\n}\n","import ExtensionPage from 'flarum/common/components/ExtensionPage';\nimport HeadItem from './components/HeadItemList';\n\nexport default class HtmlHeadSettingsPage extends ExtensionPage {\n oninit(vnode) {\n super.oninit(vnode);\n }\n\n content() {\n return [\n
\n
{HeadItem.component()}
\n
,\n ];\n }\n}\n","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","import Model from 'flarum/common/Model';\n\nexport default class HeadItem extends Model {\n id = Model.attribute('id');\n description = Model.attribute('description');\n header = Model.attribute('header');\n active = Model.attribute('active');\n}\n","import app from 'flarum/common/app';\nimport HtmlHeadSettingsPage from './htmlHeadSettingsPage';\nimport HeadItem from './model/HeadItem';\n\napp.initializers.add('ianm-html-head', () => {\n app.store.models['html-headers'] = HeadItem;\n app.extensionData.for('ianm-html-head').registerPage(HtmlHeadSettingsPage);\n});\n"],"sourceRoot":""} \ No newline at end of file