home.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  1. <?php
  2. /**
  3. * Copyright 2021, 2024 5 Mode
  4. *
  5. * This file is part of MacSwap.
  6. *
  7. * MacSwap is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * MacSwap is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with MacSwap. If not, see <https://www.gnu.org/licenses/>.
  19. *
  20. * home.php
  21. *
  22. * MacSwap home page.
  23. *
  24. * @author Daniele Bonini <my25mb@aol.com>
  25. * @copyrights (c) 2021, 2024, 5 Mode
  26. */
  27. $curLocale = APP_LOCALE;
  28. $password = filter_input(INPUT_POST, "Password")??"";
  29. $password = strip_tags($password);
  30. if ($password==PHP_STR) {
  31. $password = filter_input(INPUT_POST, "Password2")??"";
  32. $password = strip_tags($password);
  33. }
  34. if ($password !== PHP_STR) {
  35. $hash = hash("sha256", $password . APP_SALT, false);
  36. if ($hash !== APP_HASH) {
  37. $password=PHP_STR;
  38. }
  39. }
  40. ?>
  41. <script>
  42. <?PHP if ($password != PHP_STR): ?>
  43. password = 1;
  44. <?PHP else: ?>
  45. password = 0;
  46. <?PHP endif ?>
  47. businessType = "<?PHP echo(BUSINESS_TYPE)?>";
  48. </script>
  49. <!DOCTYPE html>
  50. <head>
  51. <meta charset="UTF-8"/>
  52. <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  53. <!--
  54. Copyright 2021, 2024 5 Mode
  55. This file is part of MAcSwap.
  56. MacSwap is free software: you can redistribute it and/or modify
  57. it under the terms of the GNU General Public License as published by
  58. the Free Software Foundation, either version 3 of the License, or
  59. (at your option) any later version.
  60. MacSwap is distributed in the hope that it will be useful,
  61. but WITHOUT ANY WARRANTY; without even the implied warranty of
  62. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  63. GNU General Public License for more details.
  64. You should have received a copy of the GNU General Public License
  65. along with MacSwap. If not, see <https://www.gnu.org/licenses/>.
  66. -->
  67. <title><?PHP echo(APP_TITLE);?></title>
  68. <link rel="shortcut icon" href="/favicon.ico?v=<?php echo(time()); ?>" />
  69. <meta name="description" content="Welcome to <?php echo(APP_NAME); ?>"/>
  70. <meta name="author" content="5 Mode"/>
  71. <meta name="robots" content="index,follow"/>
  72. <script src="/js/jquery-3.6.0.min.js" type="text/javascript"></script>
  73. <script src="/js/common.js" type="text/javascript"></script>
  74. <script src="/js/bootstrap.min.js" type="text/javascript"></script>
  75. <script src="/js/sha.js" type="text/javascript"></script>
  76. <script src="/js/serialize-javascript.js" type="text/javascript"></script>
  77. <script src="/js/cube-code.js" type="text/javascript"></script>
  78. <script src="/js/dragndrop-code.js" type="text/javascript"></script>
  79. <script src="/js/home.js?v=<?php echo(time()); ?>" type="text/javascript" defer></script>
  80. <link href="/css/bootstrap.min.css" type="text/css" rel="stylesheet">
  81. <link href="/css/style.css?v=<?php echo(time()); ?>" type="text/css" rel="stylesheet">
  82. <script>
  83. /*
  84. * Interaction code
  85. */
  86. timeoutId=0;
  87. var oldtthis; // Old cube
  88. var lineOldVal = ""; // Old value for a detail line
  89. var lineNewVal = ""; // New value for a detail line
  90. var dataChanged = false;
  91. /*
  92. * Select the given cube
  93. *
  94. * @param <interfaceEl> selected cube
  95. * @returns void
  96. */
  97. function selCube(tthis) {
  98. <?PHP //if ($password != PHP_STR): ?>
  99. _selCube(tthis);
  100. // Clean the old selected..
  101. $(oldtthis).css("color","#d4b0dc");
  102. $(oldtthis).css("text-decoration","none");
  103. oldtthis = tthis;
  104. // Decore the selected one..
  105. $(tthis).css("color","#bd006e");
  106. $(tthis).css("text-decoration","underline");
  107. $("#cubezvname").html(curcube.getname());
  108. // Reset the detail view
  109. $("#detailtitle").html("");
  110. $("#detaildata").html("");
  111. $("#datadetail").hide();
  112. // Update ZOOMED VIEW interface..
  113. //$("#face1").html("<span id='facelet1'>" + curcube.getFace('h0') + "</span> &horbar;&horbar;&horbar;&horbar;&horbar;&xodot; ");
  114. //$("#face2").html("<span id='facelet2'>" + curcube.getFace('v1') + "</span>");
  115. //$("#face3").html("&xodot;&horbar;&horbar;&horbar;&horbar; <span id='facelet3'>" + curcube.getFace('h1') + "</span>");
  116. //$("#face1").attr("target", curcube.getFace('h0'));
  117. //$("#face2").attr("target", curcube.getFace('v1'));
  118. //$("#face3").attr("target", curcube.getFace('h1'));
  119. clearTimeout(timeoutId);
  120. // Update body background..
  121. //$(document.body).css("background","url('../res/bg.jpg')");
  122. //$(document.body).css("background-size","cover");
  123. // Display ZOOMED VIEW interface and controls
  124. $("#cubeList").css("width", "80%");
  125. //$("#cubectrls").show();
  126. //$("#zoomedview").show();
  127. //$("#cubelinks").show();
  128. <?PHP //endif; ?>
  129. }
  130. /*
  131. * Select the given offer cube
  132. *
  133. * @param <interfaceEl> selected cube
  134. * @returns void
  135. */
  136. function selOfferCube(tthis) {
  137. <?PHP //if ($password != PHP_STR): ?>
  138. _selOfferCube(tthis);
  139. // Clean the old selected..
  140. $(oldtthis).css("color","#d4b0dc");
  141. $(oldtthis).css("text-decoration","none");
  142. oldtthis = tthis;
  143. // Decore the selected one..
  144. $(tthis).css("color","#bd006e");
  145. $(tthis).css("text-decoration","underline");
  146. $("#cubezvname").html(curcube.getname());
  147. // Reset the detail view
  148. $("#detailtitle").html("");
  149. $("#detaildata").html("");
  150. $("#datadetail").hide();
  151. // Update ZOOMED VIEW interface..
  152. //$("#face1").html("<span id='facelet1'>" + curcube.getFace('h0') + "</span> &horbar;&horbar;&horbar;&horbar;&horbar;&xodot; ");
  153. //$("#face2").html("<span id='facelet2'>" + curcube.getFace('v1') + "</span>");
  154. //$("#face3").html("&xodot;&horbar;&horbar;&horbar;&horbar; <span id='facelet3'>" + curcube.getFace('h1') + "</span>");
  155. //$("#face1").attr("target", curcube.getFace('h0'));
  156. //$("#face2").attr("target", curcube.getFace('v1'));
  157. //$("#face3").attr("target", curcube.getFace('h1'));
  158. clearTimeout(timeoutId);
  159. // Update body background..
  160. //$(document.body).css("background","url('../res/bg.jpg')");
  161. //$(document.body).css("background-size","cover");
  162. // Display ZOOMED VIEW interface and controls
  163. $("#cubeList").css("width", "80%");
  164. //$("#cubectrls").show();
  165. //$("#zoomedview").show();
  166. //$("#cubelinks").show();
  167. <?PHP //endif; ?>
  168. }
  169. /*
  170. * Display the debug info
  171. *
  172. * @returns void
  173. */
  174. function visInfo() {
  175. $("#hcube").val(curcube.gethcube());
  176. $("#vcube").val(curcube.getvcube());
  177. $("#hcur").val(curcube.gethcur());
  178. $("#vcur").val(curcube.getvcur());
  179. $("#curcube").val(curcube.getname());
  180. }
  181. /*
  182. * Get the data for the given detail / face
  183. *
  184. * @param string xmlStr, the current cube xml data
  185. * @param string detail, the requested detail
  186. * @returns string, the detail data
  187. */
  188. function getDetailData(xmlStr, detail, isOffer) {
  189. var ret = "";
  190. var re;
  191. detail = detail.toLowerCase();
  192. xmlStr = xmlStr.replace('<?xml version="1.0" encoding="UTF-8"?>',"");
  193. xmlStr = xmlStr.replace('<details>',"");
  194. xmlStr = xmlStr.replace('</details>',"");
  195. xmlStr = xmlStr.replaceAll('\n',"");
  196. xmlStr = xmlStr.replaceAll(String.fromCharCode(9), "");
  197. xmlStr = xmlStr.replaceAll(String.fromCharCode(10), "");
  198. xmlStr = xmlStr.replaceAll(String.fromCharCode(13), "");
  199. xmlStr = xmlStr.replaceAll(" ", "");
  200. xmlStr = xmlStr.replaceAll(" ", "");
  201. xmlStr = escape(xmlStr);
  202. xmlStr = xmlStr.replaceAll("%0A", "");
  203. xmlStr = xmlStr.replaceAll("%20%20%20%20%20", "");
  204. xmlStr = xmlStr.replaceAll("%20%20%20%20%", "");
  205. xmlStr = xmlStr.replaceAll("%20%20%", "");
  206. //xmlStr = unescape(xmlStr);
  207. //alert(xmlStr);
  208. switch (detail) {
  209. case "swap":
  210. re = new RegExp("detail1%20face%3D%22swap%22.+/detail1", "igsu");
  211. break;
  212. case "contacts":
  213. re = new RegExp("detail2%20face%3D%22contacts%22.+/detail2", "igsu");
  214. break;
  215. case "other info":
  216. re = new RegExp("detail3%20face%3D%22other%20info%22.+/detail3", "igsu");
  217. break;
  218. case "password":
  219. re = new RegExp("detail4%20face%3D%22password%22.+/detail4", "igsu");
  220. break;
  221. }
  222. s = re.exec(xmlStr);
  223. if (!s || s.length===0) {
  224. ret = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error! #1";
  225. return ret;
  226. }
  227. xmlStr = s[0];
  228. //xmlStr = "<"+xmlStr+"></detail>";
  229. xmlStr = "<"+xmlStr+">";
  230. xmlStr = unescape(xmlStr);
  231. //alert(xmlStr);
  232. const parser = new DOMParser();
  233. const doc = parser.parseFromString(xmlStr, "text/xml");
  234. switch (detail) {
  235. case "swap":
  236. x = doc.getElementsByTagName("detail1");
  237. break;
  238. case "contacts":
  239. x = doc.getElementsByTagName("detail2");
  240. break;
  241. case "other info":
  242. x = doc.getElementsByTagName("detail3");
  243. break;
  244. case "password":
  245. x = doc.getElementsByTagName("detail4");
  246. break;
  247. }
  248. if (x.length===0) {
  249. ret = "Error! #2";
  250. return ret;
  251. }
  252. ret += "<div style='padding:10px;'>";
  253. for (i = 0; i < x[0].childNodes.length; i++) {
  254. if (x[0].childNodes[i].nodeType === 1) {
  255. <?PHP if ($password != PHP_STR): ?>
  256. saveOnKeyUp = "onkeyup='storeData(this)'";
  257. <?PHP else: ?>
  258. if (isOffer) {
  259. saveOnKeyUp = "onkeyup='storeData(this)'";
  260. } else {
  261. saveOnKeyUp = "";
  262. }
  263. <?PHP endif; ?>
  264. if (x[0].childNodes[i].nodeName === "business-type") {
  265. ret += "<div style='float:left;width:35%;text-align:right;height:32px;vertical-align:middle;padding-top:3px;font-weight:900;white-space:nowrap;'>" + x[0].childNodes[i].nodeName + "&nbsp;&nbsp;</div><div style='float:right;width:65%;height:32px;'>" + "<input type='text' id='cube-detail-" + x[0].childNodes[i].nodeName + "' value='" + x[0].childNodes[i].textContent + "' " + saveOnKeyUp + " style='color:green' readonly></div>";
  266. } else if (x[0].childNodes[i].nodeName === "guid") {
  267. ret += "<div style='float:left;width:35%;text-align:right;height:32px;vertical-align:middle;padding-top:3px;font-weight:900;white-space:nowrap;'>" + x[0].childNodes[i].nodeName + "&nbsp;&nbsp;</div><div style='float:right;width:65%;height:32px;'>" + "<input type='text' id='cube-detail-" + x[0].childNodes[i].nodeName + "' value='" + x[0].childNodes[i].textContent + "' " + saveOnKeyUp + " style='color:green' readonly></div>";
  268. } else if (x[0].childNodes[i].nodeName === "password") {
  269. <?PHP if ($password != PHP_STR): ?>
  270. ret += "<div style='float:left;width:35%;text-align:right;height:32px;vertical-align:middle;padding-top:3px;font-weight:900;white-space:nowrap;'>" + x[0].childNodes[i].nodeName + "&nbsp;&nbsp;</div><div style='float:right;width:65%;height:32px;'>" + "<input type='text' id='cube-detail-" + x[0].childNodes[i].nodeName + "' value='" + x[0].childNodes[i].textContent + "' " + saveOnKeyUp + " style='color:green' readonly></div>";
  271. <?PHP endif; ?>
  272. } else {
  273. ret += "<div style='float:left;width:35%;text-align:right;height:32px;vertical-align:middle;padding-top:3px;font-weight:900;white-space:nowrap;'>" + x[0].childNodes[i].nodeName + "&nbsp;&nbsp;</div><div style='float:right;width:65%;height:32px;'>" + "<input type='text' id='cube-detail-" + x[0].childNodes[i].nodeName + "' value='" + x[0].childNodes[i].textContent + "' " + saveOnKeyUp + "></div>";
  274. }
  275. }
  276. }
  277. //if ((detail==="pictures") || (detail==="menu")) {
  278. // ret += "<div style='padding-left:80px;clear:both;'><br>you can use eg. Goolge Drive or Microsoft OneDrive to host your pictures.</div>"
  279. //}
  280. ret += "</div>";
  281. return ret;
  282. }
  283. /*
  284. * Store the old data of the text control
  285. *
  286. * @param {InterfaceEl} tthis, the text control under editing
  287. * @returns void
  288. */
  289. /*function storeOldData(tthis) {
  290. //alert("keypress");
  291. lineOldVal = $(tthis).val();
  292. }*/
  293. /*
  294. * Store in the cube object the new data of the text control
  295. *
  296. * @param {InterfaceEl} tthis, the text control under editing
  297. * @returns void
  298. */
  299. function storeData(tthis) {
  300. lineNewVal = $(tthis).val();
  301. //alert(lineNewVal);
  302. nodeName = tthis.id;
  303. nodeName = nodeName.replace("cube-detail-","");
  304. //alert(nodeName);
  305. xmlStr = curcube.getxml();
  306. //$("#log").html($("#log").html() + "old=" + "/(\<" + nodeName + "\>).*(\<\/" + nodeName + "\>)/gs" + "\n");
  307. //$("#log").html($("#log").html() + "new=" + lineNewVal + "\n");
  308. //alert("<" + nodeName + ">" + lineNewVal + "</" + nodeName + ">");
  309. //re = "/(\<" + nodeName + "\>).*(\<\/" + nodeName + "\>)/gs";
  310. re = new RegExp('(\<'+nodeName+'>).*(\<\/'+nodeName+'>)','gs');
  311. xmlStr = xmlStr.replace(re, "$1" + lineNewVal + "$2");
  312. //xmlStr = xmlStr.replace("<" + nodeName + ">" + lineOldVal + "</" + nodeName + ">", "<" + nodeName + ">" + lineNewVal + "</" + nodeName + ">");
  313. //alert(xmlStr);
  314. curcube.xml = xmlStr;
  315. dataChanged = true;
  316. }
  317. /*
  318. * Store in the cube object the new pic data
  319. *
  320. * @param {InterfaceEl} tthis, the text control under editing
  321. * @returns void
  322. */
  323. function storePicData(tthis) {
  324. }
  325. function _saveData() {
  326. if (dataChanged) {
  327. curcube.savedata();
  328. //saveData();
  329. dataChanged = false;
  330. }
  331. }
  332. setInterval("_saveData()", 1500);
  333. /*
  334. * Display the given data detail
  335. *
  336. * @param <interfaceEl> selected cube
  337. * @returns void
  338. */
  339. function openDetail(tthis) {
  340. //myhtml = getDetailData(curcube.getxml(), $(tthis).attr("target"));
  341. //$("#detailtitle").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + $(tthis).attr("target") + ":");
  342. <?PHP if ($password!=""): ?>
  343. myhtml = getDetailData(curcube.getxml(), "swap") + getDetailData(curcube.getxml(), "contacts") + getDetailData(curcube.getxml(), "other info") + getDetailData(curcube.getxml(), "password");
  344. <?PHP else: ?>
  345. myhtml = getDetailData(curcube.getxml(), "swap");
  346. <?PHP endif; ?>
  347. $("#detailtitle").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Detail:");
  348. $("#detaildata").html(myhtml);
  349. $("#datadetail").show();
  350. //alert(curcube.getxml());
  351. }
  352. /*
  353. * Display the given data detail
  354. *
  355. * @param <interfaceEl> selected cube
  356. * @returns void
  357. */
  358. function openOfferDetail(tthis) {
  359. //myhtml = getDetailData(curcube.getxml(), $(tthis).attr("target"));
  360. //$("#detailtitle").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + $(tthis).attr("target") + ":");
  361. myhtml = getDetailData(curcube.getxml(), "swap") + getDetailData(curcube.getxml(), "contacts") + getDetailData(curcube.getxml(), "other info") + getDetailData(curcube.getxml(), "password");
  362. $("#detailtitle").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Detail:");
  363. $("#detaildata").html(myhtml);
  364. $("#datadetail").show();
  365. //alert(curcube.getxml());
  366. }
  367. </script>
  368. <script>
  369. /*
  370. * Boot up code
  371. */
  372. //var fetchDataIntervalId;
  373. /*
  374. * App starting proc
  375. *
  376. * @returns void
  377. */
  378. function startApp() {
  379. window.name = encryptSha2(rnd(0,99999999)+"");
  380. <?php
  381. if ($password!=PHP_STR) {
  382. $cubedisplay="inline";
  383. } else {
  384. $cubedisplay="none";
  385. }
  386. chdir(APP_DATA_PATH);
  387. foreach (glob("*-s.xml") as $filename) {
  388. $s = substr(substr($filename, 0, strlen($filename)-6),6);
  389. $offerNum = count(glob("burger".$s."-o-*.xml"));
  390. ?>
  391. i = parseInt("<?php echo($s);?>");
  392. if (i<10) {
  393. newFormalName = "burger" + "00" + i;
  394. } else if (i<100) {
  395. newFormalName = "burger" + "0" + i;
  396. } else {
  397. newFormalName = "burger" + i;
  398. }
  399. s = "";
  400. s = s + "<div id='cubelc" + i + "' style='width:99%;overflow-x: scroll;'><div id='cubel" + i + "' order='" + i + "' size='" + <?PHP echo($offerNum); ?> + "' guid='" + window.name + "' style='width:3800px;height:300px;border: 0px solid green;' ondragover='onDragOver(event);' ondrop='onDrop(this, event);'>";
  401. <?PHP if ($password!=""): ?>
  402. s = s + "<div id='cube" + i + "' class='cube' style='background:url(/res/1burger_" + parseInt(rnd(1,3)) + ".png);background-size:cover;border: 3px dashed white;' order='" + i + "' onclick='selCube(this);openDetail(this);' draggable='true' ondragstart='onDragStart(this, event);' onmouseover='onMouseOver();'><div id='cube" + i + "name' class='cubename'>" + businessType + "#" + i + "</div></div>";
  403. <?PHP else: ?>
  404. s = s + "<div id='cube" + i + "' class='cube' style='background:url(/res/1burger_" + parseInt(rnd(1,3)) + ".png);background-size:cover;border: 3px dashed white;' order='" + i + "' onclick='selCube(this);openDetail(this);'><div id='cube" + i + "name' class='cubename'>" + businessType + "#" + i + "</div></div>";
  405. <?PHP endif; ?>
  406. offers[i-1] = [];
  407. myoffer = [];
  408. <?PHP
  409. $y = 1;
  410. foreach (glob("burger".$s."-o-*.xml") as $filename2) {
  411. $basename = substr($filename2, 0, strlen($filename2)-4);
  412. $ss = substr(substr($filename2, 0, strlen($filename2)-4),12);
  413. ?>
  414. y = <?PHP echo($y);?>;
  415. /*
  416. if (y<10) {
  417. newOfferFormalName = "burger" + "00" + y;
  418. } else if (y<100) {
  419. newOfferFormalName = "burger" + "0" + y;
  420. } else {
  421. newOfferFormalName = "burger" + y;
  422. }
  423. */
  424. newOfferFormalName = "<?PHP echo($basename); ?>";
  425. s = s + "<div id='<?PHP echo($basename);?>' class='cube' style='display:<?PHP echo($cubedisplay); ?>;background:url(/res/1burgerg_" + parseInt(rnd(1,3)) + ".png);background-size:cover;border: 0px solid red;' cubeorder='" + i + "' order='" + y + "' onclick='selOfferCube(this);openOfferDetail(this);' draggable='true' ondragstart='onDropOff(event);' onmouseover='onMouseOver();'><div id='cube" + i + "offer" + y + "name' class='cubename'>offer#" + y + "</div></div>";
  426. myoffer[y-1] = new myCube("Offer#" + y, newOfferFormalName, "<?php echo(APP_HOST)?>");
  427. myoffer[y-1].start();
  428. <?PHP
  429. $y++;
  430. }
  431. ?>
  432. offers[i-1] = myoffer;
  433. s = s + "</div></div>";
  434. $("#cubeList").html($("#cubeList").html() + s);
  435. //$("#cube" + i + "name").html(businessType + "#" + i);
  436. cubes[i-1] = new myCube(businessType + "#" + i, newFormalName, "<?php echo(APP_HOST)?>");
  437. cubes[i-1].start();
  438. totcubes = i;
  439. <?php
  440. }
  441. ?>
  442. $("#cubeList").show();
  443. $("#vplayer").get(0).pause();
  444. $("#HCsplash").css("display","none");
  445. $(".header").show();
  446. //fetchDataIntervalId = setInterval("_fetchData()", 2000);
  447. hidePassword();
  448. }
  449. function hidePassword() {
  450. $("#passworddisplay").css("visibility","hidden");
  451. }
  452. /*
  453. * call to startApp
  454. *
  455. * @returns void
  456. */
  457. function _startApp() {
  458. setTimeout("startApp()", 1000);
  459. }
  460. /*
  461. * Set the elements position
  462. */
  463. function setContentPos() {
  464. $("#cubeList").css("height", parseInt(window.innerHeight-20) + "px");
  465. mytop = parseInt(window.innerHeight - ($("#passworddisplay").height() + 60));
  466. $("#passworddisplay").css("top", mytop+"px");
  467. }
  468. function setFooterPos() {
  469. if (document.getElementById("footerCont")) {
  470. //if ($("#Password").val() === "") {
  471. // tollerance = 48;
  472. // } else {
  473. // tollerance = 15;
  474. //}
  475. tollerance = 22;
  476. $("#footerCont").css("top", parseInt( window.innerHeight - $("#footerCont").height() - tollerance ) + "px");
  477. $("#footer").css("top", parseInt( window.innerHeight - $("#footer").height() - tollerance + 6) + "px");
  478. }
  479. }
  480. window.addEventListener("load", function() {
  481. setContentPos();
  482. if ($("#cubeList").css("display")==="none") {
  483. setTimeout("setFooterPos()", 9000);
  484. } else {
  485. setTimeout("setFooterPos()", 2000);
  486. }
  487. //Resetting secrets..
  488. //$("#_read_xml_cube1").val("");
  489. //$("#_read_xml_cube2").val("");
  490. //$("#_read_xml_cube3").val("");
  491. //$("#_read_xml_cube4").val("");
  492. //$("#_read_xml_cube5").val("");
  493. //Debug
  494. $("#hcube").val("");
  495. $("#vcube").val("");
  496. $("#hcur").val("");
  497. $("#vcur").val("");
  498. $("#curcube").val("");
  499. //Splash
  500. $("#HCsplash").show();
  501. $("#vplayer").get(0).play();
  502. }, true);
  503. window.addEventListener("load", function() {
  504. // Fisnished the Intro load the app..
  505. //document.getElementById("vplayer").onended=_startApp;
  506. setTimeout("_startApp()", 6000);
  507. // A bit of preload..
  508. });
  509. window.addEventListener("resize", function() {
  510. setTimeout("setContentPos()", 2000);
  511. if ($("#cubeList").css("display")==="none") {
  512. setTimeout("setFooterPos()", 9000);
  513. } else {
  514. setTimeout("setFooterPos()", 2000);
  515. }
  516. });
  517. // -- End Boot up code
  518. </script>
  519. </head>
  520. <body>
  521. <div id="HCsplash" style="padding-top: 40px; text-align:center;color:#d4b0dc;font-family:'Rampart One';display:none;">
  522. <div id="myh1" style="position:relative; top:80px;"><H1><?PHP echo(APP_NAME);?></H1></div><br><br>
  523. <video id="vplayer" loop="1">
  524. <source src="../res/macswap.mp4" type="video/mp4">
  525. </video>
  526. <div style="margin-bottom:80px;"><H3>&nbsp;</H3></div><br><br>
  527. </div>
  528. <form id="frmHC" method="POST" action="/" target="_self" enctype="multipart/form-data">
  529. <div class="header" style="margin-top:18px; display:none;">
  530. &nbsp;&nbsp;<a href="http://macswap.5mode-foss.eu" target="_self" style="color:#d4b0dc; text-decoration: none;"><img src="/res/1burger_1ori.png" style="width:25px;">&nbsp;MacSwap</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://github.com/par7133/MacSwap" style="color:#d4b0dc;"><span style="color:#d4b0dc;">on</span> github</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="mailto:posta@elettronica.lol" style="color:#d4b0dc;"><span style="color:#d4b0dc;">for</span> feedback</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="tel:+39-331-4029415" style="font-size:13px;background-color:#15c60b;border:2px solid #15c60b;color:#000000;height:27px;text-decoration:none;">&nbsp;&nbsp;get support&nbsp;&nbsp;</a>
  531. </div>
  532. <div id="debugdisplay" style="float:left;position:absolute;top:680px;left:450px;width:255px;display:none;">
  533. <input id="hcube" type="text"><br>
  534. <input id="vcube" type="text"><br>
  535. <input id="hcur" type="text"><br>
  536. <input id="vcur" type="text">
  537. <input id="curcube" type="text">
  538. </div>
  539. <div id="passworddisplay" style="float:left;position:fixed;top:680px;left:50px;width:255px;height:120px;background:black;text-align:left;white-space:nowrap; font-family:'Bungee Hairline'; color:#d4b0dc; font-weight:900;z-index:99999;">
  540. <br>
  541. &nbsp;&nbsp;<input type="password" id="Password" name="Password" placeholder="password" style="font-size:18px; background:transparent; width: 60%; border-radius:3px; font-weight:900;" value="<?php echo($password);?>" autocomplete="off">&nbsp;<input type="submit" value="<?php echo(getResource("Go", $curLocale));?>" style="text-align:left;width:25%;"><br>
  542. &nbsp;&nbsp;<input type="text" id="Salt" placeholder="salt" style="position:relative; top:+5px; font-size:18px; background:transparent; width: 90%; border-radius:3px; font-weight:900;" autocomplete="off"><br>
  543. <div style="text-align:center;">
  544. <a href="#" onclick="showEncodedPassword();" style="position:relative; left:-2px; top:+5px; font-size:18px; font-weight:900; color:#d4b0dc;"><?php echo(getResource("Hash Me", $curLocale));?>!</a>
  545. </div>
  546. <!--<textarea id="log"></textarea>-->
  547. </div>
  548. <div id="cubeList" style="position:absolute; width:100%; min-height: 500px; display:none; color:#d4b0dc; border: 0px solid red;">
  549. &nbsp;
  550. </div>
  551. <map name="ctrls-map">
  552. <area target="" alt="" title="" href="#" onclick="turnLeft();" onmouseover="zoomviewOver()" coords="408,122,120,3" shape="rect">
  553. <area target="" alt="" title="" href="#" onclick="turnUp();" onmouseover="zoomviewOver()" coords="411,272,525,3" shape="rect">
  554. <area target="" alt="" title="" href="#" onclick="turnRight();" onmouseover="zoomviewOver()" coords="407,497,115,383,407,495" shape="rect">
  555. <area target="" alt="" title="" href="#" onclick="turnDown();" onmouseover="zoomviewOver()" coords="176,347,66,411,2,295,0,144,62,142,106,238,105,243,63,144,109,237" shape="poly">
  556. </map>
  557. <div id="cubectrls" style="position:absolute;width:527px;height:497px;display:none;border:0px solid green; z-index:99998; transform: rotate(-63deg);" onmouseover="zoomviewOver()" onmouseout="zoomviewOut()">
  558. <img src="../res/ctrlbg.png" style="width:527px;height:497px;" usemap="#ctrls-map">
  559. </div>
  560. <div id="zoomedview" style="position:absolute;width:396px;height:477px;display:none;border:0px solid red; z-index:99997">
  561. <div id="cubezvname" style="position:relative; top:+30px;font-size:54px;color:#bd006e;width:400px;margin:auto;text-align:center;font-family:'Bungee Hairline';font-weight:900;"></div>
  562. <div id="cubezv" style="float:left;background:url(../res/1cube.png);background-size:cover;width:396px;height:477px;margin:50px;vertical-align:middle;text-align:center;">
  563. </div>
  564. </div>
  565. <div id="cubelinks" style="position:absolute;width:496px;height:7px;display:none;border:0px solid red; z-index:99999">
  566. <span id="face2" target="" onclick="openDetail(this)" onmouseover="zoomviewOver()" style="position:relative;top:160px;left:10px;background:transparent;border:0px;font-size:24px;color:#44ff00;width:450px;height:120px;margin:auto;text-align:center;font-family:'Bungee Hairline';font-weight:900;white-space:nowrap;cursor:pointer; transform: rotate(+63deg);"></span><br>
  567. <span id="face1" target="" onclick="openDetail(this)" onmouseover="zoomviewOver()" style="position:relative;top:+280px;left:-270px;background:transparent;border:0px solid red;font-size:24px;color:#44ff00;width:450px;height:120px;margin:auto;text-align:left;font-family:'Bungee Hairline';font-weight:900;white-space:nowrap;cursor:pointer; transform: rotate(+63deg);"></span><br>
  568. <span id="face3" target="" onclick="openDetail(this)" onmouseover="zoomviewOver()" style="position:relative;top:+160px;left:+240px;background:transparent;border:0px;font-size:24px;color:#44ff00;width:450px;height:80px;margin:auto;text-align:left;font-family:'Bungee Hairline';font-weight:900;transform: rotate(0deg); white-space:nowrap;cursor:pointer; transform: rotate(+63deg);"></span><br>
  569. </div>
  570. <div id="datadetail" style="float:right;background:#0d0d0d;border-left:1px solid white;width:380px;height:750px;display:none;color:#44ff00;" onmouseover="zoomviewOver()">
  571. <span id="detailtitle" style="color:#bd006e;font-size:20px;font-weight:900;"></span><br><br>
  572. <span id="detaildata"></span>
  573. </div>
  574. <!--
  575. <input type="hidden" id="_read_xml_cube1">
  576. <input type="hidden" id="_read_xml_cube2">
  577. <input type="hidden" id="_read_xml_cube3">
  578. <input type="hidden" id="_read_xml_cube4">
  579. <input type="hidden" id="_read_xml_cube5">
  580. -->
  581. </form>
  582. <div class="footer">
  583. <div id="footerCont">&nbsp;</div>
  584. <div id="footer"><span style="background:#0d0d0d;color:#d4b0dc;opacity:1.0;margin-right:10px;">&nbsp;&nbsp;A <a href="http://5mode.com" style="color:#d4b0dc; text-decoration:underline;">5 Mode</a> project and <a href="http://demo.5mode.com" style="color:#d4b0dc; text-decoration:underline;">WYSIWYG</a> system. Some rights reserved.</span></div>
  585. </div>
  586. <?php if (file_exists(APP_PATH . DIRECTORY_SEPARATOR . "metrics.html")): ?>
  587. <?php include(APP_PATH . DIRECTORY_SEPARATOR . "metrics.html"); ?>
  588. <?php endif; ?>
  589. </body>
  590. </html>