├── .eslintrc.json
├── .github
└── workflows
│ └── linters.yml
├── .gitignore
├── .hintrc
├── .stylelintrc.json
├── LICENSE
├── README.md
├── dist
├── index.html
├── main.js
└── main.js.LICENSE.txt
├── package-lock.json
├── package.json
├── src
├── complete.js
├── index.html
├── index.js
├── script.js
└── style.css
└── webpack.config.js
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "browser": true,
4 | "es6": true,
5 | "jest": true
6 | },
7 | "parser": "babel-eslint",
8 | "parserOptions": {
9 | "ecmaVersion": 2018,
10 | "sourceType": "module"
11 | },
12 | "extends": ["airbnb-base"],
13 | "rules": {
14 | "no-shadow": "off",
15 | "no-param-reassign": "off",
16 | "eol-last": "off",
17 | "import/extensions": [ 1, {
18 | "js": "always", "json": "always"
19 | }]
20 | },
21 | "ignorePatterns": [
22 | "dist/",
23 | "build/"
24 | ]
25 | }
--------------------------------------------------------------------------------
/.github/workflows/linters.yml:
--------------------------------------------------------------------------------
1 | name: Linters
2 |
3 | on: pull_request
4 |
5 | env:
6 | FORCE_COLOR: 1
7 |
8 | jobs:
9 | lighthouse:
10 | name: Lighthouse
11 | runs-on: ubuntu-22.04
12 | steps:
13 | - uses: actions/checkout@v2
14 | - uses: actions/setup-node@v1
15 | with:
16 | node-version: "12.x"
17 | - name: Setup Lighthouse
18 | run: npm install -g @lhci/cli@0.7.x
19 | - name: Lighthouse Report
20 | run: lhci autorun --upload.target=temporary-public-storage --collect.staticDistDir=.
21 | webhint:
22 | name: Webhint
23 | runs-on: ubuntu-22.04
24 | steps:
25 | - uses: actions/checkout@v2
26 | - uses: actions/setup-node@v1
27 | with:
28 | node-version: "12.x"
29 | - name: Setup Webhint
30 | run: |
31 | npm install --save-dev hint@7.x
32 | [ -f .hintrc ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/html-css-js/.hintrc
33 | - name: Webhint Report
34 | run: npx hint .
35 | stylelint:
36 | name: Stylelint
37 | runs-on: ubuntu-22.04
38 | steps:
39 | - uses: actions/checkout@v2
40 | - uses: actions/setup-node@v1
41 | with:
42 | node-version: "12.x"
43 | - name: Setup Stylelint
44 | run: |
45 | npm install --save-dev stylelint@13.x stylelint-scss@3.x stylelint-config-standard@21.x stylelint-csstree-validator@1.x
46 | [ -f .stylelintrc.json ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/html-css-js/.stylelintrc.json
47 | - name: Stylelint Report
48 | run: npx stylelint "**/*.{css,scss}"
49 | eslint:
50 | name: ESLint
51 | runs-on: ubuntu-22.04
52 | steps:
53 | - uses: actions/checkout@v2
54 | - uses: actions/setup-node@v1
55 | with:
56 | node-version: "12.x"
57 | - name: Setup ESLint
58 | run: |
59 | npm install --save-dev eslint@7.x eslint-config-airbnb-base@14.x eslint-plugin-import@2.x babel-eslint@10.x
60 | [ -f .eslintrc.json ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/html-css-js/.eslintrc.json
61 | - name: ESLint Report
62 | run: npx eslint .
63 | nodechecker:
64 | name: node_modules checker
65 | runs-on: ubuntu-22.04
66 | steps:
67 | - uses: actions/checkout@v2
68 | - name: Check node_modules existence
69 | run: |
70 | if [ -d "node_modules/" ]; then echo -e "\e[1;31mThe node_modules/ folder was pushed to the repo. Please remove it from the GitHub repository and try again."; echo -e "\e[1;32mYou can set up a .gitignore file with this folder included on it to prevent this from happening in the future." && exit 1; fi
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
--------------------------------------------------------------------------------
/.hintrc:
--------------------------------------------------------------------------------
1 | {
2 | "connector": {
3 | "name": "local",
4 | "options": {
5 | "pattern": ["**", "!.git/**", "!node_modules/**"]
6 | }
7 | },
8 | "extends": ["development"],
9 | "formatters": ["stylish"],
10 | "hints": [
11 | "button-type",
12 | "disown-opener",
13 | "html-checker",
14 | "meta-charset-utf-8",
15 | "meta-viewport",
16 | "no-inline-styles:error"
17 | ]
18 | }
--------------------------------------------------------------------------------
/.stylelintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["stylelint-config-standard"],
3 | "plugins": ["stylelint-scss", "stylelint-csstree-validator"],
4 | "rules": {
5 | "at-rule-no-unknown": [
6 | true,
7 | {
8 | "ignoreAtRules": ["tailwind", "apply", "variants", "responsive", "screen"]
9 | }
10 | ],
11 | "scss/at-rule-no-unknown": [
12 | true,
13 | {
14 | "ignoreAtRules": ["tailwind", "apply", "variants", "responsive", "screen"]
15 | }
16 | ],
17 | "csstree/validator": true
18 | },
19 | "ignoreFiles": ["build/**", "dist/**", "**/reset*.css", "**/bootstrap*.css", "**/*.js", "**/*.jsx"]
20 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Progress
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | # To-Do-List
4 |
5 | ## Description
6 |
7 | This is an awesome application that grants users the ability to save list of activites/task they intend doing.
8 |
9 |
10 | ## Build With
11 |
12 | - Editor : Visual studio code
13 |
14 | - Languages
15 |
16 | - [ ] HTML
17 | - [ ] CSS
18 | - [ ] JavaScript
19 |
20 | - Terminologies
21 | - [ ] Github
22 | - [ ] Webpack
23 | - [ ] Linters
24 | - [ ] WebHint
25 | - [ ] Stylelint
26 | - [ ] ESlint
27 |
28 | ## Live Demo
29 |
30 | [Live Demo Link](https://progress2002.github.io/To-Do-List/dist/)
31 |
32 |
33 |
34 |
35 | ## Getting Started
36 |
37 | step 1:
38 | Clone this repo locally using git in the command line and the following command
39 |
40 | ```
41 | https://github.com/Progress2002/To-Do-List.git
42 | ```
43 |
44 | Alternatively, you can just download the complete zip file and extract the folder in your directory
45 |
46 | step 2:
47 | Run `npm install` to install the project devDependencies
48 |
49 | Step 3:
50 | Copy All Project files and run using VSCODE. HTML can be viewed in browser.
51 |
52 |
53 | ## Author
54 |
55 | 👤 **Progress C. Ezeamaka**
56 |
57 | - GitHub: [@githubhandle](https://github.com/Progress2002)
58 | - Twitter: [@twitterhandle](https://twitter.com/Progress_2002)
59 | - LinkedIn: [LinkedIn](https://www.linkedin.com/in/progress-ezeamaka-27b114247)
60 |
61 | ## 🤝 Contributing
62 |
63 | Contributions, issues, and feature requests are welcome!
64 |
65 | Feel free to check the [issues page](https://github.com/Progress2002/Webpack-project/issues).
66 |
67 | ## Show your support
68 |
69 | Give a ⭐️ if you like this project!
70 |
71 |
72 | ## 📝 License
73 |
74 | This project is [MIT](https://github.com/Progress2002/To-Do-List/blob/main/LICENSE) licensed.
75 |
--------------------------------------------------------------------------------
/dist/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | To Do list
8 |
9 |
10 |
11 |
12 |
Today's To Do List
13 |
14 |
15 |
16 |
17 |
18 |
19 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/dist/main.js:
--------------------------------------------------------------------------------
1 | /*
2 | * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
3 | * This devtool is neither made for production nor for readable output files.
4 | * It uses "eval()" calls to create a separate source file in the browser devtools.
5 | * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
6 | * or disable the default devtool with "devtool: false".
7 | * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
8 | */
9 | /******/ (() => { // webpackBootstrap
10 | /******/ "use strict";
11 | /******/ var __webpack_modules__ = ({
12 |
13 | /***/ "./node_modules/css-loader/dist/cjs.js!./src/style.css":
14 | /*!*************************************************************!*\
15 | !*** ./node_modules/css-loader/dist/cjs.js!./src/style.css ***!
16 | \*************************************************************/
17 | /***/ ((module, __webpack_exports__, __webpack_require__) => {
18 |
19 | 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// Imports\n\n\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// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"* {\\r\\n margin: 0;\\r\\n padding: 0;\\r\\n box-sizing: border-box;\\r\\n}\\r\\n\\r\\nbody {\\r\\n display: flex;\\r\\n min-height: 100vh;\\r\\n background: linear-gradient(-45deg, white 50%, #f8f8f8 50%);\\r\\n font-family: sans-serif;\\r\\n}\\r\\n\\r\\n#main {\\r\\n width: 94%;\\r\\n margin: auto;\\r\\n background-color: aliceblue;\\r\\n box-shadow: 0 5px 9px gray;\\r\\n}\\r\\n\\r\\n.heading {\\r\\n display: flex;\\r\\n justify-content: space-between;\\r\\n align-items: center;\\r\\n padding: 15px;\\r\\n background-color: rgb(80, 80, 236);\\r\\n color: #fff;\\r\\n}\\r\\n\\r\\nh2 {\\r\\n font-weight: bolder;\\r\\n}\\r\\n\\r\\n.add {\\r\\n width: 100%;\\r\\n}\\r\\n\\r\\nform {\\r\\n display: flex;\\r\\n}\\r\\n\\r\\ninput[type=text] {\\r\\n padding: 15px;\\r\\n display: block;\\r\\n outline: none;\\r\\n border: none;\\r\\n width: 100%;\\r\\n font-size: 18px;\\r\\n font-style: italic;\\r\\n background-color: inherit;\\r\\n}\\r\\n\\r\\nbutton[type=submit] {\\r\\n border: none;\\r\\n background-color: inherit;\\r\\n margin-right: 15px;\\r\\n cursor: pointer;\\r\\n font-size: 15px;\\r\\n}\\r\\n\\r\\n.todo-list .list {\\r\\n padding: 15px;\\r\\n display: flex;\\r\\n justify-content: space-between;\\r\\n align-items: center;\\r\\n font-size: 20px;\\r\\n}\\r\\n\\r\\n.list-description {\\r\\n display: flex;\\r\\n align-items: center;\\r\\n width: 85%;\\r\\n}\\r\\n\\r\\n.list-description p {\\r\\n width: 100%;\\r\\n outline: none;\\r\\n border: none;\\r\\n}\\r\\n\\r\\n.completed {\\r\\n text-decoration: line-through;\\r\\n}\\r\\n\\r\\ninput[type=checkbox] {\\r\\n display: inline-block;\\r\\n border: 0;\\r\\n position: relative;\\r\\n top: 2px;\\r\\n height: 30px;\\r\\n width: 20px;\\r\\n margin-right: 7px;\\r\\n}\\r\\n\\r\\ninput[type=checkbox]:hover {\\r\\n cursor: pointer;\\r\\n}\\r\\n\\r\\n.delete {\\r\\n color: rgb(221, 50, 50);\\r\\n cursor: pointer;\\r\\n}\\r\\n\\r\\n#completed {\\r\\n padding: 13px;\\r\\n text-align: center;\\r\\n font-size: 20px;\\r\\n background-color: rgb(223, 219, 219);\\r\\n}\\r\\n\\r\\n#completed:hover {\\r\\n cursor: pointer;\\r\\n}\\r\\n\\r\\n#completed button {\\r\\n font-size: 19px;\\r\\n border: none;\\r\\n background-color: inherit;\\r\\n color: rgb(134, 131, 131);\\r\\n cursor: pointer;\\r\\n}\\r\\n\\r\\n#completed .complete:hover {\\r\\n color: rgb(37, 36, 36);\\r\\n}\\r\\n\\r\\n@media (min-width: 768px) {\\r\\n #main {\\r\\n width: 50%;\\r\\n }\\r\\n}\\r\\n\", \"\"]);\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://webpack-project/./src/style.css?./node_modules/css-loader/dist/cjs.js");
20 |
21 | /***/ }),
22 |
23 | /***/ "./node_modules/css-loader/dist/runtime/api.js":
24 | /*!*****************************************************!*\
25 | !*** ./node_modules/css-loader/dist/runtime/api.js ***!
26 | \*****************************************************/
27 | /***/ ((module) => {
28 |
29 | eval("\n\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\nmodule.exports = function (cssWithMappingToString) {\n var list = []; // return the list of modules as css string\n\n list.toString = function toString() {\n return this.map(function (item) {\n var content = \"\";\n var needLayer = typeof item[5] !== \"undefined\";\n\n if (item[4]) {\n content += \"@supports (\".concat(item[4], \") {\");\n }\n\n if (item[2]) {\n content += \"@media \".concat(item[2], \" {\");\n }\n\n if (needLayer) {\n content += \"@layer\".concat(item[5].length > 0 ? \" \".concat(item[5]) : \"\", \" {\");\n }\n\n content += cssWithMappingToString(item);\n\n if (needLayer) {\n content += \"}\";\n }\n\n if (item[2]) {\n content += \"}\";\n }\n\n if (item[4]) {\n content += \"}\";\n }\n\n return content;\n }).join(\"\");\n }; // import a list of modules into the list\n\n\n list.i = function i(modules, media, dedupe, supports, layer) {\n if (typeof modules === \"string\") {\n modules = [[null, modules, undefined]];\n }\n\n var alreadyImportedModules = {};\n\n if (dedupe) {\n for (var k = 0; k < this.length; k++) {\n var id = this[k][0];\n\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n }\n\n for (var _k = 0; _k < modules.length; _k++) {\n var item = [].concat(modules[_k]);\n\n if (dedupe && alreadyImportedModules[item[0]]) {\n continue;\n }\n\n if (typeof layer !== \"undefined\") {\n if (typeof item[5] === \"undefined\") {\n item[5] = layer;\n } else {\n item[1] = \"@layer\".concat(item[5].length > 0 ? \" \".concat(item[5]) : \"\", \" {\").concat(item[1], \"}\");\n item[5] = layer;\n }\n }\n\n if (media) {\n if (!item[2]) {\n item[2] = media;\n } else {\n item[1] = \"@media \".concat(item[2], \" {\").concat(item[1], \"}\");\n item[2] = media;\n }\n }\n\n if (supports) {\n if (!item[4]) {\n item[4] = \"\".concat(supports);\n } else {\n item[1] = \"@supports (\".concat(item[4], \") {\").concat(item[1], \"}\");\n item[4] = supports;\n }\n }\n\n list.push(item);\n }\n };\n\n return list;\n};\n\n//# sourceURL=webpack://webpack-project/./node_modules/css-loader/dist/runtime/api.js?");
30 |
31 | /***/ }),
32 |
33 | /***/ "./node_modules/css-loader/dist/runtime/noSourceMaps.js":
34 | /*!**************************************************************!*\
35 | !*** ./node_modules/css-loader/dist/runtime/noSourceMaps.js ***!
36 | \**************************************************************/
37 | /***/ ((module) => {
38 |
39 | eval("\n\nmodule.exports = function (i) {\n return i[1];\n};\n\n//# sourceURL=webpack://webpack-project/./node_modules/css-loader/dist/runtime/noSourceMaps.js?");
40 |
41 | /***/ }),
42 |
43 | /***/ "./src/style.css":
44 | /*!***********************!*\
45 | !*** ./src/style.css ***!
46 | \***********************/
47 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
48 |
49 | 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_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js */ \"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/styleDomAPI.js */ \"./node_modules/style-loader/dist/runtime/styleDomAPI.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/insertBySelector.js */ \"./node_modules/style-loader/dist/runtime/insertBySelector.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js */ \"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/insertStyleElement.js */ \"./node_modules/style-loader/dist/runtime/insertStyleElement.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/styleTagTransform.js */ \"./node_modules/style-loader/dist/runtime/styleTagTransform.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _node_modules_css_loader_dist_cjs_js_style_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! !!../node_modules/css-loader/dist/cjs.js!./style.css */ \"./node_modules/css-loader/dist/cjs.js!./src/style.css\");\n\n \n \n \n \n \n \n \n \n \n\nvar options = {};\n\noptions.styleTagTransform = (_node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default());\noptions.setAttributes = (_node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default());\n\n options.insert = _node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default().bind(null, \"head\");\n \noptions.domAPI = (_node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default());\noptions.insertStyleElement = (_node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default());\n\nvar update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_node_modules_css_loader_dist_cjs_js_style_css__WEBPACK_IMPORTED_MODULE_6__[\"default\"], options);\n\n\n\n\n /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_css_loader_dist_cjs_js_style_css__WEBPACK_IMPORTED_MODULE_6__[\"default\"] && _node_modules_css_loader_dist_cjs_js_style_css__WEBPACK_IMPORTED_MODULE_6__[\"default\"].locals ? _node_modules_css_loader_dist_cjs_js_style_css__WEBPACK_IMPORTED_MODULE_6__[\"default\"].locals : undefined);\n\n\n//# sourceURL=webpack://webpack-project/./src/style.css?");
50 |
51 | /***/ }),
52 |
53 | /***/ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":
54 | /*!****************************************************************************!*\
55 | !*** ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js ***!
56 | \****************************************************************************/
57 | /***/ ((module) => {
58 |
59 | eval("\n\nvar stylesInDOM = [];\n\nfunction getIndexByIdentifier(identifier) {\n var result = -1;\n\n for (var i = 0; i < stylesInDOM.length; i++) {\n if (stylesInDOM[i].identifier === identifier) {\n result = i;\n break;\n }\n }\n\n return result;\n}\n\nfunction modulesToDom(list, options) {\n var idCountMap = {};\n var identifiers = [];\n\n for (var i = 0; i < list.length; i++) {\n var item = list[i];\n var id = options.base ? item[0] + options.base : item[0];\n var count = idCountMap[id] || 0;\n var identifier = \"\".concat(id, \" \").concat(count);\n idCountMap[id] = count + 1;\n var indexByIdentifier = getIndexByIdentifier(identifier);\n var obj = {\n css: item[1],\n media: item[2],\n sourceMap: item[3],\n supports: item[4],\n layer: item[5]\n };\n\n if (indexByIdentifier !== -1) {\n stylesInDOM[indexByIdentifier].references++;\n stylesInDOM[indexByIdentifier].updater(obj);\n } else {\n var updater = addElementStyle(obj, options);\n options.byIndex = i;\n stylesInDOM.splice(i, 0, {\n identifier: identifier,\n updater: updater,\n references: 1\n });\n }\n\n identifiers.push(identifier);\n }\n\n return identifiers;\n}\n\nfunction addElementStyle(obj, options) {\n var api = options.domAPI(options);\n api.update(obj);\n\n var updater = function updater(newObj) {\n if (newObj) {\n if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) {\n return;\n }\n\n api.update(obj = newObj);\n } else {\n api.remove();\n }\n };\n\n return updater;\n}\n\nmodule.exports = function (list, options) {\n options = options || {};\n list = list || [];\n var lastIdentifiers = modulesToDom(list, options);\n return function update(newList) {\n newList = newList || [];\n\n for (var i = 0; i < lastIdentifiers.length; i++) {\n var identifier = lastIdentifiers[i];\n var index = getIndexByIdentifier(identifier);\n stylesInDOM[index].references--;\n }\n\n var newLastIdentifiers = modulesToDom(newList, options);\n\n for (var _i = 0; _i < lastIdentifiers.length; _i++) {\n var _identifier = lastIdentifiers[_i];\n\n var _index = getIndexByIdentifier(_identifier);\n\n if (stylesInDOM[_index].references === 0) {\n stylesInDOM[_index].updater();\n\n stylesInDOM.splice(_index, 1);\n }\n }\n\n lastIdentifiers = newLastIdentifiers;\n };\n};\n\n//# sourceURL=webpack://webpack-project/./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js?");
60 |
61 | /***/ }),
62 |
63 | /***/ "./node_modules/style-loader/dist/runtime/insertBySelector.js":
64 | /*!********************************************************************!*\
65 | !*** ./node_modules/style-loader/dist/runtime/insertBySelector.js ***!
66 | \********************************************************************/
67 | /***/ ((module) => {
68 |
69 | eval("\n\nvar memo = {};\n/* istanbul ignore next */\n\nfunction getTarget(target) {\n if (typeof memo[target] === \"undefined\") {\n var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself\n\n if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n try {\n // This will throw an exception if access to iframe is blocked\n // due to cross-origin restrictions\n styleTarget = styleTarget.contentDocument.head;\n } catch (e) {\n // istanbul ignore next\n styleTarget = null;\n }\n }\n\n memo[target] = styleTarget;\n }\n\n return memo[target];\n}\n/* istanbul ignore next */\n\n\nfunction insertBySelector(insert, style) {\n var target = getTarget(insert);\n\n if (!target) {\n throw new Error(\"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\");\n }\n\n target.appendChild(style);\n}\n\nmodule.exports = insertBySelector;\n\n//# sourceURL=webpack://webpack-project/./node_modules/style-loader/dist/runtime/insertBySelector.js?");
70 |
71 | /***/ }),
72 |
73 | /***/ "./node_modules/style-loader/dist/runtime/insertStyleElement.js":
74 | /*!**********************************************************************!*\
75 | !*** ./node_modules/style-loader/dist/runtime/insertStyleElement.js ***!
76 | \**********************************************************************/
77 | /***/ ((module) => {
78 |
79 | eval("\n\n/* istanbul ignore next */\nfunction insertStyleElement(options) {\n var element = document.createElement(\"style\");\n options.setAttributes(element, options.attributes);\n options.insert(element, options.options);\n return element;\n}\n\nmodule.exports = insertStyleElement;\n\n//# sourceURL=webpack://webpack-project/./node_modules/style-loader/dist/runtime/insertStyleElement.js?");
80 |
81 | /***/ }),
82 |
83 | /***/ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":
84 | /*!**********************************************************************************!*\
85 | !*** ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js ***!
86 | \**********************************************************************************/
87 | /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
88 |
89 | eval("\n\n/* istanbul ignore next */\nfunction setAttributesWithoutAttributes(styleElement) {\n var nonce = true ? __webpack_require__.nc : 0;\n\n if (nonce) {\n styleElement.setAttribute(\"nonce\", nonce);\n }\n}\n\nmodule.exports = setAttributesWithoutAttributes;\n\n//# sourceURL=webpack://webpack-project/./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js?");
90 |
91 | /***/ }),
92 |
93 | /***/ "./node_modules/style-loader/dist/runtime/styleDomAPI.js":
94 | /*!***************************************************************!*\
95 | !*** ./node_modules/style-loader/dist/runtime/styleDomAPI.js ***!
96 | \***************************************************************/
97 | /***/ ((module) => {
98 |
99 | eval("\n\n/* istanbul ignore next */\nfunction apply(styleElement, options, obj) {\n var css = \"\";\n\n if (obj.supports) {\n css += \"@supports (\".concat(obj.supports, \") {\");\n }\n\n if (obj.media) {\n css += \"@media \".concat(obj.media, \" {\");\n }\n\n var needLayer = typeof obj.layer !== \"undefined\";\n\n if (needLayer) {\n css += \"@layer\".concat(obj.layer.length > 0 ? \" \".concat(obj.layer) : \"\", \" {\");\n }\n\n css += obj.css;\n\n if (needLayer) {\n css += \"}\";\n }\n\n if (obj.media) {\n css += \"}\";\n }\n\n if (obj.supports) {\n css += \"}\";\n }\n\n var sourceMap = obj.sourceMap;\n\n if (sourceMap && typeof btoa !== \"undefined\") {\n css += \"\\n/*# sourceMappingURL=data:application/json;base64,\".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), \" */\");\n } // For old IE\n\n /* istanbul ignore if */\n\n\n options.styleTagTransform(css, styleElement, options.options);\n}\n\nfunction removeStyleElement(styleElement) {\n // istanbul ignore if\n if (styleElement.parentNode === null) {\n return false;\n }\n\n styleElement.parentNode.removeChild(styleElement);\n}\n/* istanbul ignore next */\n\n\nfunction domAPI(options) {\n var styleElement = options.insertStyleElement(options);\n return {\n update: function update(obj) {\n apply(styleElement, options, obj);\n },\n remove: function remove() {\n removeStyleElement(styleElement);\n }\n };\n}\n\nmodule.exports = domAPI;\n\n//# sourceURL=webpack://webpack-project/./node_modules/style-loader/dist/runtime/styleDomAPI.js?");
100 |
101 | /***/ }),
102 |
103 | /***/ "./node_modules/style-loader/dist/runtime/styleTagTransform.js":
104 | /*!*********************************************************************!*\
105 | !*** ./node_modules/style-loader/dist/runtime/styleTagTransform.js ***!
106 | \*********************************************************************/
107 | /***/ ((module) => {
108 |
109 | eval("\n\n/* istanbul ignore next */\nfunction styleTagTransform(css, styleElement) {\n if (styleElement.styleSheet) {\n styleElement.styleSheet.cssText = css;\n } else {\n while (styleElement.firstChild) {\n styleElement.removeChild(styleElement.firstChild);\n }\n\n styleElement.appendChild(document.createTextNode(css));\n }\n}\n\nmodule.exports = styleTagTransform;\n\n//# sourceURL=webpack://webpack-project/./node_modules/style-loader/dist/runtime/styleTagTransform.js?");
110 |
111 | /***/ }),
112 |
113 | /***/ "./src/complete.js":
114 | /*!*************************!*\
115 | !*** ./src/complete.js ***!
116 | \*************************/
117 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
118 |
119 | 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 _script_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./script.js */ \"./src/script.js\");\n // eslint-disable-line \r\n\r\n// mark a task as completed or not------------\r\nconst toggleComplete = (element) => {\r\n element.classList.toggle('completed');\r\n let elementPerentId = element.parentNode.parentNode.parentNode.id;\r\n elementPerentId = parseInt(elementPerentId, 10);\r\n _script_js__WEBPACK_IMPORTED_MODULE_0__.tasks.forEach((task) => {\r\n if (task.index === elementPerentId) {\r\n const isIncluded = element.classList.contains('completed');\r\n if (isIncluded) {\r\n task.completed = true;\r\n } else {\r\n task.completed = false;\r\n }\r\n }\r\n });\r\n};\r\n\r\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (toggleComplete);\n\n//# sourceURL=webpack://webpack-project/./src/complete.js?");
120 |
121 | /***/ }),
122 |
123 | /***/ "./src/index.js":
124 | /*!**********************!*\
125 | !*** ./src/index.js ***!
126 | \**********************/
127 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
128 |
129 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _style_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./style.css */ \"./src/style.css\");\n/* harmony import */ var _script_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./script.js */ \"./src/script.js\");\n\r\n\r\n\r\nconst toDoListContainer = document.querySelector('.todo-list');\r\n\r\n(0,_script_js__WEBPACK_IMPORTED_MODULE_1__.formaction)();\r\n\r\ndocument.addEventListener('DOMContentLoaded', () => {\r\n _script_js__WEBPACK_IMPORTED_MODULE_1__.tasks.sort((a, b) => a.index - b.index).map((item) => (0,_script_js__WEBPACK_IMPORTED_MODULE_1__.render)(item));\r\n (0,_script_js__WEBPACK_IMPORTED_MODULE_1__.remove)(toDoListContainer);\r\n _script_js__WEBPACK_IMPORTED_MODULE_1__.tasks.forEach((task) => {\r\n if (task.completed) {\r\n const taskIndex = task.index;\r\n toDoListContainer.querySelectorAll('.text').forEach((text) => {\r\n const textParentNodeId = parseInt(text.parentNode.parentNode.parentNode.id, 10);\r\n if (textParentNodeId === taskIndex) {\r\n text.classList.add('completed');\r\n text.previousElementSibling.checked = true;\r\n }\r\n });\r\n }\r\n });\r\n (0,_script_js__WEBPACK_IMPORTED_MODULE_1__.editTask)(toDoListContainer);\r\n (0,_script_js__WEBPACK_IMPORTED_MODULE_1__.markAsCompleted)(toDoListContainer);\r\n (0,_script_js__WEBPACK_IMPORTED_MODULE_1__.cleareCompleted)(toDoListContainer);\r\n});\r\n\n\n//# sourceURL=webpack://webpack-project/./src/index.js?");
130 |
131 | /***/ }),
132 |
133 | /***/ "./src/script.js":
134 | /*!***********************!*\
135 | !*** ./src/script.js ***!
136 | \***********************/
137 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
138 |
139 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"cleareCompleted\": () => (/* binding */ cleareCompleted),\n/* harmony export */ \"editTask\": () => (/* binding */ editTask),\n/* harmony export */ \"formaction\": () => (/* binding */ formaction),\n/* harmony export */ \"markAsCompleted\": () => (/* binding */ markAsCompleted),\n/* harmony export */ \"remove\": () => (/* binding */ remove),\n/* harmony export */ \"render\": () => (/* binding */ render),\n/* harmony export */ \"tasks\": () => (/* binding */ tasks),\n/* harmony export */ \"updateStorage\": () => (/* binding */ updateStorage)\n/* harmony export */ });\n/* harmony import */ var _complete_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./complete.js */ \"./src/complete.js\");\n // eslint-disable-line \r\n\r\nconst completeBtn = document.querySelector('.complete');\r\nconst toDoListContainer = document.querySelector('.todo-list');\r\nconst form = document.querySelector('form');\r\n\r\nlet tasks = []; // eslint-disable-line \r\n\r\nconst updateStorage = (task) => {\r\n localStorage.setItem('My-To-Do-List', JSON.stringify(task));\r\n};\r\n\r\n// render newly added task to page --------\r\nconst render = (task) => {\r\n toDoListContainer.innerHTML += `\r\n \r\n
\r\n
\r\n
\r\n
${task.description}
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n `;\r\n};\r\n\r\n// Remove selected task from list---\r\nconst removeId = (id) => {\r\n tasks = tasks.filter((task) => task.index !== id);\r\n for (let i = 0; i < tasks.length; i += 1) {\r\n tasks[i].index = i;\r\n updateStorage(tasks);\r\n }\r\n updateStorage(tasks);\r\n};\r\n\r\nconst remove = (element) => {\r\n element.querySelectorAll('.delete').forEach((btn) => {\r\n btn.addEventListener('click', (e) => {\r\n const parent = e.target.parentNode.parentNode.parentNode;\r\n removeId(parseInt(parent.id, 10));\r\n parent.remove();\r\n });\r\n });\r\n};\r\n\r\nconst markAsCompleted = (element) => {\r\n element.querySelectorAll('.checkbox').forEach((box) => {\r\n box.addEventListener('change', () => {\r\n const item = box.nextElementSibling;\r\n (0,_complete_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(item);\r\n updateStorage(tasks);\r\n });\r\n });\r\n};\r\n\r\n// Cleare completed files---------\r\nconst cleareCompleted = (element) => {\r\n completeBtn.addEventListener('click', () => {\r\n element.querySelectorAll('.list').forEach((list) => {\r\n const taskId = parseInt(list.parentNode.id, 10);\r\n const parentnode = list.parentNode;\r\n tasks.forEach((task) => {\r\n if (task.completed && task.index === taskId) {\r\n parentnode.remove();\r\n }\r\n });\r\n });\r\n tasks = tasks.filter((task) => task.completed !== true);\r\n for (let i = 0; i < tasks.length; i += 1) {\r\n tasks[i].index = i;\r\n updateStorage(tasks);\r\n }\r\n updateStorage(tasks);\r\n });\r\n};\r\n\r\n// // edit task----------------\r\nconst editTask = (element) => {\r\n element.querySelectorAll('.text').forEach((box) => {\r\n box.addEventListener('input', (e) => {\r\n const activeText = e.target;\r\n const textContent = activeText.innerHTML;\r\n const activeTextParentId = parseInt(activeText.parentNode.parentNode.parentNode.id, 10);\r\n tasks.forEach((task) => {\r\n if (task.index === activeTextParentId) {\r\n task.description = textContent;\r\n updateStorage(tasks);\r\n }\r\n });\r\n });\r\n });\r\n};\r\n\r\n// // Add new task to the list---------\r\nconst add = (task) => {\r\n render(task);\r\n tasks.push(task);\r\n updateStorage(tasks);\r\n remove(toDoListContainer);\r\n editTask(toDoListContainer);\r\n markAsCompleted(toDoListContainer);\r\n cleareCompleted(toDoListContainer);\r\n};\r\n\r\nconst formaction = () => {\r\n form.onsubmit = (e) => {\r\n e.preventDefault();\r\n const { text } = e.target;\r\n add({\r\n description: text.value,\r\n completed: false,\r\n index: tasks.length,\r\n });\r\n text.value = '';\r\n };\r\n};\r\n\r\nif (localStorage.getItem('My-To-Do-List')) {\r\n tasks = JSON.parse(localStorage.getItem('My-To-Do-List'));\r\n} else {\r\n localStorage.setItem('My-To-Do-List', JSON.stringify([]));\r\n}\r\n\r\n\n\n//# sourceURL=webpack://webpack-project/./src/script.js?");
140 |
141 | /***/ })
142 |
143 | /******/ });
144 | /************************************************************************/
145 | /******/ // The module cache
146 | /******/ var __webpack_module_cache__ = {};
147 | /******/
148 | /******/ // The require function
149 | /******/ function __webpack_require__(moduleId) {
150 | /******/ // Check if module is in cache
151 | /******/ var cachedModule = __webpack_module_cache__[moduleId];
152 | /******/ if (cachedModule !== undefined) {
153 | /******/ return cachedModule.exports;
154 | /******/ }
155 | /******/ // Create a new module (and put it into the cache)
156 | /******/ var module = __webpack_module_cache__[moduleId] = {
157 | /******/ id: moduleId,
158 | /******/ // no module.loaded needed
159 | /******/ exports: {}
160 | /******/ };
161 | /******/
162 | /******/ // Execute the module function
163 | /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
164 | /******/
165 | /******/ // Return the exports of the module
166 | /******/ return module.exports;
167 | /******/ }
168 | /******/
169 | /************************************************************************/
170 | /******/ /* webpack/runtime/compat get default export */
171 | /******/ (() => {
172 | /******/ // getDefaultExport function for compatibility with non-harmony modules
173 | /******/ __webpack_require__.n = (module) => {
174 | /******/ var getter = module && module.__esModule ?
175 | /******/ () => (module['default']) :
176 | /******/ () => (module);
177 | /******/ __webpack_require__.d(getter, { a: getter });
178 | /******/ return getter;
179 | /******/ };
180 | /******/ })();
181 | /******/
182 | /******/ /* webpack/runtime/define property getters */
183 | /******/ (() => {
184 | /******/ // define getter functions for harmony exports
185 | /******/ __webpack_require__.d = (exports, definition) => {
186 | /******/ for(var key in definition) {
187 | /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
188 | /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
189 | /******/ }
190 | /******/ }
191 | /******/ };
192 | /******/ })();
193 | /******/
194 | /******/ /* webpack/runtime/hasOwnProperty shorthand */
195 | /******/ (() => {
196 | /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
197 | /******/ })();
198 | /******/
199 | /******/ /* webpack/runtime/make namespace object */
200 | /******/ (() => {
201 | /******/ // define __esModule on exports
202 | /******/ __webpack_require__.r = (exports) => {
203 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
204 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
205 | /******/ }
206 | /******/ Object.defineProperty(exports, '__esModule', { value: true });
207 | /******/ };
208 | /******/ })();
209 | /******/
210 | /******/ /* webpack/runtime/nonce */
211 | /******/ (() => {
212 | /******/ __webpack_require__.nc = undefined;
213 | /******/ })();
214 | /******/
215 | /************************************************************************/
216 | /******/
217 | /******/ // startup
218 | /******/ // Load entry module and return exports
219 | /******/ // This entry module can't be inlined because the eval devtool is used.
220 | /******/ var __webpack_exports__ = __webpack_require__("./src/index.js");
221 | /******/
222 | /******/ })()
223 | ;
--------------------------------------------------------------------------------
/dist/main.js.LICENSE.txt:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Lodash
4 | * Copyright OpenJS Foundation and other contributors
5 | * Released under MIT license
6 | * Based on Underscore.js 1.8.3
7 | * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
8 | */
9 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "webpack-project",
3 | "version": "1.0.0",
4 | "description": "",
5 | "private": true,
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1",
8 | "start": "webpack serve --open",
9 | "build": "webpack"
10 | },
11 | "repository": {
12 | "type": "git",
13 | "url": "git+https://github.com/Progress2002/Webpack-project.git"
14 | },
15 | "keywords": [],
16 | "author": "",
17 | "license": "ISC",
18 | "bugs": {
19 | "url": "https://github.com/Progress2002/Webpack-project/issues"
20 | },
21 | "homepage": "https://github.com/Progress2002/Webpack-project#readme",
22 | "devDependencies": {
23 | "babel-eslint": "^10.1.0",
24 | "css-loader": "^6.7.1",
25 | "eslint": "^7.32.0",
26 | "eslint-config-airbnb-base": "^14.2.1",
27 | "eslint-plugin-import": "^2.26.0",
28 | "hint": "^7.1.3",
29 | "html-webpack-plugin": "^5.5.0",
30 | "style-loader": "^3.3.1",
31 | "stylelint": "^13.13.1",
32 | "stylelint-config-standard": "^21.0.0",
33 | "stylelint-csstree-validator": "^1.9.0",
34 | "stylelint-scss": "^3.21.0",
35 | "webpack": "^5.74.0",
36 | "webpack-cli": "^4.10.0",
37 | "webpack-dev-server": "^4.11.1"
38 | },
39 | "dependencies": {
40 | "lodash": "^4.17.21"
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/complete.js:
--------------------------------------------------------------------------------
1 | import { tasks } from './script.js'; // eslint-disable-line
2 |
3 | // mark a task as completed or not------------
4 | const toggleComplete = (element) => {
5 | element.classList.toggle('completed');
6 | let elementPerentId = element.parentNode.parentNode.parentNode.id;
7 | elementPerentId = parseInt(elementPerentId, 10);
8 | tasks.forEach((task) => {
9 | if (task.index === elementPerentId) {
10 | const isIncluded = element.classList.contains('completed');
11 | if (isIncluded) {
12 | task.completed = true;
13 | } else {
14 | task.completed = false;
15 | }
16 | }
17 | });
18 | };
19 |
20 | export default toggleComplete;
--------------------------------------------------------------------------------
/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | To Do list
8 |
9 |
10 |
11 |
12 |
Today's To Do List
13 |
14 |
15 |
16 |
17 |
18 |
19 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import './style.css';
2 | import {
3 | render, remove, markAsCompleted, editTask, cleareCompleted, tasks, formaction,
4 | } from './script.js';
5 |
6 | const toDoListContainer = document.querySelector('.todo-list');
7 |
8 | formaction();
9 |
10 | document.addEventListener('DOMContentLoaded', () => {
11 | tasks.sort((a, b) => a.index - b.index).map((item) => render(item));
12 | remove(toDoListContainer);
13 | tasks.forEach((task) => {
14 | if (task.completed) {
15 | const taskIndex = task.index;
16 | toDoListContainer.querySelectorAll('.text').forEach((text) => {
17 | const textParentNodeId = parseInt(text.parentNode.parentNode.parentNode.id, 10);
18 | if (textParentNodeId === taskIndex) {
19 | text.classList.add('completed');
20 | text.previousElementSibling.checked = true;
21 | }
22 | });
23 | }
24 | });
25 | editTask(toDoListContainer);
26 | markAsCompleted(toDoListContainer);
27 | cleareCompleted(toDoListContainer);
28 | });
29 |
--------------------------------------------------------------------------------
/src/script.js:
--------------------------------------------------------------------------------
1 | import toggleComplete from './complete.js'; // eslint-disable-line
2 |
3 | const completeBtn = document.querySelector('.complete');
4 | const toDoListContainer = document.querySelector('.todo-list');
5 | const form = document.querySelector('form');
6 |
7 | let tasks = []; // eslint-disable-line
8 |
9 | export const updateStorage = (task) => {
10 | localStorage.setItem('My-To-Do-List', JSON.stringify(task));
11 | };
12 |
13 | // render newly added task to page --------
14 | export const render = (task) => {
15 | toDoListContainer.innerHTML += `
16 |
17 |
18 |
19 |
20 |
${task.description}
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | `;
29 | };
30 |
31 | // Remove selected task from list---
32 | const removeId = (id) => {
33 | tasks = tasks.filter((task) => task.index !== id);
34 | for (let i = 0; i < tasks.length; i += 1) {
35 | tasks[i].index = i;
36 | updateStorage(tasks);
37 | }
38 | updateStorage(tasks);
39 | };
40 |
41 | export const remove = (element) => {
42 | element.querySelectorAll('.delete').forEach((btn) => {
43 | btn.addEventListener('click', (e) => {
44 | const parent = e.target.parentNode.parentNode.parentNode;
45 | removeId(parseInt(parent.id, 10));
46 | parent.remove();
47 | });
48 | });
49 | };
50 |
51 | export const markAsCompleted = (element) => {
52 | element.querySelectorAll('.checkbox').forEach((box) => {
53 | box.addEventListener('change', () => {
54 | const item = box.nextElementSibling;
55 | toggleComplete(item);
56 | updateStorage(tasks);
57 | });
58 | });
59 | };
60 |
61 | // Cleare completed files---------
62 | export const cleareCompleted = (element) => {
63 | completeBtn.addEventListener('click', () => {
64 | element.querySelectorAll('.list').forEach((list) => {
65 | const taskId = parseInt(list.parentNode.id, 10);
66 | const parentnode = list.parentNode;
67 | tasks.forEach((task) => {
68 | if (task.completed && task.index === taskId) {
69 | parentnode.remove();
70 | }
71 | });
72 | });
73 | tasks = tasks.filter((task) => task.completed !== true);
74 | for (let i = 0; i < tasks.length; i += 1) {
75 | tasks[i].index = i;
76 | updateStorage(tasks);
77 | }
78 | updateStorage(tasks);
79 | });
80 | };
81 |
82 | // // edit task----------------
83 | export const editTask = (element) => {
84 | element.querySelectorAll('.text').forEach((box) => {
85 | box.addEventListener('input', (e) => {
86 | const activeText = e.target;
87 | const textContent = activeText.innerHTML;
88 | const activeTextParentId = parseInt(activeText.parentNode.parentNode.parentNode.id, 10);
89 | tasks.forEach((task) => {
90 | if (task.index === activeTextParentId) {
91 | task.description = textContent;
92 | updateStorage(tasks);
93 | }
94 | });
95 | });
96 | });
97 | };
98 |
99 | // // Add new task to the list---------
100 | const add = (task) => {
101 | render(task);
102 | tasks.push(task);
103 | updateStorage(tasks);
104 | remove(toDoListContainer);
105 | editTask(toDoListContainer);
106 | markAsCompleted(toDoListContainer);
107 | cleareCompleted(toDoListContainer);
108 | };
109 |
110 | export const formaction = () => {
111 | form.onsubmit = (e) => {
112 | e.preventDefault();
113 | const { text } = e.target;
114 | add({
115 | description: text.value,
116 | completed: false,
117 | index: tasks.length,
118 | });
119 | text.value = '';
120 | };
121 | };
122 |
123 | if (localStorage.getItem('My-To-Do-List')) {
124 | tasks = JSON.parse(localStorage.getItem('My-To-Do-List'));
125 | } else {
126 | localStorage.setItem('My-To-Do-List', JSON.stringify([]));
127 | }
128 |
129 | export { tasks };
--------------------------------------------------------------------------------
/src/style.css:
--------------------------------------------------------------------------------
1 | * {
2 | margin: 0;
3 | padding: 0;
4 | box-sizing: border-box;
5 | }
6 |
7 | body {
8 | display: flex;
9 | min-height: 100vh;
10 | background: linear-gradient(-45deg, white 50%, #f8f8f8 50%);
11 | font-family: sans-serif;
12 | }
13 |
14 | #main {
15 | width: 94%;
16 | border-radius: 7px;
17 | margin: auto;
18 | background-color: aliceblue;
19 | box-shadow: 0 5px 9px gray;
20 | }
21 |
22 | .heading {
23 | display: flex;
24 | justify-content: space-between;
25 | align-items: center;
26 | padding: 15px;
27 | background-color: rgb(46, 46, 236);
28 | color: #fff;
29 | border-radius: 7px 7px 0 0;
30 | }
31 |
32 | h2 {
33 | font-weight: bolder;
34 | }
35 |
36 | .add {
37 | width: 100%;
38 | }
39 |
40 | form {
41 | display: flex;
42 | }
43 |
44 | input[type=text] {
45 | padding: 15px;
46 | display: block;
47 | outline: none;
48 | border: none;
49 | width: 100%;
50 | font-size: 18px;
51 | font-style: italic;
52 | background-color: inherit;
53 | }
54 |
55 | button[type=submit] {
56 | border: none;
57 | background-color: inherit;
58 | margin-right: 15px;
59 | cursor: pointer;
60 | font-size: 15px;
61 | }
62 |
63 | .todo-list .list {
64 | padding: 15px;
65 | display: flex;
66 | justify-content: space-between;
67 | align-items: center;
68 | font-size: 20px;
69 | }
70 |
71 | .list-description {
72 | display: flex;
73 | align-items: center;
74 | width: 85%;
75 | }
76 |
77 | .list-description p {
78 | width: 100%;
79 | outline: none;
80 | border: none;
81 | }
82 |
83 | .completed {
84 | text-decoration: line-through;
85 | }
86 |
87 | input[type=checkbox] {
88 | display: inline-block;
89 | border: 0;
90 | position: relative;
91 | top: 2px;
92 | height: 30px;
93 | width: 20px;
94 | margin-right: 7px;
95 | }
96 |
97 | input[type=checkbox]:hover {
98 | cursor: pointer;
99 | }
100 |
101 | .delete {
102 | color: rgb(221, 50, 50);
103 | cursor: pointer;
104 | }
105 |
106 | #completed {
107 | padding: 13px;
108 | text-align: center;
109 | font-size: 20px;
110 | background-color: rgb(223, 219, 219);
111 | }
112 |
113 | #completed:hover {
114 | cursor: pointer;
115 | }
116 |
117 | #completed button {
118 | font-size: 19px;
119 | border: none;
120 | background-color: inherit;
121 | color: rgb(134, 131, 131);
122 | cursor: pointer;
123 | }
124 |
125 | #completed .complete:hover {
126 | color: rgb(37, 36, 36);
127 | }
128 |
129 | @media (min-width: 768px) {
130 | #main {
131 | width: 50%;
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const HtmlWebpackPlugin = require('html-webpack-plugin');
3 |
4 | module.exports = {
5 | mode: 'development',
6 | entry: './src/index.js',
7 | devServer: {
8 | static: './dist',
9 | },
10 | plugins: [
11 | new HtmlWebpackPlugin({
12 | template: './src/index.html',
13 | }),
14 | ],
15 | output: {
16 | filename: 'main.js',
17 | path: path.resolve(__dirname, 'dist'),
18 | },
19 | module: {
20 | rules: [
21 | {
22 | test: /\.css$/i,
23 | use: ['style-loader', 'css-loader'],
24 | },
25 | ],
26 | },
27 | };
--------------------------------------------------------------------------------