Skip to content

Commit 97f1242

Browse files
authored
Add files via upload
1 parent d326cf5 commit 97f1242

7 files changed

+1175
-0
lines changed

Test Mode Certificate.pdf

11.5 KB
Binary file not shown.

filesaver.js

+188
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
(function (global, factory) {
2+
if (typeof define === "function" && define.amd) {
3+
define([], factory);
4+
} else if (typeof exports !== "undefined") {
5+
factory();
6+
} else {
7+
var mod = {
8+
exports: {}
9+
};
10+
factory();
11+
global.FileSaver = mod.exports;
12+
}
13+
})(this, function () {
14+
"use strict";
15+
16+
/*
17+
* FileSaver.js
18+
* A saveAs() FileSaver implementation.
19+
*
20+
* By Eli Grey, http://eligrey.com
21+
*
22+
* License : https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md (MIT)
23+
* source : http://purl.eligrey.com/github/FileSaver.js
24+
*/
25+
// The one and only way of getting global scope in all environments
26+
// https://stackoverflow.com/q/3277182/1008999
27+
var _global = typeof window === 'object' && window.window === window ? window : typeof self === 'object' && self.self === self ? self : typeof global === 'object' && global.global === global ? global : void 0;
28+
29+
function bom(blob, opts) {
30+
if (typeof opts === 'undefined') opts = {
31+
autoBom: false
32+
};else if (typeof opts !== 'object') {
33+
console.warn('Deprecated: Expected third argument to be a object');
34+
opts = {
35+
autoBom: !opts
36+
};
37+
} // prepend BOM for UTF-8 XML and text/* types (including HTML)
38+
// note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF
39+
40+
if (opts.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
41+
return new Blob([String.fromCharCode(0xFEFF), blob], {
42+
type: blob.type
43+
});
44+
}
45+
46+
return blob;
47+
}
48+
49+
function download(url, name, opts) {
50+
var xhr = new XMLHttpRequest();
51+
xhr.open('GET', url);
52+
xhr.responseType = 'blob';
53+
54+
xhr.onload = function () {
55+
saveAs(xhr.response, name, opts);
56+
};
57+
58+
xhr.onerror = function () {
59+
console.error('could not download file');
60+
};
61+
62+
xhr.send();
63+
}
64+
65+
function corsEnabled(url) {
66+
var xhr = new XMLHttpRequest(); // use sync to avoid popup blocker
67+
68+
xhr.open('HEAD', url, false);
69+
70+
try {
71+
xhr.send();
72+
} catch (e) {}
73+
74+
return xhr.status >= 200 && xhr.status <= 299;
75+
} // `a.click()` doesn't work for all browsers (#465)
76+
77+
78+
function click(node) {
79+
try {
80+
node.dispatchEvent(new MouseEvent('click'));
81+
} catch (e) {
82+
var evt = document.createEvent('MouseEvents');
83+
evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null);
84+
node.dispatchEvent(evt);
85+
}
86+
} // Detect WebView inside a native macOS app by ruling out all browsers
87+
// We just need to check for 'Safari' because all other browsers (besides Firefox) include that too
88+
// https://www.whatismybrowser.com/guides/the-latest-user-agent/macos
89+
90+
91+
var isMacOSWebView = /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent);
92+
var saveAs = _global.saveAs || ( // probably in some web worker
93+
typeof window !== 'object' || window !== _global ? function saveAs() {}
94+
/* noop */
95+
// Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView
96+
: 'download' in HTMLAnchorElement.prototype && !isMacOSWebView ? function saveAs(blob, name, opts) {
97+
var URL = _global.URL || _global.webkitURL;
98+
var a = document.createElement('a');
99+
name = name || blob.name || 'download';
100+
a.download = name;
101+
a.rel = 'noopener'; // tabnabbing
102+
// TODO: detect chrome extensions & packaged apps
103+
// a.target = '_blank'
104+
105+
if (typeof blob === 'string') {
106+
// Support regular links
107+
a.href = blob;
108+
109+
if (a.origin !== location.origin) {
110+
corsEnabled(a.href) ? download(blob, name, opts) : click(a, a.target = '_blank');
111+
} else {
112+
click(a);
113+
}
114+
} else {
115+
// Support blobs
116+
a.href = URL.createObjectURL(blob);
117+
setTimeout(function () {
118+
URL.revokeObjectURL(a.href);
119+
}, 4E4); // 40s
120+
121+
setTimeout(function () {
122+
click(a);
123+
}, 0);
124+
}
125+
} // Use msSaveOrOpenBlob as a second approach
126+
: 'msSaveOrOpenBlob' in navigator ? function saveAs(blob, name, opts) {
127+
name = name || blob.name || 'download';
128+
129+
if (typeof blob === 'string') {
130+
if (corsEnabled(blob)) {
131+
download(blob, name, opts);
132+
} else {
133+
var a = document.createElement('a');
134+
a.href = blob;
135+
a.target = '_blank';
136+
setTimeout(function () {
137+
click(a);
138+
});
139+
}
140+
} else {
141+
navigator.msSaveOrOpenBlob(bom(blob, opts), name);
142+
}
143+
} // Fallback to using FileReader and a popup
144+
: function saveAs(blob, name, opts, popup) {
145+
// Open a popup immediately do go around popup blocker
146+
// Mostly only available on user interaction and the fileReader is async so...
147+
popup = popup || open('', '_blank');
148+
149+
if (popup) {
150+
popup.document.title = popup.document.body.innerText = 'downloading...';
151+
}
152+
153+
if (typeof blob === 'string') return download(blob, name, opts);
154+
var force = blob.type === 'application/octet-stream';
155+
156+
var isSafari = /constructor/i.test(_global.HTMLElement) || _global.safari;
157+
158+
var isChromeIOS = /CriOS\/[\d]+/.test(navigator.userAgent);
159+
160+
if ((isChromeIOS || force && isSafari || isMacOSWebView) && typeof FileReader !== 'undefined') {
161+
// Safari doesn't allow downloading of blob URLs
162+
var reader = new FileReader();
163+
164+
reader.onloadend = function () {
165+
var url = reader.result;
166+
url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, 'data:attachment/file;');
167+
if (popup) popup.location.href = url;else location = url;
168+
popup = null; // reverse-tabnabbing #460
169+
};
170+
171+
reader.readAsDataURL(blob);
172+
} else {
173+
var URL = _global.URL || _global.webkitURL;
174+
var url = URL.createObjectURL(blob);
175+
if (popup) popup.location = url;else location.href = url;
176+
popup = null; // reverse-tabnabbing #460
177+
178+
setTimeout(function () {
179+
URL.revokeObjectURL(url);
180+
}, 4E4); // 40s
181+
}
182+
});
183+
_global.saveAs = saveAs.saveAs = saveAs;
184+
185+
if (typeof module !== 'undefined') {
186+
module.exports = saveAs;
187+
}
188+
});

index.html

+183
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
8+
<meta name="theme-color" content="#343A40">
9+
<meta name="msapplication-navbutton-color" content="#343A40">
10+
<meta name="apple-mobile-web-app-status-bar-style" content="#343A40">
11+
<meta name="description" content="TestMode is where you can test your skills and get certified.">
12+
<meta name="keywords" content="test, skill test, coding, programming, c++, cpp, html, css, js, javascript, certificate, leaderboard">
13+
<meta name="author" content="Ahmed Saber, ahmed0saber, [email protected]">
14+
<meta name="og:title" content="Test Mode">
15+
<meta name="og:description" content="TestMode is where you can test your skills and get certified.">
16+
17+
<meta property="og:image" content="https://drive.google.com/u/0/uc?id=1-wybmU-q4tljQ3bJAtcHE_Lst_PNdWYx&export=download">
18+
<link rel="icon" href="https://drive.google.com/u/0/uc?id=1-wybmU-q4tljQ3bJAtcHE_Lst_PNdWYx&export=download" type="image/x-icon">
19+
20+
<title>Test Mode</title>
21+
<link rel="preconnect" href="https://fonts.googleapis.com">
22+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
23+
<link href="https://fonts.googleapis.com/css2?family=Bree+Serif&display=swap" rel="stylesheet">
24+
<link rel="stylesheet" href="./style.css">
25+
</head>
26+
<body>
27+
<main>
28+
<section class="pages" id="cover"></section>
29+
30+
<section class="pages" id="home">
31+
<div class="test">
32+
<div class="btns">
33+
<h1>Test Mode</h1>
34+
<span class="copyright">By <a style="color: #007BFF" href="https://github.com/ahmed0saber" target="_blank">ahmed0saber</a></span>
35+
</div>
36+
<p>TestMode is where you can test your skills and get certified.</p>
37+
</div>
38+
39+
<div class="test">
40+
<div class="btns">
41+
<h2>C++ Test</h2>
42+
<span>33 Questions</span>
43+
</div>
44+
<p>This test covers Data Types, Variables, Console Output, User Input, Comments, Operators, Conditional Statements, Loops, Arrays and Functions.</p>
45+
<p>If you are not ready, check <a style="color: #28A745" href="https://www.w3schools.com/cpp/default.asp" target="_blank">w3schools</a> or <a style="color: #007BFF" href="https://www.programiz.com/cpp-programming" target="_blank">programiz</a> for some tutorials.</p>
46+
<div class="btns">
47+
<a class="startBtn" onclick="toTest(0)">Start the Test</a>
48+
<a class="startBtn" onclick="toLeaderboard(0)"><i class="fa fa-award"></i></a>
49+
</div>
50+
</div>
51+
52+
<div class="test">
53+
<div class="btns">
54+
<h2>HTML Test</h2>
55+
<span>2 Questions</span>
56+
</div>
57+
<p>This test covers Attributes.</p>
58+
<p>If you are not ready, check <a style="color: #28A745" href="https://www.w3schools.com/html/default.asp" target="_blank">w3schools</a> for some tutorials.</p>
59+
<div class="btns">
60+
<a class="startBtn" onclick="toTest(1)">Start the Test</a>
61+
<a class="startBtn" onclick="toLeaderboard(1)"><i class="fa fa-award"></i></a>
62+
</div>
63+
</div>
64+
65+
<div class="test">
66+
<div class="btns">
67+
<h2>CSS Test</h2>
68+
<span>2 Questions</span>
69+
</div>
70+
<p>This test covers Selectors.</p>
71+
<p>If you are not ready, check <a style="color: #28A745" href="https://www.w3schools.com/css/default.asp" target="_blank">w3schools</a> for some tutorials.</p>
72+
<div class="btns">
73+
<a class="startBtn" onclick="toTest(2)">Start the Test</a>
74+
<a class="startBtn" onclick="toLeaderboard(2)"><i class="fa fa-award"></i></a>
75+
</div>
76+
</div>
77+
78+
<div class="test">
79+
<div class="btns">
80+
<h2>JavaScript Test</h2>
81+
<span>1 Questions</span>
82+
</div>
83+
<p>This test covers Variables.</p>
84+
<p>If you are not ready, check <a style="color: #28A745" href="https://www.w3schools.com/css/default.asp" target="_blank">w3schools</a> for some tutorials.</p>
85+
<div class="btns">
86+
<a class="startBtn" onclick="toTest(3)">Start the Test</a>
87+
<a class="startBtn" onclick="toLeaderboard(3)"><i class="fa fa-award"></i></a>
88+
</div>
89+
</div>
90+
</section>
91+
92+
<section class="pages" id="test">
93+
<div class="info">
94+
<p>Question number <span id="num">1</span> out of <span id="numOfQ">20</span></p>
95+
<div class="row">
96+
<p id="score">Score : 0</p>
97+
<span id="timer">60</span>
98+
</div>
99+
</div>
100+
<div>
101+
<p id="question">What is your name ?!</p>
102+
<pre id="code"></pre>
103+
<p class="answer-container">
104+
<label>
105+
<input name="ans" type="radio" class="answer" id="answer0"/>
106+
<span for="answer0" id="choice1">Ahmed</span>
107+
</label>
108+
</p>
109+
<p class="answer-container">
110+
<label>
111+
<input name="ans" type="radio" class="answer" id="answer1"/>
112+
<span for="answer1" id="choice2">Ahmed</span>
113+
</label>
114+
</p>
115+
<p class="answer-container">
116+
<label>
117+
<input name="ans" type="radio" class="answer" id="answer2"/>
118+
<span for="answer2" id="choice3">Ahmed</span>
119+
</label>
120+
</p>
121+
<p class="answer-container">
122+
<label>
123+
<input name="ans" type="radio" class="answer" id="answer3"/>
124+
<span for="answer3" id="choice4">Ahmed</span>
125+
</label>
126+
</p>
127+
<button onclick="checkAnswer()">Check</button>
128+
<div class="btns">
129+
<button onclick="backQuestion()">Back</button>
130+
<button onclick="nextQuestion()">Next</button>
131+
</div>
132+
</div>
133+
</section>
134+
135+
<section class="pages" id="certificate">
136+
<h2>Congratulations! You have successfully passed the test..</h2>
137+
<p>Enter your full name to get your certificate.</p>
138+
<input type="text" id="name" placeholder="Ex: Ahmed Saber Fathy" autocomplete="off" required/>
139+
<button id="submitBtn">Get Certificate</button>
140+
<a class="backBtn" href="./#home">Back To Home</a>
141+
</section>
142+
143+
<section class="pages" id="fail">
144+
<h2>Unfortunately, You haven't passed the test..</h2>
145+
<a class="backBtn" href="./#home">Back To Home</a>
146+
</section>
147+
148+
<section class="pages" id="leaderboard">
149+
<div class="row">
150+
<h2>Top Users</h2>
151+
<a class="backBtn" href="./#home">Back To Home</a>
152+
</div>
153+
<div class="user">
154+
<span>1</span>
155+
<span>Ahmed Saber</span>
156+
<span>165</span>
157+
</div>
158+
<div class="user">
159+
<span>2</span>
160+
<span>Ahmed 2</span>
161+
<span>160</span>
162+
</div>
163+
<div class="user">
164+
<span>3</span>
165+
<span>Ahmed 5</span>
166+
<span>155</span>
167+
</div>
168+
<div class="user">
169+
<span>4</span>
170+
<span>Ahmed Saber Fathy Hassan Mohammed Ali</span>
171+
<span>150</span>
172+
</div>
173+
</section>
174+
</main>
175+
</body>
176+
<script src="https://unpkg.com/pdf-lib/dist/pdf-lib.min.js"></script>
177+
<script src="https://unpkg.com/@pdf-lib/[email protected]"></script>
178+
<script src="filesaver.js"></script>
179+
<script src="index.js"></script>
180+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.all.min.js"></script>
181+
<script src="./script.js"></script>
182+
<script src="https://kit.fontawesome.com/282bcf757e.js" crossorigin="anonymous"></script>
183+
</html>

0 commit comments

Comments
 (0)