1
0

index.html 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  5. <title> iFractions </title>
  6. <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
  7. <link rel="stylesheet" type="text/css" href="css/jquery-ui.css">
  8. <script type="text/javascript" src="js/phaser.min.js"></script>
  9. <script type="text/javascript" src="js/jquery.js"></script>
  10. <script type="text/javascript" src="js/jquery-ui.js"></script>
  11. <script type="text/javascript" src="js/boot.js"></script>
  12. <script type="text/javascript" src="js/menu.js"></script>
  13. <script type="text/javascript" src="js/circleOne.js"></script>
  14. <script type="text/javascript" src="js/squareOne.js"></script>
  15. <script type="text/javascript" src="js/squareTwo.js"></script>
  16. <script>
  17. function getParameterByName(name) {
  18. var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
  19. return match ? decodeURIComponent(match[1].replace(/\+/g, ' ')) : null;
  20. }
  21. function getAnswer() {
  22. console.log("getAnswer:: called");
  23. if (modulo < 1) {
  24. alert(words.error_module);
  25. return x;
  26. }
  27. if (difficulty < 1) {
  28. alert(words.error_difficulty);
  29. return x;
  30. }
  31. if (num < 5) {
  32. return '{'
  33. + '"shape": "' + (modules_names[modulo].split(",")[0] === words.square_name ? "Square" : "Circle")
  34. + '", "modo": "' + modos[modulo]
  35. + '", "label": "' + labels[modulo]
  36. + '", "operator": "' + (operation == 1 ? "Plus" : (operation == 2 ? "Minus" : (operation == 3 ? "Mixed" : "Equals")))
  37. + '", "difficulty": "' + difficulty
  38. + '", "num": "' + num
  39. + '"}';
  40. } else {
  41. return '{'
  42. + '"shape": "' + (modules_names[modulo].split(",")[0] === words.square_name ? "Square" : "Circle")
  43. + '", "modo": "' + (operation == 1 ? "A" : (operation == 2 ? "B" : "C"))
  44. + '", "label": "' + labels[modulo]
  45. + '", "operator": "' + (operation == 1 ? "Plus" : (operation == 2 ? "Minus" : (operation == 3 ? "Mixed" : "Equals")))
  46. + '", "difficulty": "' + difficulty
  47. + '", "num": "' + num
  48. + '"}';
  49. }
  50. }
  51. function getEvaluation() {
  52. console.log("getEvaluation:: called");
  53. //return false;
  54. //return angular.element("#commCtrl").scope().getEvaluation();
  55. }
  56. function getEvaluationCallback(nota) {
  57. console.log("getEvaluationCallback:: called");
  58. return false;
  59. //parent.getEvaluationCallback(nota);
  60. }
  61. var iLMparameters = {
  62. iLM_PARAM_ServerToGetAnswerURL: getParameterByName("iLM_PARAM_ServerToGetAnswerURL"),
  63. iLM_PARAM_SendAnswer: getParameterByName("iLM_PARAM_SendAnswer"),
  64. iLM_PARAM_AssignmentURL: getParameterByName("iLM_PARAM_AssignmentURL"),
  65. iLM_PARAM_Assignment: getParameterByName("iLM_PARAM_Assignment"),
  66. lang: getParameterByName("lang")
  67. };
  68. function trackAction(action) {
  69. $.post(iLMparameters.iLM_PARAM_ServerToGetAnswerURL + "&track=1", {trackingData: "html=1;" + action}, function (d) {});
  70. }
  71. </script>
  72. <style>
  73. .input-hidden {
  74. position: absolute;
  75. left: -9999px;
  76. }
  77. input[type=radio]:checked + label>img {
  78. border: 1px solid #fff;
  79. box-shadow: 0 0 3px 3px #090;
  80. filter: grayscale(0%);
  81. }
  82. input[type=radio] + label>img {
  83. width: 80px;
  84. height: 80px;
  85. margin-left: 5px;
  86. filter: grayscale(100%);
  87. transition: 500ms all;
  88. }
  89. #form-create img:hover {
  90. filter: grayscale(0%);
  91. }
  92. #select_module, #select_difficulty, #options_summary_title {
  93. text-align: left;
  94. padding: 15px;
  95. }
  96. #options_module, #options_diff {
  97. text-align: left;
  98. padding-left: 40px;
  99. }
  100. .img_difficulty {
  101. width: 80px !important;
  102. margin-right: 20px;
  103. margin-top: 20px;
  104. }
  105. #results-title {
  106. font-size: 140%;
  107. border-bottom: 2px solid #c9d1dd;
  108. padding-bottom: 5px;
  109. }
  110. #results-image, #results-info {
  111. float: left;
  112. margin-top: 10px;
  113. }
  114. #results-image img {
  115. width: 80px;
  116. height: 80px;
  117. }
  118. #results-info {
  119. margin-left: 15px;
  120. margin-top: 20px;
  121. font-size: 120%;
  122. }
  123. #bl {
  124. width: 100%;
  125. height: 105px;
  126. border-bottom: 2px solid #c9d1dd;
  127. }
  128. .results-levels {
  129. border-bottom: 2px solid #c9d1dd;
  130. padding: 10px;
  131. }
  132. .results-levels img {
  133. width: 60px;
  134. }
  135. .numphase {
  136. float: left;
  137. margin-top: -50px;
  138. margin-left: 25px;
  139. position: absolute;
  140. z-index: 9999;
  141. color: white;
  142. font-size: 20px;
  143. font-weight: bold;
  144. }
  145. .results-levels-item, .results-levels {
  146. }
  147. .results-levels-item {
  148. margin-top: -70px;
  149. margin-left: 75px;
  150. }
  151. </style>
  152. </head>
  153. <body>
  154. <div class="container">
  155. <div class="clearfix"></div>
  156. <div class="panel panel-primary">
  157. <div class="panel-heading">FRACTIONS GAME</div>
  158. <div class="panel-body">
  159. <center>
  160. <div id="fractions-game" style="padding: 0 auto 0 auto;">
  161. <div id="form-create" style="display: none;">
  162. <script>
  163. //
  164. var words = [];
  165. var modules_names = [''];
  166. var total_levels = [0, 2, 2, 3, 3, 3, 2, 2, 3, 3];
  167. var levels = [0, 3, 3, 5, 5, 5, 3, 3, 5, 5];
  168. var modos = ['', 'A', 'A', 'A', 'A', 'C', 'B', 'B', 'B', 'B'];
  169. var labels = [false, true, false, true, false, false, true, false, true, false];
  170. var operation_img = [''];
  171. var operation;
  172. var difficulty = 0;
  173. var modulo = 0;
  174. var num;
  175. var redir = true;
  176. var url_lang;
  177. if (iLMparameters.lang == "en")
  178. url_lang = "en_US";
  179. if (iLMparameters.lang == "pt")
  180. url_lang = "pt_BR";
  181. if (iLMparameters.lang == "fr")
  182. url_lang = "fr_FR";
  183. if (iLMparameters.lang == "es")
  184. url_lang = "es_PE";
  185. $.getJSON("resource/lang/" + url_lang + ".json", function (data) {
  186. $.each(data, function (key, val) {
  187. words[key] = val;
  188. });
  189. $("#select_module").html(words.select_module + ":");
  190. $("#select_difficulty").html(words.select_operation + ":");
  191. $("#options_summary_title").html(words.options_summary + ":");
  192. $("#options_module").html(words.options_module + ":");
  193. $("#options_diff").html(words.options_difficulty + ":");
  194. modules_names[1] = words.square_name + ", " + words.mode_name + " A, " + words.with_name + " " + words.label_name;
  195. modules_names[2] = words.square_name + ", " + words.mode_name + " A, " + words.without_name + " " + words.label_name;
  196. modules_names[3] = words.circle_name + ", " + words.mode_name + " A, " + words.with_name + " " + words.label_name;
  197. modules_names[4] = words.circle_name + ", " + words.mode_name + " A, " + words.without_name + " " + words.label_name;
  198. modules_names[5] = words.square_name + ", " + words.mode_name + " C, " + words.without_name + " " + words.label_name;
  199. modules_names[6] = words.square_name + ", " + words.mode_name + " B, " + words.with_name + " " + words.label_name;
  200. modules_names[7] = words.square_name + ", " + words.mode_name + " B, " + words.without_name + " " + words.label_name;
  201. modules_names[8] = words.circle_name + ", " + words.mode_name + " B, " + words.with_name + " " + words.label_name;
  202. modules_names[9] = words.circle_name + ", " + words.mode_name + " B, " + words.without_name + " " + words.label_name;
  203. for (i = 1; i < modules_names.length; i++) {
  204. $("#img_" + i).attr("title", modules_names[i]);
  205. }
  206. operation_img[1] = "help/arrow.png,help/arrow_2.png";
  207. operation_img[2] = "help/arrow.png,help/arrow_2.png";
  208. operation_img[3] = "help/arrow.png,help/arrow_2.png,help/double.png";
  209. operation_img[4] = "help/arrow.png,help/arrow_2.png,help/double.png";
  210. operation_img[5] = ",operator/equal.png,";
  211. operation_img[6] = "help/arrow.png,help/arrow_2.png";
  212. operation_img[7] = "help/arrow.png,help/arrow_2.png";
  213. operation_img[8] = "help/arrow.png,help/arrow_2.png,help/double.png";
  214. operation_img[9] = "help/arrow.png,help/arrow_2.png,help/double.png";
  215. });
  216. $(function () {
  217. $(document).tooltip();
  218. });
  219. function show_operation_and_difficulty(opt) {
  220. difficulty = 0;
  221. $("#div_difficulty").css("display", "block");
  222. $("#div_summary").css("display", "none");
  223. $("#options_module").html(words.options_module + ":");
  224. $("#options_diff").html(words.options_difficulty + ":");
  225. modulo = parseInt(opt.value);
  226. num = (modulo == 1 ? 1 : (modulo == 2 ? 2 : (modulo == 3 ? 1 : (modulo == 4 ? 2 : (modulo == 5 ? 5 : (modulo == 6 ? 3 : (modulo == 7 ? 4 : (modulo == 8 ? 3 : 4))))))));
  227. var i;
  228. var divs = "";
  229. var id = 1;
  230. for (i = 0; i < total_levels[modulo]; i++) {
  231. var j;
  232. divs += "<div style='margin-bottom: 20px;'>";
  233. if (operation_img[modulo].split(",")[i] !== '') {
  234. divs += "<img class='img_difficulty' src='resource/img/global/" + operation_img[modulo].split(",")[i] + "'>";
  235. } else {
  236. divs += "<div class='img_difficulty' style='display:inline;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>";
  237. }
  238. for (j = 0; j < levels[modulo]; j++) {
  239. divs += "<input type='radio' name='difficulty' id='diff_" + id + "' class='input-hidden' value='" + i + "," + j + "' onchange='change_operation_and_difficulty(" + (i + 1) + "," + (j + 1) + ")' /> <label for='diff_" + id + "'> <img src='resource/img/global/dot.png' style='height: " + ((j + 1) * 20) + "px; width: 30px; margin-bottom: -" + (((levels[modulo] + 1) * 20) - ((j + 1) * 20)) + "px;' /> </label>";
  240. id++;
  241. }
  242. divs += "</div>";
  243. }
  244. $("#options_difficulty").html(divs);
  245. $("#options_module").html(words.options_module + ": " + modules_names[modulo]);
  246. }
  247. function change_operation_and_difficulty(op, dif) {
  248. $("#div_summary").css("display", "block");
  249. operation = parseInt(op);
  250. difficulty = parseInt(dif);
  251. var op_text = "";
  252. switch (operation) {
  253. case 1:
  254. op_text = words.options_plus;
  255. break;
  256. case 2:
  257. op_text = words.options_minus;
  258. break;
  259. case 3:
  260. op_text = words.options_mixed;
  261. break;
  262. case 4:
  263. op_text = words.options_equals;
  264. break;
  265. }
  266. $("#options_diff").html(words.options_difficulty + ": " + op_text + ", " + difficulty);
  267. }
  268. </script>
  269. <div id="select_module"></div>
  270. <input
  271. type="radio" name="emotion"
  272. id="in1" class="input-hidden" onchange="show_operation_and_difficulty(this)" value="1" />
  273. <label for="in1">
  274. <img id="img_1" src="resource/img/global/game/one-s.png" title="" />
  275. </label>
  276. <input
  277. type="radio" name="emotion"
  278. id="in2" class="input-hidden" onchange="show_operation_and_difficulty(this)" value="2" />
  279. <label for="in2">
  280. <img id="img_2" src="resource/img/global/game/two-s.png" title="" />
  281. </label>
  282. <input
  283. type="radio" name="emotion"
  284. id="in3" class="input-hidden" onchange="show_operation_and_difficulty(this)" value="3" />
  285. <label for="in3">
  286. <img id="img_3" src="resource/img/global/game/one-c.png" title="" />
  287. </label>
  288. <input
  289. type="radio" name="emotion"
  290. id="in4" class="input-hidden" onchange="show_operation_and_difficulty(this)" value="4" />
  291. <label for="in4">
  292. <img id="img_4" src="resource/img/global/game/two-c.png" title="" />
  293. </label>
  294. <input
  295. type="radio" name="emotion"
  296. id="in5" class="input-hidden" onchange="show_operation_and_difficulty(this)" value="5" />
  297. <label for="in5">
  298. <img id="img_5" src="resource/img/global/game/five-s.png" title="" />
  299. </label>
  300. <input
  301. type="radio" name="emotion"
  302. id="in6" class="input-hidden" onchange="show_operation_and_difficulty(this)" value="6" />
  303. <label for="in6">
  304. <img id="img_6" src="resource/img/global/game/three-s.png" title="" />
  305. </label>
  306. <input
  307. type="radio" name="emotion"
  308. id="in7" class="input-hidden" onchange="show_operation_and_difficulty(this)" value="7" />
  309. <label for="in7">
  310. <img id="img_7" src="resource/img/global/game/four-s.png" title="" />
  311. </label>
  312. <input
  313. type="radio" name="emotion"
  314. id="in8" class="input-hidden" onchange="show_operation_and_difficulty(this)" value="8" />
  315. <label for="in8">
  316. <img id="img_8" src="resource/img/global/game/three-c.png" title="" />
  317. </label>
  318. <input
  319. type="radio" name="emotion"
  320. id="in9" class="input-hidden" onchange="show_operation_and_difficulty(this)" value="9" />
  321. <label for="in9">
  322. <img id="img_9" src="resource/img/global/game/four-c.png" title="" />
  323. </label>
  324. <div id="div_difficulty" style="display:none;">
  325. <div id="select_difficulty"></div>
  326. <div id="options_difficulty"></div>
  327. </div>
  328. <div id="div_summary" style="display:none;">
  329. <div id="options_summary_title"></div>
  330. <div id="options_summary_text">
  331. <div id="options_module"></div>
  332. <div id="options_diff"></div>
  333. </div>
  334. </div>
  335. </div>
  336. </div>
  337. </center>
  338. <div id="results" style="display: none;">
  339. <div id="results-title"></div>
  340. <div id="bl">
  341. <div id="results-image"></div>
  342. <div id="results-info"></div>
  343. </div>
  344. <div id="results-details"></div>
  345. </div>
  346. </div>
  347. </div>
  348. <div class="panel panel-info">
  349. <div class="panel-heading">COOPERATION TEAM</div>
  350. <div class="panel-body">
  351. <center>
  352. <ul>
  353. <li><strong>BRAZIL:</strong> Le&ocirc;nidas de Oliveira Brand&atilde;o (IME-USP)</li>
  354. <li><strong>PERU:</strong> Manuel Ibarra and Cristhian Serrano (EAPIIS-UNAMBA)</li>
  355. <li><strong>FRANCE:</strong> Jean-Marc (MOCAH-UPMC)</li>
  356. </ul>
  357. </center>
  358. </div>
  359. </div>
  360. <div class="panel panel-default">
  361. <div class="panel-heading">BASED ON</div>
  362. <div class="panel-body">
  363. <center>
  364. <ul>
  365. <li><strong>iLM </strong>(interactive Learning Modules) </li>
  366. <li><strong>Six facets of Serious Game Design</strong>:<br>
  367. Pedagogical Objectives; Domain Simulation; Interactions with the Simulation; Problems and Progression; Decorum and Conditions of Use.
  368. </li>
  369. </ul>
  370. </center>
  371. </div>
  372. </div>
  373. <div class="panel panel-danger">
  374. <div class="panel-heading">TECHNOLOGY</div>
  375. <div class="panel-body">
  376. <center>
  377. <ul>
  378. <li> We used <strong>HTML5</strong>, <strong>CSS</strong> and the <strong>Javascript</strong> Library <a href="http://phaser.io/" target="_blank"><strong>Phaser.io</strong></a> </li>
  379. </ul>
  380. </center>
  381. </div>
  382. </div>
  383. </div>
  384. </body>
  385. <script type="text/javascript">
  386. // If SendAnswer (student) ::Igor
  387. if (iLMparameters.iLM_PARAM_SendAnswer == 'false') {
  388. // Initialize the game
  389. var game = new Phaser.Game(900, 600, Phaser.CANVAS, 'fractions-game');
  390. hip = "143.107.45.11"; //Host ip
  391. name = ""; //player name
  392. lang = ""; //language
  393. var timer, totalTime;
  394. // Game One
  395. onePosition = 0; //Map position
  396. oneMove = false; //Move to next position
  397. oneDifficulty = 0; //From one to five
  398. oneOperator = ""; //Plus; Minus; Mixed
  399. oneLabel = false; //Show block label
  400. oneShape = ""; //Circle; square
  401. oneType = ""; // A - Place distance; B - Select blocks
  402. oneMenu = true;
  403. // Game Two
  404. twoPosition = 0; //Map position
  405. twoMove = false; //Move to next position
  406. twoDifficulty = 0; //From one to five
  407. twoOperator = ""; //Plus; Minus; Mixed
  408. twoLabel = false; //Show block label
  409. twoShape = ""; //Circle; square
  410. twoType = ""; // A - Normal position; B - Random position
  411. twoMenu = true;
  412. //adding game states (scenes)
  413. game.state.add('boot', bootState);
  414. game.state.add('load', loadState);
  415. game.state.add('name', nameState);
  416. game.state.add('menu', menuState);
  417. game.state.add('menuCOne', menuCircleOne);
  418. game.state.add('mapCOne', mapCircleOne);
  419. game.state.add('gameCOne', gameCircleOne);
  420. game.state.add('endCOne', endCircleOne);
  421. game.state.add('menuSOne', menuSquareOne);
  422. game.state.add('mapSOne', mapSquareOne);
  423. game.state.add('gameSOne', gameSquareOne);
  424. game.state.add('endSOne', endSquareOne);
  425. game.state.add('menuSTwo', menuSquareTwo);
  426. game.state.add('mapSTwo', mapSquareTwo);
  427. game.state.add('gameSTwo', gameSquareTwo);
  428. game.state.add('endSTwo', endSquareTwo);
  429. lang = url_lang;
  430. var jogo = [];
  431. $.get(iLMparameters.iLM_PARAM_Assignment, function (d) {
  432. if (d != null) {
  433. $.each(d, function (key, val) {
  434. jogo[key] = val;
  435. });
  436. register_start();
  437. if (jogo.hasOwnProperty('results')) {
  438. $("#fractions-game").css("display", "none");
  439. $("#results").css("display", "block");
  440. var results = [];
  441. $.each(jogo.results, function (key, val) {
  442. results[key] = val;
  443. });
  444. $("#results-title").html(words.results_title);
  445. $("#results-info").html(words.results_operation + ": " + jogo.operator + "<br>" + words.results_difficulty + ": " + jogo.difficulty);
  446. var dd = "";
  447. for (i = 1; i < results.length; i++) {
  448. dd += "<div class='results-levels'> <img src='resource/img/en_US/sign.png'><div class='numphase'>" + i + "</div> ";
  449. dd += "<div class='results-levels-item'>" + words.results_start + ": " + timeConverter(results[i].start);
  450. dd += " " + words.results_end + ": " + timeConverter(results[i].end);
  451. var temp = results[i].end - results[i].start;
  452. dd += "<br>" + words.results_time + ": " + ("" + temp + "").toHHMMSS();
  453. dd += "<br>" + words.results_hits + ": " + results[i].hits;
  454. dd += "<br>" + words.results_errors + ": " + results[i].errors;
  455. //dd += "<br>" + words.results_grade + ": ";
  456. dd += "</div></div>";
  457. }
  458. $("#results-details").html(dd);
  459. var icone = "";
  460. if (jogo.shape == "Square") {
  461. if (jogo.modo == "A") {
  462. if (jogo.label == true) {
  463. icone = "one-s.png";
  464. } else {
  465. icone = "two-s.png";
  466. }
  467. }
  468. if (jogo.modo == "B") {
  469. if (jogo.label == true) {
  470. icone = "three-s.png";
  471. } else {
  472. icone = "four-s.png";
  473. }
  474. }
  475. if (jogo.modo == "C") {
  476. icone = "five-s.png";
  477. }
  478. } else {
  479. if (jogo.modo == "A") {
  480. if (jogo.label == true) {
  481. icone = "one-c.png";
  482. } else {
  483. icone = "two-c.png";
  484. }
  485. }
  486. if (jogo.modo == "B") {
  487. if (jogo.label == true) {
  488. icone = "three-c.png";
  489. } else {
  490. icone = "four-c.png";
  491. }
  492. }
  493. }
  494. $("#results-image").html("<img src='resource/img/global/game/" + icone + "'>");
  495. } else {
  496. //starting to boot game
  497. game.state.start('boot');
  498. }
  499. } else
  500. alert('Erro: nao consegui ler o conteudo de ' + iLMparameters.iLM_PARAM_Assignment);
  501. }, "json");
  502. var conta = true;
  503. var iterator = 0;
  504. var hits = [0, 0, 0, 0];
  505. var errors = [0, 0, 0, 0];
  506. var start = [0, 0, 0, 0];
  507. var end = [0, 0, 0, 0];
  508. } else { // If Not SendAnswer (teacher) ::Igor
  509. $("#form-create").css("display", "block");
  510. }
  511. function sendResults(final) {
  512. var str = "{"
  513. + '"shape": "' + jogo.shape
  514. + '", "modo": "' + jogo.modo
  515. + '", "label": "' + jogo.label
  516. + '", "operator": "' + jogo.operator
  517. + '", "difficulty": "' + jogo.difficulty
  518. + '", "num": "' + jogo.num
  519. + '", "results": {';
  520. for (j = 0; j < iterator; j++) {
  521. str += '"' + (j + 1) + '": { "phase": "' + (j + 1)
  522. + '", "hits": "' + hits[j]
  523. + '", "errors": "' + errors[j]
  524. + '", "start": "' + start[j]
  525. + '", "end": "' + end[j]
  526. + '" }' + ((j + 1 < iterator) ? "," : "");
  527. }
  528. str += "}}";
  529. console.log(str);
  530. $.post(iLMparameters.iLM_PARAM_ServerToGetAnswerURL, {return_get_answer: 1, iLM_PARAM_ActivityEvaluation: final, iLM_PARAM_ArchiveContent: str}, function (d) {});
  531. }
  532. function register_start() {
  533. var str = "{"
  534. + '"shape": "' + jogo.shape
  535. + '", "modo": "' + jogo.modo
  536. + '", "label": "' + jogo.label
  537. + '", "operator": "' + jogo.operator
  538. + '", "difficulty": "' + jogo.difficulty
  539. + '", "num": "' + jogo.num
  540. + '"';
  541. str += "}";
  542. $.post(iLMparameters.iLM_PARAM_ServerToGetAnswerURL, {iLM_PARAM_ActivityEvaluation: 0, iLM_PARAM_ArchiveContent: str}, function (d) {});
  543. }
  544. function finish_redirect() {
  545. var t = (parent.document.location + " ").split("?")[0];
  546. t += "?id=" + getParameterFromParent("id") + "&userid_iassign=" + getParameterFromParent("userid_iassign");
  547. t += "&action=view&iassign_current=" + getParameterFromParent("iassign_current");
  548. if (parent.document.location == t) {
  549. parent.document.location.reload();
  550. } else {
  551. window.parent.location = t + "#iLM";
  552. }
  553. }
  554. function timeConverter(UNIX_timestamp) {
  555. var a = new Date(UNIX_timestamp * 1000);
  556. var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
  557. var year = a.getFullYear();
  558. var month = months[a.getMonth()];
  559. var date = a.getDate();
  560. var hour = a.getHours();
  561. var min = a.getMinutes();
  562. var sec = a.getSeconds();
  563. var time = date + ' ' + month + ' ' + year + ' ' + hour + ':' + min + ':' + sec;
  564. return time;
  565. }
  566. String.prototype.toHHMMSS = function () {
  567. var sec_num = parseInt(this, 10); // don't forget the second param
  568. var hours = Math.floor(sec_num / 3600);
  569. var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
  570. var seconds = sec_num - (hours * 3600) - (minutes * 60);
  571. if (hours < 10) {
  572. hours = "0" + hours;
  573. }
  574. if (minutes < 10) {
  575. minutes = "0" + minutes;
  576. }
  577. if (seconds < 10) {
  578. seconds = "0" + seconds;
  579. }
  580. return hours + ':' + minutes + ':' + seconds;
  581. }
  582. function getParameterFromParent(name) {
  583. var match = RegExp('[?&]' + name + '=([^&]*)').exec(parent.document.location.search);
  584. return match ? decodeURIComponent(match[1].replace(/\+/g, ' ')) : null;
  585. }
  586. </script>
  587. </html>