From a62d3b8f18de77ec1e04d6a49747253301916c0a Mon Sep 17 00:00:00 2001 From: Marco Colia Date: Sat, 13 Nov 2021 12:20:49 +0100 Subject: [PATCH] fixed api errors --- js/dist/admin.js | 140 +----------------------- js/dist/admin.js.map | 2 +- js/dist/forum.js | 240 +----------------------------------------- js/dist/forum.js.map | 2 +- js/src/forum/index.js | 75 +++++++------ 5 files changed, 41 insertions(+), 418 deletions(-) diff --git a/js/dist/admin.js b/js/dist/admin.js index 9115184..514011c 100644 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -1,140 +1,2 @@ -module.exports = -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./admin.js"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "./admin.js": -/*!******************!*\ - !*** ./admin.js ***! - \******************/ -/*! no exports provided */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _src_admin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./src/admin */ "./src/admin/index.js"); -/* empty/unused harmony star reexport */ - -/***/ }), - -/***/ "./src/admin/index.js": -/*!****************************!*\ - !*** ./src/admin/index.js ***! - \****************************/ -/*! no exports provided */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var flarum_admin_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! flarum/admin/app */ "flarum/admin/app"); -/* harmony import */ var flarum_admin_app__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(flarum_admin_app__WEBPACK_IMPORTED_MODULE_0__); - -flarum_admin_app__WEBPACK_IMPORTED_MODULE_0___default.a.initializers.add('justoverclock/theaudiodb-api', function () { - flarum_admin_app__WEBPACK_IMPORTED_MODULE_0___default.a.extensionData["for"]('justoverclock-theaudiodb-api').registerSetting({ - setting: 'justoverclock-theaudiodb-api.langCode', - name: 'justoverclock-theaudiodb-api.langCode', - type: 'text', - label: flarum_admin_app__WEBPACK_IMPORTED_MODULE_0___default.a.translator.trans('justoverclock-theaudiodb-api.admin.langcode'), - help: flarum_admin_app__WEBPACK_IMPORTED_MODULE_0___default.a.translator.trans('justoverclock-theaudiodb-api.admin.langcode-help') - }); -}); - -/***/ }), - -/***/ "flarum/admin/app": -/*!**************************************************!*\ - !*** external "flarum.core.compat['admin/app']" ***! - \**************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = flarum.core.compat['admin/app']; - -/***/ }) - -/******/ }); +module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=7)}({2:function(e,t){e.exports=flarum.core.compat["admin/app"]},7:function(e,t,r){"use strict";r.r(t);var n=r(2),o=r.n(n);o.a.initializers.add("justoverclock/theaudiodb-api",(function(){o.a.extensionData.for("justoverclock-theaudiodb-api").registerSetting({setting:"justoverclock-theaudiodb-api.langCode",name:"justoverclock-theaudiodb-api.langCode",type:"text",label:o.a.translator.trans("justoverclock-theaudiodb-api.admin.langcode"),help:o.a.translator.trans("justoverclock-theaudiodb-api.admin.langcode-help")})}))}}); //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/js/dist/admin.js.map b/js/dist/admin.js.map index ed6fdb2..1292271 100644 --- a/js/dist/admin.js.map +++ b/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://@justoverclock/theaudiodb-api/webpack/bootstrap","webpack://@justoverclock/theaudiodb-api/./admin.js","webpack://@justoverclock/theaudiodb-api/./src/admin/index.js","webpack://@justoverclock/theaudiodb-api/external \"flarum.core.compat['admin/app']\""],"names":["app","initializers","add","extensionData","registerSetting","setting","name","type","label","translator","trans","help"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA,wC;;;;;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAEAA,uDAAG,CAACC,YAAJ,CAAiBC,GAAjB,CAAqB,8BAArB,EAAqD,YAAM;AACzDF,yDAAG,CAACG,aAAJ,QAAsB,8BAAtB,EAAsDC,eAAtD,CAAsE;AACpEC,WAAO,EAAE,uCAD2D;AAEpEC,QAAI,EAAE,uCAF8D;AAGpEC,QAAI,EAAE,MAH8D;AAIpEC,SAAK,EAAER,uDAAG,CAACS,UAAJ,CAAeC,KAAf,CAAqB,6CAArB,CAJ6D;AAKpEC,QAAI,EAAEX,uDAAG,CAACS,UAAJ,CAAeC,KAAf,CAAqB,kDAArB;AAL8D,GAAtE;AAOD,CARD,E;;;;;;;;;;;ACFA,iD","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 = \"./admin.js\");\n","export * from './src/admin';\r\n","import app from 'flarum/admin/app';\n\napp.initializers.add('justoverclock/theaudiodb-api', () => {\n app.extensionData.for('justoverclock-theaudiodb-api').registerSetting({\n setting: 'justoverclock-theaudiodb-api.langCode',\n name: 'justoverclock-theaudiodb-api.langCode',\n type: 'text',\n label: app.translator.trans('justoverclock-theaudiodb-api.admin.langcode'),\n help: app.translator.trans('justoverclock-theaudiodb-api.admin.langcode-help'),\n });\n});\n","module.exports = flarum.core.compat['admin/app'];"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@justoverclock/theaudiodb-api/webpack/bootstrap","webpack://@justoverclock/theaudiodb-api/external \"flarum.core.compat['admin/app']\"","webpack://@justoverclock/theaudiodb-api/./src/admin/index.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","app","initializers","add","extensionData","registerSetting","setting","type","label","translator","trans","help"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBkB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOrB,EAAoBU,EAAEe,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIRzB,EAAoB6B,EAAI,SAAS1B,GAChC,IAAIS,EAAST,GAAUA,EAAOqB,WAC7B,WAAwB,OAAOrB,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAH,EAAoBU,EAAEE,EAAQ,IAAKA,GAC5BA,GAIRZ,EAAoBa,EAAI,SAASiB,EAAQC,GAAY,OAAOjB,OAAOkB,UAAUC,eAAe1B,KAAKuB,EAAQC,IAGzG/B,EAAoBkC,EAAI,GAIjBlC,EAAoBA,EAAoBmC,EAAI,G,kBClFrDhC,EAAOD,QAAUkC,OAAOC,KAAKC,OAAO,c,0DCEpCC,IAAIC,aAAaC,IAAI,gCAAgC,WACnDF,IAAIG,cAAJ,IAAsB,gCAAgCC,gBAAgB,CACpEC,QAAS,wCACTjC,KAAM,wCACNkC,KAAM,OACNC,MAAOP,IAAIQ,WAAWC,MAAM,+CAC5BC,KAAMV,IAAIQ,WAAWC,MAAM","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 = 7);\n","module.exports = flarum.core.compat['admin/app'];","import app from 'flarum/admin/app';\n\napp.initializers.add('justoverclock/theaudiodb-api', () => {\n app.extensionData.for('justoverclock-theaudiodb-api').registerSetting({\n setting: 'justoverclock-theaudiodb-api.langCode',\n name: 'justoverclock-theaudiodb-api.langCode',\n type: 'text',\n label: app.translator.trans('justoverclock-theaudiodb-api.admin.langcode'),\n help: app.translator.trans('justoverclock-theaudiodb-api.admin.langcode-help'),\n });\n});\n"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/forum.js b/js/dist/forum.js index 64a76a9..5101bc6 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,240 +1,2 @@ -module.exports = -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./forum.js"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "./forum.js": -/*!******************!*\ - !*** ./forum.js ***! - \******************/ -/*! no exports provided */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _src_forum__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./src/forum */ "./src/forum/index.js"); -/* empty/unused harmony star reexport */ - -/***/ }), - -/***/ "./src/forum/index.js": -/*!****************************!*\ - !*** ./src/forum/index.js ***! - \****************************/ -/*! no exports provided */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! flarum/forum/app */ "flarum/forum/app"); -/* harmony import */ var flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_app__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! flarum/common/extend */ "flarum/common/extend"); -/* harmony import */ var flarum_common_extend__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var flarum_forum_components_DiscussionHero__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! flarum/forum/components/DiscussionHero */ "flarum/forum/components/DiscussionHero"); -/* harmony import */ var flarum_forum_components_DiscussionHero__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(flarum_forum_components_DiscussionHero__WEBPACK_IMPORTED_MODULE_2__); -/* - __ _ _ _ - / _| | (_) | -| |_| | __ _ _ __ _ _ _ __ ___ _| |_ -| _| |/ _` | '__| | | | '_ ` _ \ | | __| -| | | | (_| | | | |_| | | | | | |_| | |_ -|_| |_|\__,_|_| \__,_|_| |_| |_(_)_|\__| - https://flarum.it - Marco Colia - */ - - - -flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default.a.initializers.add('justoverclock/theaudiodb-api', function () { - Object(flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__["extend"])(flarum_forum_components_DiscussionHero__WEBPACK_IMPORTED_MODULE_2___default.a.prototype, 'oncreate', function () { - var _this = this; - - var artistTitle = this.attrs.discussion.title().split(/\s+/).join('%20'); - var languageCode = flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default.a.forum.attribute('justoverclock-theaudiodb-api.langCode') || 'EN'; - var isLoggedIn = flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default.a.session.user; // gestiamo gli errori nella risposta - - function handleErrors(response) { - if (!response.ok) { - console.clear(); - throw Error(response.statusText); - } - - return response; - } // per evitare troppe richieste all'api, effettuiamo fetch solo per chi è registrato - - - if (isLoggedIn) { - var ArtistApi = fetch('https://theaudiodb.com/api/v1/json/1/search.php?s=' + artistTitle).then(handleErrors).then(function (response) { - return response.json(); - }).then(function (data) { - _this.audiodb = data; - m.redraw(); - var arrayElem = 'strBiography' + languageCode; - - if (data.artists[0][arrayElem] === null) { - data.artists[0][arrayElem] = 'Oops! Description is not available in your language unfortunately...You can contribute to TheAudioDB.com by adding information about this artists in your language.'; - } - })["catch"](function (error) { - return console.log('This Game title does not exist ;) =>', artistTitle); - }); - } - }); - Object(flarum_common_extend__WEBPACK_IMPORTED_MODULE_1__["extend"])(flarum_forum_components_DiscussionHero__WEBPACK_IMPORTED_MODULE_2___default.a.prototype, 'items', function (items) { - var languageCode = flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default.a.forum.attribute('justoverclock-theaudiodb-api.langCode') || 'EN'; - var arrayElem = 'strBiography' + languageCode; - console.log(this.audiodb); // non mostriamo l'html se non c'è nulla da mostrare - - if (this.audiodb === undefined) { - return; - } else { - items.add('artistDetailMusic', m("div", { - "class": "artistWrapper" - }, m("div", { - id: "containerArtist" - }, m("div", { - id: "contentArtist" - }, m("p", { - "class": "artistDesc", - id: "descArtist" - }, this.audiodb.artists[0][arrayElem].substring(0, 400) + '...'), m("div", { - "class": "itemdescrip" - }, m("div", { - "class": "genreArtist", - id: "genreArtist" - }, flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default.a.translator.trans('justoverclock-theaudiodb-api.forum.genres'), ": ", this.audiodb.artists[0].strGenre), m("div", { - "class": "yearBorn", - id: "yearBorn" - }, flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default.a.translator.trans('justoverclock-theaudiodb-api.forum.intFormedYear'), ": ", this.audiodb.artists[0].intFormedYear), m("div", { - "class": "strcountry", - id: "strcountry" - }, flarum_forum_app__WEBPACK_IMPORTED_MODULE_0___default.a.translator.trans('justoverclock-theaudiodb-api.forum.countryart'), ": ", this.audiodb.artists[0].strCountry)))), m("div", { - id: "sidebarImgArtist" - }, m("img", { - className: "imgArtist", - id: "imgArtists", - src: this.audiodb.artists[0].strArtistThumb - })))); - } - }); -}); - -/***/ }), - -/***/ "flarum/common/extend": -/*!******************************************************!*\ - !*** external "flarum.core.compat['common/extend']" ***! - \******************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = flarum.core.compat['common/extend']; - -/***/ }), - -/***/ "flarum/forum/app": -/*!**************************************************!*\ - !*** external "flarum.core.compat['forum/app']" ***! - \**************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = flarum.core.compat['forum/app']; - -/***/ }), - -/***/ "flarum/forum/components/DiscussionHero": -/*!************************************************************************!*\ - !*** external "flarum.core.compat['forum/components/DiscussionHero']" ***! - \************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = flarum.core.compat['forum/components/DiscussionHero']; - -/***/ }) - -/******/ }); +module.exports=function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=6)}([function(t,r){t.exports=flarum.core.compat["forum/app"]},function(t,r,e){t.exports=e(5)},,function(t,r){t.exports=flarum.core.compat["common/extend"]},function(t,r){t.exports=flarum.core.compat["forum/components/DiscussionHero"]},function(t,r,e){var n=function(t){"use strict";var r=Object.prototype,e=r.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{c({},"")}catch(t){c=function(t,r,e){return t[r]=e}}function u(t,r,e,n){var o=r&&r.prototype instanceof f?r:f,i=Object.create(o.prototype),a=new L(n||[]);return i._invoke=function(t,r,e){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return O()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=w(a,e);if(c){if(c===l)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var u=s(t,r,e);if("normal"===u.type){if(n=e.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n="completed",e.method="throw",e.arg=u.arg)}}}(t,e,a),i}function s(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function f(){}function h(){}function d(){}var p={};c(p,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(E([])));v&&v!==r&&e.call(v,o)&&(p=v);var m=d.prototype=f.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(r){c(t,r,(function(t){return this._invoke(r,t)}))}))}function b(t,r){var n;this._invoke=function(o,i){function a(){return new r((function(n,a){!function n(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&e.call(f,"__await")?r.resolve(f.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):r.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,r){var e=t.iterator[r.method];if(void 0===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,w(t,r),"throw"===r.method))return l;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=s(e,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,l;var o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,l):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,l)}function x(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function j(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function r(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=e.call(i,"catchLoc"),u=e.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&e.call(o,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),j(e),l}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;j(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:E(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},function(t,r,e){"use strict";function n(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function o(t){return function(){var r=this,e=arguments;return new Promise((function(o,i){var a=t.apply(r,e);function c(t){n(a,o,i,c,u,"next",t)}function u(t){n(a,o,i,c,u,"throw",t)}c(void 0)}))}}e.r(r);var i=e(1),a=e.n(i),c=e(0),u=e.n(c),s=e(3),l=e(4),f=e.n(l);u.a.initializers.add("justoverclock/theaudiodb-api",(function(){Object(s.extend)(f.a.prototype,"oncreate",o(a.a.mark((function t(){var r,e,n,i,c=this;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.attrs.discussion.title().split(/\s+/).join("%20"),e=u.a.forum.attribute("justoverclock-theaudiodb-api.langCode")||"EN",!u.a.session.user){t.next=7;break}return t.next=6,fetch("https://theaudiodb.com/api/v1/json/1/search.php?s="+r).then(function(){var t=o(a.a.mark((function t(r){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}()).then((function(t){c.audiodb=t,m.redraw();var r="strBiography"+e;null===t.artists[0][r]&&(t.artists[0][r]="Oops! Description is not available in your language unfortunately. You can contribute to TheAudioDB.com by adding information about this artists in your language.")})).catch((function(t){return console.log("This Artist/band does not exist ;) =>",r)}));case 6:t.sent;case 7:null===this.audiodb.artists?document.querySelector("li.item-artistDetailMusic").style.display="none":(n="strBiography"+e,document.getElementById("genreArtist").innerText=u.a.translator.trans("justoverclock-theaudiodb-api.forum.genres")+": "+this.audiodb.artists[0].strGenre,document.getElementById("descArtist").innerText=this.audiodb.artists[0][n].substring(0,400)+"...",document.getElementById("yearBorn").innerText=u.a.translator.trans("justoverclock-theaudiodb-api.forum.intFormedYear")+": "+this.audiodb.artists[0].intFormedYear,document.getElementById("strcountry").innerText=u.a.translator.trans("justoverclock-theaudiodb-api.forum.countryart")+": "+this.audiodb.artists[0].strCountry,i=this.audiodb.artists[0].strArtistThumb,$("#imgArtists").attr("src",i));case 8:case"end":return t.stop()}}),t,this)})))),Object(s.extend)(f.a.prototype,"items",(function(t){t.add("artistDetailMusic",m("div",{class:"artistWrapper"},m("div",{id:"containerArtist"},m("div",{id:"contentArtist"},m("p",{class:"artistDesc",id:"descArtist"}),m("div",{class:"itemdescrip"},m("div",{class:"genreArtist",id:"genreArtist"}),m("div",{class:"yearBorn",id:"yearBorn"}),m("div",{class:"strcountry",id:"strcountry"})))),m("div",{id:"sidebarImgArtist"},m("img",{className:"imgArtist",id:"imgArtists",src:""}))))}))}))}]); //# 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 99b3d91..e84196c 100644 --- a/js/dist/forum.js.map +++ b/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://@justoverclock/theaudiodb-api/webpack/bootstrap","webpack://@justoverclock/theaudiodb-api/./forum.js","webpack://@justoverclock/theaudiodb-api/./src/forum/index.js","webpack://@justoverclock/theaudiodb-api/external \"flarum.core.compat['common/extend']\"","webpack://@justoverclock/theaudiodb-api/external \"flarum.core.compat['forum/app']\"","webpack://@justoverclock/theaudiodb-api/external \"flarum.core.compat['forum/components/DiscussionHero']\""],"names":["app","initializers","add","extend","DiscussionHero","prototype","artistTitle","attrs","discussion","title","split","join","languageCode","forum","attribute","isLoggedIn","session","user","handleErrors","response","ok","console","clear","Error","statusText","ArtistApi","fetch","then","json","data","audiodb","m","redraw","arrayElem","artists","error","log","items","undefined","substring","translator","trans","strGenre","intFormedYear","strCountry","strArtistThumb"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;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b,CAAqB,CAArB,EAAwBD,SAAxB,EAAmCM,SAAnC,CAA6C,CAA7C,EAA+C,GAA/C,IAAsD,KAA7F,CADF,EAEE;AAAK,iBAAM;AAAX,SACE;AAAK,iBAAM,aAAX;AAAyB,UAAE,EAAC;AAA5B,SAA2CvC,uDAAG,CAACwC,UAAJ,CAAeC,KAAf,CAAqB,2CAArB,CAA3C,QAAgH,KAAKX,OAAL,CAAaI,OAAb,CAAqB,CAArB,EAAwBQ,QAAxI,CADF,EAEE;AAAK,iBAAM,UAAX;AAAsB,UAAE,EAAC;AAAzB,SAAqC1C,uDAAG,CAACwC,UAAJ,CAAeC,KAAf,CAAqB,kDAArB,CAArC,QAAiH,KAAKX,OAAL,CAAaI,OAAb,CAAqB,CAArB,EAAwBS,aAAzI,CAFF,EAGE;AAAK,iBAAM,YAAX;AAAwB,UAAE,EAAC;AAA3B,SAAyC3C,uDAAG,CAACwC,UAAJ,CAAeC,KAAf,CAAqB,+CAArB,CAAzC,QAAkH,KAAKX,OAAL,CAAaI,OAAb,CAAqB,CAArB,EAAwBU,UAA1I,CAHF,CAFF,CADF,CADF,EAWE;AAAK,UAAE,EAAC;AAAR,SACE;AAAK,iBAAS,EAAC,WAAf;AAA2B,UAAE,EAAC,YAA9B;AAA2C,WAAG,EAAE,KAAKd,OAAL,CAAaI,OAAb,CAAqB,CAArB,EAAwBW;AAAxE,QADF,CAXF,CAFF;AAkBD;AACF,GA3BK,CAAN;AA4BD,CA5DD,E;;;;;;;;;;;ACdA,qD;;;;;;;;;;;ACAA,iD;;;;;;;;;;;ACAA,uE","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 = \"./forum.js\");\n","export * from './src/forum';\r\n","/*\n __ _ _ _\n / _| | (_) |\n| |_| | __ _ _ __ _ _ _ __ ___ _| |_\n| _| |/ _` | '__| | | | '_ ` _ \\ | | __|\n| | | | (_| | | | |_| | | | | | |_| | |_\n|_| |_|\\__,_|_| \\__,_|_| |_| |_(_)_|\\__|\n https://flarum.it - Marco Colia\n */\n\nimport app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport DiscussionHero from 'flarum/forum/components/DiscussionHero';\n\napp.initializers.add('justoverclock/theaudiodb-api', () => {\n extend(DiscussionHero.prototype, 'oncreate', function () {\n const artistTitle = this.attrs.discussion.title().split(/\\s+/).join('%20');\n const languageCode = app.forum.attribute('justoverclock-theaudiodb-api.langCode') || 'EN';\n const isLoggedIn = app.session.user;\n\n // gestiamo gli errori nella risposta\n function handleErrors(response) {\n if (!response.ok) {\n console.clear()\n throw Error(response.statusText);\n }\n return response;\n }\n\n // per evitare troppe richieste all'api, effettuiamo fetch solo per chi è registrato\n if (isLoggedIn) {\n const ArtistApi = fetch('https://theaudiodb.com/api/v1/json/1/search.php?s=' + artistTitle)\n .then(handleErrors)\n .then((response) => response.json())\n .then((data) => {\n this.audiodb = data;\n m.redraw();\n const arrayElem = 'strBiography' + languageCode;\n if (data.artists[0][arrayElem] === null) {\n data.artists[0][arrayElem] =\n 'Oops! Description is not available in your language unfortunately...You can contribute to TheAudioDB.com by adding information about this artists in your language.';\n }\n })\n .catch((error) => console.log('This Game title does not exist ;) =>', artistTitle));\n }\n });\n extend(DiscussionHero.prototype, 'items', function (items) {\n const languageCode = app.forum.attribute('justoverclock-theaudiodb-api.langCode') || 'EN';\n const arrayElem = 'strBiography' + languageCode;\n console.log(this.audiodb)\n // non mostriamo l'html se non c'è nulla da mostrare\n if (this.audiodb === undefined) {\n return;\n } else {\n items.add(\n 'artistDetailMusic',\n
\n
\n
\n

{this.audiodb.artists[0][arrayElem].substring(0,400) + '...'}

\n
\n
{app.translator.trans('justoverclock-theaudiodb-api.forum.genres')}: {this.audiodb.artists[0].strGenre}
\n
{app.translator.trans('justoverclock-theaudiodb-api.forum.intFormedYear')}: {this.audiodb.artists[0].intFormedYear}
\n
{app.translator.trans('justoverclock-theaudiodb-api.forum.countryart')}: {this.audiodb.artists[0].strCountry}
\n
\n
\n
\n
\n \n
\n
\n );\n }\n });\n});\n","module.exports = flarum.core.compat['common/extend'];","module.exports = flarum.core.compat['forum/app'];","module.exports = flarum.core.compat['forum/components/DiscussionHero'];"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@justoverclock/theaudiodb-api/webpack/bootstrap","webpack://@justoverclock/theaudiodb-api/external \"flarum.core.compat['forum/app']\"","webpack://@justoverclock/theaudiodb-api/./node_modules/@babel/runtime/regenerator/index.js","webpack://@justoverclock/theaudiodb-api/external \"flarum.core.compat['common/extend']\"","webpack://@justoverclock/theaudiodb-api/external \"flarum.core.compat['forum/components/DiscussionHero']\"","webpack://@justoverclock/theaudiodb-api/./node_modules/regenerator-runtime/runtime.js","webpack://@justoverclock/theaudiodb-api/./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js","webpack://@justoverclock/theaudiodb-api/./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","require","runtime","Op","hasOwn","$Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","define","obj","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","context","Context","_invoke","state","method","arg","Error","doneResult","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","type","done","makeInvokeMethod","fn","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","this","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","AsyncIterator","PromiseImpl","previousPromise","callInvokeWithMethodAndArg","resolve","reject","invoke","result","__await","then","unwrapped","error","undefined","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","displayName","isGeneratorFunction","genFun","ctor","constructor","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","keys","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","regeneratorRuntime","accidentalStrictMode","globalThis","Function","asyncGeneratorStep","gen","_next","_throw","_asyncToGenerator","args","arguments","apply","app","initializers","add","extend","DiscussionHero","a","artistTitle","attrs","discussion","title","split","join","languageCode","forum","attribute","session","user","fetch","response","json","data","audiodb","redraw","arrayElem","artists","console","log","document","querySelector","style","display","getElementById","innerText","translator","trans","strGenre","substring","intFormedYear","strCountry","urlImg","strArtistThumb","$","attr","items","class","id","className","src"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAA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AK4G,QAAQG,QAAQ,GAAGW,SACpFR,SAASI,eAAe,cAAcC,UAAYvH,KAAK4G,QAAQG,QAAQ,GAAGD,GAAWa,UAAU,EAAG,KAAO,MAC3GT,SAASI,eAAe,YAAYC,UACjDhC,IAAIiC,WAAWC,MAAM,oDAAsD,KAAOzH,KAAK4G,QAAQG,QAAQ,GAAGa,cAC3FV,SAASI,eAAe,cAAcC,UACrDhC,IAAIiC,WAAWC,MAAM,iDAAmD,KAAOzH,KAAK4G,QAAQG,QAAQ,GAAGc,WACnGC,EAAS9H,KAAK4G,QAAQG,QAAQ,GAAGgB,eACvCC,EAAE,eAAeC,KAAK,MAAOH,IAnCY,iDAsC7CpC,iBAAOC,IAAelJ,UAAW,SAAS,SAAUyL,GAClDA,EAAMzC,IACJ,oBACA,SAAK0C,MAAM,iBACT,SAAKC,GAAG,mBACN,SAAKA,GAAG,iBACN,OAAGD,MAAM,aAAaC,GAAG,eACzB,SAAKD,MAAM,eACT,SAAKA,MAAM,cAAcC,GAAG,gBAC5B,SAAKD,MAAM,WAAWC,GAAG,aACzB,SAAKD,MAAM,aAAaC,GAAG,kBAIjC,SAAKA,GAAG,oBACN,SAAKC,UAAU,YAAYD,GAAG,aAAaE,IAAI","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 = 6);\n","module.exports = flarum.core.compat['forum/app'];","module.exports = require(\"regenerator-runtime\");\n","module.exports = flarum.core.compat['common/extend'];","module.exports = flarum.core.compat['forum/components/DiscussionHero'];","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}","/*\n __ _ _ _\n / _| | (_) |\n| |_| | __ _ _ __ _ _ _ __ ___ _| |_\n| _| |/ _` | '__| | | | '_ ` _ \\ | | __|\n| | | | (_| | | | |_| | | | | | |_| | |_\n|_| |_|\\__,_|_| \\__,_|_| |_| |_(_)_|\\__|\n https://flarum.it - Marco Colia\n */\n\nimport app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport DiscussionHero from 'flarum/forum/components/DiscussionHero';\n\napp.initializers.add('justoverclock/theaudiodb-api', () => {\n extend(DiscussionHero.prototype, 'oncreate', async function () {\n const artistTitle = this.attrs.discussion.title().split(/\\s+/).join('%20');\n\n const languageCode = app.forum.attribute('justoverclock-theaudiodb-api.langCode') || 'EN';\n const isLoggedIn = app.session.user;\n\n // per evitare troppe richieste all'api, effettuiamo fetch solo per chi è registrato\n if (isLoggedIn) {\n const ArtistApi = await fetch('https://theaudiodb.com/api/v1/json/1/search.php?s=' + artistTitle)\n .then(async (response) => await response.json())\n .then((data) => {\n this.audiodb = data;\n m.redraw();\n const arrayElem = 'strBiography' + languageCode;\n if (data.artists[0][arrayElem] === null) {\n data.artists[0][arrayElem] =\n 'Oops! Description is not available in your language unfortunately. You can contribute to TheAudioDB.com by adding information about this artists in your language.';\n }\n })\n .catch((error) => console.log('This Artist/band does not exist ;) =>', artistTitle));\n }\n\n if (this.audiodb.artists === null) {\n const el = document.querySelector('li.item-artistDetailMusic');\n el.style.display = 'none';\n } else {\n const arrayElem = 'strBiography' + languageCode;\n const Genre = (document.getElementById('genreArtist').innerText =\n app.translator.trans('justoverclock-theaudiodb-api.forum.genres') + ': ' + this.audiodb.artists[0].strGenre);\n const DescArt = (document.getElementById('descArtist').innerText = this.audiodb.artists[0][arrayElem].substring(0, 400) + '...');\n const yearB = (document.getElementById('yearBorn').innerText =\n app.translator.trans('justoverclock-theaudiodb-api.forum.intFormedYear') + ': ' + this.audiodb.artists[0].intFormedYear);\n const Country = (document.getElementById('strcountry').innerText =\n app.translator.trans('justoverclock-theaudiodb-api.forum.countryart') + ': ' + this.audiodb.artists[0].strCountry);\n const urlImg = this.audiodb.artists[0].strArtistThumb;\n $('#imgArtists').attr('src', urlImg);\n }\n });\n extend(DiscussionHero.prototype, 'items', function (items) {\n items.add(\n 'artistDetailMusic',\n
\n
\n
\n

\n

\n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n );\n });\n});\n"],"sourceRoot":""} \ No newline at end of file diff --git a/js/src/forum/index.js b/js/src/forum/index.js index 67dfbf6..bc52910 100644 --- a/js/src/forum/index.js +++ b/js/src/forum/index.js @@ -13,63 +13,62 @@ import { extend } from 'flarum/common/extend'; import DiscussionHero from 'flarum/forum/components/DiscussionHero'; app.initializers.add('justoverclock/theaudiodb-api', () => { - extend(DiscussionHero.prototype, 'oncreate', function () { + extend(DiscussionHero.prototype, 'oncreate', async function () { const artistTitle = this.attrs.discussion.title().split(/\s+/).join('%20'); + const languageCode = app.forum.attribute('justoverclock-theaudiodb-api.langCode') || 'EN'; const isLoggedIn = app.session.user; - // gestiamo gli errori nella risposta - function handleErrors(response) { - if (!response.ok) { - console.clear() - throw Error(response.statusText); - } - return response; - } - // per evitare troppe richieste all'api, effettuiamo fetch solo per chi è registrato if (isLoggedIn) { - const ArtistApi = fetch('https://theaudiodb.com/api/v1/json/1/search.php?s=' + artistTitle) - .then(handleErrors) - .then((response) => response.json()) + const ArtistApi = await fetch('https://theaudiodb.com/api/v1/json/1/search.php?s=' + artistTitle) + .then(async (response) => await response.json()) .then((data) => { this.audiodb = data; m.redraw(); const arrayElem = 'strBiography' + languageCode; if (data.artists[0][arrayElem] === null) { data.artists[0][arrayElem] = - 'Oops! Description is not available in your language unfortunately...You can contribute to TheAudioDB.com by adding information about this artists in your language.'; + 'Oops! Description is not available in your language unfortunately. You can contribute to TheAudioDB.com by adding information about this artists in your language.'; } }) - .catch((error) => console.log('This Game title does not exist ;) =>', artistTitle)); + .catch((error) => console.log('This Artist/band does not exist ;) =>', artistTitle)); + } + + if (this.audiodb.artists === null) { + const el = document.querySelector('li.item-artistDetailMusic'); + el.style.display = 'none'; + } else { + const arrayElem = 'strBiography' + languageCode; + const Genre = (document.getElementById('genreArtist').innerText = + app.translator.trans('justoverclock-theaudiodb-api.forum.genres') + ': ' + this.audiodb.artists[0].strGenre); + const DescArt = (document.getElementById('descArtist').innerText = this.audiodb.artists[0][arrayElem].substring(0, 400) + '...'); + const yearB = (document.getElementById('yearBorn').innerText = + app.translator.trans('justoverclock-theaudiodb-api.forum.intFormedYear') + ': ' + this.audiodb.artists[0].intFormedYear); + const Country = (document.getElementById('strcountry').innerText = + app.translator.trans('justoverclock-theaudiodb-api.forum.countryart') + ': ' + this.audiodb.artists[0].strCountry); + const urlImg = this.audiodb.artists[0].strArtistThumb; + $('#imgArtists').attr('src', urlImg); } }); extend(DiscussionHero.prototype, 'items', function (items) { - const languageCode = app.forum.attribute('justoverclock-theaudiodb-api.langCode') || 'EN'; - const arrayElem = 'strBiography' + languageCode; - console.log(this.audiodb) - // non mostriamo l'html se non c'è nulla da mostrare - if (this.audiodb === undefined) { - return; - } else { - items.add( - 'artistDetailMusic', -
-
-
-

{this.audiodb.artists[0][arrayElem].substring(0,400) + '...'}

-
-
{app.translator.trans('justoverclock-theaudiodb-api.forum.genres')}: {this.audiodb.artists[0].strGenre}
-
{app.translator.trans('justoverclock-theaudiodb-api.forum.intFormedYear')}: {this.audiodb.artists[0].intFormedYear}
-
{app.translator.trans('justoverclock-theaudiodb-api.forum.countryart')}: {this.audiodb.artists[0].strCountry}
-
+ items.add( + 'artistDetailMusic', +
+
+
+

+

+
+
+
-
- -
- ); - } +
+ +
+
+ ); }); });