diff --git a/README.md b/README.md index b9b9a06..10bcd21 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ After you're finished please remove all the comments and instructions! > This project is application project about movie description user of application can like and leave comments -**[Movie Api]** is a javascript project +**[Movie Api]** is a javascript project that fetches TV Show Data from an API ## 🛠 Built With @@ -81,7 +81,6 @@ After you're finished please remove all the comments and instructions! ## 💻 Getting Started - To get a local copy up and running, follow these steps. ### Prerequisites @@ -96,25 +95,24 @@ npm Clone this repository to your desired folder: -``` git clone https://github.com/MosDevx/MovieApiProject.git``` +` git clone https://github.com/MosDevx/MovieApiProject.git` ### Install Install this project with: -``` npm install ``` +`npm install` ### Usage To run the project, execute the following command: -```npm run serve ``` +`npm run serve ` ### Run tests To run tests, run the following command: - ``` npm run test ``` @@ -122,7 +120,13 @@ npm run test ### Deployment You can deploy this project using: -```npm run serve``` +`npm run serve` + + + +## 🚀 Live Demo + +- [Live Demo Link](https://mosdevx.github.io/MovieApiProject)

(back to top)

@@ -138,7 +142,6 @@ You can deploy this project using: - Twitter: [@moseswamae7](https://twitter.com/moseswamae7) - LinkedIn: [LinkedIn](https://linkedin.com/in/moses-wamae-a13a67244) - 👤 **Aster Alemu** - GitHub: [@aster-alemu](https://github.com/aster-alemu) @@ -147,8 +150,6 @@ You can deploy this project using:

(back to top)

-

(back to top)

- ## 🤝 Contributing @@ -173,8 +174,6 @@ We would like to thank Microverse

(back to top)

-

(back to top)

- ## 📝 License diff --git a/dist/3a1926a3547db7d195be.png b/dist/3a1926a3547db7d195be.png new file mode 100644 index 0000000..a0ae0e1 Binary files /dev/null and b/dist/3a1926a3547db7d195be.png differ diff --git a/dist/c0f59bc5687dc177042b.webp b/dist/c0f59bc5687dc177042b.webp new file mode 100644 index 0000000..833c072 Binary files /dev/null and b/dist/c0f59bc5687dc177042b.webp differ diff --git a/dist/index.html b/dist/index.html index 7ee0cca..0874448 100644 --- a/dist/index.html +++ b/dist/index.html @@ -12,8 +12,8 @@ - - + + @@ -54,6 +54,10 @@ +

Todays Tv Shows

+ + +
diff --git a/dist/main.js b/dist/main.js index 093241f..d56c409 100644 --- a/dist/main.js +++ b/dist/main.js @@ -46,7 +46,37 @@ eval("\n\nmodule.exports = function (i) {\n return i[1];\n};\n\n//# sourceURL=w \**********************/ /***/ ((module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _modules_display_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modules/display.js */ \"./src/modules/display.js\");\n/* harmony import */ var _modules_getMovies_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modules/getMovies.js */ \"./src/modules/getMovies.js\");\n/* harmony import */ var _modules_likesApi_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./modules/likesApi.js */ \"./src/modules/likesApi.js\");\n/* harmony import */ var _style_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./style.css */ \"./src/style.css\");\n// import getLikes from './modules/involvment.js'\n\n\n\n\nvar mainSection = document.getElementById('main-section');\nvar movieArray = await (0,_modules_getMovies_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])();\nvar allLikes = await (0,_modules_likesApi_js__WEBPACK_IMPORTED_MODULE_2__.getLikes)();\n\n// function\n\nvar allIdsArray = [];\nmovieArray.forEach(function (movie) {\n allIdsArray.push(movie.showId);\n});\nvar findLikes = function findLikes(id) {\n var _result$likes;\n var result = allLikes.find(function (like) {\n return like.item_id === id;\n });\n return (_result$likes = result === null || result === void 0 ? void 0 : result.likes) !== null && _result$likes !== void 0 ? _result$likes : 0;\n};\nmovieArray.forEach(function (movie) {\n var likes = findLikes(movie.showId);\n var card = (0,_modules_display_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(movie, likes);\n mainSection.append(card);\n});\n__webpack_async_result__();\n} catch(e) { __webpack_async_result__(e); } }, 1);\n\n//# sourceURL=webpack://my-webpack-project/./src/index.js?"); +eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _modules_display_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modules/display.js */ \"./src/modules/display.js\");\n/* harmony import */ var _modules_initializer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modules/initializer.js */ \"./src/modules/initializer.js\");\n/* harmony import */ var _style_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./style.css */ \"./src/style.css\");\nvar __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_modules_display_js__WEBPACK_IMPORTED_MODULE_0__, _modules_initializer_js__WEBPACK_IMPORTED_MODULE_1__]);\n([_modules_display_js__WEBPACK_IMPORTED_MODULE_0__, _modules_initializer_js__WEBPACK_IMPORTED_MODULE_1__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);\n// import getLikes from './modules/involvment.js'\n\n\n\nvar mainSection = document.getElementById('main-section');\nvar popupContainer = document.getElementById('popup-section');\nfunction closeModal() {\n popupContainer.innerHTML = '';\n}\n_modules_initializer_js__WEBPACK_IMPORTED_MODULE_1__.movieArray.forEach(function (movie) {\n var likes = (0,_modules_initializer_js__WEBPACK_IMPORTED_MODULE_1__.findLikes)(movie.showId);\n var card = (0,_modules_display_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(movie, likes, closeModal, popupContainer);\n mainSection.append(card);\n});\n__webpack_async_result__();\n} catch(e) { __webpack_async_result__(e); } });\n\n//# sourceURL=webpack://my-webpack-project/./src/index.js?"); + +/***/ }), + +/***/ "./src/modules/commentCounter.js": +/*!***************************************!*\ + !*** ./src/modules/commentCounter.js ***! + \***************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nvar countComments = function countComments(DOMElem) {\n return DOMElem.childElementCount;\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (countComments);\n\n//# sourceURL=webpack://my-webpack-project/./src/modules/commentCounter.js?"); + +/***/ }), + +/***/ "./src/modules/commentsApi.js": +/*!************************************!*\ + !*** ./src/modules/commentsApi.js ***! + \************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"getComments\": () => (/* binding */ getComments),\n/* harmony export */ \"postComment\": () => (/* binding */ postComment)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nvar commentsUrl = 'https://us-central1-involvement-api.cloudfunctions.net/capstoneApi/apps/j26xtAx7qVMwcqU9i8K3/comments/';\nfunction postComment(_x) {\n return _postComment.apply(this, arguments);\n}\nfunction _postComment() {\n _postComment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {\n var showId, name, comment, response;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n showId = _ref.showId, name = _ref.name, comment = _ref.comment;\n _context.next = 3;\n return fetch(commentsUrl, {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n item_id: showId,\n username: name,\n comment: comment\n })\n });\n case 3:\n response = _context.sent;\n _context.next = 6;\n return response.json();\n case 6:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n return _postComment.apply(this, arguments);\n}\nfunction getComments(_x2) {\n return _getComments.apply(this, arguments);\n}\nfunction _getComments() {\n _getComments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(showID) {\n var response;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.prev = 0;\n _context2.next = 3;\n return fetch(\"\".concat(commentsUrl, \"?\").concat(new URLSearchParams({\n item_id: showID\n })));\n case 3:\n response = _context2.sent;\n if (response.ok) {\n _context2.next = 9;\n break;\n }\n _context2.next = 7;\n return Promise.reject(new Error(response.status.toString()));\n case 7:\n _context2.next = 12;\n break;\n case 9:\n _context2.next = 11;\n return response.json();\n case 11:\n return _context2.abrupt(\"return\", _context2.sent);\n case 12:\n _context2.next = 16;\n break;\n case 14:\n _context2.prev = 14;\n _context2.t0 = _context2[\"catch\"](0);\n case 16:\n return _context2.abrupt(\"return\", []);\n case 17:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, null, [[0, 14]]);\n }));\n return _getComments.apply(this, arguments);\n}\n\n\n//# sourceURL=webpack://my-webpack-project/./src/modules/commentsApi.js?"); + +/***/ }), + +/***/ "./src/modules/commentsPopupWindow.js": +/*!********************************************!*\ + !*** ./src/modules/commentsPopupWindow.js ***! + \********************************************/ +/***/ ((module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _commentCounter_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./commentCounter.js */ \"./src/modules/commentCounter.js\");\n/* harmony import */ var _commentsApi_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./commentsApi.js */ \"./src/modules/commentsApi.js\");\n/* harmony import */ var _getDate_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./getDate.js */ \"./src/modules/getDate.js\");\n/* harmony import */ var _initializer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./initializer.js */ \"./src/modules/initializer.js\");\n/* harmony import */ var _validateComment_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./validateComment.js */ \"./src/modules/validateComment.js\");\nvar __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_initializer_js__WEBPACK_IMPORTED_MODULE_3__]);\n_initializer_js__WEBPACK_IMPORTED_MODULE_3__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\n\n\n// import { getComments } from './commentsApi.js';\n\n\n\nvar createLiComments = function createLiComments(comments) {\n var fragment = document.createDocumentFragment();\n if (comments.length === 0) {\n return '';\n }\n comments.reverse().forEach(function (comment) {\n var li = document.createElement('li');\n li.textContent = \"\".concat(comment.creation_date, \": \").concat(comment.username, \"--\").concat(comment.comment);\n fragment.append(li);\n });\n return fragment;\n};\nvar createOneLiComment = function createOneLiComment(comment) {\n var li = document.createElement('li');\n li.textContent = \"\".concat((0,_getDate_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(), \":\").concat(comment);\n return li;\n};\nvar popupWindow = function popupWindow(_ref, index, closePopup) {\n var showId = _ref.showId,\n imgMediumUrl = _ref.imgMediumUrl,\n imgAlt = _ref.imgAlt,\n name = _ref.name,\n episodeName = _ref.episodeName,\n season = _ref.season,\n episode = _ref.episode,\n summary = _ref.summary;\n var localCommentsArray = [];\n localCommentsArray.push.apply(localCommentsArray, _toConsumableArray(_initializer_js__WEBPACK_IMPORTED_MODULE_3__.commentsArray));\n var mainDiv = document.createElement('div');\n mainDiv.classList.add('popup-window');\n\n // start close button\n\n var closeButton = document.createElement('button');\n closeButton.classList.add('button-default', 'close-button');\n var closeIcon = document.createElement('i');\n closeIcon.classList.add('fa-solid', 'fa-xmark', 'close-icon-fa');\n closeButton.appendChild(closeIcon);\n\n // eventListener to close Popup Window\n closeButton.addEventListener('click', function () {\n closePopup();\n });\n\n // end close button\n\n // start image div\n var imgDiv = document.createElement('div');\n var imgElement = document.createElement('img');\n imgElement.classList.add('popup-image');\n imgElement.setAttribute('src', imgMediumUrl);\n imgElement.setAttribute('alt', imgAlt);\n imgDiv.appendChild(imgElement);\n // end image div\n\n // start show summary div\n var titleDiv = document.createElement('div');\n titleDiv.classList.add('title-div');\n var movieHeading = document.createElement('h3');\n movieHeading.textContent = name;\n var episodeHeading = document.createElement('h5');\n episodeHeading.textContent = episodeName;\n var detailsDiv = document.createElement('div');\n detailsDiv.classList.add('details-div');\n var seasonSpan = document.createElement('span');\n seasonSpan.textContent = \"Season : \".concat(season);\n var episodeSpan = document.createElement('span');\n episodeSpan.textContent = \"Episode : \".concat(episode);\n detailsDiv.append(seasonSpan, episodeSpan);\n titleDiv.append(movieHeading, episodeHeading, detailsDiv);\n var summaryDiv = document.createElement('div');\n summaryDiv.innerHTML = summary;\n summaryDiv.classList.add('summary-div');\n // end show descritption div\n\n // start display comments div\n var displayCommentsDiv = document.createElement('div');\n displayCommentsDiv.classList.add('display-comments');\n var commentTitleDiv = document.createElement('div');\n commentTitleDiv.classList.add('comment-title');\n var commentsHeading = document.createElement('h4');\n commentsHeading.textContent = 'Comments';\n var commentCountSpan = document.createElement('span');\n commentCountSpan.setAttribute('id', 'comment-count');\n commentsHeading.append(commentCountSpan);\n commentTitleDiv.append(commentsHeading);\n var commentsUL = document.createElement('ul');\n commentsUL.classList.add('comments-ul');\n\n //* createLiComments will return a fragment containing list items of commenst\n\n var comments = createLiComments(_initializer_js__WEBPACK_IMPORTED_MODULE_3__.commentsArray[index]);\n commentsUL.append(comments);\n var updateCommentCount = function updateCommentCount() {\n var commentCount = (0,_commentCounter_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(commentsUL);\n commentCountSpan.textContent = \"(\".concat(commentCount, \")\");\n };\n updateCommentCount();\n displayCommentsDiv.append(commentTitleDiv, commentsUL);\n // end display comments div\n\n // start New Comments div\n var newCommentsDiv = document.createElement('div');\n newCommentsDiv.classList.add('new-comments');\n var newCommentHeading = document.createElement('h4');\n newCommentHeading.textContent = 'Add A Comment';\n var commentsForm = document.createElement('form');\n commentsForm.classList.add('comments-form');\n commentsForm.setAttribute('action', '');\n var nameInput = document.createElement('input');\n nameInput.setAttribute('type', 'text');\n nameInput.setAttribute('required', '');\n nameInput.setAttribute('placeholder', 'Your Name');\n var commentTextArea = document.createElement('textarea');\n commentTextArea.setAttribute('required', '');\n commentTextArea.setAttribute('placeholder', 'Your Comments');\n commentTextArea.setAttribute('cols', '25');\n commentTextArea.setAttribute('rows', '3');\n var commentButton = document.createElement('button');\n // commentButton.setAttribute('type','submit')\n // commentButton.setAttribute('value','Comment')\n commentButton.classList.add('comment-button', 'button-85');\n commentButton.innerHTML = 'Comment';\n commentsForm.append(nameInput, commentTextArea, commentButton);\n newCommentsDiv.append(newCommentHeading, commentsForm);\n // end new Comments div\n\n // commentsForm attach EventListener\n commentsForm.addEventListener('submit', function (e) {\n e.preventDefault();\n var name = e.target.elements[0].value;\n var comment = e.target.elements[1].value;\n e.target.elements[0].value = '';\n e.target.elements[1].value = '';\n _initializer_js__WEBPACK_IMPORTED_MODULE_3__.commentsArray[index].push({\n creation_date: (0,_getDate_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(),\n user_name: name,\n comment: comment\n });\n var data = (0,_validateComment_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(name, comment);\n (0,_commentsApi_js__WEBPACK_IMPORTED_MODULE_1__.postComment)({\n showId: showId,\n name: name,\n comment: comment\n });\n var liComment = createOneLiComment(data);\n commentsUL.prepend(liComment);\n updateCommentCount();\n });\n mainDiv.append(closeButton, imgDiv, titleDiv, summaryDiv, displayCommentsDiv, newCommentsDiv);\n return mainDiv;\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (popupWindow);\n__webpack_async_result__();\n} catch(e) { __webpack_async_result__(e); } });\n\n//# sourceURL=webpack://my-webpack-project/./src/modules/commentsPopupWindow.js?"); /***/ }), @@ -54,9 +84,19 @@ eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__ /*!********************************!*\ !*** ./src/modules/display.js ***! \********************************/ +/***/ ((module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _likesApi_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./likesApi.js */ \"./src/modules/likesApi.js\");\n/* harmony import */ var _commentsPopupWindow_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./commentsPopupWindow.js */ \"./src/modules/commentsPopupWindow.js\");\nvar __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_commentsPopupWindow_js__WEBPACK_IMPORTED_MODULE_1__]);\n_commentsPopupWindow_js__WEBPACK_IMPORTED_MODULE_1__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];\n\n\n\n//* Begining of function\n\nvar showItems = function showItems(movie, likes, closeModal, popupContainer) {\n var currentLikes = likes;\n // main card body\n var itemDisplay = document.createElement('div');\n itemDisplay.classList.add('movie-card');\n\n // image div\n var movieCards = document.createElement('div');\n movieCards.classList.add('movie-image-div');\n var Img = document.createElement('img');\n Img.setAttribute('src', movie.imgMediumUrl);\n Img.setAttribute('alt', \"image of \".concat(movie.name));\n // Img.setAttribute('class', 'movie-img');\n movieCards.append(Img);\n itemDisplay.append(movieCards);\n\n // description div\n var cardDescription = document.createElement('div');\n cardDescription.classList.add('card-description');\n var tvTitle = document.createElement('h3');\n tvTitle.textContent = movie.name;\n cardDescription.append(tvTitle);\n var likeIconDiv = document.createElement('div');\n likeIconDiv.classList.add('like-div');\n\n // like button\n var likeBtn = document.createElement('button');\n likeBtn.classList.add('like-button');\n likeBtn.setAttribute('id', 'like-button');\n likeBtn.dataset.showId = movie.showId;\n var like = document.createElement('i');\n like.classList.add('fa-solid', 'fa-heart', 'red');\n likeBtn.append(like);\n likeIconDiv.append(likeBtn);\n\n // like Count\n var likeCount = document.createElement('span');\n likeCount.textContent = \"\".concat(currentLikes, \" likes\");\n likeIconDiv.append(likeCount);\n\n //* increment number of likes\n likeBtn.addEventListener('click', function () {\n currentLikes += 1;\n likeCount.textContent = \"\".concat(currentLikes, \" likes\");\n (0,_likesApi_js__WEBPACK_IMPORTED_MODULE_0__.postLike)(movie.showId);\n });\n cardDescription.appendChild(likeIconDiv);\n // comment Button\n var commentBtn = document.createElement('button');\n commentBtn.setAttribute('id', 'comment-button');\n // commentBtn.setAttribute('comment-button', `${data.id}`);\n\n commentBtn.dataset.id = movie.index;\n commentBtn.innerHTML = 'Comments';\n commentBtn.addEventListener('click', function () {\n var popup = (0,_commentsPopupWindow_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(movie, movie.index, closeModal);\n popupContainer.append(popup);\n });\n cardDescription.append(commentBtn);\n itemDisplay.appendChild(cardDescription);\n return itemDisplay;\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (showItems);\n__webpack_async_result__();\n} catch(e) { __webpack_async_result__(e); } });\n\n//# sourceURL=webpack://my-webpack-project/./src/modules/display.js?"); + +/***/ }), + +/***/ "./src/modules/getDate.js": +/*!********************************!*\ + !*** ./src/modules/getDate.js ***! + \********************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _likesApi_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./likesApi.js */ \"./src/modules/likesApi.js\");\n\n\n//* Begining of function\n\nvar showItems = function showItems(_ref) {\n var index = _ref.index,\n showId = _ref.showId,\n name = _ref.name,\n imgMediumUrl = _ref.imgMediumUrl;\n var likes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;\n var currentLikes = likes;\n // main card body\n var itemDisplay = document.createElement('div');\n itemDisplay.classList.add('movie-card');\n\n // image div\n var movieCards = document.createElement('div');\n movieCards.classList.add('movie-image-div');\n var Img = document.createElement('img');\n Img.setAttribute('src', imgMediumUrl);\n Img.setAttribute('alt', \"image of \".concat(name));\n // Img.setAttribute('class', 'movie-img');\n movieCards.append(Img);\n itemDisplay.append(movieCards);\n\n // description div\n var cardDescription = document.createElement('div');\n cardDescription.classList.add('card-description');\n var tvTitle = document.createElement('h3');\n tvTitle.textContent = name;\n cardDescription.append(tvTitle);\n var likeIconDiv = document.createElement('div');\n likeIconDiv.classList.add('like-div');\n\n // like button\n var likeBtn = document.createElement('button');\n likeBtn.classList.add('like-button');\n likeBtn.setAttribute('id', 'like-button');\n likeBtn.dataset.showId = showId;\n var like = document.createElement('i');\n like.classList.add('fa-regular', 'fa-heart');\n likeBtn.append(like);\n likeIconDiv.append(likeBtn);\n\n // like Count\n var likeCount = document.createElement('span');\n likeCount.textContent = \"\".concat(currentLikes, \" likes\");\n likeIconDiv.append(likeCount);\n\n //* increment number of likes\n likeBtn.addEventListener('click', function () {\n currentLikes += 1;\n likeCount.textContent = \"\".concat(currentLikes, \" likes\");\n (0,_likesApi_js__WEBPACK_IMPORTED_MODULE_0__.postLike)(showId);\n });\n cardDescription.appendChild(likeIconDiv);\n // comment Button\n var commentBtn = document.createElement('button');\n commentBtn.setAttribute('id', 'comment-button');\n // commentBtn.setAttribute('comment-button', `${data.id}`);\n\n commentBtn.dataset.id = index;\n commentBtn.innerHTML = 'Comments';\n cardDescription.append(commentBtn);\n itemDisplay.appendChild(cardDescription);\n return itemDisplay;\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (showItems);\n\n//# sourceURL=webpack://my-webpack-project/./src/modules/display.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nfunction getDate() {\n var today = new Date();\n var dd = String(today.getDate()).padStart(2, '0');\n var mm = String(today.getMonth() + 1).padStart(2, '0'); // janvier = 0\n var yyyy = today.getFullYear();\n return \"\".concat(yyyy, \"-\").concat(mm, \"-\").concat(dd);\n // return dd + '/' + mm + '/' + yyyy; // change form if you need\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getDate);\n\n//# sourceURL=webpack://my-webpack-project/./src/modules/getDate.js?"); /***/ }), @@ -66,7 +106,17 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \**********************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nvar movieUrl = 'https://api.tvmaze.com/schedule/web?date=2020-05-28&country=US';\nfunction parseMovieData(dataArray) {\n var parsedArray = [];\n dataArray.forEach(function (movie, index) {\n // console.log(movie);\n var id = movie.id,\n name = movie.name,\n season = movie.season,\n number = movie.number,\n _movie$_embedded$show = movie._embedded.show,\n showName = _movie$_embedded$show.name,\n _movie$_embedded$show2 = _movie$_embedded$show.image,\n medium = _movie$_embedded$show2.medium,\n original = _movie$_embedded$show2.original,\n summary = _movie$_embedded$show.summary;\n var show = {\n index: index,\n showId: id,\n name: showName,\n episodeName: name,\n season: season,\n episode: number,\n imgMediumUrl: medium,\n imgOriginal: original,\n summary: summary\n };\n\n // console.log(show);\n parsedArray.push(show);\n });\n return parsedArray;\n}\nfunction getMovies() {\n return _getMovies.apply(this, arguments);\n}\nfunction _getMovies() {\n _getMovies = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var response, data;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return fetch(movieUrl);\n case 2:\n response = _context.sent;\n _context.next = 5;\n return response.json();\n case 5:\n data = _context.sent;\n return _context.abrupt(\"return\", parseMovieData(data));\n case 7:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n return _getMovies.apply(this, arguments);\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getMovies);\n\n//# sourceURL=webpack://my-webpack-project/./src/modules/getMovies.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nvar movieUrl = 'https://api.tvmaze.com/schedule/web?date=2020-05-29&country=US';\nfunction parseMovieData(dataArray) {\n var parsedArray = [];\n dataArray.forEach(function (movie, index) {\n // console.log(movie);\n var id = movie.id,\n name = movie.name,\n season = movie.season,\n number = movie.number,\n _movie$_embedded$show = movie._embedded.show,\n showName = _movie$_embedded$show.name,\n _movie$_embedded$show2 = _movie$_embedded$show.image,\n medium = _movie$_embedded$show2.medium,\n original = _movie$_embedded$show2.original,\n summary = _movie$_embedded$show.summary;\n var show = {\n index: index,\n showId: id,\n name: showName,\n episodeName: name,\n season: season,\n episode: number,\n imgMediumUrl: medium,\n imgOriginal: original,\n summary: summary\n };\n\n // console.log(show);\n parsedArray.push(show);\n });\n return parsedArray;\n}\nfunction getMovies() {\n return _getMovies.apply(this, arguments);\n}\nfunction _getMovies() {\n _getMovies = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var response, data;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return fetch(movieUrl);\n case 2:\n response = _context.sent;\n _context.next = 5;\n return response.json();\n case 5:\n data = _context.sent;\n return _context.abrupt(\"return\", parseMovieData(data));\n case 7:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n return _getMovies.apply(this, arguments);\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getMovies);\n\n//# sourceURL=webpack://my-webpack-project/./src/modules/getMovies.js?"); + +/***/ }), + +/***/ "./src/modules/initializer.js": +/*!************************************!*\ + !*** ./src/modules/initializer.js ***! + \************************************/ +/***/ ((module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"commentsArray\": () => (/* binding */ commentsArray),\n/* harmony export */ \"findLikes\": () => (/* binding */ findLikes),\n/* harmony export */ \"movieArray\": () => (/* binding */ movieArray)\n/* harmony export */ });\n/* harmony import */ var _getMovies_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getMovies.js */ \"./src/modules/getMovies.js\");\n/* harmony import */ var _likesApi_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./likesApi.js */ \"./src/modules/likesApi.js\");\n/* harmony import */ var _commentsApi_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./commentsApi.js */ \"./src/modules/commentsApi.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\n\n\nvar movieArray = await (0,_getMovies_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])();\nvar allLikes = await (0,_likesApi_js__WEBPACK_IMPORTED_MODULE_1__.getLikes)();\n\n// function\n\nvar allIdsArray = [];\nmovieArray.forEach(function (movie) {\n allIdsArray.push(movie.showId);\n});\nfunction getAllComments(_x) {\n return _getAllComments.apply(this, arguments);\n}\nfunction _getAllComments() {\n _getAllComments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(showIdsArray) {\n var allCommentsArray, allArray, index, comment;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n allCommentsArray = [];\n allArray = [];\n for (index = 0; index < showIdsArray.length; index += 1) {\n comment = (0,_commentsApi_js__WEBPACK_IMPORTED_MODULE_2__.getComments)(showIdsArray[index]);\n allCommentsArray.push(comment);\n }\n _context.next = 5;\n return Promise.all(allCommentsArray);\n case 5:\n allArray = _context.sent;\n return _context.abrupt(\"return\", allArray);\n case 7:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n return _getAllComments.apply(this, arguments);\n}\nvar findLikes = function findLikes(id) {\n var _result$likes;\n var result = allLikes.find(function (like) {\n return like.item_id === id;\n });\n return (_result$likes = result === null || result === void 0 ? void 0 : result.likes) !== null && _result$likes !== void 0 ? _result$likes : 0;\n};\nvar commentsArray = await getAllComments(allIdsArray);\n\n__webpack_async_result__();\n} catch(e) { __webpack_async_result__(e); } }, 1);\n\n//# sourceURL=webpack://my-webpack-project/./src/modules/initializer.js?"); /***/ }), @@ -80,13 +130,33 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ }), +/***/ "./src/modules/validateComment.js": +/*!****************************************!*\ + !*** ./src/modules/validateComment.js ***! + \****************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nvar validateComment = function validateComment(name, comment) {\n return \"\".concat(name, \" -- \").concat(comment);\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateComment);\n\n//# sourceURL=webpack://my-webpack-project/./src/modules/validateComment.js?"); + +/***/ }), + +/***/ "./node_modules/css-loader/dist/cjs.js!./src/css/pop-window.css": +/*!**********************************************************************!*\ + !*** ./node_modules/css-loader/dist/cjs.js!./src/css/pop-window.css ***! + \**********************************************************************/ +/***/ ((module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../node_modules/css-loader/dist/runtime/noSourceMaps.js */ \"./node_modules/css-loader/dist/runtime/noSourceMaps.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../node_modules/css-loader/dist/runtime/getUrl.js */ \"./node_modules/css-loader/dist/runtime/getUrl.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2__);\n// Imports\n\n\n\nvar ___CSS_LOADER_URL_IMPORT_0___ = new URL(/* asset import */ __webpack_require__(/*! ../../../../../../src/assets/dust_scratches.png */ \"./src/assets/dust_scratches.png\"), __webpack_require__.b);\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));\nvar ___CSS_LOADER_URL_REPLACEMENT_0___ = _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2___default()(___CSS_LOADER_URL_IMPORT_0___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"\\n/* Styling for the popup window */\\n\\n.popup-window1 {\\n display: none;\\n visibility: hidden;\\n}\\n\\n.button-default {\\n background: none;\\n color: inherit;\\n border: none;\\n padding: 0;\\n font: inherit;\\n cursor: pointer;\\n outline: inherit;\\n}\\n\\n.close-button {\\n position: absolute;\\n right: 0;\\n margin-right: 15px;\\n font-size: 45px;\\n}\\n\\n.close-icon-fa {\\n color: rgb(255, 42, 0);\\n}\\n\\n.popup-window {\\n display: flex;\\n flex-direction: column;\\n width: 70%;\\n border: 5px solid black;\\n\\n /* justify-content:space-evenly; */\\n align-items: center;\\n z-index: 10;\\n position: fixed;\\n top: 50%;\\n left: 50%;\\n\\n /* bring your own prefixes */\\n transform: translate(-50%, -50%);\\n text-align: center;\\n height: 700px;\\n\\n /* height:max-content; */\\n background-image: url(\" + ___CSS_LOADER_URL_REPLACEMENT_0___ + \");\\n overflow-y: auto;\\n padding-top: 20px;\\n padding-bottom: 20px;\\n}\\n\\n.popup-image {\\n width: auto;\\n height: 250px;\\n}\\n\\n.title-div {\\n margin: 10px;\\n width: 350px;\\n}\\n\\n.summary-div {\\n padding-right: 40px;\\n padding-left: 40px;\\n text-align: justify;\\n}\\n\\n.display-comments {\\n margin-top: 20px;\\n margin-bottom: 20px;\\n text-align: left;\\n overflow-x: visible;\\n width: 450px;\\n padding-left: 5px;\\n\\n /* overflow-y: hidden; */\\n}\\n\\n.details-div {\\n display: flex;\\n width: 70%;\\n margin: auto;\\n color: blueviolet;\\n justify-content: space-between;\\n}\\n\\n.comment-title {\\n display: flex;\\n justify-content: center;\\n}\\n\\n.comments-ul {\\n border: 2px solid blue;\\n list-style-type: none;\\n text-align: left;\\n padding-left: 0;\\n height: 150px;\\n overflow-y: auto;\\n}\\n\\n.comments-ul li:nth-child(odd) { background: rgba(124, 235, 249, 0.538); }\\n\\n.new-comments {\\n width: 350px;\\n}\\n\\n.comments-form {\\n display: flex;\\n flex-direction: column;\\n justify-content: space-between;\\n align-items: flex-start;\\n height: 190px;\\n}\\n\\n.comment-button {\\n margin-bottom: 10px;\\n}\\n\\n/* CSS */\\n.button-85 {\\n padding: 0.4em 1.7em;\\n border: none;\\n outline: none;\\n color: rgb(255, 255, 255);\\n background: #111;\\n cursor: pointer;\\n position: relative;\\n z-index: 0;\\n border-radius: 10px;\\n user-select: none;\\n -webkit-user-select: none;\\n touch-action: manipulation;\\n}\\n\\n.button-85::before {\\n content: \\\"\\\";\\n background:\\n linear-gradient(\\n 45deg,\\n #f00,\\n #ff7300,\\n #fffb00,\\n #48ff00,\\n #00ffd5,\\n #002bff,\\n #7a00ff,\\n #ff00c8,\\n #f00\\n );\\n position: absolute;\\n top: -2px;\\n left: -2px;\\n background-size: 400%;\\n z-index: -1;\\n filter: blur(5px);\\n -webkit-filter: blur(5px);\\n width: calc(100% + 4px);\\n height: calc(100% + 4px);\\n animation: glowing-button-85 20s linear infinite;\\n transition: opacity 0.3s ease-in-out;\\n border-radius: 10px;\\n}\\n\\n@keyframes glowing-button-85 {\\n 0% {\\n background-position: 0 0;\\n }\\n\\n 50% {\\n background-position: 400% 0;\\n }\\n\\n 100% {\\n background-position: 0 0;\\n }\\n}\\n\\n.button-85::after {\\n z-index: -1;\\n content: \\\"\\\";\\n position: absolute;\\n width: 100%;\\n height: 100%;\\n background: #222;\\n left: 0;\\n top: 0;\\n border-radius: 10px;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://my-webpack-project/./src/css/pop-window.css?./node_modules/css-loader/dist/cjs.js"); + +/***/ }), + /***/ "./node_modules/css-loader/dist/cjs.js!./src/style.css": /*!*************************************************************!*\ !*** ./node_modules/css-loader/dist/cjs.js!./src/style.css ***! \*************************************************************/ /***/ ((module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/noSourceMaps.js */ \"./node_modules/css-loader/dist/runtime/noSourceMaps.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/getUrl.js */ \"./node_modules/css-loader/dist/runtime/getUrl.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2__);\n// Imports\n\n\n\nvar ___CSS_LOADER_URL_IMPORT_0___ = new URL(/* asset import */ __webpack_require__(/*! ../../../../../../src/assets/so-white.png */ \"./src/assets/so-white.png\"), __webpack_require__.b);\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));\nvar ___CSS_LOADER_URL_REPLACEMENT_0___ = _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2___default()(___CSS_LOADER_URL_IMPORT_0___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/*\\r\\n 1. Use a more-intuitive box-sizing model.\\r\\n*/\\r\\n*,\\r\\n*::before,\\r\\n*::after {\\r\\n box-sizing: border-box;\\r\\n}\\r\\n\\r\\n/*\\r\\n 2. Remove default margin\\r\\n*/\\r\\n* {\\r\\n margin: 0;\\r\\n}\\r\\n\\r\\n/*\\r\\n 3. Allow percentage-based heights in the application\\r\\n*/\\r\\nhtml,\\r\\nbody {\\r\\n height: 100%;\\r\\n}\\r\\n\\r\\n/*\\r\\n Typographic tweaks!\\r\\n 4. Add accessible line-height\\r\\n 5. Improve text rendering\\r\\n*/\\r\\nbody {\\r\\n line-height: 1.5;\\r\\n -webkit-font-smoothing: antialiased;\\r\\n font-family: 'Magra', sans-serif;\\r\\n font-size: 18px;\\r\\n letter-spacing: 1px;\\r\\n background-image: url(\" + ___CSS_LOADER_URL_REPLACEMENT_0___ + \");\\r\\n padding-bottom: 60px;\\r\\n}\\r\\n\\r\\n/*\\r\\n 6. Improve media defaults\\r\\n*/\\r\\nimg,\\r\\npicture,\\r\\nvideo,\\r\\ncanvas,\\r\\nsvg {\\r\\n display: block;\\r\\n max-width: 100%;\\r\\n}\\r\\n\\r\\n/*\\r\\n 7. Remove built-in form typography styles\\r\\n*/\\r\\ninput,\\r\\nbutton,\\r\\ntextarea,\\r\\nselect {\\r\\n font: inherit;\\r\\n}\\r\\n\\r\\n/*\\r\\n 8. Avoid text overflows\\r\\n*/\\r\\nh1,\\r\\nh2,\\r\\nh3,\\r\\nh4,\\r\\nh5,\\r\\nh6 {\\r\\n overflow-wrap: break-word;\\r\\n font-family: 'Metamorphous', cursive;\\r\\n}\\r\\n\\r\\np {\\r\\n overflow-wrap: break-word;\\r\\n}\\r\\n\\r\\n/*\\r\\n 9. Create a root stacking context\\r\\n*/\\r\\n#root,\\r\\n#__next {\\r\\n isolation: isolate;\\r\\n}\\r\\n\\r\\n.header {\\r\\n display: flex;\\r\\n justify-content: space-around;\\r\\n align-items: center;\\r\\n background-color: #204ecf;\\r\\n padding: 10px;\\r\\n}\\r\\n\\r\\n.logo-div {\\r\\n display: flex;\\r\\n align-items: center;\\r\\n color: white;\\r\\n font-size: 30px;\\r\\n}\\r\\n\\r\\n.movie-icon {\\r\\n width: 100px;\\r\\n}\\r\\n\\r\\n.nav-link {\\r\\n width: 350px;\\r\\n display: flex;\\r\\n justify-content: space-between;\\r\\n padding-left: 30px;\\r\\n padding-right: 30px;\\r\\n}\\r\\n\\r\\na {\\r\\n text-decoration: none;\\r\\n color: white;\\r\\n}\\r\\n\\r\\n.footer {\\r\\n display: flex;\\r\\n justify-content: space-around;\\r\\n align-items: center;\\r\\n padding: 10px;\\r\\n font-weight: normal;\\r\\n}\\r\\n\\r\\n.footer-logo-div {\\r\\n display: flex;\\r\\n align-items: center;\\r\\n color: white;\\r\\n font-size: 25px;\\r\\n}\\r\\n\\r\\n.footer-icon {\\r\\n width: 70px;\\r\\n height: auto;\\r\\n}\\r\\n\\r\\nfooter {\\r\\n width: 100%;\\r\\n position: fixed;\\r\\n bottom: 0;\\r\\n display: flex;\\r\\n flex-direction: column;\\r\\n background-color: #204ecf;\\r\\n color: white;\\r\\n height: 60px;\\r\\n}\\r\\n\\r\\n/* styling for movie cards */\\r\\n\\r\\n.main-section {\\r\\n display: grid;\\r\\n grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));\\r\\n margin: 20px;\\r\\n grid-gap: 20px;\\r\\n padding: 20px;\\r\\n margin-top: 90px;\\r\\n margin-bottom: 90px;\\r\\n}\\r\\n\\r\\n.movie-card {\\r\\n display: flex;\\r\\n flex-direction: column;\\r\\n\\r\\n /* border:4px solid black; */\\r\\n\\r\\n /* justify-content: space-between; */\\r\\n width: 300px;\\r\\n height: 433px;\\r\\n align-items: center;\\r\\n background-color: whitesmoke;\\r\\n box-shadow:\\r\\n 1.7px 2.6px 2.8px rgba(0, 0, 0, 0.052),\\r\\n 4.6px 7px 7.8px rgba(0, 0, 0, 0.07),\\r\\n 11.1px 16.7px 18.7px rgba(0, 0, 0, 0.082),\\r\\n 37px 56px 62px rgba(0, 0, 0, 0.1);\\r\\n}\\r\\n\\r\\n.movie-image-div {\\r\\n display: flex;\\r\\n justify-content: center;\\r\\n width: 100%;\\r\\n height: 295px;\\r\\n\\r\\n /* background-color:#77628e; */\\r\\n background: rgb(115, 147, 200);\\r\\n background: linear-gradient(90deg, rgba(115, 147, 200, 1) 0%, rgba(33, 64, 171, 1) 100%);\\r\\n\\r\\n /* border-bottom: 1px solid rgb(207, 194, 194); */\\r\\n}\\r\\n\\r\\n.movie-image {\\r\\n /* pass */\\r\\n}\\r\\n\\r\\n.card-description {\\r\\n display: flex;\\r\\n flex-direction: column;\\r\\n\\r\\n /* flex-wrap: wrap; */\\r\\n justify-content: space-around;\\r\\n text-align: center;\\r\\n align-items: center;\\r\\n width: 100%;\\r\\n height: 50%;\\r\\n}\\r\\n\\r\\n.like-div {\\r\\n display: flex;\\r\\n\\r\\n /* flex-direction: column; */\\r\\n justify-content: space-between;\\r\\n align-items: center;\\r\\n width: 50%;\\r\\n\\r\\n /* padding-right: 120px; */\\r\\n}\\r\\n\\r\\n.like-button {\\r\\n background: none;\\r\\n color: inherit;\\r\\n border: none;\\r\\n padding: 0;\\r\\n font: inherit;\\r\\n cursor: pointer;\\r\\n outline: inherit;\\r\\n font-size: 30px;\\r\\n}\\r\\n\", \"\"]);\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://my-webpack-project/./src/style.css?./node_modules/css-loader/dist/cjs.js"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/noSourceMaps.js */ \"./node_modules/css-loader/dist/runtime/noSourceMaps.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _node_modules_css_loader_dist_cjs_js_css_pop_window_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! -!../node_modules/css-loader/dist/cjs.js!./css/pop-window.css */ \"./node_modules/css-loader/dist/cjs.js!./src/css/pop-window.css\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/getUrl.js */ \"./node_modules/css-loader/dist/runtime/getUrl.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_3__);\n// Imports\n\n\n\n\nvar ___CSS_LOADER_URL_IMPORT_0___ = new URL(/* asset import */ __webpack_require__(/*! ../../../../../../src/assets/so-white.png */ \"./src/assets/so-white.png\"), __webpack_require__.b);\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));\n___CSS_LOADER_EXPORT___.i(_node_modules_css_loader_dist_cjs_js_css_pop_window_css__WEBPACK_IMPORTED_MODULE_2__[\"default\"]);\nvar ___CSS_LOADER_URL_REPLACEMENT_0___ = _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_3___default()(___CSS_LOADER_URL_IMPORT_0___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"\\n/*\\n 1. Use a more-intuitive box-sizing model.\\n*/\\n*,\\n*::before,\\n*::after {\\n box-sizing: border-box;\\n}\\n\\n/*\\n 2. Remove default margin\\n*/\\n* {\\n margin: 0;\\n}\\n\\n/*\\n 3. Allow percentage-based heights in the application\\n*/\\nhtml,\\nbody {\\n height: 100%;\\n}\\n\\n/*\\n Typographic tweaks!\\n 4. Add accessible line-height\\n 5. Improve text rendering\\n*/\\nbody {\\n line-height: 1.5;\\n -webkit-font-smoothing: antialiased;\\n font-family: 'Mukta Malar', sans-serif;\\n font-size: 18px;\\n letter-spacing: 1px;\\n background-image: url(\" + ___CSS_LOADER_URL_REPLACEMENT_0___ + \");\\n padding-bottom: 60px;\\n}\\n\\n/*\\n 6. Improve media defaults\\n*/\\nimg,\\npicture,\\nvideo,\\ncanvas,\\nsvg {\\n display: block;\\n max-width: 100%;\\n}\\n\\n/*\\n 7. Remove built-in form typography styles\\n*/\\ninput,\\nbutton,\\ntextarea,\\nselect {\\n font: inherit;\\n}\\n\\n/*\\n 8. Avoid text overflows\\n*/\\nh1,\\nh2,\\nh3,\\nh4,\\nh5,\\nh6 {\\n overflow-wrap: break-word;\\n font-family: 'Tenor Sans', sans-serif;\\n}\\n\\np {\\n overflow-wrap: break-word;\\n}\\n\\n/*\\n 9. Create a root stacking context\\n*/\\n#root,\\n#__next {\\n isolation: isolate;\\n}\\n\\nspan {\\n font-size: 22px;\\n}\\n\\n.page-title {\\n margin: auto;\\n text-align: center;\\n padding-top: 50px;\\n font-size: 50px;\\n}\\n\\n.header {\\n display: flex;\\n justify-content: space-around;\\n align-items: center;\\n background-color: #204ecf;\\n padding: 10px;\\n}\\n\\n.logo-div {\\n display: flex;\\n align-items: center;\\n color: white;\\n font-size: 30px;\\n}\\n\\n.movie-icon {\\n width: 100px;\\n}\\n\\n.nav-link {\\n width: 350px;\\n display: flex;\\n justify-content: space-between;\\n padding-left: 30px;\\n padding-right: 30px;\\n}\\n\\na {\\n text-decoration: none;\\n color: white;\\n}\\n\\n.footer {\\n display: flex;\\n justify-content: space-around;\\n align-items: center;\\n padding: 10px;\\n font-weight: normal;\\n}\\n\\n.footer-logo-div {\\n display: flex;\\n align-items: center;\\n color: white;\\n font-size: 25px;\\n}\\n\\n.footer-icon {\\n width: 70px;\\n height: auto;\\n}\\n\\nfooter {\\n width: 100%;\\n position: fixed;\\n bottom: 0;\\n display: flex;\\n flex-direction: column;\\n background-color: #204ecf;\\n color: white;\\n height: 60px;\\n}\\n\\n/* styling for movie cards */\\n\\n.main-section {\\n display: grid;\\n grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));\\n margin: 20px;\\n grid-gap: 20px;\\n padding: 20px;\\n margin-top: 90px;\\n margin-bottom: 90px;\\n}\\n\\n.movie-card {\\n display: flex;\\n flex-direction: column;\\n\\n /* border:4px solid black; */\\n\\n /* justify-content: space-between; */\\n padding-bottom: 5px;\\n width: 300px;\\n height: 440px;\\n align-items: center;\\n background-color: whitesmoke;\\n box-shadow:\\n 1.7px 2.6px 2.8px rgba(0, 0, 0, 0.052),\\n 4.6px 7px 7.8px rgba(0, 0, 0, 0.07),\\n 11.1px 16.7px 18.7px rgba(0, 0, 0, 0.082),\\n 37px 56px 62px rgba(0, 0, 0, 0.1);\\n}\\n\\n.movie-image-div {\\n display: flex;\\n justify-content: center;\\n width: 100%;\\n height: 295px;\\n\\n /* background-color:#77628e; */\\n background: rgb(115, 147, 200);\\n background: linear-gradient(90deg, rgba(115, 147, 200, 1) 0%, rgba(33, 64, 171, 1) 100%);\\n\\n /* border-bottom: 1px solid rgb(207, 194, 194); */\\n}\\n\\n.movie-image {\\n /* pass */\\n}\\n\\n.card-description {\\n display: flex;\\n flex-direction: column;\\n\\n /* flex-wrap: wrap; */\\n justify-content: space-around;\\n text-align: center;\\n align-items: center;\\n width: 100%;\\n height: 50%;\\n}\\n\\n.like-div {\\n display: flex;\\n\\n /* flex-direction: column; */\\n justify-content: space-between;\\n align-items: center;\\n width: 50%;\\n\\n /* padding-right: 120px; */\\n}\\n\\n.like-button {\\n background: none;\\n color: inherit;\\n border: none;\\n padding: 0;\\n font: inherit;\\n cursor: pointer;\\n outline: inherit;\\n font-size: 30px;\\n}\\n\\n.red {\\n color: red;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://my-webpack-project/./src/style.css?./node_modules/css-loader/dist/cjs.js"); /***/ }), @@ -160,6 +230,16 @@ eval("\n\n/* istanbul ignore next */\nfunction styleTagTransform(css, styleElem /***/ }), +/***/ "./src/assets/dust_scratches.png": +/*!***************************************!*\ + !*** ./src/assets/dust_scratches.png ***! + \***************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("module.exports = __webpack_require__.p + \"3a1926a3547db7d195be.png\";\n\n//# sourceURL=webpack://my-webpack-project/./src/assets/dust_scratches.png?"); + +/***/ }), + /***/ "./src/assets/so-white.png": /*!*********************************!*\ !*** ./src/assets/so-white.png ***! diff --git a/package-lock.json b/package-lock.json index 8f12c54..f9e7fd3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dotenv-webpack": "^8.0.1", "jest": "^29.3.1", "jest-environment-jsdom": "^29.3.1", - "node-vibrant": "^3.1.6" + "node-vibrant": "^3.2.1-alpha.1" }, "devDependencies": { "@babel/core": "^7.20.5", @@ -3546,6 +3546,103 @@ "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==" }, + "node_modules/@vibrant/color": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/color/-/color-3.2.1-alpha.1.tgz", + "integrity": "sha512-cvm+jAPwao2NerTr3d1JttYyLhp3eD/AQBeevxF7KT6HctToWZCwr2AeTr003/wKgbjzdOV1qySnbyOeu+R+Jw==" + }, + "node_modules/@vibrant/core": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/core/-/core-3.2.1-alpha.1.tgz", + "integrity": "sha512-X9Oa9WfPEQnZ6L+5dLRlh+IlsxJkYTw9b/g3stFKoNXbVRKCeXHmH48l7jIBBOg3VcXOGUdsYBqsTwPNkIveaA==", + "dependencies": { + "@vibrant/color": "^3.2.1-alpha.1", + "@vibrant/generator": "^3.2.1-alpha.1", + "@vibrant/image": "^3.2.1-alpha.1", + "@vibrant/quantizer": "^3.2.1-alpha.1", + "@vibrant/types": "^3.2.1-alpha.1", + "@vibrant/worker": "^3.2.1-alpha.1" + } + }, + "node_modules/@vibrant/generator": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/generator/-/generator-3.2.1-alpha.1.tgz", + "integrity": "sha512-luS5YvMhwMqG01YTj1dJ+cmkuIw1VCByOR6zIaCOwQqI/mcOs88JBWcA1r2TywJTOPlVpjfnDvAlyaKBKh4dMA==", + "dependencies": { + "@vibrant/color": "^3.2.1-alpha.1", + "@vibrant/types": "^3.2.1-alpha.1" + } + }, + "node_modules/@vibrant/generator-default": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/generator-default/-/generator-default-3.2.1-alpha.1.tgz", + "integrity": "sha512-BWnQhDaz92UhyHnpdAzKXHQecY+jvyMXtzjKYbveFxThm6+HVoLjwONlbck7oyOpFzV2OM7V11XuR85BxaHvjw==", + "dependencies": { + "@vibrant/color": "^3.2.1-alpha.1", + "@vibrant/generator": "^3.2.1-alpha.1" + } + }, + "node_modules/@vibrant/image": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/image/-/image-3.2.1-alpha.1.tgz", + "integrity": "sha512-4aF5k79QfyhZOqRovJpbnIjWfe3uuWhY8voqVdd4/qgu4o70/AwVlM+pYmCaJVzI45VWNWWHYA5QlYuKsXnBqQ==", + "dependencies": { + "@vibrant/color": "^3.2.1-alpha.1", + "@vibrant/types": "^3.2.1-alpha.1" + } + }, + "node_modules/@vibrant/image-browser": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/image-browser/-/image-browser-3.2.1-alpha.1.tgz", + "integrity": "sha512-6xWvQfB20sE6YtCWylgEAHuee3iD8h3aFIDbCS2yj7jIelKcYTrrp5jg2d2BhOOB6pC5JzF+QfpCrm0DmAIlgQ==", + "dependencies": { + "@vibrant/image": "^3.2.1-alpha.1" + } + }, + "node_modules/@vibrant/image-node": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/image-node/-/image-node-3.2.1-alpha.1.tgz", + "integrity": "sha512-/Io/Rpo4EkO6AhaXdcxUXkbOFhSFtjm0LSAM4c0AyGA5EbC8PyZqjk8b11bQAEMCaYaweFQfTdGD7oVbXe21CQ==", + "dependencies": { + "@jimp/custom": "^0.16.1", + "@jimp/plugin-resize": "^0.16.1", + "@jimp/types": "^0.16.1", + "@vibrant/image": "^3.2.1-alpha.1" + } + }, + "node_modules/@vibrant/quantizer": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/quantizer/-/quantizer-3.2.1-alpha.1.tgz", + "integrity": "sha512-iHnPx/+n4iLtYLm1GClSfyg2fFbMatFG0ipCyp9M6tXNIPAg+pSvUJSGBnVnH7Nl/bR8Gkkj1h0pJ4RsKcdIrQ==", + "dependencies": { + "@vibrant/color": "^3.2.1-alpha.1", + "@vibrant/image": "^3.2.1-alpha.1", + "@vibrant/types": "^3.2.1-alpha.1" + } + }, + "node_modules/@vibrant/quantizer-mmcq": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/quantizer-mmcq/-/quantizer-mmcq-3.2.1-alpha.1.tgz", + "integrity": "sha512-Wuk9PTZtxr8qsWTcgP6lcrrmrq36syVwxf+BUxdgQYntBcQ053SaN34lVGOJ0WPdK5vABoxbYljhceCgiILtZw==", + "dependencies": { + "@vibrant/color": "^3.2.1-alpha.1", + "@vibrant/image": "^3.2.1-alpha.1", + "@vibrant/quantizer": "^3.2.1-alpha.1" + } + }, + "node_modules/@vibrant/types": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/types/-/types-3.2.1-alpha.1.tgz", + "integrity": "sha512-ts9u7nsrENoYI5s0MmPOeY5kCLFKvQndKVDOPFCbTA0z493uhDp8mpiQhjFYTf3kPbS04z9zbHLE2luFC7x4KQ==" + }, + "node_modules/@vibrant/worker": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/worker/-/worker-3.2.1-alpha.1.tgz", + "integrity": "sha512-mtSlBdHkFNr4FOnMtqtHJxy9z5AsUcZzGlpiHzvWOoaoN9lNTDPwxOBd0q4VTYWuGPrIm6Fuq5m7aRbLv7KqiQ==", + "dependencies": { + "@vibrant/types": "^3.2.1-alpha.1" + } + }, "node_modules/@webassemblyjs/ast": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz", @@ -7597,6 +7694,15 @@ "process": "^0.11.10" } }, + "node_modules/global": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", + "integrity": "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==", + "dependencies": { + "min-document": "^2.19.0", + "process": "^0.11.10" + } + }, "node_modules/global-modules": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-2.0.0.tgz", @@ -10975,6 +11081,20 @@ "node": ">=8.9.0" } }, + "node_modules/loader-utils": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz", + "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==", + "dev": true, + "dependencies": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + }, + "engines": { + "node": ">=8.9.0" + } + }, "node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -11864,16 +11984,16 @@ "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==" }, "node_modules/node-vibrant": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/node-vibrant/-/node-vibrant-3.1.6.tgz", - "integrity": "sha512-Wlc/hQmBMOu6xon12ZJHS2N3M+I6J8DhrD3Yo6m5175v8sFkVIN+UjhKVRcO+fqvre89ASTpmiFEP3nPO13SwA==", - "dependencies": { - "@jimp/custom": "^0.16.1", - "@jimp/plugin-resize": "^0.16.1", - "@jimp/types": "^0.16.1", - "@types/lodash": "^4.14.53", - "@types/node": "^10.11.7", - "lodash": "^4.17.20", + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/node-vibrant/-/node-vibrant-3.2.1-alpha.1.tgz", + "integrity": "sha512-EQergCp7fvbvUCE0VMCBnvaAV0lGWSP8SXLmuWQIBzQK5M5pIwcd9fIOXuzFkJx/8hUiiiLvAzzGDS/bIy2ikA==", + "dependencies": { + "@types/node": "^10.12.18", + "@vibrant/core": "^3.2.1-alpha.1", + "@vibrant/generator-default": "^3.2.1-alpha.1", + "@vibrant/image-browser": "^3.2.1-alpha.1", + "@vibrant/image-node": "^3.2.1-alpha.1", + "@vibrant/quantizer-mmcq": "^3.2.1-alpha.1", "url": "^0.11.0" } }, @@ -20335,6 +20455,103 @@ "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==" }, + "@vibrant/color": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/color/-/color-3.2.1-alpha.1.tgz", + "integrity": "sha512-cvm+jAPwao2NerTr3d1JttYyLhp3eD/AQBeevxF7KT6HctToWZCwr2AeTr003/wKgbjzdOV1qySnbyOeu+R+Jw==" + }, + "@vibrant/core": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/core/-/core-3.2.1-alpha.1.tgz", + "integrity": "sha512-X9Oa9WfPEQnZ6L+5dLRlh+IlsxJkYTw9b/g3stFKoNXbVRKCeXHmH48l7jIBBOg3VcXOGUdsYBqsTwPNkIveaA==", + "requires": { + "@vibrant/color": "^3.2.1-alpha.1", + "@vibrant/generator": "^3.2.1-alpha.1", + "@vibrant/image": "^3.2.1-alpha.1", + "@vibrant/quantizer": "^3.2.1-alpha.1", + "@vibrant/types": "^3.2.1-alpha.1", + "@vibrant/worker": "^3.2.1-alpha.1" + } + }, + "@vibrant/generator": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/generator/-/generator-3.2.1-alpha.1.tgz", + "integrity": "sha512-luS5YvMhwMqG01YTj1dJ+cmkuIw1VCByOR6zIaCOwQqI/mcOs88JBWcA1r2TywJTOPlVpjfnDvAlyaKBKh4dMA==", + "requires": { + "@vibrant/color": "^3.2.1-alpha.1", + "@vibrant/types": "^3.2.1-alpha.1" + } + }, + "@vibrant/generator-default": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/generator-default/-/generator-default-3.2.1-alpha.1.tgz", + "integrity": "sha512-BWnQhDaz92UhyHnpdAzKXHQecY+jvyMXtzjKYbveFxThm6+HVoLjwONlbck7oyOpFzV2OM7V11XuR85BxaHvjw==", + "requires": { + "@vibrant/color": "^3.2.1-alpha.1", + "@vibrant/generator": "^3.2.1-alpha.1" + } + }, + "@vibrant/image": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/image/-/image-3.2.1-alpha.1.tgz", + "integrity": "sha512-4aF5k79QfyhZOqRovJpbnIjWfe3uuWhY8voqVdd4/qgu4o70/AwVlM+pYmCaJVzI45VWNWWHYA5QlYuKsXnBqQ==", + "requires": { + "@vibrant/color": "^3.2.1-alpha.1", + "@vibrant/types": "^3.2.1-alpha.1" + } + }, + "@vibrant/image-browser": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/image-browser/-/image-browser-3.2.1-alpha.1.tgz", + "integrity": "sha512-6xWvQfB20sE6YtCWylgEAHuee3iD8h3aFIDbCS2yj7jIelKcYTrrp5jg2d2BhOOB6pC5JzF+QfpCrm0DmAIlgQ==", + "requires": { + "@vibrant/image": "^3.2.1-alpha.1" + } + }, + "@vibrant/image-node": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/image-node/-/image-node-3.2.1-alpha.1.tgz", + "integrity": "sha512-/Io/Rpo4EkO6AhaXdcxUXkbOFhSFtjm0LSAM4c0AyGA5EbC8PyZqjk8b11bQAEMCaYaweFQfTdGD7oVbXe21CQ==", + "requires": { + "@jimp/custom": "^0.16.1", + "@jimp/plugin-resize": "^0.16.1", + "@jimp/types": "^0.16.1", + "@vibrant/image": "^3.2.1-alpha.1" + } + }, + "@vibrant/quantizer": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/quantizer/-/quantizer-3.2.1-alpha.1.tgz", + "integrity": "sha512-iHnPx/+n4iLtYLm1GClSfyg2fFbMatFG0ipCyp9M6tXNIPAg+pSvUJSGBnVnH7Nl/bR8Gkkj1h0pJ4RsKcdIrQ==", + "requires": { + "@vibrant/color": "^3.2.1-alpha.1", + "@vibrant/image": "^3.2.1-alpha.1", + "@vibrant/types": "^3.2.1-alpha.1" + } + }, + "@vibrant/quantizer-mmcq": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/quantizer-mmcq/-/quantizer-mmcq-3.2.1-alpha.1.tgz", + "integrity": "sha512-Wuk9PTZtxr8qsWTcgP6lcrrmrq36syVwxf+BUxdgQYntBcQ053SaN34lVGOJ0WPdK5vABoxbYljhceCgiILtZw==", + "requires": { + "@vibrant/color": "^3.2.1-alpha.1", + "@vibrant/image": "^3.2.1-alpha.1", + "@vibrant/quantizer": "^3.2.1-alpha.1" + } + }, + "@vibrant/types": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/types/-/types-3.2.1-alpha.1.tgz", + "integrity": "sha512-ts9u7nsrENoYI5s0MmPOeY5kCLFKvQndKVDOPFCbTA0z493uhDp8mpiQhjFYTf3kPbS04z9zbHLE2luFC7x4KQ==" + }, + "@vibrant/worker": { + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/@vibrant/worker/-/worker-3.2.1-alpha.1.tgz", + "integrity": "sha512-mtSlBdHkFNr4FOnMtqtHJxy9z5AsUcZzGlpiHzvWOoaoN9lNTDPwxOBd0q4VTYWuGPrIm6Fuq5m7aRbLv7KqiQ==", + "requires": { + "@vibrant/types": "^3.2.1-alpha.1" + } + }, "@webassemblyjs/ast": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz", @@ -23434,6 +23651,15 @@ "process": "^0.11.10" } }, + "global": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", + "integrity": "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==", + "requires": { + "min-document": "^2.19.0", + "process": "^0.11.10" + } + }, "global-modules": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-2.0.0.tgz", @@ -25884,6 +26110,17 @@ "json5": "^2.1.2" } }, + "loader-utils": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz", + "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + } + }, "locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -26553,16 +26790,16 @@ "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==" }, "node-vibrant": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/node-vibrant/-/node-vibrant-3.1.6.tgz", - "integrity": "sha512-Wlc/hQmBMOu6xon12ZJHS2N3M+I6J8DhrD3Yo6m5175v8sFkVIN+UjhKVRcO+fqvre89ASTpmiFEP3nPO13SwA==", - "requires": { - "@jimp/custom": "^0.16.1", - "@jimp/plugin-resize": "^0.16.1", - "@jimp/types": "^0.16.1", - "@types/lodash": "^4.14.53", - "@types/node": "^10.11.7", - "lodash": "^4.17.20", + "version": "3.2.1-alpha.1", + "resolved": "https://registry.npmjs.org/node-vibrant/-/node-vibrant-3.2.1-alpha.1.tgz", + "integrity": "sha512-EQergCp7fvbvUCE0VMCBnvaAV0lGWSP8SXLmuWQIBzQK5M5pIwcd9fIOXuzFkJx/8hUiiiLvAzzGDS/bIy2ikA==", + "requires": { + "@types/node": "^10.12.18", + "@vibrant/core": "^3.2.1-alpha.1", + "@vibrant/generator-default": "^3.2.1-alpha.1", + "@vibrant/image-browser": "^3.2.1-alpha.1", + "@vibrant/image-node": "^3.2.1-alpha.1", + "@vibrant/quantizer-mmcq": "^3.2.1-alpha.1", "url": "^0.11.0" }, "dependencies": { diff --git a/package.json b/package.json index 56f2151..3d48982 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ }, "dependencies": { "jest": "^29.3.1", - "jest-environment-jsdom": "^29.3.1" + "jest-environment-jsdom": "^29.3.1", + "node-vibrant": "^3.2.1-alpha.1" } } diff --git a/src/assets/dust_scratches.png b/src/assets/dust_scratches.png new file mode 100644 index 0000000..a0ae0e1 Binary files /dev/null and b/src/assets/dust_scratches.png differ diff --git a/src/assets/light-veneer.webp b/src/assets/light-veneer.webp new file mode 100644 index 0000000..833c072 Binary files /dev/null and b/src/assets/light-veneer.webp differ diff --git a/src/assets/weather.png b/src/assets/weather.png new file mode 100644 index 0000000..8c4086f Binary files /dev/null and b/src/assets/weather.png differ diff --git a/src/css/pop-window.css b/src/css/pop-window.css new file mode 100644 index 0000000..7b8294c --- /dev/null +++ b/src/css/pop-window.css @@ -0,0 +1,191 @@ + +/* Styling for the popup window */ + +.popup-window1 { + display: none; + visibility: hidden; +} + +.button-default { + background: none; + color: inherit; + border: none; + padding: 0; + font: inherit; + cursor: pointer; + outline: inherit; +} + +.close-button { + position: absolute; + right: 0; + margin-right: 15px; + font-size: 45px; +} + +.close-icon-fa { + color: rgb(255, 42, 0); +} + +.popup-window { + display: flex; + flex-direction: column; + width: 70%; + border: 5px solid black; + + /* justify-content:space-evenly; */ + align-items: center; + z-index: 10; + position: fixed; + top: 50%; + left: 50%; + + /* bring your own prefixes */ + transform: translate(-50%, -50%); + text-align: center; + height: 700px; + + /* height:max-content; */ + background-image: url('/src/assets/dust_scratches.png'); + overflow-y: auto; + padding-top: 20px; + padding-bottom: 20px; +} + +.popup-image { + width: auto; + height: 250px; +} + +.title-div { + margin: 10px; + width: 350px; +} + +.summary-div { + padding-right: 40px; + padding-left: 40px; + text-align: justify; +} + +.display-comments { + margin-top: 20px; + margin-bottom: 20px; + text-align: left; + overflow-x: visible; + width: 450px; + padding-left: 5px; + + /* overflow-y: hidden; */ +} + +.details-div { + display: flex; + width: 70%; + margin: auto; + color: blueviolet; + justify-content: space-between; +} + +.comment-title { + display: flex; + justify-content: center; +} + +.comments-ul { + border: 2px solid blue; + list-style-type: none; + text-align: left; + padding-left: 0; + height: 150px; + overflow-y: auto; +} + +.comments-ul li:nth-child(odd) { background: rgba(124, 235, 249, 0.538); } + +.new-comments { + width: 350px; +} + +.comments-form { + display: flex; + flex-direction: column; + justify-content: space-between; + align-items: flex-start; + height: 190px; +} + +.comment-button { + margin-bottom: 10px; +} + +/* CSS */ +.button-85 { + padding: 0.4em 1.7em; + border: none; + outline: none; + color: rgb(255, 255, 255); + background: #111; + cursor: pointer; + position: relative; + z-index: 0; + border-radius: 10px; + user-select: none; + -webkit-user-select: none; + touch-action: manipulation; +} + +.button-85::before { + content: ""; + background: + linear-gradient( + 45deg, + #f00, + #ff7300, + #fffb00, + #48ff00, + #00ffd5, + #002bff, + #7a00ff, + #ff00c8, + #f00 + ); + position: absolute; + top: -2px; + left: -2px; + background-size: 400%; + z-index: -1; + filter: blur(5px); + -webkit-filter: blur(5px); + width: calc(100% + 4px); + height: calc(100% + 4px); + animation: glowing-button-85 20s linear infinite; + transition: opacity 0.3s ease-in-out; + border-radius: 10px; +} + +@keyframes glowing-button-85 { + 0% { + background-position: 0 0; + } + + 50% { + background-position: 400% 0; + } + + 100% { + background-position: 0 0; + } +} + +.button-85::after { + z-index: -1; + content: ""; + position: absolute; + width: 100%; + height: 100%; + background: #222; + left: 0; + top: 0; + border-radius: 10px; +} diff --git a/src/index.html b/src/index.html index bee6ab5..e8c66e3 100644 --- a/src/index.html +++ b/src/index.html @@ -12,8 +12,8 @@ - - + + @@ -54,6 +54,10 @@ +

Todays Tv Shows

+ + +
diff --git a/src/index.js b/src/index.js index b00d572..98bacbb 100644 --- a/src/index.js +++ b/src/index.js @@ -1,30 +1,18 @@ // import getLikes from './modules/involvment.js' import showItems from './modules/display.js'; -import getMovies from './modules/getMovies.js'; -import { getLikes } from './modules/likesApi.js'; +import { movieArray, findLikes } from './modules/initializer.js'; import './style.css'; const mainSection = document.getElementById('main-section'); +const popupContainer = document.getElementById('popup-section'); -const movieArray = await getMovies(); - -const allLikes = await getLikes(); - -// function - -const allIdsArray = []; -movieArray.forEach((movie) => { - allIdsArray.push(movie.showId); -}); - -const findLikes = (id) => { - const result = allLikes.find((like) => like.item_id === id); - return result?.likes ?? 0; -}; +function closeModal() { + popupContainer.innerHTML = ''; +} movieArray.forEach((movie) => { const likes = findLikes(movie.showId); - const card = showItems(movie, likes); + const card = showItems(movie, likes, closeModal, popupContainer); mainSection.append(card); -}); +}); \ No newline at end of file diff --git a/src/index2.html b/src/index2.html new file mode 100644 index 0000000..bee6ab5 --- /dev/null +++ b/src/index2.html @@ -0,0 +1,100 @@ + + + + + + + + + + MovieBase + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + MovieBase + +
+ + + +
+ + +
+ + + + + + + + +
+ + + +
+ + + +
+ + + \ No newline at end of file diff --git a/src/index2.js b/src/index2.js new file mode 100644 index 0000000..ea175d2 --- /dev/null +++ b/src/index2.js @@ -0,0 +1,41 @@ +import './style.css'; +// import './css/pop-window.css' + +import popupWindow from './modules/commentsPopupWindow.js'; +import getMovies from './modules/getMovies.js'; +import { + getComments, + +} from './modules/commentsApi.js'; + +const popupContainer = document.getElementById('popup-container'); + +const movieArray = await getMovies(); + +const allIdsArray = []; +movieArray.forEach((movie) => { + allIdsArray.push(movie.showId); +}); + +async function getAllComments(showIdsArray) { + const allCommentsArray = []; + + let allArray = []; + for (let index = 0; index < showIdsArray.length; index += 1) { + const comment = getComments(showIdsArray[index]); + allCommentsArray.push(comment); + } + allArray = await Promise.all(allCommentsArray); + + return allArray; +} + +const commentsArray = await getAllComments(allIdsArray); + +function closeModal() { + popupContainer.innerHTML = ''; +} + +const popup = popupWindow(movieArray[2], commentsArray[2], closeModal); + +popupContainer.append(popup); \ No newline at end of file diff --git a/src/modules/commentCounter.js b/src/modules/commentCounter.js new file mode 100644 index 0000000..09c71f3 --- /dev/null +++ b/src/modules/commentCounter.js @@ -0,0 +1,3 @@ +const countComments = (DOMElem) => DOMElem.childElementCount; + +export default countComments; \ No newline at end of file diff --git a/src/modules/commentsApi.js b/src/modules/commentsApi.js new file mode 100644 index 0000000..8810b1e --- /dev/null +++ b/src/modules/commentsApi.js @@ -0,0 +1,36 @@ +const commentsUrl = 'https://us-central1-involvement-api.cloudfunctions.net/capstoneApi/apps/j26xtAx7qVMwcqU9i8K3/comments/'; + +async function postComment({ showId, name, comment }) { + const response = await fetch(commentsUrl, { + + method: 'POST', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ item_id: showId, username: name, comment }), + + }); + + await response.json(); +} + +async function getComments(showID) { + try { + const response = await fetch(`${commentsUrl}?${new URLSearchParams({ + item_id: showID, + })}`); + + if (!response.ok) { + await Promise.reject(new Error(response.status.toString())); + } else { + return await response.json(); + } + } catch (e) { + // console.log('asd', e); + // throw new Error('Comment doesnt exist'); + } + return []; +} + +export { postComment, getComments }; diff --git a/src/modules/commentsPopupWindow.js b/src/modules/commentsPopupWindow.js new file mode 100644 index 0000000..7d8e1b7 --- /dev/null +++ b/src/modules/commentsPopupWindow.js @@ -0,0 +1,180 @@ +import countComments from './commentCounter.js'; +import { postComment } from './commentsApi.js'; +import getDate from './getDate.js'; +// import { getComments } from './commentsApi.js'; + +import { commentsArray } from './initializer.js'; + +import validateComment from './validateComment.js'; + +const createLiComments = (comments) => { + const fragment = document.createDocumentFragment(); + + if (comments.length === 0) { + return ''; + } + comments.reverse().forEach((comment) => { + const li = document.createElement('li'); + li.textContent = `${comment.creation_date}: ${comment.username}--${comment.comment}`; + fragment.append(li); + }); + + return fragment; +}; + +const createOneLiComment = (comment) => { + const li = document.createElement('li'); + li.textContent = `${getDate()}:${comment}`; + return li; +}; + +const popupWindow = ({ + showId, imgMediumUrl, imgAlt, name, episodeName, season, episode, summary, +}, index, closePopup) => { + const localCommentsArray = []; + localCommentsArray.push(...commentsArray); + + const mainDiv = document.createElement('div'); + mainDiv.classList.add('popup-window'); + + // start close button + + const closeButton = document.createElement('button'); + closeButton.classList.add('button-default', 'close-button'); + const closeIcon = document.createElement('i'); + closeIcon.classList.add('fa-solid', 'fa-xmark', 'close-icon-fa'); + closeButton.appendChild(closeIcon); + + // eventListener to close Popup Window + closeButton.addEventListener('click', () => { + closePopup(); + }); + + // end close button + + // start image div + const imgDiv = document.createElement('div'); + const imgElement = document.createElement('img'); + imgElement.classList.add('popup-image'); + imgElement.setAttribute('src', imgMediumUrl); + imgElement.setAttribute('alt', imgAlt); + imgDiv.appendChild(imgElement); + // end image div + + // start show summary div + const titleDiv = document.createElement('div'); + titleDiv.classList.add('title-div'); + + const movieHeading = document.createElement('h3'); + movieHeading.textContent = name; + + const episodeHeading = document.createElement('h5'); + episodeHeading.textContent = episodeName; + + const detailsDiv = document.createElement('div'); + detailsDiv.classList.add('details-div'); + + const seasonSpan = document.createElement('span'); + seasonSpan.textContent = `Season : ${season}`; + + const episodeSpan = document.createElement('span'); + episodeSpan.textContent = `Episode : ${episode}`; + + detailsDiv.append(seasonSpan, episodeSpan); + + titleDiv.append(movieHeading, episodeHeading, detailsDiv); + + const summaryDiv = document.createElement('div'); + summaryDiv.innerHTML = summary; + summaryDiv.classList.add('summary-div'); + // end show descritption div + + // start display comments div + const displayCommentsDiv = document.createElement('div'); + displayCommentsDiv.classList.add('display-comments'); + + const commentTitleDiv = document.createElement('div'); + commentTitleDiv.classList.add('comment-title'); + const commentsHeading = document.createElement('h4'); + commentsHeading.textContent = 'Comments'; + + const commentCountSpan = document.createElement('span'); + commentCountSpan.setAttribute('id', 'comment-count'); + + commentsHeading.append(commentCountSpan); + commentTitleDiv.append(commentsHeading); + + const commentsUL = document.createElement('ul'); + commentsUL.classList.add('comments-ul'); + + //* createLiComments will return a fragment containing list items of commenst + + const comments = createLiComments(commentsArray[index]); + + commentsUL.append(comments); + + const updateCommentCount = () => { + const commentCount = countComments(commentsUL); + commentCountSpan.textContent = `(${commentCount})`; + }; + + updateCommentCount(); + displayCommentsDiv.append(commentTitleDiv, commentsUL); + // end display comments div + + // start New Comments div + const newCommentsDiv = document.createElement('div'); + newCommentsDiv.classList.add('new-comments'); + + const newCommentHeading = document.createElement('h4'); + newCommentHeading.textContent = 'Add A Comment'; + + const commentsForm = document.createElement('form'); + commentsForm.classList.add('comments-form'); + commentsForm.setAttribute('action', ''); + + const nameInput = document.createElement('input'); + nameInput.setAttribute('type', 'text'); + nameInput.setAttribute('required', ''); + nameInput.setAttribute('placeholder', 'Your Name'); + + const commentTextArea = document.createElement('textarea'); + commentTextArea.setAttribute('required', ''); + commentTextArea.setAttribute('placeholder', 'Your Comments'); + commentTextArea.setAttribute('cols', '25'); + commentTextArea.setAttribute('rows', '3'); + + const commentButton = document.createElement('button'); + // commentButton.setAttribute('type','submit') + // commentButton.setAttribute('value','Comment') + commentButton.classList.add('comment-button', 'button-85'); + commentButton.innerHTML = 'Comment'; + + commentsForm.append(nameInput, commentTextArea, commentButton); + + newCommentsDiv.append(newCommentHeading, commentsForm); + // end new Comments div + + // commentsForm attach EventListener + commentsForm.addEventListener('submit', (e) => { + e.preventDefault(); + const name = e.target.elements[0].value; + const comment = e.target.elements[1].value; + e.target.elements[0].value = ''; + e.target.elements[1].value = ''; + + commentsArray[index].push({ creation_date: getDate(), user_name: name, comment }); + const data = validateComment(name, comment); + + postComment({ showId, name, comment }); + const liComment = createOneLiComment(data); + commentsUL.prepend(liComment); + updateCommentCount(); + }); + + mainDiv.append(closeButton, imgDiv, titleDiv, summaryDiv, displayCommentsDiv, newCommentsDiv); + + return mainDiv; +}; + +export default popupWindow; \ No newline at end of file diff --git a/src/modules/display.js b/src/modules/display.js index a912f45..f926ada 100644 --- a/src/modules/display.js +++ b/src/modules/display.js @@ -1,10 +1,9 @@ import { postLike } from './likesApi.js'; +import popupWindow from './commentsPopupWindow.js'; //* Begining of function -const showItems = ({ - index, showId, name, imgMediumUrl, -}, likes = 10) => { +const showItems = (movie, likes, closeModal, popupContainer) => { let currentLikes = likes; // main card body const itemDisplay = document.createElement('div'); @@ -14,8 +13,8 @@ const showItems = ({ const movieCards = document.createElement('div'); movieCards.classList.add('movie-image-div'); const Img = document.createElement('img'); - Img.setAttribute('src', imgMediumUrl); - Img.setAttribute('alt', `image of ${name}`); + Img.setAttribute('src', movie.imgMediumUrl); + Img.setAttribute('alt', `image of ${movie.name}`); // Img.setAttribute('class', 'movie-img'); movieCards.append(Img); @@ -26,7 +25,7 @@ const showItems = ({ cardDescription.classList.add('card-description'); const tvTitle = document.createElement('h3'); - tvTitle.textContent = name; + tvTitle.textContent = movie.name; cardDescription.append(tvTitle); const likeIconDiv = document.createElement('div'); @@ -37,10 +36,10 @@ const showItems = ({ likeBtn.classList.add('like-button'); likeBtn.setAttribute('id', 'like-button'); - likeBtn.dataset.showId = showId; + likeBtn.dataset.showId = movie.showId; const like = document.createElement('i'); - like.classList.add('fa-regular', 'fa-heart'); + like.classList.add('fa-solid', 'fa-heart', 'red'); likeBtn.append(like); likeIconDiv.append(likeBtn); @@ -53,7 +52,7 @@ const showItems = ({ likeBtn.addEventListener('click', () => { currentLikes += 1; likeCount.textContent = `${currentLikes} likes`; - postLike(showId); + postLike(movie.showId); }); cardDescription.appendChild(likeIconDiv); @@ -62,8 +61,13 @@ const showItems = ({ commentBtn.setAttribute('id', 'comment-button'); // commentBtn.setAttribute('comment-button', `${data.id}`); - commentBtn.dataset.id = index; + commentBtn.dataset.id = movie.index; commentBtn.innerHTML = 'Comments'; + + commentBtn.addEventListener('click', () => { + const popup = popupWindow(movie, movie.index, closeModal); + popupContainer.append(popup); + }); cardDescription.append(commentBtn); itemDisplay.appendChild(cardDescription); diff --git a/src/modules/getDate.js b/src/modules/getDate.js new file mode 100644 index 0000000..bebd972 --- /dev/null +++ b/src/modules/getDate.js @@ -0,0 +1,11 @@ +function getDate() { + const today = new Date(); + const dd = String(today.getDate()).padStart(2, '0'); + const mm = String(today.getMonth() + 1).padStart(2, '0'); // janvier = 0 + const yyyy = today.getFullYear(); + + return `${yyyy}-${mm}-${dd}`; + // return dd + '/' + mm + '/' + yyyy; // change form if you need +} + +export default getDate; \ No newline at end of file diff --git a/src/modules/getMovies.js b/src/modules/getMovies.js index f3e7a9d..1dd8bad 100644 --- a/src/modules/getMovies.js +++ b/src/modules/getMovies.js @@ -1,4 +1,4 @@ -const movieUrl = 'https://api.tvmaze.com/schedule/web?date=2020-05-28&country=US'; +const movieUrl = 'https://api.tvmaze.com/schedule/web?date=2020-05-29&country=US'; function parseMovieData(dataArray) { const parsedArray = []; diff --git a/src/modules/initializer.js b/src/modules/initializer.js new file mode 100644 index 0000000..5de2c29 --- /dev/null +++ b/src/modules/initializer.js @@ -0,0 +1,36 @@ +import getMovies from './getMovies.js'; +import { getLikes } from './likesApi.js'; +import { getComments } from './commentsApi.js'; + +const movieArray = await getMovies(); + +const allLikes = await getLikes(); + +// function + +const allIdsArray = []; +movieArray.forEach((movie) => { + allIdsArray.push(movie.showId); +}); + +async function getAllComments(showIdsArray) { + const allCommentsArray = []; + + let allArray = []; + for (let index = 0; index < showIdsArray.length; index += 1) { + const comment = getComments(showIdsArray[index]); + allCommentsArray.push(comment); + } + allArray = await Promise.all(allCommentsArray); + + return allArray; +} + +const findLikes = (id) => { + const result = allLikes.find((like) => like.item_id === id); + return result?.likes ?? 0; +}; + +const commentsArray = await getAllComments(allIdsArray); + +export { movieArray, findLikes, commentsArray }; \ No newline at end of file diff --git a/src/modules/involvment.js b/src/modules/involvment.js index 54b16b3..da3468f 100644 --- a/src/modules/involvment.js +++ b/src/modules/involvment.js @@ -1,39 +1,39 @@ -// import {involveUrl,apiId} from './data.js' -// require('dotenv').config() +// // import {involveUrl,apiId} from './data.js' +// // require('dotenv').config() -const apiId = 'j26xtAx7qVMwcqU9i8K3'; -const involveUrl = 'https://us-central1-involvement-api.cloudfunctions.net/capstoneApi/apps/'; +// const apiId = 'j26xtAx7qVMwcqU9i8K3'; +// const involveUrl = 'https://us-central1-involvement-api.cloudfunctions.net/capstoneApi/apps/'; -const baseUrl = involveUrl + apiId; +// const baseUrl = involveUrl + apiId; -// console.log("involveUrl") +// // console.log("involveUrl") -const likesEndpoint = `${baseUrl}/likes/`; +// const likesEndpoint = `${baseUrl}/likes/`; -async function postLikes(showIdArray) { - const likesArray = []; - showIdArray.forEach((id) => { - const like = { - likes: 0, - item_id: id, - }; - likesArray.push(like); - }); +// async function postLikes(showIdArray) { +// const likesArray = []; +// showIdArray.forEach((id) => { +// const like = { +// likes: 0, +// item_id: id, +// }; +// likesArray.push(like); +// }); - const response = await fetch(likesEndpoint, { - method: 'POST', - headers: { - Accept: 'application/json', - 'Content-Type': 'application/json', - }, +// const response = await fetch(likesEndpoint, { +// method: 'POST', +// headers: { +// Accept: 'application/json', +// 'Content-Type': 'application/json', +// }, - body: JSON.stringify(likesArray), +// body: JSON.stringify(likesArray), - }); +// }); - await response.json(); -} +// await response.json(); +// } -postLikes(['101', '102', '103', '104']); +// postLikes(['101', '102', '103', '104']); -// export default getLikes \ No newline at end of file +// // export default getLikes \ No newline at end of file diff --git a/src/modules/validateComment.js b/src/modules/validateComment.js new file mode 100644 index 0000000..4fbce3c --- /dev/null +++ b/src/modules/validateComment.js @@ -0,0 +1,3 @@ +const validateComment = (name, comment) => `${name} -- ${comment}`; + +export default validateComment; \ No newline at end of file diff --git a/src/popup.html b/src/popup.html new file mode 100644 index 0000000..bb58456 --- /dev/null +++ b/src/popup.html @@ -0,0 +1,138 @@ + + + + + + + + + + MovieBase + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + MovieBase + +
+ + + + +
+ +
+ + + + + + + + + + +
+ +
+ + + +
+ + + \ No newline at end of file diff --git a/src/style.css b/src/style.css index b97c61d..95ae156 100644 --- a/src/style.css +++ b/src/style.css @@ -1,3 +1,7 @@ + +@import url('./css/pop-window.css'); + + /* 1. Use a more-intuitive box-sizing model. */ @@ -30,7 +34,7 @@ body { body { line-height: 1.5; -webkit-font-smoothing: antialiased; - font-family: 'Magra', sans-serif; + font-family: 'Mukta Malar', sans-serif; font-size: 18px; letter-spacing: 1px; background-image: url(/src/assets/so-white.png); @@ -69,7 +73,7 @@ h4, h5, h6 { overflow-wrap: break-word; - font-family: 'Metamorphous', cursive; + font-family: 'Tenor Sans', sans-serif; } p { @@ -84,6 +88,17 @@ p { isolation: isolate; } +span { + font-size: 22px; +} + +.page-title { + margin: auto; + text-align: center; + padding-top: 50px; + font-size: 50px; +} + .header { display: flex; justify-content: space-around; @@ -151,7 +166,7 @@ footer { .main-section { display: grid; - grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); + grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin: 20px; grid-gap: 20px; padding: 20px; @@ -166,8 +181,9 @@ footer { /* border:4px solid black; */ /* justify-content: space-between; */ + padding-bottom: 5px; width: 300px; - height: 433px; + height: 440px; align-items: center; background-color: whitesmoke; box-shadow: @@ -227,3 +243,7 @@ footer { outline: inherit; font-size: 30px; } + +.red { + color: red; +} diff --git a/src/tests/commentCounter.test.js b/src/tests/commentCounter.test.js new file mode 100644 index 0000000..878450b --- /dev/null +++ b/src/tests/commentCounter.test.js @@ -0,0 +1,29 @@ +import countComments from '../modules/commentCounter.js'; + +describe('Test To Count Number of Comments in A Dom Element', () => { + test('Count Comments', () => { + document.body.innerHTML = ` + + `; + + const commentContainer = document.getElementById('comments-container'); + expect(countComments(commentContainer)).toBe(2); + }); + + test('Count Comments', () => { + document.body.innerHTML = ` + + `; + + const commentContainer = document.getElementById('comments-container'); + expect(countComments(commentContainer)).toBe(2); + }); +}); diff --git a/webpack.config.js b/webpack.config.js index c6e0bcf..4ca98dd 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -36,6 +36,11 @@ const config = { loader: 'babel-loader', }, + { + test: /\.worker.js$/, + loader: 'worker-loader', + options: { /* ... */ }, + }, { test: /\.worker.js$/, loader: 'worker-loader',