subduino 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (267) hide show
  1. data/VERSION +1 -1
  2. data/bin/subduino +18 -5
  3. data/duino/Makefile +2 -3
  4. data/duino/duino.pde +97 -66
  5. data/lib/subduino/ard_io.rb +33 -14
  6. data/lib/subduino/ard_ps.rb +47 -24
  7. data/lib/subduino/os.rb +49 -0
  8. data/lib/subduino/parse/bool.rb +1 -1
  9. data/lib/subduino/parse/energy.rb +18 -0
  10. data/lib/subduino/parse/flow.rb +13 -0
  11. data/lib/subduino/parse/lux.rb +1 -1
  12. data/lib/subduino/parse/presence.rb +9 -0
  13. data/lib/subduino/parse/pressure.rb +13 -0
  14. data/lib/subduino/parse/temp.rb +1 -1
  15. data/lib/subduino/parse.rb +3 -3
  16. data/lib/subduino/scaffold/Makefile +72 -73
  17. data/lib/subduino/scaffold/scaffold.pde +77 -0
  18. data/lib/subduino/store.rb +1 -1
  19. data/spec/subduino/parse_spec.rb +1 -1
  20. data/subduino.gemspec +8 -249
  21. metadata +8 -249
  22. data/webapp/Gemfile +0 -8
  23. data/webapp/Gemfile.lock +0 -14
  24. data/webapp/Rakefile +0 -49
  25. data/webapp/Readme.textile +0 -45
  26. data/webapp/VERSION +0 -1
  27. data/webapp/config.yml +0 -20
  28. data/webapp/lib/app.rb +0 -103
  29. data/webapp/lib/duino.rb +0 -206
  30. data/webapp/lib/environment.rb +0 -36
  31. data/webapp/lib/messenger.rb +0 -16
  32. data/webapp/public/app.css +0 -119
  33. data/webapp/public/app.js +0 -34
  34. data/webapp/public/custom.js +0 -187
  35. data/webapp/public/date_input.css +0 -149
  36. data/webapp/public/facebox.css +0 -83
  37. data/webapp/public/facebox.js +0 -319
  38. data/webapp/public/favicon.ico +0 -0
  39. data/webapp/public/faye.js +0 -1
  40. data/webapp/public/icons/alarm-clock-blue.png +0 -0
  41. data/webapp/public/icons/alarm-clock.png +0 -0
  42. data/webapp/public/icons/balloon-left.png +0 -0
  43. data/webapp/public/icons/bandaid.png +0 -0
  44. data/webapp/public/icons/bell-disable.png +0 -0
  45. data/webapp/public/icons/bell.png +0 -0
  46. data/webapp/public/icons/big_icon.png +0 -0
  47. data/webapp/public/icons/bomb.png +0 -0
  48. data/webapp/public/icons/bookmark.png +0 -0
  49. data/webapp/public/icons/box-label.png +0 -0
  50. data/webapp/public/icons/brightness-control-up.png +0 -0
  51. data/webapp/public/icons/brightness-control.png +0 -0
  52. data/webapp/public/icons/brightness-small.png +0 -0
  53. data/webapp/public/icons/broom.png +0 -0
  54. data/webapp/public/icons/bug.png +0 -0
  55. data/webapp/public/icons/calculator.png +0 -0
  56. data/webapp/public/icons/calendar-day.png +0 -0
  57. data/webapp/public/icons/camera.png +0 -0
  58. data/webapp/public/icons/cards-address.png +0 -0
  59. data/webapp/public/icons/chart.png +0 -0
  60. data/webapp/public/icons/clock-select.png +0 -0
  61. data/webapp/public/icons/color.png +0 -0
  62. data/webapp/public/icons/compass.png +0 -0
  63. data/webapp/public/icons/control-power-small.png +0 -0
  64. data/webapp/public/icons/control-power.png +0 -0
  65. data/webapp/public/icons/control-record-small.png +0 -0
  66. data/webapp/public/icons/cpus.png +0 -0
  67. data/webapp/public/icons/credit-card.png +0 -0
  68. data/webapp/public/icons/cross-small.png +0 -0
  69. data/webapp/public/icons/current.png +0 -0
  70. data/webapp/public/icons/dashboard.png +0 -0
  71. data/webapp/public/icons/database.png +0 -0
  72. data/webapp/public/icons/databases.png +0 -0
  73. data/webapp/public/icons/day.png +0 -0
  74. data/webapp/public/icons/door-big.png +0 -0
  75. data/webapp/public/icons/door-open-in.png +0 -0
  76. data/webapp/public/icons/door-open-out.png +0 -0
  77. data/webapp/public/icons/door-open.png +0 -0
  78. data/webapp/public/icons/door.png +0 -0
  79. data/webapp/public/icons/drive-globe.png +0 -0
  80. data/webapp/public/icons/equalizer.png +0 -0
  81. data/webapp/public/icons/exclamation-diamond.png +0 -0
  82. data/webapp/public/icons/exclamation.png +0 -0
  83. data/webapp/public/icons/eye-disable.png +0 -0
  84. data/webapp/public/icons/eye.png +0 -0
  85. data/webapp/public/icons/false.png +0 -0
  86. data/webapp/public/icons/favicon.png +0 -0
  87. data/webapp/public/icons/gear-small.png +0 -0
  88. data/webapp/public/icons/gear.png +0 -0
  89. data/webapp/public/icons/groups.png +0 -0
  90. data/webapp/public/icons/heart.png +0 -0
  91. data/webapp/public/icons/heart_empty.png +0 -0
  92. data/webapp/public/icons/info.png +0 -0
  93. data/webapp/public/icons/irrigation.png +0 -0
  94. data/webapp/public/icons/key.png +0 -0
  95. data/webapp/public/icons/lamp-big.png +0 -0
  96. data/webapp/public/icons/lightbulb.png +0 -0
  97. data/webapp/public/icons/lightbulb_off.png +0 -0
  98. data/webapp/public/icons/lightning-disable.png +0 -0
  99. data/webapp/public/icons/lightning-small.png +0 -0
  100. data/webapp/public/icons/lightning.png +0 -0
  101. data/webapp/public/icons/lock-unlock.png +0 -0
  102. data/webapp/public/icons/lock.png +0 -0
  103. data/webapp/public/icons/locked.png +0 -0
  104. data/webapp/public/icons/lux.png +0 -0
  105. data/webapp/public/icons/marker.png +0 -0
  106. data/webapp/public/icons/media-player-phone.png +0 -0
  107. data/webapp/public/icons/megaphone.png +0 -0
  108. data/webapp/public/icons/mem.png +0 -0
  109. data/webapp/public/icons/microphone.png +0 -0
  110. data/webapp/public/icons/monitor.png +0 -0
  111. data/webapp/public/icons/navigation.png +0 -0
  112. data/webapp/public/icons/night.png +0 -0
  113. data/webapp/public/icons/noise.png +0 -0
  114. data/webapp/public/icons/off.png +0 -0
  115. data/webapp/public/icons/on.png +0 -0
  116. data/webapp/public/icons/onoff.png +0 -0
  117. data/webapp/public/icons/pin.png +0 -0
  118. data/webapp/public/icons/plug--exclamation.png +0 -0
  119. data/webapp/public/icons/plug-disable.png +0 -0
  120. data/webapp/public/icons/plug.png +0 -0
  121. data/webapp/public/icons/rain.png +0 -0
  122. data/webapp/public/icons/refrigeration.png +0 -0
  123. data/webapp/public/icons/restart.png +0 -0
  124. data/webapp/public/icons/ruby.png +0 -0
  125. data/webapp/public/icons/server.png +0 -0
  126. data/webapp/public/icons/shield-disable.png +0 -0
  127. data/webapp/public/icons/shield.png +0 -0
  128. data/webapp/public/icons/socket--exclamation.png +0 -0
  129. data/webapp/public/icons/socket-disable.png +0 -0
  130. data/webapp/public/icons/socket.png +0 -0
  131. data/webapp/public/icons/start.png +0 -0
  132. data/webapp/public/icons/stop.png +0 -0
  133. data/webapp/public/icons/switch--exclamation.png +0 -0
  134. data/webapp/public/icons/switch-disable.png +0 -0
  135. data/webapp/public/icons/switch-small.png +0 -0
  136. data/webapp/public/icons/switch.png +0 -0
  137. data/webapp/public/icons/target.png +0 -0
  138. data/webapp/public/icons/television-off.png +0 -0
  139. data/webapp/public/icons/television.png +0 -0
  140. data/webapp/public/icons/temp.png +0 -0
  141. data/webapp/public/icons/terminal.png +0 -0
  142. data/webapp/public/icons/tick-small.png +0 -0
  143. data/webapp/public/icons/traffic-light-off.png +0 -0
  144. data/webapp/public/icons/traffic-light.png +0 -0
  145. data/webapp/public/icons/traffic.png +0 -0
  146. data/webapp/public/icons/true.png +0 -0
  147. data/webapp/public/icons/umbrella.png +0 -0
  148. data/webapp/public/icons/unlocked.png +0 -0
  149. data/webapp/public/icons/unmonitor.png +0 -0
  150. data/webapp/public/icons/unmonitored.png +0 -0
  151. data/webapp/public/icons/users.png +0 -0
  152. data/webapp/public/icons/vcard.png +0 -0
  153. data/webapp/public/icons/wall.png +0 -0
  154. data/webapp/public/icons/wall_brick.png +0 -0
  155. data/webapp/public/icons/wall_disable.png +0 -0
  156. data/webapp/public/icons/wand-disable.png +0 -0
  157. data/webapp/public/icons/wand.png +0 -0
  158. data/webapp/public/icons/warn.png +0 -0
  159. data/webapp/public/icons/weather_clouds.png +0 -0
  160. data/webapp/public/icons/weather_cloudy.png +0 -0
  161. data/webapp/public/icons/weather_lightning.png +0 -0
  162. data/webapp/public/icons/weather_rain.png +0 -0
  163. data/webapp/public/icons/weather_snow.png +0 -0
  164. data/webapp/public/icons/weather_sun.png +0 -0
  165. data/webapp/public/icons/wrench-screwdriver.png +0 -0
  166. data/webapp/public/icons/wrench.png +0 -0
  167. data/webapp/public/images/ajax-loader.gif +0 -0
  168. data/webapp/public/images/b.png +0 -0
  169. data/webapp/public/images/bendl.gif +0 -0
  170. data/webapp/public/images/bendr.gif +0 -0
  171. data/webapp/public/images/bendsb.gif +0 -0
  172. data/webapp/public/images/bg.jpg +0 -0
  173. data/webapp/public/images/bhead.gif +0 -0
  174. data/webapp/public/images/bheadl.gif +0 -0
  175. data/webapp/public/images/bheadr.gif +0 -0
  176. data/webapp/public/images/bl.png +0 -0
  177. data/webapp/public/images/bnd.gif +0 -0
  178. data/webapp/public/images/br.png +0 -0
  179. data/webapp/public/images/bread.gif +0 -0
  180. data/webapp/public/images/btnb.gif +0 -0
  181. data/webapp/public/images/btnb_.gif +0 -0
  182. data/webapp/public/images/btnm.gif +0 -0
  183. data/webapp/public/images/btnm_.gif +0 -0
  184. data/webapp/public/images/btns.gif +0 -0
  185. data/webapp/public/images/btns_.gif +0 -0
  186. data/webapp/public/images/cal.jpg +0 -0
  187. data/webapp/public/images/close.png +0 -0
  188. data/webapp/public/images/closelabel.gif +0 -0
  189. data/webapp/public/images/error.gif +0 -0
  190. data/webapp/public/images/ft.gif +0 -0
  191. data/webapp/public/images/hdr.gif +0 -0
  192. data/webapp/public/images/hdrl.gif +0 -0
  193. data/webapp/public/images/hdrr.gif +0 -0
  194. data/webapp/public/images/hld.jpg +0 -0
  195. data/webapp/public/images/imgb.gif +0 -0
  196. data/webapp/public/images/imgo.gif +0 -0
  197. data/webapp/public/images/imgt.gif +0 -0
  198. data/webapp/public/images/info.gif +0 -0
  199. data/webapp/public/images/jquery.wysiwyg.gif +0 -0
  200. data/webapp/public/images/li.gif +0 -0
  201. data/webapp/public/images/mbg.png +0 -0
  202. data/webapp/public/images/nsp.gif +0 -0
  203. data/webapp/public/images/phs.gif +0 -0
  204. data/webapp/public/images/sdd.jpg +0 -0
  205. data/webapp/public/images/sdd_.jpg +0 -0
  206. data/webapp/public/images/sidebar.gif +0 -0
  207. data/webapp/public/images/sorta.gif +0 -0
  208. data/webapp/public/images/sortd.gif +0 -0
  209. data/webapp/public/images/srch.gif +0 -0
  210. data/webapp/public/images/srch_.gif +0 -0
  211. data/webapp/public/images/success.gif +0 -0
  212. data/webapp/public/images/thumb1.jpg +0 -0
  213. data/webapp/public/images/thumb2.jpg +0 -0
  214. data/webapp/public/images/thumb3.jpg +0 -0
  215. data/webapp/public/images/tiny.gif +0 -0
  216. data/webapp/public/images/tiny_.gif +0 -0
  217. data/webapp/public/images/tl.png +0 -0
  218. data/webapp/public/images/tr.png +0 -0
  219. data/webapp/public/images/upload.gif +0 -0
  220. data/webapp/public/images/warning.gif +0 -0
  221. data/webapp/public/iui/backButton.png +0 -0
  222. data/webapp/public/iui/blueButton.png +0 -0
  223. data/webapp/public/iui/cancel.png +0 -0
  224. data/webapp/public/iui/grayButton.png +0 -0
  225. data/webapp/public/iui/greenButton.png +0 -0
  226. data/webapp/public/iui/iui-logo-touch-icon.png +0 -0
  227. data/webapp/public/iui/iui.css +0 -396
  228. data/webapp/public/iui/iui.js +0 -511
  229. data/webapp/public/iui/iuix.css +0 -1
  230. data/webapp/public/iui/iuix.js +0 -1
  231. data/webapp/public/iui/listArrow.png +0 -0
  232. data/webapp/public/iui/listArrowSel.png +0 -0
  233. data/webapp/public/iui/listGroup.png +0 -0
  234. data/webapp/public/iui/loading.gif +0 -0
  235. data/webapp/public/iui/pinstripes.png +0 -0
  236. data/webapp/public/iui/redButton.png +0 -0
  237. data/webapp/public/iui/selection.png +0 -0
  238. data/webapp/public/iui/thumb.png +0 -0
  239. data/webapp/public/iui/toggle.png +0 -0
  240. data/webapp/public/iui/toggleOn.png +0 -0
  241. data/webapp/public/iui/toolButton.png +0 -0
  242. data/webapp/public/iui/toolbar.png +0 -0
  243. data/webapp/public/iui/whiteButton.png +0 -0
  244. data/webapp/public/iui/yellowButton.png +0 -0
  245. data/webapp/public/jquery.img.preload.js +0 -152
  246. data/webapp/public/jquery.js +0 -154
  247. data/webapp/public/jquery.sparkline.js +0 -85
  248. data/webapp/public/jquery.tablesorter.min.js +0 -2
  249. data/webapp/public/jquery.visualize.js +0 -452
  250. data/webapp/public/jquery.wysiwyg.css +0 -56
  251. data/webapp/public/layout.css +0 -33
  252. data/webapp/public/right.js +0 -9
  253. data/webapp/public/rt.js +0 -7
  254. data/webapp/public/sparkline.js +0 -85
  255. data/webapp/public/style.css +0 -881
  256. data/webapp/public/visualize.css +0 -32
  257. data/webapp/spec/duino_spec.rb +0 -8
  258. data/webapp/spec/spec_helper.rb +0 -10
  259. data/webapp/views/command.haml +0 -4
  260. data/webapp/views/icon.haml +0 -6
  261. data/webapp/views/index.haml +0 -367
  262. data/webapp/views/layout.haml +0 -88
  263. data/webapp/views/mobile.haml +0 -21
  264. data/webapp/views/switch.haml +0 -56
  265. data/webapp/views/template.haml +0 -676
  266. data/webapp/views/top.haml +0 -4
  267. data/webapp/views/watch.haml +0 -26
@@ -1,9 +0,0 @@
1
- /**
2
- * RightJS, http://rightjs.org
3
- * Released under the MIT license
4
- *
5
- * Custom build with options: no-olds, server
6
- *
7
- * Copyright (C) 2008-2010 Nikolay Nemshilov
8
- */
9
- RightJS={version:"1.5.6",modules:["core","dom","form","cookie","xhr","fx"]};function $ext(d,s,a){var s=s||{},k;for(k in s)if(a!==true||typeof(d[k])==='undefined')d[k]=s[k];return d};function $try(){for(var i=0;i<arguments.length;i++)try{return arguments[i]()}catch(e){}};function $eval(t){if(!isString(t)||t.blank())return;if(window.execScript)window.execScript(t);else $E('script',{type:'text/javascript',text:t}).insertTo(document.body)}function $break(){throw new Break()};function $alias(o,n){for(var a in n)o[a]=o[n[a]];return o};function defined(v){return typeof(v)!=='undefined'};function isFunction(v){return typeof(v)==='function'};function isString(v){return typeof(v)==='string'};function isNumber(v){return typeof(v)==='number'};function isElement(v){return v&&v.tagName};function isNode(v){return v&&v.nodeType};function $E(t,o){return new Element(t,o)};function $(e){return typeof(e)==='string'?document.getElementById(e):e};function $$(c){return $A(document.querySelectorAll(c))};function $w(s){return s.trim().split(/\s+/)};(function(){var t=Object.prototype.toString,s=Array.prototype.slice,U=1;isHash=function(v){return t.call(v)==='[object Object]'};if(isHash(document.documentElement))isHash=function(v){return t.call(v)==='[object Object]'&&v!==null&&typeof(v)!=='undefined'&&typeof(v.hasOwnProperty)!=='undefined'};isArray=function(v){return t.call(v)==='[object Array]'};$A=function(b){try{return s.call(b)}catch(e){for(var a=[],i=0,l=b.length;i<l;i++)a[i]=b[i];return a}};$uid=function(i){return i.uid||(i.uid=U++)};for(var i=0,n=[Array,Function,Number,String,Date,RegExp];i<n.length;i++)n[i].include=function(m,d){$ext(this.prototype,m,d);return this}})();$ext(Object,{keys:function(o){var a=[],k;for(k in o)a.push(k);return a},values:function(o){var v=[],k;for(k in o)v.push(o[k]);return v},empty:function(o){for(var k in o)break;return!k},without:function(){var f=$A(arguments),o=f.shift(),c={},k;for(k in o)if(!f.includes(k))c[k]=o[k];return c},only:function(){var f=$A(arguments),o=f.shift(),c={},i=0,l=f.length;for(;i<l;i++)if(defined(o[f[i]]))c[f[i]]=o[f[i]];return c},merge:function(){var o={},i=0,l=arguments.length;for(;i<l;i++)if(isHash(arguments[i]))$ext(o,arguments[i]);return o},toQueryString:function(o){var t=[],k;for(k in o)t.push(k+'='+encodeURIComponent(o[k]));return t.join('&')}},true);$ext(Math,{random:function(a,m){var r=this._random();if(arguments.length==0)return r;if(arguments.length==1)var m=a,a=0;return Math.floor(r*(m-a+1)+a)},_random:Math.random});(function(A){var q=A.forEach||function(c,s){for(var i=0,l=this.length;i<l;i++)c.call(s,this[i],i,this)};var m=A.filter||function(c,s){for(var r=[],i=0,j=0,l=this.length;i<l;i++)if(c.call(s,this[i],i,this))r[j++]=this[i];return r};var w=A.map||function(c,s){for(var r=[],i=0,l=this.length;i<l;i++)r[i]=c.call(s,this[i],i,this);return r};var y=A.some||function(c,s){for(var i=0,l=this.length;i<l;i++)if(c.call(s,this[i],i,this))return true;return false};var k=A.every||function(c,s){for(var i=0,l=this.length;i<l;i++)if(!c.call(s,this[i],i,this))return false;return true};function n(c,s){for(var i=0,l=this.length;i<l;i++)if(c.call(s,this[i],i,this))return this[i];return this._$u};function u(c,s){for(var i=this.length-1;i>-1;i--)if(c.call(s,this[i],i,this))return this[i];return this._$u};function t(a,b){var d=a[0],a=A.slice.call(a,1),s=b;if(isString(d)){var c=d;if(b.length&&isFunction(b[0][c]))d=function(o){return o[c].apply(o,a)};else d=function(o){return o[c]}}else s=a[0];return[d,s]};function h(f,s,a){try{return f.apply(s,t(a,s))}catch(e){if(!(e instanceof Break))throw(e)}};function g(a){return!!a};Array.include({indexOf:A.indexOf||function(v,f){for(var i=(f<0)?Math.max(0,this.length+f):f||0,l=this.length;i<l;i++)if(this[i]===v)return i;return-1},lastIndexOf:A.lastIndexOf||function(v){for(var i=this.length-1;i>-1;i--)if(this[i]===v)return i;return-1},first:function(){return arguments.length?h(n,this,arguments):this[0]},last:function(){return arguments.length?h(u,this,arguments):this[this.length-1]},random:function(){return this.length?this[Math.random(this.length-1)]:null},size:function(){return this.length},clean:function(){this.length=0;return this},empty:function(){return!this.length},clone:function(){return this.slice(0)},each:function(){h(q,this,arguments);return this},forEach:q,map:function(){return h(w,this,arguments)},filter:function(){return h(m,this,arguments)},some:function(v){return h(y,this,v?arguments:[g])},every:function(v){return h(k,this,v?arguments:[g])},walk:function(){this.map.apply(this,arguments).forEach(function(v,a){this[a]=v},this);return this},merge:function(){for(var c=this.clone(),a,i=0,j,l=arguments.length;i<l;i++){a=arguments[i];if(isArray(a)){for(j=0;j<a.length;j++)if(c.indexOf(a[j])==-1)c.push(a[j])}else if(c.indexOf(a)==-1)c.push(a)}return c},flatten:function(){var c=[];this.forEach(function(v){if(isArray(v))c=c.concat(v.flatten());else c.push(v)});return c},compact:function(){return this.without(null,this._$u)},uniq:function(){return[].merge(this)},includes:function(){for(var i=0,l=arguments.length;i<l;i++)if(this.indexOf(arguments[i])==-1)return false;return true},without:function(){var f=$A(arguments);return this.filter(function(v){return!f.includes(v)})},shuffle:function(){var s=this.clone(),j,x,i=s.length;for(;i;j=Math.random(i-1),x=s[--i],s[i]=s[j],s[j]=x);return s},sortBy:function(){var p=t(arguments,this);return this.map(function(b,a){return{item:b,value:p[0].call(p[1],b,a,this)}}).sort(function(c,d){return c.value>d.value?1:c.value<d.value?-1:0}).map('item')}});$alias(A,{include:'includes',all:'every',any:'some'})})(Array.prototype);String.include({empty:function(){return this==''},blank:function(){return/^\s*$/.test(this)},trim:String.prototype.trim||function(){var a=this.replace(/^\s\s*/,''),i=a.length;while(/\s/.test(a.charAt(--i)));return a.slice(0,i+1)},stripTags:function(){return this.replace(/<\/?[^>]+>/ig,'')},stripScripts:function(o){var a='',t=this.replace(/<script[^>]*>([\s\S]*?)<\/script>/img,function(m,s){a+=s+"\n";return ''});if(o===true)$eval(a);else if(isFunction(o))o(a,t);return t},extractScripts:function(){var s='';this.stripScripts(function(a){s=a});return s},evalScripts:function(){this.stripScripts(true);return this},camelize:function(){var p=this.match(/^(\-|_)+?/g)||'';return p+this.substr(p.length,this.length).replace(/(\-|_)+?(\D)/g,function(m){return m.replace(/\-|_/,'').toUpperCase()})},underscored:function(){return this.replace(/([a-z0-9])([A-Z]+)/g,function(m,f,s){return f+"_"+(s.length>1?s:s.toLowerCase())}).replace(/\-/g,'_')},capitalize:function(){return this.replace(/(^|\s|\-|_)[a-z\u00e0-\u00fe\u0430-\u045f]/g,function(m){return m.toUpperCase()})},includes:function(s){return this.indexOf(s)!=-1},startsWith:function(a,i){var s=this.substr(0,a.length);return i?s.toLowerCase()===a.toLowerCase():s===a},endsWith:function(s,i){var e=this.substring(this.length-s.length);return i?e.toLowerCase()===s.toLowerCase():e===s},toInt:function(b){return parseInt(this,b||10)},toFloat:function(s){return parseFloat(s?this:this.replace(',','.').replace(/(\d)-(\d)/g,'$1.$2'))}});$alias(String.prototype,{include:'includes'});Function.include({bind:function(){var a=$A(arguments),s=a.shift(),f=this;return function(){return f.apply(s,(a.length||arguments.length)?a.concat($A(arguments)):a)}},bindAsEventListener:function(){var a=$A(arguments),s=a.shift(),f=this;return function(e){return f.apply(s,[e||window.event].concat(a).concat($A(arguments)))}},curry:function(){return this.bind.apply(this,[this].concat($A(arguments)))},rcurry:function(){var c=$A(arguments),f=this;return function(){return f.apply(f,$A(arguments).concat(c))}},delay:function(){var a=$A(arguments),t=a.shift(),b=new Number(window.setTimeout(this.bind.apply(this,[this].concat(a)),t));b.cancel=function(){window.clearTimeout(this)};return b},periodical:function(){var a=$A(arguments),t=a.shift(),b=new Number(window.setInterval(this.bind.apply(this,[this].concat(a)),t));b.stop=function(){window.clearInterval(this)};return b},chain:function(){var a=$A(arguments),f=a.shift(),c=this;return function(){var r=c.apply(c,arguments);f.apply(f,a);return r}}});Number.include({times:function(c,s){for(var i=0;i<this;i++)c.call(s,i);return this},upto:function(n,c,s){for(var i=this+0;i<=n;i++)c.call(s,i);return this},downto:function(n,c,s){for(var i=this+0;i>=n;i--)c.call(s,i);return this},abs:function(){return Math.abs(this)},round:function(b){if(b){var b=Math.pow(10,b);return Math.round(this*b)/b}else return Math.round(this)},ceil:function(){return Math.ceil(this)},floor:function(){return Math.floor(this)}});RegExp.escape=function(s){return(''+s).replace(/([.*+?^=!:${}()|[\]\/\\])/g,'\\$1')};var Class=function(){var a=$A(arguments),b=a.pop()||{},p=a.pop();function k(){return this.initialize?this.initialize.apply(this,arguments):this};if(!a.length&&!isHash(b)){p=b;b={}}$ext(k,Class.Methods).inherit(p);$w('extend include').each(function(n){if(b[n]){var m=b[n];k[n].apply(k,isArray(m)?m:[m]);delete(b[n])}});return k.include(b)};Class.findSet=function(o,p){var u=p.toUpperCase(),b=p.capitalize(),c=[o,o.constructor].concat(o.constructor.ancestors),h=c.first(function(a){return a&&(a[u]||a[b])});return h?h[u]||h[b]:null};Class.Methods=(function(){var f=$w('selfExtended self_extended selfIncluded self_included'),g=f.concat($w('prototype parent extend include')),i=f.concat(['constructor']);function e(m,w){return Object.without.apply(Object,[m].concat(w=='e'?g:i))};return{inherit:function(p){if(p&&p.prototype){var s=function(){};s.prototype=p.prototype;this.prototype=new s;this.parent=p}this.ancestors=[];while(p){this.ancestors.push(p);p=p.parent}return this.prototype.constructor=this},extend:function(){$A(arguments).filter(isHash).each(function(m){var c=m.selfExtended||m.self_extended;$ext(this,e(m,'e'));if(c)c.call(m,this)},this);return this},include:function(){var d=this.ancestors.map('prototype'),b;$A(arguments).filter(isHash).each(function(a){var c=a.selfIncluded||a.self_included;a=e(a,'i');for(var k in a){b=d.first(function(p){return isFunction(p[k])});this.prototype[k]=!b?a[k]:(function(n,m,s){return function(){this.$super=s;return m.apply(this,arguments)}})(k,a[k],b[k])}if(c)c.call(a,this)},this);return this}}})();Options={setOptions:function(o){var o=this.options=Object.merge(Class.findSet(this,'options'),o),m,k;if(isFunction(this.on))for(k in o)if(m=k.match(/on([A-Z][A-Za-z]+)/)){this.on(m[1].toLowerCase(),o[k]);delete(o[k])}return this},cutOptions:function(a){var a=$A(a);this.setOptions(isHash(a.last())?a.pop():{});return a}};Observer=new Class({include:Options,initialize:function(o){this.setOptions(o);Observer.createShortcuts(this,Class.findSet(this,'events'))},on:function(){var a=$A(arguments),e=a.shift();if(isString(e)){if(!defined(this.$listeners))this.$listeners=[];var c=a.shift(),n;switch(typeof(c)){case "string":n=c;c=this[c];case "function":var h={};h.e=e;h.f=c;h.a=a;h.r=n;this.$listeners.push(h);break;default:if(isArray(c))for(var i=0;i<c.length;i++)this.on.apply(this,[e].concat(isArray(c[i])?c[i]:[c[i]]).concat(a))}}else for(var n in e)this.on.apply(this,[n].concat(isArray(e[n])?e[n]:[e[n]]).concat(a));return this},observes:function(e,c){if(!isString(e)){c=e;e=null}if(isString(c))c=this[c];return(this.$listeners||[]).some(function(a){return(e&&c)?a.e===e&&a.f===c:e?a.e===e:a.f===c})},stopObserving:function(e,c){if(isHash(e))for(var k in e)this.stopObserving(k,e[k]);else{if(!isString(e)){c=e;e=null}if(isString(c))c=this[c];this.$listeners=(this.$listeners||[]).filter(function(a){return(e&&c)?(a.e!==e||a.f!==c):(e?a.e!==e:a.f!==c)},this)}return this},listeners:function(e){return(this.$listeners||[]).filter(function(a){return!e||a.e===e}).map(function(a){return a.f}).uniq()},fire:function(){var b=$A(arguments),e=b.shift();(this.$listeners||[]).each(function(a){if(a.e===e)a.f.apply(this,a.a.concat(b))},this);return this},extend:{create:function(o,e){$ext(o,Object.without(this.prototype,'initialize','setOptions'),true);return this.createShortcuts(o,e||Class.findSet(o,'events'))},createShortcuts:function(o,a){(a||[]).each(function(n){var m='on'+n.replace(/:/g,'_').camelize().capitalize();if(!defined(o[m]))o[m]=function(){return this.on.apply(this,[n].concat($A(arguments)))}});return o}}});$alias(Observer.prototype,{observe:'on'});Break=new Class(Error,{message:"Manual iterator break"});Browser=(function(a){return{IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,WebKit:a.indexOf('AppleWebKit/')>-1,Gecko:a.indexOf('Gecko')>-1&&a.indexOf('KHTML')<0,MobileSafari:!!a.match(/Apple.*Mobile.*Safari/),Konqueror:a.indexOf('Konqueror')>-1,OLD:!!(window.attachEvent&&!window.opera)&&!document.querySelector}})(navigator.userAgent);Event=new Class(window.Event,{extend:{ext:function(e,b){if(!e.stop)$ext(e,this.Methods,true);if(!e.target&&e.srcElement){e.which=e.button==2?3:e.button==4?2:1;var s=window.scrolls();e.pageX=e.clientX+s.x;e.pageY=e.clientY+s.y;e.target=$(e.srcElement)||b;e.relatedTarget=e.target===e.fromElement?$(e.toElement):e.target;e.currentTarget=b;e.eventPhase=3}if(e.target&&e.target.nodeType==3)e.target=e.target.parentNode;return e},cleanName:function(n){n=n.toLowerCase();n=n.substr(0,2)==='on'?n.slice(2):n;n=n==='rightclick'?'contextmenu':n;return n},realName:function(n){if(Browser.Gecko&&n==='mousewheel')n='DOMMouseScroll';if(Browser.Konqueror&&n==='contextmenu')n='rightclick';return n},Methods:{}},initialize:function(n,o){return new Event.Custom(Event.cleanName(n),o)}});Event.include=function(m){$ext(this.Methods,m);try{$ext(Event.parent.prototype,m,true)}catch(e){}};Event.include({stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},stop:function(){this.stopPropagation();this.preventDefault();return this},position:function(){return{x:this.pageX,y:this.pageY}}});Event.Custom=function(n,o){this.type=n;this.stop=function(){};$ext(this,o||{})};Event.extend({delegate:function(o){return function(e){var t=e.target,b,a,c;for(b in o)if($(this).select(b).include(t)){a=o[b];a=isArray(a)?a:[a];c=a[0];a=a.slice(1);if(isString(c))t[c].apply(t,a);else c.apply(t,[e].concat(a))}}},behave:function(d,o){var h={},k={},b=$A(arguments).slice(1),i='focus',c='blur',j=[i,c];if(isString(o)){k[b.shift()]=b;o=k}for(var g in o){var k={};k[d]=o[g];if(Browser.IE){if(g==i)g=i+'in';if(g==c)g=i+'out'}h[g]=Event.delegate(k);if(j.include(g)&&!Browser.IE){document.addEventListener(g,h[g],true);(document.$listeners=document.$listeners||[]).push({e:g,f:h[g],a:[]})}else document.on(g,h[g])}return h}});String.include({on:function(){Event.behave.apply(Event,[''+this].concat($A(arguments)));return this}});$alias(String.prototype,{behave:'on'});Element=(function(a){var b={id:['id',0],html:['innerHTML',0],'class':['className',0],style:['setStyle',1],observe:['on',1],on:['on',1]};function n(t,o){var e=document.createElement(t);if(o)for(var k in o){if(b[k]){if(b[k][1])e[b[k][0]](o[k]);else e[b[k][0]]=o[k]}else e.set(k,o[k])}return e};if(Browser.IE)n=eval('['+n.toString().replace(/(\((\w+),\s*(\w+)\)\s*\{)/,'$1if($2==="input"&&$3)$2="<input name="+$3.name+" type="+$3.type+($3.checked?" checked":"")+"/>";')+']')[0];if(a){$ext(n,a);n.parent=a}return n})(window.Element);$ext(Element,{include:function(m,d){$ext(this.Methods,m,d);try{$ext((window.HTMLElement||this.parent).prototype,m,d)}catch(e){}return this},Methods:{}});Element.include({parent:function(c){return c?this.parents(c)[0]:$(this.parentNode)},parents:function(c){return this.rCollect('parentNode',c)},subNodes:function(c){return this.select(c).filter(function(e){return e.parentNode===this},this)},siblings:function(c){return this.prevSiblings(c).reverse().concat(this.nextSiblings(c))},nextSiblings:function(c){return this.rCollect('nextSibling',c)},prevSiblings:function(c){return this.rCollect('previousSibling',c)},next:function(c){return this.nextSiblings(c)[0]},prev:function(c){return this.prevSiblings(c)[0]},remove:function(){if(this.parentNode)this.parentNode.removeChild(this);return this},insert:function(c,p){if(isHash(c))for(var p in c)this.insert(c[p],p);else{var s,i=Element.insertions;p=isString(p)?p.toLowerCase():'bottom';if(isString(c)||isNumber(c))c=(''+c).stripScripts(function(a){s=a});i[p](this,c.tagName?c:i.createFragment.call((p==='bottom'||p==='top'||!this.parentNode)?this:this.parentNode,c));if(s)$eval(s)}return this},insertTo:function(e,p){$(e).insert(this,p);return this},replace:function(c){return this.insert(c,'instead')},update:function(c){if((isString(c)||isNumber(c))&&!Element.insertions.wraps[this.tagName]){var s;this.innerHTML=(''+c).stripScripts(function(a){s=a});if(s)$eval(s)}else this.clean().insert(c);return this},wrap:function(e){if(this.parentNode){this.parentNode.replaceChild(e,this);e.appendChild(this)}return this},clean:function(){while(this.firstChild)this.removeChild(this.firstChild);return this},empty:function(){return this.innerHTML.blank()},rCollect:function(a,c){var n=this,r=[];while((n=n[a]))if(n.tagName&&(!c||$(n).match(c)))r.push(n);return r}});Element.insertions={bottom:function(t,c){t.appendChild(c)},top:function(t,c){t.firstChild?t.insertBefore(c,t.firstChild):t.appendChild(c)},after:function(t,c){var p=t.parentNode,s=t.nextSibling;if(p)s?p.insertBefore(c,s):p.appendChild(c)},before:function(t,c){if(t.parentNode)t.parentNode.insertBefore(c,t)},instead:function(t,c){if(t.parentNode)t.parentNode.replaceChild(c,t)},createFragment:function(c){var f;if(isString(c)){var t=document.createElement('div'),w=Element.insertions.wraps[this.tagName]||['','',0],d=w[2];t.innerHTML=w[0]+c+w[1];while(d>0){t=t.firstChild;d--}f=arguments.callee.call(this,t.childNodes)}else{f=document.createDocumentFragment();if(isNode(c))f.appendChild(c);else if(c&&c.length)for(var i=0,l=c.length;i<l;i++)f.appendChild(c[c.length==l?i:0])}return f},wraps:{TABLE:['<table>','</table>',1],TBODY:['<table><tbody>','</tbody></table>',2],TR:['<table><tbody><tr>','</tr></tbody></table>',3],TD:['<table><tbody><tr><td>','</td></tr></tbody></table>',4],SELECT:['<select>','</select>',1]}};$alias(Element.insertions.wraps,{THEAD:'TBODY',TFOOT:'TBODY',TH:'TD'});Element.include({setStyle:function(h,v){var k,c,s={};if(v){s[h]=v;h=s}else if(isString(h)){h.split(';').each(function(o){var e=o.split(':').map('trim');if(e[0]&&e[1])s[e[0]]=e[1]});h=s}for(k in h){c=k.indexOf('-')!=-1?k.camelize():k;if(k==='opacity'){if(Browser.IE)this.style.filter='alpha(opacity='+h[k]*100+')';else this.style.opacity=h[k]}else if(k==='float')c=Browser.IE?'styleFloat':'cssFloat';this.style[c]=h[k]}return this},getStyle:function(k){return this._getStyle(this.style,k)||this._getStyle(this.computedStyles(),k)},computedStyles:function(){return this.currentStyle||this.runtimeStyle||this.ownerDocument.defaultView.getComputedStyle(this,null)||{}},_getStyle:function(s,k){var v,k=k.camelize();switch(k){case 'opacity':v=!Browser.IE?s[k]:((/opacity=(\d+)/i.exec(s.filter||'')||['','100'])[1].toInt()/100)+'';break;case 'float':k=Browser.IE?'styleFloat':'cssFloat';default:v=s[k];if(Browser.Opera&&/color/i.test(k)&&v)v=v.replace(/"/g,'')}return v?v:null},hasClass:function(n){return(' '+this.className+' ').indexOf(' '+n+' ')!=-1},setClass:function(c){this.className=c;return this},addClass:function(n){var t=' '+this.className+' ';if(t.indexOf(' '+n+' ')==-1)this.className+=(t===' '?'':' ')+n;return this},removeClass:function(n){this.className=(' '+this.className+' ').replace(' '+n+' ',' ').trim();return this},toggleClass:function(n){return this[this.hasClass(n)?'removeClass':'addClass'](n)},radioClass:function(n){this.siblings().each('removeClass',n);return this.addClass(n)}});Element.include({set:function(h,a){if(typeof(h)==='string'){var v={};v[h]=a;h=v}for(var k in h){if(typeof(this[k])==='undefined')this.setAttribute(k,''+h[k]);this[k]=h[k]}return this},get:function(n){var v=this[n]||this.getAttribute(n);return v===''?null:v},has:function(n){return this.get(n)!==null},erase:function(n){this.removeAttribute(n);return this},hidden:function(){return this.getStyle('display')=='none'},visible:function(){return!this.hidden()},hide:function(e,o){this._$pd=this.getStyle('display');this.style.display='none';return this},show:function(e,o){if(this.getStyle('display')=='none'){var v=this.tagName=='DIV'?'block':'inline';this.style.display=this._$pd=='none'?v:this._$pd||v}return this},toggle:function(e,o){return this[this.hidden()?'show':'hide'](e,o)},radio:function(e,o){this.siblings().each('hide',e,o);return this.show()}});Element.include({sizes:function(){return{x:this.offsetWidth,y:this.offsetHeight}},position:function(){var r=this.getBoundingClientRect(),d=this.ownerDocument.documentElement,s=window.scrolls();return{x:r.left+s.x-d.clientLeft,y:r.top+s.y-d.clientTop}},scrolls:function(){return{x:this.scrollLeft,y:this.scrollTop}},dimensions:function(){var a=this.sizes();var s=this.scrolls();var p=this.position();return{top:p.y,left:p.x,width:a.x,height:a.y,scrollLeft:s.x,scrollTop:s.y}},setWidth:function(w){var s=this.style,p='offsetWidth';s.width=w+'px';s.width=(2*w-this[p])+'px';return this},setHeight:function(h){var s=this.style,p='offsetHeight';s.height=h+'px';s.height=(2*h-this[p])+'px';return this},resize:function(w,h){if(isHash(w)){h=w.y;w=w.x}return this.setWidth(w).setHeight(h)},moveTo:function(l,t){if(isHash(l)){t=l.y;l=l.x}return this.setStyle({left:l+'px',top:t+'px'})},scrollTo:function(l,t){if(isHash(l)){t=l.y;l=l.x}this.scrollLeft=l;this.scrollTop=t;return this},scrollThere:function(o){window.scrollTo(this,o);return this}});Element.include((function(){var o=Observer.create({},$w('click rightclick contextmenu mousedown mouseup mouseover mouseout mousemove keypress keydown keyup'));function h(n,r,t){o[n]=eval('['+o[n].toString().replace(r,t)+']')[0]};h('on',/(\$listeners\.push\((\w+?)\);)/,'$1$2.e=Event.cleanName($2.e);$2.n=Event.realName($2.e);$2.w=function(){var a=$A(arguments),e=($2.r&&$2.r!=="stopEvent")?a.shift():Event.ext(a[0],this);return $2.f.apply(this,a.concat($2.a))};'+(window.attachEvent?'$2.w=$2.w.bind(this);this.attachEvent("on"+$2.n,$2.w);':'this.addEventListener($2.n,$2.w,false);'));o.observe=o.on;h('stopObserving',/(function\s*\((\w+)\)\s*\{\s*)(return\s*)([^}]+)/m,'$1var r=$4;if(!r)'+(window.attachEvent?'this.detachEvent("on"+$2.n,$2.w);':'this.removeEventListener($2.n,$2.w,false);')+'$3 r');h('fire',/(\w+)\.f\.apply.*?\.concat\((\w+)\)\)/,'$1.f.apply(this,(($1.r&&$1.r!=="stopEvent")?[]:[new Event($1.e,$2.shift())]).concat($1.a).concat($2))');o.stopEvent=function(a){a.stop()};$ext(window,o);$ext(document,o);Observer.createShortcuts(window,$w('blur focus scroll'));return o})());Element.include((function(){function s(c,t){return c?c.replace(/(^|,)/g,'$1'+t+' '):'*'};return{first:function(c){return this.querySelector(s(c,this.tagName))},select:function(c){return $A(this.querySelectorAll(s(c,this.tagName)))},match:function(c){var r,p=this.tagName==='HTML'?this.ownerDocument:this.parents().last();r=$(p||$E('p').insert(this)).select(c).include(this);if(!p)this.remove();return r}}})());$ext(document,{first:function(c){return this.querySelector(c)},select:function(c){return $A(this.querySelectorAll(c))}});$ext(window,(function(){var n=window.scrollTo;return{sizes:function(){var d=document.documentElement;return this.innerWidth?{x:this.innerWidth,y:this.innerHeight}:{x:d.clientWidth,y:d.clientHeight}},scrolls:function(){var b=this.document.body,d=this.document.documentElement,o='pageXOffset',a='pageYOffset',s='scrollLeft',c='scrollTop';return(this[o]||this[a])?{x:this[o],y:this[a]}:(b[s]||b[c])?{x:b[s],y:b[c]}:{x:d[s],y:d[c]}},scrollTo:function(l,t,f){var a=l,b=t;if(isElement(l)||(isString(l)&&$(l)))l=$(l).position();if(isHash(l)){b=l.y;a=l.x}if(isHash(f=f||t)&&window.Fx)new Fx.Scroll(this,f).start({x:a,y:b});else n(a,b);return this}}})());[window,document].each(function(o){Observer.createShortcuts(o,['ready']);var r=o.fire.bind(o,'ready');if(typeof(document.readyState)!=='undefined')(function(){['loaded','complete'].includes(document.readyState)?r():arguments.callee.delay(50)})();else document.addEventListener('DOMContentLoaded',r,false)});function Form(o){var o=o||{},r=o.remote,f=new Element('form',Object.without(o,'remote'));if(r)f.remotize();return f};$ext(Form,{ext:function(e){return $ext(e,this.Methods)},Methods:{},include:function(m,d){$ext(Form.Methods,m,d);try{$ext(HTMLFormElement.prototype,m,d)}catch(e){}}});Form.include({getElements:function(){return $A(this.elements).map($)},inputs:function(){return this.getElements().filter(function(i){return!['submit','button','reset','image',null].includes(i.type)})},focus:function(){var f=this.inputs().first(function(i){return i.type!='hidden'});if(f)f.focus();return this.fire('focus')},blur:function(){this.getElements().each('blur');return this.fire('blur')},disable:function(){this.getElements().each('disable');return this.fire('disable')},enable:function(){this.getElements().each('enable');return this.fire('enable')},values:function(){var v={};this.inputs().each(function(i){if(!i.disabled&&i.name&&(!['checkbox','radio'].includes(i.type)||i.checked))v[i.name]=i.getValue()});return v},serialize:function(){return Object.toQueryString(this.values())}});Form.include(Observer.createShortcuts({},$w('submit reset focus')),true);(function(){try{var i=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLButtonElement]}catch(e){var i=[]}Form.Element={ext:function(e){e._blur=e.blur;e._focus=e.focus;e._select=e.select;return $ext(e,this.Methods)},Methods:{},include:function(m,d){$ext(this.Methods,m,d);i.each(function(k){$ext(k.prototype,m,d)})}};i.each(function(k){$alias(k.prototype,{_blur:'blur',_focus:'focus',_select:'select'})})})();Form.Element.include({getValue:function(){if(this.type=='select-multiple')return $A(this.getElementsByTagName('option')).map(function(o){return o.selected?o.value:null}).compact();else return this.value},setValue:function(v){if(this.type=='select-multiple'){v=$A(isArray(v)?v:[v]).map(String);$A(this.getElementsByTagName('option')).each(function(o){o.selected=v.includes(o.value)})}else this.value=v;return this},disable:function(){this.disabled=true;this.fire('disable');return this},enable:function(){this.disabled=false;this.fire('enable');return this},focus:function(){Browser.OLD?this._focus():this._focus.call(this);this.focused=true;this.fire('focus');return this},select:function(){this.focus();Browser.OLD?this._select():this._select.call(this);return this},blur:function(){Browser.OLD?this._blur():this._blur.call(this);this.focused=false;this.fire('blur');return this}});Form.Element.include(Observer.createShortcuts({},$w('disable enable focus blur change')),true);Cookie=new Class({include:Options,extend:{set:function(n,v,o){return new this(n,o).set(v)},get:function(n){return new this(n).get()},remove:function(n){return new this(n).remove()},enabled:function(){document.cookie="__t=1";return document.cookie.indexOf("__t=1")!=-1},Options:{secure:false,document:document}},initialize:function(n,o){this.name=n;this.setOptions(o)},set:function(v){var v=encodeURIComponent(v),o=this.options;if(o.domain)v+='; domain='+o.domain;if(o.path)v+='; path='+o.path;if(o.duration){var d=new Date();d.setTime(d.getTime()+o.duration*24*60*60*1000);v+='; expires='+d.toGMTString()}if(o.secure)v+='; secure';o.document.cookie=this.name+'='+v;return this},get:function(){var v=this.options.document.cookie.match('(?:^|;)\\s*'+RegExp.escape(this.name)+'=([^;]*)');return(v)?decodeURIComponent(v[1]):null},remove:function(){this.options.duration=-1;return this.set('')}});Xhr=new Class(Observer,{extend:{EVENTS:$w('success failure complete request cancel create'),Options:{headers:{'X-Requested-With':'XMLHttpRequest','Accept':'text/javascript,text/html,application/xml,text/xml,*/*'},method:'post',encoding:'utf-8',async:true,evalScripts:false,evalResponse:false,evalJSON:true,secureJSON:true,urlEncoded:true,spinner:null,spinnerFx:'fade',params:null,iframed:false},load:function(u,o){return new this(u,Object.merge({method:'get'},o)).send()}},initialize:function(u,o){this.initCallbacks();this.url=u;this.$super(o);for(var k in Xhr.Options)this[k]=this.options[k];this.initSpinner()},setHeader:function(n,v){this.headers[n]=v;return this},getHeader:function(n){try{return this.xhr.getResponseHeader(n)}catch(e){}},successful:function(){return(this.status>=200)&&(this.status<300)},send:function(p){var a={},u=this.url,m=this.method.toLowerCase(),k;if(m=='put'||m=='delete'){a['_method']=m;m='post'}var d=this.prepareData(this.params,this.prepareParams(p),a);if(this.urlEncoded&&m=='post'&&!this.headers['Content-type'])this.setHeader('Content-type','application/x-www-form-urlencoded;charset='+this.encoding);if(m=='get'){if(d)u+=(u.includes('?')?'&':'?')+d;d=null}this.xhr=this.createXhr();this.fire('create');this.xhr.open(m,u,this.async);this.xhr.onreadystatechange=this.stateChanged.bind(this);for(k in this.headers)this.xhr.setRequestHeader(k,this.headers[k]);this.xhr.send(d);this.fire('request');if(!this.async)this.stateChanged();return this},update:function(e,p){return this.onSuccess(function(a){e.update(a.text)}).send(p)},cancel:function(){if(!this.xhr||this.xhr.canceled)return this;this.xhr.abort();this.xhr.onreadystatechange=function(){};this.xhr.canceled=true;return this.fire('cancel')},fire:function(n){return this.$super(n,this,this.xhr)},createXhr:function(){if(this.form&&this.form.getElements().map('type').includes('file'))return new Xhr.IFramed(this.form);else try{return new XMLHttpRequest()}catch(e){return new ActiveXObject('MSXML2.XMLHTTP')}},prepareParams:function(p){if(p&&p.tagName=='FORM'){this.form=p;p=p.values()}return p},prepareData:function(){return $A(arguments).map(function(p){if(!isString(p))p=Object.toQueryString(p);return p.blank()?null:p}).compact().join('&')},stateChanged:function(){if(this.xhr.readyState!=4||this.xhr.canceled)return;try{this.status=this.xhr.status}catch(e){this.status=0}this.text=this.responseText=this.xhr.responseText;this.xml=this.responseXML=this.xhr.responseXML;this.fire('complete').fire(this.successful()?'success':'failure')},tryScripts:function(r){if(this.evalResponse||(/(ecma|java)script/).test(this.getHeader('Content-type')))$eval(this.text);else if((/json/).test(this.getHeader('Content-type'))&&this.evalJSON)this.json=this.responseJSON=this.sanitizedJSON();else if(this.evalScripts)this.text.evalScripts()},sanitizedJSON:function(){try{return JSON.parse(this.text)}catch(e){if(window.JSON||!(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(this.text.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"/g,''))){if(this.secureJSON)throw "JSON parse error: "+this.text;else return null}}return eval("("+this.text+")")},initCallbacks:function(){this.on({success:'tryScripts',create:'showSpinner',complete:'hideSpinner',cancel:'hideSpinner'});Xhr.EVENTS.each(function(n){this.on(n,function(){Xhr.fire(n,this,this.xhr)})},this)},initSpinner:function(){if(this.spinner)this.spinner=$(this.spinner);if(Xhr.Options.spinner&&this.spinner===$(Xhr.Options.spinner))this.spinner=null},showSpinner:function(){if(this.spinner)this.spinner.show(this.spinnerFx,{duration:100})},hideSpinner:function(){if(this.spinner)this.spinner.hide(this.spinnerFx,{duration:100})}});Observer.create(Xhr);$ext(Xhr,{counter:0,showSpinner:function(){if(this.Options.spinner)$(this.Options.spinner).show(this.Options.spinnerFx,{duration:100})},hideSpinner:function(){if(this.Options.spinner)$(this.Options.spinner).hide(this.Options.spinnerFx,{duration:100})}});Xhr.onCreate(function(){this.counter++;this.showSpinner()}).onComplete(function(){this.counter--;if(this.counter<1)this.hideSpinner()}).onCancel(function(){this.counter--;if(this.counter<1)this.hideSpinner()});Form.include({send:function(o){o=o||{};o['method']=o['method']||this.method||'post';new Xhr(this.get('action')||document.location.href,o).onRequest(this.disable.bind(this)).onComplete(this.enable.bind(this)).send(this);return this},remotize:function(o){this.onsubmit=function(){this.send.bind(this,Object.merge({spinner:this.first('.spinner')},o)).delay(20);return false};this.remote=true;return this},unremotize:function(){this.onsubmit=function(){};this.remote=false;return this}});Element.include({load:function(u,o){new Xhr(u,Object.merge({method:'get'},o)).update(this);return this}});Xhr.IFramed=new Class({initialize:function(f){this.form=f;var i='xhr_frame_'+Math.random().toString().split('.').last();$E('div').insertTo(document.body).update('<iframe name="'+i+'" id="'+i+'" width="0" height="0" frameborder="0" src="about:blank"></iframe>');this.iframe=$(i);this.iframe.on('load',this.onLoad.bind(this))},send:function(){var o=this.form.onsubmit,a=this.form.target;this.form.onsubmit=function(){};this.form.target=this.iframe.id;this.form.submit();this.form.onsubmit=o;this.form.target=a},onLoad:function(){this.status=200;this.readyState=4;try{this.responseText=window[this.iframe.id].document.documentElement.innerHTML}catch(e){}this.onreadystatechange()},open:function(){},abort:function(){},setRequestHeader:function(){},onreadystatechange:function(){}});Fx=new Class(Observer,{extend:{EVENTS:$w('start finish cancel'),Durations:{'short':200,'normal':400,'long':800},Options:{fps:Browser.IE?40:60,duration:'normal',transition:'Sin',queue:true},Transitions:{Sin:function(a){return-(Math.cos(Math.PI*a)-1)/2},Cos:function(a){return Math.asin((a-0.5)*2)/Math.PI+0.5},Exp:function(a){return Math.pow(2,8*(a-1))},Log:function(a){return 1-Math.pow(2,-8*a)},Lin:function(a){return a}},ch:[],cr:[]},initialize:function(e,o){this.$super(o);if(this.element=e=$(e)){var u=$uid(e);this.ch=(Fx.ch[u]=Fx.ch[u]||[]);this.cr=(Fx.cr[u]=Fx.cr[u]||[])}},start:function(){if(this.queue(arguments))return this;this.prepare.apply(this,arguments);var o=this.options,d=Fx.Durations[o.duration]||o.duration;this.transition=Fx.Transitions[o.transition]||o.transition;this.steps=(d/1000*this.options.fps).ceil();this.number=1;if(this.cr)this.cr.push(this);return this.fire('start',this).startTimer()},finish:function(){return this.stopTimer().unreg().fire('finish').next()},cancel:function(){this.ch.clean();return this.stopTimer().unreg().fire('cancel')},pause:function(){return this.stopTimer()},resume:function(){return this.startTimer()},prepare:function(v){},render:function(d){},step:function(t){if(t.number>t.steps)t.finish();else{if(!t.w){t.w=true;t.render(t.transition(t.number/t.steps));t.w=false}t.number++}},startTimer:function(){this.timer=this.step.periodical((1000/this.options.fps).round(),this);return this},stopTimer:function(){if(this.timer)this.timer.stop();return this},queue:function(a){var c=this.ch,q=this.options.queue;if(!c||this.$ch)return this.$ch=false;if(q)c.push([a,this]);return q&&c[0][1]!==this},next:function(){var c=this.ch,n=c.shift(),n=c[0];if(n){n[1].$ch=true;n[1].start.apply(n[1],n[0])}return this},unreg:function(){var c=this.cr;if(c)c.splice(c.indexOf(this),1);return this}});String.COLORS={maroon:'#800000',red:'#ff0000',orange:'#ffA500',yellow:'#ffff00',olive:'#808000',purple:'#800080',fuchsia:'#ff00ff',white:'#ffffff',lime:'#00ff00',green:'#008000',navy:'#000080',blue:'#0000ff',aqua:'#00ffff',teal:'#008080',black:'#000000',silver:'#c0c0c0',gray:'#808080',brown:'#a52a2a'};String.include({toHex:function(){var m=/^#(\w)(\w)(\w)$/.exec(this);if(m)m="#"+m[1]+m[1]+m[2]+m[2]+m[3]+m[3];else if(m=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/.exec(this))m="#"+m.slice(1).map(function(b){b=(b-0).toString(16);return b.length==1?'0'+b:b}).join('');else m=String.COLORS[this]||this;return m},toRgb:function(a){var m=/#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})/i.exec(this.toHex()||'');if(m){m=m.slice(1).map('toInt',16);m=a?m:'rgb('+m+')'}return m}});Fx.Morph=new Class(Fx,(function(){var C='Color',S='Style',W='Width',B='background',o='border',P='Position',h=B+C,t=$w('Top Left Right Bottom');function p(a,k,v){for(var i=0;i<v.length;i++)a.push(k+v[i])};function q(e,a){for(var i=0;i<4;i++){var f=t[i],c=o+f+S,d=o+f+W,b=o+f+C;if(e[c]!=a[c]){var s=this.element.style;if(e[c]=='none')s[d]='0px';s[c]=a[c];if(this._transp(e[b]))s[b]=this.element.getStyle(C)}}};function u(b){var a={},r=/[\d\.\-]+/g,m,k,v,i;for(k in b){m=b[k].match(r);v=m.map('toFloat');v.t=b[k].split(r);v.r=v.t[0]==='rgb(';if(v.t.length==1)v.t.unshift('');for(i=0;i<v.length;i++)v.t.splice(i*2+1,0,v[i]);a[k]=v}return a};return{prepare:function(s){var k=this._styleKeys(s),b=this._cloneStyle(this.element,k),a=this._endStyle(s,k);this._cleanStyles(b,a);this.before=u(b);this.after=u(a)},render:function(d){var b,a,v,s=this.element.style,k,i;for(k in this.after){b=this.before[k];a=this.after[k];for(i=0;i<a.length;i++){v=b[i]+(a[i]-b[i])*d;if(a.r)v=Math.round(v);a.t[i*2+1]=v}s[k]=a.t.join('')}},_endStyle:function(s,k){var d=$(this.element.cloneNode(true)).setStyle('position:absolute;z-index:-1;visibility:hidden').insertTo(this.element,'before').setWidth(this.element.sizes().x).setStyle(s),a=this._cloneStyle(d,k);d.remove();return a},_cloneStyle:function(e,k){for(var i=0,l=k.length,s=e.computedStyles(),c={};i<l;i++)c[k[i]]=s[k[i]];return c},_styleKeys:function(s){var a=[],b=[S,C,W],k,i,j;for(k in s){if(k.startsWith(o))for(i=0;i<b.length;i++)for(j=0;j<t.length;j++)a.push(o+t[j]+b[i]);else if(k=='margin'||k=='padding')p(a,k,t);else if(k.startsWith(B))p(a,B,[C,P,P+'X',P+'Y']);else if(k=='opacity'&&Browser.IE)a.push('filter');else a.push(k)}return a},_cleanStyles:function(b,a){var r=[],k;for(k in a)if((k=='width'||k=='height')&&b[k]=='auto')b[k]=this.element['offset'+k.capitalize()]+'px';if(a.filter&&!b.filter)b.filter='alpha(opacity=100)';q.call(this,b,a);for(k in a){if(a[k]!==b[k]&&!r.includes(k)&&/color/i.test(k)){if(Browser.Opera){a[k]=a[k].replace(/"/g,'');b[k]=b[k].replace(/"/g,'')}if(!this._transp(a[k]))a[k]=a[k].toRgb();if(!this._transp(b[k]))b[k]=b[k].toRgb();if(!a[k]||!b[k])a[k]=b[k]=''}if(/\d/.test(a[k])&&!/\d/.test(b[k]))b[k]=a[k].replace(/[\d\.\-]+/g,'0');if(a[k]===b[k]||r.includes(k)||!/\d/.test(b[k])||!/\d/.test(a[k])){delete(a[k]);delete(b[k])}}},_getBGColor:function(e){return[e].concat(e.parents()).map(function(n){var b=n.getStyle(h);return(b&&!this._transp(b))?b:null},this).compact().first()||'#FFF'},_transp:function(c){return c==='transparent'||c==='rgba(0, 0, 0, 0)'}}})());Fx.Highlight=new Class(Fx.Morph,{extend:{Options:Object.merge(Fx.Options,{color:'#FF8',transition:'Exp'})},prepare:function(s,e){var a=e||this.element.getStyle('backgroundColor');if(this._transp(a)){this.onFinish(function(){this.element.style.backgroundColor='transparent'});a=this._getBGColor(this.element)}this.element.style.backgroundColor=(s||this.options.color);return this.$super({backgroundColor:a})}});Fx.Twin=new Class(Fx.Morph,{finish:function(){if(this.how=='out')this.element.hide();return this.$super()},setHow:function(h){this.how=h||'toggle';if(this.how=='toggle')this.how=this.element.visible()?'out':'in'}});Fx.Slide=new Class(Fx.Twin,{extend:{Options:Object.merge(Fx.Options,{direction:'top'})},prepare:function(h){this.setHow(h);var e=this.element;e.show();this.sizes=e.sizes();this.styles={};$w('overflow height width marginTop marginLeft').each(function(k){this.styles[k]=e.style[k]},this);e.style.overflow='hidden';this.onFinish('_getBack').onCancel('_getBack');return this.$super(this._getStyle(this.options.direction))},_getBack:function(){this.element.setStyle(this.styles)},_getStyle:function(d){var f={},s=this.sizes,m='marginLeft',a='marginTop',b=this.styles[m].toFloat()||0,c=this.styles[a].toFloat()||0;if(this.how=='out'){f[['top','bottom'].includes(d)?'height':'width']='0px';if(d=='right')f[m]=b+s.x+'px';else if(d=='bottom')f[a]=c+s.y+'px'}else if(this.how=='in'){var e=this.element.style;if(['top','bottom'].includes(d)){f.height=s.y+'px';e.height='0px'}else{f.width=s.x+'px';e.width='0px'}if(d=='right'){f[m]=b+'px';e[m]=b+s.x+'px'}else if(d=='bottom'){f[a]=c+'px';e[a]=c+s.y+'px'}}return f}});Fx.Fade=new Class(Fx.Twin,{prepare:function(h){this.setHow(h);if(this.how=='in')this.element.setStyle({opacity:0}).show();return this.$super({opacity:isNumber(h)?h:this.how=='in'?1:0})}});Fx.Scroll=new Class(Fx,{initialize:function(e,o){this.$super(e.prompt?e.document[Browser.WebKit?'body':'documentElement']:e,o)},prepare:function(v){this.before={};this.after=v;if(defined(v.x))this.before.x=this.element.scrollLeft;if(defined(v.y))this.before.y=this.element.scrollTop},render:function(d){var b=this.before,k;for(k in b)this.element['scroll'+(k=='x'?'Left':'Top')]=b[k]+(this.after[k]-b[k])*d}});Element.include((function(m){var b=m.hide,d=m.show,c=m.scrollTo;return{stop:function(){(Fx.cr[$uid(this)]||[]).each('cancel');return this},hide:function(f,o){return f?this.fx(f,['out',o]):b.call(this)},show:function(f,o){return f?this.fx(f,['in',o]):d.call(this)},morph:function(s,o){return this.fx('morph',[s,o||{}])},highlight:function(){return this.fx('highlight',arguments)},fade:function(){return this.fx('fade',arguments)},slide:function(){return this.fx('slide',arguments)},scroll:function(v,o){return this.fx('scroll',[v,o||{}])},scrollTo:function(v,o){return isHash(o)?this.scroll(v,o):c.apply(this,arguments)},fx:function(n,a){var a=$A(a).compact(),o=isHash(a.last())?a.pop():{},f=new Fx[n.capitalize()](this,o);f.start.apply(f,a);return this}}})(Element.Methods));if(!document.querySelector)(function(){var r=/(^|\/)(right)([^\/]+)$/,c=$A(document.getElementsByTagName('script')).map('src').compact().first('match',r);if(c)document.write('<scr'+'ipt src="'+c.replace(r,'$1$2-olds$3')+'"></scr'+'ipt>')})();
data/webapp/public/rt.js DELETED
@@ -1,7 +0,0 @@
1
-
2
- var client = new Faye.Client('http://localhost:8000/faye');
3
-
4
- var subscription = client.subscribe('/stats', function(message) {
5
- // console.log(message);
6
- $('#stats').append("<div>" + message["data"] + "</div>");
7
- });
@@ -1,85 +0,0 @@
1
- /* jquery.sparkline 1.5.1 - http://omnipotent.net/jquery.sparkline/ */
2
-
3
- (function($){$.fn.simpledraw=function(width,height,use_existing){if(use_existing&&this[0].vcanvas)return this[0].vcanvas;if(width==undefined)width=$(this).innerWidth();if(height==undefined)height=$(this).innerHeight();if($.browser.hasCanvas){return new vcanvas_canvas(width,height,this);}else if($.browser.msie){return new vcanvas_vml(width,height,this);}else{return false;}};var pending=[];$.fn.sparkline=function(uservalues,options){var options=$.extend({type:'line',lineColor:'#00f',fillColor:'#cdf',defaultPixelsPerValue:3,width:'auto',height:'auto',composite:false},options?options:{});return this.each(function(){var render=function(){var values=(uservalues=='html'||uservalues==undefined)?$(this).text().split(','):uservalues;var width=options.width=='auto'?values.length*options.defaultPixelsPerValue:options.width;if(options.height=='auto'){if(!options.composite||!this.vcanvas){var tmp=document.createElement('span');tmp.innerHTML='a';$(this).html(tmp);height=$(tmp).innerHeight();$(tmp).remove();}}else{height=options.height;}
4
- $.fn.sparkline[options.type].call(this,values,options,width,height);}
5
- if(($(this).html()&&$(this).is(':hidden'))||($.fn.jquery<"1.3.0"&&$(this).parents().is(':hidden'))){pending.push([this,render]);}else{render.call(this);}});};$.sparkline_display_visible=function(){for(var i=pending.length-1;i>=0;i--){var el=pending[i][0];if($(el).is(':visible')&&!$(el).parents().is(':hidden')){pending[i][1].call(el);pending.splice(i,1);}}};$.fn.sparkline.line=function(values,options,width,height){var options=$.extend({spotColor:'#f80',spotRadius:1.5,minSpotColor:'#f80',maxSpotColor:'#f80',lineWidth:1,normalRangeMin:undefined,normalRangeMax:undefined,normalRangeColor:'#ccc',chartRangeMin:undefined,chartRangeMax:undefined,chartRangeMinX:undefined,chartRangeMaxX:undefined},options?options:{});var xvalues=[],yvalues=[],yminmax=[];for(i=0;i<values.length;i++){var v=values[i];var isstr=typeof(values[i])=='string';var isarray=typeof(values[i])=='object'&&values[i]instanceof Array;var sp=isstr&&values[i].split(':');if(isstr&&sp.length==2){xvalues.push(Number(sp[0]));yvalues.push(Number(sp[1]));yminmax.push(Number(sp[1]));}else if(isarray){xvalues.push(values[i][0]);yvalues.push(values[i][1]);yminmax.push(values[i][1]);}else{xvalues.push(i);if(values[i]===null||values[i]=='null'){yvalues.push(null);}else{yvalues.push(Number(values[i]));yminmax.push(Number(values[i]));}}}
6
- if(options.xvalues){xvalues=options.xvalues;}
7
- var maxy=Math.max.apply(Math,yminmax);var maxyval=maxy;var miny=Math.min.apply(Math,yminmax);var minyval=miny;var maxx=Math.max.apply(Math,xvalues);var maxxval=maxx;var minx=Math.min.apply(Math,xvalues);var minxval=minx;if(options.normalRangeMin!=undefined){if(options.normalRangeMin<miny)
8
- miny=options.normalRangeMin;if(options.normalRangeMax>maxy)
9
- maxy=options.normalRangeMax;}
10
- if(options.chartRangeMin!=undefined&&(options.chartRangeClip||options.chartRangeMin<miny)){miny=options.chartRangeMin;}
11
- if(options.chartRangeMax!=undefined&&(options.chartRangeClip||options.chartRangeMax>maxy)){maxy=options.chartRangeMax;}
12
- if(options.chartRangeMinX!=undefined&&(options.chartRangeClipX||options.chartRangeMinX<minx)){minx=options.chartRangeMinX;}
13
- if(options.chartRangeMaxX!=undefined&&(options.chartRangeClipX||options.chartRangeMaxX>maxx)){maxx=options.chartRangeMaxX;}
14
- var rangex=maxx-minx==0?1:maxx-minx;var rangey=maxy-miny==0?1:maxy-miny;var vl=yvalues.length-1;if(vl<1){this.innerHTML='';return;}
15
- var target=$(this).simpledraw(width,height,options.composite);if(target){var canvas_width=target.pixel_width;var canvas_height=target.pixel_height;var canvas_top=0;var canvas_left=0;if(options.spotRadius&&(canvas_width<(options.spotRadius*4)||canvas_height<(options.spotRadius*4))){options.spotRadius=0;}
16
- if(options.spotRadius){if(options.minSpotColor||(options.spotColor&&yvalues[vl]==miny))
17
- canvas_height-=Math.ceil(options.spotRadius);if(options.maxSpotColor||(options.spotColor&&yvalues[vl]==maxy)){canvas_height-=Math.ceil(options.spotRadius);canvas_top+=Math.ceil(options.spotRadius);}
18
- if(options.minSpotColor||options.maxSpotColor&&(yvalues[0]==miny||yvalues[0]==maxy)){canvas_left+=Math.ceil(options.spotRadius);canvas_width-=Math.ceil(options.spotRadius);}
19
- if(options.spotColor||(options.minSpotColor||options.maxSpotColor&&(yvalues[vl]==miny||yvalues[vl]==maxy)))
20
- canvas_width-=Math.ceil(options.spotRadius);}
21
- canvas_height--;if(options.normalRangeMin!=undefined){var ytop=canvas_top+Math.round(canvas_height-(canvas_height*((options.normalRangeMax-miny)/rangey)));var height=Math.round((canvas_height*(options.normalRangeMax-options.normalRangeMin))/rangey);target.drawRect(canvas_left,ytop,canvas_width,height,undefined,options.normalRangeColor);}
22
- var path=[];var paths=[path];for(var i=0,vlen=yvalues.length;i<vlen;i++){var x=xvalues[i],y=yvalues[i];if(y===null){if(i){if(yvalues[i-1]!==null){path=[];paths.push(path);}}}else{if(y<miny)y=miny;if(y>maxy)y=maxy;if(!path.length){path.push([canvas_left+Math.round((x-minx)*(canvas_width/rangex)),canvas_top+canvas_height]);}
23
- path.push([canvas_left+Math.round((x-minx)*(canvas_width/rangex)),canvas_top+Math.round(canvas_height-(canvas_height*((y-miny)/rangey)))]);}}
24
- for(var i=0,plen=paths.length;i<plen;i++){path=paths[i];if(!path.length)
25
- continue;if(options.fillColor){path.push([path[path.length-1][0],canvas_top+canvas_height-1]);target.drawShape(path,undefined,options.fillColor);path.pop();}
26
- if(path.length>2){path[0]=[path[0][0],path[1][1]];}
27
- target.drawShape(path,options.lineColor,undefined,options.lineWidth);}
28
- if(options.spotRadius&&options.spotColor){target.drawCircle(canvas_left+Math.round(xvalues[xvalues.length-1]*(canvas_width/rangex)),canvas_top+Math.round(canvas_height-(canvas_height*((yvalues[vl]-miny)/rangey))),options.spotRadius,undefined,options.spotColor);}
29
- if(maxy!=minyval){if(options.spotRadius&&options.minSpotColor){var x=xvalues[yvalues.indexOf(minyval)];target.drawCircle(canvas_left+Math.round((x-minx)*(canvas_width/rangex)),canvas_top+Math.round(canvas_height-(canvas_height*((minyval-miny)/rangey))),options.spotRadius,undefined,options.minSpotColor);}
30
- if(options.spotRadius&&options.maxSpotColor){var x=xvalues[yvalues.indexOf(maxyval)];target.drawCircle(canvas_left+Math.round((x-minx)*(canvas_width/rangex)),canvas_top+Math.round(canvas_height-(canvas_height*((maxyval-miny)/rangey))),options.spotRadius,undefined,options.maxSpotColor);}}}else{this.innerHTML='';}};$.fn.sparkline.bar=function(values,options,width,height){var options=$.extend({type:'bar',barColor:'#00f',negBarColor:'#f44',zeroColor:undefined,nullColor:undefined,zeroAxis:undefined,barWidth:4,barSpacing:1,chartRangeMax:undefined,chartRangeMin:undefined,chartRangeClip:false,colorMap:undefined},options?options:{});var width=(values.length*options.barWidth)+((values.length-1)*options.barSpacing);var num_values=[];for(var i=0,vlen=values.length;i<vlen;i++){if(values[i]=='null'||values[i]===null){values[i]=null;}else{values[i]=Number(values[i]);num_values.push(Number(values[i]));}}
31
- var max=Math.max.apply(Math,num_values);var min=Math.min.apply(Math,num_values);if(options.chartRangeMin!=undefined&&(options.chartRangeClip||options.chartRangeMin<min)){min=options.chartRangeMin;}
32
- if(options.chartRangeMax!=undefined&&(options.chartRangeClip||options.chartRangeMax>max)){max=options.chartRangeMax;}
33
- if(options.zeroAxis==undefined)options.zeroAxis=min<0;var range=max-min==0?1:max-min;if($.isArray(options.colorMap)){var colorMapByIndex=options.colorMap;var colorMapByValue=null;}else{var colorMapByIndex=null;var colorMapByValue=options.colorMap;}
34
- var target=$(this).simpledraw(width,height,options.composite);if(target){var canvas_width=target.pixel_width;var canvas_height=target.pixel_height;var yzero=min<0&&options.zeroAxis?canvas_height-Math.round(canvas_height*(Math.abs(min)/range))-1:canvas_height-1;for(var i=0,vlen=values.length;i<vlen;i++){var x=i*(options.barWidth+options.barSpacing);var val=values[i];if(val===null){if(options.nullColor){color=options.nullColor;val=(options.zeroAxis&&min<0)?0:min;var height=1;var y=(options.zeroAxis&&min<0)?yzero:canvas_height-height;}else{continue;}}else{if(val<min)val=min;if(val>max)val=max;var color=(val<0)?options.negBarColor:options.barColor;if(options.zeroAxis&&min<0){var height=Math.round(canvas_height*((Math.abs(val)/range)))+1;var y=(val<0)?yzero:yzero-height;}else{var height=Math.round(canvas_height*((val-min)/range))+1;var y=canvas_height-height;}
35
- if(val==0&&options.zeroColor!=undefined){color=options.zeroColor;}
36
- if(colorMapByValue&&colorMapByValue[val]){color=colorMapByValue[val];}else if(colorMapByIndex&&colorMapByIndex.length>i){color=colorMapByIndex[i];}
37
- if(color===null){continue;}}
38
- target.drawRect(x,y,options.barWidth-1,height-1,color,color);}}else{this.innerHTML='';}};$.fn.sparkline.tristate=function(values,options,width,height){values=$.map(values,Number);var options=$.extend({barWidth:4,barSpacing:1,posBarColor:'#6f6',negBarColor:'#f44',zeroBarColor:'#999',colorMap:{}},options);var width=(values.length*options.barWidth)+((values.length-1)*options.barSpacing);if($.isArray(options.colorMap)){var colorMapByIndex=options.colorMap;var colorMapByValue=null;}else{var colorMapByIndex=null;var colorMapByValue=options.colorMap;}
39
- var target=$(this).simpledraw(width,height,options.composite);if(target){var canvas_width=target.pixel_width;var canvas_height=target.pixel_height;var half_height=Math.round(canvas_height/2);for(var i=0,vlen=values.length;i<vlen;i++){var x=i*(options.barWidth+options.barSpacing);if(values[i]<0){var y=half_height;var height=half_height-1;var color=options.negBarColor;}else if(values[i]>0){var y=0;var height=half_height-1;var color=options.posBarColor;}else{var y=half_height-1;var height=2;var color=options.zeroBarColor;}
40
- if(colorMapByValue&&colorMapByValue[values[i]]){color=colorMapByValue[values[i]];}else if(colorMapByIndex&&colorMapByIndex.length>i){color=colorMapByIndex[i];}
41
- if(color===null){continue;}
42
- target.drawRect(x,y,options.barWidth-1,height-1,color,color);}}else{this.innerHTML='';}};$.fn.sparkline.discrete=function(values,options,width,height){values=$.map(values,Number);var options=$.extend({lineHeight:'auto',thresholdColor:undefined,thresholdValue:0,chartRangeMax:undefined,chartRangeMin:undefined,chartRangeClip:false},options);width=options.width=='auto'?values.length*2:width;var interval=Math.floor(width/values.length);var target=$(this).simpledraw(width,height,options.composite);if(target){var canvas_width=target.pixel_width;var canvas_height=target.pixel_height;var line_height=options.lineHeight=='auto'?Math.round(canvas_height*0.3):options.lineHeight;var pheight=canvas_height-line_height;var min=Math.min.apply(Math,values);var max=Math.max.apply(Math,values);if(options.chartRangeMin!=undefined&&(options.chartRangeClip||options.chartRangeMin<min)){min=options.chartRangeMin;}
43
- if(options.chartRangeMax!=undefined&&(options.chartRangeClip||options.chartRangeMax>max)){max=options.chartRangeMax;}
44
- var range=max-min;for(var i=0,vlen=values.length;i<vlen;i++){var val=values[i];if(val<min)val=min;if(val>max)val=max;var x=(i*interval);var ytop=Math.round(pheight-pheight*((val-min)/range));target.drawLine(x,ytop,x,ytop+line_height,(options.thresholdColor&&val<options.thresholdValue)?options.thresholdColor:options.lineColor);}}else{this.innerHTML='';}};$.fn.sparkline.bullet=function(values,options,width,height){values=$.map(values,Number);var options=$.extend({targetColor:'red',targetWidth:3,performanceColor:'blue',rangeColors:['#D3DAFE','#A8B6FF','#7F94FF'],base:undefined},options);width=options.width=='auto'?'4.0em':width;var target=$(this).simpledraw(width,height,options.composite);if(target&&values.length>1){var canvas_width=target.pixel_width-Math.ceil(options.targetWidth/2);var canvas_height=target.pixel_height;var min=Math.min.apply(Math,values);var max=Math.max.apply(Math,values);if(options.base==undefined){var min=min<0?min:0;}else{min=options.base;}
45
- var range=max-min;for(i=2,vlen=values.length;i<vlen;i++){var rangeval=parseInt(values[i]);var rangewidth=Math.round(canvas_width*((rangeval-min)/range));target.drawRect(0,0,rangewidth-1,canvas_height-1,options.rangeColors[i-2],options.rangeColors[i-2]);}
46
- var perfval=parseInt(values[1]);var perfwidth=Math.round(canvas_width*((perfval-min)/range));target.drawRect(0,Math.round(canvas_height*0.3),perfwidth-1,Math.round(canvas_height*0.4)-1,options.performanceColor,options.performanceColor);var targetval=parseInt(values[0]);var x=Math.round(canvas_width*((targetval-min)/range)-(options.targetWidth/2));var targettop=Math.round(canvas_height*0.10);var targetheight=canvas_height-(targettop*2);target.drawRect(x,targettop,options.targetWidth-1,targetheight-1,options.targetColor,options.targetColor);}else{this.innerHTML='';}};$.fn.sparkline.pie=function(values,options,width,height){values=$.map(values,Number);var options=$.extend({sliceColors:['#f00','#0f0','#00f']},options);width=options.width=='auto'?height:width;var target=$(this).simpledraw(width,height,options.composite);if(target&&values.length>1){var canvas_width=target.pixel_width;var canvas_height=target.pixel_height;var radius=Math.floor(Math.min(canvas_width,canvas_height)/2);var total=0;for(var i=0,vlen=values.length;i<vlen;i++)
47
- total+=values[i];var next=0;if(options.offset){next+=(2*Math.PI)*(options.offset/360);}
48
- var circle=2*Math.PI;for(var i=0,vlen=values.length;i<vlen;i++){var start=next;var end=next;if(total>0){end=next+(circle*(values[i]/total));}
49
- target.drawPieSlice(radius,radius,radius,start,end,undefined,options.sliceColors[i%options.sliceColors.length]);next=end;}}};function quartile(values,q){if(q==2){var vl2=Math.floor(values.length/2);return values.length%2?values[vl2]:(values[vl2]+values[vl2+1])/2;}else{var vl4=Math.floor(values.length/4);return values.length%2?(values[vl4*q]+values[vl4*q+1])/2:values[vl4*q];}};$.fn.sparkline.box=function(values,options,width,height){values=$.map(values,Number);var options=$.extend({raw:false,boxLineColor:'black',boxFillColor:'#cdf',whiskerColor:'black',outlierLineColor:'#333',outlierFillColor:'white',medianColor:'red',showOutliers:true,outlierIQR:1.5,spotRadius:1.5,target:undefined,targetColor:'#4a2',chartRangeMax:undefined,chartRangeMin:undefined},options);width=options.width=='auto'?'4.0em':width;minvalue=options.chartRangeMin==undefined?Math.min.apply(Math,values):options.chartRangeMin;maxvalue=options.chartRangeMax==undefined?Math.max.apply(Math,values):options.chartRangeMax;var target=$(this).simpledraw(width,height,options.composite);if(target&&values.length>1){var canvas_width=target.pixel_width;var canvas_height=target.pixel_height;if(options.raw){if(options.showOutliers&&values.length>5){var loutlier=values[0],lwhisker=values[1],q1=values[2],q2=values[3],q3=values[4],rwhisker=values[5],routlier=values[6];}else{var lwhisker=values[0],q1=values[1],q2=values[2],q3=values[3],rwhisker=values[4];}}else{values.sort(function(a,b){return a-b;});var q1=quartile(values,1);var q2=quartile(values,2);var q3=quartile(values,3);var iqr=q3-q1;if(options.showOutliers){var lwhisker=undefined,rwhisker=undefined;for(var i=0,vlen=values.length;i<vlen;i++){if(lwhisker==undefined&&values[i]>q1-(iqr*options.outlierIQR))
50
- lwhisker=values[i];if(values[i]<q3+(iqr*options.outlierIQR))
51
- rwhisker=values[i];}
52
- var loutlier=values[0];var routlier=values[values.length-1];}else{var lwhisker=values[0];var rwhisker=values[values.length-1];}}
53
- var unitsize=canvas_width/(maxvalue-minvalue+1);var canvas_left=0;if(options.showOutliers){canvas_left=Math.ceil(options.spotRadius);canvas_width-=2*Math.ceil(options.spotRadius);var unitsize=canvas_width/(maxvalue-minvalue+1);if(loutlier<lwhisker)
54
- target.drawCircle((loutlier-minvalue)*unitsize+canvas_left,canvas_height/2,options.spotRadius,options.outlierLineColor,options.outlierFillColor);if(routlier>rwhisker)
55
- target.drawCircle((routlier-minvalue)*unitsize+canvas_left,canvas_height/2,options.spotRadius,options.outlierLineColor,options.outlierFillColor);}
56
- target.drawRect(Math.round((q1-minvalue)*unitsize+canvas_left),Math.round(canvas_height*0.1),Math.round((q3-q1)*unitsize),Math.round(canvas_height*0.8),options.boxLineColor,options.boxFillColor);target.drawLine(Math.round((lwhisker-minvalue)*unitsize+canvas_left),Math.round(canvas_height/2),Math.round((q1-minvalue)*unitsize+canvas_left),Math.round(canvas_height/2),options.lineColor);target.drawLine(Math.round((lwhisker-minvalue)*unitsize+canvas_left),Math.round(canvas_height/4),Math.round((lwhisker-minvalue)*unitsize+canvas_left),Math.round(canvas_height-canvas_height/4),options.whiskerColor);target.drawLine(Math.round((rwhisker-minvalue)*unitsize+canvas_left),Math.round(canvas_height/2),Math.round((q3-minvalue)*unitsize+canvas_left),Math.round(canvas_height/2),options.lineColor);target.drawLine(Math.round((rwhisker-minvalue)*unitsize+canvas_left),Math.round(canvas_height/4),Math.round((rwhisker-minvalue)*unitsize+canvas_left),Math.round(canvas_height-canvas_height/4),options.whiskerColor);target.drawLine(Math.round((q2-minvalue)*unitsize+canvas_left),Math.round(canvas_height*0.1),Math.round((q2-minvalue)*unitsize+canvas_left),Math.round(canvas_height*0.9),options.medianColor);if(options.target){var size=Math.ceil(options.spotRadius);target.drawLine(Math.round((options.target-minvalue)*unitsize+canvas_left),Math.round((canvas_height/2)-size),Math.round((options.target-minvalue)*unitsize+canvas_left),Math.round((canvas_height/2)+size),options.targetColor);target.drawLine(Math.round((options.target-minvalue)*unitsize+canvas_left-size),Math.round(canvas_height/2),Math.round((options.target-minvalue)*unitsize+canvas_left+size),Math.round(canvas_height/2),options.targetColor);}}else{this.innerHTML='';}};if(!Array.prototype.indexOf){Array.prototype.indexOf=function(entry){for(var i=0,vlen=this.length;i<vlen;i++){if(this[i]==entry)
57
- return i;}
58
- return-1;}}
59
- if($.browser.msie&&!document.namespaces['v']){document.namespaces.add('v','urn:schemas-microsoft-com:vml','#default#VML');}
60
- if($.browser.hasCanvas==undefined){var t=document.createElement('canvas');$.browser.hasCanvas=t.getContext!=undefined;}
61
- var vcanvas_base=function(width,height,target){};vcanvas_base.prototype={init:function(width,height,target){this.width=width;this.height=height;this.target=target;if(target[0])target=target[0];target.vcanvas=this;},drawShape:function(path,lineColor,fillColor,lineWidth){alert('drawShape not implemented');},drawLine:function(x1,y1,x2,y2,lineColor,lineWidth){return this.drawShape([[x1,y1],[x2,y2]],lineColor,lineWidth);},drawCircle:function(x,y,radius,lineColor,fillColor){alert('drawCircle not implemented');},drawPieSlice:function(x,y,radius,startAngle,endAngle,lineColor,fillColor){alert('drawPieSlice not implemented');},drawRect:function(x,y,width,height,lineColor,fillColor){alert('drawRect not implemented');},getElement:function(){return this.canvas;},_insert:function(el,target){$(target).html(el);}};var vcanvas_canvas=function(width,height,target){return this.init(width,height,target);};vcanvas_canvas.prototype=$.extend(new vcanvas_base,{_super:vcanvas_base.prototype,init:function(width,height,target){this._super.init(width,height,target);this.canvas=document.createElement('canvas');if(target[0])target=target[0];target.vcanvas=this;$(this.canvas).css({display:'inline-block',width:width,height:height,verticalAlign:'top'});this._insert(this.canvas,target);this.pixel_height=$(this.canvas).height();this.pixel_width=$(this.canvas).width();this.canvas.width=this.pixel_width;this.canvas.height=this.pixel_height;$(this.canvas).css({width:this.pixel_width,height:this.pixel_height});},_getContext:function(lineColor,fillColor,lineWidth){var context=this.canvas.getContext('2d');if(lineColor!=undefined)
62
- context.strokeStyle=lineColor;context.lineWidth=lineWidth==undefined?1:lineWidth;if(fillColor!=undefined)
63
- context.fillStyle=fillColor;return context;},drawShape:function(path,lineColor,fillColor,lineWidth){var context=this._getContext(lineColor,fillColor,lineWidth);context.beginPath();context.moveTo(path[0][0]+0.5,path[0][1]+0.5);for(var i=1,plen=path.length;i<plen;i++){context.lineTo(path[i][0]+0.5,path[i][1]+0.5);}
64
- if(lineColor!=undefined){context.stroke();}
65
- if(fillColor!=undefined){context.fill();}},drawCircle:function(x,y,radius,lineColor,fillColor){var context=this._getContext(lineColor,fillColor);context.beginPath();context.arc(x,y,radius,0,2*Math.PI,false);if(lineColor!=undefined){context.stroke();}
66
- if(fillColor!=undefined){context.fill();}},drawPieSlice:function(x,y,radius,startAngle,endAngle,lineColor,fillColor){var context=this._getContext(lineColor,fillColor);context.beginPath();context.moveTo(x,y);context.arc(x,y,radius,startAngle,endAngle,false);context.lineTo(x,y);context.closePath();if(lineColor!=undefined){context.stroke();}
67
- if(fillColor){context.fill();}},drawRect:function(x,y,width,height,lineColor,fillColor){return this.drawShape([[x,y],[x+width,y],[x+width,y+height],[x,y+height],[x,y]],lineColor,fillColor);}});var vcanvas_vml=function(width,height,target){return this.init(width,height,target);};vcanvas_vml.prototype=$.extend(new vcanvas_base,{_super:vcanvas_base.prototype,init:function(width,height,target){this._super.init(width,height,target);if(target[0])target=target[0];target.vcanvas=this;this.canvas=document.createElement('span');$(this.canvas).css({display:'inline-block',position:'relative',overflow:'hidden',width:width,height:height,margin:'0px',padding:'0px',verticalAlign:'top'});this._insert(this.canvas,target);this.pixel_height=$(this.canvas).height();this.pixel_width=$(this.canvas).width();this.canvas.width=this.pixel_width;this.canvas.height=this.pixel_height;;var groupel='<v:group coordorigin="0 0" coordsize="'+this.pixel_width+' '+this.pixel_height+'"'
68
- +' style="position:absolute;top:0;left:0;width:'+this.pixel_width+'px;height='+this.pixel_height+'px;"></v:group>';this.canvas.insertAdjacentHTML('beforeEnd',groupel);this.group=$(this.canvas).children()[0];},drawShape:function(path,lineColor,fillColor,lineWidth){var vpath=[];for(var i=0,plen=path.length;i<plen;i++){vpath[i]=''+(path[i][0])+','+(path[i][1]);}
69
- var initial=vpath.splice(0,1);lineWidth=lineWidth==undefined?1:lineWidth;var stroke=lineColor==undefined?' stroked="false" ':' strokeWeight="'+lineWidth+'" strokeColor="'+lineColor+'" ';var fill=fillColor==undefined?' filled="false"':' fillColor="'+fillColor+'" filled="true" ';var closed=vpath[0]==vpath[vpath.length-1]?'x ':'';var vel='<v:shape coordorigin="0 0" coordsize="'+this.pixel_width+' '+this.pixel_height+'" '
70
- +stroke
71
- +fill
72
- +' style="position:absolute;left:0px;top:0px;height:'+this.pixel_height+'px;width:'+this.pixel_width+'px;padding:0px;margin:0px;" '
73
- +' path="m '+initial+' l '+vpath.join(', ')+' '+closed+'e">'
74
- +' </v:shape>';this.group.insertAdjacentHTML('beforeEnd',vel);},drawCircle:function(x,y,radius,lineColor,fillColor){x-=radius+1;y-=radius+1;var stroke=lineColor==undefined?' stroked="false" ':' strokeWeight="1" strokeColor="'+lineColor+'" ';var fill=fillColor==undefined?' filled="false"':' fillColor="'+fillColor+'" filled="true" ';var vel='<v:oval '
75
- +stroke
76
- +fill
77
- +' style="position:absolute;top:'+y+'px; left:'+x+'px; width:'+(radius*2)+'px; height:'+(radius*2)+'px"></v:oval>';this.group.insertAdjacentHTML('beforeEnd',vel);},drawPieSlice:function(x,y,radius,startAngle,endAngle,lineColor,fillColor){if(startAngle==endAngle){return;}
78
- if((endAngle-startAngle)==(2*Math.PI)){startAngle=0.0;endAngle=(2*Math.PI);}
79
- var startx=x+Math.round(Math.cos(startAngle)*radius);var starty=y+Math.round(Math.sin(startAngle)*radius);var endx=x+Math.round(Math.cos(endAngle)*radius);var endy=y+Math.round(Math.sin(endAngle)*radius);if(startx==endx&&starty==endy&&(endAngle-startAngle)<Math.PI)
80
- return;var vpath=[x-radius,y-radius,x+radius,y+radius,startx,starty,endx,endy];var stroke=lineColor==undefined?' stroked="false" ':' strokeWeight="1" strokeColor="'+lineColor+'" ';var fill=fillColor==undefined?' filled="false"':' fillColor="'+fillColor+'" filled="true" ';var vel='<v:shape coordorigin="0 0" coordsize="'+this.pixel_width+' '+this.pixel_height+'" '
81
- +stroke
82
- +fill
83
- +' style="position:absolute;left:0px;top:0px;height:'+this.pixel_height+'px;width:'+this.pixel_width+'px;padding:0px;margin:0px;" '
84
- +' path="m '+x+','+y+' wa '+vpath.join(', ')+' x e">'
85
- +' </v:shape>';this.group.insertAdjacentHTML('beforeEnd',vel);},drawRect:function(x,y,width,height,lineColor,fillColor){return this.drawShape([[x,y],[x,y+height],[x+width,y+height],[x+width,y],[x,y]],lineColor,fillColor);}});})(jQuery);