how_are_we_doing 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. data/app/controllers/reports_controller.rb +54 -0
  2. data/app/helpers/prints_helper.rb +25 -0
  3. data/app/helpers/reports_helper.rb +36 -0
  4. data/app/helpers/shares_helper.rb +25 -0
  5. data/app/helpers/views_helper.rb +25 -0
  6. data/app/models/print.rb +28 -0
  7. data/app/models/share.rb +29 -0
  8. data/app/models/total.rb +25 -0
  9. data/app/models/view.rb +28 -0
  10. data/app/views/reports/index.html.erb +28 -0
  11. data/how_are_we_doing.gemspec +3 -0
  12. data/lib/acts_as_printable.rb +8 -1
  13. data/lib/acts_as_shareable.rb +9 -2
  14. data/lib/acts_as_totalable.rb +31 -0
  15. data/lib/acts_as_viewable.rb +8 -1
  16. data/lib/generators/how_are_we_doing/install/install_generator.rb +9 -3
  17. data/lib/generators/how_are_we_doing/install/templates/db/migrate/create_totals.rb +16 -0
  18. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/API.txt +1024 -0
  19. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/FAQ.txt +71 -0
  20. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/LICENSE.txt +22 -0
  21. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/Makefile +15 -0
  22. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/NEWS.txt +340 -0
  23. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/PLUGINS.txt +105 -0
  24. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/README.txt +81 -0
  25. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/ajax.html +143 -0
  26. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/annotating.html +75 -0
  27. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/arrow-down.gif +0 -0
  28. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/arrow-left.gif +0 -0
  29. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/arrow-right.gif +0 -0
  30. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/arrow-up.gif +0 -0
  31. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/basic.html +38 -0
  32. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/data-eu-gdp-growth-1.json +4 -0
  33. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/data-eu-gdp-growth-2.json +4 -0
  34. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/data-eu-gdp-growth-3.json +4 -0
  35. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/data-eu-gdp-growth-4.json +4 -0
  36. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/data-eu-gdp-growth-5.json +4 -0
  37. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/data-eu-gdp-growth.json +4 -0
  38. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/data-japan-gdp-growth.json +4 -0
  39. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/data-usa-gdp-growth.json +4 -0
  40. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/dual-axis.html +39 -0
  41. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/graph-types.html +75 -0
  42. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/hs-2004-27-a-large_web.jpg +0 -0
  43. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/image.html +45 -0
  44. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/index.html +43 -0
  45. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/interacting.html +93 -0
  46. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/layout.css +6 -0
  47. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/navigate.html +118 -0
  48. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/selection.html +114 -0
  49. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/setting-options.html +65 -0
  50. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/stacking.html +77 -0
  51. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/thresholding.html +54 -0
  52. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/time.html +71 -0
  53. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/tracking.html +95 -0
  54. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/turning-series.html +98 -0
  55. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/visitors.html +90 -0
  56. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/examples/zooming.html +98 -0
  57. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/excanvas.js +1427 -0
  58. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/excanvas.min.js +1 -0
  59. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.colorhelpers.js +174 -0
  60. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.colorhelpers.min.js +1 -0
  61. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.flot.crosshair.js +156 -0
  62. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.flot.crosshair.min.js +1 -0
  63. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.flot.image.js +237 -0
  64. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.flot.image.min.js +1 -0
  65. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.flot.js +2119 -0
  66. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.flot.min.js +1 -0
  67. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.flot.navigate.js +272 -0
  68. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.flot.navigate.min.js +1 -0
  69. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.flot.selection.js +299 -0
  70. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.flot.selection.min.js +1 -0
  71. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.flot.stack.js +152 -0
  72. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.flot.stack.min.js +1 -0
  73. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.flot.threshold.js +103 -0
  74. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.flot.threshold.min.js +1 -0
  75. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.js +4376 -0
  76. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.min.js +19 -0
  77. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/how_are_we_doing.js +89 -0
  78. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/jquery-ui-1.8.10.custom.min.js +99 -0
  79. data/lib/generators/how_are_we_doing/install/templates/public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  80. data/lib/generators/how_are_we_doing/install/templates/public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  81. data/lib/generators/how_are_we_doing/install/templates/public/stylesheets/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
  82. data/lib/generators/how_are_we_doing/install/templates/public/stylesheets/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  83. data/lib/generators/how_are_we_doing/install/templates/public/stylesheets/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  84. data/lib/generators/how_are_we_doing/install/templates/public/stylesheets/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  85. data/lib/generators/how_are_we_doing/install/templates/public/stylesheets/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  86. data/lib/generators/how_are_we_doing/install/templates/public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  87. data/lib/generators/how_are_we_doing/install/templates/public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  88. data/lib/generators/how_are_we_doing/install/templates/public/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
  89. data/lib/generators/how_are_we_doing/install/templates/public/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
  90. data/lib/generators/how_are_we_doing/install/templates/public/stylesheets/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
  91. data/lib/generators/how_are_we_doing/install/templates/public/stylesheets/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
  92. data/lib/generators/how_are_we_doing/install/templates/public/stylesheets/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
  93. data/lib/generators/how_are_we_doing/install/templates/public/stylesheets/ui-lightness/jquery-ui-1.8.10.custom.css +362 -0
  94. data/lib/how_are_we_doing/version.rb +1 -1
  95. data/lib/how_are_we_doing.rb +8 -0
  96. metadata +112 -14
@@ -0,0 +1 @@
1
+ if(!document.createElement("canvas").getContext){(function(){var z=Math;var K=z.round;var J=z.sin;var U=z.cos;var b=z.abs;var k=z.sqrt;var D=10;var F=D/2;function T(){return this.context_||(this.context_=new W(this))}var O=Array.prototype.slice;function G(i,j,m){var Z=O.call(arguments,2);return function(){return i.apply(j,Z.concat(O.call(arguments)))}}function AD(Z){return String(Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}function r(i){if(!i.namespaces.g_vml_){i.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml","#default#VML")}if(!i.namespaces.g_o_){i.namespaces.add("g_o_","urn:schemas-microsoft-com:office:office","#default#VML")}if(!i.styleSheets.ex_canvas_){var Z=i.createStyleSheet();Z.owningElement.id="ex_canvas_";Z.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"}}r(document);var E={init:function(Z){if(/MSIE/.test(navigator.userAgent)&&!window.opera){var i=Z||document;i.createElement("canvas");i.attachEvent("onreadystatechange",G(this.init_,this,i))}},init_:function(m){var j=m.getElementsByTagName("canvas");for(var Z=0;Z<j.length;Z++){this.initElement(j[Z])}},initElement:function(i){if(!i.getContext){i.getContext=T;r(i.ownerDocument);i.innerHTML="";i.attachEvent("onpropertychange",S);i.attachEvent("onresize",w);var Z=i.attributes;if(Z.width&&Z.width.specified){i.style.width=Z.width.nodeValue+"px"}else{i.width=i.clientWidth}if(Z.height&&Z.height.specified){i.style.height=Z.height.nodeValue+"px"}else{i.height=i.clientHeight}}return i}};function S(i){var Z=i.srcElement;switch(i.propertyName){case"width":Z.getContext().clearRect();Z.style.width=Z.attributes.width.nodeValue+"px";Z.firstChild.style.width=Z.clientWidth+"px";break;case"height":Z.getContext().clearRect();Z.style.height=Z.attributes.height.nodeValue+"px";Z.firstChild.style.height=Z.clientHeight+"px";break}}function w(i){var Z=i.srcElement;if(Z.firstChild){Z.firstChild.style.width=Z.clientWidth+"px";Z.firstChild.style.height=Z.clientHeight+"px"}}E.init();var I=[];for(var AC=0;AC<16;AC++){for(var AB=0;AB<16;AB++){I[AC*16+AB]=AC.toString(16)+AB.toString(16)}}function V(){return[[1,0,0],[0,1,0],[0,0,1]]}function d(m,j){var i=V();for(var Z=0;Z<3;Z++){for(var AF=0;AF<3;AF++){var p=0;for(var AE=0;AE<3;AE++){p+=m[Z][AE]*j[AE][AF]}i[Z][AF]=p}}return i}function Q(i,Z){Z.fillStyle=i.fillStyle;Z.lineCap=i.lineCap;Z.lineJoin=i.lineJoin;Z.lineWidth=i.lineWidth;Z.miterLimit=i.miterLimit;Z.shadowBlur=i.shadowBlur;Z.shadowColor=i.shadowColor;Z.shadowOffsetX=i.shadowOffsetX;Z.shadowOffsetY=i.shadowOffsetY;Z.strokeStyle=i.strokeStyle;Z.globalAlpha=i.globalAlpha;Z.font=i.font;Z.textAlign=i.textAlign;Z.textBaseline=i.textBaseline;Z.arcScaleX_=i.arcScaleX_;Z.arcScaleY_=i.arcScaleY_;Z.lineScale_=i.lineScale_}var B={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgreen:"#006400",darkgrey:"#A9A9A9",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",grey:"#808080",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgreen:"#90EE90",lightgrey:"#D3D3D3",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",oldlace:"#FDF5E6",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",whitesmoke:"#F5F5F5",yellowgreen:"#9ACD32"};function g(i){var m=i.indexOf("(",3);var Z=i.indexOf(")",m+1);var j=i.substring(m+1,Z).split(",");if(j.length==4&&i.substr(3,1)=="a"){alpha=Number(j[3])}else{j[3]=1}return j}function C(Z){return parseFloat(Z)/100}function N(i,j,Z){return Math.min(Z,Math.max(j,i))}function c(AF){var j,i,Z;h=parseFloat(AF[0])/360%360;if(h<0){h++}s=N(C(AF[1]),0,1);l=N(C(AF[2]),0,1);if(s==0){j=i=Z=l}else{var m=l<0.5?l*(1+s):l+s-l*s;var AE=2*l-m;j=A(AE,m,h+1/3);i=A(AE,m,h);Z=A(AE,m,h-1/3)}return"#"+I[Math.floor(j*255)]+I[Math.floor(i*255)]+I[Math.floor(Z*255)]}function A(i,Z,j){if(j<0){j++}if(j>1){j--}if(6*j<1){return i+(Z-i)*6*j}else{if(2*j<1){return Z}else{if(3*j<2){return i+(Z-i)*(2/3-j)*6}else{return i}}}}function Y(Z){var AE,p=1;Z=String(Z);if(Z.charAt(0)=="#"){AE=Z}else{if(/^rgb/.test(Z)){var m=g(Z);var AE="#",AF;for(var j=0;j<3;j++){if(m[j].indexOf("%")!=-1){AF=Math.floor(C(m[j])*255)}else{AF=Number(m[j])}AE+=I[N(AF,0,255)]}p=m[3]}else{if(/^hsl/.test(Z)){var m=g(Z);AE=c(m);p=m[3]}else{AE=B[Z]||Z}}}return{color:AE,alpha:p}}var L={style:"normal",variant:"normal",weight:"normal",size:10,family:"sans-serif"};var f={};function X(Z){if(f[Z]){return f[Z]}var m=document.createElement("div");var j=m.style;try{j.font=Z}catch(i){}return f[Z]={style:j.fontStyle||L.style,variant:j.fontVariant||L.variant,weight:j.fontWeight||L.weight,size:j.fontSize||L.size,family:j.fontFamily||L.family}}function P(j,i){var Z={};for(var AF in j){Z[AF]=j[AF]}var AE=parseFloat(i.currentStyle.fontSize),m=parseFloat(j.size);if(typeof j.size=="number"){Z.size=j.size}else{if(j.size.indexOf("px")!=-1){Z.size=m}else{if(j.size.indexOf("em")!=-1){Z.size=AE*m}else{if(j.size.indexOf("%")!=-1){Z.size=(AE/100)*m}else{if(j.size.indexOf("pt")!=-1){Z.size=m/0.75}else{Z.size=AE}}}}}Z.size*=0.981;return Z}function AA(Z){return Z.style+" "+Z.variant+" "+Z.weight+" "+Z.size+"px "+Z.family}function t(Z){switch(Z){case"butt":return"flat";case"round":return"round";case"square":default:return"square"}}function W(i){this.m_=V();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.strokeStyle="#000";this.fillStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=D*1;this.globalAlpha=1;this.font="10px sans-serif";this.textAlign="left";this.textBaseline="alphabetic";this.canvas=i;var Z=i.ownerDocument.createElement("div");Z.style.width=i.clientWidth+"px";Z.style.height=i.clientHeight+"px";Z.style.overflow="hidden";Z.style.position="absolute";i.appendChild(Z);this.element_=Z;this.arcScaleX_=1;this.arcScaleY_=1;this.lineScale_=1}var M=W.prototype;M.clearRect=function(){if(this.textMeasureEl_){this.textMeasureEl_.removeNode(true);this.textMeasureEl_=null}this.element_.innerHTML=""};M.beginPath=function(){this.currentPath_=[]};M.moveTo=function(i,Z){var j=this.getCoords_(i,Z);this.currentPath_.push({type:"moveTo",x:j.x,y:j.y});this.currentX_=j.x;this.currentY_=j.y};M.lineTo=function(i,Z){var j=this.getCoords_(i,Z);this.currentPath_.push({type:"lineTo",x:j.x,y:j.y});this.currentX_=j.x;this.currentY_=j.y};M.bezierCurveTo=function(j,i,AI,AH,AG,AE){var Z=this.getCoords_(AG,AE);var AF=this.getCoords_(j,i);var m=this.getCoords_(AI,AH);e(this,AF,m,Z)};function e(Z,m,j,i){Z.currentPath_.push({type:"bezierCurveTo",cp1x:m.x,cp1y:m.y,cp2x:j.x,cp2y:j.y,x:i.x,y:i.y});Z.currentX_=i.x;Z.currentY_=i.y}M.quadraticCurveTo=function(AG,j,i,Z){var AF=this.getCoords_(AG,j);var AE=this.getCoords_(i,Z);var AH={x:this.currentX_+2/3*(AF.x-this.currentX_),y:this.currentY_+2/3*(AF.y-this.currentY_)};var m={x:AH.x+(AE.x-this.currentX_)/3,y:AH.y+(AE.y-this.currentY_)/3};e(this,AH,m,AE)};M.arc=function(AJ,AH,AI,AE,i,j){AI*=D;var AN=j?"at":"wa";var AK=AJ+U(AE)*AI-F;var AM=AH+J(AE)*AI-F;var Z=AJ+U(i)*AI-F;var AL=AH+J(i)*AI-F;if(AK==Z&&!j){AK+=0.125}var m=this.getCoords_(AJ,AH);var AG=this.getCoords_(AK,AM);var AF=this.getCoords_(Z,AL);this.currentPath_.push({type:AN,x:m.x,y:m.y,radius:AI,xStart:AG.x,yStart:AG.y,xEnd:AF.x,yEnd:AF.y})};M.rect=function(j,i,Z,m){this.moveTo(j,i);this.lineTo(j+Z,i);this.lineTo(j+Z,i+m);this.lineTo(j,i+m);this.closePath()};M.strokeRect=function(j,i,Z,m){var p=this.currentPath_;this.beginPath();this.moveTo(j,i);this.lineTo(j+Z,i);this.lineTo(j+Z,i+m);this.lineTo(j,i+m);this.closePath();this.stroke();this.currentPath_=p};M.fillRect=function(j,i,Z,m){var p=this.currentPath_;this.beginPath();this.moveTo(j,i);this.lineTo(j+Z,i);this.lineTo(j+Z,i+m);this.lineTo(j,i+m);this.closePath();this.fill();this.currentPath_=p};M.createLinearGradient=function(i,m,Z,j){var p=new v("gradient");p.x0_=i;p.y0_=m;p.x1_=Z;p.y1_=j;return p};M.createRadialGradient=function(m,AE,j,i,p,Z){var AF=new v("gradientradial");AF.x0_=m;AF.y0_=AE;AF.r0_=j;AF.x1_=i;AF.y1_=p;AF.r1_=Z;return AF};M.drawImage=function(AO,j){var AH,AF,AJ,AV,AM,AK,AQ,AX;var AI=AO.runtimeStyle.width;var AN=AO.runtimeStyle.height;AO.runtimeStyle.width="auto";AO.runtimeStyle.height="auto";var AG=AO.width;var AT=AO.height;AO.runtimeStyle.width=AI;AO.runtimeStyle.height=AN;if(arguments.length==3){AH=arguments[1];AF=arguments[2];AM=AK=0;AQ=AJ=AG;AX=AV=AT}else{if(arguments.length==5){AH=arguments[1];AF=arguments[2];AJ=arguments[3];AV=arguments[4];AM=AK=0;AQ=AG;AX=AT}else{if(arguments.length==9){AM=arguments[1];AK=arguments[2];AQ=arguments[3];AX=arguments[4];AH=arguments[5];AF=arguments[6];AJ=arguments[7];AV=arguments[8]}else{throw Error("Invalid number of arguments")}}}var AW=this.getCoords_(AH,AF);var m=AQ/2;var i=AX/2;var AU=[];var Z=10;var AE=10;AU.push(" <g_vml_:group",' coordsize="',D*Z,",",D*AE,'"',' coordorigin="0,0"',' style="width:',Z,"px;height:",AE,"px;position:absolute;");if(this.m_[0][0]!=1||this.m_[0][1]||this.m_[1][1]!=1||this.m_[1][0]){var p=[];p.push("M11=",this.m_[0][0],",","M12=",this.m_[1][0],",","M21=",this.m_[0][1],",","M22=",this.m_[1][1],",","Dx=",K(AW.x/D),",","Dy=",K(AW.y/D),"");var AS=AW;var AR=this.getCoords_(AH+AJ,AF);var AP=this.getCoords_(AH,AF+AV);var AL=this.getCoords_(AH+AJ,AF+AV);AS.x=z.max(AS.x,AR.x,AP.x,AL.x);AS.y=z.max(AS.y,AR.y,AP.y,AL.y);AU.push("padding:0 ",K(AS.x/D),"px ",K(AS.y/D),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",p.join(""),", sizingmethod='clip');")}else{AU.push("top:",K(AW.y/D),"px;left:",K(AW.x/D),"px;")}AU.push(' ">','<g_vml_:image src="',AO.src,'"',' style="width:',D*AJ,"px;"," height:",D*AV,'px"',' cropleft="',AM/AG,'"',' croptop="',AK/AT,'"',' cropright="',(AG-AM-AQ)/AG,'"',' cropbottom="',(AT-AK-AX)/AT,'"'," />","</g_vml_:group>");this.element_.insertAdjacentHTML("BeforeEnd",AU.join(""))};M.stroke=function(AM){var m=10;var AN=10;var AE=5000;var AG={x:null,y:null};var AL={x:null,y:null};for(var AH=0;AH<this.currentPath_.length;AH+=AE){var AK=[];var AF=false;AK.push("<g_vml_:shape",' filled="',!!AM,'"',' style="position:absolute;width:',m,"px;height:",AN,'px;"',' coordorigin="0,0"',' coordsize="',D*m,",",D*AN,'"',' stroked="',!AM,'"',' path="');var AO=false;for(var AI=AH;AI<Math.min(AH+AE,this.currentPath_.length);AI++){if(AI%AE==0&&AI>0){AK.push(" m ",K(this.currentPath_[AI-1].x),",",K(this.currentPath_[AI-1].y))}var Z=this.currentPath_[AI];var AJ;switch(Z.type){case"moveTo":AJ=Z;AK.push(" m ",K(Z.x),",",K(Z.y));break;case"lineTo":AK.push(" l ",K(Z.x),",",K(Z.y));break;case"close":AK.push(" x ");Z=null;break;case"bezierCurveTo":AK.push(" c ",K(Z.cp1x),",",K(Z.cp1y),",",K(Z.cp2x),",",K(Z.cp2y),",",K(Z.x),",",K(Z.y));break;case"at":case"wa":AK.push(" ",Z.type," ",K(Z.x-this.arcScaleX_*Z.radius),",",K(Z.y-this.arcScaleY_*Z.radius)," ",K(Z.x+this.arcScaleX_*Z.radius),",",K(Z.y+this.arcScaleY_*Z.radius)," ",K(Z.xStart),",",K(Z.yStart)," ",K(Z.xEnd),",",K(Z.yEnd));break}if(Z){if(AG.x==null||Z.x<AG.x){AG.x=Z.x}if(AL.x==null||Z.x>AL.x){AL.x=Z.x}if(AG.y==null||Z.y<AG.y){AG.y=Z.y}if(AL.y==null||Z.y>AL.y){AL.y=Z.y}}}AK.push(' ">');if(!AM){R(this,AK)}else{a(this,AK,AG,AL)}AK.push("</g_vml_:shape>");this.element_.insertAdjacentHTML("beforeEnd",AK.join(""))}};function R(j,AE){var i=Y(j.strokeStyle);var m=i.color;var p=i.alpha*j.globalAlpha;var Z=j.lineScale_*j.lineWidth;if(Z<1){p*=Z}AE.push("<g_vml_:stroke",' opacity="',p,'"',' joinstyle="',j.lineJoin,'"',' miterlimit="',j.miterLimit,'"',' endcap="',t(j.lineCap),'"',' weight="',Z,'px"',' color="',m,'" />')}function a(AO,AG,Ah,AP){var AH=AO.fillStyle;var AY=AO.arcScaleX_;var AX=AO.arcScaleY_;var Z=AP.x-Ah.x;var m=AP.y-Ah.y;if(AH instanceof v){var AL=0;var Ac={x:0,y:0};var AU=0;var AK=1;if(AH.type_=="gradient"){var AJ=AH.x0_/AY;var j=AH.y0_/AX;var AI=AH.x1_/AY;var Aj=AH.y1_/AX;var Ag=AO.getCoords_(AJ,j);var Af=AO.getCoords_(AI,Aj);var AE=Af.x-Ag.x;var p=Af.y-Ag.y;AL=Math.atan2(AE,p)*180/Math.PI;if(AL<0){AL+=360}if(AL<0.000001){AL=0}}else{var Ag=AO.getCoords_(AH.x0_,AH.y0_);Ac={x:(Ag.x-Ah.x)/Z,y:(Ag.y-Ah.y)/m};Z/=AY*D;m/=AX*D;var Aa=z.max(Z,m);AU=2*AH.r0_/Aa;AK=2*AH.r1_/Aa-AU}var AS=AH.colors_;AS.sort(function(Ak,i){return Ak.offset-i.offset});var AN=AS.length;var AR=AS[0].color;var AQ=AS[AN-1].color;var AW=AS[0].alpha*AO.globalAlpha;var AV=AS[AN-1].alpha*AO.globalAlpha;var Ab=[];for(var Ae=0;Ae<AN;Ae++){var AM=AS[Ae];Ab.push(AM.offset*AK+AU+" "+AM.color)}AG.push('<g_vml_:fill type="',AH.type_,'"',' method="none" focus="100%"',' color="',AR,'"',' color2="',AQ,'"',' colors="',Ab.join(","),'"',' opacity="',AV,'"',' g_o_:opacity2="',AW,'"',' angle="',AL,'"',' focusposition="',Ac.x,",",Ac.y,'" />')}else{if(AH instanceof u){if(Z&&m){var AF=-Ah.x;var AZ=-Ah.y;AG.push("<g_vml_:fill",' position="',AF/Z*AY*AY,",",AZ/m*AX*AX,'"',' type="tile"',' src="',AH.src_,'" />')}}else{var Ai=Y(AO.fillStyle);var AT=Ai.color;var Ad=Ai.alpha*AO.globalAlpha;AG.push('<g_vml_:fill color="',AT,'" opacity="',Ad,'" />')}}}M.fill=function(){this.stroke(true)};M.closePath=function(){this.currentPath_.push({type:"close"})};M.getCoords_=function(j,i){var Z=this.m_;return{x:D*(j*Z[0][0]+i*Z[1][0]+Z[2][0])-F,y:D*(j*Z[0][1]+i*Z[1][1]+Z[2][1])-F}};M.save=function(){var Z={};Q(this,Z);this.aStack_.push(Z);this.mStack_.push(this.m_);this.m_=d(V(),this.m_)};M.restore=function(){if(this.aStack_.length){Q(this.aStack_.pop(),this);this.m_=this.mStack_.pop()}};function H(Z){return isFinite(Z[0][0])&&isFinite(Z[0][1])&&isFinite(Z[1][0])&&isFinite(Z[1][1])&&isFinite(Z[2][0])&&isFinite(Z[2][1])}function y(i,Z,j){if(!H(Z)){return }i.m_=Z;if(j){var p=Z[0][0]*Z[1][1]-Z[0][1]*Z[1][0];i.lineScale_=k(b(p))}}M.translate=function(j,i){var Z=[[1,0,0],[0,1,0],[j,i,1]];y(this,d(Z,this.m_),false)};M.rotate=function(i){var m=U(i);var j=J(i);var Z=[[m,j,0],[-j,m,0],[0,0,1]];y(this,d(Z,this.m_),false)};M.scale=function(j,i){this.arcScaleX_*=j;this.arcScaleY_*=i;var Z=[[j,0,0],[0,i,0],[0,0,1]];y(this,d(Z,this.m_),true)};M.transform=function(p,m,AF,AE,i,Z){var j=[[p,m,0],[AF,AE,0],[i,Z,1]];y(this,d(j,this.m_),true)};M.setTransform=function(AE,p,AG,AF,j,i){var Z=[[AE,p,0],[AG,AF,0],[j,i,1]];y(this,Z,true)};M.drawText_=function(AK,AI,AH,AN,AG){var AM=this.m_,AQ=1000,i=0,AP=AQ,AF={x:0,y:0},AE=[];var Z=P(X(this.font),this.element_);var j=AA(Z);var AR=this.element_.currentStyle;var p=this.textAlign.toLowerCase();switch(p){case"left":case"center":case"right":break;case"end":p=AR.direction=="ltr"?"right":"left";break;case"start":p=AR.direction=="rtl"?"right":"left";break;default:p="left"}switch(this.textBaseline){case"hanging":case"top":AF.y=Z.size/1.75;break;case"middle":break;default:case null:case"alphabetic":case"ideographic":case"bottom":AF.y=-Z.size/2.25;break}switch(p){case"right":i=AQ;AP=0.05;break;case"center":i=AP=AQ/2;break}var AO=this.getCoords_(AI+AF.x,AH+AF.y);AE.push('<g_vml_:line from="',-i,' 0" to="',AP,' 0.05" ',' coordsize="100 100" coordorigin="0 0"',' filled="',!AG,'" stroked="',!!AG,'" style="position:absolute;width:1px;height:1px;">');if(AG){R(this,AE)}else{a(this,AE,{x:-i,y:0},{x:AP,y:Z.size})}var AL=AM[0][0].toFixed(3)+","+AM[1][0].toFixed(3)+","+AM[0][1].toFixed(3)+","+AM[1][1].toFixed(3)+",0,0";var AJ=K(AO.x/D)+","+K(AO.y/D);AE.push('<g_vml_:skew on="t" matrix="',AL,'" ',' offset="',AJ,'" origin="',i,' 0" />','<g_vml_:path textpathok="true" />','<g_vml_:textpath on="true" string="',AD(AK),'" style="v-text-align:',p,";font:",AD(j),'" /></g_vml_:line>');this.element_.insertAdjacentHTML("beforeEnd",AE.join(""))};M.fillText=function(j,Z,m,i){this.drawText_(j,Z,m,i,false)};M.strokeText=function(j,Z,m,i){this.drawText_(j,Z,m,i,true)};M.measureText=function(j){if(!this.textMeasureEl_){var Z='<span style="position:absolute;top:-20000px;left:0;padding:0;margin:0;border:none;white-space:pre;"></span>';this.element_.insertAdjacentHTML("beforeEnd",Z);this.textMeasureEl_=this.element_.lastChild}var i=this.element_.ownerDocument;this.textMeasureEl_.innerHTML="";this.textMeasureEl_.style.font=this.font;this.textMeasureEl_.appendChild(i.createTextNode(j));return{width:this.textMeasureEl_.offsetWidth}};M.clip=function(){};M.arcTo=function(){};M.createPattern=function(i,Z){return new u(i,Z)};function v(Z){this.type_=Z;this.x0_=0;this.y0_=0;this.r0_=0;this.x1_=0;this.y1_=0;this.r1_=0;this.colors_=[]}v.prototype.addColorStop=function(i,Z){Z=Y(Z);this.colors_.push({offset:i,color:Z.color,alpha:Z.alpha})};function u(i,Z){q(i);switch(Z){case"repeat":case null:case"":this.repetition_="repeat";break;case"repeat-x":case"repeat-y":case"no-repeat":this.repetition_=Z;break;default:n("SYNTAX_ERR")}this.src_=i.src;this.width_=i.width;this.height_=i.height}function n(Z){throw new o(Z)}function q(Z){if(!Z||Z.nodeType!=1||Z.tagName!="IMG"){n("TYPE_MISMATCH_ERR")}if(Z.readyState!="complete"){n("INVALID_STATE_ERR")}}function o(Z){this.code=this[Z];this.message=Z+": DOM Exception "+this.code}var x=o.prototype=new Error;x.INDEX_SIZE_ERR=1;x.DOMSTRING_SIZE_ERR=2;x.HIERARCHY_REQUEST_ERR=3;x.WRONG_DOCUMENT_ERR=4;x.INVALID_CHARACTER_ERR=5;x.NO_DATA_ALLOWED_ERR=6;x.NO_MODIFICATION_ALLOWED_ERR=7;x.NOT_FOUND_ERR=8;x.NOT_SUPPORTED_ERR=9;x.INUSE_ATTRIBUTE_ERR=10;x.INVALID_STATE_ERR=11;x.SYNTAX_ERR=12;x.INVALID_MODIFICATION_ERR=13;x.NAMESPACE_ERR=14;x.INVALID_ACCESS_ERR=15;x.VALIDATION_ERR=16;x.TYPE_MISMATCH_ERR=17;G_vmlCanvasManager=E;CanvasRenderingContext2D=W;CanvasGradient=v;CanvasPattern=u;DOMException=o})()};
@@ -0,0 +1,174 @@
1
+ /* Plugin for jQuery for working with colors.
2
+ *
3
+ * Version 1.0.
4
+ *
5
+ * Inspiration from jQuery color animation plugin by John Resig.
6
+ *
7
+ * Released under the MIT license by Ole Laursen, October 2009.
8
+ *
9
+ * Examples:
10
+ *
11
+ * $.color.parse("#fff").scale('rgb', 0.25).add('a', -0.5).toString()
12
+ * var c = $.color.extract($("#mydiv"), 'background-color');
13
+ * console.log(c.r, c.g, c.b, c.a);
14
+ * $.color.make(100, 50, 25, 0.4).toString() // returns "rgba(100,50,25,0.4)"
15
+ *
16
+ * Note that .scale() and .add() work in-place instead of returning
17
+ * new objects.
18
+ */
19
+
20
+ (function() {
21
+ jQuery.color = {};
22
+
23
+ // construct color object with some convenient chainable helpers
24
+ jQuery.color.make = function (r, g, b, a) {
25
+ var o = {};
26
+ o.r = r || 0;
27
+ o.g = g || 0;
28
+ o.b = b || 0;
29
+ o.a = a != null ? a : 1;
30
+
31
+ o.add = function (c, d) {
32
+ for (var i = 0; i < c.length; ++i)
33
+ o[c.charAt(i)] += d;
34
+ return o.normalize();
35
+ };
36
+
37
+ o.scale = function (c, f) {
38
+ for (var i = 0; i < c.length; ++i)
39
+ o[c.charAt(i)] *= f;
40
+ return o.normalize();
41
+ };
42
+
43
+ o.toString = function () {
44
+ if (o.a >= 1.0) {
45
+ return "rgb("+[o.r, o.g, o.b].join(",")+")";
46
+ } else {
47
+ return "rgba("+[o.r, o.g, o.b, o.a].join(",")+")";
48
+ }
49
+ };
50
+
51
+ o.normalize = function () {
52
+ function clamp(min, value, max) {
53
+ return value < min ? min: (value > max ? max: value);
54
+ }
55
+
56
+ o.r = clamp(0, parseInt(o.r), 255);
57
+ o.g = clamp(0, parseInt(o.g), 255);
58
+ o.b = clamp(0, parseInt(o.b), 255);
59
+ o.a = clamp(0, o.a, 1);
60
+ return o;
61
+ };
62
+
63
+ o.clone = function () {
64
+ return jQuery.color.make(o.r, o.b, o.g, o.a);
65
+ };
66
+
67
+ return o.normalize();
68
+ }
69
+
70
+ // extract CSS color property from element, going up in the DOM
71
+ // if it's "transparent"
72
+ jQuery.color.extract = function (elem, css) {
73
+ var c;
74
+ do {
75
+ c = elem.css(css).toLowerCase();
76
+ // keep going until we find an element that has color, or
77
+ // we hit the body
78
+ if (c != '' && c != 'transparent')
79
+ break;
80
+ elem = elem.parent();
81
+ } while (!jQuery.nodeName(elem.get(0), "body"));
82
+
83
+ // catch Safari's way of signalling transparent
84
+ if (c == "rgba(0, 0, 0, 0)")
85
+ c = "transparent";
86
+
87
+ return jQuery.color.parse(c);
88
+ }
89
+
90
+ // parse CSS color string (like "rgb(10, 32, 43)" or "#fff"),
91
+ // returns color object
92
+ jQuery.color.parse = function (str) {
93
+ var res, m = jQuery.color.make;
94
+
95
+ // Look for rgb(num,num,num)
96
+ if (res = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(str))
97
+ return m(parseInt(res[1], 10), parseInt(res[2], 10), parseInt(res[3], 10));
98
+
99
+ // Look for rgba(num,num,num,num)
100
+ if (res = /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str))
101
+ return m(parseInt(res[1], 10), parseInt(res[2], 10), parseInt(res[3], 10), parseFloat(res[4]));
102
+
103
+ // Look for rgb(num%,num%,num%)
104
+ if (res = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(str))
105
+ return m(parseFloat(res[1])*2.55, parseFloat(res[2])*2.55, parseFloat(res[3])*2.55);
106
+
107
+ // Look for rgba(num%,num%,num%,num)
108
+ if (res = /rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str))
109
+ return m(parseFloat(res[1])*2.55, parseFloat(res[2])*2.55, parseFloat(res[3])*2.55, parseFloat(res[4]));
110
+
111
+ // Look for #a0b1c2
112
+ if (res = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(str))
113
+ return m(parseInt(res[1], 16), parseInt(res[2], 16), parseInt(res[3], 16));
114
+
115
+ // Look for #fff
116
+ if (res = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(str))
117
+ return m(parseInt(res[1]+res[1], 16), parseInt(res[2]+res[2], 16), parseInt(res[3]+res[3], 16));
118
+
119
+ // Otherwise, we're most likely dealing with a named color
120
+ var name = jQuery.trim(str).toLowerCase();
121
+ if (name == "transparent")
122
+ return m(255, 255, 255, 0);
123
+ else {
124
+ res = lookupColors[name];
125
+ return m(res[0], res[1], res[2]);
126
+ }
127
+ }
128
+
129
+ var lookupColors = {
130
+ aqua:[0,255,255],
131
+ azure:[240,255,255],
132
+ beige:[245,245,220],
133
+ black:[0,0,0],
134
+ blue:[0,0,255],
135
+ brown:[165,42,42],
136
+ cyan:[0,255,255],
137
+ darkblue:[0,0,139],
138
+ darkcyan:[0,139,139],
139
+ darkgrey:[169,169,169],
140
+ darkgreen:[0,100,0],
141
+ darkkhaki:[189,183,107],
142
+ darkmagenta:[139,0,139],
143
+ darkolivegreen:[85,107,47],
144
+ darkorange:[255,140,0],
145
+ darkorchid:[153,50,204],
146
+ darkred:[139,0,0],
147
+ darksalmon:[233,150,122],
148
+ darkviolet:[148,0,211],
149
+ fuchsia:[255,0,255],
150
+ gold:[255,215,0],
151
+ green:[0,128,0],
152
+ indigo:[75,0,130],
153
+ khaki:[240,230,140],
154
+ lightblue:[173,216,230],
155
+ lightcyan:[224,255,255],
156
+ lightgreen:[144,238,144],
157
+ lightgrey:[211,211,211],
158
+ lightpink:[255,182,193],
159
+ lightyellow:[255,255,224],
160
+ lime:[0,255,0],
161
+ magenta:[255,0,255],
162
+ maroon:[128,0,0],
163
+ navy:[0,0,128],
164
+ olive:[128,128,0],
165
+ orange:[255,165,0],
166
+ pink:[255,192,203],
167
+ purple:[128,0,128],
168
+ violet:[128,0,128],
169
+ red:[255,0,0],
170
+ silver:[192,192,192],
171
+ white:[255,255,255],
172
+ yellow:[255,255,0]
173
+ };
174
+ })();
@@ -0,0 +1 @@
1
+ (function(){jQuery.color={};jQuery.color.make=function(E,D,B,C){var F={};F.r=E||0;F.g=D||0;F.b=B||0;F.a=C!=null?C:1;F.add=function(I,H){for(var G=0;G<I.length;++G){F[I.charAt(G)]+=H}return F.normalize()};F.scale=function(I,H){for(var G=0;G<I.length;++G){F[I.charAt(G)]*=H}return F.normalize()};F.toString=function(){if(F.a>=1){return"rgb("+[F.r,F.g,F.b].join(",")+")"}else{return"rgba("+[F.r,F.g,F.b,F.a].join(",")+")"}};F.normalize=function(){function G(I,J,H){return J<I?I:(J>H?H:J)}F.r=G(0,parseInt(F.r),255);F.g=G(0,parseInt(F.g),255);F.b=G(0,parseInt(F.b),255);F.a=G(0,F.a,1);return F};F.clone=function(){return jQuery.color.make(F.r,F.b,F.g,F.a)};return F.normalize()};jQuery.color.extract=function(C,B){var D;do{D=C.css(B).toLowerCase();if(D!=""&&D!="transparent"){break}C=C.parent()}while(!jQuery.nodeName(C.get(0),"body"));if(D=="rgba(0, 0, 0, 0)"){D="transparent"}return jQuery.color.parse(D)};jQuery.color.parse=function(E){var D,B=jQuery.color.make;if(D=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(E)){return B(parseInt(D[1],10),parseInt(D[2],10),parseInt(D[3],10))}if(D=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(E)){return B(parseInt(D[1],10),parseInt(D[2],10),parseInt(D[3],10),parseFloat(D[4]))}if(D=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(E)){return B(parseFloat(D[1])*2.55,parseFloat(D[2])*2.55,parseFloat(D[3])*2.55)}if(D=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(E)){return B(parseFloat(D[1])*2.55,parseFloat(D[2])*2.55,parseFloat(D[3])*2.55,parseFloat(D[4]))}if(D=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(E)){return B(parseInt(D[1],16),parseInt(D[2],16),parseInt(D[3],16))}if(D=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(E)){return B(parseInt(D[1]+D[1],16),parseInt(D[2]+D[2],16),parseInt(D[3]+D[3],16))}var C=jQuery.trim(E).toLowerCase();if(C=="transparent"){return B(255,255,255,0)}else{D=A[C];return B(D[0],D[1],D[2])}};var A={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})();
@@ -0,0 +1,156 @@
1
+ /*
2
+ Flot plugin for showing a crosshair, thin lines, when the mouse hovers
3
+ over the plot.
4
+
5
+ crosshair: {
6
+ mode: null or "x" or "y" or "xy"
7
+ color: color
8
+ lineWidth: number
9
+ }
10
+
11
+ Set the mode to one of "x", "y" or "xy". The "x" mode enables a
12
+ vertical crosshair that lets you trace the values on the x axis, "y"
13
+ enables a horizontal crosshair and "xy" enables them both. "color" is
14
+ the color of the crosshair (default is "rgba(170, 0, 0, 0.80)"),
15
+ "lineWidth" is the width of the drawn lines (default is 1).
16
+
17
+ The plugin also adds four public methods:
18
+
19
+ - setCrosshair(pos)
20
+
21
+ Set the position of the crosshair. Note that this is cleared if
22
+ the user moves the mouse. "pos" should be on the form { x: xpos,
23
+ y: ypos } (or x2 and y2 if you're using the secondary axes), which
24
+ is coincidentally the same format as what you get from a "plothover"
25
+ event. If "pos" is null, the crosshair is cleared.
26
+
27
+ - clearCrosshair()
28
+
29
+ Clear the crosshair.
30
+
31
+ - lockCrosshair(pos)
32
+
33
+ Cause the crosshair to lock to the current location, no longer
34
+ updating if the user moves the mouse. Optionally supply a position
35
+ (passed on to setCrosshair()) to move it to.
36
+
37
+ Example usage:
38
+ var myFlot = $.plot( $("#graph"), ..., { crosshair: { mode: "x" } } };
39
+ $("#graph").bind("plothover", function (evt, position, item) {
40
+ if (item) {
41
+ // Lock the crosshair to the data point being hovered
42
+ myFlot.lockCrosshair({ x: item.datapoint[0], y: item.datapoint[1] });
43
+ }
44
+ else {
45
+ // Return normal crosshair operation
46
+ myFlot.unlockCrosshair();
47
+ }
48
+ });
49
+
50
+ - unlockCrosshair()
51
+
52
+ Free the crosshair to move again after locking it.
53
+ */
54
+
55
+ (function ($) {
56
+ var options = {
57
+ crosshair: {
58
+ mode: null, // one of null, "x", "y" or "xy",
59
+ color: "rgba(170, 0, 0, 0.80)",
60
+ lineWidth: 1
61
+ }
62
+ };
63
+
64
+ function init(plot) {
65
+ // position of crosshair in pixels
66
+ var crosshair = { x: -1, y: -1, locked: false };
67
+
68
+ plot.setCrosshair = function setCrosshair(pos) {
69
+ if (!pos)
70
+ crosshair.x = -1;
71
+ else {
72
+ var axes = plot.getAxes();
73
+
74
+ crosshair.x = Math.max(0, Math.min(pos.x != null ? axes.xaxis.p2c(pos.x) : axes.x2axis.p2c(pos.x2), plot.width()));
75
+ crosshair.y = Math.max(0, Math.min(pos.y != null ? axes.yaxis.p2c(pos.y) : axes.y2axis.p2c(pos.y2), plot.height()));
76
+ }
77
+
78
+ plot.triggerRedrawOverlay();
79
+ };
80
+
81
+ plot.clearCrosshair = plot.setCrosshair; // passes null for pos
82
+
83
+ plot.lockCrosshair = function lockCrosshair(pos) {
84
+ if (pos)
85
+ plot.setCrosshair(pos);
86
+ crosshair.locked = true;
87
+ }
88
+
89
+ plot.unlockCrosshair = function unlockCrosshair() {
90
+ crosshair.locked = false;
91
+ }
92
+
93
+ plot.hooks.bindEvents.push(function (plot, eventHolder) {
94
+ if (!plot.getOptions().crosshair.mode)
95
+ return;
96
+
97
+ eventHolder.mouseout(function () {
98
+ if (crosshair.x != -1) {
99
+ crosshair.x = -1;
100
+ plot.triggerRedrawOverlay();
101
+ }
102
+ });
103
+
104
+ eventHolder.mousemove(function (e) {
105
+ if (plot.getSelection && plot.getSelection()) {
106
+ crosshair.x = -1; // hide the crosshair while selecting
107
+ return;
108
+ }
109
+
110
+ if (crosshair.locked)
111
+ return;
112
+
113
+ var offset = plot.offset();
114
+ crosshair.x = Math.max(0, Math.min(e.pageX - offset.left, plot.width()));
115
+ crosshair.y = Math.max(0, Math.min(e.pageY - offset.top, plot.height()));
116
+ plot.triggerRedrawOverlay();
117
+ });
118
+ });
119
+
120
+ plot.hooks.drawOverlay.push(function (plot, ctx) {
121
+ var c = plot.getOptions().crosshair;
122
+ if (!c.mode)
123
+ return;
124
+
125
+ var plotOffset = plot.getPlotOffset();
126
+
127
+ ctx.save();
128
+ ctx.translate(plotOffset.left, plotOffset.top);
129
+
130
+ if (crosshair.x != -1) {
131
+ ctx.strokeStyle = c.color;
132
+ ctx.lineWidth = c.lineWidth;
133
+ ctx.lineJoin = "round";
134
+
135
+ ctx.beginPath();
136
+ if (c.mode.indexOf("x") != -1) {
137
+ ctx.moveTo(crosshair.x, 0);
138
+ ctx.lineTo(crosshair.x, plot.height());
139
+ }
140
+ if (c.mode.indexOf("y") != -1) {
141
+ ctx.moveTo(0, crosshair.y);
142
+ ctx.lineTo(plot.width(), crosshair.y);
143
+ }
144
+ ctx.stroke();
145
+ }
146
+ ctx.restore();
147
+ });
148
+ }
149
+
150
+ $.plot.plugins.push({
151
+ init: init,
152
+ options: options,
153
+ name: 'crosshair',
154
+ version: '1.0'
155
+ });
156
+ })(jQuery);
@@ -0,0 +1 @@
1
+ (function(B){var A={crosshair:{mode:null,color:"rgba(170, 0, 0, 0.80)",lineWidth:1}};function C(G){var H={x:-1,y:-1,locked:false};G.setCrosshair=function D(J){if(!J){H.x=-1}else{var I=G.getAxes();H.x=Math.max(0,Math.min(J.x!=null?I.xaxis.p2c(J.x):I.x2axis.p2c(J.x2),G.width()));H.y=Math.max(0,Math.min(J.y!=null?I.yaxis.p2c(J.y):I.y2axis.p2c(J.y2),G.height()))}G.triggerRedrawOverlay()};G.clearCrosshair=G.setCrosshair;G.lockCrosshair=function E(I){if(I){G.setCrosshair(I)}H.locked=true};G.unlockCrosshair=function F(){H.locked=false};G.hooks.bindEvents.push(function(J,I){if(!J.getOptions().crosshair.mode){return }I.mouseout(function(){if(H.x!=-1){H.x=-1;J.triggerRedrawOverlay()}});I.mousemove(function(K){if(J.getSelection&&J.getSelection()){H.x=-1;return }if(H.locked){return }var L=J.offset();H.x=Math.max(0,Math.min(K.pageX-L.left,J.width()));H.y=Math.max(0,Math.min(K.pageY-L.top,J.height()));J.triggerRedrawOverlay()})});G.hooks.drawOverlay.push(function(K,I){var L=K.getOptions().crosshair;if(!L.mode){return }var J=K.getPlotOffset();I.save();I.translate(J.left,J.top);if(H.x!=-1){I.strokeStyle=L.color;I.lineWidth=L.lineWidth;I.lineJoin="round";I.beginPath();if(L.mode.indexOf("x")!=-1){I.moveTo(H.x,0);I.lineTo(H.x,K.height())}if(L.mode.indexOf("y")!=-1){I.moveTo(0,H.y);I.lineTo(K.width(),H.y)}I.stroke()}I.restore()})}B.plot.plugins.push({init:C,options:A,name:"crosshair",version:"1.0"})})(jQuery);
@@ -0,0 +1,237 @@
1
+ /*
2
+ Flot plugin for plotting images, e.g. useful for putting ticks on a
3
+ prerendered complex visualization.
4
+
5
+ The data syntax is [[image, x1, y1, x2, y2], ...] where (x1, y1) and
6
+ (x2, y2) are where you intend the two opposite corners of the image to
7
+ end up in the plot. Image must be a fully loaded Javascript image (you
8
+ can make one with new Image()). If the image is not complete, it's
9
+ skipped when plotting.
10
+
11
+ There are two helpers included for retrieving images. The easiest work
12
+ the way that you put in URLs instead of images in the data (like
13
+ ["myimage.png", 0, 0, 10, 10]), then call $.plot.image.loadData(data,
14
+ options, callback) where data and options are the same as you pass in
15
+ to $.plot. This loads the images, replaces the URLs in the data with
16
+ the corresponding images and calls "callback" when all images are
17
+ loaded (or failed loading). In the callback, you can then call $.plot
18
+ with the data set. See the included example.
19
+
20
+ A more low-level helper, $.plot.image.load(urls, callback) is also
21
+ included. Given a list of URLs, it calls callback with an object
22
+ mapping from URL to Image object when all images are loaded or have
23
+ failed loading.
24
+
25
+ Options for the plugin are
26
+
27
+ series: {
28
+ images: {
29
+ show: boolean
30
+ anchor: "corner" or "center"
31
+ alpha: [0,1]
32
+ }
33
+ }
34
+
35
+ which can be specified for a specific series
36
+
37
+ $.plot($("#placeholder"), [{ data: [ ... ], images: { ... } ])
38
+
39
+ Note that because the data format is different from usual data points,
40
+ you can't use images with anything else in a specific data series.
41
+
42
+ Setting "anchor" to "center" causes the pixels in the image to be
43
+ anchored at the corner pixel centers inside of at the pixel corners,
44
+ effectively letting half a pixel stick out to each side in the plot.
45
+
46
+
47
+ A possible future direction could be support for tiling for large
48
+ images (like Google Maps).
49
+
50
+ */
51
+
52
+ (function ($) {
53
+ var options = {
54
+ series: {
55
+ images: {
56
+ show: false,
57
+ alpha: 1,
58
+ anchor: "corner" // or "center"
59
+ }
60
+ }
61
+ };
62
+
63
+ $.plot.image = {};
64
+
65
+ $.plot.image.loadDataImages = function (series, options, callback) {
66
+ var urls = [], points = [];
67
+
68
+ var defaultShow = options.series.images.show;
69
+
70
+ $.each(series, function (i, s) {
71
+ if (!(defaultShow || s.images.show))
72
+ return;
73
+
74
+ if (s.data)
75
+ s = s.data;
76
+
77
+ $.each(s, function (i, p) {
78
+ if (typeof p[0] == "string") {
79
+ urls.push(p[0]);
80
+ points.push(p);
81
+ }
82
+ });
83
+ });
84
+
85
+ $.plot.image.load(urls, function (loadedImages) {
86
+ $.each(points, function (i, p) {
87
+ var url = p[0];
88
+ if (loadedImages[url])
89
+ p[0] = loadedImages[url];
90
+ });
91
+
92
+ callback();
93
+ });
94
+ }
95
+
96
+ $.plot.image.load = function (urls, callback) {
97
+ var missing = urls.length, loaded = {};
98
+ if (missing == 0)
99
+ callback({});
100
+
101
+ $.each(urls, function (i, url) {
102
+ var handler = function () {
103
+ --missing;
104
+
105
+ loaded[url] = this;
106
+
107
+ if (missing == 0)
108
+ callback(loaded);
109
+ };
110
+
111
+ $('<img />').load(handler).error(handler).attr('src', url);
112
+ });
113
+ }
114
+
115
+ function draw(plot, ctx) {
116
+ var plotOffset = plot.getPlotOffset();
117
+
118
+ $.each(plot.getData(), function (i, series) {
119
+ var points = series.datapoints.points,
120
+ ps = series.datapoints.pointsize;
121
+
122
+ for (var i = 0; i < points.length; i += ps) {
123
+ var img = points[i],
124
+ x1 = points[i + 1], y1 = points[i + 2],
125
+ x2 = points[i + 3], y2 = points[i + 4],
126
+ xaxis = series.xaxis, yaxis = series.yaxis,
127
+ tmp;
128
+
129
+ // actually we should check img.complete, but it
130
+ // appears to be a somewhat unreliable indicator in
131
+ // IE6 (false even after load event)
132
+ if (!img || img.width <= 0 || img.height <= 0)
133
+ continue;
134
+
135
+ if (x1 > x2) {
136
+ tmp = x2;
137
+ x2 = x1;
138
+ x1 = tmp;
139
+ }
140
+ if (y1 > y2) {
141
+ tmp = y2;
142
+ y2 = y1;
143
+ y1 = tmp;
144
+ }
145
+
146
+ // if the anchor is at the center of the pixel, expand the
147
+ // image by 1/2 pixel in each direction
148
+ if (series.images.anchor == "center") {
149
+ tmp = 0.5 * (x2-x1) / (img.width - 1);
150
+ x1 -= tmp;
151
+ x2 += tmp;
152
+ tmp = 0.5 * (y2-y1) / (img.height - 1);
153
+ y1 -= tmp;
154
+ y2 += tmp;
155
+ }
156
+
157
+ // clip
158
+ if (x1 == x2 || y1 == y2 ||
159
+ x1 >= xaxis.max || x2 <= xaxis.min ||
160
+ y1 >= yaxis.max || y2 <= yaxis.min)
161
+ continue;
162
+
163
+ var sx1 = 0, sy1 = 0, sx2 = img.width, sy2 = img.height;
164
+ if (x1 < xaxis.min) {
165
+ sx1 += (sx2 - sx1) * (xaxis.min - x1) / (x2 - x1);
166
+ x1 = xaxis.min;
167
+ }
168
+
169
+ if (x2 > xaxis.max) {
170
+ sx2 += (sx2 - sx1) * (xaxis.max - x2) / (x2 - x1);
171
+ x2 = xaxis.max;
172
+ }
173
+
174
+ if (y1 < yaxis.min) {
175
+ sy2 += (sy1 - sy2) * (yaxis.min - y1) / (y2 - y1);
176
+ y1 = yaxis.min;
177
+ }
178
+
179
+ if (y2 > yaxis.max) {
180
+ sy1 += (sy1 - sy2) * (yaxis.max - y2) / (y2 - y1);
181
+ y2 = yaxis.max;
182
+ }
183
+
184
+ x1 = xaxis.p2c(x1);
185
+ x2 = xaxis.p2c(x2);
186
+ y1 = yaxis.p2c(y1);
187
+ y2 = yaxis.p2c(y2);
188
+
189
+ // the transformation may have swapped us
190
+ if (x1 > x2) {
191
+ tmp = x2;
192
+ x2 = x1;
193
+ x1 = tmp;
194
+ }
195
+ if (y1 > y2) {
196
+ tmp = y2;
197
+ y2 = y1;
198
+ y1 = tmp;
199
+ }
200
+
201
+ tmp = ctx.globalAlpha;
202
+ ctx.globalAlpha *= series.images.alpha;
203
+ ctx.drawImage(img,
204
+ sx1, sy1, sx2 - sx1, sy2 - sy1,
205
+ x1 + plotOffset.left, y1 + plotOffset.top,
206
+ x2 - x1, y2 - y1);
207
+ ctx.globalAlpha = tmp;
208
+ }
209
+ });
210
+ }
211
+
212
+ function processRawData(plot, series, data, datapoints) {
213
+ if (!series.images.show)
214
+ return;
215
+
216
+ // format is Image, x1, y1, x2, y2 (opposite corners)
217
+ datapoints.format = [
218
+ { required: true },
219
+ { x: true, number: true, required: true },
220
+ { y: true, number: true, required: true },
221
+ { x: true, number: true, required: true },
222
+ { y: true, number: true, required: true }
223
+ ];
224
+ }
225
+
226
+ function init(plot) {
227
+ plot.hooks.processRawData.push(processRawData);
228
+ plot.hooks.draw.push(draw);
229
+ }
230
+
231
+ $.plot.plugins.push({
232
+ init: init,
233
+ options: options,
234
+ name: 'image',
235
+ version: '1.1'
236
+ });
237
+ })(jQuery);