Guest User

Untitled

a guest
Nov 18th, 2018
253
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <div class="cmd #history# tooltips cmd-widget widget#id#" data-type="info" data-subtype="numeric" data-cmd_id="#id#" title="#collectDate#">
  2. <div style="font-weight: bold;font-size : 12px; #hideCmdName#">#name#</div>
  3. <div class="conso_position#id#">
  4. <img class="IMGihtid#id#" id="imgID#id#" src="plugins/widget/core/template/dashboard/cmd.info.numeric.HygroThermographe_TaG/No.ext_100.png">
  5. <span class="lcd_text stateint_temp#id#" id="intNumTemp#id#"></span>
  6. <span class="lcd_text statedec_temp#id#" id="decNumTemp#id#"></span>
  7. <span class="lcd_text unite_temp#id#" id="unite#id#">#unite#</span>
  8. <span class="lcd_text humidityint_unite#id#" id="intNumHumidity#id#"></span>
  9. <span class="lcd_text humiditydec_unite#id#" id="decNumHumidity#id#"></span>
  10. <span class="lcd_text humidityunite#id#" id="humidityunite#id#">%</span>
  11. </div>
  12. <style>
  13. @font-face {
  14. font-family: "Digital-7";
  15. src: url("plugins/widget/core/template/dashboard/cmd.info.numeric.HygroThermographe_TaG/font/digital-7.eot?") format("eot"),
  16. url("plugins/widget/core/template/dashboard/cmd.info.numeric.HygroThermographe_TaG/font/digital-7.woff") format("woff"),
  17. url("plugins/widget/core/template/dashboard/cmd.info.numeric.HygroThermographe_TaG/font/digital-7.ttf") format("truetype"),
  18. url("plugins/widget/core/template/dashboard/cmd.info.numeric.HygroThermographe_TaG/font/digital-7.svg#Digital-7") format("svg");
  19. font-weight:normal;
  20. font-style:normal;
  21. }
  22. .lcd_text {
  23. font-family: "Digital-7";
  24. position: absolute;
  25. color: #181818;
  26. }
  27. .widget#id#
  28. {
  29. /* pour centrer , pas joli mais ca marche*/
  30. width: 220px;
  31. width: calc(220px*#coefficient#);
  32. line-height:1.42857;
  33. }
  34. .conso_position#id#
  35. {
  36. box-sizing: border-box;
  37. width: 500px; /* taille de l'image sans scale */
  38. transform-origin: 0 0;
  39. -webkit-transform-origin: 0 0;
  40. -moz-transform-origin: 0 0;
  41. -ms-transform-origin: 0 0;
  42. -o-transform-origin: 0 0;
  43. /* 0.435 pour faire 220px */
  44. transform:scale(0.435);
  45. -webkit-transform:scale(0.435); /* Safari and Chrome */
  46. -moz-transform:scale(0.435); /* Firefox */
  47. -ms-transform:scale(0.435); /* IE 9+ */
  48. -o-transform:scale(0.435); /* Opera */
  49. transform:scale(calc(0.435*#coefficient#)) ;
  50. -webkit-transform:scale(calc(0.435*#coefficient#)) ; /* Safari and Chrome */
  51. -moz-transform:scale(calc(0.435*#coefficient#)); /* Firefox */
  52. -ms-transform:scale(calc(0.435*#coefficient#)); /* IE 9+ */
  53. -o-transform:scale(calc(0.435*#coefficient#)); /* Opera */
  54. }
  55. span.stateint_temp#id# {
  56. font-size: 185px;
  57. letter-spacing: 6px;
  58. top: 65px;
  59. right: 180px;
  60. }
  61. span.statedec_temp#id# {
  62. font-size:114px;
  63. top: 138px;
  64. left: 322px;
  65. }
  66. span.unite_temp#id# {
  67. font-size: 57px;
  68. font-weight: bold;
  69. top: 111px;
  70. left: 322px;
  71. }
  72. div.conso#id# {
  73. width:140px;
  74. min-height : 140px;
  75. }
  76. span.humidityint_unite#id# {
  77. font-size: 142px;
  78. letter-spacing: 6px;
  79. bottom: 63px;
  80. right: 180px;
  81. }
  82. span.humiditydec_unite#id# {
  83. font-size: 71px;
  84. bottom: 90px;
  85. left: 315px;
  86. }
  87. span.humidityunite#id# {
  88. font-size: 57px;
  89. bottom: 156px;
  90. left: 315px;
  91. }
  92. .ui-mobile-viewport .widget#id#
  93. {
  94. width: 220px;
  95. height: 220px;
  96. }
  97. .ui-mobile-viewport .conso_position#id#
  98. {
  99. width: fit-content;
  100. transform-origin: 0 0;
  101. -webkit-transform-origin: 0 0;
  102. -moz-transform-origin: 0 0;
  103. -ms-transform-origin: 0 0;
  104. -o-transform-origin: 0 0;
  105. /* 0.42 pour faire 220px avec 5px de padding*/
  106. transform:scale(0.42);
  107. -webkit-transform:scale(0.42); /* Safari and Chrome */
  108. -moz-transform:scale(0.42); /* Firefox */
  109. -ms-transform:scale(0.42); /* IE 9+ */
  110. -o-transform:scale(0.42); /* Opera */
  111. }
  112. </style>
  113.  
  114. <script>
  115. jeedom.cmd.update['#id#'] = function(_options){
  116. console.log("début fonction jeedom update");
  117. // Déclaration des variables
  118. console.log(jeedom.cmd.normalizeName('#name#'));
  119. var humidity#id# = #humidity#;
  120. var present#id# = #present#;
  121. var battery#id# = #battery#;
  122. var online;
  123. var batterie;
  124. var intNum = Math.floor(_options.display_value);
  125. var decNum = Math.round((_options.display_value - intNum) * 10);
  126.  
  127. console.log("modification valeur Température");
  128. // on déclare directement la valeur de température, #state# contient la témpérature. Pour rappel on a associé le widget à la commande Température
  129. $('#intNumTemp#id#').text(intNum+".");
  130. $('#decNumTemp#id#').text(decNum);
  131. console.log("température");
  132. console.log(intNum+"."+decNum);
  133.  
  134. jeedom.cmd.execute({ // Récupération de la valeur de la commande humidité
  135. id: humidity#id#,
  136. success: function(valeur) {
  137. var humidityintNum = Math.floor(valeur);
  138. var humiditydecNum = Math.round((valeur - humidityintNum) * 10);
  139. $('#intNumHumidity#id#').text(humidityintNum+".");
  140. $('#decNumHumidity#id#').text(humiditydecNum);
  141. console.log("humidité");
  142. console.log(humidityintNum+"."+humiditydecNum);
  143.  
  144. }
  145. });
  146.  
  147. jeedom.cmd.execute({ // Récupération de la valeur de la commande present (binaire)
  148. id: present#id#,
  149. success: function(valeur){
  150. online = valeur;
  151.  
  152. jeedom.cmd.execute({ // Récupération de la valeur de la commande batterie
  153. id: battery#id#,
  154. success: function(valeur){
  155. batterie = valeur;
  156. console.log("récup batterie : "+batterie);
  157. console.log("online : "+online);
  158. ext_online=(online == 1 ?'':'_nobt');
  159. root_dir='plugins/widget/core/template/dashboard/cmd.info.numeric.HygroThermographe_TaG/';
  160. if (batterie >= 80) {
  161. $('.cmd[data-cmd_id=#id#] .IMGihtid#id#').attr('src',root_dir+'No.ext_100'+ext_online+'.png');
  162. }else if (batterie >= 60 && batterie < 80){
  163. $('.cmd[data-cmd_id=#id#] .IMGihtid#id#').attr('src',root_dir+'No.ext_80'+ext_online+'.png');
  164. }else if (batterie >= 40 && batterie < 60){
  165. $('.cmd[data-cmd_id=#id#] .IMGihtid#id#').attr('src',root_dir+'No.ext_60'+ext_online+'.png');
  166. }else if (batterie >= 20 && batterie < 40){
  167. $('.cmd[data-cmd_id=#id#] .IMGihtid#id#').attr('src',root_dir+'No.ext_40'+ext_online+'.png');
  168. }else if (batterie >= 5 && batterie < 20){
  169. $('.cmd[data-cmd_id=#id#] .IMGihtid#id#').attr('src',root_dir+'No.ext_20'+ext_online+'.png');
  170. }else if (batterie < 5){
  171. $('.cmd[data-cmd_id=#id#] .IMGihtid#id#').attr('src',root_dir+'No.ext_0'+ext_online+'.png');
  172. }
  173. }
  174. });
  175. }
  176. });
  177.  
  178. $('.cmd[data-cmd_id=#id#]').attr('title','Valeur du '+_options.valueDate+', collectée le '+_options.collectDate);
  179. $('.cmd[data-cmd_id=#id#] .state').empty().append(_options.display_value);
  180. console.log("fin fonction jeedom update");
  181. }
  182. jeedom.cmd.update['#id#']({display_value:'#state#',valueDate:'#valueDate#',collectDate:'#collectDate#'});
  183.  
  184. </script>
  185. </div>
RAW Paste Data