Skip to content

Commit

Permalink
added loading page beforeUnload()
Browse files Browse the repository at this point in the history
  • Loading branch information
arielfayol37 committed Nov 23, 2023
1 parent 3f0d1df commit 82d01c8
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 15 deletions.
12 changes: 0 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@ Web platform for Physics Assigments System.

This is the README file for the Dr_R web application built using Django. The application is designed to provide different functionalities for students (Deimos), instructors (Phobos), and general users (Astros).

### Distinctiveness and Complexity
"It’s different from the other projects and it was complex to build." Haha

Jokes aside, it is a *physics* learning management system which differs a lot from other projects because of functionalities like comparing algebraic expressions and units; dynamic question creation page which acts as a GUI compiler that has to test various user input and take care of different formats like floats, multiple choice questions, latex equation, variables etc;
a semantic search engine; etc etc

### Files
One of the submission requirements was to explain what is in every file I created but this project is relatively huge compared to previous projects, so I created a separate md file for essential documentation. Filename: documentation.md

## PreRequisites
Having Python installed on your machine and your PATH environment variable having a path to your Python's Scripts folder.

## Installation

1. Clone the repository:
Expand Down
8 changes: 7 additions & 1 deletion astros/templates/astros/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@
var loader = document.querySelector('#preloader');
window.addEventListener('load', ()=>{
loader.classList.add('hide');
})
});
document.querySelectorAll('a').forEach(function(link) {
link.addEventListener('click', function(e) {
// Your logic here
loader.classList.remove('hide');
});
});
</script>
</html>
8 changes: 7 additions & 1 deletion deimos/templates/deimos/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@
var loader = document.querySelector('#preloader');
window.addEventListener('load', ()=>{
loader.classList.add('hide');
})
});
document.querySelectorAll('a').forEach(function(link) {
link.addEventListener('click', function(e) {
// Your logic here
loader.classList.remove('hide');
});
});
</script>
</html>
7 changes: 7 additions & 0 deletions phobos/static/phobos/js/create_question.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@

document.addEventListener('DOMContentLoaded', () => {
const preloader = document.querySelector('#preloader');

window.addEventListener('beforeunload', function (event) {
// Your logic here
preloader.classList.remove('hide');
event.returnValue = true; // Chrome requires returnValue to be set
});

const form = document.querySelector('#question-form');
const allQuestionBlocks = form.querySelector("#all-question-blocks");
let currentAction = form.getAttribute('action');
Expand Down
9 changes: 8 additions & 1 deletion phobos/templates/phobos/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@
var loader = document.querySelector('#preloader');
window.addEventListener('load', ()=>{
loader.classList.add('hide');
})
});
document.querySelectorAll('a').forEach(function(link) {
link.addEventListener('click', function(e) {
// Your logic here
loader.classList.remove('hide');
});
});

</script>
</html>

0 comments on commit 82d01c8

Please sign in to comment.