You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

231 lines
7.5 KiB

8 years ago
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>info visualizer</title>
  5. <meta charset="UTF-8" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <!-- (no cal pq ja estan les funcions i el css en aquest fitxer)
  8. <link rel='StyleSheet' type='text/css' href='estil.css'>
  9. <script src='funcions.js'></script>
  10. -->
  11. <!-- llibraries -->
  12. <script src="xml2json.js"></script>
  13. <!-- /llibraries -->
  14. <script>
  15. function OnLoadApp()
  16. {//function that runs on load the page
  17. InitializeObjectOFromXML();
  18. //MostraInfo();
  19. }
  20. function InitializeObjectOFromXML()
  21. {//function to convert the xml object to a json object 'o'
  22. xmlDoc=LoadXMLDoc("dadestw.xml");
  23. ojson=xml2json(xmlDoc, "");
  24. o=JSON.parse(ojson);
  25. }
  26. function LoadXMLDoc(dname)
  27. {
  28. if(window.XMLHttpRequest){
  29. xhttp=new XMLHttpRequest();
  30. }else{
  31. xhttp=new ActiveXObject("Microsoft.XMLHTTP");
  32. }
  33. xhttp.open("GET",dname,false);
  34. xhttp.send();
  35. return xhttp.responseXML;
  36. }
  37. function swModeClick()
  38. {
  39. if(document.getElementById("swmode").checked==true)
  40. {
  41. MostraInfoModeNormal();
  42. document.getElementById("swmode").checked="";
  43. }else if(document.getElementById("swmode").checked==false)
  44. {
  45. MostraInfoModeResumit();
  46. document.getElementById("swmode").checked="true";
  47. }
  48. }
  49. function MostraInfoModeNormal()
  50. {
  51. var sortida="";
  52. document.getElementById("contingutInfo").innerHTML="";
  53. //sortida+="<div class='botoMode' onclick='MostraInfoModeResumit()'>MostraInfo(Resum)</div>";
  54. // document.getElementById("contingutInfo").innerHTTML=o.root.llistaamics.amic.length;
  55. numbucle=o.root.llistatuits.tuit.length -1;
  56. for(i=numbucle; i>0; i--)
  57. {
  58. if(o.root.llistatuits.tuit[i]["@retuits"]>5)
  59. {
  60. sortida+= "<font color='#3C9166'>" + o.root.llistatuits.tuit[i]["@de"] + "</font>";
  61. sortida+= " - <font color='#7a5752'>" + o.root.llistatuits.tuit[i]["@hora"] + "</font><br>";
  62. sortida+=o.root.llistatuits.tuit[i]["#text"] + "<br>";
  63. if(o.root.llistatuits.tuit[i]["@imatge"])
  64. {
  65. sortida+="<img class='imatge' src='"+o.root.llistatuits.tuit[i]["@imatge"]+"'/><br>";
  66. }
  67. sortida+="<font color='#51707b'>rt: " + o.root.llistatuits.tuit[i]["@retuits"] + "</font><br>";
  68. sortida+="<hr color='#343434'>";
  69. }else{
  70. sortida+= "<div style='background:#2c313a; color:#7d889c'><font color='#3C9166'>" + o.root.llistatuits.tuit[i]["@de"] + "</font>";
  71. sortida+= " - <font color='#7a5752'>" + o.root.llistatuits.tuit[i]["@hora"] + "</font><br>";
  72. sortida+=o.root.llistatuits.tuit[i]["#text"] + "<br>";
  73. if(o.root.llistatuits.tuit[i]["@imatge"])
  74. {
  75. sortida+="<img class='imatge' src='"+o.root.llistatuits.tuit[i]["@imatge"]+"'/><br>";
  76. }
  77. sortida+="<font color='#51707b'>rt: " + o.root.llistatuits.tuit[i]["@retuits"] + "</font><br>";
  78. sortida+="</div><hr color='#343434'>";
  79. }
  80. }
  81. document.getElementById("contingutInfo").innerHTML=sortida;
  82. }
  83. function MostraInfoModeResumit()
  84. {
  85. var sortida="";
  86. document.getElementById("contingutInfo").innerHTML="";
  87. //sortida+="<div class='botoMode' onclick='MostraInfoModeNormal()'>MostraInfo(Normal)</div>";
  88. numbucle=o.root.llistatuits.tuit.length -1;
  89. for(i=numbucle; i>0; i--)
  90. {
  91. //alert(o.root.llistatuits.tuit[i]["@retuits"]);
  92. if(o.root.llistatuits.tuit[i]["@retuits"]>5)
  93. {
  94. sortida+= "<font color='#3C9166'>" + o.root.llistatuits.tuit[i]["@de"] + "</font>";
  95. sortida+= " - <font color='#7a5752'>" + o.root.llistatuits.tuit[i]["@hora"] + "</font><br>";
  96. sortida+=o.root.llistatuits.tuit[i]["#text"] + "<br>";
  97. if(o.root.llistatuits.tuit[i]["@imatge"])
  98. {
  99. sortida+="<img class='imatge' src='"+o.root.llistatuits.tuit[i]["@imatge"]+"'/><br>";
  100. }
  101. sortida+="<font color='#51707b'>rt: " + o.root.llistatuits.tuit[i]["@retuits"] + "</font><br>";
  102. sortida+="<hr color='#343434'>";
  103. }
  104. }
  105. document.getElementById("contingutInfo").innerHTML=sortida;
  106. }
  107. </script>
  108. <style>
  109. html, body { /* sense marges ni padding */
  110. margin: 0;
  111. padding: 0;
  112. /*background-color: #EDEEF0;*/
  113. font-family: "Courier New", Courier, monospace;
  114. background: #282c34;
  115. }
  116. .caixainfo{
  117. background: #282c34;
  118. color: #abb2bf;
  119. /*border: 2px black solid;
  120. margin-left: 100px;
  121. margin-top: 10px;
  122. width: 350px;
  123. height: 630px;*/
  124. /*overflow-y: scroll;*/
  125. }
  126. .botoMode{
  127. background: #6f7a90;
  128. width: 180px;
  129. padding: 5px;
  130. margin: 5px;
  131. margin-left: auto;
  132. font-weight: bold;
  133. border-radius: 3px;
  134. }
  135. .imatge{
  136. width: 400px;
  137. height: 1px;
  138. /*border: 1px solid #3b4044;*/
  139. transition:all .1s linear;
  140. filter: grayscale(100%);
  141. border-radius: 8px;
  142. }
  143. .imatge:hover{
  144. /*width: 400px;*/
  145. height: auto;
  146. transition:all .1s linear;
  147. filter: grayscale(0%);
  148. }
  149. /*switcher small*/
  150. .onoffswitch01 {
  151. margin-left:440px;
  152. display: inline-block;
  153. position: relative; width: 40px;
  154. -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
  155. transition:all .5s linear;
  156. }
  157. .onoffswitch01-checkbox {
  158. display: none;
  159. }
  160. .onoffswitch01-label {
  161. display: block; overflow: hidden; cursor: pointer;
  162. border: 2px solid #A0A5AB; border-radius: 36px;
  163. }
  164. .onoffswitch01-inner {
  165. display: block; width: 200%; margin-left: -100%;
  166. transition: margin 0.25s ease-in 0s;
  167. }
  168. .onoffswitch01-inner:before, .onoffswitch01-inner:after {
  169. display: block; float: left; width: 50%; height: 15px; padding: 0; line-height: 15px;
  170. font-size: 16px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
  171. box-sizing: border-box;
  172. }
  173. .onoffswitch01-inner:before {
  174. content: "";
  175. padding-left: 10px;
  176. background-color: #374d73; color: #FFFFFF;
  177. }
  178. .onoffswitch01-inner:after {
  179. content: "";
  180. padding-right: 10px;
  181. background-color: #CBCDCF; color: #666666;
  182. text-align: right;
  183. }
  184. .onoffswitch01-switch {
  185. display: block; width: 15px; margin: 0px;
  186. background: #FFFFFF;
  187. position: absolute; top: 0; bottom: 0;
  188. right: 21px;
  189. border: 2px solid #CCCCCC; border-radius: 36px;
  190. transition: all 0.25s ease-in 0s;
  191. }
  192. .onoffswitch01-checkbox:checked + .onoffswitch01-label .onoffswitch01-inner {
  193. margin-left: 0;
  194. }
  195. .onoffswitch01-checkbox:checked + .onoffswitch01-label .onoffswitch01-switch {
  196. right: 0px;
  197. }
  198. </style>
  199. </head>
  200. <body onload="OnLoadApp()">
  201. <div class='onoffswitch01' onclick='swModeClick()'>
  202. <input type='checkbox' name='onoffswitch01' class='onoffswitch01-checkbox' id='swmode' checked>
  203. <label class='onoffswitch01-label' for='mode'>
  204. <span class='onoffswitch01-inner'></span>
  205. <span class='onoffswitch01-switch'></span>
  206. </label>
  207. </div><br>
  208. <div id="contingutInfo" class='caixainfo'>
  209. <!-- <div class='botoMode' onclick='MostraInfoModeNormal()'>MostraInfo(Normal)</div>-->
  210. </div>
  211. </body>
  212. </html>