{"version":3,"sources":["webpack:/webpack/bootstrap 1da46546ad8f66b4c2a3","webpack:/external \"window.jQuery\"","webpack:///src/scripts/modules/comments.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","window","jQuery","Comments","_classCallCheck","this","form","$","length","formErrors","x5script","commentsFormErrors","validateComment","email","test","String","toLowerCase","_this","attr","requiredFields","find","on","e","self","target","invalid","fieldError","remove","each","el","field","value","val","trim","push","element","error","fieldEmpty","validateEmail","invalidEmail","parent","append","concat","stop","animate","scrollTop","offset","top"],"mappings":"aACA,IAAAA,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,GAAA,CACAG,EAAAH,EACAI,GAAA,EACAH,QAAA,IAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,EAAAA,EAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QAKAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,EAAA,CACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAhB,GACA,IAAAS,EAAAT,GAAAA,EAAAiB,WACA,WAA2B,OAAAjB,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAH,EAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,OAAAR,OAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,EAAAA,EAAA0B,EAAA,wDC7DAvB,EAAAD,QAAAyB,OAAAC,0RCsFe,eAjFb,SAAAC,iGAAcC,CAAAC,KAAAF,GACZE,KAAKC,KAAOC,GAAAA,CAAE,qBAETF,KAAKC,KAAKE,SAIfH,KAAKI,WAAaC,SAASC,mBAC3BN,KAAKO,sEAGP,SAAqBC,GAInB,MAFW,0JAEDC,KAAKC,OAAOF,GAAOG,mDAG/B,WAAkB,IAAAC,EAAAZ,KAChBA,KAAKC,KAAKY,KAAK,cAAc,GAE7B,IAAMC,EAAiBd,KAAKC,KAAKc,KAAK,yBAEtCf,KAAKC,KAAKe,GAAG,SAAU,SAAAC,GACrB,IAAMC,EAAOhB,GAAAA,CAAEe,EAAEE,QACXC,EAAU,GACVC,EAAaH,EAAKH,KAAK,mBAM7B,OAJIM,EAAWlB,QACbkB,EAAWC,WAGTR,EAAeX,SACjBD,EAAAA,EAAEqB,KAAKT,EAAgB,SAACzC,EAAGmD,GACzB,IAAMC,EAAQvB,GAAAA,CAAEsB,GACVE,EAAQD,EAAME,MAAMC,OAEZ,KAAVF,EACFN,EAAQS,KAAK,CACXC,QAASL,EACTM,MAAOnB,EAAKR,WAAW4B,aAEO,UAAvBP,EAAMZ,KAAK,UACff,EAASmC,cAAcP,IAC1BN,EAAQS,KAAK,CACXC,QAASL,EACTM,MAAOnB,EAAKR,WAAW8B,kBAM3Bd,EAAQjB,OAAS,MACnBD,EAAAA,EAAEqB,KAAKH,EAAS,SAAC/C,EAAGoD,GAClBA,EAAMK,QACHK,SACAC,OAFH,oDAAAC,OAIMZ,EAAMM,MAJZ,WASF7B,GAAAA,CAAE,cACCoC,OACAC,QACC,CACEC,UAAWtB,EAAKuB,SAASC,IAAM,KAEjC,MAGG","file":"blog.bundle.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, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\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 \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"multi \\\\src\\\\scripts\\\\blog.js\");\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 1da46546ad8f66b4c2a3","module.exports = window.jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window.jQuery\"\n// module id = 0iPh\n// module chunks = xicons gutenberg customizer customizer-fonts blog app","import $ from 'jquery';\n\n/* global x5script */\n\nclass Comments {\n constructor() {\n this.form = $('.js-comments-form');\n\n if (!this.form.length) {\n return;\n }\n\n this.formErrors = x5script.commentsFormErrors;\n this.validateComment();\n }\n\n static validateEmail(email) {\n // eslint-disable-next-line no-useless-escape\n const re = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n\n return re.test(String(email).toLowerCase());\n }\n\n validateComment() {\n this.form.attr('novalidate', true);\n\n const requiredFields = this.form.find('[required=\"required\"]');\n\n this.form.on('submit', e => {\n const self = $(e.target);\n const invalid = [];\n const fieldError = self.find('.js-field-error');\n\n if (fieldError.length) {\n fieldError.remove();\n }\n\n if (requiredFields.length) {\n $.each(requiredFields, (i, el) => {\n const field = $(el);\n const value = field.val().trim();\n\n if (value === '') {\n invalid.push({\n element: field,\n error: this.formErrors.fieldEmpty,\n });\n } else if (field.attr('name') === 'email') {\n if (!Comments.validateEmail(value)) {\n invalid.push({\n element: field,\n error: this.formErrors.invalidEmail,\n });\n }\n }\n });\n\n if (invalid.length > 0) {\n $.each(invalid, (i, field) => {\n field.element\n .parent()\n .append(\n `

${\n field.error\n }

`,\n );\n });\n\n $('body, html')\n .stop()\n .animate(\n {\n scrollTop: self.offset().top - 200,\n },\n 300,\n );\n\n return false;\n }\n }\n\n return true;\n });\n }\n}\n\nexport default new Comments();\n\n\n\n// WEBPACK FOOTER //\n// ./src/scripts/modules/comments.js"]}