Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.43 KB | None | 0 0
  1. proc/show_HTML(var/mob/user)
  2. if(stat & (NOPOWER|BROKEN))
  3. return
  4. user.machine = src
  5. var/HTML = {"<style type="text/css">
  6. .tiptop {
  7. position: absolute;
  8. z-index: 9999;
  9. max-width: 300px;
  10. padding: 5px;
  11. font: 12px/1.4em "Helvetica Neue", Helvetica, Arial, sans-serif;
  12. color: #fff;
  13. background: #222;
  14. border: 2px solid #379abe
  15. }
  16.  
  17. ::-ms-clear {
  18. display: none;
  19. }
  20.  
  21. input:focus {
  22. outline: none;
  23. border-bottom: 1px solid #379abe;
  24. }
  25.  
  26. .input {
  27. background: none;
  28. width: 100%;
  29. text-align: center;
  30. padding: 7px 0 7px 0;
  31. font-size: 16px;
  32. font-weight: bold;
  33. border: none;
  34. display: inline-block;
  35. color: #ffffff;
  36. border-bottom: 1px solid transparent;
  37. }
  38.  
  39. .coord {
  40. width: 50%;
  41. display: inline-block;
  42. }
  43.  
  44. .output {
  45. margin: 0 1px;
  46. background: #21272C;
  47. }
  48.  
  49. .coordn {
  50. text-align: center;
  51. padding: 3px 0 0 0;
  52. font-size: 11px;
  53. font-weight: bold;
  54. }
  55.  
  56. .coordn a {
  57. text-align: center;
  58. color: #ffffff;
  59. text-decoration: none;
  60. font-weight: bold;
  61. }
  62.  
  63. .temp {
  64. font-size: 16px;
  65. text-align: center;
  66. font-weight: bold;
  67. padding: 5px 0 5px 0;
  68. border-bottom: 1px solid transparent;
  69. }
  70.  
  71. .buttons {
  72. margin: 0 0 1px 0;
  73. }
  74.  
  75. .buttons .act {
  76. background: #be3737;
  77. }
  78.  
  79. .buttons a {
  80. width: 100%;
  81. background: #379ABE;
  82. text-transform: uppercase;
  83. padding: 4px 0 4px 5px;
  84. font-size: 11px;
  85. text-decoration: none;
  86. color: #ffffff;
  87. margin: 0;
  88. box-sizing: border-box;
  89. }
  90.  
  91. .buttons a:hover {
  92. background: #6BC7E8;
  93. }
  94.  
  95. .butt {
  96. width: 50%;
  97. box-sizing: border-box;
  98. display: inline-block;
  99. vertical-align: middle;
  100. }
  101.  
  102. .butt span {
  103. background: #21272C;
  104. padding: 4px 0 4px 5px;
  105. width: 100%;
  106. box-sizing: border-box;
  107. display: inline-block;
  108. }
  109.  
  110. .label,
  111. tr td,
  112. tr th {
  113. padding: 3px;
  114. margin: 0 0 1px 0;
  115. font-size: 11px;
  116. }
  117.  
  118. .label {
  119. background: #21272C;
  120. }
  121.  
  122. .label a,
  123. .head a {
  124. text-decoration: none;
  125. color: #ffffff;
  126. }
  127.  
  128. .label a:hover,
  129. .head a:hover {
  130. color: #6BC7E8;
  131. }
  132.  
  133. .right {
  134. float: right;
  135. font-size: 12px;
  136. padding: 0 0 0 5px;
  137. margin-right: 5px;
  138. }
  139.  
  140. .buttons i,
  141. .head i,
  142. .coord i {
  143. padding: 0 5px 0 1px;
  144. width: 10px;
  145. text-align: center;
  146. display: inline-block;
  147. }
  148.  
  149. .buttons,
  150. .label.head,
  151. .new {
  152. margin-top: 5px;
  153. }
  154.  
  155. .head {
  156. background: #379ABE;
  157. font-size: 12px;
  158. font-weight: bold;
  159. border: none;
  160. padding: 4px 5px 4px 5px;
  161. }
  162. </style>"}
  163.  
  164. if(!beaker)
  165. HTML += "<div class='head'>Please insert beaker</div>"
  166. else if (!beaker.reagents.total_volume)
  167. HTML += "<div class='head'>Beaker is empty<A class='right' href='?src=\ref[src];eject=1'><i class='icon-eject'></i>Eject beaker</A></div>"
  168. else
  169. var/datum/reagents/R = beaker:reagents
  170. HTML += "<div class='head'>Heating/Cooling<A class='right' href='?src=\ref[src];eject=1'><i class='icon-eject'></i>Eject beaker</A></div>"
  171.  
  172. HTML += "<div class='coord'><div class='output'><div class='coordn'>Current Temperature</div><div class='temp'>[R.total_temperature]</div></div></div>"
  173.  
  174. HTML += "<div class='coord'><div class='output'><div class='coordn'>Set Temperature<a class='infotip' title='Use mousewheel to change Shift+mousewheel to change by 100' href='#info'><i class='icon-info-sign'></i></a></div>"
  175.  
  176. HTML += "<form class='container'><input type='number' class='input' min='0' max='1000' value='[target_temp]' maxlength='4'></form></div></div>"
  177.  
  178. HTML += "<div class='buttons'><div class='butt'><span class='status'>"
  179. if(active)
  180. HTML += "Status:Active ([(target_temp > R.total_temperature) ? "Heating" : "Cooling"])</span></div><div class='butt'><A class='right activate' href='?src=\ref[src];stop=1'><i class='icon-power-off'></i>Deactivate</A></div></div><BR>"
  181. else
  182. HTML += "Status:Inactive</span></div><div class='butt'><A class='right activate' href='?src=\ref[src];start=1'><i class='icon-power-off'></i>Activate</A></div></div><BR>"
  183.  
  184. for(var/reagent_id in R.reagent_list)
  185. var/datum/reagent/current_reagent = R.reagent_list[reagent_id]
  186. HTML += "<div class='label'>[current_reagent.name], [current_reagent.volume] Units.</div>"
  187.  
  188. HTML += {"
  189. <script type="text/javascript">
  190. function add(input, change) {
  191. var limit = $(input).attr("max");
  192. var value = parseInt($(input).val())
  193. if (value + change <= limit) {
  194. return $(input).val(value + change)
  195. }
  196. };
  197. function sub(input, change) {
  198. var value = parseInt($(input).val())
  199. if (value - change >= 0) {
  200. return $(input).val(value - change)
  201. }
  202. };
  203. $('.input').bind('mousewheel DOMMouseScroll', function(e) {
  204. e.preventDefault();
  205. if (e.originalEvent.wheelDelta > 0 || e.originalEvent.detail < 0) {
  206. if (event.shiftKey) {
  207. add(this, 100);
  208. } else {
  209. add(this, 50);
  210. }
  211. } else {
  212. if (event.shiftKey) {
  213. sub(this, 100);
  214. } else {
  215. sub(this, 50);
  216. }
  217. }
  218. });</script>"}
  219.  
  220. //user << browse(HTML, "window=gps;size=400x540")
  221. user.Browse(HTML, "window=chem_heater;title=Reagent Heating/Cooling Unit;size=400x540")
  222. onclose(user, "chem_heater")
  223.  
  224. attack_hand(mob/user as mob)
  225. if ((user.contents.Find(src) || get_dist(src, user) <= 1 && istype(src.loc, /turf)))
  226. src.show_HTML(user)
  227. else
  228. //user << browse(null, "window=gps")
  229. user.Browse(null, "window=chem_heater")
  230. user.machine = null
  231. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement