AUTO-SAVE-WHEN-ONLINE SET-CLOSE-TIME-ENV : AADHAVAN
This commit is contained in:
parent
43a57aaa3d
commit
5bbceb5ed1
@ -40,8 +40,10 @@
|
||||
<link rel="stylesheet" href="assets/css/responsive.css" type="text/css" media="all" />
|
||||
<!-- modernizr js -->
|
||||
<script src="assets/js/vendor/modernizr-3.5.0.min.js"></script>
|
||||
<link href='https://fonts.googleapis.com/css?family=Titillium+Web:400,600' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css">
|
||||
<link rel="stylesheet" href="./assets/css/titillium.css" type="text/css">
|
||||
<!-- <link href='https://fonts.googleapis.com/css?family=Titillium+Web:400,600' rel='stylesheet' type='text/css'> -->
|
||||
<link rel="stylesheet" href="./node_modules/bootstrap-icons/font/bootstrap-icons.css">
|
||||
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css"> -->
|
||||
|
||||
|
||||
|
||||
|
||||
28
addform.html
28
addform.html
@ -542,6 +542,7 @@
|
||||
|
||||
<!-- nave pane -->
|
||||
<script src="nav_pane.js"></script>
|
||||
<script src="main.js"></script>
|
||||
<script>
|
||||
var sidebarWrapper = document.getElementById("questionPaper");
|
||||
|
||||
@ -551,6 +552,22 @@
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
const { ipcRenderer } = require('electron');
|
||||
ipcRenderer.on('button-click', async () => {
|
||||
const saveButton = document.getElementById('SaveButton');
|
||||
|
||||
if (saveButton) {
|
||||
saveButton.click();
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
const swalButton = document.querySelector('.swal2-confirm.swal2-styled');
|
||||
if (swalButton) {
|
||||
swalButton.click();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
<script>
|
||||
|
||||
const url = new URL(window.location.href);// Get the URL of the current page for JSON
|
||||
@ -568,9 +585,6 @@ $(document).ready(function() {
|
||||
const isEncrypted = process.env.ENCRYPTED;
|
||||
// console.log(isEncrypted);
|
||||
|
||||
require('dotenv').config();
|
||||
const isEncrypted = process.env.ENCRYPTED;
|
||||
|
||||
$('.ql-toolbar').hide(); // Hide the Quill Text Editor if PAge load
|
||||
|
||||
if(FileName == "" || FileName == null ) {
|
||||
@ -599,9 +613,6 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
const scrollToTopBtn = document.getElementById('SaveButton');
|
||||
const scrollToTopBtn2 = document.getElementById('SaveButton2');
|
||||
|
||||
// require('dotenv').config();
|
||||
// const isEncrypted = process.env.ENCRYPTED;
|
||||
|
||||
// Function to keep the cursor at its current position
|
||||
function keepCursorAtPosition(event) {
|
||||
event.preventDefault(); // Prevent the default button click behavior
|
||||
@ -629,7 +640,7 @@ function loadXML(xmlFileName) {
|
||||
if (isEncrypted === 'YES') {
|
||||
// decrypt function call go to decode.js
|
||||
decodeData = decode(data);
|
||||
} else {
|
||||
} else{
|
||||
decodeData = data;
|
||||
}
|
||||
resolve(decodeData)
|
||||
@ -644,8 +655,9 @@ function loadXML(xmlFileName) {
|
||||
|
||||
// Function for Save the XML File
|
||||
function saveFile() {
|
||||
|
||||
console.log("html2json");
|
||||
html2json();
|
||||
console.log("json2xml");
|
||||
json2xml();
|
||||
|
||||
if(FileName == "" || FileName == null ){
|
||||
|
||||
32
assets/css/titillium.css
Normal file
32
assets/css/titillium.css
Normal file
@ -0,0 +1,32 @@
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Titillium Web';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(https://fonts.gstatic.com/s/titilliumweb/v17/NaPecZTIAOhVxoMyOr9n_E7fdM3mDbRS.woff2) format('woff2');
|
||||
unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Titillium Web';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(https://fonts.gstatic.com/s/titilliumweb/v17/NaPecZTIAOhVxoMyOr9n_E7fdMPmDQ.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Titillium Web';
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
src: url(https://fonts.gstatic.com/s/titilliumweb/v17/NaPDcZTIAOhVxoMyOr9n_E7ffBzCGIVzY4SY.woff2) format('woff2');
|
||||
unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Titillium Web';
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
src: url(https://fonts.gstatic.com/s/titilliumweb/v17/NaPDcZTIAOhVxoMyOr9n_E7ffBzCGItzYw.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
@ -40,8 +40,10 @@
|
||||
<link rel="stylesheet" href="assets/css/responsive.css" type="text/css" media="all" />
|
||||
<!-- modernizr js -->
|
||||
<script src="assets/js/vendor/modernizr-3.5.0.min.js"></script>
|
||||
<link href='https://fonts.googleapis.com/css?family=Titillium+Web:400,600' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css">
|
||||
<link rel="stylesheet" href="./assets/css/titillium.css" type="text/css">
|
||||
<!-- <link href='https://fonts.googleapis.com/css?family=Titillium+Web:400,600' rel='stylesheet' type='text/css'> -->
|
||||
<link rel="stylesheet" href="./node_modules/bootstrap-icons/font/bootstrap-icons.css">
|
||||
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css"> -->
|
||||
|
||||
|
||||
|
||||
|
||||
14
main.js
14
main.js
@ -10,6 +10,7 @@ const saveFile = require('./savexml')
|
||||
require('dotenv').config()
|
||||
|
||||
const auto_close= process.env.DISABLE_AUTO_CLOSE;
|
||||
const auto_close_time = parseInt(process.env.AUTO_CLOSE_TIME) * 1000;
|
||||
|
||||
let mainWindow;
|
||||
|
||||
@ -29,7 +30,7 @@ async function createWindow() {
|
||||
mainWindow = null;
|
||||
});
|
||||
|
||||
// setInterval(checkInternetConnection, 5000);
|
||||
setInterval(checkInternetConnection, 5000);
|
||||
}
|
||||
|
||||
async function checkInternetConnection() {
|
||||
@ -38,24 +39,23 @@ async function checkInternetConnection() {
|
||||
if (response.ok && onlineStatus) {
|
||||
onlineStatus = false;
|
||||
|
||||
// mainWindow.webContents.send('online');
|
||||
|
||||
|
||||
if (auto_close === 'TRUE') {
|
||||
|
||||
}else{
|
||||
dialog.showMessageBox(mainWindow, {
|
||||
type: 'info',
|
||||
message: 'Internet is available. Click OK to close the app. Otherwise app will auto close in 10 seconds',
|
||||
message: `Internet is available. Click OK to close the app. Otherwise app will auto close in ${auto_close_time/1000} Seconds`,
|
||||
buttons: ['OK'],
|
||||
});
|
||||
//Send the tigger to AutoSave the question Paper when System come's online
|
||||
mainWindow.webContents.send('button-click');
|
||||
|
||||
setTimeout(() => {
|
||||
app.quit();
|
||||
}, 10000);
|
||||
}, auto_close_time);
|
||||
}
|
||||
} else if (!response.ok && !onlineStatus) {
|
||||
onlineStatus = true;
|
||||
// mainWindow.webContents.send('offline');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error checking internet connection');
|
||||
|
||||
16
package-lock.json
generated
16
package-lock.json
generated
@ -9,6 +9,7 @@
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bootstrap-icons": "^1.11.1",
|
||||
"cheerio": "^1.0.0-rc.12",
|
||||
"desandro-matches-selector": "^2.0.2",
|
||||
"dotenv": "^16.3.1",
|
||||
@ -208,6 +209,21 @@
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/bootstrap-icons": {
|
||||
"version": "1.11.1",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap-icons/-/bootstrap-icons-1.11.1.tgz",
|
||||
"integrity": "sha512-F0DDp7nKUX+x/QtpfRZ+XHFya60ng9nfdpdS59vDDfs4Uhuxp7zym/QavMsu/xx51txkoM9eVmpE7D08N35blw==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/twbs"
|
||||
},
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/bootstrap"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/buffer-crc32": {
|
||||
"version": "0.2.13",
|
||||
"resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
"electron": "^26.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"bootstrap-icons": "^1.11.1",
|
||||
"cheerio": "^1.0.0-rc.12",
|
||||
"desandro-matches-selector": "^2.0.2",
|
||||
"dotenv": "^16.3.1",
|
||||
|
||||
1
xml2/Check-Auto-Save-1n.xml
Normal file
1
xml2/Check-Auto-Save-1n.xml
Normal file
@ -0,0 +1 @@
|
||||
Ond5CUhtmItDkbsWB7/g6A==jIi6QXH7u9VEH8T0CFJ4FgC5cFXCL7WP5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