Skip to content

Commit 177820b

Browse files
authored
Merge pull request #104 from arielfayol37/polishing
added loading page beforeUnload()
2 parents 8a8fc87 + 82d01c8 commit 177820b

File tree

5 files changed

+29
-15
lines changed

5 files changed

+29
-15
lines changed

README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,6 @@ Web platform for Physics Assigments System.
33

44
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).
55

6-
### Distinctiveness and Complexity
7-
"It’s different from the other projects and it was complex to build." Haha
8-
9-
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;
10-
a semantic search engine; etc etc
11-
12-
### Files
13-
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
14-
15-
## PreRequisites
16-
Having Python installed on your machine and your PATH environment variable having a path to your Python's Scripts folder.
17-
186
## Installation
197

208
1. Clone the repository:

astros/templates/astros/layout.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@
7272
var loader = document.querySelector('#preloader');
7373
window.addEventListener('load', ()=>{
7474
loader.classList.add('hide');
75-
})
75+
});
76+
document.querySelectorAll('a').forEach(function(link) {
77+
link.addEventListener('click', function(e) {
78+
// Your logic here
79+
loader.classList.remove('hide');
80+
});
81+
});
7682
</script>
7783
</html>

deimos/templates/deimos/layout.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@
6161
var loader = document.querySelector('#preloader');
6262
window.addEventListener('load', ()=>{
6363
loader.classList.add('hide');
64-
})
64+
});
65+
document.querySelectorAll('a').forEach(function(link) {
66+
link.addEventListener('click', function(e) {
67+
// Your logic here
68+
loader.classList.remove('hide');
69+
});
70+
});
6571
</script>
6672
</html>

phobos/static/phobos/js/create_question.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11

22
document.addEventListener('DOMContentLoaded', () => {
33
const preloader = document.querySelector('#preloader');
4+
5+
window.addEventListener('beforeunload', function (event) {
6+
// Your logic here
7+
preloader.classList.remove('hide');
8+
event.returnValue = true; // Chrome requires returnValue to be set
9+
});
10+
411
const form = document.querySelector('#question-form');
512
const allQuestionBlocks = form.querySelector("#all-question-blocks");
613
let currentAction = form.getAttribute('action');

phobos/templates/phobos/layout.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@
6666
var loader = document.querySelector('#preloader');
6767
window.addEventListener('load', ()=>{
6868
loader.classList.add('hide');
69-
})
69+
});
70+
document.querySelectorAll('a').forEach(function(link) {
71+
link.addEventListener('click', function(e) {
72+
// Your logic here
73+
loader.classList.remove('hide');
74+
});
75+
});
76+
7077
</script>
7178
</html>

0 commit comments

Comments
 (0)