├── googleec6ed805508de9e8.html
├── favicon.ico
├── assets
├── discordicon.png
└── githubicon.png
├── robots.txt
├── modules
├── isEmptyOrSpaces.js
├── generateJson.js
├── theme.js
└── export.js
├── scrollbar.css
├── sitemap.xml
├── LICENSE
├── .github
└── workflows
│ └── pages.yml
├── README.md
├── CONTRIBUTING.md
├── script.js
├── index.html
├── CODE_OF_CONDUCT.md
└── style.css
/googleec6ed805508de9e8.html:
--------------------------------------------------------------------------------
1 | google-site-verification: googleec6ed805508de9e8.html
--------------------------------------------------------------------------------
/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Would-You-Bot/json-generator/HEAD/favicon.ico
--------------------------------------------------------------------------------
/assets/discordicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Would-You-Bot/json-generator/HEAD/assets/discordicon.png
--------------------------------------------------------------------------------
/assets/githubicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Would-You-Bot/json-generator/HEAD/assets/githubicon.png
--------------------------------------------------------------------------------
/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Allow: /
3 |
4 | Sitemap: https://would-you-bot.github.io/json-generator/sitemap.xml
--------------------------------------------------------------------------------
/modules/isEmptyOrSpaces.js:
--------------------------------------------------------------------------------
1 | export default function isEmptyOrSpaces(str) {
2 | return str === null || str.match(/^ *$/) !== null;
3 | }
--------------------------------------------------------------------------------
/scrollbar.css:
--------------------------------------------------------------------------------
1 | ::-webkit-scrollbar {
2 | width: 10px;
3 | }
4 |
5 | /* Track */
6 | ::-webkit-scrollbar-track {
7 | background: #151515;
8 | }
9 |
10 | /* Handle */
11 | ::-webkit-scrollbar-thumb {
12 | background: #888;
13 | border-radius: 2px;
14 | }
15 |
16 | /* Handle on hover */
17 | ::-webkit-scrollbar-thumb:hover {
18 | background: #555;
19 | }
20 |
--------------------------------------------------------------------------------
/sitemap.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 | https://would-you-bot.github.io/json-generator/
9 | 2022-10-08T17:49:08+00:00
10 |
11 |
--------------------------------------------------------------------------------
/modules/generateJson.js:
--------------------------------------------------------------------------------
1 | export default function generateJson() {
2 | var arrayuseful = [];
3 | $("#containeruseful :input").each(function (e) {
4 | arrayuseful.push(this.value);
5 | });
6 | const filteruseful = arrayuseful.filter((a) => a);
7 | var arrayuseless = [];
8 | $("#containeruseless :input").each(function (e) {
9 | arrayuseless.push(this.value);
10 | });
11 | const filteruseless = arrayuseless.filter((a) => a);
12 | const finished = {
13 | useful: filteruseful,
14 | useless: filteruseless,
15 | };
16 | return finished;
17 | }
--------------------------------------------------------------------------------
/modules/theme.js:
--------------------------------------------------------------------------------
1 | const toggleIcon = document.querySelector("#toggle-icon");
2 | // for dark theme
3 | (function () {
4 | if (localStorage.getItem("dark") === "false") {
5 | document.body.classList.toggle("light-mode");
6 | toggleIcon.classList.remove("fa-sun");
7 | toggleIcon.classList.add("fa-moon");
8 | } else {
9 | localStorage.setItem("dark", "true");
10 | }
11 | document.querySelector(".theme-btn").addEventListener("click", () => {
12 | document.body.classList.toggle("light-mode");
13 | if (localStorage.getItem("dark") === "true") {
14 | localStorage.setItem("dark", "false");
15 | toggleIcon.classList.remove("fa-sun");
16 | toggleIcon.classList.add("fa-moon");
17 | } else {
18 | localStorage.setItem("dark", "true");
19 | toggleIcon.classList.remove("fa-moon");
20 | toggleIcon.classList.add("fa-sun");
21 | }
22 | });
23 | })();
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Would You Bot
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 |
--------------------------------------------------------------------------------
/.github/workflows/pages.yml:
--------------------------------------------------------------------------------
1 | # Simple workflow for deploying static content to GitHub Pages
2 | name: Deploy static content to Pages
3 |
4 | on:
5 | # Runs on pushes targeting the default branch
6 | push:
7 | branches: ["main"]
8 |
9 | # Allows you to run this workflow manually from the Actions tab
10 | workflow_dispatch:
11 |
12 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13 | permissions:
14 | contents: read
15 | pages: write
16 | id-token: write
17 |
18 | # Allow one concurrent deployment
19 | concurrency:
20 | group: "pages"
21 | cancel-in-progress: true
22 |
23 | jobs:
24 | # Single deploy job since we're just deploying
25 | deploy:
26 | environment:
27 | name: github-pages
28 | url: ${{ steps.deployment.outputs.page_url }}
29 | runs-on: ubuntu-latest
30 | steps:
31 | - name: Checkout
32 | uses: actions/checkout@v3
33 | - name: Setup Pages
34 | uses: actions/configure-pages@v2
35 | - name: Upload artifact
36 | uses: actions/upload-pages-artifact@v1
37 | with:
38 | # Upload entire repository
39 | path: '.'
40 | - name: Deploy to GitHub Pages
41 | id: deployment
42 | uses: actions/deploy-pages@v1
43 |
--------------------------------------------------------------------------------
/modules/export.js:
--------------------------------------------------------------------------------
1 | import generateJson from "./generateJson.js";
2 | import isEmptyOrSpaces from "./isEmptyOrSpaces.js";
3 |
4 | const svgContainer = document.getElementById('svg');
5 | // Setting up bodymovin animation
6 | const animItem = bodymovin.loadAnimation({
7 | wrapper: svgContainer,
8 | animType: 'svg',
9 | loop: false,
10 | autoplay: false,
11 | path: 'https://assets4.lottiefiles.com/packages/lf20_Jp1pCorlFf.json',
12 | });
13 | document.getElementById("generatebtn").onclick = function () {
14 | let finished = generateJson();
15 | let empty = false;
16 | finished["useful"].forEach(e => {
17 | if (isEmptyOrSpaces(e)) empty = true;
18 | })
19 | finished["useless"].forEach(e => {
20 | if (isEmptyOrSpaces(e)) empty = true;
21 | })
22 | if (empty) return alert("You can't have empty fields!");
23 | if (finished["useful"].length == 0 && finished["useless"].length == 0 && finished)
24 | return alert("You need to add at least one question before exporting");
25 |
26 | svgContainer.classList.remove('hide'); //making visible
27 | animItem.goToAndPlay(0, true); //resetting animation
28 |
29 | const blob = new Blob([JSON.stringify(finished)], {
30 | type: "application/json",
31 | });
32 | const url = URL.createObjectURL(blob);
33 | const link = document.createElement("a");
34 | link.href = url;
35 | link.download = "wouldyou-export.json";
36 | link.click();
37 | setTimeout(() => {
38 | URL.revokeObjectURL(url);
39 | }, 100);
40 | };
41 | // Lottie
42 | animItem.addEventListener('complete', () => svgContainer.classList.add('hide')); //Adding back the hide class once animation is complete
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Json Generator
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | ## How to run the project
13 | - Install the [VSCode Live Server](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer) Extention.
14 | - Navigate to the [`html file`](index.html).
15 | - Start the Live Server.
16 |
17 | ## Want to contribute?
18 | - Take a look at [`contributing guidelines`](CONTRIBUTING.md).
19 | - Refer [GitHub Flow](https://guides.github.com/introduction/flow).
20 |
21 | ## Why should I contribute?
22 | - You can help a small project grow and improve it.
23 | - You can earn points during [hacktoberfest](https://hacktoberfest.com/).
24 | - You can earn yourself a special contributor/helper role on our [discord server](discord.gg/vMyXAxEznS)
25 |
26 |
27 | ## Contributors
28 |
29 | **Thanks goes to these wonderful people ❤️**
30 |
31 |
32 |