From 52fefb53d73b734e8fdafcdba63f20ecceea390e Mon Sep 17 00:00:00 2001 From: Sharath Date: Wed, 22 Nov 2023 10:20:58 +0530 Subject: [PATCH 1/2] WORK AREA-SV --- addform.html | 413 +++++++++++++++++++++- package-lock.json | 802 ++++++++++++++++++++++++++++++++++++++++++- package.json | 1 + rtc_hide_and_show.js | 4 +- 4 files changed, 1197 insertions(+), 23 deletions(-) diff --git a/addform.html b/addform.html index 433e27b..bcc2ad9 100644 --- a/addform.html +++ b/addform.html @@ -56,9 +56,10 @@ - - - + + + + @@ -240,7 +242,7 @@ #sidebar-wrapper { min-height: 100vh; - flex-basis:20%; + flex-basis:21%; width:300px; margin-left: -15rem; transition: margin 0.25s ease-out; @@ -357,6 +359,37 @@ color: #bf303b; /* background: #bf303b; */ } + .work-area{ + background-color: transparent; + position: fixed; + top:81px; + right: 10px; + border: none; + border-radius: 15%; /* Make the button round */ + width: 40px; /* Set the width and height of the button */ + height: 40px; + transition: box-shadow 0.3s, background-color 0.3s; + color: #bf303b; + + } + .work-area1{ + background-color: transparent; + position: absolute; + top:-8px; + left:-18px; + border-width:0; + transform:rotate(58deg); + transition: box-shadow 0.3s, background-color 0.3s; + color: #bf303b; + + } + .work-area1::before{ + content: '\2BC7'; + font-size: 24px; + } + .work-area::before{ + content:'\2630'; + } .menu-symbol { position:absolute; right:0; @@ -391,8 +424,6 @@ - - + + -
@@ -568,6 +717,7 @@ h1.title{
  • Home
  • Save
  • Preview
  • +
    @@ -577,6 +727,7 @@ h1.title{ +
    @@ -587,7 +738,209 @@ h1.title{
    + + +
    @@ -779,6 +1132,7 @@ h1.title{ + @@ -862,15 +1216,15 @@ $(document).ready(function() { }) -$(document).on("click", function (event) { +// $(document).on("click", function (event) { - var questionPaperDiv = $(".QuestionPaperClass"); - if (!questionPaperDiv.is(event.target) && questionPaperDiv.has(event.target).length === 0) { - $('.ql-toolbar').hide(); - } +// var questionPaperDiv = $(".QuestionPaperClass"); +// if (!questionPaperDiv.is(event.target) && questionPaperDiv.has(event.target).length === 0) { +// $('.ql-toolbar').hide(); +// } -}); +// }); document.addEventListener('DOMContentLoaded', function () { @@ -1062,6 +1416,22 @@ var quill = new Quill('#Question_description', { } }); +// var quill = new Quill('#workarea', { +// theme: 'snow', +// modules: { +// toolbar:{ +// container:toolbarOptions, +// clipboard: { +// matchVisual: true, +// }, +// ImageResize:{ +// displaySize:true, +// modules: [ 'Resize', 'DisplaySize', 'Toolbar' ] +// } +// }, +// } +// }); + var quill = new Quill('#ql-editor',{ theme:'snow', module:{ @@ -1093,7 +1463,9 @@ rtc_hide_and_show(setitem); }); var Question_description_Div = $("#Question_description"); +console.log("Question_description_Div",Question_description_Div); var Question_description_previousDiv = Question_description_Div.prev(); +console.log("Question_description_previousDiv",Question_description_previousDiv); Question_description_previousDiv.attr("id", "Question_description_rtc"); var questionDescriptionRtc = 'Question_description_rtc'; $('#Question_description').focus(function() { @@ -1102,6 +1474,13 @@ rtc_hide_and_show(questionDescriptionRtc); }); +// var chat_Div = $("#workarea"); +// var chat_previousDiv = chat_Div.prev(); +// chat_previousDiv.attr("id", "messageInput_rtc"); +// var chatRtc = 'messageInput_rtc'; +// $('#workarea').focus(function() { +// rtc_hide_and_show(chatRtc); +// }); var checkboxElement = document.createElement('input'); checkboxElement.type = 'checkbox'; diff --git a/package-lock.json b/package-lock.json index 884dd68..5b21d18 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,6 +25,7 @@ "jquery-ui": "^1.13.2", "jsdom": "^22.1.0", "mathjax": "^3.2.2", + "mathjax-node": "^2.1.1", "mathlive": "^0.95.5", "quill": "^1.3.7", "quill-image-resize": "^3.0.9", @@ -396,6 +397,45 @@ "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==" }, + "node_modules/acorn": { + "version": "5.7.4", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz", + "integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-globals": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz", + "integrity": "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A==", + "dependencies": { + "acorn": "^6.0.1", + "acorn-walk": "^6.0.1" + } + }, + "node_modules/acorn-globals/node_modules/acorn": { + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz", + "integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", + "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/agent-base": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", @@ -422,6 +462,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -444,11 +499,35 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/array-equal": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.2.tgz", + "integrity": "sha512-gUHx76KtnhEgB3HOuFYiCm3FIdEs6ocM2asHvNTkfu/Y09qQVrrVVaOKENmS2KkSaGoxgXNqC+ZVtR/n0MOkSA==", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/asap": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==" }, + "node_modules/asn1": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", + "dependencies": { + "safer-buffer": "~2.1.0" + } + }, + "node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", + "engines": { + "node": ">=0.8" + } + }, "node_modules/astral-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", @@ -457,6 +536,11 @@ "node": ">=8" } }, + "node_modules/async-limiter": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -480,6 +564,19 @@ "node": ">=0.8" } }, + "node_modules/aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", + "engines": { + "node": "*" + } + }, + "node_modules/aws4": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz", + "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==" + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -506,6 +603,14 @@ } ] }, + "node_modules/bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", + "dependencies": { + "tweetnacl": "^0.14.3" + } + }, "node_modules/bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -549,6 +654,11 @@ "concat-map": "0.0.1" } }, + "node_modules/browser-process-hrtime": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", + "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==" + }, "node_modules/buffer-crc32": { "version": "0.2.13", "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", @@ -610,6 +720,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==" + }, "node_modules/cheerio": { "version": "1.0.0-rc.12", "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.12.tgz", @@ -769,6 +884,11 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, + "node_modules/core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -833,6 +953,11 @@ "url": "https://github.com/sponsors/fb55" } }, + "node_modules/cssom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==" + }, "node_modules/cssstyle": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-3.0.0.tgz", @@ -844,6 +969,17 @@ "node": ">=14" } }, + "node_modules/dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", + "dependencies": { + "assert-plus": "^1.0.0" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/data-urls": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-4.0.0.tgz", @@ -919,6 +1055,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" + }, "node_modules/defer-to-connect": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", @@ -1090,6 +1231,15 @@ "url": "https://github.com/motdotla/dotenv?sponsor=1" } }, + "node_modules/ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", + "dependencies": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, "node_modules/electron": { "version": "26.4.2", "resolved": "https://registry.npmjs.org/electron/-/electron-26.4.2.tgz", @@ -1383,6 +1533,55 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/escodegen": { + "version": "1.14.3", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.3.tgz", + "integrity": "sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==", + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^4.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=4.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/ev-emitter": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ev-emitter/-/ev-emitter-2.1.2.tgz", @@ -1441,11 +1640,34 @@ "@types/yauzl": "^2.9.1" } }, + "node_modules/extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", + "engines": [ + "node >=0.6.0" + ] + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, "node_modules/fast-diff": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.1.2.tgz", "integrity": "sha512-KaJUt+M9t1qaIteSvjc6P3RbMdXsNhK61GRftR6SNxqmhthcd9MGIi4T+o0jD8LUSpSnSKXE20nLtJ3fOHxQig==" }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==" + }, "node_modules/fd-slicer": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", @@ -1546,6 +1768,14 @@ "node": ">= 10.0.0" } }, + "node_modules/forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", + "engines": { + "node": "*" + } + }, "node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -1729,6 +1959,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", + "dependencies": { + "assert-plus": "^1.0.0" + } + }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -1841,6 +2079,27 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, + "node_modules/har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==", + "engines": { + "node": ">=4" + } + }, + "node_modules/har-validator": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", + "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", + "deprecated": "this library is no longer supported", + "dependencies": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/has-property-descriptors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", @@ -1965,6 +2224,20 @@ "node": ">= 6" } }, + "node_modules/http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==", + "dependencies": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + }, + "engines": { + "node": ">=0.8", + "npm": ">=1.3.7" + } + }, "node_modules/http2-wrapper": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", @@ -2319,6 +2592,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==" + }, "node_modules/is-wsl": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", @@ -2349,6 +2627,11 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "node_modules/isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" + }, "node_modules/jquery": { "version": "3.7.1", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz", @@ -2362,6 +2645,11 @@ "jquery": ">=1.8.0 <4.0.0" } }, + "node_modules/jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==" + }, "node_modules/jsdom": { "version": "22.1.0", "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-22.1.0.tgz", @@ -2408,12 +2696,20 @@ "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" }, + "node_modules/json-schema": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, "node_modules/json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", - "dev": true, - "optional": true + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" }, "node_modules/jsonfile": { "version": "4.0.0", @@ -2424,6 +2720,20 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/jsprim": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", + "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", + "dependencies": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.4.0", + "verror": "1.10.0" + }, + "engines": { + "node": ">=0.6.0" + } + }, "node_modules/junk": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/junk/-/junk-3.1.0.tgz", @@ -2450,6 +2760,24 @@ "node": ">=14.14.0" } }, + "node_modules/left-pad": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz", + "integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==", + "deprecated": "use String.prototype.padStart()" + }, + "node_modules/levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", + "dependencies": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/load-json-file": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", @@ -2489,6 +2817,11 @@ "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", "dev": true }, + "node_modules/lodash.sortby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==" + }, "node_modules/lowercase-keys": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", @@ -2528,6 +2861,186 @@ "resolved": "https://registry.npmjs.org/mathjax/-/mathjax-3.2.2.tgz", "integrity": "sha512-Bt+SSVU8eBG27zChVewOicYs7Xsdt40qm4+UpHyX7k0/O9NliPc+x77k1/FEsPsjKPZGJvtRZM1vO+geW0OhGw==" }, + "node_modules/mathjax-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/mathjax-node/-/mathjax-node-2.1.1.tgz", + "integrity": "sha512-i29tvqD8yHPB2WhrGV5rvliYnKwTT8a/TO8SCnuYtatpSHxLGy3aF7lDTVLD6B1bfuVMTFB6McZu2TBxk0XGeg==", + "dependencies": { + "is-fullwidth-code-point": "^2.0.0", + "jsdom": "^11.0.0", + "mathjax": "^2.7.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/mathjax-node/node_modules/cssstyle": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-1.4.0.tgz", + "integrity": "sha512-GBrLZYZ4X4x6/QEoBnIrqb8B/f5l4+8me2dkom/j1Gtbxy0kBv6OGzKuAsGM75bkGwGAFkt56Iwg28S3XTZgSA==", + "dependencies": { + "cssom": "0.3.x" + } + }, + "node_modules/mathjax-node/node_modules/data-urls": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.1.0.tgz", + "integrity": "sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ==", + "dependencies": { + "abab": "^2.0.0", + "whatwg-mimetype": "^2.2.0", + "whatwg-url": "^7.0.0" + } + }, + "node_modules/mathjax-node/node_modules/data-urls/node_modules/whatwg-url": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", + "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", + "dependencies": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + }, + "node_modules/mathjax-node/node_modules/domexception": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", + "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==", + "dependencies": { + "webidl-conversions": "^4.0.2" + } + }, + "node_modules/mathjax-node/node_modules/html-encoding-sniffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", + "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", + "dependencies": { + "whatwg-encoding": "^1.0.1" + } + }, + "node_modules/mathjax-node/node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mathjax-node/node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", + "engines": { + "node": ">=4" + } + }, + "node_modules/mathjax-node/node_modules/jsdom": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.12.0.tgz", + "integrity": "sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw==", + "dependencies": { + "abab": "^2.0.0", + "acorn": "^5.5.3", + "acorn-globals": "^4.1.0", + "array-equal": "^1.0.0", + "cssom": ">= 0.3.2 < 0.4.0", + "cssstyle": "^1.0.0", + "data-urls": "^1.0.0", + "domexception": "^1.0.1", + "escodegen": "^1.9.1", + "html-encoding-sniffer": "^1.0.2", + "left-pad": "^1.3.0", + "nwsapi": "^2.0.7", + "parse5": "4.0.0", + "pn": "^1.1.0", + "request": "^2.87.0", + "request-promise-native": "^1.0.5", + "sax": "^1.2.4", + "symbol-tree": "^3.2.2", + "tough-cookie": "^2.3.4", + "w3c-hr-time": "^1.0.1", + "webidl-conversions": "^4.0.2", + "whatwg-encoding": "^1.0.3", + "whatwg-mimetype": "^2.1.0", + "whatwg-url": "^6.4.1", + "ws": "^5.2.0", + "xml-name-validator": "^3.0.0" + } + }, + "node_modules/mathjax-node/node_modules/mathjax": { + "version": "2.7.9", + "resolved": "https://registry.npmjs.org/mathjax/-/mathjax-2.7.9.tgz", + "integrity": "sha512-NOGEDTIM9+MrsqnjPEjVGNx4q0GQxqm61yQwSK+/5S59i26wId5IC5gNu9/bu8+CCVl5p9G2IHcAl/wJa+5+BQ==" + }, + "node_modules/mathjax-node/node_modules/parse5": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", + "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==" + }, + "node_modules/mathjax-node/node_modules/tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dependencies": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/mathjax-node/node_modules/tr46": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/mathjax-node/node_modules/webidl-conversions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==" + }, + "node_modules/mathjax-node/node_modules/whatwg-encoding": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz", + "integrity": "sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==", + "dependencies": { + "iconv-lite": "0.4.24" + } + }, + "node_modules/mathjax-node/node_modules/whatwg-mimetype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz", + "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==" + }, + "node_modules/mathjax-node/node_modules/whatwg-url": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.5.0.tgz", + "integrity": "sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ==", + "dependencies": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + }, + "node_modules/mathjax-node/node_modules/ws": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.3.tgz", + "integrity": "sha512-jZArVERrMsKUatIdnLzqvcfydI85dvd/Fp1u/VOpfdDWQ4c9qWXe+VIeAbQ5FrDwciAkr+lzofXLz3Kuf26AOA==", + "dependencies": { + "async-limiter": "~1.0.0" + } + }, + "node_modules/mathjax-node/node_modules/xml-name-validator": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", + "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==" + }, "node_modules/mathlive": { "version": "0.95.5", "resolved": "https://registry.npmjs.org/mathlive/-/mathlive-0.95.5.tgz", @@ -2655,6 +3168,14 @@ "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.7.tgz", "integrity": "sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==" }, + "node_modules/oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "engines": { + "node": "*" + } + }, "node_modules/object-is": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", @@ -2686,6 +3207,22 @@ "wrappy": "1" } }, + "node_modules/optionator": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "dependencies": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.6", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "word-wrap": "~1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/p-any": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/p-any/-/p-any-4.0.0.tgz", @@ -2888,6 +3425,11 @@ "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", "dev": true }, + "node_modules/performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==" + }, "node_modules/pify": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", @@ -2911,6 +3453,19 @@ "node": ">=10.4.0" } }, + "node_modules/pn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", + "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==" + }, + "node_modules/prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", @@ -3119,6 +3674,14 @@ "node": ">=8" } }, + "node_modules/qs": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", + "engines": { + "node": ">=0.6" + } + }, "node_modules/querystringify": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", @@ -3255,6 +3818,114 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", + "dependencies": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/request-promise-core": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz", + "integrity": "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==", + "dependencies": { + "lodash": "^4.17.19" + }, + "engines": { + "node": ">=0.10.0" + }, + "peerDependencies": { + "request": "^2.34" + } + }, + "node_modules/request-promise-native": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.9.tgz", + "integrity": "sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g==", + "deprecated": "request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142", + "dependencies": { + "request-promise-core": "1.1.4", + "stealthy-require": "^1.1.1", + "tough-cookie": "^2.3.3" + }, + "engines": { + "node": ">=0.12.0" + }, + "peerDependencies": { + "request": "^2.34" + } + }, + "node_modules/request-promise-native/node_modules/tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dependencies": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/request/node_modules/form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 0.12" + } + }, + "node_modules/request/node_modules/tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dependencies": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/request/node_modules/uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "bin": { + "uuid": "bin/uuid" + } + }, "node_modules/requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", @@ -3317,6 +3988,25 @@ "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz", "integrity": "sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==" }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -3453,6 +4143,15 @@ "node": ">=0.10.0" } }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/spdx-correct": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", @@ -3492,6 +4191,38 @@ "dev": true, "optional": true }, + "node_modules/sshpk": { + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.18.0.tgz", + "integrity": "sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==", + "dependencies": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + }, + "bin": { + "sshpk-conv": "bin/sshpk-conv", + "sshpk-sign": "bin/sshpk-sign", + "sshpk-verify": "bin/sshpk-verify" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/stealthy-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", + "integrity": "sha512-ZnWpYnYugiOVEY5GkcuJK1io5V8QmNYChG62gSit9pQVGErXtrKuPC55ITaVSukmMta5qpMU7vqLt2Lnni4f/g==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -3651,6 +4382,33 @@ "node": ">=0.8.0" } }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==" + }, + "node_modules/type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", + "dependencies": { + "prelude-ls": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/type-fest": { "version": "0.13.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz", @@ -3699,6 +4457,14 @@ "node": ">=8" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/url-parse": { "version": "1.5.10", "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", @@ -3730,6 +4496,28 @@ "spdx-expression-parse": "^3.0.0" } }, + "node_modules/verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", + "engines": [ + "node >=0.6.0" + ], + "dependencies": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "node_modules/w3c-hr-time": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", + "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==", + "deprecated": "Use your platform's native performance.now() and performance.timeOrigin.", + "dependencies": { + "browser-process-hrtime": "^1.0.0" + } + }, "node_modules/w3c-xmlserializer": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", @@ -3795,6 +4583,14 @@ "node": ">= 8" } }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/package.json b/package.json index 73206d0..1601104 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "jquery-ui": "^1.13.2", "jsdom": "^22.1.0", "mathjax": "^3.2.2", + "mathjax-node": "^2.1.1", "mathlive": "^0.95.5", "quill": "^1.3.7", "quill-image-resize": "^3.0.9", diff --git a/rtc_hide_and_show.js b/rtc_hide_and_show.js index cab9458..2a95107 100644 --- a/rtc_hide_and_show.js +++ b/rtc_hide_and_show.js @@ -1,18 +1,16 @@ function rtc_hide_and_show(rtcid) { - // console.log('show id :'+rtcid) var id = localStorage.getItem('rtc'); var hideid = document.getElementById(id); // console.log('hide id :' + id) $(hideid).hide(); - var showid = document.getElementById(rtcid); + console.log('hide id :' + id) $(showid).show(); localStorage.setItem('rtc',rtcid); }; - function add_button_hide_and_show(BtnID){ // console.log('show id :'+BtnID) From b392a83b3fe0fb6156bf9650a8300fe7353a3a8a Mon Sep 17 00:00:00 2001 From: venkateswaran ubuntu Date: Fri, 24 Nov 2023 12:30:54 +0530 Subject: [PATCH 2/2] CRYPTO-NEW, EXPORT-NEW, ANSWER-JSON : RV --- .gitignore | 8 ++ addform.html | 65 ++++++++++++++- credentials/in/.gitkeep | 0 credentials/out/.gitkeep | 0 dashboard.html | 173 ++++++++++++++++++++++++++++++++++++--- decode.js | 51 ++++++++---- encode.js | 98 ++++++++++++++++++---- encodeEnv.js | 26 ++++++ html2json.js | 4 +- json2html.js | 2 + json2xml.js | 169 +++++++++++++++++++++++++++++++++++++- package-lock.json | 123 ++++++++++++++++++++++++++++ package.json | 2 + savexml.js | 99 +++++++++++++++------- style.css | 4 + xml/.gitkeep | 0 xml/Sample.xml | 1 + xml2json.js | 39 ++++++++- 18 files changed, 785 insertions(+), 79 deletions(-) create mode 100644 credentials/in/.gitkeep create mode 100644 credentials/out/.gitkeep create mode 100644 encodeEnv.js create mode 100644 xml/.gitkeep create mode 100644 xml/Sample.xml diff --git a/.gitignore b/.gitignore index 781ecc2..e0a0247 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,12 @@ dist/ .env xml/* !xml/Sample.xml +!xml/.gitkeep +credentials/in/* +credentials/out/* +!credentials/in/.gitkeep +!credentials/out/.gitkeep + + + diff --git a/addform.html b/addform.html index 7005100..5050098 100644 --- a/addform.html +++ b/addform.html @@ -399,6 +399,8 @@ border-color:#eee; margin-right: 0px; margin-top: 16px; + background: #1D3557; + } .popupbox q{ align-items: center; @@ -880,11 +882,68 @@ document.addEventListener('DOMContentLoaded', function () { } }) +// Function for Finding the JSON File in the folder +function findFile(filePath) { + try { + const stats = fs.statSync(filePath); + + if (stats.isFile()) { + + // File exists + // console.log(`File found at: ${filePath}`); + return true; + } else { + // console.error(`Path is not a file: ${filePath}`); + return false; + } + } catch (err) { + // console.error(`File not found: ${filePath}`); + return false; + } +} + + + + // Function to load XML from a file function loadXML(xmlFileName) { var decodeData =""; + var encodedXmlFilePath = `${xmlPath}${xmlFileName}`; + var jsonDecodeData = ""; + var jsonFileName = xmlFileName.split('.xml'); + var encodedJsonFilePath = `${xmlPath}${jsonFileName[0]}_answer.json`; + + var filelist = findFile(encodedJsonFilePath); + + if(filelist !== false) + { + //JSON File Read Function + new Promise((resolve, reject) => { + fs.readFile(encodedJsonFilePath, 'utf8', (error, data) => { + if (error) { + console.error('Error reading file:', error); + reject(error); + } else { + if (isEncrypted === 'YES') { + + jsonDecodeData = decode(encodedJsonFilePath); + localStorage.setItem('json_Decode_Data_For_Mcq_Crt_Ans', jsonDecodeData); + + } else{ + jsonDecodeData = data; + localStorage.setItem('json_Decode_Data_For_Mcq_Crt_Ans', jsonDecodeData); + + } + resolve(jsonDecodeData); + + } + }); + }); + } + +//XML File Read Function return new Promise((resolve, reject) => { fs.readFile(`${xmlPath}${xmlFileName}`, 'utf8', (error, data) => { if (error) { @@ -893,11 +952,13 @@ function loadXML(xmlFileName) { } else { if (isEncrypted === 'YES') { // decrypt function call go to decode.js - decodeData = decode(data); + decodeData = decode(encodedXmlFilePath); + } else{ decodeData = data; } - + + console.log('jsonDecodeData : ', jsonDecodeData); resolve(decodeData); xml2json(decodeData); // json2nav(); diff --git a/credentials/in/.gitkeep b/credentials/in/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/credentials/out/.gitkeep b/credentials/out/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/dashboard.html b/dashboard.html index 41ac827..28e08f3 100644 --- a/dashboard.html +++ b/dashboard.html @@ -302,6 +302,10 @@ margin-left: -16px; + + + + @@ -377,6 +381,8 @@ sourceStream.on('error', (err) => { diff --git a/decode.js b/decode.js index a4a4dda..ae7ba20 100644 --- a/decode.js +++ b/decode.js @@ -1,23 +1,46 @@ const crypto = require('crypto'); +function decode(encryptedDataFilePath) { + + // console.log('encryptedDataFilePath :', encryptedDataFilePath); + const privateKeyPath = process.env.PRIVATE_KEY_PATH; + const encryptedFileContent = fs.readFileSync(encryptedDataFilePath); + + // Extract the encrypted AES key, IV, and ciphertext + const encryptedAesKeyDec = encryptedFileContent.slice(0, 256); // Assuming 2048-bit RSA key, 256 bytes for the encrypted AES key + const ivDec = encryptedFileContent.slice(256, 256 + 16); // IV is 16 bytes + const ciphertext = encryptedFileContent.slice(256 + 16); -function decode(encryptedData) { try { - const algorithm = 'aes-256-cbc'; - const iv = Buffer.from(encryptedData.slice(0, 24), 'base64'); - const keyHex = 'd0ca711dc0c599de0847cb86f415cd34d602a322f0f07dc89bce9e1481f481b3'; - const derivedKey = Buffer.from(keyHex, 'hex'); - const encryptedText = encryptedData.slice(24); + + // Decrypt the AES key with the private key + const privateKeyObj = fs.readFileSync(privateKeyPath, 'utf-8'); + const decryptedAesKey = crypto.privateDecrypt( + { + key: privateKeyObj, + padding: crypto.constants.RSA_PKCS1_OAEP_PADDING, + oaepHash: 'sha256', + }, + encryptedAesKeyDec + ); - const decipher = crypto.createDecipheriv(algorithm, derivedKey, iv); - let decrypted = decipher.update(encryptedText, 'base64', 'utf8'); - decrypted += decipher.final('utf8'); + // Decrypt the file using AES + // const decipher = crypto.createDecipheriv('aes-128-cbc', decryptedAesKey, ivDec); + // let decryptedData = decipher.update(ciphertext); + // decryptedData = Buffer.concat([decryptedData, decipher.final()]); - console.log('Decrypted String:', decrypted); - return decrypted; + const decipher = crypto.createDecipheriv('aes-128-cbc', decryptedAesKey, ivDec); + let decryptedData = decipher.update(ciphertext, 'hex', 'utf-8'); + decryptedData += decipher.final('utf-8'); + + // console.log('File decrypted successfully.'); + // console.log('Decrypted String:', decryptedData); + return decryptedData; + } catch (error) { - console.error('Decryption failed:', error.message); - return null; + + console.error('Decryption failed:', error.message); + return null; } } - module.exports = decode; +module.exports = decode; diff --git a/encode.js b/encode.js index eef840a..e7aa3b6 100644 --- a/encode.js +++ b/encode.js @@ -1,23 +1,93 @@ +const fs = require('fs'); const crypto = require('crypto'); -function encode(inputString) { - try { - const algorithm = 'aes-256-cbc'; - const iv = crypto.randomBytes(16); - const keyHex = 'd0ca711dc0c599de0847cb86f415cd34d602a322f0f07dc89bce9e1481f481b3'; - const derivedKey = Buffer.from(keyHex, 'hex'); - const cipher = crypto.createCipheriv(algorithm, derivedKey, iv); +function encode(inputString, downloadFilePath = false) { - let encrypted = cipher.update(inputString, 'utf8', 'base64'); - encrypted += cipher.final('base64'); + console.log('encod downloadFilePath : ', downloadFilePath) + + var certificatePath = ''; + + if(downloadFilePath !== false) + { + certificatePath = process.env.DOWNLOAD_PUBLIC_KEY_PATH; + } + else{ + certificatePath = process.env.PUBLIC_KEY_PATH; + } + +try { + + const aesKey = crypto.randomBytes(16); // Change the byte length for different key lengths + const iv = crypto.randomBytes(16); // Initialization vector for AES-CBC + + // Encrypt the file using AES + const cipher = crypto.createCipheriv('aes-128-cbc', aesKey, iv); + let encryptedData = cipher.update(inputString); + encryptedData = Buffer.concat([encryptedData, cipher.final()]); + + // Get the public key from the self-signed certificate + const publicKey = fs.readFileSync(certificatePath, 'utf-8'); + + // Encrypt the AES key with the public key + const encryptedAesKey = crypto.publicEncrypt( + { + key: publicKey, + padding: crypto.constants.RSA_PKCS1_OAEP_PADDING, + oaepHash: 'sha256', + }, + aesKey + ); + + // Save the encrypted file and encrypted AES key + var encryptedResult = Buffer.concat([encryptedAesKey, iv, encryptedData]) + console.log('File encrypted successfully.'); + console.log('Encrypted String:', encryptedResult); + + if(downloadFilePath !== false) + { + try { + fs.writeFileSync(downloadFilePath, encryptedResult); + console.log('File downloaded successfully.'); + Swal.fire({ + title: "File Downloaded", + icon: "success" + }); + } catch (error) { + console.error('Error writing file:', error.message); + var errorMessage = ""; + + if(error.code == 'EACCES'){ + + errorMessage = `Permission Denied.
    Path: ${downloadFilePath}`; + } + else if(error.code == 'ENOENT'){ + + errorMessage = `No Such File Directory.
    Path: ${downloadFilePath}`; + } + else{ + errorMessage = `Unknown Error.
    Path: ${downloadFilePath}`; + } + + Swal.fire({ + title: "File Download Failed", + html: errorMessage, + icon: "warning" + }); + + } + } + else{ + + return encryptedResult; + + } + +} catch (error) { - const encryptedData = iv.toString('base64') + encrypted; - console.log('Encrypted String:', encryptedData); - return encryptedData; - } catch (error) { console.error('Encryption failed:', error.message); return null; - } + +} } module.exports = encode; diff --git a/encodeEnv.js b/encodeEnv.js new file mode 100644 index 0000000..e35279c --- /dev/null +++ b/encodeEnv.js @@ -0,0 +1,26 @@ +const fs = require('fs'); + +// Function to encode data to base64 +function encodeToBase64(data) { + return Buffer.from(data, 'utf-8').toString('base64'); +} + +// Function to encode .env file to base64 +function encodeEnvFileToBase64(envFilePath, outputFilePath) { + // Read the content of the .env file + const envData = fs.readFileSync(envFilePath, 'utf-8'); + + // Encode the data to base64 + const base64Data = encodeToBase64(envData); + + // Write the base64-encoded data to a new file + fs.writeFileSync(outputFilePath, base64Data, 'utf-8'); + + console.log('File encoded to base64 successfully.'); +} + +// Example usage +const envFilePath = '/.env'; +const outputFilePath = '/encoded_base64.env'; + +encodeEnvFileToBase64(envFilePath, outputFilePath); diff --git a/html2json.js b/html2json.js index 8e9a63a..4ef33f4 100644 --- a/html2json.js +++ b/html2json.js @@ -84,7 +84,7 @@ function html2json() { var groupChoiceId = ((element.id).split('_').slice(-1)[0]).split('.').slice(0)[0]; var individualChoiceId = (element.id).split('.').slice(-1)[0]; - console.log('newChoiceTextField_'+groupChoiceId+'.'+individualChoiceId); + // console.log('newChoiceTextField_'+groupChoiceId+'.'+individualChoiceId); var choice_math_Enabled = document.getElementById('choice_math_' + groupChoiceId + '.' + individualChoiceId).checked; var choice_name = ""; @@ -276,6 +276,6 @@ function html2json() { // console.log((formData)); // console.log(JSON.stringify(formData, null, 1)); localStorage.setItem("json", JSON.stringify((formData))); - console.log(JSON.stringify(formData)); + // console.log(JSON.stringify(formData)); // console.log(OBJtoXML(({'question_paper' : formData}))); } diff --git a/json2html.js b/json2html.js index aebdf74..d239567 100644 --- a/json2html.js +++ b/json2html.js @@ -5,6 +5,7 @@ function jsonToHtml(jsonData) { localStorage.setItem('scroll', 1) localStorage.setItem('EditNavExpend', 1) + const count = jsonData.sections.length; // console.log(`Count of sections: ${count}`); @@ -138,6 +139,7 @@ function QuestionsForEach(Question, questionAreaId, questionRandomNo){ groupQuestion(false, false, false, questionTitle, questionDescription, questionType, questionSubType, mathEnabled, Choice, questionAreaId, questionRandomNo, questionMarks, questionUUID, questionDisplayMarks,); // groupQuestion(QuestionObj); + Choice = Choice.slice(1); Choice.forEach(function(choicenames, index) { var choiceName = choicenames.choice_name; diff --git a/json2xml.js b/json2xml.js index 9a1060e..9830368 100644 --- a/json2xml.js +++ b/json2xml.js @@ -1,6 +1,143 @@ function json2xml() { // console.clear(); var obj = localStorage.getItem("json"); + // var obj = `{ + // "question_paper_title": "


    ", + // "question_paper_description": "


    ", + // "max_marks": "", + // "course_ID": "", + // "course_Code": "", + // "subject_ID": "", + // "subject_Code": "", + // "paper_No": "", + // "subject_Name": "", + // "sub_Paper_Prefix": "", + // "question_Paper_uuid": "f676ad21-b0d2-4a80-8c77-6cd2b35f1b34", + // "sections": [ + // { + // "section_title": "

    0

    ", + // "section_description": "


    ", + // "section_marks": "0", + // "section_uuid": "7c62e594-3b93-444f-9fa6-a05f87869db6", + // "section_display_marks": true, + // "section_attempt_any": "", + // "questions": [ + // { + // "question": "

    1

    ", + // "question_description": "


    ", + // "question_type": "group", + // "question_sub_type": false, + // "is_math_enabled": false, + // "display_marks": true, + // "marks": "", + // "choice_question_uuid": "40f37294-e7cb-4f19-9166-72f7a04f6391", + // "answers": [ + // { + // "choice_name": "


    ", + // "is_math_enabled": false, + // "choice_uuid": "387d9b85-4702-4e77-a8c3-29d713b7689e", + // "no": "a" + // }, + // { + // "choice_name": "


    ", + // "is_math_enabled": false, + // "choice_uuid": "1a6be686-9e7c-4b07-bf15-b9e07a01fd62", + // "no": "b" + // }, + // { + // "choice_name": "


    ", + // "is_math_enabled": false, + // "choice_uuid": "0640c05b-522e-422c-8050-0d5982aa3c74", + // "no": "c" + // }, + // { + // "choice_name": "


    ", + // "is_math_enabled": false, + // "choice_uuid": "e59f90b0-79d5-413e-85a4-ee3c181230d8", + // "no": "d" + // } + // ], + // "correct_answer": ["1a6be686-9e7c-4b07-bf15-b9e07a01fd62"] + // }, + // { + // "question": "

    2

    ", + // "question_description": "


    ", + // "question_type": "group", + // "question_sub_type": false, + // "is_math_enabled": false, + // "display_marks": true, + // "marks": "", + // "choice_question_uuid": "7a1c83e7-e9ae-4424-9336-6135eaa6b833", + // "answers": [ + // { + // "choice_name": "


    ", + // "is_math_enabled": false, + // "choice_uuid": "0cbb8330-8ce9-4d69-b547-68cee529a636", + // "no": "a" + // }, + // { + // "choice_name": "


    ", + // "is_math_enabled": false, + // "choice_uuid": "25dc4fdc-7bcf-4bea-aaa5-dc42a22c08b5", + // "no": "b" + // }, + // { + // "choice_name": "


    ", + // "is_math_enabled": false, + // "choice_uuid": "5b0da327-076f-488c-a46e-0b8251c83283", + // "no": "c" + // }, + // { + // "choice_name": "


    ", + // "is_math_enabled": false, + // "choice_uuid": "d3934305-d6fd-4601-8b1b-08067f47a8dd", + // "no": "d" + // } + // ], + // "correct_answer": ["d3934305-d6fd-4601-8b1b-08067f47a8dd"] + // }, + // { + // "question": "

    3

    ", + // "question_description": "


    ", + // "question_type": "group", + // "question_sub_type": false, + // "is_math_enabled": false, + // "display_marks": true, + // "marks": "", + // "choice_question_uuid": "6f929b53-9ebc-40fb-800e-46c42b75f2d9", + // "answers": [ + // { + // "choice_name": "


    ", + // "is_math_enabled": false, + // "choice_uuid": "f839312c-8de5-4cd5-8d6c-3ffd3b9efea6", + // "no": "a" + // }, + // { + // "choice_name": "


    ", + // "is_math_enabled": false, + // "choice_uuid": "905db769-82b2-4240-af06-fe0b15ee1f73", + // "no": "b" + // }, + // { + // "choice_name": "


    ", + // "is_math_enabled": false, + // "choice_uuid": "6a16126f-8100-49f8-ae33-71d4848030cf", + // "no": "c" + // }, + // { + // "choice_name": "


    ", + // "is_math_enabled": false, + // "choice_uuid": "143f648a-d52c-42ff-9428-1c080326e1c8", + // "no": "d" + // } + // ], + // "correct_answer": ["143f648a-d52c-42ff-9428-1c080326e1c8", "6a16126f-8100-49f8-ae33-71d4848030cf"] + // } + // ] + // } + // ] + // } + // ` // console.log(obj); // console.log('***********************************************************'); @@ -177,7 +314,7 @@ function json2xml() { //create section related xml nodes var tempSection = questionPaper['sections'][section]; - console.log(tempSection); + // console.log(tempSection); var sectionElement = createElementWithText(xmlDoc, rootItemsElement, 'Question', '', { 'xsi:type': 'QuestionPaperSection', @@ -199,6 +336,14 @@ function json2xml() { if (tempSection['questions'].length != 0) { for (question in tempSection['questions']) { var singleQuestion = tempSection['questions'][question]; + + //for Separate Correct Answer From MCQ + if(singleQuestion.question_type == 'group'){ + + separateCorrectAnswerFromMcqAsJson(singleQuestion) + } + + if (singleQuestion.hasOwnProperty('question_type')) // normal questions { var singleQuestionElement = getXMLNodesOfQuestionData(singleQuestion); @@ -224,3 +369,25 @@ function json2xml() { localStorage.setItem("xml", xmlString); } + + +const outputJson = { questions: [] }; + +function separateCorrectAnswerFromMcqAsJson(tempSection) { + +const questionId = tempSection.choice_question_uuid; +const answers = tempSection.correct_answer; + +// Create an object for each question and push it to the output array +outputJson.questions.push({ + questionId, + answers +}); + +// Convert the output object to JSON string +const outputJsonString = JSON.stringify(outputJson, null, 2); +localStorage.setItem("Correct_Answer_Json", outputJsonString); +console.log('outputJsonString : ', outputJsonString); + +} + diff --git a/package-lock.json b/package-lock.json index 65ec8da..ad2b5b1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,8 @@ "cheerio": "^1.0.0-rc.12", "desandro-matches-selector": "^2.0.2", "dotenv": "^16.3.1", + "electron-dl": "^3.5.1", + "electron-download-manager": "^2.1.2", "ev-emitter": "^2.1.2", "fizzy-ui-utils": "^3.0.0", "formidable": "^3.5.1", @@ -1043,6 +1045,27 @@ "node": ">= 12.20.55" } }, + "node_modules/electron-dl": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/electron-dl/-/electron-dl-3.5.1.tgz", + "integrity": "sha512-5Yb9s/iPVJ5mW5x3j6XkKxt7WEqREr/AhYxZmtEfW1ffQHs1+aGoiQ2fXCAU6UIXMnWog2MXK82vrxJsjA3nbQ==", + "dependencies": { + "ext-name": "^5.0.0", + "pupa": "^2.0.1", + "unused-filename": "^2.1.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/electron-download-manager": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/electron-download-manager/-/electron-download-manager-2.1.2.tgz", + "integrity": "sha512-9v8aeMVZTX69NjEveKlKfTlJY74twpKktTXrmDI+UcQHZg7FtwuqxWw0ZNrjtVAOBcVNKzwG4ekn44B+xhz1tg==" + }, "node_modules/electron-packager": { "version": "17.1.2", "resolved": "https://registry.npmjs.org/electron-packager/-/electron-packager-17.1.2.tgz", @@ -1255,6 +1278,14 @@ "dev": true, "optional": true }, + "node_modules/escape-goat": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", + "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", + "engines": { + "node": ">=8" + } + }, "node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -1278,6 +1309,29 @@ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-2.0.3.tgz", "integrity": "sha512-jLN68Dx5kyFHaePoXWPsCGW5qdyZQtLYHkxkg02/Mz6g0kYpDx4FyP6XfArhQdlOC4b8Mv+EMxPo/8La7Tzghg==" }, + "node_modules/ext-list": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/ext-list/-/ext-list-2.2.2.tgz", + "integrity": "sha512-u+SQgsubraE6zItfVA0tBuCBhfU9ogSRnsvygI7wht9TS510oLkBRXBsqopeUG/GBOIQyKZO9wjTqIu/sf5zFA==", + "dependencies": { + "mime-db": "^1.28.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ext-name": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ext-name/-/ext-name-5.0.0.tgz", + "integrity": "sha512-yblEwXAbGv1VQDmow7s38W77hzAgJAO50ztBLMcUyUBfxv1HC+LGwtiEN+Co6LtlqT/5uwVOxsD4TNIilWhwdQ==", + "dependencies": { + "ext-list": "^2.0.0", + "sort-keys-length": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", @@ -2145,6 +2199,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-potential-custom-element-name": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", @@ -2440,6 +2502,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/modify-filename": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/modify-filename/-/modify-filename-1.1.0.tgz", + "integrity": "sha512-EickqnKq3kVVaZisYuCxhtKbZjInCuwgwZWyAmRIp1NTMhri7r3380/uqwrUHfaDiPzLVTuoNy4whX66bxPVog==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -2947,6 +3017,17 @@ "node": ">=6" } }, + "node_modules/pupa": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", + "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", + "dependencies": { + "escape-goat": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/querystringify": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", @@ -3213,6 +3294,28 @@ "node": ">=8" } }, + "node_modules/sort-keys": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", + "integrity": "sha512-vzn8aSqKgytVik0iwdBEi+zevbTYZogewTUM6dtpmGwEcdzbub/TX4bCzRhebDCRC3QzXgJsLRKB2V/Oof7HXg==", + "dependencies": { + "is-plain-obj": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sort-keys-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sort-keys-length/-/sort-keys-length-1.0.1.tgz", + "integrity": "sha512-GRbEOUqCxemTAk/b32F2xa8wDTs+Z1QHOkbhJDQTvv/6G3ZkbJ+frYWsTcc7cBB3Fu4wy4XlLCuNtJuMn7Gsvw==", + "dependencies": { + "sort-keys": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/spdx-correct": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", @@ -3415,6 +3518,26 @@ "node": ">= 4.0.0" } }, + "node_modules/unused-filename": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/unused-filename/-/unused-filename-2.1.0.tgz", + "integrity": "sha512-BMiNwJbuWmqCpAM1FqxCTD7lXF97AvfQC8Kr/DIeA6VtvhJaMDupZ82+inbjl5yVP44PcxOuCSxye1QMS0wZyg==", + "dependencies": { + "modify-filename": "^1.1.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/unused-filename/node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "engines": { + "node": ">=8" + } + }, "node_modules/url-parse": { "version": "1.5.10", "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", diff --git a/package.json b/package.json index bc37070..9fa0ad9 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,8 @@ "cheerio": "^1.0.0-rc.12", "desandro-matches-selector": "^2.0.2", "dotenv": "^16.3.1", + "electron-dl": "^3.5.1", + "electron-download-manager": "^2.1.2", "ev-emitter": "^2.1.2", "fizzy-ui-utils": "^3.0.0", "formidable": "^3.5.1", diff --git a/savexml.js b/savexml.js index 99f5213..af79875 100644 --- a/savexml.js +++ b/savexml.js @@ -34,53 +34,90 @@ files.forEach((file) => { //////// //end the autosave -function saveXmlToFile(xmlData, filePath,reorder=false, xmlfilename) { - // console.log(xmlfilename); - // console.log(filePath); - // Check if the file path is provided - if (!filePath) { - console.error('File path is required.'); - return; - } + function saveXmlToFile(xmlData, filePath,reorder=false, xmlfilename, jsonData, jsonfilePath) { + // console.log(xmlData); + // console.log(filePath); + // Check if the file path is provided + if (!filePath) { + console.error('File path is required.'); + return; + } + + // Write the XML data to the specified file path + fs.writeFileSync(filePath, xmlData, 'utf8', (err) => { + console.log("fs write inside "); + alert("fs write inside") + if (err) { + console.error('Error writing XML file:', err); + } else { + console.log('XML file saved successfully.'); + + // Clear all data in local storage + localStorage.clear(); + + } + }); - // Write the XML data to the specified file path - fs.writeFileSync(filePath, xmlData, 'utf8', (err) => { - console.log("fs write inside "); - alert("fs write inside") - if (err) { - console.error('Error writing XML file:', err); - } else { - console.log('XML file saved successfully.'); + if(jsonData !== ""){ - // Clear all data in local storage - localStorage.clear(); + // Write the JSON data to the specified file path + fs.writeFileSync(jsonfilePath, jsonData, 'utf8', (err) => { + + if (err) { + console.error('Error writing XML file:', err); + } else { + console.log('JSON file saved successfully.'); + + localStorage.clear(); + + } + }); } - }); - localStorage.clear(); - if(reorder){ - window.location.reload(); - }else{ - window.location.href = 'addform.html?filename=' + xmlfilename; - // window.location.reload(); + - } + + localStorage.clear(); + if(reorder){ + window.location.reload(); + }else{ + window.location.href = 'addform.html?filename=' + xmlfilename; + // window.location.reload(); - } + } + + } function savexml(UserFilename,reorder=false) { console.log("reorder",reorder); // Get the XML string from localStorage var xmlString = localStorage.getItem("xml"); + var jsonString = localStorage.getItem("Correct_Answer_Json"); + console.log('save json : ', jsonString); + console.log('save xml : ', xmlString); + //check Encrypted or not var enc = ""; + var encJson = ""; if (isEncrypted === 'YES') { // Encrypt enc = encode(xmlString); + if(jsonString) + { + encJson = encode(jsonString); + } } else { enc = xmlString; + if(jsonString) + { + encJson = jsonString; + } + } + + console.log('save xml : ', enc); + //XmlPath get from .env const xmlPathenv=process.env.XML_FILE_PATH; const xmlPath = path.join(__dirname, xmlPathenv) @@ -89,20 +126,20 @@ function savexml(UserFilename,reorder=false) { // Create a filename using on the subtitle var xmlfilename = `${UserFilename}.xml`; - console.log('xmlfilename : ', xmlfilename) - // var jsonfilename = `${UserFilename}.json`; + var jsonfilename = `${UserFilename}_answer.json`; // file path where you want to save the XML file // const xmlfilePath = process.cwd() + `/${xmlPath}` + xmlfilename; const xmlfilePath = `${xmlPath}` + xmlfilename; + const jsonfilePath = `${xmlPath}` + jsonfilename; // const jsonfilePath = process.cwd() + '/xml/' + jsonfilename; if(reorder){ - saveXmlToFile(enc, xmlfilePath,reorder=true, xmlfilename); + saveXmlToFile(enc, xmlfilePath,reorder=true, xmlfilename, encJson, jsonfilePath); }else{ // Call the function to save the XML file - saveXmlToFile(enc, xmlfilePath, false, xmlfilename); + saveXmlToFile(enc, xmlfilePath, false, xmlfilename, encJson, jsonfilePath); } } diff --git a/style.css b/style.css index 5076511..0e86996 100644 --- a/style.css +++ b/style.css @@ -3712,6 +3712,10 @@ width:85px; .modal_form_button button:hover{ background: #bf303b; +} +.popup-save button:hover{ + background: #bf303b; + } ::-webkit-scrollbar-thumb { diff --git a/xml/.gitkeep b/xml/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/xml/Sample.xml b/xml/Sample.xml new file mode 100644 index 0000000..5e65272 --- /dev/null +++ b/xml/Sample.xml @@ -0,0 +1 @@ +<p><strong>Monthly Question Paper what </strong><span class="ql-cursor"></span></p><p>May Month Test Question Paper</p><p>Section c</p><p>Two Mark Question</p>2000true2<p>What is Laptop</p><p>Describe 20 words</p>1000truefalse<p>Who discover the laptop</p><p>pick one answer</p>1000falsefalsetrue8322d364-db1d-444d-bab0-dec8dd668375a<p>ch 1</p>false2b7a8bd3-db2b-4a97-bc78-59a77e72e0a7b<p>ch 1</p>false1a755857-3e4d-436a-a4f7-aaf29171e349c<p>ch 2</p>falseba1299c9-97e4-4d99-a183-e1f7b719bb96d\sqrt2true<p>s1 q1</p><p>Description</p>1000false1<p>Describe the Mobile Phone</p><p>Describe 20 words</p>1000falsefalse<p>1</p><p>pick one answer</p>1000falsefalsefalse7d15a61c-e4dc-47a5-93d1-41f00611814ca<p>ch 1</p>falsee777ddfe-d7b3-4563-8282-944f46716bffb<p>ch 2</p>falsefb957850-9d6b-4fed-8ad9-bfaf8261a7e8c<p>ch 3</p>false<p>s1 q2</p><p>Description</p>1000false2<p>1</p><p>Describe 20 words</p>500falsefalse<p>Who Discover the mouse</p><p>pick one answer</p>500falsefalsefalsea80ce15a-bed0-4543-ab0f-361f55ba5a27a<p>ch 1</p>falseb73e9ab0-5351-4e62-83a9-69a6a87ac3c2b<p>ch2</p>false4b798f3d-5004-49d1-b008-57fb607d3e68c<p>ch3</p>false0dc2a56e-0d28-4f2a-bfc2-18e105569c07d<p>ch4</p>false<p>s1 q3</p><p>Desciption</p>500false1<p>What is RAM</p><p>Describe 20 words</p>500falsefalse<p>Who Discover the RAM</p><p>pick one answer</p>500falsefalsefalse10d6607c-29a8-4885-ad12-f2118e12f1e7a<p>ch 1</p>falseb831ded1-3550-432a-b0bb-a180847a14b9b<p>ch 2</p>false32c91506-b8af-44f7-b548-97fd3c456cfbc<p>ch 3</p>false<p>s1 q4</p><p>description</p>500false2<p>solve it that is tje what is the werwerer</p>\sqrt{25}=?250falsetrue<p>solve it</p>\sqrt{25}=?250falsetruefalse213a3ffd-4680-456a-b459-8e0a5023838da5true98a2297b-08fe-416d-acb8-28794962d2e7b<p><br></p>false04ae1f66-8099-4fc9-b3f1-09c12a303646c<p><br></p>false89d8e74d-f3fb-4817-b756-aca13b52b41ed<p><br></p>false<p>1</p><p><br></p>250truefalse<p>1</p><p><br></p>1000truefalse<p>Section B</p><p>Description</p>20true<p>S2 Q1</p><p><br></p>2truefalse<p>S2 QG1 2</p><p>dfdasdfasd</p>16true<p>S2 QG1 Q2</p><p>sdgdfgdfgdfgsdgsddgsdgsddgsdgsddgfs</p>2truefalsetruea04d0e78-7892-4a49-9e45-363be6985aa3a<p>fhgfdgh</p>falsebe8a955e-dadd-44f0-9f59-a182fa7ebb8fb<p>fdghdfgh</p>false47bb7bb9-337e-4838-9fbf-1c8678ba3e22c<p>fghdgfghdgf</p>false61fec00a-4075-4807-88bc-be278a3c4992d<p>dfghdfghd</p>falsedb3f1ca5-083a-432d-8fae-f94d944e4989e<p>dfgdfgsdfg</p>false<p>S2 QG2 Q1</p><p>dsfgsdfgsdfgsdfg</p>2falsefalse<p>S2 QG2</p><p>dfgsdfgsdfgsdfg</p>12false<p>S2 QG2 Q1</p><p>fdgdsfgsdfgsdfgsdfgsdfg</p>2falsefalse<p>S2 QG2 Q2</p><p>fdgsdfgdsfgsdfg</p>2truefalsetrue0df34d5a-927a-4ecf-b22f-8acf66a2f979a<p>fsdgsdfgsdfgsdf</p>false03cbc474-aeea-4a81-9c97-ee14843f3e89b<p>sdfgsdfgsdfgsd</p>false038e0125-dab8-48e0-9e89-2b1417221b9bc<p>dfgdsfgdsf</p>falseeaba5d1a-a0c5-4d8e-827f-03fd094345d9d<p>fgsdfgdsfgsdfgdsfgdfgsdf</p>false<p>S2 QG3</p><p><br></p>8false<p>S2 QG3 Q1</p><p><br></p>2truefalse<p>S2 QG3 Q2</p><p><br></p>2truefalsetrue94c5fd0e-444f-4fca-a516-a6bb93b52602a<p><br></p>false<p>S2 QG4</p><p><br></p>4true<p>S2 QG4 Q1</p><p><br></p>2truefalse<p>S2 QG4 Q2</p><p>xfdgsdfgsdfgsdfgsdfgsdfgsdfgsdfgsd</p>2truefalsetrue30dbde59-a12e-4fb5-b0cf-2a0ef997ece6atrue1394d4bd-cd38-47a7-9e80-c4f26466cc78btrue43c3971a-9799-4698-8570-6048d4b79b67ctrue8410a092-c4e1-46da-8215-7bb8b3b50dacdtrue<p>S2 Q2</p><p><br></p>2truefalsetruefa186388-6f21-40dc-bf5c-e52910f560a1a<p><br></p>false<p>test</p><p><br></p>truefalse \ No newline at end of file diff --git a/xml2json.js b/xml2json.js index e8a7d6a..fd07522 100644 --- a/xml2json.js +++ b/xml2json.js @@ -1,9 +1,11 @@ - function xml2json(xmlData) { // console.clear(); // console.log('xml to json converstion'); // console.log(xmlData); +var jsonDecodeData = localStorage.getItem('json_Decode_Data_For_Mcq_Crt_Ans'); +// console.log(jsonDecodeData); + function getAttributesOfXMLNode(node) { // Get attributes of the node (if any) @@ -45,6 +47,7 @@ function getQuestionsNodes(questionNode,type) questionObj['display_marks'] = questionNode.childNodes[3].firstChild.nodeValue; questionObj['is_math_enabled'] = questionNode.childNodes[4].firstChild.nodeValue; questionObj['answers'] = []; + questionObj['correct_answer'] = []; var choiceList = questionNode.childNodes[6].childNodes; @@ -61,6 +64,36 @@ function getQuestionsNodes(questionNode,type) questionObj['answers'].push(tempChoiceobj); } } + if(jsonDecodeData !== null) + { + var jsonParsedData = JSON.parse(jsonDecodeData); + + // console.log('jsonParsedData : ', jsonParsedData) + + // Iterate over each question + for (const question of jsonParsedData.questions) { + + const questionId = question.questionId; + const answers = question.answers; + + console.log(typeof answers) + + // console.log(`Question ID: ${questionId}`); + + if(answers !== undefined) { + // console.log(`Not Undifined Answer`); + for (const answer of answers) { + + // console.log(` Answer ID: ${answer}`); + + if(questionId == questionObj['attributes']['Id']) { + questionObj['correct_answer'].push(answer); + } + } + } + } + // console.log('jsonDecodeData.length', jsonDecodeData); + } } return questionObj; @@ -165,10 +198,12 @@ jsonObj['sections'] = []; var jsonData = JSON.stringify(jsonObj); // console.log('Xml to Json Conversion '); - // console.log(jsonData); + console.log('jsonData : ', jsonData); // console.log(jsonObj); jsonToHtml(jsonObj); // console.log(jsonToHtml(jsonObj)) + localStorage.removeItem('json_Decode_Data_For_Mcq_Crt_Ans'); + }