Wp-Pro-Quiz - Version 0.19

Version Description

  • Leaderboard added
  • Quiz requirements added
  • Different points for each answer
  • "Matrix Sort" sort elements can now be created without criteria
  • Front-End javascript completely rewritten
  • Admin javascript revised
  • Average score can now be displayed in quiz
  • Cloze: different points can be assigned for every gap
  • Very many internal changes
  • several bugfixes
Download this release

Release Info

Developer xeno010
Plugin Icon 128x128 Wp-Pro-Quiz
Version 0.19
Comparing to
See all releases

Code changes from version 0.18 to 0.19

Files changed (72) hide show
  1. css/wpProQuiz_front.css +97 -12
  2. css/wpProQuiz_front.min.css +1 -1
  3. img/averagePoints.png +0 -0
  4. img/leaderboardInButton.png +0 -0
  5. img/leaderboardInResultText.png +0 -0
  6. js/wpProQuiz_admin.js +903 -275
  7. js/wpProQuiz_admin.min.js +41 -35
  8. js/wpProQuiz_front.js +617 -545
  9. js/wpProQuiz_front.min.js +22 -23
  10. js/wpProQuiz_toplist.js +62 -0
  11. js/wpProQuiz_toplist.min.js +2 -0
  12. languages/wp-pro-quiz-ar.mo +0 -0
  13. languages/wp-pro-quiz-ar.po +692 -293
  14. languages/wp-pro-quiz-de_DE.mo +0 -0
  15. languages/wp-pro-quiz-de_DE.po +916 -298
  16. languages/wp-pro-quiz-nb_NO.mo +0 -0
  17. languages/wp-pro-quiz-nb_NO.po +707 -295
  18. languages/wp-pro-quiz-nl_NL.mo +0 -0
  19. languages/wp-pro-quiz-nl_NL.po +708 -297
  20. languages/wp-pro-quiz-ru_RU.mo +0 -0
  21. languages/wp-pro-quiz-ru_RU.po +709 -297
  22. languages/wp-pro-quiz-sv_SE.mo +0 -0
  23. languages/wp-pro-quiz-sv_SE.po +694 -291
  24. languages/wp-pro-quiz.pot +1553 -0
  25. lib/controller/WpProQuiz_Controller_Admin.php +58 -4
  26. lib/controller/WpProQuiz_Controller_Front.php +72 -9
  27. lib/controller/WpProQuiz_Controller_GlobalSettings.php +14 -0
  28. lib/controller/WpProQuiz_Controller_Preview.php +6 -1
  29. lib/controller/WpProQuiz_Controller_Question.php +87 -61
  30. lib/controller/WpProQuiz_Controller_Quiz.php +191 -41
  31. lib/controller/WpProQuiz_Controller_Statistics.php +93 -21
  32. lib/controller/WpProQuiz_Controller_Toplist.php +271 -0
  33. lib/controller/WpProQuiz_Controller_WpqSupport.php +13 -0
  34. lib/helper/WpProQuiz_Helper_Captcha.php +76 -0
  35. lib/helper/WpProQuiz_Helper_DbUpgrade.php +206 -1
  36. lib/helper/WpProQuiz_Helper_Export.php +1 -1
  37. lib/helper/WpProQuiz_Helper_Import.php +11 -9
  38. lib/helper/WpProQuiz_Helper_Until.php +14 -0
  39. lib/helper/WpProQuiz_Helper_Upgrade.php +8 -0
  40. lib/model/WpProQuiz_Model_AnswerTypes.php +65 -0
  41. lib/model/WpProQuiz_Model_Mapper.php +8 -0
  42. lib/model/WpProQuiz_Model_Model.php +11 -14
  43. lib/model/WpProQuiz_Model_PrerequisiteMapper.php +52 -0
  44. lib/model/WpProQuiz_Model_Question.php +34 -58
  45. lib/model/WpProQuiz_Model_QuestionMapper.php +23 -69
  46. lib/model/WpProQuiz_Model_Quiz.php +146 -0
  47. lib/model/WpProQuiz_Model_QuizMapper.php +36 -3
  48. lib/model/WpProQuiz_Model_StatisticMapper.php +47 -3
  49. lib/model/WpProQuiz_Model_Toplist.php +93 -0
  50. lib/model/WpProQuiz_Model_ToplistMapper.php +118 -0
  51. lib/view/WpProQuiz_View_AdminToplist.php +97 -0
  52. lib/view/WpProQuiz_View_FrontQuiz.php +228 -147
  53. lib/view/WpProQuiz_View_FrontToplist.php +41 -0
  54. lib/view/WpProQuiz_View_GobalSettings.php +57 -4
  55. lib/view/WpProQuiz_View_QuestionEdit.php +195 -216
  56. lib/view/WpProQuiz_View_QuestionOverall.php +27 -13
  57. lib/view/WpProQuiz_View_QuizEdit.php +249 -1
  58. lib/view/WpProQuiz_View_QuizOverall.php +50 -21
  59. lib/view/WpProQuiz_View_Statistics.php +3 -3
  60. lib/view/WpProQuiz_View_View.php +11 -0
  61. lib/view/WpProQuiz_View_WpqSupport.php +57 -0
  62. readme.txt +27 -9
  63. screenshot-10.png +0 -0
  64. screenshot-11.png +0 -0
  65. screenshot-12.png +0 -0
  66. screenshot-2.png +0 -0
  67. screenshot-6.png +0 -0
  68. screenshot-7.png +0 -0
  69. screenshot-8.png +0 -0
  70. screenshot-9.png +0 -0
  71. uninstall.php +2 -1
  72. wp-pro-quiz.php +7 -2
css/wpProQuiz_front.css CHANGED
@@ -18,8 +18,10 @@
18
  .wpProQuiz_content h2 {
19
  margin-bottom: 10px !important;
20
  }
21
-
22
- .wpProQuiz_content input[type="button"], .wpProQuiz_content input[type="button"]:hover {
 
 
23
  margin: 0 !important;
24
  padding: 5px 10px !important;
25
  background: #13455B !important;
@@ -40,6 +42,11 @@
40
  font-weight: bold !important;
41
  }
42
 
 
 
 
 
 
43
  .wpProQuiz_questionListItem {
44
  padding: 3px !important;
45
  margin-bottom: 5px !important;
@@ -55,11 +62,6 @@
55
  width: 100%;
56
  }
57
 
58
- .wpProQuiz_questionListItem:last-child {
59
- padding: 3px !important;
60
- margin-bottom: 0 !important;
61
- }
62
-
63
  .wpProQuiz_list, .wpProQuiz_listItem, .wpProQuiz_questionList, .wpProQuiz_sortStringList, .wpProQuiz_sortStringList, .wpProQuiz_maxtrixSortCriterion, .wpProQuiz_resultsList {
64
  list-style: none !important;
65
  padding: 0 !important;
@@ -108,7 +110,7 @@
108
  margin-top: 5px !important;
109
  margin-bottom: 5px !important;
110
  }
111
- .wpProQuiz_time_limit .progress {
112
  height: 10px !important;
113
  background-color: blue !important;
114
  margin-bottom: 5px !important;
@@ -121,13 +123,13 @@
121
  .wpProQuiz_question_text {
122
  margin-bottom: 10px !important;
123
  }
124
- .wpProQuiz_tipp {
125
  padding: 10px !important;
126
  background-color: #DDECFF !important;
127
  border: 1px dotted #363636 !important;
128
  border-radius: 10px !important;
129
  position: absolute !important;
130
- bottom: 35px !important;
131
  left: 5px !important;
132
  right: 5px !important;
133
  box-shadow: 2px 2px 5px 0px #313131 !important;
@@ -204,10 +206,93 @@
204
  padding: 0 !important;
205
  margin: 0 !important;
206
  }
207
- .wpProQuiz_lock {
208
  border: 1px dotted #FFC3C3 !important;
209
  background-color: #FFF7F7 !important;
210
  }
211
- .wpProQuiz_lock p {
212
  margin: 20px !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  }
18
  .wpProQuiz_content h2 {
19
  margin-bottom: 10px !important;
20
  }
21
+ *+html .wpProQuiz_button, *+html .wpProQuiz_button:hover {
22
+ padding: 3px 0px !important;
23
+ }
24
+ .wpProQuiz_button, .wpProQuiz_button:hover {
25
  margin: 0 !important;
26
  padding: 5px 10px !important;
27
  background: #13455B !important;
42
  font-weight: bold !important;
43
  }
44
 
45
+ .wpProQuiz_questionListItem:last-child, .wpProQuiz_questionListItemLastChildIE {
46
+ padding: 3px !important;
47
+ margin-bottom: 0 !important;
48
+ }
49
+
50
  .wpProQuiz_questionListItem {
51
  padding: 3px !important;
52
  margin-bottom: 5px !important;
62
  width: 100%;
63
  }
64
 
 
 
 
 
 
65
  .wpProQuiz_list, .wpProQuiz_listItem, .wpProQuiz_questionList, .wpProQuiz_sortStringList, .wpProQuiz_sortStringList, .wpProQuiz_maxtrixSortCriterion, .wpProQuiz_resultsList {
66
  list-style: none !important;
67
  padding: 0 !important;
110
  margin-top: 5px !important;
111
  margin-bottom: 5px !important;
112
  }
113
+ .wpProQuiz_time_limit .wpProQuiz_progress {
114
  height: 10px !important;
115
  background-color: blue !important;
116
  margin-bottom: 5px !important;
123
  .wpProQuiz_question_text {
124
  margin-bottom: 10px !important;
125
  }
126
+ .wpProQuiz_tipp > div {
127
  padding: 10px !important;
128
  background-color: #DDECFF !important;
129
  border: 1px dotted #363636 !important;
130
  border-radius: 10px !important;
131
  position: absolute !important;
132
+ bottom: 5px !important;
133
  left: 5px !important;
134
  right: 5px !important;
135
  box-shadow: 2px 2px 5px 0px #313131 !important;
206
  padding: 0 !important;
207
  margin: 0 !important;
208
  }
209
+ .wpProQuiz_lock, .wpProQuiz_prerequisite {
210
  border: 1px dotted #FFC3C3 !important;
211
  background-color: #FFF7F7 !important;
212
  }
213
+ .wpProQuiz_lock p, .wpProQuiz_prerequisite p {
214
  margin: 20px !important;
215
+ font-weight: bold !important;
216
+ }
217
+ .wpProQuiz_toplistTable {
218
+ width: 100% !important;
219
+ border: 1px solid #C3D1A3 !important;
220
+ border-collapse: collapse !important;
221
+ }
222
+ .wpProQuiz_toplistTable caption {
223
+ caption-side:top !important;
224
+ text-align: right !important;
225
+ padding-bottom: 2px !important;
226
+ color: gray !important;
227
+ margin: 0 !important;
228
+ font-size: 11px !important;
229
+ }
230
+ .wpProQuiz_toplistTable thead tr {
231
+ background-color: rgb(155,187,89) !important;
232
+ padding: 5px !important;
233
+ color: white !important;
234
+ font-weight: bold !important;
235
+ }
236
+ .wpProQuiz_toplistTable tbody td:FIRST-CHILD{
237
+ font-weight: bold !important;
238
+ }
239
+ .wpProQuiz_toplistTable td, .wpProQuiz_toplistTable th {
240
+ padding: 5px !important;
241
+ text-align: center;
242
+ }
243
+ .wpProQuiz_toplistTrOdd {
244
+ background-color: #EBF1DE !important;
245
+ }
246
+ .wpProQuiz_addToplist {
247
+ margin-top: 10px !important;
248
+ background-color: #F5FAEA !important;
249
+ padding: 10px !important;
250
+ border: 1px solid #C3D1A3 !important;
251
+ }
252
+ .wpProQuiz_addToplistMessage {
253
+ border: 1px solid rgb(160, 160, 160) !important;
254
+ background-color: #FCFFB3 !important;
255
+ margin-bottom: 5px !important;
256
+ border-radius: 5px !important;
257
+ padding: 5px !important;
258
+ font-weight: bold !important;
259
+ color: dimGray !important;
260
+ }
261
+ .wpProQuiz_toplistButton, .wpProQuiz_toplistButton:hover {
262
+ background-color: lightGrey !important;
263
+ border: 1px solid rgb(194, 194, 194) !important;
264
+ text-shadow: 1px 1px 1px white !important;
265
+ margin-top: 5px !important;
266
+ color: black !important;
267
+ }
268
+ .wpProQuiz_resultTable {
269
+ margin: 15px auto !important;
270
+ width: 400px !important;
271
+ border: 1px solid #C4C4C4 !important;
272
+ padding: 15px !important;
273
+ font-weight: bold !important;
274
+ }
275
+ .wpProQuiz_resultTable table {
276
+ width: 100% !important;
277
+ border-collapse: collapse !important;
278
+ margin: 0 !important;
279
+ }
280
+ .wpProQuiz_resultName {
281
+ width: 100px !important;
282
+ border-right: 1px solid rgb(134, 134, 134) !important;
283
+ padding: 10px 0px !important;
284
+ }
285
+ .wpProQuiz_resultValue {
286
+ padding: 0 !important;
287
+ }
288
+ .wpProQuiz_resultValue div {
289
+ color: black !important;
290
+ text-align: right !important;
291
+ box-shadow: 1px 1px 3px 1px #C4C4C4 !important;
292
+ display: inline-block !important;
293
+ height: 18px !important;
294
+ zoom: 1 !important;
295
+ *display: inline !important;
296
+ margin-right: 3px !important;
297
+ vertical-align: middle !important;
298
  }
css/wpProQuiz_front.min.css CHANGED
@@ -1 +1 @@
1
- .wpProQuiz_answerCorrect{background:#6DB46D!important;font-weight:700!important;}.wpProQuiz_answerCorrect label{font-weight:700!important;}.wpProQuiz_answerIncorrect{background:#FF9191!important;font-weight:700!important;}.wpProQuiz_content{margin-top:10px!important;margin-bottom:10px!important;}.wpProQuiz_content h2{margin-bottom:10px!important;}.wpProQuiz_content input[type=button],.wpProQuiz_content input[type=button]:hover{margin:0!important;padding:5px 10px!important;background:#13455B!important;border-radius:11px!important;color:#FFF!important;font-weight:700!important;border:1px solid #13455B!important;box-shadow:1px 1px 1px #333!important;text-shadow:none!important;filter:none!important;}.wpProQuiz_question_page{margin-bottom:10px!important;}.wpProQuiz_question_page span{font-weight:700!important;}.wpProQuiz_questionListItem{padding:3px!important;margin-bottom:5px!important;background-image:none!important;margin-left:0!important;list-style:none!important;}.wpProQuiz_questionListItem > table{border-collapse:collapse!important;margin:0!important;padding:0!important;width:100%;}.wpProQuiz_questionListItem:last-child{padding:3px!important;margin-bottom:0!important;}.wpProQuiz_list,.wpProQuiz_listItem,.wpProQuiz_questionList,.wpProQuiz_sortStringList,.wpProQuiz_sortStringList,.wpProQuiz_maxtrixSortCriterion,.wpProQuiz_resultsList{list-style:none!important;padding:0!important;margin:0!important;}.wpProQuiz_questionList{margin-bottom:10px!important;background:#F8FAF5!important;border:1px solid #C3D1A3!important;padding:5px!important;list-style:none!important;}.wpProQuiz_listItem{position:relative!important;}.wpProQuiz_response{background:#F8FAF5!important;border:1px solid #C4C4C4!important;padding:5px!important;margin-bottom:15px!important;box-shadow:1px 1px 2px #AAA!important;}.wpProQuiz_response span{font-weight:700!important;}.wpProQuiz_sort{width:25px!important;}.wpProQuiz_results h3{margin-bottom:10px!important;}.wpProQuiz_sort_correct_answer{font-weight:700!important;margin-right:5px!important;display:none!important;}.wpProQuiz_sortable,.wpProQuiz_sortStringItem{padding:5px!important;border:1px solid #D3D3D3!important;box-shadow:2px 2px 1px #EEE;background-color:#F8FAF5!important;cursor:move;}.wpProQuiz_time_limit .time{font-weight:700!important;margin-top:5px!important;margin-bottom:5px!important;}.wpProQuiz_time_limit .progress{height:10px!important;background-color:blue!important;margin-bottom:5px!important;}.wpProQuiz_time_limit_expired{font-weight:700!important;font-size:15px!important;text-align:center!important;}.wpProQuiz_question_text{margin-bottom:10px!important;}.wpProQuiz_tipp{padding:10px!important;background-color:#DDECFF!important;border:1px dotted #363636!important;border-radius:10px!important;position:absolute!important;bottom:35px!important;left:5px!important;right:5px!important;box-shadow:2px 2px 5px 0 #313131!important;z-index:99999!important;}.wpProQuiz_matrixSortString,.wpProQuiz_matrixSortString > h3{margin-bottom:10px!important;margin-top:0!important;}.wpProQuiz_matrixSortString{background:#F8FAF5!important;border:1px solid #C3D1A3!important;padding:5px!important;}.wpProQuiz_sortStringList{padding:10px!important;}.wpProQuiz_sortStringList > li{float:left!important;margin-left:5px!important;margin-right:5px!important;margin-bottom:5px!important;}.wpProQuiz_sortStringItem{margin:0!important;background-image:none!important;list-style:none!important;}.wpProQuiz_maxtrixSortCriterion{padding:5px!important;}.wpProQuiz_placehold{background-color:#FFFFC2!important;list-style:none!important;background-image:none!important;padding:5px!important;height:30px!important;min-width:50px!important;margin:0!important;}.wpProQuiz_maxtrixSortText{padding:5px!important;}.wpProQuiz_mextrixTr > td{border:1px solid #D1D1D1!important;padding:5px!important;vertical-align:middle!important;}.wpProQuiz_points{font-weight:700!important;text-align:center!important;margin-bottom:20px!important;}.wpProQuiz_cloze input{background:transparent;border:0!important;border-bottom:1px solid!important;height:18px!important;margin:0!important;padding:0 4px!important;color:#000!important;border-radius:0!important;box-shadow:0 0!important;}.wpProQuiz_cloze input:focus{outline:none!important;}.wpProQuiz_questionListItem input,.wpProQuiz_questionListItem label{margin:0!important;font-weight:400;}.wpProQuiz_resultsList > li{background-image:none!important;padding:0!important;margin:0!important;}.wpProQuiz_lock{border:1px dotted #FFC3C3!important;background-color:#FFF7F7!important;}.wpProQuiz_lock p{margin:20px!important;}
1
+ .wpProQuiz_answerCorrect{background:#6DB46D!important;font-weight:700!important;}.wpProQuiz_answerCorrect label{font-weight:700!important;}.wpProQuiz_answerIncorrect{background:#FF9191!important;font-weight:700!important;}.wpProQuiz_content{margin-top:10px!important;margin-bottom:10px!important;}.wpProQuiz_content h2{margin-bottom:10px!important;}*+html .wpProQuiz_button,*+html .wpProQuiz_button:hover{padding:3px 0!important;}.wpProQuiz_button,.wpProQuiz_button:hover{margin:0!important;padding:5px 10px!important;background:#13455B!important;border-radius:11px!important;color:#FFF!important;font-weight:700!important;border:1px solid #13455B!important;box-shadow:1px 1px 1px #333!important;text-shadow:none!important;filter:none!important;}.wpProQuiz_question_page{margin-bottom:10px!important;}.wpProQuiz_question_page span{font-weight:700!important;}.wpProQuiz_questionListItem:last-child,.wpProQuiz_questionListItemLastChildIE{padding:3px!important;margin-bottom:0!important;}.wpProQuiz_questionListItem{padding:3px!important;margin-bottom:5px!important;background-image:none!important;margin-left:0!important;list-style:none!important;}.wpProQuiz_questionListItem > table{border-collapse:collapse!important;margin:0!important;padding:0!important;width:100%;}.wpProQuiz_list,.wpProQuiz_listItem,.wpProQuiz_questionList,.wpProQuiz_sortStringList,.wpProQuiz_sortStringList,.wpProQuiz_maxtrixSortCriterion,.wpProQuiz_resultsList{list-style:none!important;padding:0!important;margin:0!important;}.wpProQuiz_questionList{margin-bottom:10px!important;background:#F8FAF5!important;border:1px solid #C3D1A3!important;padding:5px!important;list-style:none!important;}.wpProQuiz_listItem{position:relative!important;}.wpProQuiz_response{background:#F8FAF5!important;border:1px solid #C4C4C4!important;padding:5px!important;margin-bottom:15px!important;box-shadow:1px 1px 2px #AAA!important;}.wpProQuiz_response span{font-weight:700!important;}.wpProQuiz_sort{width:25px!important;}.wpProQuiz_results h3{margin-bottom:10px!important;}.wpProQuiz_sort_correct_answer{font-weight:700!important;margin-right:5px!important;display:none!important;}.wpProQuiz_sortable,.wpProQuiz_sortStringItem{padding:5px!important;border:1px solid #D3D3D3!important;box-shadow:2px 2px 1px #EEE;background-color:#F8FAF5!important;cursor:move;}.wpProQuiz_time_limit .time{font-weight:700!important;margin-top:5px!important;margin-bottom:5px!important;}.wpProQuiz_time_limit .wpProQuiz_progress{height:10px!important;background-color:blue!important;margin-bottom:5px!important;}.wpProQuiz_time_limit_expired{font-weight:700!important;font-size:15px!important;text-align:center!important;}.wpProQuiz_question_text{margin-bottom:10px!important;}.wpProQuiz_tipp > div{padding:10px!important;background-color:#DDECFF!important;border:1px dotted #363636!important;border-radius:10px!important;position:absolute!important;bottom:5px!important;left:5px!important;right:5px!important;box-shadow:2px 2px 5px 0 #313131!important;z-index:99999!important;}.wpProQuiz_matrixSortString,.wpProQuiz_matrixSortString > h3{margin-bottom:10px!important;margin-top:0!important;}.wpProQuiz_matrixSortString{background:#F8FAF5!important;border:1px solid #C3D1A3!important;padding:5px!important;}.wpProQuiz_sortStringList{padding:10px!important;}.wpProQuiz_sortStringList > li{float:left!important;margin-left:5px!important;margin-right:5px!important;margin-bottom:5px!important;}.wpProQuiz_sortStringItem{margin:0!important;background-image:none!important;list-style:none!important;}.wpProQuiz_maxtrixSortCriterion{padding:5px!important;}.wpProQuiz_placehold{background-color:#FFFFC2!important;list-style:none!important;background-image:none!important;padding:5px!important;height:30px!important;min-width:50px!important;margin:0!important;}.wpProQuiz_maxtrixSortText{padding:5px!important;}.wpProQuiz_mextrixTr > td{border:1px solid #D1D1D1!important;padding:5px!important;vertical-align:middle!important;}.wpProQuiz_points{font-weight:700!important;text-align:center!important;margin-bottom:20px!important;}.wpProQuiz_cloze input{background:transparent;border:0!important;border-bottom:1px solid!important;height:18px!important;margin:0!important;padding:0 4px!important;color:#000!important;border-radius:0!important;box-shadow:0 0!important;}.wpProQuiz_cloze input:focus{outline:none!important;}.wpProQuiz_questionListItem input,.wpProQuiz_questionListItem label{margin:0!important;font-weight:400;}.wpProQuiz_resultsList > li{background-image:none!important;padding:0!important;margin:0!important;}.wpProQuiz_lock,.wpProQuiz_prerequisite{border:1px dotted #FFC3C3!important;background-color:#FFF7F7!important;}.wpProQuiz_lock p,.wpProQuiz_prerequisite p{margin:20px!important;font-weight:700!important;}.wpProQuiz_toplistTable{width:100%!important;border:1px solid #C3D1A3!important;border-collapse:collapse!important;}.wpProQuiz_toplistTable caption{caption-side:top!important;text-align:right!important;padding-bottom:2px!important;color:gray!important;margin:0!important;font-size:11px!important;}.wpProQuiz_toplistTable thead tr{background-color:#9bbb59!important;padding:5px!important;color:#FFF!important;font-weight:700!important;}.wpProQuiz_toplistTable tbody td:FIRST-CHILD{font-weight:700!important;}.wpProQuiz_toplistTable td,.wpProQuiz_toplistTable th{padding:5px!important;text-align:center;}.wpProQuiz_toplistTrOdd{background-color:#EBF1DE!important;}.wpProQuiz_addToplist{margin-top:10px!important;background-color:#F5FAEA!important;padding:10px!important;border:1px solid #C3D1A3!important;}.wpProQuiz_addToplistMessage{border:1px solid #a0a0a0!important;background-color:#FCFFB3!important;margin-bottom:5px!important;border-radius:5px!important;padding:5px!important;font-weight:700!important;color:#696969!important;}.wpProQuiz_toplistButton,.wpProQuiz_toplistButton:hover{background-color:#D3D3D3!important;border:1px solid #c2c2c2!important;text-shadow:1px 1px 1px #FFF!important;margin-top:5px!important;color:#000!important;}.wpProQuiz_resultTable{margin:15px auto!important;width:400px!important;border:1px solid #C4C4C4!important;padding:15px!important;font-weight:700!important;}.wpProQuiz_resultTable table{width:100%!important;border-collapse:collapse!important;margin:0!important;}.wpProQuiz_resultName{width:100px!important;border-right:1px solid #868686!important;padding:10px 0!important;}.wpProQuiz_resultValue{padding:0!important;}.wpProQuiz_resultValue div{color:#000!important;text-align:right!important;box-shadow:1px 1px 3px 1px #C4C4C4!important;display:inline-block!important;height:18px!important;zoom:1!important;*display:inline!important;margin-right:3px!important;vertical-align:middle!important;}
img/averagePoints.png ADDED
Binary file
img/leaderboardInButton.png ADDED
Binary file
img/leaderboardInResultText.png ADDED
Binary file
js/wpProQuiz_admin.js CHANGED
@@ -112,262 +112,337 @@ jQuery(document).ready(function($) {
112
  init();
113
  };
114
 
115
- $.fn.wpProQuiz_questionEdit = function() {
116
-
117
- var setup = function() {
118
- if($('input[name="answerType"][checked="checked"]').size() < 1) {
119
- $('input[name="answerType"][value="single"]').attr({'checked': 'checked'});
120
- }
121
-
122
- $('input[name="answerType"]:checked').click();
123
- $('#wpProQuiz_correctSameText').change();
124
- $('#wpProQuiz_tip').change();
125
- $('input[name="pointsPerAnswer"]').change();
126
- };
127
-
128
- var formListener = {
129
- setup: function() {
130
- $('input[name="answerType"]').click(function(e) {
131
- $('.answer_felder').children().css('display', 'none');
132
-
133
- switch (this.value) {
134
- case 'single':
135
- formListener.displaySingle('radio');
136
- break;
137
- case 'multiple':
138
- formListener.displaySingle('checkbox');
139
- break;
140
- case 'free_answer':
141
- formListener.displayFreeAnswer();
142
- break;
143
- case 'sort_answer':
144
- formListener.displaySortAnswer();
145
- break;
146
- case 'matrix_sort_answer':
147
- formListener.displayMatrixSortAnswer();
148
- break;
149
- case 'cloze_answer':
150
- formListener.displayClozeAnswer();
151
- break;
152
- }
153
- });
154
-
155
- $('.addAnswer').click(function(e) {
156
- formListener.addAnswer(this);
157
- });
158
-
159
- $('.deleteAnswer').click(function(e) {
160
- formListener.deleteAnswer(this);
161
- });
162
-
163
- $('#saveQuestion').click(function(e) {
164
- return validate();
165
- });
166
-
167
- $('.sort_answer ul, .classic_answer ul, .matrix_sort_answer ul').sortable({
168
- handle: '.wpProQuiz_move',
169
- update: function(event, ui) {
170
- formListener.setValueClassicAnswer();
171
- }
172
- });
173
-
174
- $('#wpProQuiz_correctSameText').change(function() {
175
- if(this.checked)
176
- $('#wpProQuiz_incorrectMassageBox').hide();
177
- else
178
- $('#wpProQuiz_incorrectMassageBox').show();
179
- });
180
-
181
- $('#wpProQuiz_tip').change(function(e) {
182
- if(this.checked)
183
- $('#wpProQuiz_tipBox').show();
184
- else
185
- $('#wpProQuiz_tipBox').hide();
186
- });
187
-
188
- $('input[name="pointsPerAnswer"]').change(function() {
189
- if(this.checked) {
190
- $('#wpProQuiz_showPointsBox').show();
191
- } else {
192
- $('#wpProQuiz_showPointsBox').hide();
193
- }
194
- });
195
-
196
- $('.wpProQuiz_demoBox a').mouseover(function() {
197
- $(this).next().show();
198
- }).mouseout(function() {
199
- $(this).next().hide();
200
- }).click(function() {
201
- return false;
202
- });
203
-
204
- },
205
-
206
- displaySingle: function(type) {
207
- $('.classic_answer').find('input[name="answerJson[classic_answer][correct][]"]').each(function() {
208
- $("<input type=" + type + " />").attr({ name: this.name, value: this.value, checked: this.checked}).insertBefore(this);
209
- }).remove();
210
-
211
- $('.classic_answer').css('display', 'block');
212
- },
213
-
214
- displayFreeAnswer: function() {
215
- $('.free_answer').css('display', 'block');
216
- },
217
-
218
- displaySortAnswer: function() {
219
- $('.sort_answer').css('display', 'block');
220
- },
221
-
222
- displayMatrixSortAnswer: function() {
223
- $('.matrix_sort_answer').show();
224
- },
225
-
226
- displayClozeAnswer: function() {
227
- $('.cloze_answer').show();
228
- },
229
-
230
- addAnswer: function(obj) {
231
- $(obj).siblings('ul').children().first()
232
- .clone().css('display', 'block')
233
- .appendTo($(obj).siblings('ul'));
234
-
235
- formListener.setValueClassicAnswer();
236
-
237
- $('.deleteAnswer').click(function(e) {
238
- formListener.deleteAnswer(this);
239
- });
240
- },
241
-
242
- deleteAnswer: function(obj) {
243
- $(obj).parent('li').remove();
244
-
245
- formListener.setValueClassicAnswer();
246
- },
247
-
248
- setValueClassicAnswer: function() {
249
-
250
- $('.classic_answer ul, .matrix_sort_answer ul, .sort_answer ul').children().each(function() {
251
- var index = $(this).index();
252
-
253
- $(this).find( 'input[name="answerJson[classic_answer][correct][]"], '
254
- + 'input[name="answerJson[classic_answer][html][]"], '
255
- + 'input[name="answerJson[answer_matrix_sort][answer_html][]"], '
256
- + 'input[name="answerJson[answer_matrix_sort][sort_string_html][]"], '
257
- + 'input[name="answerJson[answer_sort][html][]"]').val(index);
258
- });
259
- }
260
- };
261
-
262
- var validate = function () {
263
-
264
- var question = '';
265
- var type = $('input[name="answerType"]:checked');
266
- var $points = $('input[name="points"]');
267
-
268
- if(tinymce.editors.question != undefined && !tinymce.editors.question.isHidden()) {
269
- question = tinymce.editors.question.getContent();
270
- } else {
271
- question = $('textarea[name="question"]').val();
272
- }
273
-
274
- if(isNaN($points.val()) || $points.val() < 1) {
275
- alert(wpProQuizLocalize.no_nummber_points);
276
- $points.focus();
277
- return false;
278
- }
279
-
280
- if(isEmpty(question)) {
281
- alert(wpProQuizLocalize.no_question_msg);
282
- return false;
283
- }
284
-
285
-
286
- if(type.val() == 'single' || type.val() == 'multiple') {
287
- var findChecked = true;
288
- if($('input[name="answerJson[classic_answer][correct][]"]:checked').each(function() {
289
- if($.trim($(this).parent().siblings('textarea').val()) != '')
290
- findChecked &= true;
291
- else
292
- findChecked = false;
293
- })
294
- .size() < 1) {
295
- alert(wpProQuizLocalize.no_correct_msg);
296
- return false;
297
- }
298
-
299
- if(!findChecked) {
300
- alert(wpProQuizLocalize.no_answer_msg);
301
- return false;
302
- }
303
- } else if(type.val() == 'sort_answer') {
304
- var findChecked = false;
305
- $('textarea[name="answerJson[answer_sort][answer][]"]').each(function() {
306
- if(isEmpty($(this).val())) {
307
- findChecked |= false;
308
- } else {
309
- findChecked = true;
310
- }
311
- });
312
-
313
- if(!findChecked) {
314
- alert(wpProQuizLocalize.no_answer_msg);
315
- return false;
316
- }
317
- } else if(type.val() == 'matrix_sort_answer') {
318
- var findChecked = false;
319
- $('textarea[name="answerJson[answer_matrix_sort][answer][]"]').each(function() {
320
- if(isEmpty($(this).val())) {
321
- findChecked |= false;
322
- } else {
323
-
324
- var $sortString = $(this).parent().parent().find('textarea[name="answerJson[answer_matrix_sort][sort_string][]"]');
325
-
326
- if(isEmpty($sortString.val())) {
327
- findChecked |= false;
328
- } else {
329
- findChecked = true;
330
- }
331
- }
332
- });
333
-
334
- if(!findChecked) {
335
- alert(wpProQuizLocalize.no_answer_msg);
336
- return false;
337
- }
338
- } else if(type.val() == 'cloze_answer') {
339
- var clozeText = '';
340
-
341
- if(tinymce.editors.cloze != undefined && !tinymce.editors.cloze.isHidden()) {
342
- clozeText = tinymce.editors.cloze.getContent();
343
- } else {
344
- clozeText = $('textarea[name="answerJson[answer_cloze][text]"]').val();
345
- }
346
-
347
- if(isEmpty(clozeText)) {
348
- alert(wpProQuizLocalize.no_answer_msg);
349
- return false;
350
- }
351
- } else if(type.val() == 'free_answer') {
352
- var freeText = $('textarea[name="answerJson[free_answer][correct]"]').val();
353
-
354
- if(isEmpty(freeText)) {
355
- alert(wpProQuizLocalize.no_answer_msg);
356
- return false;
357
- }
358
- }
359
-
360
- return true;
361
- };
362
-
363
- var isEmpty = function(str) {
364
- str = $.trim(str);
365
- return (!str || 0 === str.length);
366
- };
367
-
368
- formListener.setup();
369
- setup();
370
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
371
 
372
  $.fn.wpProQuiz_questionOverall = function() {
373
 
@@ -669,6 +744,8 @@ jQuery(document).ready(function($) {
669
  $('#wpProQuiz_save').click(function(e) {
670
  if(!methode.validInput())
671
  e.preventDefault();
 
 
672
  });
673
 
674
  $('input[name="quizRunOnce"]').change(function(e) {
@@ -712,6 +789,39 @@ jQuery(document).ready(function($) {
712
  }
713
  });
714
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
715
  $('#statistics_on').change();
716
  $('#wpProQuiz_resultGradeEnabled').change();
717
  $('input[name="quizRunOnce"]').change();
@@ -749,9 +859,6 @@ jQuery(document).ready(function($) {
749
  setStatistics: function(json) {
750
  var $table = $('.wpProQuiz_statistics_table');
751
  var $tbody = $table.find('tbody');
752
- var points = 0;
753
- var gPoints = 0;
754
- var cPoints = 0;
755
 
756
  if(currectTab == 'wpProQuiz_typeOverview') {
757
  return;
@@ -761,21 +868,10 @@ jQuery(document).ready(function($) {
761
  i.find('.wpProQuiz_cCorrect').text(j.cCorrect + ' (' + j.pCorrect + '%)');
762
  i.find('.wpProQuiz_cIncorrect').text(j.cIncorrect + ' (' + j.pIncorrect + '%)');
763
  i.find('.wpProQuiz_cTip').text(j.cTip);
764
- i.find('.wpProQuiz_cCorrectAnswerPoints').text(j.cCorrectAnswerPoints * i.find('.wpProQuiz_pointsAnswer').text());
765
 
766
  if(r == true) {
767
- if(gPoints > 0) {
768
- $table.find('.wpProQuiz_cResult').text(
769
- (Math.round(points / gPoints * 100 * 100) / 100)
770
- + "%");
771
- } else {
772
- $table.find('.wpProQuiz_cResult').text("0%");
773
- }
774
- i.find('.wpProQuiz_cCorrectAnswerPoints').text(cPoints);
775
- } else {
776
- points += (j.cCorrectAnswerPoints * i.find('.wpProQuiz_pointsAnswer').text());
777
- gPoints += (j.cCorrect + j.cIncorrect ) * i.find('.wpProQuiz_points').text();
778
- cPoints += j.cCorrectAnswerPoints * i.find('.wpProQuiz_pointsAnswer').text();
779
  }
780
  };
781
 
@@ -842,7 +938,7 @@ jQuery(document).ready(function($) {
842
  d.find('.wpProQuiz_cCorrect').text(v.cCorrect + ' (' + v.pCorrect + '%)');
843
  d.find('.wpProQuiz_cIncorrect').text(v.cIncorrect + ' (' + v.pIncorrect + '%)');
844
  d.find('.wpProQuiz_cTip').text(v.cTip);
845
- d.find('.wpProQuiz_cResult').text((Math.round(v.cPoints / v.totalPoints * 100 * 100) / 100) + '%');
846
  } else {
847
  d.find('th').removeAttr('style');
848
  }
@@ -1008,6 +1104,164 @@ jQuery(document).ready(function($) {
1008
  init();
1009
  };
1010
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1011
 
1012
  if($('.wpProQuiz_quizOverall').length)
1013
  $('.wpProQuiz_quizOverall').wpProQuiz_preview();
@@ -1019,12 +1273,386 @@ jQuery(document).ready(function($) {
1019
  if($('.wpProQuiz_quizEdit').length)
1020
  $('.wpProQuiz_quizEdit').wpProQuiz_quizEdit();
1021
 
1022
- if($('.wpProQuiz_questionEdit').length)
1023
- $('.wpProQuiz_questionEdit').wpProQuiz_questionEdit();
1024
 
1025
  if($('.wpProQuiz_questionOverall').length)
1026
  $('.wpProQuiz_questionOverall').wpProQuiz_questionOverall();
1027
 
1028
  if($('.wpProQuiz_statistics').length)
1029
  $('.wpProQuiz_statistics').wpProQuiz_statistics();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1030
  });
112
  init();
113
  };
114
 
115
+ // $.fn.wpProQuiz_questionEdit = function() {
116
+ //
117
+ // var setup = function() {
118
+ // if($('input[name="answerType"][checked="checked"]').size() < 1) {
119
+ // $('input[name="answerType"][value="single"]').attr({'checked': 'checked'});
120
+ // }
121
+ //
122
+ // $('input[name="answerType"]:checked').click();
123
+ // $('#wpProQuiz_correctSameText').change();
124
+ // $('#wpProQuiz_tip').change();
125
+ // $('input[name="pointsPerAnswer"]').change();
126
+ // $('input[name="answerPointsActivated"]').change();
127
+ // };
128
+ //
129
+ // var formListener = {
130
+ // setup: function() {
131
+ // $('input[name="answerType"]').click(function(e) {
132
+ // $('.answer_felder').children().css('display', 'none');
133
+ //
134
+ // switch (this.value) {
135
+ // case 'single':
136
+ // formListener.displaySingle('radio');
137
+ // break;
138
+ // case 'multiple':
139
+ // formListener.displaySingle('checkbox');
140
+ // break;
141
+ // case 'free_answer':
142
+ // formListener.displayFreeAnswer();
143
+ // break;
144
+ // case 'sort_answer':
145
+ // formListener.displaySortAnswer();
146
+ // break;
147
+ // case 'matrix_sort_answer':
148
+ // formListener.displayMatrixSortAnswer();
149
+ // break;
150
+ // case 'cloze_answer':
151
+ // formListener.displayClozeAnswer();
152
+ // break;
153
+ // }
154
+ // });
155
+ //
156
+ // $('.addAnswer').click(function(e) {
157
+ // formListener.addAnswer(this);
158
+ // });
159
+ //
160
+ // $('.deleteAnswer').click(function(e) {
161
+ // formListener.deleteAnswer(this);
162
+ // });
163
+ //
164
+ // $('#saveQuestion').click(function(e) {
165
+ // return validate();
166
+ // });
167
+ //
168
+ // $('.sort_answer ul, .classic_answer ul, .matrix_sort_answer ul').sortable({
169
+ // handle: '.wpProQuiz_move',
170
+ // update: function(event, ui) {
171
+ // formListener.setValueClassicAnswer();
172
+ // }
173
+ // });
174
+ //
175
+ // $('#wpProQuiz_correctSameText').change(function() {
176
+ // if(this.checked)
177
+ // $('#wpProQuiz_incorrectMassageBox').hide();
178
+ // else
179
+ // $('#wpProQuiz_incorrectMassageBox').show();
180
+ // });
181
+ //
182
+ // $('#wpProQuiz_tip').change(function(e) {
183
+ // if(this.checked)
184
+ // $('#wpProQuiz_tipBox').show();
185
+ // else
186
+ // $('#wpProQuiz_tipBox').hide();
187
+ // });
188
+ //
189
+ // $('input[name="pointsPerAnswer"]').change(function() {
190
+ // if(this.checked) {
191
+ // $('#wpProQuiz_showPointsBox').show();
192
+ // } else {
193
+ // $('#wpProQuiz_showPointsBox').hide();
194
+ // }
195
+ // });
196
+ //
197
+ // $('input[name="answerPointsActivated"]').change(function() {
198
+ // if(this.checked) {
199
+ // $('input[name="points"]').attr('disabled', 'disabled');
200
+ // $('.wpProQuiz_answerPoints').show();
201
+ // $('#wpProQuiz_showPointsBox').show();
202
+ // } else {
203
+ // $('input[name="points"]').removeAttr('disabled');
204
+ // $('.wpProQuiz_answerPoints').hide();
205
+ // $('#wpProQuiz_showPointsBox').hide();
206
+ // }
207
+ // });
208
+ //
209
+ // $('.wpProQuiz_demoBox a').mouseover(function() {
210
+ // $(this).next().show();
211
+ // }).mouseout(function() {
212
+ // $(this).next().hide();
213
+ // }).click(function() {
214
+ // return false;
215
+ // });
216
+ //
217
+ // },
218
+ //
219
+ // displaySingle: function(type) {
220
+ // $('.classic_answer').find('input[name="answerJson[classic_answer][correct][]"]').each(function() {
221
+ // $("<input type=" + type + " />").attr({ name: this.name, value: this.value, checked: this.checked}).insertBefore(this);
222
+ // }).remove();
223
+ //
224
+ // $('.classic_answer').css('display', 'block');
225
+ // },
226
+ //
227
+ // displayFreeAnswer: function() {
228
+ // $('.free_answer').css('display', 'block');
229
+ // },
230
+ //
231
+ // displaySortAnswer: function() {
232
+ // $('.sort_answer').css('display', 'block');
233
+ // },
234
+ //
235
+ // displayMatrixSortAnswer: function() {
236
+ // $('.matrix_sort_answer').show();
237
+ // },
238
+ //
239
+ // displayClozeAnswer: function() {
240
+ // $('.cloze_answer').show();
241
+ // },
242
+ //
243
+ // addAnswer: function(obj) {
244
+ // $(obj).siblings('ul').children().first()
245
+ // .clone().css('display', 'block')
246
+ // .appendTo($(obj).siblings('ul'));
247
+ //
248
+ // formListener.setValueClassicAnswer();
249
+ //
250
+ // $('.deleteAnswer').click(function(e) {
251
+ // formListener.deleteAnswer(this);
252
+ // });
253
+ // },
254
+ //
255
+ // deleteAnswer: function(obj) {
256
+ // $(obj).parent().parent('li').remove();
257
+ //
258
+ // formListener.setValueClassicAnswer();
259
+ // },
260
+ //
261
+ // setValueClassicAnswer: function() {
262
+ //
263
+ // $('.classic_answer ul, .matrix_sort_answer ul, .sort_answer ul').children().each(function() {
264
+ // var index = $(this).index();
265
+ //
266
+ // $(this).find( 'input[name="answerJson[classic_answer][correct][]"], '
267
+ // + 'input[name="answerJson[classic_answer][html][]"], '
268
+ // + 'input[name="answerJson[answer_matrix_sort][answer_html][]"], '
269
+ // + 'input[name="answerJson[answer_matrix_sort][sort_string_html][]"], '
270
+ // + 'input[name="answerJson[answer_sort][html][]"]').val(index);
271
+ // });
272
+ // }
273
+ // };
274
+ //
275
+ // var validate = function () {
276
+ //
277
+ // var question = '';
278
+ // var type = $('input[name="answerType"]:checked');
279
+ // var $points = $('input[name="points"]');
280
+ //
281
+ // if(tinymce.editors.question != undefined && !tinymce.editors.question.isHidden()) {
282
+ // question = tinymce.editors.question.getContent();
283
+ // } else {
284
+ // question = $('textarea[name="question"]').val();
285
+ // }
286
+ //
287
+ // if(isNaN($points.val()) || $points.val() < 1) {
288
+ // alert(wpProQuizLocalize.no_nummber_points);
289
+ // $points.focus();
290
+ // return false;
291
+ // }
292
+ //
293
+ // if(isEmpty(question)) {
294
+ // alert(wpProQuizLocalize.no_question_msg);
295
+ // return false;
296
+ // }
297
+ //
298
+ //
299
+ // if(type.val() == 'single' || type.val() == 'multiple') {
300
+ // var findChecked = true;
301
+ // var findPoints = true;
302
+ // if($('input[name="answerJson[classic_answer][correct][]"]:checked').each(function() {
303
+ // if($.trim($(this).parent().parent().parent().parent().find('textarea').val()) != '') {
304
+ // findChecked &= true;
305
+ // } else {
306
+ // findChecked = false;
307
+ // }
308
+ // })
309
+ // .size() < 1) {
310
+ // alert(wpProQuizLocalize.no_correct_msg);
311
+ // return false;
312
+ // }
313
+ //
314
+ // if($('input[name="answerPointsActivated"]:checked').length) {
315
+ // $('input[name="answerJson[classic_answer][points][]"]').each(function() {
316
+ // if($.trim($(this).parentsUntil('table').find('textarea').val()) != '') {
317
+ // var points = $.trim($(this).val());
318
+ //
319
+ // if(isNaN(points) || points == '' || points < 0) {
320
+ // findPoints = false;
321
+ // } else {
322
+ // findPoints &= true;
323
+ // }
324
+ // }
325
+ // });
326
+ //
327
+ // if(!findPoints) {
328
+ // alert(wpProQuizLocalize.no_nummber_points_new);
329
+ // return false;
330
+ // }
331
+ // }
332
+ //
333
+ // if(!findChecked) {
334
+ // alert(wpProQuizLocalize.no_answer_msg);
335
+ // return false;
336
+ // }
337
+ // } else if(type.val() == 'sort_answer') {
338
+ // var findChecked = false;
339
+ // var findPoints = true;
340
+ //
341
+ // $('textarea[name="answerJson[answer_sort][answer][]"]').each(function() {
342
+ // if(isEmpty($(this).val())) {
343
+ // findChecked |= false;
344
+ // } else {
345
+ // findChecked = true;
346
+ // }
347
+ // });
348
+ //
349
+ // if($('input[name="answerPointsActivated"]:checked').length) {
350
+ // $('input[name="answerJson[answer_sort][points][]"]').each(function() {
351
+ // if($.trim($(this).parentsUntil('table').find('textarea').val()) != '') {
352
+ // var points = $.trim($(this).val());
353
+ //
354
+ // if(isNaN(points) || points == '' || points < 0) {
355
+ // findPoints = false;
356
+ // } else {
357
+ // findPoints &= true;
358
+ // }
359
+ // }
360
+ // });
361
+ //
362
+ // if(!findPoints) {
363
+ // alert(wpProQuizLocalize.no_nummber_points_new);
364
+ // return false;
365
+ // }
366
+ // }
367
+ //
368
+ // if(!findChecked) {
369
+ // alert(wpProQuizLocalize.no_answer_msg);
370
+ // return false;
371
+ // }
372
+ // } else if(type.val() == 'matrix_sort_answer') {
373
+ // var findChecked = false;
374
+ // var findPoints = true;
375
+ // $('textarea[name="answerJson[answer_matrix_sort][answer][]"]').each(function() {
376
+ // if(isEmpty($(this).val())) {
377
+ // findChecked |= false;
378
+ // } else {
379
+ //
380
+ // var $sortString = $(this).parent().parent().find('textarea[name="answerJson[answer_matrix_sort][sort_string][]"]');
381
+ //
382
+ // if(isEmpty($sortString.val())) {
383
+ // findChecked |= false;
384
+ // } else {
385
+ // findChecked = true;
386
+ // }
387
+ // }
388
+ // });
389
+ //
390
+ // if($('input[name="answerPointsActivated"]:checked').length) {
391
+ // $('input[name="answerJson[answer_matrix_sort][points][]"]').each(function() {
392
+ // if($.trim($(this).parentsUntil('table').find('textarea').val()) != '') {
393
+ // var points = $.trim($(this).val());
394
+ //
395
+ // if(isNaN(points) || points == '' || points < 0) {
396
+ // findPoints = false;
397
+ // } else {
398
+ // findPoints &= true;
399
+ // }
400
+ // }
401
+ // });
402
+ //
403
+ // if(!findPoints) {
404
+ // alert(wpProQuizLocalize.no_nummber_points_new);
405
+ // return false;
406
+ // }
407
+ // }
408
+ //
409
+ // if(!findChecked) {
410
+ // alert(wpProQuizLocalize.no_answer_msg);
411
+ // return false;
412
+ // }
413
+ // } else if(type.val() == 'cloze_answer') {
414
+ // var clozeText = '';
415
+ //
416
+ // if(tinymce.editors.cloze != undefined && !tinymce.editors.cloze.isHidden()) {
417
+ // clozeText = tinymce.editors.cloze.getContent();
418
+ // } else {
419
+ // clozeText = $('textarea[name="answerJson[answer_cloze][text]"]').val();
420
+ // }
421
+ //
422
+ // if(isEmpty(clozeText)) {
423
+ // alert(wpProQuizLocalize.no_answer_msg);
424
+ // return false;
425
+ // }
426
+ // } else if(type.val() == 'free_answer') {
427
+ // var freeText = $('textarea[name="answerJson[free_answer][correct]"]').val();
428
+ //
429
+ // if(isEmpty(freeText)) {
430
+ // alert(wpProQuizLocalize.no_answer_msg);
431
+ // return false;
432
+ // }
433
+ // }
434
+ //
435
+ // return true;
436
+ // };
437
+ //
438
+ // var isEmpty = function(str) {
439
+ // str = $.trim(str);
440
+ // return (!str || 0 === str.length);
441
+ // };
442
+ //
443
+ // formListener.setup();
444
+ // setup();
445
+ // };
446
 
447
  $.fn.wpProQuiz_questionOverall = function() {
448
 
744
  $('#wpProQuiz_save').click(function(e) {
745
  if(!methode.validInput())
746
  e.preventDefault();
747
+
748
+ $('select[name="prerequisiteList[]"] option').attr('selected', 'selected');
749
  });
750
 
751
  $('input[name="quizRunOnce"]').change(function(e) {
789
  }
790
  });
791
 
792
+ $('#btnPrerequisiteAdd').click(function() {
793
+ $('select[name="quizList"] option:selected').removeAttr('selected').appendTo('select[name="prerequisiteList[]"]');
794
+ });
795
+
796
+ $('#btnPrerequisiteDelete').click(function() {
797
+ $('select[name="prerequisiteList[]"] option:selected').removeAttr('selected').appendTo('select[name="quizList"]');
798
+ });
799
+
800
+ $('input[name="prerequisite"]').change(function() {
801
+ if(this.checked)
802
+ $('#prerequisiteBox').show();
803
+ else
804
+ $('#prerequisiteBox').hide();
805
+
806
+
807
+ }).change();
808
+
809
+ $('input[name="toplistDataAddMultiple"]').change(function() {
810
+ if(this.checked)
811
+ $('#toplistDataAddBlockBox').show();
812
+ else
813
+ $('#toplistDataAddBlockBox').hide();
814
+
815
+ }).change();
816
+
817
+ $('input[name="toplistActivated"]').change(function() {
818
+ if(this.checked)
819
+ $('#toplistBox > tr:gt(0)').show();
820
+ else
821
+ $('#toplistBox > tr:gt(0)').hide();
822
+
823
+ }).change();
824
+
825
  $('#statistics_on').change();
826
  $('#wpProQuiz_resultGradeEnabled').change();
827
  $('input[name="quizRunOnce"]').change();
859
  setStatistics: function(json) {
860
  var $table = $('.wpProQuiz_statistics_table');
861
  var $tbody = $table.find('tbody');
 
 
 
862
 
863
  if(currectTab == 'wpProQuiz_typeOverview') {
864
  return;
868
  i.find('.wpProQuiz_cCorrect').text(j.cCorrect + ' (' + j.pCorrect + '%)');
869
  i.find('.wpProQuiz_cIncorrect').text(j.cIncorrect + ' (' + j.pIncorrect + '%)');
870
  i.find('.wpProQuiz_cTip').text(j.cTip);
871
+ i.find('.wpProQuiz_cPoints').text(j.cPoints);
872
 
873
  if(r == true) {
874
+ $table.find('.wpProQuiz_cResult').text(j.result + '%');
 
 
 
 
 
 
 
 
 
 
 
875
  }
876
  };
877
 
938
  d.find('.wpProQuiz_cCorrect').text(v.cCorrect + ' (' + v.pCorrect + '%)');
939
  d.find('.wpProQuiz_cIncorrect').text(v.cIncorrect + ' (' + v.pIncorrect + '%)');
940
  d.find('.wpProQuiz_cTip').text(v.cTip);
941
+ d.find('.wpProQuiz_cResult').text(v.result + '%');
942
  } else {
943
  d.find('th').removeAttr('style');
944
  }
1104
  init();
1105
  };
1106
 
1107
+ $.fn.wpProQuiz_toplist = function() {
1108
+ var methods = this;
1109
+ var elements = {
1110
+ sort: $('#wpProQuiz_sorting'),
1111
+ pageLimit: $('#wpProQuiz_pageLimit'),
1112
+ currentPage: $('#wpProQuiz_currentPage'),
1113
+ loadDataBox: $('#wpProQuiz_loadData'),
1114
+ pageLeft: $('#wpProQuiz_pageLeft'),
1115
+ pageRight: $('#wpProQuiz_pageRight'),
1116
+ dataBody: $('#wpProQuiz_toplistTable tbody'),
1117
+ rowClone: $('#wpProQuiz_toplistTable tbody tr:eq(0)').clone(),
1118
+ content: $('#wpProQuiz_content')
1119
+ };
1120
+
1121
+ methods = {
1122
+ loadData: function(action) {
1123
+ var location = window.location.pathname + window.location.search;
1124
+ var url = location.replace('admin.php', 'admin-ajax.php') + '&action=load_toplist';
1125
+ var data = {
1126
+ action: 'wp_pro_quiz_load_toplist',
1127
+ sort: elements.sort.val(),
1128
+ limit: elements.pageLimit.val(),
1129
+ page: elements.currentPage.val()
1130
+ };
1131
+
1132
+ if(action != undefined) {
1133
+ $.extend(data, action);
1134
+ }
1135
+
1136
+ elements.loadDataBox.show();
1137
+ elements.content.hide();
1138
+
1139
+ $.post(url, data, function(json) {
1140
+ methods.handleDataRequest(json.data);
1141
+
1142
+ if(json.nav != undefined) {
1143
+ methods.handleNav(json.nav);
1144
+ }
1145
+
1146
+ elements.loadDataBox.hide();
1147
+ elements.content.show();
1148
+ }, 'json');
1149
+ },
1150
+
1151
+ handleNav: function(nav) {
1152
+ elements.currentPage.empty();
1153
+
1154
+ for(var i = 1; i <= nav.pages; i++) {
1155
+ $(document.createElement('option'))
1156
+ .val(i).text(i)
1157
+ .appendTo(elements.currentPage);
1158
+ }
1159
+
1160
+ methods.checkNav();
1161
+ },
1162
+
1163
+ handleDataRequest: function(json) {
1164
+
1165
+ elements.dataBody.empty();
1166
+
1167
+ $.each(json, function(i, v) {
1168
+ var data = elements.rowClone.clone().children();
1169
+
1170
+ data.eq(0).children().val(v.id);
1171
+ data.eq(1).text(v.name);
1172
+ data.eq(2).text(v.email);
1173
+ data.eq(3).text(v.type);
1174
+ data.eq(4).text(v.date);
1175
+ data.eq(5).text(v.points);
1176
+ data.eq(6).text(v.result);
1177
+
1178
+ data.parent().show().appendTo(elements.dataBody);
1179
+ });
1180
+
1181
+ if(!json.length) {
1182
+ $(document.createElement('td'))
1183
+ .attr('colspan', '7')
1184
+ .text(wpProQuizLocalize.no_data_available)
1185
+ .css({'font-weight': 'bold', 'text-align': 'center', 'padding': '5px'})
1186
+ .appendTo(document.createElement('tr'))
1187
+ .appendTo(elements.dataBody);
1188
+ }
1189
+
1190
+ },
1191
+
1192
+ checkNav: function() {
1193
+ var n = elements.currentPage.val();
1194
+
1195
+ if(n == 1) {
1196
+ elements.pageLeft.hide();
1197
+ } else {
1198
+ elements.pageLeft.show();
1199
+ }
1200
+
1201
+ if(n == elements.currentPage.children().length) {
1202
+ elements.pageRight.hide();
1203
+ } else {
1204
+ elements.pageRight.show();
1205
+ }
1206
+ }
1207
+ };
1208
+
1209
+ var init = function() {
1210
+ elements.sort.change(function() {
1211
+ methods.loadData();
1212
+ });
1213
+
1214
+ elements.pageLimit.change(function() {
1215
+ methods.loadData({nav: 1});
1216
+ });
1217
+
1218
+ elements.currentPage.change(function() {
1219
+ methods.checkNav();
1220
+ methods.loadData();
1221
+ });
1222
+
1223
+ elements.pageLeft.click(function() {
1224
+ elements.currentPage.val(Number(elements.currentPage.val()) - 1);
1225
+ methods.checkNav();
1226
+ methods.loadData();
1227
+ });
1228
+
1229
+ elements.pageRight.click(function() {
1230
+ elements.currentPage.val(Number(elements.currentPage.val()) + 1);
1231
+ methods.checkNav();
1232
+ methods.loadData();
1233
+ });
1234
+
1235
+ $('#wpProQuiz_deleteAll').click(function() {
1236
+ methods.loadData({a: 'deleteAll'});
1237
+ });
1238
+
1239
+ $('#wpProQuiz_action').click(function() {
1240
+ var name = $('#wpProQuiz_actionName').val();
1241
+
1242
+ if(name != '0') {
1243
+
1244
+ var ids = $('input[name="checkedData[]"]:checked').map(function() {
1245
+ return $(this).val();
1246
+ }).get();
1247
+
1248
+ methods.loadData({a: name, toplistIds: ids});
1249
+ }
1250
+ });
1251
+
1252
+ $('#wpProQuiz_checkedAll').change(function() {
1253
+ if(this.checked)
1254
+ $('input[name="checkedData[]"]').attr('checked', 'checked');
1255
+ else
1256
+ $('input[name="checkedData[]"]').removeAttr('checked', 'checked');
1257
+ });
1258
+
1259
+ methods.loadData({nav: 1});
1260
+ };
1261
+
1262
+ init();
1263
+ };
1264
+
1265
 
1266
  if($('.wpProQuiz_quizOverall').length)
1267
  $('.wpProQuiz_quizOverall').wpProQuiz_preview();
1273
  if($('.wpProQuiz_quizEdit').length)
1274
  $('.wpProQuiz_quizEdit').wpProQuiz_quizEdit();
1275
 
1276
+ // if($('.wpProQuiz_questionEdit').length)
1277
+ // $('.wpProQuiz_questionEdit').wpProQuiz_questionEdit();
1278
 
1279
  if($('.wpProQuiz_questionOverall').length)
1280
  $('.wpProQuiz_questionOverall').wpProQuiz_questionOverall();
1281
 
1282
  if($('.wpProQuiz_statistics').length)
1283
  $('.wpProQuiz_statistics').wpProQuiz_statistics();
1284
+
1285
+ if($('.wpProQuiz_toplist').length)
1286
+ $('.wpProQuiz_toplist').wpProQuiz_toplist();
1287
+
1288
+ /**
1289
+ * NEW
1290
+ */
1291
+ function WpProQuiz_Admin() {
1292
+ var global = this;
1293
+
1294
+ global = {
1295
+ displayChecked: function(t, box, neg, disabled) {
1296
+ var c = neg ? !t.checked : t.checked;
1297
+
1298
+ if(disabled)
1299
+ c ? box.attr('disabled', 'disabled') : box.removeAttr('disabled');
1300
+ else
1301
+ c ? box.show() : box.hide();
1302
+ },
1303
+
1304
+ isEmpty: function(text) {
1305
+ text = $.trim(text);
1306
+
1307
+ return (!text || 0 === text.length);
1308
+ },
1309
+
1310
+ isNumber: function(number) {
1311
+ number = $.trim(number);
1312
+ return !global.isEmpty(number) && !isNaN(number);
1313
+ },
1314
+
1315
+ getMceContent: function(id) {
1316
+ var editor = tinymce.editors[id];
1317
+
1318
+ if(editor != undefined && !editor.isHidden()) {
1319
+ return editor.getContent();
1320
+ }
1321
+
1322
+ return $('#'+id).val();
1323
+ }
1324
+ };
1325
+
1326
+ var module = {
1327
+
1328
+ gobalSettings: function() {
1329
+ var init = function() {
1330
+ $('.wpProQuiz_tab').click(function() {
1331
+ var $this = $(this);
1332
+
1333
+ $('.wpProQuiz_tab').removeClass('button-primary').addClass('button-secondary');
1334
+ $this.removeClass('button-secondary').addClass('button-primary');
1335
+
1336
+ $('#problemInfo, #problemContent, #globalContent').hide('fast');
1337
+
1338
+ if($this.attr('id') == 'globalTab') {
1339
+ $('#globalContent').show('fast');
1340
+ } else {
1341
+ $('#problemInfo, #problemContent').show('fast');
1342
+ }
1343
+ });
1344
+ };
1345
+
1346
+ init();
1347
+ },
1348
+
1349
+ questionEdit: function() {
1350
+ var methode = this;
1351
+ var filter = $.noop();
1352
+
1353
+ var elements = {
1354
+ answerChildren: $('.answer_felder > div'),
1355
+ pointsModus: $('input[name="answerPointsActivated"]'),
1356
+ gPoints: $('input[name="points"]')
1357
+ };
1358
+
1359
+ methode = {
1360
+ generateArrayIndex: function() {
1361
+ var type = $('input[name="answerType"]:checked').val();
1362
+ type = (type == 'single' || type == 'multiple') ? 'classic_answer' : type;
1363
+
1364
+ $('.answerList').each(function() {
1365
+ var currentType = $(this).parent().attr('class');
1366
+
1367
+ $(this).children().each(function(i, v) {
1368
+ $(this).find('[name^="answerData"]').each(function() {
1369
+ var name = this.name;
1370
+ var x = name.search(/\](\[\w+\])+$/);
1371
+ var n = (type == currentType) ? i : 'none';
1372
+
1373
+ if(x > 0) {
1374
+ this.name = 'answerData[' + n + name.substring(x, name.length);
1375
+
1376
+ }
1377
+ });
1378
+ });
1379
+ });
1380
+ },
1381
+
1382
+ globalValidate: function() {
1383
+ if(global.isEmpty(global.getMceContent('question'))) {
1384
+ alert(wpProQuizLocalize.no_question_msg);
1385
+
1386
+ return false;
1387
+ }
1388
+
1389
+ if(!elements.pointsModus.is(':checked')) {
1390
+ var p = elements.gPoints.val();
1391
+
1392
+ if(!global.isNumber(p) || p < 1) {
1393
+ alert(wpProQuizLocalize.no_nummber_points);
1394
+
1395
+ return false;
1396
+ }
1397
+ } else {
1398
+ if($('input[name="answerType"]:checked').val() == 'free_answer') {
1399
+ alert(wpProQuizLocalize.dif_points);
1400
+ return false;
1401
+ }
1402
+ }
1403
+
1404
+ if(filter() === false)
1405
+ return false;
1406
+
1407
+ return true;
1408
+ },
1409
+
1410
+ answerRemove: function() {
1411
+ var li = $(this).parent();
1412
+
1413
+ if(li.parent().children().length < 2)
1414
+ return false;
1415
+
1416
+ li.remove();
1417
+
1418
+ return false;
1419
+ }
1420
+ };
1421
+
1422
+ var validate = {
1423
+ classic_answer: function() {
1424
+ var findText = 0;
1425
+ var findCorrect = 0;
1426
+ var findPoints = 0;
1427
+
1428
+ $('.classic_answer .answerList').children().each(function() {
1429
+ var t = $(this);
1430
+
1431
+ if(!global.isEmpty(t.find('textarea[name="answerData[][answer]"]').val())) {
1432
+ findText++;
1433
+
1434
+ if(t.find('input[name="answerData[][correct]"]:checked').length) {
1435
+ findCorrect++;
1436
+ }
1437
+
1438
+ var p = t.find('input[name="answerData[][points]"]').val();
1439
+
1440
+ if(global.isNumber(p) && p >= 0) {
1441
+ findPoints++;
1442
+ }
1443
+ }
1444
+ });
1445
+
1446
+ if(!findText) {
1447
+ alert(wpProQuizLocalize.no_answer_msg);
1448
+ return false;
1449
+ }
1450
+
1451
+ if(!findCorrect) {
1452
+ alert(wpProQuizLocalize.no_correct_msg);
1453
+ return false;
1454
+ }
1455
+
1456
+ if(findPoints != findText && elements.pointsModus.is(':checked')) {
1457
+ alert(wpProQuizLocalize.no_nummber_points_new);
1458
+ return false;
1459
+ }
1460
+
1461
+ return true;
1462
+ },
1463
+
1464
+ free_answer: function() {
1465
+ if(global.isEmpty($('.free_answer textarea[name="answerData[][answer]"]').val())) {
1466
+ alert(wpProQuizLocalize.no_answer_msg);
1467
+ return false;
1468
+ }
1469
+
1470
+ return true;
1471
+ },
1472
+
1473
+ cloze_answer: function() {
1474
+ if(global.isEmpty(global.getMceContent('cloze'))) {
1475
+ alert(wpProQuizLocalize.no_answer_msg);
1476
+ return false;
1477
+ }
1478
+
1479
+ return true;
1480
+ },
1481
+
1482
+ sort_answer: function() {
1483
+ var findText = 0;
1484
+ var findPoints = 0;
1485
+
1486
+ $('.sort_answer .answerList').children().each(function() {
1487
+ var t = $(this);
1488
+
1489
+ if(!global.isEmpty(t.find('textarea[name="answerData[][answer]"]').val())) {
1490
+ findText++;
1491
+
1492
+ var p = t.find('input[name="answerData[][points]"]').val();
1493
+
1494
+ if(global.isNumber(p) && p >= 0) {
1495
+ findPoints++;
1496
+ }
1497
+ }
1498
+ });
1499
+
1500
+ if(!findText) {
1501
+ alert(wpProQuizLocalize.no_answer_msg);
1502
+ return false;
1503
+ }
1504
+
1505
+ if(findPoints != findText && elements.pointsModus.is(':checked')) {
1506
+ alert(wpProQuizLocalize.no_nummber_points_new);
1507
+ return false;
1508
+ }
1509
+
1510
+ return true;
1511
+ },
1512
+
1513
+ matrix_sort_answer: function() {
1514
+ var findText = 0;
1515
+ var findPoints = 0;
1516
+ var sortString = true;
1517
+ var menge = 0;
1518
+
1519
+ $('.matrix_sort_answer .answerList').children().each(function() {
1520
+ var t = $(this);
1521
+ var p = t.find('input[name="answerData[][points]"]').val();
1522
+
1523
+ if(!global.isEmpty(t.find('textarea[name="answerData[][answer]"]').val())) {
1524
+ findText++;
1525
+ menge++;
1526
+
1527
+ if(global.isEmpty(t.find('textarea[name="answerData[][sort_string]"]').val())) {
1528
+ sortString = false;
1529
+ }
1530
+
1531
+ if(global.isNumber(p) && p >= 0) {
1532
+ findPoints++;
1533
+ }
1534
+ } else {
1535
+ if(!global.isEmpty(t.find('textarea[name="answerData[][sort_string]"]').val())) {
1536
+ menge++;
1537
+
1538
+ if(global.isNumber(p) && p >= 0) {
1539
+ findPoints++;
1540
+ }
1541
+ }
1542
+ }
1543
+ });
1544
+
1545
+ if(!findText) {
1546
+ alert(wpProQuizLocalize.no_answer_msg);
1547
+ return false;
1548
+ }
1549
+
1550
+ if(!sortString) {
1551
+ alert(wpProQuizLocalize.no_sort_element_criterion);
1552
+ return false;
1553
+ }
1554
+
1555
+ if(findPoints != menge && elements.pointsModus.is(':checked')) {
1556
+ alert(wpProQuizLocalize.no_nummber_points_new);
1557
+ return false;
1558
+ }
1559
+
1560
+ return true;
1561
+ }
1562
+ };
1563
+
1564
+ var formListener = function() {
1565
+ $('#wpProQuiz_tip').change(function() {
1566
+ global.displayChecked(this, $('#wpProQuiz_tipBox'));
1567
+ }).change();
1568
+
1569
+ $('#wpProQuiz_correctSameText').change(function() {
1570
+ global.displayChecked(this, $('#wpProQuiz_incorrectMassageBox'), true);
1571
+ }).change();
1572
+
1573
+ $('input[name="answerType"]').click(function() {
1574
+ elements.answerChildren.hide();
1575
+ var v = this.value;
1576
+
1577
+ if(v == 'single' || v == 'multiple') {
1578
+ var type = (v == 'single') ? 'radio' : 'checkbox';
1579
+ v = 'classic_answer';
1580
+
1581
+ $('.wpProQuiz_classCorrect').each(function() {
1582
+ $("<input type=" + type + " />")
1583
+ .attr({ name: this.name, value: this.value, checked: this.checked})
1584
+ .addClass('wpProQuiz_classCorrect wpProQuiz_checkbox')
1585
+ .insertBefore(this);
1586
+ }).remove();
1587
+ }
1588
+
1589
+ filter = (validate[v] != undefined) ? validate[v] : $.noop();
1590
+
1591
+ $('.' + v).show();
1592
+ });
1593
+
1594
+ $('input[name="answerType"]:checked').click();
1595
+
1596
+ $('.deleteAnswer').click(methode.answerRemove);
1597
+
1598
+ $('.addAnswer').click(function() {
1599
+ var ul = $(this).siblings('ul');
1600
+ var clone = ul.find('li:eq(0)').clone();
1601
+
1602
+ clone.find('.wpProQuiz_checkbox').removeAttr('checked');
1603
+ clone.find('.wpProQuiz_text').val('');
1604
+ clone.find('.wpProQuiz_points').val(1);
1605
+ clone.find('.deleteAnswer').click(methode.answerRemove);
1606
+
1607
+ clone.appendTo(ul);
1608
+
1609
+ return false;
1610
+ });
1611
+
1612
+ $('.sort_answer ul, .classic_answer ul, .matrix_sort_answer ul').sortable({
1613
+ handle: '.wpProQuiz_move'
1614
+ });
1615
+
1616
+ $('#saveQuestion').click(function() {
1617
+ if(!methode.globalValidate()) {
1618
+ return false;
1619
+ }
1620
+
1621
+ methode.generateArrayIndex();
1622
+
1623
+ return true;
1624
+ });
1625
+
1626
+ $(elements.pointsModus).change(function() {
1627
+ global.displayChecked(this, $('.wpProQuiz_answerPoints'));
1628
+ global.displayChecked(this, $('#wpProQuiz_showPointsBox'));
1629
+ global.displayChecked(this, elements.gPoints, false, true);
1630
+ }).change();
1631
+ };
1632
+
1633
+ var init = function() {
1634
+ elements.answerChildren.hide();
1635
+
1636
+ formListener();
1637
+ };
1638
+
1639
+ init();
1640
+ }
1641
+ };
1642
+
1643
+ var init = function() {
1644
+ var m = $.noop;
1645
+ if($('.wpProQuiz_questionEdit').length) {
1646
+ m = module.questionEdit;
1647
+ } else if($('.wpProQuiz_globalSettings').length) {
1648
+ m = module.gobalSettings;
1649
+ }
1650
+
1651
+ m();
1652
+ };
1653
+
1654
+ init();
1655
+ }
1656
+
1657
+ WpProQuiz_Admin();
1658
  });
js/wpProQuiz_admin.min.js CHANGED
@@ -1,35 +1,41 @@
1
- jQuery(document).ready(function(a){a.fn.wpProQuiz_preview=function(){var c={openPreview:function(e){window.open(a(e).attr("href"),"wpProQuizPreview","width=900,height=900")}};a(".wpProQuiz_prview").click(function(a){c.openPreview(this);a.preventDefault()})};a.fn.wpProQuiz_quizOverall=function(){var c={changeExport:function(e){$input=a(e);$export=a(".wpProQuiz_exportList");$ul=$export.find("ul").first();$export.find("li").remove();a('input[name="exportItems"]').each(function(){$this=a(this);if(this.checked){var b=
2
- $this.parent().parent().find(".wpProQuiz_quizName").text();a("<li>"+b+"</li>").appendTo($ul)}})},startExport:function(){$ele=a('input[name="exportItems"]:checked');if(1>$ele.length)return alert(wpProQuizLocalize.no_selected_quiz),!1;$hidden=a("#exportHidden");$hidden.html("");a('input[name="exportItems"]').each(function(){$this=a(this);this.checked&&a('<input type="hidden" value="'+this.value+'" name="exportIds[]">').appendTo($hidden)});return!0}};a(".wpProQuiz_delete").click(function(a){return!confirm(wpProQuizLocalize.delete_msg)?
3
- (a.preventDefault(),!1):!0});a(".wpProQuiz_import").click(function(c){c.preventDefault();a(".wpProQuiz_importList").toggle("fast");a(".wpProQuiz_exportList").hide();a(".wpProQuiz_exportCheck").hide()});a(".wpProQuiz_export").click(function(c){c.preventDefault();a(".wpProQuiz_exportList").toggle("fast");a(".wpProQuiz_exportCheck").toggle("fast");a(".wpProQuiz_importList").hide()});a('input[name="exportItems"]').change(function(){c.changeExport(this)});a('input[name="exportItemsAll"]').change(function(){var c=
4
- a('input[name="exportItems"]');this.checked?c.attr("checked",!0):c.attr("checked",!1);c.change()});a("#exportStart").click(function(a){c.startExport()||a.preventDefault()})};a.fn.wpProQuiz_questionEdit=function(){var c={setup:function(){a('input[name="answerType"]').click(function(){a(".answer_felder").children().css("display","none");switch(this.value){case "single":c.displaySingle("radio");break;case "multiple":c.displaySingle("checkbox");break;case "free_answer":c.displayFreeAnswer();break;case "sort_answer":c.displaySortAnswer();
5
- break;case "matrix_sort_answer":c.displayMatrixSortAnswer();break;case "cloze_answer":c.displayClozeAnswer()}});a(".addAnswer").click(function(){c.addAnswer(this)});a(".deleteAnswer").click(function(){c.deleteAnswer(this)});a("#saveQuestion").click(function(){return e()});a(".sort_answer ul, .classic_answer ul, .matrix_sort_answer ul").sortable({handle:".wpProQuiz_move",update:function(){c.setValueClassicAnswer()}});a("#wpProQuiz_correctSameText").change(function(){this.checked?a("#wpProQuiz_incorrectMassageBox").hide():
6
- a("#wpProQuiz_incorrectMassageBox").show()});a("#wpProQuiz_tip").change(function(){this.checked?a("#wpProQuiz_tipBox").show():a("#wpProQuiz_tipBox").hide()});a('input[name="pointsPerAnswer"]').change(function(){this.checked?a("#wpProQuiz_showPointsBox").show():a("#wpProQuiz_showPointsBox").hide()});a(".wpProQuiz_demoBox a").mouseover(function(){a(this).next().show()}).mouseout(function(){a(this).next().hide()}).click(function(){return!1})},displaySingle:function(b){a(".classic_answer").find('input[name="answerJson[classic_answer][correct][]"]').each(function(){a("<input type="+
7
- b+" />").attr({name:this.name,value:this.value,checked:this.checked}).insertBefore(this)}).remove();a(".classic_answer").css("display","block")},displayFreeAnswer:function(){a(".free_answer").css("display","block")},displaySortAnswer:function(){a(".sort_answer").css("display","block")},displayMatrixSortAnswer:function(){a(".matrix_sort_answer").show()},displayClozeAnswer:function(){a(".cloze_answer").show()},addAnswer:function(b){a(b).siblings("ul").children().first().clone().css("display","block").appendTo(a(b).siblings("ul"));
8
- c.setValueClassicAnswer();a(".deleteAnswer").click(function(){c.deleteAnswer(this)})},deleteAnswer:function(b){a(b).parent("li").remove();c.setValueClassicAnswer()},setValueClassicAnswer:function(){a(".classic_answer ul, .matrix_sort_answer ul, .sort_answer ul").children().each(function(){var b=a(this).index();a(this).find('input[name="answerJson[classic_answer][correct][]"], input[name="answerJson[classic_answer][html][]"], input[name="answerJson[answer_matrix_sort][answer_html][]"], input[name="answerJson[answer_matrix_sort][sort_string_html][]"], input[name="answerJson[answer_sort][html][]"]').val(b)})}},
9
- e=function(){var c="",d=a('input[name="answerType"]:checked'),e=a('input[name="points"]'),c=void 0!=tinymce.editors.question&&!tinymce.editors.question.isHidden()?tinymce.editors.question.getContent():a('textarea[name="question"]').val();if(isNaN(e.val())||1>e.val())return alert(wpProQuizLocalize.no_nummber_points),e.focus(),!1;if(b(c))return alert(wpProQuizLocalize.no_question_msg),!1;if("single"==d.val()||"multiple"==d.val()){var f=!0;if(1>a('input[name="answerJson[classic_answer][correct][]"]:checked').each(function(){f=
10
- ""!=a.trim(a(this).parent().siblings("textarea").val())?f&1:!1}).size())return alert(wpProQuizLocalize.no_correct_msg),!1;if(!f)return alert(wpProQuizLocalize.no_answer_msg),!1}else if("sort_answer"==d.val()){if(f=!1,a('textarea[name="answerJson[answer_sort][answer][]"]').each(function(){f=b(a(this).val())?f|0:!0}),!f)return alert(wpProQuizLocalize.no_answer_msg),!1}else if("matrix_sort_answer"==d.val()){if(f=!1,a('textarea[name="answerJson[answer_matrix_sort][answer][]"]').each(function(){if(b(a(this).val()))f|=
11
- 0;else{var c=a(this).parent().parent().find('textarea[name="answerJson[answer_matrix_sort][sort_string][]"]');f=b(c.val())?f|0:!0}}),!f)return alert(wpProQuizLocalize.no_answer_msg),!1}else if("cloze_answer"==d.val()){if(c="",c=void 0!=tinymce.editors.cloze&&!tinymce.editors.cloze.isHidden()?tinymce.editors.cloze.getContent():a('textarea[name="answerJson[answer_cloze][text]"]').val(),b(c))return alert(wpProQuizLocalize.no_answer_msg),!1}else if("free_answer"==d.val()&&(c=a('textarea[name="answerJson[free_answer][correct]"]').val(),
12
- b(c)))return alert(wpProQuizLocalize.no_answer_msg),!1;return!0},b=function(b){b=a.trim(b);return!b||0===b.length};c.setup();1>a('input[name="answerType"][checked="checked"]').size()&&a('input[name="answerType"][value="single"]').attr({checked:"checked"});a('input[name="answerType"]:checked').click();a("#wpProQuiz_correctSameText").change();a("#wpProQuiz_tip").change();a('input[name="pointsPerAnswer"]').change()};a.fn.wpProQuiz_questionOverall=function(){var c={saveSort:function(){var e={action:"wp_pro_quiz_update_sort",
13
- sort:c.parseSortArray()},b=(window.location.pathname+window.location.search).replace("admin.php","admin-ajax.php")+"&action=save_sort";a.post(b,e,function(){a("#sortMsg").show(400).delay(1E3).hide(400)})},parseSortArray:function(){var c=[];a("tbody tr").each(function(){c.push(this.id.replace("wpProQuiz_questionId_",""))});return c},sortUpdate:function(){a(".wpProQuiz_questionOverall tbody").children().each(function(){$t=a(this).children().first().text(a(this).index()+1)})},loadQuestionCopy:function(){var c=
14
- a("#questionCopySelect"),b=(window.location.pathname+window.location.search).replace("admin.php","admin-ajax.php")+"&action=load_question";c.hide();c.empty();a("#loadDataImg").show();a.post(b,{action:"wp_pro_quiz_load_question",excludeId:1},function(b){a.each(b,function(b,g){var f=a(document.createElement("optgroup"));f.attr("label",g.name);a.each(g.question,function(b,c){a(document.createElement("option")).val(c.id).text(c.name).appendTo(f)});c.append(f)});a("#loadDataImg").hide();c.show()},"json")}};
15
- a(".wp-list-table tbody").sortable({handle:".wpProQuiz_move",update:c.sortUpdate});a(".wpProQuiz_delete").click(function(a){return!confirm(wpProQuizLocalize.delete_msg)?(a.preventDefault(),!1):!0});a("#wpProQuiz_saveSort").click(function(a){a.preventDefault();c.saveSort()});a("#wpProQuiz_questionCopy").click(function(e){var b=a(".wpProQuiz_questionCopy");b.is(":visible")?b.hide():(b.show(),c.loadQuestionCopy());e.preventDefault()})};a.fn.wpProQuiz_quizEdit=function(){var c={addResult:function(){a("#resultList").children().each(function(){if("none"==
16
- a(this).css("display")){var b=a(this),c=b.find('textarea[name="resultTextGrade[text][]"]'),d=c.attr("id"),e=!0;b.find('input[name="resultTextGrade[prozent][]"]').val("0");b.find('input[name="resultTextGrade[activ][]"]').val("1").keyup();void 0!=tinymce.editors[d]&&!tinymce.editors[d].isHidden()&&(e=!1);void 0!=switchEditors&&!e&&(switchEditors.go(d,"toggle"),switchEditors.go(d,"toggle"));void 0!=tinymce.editors[d]?tinymce.editors[d].setContent(""):c.val("");void 0!=tinymce.editors[d]&&!e&&tinyMCE.execCommand("mceRemoveControl",
17
- !1,d);b.parent().children(":visible").last().after(b);void 0!=tinymce.editors[d]&&!e&&tinyMCE.execCommand("mceAddControl",!1,d);a(this).show();void 0!=switchEditors&&!e&&switchEditors.go(d,"toggle");return!1}})},deleteResult:function(b){a(b).parent().parent().hide();a(b).siblings('input[name="resultTextGrade[activ][]"]').val("0")},changeResult:function(b){b=a(b);if(c.validResultInput(b.val()))return b.siblings(".resultProzent").text(b.val()),b.removeAttr("style"),!0;b.css("background-color","#FF9696");
18
- return!1},validResultInput:function(a){if(e(a))return!1;a=a.replace(/\,/,".");return!isNaN(a)&&100>=Number(a)&&0<=Number(a)?null!=a.match(/\./)?3>a.split(".")[1].length:!0:!1},validInput:function(){if(e(a("#wpProQuiz_title").val()))return alert(wpProQuizLocalize.no_title_msg),!1;var b="",b=void 0!=tinymce.editors.text&&!tinymce.editors.text.isHidden()?tinymce.editors.text.getContent():a('textarea[name="text"]').val();if(e(b))return alert(wpProQuizLocalize.no_quiz_start_msg),!1;if(a("#wpProQuiz_resultGradeEnabled:checked").length){var g=
19
- !0;a("#resultList").children().each(function(){if(a(this).is(":visible")&&!c.validResultInput(a(this).find('input[name="resultTextGrade[prozent][]"]').val()))return g=!1});if(!g)return alert(wpProQuizLocalize.fail_grade_result),!1}return!0},resetLock:function(){var b=(window.location.pathname+window.location.search).replace("admin.php","admin-ajax.php"),b=b.replace("action=edit","action=reset_lock");a.post(b,{action:"wp_pro_quiz_reset_lock"},function(){a("#resetLockMsg").show("fast").delay(2E3).hide("fast")})}},
20
- e=function(b){b=a.trim(b);return!b||0===b.length};a("#statistics_on").change(function(){this.checked?a("#statistics_ip_lock_tr").show():a("#statistics_ip_lock_tr").hide()});a(".addResult").click(function(){c.addResult()});a(".deleteResult").click(function(){c.deleteResult(this)});a('input[name="resultTextGrade[prozent][]"]').keyup(function(){c.changeResult(this)}).keydown(function(a){13==a.which&&a.preventDefault()});a("#wpProQuiz_resultGradeEnabled").change(function(){this.checked?(a("#resultGrade").show(),
21
- a("#resultNormal").hide()):(a("#resultGrade").hide(),a("#resultNormal").show())});a("#wpProQuiz_save").click(function(a){c.validInput()||a.preventDefault()});a('input[name="quizRunOnce"]').change(function(){this.checked?(a("#wpProQuiz_quiz_run_once_type").show(),a('input[name="quizRunOnceType"]:checked').change()):a("#wpProQuiz_quiz_run_once_type").hide()});a('input[name="quizRunOnceType"]').change(function(){this.checked&&("1"==this.value||"3"==this.value)?a("#wpProQuiz_quiz_run_once_cookie").show():
22
- a("#wpProQuiz_quiz_run_once_cookie").hide()});a('input[name="resetQuizLock"]').click(function(){c.resetLock();return!1});a(".wpProQuiz_demoBox a").mouseover(function(){a(this).next().show()}).mouseout(function(){a(this).next().hide()}).click(function(){return!1});a('input[name="showMaxQuestion"]').change(function(){this.checked?(a('input[name="statisticsOn"]').removeAttr("checked").attr("disabled","disabled").change(),a("#wpProQuiz_showMaxBox").show()):(a('input[name="statisticsOn"]').removeAttr("disabled"),
23
- a("#wpProQuiz_showMaxBox").hide())});a("#statistics_on").change();a("#wpProQuiz_resultGradeEnabled").change();a('input[name="quizRunOnce"]').change();a('input[name="quizRunOnceType"]:checked').change();a('input[name="showMaxQuestion"]').change()};a.fn.wpProQuiz_statistics=function(){var c="wpProQuiz_typeAnonymeUser",e=!0,b={loadStatistics:function(c){var d=(window.location.pathname+window.location.search).replace("admin.php","admin-ajax.php")+"&action=load_statistics",c={action:"wp_pro_quiz_load_statistics",
24
- userId:c};a("#wpProQuiz_loadData").show();a("#wpProQuiz_statistics_content, #wpProQuiz_statistics_overview").hide();a.post(d,c,b.setStatistics,"json")},setStatistics:function(b){var d=a(".wpProQuiz_statistics_table"),e=d.find("tbody"),f=0,h=0,i=0;if("wpProQuiz_typeOverview"!=c){var j=function(a,b,c){a.find(".wpProQuiz_cCorrect").text(b.cCorrect+" ("+b.pCorrect+"%)");a.find(".wpProQuiz_cIncorrect").text(b.cIncorrect+" ("+b.pIncorrect+"%)");a.find(".wpProQuiz_cTip").text(b.cTip);a.find(".wpProQuiz_cCorrectAnswerPoints").text(b.cCorrectAnswerPoints*
25
- a.find(".wpProQuiz_pointsAnswer").text());!0==c?(0<h?d.find(".wpProQuiz_cResult").text(Math.round(1E4*(f/h))/100+"%"):d.find(".wpProQuiz_cResult").text("0%"),a.find(".wpProQuiz_cCorrectAnswerPoints").text(i)):(f+=b.cCorrectAnswerPoints*a.find(".wpProQuiz_pointsAnswer").text(),h+=(b.cCorrect+b.cIncorrect)*a.find(".wpProQuiz_points").text(),i+=b.cCorrectAnswerPoints*a.find(".wpProQuiz_pointsAnswer").text())};j(d,b.clear,!1);a.each(b.items,function(a,b){j(e.find("#wpProQuiz_tr_"+b.id),b,!1)});j(d.find("tfoot"),
26
- b.global,!0);a("#wpProQuiz_loadData").hide();a("#wpProQuiz_statistics_content, .wpProQuiz_statistics_table").show()}},loadOverview:function(){a(".wpProQuiz_statistics_table, #wpProQuiz_statistics_content, #wpProQuiz_statistics_overview").hide();a("#wpProQuiz_loadData").show();var g=(window.location.pathname+window.location.search).replace("admin.php","admin-ajax.php")+"&action=load_statistics",d={action:"wp_pro_quiz_load_statistics",overview:!0,pageLimit:a("#wpProQuiz_pageLimit").val(),onlyCompleted:Number(a("#wpProQuiz_onlyCompleted").is(":checked")),
27
- page:a("#wpProQuiz_currentPage").val(),generatePageNav:Number(e)};a.post(g,d,function(d){a("#wpProQuiz_statistics_overview_data").empty();if("wpProQuiz_typeOverview"==c){var f=a('<tr><th><a href="#">---</a></th><th class="wpProQuiz_points">---</th><th class="wpProQuiz_cCorrect" style="color: green;">---</th><th class="wpProQuiz_cIncorrect" style="color: red;">---</th><th class="wpProQuiz_cTip">---</th><th class="wpProQuiz_cResult" style="font-weight: bold;">---</th></tr>');a.each(d.items,function(b,
28
- c){var d=f.clone();d.find("a").text(c.userName).data("userId",c.userId).click(function(){a("#userSelect").val(a(this).data("userId"));a("#wpProQuiz_typeRegisteredUser").click();return!1});c.completed?(d.find(".wpProQuiz_points").text(c.cPoints),d.find(".wpProQuiz_cCorrect").text(c.cCorrect+" ("+c.pCorrect+"%)"),d.find(".wpProQuiz_cIncorrect").text(c.cIncorrect+" ("+c.pIncorrect+"%)"),d.find(".wpProQuiz_cTip").text(c.cTip),d.find(".wpProQuiz_cResult").text(Math.round(1E4*(c.cPoints/c.totalPoints))/
29
- 100+"%")):d.find("th").removeAttr("style");a("#wpProQuiz_statistics_overview_data").append(d)});void 0!=d.page&&(b.setPageNav(d.page),e=!1);a("#wpProQuiz_loadData").hide();a("#wpProQuiz_statistics_overview").show()}},"json")},changeTab:function(e){c=e;"wpProQuiz_typeRegisteredUser"==e?b.loadStatistics(a("#userSelect").val()):"wpProQuiz_typeAnonymeUser"==e?b.loadStatistics(0):b.loadOverview()},resetStatistic:function(e){var d="wpProQuiz_typeRegisteredUser"==c?a("#userSelect").val():0,k=(window.location.pathname+
30
- window.location.search).replace("admin.php","admin-ajax.php")+"&action=reset";a.post(k,{action:"wp_pro_quiz_statistics",userId:d,complete:e},function(){b.changeTab(c)})},setPageNav:function(b){b=Math.ceil(b/a("#wpProQuiz_pageLimit").val());a("#wpProQuiz_currentPage").empty();for(var c=1;c<=b;c++)a(document.createElement("option")).val(c).text(c).appendTo(a("#wpProQuiz_currentPage"));a("#wpProQuiz_pageLeft, #wpProQuiz_pageRight").hide();1<a("#wpProQuiz_currentPage option").length&&a("#wpProQuiz_pageRight").show()}};
31
- a(".wpProQuiz_tab").click(function(){var c=a(this);if(c.hasClass("button-primary"))return!1;"wpProQuiz_typeRegisteredUser"==c.attr("id")?a("#wpProQuiz_userBox").show():a("#wpProQuiz_userBox").hide();a(".wpProQuiz_tab").removeClass("button-primary").addClass("button-secondary");c.removeClass("button-secondary").addClass("button-primary");b.changeTab(c.attr("id"));return!1});a("#userSelect").change(function(){b.changeTab("wpProQuiz_typeRegisteredUser")});a(".wpProQuiz_update").click(function(){b.changeTab(c);
32
- return!1});a("#wpProQuiz_reset").click(function(){confirm(wpProQuizLocalize.reset_statistics_msg)&&b.resetStatistic(!1);return!1});a(".wpProQuiz_resetComplete").click(function(){confirm(wpProQuizLocalize.reset_statistics_msg)&&b.resetStatistic(!0);return!1});a("#wpProQuiz_pageLimit, #wpProQuiz_onlyCompleted").change(function(){a("#wpProQuiz_currentPage").val(0);e=!0;b.changeTab(c);return!1});a("#wpProQuiz_currentPage").change(function(){a("#wpProQuiz_pageLeft, #wpProQuiz_pageRight").hide();1!=a("#wpProQuiz_currentPage option").length&&
33
- (a("#wpProQuiz_currentPage option:first-child:selected").length?a("#wpProQuiz_pageRight").show():a("#wpProQuiz_currentPage option:last-child:selected").length?a("#wpProQuiz_pageLeft").show():a("#wpProQuiz_pageLeft, #wpProQuiz_pageRight").show());b.changeTab(c)});a("#wpProQuiz_pageRight").click(function(){a("#wpProQuiz_currentPage option:selected").next().attr("selected","selected");a("#wpProQuiz_currentPage").change();return!1});a("#wpProQuiz_pageLeft").click(function(){a("#wpProQuiz_currentPage option:selected").prev().attr("selected",
34
- "selected");a("#wpProQuiz_currentPage").change();return!1});b.changeTab("wpProQuiz_typeAnonymeUser")};a(".wpProQuiz_quizOverall").length&&a(".wpProQuiz_quizOverall").wpProQuiz_preview();a(".wpProQuiz_quizOverall").length&&a(".wpProQuiz_quizOverall").wpProQuiz_quizOverall();a(".wpProQuiz_quizEdit").length&&a(".wpProQuiz_quizEdit").wpProQuiz_quizEdit();a(".wpProQuiz_questionEdit").length&&a(".wpProQuiz_questionEdit").wpProQuiz_questionEdit();a(".wpProQuiz_questionOverall").length&&a(".wpProQuiz_questionOverall").wpProQuiz_questionOverall();
35
- a(".wpProQuiz_statistics").length&&a(".wpProQuiz_statistics").wpProQuiz_statistics()});
 
 
 
 
 
 
1
+ jQuery(document).ready(function(a){a.fn.wpProQuiz_preview=function(){var b={openPreview:function(b){window.open(a(b).attr("href"),"wpProQuizPreview","width=900,height=900")}};a(".wpProQuiz_prview").click(function(a){b.openPreview(this);a.preventDefault()})};a.fn.wpProQuiz_quizOverall=function(){var b={changeExport:function(b){$input=a(b);$export=a(".wpProQuiz_exportList");$ul=$export.find("ul").first();$export.find("li").remove();a('input[name="exportItems"]').each(function(){$this=a(this);if(this.checked){var c=
2
+ $this.parent().parent().find(".wpProQuiz_quizName").text();a("<li>"+c+"</li>").appendTo($ul)}})},startExport:function(){$ele=a('input[name="exportItems"]:checked');if(1>$ele.length)return alert(wpProQuizLocalize.no_selected_quiz),!1;$hidden=a("#exportHidden");$hidden.html("");a('input[name="exportItems"]').each(function(){$this=a(this);this.checked&&a('<input type="hidden" value="'+this.value+'" name="exportIds[]">').appendTo($hidden)});return!0}};a(".wpProQuiz_delete").click(function(a){return!confirm(wpProQuizLocalize.delete_msg)?
3
+ (a.preventDefault(),!1):!0});a(".wpProQuiz_import").click(function(b){b.preventDefault();a(".wpProQuiz_importList").toggle("fast");a(".wpProQuiz_exportList").hide();a(".wpProQuiz_exportCheck").hide()});a(".wpProQuiz_export").click(function(b){b.preventDefault();a(".wpProQuiz_exportList").toggle("fast");a(".wpProQuiz_exportCheck").toggle("fast");a(".wpProQuiz_importList").hide()});a('input[name="exportItems"]').change(function(){b.changeExport(this)});a('input[name="exportItemsAll"]').change(function(){var b=
4
+ a('input[name="exportItems"]');this.checked?b.attr("checked",!0):b.attr("checked",!1);b.change()});a("#exportStart").click(function(a){b.startExport()||a.preventDefault()})};a.fn.wpProQuiz_questionOverall=function(){var b={saveSort:function(){var f={action:"wp_pro_quiz_update_sort",sort:b.parseSortArray()},c=(window.location.pathname+window.location.search).replace("admin.php","admin-ajax.php")+"&action=save_sort";a.post(c,f,function(){a("#sortMsg").show(400).delay(1E3).hide(400)})},parseSortArray:function(){var b=
5
+ [];a("tbody tr").each(function(){b.push(this.id.replace("wpProQuiz_questionId_",""))});return b},sortUpdate:function(){a(".wpProQuiz_questionOverall tbody").children().each(function(){$t=a(this).children().first().text(a(this).index()+1)})},loadQuestionCopy:function(){var b=a("#questionCopySelect"),c=(window.location.pathname+window.location.search).replace("admin.php","admin-ajax.php")+"&action=load_question";b.hide();b.empty();a("#loadDataImg").show();a.post(c,{action:"wp_pro_quiz_load_question",
6
+ excludeId:1},function(c){a.each(c,function(c,e){var h=a(document.createElement("optgroup"));h.attr("label",e.name);a.each(e.question,function(b,c){a(document.createElement("option")).val(c.id).text(c.name).appendTo(h)});b.append(h)});a("#loadDataImg").hide();b.show()},"json")}};a(".wp-list-table tbody").sortable({handle:".wpProQuiz_move",update:b.sortUpdate});a(".wpProQuiz_delete").click(function(a){return!confirm(wpProQuizLocalize.delete_msg)?(a.preventDefault(),!1):!0});a("#wpProQuiz_saveSort").click(function(a){a.preventDefault();
7
+ b.saveSort()});a("#wpProQuiz_questionCopy").click(function(f){var c=a(".wpProQuiz_questionCopy");c.is(":visible")?c.hide():(c.show(),b.loadQuestionCopy());f.preventDefault()})};a.fn.wpProQuiz_quizEdit=function(){var b={addResult:function(){a("#resultList").children().each(function(){if("none"==a(this).css("display")){var b=a(this),e=b.find('textarea[name="resultTextGrade[text][]"]'),d=e.attr("id"),g=!0;b.find('input[name="resultTextGrade[prozent][]"]').val("0");b.find('input[name="resultTextGrade[activ][]"]').val("1").keyup();
8
+ void 0!=tinymce.editors[d]&&!tinymce.editors[d].isHidden()&&(g=!1);void 0!=switchEditors&&!g&&(switchEditors.go(d,"toggle"),switchEditors.go(d,"toggle"));void 0!=tinymce.editors[d]?tinymce.editors[d].setContent(""):e.val("");void 0!=tinymce.editors[d]&&!g&&tinyMCE.execCommand("mceRemoveControl",!1,d);b.parent().children(":visible").last().after(b);void 0!=tinymce.editors[d]&&!g&&tinyMCE.execCommand("mceAddControl",!1,d);a(this).show();void 0!=switchEditors&&!g&&switchEditors.go(d,"toggle");return!1}})},
9
+ deleteResult:function(b){a(b).parent().parent().hide();a(b).siblings('input[name="resultTextGrade[activ][]"]').val("0")},changeResult:function(c){c=a(c);if(b.validResultInput(c.val()))return c.siblings(".resultProzent").text(c.val()),c.removeAttr("style"),!0;c.css("background-color","#FF9696");return!1},validResultInput:function(a){if(f(a))return!1;a=a.replace(/\,/,".");return!isNaN(a)&&100>=Number(a)&&0<=Number(a)?null!=a.match(/\./)?3>a.split(".")[1].length:!0:!1},validInput:function(){if(f(a("#wpProQuiz_title").val()))return alert(wpProQuizLocalize.no_title_msg),
10
+ !1;var c="",c=void 0!=tinymce.editors.text&&!tinymce.editors.text.isHidden()?tinymce.editors.text.getContent():a('textarea[name="text"]').val();if(f(c))return alert(wpProQuizLocalize.no_quiz_start_msg),!1;if(a("#wpProQuiz_resultGradeEnabled:checked").length){var e=!0;a("#resultList").children().each(function(){if(a(this).is(":visible")&&!b.validResultInput(a(this).find('input[name="resultTextGrade[prozent][]"]').val()))return e=!1});if(!e)return alert(wpProQuizLocalize.fail_grade_result),!1}return!0},
11
+ resetLock:function(){var b=(window.location.pathname+window.location.search).replace("admin.php","admin-ajax.php"),b=b.replace("action=edit","action=reset_lock");a.post(b,{action:"wp_pro_quiz_reset_lock"},function(){a("#resetLockMsg").show("fast").delay(2E3).hide("fast")})}},f=function(b){b=a.trim(b);return!b||0===b.length};a("#statistics_on").change(function(){this.checked?a("#statistics_ip_lock_tr").show():a("#statistics_ip_lock_tr").hide()});a(".addResult").click(function(){b.addResult()});a(".deleteResult").click(function(){b.deleteResult(this)});
12
+ a('input[name="resultTextGrade[prozent][]"]').keyup(function(){b.changeResult(this)}).keydown(function(a){13==a.which&&a.preventDefault()});a("#wpProQuiz_resultGradeEnabled").change(function(){this.checked?(a("#resultGrade").show(),a("#resultNormal").hide()):(a("#resultGrade").hide(),a("#resultNormal").show())});a("#wpProQuiz_save").click(function(c){b.validInput()||c.preventDefault();a('select[name="prerequisiteList[]"] option').attr("selected","selected")});a('input[name="quizRunOnce"]').change(function(){this.checked?
13
+ (a("#wpProQuiz_quiz_run_once_type").show(),a('input[name="quizRunOnceType"]:checked').change()):a("#wpProQuiz_quiz_run_once_type").hide()});a('input[name="quizRunOnceType"]').change(function(){this.checked&&("1"==this.value||"3"==this.value)?a("#wpProQuiz_quiz_run_once_cookie").show():a("#wpProQuiz_quiz_run_once_cookie").hide()});a('input[name="resetQuizLock"]').click(function(){b.resetLock();return!1});a(".wpProQuiz_demoBox a").mouseover(function(){a(this).next().show()}).mouseout(function(){a(this).next().hide()}).click(function(){return!1});
14
+ a('input[name="showMaxQuestion"]').change(function(){this.checked?(a('input[name="statisticsOn"]').removeAttr("checked").attr("disabled","disabled").change(),a("#wpProQuiz_showMaxBox").show()):(a('input[name="statisticsOn"]').removeAttr("disabled"),a("#wpProQuiz_showMaxBox").hide())});a("#btnPrerequisiteAdd").click(function(){a('select[name="quizList"] option:selected').removeAttr("selected").appendTo('select[name="prerequisiteList[]"]')});a("#btnPrerequisiteDelete").click(function(){a('select[name="prerequisiteList[]"] option:selected').removeAttr("selected").appendTo('select[name="quizList"]')});
15
+ a('input[name="prerequisite"]').change(function(){this.checked?a("#prerequisiteBox").show():a("#prerequisiteBox").hide()}).change();a('input[name="toplistDataAddMultiple"]').change(function(){this.checked?a("#toplistDataAddBlockBox").show():a("#toplistDataAddBlockBox").hide()}).change();a('input[name="toplistActivated"]').change(function(){this.checked?a("#toplistBox > tr:gt(0)").show():a("#toplistBox > tr:gt(0)").hide()}).change();a("#statistics_on").change();a("#wpProQuiz_resultGradeEnabled").change();
16
+ a('input[name="quizRunOnce"]').change();a('input[name="quizRunOnceType"]:checked').change();a('input[name="showMaxQuestion"]').change()};a.fn.wpProQuiz_statistics=function(){var b="wpProQuiz_typeAnonymeUser",f=!0,c={loadStatistics:function(b){var d=(window.location.pathname+window.location.search).replace("admin.php","admin-ajax.php")+"&action=load_statistics",b={action:"wp_pro_quiz_load_statistics",userId:b};a("#wpProQuiz_loadData").show();a("#wpProQuiz_statistics_content, #wpProQuiz_statistics_overview").hide();
17
+ a.post(d,b,c.setStatistics,"json")},setStatistics:function(c){var d=a(".wpProQuiz_statistics_table"),g=d.find("tbody");if("wpProQuiz_typeOverview"!=b){var h=function(a,b,c){a.find(".wpProQuiz_cCorrect").text(b.cCorrect+" ("+b.pCorrect+"%)");a.find(".wpProQuiz_cIncorrect").text(b.cIncorrect+" ("+b.pIncorrect+"%)");a.find(".wpProQuiz_cTip").text(b.cTip);a.find(".wpProQuiz_cPoints").text(b.cPoints);!0==c&&d.find(".wpProQuiz_cResult").text(b.result+"%")};h(d,c.clear,!1);a.each(c.items,function(a,b){h(g.find("#wpProQuiz_tr_"+
18
+ b.id),b,!1)});h(d.find("tfoot"),c.global,!0);a("#wpProQuiz_loadData").hide();a("#wpProQuiz_statistics_content, .wpProQuiz_statistics_table").show()}},loadOverview:function(){a(".wpProQuiz_statistics_table, #wpProQuiz_statistics_content, #wpProQuiz_statistics_overview").hide();a("#wpProQuiz_loadData").show();var e=(window.location.pathname+window.location.search).replace("admin.php","admin-ajax.php")+"&action=load_statistics",d={action:"wp_pro_quiz_load_statistics",overview:!0,pageLimit:a("#wpProQuiz_pageLimit").val(),
19
+ onlyCompleted:Number(a("#wpProQuiz_onlyCompleted").is(":checked")),page:a("#wpProQuiz_currentPage").val(),generatePageNav:Number(f)};a.post(e,d,function(d){a("#wpProQuiz_statistics_overview_data").empty();if("wpProQuiz_typeOverview"==b){var e=a('<tr><th><a href="#">---</a></th><th class="wpProQuiz_points">---</th><th class="wpProQuiz_cCorrect" style="color: green;">---</th><th class="wpProQuiz_cIncorrect" style="color: red;">---</th><th class="wpProQuiz_cTip">---</th><th class="wpProQuiz_cResult" style="font-weight: bold;">---</th></tr>');
20
+ a.each(d.items,function(b,d){var c=e.clone();c.find("a").text(d.userName).data("userId",d.userId).click(function(){a("#userSelect").val(a(this).data("userId"));a("#wpProQuiz_typeRegisteredUser").click();return!1});d.completed?(c.find(".wpProQuiz_points").text(d.cPoints),c.find(".wpProQuiz_cCorrect").text(d.cCorrect+" ("+d.pCorrect+"%)"),c.find(".wpProQuiz_cIncorrect").text(d.cIncorrect+" ("+d.pIncorrect+"%)"),c.find(".wpProQuiz_cTip").text(d.cTip),c.find(".wpProQuiz_cResult").text(d.result+"%")):
21
+ c.find("th").removeAttr("style");a("#wpProQuiz_statistics_overview_data").append(c)});void 0!=d.page&&(c.setPageNav(d.page),f=!1);a("#wpProQuiz_loadData").hide();a("#wpProQuiz_statistics_overview").show()}},"json")},changeTab:function(e){b=e;"wpProQuiz_typeRegisteredUser"==e?c.loadStatistics(a("#userSelect").val()):"wpProQuiz_typeAnonymeUser"==e?c.loadStatistics(0):c.loadOverview()},resetStatistic:function(e){var d="wpProQuiz_typeRegisteredUser"==b?a("#userSelect").val():0,g=(window.location.pathname+
22
+ window.location.search).replace("admin.php","admin-ajax.php")+"&action=reset";a.post(g,{action:"wp_pro_quiz_statistics",userId:d,complete:e},function(){c.changeTab(b)})},setPageNav:function(b){b=Math.ceil(b/a("#wpProQuiz_pageLimit").val());a("#wpProQuiz_currentPage").empty();for(var d=1;d<=b;d++)a(document.createElement("option")).val(d).text(d).appendTo(a("#wpProQuiz_currentPage"));a("#wpProQuiz_pageLeft, #wpProQuiz_pageRight").hide();1<a("#wpProQuiz_currentPage option").length&&a("#wpProQuiz_pageRight").show()}};
23
+ a(".wpProQuiz_tab").click(function(){var b=a(this);if(b.hasClass("button-primary"))return!1;"wpProQuiz_typeRegisteredUser"==b.attr("id")?a("#wpProQuiz_userBox").show():a("#wpProQuiz_userBox").hide();a(".wpProQuiz_tab").removeClass("button-primary").addClass("button-secondary");b.removeClass("button-secondary").addClass("button-primary");c.changeTab(b.attr("id"));return!1});a("#userSelect").change(function(){c.changeTab("wpProQuiz_typeRegisteredUser")});a(".wpProQuiz_update").click(function(){c.changeTab(b);
24
+ return!1});a("#wpProQuiz_reset").click(function(){confirm(wpProQuizLocalize.reset_statistics_msg)&&c.resetStatistic(!1);return!1});a(".wpProQuiz_resetComplete").click(function(){confirm(wpProQuizLocalize.reset_statistics_msg)&&c.resetStatistic(!0);return!1});a("#wpProQuiz_pageLimit, #wpProQuiz_onlyCompleted").change(function(){a("#wpProQuiz_currentPage").val(0);f=!0;c.changeTab(b);return!1});a("#wpProQuiz_currentPage").change(function(){a("#wpProQuiz_pageLeft, #wpProQuiz_pageRight").hide();1!=a("#wpProQuiz_currentPage option").length&&
25
+ (a("#wpProQuiz_currentPage option:first-child:selected").length?a("#wpProQuiz_pageRight").show():a("#wpProQuiz_currentPage option:last-child:selected").length?a("#wpProQuiz_pageLeft").show():a("#wpProQuiz_pageLeft, #wpProQuiz_pageRight").show());c.changeTab(b)});a("#wpProQuiz_pageRight").click(function(){a("#wpProQuiz_currentPage option:selected").next().attr("selected","selected");a("#wpProQuiz_currentPage").change();return!1});a("#wpProQuiz_pageLeft").click(function(){a("#wpProQuiz_currentPage option:selected").prev().attr("selected",
26
+ "selected");a("#wpProQuiz_currentPage").change();return!1});c.changeTab("wpProQuiz_typeAnonymeUser")};a.fn.wpProQuiz_toplist=function(){var b=this,f=a("#wpProQuiz_sorting"),c=a("#wpProQuiz_pageLimit"),e=a("#wpProQuiz_currentPage"),d=a("#wpProQuiz_loadData"),g=a("#wpProQuiz_pageLeft"),h=a("#wpProQuiz_pageRight"),i=a("#wpProQuiz_toplistTable tbody"),k=a("#wpProQuiz_toplistTable tbody tr:eq(0)").clone(),j=a("#wpProQuiz_content"),b={loadData:function(l){var m=(window.location.pathname+window.location.search).replace("admin.php",
27
+ "admin-ajax.php")+"&action=load_toplist",g={action:"wp_pro_quiz_load_toplist",sort:f.val(),limit:c.val(),page:e.val()};void 0!=l&&a.extend(g,l);d.show();j.hide();a.post(m,g,function(a){b.handleDataRequest(a.data);void 0!=a.nav&&b.handleNav(a.nav);d.hide();j.show()},"json")},handleNav:function(d){e.empty();for(var c=1;c<=d.pages;c++)a(document.createElement("option")).val(c).text(c).appendTo(e);b.checkNav()},handleDataRequest:function(b){i.empty();a.each(b,function(a,b){var d=k.clone().children();
28
+ d.eq(0).children().val(b.id);d.eq(1).text(b.name);d.eq(2).text(b.email);d.eq(3).text(b.type);d.eq(4).text(b.date);d.eq(5).text(b.points);d.eq(6).text(b.result);d.parent().show().appendTo(i)});b.length||a(document.createElement("td")).attr("colspan","7").text(wpProQuizLocalize.no_data_available).css({"font-weight":"bold","text-align":"center",padding:"5px"}).appendTo(document.createElement("tr")).appendTo(i)},checkNav:function(){var a=e.val();1==a?g.hide():g.show();a==e.children().length?h.hide():
29
+ h.show()}};f.change(function(){b.loadData()});c.change(function(){b.loadData({nav:1})});e.change(function(){b.checkNav();b.loadData()});g.click(function(){e.val(Number(e.val())-1);b.checkNav();b.loadData()});h.click(function(){e.val(Number(e.val())+1);b.checkNav();b.loadData()});a("#wpProQuiz_deleteAll").click(function(){b.loadData({a:"deleteAll"})});a("#wpProQuiz_action").click(function(){var d=a("#wpProQuiz_actionName").val();if("0"!=d){var c=a('input[name="checkedData[]"]:checked').map(function(){return a(this).val()}).get();
30
+ b.loadData({a:d,toplistIds:c})}});a("#wpProQuiz_checkedAll").change(function(){this.checked?a('input[name="checkedData[]"]').attr("checked","checked"):a('input[name="checkedData[]"]').removeAttr("checked","checked")});b.loadData({nav:1})};a(".wpProQuiz_quizOverall").length&&a(".wpProQuiz_quizOverall").wpProQuiz_preview();a(".wpProQuiz_quizOverall").length&&a(".wpProQuiz_quizOverall").wpProQuiz_quizOverall();a(".wpProQuiz_quizEdit").length&&a(".wpProQuiz_quizEdit").wpProQuiz_quizEdit();a(".wpProQuiz_questionOverall").length&&
31
+ a(".wpProQuiz_questionOverall").wpProQuiz_questionOverall();a(".wpProQuiz_statistics").length&&a(".wpProQuiz_statistics").wpProQuiz_statistics();a(".wpProQuiz_toplist").length&&a(".wpProQuiz_toplist").wpProQuiz_toplist();(function(){var b=this,b={displayChecked:function(a,b,c,e){a=c?!a.checked:a.checked;e?a?b.attr("disabled","disabled"):b.removeAttr("disabled"):a?b.show():b.hide()},isEmpty:function(b){b=a.trim(b);return!b||0===b.length},isNumber:function(d){d=a.trim(d);return!b.isEmpty(d)&&!isNaN(d)},
32
+ getMceContent:function(b){var c=tinymce.editors[b];return void 0!=c&&!c.isHidden()?c.getContent():a("#"+b).val()}},f=function(){a(".wpProQuiz_tab").click(function(){var b=a(this);a(".wpProQuiz_tab").removeClass("button-primary").addClass("button-secondary");b.removeClass("button-secondary").addClass("button-primary");a("#problemInfo, #problemContent, #globalContent").hide("fast");"globalTab"==b.attr("id")?a("#globalContent").show("fast"):a("#problemInfo, #problemContent").show("fast")})},c=function(){var c=
33
+ this,e=a.noop(),f=a(".answer_felder > div"),i=a('input[name="answerPointsActivated"]'),k=a('input[name="points"]'),c={generateArrayIndex:function(){var b=a('input[name="answerType"]:checked').val(),b="single"==b||"multiple"==b?"classic_answer":b;a(".answerList").each(function(){var c=a(this).parent().attr("class");a(this).children().each(function(d){a(this).find('[name^="answerData"]').each(function(){var a=this.name,e=a.search(/\](\[\w+\])+$/),f=b==c?d:"none";0<e&&(this.name="answerData["+f+a.substring(e,
34
+ a.length))})})})},globalValidate:function(){if(b.isEmpty(b.getMceContent("question")))return alert(wpProQuizLocalize.no_question_msg),!1;if(i.is(":checked")){if("free_answer"==a('input[name="answerType"]:checked').val())return alert(wpProQuizLocalize.dif_points),!1}else{var c=k.val();if(!b.isNumber(c)||1>c)return alert(wpProQuizLocalize.no_nummber_points),!1}return!1===e()?!1:!0},answerRemove:function(){var b=a(this).parent();if(2>b.parent().children().length)return!1;b.remove();return!1}},j={classic_answer:function(){var c=
35
+ 0,d=0,e=0;a(".classic_answer .answerList").children().each(function(){var f=a(this);b.isEmpty(f.find('textarea[name="answerData[][answer]"]').val())||(c++,f.find('input[name="answerData[][correct]"]:checked').length&&d++,f=f.find('input[name="answerData[][points]"]').val(),b.isNumber(f)&&0<=f&&e++)});return!c?(alert(wpProQuizLocalize.no_answer_msg),!1):!d?(alert(wpProQuizLocalize.no_correct_msg),!1):e!=c&&i.is(":checked")?(alert(wpProQuizLocalize.no_nummber_points_new),!1):!0},free_answer:function(){return b.isEmpty(a('.free_answer textarea[name="answerData[][answer]"]').val())?
36
+ (alert(wpProQuizLocalize.no_answer_msg),!1):!0},cloze_answer:function(){return b.isEmpty(b.getMceContent("cloze"))?(alert(wpProQuizLocalize.no_answer_msg),!1):!0},sort_answer:function(){var c=0,d=0;a(".sort_answer .answerList").children().each(function(){var e=a(this);b.isEmpty(e.find('textarea[name="answerData[][answer]"]').val())||(c++,e=e.find('input[name="answerData[][points]"]').val(),b.isNumber(e)&&0<=e&&d++)});return!c?(alert(wpProQuizLocalize.no_answer_msg),!1):d!=c&&i.is(":checked")?(alert(wpProQuizLocalize.no_nummber_points_new),
37
+ !1):!0},matrix_sort_answer:function(){var c=0,d=0,e=!0,f=0;a(".matrix_sort_answer .answerList").children().each(function(){var g=a(this),h=g.find('input[name="answerData[][points]"]').val();b.isEmpty(g.find('textarea[name="answerData[][answer]"]').val())?b.isEmpty(g.find('textarea[name="answerData[][sort_string]"]').val())||(f++,b.isNumber(h)&&0<=h&&d++):(c++,f++,b.isEmpty(g.find('textarea[name="answerData[][sort_string]"]').val())&&(e=!1),b.isNumber(h)&&0<=h&&d++)});return!c?(alert(wpProQuizLocalize.no_answer_msg),
38
+ !1):!e?(alert(wpProQuizLocalize.no_sort_element_criterion),!1):d!=f&&i.is(":checked")?(alert(wpProQuizLocalize.no_nummber_points_new),!1):!0}};f.hide();a("#wpProQuiz_tip").change(function(){b.displayChecked(this,a("#wpProQuiz_tipBox"))}).change();a("#wpProQuiz_correctSameText").change(function(){b.displayChecked(this,a("#wpProQuiz_incorrectMassageBox"),!0)}).change();a('input[name="answerType"]').click(function(){f.hide();var b=this.value;if("single"==b||"multiple"==b){var c="single"==b?"radio":"checkbox",
39
+ b="classic_answer";a(".wpProQuiz_classCorrect").each(function(){a("<input type="+c+" />").attr({name:this.name,value:this.value,checked:this.checked}).addClass("wpProQuiz_classCorrect wpProQuiz_checkbox").insertBefore(this)}).remove()}e=void 0!=j[b]?j[b]:a.noop();a("."+b).show()});a('input[name="answerType"]:checked').click();a(".deleteAnswer").click(c.answerRemove);a(".addAnswer").click(function(){var b=a(this).siblings("ul"),e=b.find("li:eq(0)").clone();e.find(".wpProQuiz_checkbox").removeAttr("checked");
40
+ e.find(".wpProQuiz_text").val("");e.find(".wpProQuiz_points").val(1);e.find(".deleteAnswer").click(c.answerRemove);e.appendTo(b);return!1});a(".sort_answer ul, .classic_answer ul, .matrix_sort_answer ul").sortable({handle:".wpProQuiz_move"});a("#saveQuestion").click(function(){if(!c.globalValidate())return!1;c.generateArrayIndex();return!0});a(i).change(function(){b.displayChecked(this,a(".wpProQuiz_answerPoints"));b.displayChecked(this,a("#wpProQuiz_showPointsBox"));b.displayChecked(this,k,!1,!0)}).change()},
41
+ e=a.noop;a(".wpProQuiz_questionEdit").length?e=c:a(".wpProQuiz_globalSettings").length&&(e=f);e()})()});
js/wpProQuiz_front.js CHANGED
@@ -1,521 +1,476 @@
1
  (function($) {
2
  $.wpProQuizFront = function(element, options) {
3
- var $element = $(element);
4
  var config = options;
5
  var plugin = this;
6
- var correctAnswer = 0;
7
- var countAnswer = 0;
8
- var intervalId = 0;
9
  var startTime = 0;
10
- var statistics = new Object();
11
- var points = 0;
12
- var pointsTotal = 0;
13
- var cors = false;
 
 
 
 
 
 
14
 
15
- var isLock = false;
16
- var locked = false;
17
- var loadLocked = false;
18
- var startQuiz = false;
 
 
19
 
20
- plugin.methode = {
21
-
22
- preStartQuiz: function() {
23
- statistics = new Object();
 
24
 
25
- if(config.questionRandom) {
26
- plugin.methode.questionRandom();
27
- }
28
-
29
- if(config.answerRandom) {
30
- plugin.methode.answerRandom('.wpProQuiz_questionList');
31
- } else {
32
- plugin.methode.answerRandom($element.find('.wpProQuiz_sortable').parent().parent());
33
- }
34
-
35
- plugin.methode.answerRandom('.wpProQuiz_sortStringList');
36
-
37
- correctAnswer = 0;
38
- points = 0;
39
-
40
- if(!config.questionOnSinglePage) {
41
- if(config.checkAnswer) {
42
- $element.find('input[name="check"]').show();
43
- } else {
44
- $element.find('input[name="next"]').show();
45
- }
46
- }
47
-
48
- if(!isLock || !loadLocked) {
49
- plugin.methode.startQuiz();
50
- } else {
51
- startQuiz = true;
52
- }
53
-
54
- if(config.numberedAnswer) {
55
- plugin.methode.numberedAnswer();
56
- }
57
- },
58
 
59
- startQuiz: function() {
60
- $element.find('.wpProQuiz_text').hide();
61
-
62
- if(locked) {
63
- $element.find('.wpProQuiz_lock').show();
64
- return;
65
  }
 
66
 
67
- startTime = new Date();
68
-
69
- if(config.timeLimit) {
70
- plugin.methode.setTimeLimit();
71
- }
72
 
73
- if(config.questionOnSinglePage) {
74
- $element.find('.wpProQuiz_listItem').show();
75
- }
76
 
77
- $element.find('.wpProQuiz_listItem').first().show();
78
- $element.find('.wpProQuiz_quiz').fadeIn(200);
79
 
80
- $element.find('.wpProQuiz_sortable').parent().parent().sortable().disableSelection();
81
 
82
- $element.find('.wpProQuiz_sortStringList, .wpProQuiz_maxtrixSortCriterion').sortable({
83
- connectWith: '.wpProQuiz_maxtrixSortCriterion:not(:has(li)), .wpProQuiz_sortStringList',
84
- placeholder: 'wpProQuiz_placehold'
85
- }).disableSelection();
86
- },
87
-
88
- scrollTo: function(e, c) {
89
- var x = e.offset().top - 100;
90
-
91
- if(c) {
92
- if((window.pageYOffset || document.body.scrollTop) > x) {
93
- $('html,body').animate({scrollTop: x}, 300);
94
  }
95
- } else {
96
- $('html,body').animate({scrollTop: x}, 300);
97
- }
98
- },
99
-
100
- reStartQuiz: function() {
101
- $element.find('.wpProQuiz_answerCorrect').removeClass('wpProQuiz_answerCorrect');
102
- $element.find('.wpProQuiz_answerIncorrect').removeClass('wpProQuiz_answerIncorrect');
103
-
104
- $element.find('.wpProQuiz_text, input[name="tip"]').show();
105
- $element.find('.wpProQuiz_quiz, .wpProQuiz_results, .wpProQuiz_response, .wpProQuiz_correct, .wpProQuiz_incorrect')
106
- .hide();
107
- $element.find('.wpProQuiz_time_limit, .wpProQuiz_time_limit_expired, .wpProQuiz_sort_correct_answer')
108
- .hide();
109
- $element.find('.wpProQuiz_quiz').children().first().children().hide();
110
- $element.find('.wpProQuiz_sortable, .wpProQuiz_sortStringItem').removeAttr('style');
111
- $element.find('input[name="check"]').hide();
112
- $element.find('input[name="next"]').hide();
113
- $element.find('.wpProQuiz_questionInput').removeAttr('disabled').removeAttr('checked');
114
- $element.find('input.wpProQuiz_questionInput[type="text"]').removeAttr('value');
115
- $element.find('.wpProQuiz_resultsList').children().hide();
116
- $element.find('.wpProQuiz_cloze input').removeAttr('disabled').removeAttr('value').css('background-color', '');
117
- $element.find('.wpProQuiz_cloze span').hide();
118
- $element.find('input[name="checkSingle"]').show();
119
-
120
- if(!config.questionOnSinglePage) {
121
- $element.find('.wpProQuiz_question_page').show();
122
- }
123
-
124
- plugin.methode.resetMatrix();
125
-
126
- $element.find('.wpProQuiz_listItem').data('isChecked', false);
127
- },