brilliant_cms 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +37 -0
  5. data/app/assets/images/brilliant_cms/bootstrap-colorpicker/alpha-horizontal.png +0 -0
  6. data/app/assets/images/brilliant_cms/bootstrap-colorpicker/alpha.png +0 -0
  7. data/app/assets/images/brilliant_cms/bootstrap-colorpicker/hue-horizontal.png +0 -0
  8. data/app/assets/images/brilliant_cms/bootstrap-colorpicker/hue.png +0 -0
  9. data/app/assets/images/brilliant_cms/bootstrap-colorpicker/saturation.png +0 -0
  10. data/app/assets/images/brilliant_cms/light-bulb.svg +38 -0
  11. data/app/assets/images/brilliant_cms/user.png +0 -0
  12. data/app/assets/javascripts/brilliant_cms/application.js +6 -0
  13. data/app/assets/javascripts/brilliant_cms/dashboard.js +2 -0
  14. data/app/assets/javascripts/brilliant_cms/data/flot.js +58 -0
  15. data/app/assets/javascripts/brilliant_cms/data/gauge.js +21 -0
  16. data/app/assets/javascripts/brilliant_cms/data/linegraphs.coffee +23 -0
  17. data/app/assets/javascripts/brilliant_cms/data/load.js +1 -0
  18. data/app/assets/javascripts/brilliant_cms/data/map.coffee +17 -0
  19. data/app/assets/javascripts/brilliant_cms/datepicker.coffee +107 -0
  20. data/app/assets/javascripts/brilliant_cms/entries.js +2 -0
  21. data/app/assets/javascripts/brilliant_cms/skycons.coffee +18 -0
  22. data/app/assets/javascripts/brilliant_cms/vendor/bootstrap-progressbar.min.js +2 -0
  23. data/app/assets/javascripts/brilliant_cms/vendor/chart.min.js +11 -0
  24. data/app/assets/javascripts/brilliant_cms/vendor/daterangepicker.js +1 -0
  25. data/app/assets/javascripts/brilliant_cms/vendor/flot/a.jquery.flot.js +2 -0
  26. data/app/assets/javascripts/brilliant_cms/vendor/flot/b.jquery.flot.pie.js +820 -0
  27. data/app/assets/javascripts/brilliant_cms/vendor/flot/c.jquery.flot.orderBars.js +187 -0
  28. data/app/assets/javascripts/brilliant_cms/vendor/flot/d.jquery.flot.time.min.js +1 -0
  29. data/app/assets/javascripts/brilliant_cms/vendor/flot/e.date.js +104 -0
  30. data/app/assets/javascripts/brilliant_cms/vendor/flot/f.jquery.flot.spline.js +212 -0
  31. data/app/assets/javascripts/brilliant_cms/vendor/flot/g.jquery.flot.stack.js +188 -0
  32. data/app/assets/javascripts/brilliant_cms/vendor/flot/h.curvedLines.js +483 -0
  33. data/app/assets/javascripts/brilliant_cms/vendor/flot/i.jquery.flot.resize.js +57 -0
  34. data/app/assets/javascripts/brilliant_cms/vendor/flot/jquery.flot.tooltip.min.js +12 -0
  35. data/app/assets/javascripts/brilliant_cms/vendor/gauge.min.js +61 -0
  36. data/app/assets/javascripts/brilliant_cms/vendor/jquery.nicescroll.min.js +111 -0
  37. data/app/assets/javascripts/brilliant_cms/vendor/load.js +11 -0
  38. data/app/assets/javascripts/brilliant_cms/vendor/maps/jquery-jvectormap.js +2 -0
  39. data/app/assets/javascripts/brilliant_cms/vendor/maps/jvectormap-us-aea-en.js +1 -0
  40. data/app/assets/javascripts/brilliant_cms/vendor/maps/jvectormap-world-mill-en.js +1 -0
  41. data/app/assets/javascripts/brilliant_cms/vendor/maps/z.gdp-data.js +185 -0
  42. data/app/assets/javascripts/brilliant_cms/vendor/moment.js +3606 -0
  43. data/app/assets/javascripts/brilliant_cms/vendor/nprogress.js +491 -0
  44. data/app/assets/javascripts/brilliant_cms/vendor/skycons.js +730 -0
  45. data/app/assets/javascripts/brilliant_cms/vendor/template.js +317 -0
  46. data/app/assets/stylesheets/brilliant_cms/application.css +6 -0
  47. data/app/assets/stylesheets/brilliant_cms/dashboard.css +4 -0
  48. data/app/assets/stylesheets/brilliant_cms/entries.css +4 -0
  49. data/app/assets/stylesheets/brilliant_cms/layout.scss +6389 -0
  50. data/app/assets/stylesheets/brilliant_cms/vendor/animate.min.css +11 -0
  51. data/app/assets/stylesheets/brilliant_cms/vendor/maps/jquery-jvectormap-2.0.1.css +129 -0
  52. data/app/controllers/brilliant_cms/application_controller.rb +35 -0
  53. data/app/controllers/brilliant_cms/dashboard_controller.rb +12 -0
  54. data/app/controllers/brilliant_cms/entries_controller.rb +87 -0
  55. data/app/controllers/brilliant_cms/registrations_controller.rb +19 -0
  56. data/app/helpers/brilliant_cms/application_helper.rb +9 -0
  57. data/app/helpers/brilliant_cms/dashboard_helper.rb +4 -0
  58. data/app/helpers/brilliant_cms/entries_helper.rb +4 -0
  59. data/app/models/brilliant_cms/article.rb +9 -0
  60. data/app/models/brilliant_cms/blog_link.rb +10 -0
  61. data/app/models/brilliant_cms/blog_post.rb +9 -0
  62. data/app/models/brilliant_cms/concerns/searchable.rb +37 -0
  63. data/app/models/brilliant_cms/entry.rb +25 -0
  64. data/app/models/brilliant_cms/entry_search_data.rb +19 -0
  65. data/app/models/brilliant_cms/user.rb +8 -0
  66. data/app/views/brilliant_cms/dashboard/index.html.erb +0 -0
  67. data/app/views/brilliant_cms/entries/_form.html.erb +21 -0
  68. data/app/views/brilliant_cms/entries/edit.html.erb +6 -0
  69. data/app/views/brilliant_cms/entries/index.html.erb +38 -0
  70. data/app/views/brilliant_cms/entries/new.html.erb +3 -0
  71. data/app/views/brilliant_cms/entries/show.html.erb +28 -0
  72. data/app/views/layouts/brilliant_cms/_footer.html.erb +10 -0
  73. data/app/views/layouts/brilliant_cms/_notifications.html.erb +6 -0
  74. data/app/views/layouts/brilliant_cms/_sidemenu.html.erb +87 -0
  75. data/app/views/layouts/brilliant_cms/_topbar.html.erb +31 -0
  76. data/app/views/layouts/brilliant_cms/application.html.erb +40 -0
  77. data/config/initializers/assets.rb +1 -0
  78. data/config/initializers/devise.rb +267 -0
  79. data/config/initializers/simple_form.rb +165 -0
  80. data/config/initializers/simple_form_bootstrap.rb +149 -0
  81. data/config/locales/devise.en.yml +62 -0
  82. data/config/locales/simple_form.en.yml +31 -0
  83. data/config/routes.rb +27 -0
  84. data/db/migrate/20160218214729_create_brilliant_cms_entries.rb +15 -0
  85. data/db/migrate/20160219045419_create_brilliant_cms_entry_search_data.rb +14 -0
  86. data/db/migrate/20160219065450_devise_create_brilliant_cms_users.rb +42 -0
  87. data/lib/brilliant_cms.rb +6 -0
  88. data/lib/brilliant_cms/configuration.rb +17 -0
  89. data/lib/brilliant_cms/engine.rb +11 -0
  90. data/lib/brilliant_cms/version.rb +3 -0
  91. data/lib/tasks/brilliant_cms_tasks.rake +4 -0
  92. data/lib/templates/erb/scaffold/_form.html.erb +13 -0
  93. data/test/brilliant_cms_test.rb +7 -0
  94. data/test/controllers/brilliant_cms/dashboard_controller_test.rb +13 -0
  95. data/test/controllers/brilliant_cms/entries_controller_test.rb +13 -0
  96. data/test/dummy/README.rdoc +28 -0
  97. data/test/dummy/Rakefile +6 -0
  98. data/test/dummy/app/assets/javascripts/application.js +13 -0
  99. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  100. data/test/dummy/app/controllers/application_controller.rb +5 -0
  101. data/test/dummy/app/helpers/application_helper.rb +2 -0
  102. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  103. data/test/dummy/bin/bundle +3 -0
  104. data/test/dummy/bin/rails +4 -0
  105. data/test/dummy/bin/rake +4 -0
  106. data/test/dummy/bin/setup +29 -0
  107. data/test/dummy/config.ru +4 -0
  108. data/test/dummy/config/application.rb +26 -0
  109. data/test/dummy/config/boot.rb +5 -0
  110. data/test/dummy/config/database.yml +85 -0
  111. data/test/dummy/config/environment.rb +5 -0
  112. data/test/dummy/config/environments/development.rb +41 -0
  113. data/test/dummy/config/environments/production.rb +79 -0
  114. data/test/dummy/config/environments/test.rb +42 -0
  115. data/test/dummy/config/initializers/assets.rb +11 -0
  116. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  117. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  118. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  119. data/test/dummy/config/initializers/inflections.rb +16 -0
  120. data/test/dummy/config/initializers/mime_types.rb +4 -0
  121. data/test/dummy/config/initializers/session_store.rb +3 -0
  122. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  123. data/test/dummy/config/locales/en.yml +23 -0
  124. data/test/dummy/config/routes.rb +4 -0
  125. data/test/dummy/config/secrets.yml +22 -0
  126. data/test/dummy/public/404.html +67 -0
  127. data/test/dummy/public/422.html +67 -0
  128. data/test/dummy/public/500.html +66 -0
  129. data/test/dummy/public/favicon.ico +0 -0
  130. data/test/fixtures/brilliant_cms/entries.yml +11 -0
  131. data/test/fixtures/brilliant_cms/entry_search_data.yml +13 -0
  132. data/test/fixtures/brilliant_cms/users.yml +11 -0
  133. data/test/integration/navigation_test.rb +8 -0
  134. data/test/models/brilliant_cms/entry_search_data_test.rb +9 -0
  135. data/test/models/brilliant_cms/entry_test.rb +9 -0
  136. data/test/models/brilliant_cms/user_test.rb +9 -0
  137. data/test/test_helper.rb +21 -0
  138. metadata +407 -0
@@ -0,0 +1,187 @@
1
+ /*
2
+ * Flot plugin to order bars side by side.
3
+ *
4
+ * Released under the MIT license by Benjamin BUFFET, 20-Sep-2010.
5
+ *
6
+ * This plugin is an alpha version.
7
+ *
8
+ * To activate the plugin you must specify the parameter "order" for the specific serie :
9
+ *
10
+ * $.plot($("#placeholder"), [{ data: [ ... ], bars :{ order = null or integer }])
11
+ *
12
+ * If 2 series have the same order param, they are ordered by the position in the array;
13
+ *
14
+ * The plugin adjust the point by adding a value depanding of the barwidth
15
+ * Exemple for 3 series (barwidth : 0.1) :
16
+ *
17
+ * first bar décalage : -0.15
18
+ * second bar décalage : -0.05
19
+ * third bar décalage : 0.05
20
+ *
21
+ */
22
+
23
+ (function($){
24
+ function init(plot){
25
+ var orderedBarSeries;
26
+ var nbOfBarsToOrder;
27
+ var borderWidth;
28
+ var borderWidthInXabsWidth;
29
+ var pixelInXWidthEquivalent = 1;
30
+ var isHorizontal = false;
31
+
32
+ /*
33
+ * This method add shift to x values
34
+ */
35
+ function reOrderBars(plot, serie, datapoints){
36
+ var shiftedPoints = null;
37
+
38
+ if(serieNeedToBeReordered(serie)){
39
+ checkIfGraphIsHorizontal(serie);
40
+ calculPixel2XWidthConvert(plot);
41
+ retrieveBarSeries(plot);
42
+ calculBorderAndBarWidth(serie);
43
+
44
+ if(nbOfBarsToOrder >= 2){
45
+ var position = findPosition(serie);
46
+ var decallage = 0;
47
+
48
+ var centerBarShift = calculCenterBarShift();
49
+
50
+ if (isBarAtLeftOfCenter(position)){
51
+ decallage = -1*(sumWidth(orderedBarSeries,position-1,Math.floor(nbOfBarsToOrder / 2)-1)) - centerBarShift;
52
+ }else{
53
+ decallage = sumWidth(orderedBarSeries,Math.ceil(nbOfBarsToOrder / 2),position-2) + centerBarShift + borderWidthInXabsWidth*2;
54
+ }
55
+
56
+ shiftedPoints = shiftPoints(datapoints,serie,decallage);
57
+ datapoints.points = shiftedPoints;
58
+ }
59
+ }
60
+ return shiftedPoints;
61
+ }
62
+
63
+ function serieNeedToBeReordered(serie){
64
+ return serie.bars != null
65
+ && serie.bars.show
66
+ && serie.bars.order != null;
67
+ }
68
+
69
+ function calculPixel2XWidthConvert(plot){
70
+ var gridDimSize = isHorizontal ? plot.getPlaceholder().innerHeight() : plot.getPlaceholder().innerWidth();
71
+ var minMaxValues = isHorizontal ? getAxeMinMaxValues(plot.getData(),1) : getAxeMinMaxValues(plot.getData(),0);
72
+ var AxeSize = minMaxValues[1] - minMaxValues[0];
73
+ pixelInXWidthEquivalent = AxeSize / gridDimSize;
74
+ }
75
+
76
+ function getAxeMinMaxValues(series,AxeIdx){
77
+ var minMaxValues = new Array();
78
+ for(var i = 0; i < series.length; i++){
79
+ minMaxValues[0] = series[i].data[0][AxeIdx];
80
+ minMaxValues[1] = series[i].data[series[i].data.length - 1][AxeIdx];
81
+ }
82
+ return minMaxValues;
83
+ }
84
+
85
+ function retrieveBarSeries(plot){
86
+ orderedBarSeries = findOthersBarsToReOrders(plot.getData());
87
+ nbOfBarsToOrder = orderedBarSeries.length;
88
+ }
89
+
90
+ function findOthersBarsToReOrders(series){
91
+ var retSeries = new Array();
92
+
93
+ for(var i = 0; i < series.length; i++){
94
+ if(series[i].bars.order != null && series[i].bars.show){
95
+ retSeries.push(series[i]);
96
+ }
97
+ }
98
+
99
+ return retSeries.sort(sortByOrder);
100
+ }
101
+
102
+ function sortByOrder(serie1,serie2){
103
+ var x = serie1.bars.order;
104
+ var y = serie2.bars.order;
105
+ return ((x < y) ? -1 : ((x > y) ? 1 : 0));
106
+ }
107
+
108
+ function calculBorderAndBarWidth(serie){
109
+ borderWidth = serie.bars.lineWidth ? serie.bars.lineWidth : 2;
110
+ borderWidthInXabsWidth = borderWidth * pixelInXWidthEquivalent;
111
+ }
112
+
113
+ function checkIfGraphIsHorizontal(serie){
114
+ if(serie.bars.horizontal){
115
+ isHorizontal = true;
116
+ }
117
+ }
118
+
119
+ function findPosition(serie){
120
+ var pos = 0
121
+ for (var i = 0; i < orderedBarSeries.length; ++i) {
122
+ if (serie == orderedBarSeries[i]){
123
+ pos = i;
124
+ break;
125
+ }
126
+ }
127
+
128
+ return pos+1;
129
+ }
130
+
131
+ function calculCenterBarShift(){
132
+ var width = 0;
133
+
134
+ if(nbOfBarsToOrder%2 != 0)
135
+ width = (orderedBarSeries[Math.ceil(nbOfBarsToOrder / 2)].bars.barWidth)/2;
136
+
137
+ return width;
138
+ }
139
+
140
+ function isBarAtLeftOfCenter(position){
141
+ return position <= Math.ceil(nbOfBarsToOrder / 2);
142
+ }
143
+
144
+ function sumWidth(series,start,end){
145
+ var totalWidth = 0;
146
+
147
+ for(var i = start; i <= end; i++){
148
+ totalWidth += series[i].bars.barWidth+borderWidthInXabsWidth*2;
149
+ }
150
+
151
+ return totalWidth;
152
+ }
153
+
154
+ function shiftPoints(datapoints,serie,dx){
155
+ var ps = datapoints.pointsize;
156
+ var points = datapoints.points;
157
+ var j = 0;
158
+ for(var i = isHorizontal ? 1 : 0;i < points.length; i += ps){
159
+ points[i] += dx;
160
+ //Adding the new x value in the serie to be abble to display the right tooltip value,
161
+ //using the index 3 to not overide the third index.
162
+ serie.data[j][3] = points[i];
163
+ j++;
164
+ }
165
+
166
+ return points;
167
+ }
168
+
169
+ plot.hooks.processDatapoints.push(reOrderBars);
170
+
171
+ }
172
+
173
+ var options = {
174
+ series : {
175
+ bars: {order: null} // or number/string
176
+ }
177
+ };
178
+
179
+ $.plot.plugins.push({
180
+ init: init,
181
+ options: options,
182
+ name: "orderBars",
183
+ version: "0.2"
184
+ });
185
+
186
+ })(jQuery)
187
+
@@ -0,0 +1 @@
1
+ (function(a){var i={};function d(k,j){return j*Math.floor(k/j)}function h(q,l,o,k){if(typeof q.strftime=="function"){return q.strftime(l)}var u=function(w,r){w=""+w;r=""+(r==null?"0":r);return w.length==1?r+w:w};var j=[];var v=false;var t=q.getHours();var p=t<12;if(o==null){o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}if(k==null){k=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]}var m;if(t>12){m=t-12}else{if(t==0){m=12}else{m=t}}for(var n=0;n<l.length;++n){var s=l.charAt(n);if(v){switch(s){case"a":s=""+k[q.getDay()];break;case"b":s=""+o[q.getMonth()];break;case"d":s=u(q.getDate());break;case"e":s=u(q.getDate()," ");break;case"H":s=u(t);break;case"I":s=u(m);break;case"l":s=u(m," ");break;case"m":s=u(q.getMonth()+1);break;case"M":s=u(q.getMinutes());break;case"S":s=u(q.getSeconds());break;case"y":s=u(q.getFullYear()%100);break;case"Y":s=""+q.getFullYear();break;case"p":s=(p)?("am"):("pm");break;case"P":s=(p)?("AM"):("PM");break;case"w":s=""+q.getDay();break}j.push(s);v=false}else{if(s=="%"){v=true}else{j.push(s)}}}return j.join("")}function g(n){function j(q,p,o,r){q[p]=function(){return o[r].apply(o,arguments)}}var l={date:n};if(n.strftime!=undefined){j(l,"strftime",n,"strftime")}j(l,"getTime",n,"getTime");j(l,"setTime",n,"setTime");var k=["Date","Day","FullYear","Hours","Milliseconds","Minutes","Month","Seconds"];for(var m=0;m<k.length;m++){j(l,"get"+k[m],n,"getUTC"+k[m]);j(l,"set"+k[m],n,"setUTC"+k[m])}return l}function c(k,j){if(j.timezone=="browser"){return new Date(k)}else{if(!j.timezone||j.timezone=="utc"){return g(new Date(k))}else{if(typeof timezoneJS!="undefined"&&typeof timezoneJS.Date!="undefined"){var l=new timezoneJS.Date();l.setTimezone(j.timezone);l.setTime(k);return l}else{return g(new Date(k))}}}}var b={second:1000,minute:60*1000,hour:60*60*1000,day:24*60*60*1000,month:30*24*60*60*1000,year:365.2425*24*60*60*1000};var e=[[1,"second"],[2,"second"],[5,"second"],[10,"second"],[30,"second"],[1,"minute"],[2,"minute"],[5,"minute"],[10,"minute"],[30,"minute"],[1,"hour"],[2,"hour"],[4,"hour"],[8,"hour"],[12,"hour"],[1,"day"],[2,"day"],[3,"day"],[0.25,"month"],[0.5,"month"],[1,"month"],[2,"month"],[3,"month"],[6,"month"],[1,"year"]];function f(j){j.hooks.processDatapoints.push(function(m,k,l){a.each(m.getAxes(),function(p,n){var o=n.options;if(o.mode=="time"){n.tickGenerator=function(w){var C=[],B=c(w.min,o),t=0;if(o.minTickSize!=null){if(typeof o.tickSize=="number"){t=o.tickSize}else{t=o.minTickSize[0]*b[o.minTickSize[1]]}}for(var A=0;A<e.length-1;++A){if(w.delta<(e[A][0]*b[e[A][1]]+e[A+1][0]*b[e[A+1][1]])/2&&e[A][0]*b[e[A][1]]>=t){break}}var G=e[A][0];var D=e[A][1];if(D=="year"){if(o.minTickSize!=null&&o.minTickSize[1]=="year"){G=Math.floor(o.minTickSize[0])}else{var r=Math.pow(10,Math.floor(Math.log(w.delta/b.year)/Math.LN10));var q=(w.delta/b.year)/r;if(q<1.5){G=1}else{if(q<3){G=2}else{if(q<7.5){G=5}else{G=10}}}G*=r}if(G<1){G=1}}w.tickSize=o.tickSize||[G,D];var z=w.tickSize[0];D=w.tickSize[1];var u=z*b[D];if(D=="second"){B.setSeconds(d(B.getSeconds(),z))}if(D=="minute"){B.setMinutes(d(B.getMinutes(),z))}if(D=="hour"){B.setHours(d(B.getHours(),z))}if(D=="month"){B.setMonth(d(B.getMonth(),z))}if(D=="year"){B.setFullYear(d(B.getFullYear(),z))}B.setMilliseconds(0);if(u>=b.minute){B.setSeconds(0)}if(u>=b.hour){B.setMinutes(0)}if(u>=b.day){B.setHours(0)}if(u>=b.day*4){B.setDate(1)}if(u>=b.year){B.setMonth(0)}var F=0,E=Number.NaN,x;do{x=E;E=B.getTime();C.push(E);if(D=="month"){if(z<1){B.setDate(1);var s=B.getTime();B.setMonth(B.getMonth()+1);var y=B.getTime();B.setTime(E+F*b.hour+(y-s)*z);F=B.getHours();B.setHours(0)}else{B.setMonth(B.getMonth()+z)}}else{if(D=="year"){B.setFullYear(B.getFullYear()+z)}else{B.setTime(E+u)}}}while(E<w.max&&E!=x);return C};n.tickFormatter=function(r,w){var y=c(r,w.options);if(o.timeformat!=null){return h(y,o.timeformat,o.monthNames,o.dayNames)}var s=w.tickSize[0]*b[w.tickSize[1]];var u=w.max-w.min;var x=(o.twelveHourClock)?" %p":"";var z=(o.twelveHourClock)?"%I":"%H";if(s<b.minute){fmt=z+":%M:%S"+x}else{if(s<b.day){if(u<2*b.day){fmt=z+":%M"+x}else{fmt="%b %d "+z+":%M"+x}}else{if(s<b.month){fmt="%b %d"}else{if(s<b.year){if(u<b.year){fmt="%b"}else{fmt="%b %Y"}}else{fmt="%Y"}}}}var q=h(y,fmt,o.monthNames,o.dayNames);return q}}})})}a.plot.plugins.push({init:f,options:i,name:"time",version:"1.0"})})(jQuery);
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Version: 1.0 Alpha-1
3
+ * Build Date: 13-Nov-2007
4
+ * Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved.
5
+ * License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/.
6
+ * Website: http://www.datejs.com/ or http://www.coolite.com/datejs/
7
+ */
8
+ Date.CultureInfo={name:"en-US",englishName:"English (United States)",nativeName:"English (United States)",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortestDayNames:["Su","Mo","Tu","We","Th","Fr","Sa"],firstLetterDayNames:["S","M","T","W","T","F","S"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],amDesignator:"AM",pmDesignator:"PM",firstDayOfWeek:0,twoDigitYearMax:2029,dateElementOrder:"mdy",formatPatterns:{shortDate:"M/d/yyyy",longDate:"dddd, MMMM dd, yyyy",shortTime:"h:mm tt",longTime:"h:mm:ss tt",fullDateTime:"dddd, MMMM dd, yyyy h:mm:ss tt",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"MMMM dd",yearMonth:"MMMM, yyyy"},regexPatterns:{jan:/^jan(uary)?/i,feb:/^feb(ruary)?/i,mar:/^mar(ch)?/i,apr:/^apr(il)?/i,may:/^may/i,jun:/^jun(e)?/i,jul:/^jul(y)?/i,aug:/^aug(ust)?/i,sep:/^sep(t(ember)?)?/i,oct:/^oct(ober)?/i,nov:/^nov(ember)?/i,dec:/^dec(ember)?/i,sun:/^su(n(day)?)?/i,mon:/^mo(n(day)?)?/i,tue:/^tu(e(s(day)?)?)?/i,wed:/^we(d(nesday)?)?/i,thu:/^th(u(r(s(day)?)?)?)?/i,fri:/^fr(i(day)?)?/i,sat:/^sa(t(urday)?)?/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|after|from)/i,subtract:/^(\-|before|ago)/i,yesterday:/^yesterday/i,today:/^t(oday)?/i,tomorrow:/^tomorrow/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^min(ute)?s?/i,hour:/^h(ou)?rs?/i,week:/^w(ee)?k/i,month:/^m(o(nth)?s?)?/i,day:/^d(ays?)?/i,year:/^y((ea)?rs?)?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a|p)/i},abbreviatedTimeZoneStandard:{GMT:"-000",EST:"-0400",CST:"-0500",MST:"-0600",PST:"-0700"},abbreviatedTimeZoneDST:{GMT:"-000",EDT:"-0500",CDT:"-0600",MDT:"-0700",PDT:"-0800"}};
9
+ Date.getMonthNumberFromName=function(name){var n=Date.CultureInfo.monthNames,m=Date.CultureInfo.abbreviatedMonthNames,s=name.toLowerCase();for(var i=0;i<n.length;i++){if(n[i].toLowerCase()==s||m[i].toLowerCase()==s){return i;}}
10
+ return-1;};Date.getDayNumberFromName=function(name){var n=Date.CultureInfo.dayNames,m=Date.CultureInfo.abbreviatedDayNames,o=Date.CultureInfo.shortestDayNames,s=name.toLowerCase();for(var i=0;i<n.length;i++){if(n[i].toLowerCase()==s||m[i].toLowerCase()==s){return i;}}
11
+ return-1;};Date.isLeapYear=function(year){return(((year%4===0)&&(year%100!==0))||(year%400===0));};Date.getDaysInMonth=function(year,month){return[31,(Date.isLeapYear(year)?29:28),31,30,31,30,31,31,30,31,30,31][month];};Date.getTimezoneOffset=function(s,dst){return(dst||false)?Date.CultureInfo.abbreviatedTimeZoneDST[s.toUpperCase()]:Date.CultureInfo.abbreviatedTimeZoneStandard[s.toUpperCase()];};Date.getTimezoneAbbreviation=function(offset,dst){var n=(dst||false)?Date.CultureInfo.abbreviatedTimeZoneDST:Date.CultureInfo.abbreviatedTimeZoneStandard,p;for(p in n){if(n[p]===offset){return p;}}
12
+ return null;};Date.prototype.clone=function(){return new Date(this.getTime());};Date.prototype.compareTo=function(date){if(isNaN(this)){throw new Error(this);}
13
+ if(date instanceof Date&&!isNaN(date)){return(this>date)?1:(this<date)?-1:0;}else{throw new TypeError(date);}};Date.prototype.equals=function(date){return(this.compareTo(date)===0);};Date.prototype.between=function(start,end){var t=this.getTime();return t>=start.getTime()&&t<=end.getTime();};Date.prototype.addMilliseconds=function(value){this.setMilliseconds(this.getMilliseconds()+value);return this;};Date.prototype.addSeconds=function(value){return this.addMilliseconds(value*1000);};Date.prototype.addMinutes=function(value){return this.addMilliseconds(value*60000);};Date.prototype.addHours=function(value){return this.addMilliseconds(value*3600000);};Date.prototype.addDays=function(value){return this.addMilliseconds(value*86400000);};Date.prototype.addWeeks=function(value){return this.addMilliseconds(value*604800000);};Date.prototype.addMonths=function(value){var n=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+value);this.setDate(Math.min(n,this.getDaysInMonth()));return this;};Date.prototype.addYears=function(value){return this.addMonths(value*12);};Date.prototype.add=function(config){if(typeof config=="number"){this._orient=config;return this;}
14
+ var x=config;if(x.millisecond||x.milliseconds){this.addMilliseconds(x.millisecond||x.milliseconds);}
15
+ if(x.second||x.seconds){this.addSeconds(x.second||x.seconds);}
16
+ if(x.minute||x.minutes){this.addMinutes(x.minute||x.minutes);}
17
+ if(x.hour||x.hours){this.addHours(x.hour||x.hours);}
18
+ if(x.month||x.months){this.addMonths(x.month||x.months);}
19
+ if(x.year||x.years){this.addYears(x.year||x.years);}
20
+ if(x.day||x.days){this.addDays(x.day||x.days);}
21
+ return this;};Date._validate=function(value,min,max,name){if(typeof value!="number"){throw new TypeError(value+" is not a Number.");}else if(value<min||value>max){throw new RangeError(value+" is not a valid value for "+name+".");}
22
+ return true;};Date.validateMillisecond=function(n){return Date._validate(n,0,999,"milliseconds");};Date.validateSecond=function(n){return Date._validate(n,0,59,"seconds");};Date.validateMinute=function(n){return Date._validate(n,0,59,"minutes");};Date.validateHour=function(n){return Date._validate(n,0,23,"hours");};Date.validateDay=function(n,year,month){return Date._validate(n,1,Date.getDaysInMonth(year,month),"days");};Date.validateMonth=function(n){return Date._validate(n,0,11,"months");};Date.validateYear=function(n){return Date._validate(n,1,9999,"seconds");};Date.prototype.set=function(config){var x=config;if(!x.millisecond&&x.millisecond!==0){x.millisecond=-1;}
23
+ if(!x.second&&x.second!==0){x.second=-1;}
24
+ if(!x.minute&&x.minute!==0){x.minute=-1;}
25
+ if(!x.hour&&x.hour!==0){x.hour=-1;}
26
+ if(!x.day&&x.day!==0){x.day=-1;}
27
+ if(!x.month&&x.month!==0){x.month=-1;}
28
+ if(!x.year&&x.year!==0){x.year=-1;}
29
+ if(x.millisecond!=-1&&Date.validateMillisecond(x.millisecond)){this.addMilliseconds(x.millisecond-this.getMilliseconds());}
30
+ if(x.second!=-1&&Date.validateSecond(x.second)){this.addSeconds(x.second-this.getSeconds());}
31
+ if(x.minute!=-1&&Date.validateMinute(x.minute)){this.addMinutes(x.minute-this.getMinutes());}
32
+ if(x.hour!=-1&&Date.validateHour(x.hour)){this.addHours(x.hour-this.getHours());}
33
+ if(x.month!==-1&&Date.validateMonth(x.month)){this.addMonths(x.month-this.getMonth());}
34
+ if(x.year!=-1&&Date.validateYear(x.year)){this.addYears(x.year-this.getFullYear());}
35
+ if(x.day!=-1&&Date.validateDay(x.day,this.getFullYear(),this.getMonth())){this.addDays(x.day-this.getDate());}
36
+ if(x.timezone){this.setTimezone(x.timezone);}
37
+ if(x.timezoneOffset){this.setTimezoneOffset(x.timezoneOffset);}
38
+ return this;};Date.prototype.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this;};Date.prototype.isLeapYear=function(){var y=this.getFullYear();return(((y%4===0)&&(y%100!==0))||(y%400===0));};Date.prototype.isWeekday=function(){return!(this.is().sat()||this.is().sun());};Date.prototype.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth());};Date.prototype.moveToFirstDayOfMonth=function(){return this.set({day:1});};Date.prototype.moveToLastDayOfMonth=function(){return this.set({day:this.getDaysInMonth()});};Date.prototype.moveToDayOfWeek=function(day,orient){var diff=(day-this.getDay()+7*(orient||+1))%7;return this.addDays((diff===0)?diff+=7*(orient||+1):diff);};Date.prototype.moveToMonth=function(month,orient){var diff=(month-this.getMonth()+12*(orient||+1))%12;return this.addMonths((diff===0)?diff+=12*(orient||+1):diff);};Date.prototype.getDayOfYear=function(){return Math.floor((this-new Date(this.getFullYear(),0,1))/86400000);};Date.prototype.getWeekOfYear=function(firstDayOfWeek){var y=this.getFullYear(),m=this.getMonth(),d=this.getDate();var dow=firstDayOfWeek||Date.CultureInfo.firstDayOfWeek;var offset=7+1-new Date(y,0,1).getDay();if(offset==8){offset=1;}
39
+ var daynum=((Date.UTC(y,m,d,0,0,0)-Date.UTC(y,0,1,0,0,0))/86400000)+1;var w=Math.floor((daynum-offset+7)/7);if(w===dow){y--;var prevOffset=7+1-new Date(y,0,1).getDay();if(prevOffset==2||prevOffset==8){w=53;}else{w=52;}}
40
+ return w;};Date.prototype.isDST=function(){console.log('isDST');return this.toString().match(/(E|C|M|P)(S|D)T/)[2]=="D";};Date.prototype.getTimezone=function(){return Date.getTimezoneAbbreviation(this.getUTCOffset,this.isDST());};Date.prototype.setTimezoneOffset=function(s){var here=this.getTimezoneOffset(),there=Number(s)*-6/10;this.addMinutes(there-here);return this;};Date.prototype.setTimezone=function(s){return this.setTimezoneOffset(Date.getTimezoneOffset(s));};Date.prototype.getUTCOffset=function(){var n=this.getTimezoneOffset()*-10/6,r;if(n<0){r=(n-10000).toString();return r[0]+r.substr(2);}else{r=(n+10000).toString();return"+"+r.substr(1);}};Date.prototype.getDayName=function(abbrev){return abbrev?Date.CultureInfo.abbreviatedDayNames[this.getDay()]:Date.CultureInfo.dayNames[this.getDay()];};Date.prototype.getMonthName=function(abbrev){return abbrev?Date.CultureInfo.abbreviatedMonthNames[this.getMonth()]:Date.CultureInfo.monthNames[this.getMonth()];};Date.prototype._toString=Date.prototype.toString;Date.prototype.toString=function(format){var self=this;var p=function p(s){return(s.toString().length==1)?"0"+s:s;};return format?format.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g,function(format){switch(format){case"hh":return p(self.getHours()<13?self.getHours():(self.getHours()-12));case"h":return self.getHours()<13?self.getHours():(self.getHours()-12);case"HH":return p(self.getHours());case"H":return self.getHours();case"mm":return p(self.getMinutes());case"m":return self.getMinutes();case"ss":return p(self.getSeconds());case"s":return self.getSeconds();case"yyyy":return self.getFullYear();case"yy":return self.getFullYear().toString().substring(2,4);case"dddd":return self.getDayName();case"ddd":return self.getDayName(true);case"dd":return p(self.getDate());case"d":return self.getDate().toString();case"MMMM":return self.getMonthName();case"MMM":return self.getMonthName(true);case"MM":return p((self.getMonth()+1));case"M":return self.getMonth()+1;case"t":return self.getHours()<12?Date.CultureInfo.amDesignator.substring(0,1):Date.CultureInfo.pmDesignator.substring(0,1);case"tt":return self.getHours()<12?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;case"zzz":case"zz":case"z":return"";}}):this._toString();};
41
+ Date.now=function(){return new Date();};Date.today=function(){return Date.now().clearTime();};Date.prototype._orient=+1;Date.prototype.next=function(){this._orient=+1;return this;};Date.prototype.last=Date.prototype.prev=Date.prototype.previous=function(){this._orient=-1;return this;};Date.prototype._is=false;Date.prototype.is=function(){this._is=true;return this;};Number.prototype._dateElement="day";Number.prototype.fromNow=function(){var c={};c[this._dateElement]=this;return Date.now().add(c);};Number.prototype.ago=function(){var c={};c[this._dateElement]=this*-1;return Date.now().add(c);};(function(){var $D=Date.prototype,$N=Number.prototype;var dx=("sunday monday tuesday wednesday thursday friday saturday").split(/\s/),mx=("january february march april may june july august september october november december").split(/\s/),px=("Millisecond Second Minute Hour Day Week Month Year").split(/\s/),de;var df=function(n){return function(){if(this._is){this._is=false;return this.getDay()==n;}
42
+ return this.moveToDayOfWeek(n,this._orient);};};for(var i=0;i<dx.length;i++){$D[dx[i]]=$D[dx[i].substring(0,3)]=df(i);}
43
+ var mf=function(n){return function(){if(this._is){this._is=false;return this.getMonth()===n;}
44
+ return this.moveToMonth(n,this._orient);};};for(var j=0;j<mx.length;j++){$D[mx[j]]=$D[mx[j].substring(0,3)]=mf(j);}
45
+ var ef=function(j){return function(){if(j.substring(j.length-1)!="s"){j+="s";}
46
+ return this["add"+j](this._orient);};};var nf=function(n){return function(){this._dateElement=n;return this;};};for(var k=0;k<px.length;k++){de=px[k].toLowerCase();$D[de]=$D[de+"s"]=ef(px[k]);$N[de]=$N[de+"s"]=nf(de);}}());Date.prototype.toJSONString=function(){return this.toString("yyyy-MM-ddThh:mm:ssZ");};Date.prototype.toShortDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortDatePattern);};Date.prototype.toLongDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.longDatePattern);};Date.prototype.toShortTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortTimePattern);};Date.prototype.toLongTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.longTimePattern);};Date.prototype.getOrdinal=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th";}};
47
+ (function(){Date.Parsing={Exception:function(s){this.message="Parse error at '"+s.substring(0,10)+" ...'";}};var $P=Date.Parsing;var _=$P.Operators={rtoken:function(r){return function(s){var mx=s.match(r);if(mx){return([mx[0],s.substring(mx[0].length)]);}else{throw new $P.Exception(s);}};},token:function(s){return function(s){return _.rtoken(new RegExp("^\s*"+s+"\s*"))(s);};},stoken:function(s){return _.rtoken(new RegExp("^"+s));},until:function(p){return function(s){var qx=[],rx=null;while(s.length){try{rx=p.call(this,s);}catch(e){qx.push(rx[0]);s=rx[1];continue;}
48
+ break;}
49
+ return[qx,s];};},many:function(p){return function(s){var rx=[],r=null;while(s.length){try{r=p.call(this,s);}catch(e){return[rx,s];}
50
+ rx.push(r[0]);s=r[1];}
51
+ return[rx,s];};},optional:function(p){return function(s){var r=null;try{r=p.call(this,s);}catch(e){return[null,s];}
52
+ return[r[0],r[1]];};},not:function(p){return function(s){try{p.call(this,s);}catch(e){return[null,s];}
53
+ throw new $P.Exception(s);};},ignore:function(p){return p?function(s){var r=null;r=p.call(this,s);return[null,r[1]];}:null;},product:function(){var px=arguments[0],qx=Array.prototype.slice.call(arguments,1),rx=[];for(var i=0;i<px.length;i++){rx.push(_.each(px[i],qx));}
54
+ return rx;},cache:function(rule){var cache={},r=null;return function(s){try{r=cache[s]=(cache[s]||rule.call(this,s));}catch(e){r=cache[s]=e;}
55
+ if(r instanceof $P.Exception){throw r;}else{return r;}};},any:function(){var px=arguments;return function(s){var r=null;for(var i=0;i<px.length;i++){if(px[i]==null){continue;}
56
+ try{r=(px[i].call(this,s));}catch(e){r=null;}
57
+ if(r){return r;}}
58
+ throw new $P.Exception(s);};},each:function(){var px=arguments;return function(s){var rx=[],r=null;for(var i=0;i<px.length;i++){if(px[i]==null){continue;}
59
+ try{r=(px[i].call(this,s));}catch(e){throw new $P.Exception(s);}
60
+ rx.push(r[0]);s=r[1];}
61
+ return[rx,s];};},all:function(){var px=arguments,_=_;return _.each(_.optional(px));},sequence:function(px,d,c){d=d||_.rtoken(/^\s*/);c=c||null;if(px.length==1){return px[0];}
62
+ return function(s){var r=null,q=null;var rx=[];for(var i=0;i<px.length;i++){try{r=px[i].call(this,s);}catch(e){break;}
63
+ rx.push(r[0]);try{q=d.call(this,r[1]);}catch(ex){q=null;break;}
64
+ s=q[1];}
65
+ if(!r){throw new $P.Exception(s);}
66
+ if(q){throw new $P.Exception(q[1]);}
67
+ if(c){try{r=c.call(this,r[1]);}catch(ey){throw new $P.Exception(r[1]);}}
68
+ return[rx,(r?r[1]:s)];};},between:function(d1,p,d2){d2=d2||d1;var _fn=_.each(_.ignore(d1),p,_.ignore(d2));return function(s){var rx=_fn.call(this,s);return[[rx[0][0],r[0][2]],rx[1]];};},list:function(p,d,c){d=d||_.rtoken(/^\s*/);c=c||null;return(p instanceof Array?_.each(_.product(p.slice(0,-1),_.ignore(d)),p.slice(-1),_.ignore(c)):_.each(_.many(_.each(p,_.ignore(d))),px,_.ignore(c)));},set:function(px,d,c){d=d||_.rtoken(/^\s*/);c=c||null;return function(s){var r=null,p=null,q=null,rx=null,best=[[],s],last=false;for(var i=0;i<px.length;i++){q=null;p=null;r=null;last=(px.length==1);try{r=px[i].call(this,s);}catch(e){continue;}
69
+ rx=[[r[0]],r[1]];if(r[1].length>0&&!last){try{q=d.call(this,r[1]);}catch(ex){last=true;}}else{last=true;}
70
+ if(!last&&q[1].length===0){last=true;}
71
+ if(!last){var qx=[];for(var j=0;j<px.length;j++){if(i!=j){qx.push(px[j]);}}
72
+ p=_.set(qx,d).call(this,q[1]);if(p[0].length>0){rx[0]=rx[0].concat(p[0]);rx[1]=p[1];}}
73
+ if(rx[1].length<best[1].length){best=rx;}
74
+ if(best[1].length===0){break;}}
75
+ if(best[0].length===0){return best;}
76
+ if(c){try{q=c.call(this,best[1]);}catch(ey){throw new $P.Exception(best[1]);}
77
+ best[1]=q[1];}
78
+ return best;};},forward:function(gr,fname){return function(s){return gr[fname].call(this,s);};},replace:function(rule,repl){return function(s){var r=rule.call(this,s);return[repl,r[1]];};},process:function(rule,fn){return function(s){var r=rule.call(this,s);return[fn.call(this,r[0]),r[1]];};},min:function(min,rule){return function(s){var rx=rule.call(this,s);if(rx[0].length<min){throw new $P.Exception(s);}
79
+ return rx;};}};var _generator=function(op){return function(){var args=null,rx=[];if(arguments.length>1){args=Array.prototype.slice.call(arguments);}else if(arguments[0]instanceof Array){args=arguments[0];}
80
+ if(args){for(var i=0,px=args.shift();i<px.length;i++){args.unshift(px[i]);rx.push(op.apply(null,args));args.shift();return rx;}}else{return op.apply(null,arguments);}};};var gx="optional not ignore cache".split(/\s/);for(var i=0;i<gx.length;i++){_[gx[i]]=_generator(_[gx[i]]);}
81
+ var _vector=function(op){return function(){if(arguments[0]instanceof Array){return op.apply(null,arguments[0]);}else{return op.apply(null,arguments);}};};var vx="each any all".split(/\s/);for(var j=0;j<vx.length;j++){_[vx[j]]=_vector(_[vx[j]]);}}());(function(){var flattenAndCompact=function(ax){var rx=[];for(var i=0;i<ax.length;i++){if(ax[i]instanceof Array){rx=rx.concat(flattenAndCompact(ax[i]));}else{if(ax[i]){rx.push(ax[i]);}}}
82
+ return rx;};Date.Grammar={};Date.Translator={hour:function(s){return function(){this.hour=Number(s);};},minute:function(s){return function(){this.minute=Number(s);};},second:function(s){return function(){this.second=Number(s);};},meridian:function(s){return function(){this.meridian=s.slice(0,1).toLowerCase();};},timezone:function(s){return function(){var n=s.replace(/[^\d\+\-]/g,"");if(n.length){this.timezoneOffset=Number(n);}else{this.timezone=s.toLowerCase();}};},day:function(x){var s=x[0];return function(){this.day=Number(s.match(/\d+/)[0]);};},month:function(s){return function(){this.month=((s.length==3)?Date.getMonthNumberFromName(s):(Number(s)-1));};},year:function(s){return function(){var n=Number(s);this.year=((s.length>2)?n:(n+(((n+2000)<Date.CultureInfo.twoDigitYearMax)?2000:1900)));};},rday:function(s){return function(){switch(s){case"yesterday":this.days=-1;break;case"tomorrow":this.days=1;break;case"today":this.days=0;break;case"now":this.days=0;this.now=true;break;}};},finishExact:function(x){x=(x instanceof Array)?x:[x];var now=new Date();this.year=now.getFullYear();this.month=now.getMonth();this.day=1;this.hour=0;this.minute=0;this.second=0;for(var i=0;i<x.length;i++){if(x[i]){x[i].call(this);}}
83
+ this.hour=(this.meridian=="p"&&this.hour<13)?this.hour+12:this.hour;if(this.day>Date.getDaysInMonth(this.year,this.month)){throw new RangeError(this.day+" is not a valid value for days.");}
84
+ var r=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);if(this.timezone){r.set({timezone:this.timezone});}else if(this.timezoneOffset){r.set({timezoneOffset:this.timezoneOffset});}
85
+ return r;},finish:function(x){x=(x instanceof Array)?flattenAndCompact(x):[x];if(x.length===0){return null;}
86
+ for(var i=0;i<x.length;i++){if(typeof x[i]=="function"){x[i].call(this);}}
87
+ if(this.now){return new Date();}
88
+ var today=Date.today();var method=null;var expression=!!(this.days!=null||this.orient||this.operator);if(expression){var gap,mod,orient;orient=((this.orient=="past"||this.operator=="subtract")?-1:1);if(this.weekday){this.unit="day";gap=(Date.getDayNumberFromName(this.weekday)-today.getDay());mod=7;this.days=gap?((gap+(orient*mod))%mod):(orient*mod);}
89
+ if(this.month){this.unit="month";gap=(this.month-today.getMonth());mod=12;this.months=gap?((gap+(orient*mod))%mod):(orient*mod);this.month=null;}
90
+ if(!this.unit){this.unit="day";}
91
+ if(this[this.unit+"s"]==null||this.operator!=null){if(!this.value){this.value=1;}
92
+ if(this.unit=="week"){this.unit="day";this.value=this.value*7;}
93
+ this[this.unit+"s"]=this.value*orient;}
94
+ return today.add(this);}else{if(this.meridian&&this.hour){this.hour=(this.hour<13&&this.meridian=="p")?this.hour+12:this.hour;}
95
+ if(this.weekday&&!this.day){this.day=(today.addDays((Date.getDayNumberFromName(this.weekday)-today.getDay()))).getDate();}
96
+ if(this.month&&!this.day){this.day=1;}
97
+ return today.set(this);}}};var _=Date.Parsing.Operators,g=Date.Grammar,t=Date.Translator,_fn;g.datePartDelimiter=_.rtoken(/^([\s\-\.\,\/\x27]+)/);g.timePartDelimiter=_.stoken(":");g.whiteSpace=_.rtoken(/^\s*/);g.generalDelimiter=_.rtoken(/^(([\s\,]|at|on)+)/);var _C={};g.ctoken=function(keys){var fn=_C[keys];if(!fn){var c=Date.CultureInfo.regexPatterns;var kx=keys.split(/\s+/),px=[];for(var i=0;i<kx.length;i++){px.push(_.replace(_.rtoken(c[kx[i]]),kx[i]));}
98
+ fn=_C[keys]=_.any.apply(null,px);}
99
+ return fn;};g.ctoken2=function(key){return _.rtoken(Date.CultureInfo.regexPatterns[key]);};g.h=_.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),t.hour));g.hh=_.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2])/),t.hour));g.H=_.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),t.hour));g.HH=_.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3])/),t.hour));g.m=_.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/),t.minute));g.mm=_.cache(_.process(_.rtoken(/^[0-5][0-9]/),t.minute));g.s=_.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/),t.second));g.ss=_.cache(_.process(_.rtoken(/^[0-5][0-9]/),t.second));g.hms=_.cache(_.sequence([g.H,g.mm,g.ss],g.timePartDelimiter));g.t=_.cache(_.process(g.ctoken2("shortMeridian"),t.meridian));g.tt=_.cache(_.process(g.ctoken2("longMeridian"),t.meridian));g.z=_.cache(_.process(_.rtoken(/^(\+|\-)?\s*\d\d\d\d?/),t.timezone));g.zz=_.cache(_.process(_.rtoken(/^(\+|\-)\s*\d\d\d\d/),t.timezone));g.zzz=_.cache(_.process(g.ctoken2("timezone"),t.timezone));g.timeSuffix=_.each(_.ignore(g.whiteSpace),_.set([g.tt,g.zzz]));g.time=_.each(_.optional(_.ignore(_.stoken("T"))),g.hms,g.timeSuffix);g.d=_.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1]|\d)/),_.optional(g.ctoken2("ordinalSuffix"))),t.day));g.dd=_.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1])/),_.optional(g.ctoken2("ordinalSuffix"))),t.day));g.ddd=g.dddd=_.cache(_.process(g.ctoken("sun mon tue wed thu fri sat"),function(s){return function(){this.weekday=s;};}));g.M=_.cache(_.process(_.rtoken(/^(1[0-2]|0\d|\d)/),t.month));g.MM=_.cache(_.process(_.rtoken(/^(1[0-2]|0\d)/),t.month));g.MMM=g.MMMM=_.cache(_.process(g.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),t.month));g.y=_.cache(_.process(_.rtoken(/^(\d\d?)/),t.year));g.yy=_.cache(_.process(_.rtoken(/^(\d\d)/),t.year));g.yyy=_.cache(_.process(_.rtoken(/^(\d\d?\d?\d?)/),t.year));g.yyyy=_.cache(_.process(_.rtoken(/^(\d\d\d\d)/),t.year));_fn=function(){return _.each(_.any.apply(null,arguments),_.not(g.ctoken2("timeContext")));};g.day=_fn(g.d,g.dd);g.month=_fn(g.M,g.MMM);g.year=_fn(g.yyyy,g.yy);g.orientation=_.process(g.ctoken("past future"),function(s){return function(){this.orient=s;};});g.operator=_.process(g.ctoken("add subtract"),function(s){return function(){this.operator=s;};});g.rday=_.process(g.ctoken("yesterday tomorrow today now"),t.rday);g.unit=_.process(g.ctoken("minute hour day week month year"),function(s){return function(){this.unit=s;};});g.value=_.process(_.rtoken(/^\d\d?(st|nd|rd|th)?/),function(s){return function(){this.value=s.replace(/\D/g,"");};});g.expression=_.set([g.rday,g.operator,g.value,g.unit,g.orientation,g.ddd,g.MMM]);_fn=function(){return _.set(arguments,g.datePartDelimiter);};g.mdy=_fn(g.ddd,g.month,g.day,g.year);g.ymd=_fn(g.ddd,g.year,g.month,g.day);g.dmy=_fn(g.ddd,g.day,g.month,g.year);g.date=function(s){return((g[Date.CultureInfo.dateElementOrder]||g.mdy).call(this,s));};g.format=_.process(_.many(_.any(_.process(_.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),function(fmt){if(g[fmt]){return g[fmt];}else{throw Date.Parsing.Exception(fmt);}}),_.process(_.rtoken(/^[^dMyhHmstz]+/),function(s){return _.ignore(_.stoken(s));}))),function(rules){return _.process(_.each.apply(null,rules),t.finishExact);});var _F={};var _get=function(f){return _F[f]=(_F[f]||g.format(f)[0]);};g.formats=function(fx){if(fx instanceof Array){var rx=[];for(var i=0;i<fx.length;i++){rx.push(_get(fx[i]));}
100
+ return _.any.apply(null,rx);}else{return _get(fx);}};g._formats=g.formats(["yyyy-MM-ddTHH:mm:ss","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz","d"]);g._start=_.process(_.set([g.date,g.time,g.expression],g.generalDelimiter,g.whiteSpace),t.finish);g.start=function(s){try{var r=g._formats.call({},s);if(r[1].length===0){return r;}}catch(e){}
101
+ return g._start.call({},s);};}());Date._parse=Date.parse;Date.parse=function(s){var r=null;if(!s){return null;}
102
+ try{r=Date.Grammar.start.call({},s);}catch(e){return null;}
103
+ return((r[1].length===0)?r[0]:null);};Date.getParseFunction=function(fx){var fn=Date.Grammar.formats(fx);return function(s){var r=null;try{r=fn.call({},s);}catch(e){return null;}
104
+ return((r[1].length===0)?r[0]:null);};};Date.parseExact=function(s,fx){return Date.getParseFunction(fx)(s);};
@@ -0,0 +1,212 @@
1
+ /**
2
+ * Flot plugin that provides spline interpolation for line graphs
3
+ * author: Alex Bardas < alex.bardas@gmail.com >
4
+ * modified by: Avi Kohn https://github.com/AMKohn
5
+ * based on the spline interpolation described at:
6
+ * http://scaledinnovation.com/analytics/splines/aboutSplines.html
7
+ *
8
+ * Example usage: (add in plot options series object)
9
+ * for linespline:
10
+ * series: {
11
+ * ...
12
+ * lines: {
13
+ * show: false
14
+ * },
15
+ * splines: {
16
+ * show: true,
17
+ * tension: x, (float between 0 and 1, defaults to 0.5),
18
+ * lineWidth: y (number, defaults to 2),
19
+ * fill: z (float between 0 .. 1 or false, as in flot documentation)
20
+ * },
21
+ * ...
22
+ * }
23
+ * areaspline:
24
+ * series: {
25
+ * ...
26
+ * lines: {
27
+ * show: true,
28
+ * lineWidth: 0, (line drawing will not execute)
29
+ * fill: x, (float between 0 .. 1, as in flot documentation)
30
+ * ...
31
+ * },
32
+ * splines: {
33
+ * show: true,
34
+ * tension: 0.5 (float between 0 and 1)
35
+ * },
36
+ * ...
37
+ * }
38
+ *
39
+ */
40
+
41
+ (function($) {
42
+ 'use strict'
43
+
44
+ /**
45
+ * @param {Number} x0, y0, x1, y1: coordinates of the end (knot) points of the segment
46
+ * @param {Number} x2, y2: the next knot (not connected, but needed to calculate p2)
47
+ * @param {Number} tension: control how far the control points spread
48
+ * @return {Array}: p1 -> control point, from x1 back toward x0
49
+ * p2 -> the next control point, returned to become the next segment's p1
50
+ *
51
+ * @api private
52
+ */
53
+ function getControlPoints(x0, y0, x1, y1, x2, y2, tension) {
54
+
55
+ var pow = Math.pow,
56
+ sqrt = Math.sqrt,
57
+ d01, d12, fa, fb, p1x, p1y, p2x, p2y;
58
+
59
+ // Scaling factors: distances from this knot to the previous and following knots.
60
+ d01 = sqrt(pow(x1 - x0, 2) + pow(y1 - y0, 2));
61
+ d12 = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
62
+
63
+ fa = tension * d01 / (d01 + d12);
64
+ fb = tension - fa;
65
+
66
+ p1x = x1 + fa * (x0 - x2);
67
+ p1y = y1 + fa * (y0 - y2);
68
+
69
+ p2x = x1 - fb * (x0 - x2);
70
+ p2y = y1 - fb * (y0 - y2);
71
+
72
+ return [p1x, p1y, p2x, p2y];
73
+ }
74
+
75
+ var line = [];
76
+
77
+ function drawLine(points, ctx, height, fill, seriesColor) {
78
+ var c = $.color.parse(seriesColor);
79
+
80
+ c.a = typeof fill == "number" ? fill : .3;
81
+ c.normalize();
82
+ c = c.toString();
83
+
84
+ ctx.beginPath();
85
+ ctx.moveTo(points[0][0], points[0][1]);
86
+
87
+ var plength = points.length;
88
+
89
+ for (var i = 0; i < plength; i++) {
90
+ ctx[points[i][3]].apply(ctx, points[i][2]);
91
+ }
92
+
93
+ ctx.stroke();
94
+
95
+ ctx.lineWidth = 0;
96
+ ctx.lineTo(points[plength - 1][0], height);
97
+ ctx.lineTo(points[0][0], height);
98
+
99
+ ctx.closePath();
100
+
101
+ if (fill !== false) {
102
+ ctx.fillStyle = c;
103
+ ctx.fill();
104
+ }
105
+ }
106
+
107
+ /**
108
+ * @param {Object} ctx: canvas context
109
+ * @param {String} type: accepted strings: 'bezier' or 'quadratic' (defaults to quadratic)
110
+ * @param {Array} points: 2 points for which to draw the interpolation
111
+ * @param {Array} cpoints: control points for those segment points
112
+ *
113
+ * @api private
114
+ */
115
+ function queue(ctx, type, points, cpoints) {
116
+ if (type === void 0 || (type !== 'bezier' && type !== 'quadratic')) {
117
+ type = 'quadratic';
118
+ }
119
+ type = type + 'CurveTo';
120
+
121
+ if (line.length == 0) line.push([points[0], points[1], cpoints.concat(points.slice(2)), type]);
122
+ else if (type == "quadraticCurveTo" && points.length == 2) {
123
+ cpoints = cpoints.slice(0, 2).concat(points);
124
+
125
+ line.push([points[0], points[1], cpoints, type]);
126
+ }
127
+ else line.push([points[2], points[3], cpoints.concat(points.slice(2)), type]);
128
+ }
129
+
130
+ /**
131
+ * @param {Object} plot
132
+ * @param {Object} ctx: canvas context
133
+ * @param {Object} series
134
+ *
135
+ * @api private
136
+ */
137
+
138
+ function drawSpline(plot, ctx, series) {
139
+ // Not interested if spline is not requested
140
+ if (series.splines.show !== true) {
141
+ return;
142
+ }
143
+
144
+ var cp = [],
145
+ // array of control points
146
+ tension = series.splines.tension || 0.5,
147
+ idx, x, y, points = series.datapoints.points,
148
+ ps = series.datapoints.pointsize,
149
+ plotOffset = plot.getPlotOffset(),
150
+ len = points.length,
151
+ pts = [];
152
+
153
+ line = [];
154
+
155
+ // Cannot display a linespline/areaspline if there are less than 3 points
156
+ if (len / ps < 4) {
157
+ $.extend(series.lines, series.splines);
158
+ return;
159
+ }
160
+
161
+ for (idx = 0; idx < len; idx += ps) {
162
+ x = points[idx];
163
+ y = points[idx + 1];
164
+ if (x == null || x < series.xaxis.min || x > series.xaxis.max || y < series.yaxis.min || y > series.yaxis.max) {
165
+ continue;
166
+ }
167
+
168
+ pts.push(series.xaxis.p2c(x) + plotOffset.left, series.yaxis.p2c(y) + plotOffset.top);
169
+ }
170
+
171
+ len = pts.length;
172
+
173
+ // Draw an open curve, not connected at the ends
174
+ for (idx = 0; idx < len - 2; idx += 2) {
175
+ cp = cp.concat(getControlPoints.apply(this, pts.slice(idx, idx + 6).concat([tension])));
176
+ }
177
+
178
+ ctx.save();
179
+ ctx.strokeStyle = series.color;
180
+ ctx.lineWidth = series.splines.lineWidth;
181
+
182
+ queue(ctx, 'quadratic', pts.slice(0, 4), cp.slice(0, 2));
183
+
184
+ for (idx = 2; idx < len - 3; idx += 2) {
185
+ queue(ctx, 'bezier', pts.slice(idx, idx + 4), cp.slice(2 * idx - 2, 2 * idx + 2));
186
+ }
187
+
188
+ queue(ctx, 'quadratic', pts.slice(len - 2, len), [cp[2 * len - 10], cp[2 * len - 9], pts[len - 4], pts[len - 3]]);
189
+
190
+ drawLine(line, ctx, plot.height() + 10, series.splines.fill, series.color);
191
+
192
+ ctx.restore();
193
+ }
194
+
195
+ $.plot.plugins.push({
196
+ init: function(plot) {
197
+ plot.hooks.drawSeries.push(drawSpline);
198
+ },
199
+ options: {
200
+ series: {
201
+ splines: {
202
+ show: false,
203
+ lineWidth: 2,
204
+ tension: 0.5,
205
+ fill: false
206
+ }
207
+ }
208
+ },
209
+ name: 'spline',
210
+ version: '0.8.2'
211
+ });
212
+ })(jQuery);