Dump from SVN
This commit is contained in:
parent
f96d5a49e9
commit
c8973cda7e
17
engine/database.sql
Normal file
17
engine/database.sql
Normal file
@ -0,0 +1,17 @@
|
||||
CREATE TABLE `tests`(
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`name` varchar(65) NOT NULL default '',
|
||||
`description` text NOT NULL default '',
|
||||
`quiz` text NOT NULL default '',
|
||||
`tag` varchar(65) NOT NULL default '',
|
||||
`allowed` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE `results`(
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`submitter` varchar(65) NOT NULL default '',
|
||||
`time` timestamp NOT NULL default current_timestamp,
|
||||
`answered` text NOT NULL default '',
|
||||
PRIMARY KEY (`id`)
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
100
engine/engine.php
Normal file
100
engine/engine.php
Normal file
@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
* /engine/engine.php
|
||||
* @version 1.2
|
||||
* @desc PHP server side engine to serve commonly accessable tests, collect submitted results
|
||||
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
* License:
|
||||
sQuiz for creating small jQuery based quizs in an implementable way
|
||||
Copyright (C) 2017 Fándly Gergő Zoltán
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
**/
|
||||
|
||||
//config
|
||||
$sql_user="squiz";
|
||||
$sql_passwd="squizuserforgood";
|
||||
$sql_db="squiz";
|
||||
$quiz_tag=0;
|
||||
|
||||
$db=new PDO("mysql:host=localhost;dbname=".$sql_db.";charset=utf8", $sql_user, $sql_passwd);
|
||||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
if(isset($_GET['list'])){
|
||||
if($quiz_tag!=0){
|
||||
$sql=$db->prepare("SELECT id, name, description FROM tests WHERE allowed=1 and tag=:tag");
|
||||
$sql->execute(array(":tag"=>$quiz_tag));
|
||||
}
|
||||
else{
|
||||
$sql=$db->prepare("SELECT id, name, description FROM tests WHERE allowed=1");
|
||||
$sql->execute();
|
||||
}
|
||||
|
||||
$obj=array();
|
||||
while($row=$sql->fetch(PDO::FETCH_ASSOC)){
|
||||
array_push($obj, array("name"=>$row['name'], "description"=>$row['description'], "file"=>"//".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']."?getQuiz=".$row['id']));
|
||||
}
|
||||
|
||||
header("Content-type: text/json; charset=UTF-8");
|
||||
echo json_encode($obj);
|
||||
die();
|
||||
}
|
||||
|
||||
if(isset($_GET['getQuiz'])){
|
||||
$sql=$db->prepare("SELECT quiz FROM tests WHERE id=:id");
|
||||
$sql->execute(array(":id"=>$_GET['getQuiz']));
|
||||
$res=$sql->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
header("Content-type: text/json; charset=UTF-8");
|
||||
echo $res['quiz'];
|
||||
die();
|
||||
}
|
||||
|
||||
if(isset($_POST['submitResult']) && isset($_POST['submitResult_submitter'])){
|
||||
$sql=$db->prepare("INSERT INTO results (submitter, answered) VALUES (:submitter, :answered)");
|
||||
$sql->execute(array(":submitter"=>$_POST['submitResult_submitter'], ":answered"=>$_POST['submitResult']));
|
||||
$id=$db->lastInsertId();
|
||||
|
||||
echo $id;
|
||||
die();
|
||||
}
|
||||
|
||||
if(isset($_GET['getResult'])){
|
||||
$sql=$db->prepare("SELECT COUNT(id) AS count, submitter, time, answered FROM results WHERE id=:id");
|
||||
$sql->execute(array(":id"=>$_GET['getResult']));
|
||||
$res=$sql->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if($res['count']<1){
|
||||
echo "not found";
|
||||
}
|
||||
else{
|
||||
$obj=array("submitter"=>$res['submitter'], "time"=>$res['time'], "answered"=>$res['answered']);
|
||||
|
||||
header("Content-type: text/json; charset=UTF-8");
|
||||
echo json_encode($obj);
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST['submitQuiz']) && isset($_POST['submitQuiz_tag']) && isset($_POST['submitQuiz_name']) && isset($_POST['submitQuiz_description'])){
|
||||
$sql=$db->prepare("INSERT INTO tests (name, description, quiz, tag) VALUES (:name, :desc, :quiz, :tag)");
|
||||
$sql->execute(array(":name"=>$_POST['submitQuiz_name'], ":desc"=>$_POST['submitQuiz_description'], ":quiz"=>$_POST['submitQuiz'], ":tag"=>$_POST['submitQuiz_tag']));
|
||||
$id=$db->lastInsertId();
|
||||
|
||||
$link="https://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']."?getQuiz=".$id;
|
||||
|
||||
echo $link;
|
||||
die();
|
||||
}
|
87
index.html
Normal file
87
index.html
Normal file
@ -0,0 +1,87 @@
|
||||
<!--
|
||||
/**
|
||||
* /index.html
|
||||
* @version 1.4
|
||||
* @desc Main index file
|
||||
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
* License:
|
||||
sQuiz for creating small jQuery based quizs in an implementable way
|
||||
Copyright (C) 2017 Fándly Gergő Zoltán
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
**/
|
||||
-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{{title}}</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="description" content="{{description}}">
|
||||
<!-- stylesheet -->
|
||||
<link rel="stylesheet" href="./style/style.css">
|
||||
<link rel="icon" href="./res/icon.png">
|
||||
<!-- jquery -->
|
||||
<script src="//code.jquery.com/jquery-3.2.1.min.js"></script>
|
||||
<script src="//code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
|
||||
<!-- footable -->
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-footable/3.1.6/footable.core.min.js"></script>
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jquery-footable/3.1.6/footable.core.standalone.min.css">
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||
<!-- plugins -->
|
||||
<script src="./script/jquery.selection.js"></script>
|
||||
<script src="./script/screenfull.js"></script>
|
||||
<script src="./script/jsplumb.min.js"></script>
|
||||
<script src="./script/chart.min.js"></script>
|
||||
<!-- main script -->
|
||||
<script src="./script/script.js"></script>
|
||||
<script src="./script/tester.js"></script>
|
||||
<script src="./script/quizedit.js"></script>
|
||||
<script src="./script/resulttest.js"></script>
|
||||
<!-- sQuiz -->
|
||||
<script src="./script/sQuiz/sQuiz.js"></script>
|
||||
<script src="./script/sQuiz/sQuiz_module_simpleQuestion.js"></script>
|
||||
<script src="./script/sQuiz/sQuiz_module_simpleSelect.js"></script>
|
||||
<script src="./script/sQuiz/sQuiz_module_connectGraph.js"></script>
|
||||
<script src="./script/sQuiz/sQuiz_module_fillIn.js"></script>
|
||||
<script src="./script/sQuiz/sQuiz_module_markOnMap.js"></script>
|
||||
<link rel="stylesheet" href="./script/sQuiz/style/sQuiz.css">
|
||||
<!-- cookieconsent -->
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/1.0.9/cookieconsent.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- CONTENT -->
|
||||
<div id="content">
|
||||
<button type="button" onclick="screenfull.toggle()"><i class="fa fa-expand"></i></button>
|
||||
<h1 style="text-align: right ">{{title}}</h1>
|
||||
<div id="menuwrapper">
|
||||
<hr class="placeholder" style="height: 20vh">
|
||||
<div id="menu" class="menu">
|
||||
<button type="button" class="big" onclick="goTo('tester.html')">{{tester}}</button>
|
||||
<button type="button" class="big" onclick="goTo('newquiz.html')">{{newquiz}}</button>
|
||||
<button type="button" class="big" onclick="goTo('resulttest.html')">{{resulttest}}</button>
|
||||
<button type="button" class="big" onclick="goTo('more.html')">{{more}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END CONTENT -->
|
||||
<hr class="placeholder" style="height: 500px">
|
||||
<footer>
|
||||
<p>© Fándly Gergő Zoltán 2018</p>
|
||||
<p>Powered by: sQuizEngine<br>version: {{version}}<br>Copyright (c) 2018 Fándly Gergő (<a href="//systemtest.tk">systemtest.tk</a>, <a href="mailto:contact@systemtest.tk">contact@systemtest.tk</a>)<br>Source code: <a href="https://www.systemtest.tk/websvn/listing.php?repname=sQuiz">Repository</a></p>
|
||||
<p><a href="./license.txt">License</a></p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
11
indexc.html
Normal file
11
indexc.html
Normal file
@ -0,0 +1,11 @@
|
||||
<button type="button" onclick="screenfull.toggle()"><i class="fa fa-expand"></i></button>
|
||||
<h1 style="text-align: right ">{{title}}</h1>
|
||||
<div id="menuwrapper">
|
||||
<hr class="placeholder" style="height: 20vh">
|
||||
<div id="menu" class="menu">
|
||||
<button type="button" class="big" onclick="goTo('tester.html')">{{tester}}</button>
|
||||
<button type="button" class="big" onclick="goTo('newquiz.html')">{{newquiz}}</button>
|
||||
<button type="button" class="big" onclick="goTo('resulttest.html')">{{resulttest}}</button>
|
||||
<button type="button" class="big" onclick="goTo('more.html')">{{more}}</button>
|
||||
</div>
|
||||
</div>
|
81
lang.json
Normal file
81
lang.json
Normal file
@ -0,0 +1,81 @@
|
||||
{
|
||||
"conf_isOffline":false,
|
||||
"conf_offline_useRepo":"http://systemtest.tk/sQuiz/",
|
||||
"version":"0.9b (SVN revision: 9)",
|
||||
"title":"sQuiz - Online és Offline kvízek egyszerűen!",
|
||||
"description":"Online és Offline kvízek egyszerű készítése és kitöltése. Teljes nyílt forráskód HTML5, CSS3 és jQuery felhasználásával, fókuszban a könnyű implementálás.",
|
||||
"cookie_message":"Ez az oldal sütiket használ a megfelelő működés elérésének érdekében. Az oldal használatával elfogadja ezt és a szerződési feltételeket (lásd az oldal alján).",
|
||||
"cookie_dismiss":"Elfogadom",
|
||||
"tester":"Kvíz megoldása",
|
||||
"newquiz":"Új kvíz készítése",
|
||||
"resulttest":"Eredmény ellenőrzése",
|
||||
"more":"További tudnivalók",
|
||||
"fromlist":"Kiválasztás a listáról",
|
||||
"uploadtest":"Kvíz fájl feltöltése",
|
||||
"id":"Azonosító",
|
||||
"name":"Megnevezés",
|
||||
"desc":"Leírás",
|
||||
"solve":"Megoldás!",
|
||||
"back":"Vissza",
|
||||
"appendNew":"Új hozzáadása",
|
||||
"simpleQuestion":"Egyszerű válasz",
|
||||
"simpleSelect":"Egyszerű feleletválasztás",
|
||||
"connectGraph":"Kösd össze!",
|
||||
"fillIn":"Egészítsd ki!",
|
||||
"markOnMap":"Jelöld meg a térképen!",
|
||||
"question":"Kérdés",
|
||||
"submitOnline":"Online közzététel (ehhez kötelezően meg kell adni egy címkét is, valamint az online listán csak ellenőrzés után jelenik meg a feladat)",
|
||||
"answer":"Válasz",
|
||||
"answers":"Válaszok",
|
||||
"remove":"Eltávolítás",
|
||||
"generalSettings":"Általános beállítások",
|
||||
"questions":"Kérdések",
|
||||
"newAnswer":"Új válasz hozzáadása",
|
||||
"newSimpleSelect":"Helyes válasz - Válaszlehetőség - Eltávolítás",
|
||||
"newConnectGraph":"Eelem - Elem párja",
|
||||
"type":"Típus",
|
||||
"objective":"Feladat",
|
||||
"text":"Szöveg",
|
||||
"newFillIn":"A kitöltendő szavakat jelölje ki, majd kattintson rá a <i>mező hozzáadása</i> gombra",
|
||||
"newField":"Új mező hozzáadása",
|
||||
"map":"Térkép",
|
||||
"uploadMap":"Térkép feltöltése",
|
||||
"newMarkOnMap":"Töltsön fel egy fényképet, helyezzen el kattintható jelölőket a képen, majd válassza ki a helyes(eke)t!",
|
||||
"newMarker":"Új jelölő hozzáadása",
|
||||
"removeMarker":"Jelölő eltávolítása",
|
||||
"markers":"Jelölők",
|
||||
"loadMap":"Térkép betöltése",
|
||||
"timeLimitPerTest":"Idő limit feladatonként (másodperc)",
|
||||
"timeLimit":"Idő limit a teljes kvízre (másodperc)",
|
||||
"save":"Mentés",
|
||||
"cancel":"Mégse",
|
||||
"sure":"Biztosan?",
|
||||
"timeLeftPerTest":"Hátralévő idő erre a feladatra",
|
||||
"timeLeft":"Hátralévő idő a teljes kvízre",
|
||||
"startQuiz":"Kvíz indítása",
|
||||
"submit":"Beküld",
|
||||
"nextQuestion":"Következő kérdés",
|
||||
"quizFinished":"Gratulálok! Befejezted a kvízt",
|
||||
"resultsGot":"Elért pontszámod",
|
||||
"downloadResults":"Eredményeim letöltése",
|
||||
"onlineTag":"Címke az online kereshetőségért",
|
||||
"fromurl":"Teszt betöltése URL-ről",
|
||||
"availableAtURL":"Az ön által feltöltött feladat mostantól elérhető a következő címen. Publikusan csak az ellenőrzés után fog megjelenni!",
|
||||
"uploadResults":"Eredményem feltöltése",
|
||||
"yourname":"Neved",
|
||||
"idForResult":"Ezt a számot add meg tanárodnak, hogy megnézhesse eredményedet",
|
||||
"uploadResult":"Eredmény fájl feltöltése",
|
||||
"resultById":"Eredmény megtekintése azonosító alapján",
|
||||
"quizdata":"Kvíz adatai",
|
||||
"doneAtDate":"Befejezve ekkor",
|
||||
"charts":"Diagramok",
|
||||
"exercise":"feladat",
|
||||
"correct":"Helyes",
|
||||
"incorrect":"Helytelen",
|
||||
"correctAnswers":"Helyes válaszok",
|
||||
"answers":"Válaszok",
|
||||
"timeSpent":"Eltöltött idő",
|
||||
"doneIn":"Megoldási idő (mp)",
|
||||
"doneBy":"Megoldó",
|
||||
"ok":"Mehet"
|
||||
}
|
621
license.txt
Normal file
621
license.txt
Normal file
@ -0,0 +1,621 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
154
newquiz.html
Normal file
154
newquiz.html
Normal file
@ -0,0 +1,154 @@
|
||||
<!--
|
||||
/**
|
||||
* /newquiz.html
|
||||
* @version 1.8
|
||||
* @desc Creating a new quiz
|
||||
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
* License:
|
||||
sQuiz for creating small jQuery based quizs in an implementable way
|
||||
Copyright (C) 2017 Fándly Gergő Zoltán
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
**/
|
||||
-->
|
||||
|
||||
<button id="back" type="button" onclick="window.history.back()"><i class="fa fa-arrow-left" aria-hidden="true"></i> {{back}}</button>
|
||||
<button type="button" onclick="screenfull.toggle()"><i class="fa fa-expand"></i></button>
|
||||
<br>
|
||||
<br>
|
||||
<div id="newquizcontainer" class="container center">
|
||||
<form id="newquiz" onsubmit="function(e){ e.preventDefault() }">
|
||||
<h3>{{generalSettings}}</h3>
|
||||
<fieldset id="general">
|
||||
<p>{{name}}:</p>
|
||||
<input type="text" name="name" style="width: 90%" placeholder="{{name}}"><br>
|
||||
<p>{{desc}}:</p>
|
||||
<textarea name="description" placeholder="{{desc}}" style="width: 90%"></textarea><br>
|
||||
<p>{{timeLimitPerTest}}:</p>
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" name="timeLimitPerTest" id="timeLimitPerTestCheckbox" onclick="toggleElement('input[name=timeLimitPerTestVal]')">
|
||||
<label for="timeLimitPerTestCheckbox"></label>
|
||||
</div>
|
||||
<br>
|
||||
<input type="number" name="timeLimitPerTestVal" style="width: 90%; display: none" placeholder="{{timeLimitPerTest}}" min=0><br>
|
||||
<p>{{timeLimit}}:</p>
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" name="timeLimit" id="timeLimitCheckbox" onclick="toggleElement('input[name=timeLimitVal]')">
|
||||
<label for="timeLimitCheckbox"></label>
|
||||
</div>
|
||||
<br>
|
||||
<input type="number" name="timeLimitVal" style="width: 90%; display: none" placeholder="{{timeLimit}}" min=0><br>
|
||||
<p>{{submitOnline}}:</p>
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" name="submitOnline" id="submitOnlineCheckbox" onclick="toggleElement('input[name=onlineTag]')">
|
||||
<label for="submitOnlineCheckbox"></label>
|
||||
</div>
|
||||
<br>
|
||||
<input type="text" name="onlineTag" style="width: 90%; display: none" placeholder="{{onlineTag}}"><br>
|
||||
</fieldset>
|
||||
<br>
|
||||
<br>
|
||||
<div id="questionSettings">
|
||||
<h3>{{questions}}</h3>
|
||||
<fieldset id="questions">
|
||||
</fieldset>
|
||||
<div id="appendNew">
|
||||
<p><b>{{appendNew}}</b></p>
|
||||
<button type="button" onclick="appendNewField('simpleQuestion')"><i class="fa fa-plus-circle"></i> {{simpleQuestion}}</button>
|
||||
<button type="button" onclick="appendNewField('simpleSelect')"><i class="fa fa-plus-circle"></i> {{simpleSelect}}</button>
|
||||
<button type="button" onclick="appendNewField('connectGraph')"><i class="fa fa-plus-circle"></i> {{connectGraph}}</button>
|
||||
<button type="button" onclick="appendNewField('fillIn')"><i class="fa fa-plus-circle"></i> {{fillIn}}</button>
|
||||
<button type="button" onclick="appendNewField('markOnMap')"><i class="fa fa-plus-circle"></i> {{markOnMap}}</button>
|
||||
<div id="newPrototypes" style="display: none">
|
||||
<div data-type="simpleQuestion">
|
||||
<button type="button" onclick="removeField(this)" class="red"><i class="fa fa-times-circle"></i> {{remove}}</button><br>
|
||||
<p>{{type}}: {{simpleQuestion}}</p>
|
||||
<input type="hidden" name="type" value="simpleQuestion">
|
||||
<p>{{question}}:</p>
|
||||
<input type="text" name="question" style="width: 90%">
|
||||
<p>{{answer}}:</p>
|
||||
<input type="text" name="answer" style="width: 90%">
|
||||
<hr>
|
||||
</div>
|
||||
<div data-type="simpleSelect">
|
||||
<button type="button" onclick="removeField(this)" class="red"><i class="fa fa-times-circle"></i> {{remove}}</button><br>
|
||||
<p>{{type}}: {{simpleSelect}}</p>
|
||||
<input type="hidden" name="type" value="simpleSelect">
|
||||
<p>{{question}}:</p>
|
||||
<input type="text" name="question" style="width: 90%">
|
||||
<p>{{answers}}:</p>
|
||||
<span>{{newSimpleSelect}}</span>
|
||||
<fieldset name="answers">
|
||||
</fieldset>
|
||||
<button type="button" onclick="addNewAnswer(this)" data-append="<i class="fa fa-square fa-2x" onclick="toggleGoodAnswer(this)"></i> <input type="text" name="answer" data-correct="false" style="width: 90%"><button type="button" class="red" onclick="removeField(this)"><i class="fa fa-times-circle"></i> {{remove}}</button><br>"><i class="fa fa-plus-circle"></i> {{newAnswer}}</button>
|
||||
<hr>
|
||||
</div>
|
||||
<div data-type="connectGraph">
|
||||
<button type="button" onclick="removeField(this)" class="red"><i class="fa fa-times-circle"></i> {{remove}}</button><br>
|
||||
<p>{{type}}: {{connectGraph}}</p>
|
||||
<input type="hidden" name="type" value="connectGraph">
|
||||
<p>{{objective}}:</p>
|
||||
<input type="text" name="question" style="width: 90%">
|
||||
<p>{{answers}}:</p>
|
||||
<span>{{newConnectGraph}}</span>
|
||||
<fieldset name="answers">
|
||||
</fieldset>
|
||||
<button type="button" onclick="addNewAnswer(this)" data-append="<input type="text" name="pair1" style="width: 40%"> - <input type="text" name="pair2" style="width: 40%"><button type="button" class="red" onclick="removeField(this)"><i class="fa fa-times-circle"></i> {{remove}}</button>"><i class="fa fa-plus-circle"></i> {{newField}}</button>
|
||||
<hr>
|
||||
</div>
|
||||
<div data-type="fillIn">
|
||||
<button type="button" onclick="removeField(this)" class="red"><i class="fa fa-times-circle"></i> {{remove}}</button><br>
|
||||
<p>{{type}}: {{fillIn}}</p>
|
||||
<input type="hidden" name="type" value="fillIn">
|
||||
<p>{{objective}}:</p>
|
||||
<input type="text" name="question" style="width: 90%">
|
||||
<p>{{text}}:</p>
|
||||
<span>{{newFillIn}}</span>
|
||||
<textarea name="text" rows=10 style="width: 90%"></textarea><br>
|
||||
<button type="button" onclick="addNewFillInField(this)" ><i class="fa fa-plus-circle"></i> {{newField}}</button>
|
||||
<hr>
|
||||
</div>
|
||||
<div data-type="markOnMap">
|
||||
<button type="button" onclick="removeField(this)" class="red"><i class="fa fa-times-circle"></i> {{remove}}</button><br>
|
||||
<p>{{type}}: {{markOnMap}}</p>
|
||||
<input type="hidden" name="type" value="markOnMap">
|
||||
<p>{{objective}}:</p>
|
||||
<input type="text" name="question" style="width: 90%">
|
||||
<p>{{map}}:</p>
|
||||
<span>{{newMarkOnMap}}</span><br>
|
||||
<input type="file" accept="image/*" name="mapfile">
|
||||
<input type="hidden" name="map">
|
||||
<button type="button" onclick="loadMap(this)"><i class="fa fa-upload"></i> {{loadMap}}</button>
|
||||
<p>{{markers}}:</p>
|
||||
<div class="sq sq-mapArea" name="mapArea">
|
||||
<img src="./res/no_map.jpg">
|
||||
<div name="markers">
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<button type="button" onclick="addNewMarker(this)" ><i class="fa fa-plus-circle"></i> {{newMarker}}</button>
|
||||
<button type="button" class="red" onclick="removeMarker(this)" ><i class="fa fa-plus-circle"></i> {{removeMarker}}</button>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="placeholder">
|
||||
<div id="export">
|
||||
<button type="button" class="green" onclick="exportQuiz()"><i class="fa fa-save"></i> {{save}}</button>
|
||||
<button type="button" class="red" onclick="resetNewQuizForm()"><i class="fa fa-ban"></i> {{cancel}}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
BIN
res/background.png
Normal file
BIN
res/background.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 887 KiB |
BIN
res/background_old.png
Normal file
BIN
res/background_old.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 MiB |
BIN
res/icon.png
Normal file
BIN
res/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
BIN
res/no_map.jpg
Normal file
BIN
res/no_map.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
65
resulttest.html
Normal file
65
resulttest.html
Normal file
@ -0,0 +1,65 @@
|
||||
<!--
|
||||
/**
|
||||
* /resulttest.html
|
||||
* @version 1.1
|
||||
* @desc View and analyse results
|
||||
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
* License:
|
||||
sQuiz for creating small jQuery based quizs in an implementable way
|
||||
Copyright (C) 2017 Fándly Gergő Zoltán
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
**/
|
||||
-->
|
||||
|
||||
<button id="back" type="button" onclick="window.history.back()"><i class="fa fa-arrow-left" aria-hidden="true"></i> {{back}}</button>
|
||||
<button type="button" onclick="screenfull.toggle()"><i class="fa fa-expand"></i></button>
|
||||
<br>
|
||||
<br>
|
||||
<div id="menuwrapper">
|
||||
<hr class="placeholder" style="height: 20vh">
|
||||
<div id="menu" class="menu">
|
||||
<button type="button" class="big" onclick="resultFromFile()">{{uploadResult}}</button>
|
||||
<button type="button" class="big" onclick="resultFromId()">{{resultById}}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="resFromFile" class="container center" style="display: none">
|
||||
<input type="file" name="resfile" accept="text/json">
|
||||
<br>
|
||||
<button type="button" onclick="openResultFromFile()">{{ok}}</button>
|
||||
</div>
|
||||
<div id="resFromId" class="container center" style="display: none">
|
||||
<input type="number" min="1" name="testid">
|
||||
<br>
|
||||
<button type="button" onclick="openResultFromId()">{{ok}}</button>
|
||||
</div>
|
||||
<div id="analitycs" style="display: none">
|
||||
<h2>{{quizdata}}:</h2>
|
||||
<div class="indented">
|
||||
<p>{{name}}: <b><span id="quizName"></span></b></p>
|
||||
<p>{{desc}}: <b><span id="quizDesc"></span></b></p>
|
||||
<p>{{doneAtDate}}: <b><span id="quizDone"></span></b></p>
|
||||
<p>{{doneIn}}: <b><span id="quizTimeSpent"></span></b></p>
|
||||
<p id="quizDoneByHolder">{{doneBy}}: <b><span id="quizDoneBy"></span></b></p>
|
||||
</div>
|
||||
<hr class="placeholder">
|
||||
<h2>{{charts}}</h2>
|
||||
<div class="flexcontainer">
|
||||
<canvas id="chartCorrect" style="width: 20em; height: 20em"></canvas>
|
||||
<canvas id="chartAnswers" style="width: 50em; height: 20em"></canvas>
|
||||
<canvas id="chartTimeSpent" style="width: 50em; height: 20em"></canvas>
|
||||
<canvas id="chartTimeSpentPie" style="width: 20em; height: 20em"></canvas>
|
||||
</div>
|
||||
</div>
|
53
sQuiz.geany
Normal file
53
sQuiz.geany
Normal file
@ -0,0 +1,53 @@
|
||||
[editor]
|
||||
line_wrapping=false
|
||||
line_break_column=72
|
||||
auto_continue_multiline=true
|
||||
|
||||
[file_prefs]
|
||||
final_new_line=true
|
||||
ensure_convert_new_lines=false
|
||||
strip_trailing_spaces=false
|
||||
replace_tabs=false
|
||||
|
||||
[indentation]
|
||||
indent_width=4
|
||||
indent_type=0
|
||||
indent_hard_tab_width=8
|
||||
detect_indent=false
|
||||
detect_indent_width=false
|
||||
indent_mode=2
|
||||
|
||||
[project]
|
||||
name=sQuiz
|
||||
base_path=H:\\Munkák\\sQuiz
|
||||
description=
|
||||
file_patterns=
|
||||
|
||||
[long line marker]
|
||||
long_line_behaviour=1
|
||||
long_line_column=72
|
||||
|
||||
[files]
|
||||
current_page=20
|
||||
FILE_NAME_0=4281;HTML;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Cindex.html;0;4
|
||||
FILE_NAME_1=1356;CSS;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Cstyle%5Cstyle.css;0;4
|
||||
FILE_NAME_2=1382;Javascript;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Cscript%5Cscript.js;0;4
|
||||
FILE_NAME_3=128;JSON;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Ctests%5Cmain.json;0;4
|
||||
FILE_NAME_4=2156;HTML;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Ctester.html;0;4
|
||||
FILE_NAME_5=2971;Javascript;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Cscript%5Ctester.js;0;4
|
||||
FILE_NAME_6=3057;HTML;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Cnewquiz.html;0;4
|
||||
FILE_NAME_7=7977;Javascript;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Cscript%5Cquizedit.js;0;4
|
||||
FILE_NAME_8=89;HTML;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Cindexc.html;0;4
|
||||
FILE_NAME_9=3085;CSS;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Cscript%5CsQuiz%5Cstyle%5CsQuiz.css;0;4
|
||||
FILE_NAME_10=13129;Javascript;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Cscript%5CsQuiz%5CsQuiz.js;0;4
|
||||
FILE_NAME_11=2295;Javascript;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Cscript%5CsQuiz%5CsQuiz_module_simpleQuestion.js;0;4
|
||||
FILE_NAME_12=2126;Javascript;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Cscript%5CsQuiz%5CsQuiz_module_simpleSelect.js;0;4
|
||||
FILE_NAME_13=3871;Javascript;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Cscript%5CsQuiz%5CsQuiz_module_connectGraph.js;0;4
|
||||
FILE_NAME_14=2600;Javascript;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Cscript%5CsQuiz%5CsQuiz_module_fillIn.js;0;4
|
||||
FILE_NAME_15=2598;Javascript;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Cscript%5CsQuiz%5CsQuiz_module_markOnMap.js;0;4
|
||||
FILE_NAME_16=671;SQL;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Cengine%5Cdatabase.sql;0;4
|
||||
FILE_NAME_17=50;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Cengine%5Cengine.php;0;4
|
||||
FILE_NAME_18=380;JSON;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Cscript%5CsQuiz%5Clang.json;0;4
|
||||
FILE_NAME_19=47;HTML;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Cresulttest.html;0;4
|
||||
FILE_NAME_20=2719;Javascript;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Cscript%5Cresulttest.js;0;4
|
||||
FILE_NAME_21=110;JSON;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CsQuiz%5Clang.json;0;4
|
10
script/chart.min.js
vendored
Normal file
10
script/chart.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
354
script/jquery.selection.js
Normal file
354
script/jquery.selection.js
Normal file
@ -0,0 +1,354 @@
|
||||
/*!
|
||||
* jQuery.selection - jQuery Plugin
|
||||
*
|
||||
* Copyright (c) 2010-2014 IWASAKI Koji (@madapaja).
|
||||
* http://blog.madapaja.net/
|
||||
* Under The MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
(function($, win, doc) {
|
||||
/**
|
||||
* get caret status of the selection of the element
|
||||
*
|
||||
* @param {Element} element target DOM element
|
||||
* @return {Object} return
|
||||
* @return {String} return.text selected text
|
||||
* @return {Number} return.start start position of the selection
|
||||
* @return {Number} return.end end position of the selection
|
||||
*/
|
||||
var _getCaretInfo = function(element){
|
||||
var res = {
|
||||
text: '',
|
||||
start: 0,
|
||||
end: 0
|
||||
};
|
||||
|
||||
if (!element.value) {
|
||||
/* no value or empty string */
|
||||
return res;
|
||||
}
|
||||
|
||||
try {
|
||||
if (win.getSelection) {
|
||||
/* except IE */
|
||||
res.start = element.selectionStart;
|
||||
res.end = element.selectionEnd;
|
||||
res.text = element.value.slice(res.start, res.end);
|
||||
} else if (doc.selection) {
|
||||
/* for IE */
|
||||
element.focus();
|
||||
|
||||
var range = doc.selection.createRange(),
|
||||
range2 = doc.body.createTextRange();
|
||||
|
||||
res.text = range.text;
|
||||
|
||||
try {
|
||||
range2.moveToElementText(element);
|
||||
range2.setEndPoint('StartToStart', range);
|
||||
} catch (e) {
|
||||
range2 = element.createTextRange();
|
||||
range2.setEndPoint('StartToStart', range);
|
||||
}
|
||||
|
||||
res.start = element.value.length - range2.text.length;
|
||||
res.end = res.start + range.text.length;
|
||||
}
|
||||
} catch (e) {
|
||||
/* give up */
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
/**
|
||||
* caret operation for the element
|
||||
* @type {Object}
|
||||
*/
|
||||
var _CaretOperation = {
|
||||
/**
|
||||
* get caret position
|
||||
*
|
||||
* @param {Element} element target element
|
||||
* @return {Object} return
|
||||
* @return {Number} return.start start position for the selection
|
||||
* @return {Number} return.end end position for the selection
|
||||
*/
|
||||
getPos: function(element) {
|
||||
var tmp = _getCaretInfo(element);
|
||||
return {start: tmp.start, end: tmp.end};
|
||||
},
|
||||
|
||||
/**
|
||||
* set caret position
|
||||
*
|
||||
* @param {Element} element target element
|
||||
* @param {Object} toRange caret position
|
||||
* @param {Number} toRange.start start position for the selection
|
||||
* @param {Number} toRange.end end position for the selection
|
||||
* @param {String} caret caret mode: any of the following: "keep" | "start" | "end"
|
||||
*/
|
||||
setPos: function(element, toRange, caret) {
|
||||
caret = this._caretMode(caret);
|
||||
|
||||
if (caret === 'start') {
|
||||
toRange.end = toRange.start;
|
||||
} else if (caret === 'end') {
|
||||
toRange.start = toRange.end;
|
||||
}
|
||||
|
||||
element.focus();
|
||||
try {
|
||||
if (element.createTextRange) {
|
||||
var range = element.createTextRange();
|
||||
|
||||
if (win.navigator.userAgent.toLowerCase().indexOf("msie") >= 0) {
|
||||
toRange.start = element.value.substr(0, toRange.start).replace(/\r/g, '').length;
|
||||
toRange.end = element.value.substr(0, toRange.end).replace(/\r/g, '').length;
|
||||
}
|
||||
|
||||
range.collapse(true);
|
||||
range.moveStart('character', toRange.start);
|
||||
range.moveEnd('character', toRange.end - toRange.start);
|
||||
|
||||
range.select();
|
||||
} else if (element.setSelectionRange) {
|
||||
element.setSelectionRange(toRange.start, toRange.end);
|
||||
}
|
||||
} catch (e) {
|
||||
/* give up */
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* get selected text
|
||||
*
|
||||
* @param {Element} element target element
|
||||
* @return {String} return selected text
|
||||
*/
|
||||
getText: function(element) {
|
||||
return _getCaretInfo(element).text;
|
||||
},
|
||||
|
||||
/**
|
||||
* get caret mode
|
||||
*
|
||||
* @param {String} caret caret mode
|
||||
* @return {String} return any of the following: "keep" | "start" | "end"
|
||||
*/
|
||||
_caretMode: function(caret) {
|
||||
caret = caret || "keep";
|
||||
if (caret === false) {
|
||||
caret = 'end';
|
||||
}
|
||||
|
||||
switch (caret) {
|
||||
case 'keep':
|
||||
case 'start':
|
||||
case 'end':
|
||||
break;
|
||||
|
||||
default:
|
||||
caret = 'keep';
|
||||
}
|
||||
|
||||
return caret;
|
||||
},
|
||||
|
||||
/**
|
||||
* replace selected text
|
||||
*
|
||||
* @param {Element} element target element
|
||||
* @param {String} text replacement text
|
||||
* @param {String} caret caret mode: any of the following: "keep" | "start" | "end"
|
||||
*/
|
||||
replace: function(element, text, caret) {
|
||||
var tmp = _getCaretInfo(element),
|
||||
orig = element.value,
|
||||
pos = $(element).scrollTop(),
|
||||
range = {start: tmp.start, end: tmp.start + text.length};
|
||||
|
||||
element.value = orig.substr(0, tmp.start) + text + orig.substr(tmp.end);
|
||||
|
||||
$(element).scrollTop(pos);
|
||||
this.setPos(element, range, caret);
|
||||
},
|
||||
|
||||
/**
|
||||
* insert before the selected text
|
||||
*
|
||||
* @param {Element} element target element
|
||||
* @param {String} text insertion text
|
||||
* @param {String} caret caret mode: any of the following: "keep" | "start" | "end"
|
||||
*/
|
||||
insertBefore: function(element, text, caret) {
|
||||
var tmp = _getCaretInfo(element),
|
||||
orig = element.value,
|
||||
pos = $(element).scrollTop(),
|
||||
range = {start: tmp.start + text.length, end: tmp.end + text.length};
|
||||
|
||||
element.value = orig.substr(0, tmp.start) + text + orig.substr(tmp.start);
|
||||
|
||||
$(element).scrollTop(pos);
|
||||
this.setPos(element, range, caret);
|
||||
},
|
||||
|
||||
/**
|
||||
* insert after the selected text
|
||||
*
|
||||
* @param {Element} element target element
|
||||
* @param {String} text insertion text
|
||||
* @param {String} caret caret mode: any of the following: "keep" | "start" | "end"
|
||||
*/
|
||||
insertAfter: function(element, text, caret) {
|
||||
var tmp = _getCaretInfo(element),
|
||||
orig = element.value,
|
||||
pos = $(element).scrollTop(),
|
||||
range = {start: tmp.start, end: tmp.end};
|
||||
|
||||
element.value = orig.substr(0, tmp.end) + text + orig.substr(tmp.end);
|
||||
|
||||
$(element).scrollTop(pos);
|
||||
this.setPos(element, range, caret);
|
||||
}
|
||||
};
|
||||
|
||||
/* add jQuery.selection */
|
||||
$.extend({
|
||||
/**
|
||||
* get selected text on the window
|
||||
*
|
||||
* @param {String} mode selection mode: any of the following: "text" | "html"
|
||||
* @return {String} return
|
||||
*/
|
||||
selection: function(mode) {
|
||||
var getText = ((mode || 'text').toLowerCase() === 'text');
|
||||
|
||||
try {
|
||||
if (win.getSelection) {
|
||||
if (getText) {
|
||||
// get text
|
||||
return win.getSelection().toString();
|
||||
} else {
|
||||
// get html
|
||||
var sel = win.getSelection(), range;
|
||||
|
||||
if (sel.getRangeAt) {
|
||||
range = sel.getRangeAt(0);
|
||||
} else {
|
||||
range = doc.createRange();
|
||||
range.setStart(sel.anchorNode, sel.anchorOffset);
|
||||
range.setEnd(sel.focusNode, sel.focusOffset);
|
||||
}
|
||||
|
||||
return $('<div></div>').append(range.cloneContents()).html();
|
||||
}
|
||||
} else if (doc.selection) {
|
||||
if (getText) {
|
||||
// get text
|
||||
return doc.selection.createRange().text;
|
||||
} else {
|
||||
// get html
|
||||
return doc.selection.createRange().htmlText;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
/* give up */
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
});
|
||||
|
||||
/* add selection */
|
||||
$.fn.extend({
|
||||
selection: function(mode, opts) {
|
||||
opts = opts || {};
|
||||
|
||||
switch (mode) {
|
||||
/**
|
||||
* selection('getPos')
|
||||
* get caret position
|
||||
*
|
||||
* @return {Object} return
|
||||
* @return {Number} return.start start position for the selection
|
||||
* @return {Number} return.end end position for the selection
|
||||
*/
|
||||
case 'getPos':
|
||||
return _CaretOperation.getPos(this[0]);
|
||||
|
||||
/**
|
||||
* selection('setPos', opts)
|
||||
* set caret position
|
||||
*
|
||||
* @param {Number} opts.start start position for the selection
|
||||
* @param {Number} opts.end end position for the selection
|
||||
*/
|
||||
case 'setPos':
|
||||
return this.each(function() {
|
||||
_CaretOperation.setPos(this, opts);
|
||||
});
|
||||
|
||||
/**
|
||||
* selection('replace', opts)
|
||||
* replace the selected text
|
||||
*
|
||||
* @param {String} opts.text replacement text
|
||||
* @param {String} opts.caret caret mode: any of the following: "keep" | "start" | "end"
|
||||
*/
|
||||
case 'replace':
|
||||
return this.each(function() {
|
||||
_CaretOperation.replace(this, opts.text, opts.caret);
|
||||
});
|
||||
|
||||
/**
|
||||
* selection('insert', opts)
|
||||
* insert before/after the selected text
|
||||
*
|
||||
* @param {String} opts.text insertion text
|
||||
* @param {String} opts.caret caret mode: any of the following: "keep" | "start" | "end"
|
||||
* @param {String} opts.mode insertion mode: any of the following: "before" | "after"
|
||||
*/
|
||||
case 'insert':
|
||||
return this.each(function() {
|
||||
if (opts.mode === 'before') {
|
||||
_CaretOperation.insertBefore(this, opts.text, opts.caret);
|
||||
} else {
|
||||
_CaretOperation.insertAfter(this, opts.text, opts.caret);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* selection('get')
|
||||
* get selected text
|
||||
*
|
||||
* @return {String} return
|
||||
*/
|
||||
case 'get':
|
||||
/* falls through */
|
||||
default:
|
||||
return _CaretOperation.getText(this[0]);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
})(jQuery, window, window.document);
|
7
script/jsplumb.min.js
vendored
Normal file
7
script/jsplumb.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
196
script/quizedit.js
Normal file
196
script/quizedit.js
Normal file
@ -0,0 +1,196 @@
|
||||
/**
|
||||
* /script/quizedit.js
|
||||
* @version 1.9
|
||||
* @desc Script file for creating and editing tests
|
||||
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
* License:
|
||||
sQuiz for creating small jQuery based quizs in an implementable way
|
||||
Copyright (C) 2017 Fándly Gergő Zoltán
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
**/
|
||||
|
||||
function appendNewField(type){
|
||||
$("<div>"+$("#newPrototypes div[data-type="+type+"]").html()+"</div>").hide().appendTo($("#questions")).slideDown();
|
||||
}
|
||||
|
||||
function removeField(el){
|
||||
$(el).parent().slideUp(function(){
|
||||
$(el).parent().remove();
|
||||
});
|
||||
}
|
||||
|
||||
function addNewAnswer(el){
|
||||
$("<div>"+$(el).data("append")+"</div>").hide().appendTo($(el).parent().children("[name=answers]")).slideDown();
|
||||
}
|
||||
|
||||
function toggleGoodAnswer(el){
|
||||
if($(el).hasClass("fa-square")){
|
||||
$(el).removeClass("fa-square").addClass("fa-check-square");
|
||||
$(el).next().data("correct", "true");
|
||||
}
|
||||
else{
|
||||
$(el).removeClass("fa-check-square").addClass("fa-square");
|
||||
$(el).next().data("correct", "false");
|
||||
}
|
||||
}
|
||||
|
||||
function addNewFillInField(el){
|
||||
$(el).parent().children("textarea").selection("insert", {text:"[]", mode:"before"});
|
||||
$(el).parent().children("textarea").selection("insert", {text:"[/]", mode:"after"});
|
||||
}
|
||||
|
||||
//map funcs
|
||||
function loadMap(el){
|
||||
var file=$(el).parent().children("input[type=file]")[0].files[0];
|
||||
var fr=new FileReader();
|
||||
fr.onload=function(){
|
||||
loadMapCallback(el, fr.result);
|
||||
};
|
||||
fr.readAsDataURL(file);
|
||||
}
|
||||
function loadMapCallback(el, res){
|
||||
$(el).parent().children("div").children("img").attr("src", res);
|
||||
$(el).parent().children("input[name=map]").val(res);
|
||||
}
|
||||
|
||||
function addNewMarker(el){
|
||||
$(el).parent().children("div[name=mapArea]").css("cursor", "crosshair");
|
||||
$(el).parent().children("div[name=mapArea]").on("click", function(e){
|
||||
var x=Math.round(e.pageX-$(this).position().left)-7;
|
||||
var y=Math.round(e.pageY-$(this).position().top)-7;
|
||||
$("<i class=\"fa fa-circle\" style=\"position: absolute; top: "+y.toString()+"px; left: "+x.toString()+"px\" data-posx=\""+x.toString()+"\" data-posy=\""+y.toString()+"\" data-correct=\"false\" onclick=\"toggleGoodMarker(this)\"></i>").hide().appendTo($(el).parent().children("div[name=mapArea]").children("div[name=markers]")).fadeIn();
|
||||
$(el).parent().children("div[name=mapArea]").css("cursor", "default");
|
||||
$(el).parent().children("div[name=mapArea]").off();
|
||||
});
|
||||
}
|
||||
|
||||
function removeMarker(el){
|
||||
$(el).parent().children("div[name=mapArea]").children("div[name=markers]").children("i").css("cursor", "crosshair");
|
||||
$(el).parent().children("div[name=mapArea]").children("div[name=markers]").children("i").on("click", function(e){
|
||||
$(this).fadeOut(function(){
|
||||
$(this).remove();
|
||||
});
|
||||
$(el).parent().children("div[name=mapArea]").children("div[name=markers]").children("i").css("cursor", "default");
|
||||
$(el).parent().children("div[name=mapArea]").children("div[name=markers]").children("i").off();
|
||||
});
|
||||
}
|
||||
|
||||
function toggleGoodMarker(el){
|
||||
if($(el).hasClass("fa-circle")){
|
||||
$(el).removeClass("fa-circle").addClass("fa-check-circle");
|
||||
$(el).data("correct", "true");
|
||||
}
|
||||
else{
|
||||
$(el).removeClass("fa-check-circle").addClass("fa-circle");
|
||||
$(el).data("correct", "false");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//export, cancel
|
||||
function resetNewQuizForm(){
|
||||
if(confirm(lang.sure)){
|
||||
$("#newquizcontainer").slideUp(function(){
|
||||
$("#newquiz")[0].reset();
|
||||
$("#questions").html("");
|
||||
$("input[name=timeLimitPerTestVal]").css("display", "none");
|
||||
$("input[name=timeLimitVal]").css("display", "none");
|
||||
$("input[name=onlineTag]").css("display", "none");
|
||||
$("#newquizcontainer").slideDown();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function exportQuiz(){
|
||||
var exp={};
|
||||
//general settings
|
||||
exp.name=$("#newquiz #general input[name=name]").val();
|
||||
exp.description=$("#newquiz #general textarea[name=description]").val();
|
||||
exp.timeLimitPerTest=$("#newquiz #general input[name=timeLimitPerTest]").is(":checked")?$("#newquiz #general input[name=timeLimitPerTestVal]").val():-1;
|
||||
exp.timeLimit=$("#newquiz #general input[name=timeLimit]").is(":checked")?$("#newquiz #general input[name=timeLimitVal]").val():-1;
|
||||
var publish=$("#newquiz #general input[name=submitOnline]").is(":checked");
|
||||
|
||||
exp.questions=[];
|
||||
//questions
|
||||
$("#newquiz #questions").children("div").each(function(){
|
||||
var q={};
|
||||
q.type=$(this).children("input[name=type]").val();
|
||||
|
||||
if(q.type=="simpleQuestion"){
|
||||
q.question=$(this).children("input[name=question]").val();
|
||||
q.answer=$(this).children("input[name=answer]").val().toLowerCase();
|
||||
}
|
||||
else if(q.type=="simpleSelect"){
|
||||
q.question=$(this).children("input[name=question]").val();
|
||||
q.answers=[];
|
||||
$(this).children("fieldset[name=answers]").children("div").each(function(){
|
||||
var a={};
|
||||
a.answer=$(this).children("input[name=answer]").val();
|
||||
a.correct=($(this).children("input[name=answer]").data("correct")=="true")?true:false;
|
||||
q.answers.push(a);
|
||||
});
|
||||
}
|
||||
else if(q.type=="connectGraph"){
|
||||
q.question=$(this).children("input[name=question]").val();
|
||||
q.answers=[];
|
||||
$(this).children("fieldset[name=answers]").children("div").each(function(){
|
||||
var a={};
|
||||
a.pair1=$(this).children("input[name=pair1]").val();
|
||||
a.pair2=$(this).children("input[name=pair2]").val();
|
||||
q.answers.push(a);
|
||||
});
|
||||
}
|
||||
else if(q.type=="fillIn"){
|
||||
q.question=$(this).children("input[name=question]").val();
|
||||
q.text=$(this).children("textarea[name=text]").val();
|
||||
}
|
||||
else if(q.type=="markOnMap"){
|
||||
q.question=$(this).children("input[name=question]").val();
|
||||
q.map=$(this).children("input[name=map]").val();
|
||||
q.markers=[];
|
||||
$(this).children("div[name=mapArea]").children("div[name=markers]").children("i").each(function(){
|
||||
var m={};
|
||||
m.posx=$(this).data("posx");
|
||||
m.posy=$(this).data("posy");
|
||||
m.correct=($(this).data("correct")=="true")?true:false;
|
||||
q.markers.push(m);
|
||||
});
|
||||
}
|
||||
|
||||
exp.questions.push(q);
|
||||
});
|
||||
|
||||
var json=JSON.stringify(exp);
|
||||
|
||||
if(publish){
|
||||
$.ajax({
|
||||
url: "./engine/engine.php",
|
||||
type: "POST",
|
||||
data: {
|
||||
"submitQuiz": json,
|
||||
"submitQuiz_tag": $("#newquiz #general input[name=onlineTag]").val(),
|
||||
"submitQuiz_name": $("#newquiz #general input[name=name]").val(),
|
||||
"submitQuiz_description": $("#newquiz #general textarea[name=description]").val()
|
||||
},
|
||||
success: function(res){
|
||||
alert(lang.availableAtURL+": "+res);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var send="text/json;charset=utf-8,"+encodeURIComponent(json);
|
||||
$("<a href=\"data:"+send+"\" download=\""+exp.name+"_sQuiz.json\"></a>")[0].click();
|
||||
}
|
279
script/resulttest.js
Normal file
279
script/resulttest.js
Normal file
@ -0,0 +1,279 @@
|
||||
/**
|
||||
* /script/resulttest.js
|
||||
* @version 1.3
|
||||
* @desc Script file for the result viewer page
|
||||
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
* License:
|
||||
sQuiz for creating small jQuery based quizs in an implementable way
|
||||
Copyright (C) 2017 Fándly Gergő Zoltán
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
**/
|
||||
|
||||
function showResSelector(){
|
||||
$("#menuwrapper").slideDown();
|
||||
$("#back").attr("onclick", "window.history.back()");
|
||||
}
|
||||
|
||||
function resultFromFile(){
|
||||
$("#back").attr("onclick", "$(\"#resFromFile\").slideUp(); showResSelector()");
|
||||
$("#menuwrapper").slideUp();
|
||||
$("#resFromFile").slideDown();
|
||||
}
|
||||
|
||||
function resultFromId(){
|
||||
$("#back").attr("onclick", "$(\"#resFromId\").slideUp(); showResSelector()");
|
||||
$("#menuwrapper").slideUp();
|
||||
$("#resFromId").slideDown();
|
||||
}
|
||||
|
||||
function openResultFromFile(){
|
||||
var file=$("input[name=resfile]")[0].files[0];
|
||||
var fr=new FileReader();
|
||||
fr.onload=function(){
|
||||
openResultFromFileCallback(fr.result);
|
||||
};
|
||||
fr.readAsText(file, "utf-8");
|
||||
|
||||
//hide solvedBy
|
||||
$("#quizDoneByHolder").css("display", "none");
|
||||
}
|
||||
function openResultFromFileCallback(file){
|
||||
showResults(file);
|
||||
$("#resFromFile").slideUp();
|
||||
}
|
||||
|
||||
function openResultFromId(){
|
||||
$.ajax({
|
||||
url: "./engine/engine.php",
|
||||
type: "GET",
|
||||
data: {"getResult": $("input[name=testid]").val()},
|
||||
success: function(response){
|
||||
if(response!="not found"){
|
||||
response=(response instanceof Object)?response:JSON.parse(response);
|
||||
showResults(response.answered);
|
||||
|
||||
//show solvedBy
|
||||
$("#quizDoneByHolder").css("display", "block");
|
||||
$("#quizDoneBy").html(response.submitter);
|
||||
|
||||
//hide self
|
||||
$("#resFromId").slideUp();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var chartCorrect=null;
|
||||
var chartAnswers=null;
|
||||
var chartTimeSpent=null;
|
||||
var chartTimeSpentPie=null;
|
||||
function showResults(results){
|
||||
//show back button
|
||||
$("#back").attr("onclick", "$(\"#analitycs\").slideUp(); showResSelector()");
|
||||
|
||||
var res=(results instanceof Object)?results:JSON.parse(results);
|
||||
|
||||
//process data
|
||||
var correct=0;
|
||||
var incorrect=0;
|
||||
var totalTime=0;
|
||||
var labels=[];
|
||||
var correctArr=[];
|
||||
var timeSpentArr=[];
|
||||
var colorArr=[];
|
||||
$.each(res.answers, function(key, val){
|
||||
if(val.correct){
|
||||
correct++;
|
||||
}
|
||||
else{
|
||||
incorrect++;
|
||||
}
|
||||
totalTime+=val.timeElapsed;
|
||||
labels.push((key+1).toString()+". "+lang.exercise);
|
||||
correctArr.push(val.correct);
|
||||
timeSpentArr.push(val.timeElapsed);
|
||||
colorArr.push("rgb("+(Math.floor(Math.random()*255)).toString()+", "+(Math.floor(Math.random()*255)).toString()+", "+(Math.floor(Math.random()*255)).toString()+")");
|
||||
});
|
||||
|
||||
//set quiz datas
|
||||
$("#quizName").html(res.quizName);
|
||||
$("#quizDesc").html(res.quizDesc);
|
||||
var done=new Date(res.doneDate);
|
||||
$("#quizDone").html(done.getFullYear().toString()+"-"+(done.getMonth()+1).toString()+"-"+done.getDate().toString()+" "+done.getHours().toString()+":"+done.getMinutes().toString()+":"+done.getSeconds().toString());
|
||||
$("#quizTimeSpent").html(totalTime);
|
||||
|
||||
//
|
||||
//show charts
|
||||
//
|
||||
|
||||
//clear canvases
|
||||
if(chartCorrect!=null){
|
||||
chartCorrect.destroy();
|
||||
chartAnswers.destroy();
|
||||
chartTimeSpent.destroy();
|
||||
chartTimeSpentPie.destroy();
|
||||
}
|
||||
|
||||
//chartCorrect
|
||||
chartCorrect=new Chart($("#chartCorrect"), {
|
||||
type: "pie",
|
||||
data: {
|
||||
labels: [lang.correct, lang.incorrect],
|
||||
datasets: [{
|
||||
label: lang.answers,
|
||||
backgroundColor: ["rgb(0, 255, 0)", "rgb(255, 0, 0)"],
|
||||
data: [correct, incorrect]
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: false,
|
||||
title: {
|
||||
display: true,
|
||||
fontColor: "rgb(0, 0, 0)",
|
||||
text: lang.answers
|
||||
},
|
||||
legend: {
|
||||
labels: {
|
||||
fontColor: "rgb(0, 0, 0)"
|
||||
},
|
||||
onClick: null
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//chartAnswers
|
||||
chartAnswers=new Chart($("#chartAnswers"), {
|
||||
type: "bar",
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
label: lang.correct,
|
||||
backgroundColor: "rgba(34,168,186,0.9)",
|
||||
data: correctArr
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: false,
|
||||
title: {
|
||||
display: true,
|
||||
fontColor: "rgb(0, 0, 0)",
|
||||
text: lang.correctAnswers
|
||||
},
|
||||
legend: {
|
||||
labels: {
|
||||
fontColor: "rgb(0, 0, 0)"
|
||||
},
|
||||
onClick: null
|
||||
},
|
||||
scales: {
|
||||
xAxes: [{
|
||||
gridLines: {
|
||||
color: "rgb(0, 0, 0)"
|
||||
},
|
||||
ticks: {
|
||||
fontColor: "rgb(0, 0, 0)"
|
||||
}
|
||||
}],
|
||||
yAxes: [{
|
||||
gridLines: {
|
||||
color: "rgb(0, 0, 0)"
|
||||
},
|
||||
ticks: {
|
||||
fontColor: "rgb(0, 0, 0)",
|
||||
beginAtZero: true
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//chartTimeSpent
|
||||
chartTimeSpent=new Chart($("#chartTimeSpent"), {
|
||||
type: "line",
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
label: lang.timeSpent,
|
||||
backgroundColor: "rgba(34,168,186,0.9)",
|
||||
data: timeSpentArr,
|
||||
lineTension: 0
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: false,
|
||||
title: {
|
||||
display: true,
|
||||
fontColor: "rgb(0, 0, 0)",
|
||||
text: lang.timeSpent
|
||||
},
|
||||
legend: {
|
||||
labels: {
|
||||
fontColor: "rgb(0, 0, 0)"
|
||||
},
|
||||
onClick: null
|
||||
},
|
||||
scales: {
|
||||
xAxes: [{
|
||||
gridLines: {
|
||||
color: "rgb(0, 0, 0)"
|
||||
},
|
||||
ticks: {
|
||||
fontColor: "rgb(0, 0, 0)"
|
||||
}
|
||||
}],
|
||||
yAxes: [{
|
||||
gridLines: {
|
||||
color: "rgb(0, 0, 0)"
|
||||
},
|
||||
ticks: {
|
||||
fontColor: "rgb(0, 0, 0)",
|
||||
beginAtZero: true
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//chartTimeSpentPie
|
||||
chartTimeSpentPie=new Chart($("#chartTimeSpentPie"), {
|
||||
type: "pie",
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
label: lang.timeSpend,
|
||||
backgroundColor: colorArr,
|
||||
data: timeSpentArr
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: false,
|
||||
title: {
|
||||
display: true,
|
||||
fontColor: "rgb(0, 0, 0)",
|
||||
text: lang.timeSpent
|
||||
},
|
||||
legend: {
|
||||
labels: {
|
||||
fontColor: "rgb(0, 0, 0)"
|
||||
},
|
||||
onClick: null
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//show container
|
||||
$("#analitycs").slideDown();
|
||||
}
|
15
script/sQuiz/lang.json
Normal file
15
script/sQuiz/lang.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"downloadResults":"Download results",
|
||||
"uploadResults":"Upload results",
|
||||
"customAction":"Custom action name goes here",
|
||||
"quizFinished":"Quiz finished!",
|
||||
"resultsGot":"You've got the following results",
|
||||
"yourname":"Your name",
|
||||
"idForResult":"Share this ID with anybody you want to know your results",
|
||||
"timeLeft":"Time left for entire quiz",
|
||||
"timeLeftPerTest":"Time left for this question",
|
||||
"submit":"Submit",
|
||||
"nextQuestion":"Next question",
|
||||
"startQuiz":"Start quiz",
|
||||
"answer":"Answer"
|
||||
}
|
290
script/sQuiz/sQuiz.js
Normal file
290
script/sQuiz/sQuiz.js
Normal file
@ -0,0 +1,290 @@
|
||||
/**
|
||||
* /sQuiz/sQuiz.js
|
||||
* @version 1.4
|
||||
* @desc sQuiz main class file
|
||||
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
* License:
|
||||
sQuiz for creating small jQuery based quizs in an implementable way
|
||||
Copyright (C) 2017 Fándly Gergő Zoltán
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
**/
|
||||
|
||||
(function($){
|
||||
/**
|
||||
* sQuiz(element, quiz)
|
||||
* @desc Creating a new quiz based on a json file
|
||||
* @param $ element Container in which the quiz will be running
|
||||
* @param string quiz A JSON string/JSON object containing an sQuiz parameter list
|
||||
*/
|
||||
$.sQuiz=function(element, quiz){
|
||||
this.element=(element instanceof $)?element:$(element);
|
||||
this.quiz=(typeof quiz=="object")?quiz:JSON.parse(quiz);
|
||||
this.current=-1;
|
||||
this.currentQustion;
|
||||
this.reg;
|
||||
this.countdown;
|
||||
this.elapsedPerTest=(this.quiz.timeLimitPerTest>0)?0:-2;
|
||||
this.elapsed=(this.quiz.timeLimit>0)?0:-2;
|
||||
this.answers=[];
|
||||
this.quizDoneCallback;
|
||||
this.quizDoneOptions;
|
||||
};
|
||||
|
||||
|
||||
$.sQuiz.prototype={
|
||||
/**
|
||||
* sQuiz.setRegionalization(lang)
|
||||
* @desc Assing an Object which has all the needed vars for language (startQuiz, timeRemaining, etc. Full list in /sQuiz/lang.json), or leave it on default for English
|
||||
* @param object lang Object storing language settings
|
||||
*/
|
||||
setRegionalization: function(lang){
|
||||
this.reg=lang;
|
||||
},
|
||||
|
||||
/**
|
||||
* sQuiz.setQuizDoneCallback(callback)
|
||||
* @desc Assign a function to run when the quiz is finished
|
||||
* @param function callback Function to call
|
||||
*/
|
||||
setQuizDoneCallback: function(callback){
|
||||
this.quizDoneCallback=callback;
|
||||
},
|
||||
|
||||
/**
|
||||
* sQuiz.setQuizDoneOptions(options)
|
||||
* @desc Set options to offer when quiz is finished. Set download to true, to offer downloading. Set upload to true, to offer online submit to upload_url. Set custom to a JS function call to do self made stuff. Custom action's label regionalization is customAction.
|
||||
* @param object options Object containing the settings
|
||||
*/
|
||||
setQuizDoneOptions: function(options){
|
||||
this.quizDoneOptions=options;
|
||||
},
|
||||
|
||||
/**
|
||||
* sQuiz.secToTime(sec)
|
||||
* @desc Function for converting seconds to traditional MM:SS format
|
||||
* @param int sec Seconds to convert
|
||||
* @return string
|
||||
*/
|
||||
secToTime: function(sec){
|
||||
var mins=Math.floor(sec/60);
|
||||
var secs=sec%60;
|
||||
var minstr=(mins.toString().length==1)?"0"+mins.toString():mins.toString();
|
||||
var secstr=(secs.toString().length==1)?"0"+secs.toString():secs.toString();
|
||||
var time=minstr+":"+secstr;
|
||||
return time;
|
||||
},
|
||||
|
||||
/**
|
||||
* sQuiz.quizDone()
|
||||
* @desc Function to call when a test is finished
|
||||
*/
|
||||
quizDone: function(){
|
||||
var points=0;
|
||||
$.each(this.answers, function(key, val){
|
||||
if(val.correct){
|
||||
points++;
|
||||
}
|
||||
});
|
||||
|
||||
var self=this;
|
||||
this.element.slideUp(function(){
|
||||
var buttons="<div class=\"sq sq-menu\">";
|
||||
if(self.quizDoneOptions.download==true){
|
||||
buttons+="<button class=\"sq sq-big\" type=\"button\" id=\"sqDownloadResults\"><i class=\"fa fa-save\"></i>"+self.reg.downloadResults+"</button>";
|
||||
}
|
||||
if(self.quizDoneOptions.upload==true){
|
||||
buttons+="<button class=\"sq sq-big\" type=\"button=\" id=\"sqUploadResults\"><i class=\"fa fa-upload\"></i>"+self.reg.uploadResults+"</button>";
|
||||
}
|
||||
if(self.quizDoneOptions.custom!=undefined){
|
||||
buttons+="<button class=\"sq sq-big\" type=\"button=\" id=\"sqCustomAction\" onclick=\""+self.quizDoneOptions.custom+"\">"+self.reg.customAction+"</button>";
|
||||
}
|
||||
buttons+="</div>";
|
||||
|
||||
self.element.html("<h2>"+self.reg.quizFinished+"</h2><hr class=\"sq sq-placeholder\" style=\"height: 10vh\"><div class=\"sq sq-center\"><h3>"+self.reg.resultsGot+": <b>"+points.toString()+"/"+self.quiz.questions.length+"</b></h3><br><br>"+buttons);
|
||||
|
||||
$("#sqDownloadResults").on("click", function(){
|
||||
//store quiz name, description and done date in result file
|
||||
var result={
|
||||
"quizName": self.quiz.name,
|
||||
"quizDesc": self.quiz.description,
|
||||
"doneDate": Date.now(),
|
||||
"answers": self.answers
|
||||
};
|
||||
var json=JSON.stringify(result);
|
||||
var send="text/json;charset=utf-8,"+encodeURIComponent(json);
|
||||
$("<a href=\"data:"+send+"\" download=\""+self.quiz.name+"_answers_sQuiz.json\"></a>")[0].click();
|
||||
});
|
||||
$("#sqUploadResults").on("click", function(){
|
||||
var result={
|
||||
"quizName": self.quiz.name,
|
||||
"quizDesc": self.quiz.description,
|
||||
"doneDate": Date.now(),
|
||||
"answers": self.answers
|
||||
};
|
||||
var json=JSON.stringify(result);
|
||||
var submitter=prompt(self.reg.yourname+":");
|
||||
$.ajax({
|
||||
url: (self.quizDoneOptions.upload_url!=undefined)?self.quizDoneOptions.upload_url:"",
|
||||
type: "POST",
|
||||
data: {
|
||||
"submitResult": json,
|
||||
"submitResult_submitter": submitter
|
||||
},
|
||||
success: function(res){
|
||||
alert(self.reg.idForResult+": "+res);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
self.element.slideDown();
|
||||
});
|
||||
|
||||
var result={
|
||||
"quizName": self.quiz.name,
|
||||
"quizDesc": self.quiz.description,
|
||||
"doneDate": Date.now(),
|
||||
"answers": self.answers
|
||||
};
|
||||
if(this.quizDoneCallback!=undefined){
|
||||
this.quizDoneCallback(result, this.quiz);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* sQuiz.nextQuestion()
|
||||
* @desc Start the next question. Should be called only internally!
|
||||
*/
|
||||
nextQuestion: function(){
|
||||
var self=this;
|
||||
this.current++;
|
||||
|
||||
if(this.current>=this.quiz.questions.length){
|
||||
this.quizDone();
|
||||
}
|
||||
else{
|
||||
var type=this.quiz.questions[this.current].type;
|
||||
this.element.slideUp(function(){
|
||||
var timer="<p id=\"sqTimer\">"+(self.quiz.timeLimit>0?"<b>"+self.reg.timeLeft+":</b> <span id=\"sqTimeLeft\"></span><br>":"")+(self.quiz.timeLimitPerTest>0?"<b>"+self.reg.timeLeftPerTest+":</b> <span id=\"sqTimeLeftPerTest\"></span>":"")+"</p>";
|
||||
var submitbutton="<br><br><div class=\"sq sq-center\"><button class=\"sq green sq-big\" id=\"sqSubmitButton\"><i class=\"fa fa-check\"></i>"+self.reg.submit+"</button></div>";
|
||||
self.element.html(timer+"<hr class=\"sq-placeholder\"><div id=\"sqTestArea\" style=\"overflow: auto\"></div>"+submitbutton);
|
||||
self.element.children("#sqTimeLeft").html(self.secToTime(self.timeLimit));
|
||||
self.element.children("#sqTimeLeftPerTest").html(self.secToTime(self.timeLimitPerTest));
|
||||
self.currentQuestion=new $["sQuiz_module_"+type](self, self.quiz.questions[self.current]);
|
||||
|
||||
$("#sqSubmitButton").on("click", function(){
|
||||
self.currentQuestion.submit();
|
||||
$("#sqSubmitButton").unbind();
|
||||
$("#sqSubmitButton").fadeOut(function(){
|
||||
$(this).html("<i class=\"fa fa-arrow-right\"></i>"+self.reg.nextQuestion);
|
||||
$(this).fadeIn();
|
||||
});
|
||||
$("#sqSubmitButton").on("click", function(){
|
||||
self.nextQuestion();
|
||||
});
|
||||
});
|
||||
|
||||
self.currentQuestion.load();
|
||||
self.element.slideDown(function(){
|
||||
self.startTimer();
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* sQuiz.init()
|
||||
* @desc set up styles and so for the container
|
||||
*/
|
||||
init: function(){
|
||||
var self=this;
|
||||
|
||||
if(this.reg==undefined){
|
||||
this.reg={
|
||||
"downloadResults":"Download results",
|
||||
"uploadResults":"Upload results",
|
||||
"customAction":"Custom action name goes here",
|
||||
"quizFinished":"Quiz finished!",
|
||||
"resultsGot":"You've got the following results",
|
||||
"yourname":"Your name",
|
||||
"idForResult":"Share this ID with anybody you want to know your results",
|
||||
"timeLeft":"Time left for entire quiz",
|
||||
"timeLeftPerTest":"Time left for this question",
|
||||
"submit":"Submit",
|
||||
"nextQuestion":"Next question",
|
||||
"startQuiz":"Start quiz",
|
||||
"answer":"Answer"
|
||||
};
|
||||
}
|
||||
|
||||
this.element.hide();
|
||||
this.element.addClass("sq sq-container");
|
||||
this.element.html("<hr class=\"sq sq-placeholder\" style=\"height: 20vh\"><h2>"+this.quiz.name+"</h2><p>"+this.quiz.description+"</p><hr><div class=\"sq sq-center\"><button class=\"sq sq-big\" id=\"sqStart\">"+this.reg.startQuiz+"</button></div>");
|
||||
$("#sqStart").on("click", function(){
|
||||
self.nextQuestion();
|
||||
});
|
||||
this.element.slideDown();
|
||||
},
|
||||
|
||||
/**
|
||||
* sQuiz.startTimer
|
||||
* @desc Starts the countdown
|
||||
*/
|
||||
startTimer: function(){
|
||||
var self=this;
|
||||
this.elapsedPerTest=0;
|
||||
if(this.quiz.timeLimitPerTest>0 || this.quiz.timeLimit>0){
|
||||
if(self.quiz.timeLimitPerTest>0){
|
||||
self.elapsedPerTest++;
|
||||
self.element.children("#sqTimer").children("#sqTimeLeftPerTest").html(self.secToTime(self.quiz.timeLimitPerTest-self.elapsedPerTest));
|
||||
if(self.elapsedPerTest>=self.quiz.timeLimitPerTest){
|
||||
$("#sqSubmitButton")[0].click();
|
||||
}
|
||||
}
|
||||
if(self.quiz.timeLimit>0){
|
||||
self.elapsed++;
|
||||
self.element.children("#sqTimer").children("#sqTimeLeft").html(self.secToTime(self.quiz.timeLimit-self.elapsed));
|
||||
if(self.elapsed>=self.quiz.timeLimit){
|
||||
$("#sqSubmitButton")[0].click();
|
||||
}
|
||||
}
|
||||
}
|
||||
this.countdown=window.setInterval(function(self){
|
||||
self.elapsedPerTest++;
|
||||
if(self.quiz.timeLimitPerTest>0){
|
||||
self.element.children("#sqTimer").children("#sqTimeLeftPerTest").html(self.secToTime(self.quiz.timeLimitPerTest-self.elapsedPerTest));
|
||||
if(self.elapsedPerTest>=self.quiz.timeLimitPerTest){
|
||||
$("#sqSubmitButton")[0].click();
|
||||
}
|
||||
}
|
||||
if(self.quiz.timeLimit>0){
|
||||
self.elapsed++;
|
||||
self.element.children("#sqTimer").children("#sqTimeLeft").html(self.secToTime(self.quiz.timeLimit-self.elapsed));
|
||||
if(self.elapsed>=self.quiz.timeLimit){
|
||||
$("#sqSubmitButton")[0].click();
|
||||
}
|
||||
}
|
||||
}, 1000, self);
|
||||
},
|
||||
|
||||
/**
|
||||
* sQuiz.stopTimer
|
||||
* @desc Stops the countdown
|
||||
*/
|
||||
stopTimer: function(){
|
||||
clearInterval(this.countdown);
|
||||
}
|
||||
}
|
||||
}(jQuery));
|
155
script/sQuiz/sQuiz_module_connectGraph.js
Normal file
155
script/sQuiz/sQuiz_module_connectGraph.js
Normal file
@ -0,0 +1,155 @@
|
||||
/**
|
||||
* /sQuiz/sQuiz_module_connectGraph.js
|
||||
* @version 1.3
|
||||
* @desc sQuiz class for connectGraphs
|
||||
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
* License:
|
||||
sQuiz for creating small jQuery based quizs in an implementable way
|
||||
Copyright (C) 2017 Fándly Gergő Zoltán
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
**/
|
||||
|
||||
(function($){
|
||||
$.sQuiz_module_connectGraph=function(parent, quiz){
|
||||
this.parent=parent;
|
||||
this.quiz=quiz;
|
||||
this.container=parent.element.children("#sqTestArea");
|
||||
this.qidMap={};
|
||||
this.currentlyClicked=null;
|
||||
};
|
||||
|
||||
$.sQuiz_module_connectGraph.prototype={
|
||||
submit: function(){
|
||||
var self=this;
|
||||
this.parent.stopTimer();
|
||||
var sub={};
|
||||
|
||||
sub.answered=[];
|
||||
sub.correct=true;
|
||||
jsPlumb.reset();
|
||||
$(this.container).children("div[data-qid=pair1]").children("i").each(function(){
|
||||
if($(this).data("connectedTo")==undefined || $(this).data("connectedTo")=="--NULL--"){
|
||||
sub.answered.push({pair1: $(this).data("value"), pair2: "null"});
|
||||
$(this).addClass("sq-red");
|
||||
sub.correct=false;
|
||||
}
|
||||
else{
|
||||
for(var i=0; i<self.quiz.answers.length; i++){
|
||||
if(self.quiz.answers[i].pair1==$(this).data("value")){
|
||||
if(self.quiz.answers[i].pair2==$(this).data("connectedTo")){
|
||||
$(this).addClass("sq-green");
|
||||
self.container.children("div[data-qid=pair2]").children("i[data-value="+$(this).data("connectedTo")+"]").addClass("sq-green");
|
||||
jsPlumb.connect({
|
||||
source: $(this),
|
||||
target: self.container.children("div[data-qid=pair2]").children("i[data-value="+$(this).data("connectedTo")+"]"),
|
||||
anchor: "Center",
|
||||
paintStyle: {
|
||||
stroke: "rgba(74,230,74,0.9)",
|
||||
strokeWidth: 10
|
||||
},
|
||||
endpoint: "Dot",
|
||||
endpointStyle: {
|
||||
fill: "rgba(74,230,74,0.9)",
|
||||
radius: 12
|
||||
},
|
||||
detachable: false
|
||||
});
|
||||
}
|
||||
else{
|
||||
$(this).addClass("sq-red");
|
||||
self.container.children("div[data-qid=pair2]").children("i[data-value=\""+$(this).data("connectedTo")+"\"]").addClass("sq-red");
|
||||
jsPlumb.connect({
|
||||
source: $(this),
|
||||
target: self.container.children("div[data-qid=pair2]").children("i[data-value=\""+$(this).data("connectedTo")+"\"]"),
|
||||
anchor: "Center",
|
||||
paintStyle: {
|
||||
stroke: "rgba(230,74,74,0.9)",
|
||||
strokeWidth: 10
|
||||
},
|
||||
endpoint: "Dot",
|
||||
endpointStyle: {
|
||||
fill: "rgba(230,74,74,0.9)",
|
||||
radius: 12
|
||||
},
|
||||
detachable: false
|
||||
});
|
||||
sub.correct=false;
|
||||
}
|
||||
|
||||
sub.answered.push({pair: $(this).data("value"), pair2: $(this).data("connectedTo")});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
sub.timeElapsed=this.parent.elapsedPerTest;
|
||||
this.parent.answers.push(sub);
|
||||
},
|
||||
|
||||
load: function(){
|
||||
var self=this;
|
||||
jsPlumb.reset();
|
||||
jsPlumb.setContainer(this.container);
|
||||
|
||||
var qid=0;
|
||||
var pair1="";
|
||||
var pair2="";
|
||||
$.each(this.quiz.answers, function(key, val){
|
||||
pair1+="<span style=\"font-size: 2em\">"+val.pair1+"</span> <i class=\"fa fa-circle fa-2x\" id=\"sqPoint"+qid.toString()+"\" data-qid=\""+qid.toString()+"\" data-value=\""+val.pair1+"\" data-connectedTo=\"--NULL--\"></i><br><br>";
|
||||
qid++;
|
||||
});
|
||||
var qidp1=qid;
|
||||
var p2=this.quiz.answers.slice();
|
||||
while(p2.length>0){
|
||||
var index=Math.floor(Math.random()*p2.length);
|
||||
pair2+="<i class=\"fa fa-circle fa-2x\" id=\"sqPoint"+qid.toString()+"\" data-qid=\""+qid.toString()+"\" data-value=\""+p2[index].pair2+"\"></i> <span style=\"font-size: 2em\">"+p2[index].pair2+"</span><br><br>";
|
||||
qid++;
|
||||
p2.splice(index, 1);
|
||||
}
|
||||
|
||||
this.container.html("<h2>"+this.quiz.question+"</h2><br><div data-qid=\"pair1\" style=\"float: left; text-align: right\">"+pair1+"</div><div data-qid=\"pair2\" style=\"float: right; text-align: left\">"+pair2+"</div>");
|
||||
|
||||
this.parent.element.slideDown(function(){
|
||||
var typic={
|
||||
anchor: "Center",
|
||||
connectorStyle: {
|
||||
stroke: "rgb(0,0,0)",
|
||||
strokeWidth: 10
|
||||
},
|
||||
endpoint: "Dot",
|
||||
endpointStyle: {
|
||||
fill: "rgb(0,0,0)",
|
||||
radius: 12
|
||||
}
|
||||
};
|
||||
for(var i=0; i<qidp1; i++){
|
||||
jsPlumb.addEndpoint("sqPoint"+i.toString(), {isSource: true, isTarget: false}, typic);
|
||||
}
|
||||
for(var i=qidp1; i<qid; i++){
|
||||
jsPlumb.addEndpoint("sqPoint"+i.toString(), {isSource: false, isTarget: true}, typic);
|
||||
}
|
||||
|
||||
jsPlumb.bind("connection", function(info){
|
||||
$(info.source).data("connectedTo", $(info.target).data("value"));
|
||||
});
|
||||
jsPlumb.bind("connectionDetached", function(info){
|
||||
$(info.source).data("connectedTo", "--NULL--");
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
}(jQuery));
|
115
script/sQuiz/sQuiz_module_fillIn.js
Normal file
115
script/sQuiz/sQuiz_module_fillIn.js
Normal file
@ -0,0 +1,115 @@
|
||||
/**
|
||||
* /sQuiz/sQuiz_module_fillIn.js
|
||||
* @version 1.0
|
||||
* @desc sQuiz class for fillIns
|
||||
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
* License:
|
||||
sQuiz for creating small jQuery based quizs in an implementable way
|
||||
Copyright (C) 2017 Fándly Gergő Zoltán
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
**/
|
||||
|
||||
(function($){
|
||||
$.sQuiz_module_fillIn=function(parent, quiz){
|
||||
this.parent=parent;
|
||||
this.quiz=quiz;
|
||||
this.container=parent.element.children("#sqTestArea");
|
||||
this.qidMap={};
|
||||
this.answers=[];
|
||||
};
|
||||
|
||||
$.sQuiz_module_fillIn.prototype={
|
||||
submit: function(){
|
||||
var self=this;
|
||||
this.parent.stopTimer();
|
||||
var sub={};
|
||||
|
||||
this.container.children("div[data-qid=fillers]").children("span[data-qid=filler]").draggable("disable");
|
||||
|
||||
sub.answered=[];
|
||||
sub.correct=true;
|
||||
var i=0;
|
||||
this.container.children("p[data-qid=text]").children("span[data-qid=fillable]").each(function(){
|
||||
if($(this).data("filledWith")==undefined || $(this).data("filledWith")=="--NULL--"){
|
||||
sub.answered.push("null");
|
||||
sub.correct=false;
|
||||
self.container.children("div[data-qid=fillers]").children("span[data-qid=filler][data-attached=false]").addClass("red");
|
||||
}
|
||||
else{
|
||||
if($(this).data("filledWith")==self.answers[i]){
|
||||
$(this).data("attached").addClass("green");
|
||||
}
|
||||
else{
|
||||
$(this).data("attached").addClass("red");
|
||||
sub.correct=false;
|
||||
}
|
||||
sub.answered.push($(this).data("filledWith"));
|
||||
}
|
||||
i++;
|
||||
});
|
||||
sub.timeElapsed=this.parent.elapsedPerTest;
|
||||
this.parent.answers.push(sub);
|
||||
},
|
||||
|
||||
load: function(){
|
||||
var qid=0;
|
||||
|
||||
var replacer="<span data-qid=\"fillable\" class=\"sq sq-droppable\" data-filledWith=\"--NULL--\"></span>"
|
||||
var fillable=this.quiz.text;
|
||||
fillable=fillable.replace(new RegExp(/[\n]/g), "<br>");
|
||||
fillable=fillable.replace(new RegExp(/\[\][^\[\]]+\[\/\]/g), replacer);
|
||||
|
||||
var fillers=[];
|
||||
var res;
|
||||
var reg=new RegExp(/\[\]([^\[\]]+)\[\/\]/g);
|
||||
while((res=reg.exec(this.quiz.text))!==null){
|
||||
fillers.push("<span data-qid=\"filler\" data-value=\""+res[1]+"\" data-attached=\"false\" class=\"sq sq-draggable\">"+res[1]+"</span>");
|
||||
this.answers.push(res[1]);
|
||||
}
|
||||
var fillerstr="";
|
||||
while(fillers.length>0){
|
||||
var index=Math.floor(Math.random()*fillers.length);
|
||||
fillerstr+=fillers[index];
|
||||
fillers.splice(index, 1);
|
||||
}
|
||||
|
||||
this.container.html("<h2>"+this.quiz.question+"</h2><br><p data-qid=\"text\" style=\"font-size: 1.3em\">"+fillable+"</p><hr class=\"sq sq-placeholder\"><div data-qid=\"fillers\">"+fillerstr+"</div>");
|
||||
|
||||
//init drag 'n' drop
|
||||
this.container.children("p[data-qid=text]").children("span[data-qid=fillable]").droppable({
|
||||
tolerance: "pointer",
|
||||
drop: function(event, ui){
|
||||
ui.draggable.position({
|
||||
of: $(this),
|
||||
my: "left top",
|
||||
at: "left top"
|
||||
});
|
||||
$(this).data("filledWith", ui.draggable.data("value"));
|
||||
$(this).data("attached", ui.draggable);
|
||||
ui.draggable.data("attached", "true");
|
||||
},
|
||||
out: function(event, ui){
|
||||
$(this).data("filledWith", "--NULL--");
|
||||
ui.draggable.data("attached", "false");
|
||||
}
|
||||
});
|
||||
|
||||
this.container.children("div[data-qid=fillers]").children("span[data-qid=filler]").draggable({
|
||||
cursor: "move"
|
||||
});
|
||||
}
|
||||
};
|
||||
}(jQuery));
|
88
script/sQuiz/sQuiz_module_markOnMap.js
Normal file
88
script/sQuiz/sQuiz_module_markOnMap.js
Normal file
@ -0,0 +1,88 @@
|
||||
/**
|
||||
* /sQuiz/sQuiz_module_markOnMap.js
|
||||
* @version 1.2
|
||||
* @desc sQuiz class for markOnMaps
|
||||
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
* License:
|
||||
sQuiz for creating small jQuery based quizs in an implementable way
|
||||
Copyright (C) 2017 Fándly Gergő Zoltán
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
**/
|
||||
|
||||
(function($){
|
||||
$.sQuiz_module_markOnMap=function(parent, quiz){
|
||||
this.parent=parent;
|
||||
this.quiz=quiz;
|
||||
this.container=parent.element.children("#sqTestArea");
|
||||
this.qidMap={};
|
||||
};
|
||||
|
||||
$.sQuiz_module_markOnMap.prototype={
|
||||
submit: function(){
|
||||
var self=this;
|
||||
this.parent.stopTimer();
|
||||
var sub={};
|
||||
|
||||
//unbind handlers
|
||||
this.container.children("div[data-qid=mapArea]").children("div[data-qid=markers]").children("i[data-qid=marker]").off();
|
||||
|
||||
sub.answers=[];
|
||||
sub.correct=true;
|
||||
this.container.children("div[data-qid=mapArea]").children("div[data-qid=markers]").children("i[data-qid=marker]").each(function(){
|
||||
for(var i=0; i<self.quiz.markers.length; i++){
|
||||
if(self.quiz.markers[i].posx==$(this).data("posx") && self.quiz.markers[i].posy==$(this).data("posy")){
|
||||
var selected=$(this).data("selected");
|
||||
if(self.quiz.markers[i].correct==selected){
|
||||
$(this).addClass("sq-green");
|
||||
}
|
||||
else{
|
||||
$(this).addClass("sq-red");
|
||||
sub.correct=false;
|
||||
}
|
||||
sub.answers.push({posx: $(this).data("posx"), posy: $(this).data("posy"), selected: selected});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
sub.timeElapsed=this.parent.elapsedPerTest;
|
||||
this.parent.answers.push(sub);
|
||||
},
|
||||
|
||||
load: function(){
|
||||
var map="<img src=\""+this.quiz.map+"\" alt=\"map to fill\">";
|
||||
|
||||
var markers="";
|
||||
$.each(this.quiz.markers, function(key, val){
|
||||
markers+="<i class=\"fa fa-circle\" style=\"position: absolute; top: "+val.posy.toString()+"px; left: "+val.posx.toString()+"px\" data-posx=\""+val.posx.toString()+"\" data-posy=\""+val.posy.toString()+"\" data-qid=\"marker\" data-selected=\"false\"></i>";
|
||||
});
|
||||
|
||||
this.container.html("<h2>"+this.quiz.question+"</h2><br><div class=\"sq sq-center sq-mapArea\" data-qid=\"mapArea\">"+map+"<div data-qid=\"markers\">"+markers+"</div></div>");
|
||||
|
||||
this.container.children("div[data-qid=mapArea]").children("div[data-qid=markers]").children("i[data-qid=marker]").on("click", function(){
|
||||
if($(this).data("selected")==false){
|
||||
$(this).removeClass("fa-circle");
|
||||
$(this).addClass("fa-check-circle");
|
||||
$(this).data("selected", true);
|
||||
}
|
||||
else{
|
||||
$(this).removeClass("fa-check-circle");
|
||||
$(this).addClass("fa-circle");
|
||||
$(this).data("selected", false);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}(jQuery));
|
58
script/sQuiz/sQuiz_module_simpleQuestion.js
Normal file
58
script/sQuiz/sQuiz_module_simpleQuestion.js
Normal file
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* /sQuiz/sQuiz_module_simpleQuestion.js
|
||||
* @version 1.2
|
||||
* @desc sQuiz class for simpleQuestions
|
||||
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
* License:
|
||||
sQuiz for creating small jQuery based quizs in an implementable way
|
||||
Copyright (C) 2017 Fándly Gergő Zoltán
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
**/
|
||||
|
||||
(function($){
|
||||
$.sQuiz_module_simpleQuestion=function(parent, quiz){
|
||||
this.parent=parent;
|
||||
this.quiz=quiz;
|
||||
this.container=parent.element.children("#sqTestArea");
|
||||
this.qidMap={};
|
||||
};
|
||||
|
||||
$.sQuiz_module_simpleQuestion.prototype={
|
||||
submit: function(){
|
||||
var self=this;
|
||||
this.parent.stopTimer();
|
||||
var sub={};
|
||||
sub.answered=this.container.children("input[data-qid="+this.qidMap["answer"]+"]").val();
|
||||
if(sub.answered.toLowerCase()==this.quiz.answer){
|
||||
this.container.children("input[data-qid="+this.qidMap["answer"]+"]").addClass("sq-green");
|
||||
sub.correct=true;
|
||||
}
|
||||
else{
|
||||
this.container.children("input[data-qid="+this.qidMap["answer"]+"]").addClass("sq-red");
|
||||
sub.correct=false;
|
||||
}
|
||||
sub.timeElapsed=this.parent.elapsedPerTest;
|
||||
this.parent.answers.push(sub);
|
||||
},
|
||||
|
||||
load: function(){
|
||||
var qid=0;
|
||||
this.container.html("<h2>"+this.quiz.question+"</h2><br><p>"+this.parent.reg.answer+":</p><input type=\"text\" class=\"sq\" data-qid=\""+qid.toString()+"\" placeholder=\""+this.parent.reg.answer+"...\">");
|
||||
this.qidMap["answer"]=qid;
|
||||
$("input[data-qid="+this.qidMap["answer"]+"]").focus();
|
||||
}
|
||||
};
|
||||
}(jQuery));
|
81
script/sQuiz/sQuiz_module_simpleSelect.js
Normal file
81
script/sQuiz/sQuiz_module_simpleSelect.js
Normal file
@ -0,0 +1,81 @@
|
||||
/**
|
||||
* /sQuiz/sQuiz_module_simpleSelect.js
|
||||
* @version 1.3
|
||||
* @desc sQuiz class for simpleSelects
|
||||
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
* License:
|
||||
sQuiz for creating small jQuery based quizs in an implementable way
|
||||
Copyright (C) 2017 Fándly Gergő Zoltán
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
**/
|
||||
|
||||
(function($){
|
||||
$.sQuiz_module_simpleSelect=function(parent, quiz){
|
||||
this.parent=parent;
|
||||
this.quiz=quiz;
|
||||
this.container=parent.element.children("#sqTestArea");
|
||||
this.qidMap={};
|
||||
};
|
||||
|
||||
$.sQuiz_module_simpleSelect.prototype={
|
||||
submit: function(){
|
||||
var self=this;
|
||||
this.parent.stopTimer();
|
||||
this.container.children("i").off();
|
||||
var sub={};
|
||||
|
||||
sub.answered=[];
|
||||
sub.correct=true;
|
||||
this.container.children("i").each(function(index){
|
||||
var checked=($(this).data("checked")=="true")?true:false;
|
||||
if(checked==self.quiz.answers[index].correct){
|
||||
$(this).addClass("sq-green");
|
||||
}
|
||||
else{
|
||||
sub.correct=false;
|
||||
$(this).addClass("sq-red");
|
||||
}
|
||||
sub.answered.push(checked);
|
||||
});
|
||||
sub.timeElapsed=this.parent.elapsedPerTest;
|
||||
this.parent.answers.push(sub);
|
||||
},
|
||||
|
||||
load: function(){
|
||||
var qid=0;
|
||||
var answers="";
|
||||
$.each(this.quiz.answers, function(key, val){
|
||||
answers+="<i class=\"fa fa-square fa-2x\" data-qid=\""+qid.toString+"\" data-checked=\"false\"></i> <span style=\"font-size: 2em\">"+val.answer+"</span><br><br>";
|
||||
qid++;
|
||||
});
|
||||
|
||||
this.container.html("<h2>"+this.quiz.question+"</h2><br>"+answers);
|
||||
|
||||
this.container.children("i").on("click", function(){
|
||||
if($(this).hasClass("fa-square")){
|
||||
$(this).removeClass("fa-square");
|
||||
$(this).addClass("fa-check-square");
|
||||
$(this).data("checked", "true");
|
||||
}
|
||||
else{
|
||||
$(this).removeClass("fa-check-square");
|
||||
$(this).addClass("fa-square");
|
||||
$(this).data("checked", "false");
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}(jQuery));
|
137
script/sQuiz/style/sQuiz.css
Normal file
137
script/sQuiz/style/sQuiz.css
Normal file
@ -0,0 +1,137 @@
|
||||
/**
|
||||
* /sQuiz/style/sQuiz.css
|
||||
* @version 1.1
|
||||
* @desc Style file for sQuiz
|
||||
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
* License:
|
||||
sQuiz for creating small jQuery based quizs in an implementable way
|
||||
Copyright (C) 2017 Fándly Gergő Zoltán
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
**/
|
||||
|
||||
.sq.sq-container{
|
||||
margin: auto;
|
||||
background: rgba(34,168,186,0.7);
|
||||
padding: 1em;
|
||||
border-radius: 0.5em;
|
||||
border: 1px solid rgba(28,157,175,0.9);
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
.sq.sq-center{
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
hr.sq.sq-placeholder{
|
||||
border: none;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
div.sq.sq-mapArea{
|
||||
position: relative;
|
||||
width: fit-content;
|
||||
}
|
||||
div.sq.sq-mapArea div{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
button.sq{
|
||||
background: rgba(34,168,186,0.9);
|
||||
padding: 1em;
|
||||
border-radius: 0.5em;
|
||||
border: 1px solid rgba(28,157,175,0.9);
|
||||
}
|
||||
button.sq:hover{
|
||||
background: rgba(24,148,165,0.9);
|
||||
}
|
||||
button.sq.sq-big{
|
||||
font-size: 3em;
|
||||
padding: 1em;
|
||||
padding-top: 4em;
|
||||
padding-bottom: 4em;
|
||||
width: 9em;
|
||||
}
|
||||
button.sq.red{
|
||||
background: rgba(230,74,74,0.9);
|
||||
border: 1px solid rgba(187,48,48,0.9);
|
||||
}
|
||||
button.sq.red:hover{
|
||||
background: rgba(200,54,54,0.9);
|
||||
}
|
||||
button.sq.green{
|
||||
background: rgba(74,230,74,0.9);
|
||||
border: 1px solid rgba(48,487,48,0.9);
|
||||
}
|
||||
button.sq.green:hover{
|
||||
background: rgba(54,200,54,0.9);
|
||||
}
|
||||
|
||||
input.sq{
|
||||
border-radius: 5px;
|
||||
padding: 0.5em;
|
||||
border: 1px solid rgba(28,157,175,0.9);
|
||||
width: 90%;
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
.sq-red{
|
||||
color: rgba(230,74,74,0.9);
|
||||
}
|
||||
.sq-green{
|
||||
color: rgba(74,230,74,0.9);
|
||||
}
|
||||
|
||||
span.sq.sq-draggable{
|
||||
height: 1.3em;
|
||||
width: 10em;
|
||||
padding: 0.5em;
|
||||
margin: 1em;
|
||||
overflow: auto;
|
||||
cursor: move;
|
||||
color: rgb(255,255,255);
|
||||
background: rgb(130,130,130);
|
||||
display: inline-block;
|
||||
font-size: 1.3em;
|
||||
border-radius: 0.3em;
|
||||
}
|
||||
span.sq.sq-draggable.red{
|
||||
background: rgba(230,74,74,0.9);
|
||||
}
|
||||
span.sq.sq-draggable.green{
|
||||
background: rgba(74,230,74,0.9);
|
||||
}
|
||||
span.sq.sq-droppable{
|
||||
height: 2em;
|
||||
width: 10.7em;
|
||||
margin: 0 0.3em;
|
||||
overflow: auto;
|
||||
color: rgb(255,255,255);
|
||||
border: 3px dashed rgb(130,130,130);
|
||||
display: inline-block;
|
||||
border-radius: 0.3em;
|
||||
}
|
||||
|
||||
div.sq.sq-menu{
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
flex-wrap: wrap;
|
||||
width: 99%;
|
||||
}
|
163
script/screenfull.js
Normal file
163
script/screenfull.js
Normal file
@ -0,0 +1,163 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var document = typeof window !== 'undefined' && typeof window.document !== 'undefined' ? window.document : {};
|
||||
var isCommonjs = typeof module !== 'undefined' && module.exports;
|
||||
var keyboardAllowed = typeof Element !== 'undefined' && 'ALLOW_KEYBOARD_INPUT' in Element;
|
||||
|
||||
var fn = (function () {
|
||||
var val;
|
||||
|
||||
var fnMap = [
|
||||
[
|
||||
'requestFullscreen',
|
||||
'exitFullscreen',
|
||||
'fullscreenElement',
|
||||
'fullscreenEnabled',
|
||||
'fullscreenchange',
|
||||
'fullscreenerror'
|
||||
],
|
||||
// New WebKit
|
||||
[
|
||||
'webkitRequestFullscreen',
|
||||
'webkitExitFullscreen',
|
||||
'webkitFullscreenElement',
|
||||
'webkitFullscreenEnabled',
|
||||
'webkitfullscreenchange',
|
||||
'webkitfullscreenerror'
|
||||
|
||||
],
|
||||
// Old WebKit (Safari 5.1)
|
||||
[
|
||||
'webkitRequestFullScreen',
|
||||
'webkitCancelFullScreen',
|
||||
'webkitCurrentFullScreenElement',
|
||||
'webkitCancelFullScreen',
|
||||
'webkitfullscreenchange',
|
||||
'webkitfullscreenerror'
|
||||
|
||||
],
|
||||
[
|
||||
'mozRequestFullScreen',
|
||||
'mozCancelFullScreen',
|
||||
'mozFullScreenElement',
|
||||
'mozFullScreenEnabled',
|
||||
'mozfullscreenchange',
|
||||
'mozfullscreenerror'
|
||||
],
|
||||
[
|
||||
'msRequestFullscreen',
|
||||
'msExitFullscreen',
|
||||
'msFullscreenElement',
|
||||
'msFullscreenEnabled',
|
||||
'MSFullscreenChange',
|
||||
'MSFullscreenError'
|
||||
]
|
||||
];
|
||||
|
||||
var i = 0;
|
||||
var l = fnMap.length;
|
||||
var ret = {};
|
||||
|
||||
for (; i < l; i++) {
|
||||
val = fnMap[i];
|
||||
if (val && val[1] in document) {
|
||||
for (i = 0; i < val.length; i++) {
|
||||
ret[fnMap[0][i]] = val[i];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
})();
|
||||
|
||||
var eventNameMap = {
|
||||
change: fn.fullscreenchange,
|
||||
error: fn.fullscreenerror
|
||||
};
|
||||
|
||||
var screenfull = {
|
||||
request: function (elem) {
|
||||
var request = fn.requestFullscreen;
|
||||
|
||||
elem = elem || document.documentElement;
|
||||
|
||||
// Work around Safari 5.1 bug: reports support for
|
||||
// keyboard in fullscreen even though it doesn't.
|
||||
// Browser sniffing, since the alternative with
|
||||
// setTimeout is even worse.
|
||||
if (/ Version\/5\.1(?:\.\d+)? Safari\//.test(navigator.userAgent)) {
|
||||
elem[request]();
|
||||
} else {
|
||||
elem[request](keyboardAllowed && Element.ALLOW_KEYBOARD_INPUT);
|
||||
}
|
||||
},
|
||||
exit: function () {
|
||||
document[fn.exitFullscreen]();
|
||||
},
|
||||
toggle: function (elem) {
|
||||
if (this.isFullscreen) {
|
||||
this.exit();
|
||||
} else {
|
||||
this.request(elem);
|
||||
}
|
||||
},
|
||||
onchange: function (callback) {
|
||||
this.on('change', callback);
|
||||
},
|
||||
onerror: function (callback) {
|
||||
this.on('error', callback);
|
||||
},
|
||||
on: function (event, callback) {
|
||||
var eventName = eventNameMap[event];
|
||||
if (eventName) {
|
||||
document.addEventListener(eventName, callback, false);
|
||||
}
|
||||
},
|
||||
off: function (event, callback) {
|
||||
var eventName = eventNameMap[event];
|
||||
if (eventName) {
|
||||
document.removeEventListener(eventName, callback, false);
|
||||
}
|
||||
},
|
||||
raw: fn
|
||||
};
|
||||
|
||||
if (!fn) {
|
||||
if (isCommonjs) {
|
||||
module.exports = false;
|
||||
} else {
|
||||
window.screenfull = false;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Object.defineProperties(screenfull, {
|
||||
isFullscreen: {
|
||||
get: function () {
|
||||
return Boolean(document[fn.fullscreenElement]);
|
||||
}
|
||||
},
|
||||
element: {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return document[fn.fullscreenElement];
|
||||
}
|
||||
},
|
||||
enabled: {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
// Coerce to boolean in case of old WebKit
|
||||
return Boolean(document[fn.fullscreenEnabled]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (isCommonjs) {
|
||||
module.exports = screenfull;
|
||||
} else {
|
||||
window.screenfull = screenfull;
|
||||
}
|
||||
})();
|
92
script/script.js
Normal file
92
script/script.js
Normal file
@ -0,0 +1,92 @@
|
||||
/**
|
||||
* /script/script.js
|
||||
* @version 1.6
|
||||
* @desc Main script file
|
||||
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
* License:
|
||||
sQuiz for creating small jQuery based quizs in an implementable way
|
||||
Copyright (C) 2017 Fándly Gergő Zoltán
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
**/
|
||||
|
||||
//load language
|
||||
var lang;
|
||||
function loadLang(){
|
||||
$.each(lang, function(key, val) {
|
||||
var repl=$("title").html().replace(new RegExp("{{"+key+"}}", "g"), val);
|
||||
$("title").html(repl);
|
||||
repl=$("body").html().replace(new RegExp("{{"+key+"}}", "g"), val);
|
||||
$("body").html(repl);
|
||||
window.cookieconsent_options={
|
||||
message: lang.cookie_message,
|
||||
dismiss: lang.cookie_dismiss,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//switch pages
|
||||
function goTo(site, pop=false){
|
||||
Site=site;
|
||||
//slide up
|
||||
$("#content").slideUp(function(){
|
||||
//load part
|
||||
$.ajax({
|
||||
url: "./"+site,
|
||||
type: "GET",
|
||||
success: function(response){
|
||||
$("#content").html(response);
|
||||
if(!pop){
|
||||
window.history.pushState({"site": site}, null, "./");
|
||||
}
|
||||
},
|
||||
complete: function(){
|
||||
loadLang();
|
||||
$("#content").slideDown();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//toggle element visibility
|
||||
function toggleElement(sel){
|
||||
sel=(sel instanceof $)?sel:$(sel);
|
||||
if(sel.css("display")=="none"){
|
||||
sel.slideDown();
|
||||
}
|
||||
else{
|
||||
sel.slideUp();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//load
|
||||
$(document).ready(function(){
|
||||
$.getJSON("lang.json", function(json){
|
||||
lang=json;
|
||||
loadLang();
|
||||
});
|
||||
|
||||
window.addEventListener("popstate", function(e){
|
||||
if(e.state!=null){
|
||||
goTo(e.state["site"], true);
|
||||
}
|
||||
else{
|
||||
goTo("indexc.html", true);
|
||||
}
|
||||
});
|
||||
});
|
132
script/tester.js
Normal file
132
script/tester.js
Normal file
@ -0,0 +1,132 @@
|
||||
/**
|
||||
* /script/tester.js
|
||||
* @version 1.3
|
||||
* @desc Script file for the tester page (not the actual sQuizEngine yet. :P)
|
||||
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
* License:
|
||||
sQuiz for creating small jQuery based quizs in an implementable way
|
||||
Copyright (C) 2017 Fándly Gergő Zoltán
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
**/
|
||||
|
||||
function showSelector(){
|
||||
$("#list").slideUp();
|
||||
$("#fromfile").slideUp();
|
||||
$("#fromurl").slideUp();
|
||||
$("#sQuiz").slideUp();
|
||||
$("#menuwrapper").slideDown();
|
||||
$("#back").attr("onclick", "window.history.back()");
|
||||
}
|
||||
|
||||
function loadFromList(){
|
||||
$("#back").attr("onclick", "showSelector()");
|
||||
$("#menuwrapper").slideUp();
|
||||
$.getJSON("./tests/main.json", function(json){
|
||||
var list;
|
||||
|
||||
if(!json.locallist){
|
||||
//get list from server
|
||||
$.getJSON("./engine/engine.php?list", function(json){
|
||||
list=json;
|
||||
$("#listcontent").html("");
|
||||
$.each(list, function(key, val){
|
||||
var push="<tr>";
|
||||
push+="<td>"+(parseInt(key)+1).toString()+"</td>";
|
||||
push+="<td>"+val.name+"</td>";
|
||||
push+="<td>"+val.description+"</td>";
|
||||
push+="<td><button type=\"button\" onclick=\"startQuiz('"+val.file+"')\">"+lang.solve+"</td>";
|
||||
push+="</tr>";
|
||||
$("#listcontent").append(push);
|
||||
});
|
||||
$("#list table").footable();
|
||||
$("#list").slideDown();
|
||||
});
|
||||
}
|
||||
else{
|
||||
//get list from locallist
|
||||
list=json.available;
|
||||
$("#listcontent").html("");
|
||||
$.each(list, function(key, val){
|
||||
var push="<tr>";
|
||||
push+="<td>"+(parseInt(key)+1).toString()+"</td>";
|
||||
push+="<td>"+val.name+"</td>";
|
||||
push+="<td>"+val.description+"</td>";
|
||||
push+="<td><button type=\"button\" onclick=\"startQuiz('"+val.file+"')\">"+lang.solve+"</td>";
|
||||
push+="</tr>";
|
||||
$("#listcontent").append(push);
|
||||
});
|
||||
$("#list table").footable();
|
||||
$("#list").slideDown();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadFromFile(){
|
||||
$("#back").attr("onclick", "showSelector()");
|
||||
$("#menuwrapper").slideUp();
|
||||
$("#fromfile").slideDown();
|
||||
}
|
||||
|
||||
function loadFromURL(){
|
||||
$("#back").attr("onclick", "showSelector()");
|
||||
$("#menuwrapper").slideUp();
|
||||
$("#fromurl").slideDown();
|
||||
}
|
||||
|
||||
function openQuizFromFile(){
|
||||
var file=$("#fromfile").children("input[type=file]")[0].files[0];
|
||||
var fr=new FileReader();
|
||||
fr.onload=function(){
|
||||
openQuizFromFileCallback(fr.result);
|
||||
};
|
||||
fr.readAsText(file, "utf-8");
|
||||
}
|
||||
function openQuizFromFileCallback(res){
|
||||
$("#fromfile").slideUp();
|
||||
startQuizStr(res);
|
||||
}
|
||||
|
||||
function openQuizFromURL(){
|
||||
$("#fromurl").slideUp();
|
||||
startQuiz($("input[name=testurl]").val());
|
||||
}
|
||||
|
||||
//load quiz
|
||||
function startQuiz(path){
|
||||
$("#menuwrapper").slideUp();
|
||||
$("#list").slideUp();
|
||||
var sQuiz;
|
||||
$.ajax({
|
||||
url: path,
|
||||
type: "GET",
|
||||
success: function(res){
|
||||
startQuizStr(res);
|
||||
}
|
||||
});
|
||||
}
|
||||
function startQuizStr(quizstr){
|
||||
sQuiz=new $.sQuiz($("#sQuiz"), quizstr);
|
||||
sQuiz.setRegionalization(lang);
|
||||
sQuiz.setQuizDoneCallback(function(res, quiz){
|
||||
console.log(res);
|
||||
});
|
||||
sQuiz.setQuizDoneOptions({
|
||||
download: true,
|
||||
upload: true,
|
||||
upload_url: "./engine/engine.php"
|
||||
});
|
||||
sQuiz.init();
|
||||
}
|
83
style/mobile.css
Normal file
83
style/mobile.css
Normal file
@ -0,0 +1,83 @@
|
||||
/**
|
||||
* /style/style.php
|
||||
* @version 1.0
|
||||
* @desc Style file for desktop
|
||||
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
* License:
|
||||
sQuiz for creating small jQuery based quizs in an implementable way
|
||||
Copyright (C) 2017 Fándly Gergő Zoltán
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
**/
|
||||
|
||||
div.background{
|
||||
background: url('../res/background.png') center center fixed no-repeat;
|
||||
opacity: 0.7;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.center{
|
||||
margin: auto;
|
||||
}
|
||||
.centerchild{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
button{
|
||||
background: rgba(34,168,186,0.9);
|
||||
padding: 1em;
|
||||
border-radius: 0.5em;
|
||||
border: 1px solid rgba(28,157,175,0.9);
|
||||
}
|
||||
button:hover{
|
||||
background: rgba(24,148,165,0.9);
|
||||
}
|
||||
button.big{
|
||||
font-size: 3em;
|
||||
padding: 2em;
|
||||
padding-top: 4em;
|
||||
padding-bottom: 4em;
|
||||
width: 24%;
|
||||
}
|
||||
|
||||
footer{
|
||||
background: rgb(200,200,200);
|
||||
border-radius: 1em;
|
||||
width: 80%;
|
||||
margin: auto;
|
||||
font-size: 0.8em;
|
||||
text-align: center;
|
||||
padding: 0.3em;
|
||||
}
|
||||
|
||||
hr.placeholder{
|
||||
border: none;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
div.menu{
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
div.menu.middle{
|
||||
position: absolute;
|
||||
top: 25%;
|
||||
}
|
174
style/style.css
Normal file
174
style/style.css
Normal file
@ -0,0 +1,174 @@
|
||||
/**
|
||||
* /style/style.css
|
||||
* @version 1.4
|
||||
* @desc Style file for desktop
|
||||
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
* License:
|
||||
sQuiz for creating small jQuery based quizs in an implementable way
|
||||
Copyright (C) 2017 Fándly Gergő Zoltán
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
**/
|
||||
|
||||
html{
|
||||
background: url('../res/background.png') center center fixed no-repeat;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: -1;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.center{
|
||||
margin: auto;
|
||||
}
|
||||
.centerchild{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
button{
|
||||
background: rgba(34,168,186,0.9);
|
||||
padding: 1em;
|
||||
border-radius: 0.5em;
|
||||
border: 1px solid rgba(28,157,175,0.9);
|
||||
}
|
||||
button:hover{
|
||||
background: rgba(24,148,165,0.9);
|
||||
}
|
||||
button.big{
|
||||
font-size: 3em;
|
||||
padding: 1em;
|
||||
padding-top: 4em;
|
||||
padding-bottom: 4em;
|
||||
width: 9em;
|
||||
margin: 0.1em;
|
||||
}
|
||||
button.red{
|
||||
background: rgba(230,74,74,0.9);
|
||||
border: 1px solid rgba(187,48,48,0.9);
|
||||
}
|
||||
button.red:hover{
|
||||
background: rgba(200,54,54,0.9);
|
||||
}
|
||||
button.green{
|
||||
background: rgba(74,230,74,0.9);
|
||||
border: 1px solid rgba(48,487,48,0.9);
|
||||
}
|
||||
button.green:hover{
|
||||
background: rgba(54,200,54,0.9);
|
||||
}
|
||||
|
||||
footer{
|
||||
background: rgb(200,200,200);
|
||||
border-radius: 1em;
|
||||
width: 80%;
|
||||
margin: auto;
|
||||
font-size: 0.8em;
|
||||
text-align: center;
|
||||
padding: 0.3em;
|
||||
}
|
||||
|
||||
hr.placeholder{
|
||||
border: none;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
div.menu{
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
flex-wrap: wrap;
|
||||
width: 99%;
|
||||
}
|
||||
|
||||
div.container{
|
||||
background: rgba(34,168,186,0.7);
|
||||
padding: 1em;
|
||||
border-radius: 0.5em;
|
||||
border: 1px solid rgba(28,157,175,0.9);
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
/* the world's fanciest checkbox */
|
||||
div.checkbox{
|
||||
width: 7em;
|
||||
height: 2.5em;
|
||||
background: rgb(140, 140, 140);
|
||||
border-radius: 1.5em;
|
||||
position: relative;
|
||||
}
|
||||
div.checkbox:before{
|
||||
content: 'On';
|
||||
position: absolute;
|
||||
top: 30%;
|
||||
left: 15%;
|
||||
color: rgb(35, 200, 40);
|
||||
font-size: 1em;
|
||||
}
|
||||
div.checkbox:after{
|
||||
content: 'Off';
|
||||
position: absolute;
|
||||
top: 30%;
|
||||
right: 15%;
|
||||
color: rgb(15, 15, 15);
|
||||
font-size: 1em;
|
||||
}
|
||||
div.checkbox label{
|
||||
display: block;
|
||||
width: 45%;
|
||||
height: 55%;
|
||||
border-radius: 1.5em;
|
||||
transition: 0.5s;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
top: 22.5%;
|
||||
left: 10%;
|
||||
z-index: 1;
|
||||
background: rgb(220, 220, 220);
|
||||
}
|
||||
div.checkbox input[type=checkbox]:checked + label{
|
||||
left: 45%;
|
||||
background: rgb(35, 200, 40);
|
||||
}
|
||||
div.checkbox input[type=checkbox]{
|
||||
display: none;
|
||||
}
|
||||
|
||||
input{
|
||||
border-radius: 5px;
|
||||
padding: 0.5em;
|
||||
border: 1px solid rgba(28,157,175,0.9);
|
||||
}
|
||||
textarea{
|
||||
border-radius: 5px;
|
||||
padding: 0.5em;
|
||||
border: 1px solid rgba(28,157,175,0.9);
|
||||
}
|
||||
|
||||
fieldset{
|
||||
border: none;
|
||||
}
|
||||
|
||||
div.indented{
|
||||
margin-left: 6em;
|
||||
}
|
||||
|
||||
div.flexcontainer{
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
flex-wrap: wrap;
|
||||
width: 95%;
|
||||
}
|
67
tester.html
Normal file
67
tester.html
Normal file
@ -0,0 +1,67 @@
|
||||
<!--
|
||||
/**
|
||||
* /tester.html
|
||||
* @version 1.2
|
||||
* @desc The actual test solver
|
||||
* @note Not a standalone, runnable file.
|
||||
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
* License:
|
||||
sQuiz for creating small jQuery based quizs in an implementable way
|
||||
Copyright (C) 2017 Fándly Gergő Zoltán
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
**/
|
||||
-->
|
||||
|
||||
<button id="back" type="button" onclick="window.history.back()"><i class="fa fa-arrow-left" aria-hidden="true"></i> {{back}}</button>
|
||||
<button type="button" onclick="screenfull.toggle()"><i class="fa fa-expand"></i></button>
|
||||
<br>
|
||||
<br>
|
||||
<div id="menuwrapper">
|
||||
<hr class="placeholder" style="height: 20vh">
|
||||
<div id="menu" class="menu">
|
||||
<button type="button" class="big" onclick="loadFromList()">{{fromlist}}</button>
|
||||
<button type="button" class="big" onclick="loadFromFile()">{{uploadtest}}</button>
|
||||
<button type="button" class="big" onclick="loadFromURL()">{{fromurl}}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="list" class="container center" style="text-align: left; display: none">
|
||||
<table class="center">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{id}}</th>
|
||||
<th>{{name}}</th>
|
||||
<th>{{desc}}</th>
|
||||
<th>{{solve}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="listcontent">
|
||||
<!-- list content -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="fromfile" class="container center" style="display: none">
|
||||
<input type="file" name="testfile" accept="text/json">
|
||||
<br>
|
||||
<button type="button" onclick="openQuizFromFile()">{{solve}}</button>
|
||||
</div>
|
||||
<div id="fromurl" class="container center" style="display: none">
|
||||
<input type="text" name="testurl">
|
||||
<br>
|
||||
<button type="button" onclick="openQuizFromURL()">{{solve}}</button>
|
||||
</div>
|
||||
<div id="sQuiz" style="display: none">
|
||||
<!-- Quiz goes here -->
|
||||
</div>
|
1
tests/First test_sQuiz.json
Normal file
1
tests/First test_sQuiz.json
Normal file
File diff suppressed because one or more lines are too long
17
tests/main.json
Normal file
17
tests/main.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"type":"localdb",
|
||||
"locallist":false,
|
||||
"available":[
|
||||
{
|
||||
"_comment":"EXAMPLE, please remove!",
|
||||
"name":"NAME OF TEST",
|
||||
"description":"DESCRIPTION",
|
||||
"file":"PATH TO FILE (can be URL to)"
|
||||
},
|
||||
{
|
||||
"name":"Első teszt",
|
||||
"description":"Egy teszt a kecskékről",
|
||||
"file":"tests/First test_sQuiz.json"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user