diff --git a/mdot/mDotServer.censis/mDotServer.censis/.vs/HIE/v14/.suo b/mdot/mDotServer.censis/mDotServer.censis/.vs/HIE/v14/.suo new file mode 100644 index 0000000..40615a7 Binary files /dev/null and b/mdot/mDotServer.censis/mDotServer.censis/.vs/HIE/v14/.suo differ diff --git a/mdot/mDotServer.censis/mDotServer.censis/.vs/config/applicationhost.config b/mdot/mDotServer.censis/mDotServer.censis/.vs/config/applicationhost.config new file mode 100644 index 0000000..628b5a2 --- /dev/null +++ b/mdot/mDotServer.censis/mDotServer.censis/.vs/config/applicationhost.config @@ -0,0 +1,1038 @@ + + + + + + + + +
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+ + +
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mdot/mDotServer.censis/mDotServer.censis/HIE.sln b/mdot/mDotServer.censis/mDotServer.censis/HIE.sln new file mode 100644 index 0000000..cac7c9e --- /dev/null +++ b/mdot/mDotServer.censis/mDotServer.censis/HIE.sln @@ -0,0 +1,38 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "HIE(1)", "..\HIE", "{272EFB2D-871A-406F-8462-AF9CFE10C6A7}" + ProjectSection(WebsiteProperties) = preProject + TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0" + Debug.AspNetCompiler.VirtualPath = "/localhost_49439" + Debug.AspNetCompiler.PhysicalPath = "..\HIE\" + Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_49439\" + Debug.AspNetCompiler.Updateable = "true" + Debug.AspNetCompiler.ForceOverwrite = "true" + Debug.AspNetCompiler.FixedNames = "false" + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.VirtualPath = "/localhost_49439" + Release.AspNetCompiler.PhysicalPath = "..\HIE\" + Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_49439\" + Release.AspNetCompiler.Updateable = "true" + Release.AspNetCompiler.ForceOverwrite = "true" + Release.AspNetCompiler.FixedNames = "false" + Release.AspNetCompiler.Debug = "False" + VWDPort = "49439" + SlnRelativePath = "..\HIE\" + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {272EFB2D-871A-406F-8462-AF9CFE10C6A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {272EFB2D-871A-406F-8462-AF9CFE10C6A7}.Debug|Any CPU.Build.0 = Debug|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/css/flatWeatherPlugin.css b/mdot/mDotServer.censis/mDotServer.censis/app/css/flatWeatherPlugin.css new file mode 100644 index 0000000..136c2f7 --- /dev/null +++ b/mdot/mDotServer.censis/mDotServer.censis/app/css/flatWeatherPlugin.css @@ -0,0 +1,644 @@ +/*************************************************************************************************/ +/* Global - Base */ +/*************************************************************************************************/ +@font-face { + font-family: 'weathericons'; + src: url('../fonts/weathericons-regular-webfont.eot'); + src: url('../fonts/weathericons-regular-webfont.eot?#iefix') format('embedded-opentype'), url('../fonts/weathericons-regular-webfont.woff') format('woff'), url('../fonts/weathericons-regular-webfont.ttf') format('truetype'), url('../fonts/weathericons-regular-webfont.svg#weathericons-regular-webfontRg') format('svg'); + font-weight: normal; + font-style: normal; +} + +.wi:before, .wi:after { + display: inline-block; + font-family: 'weathericons'; + font-style: normal; + font-weight: normal; + line-height: 1; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + + +.flatWeatherPlugin { + font-size: inherit; + width: 100%; +} + +.flatWeatherPlugin p, .flatWeatherPlugin h2, .flatWeatherPlugin h3, .flatWeatherPlugin ul, .flatWeatherPlugin li { + padding: 0; + margin: 0; + color: inherit; +} + +#flatWeatherLoading.loading { + font-size: 90px; + text-align: center; + padding: 10px; + overflow: hidden; + -webkit-animation:spin 2s linear infinite; + -moz-animation:spin 2s linear infinite; + animation:spin 2s linear infinite; + opacity: 0.2; +} +@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } } +@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } } +@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } } + +.flatWeatherPlugin h2 { + margin: 0 0 5px 0; +} + +.flatWeatherPlugin .wiToday { + width: 100%; + overflow: hidden; +} + +.flatWeatherPlugin .wiToday > .wiIconGroup { + float: right; + width: 50%; + text-align: center; +} + +.flatWeatherPlugin .wiToday > .wiIconGroup p { + width: 100%; + color: inherit; + line-height: 1em; + padding: 6px 0 0 0; +} + + +.flatWeatherPlugin .wiToday .wiIconGroup div.wi { + font-size: 400%; + line-height: 1.45em; + width: 100%; +} + +.flatWeatherPlugin .wiToday .wiIconGroup div.wi:before { + vertical-align: text-bottom; +} + +.flatWeatherPlugin .clearfix:after { + content: " "; + display: table; + clear: both; +} + +.flatWeatherPlugin div.wiToday > p.wiTemperature { + font-size: 400%; + line-height: 1.45em; + float: left; + width: 50%; + text-align: center; + color: inherit; +} + +.flatWeatherPlugin sup { + opacity: 0.7; + font-size: 65%; + vertical-align: baseline; + top: -0.5em; + position: relative; +} + +.flatWeatherPlugin .wiDetail { + overflow: hidden; + width: 100%; + padding-bottom: 5px; +} + +.flatWeatherPlugin.today .wiDetail { + padding-top: 10px; +} + +.flatWeatherPlugin .wiDetail p.wiDay { + font-weight: bold; + margin: 5px 0 2px 0; + text-align: left; + color: inherit; +} + +.flatWeatherPlugin.partial .wiToday p.wiDay { + text-align: center; + font-weight: bold; + padding: 0 0 10px 0; + clear: both; + width: 100%; + color: inherit; +} + + +.flatWeatherPlugin .wiDetail ul { + width: 33%; + float: left; + list-style: none; + font-size: 90%; +} + +.flatWeatherPlugin .wiDetail ul + ul { + width: 27%; +} + +.flatWeatherPlugin .wiDetail ul + ul + ul { + width: 40%; +} + +.flatWeatherPlugin .wiDetail ul li:before { + width:30px; + +} + +.flatWeatherPlugin ul.wiForecasts{ + width: 100%; + overflow: hidden; +} + +.flatWeatherPlugin ul.wiForecasts li > span { + width: 25%; + display: inline-block; +} + +.flatWeatherPlugin ul.wiForecasts li { + float: left; + width: 100%; + overflow: hidden; + display: inline; +} + +.flatWeatherPlugin ul.wiForecasts ul.wiForecast { + font-weight: normal; + list-style: none; + float: right; + width: 75%; +} + +.flatWeatherPlugin.forecast ul.wiForecasts ul.wiForecast li { + text-align: center; +} + +.flatWeatherPlugin ul.wiForecasts ul.wiForecast li { + width: 33%; + float: left; + text-align: center; +} + +.flatWeatherPlugin ul.wiForecasts ul.wiForecast li.wi:before { + vertical-align: bottom; +} + +.flatWeatherPlugin ul.wiForecasts li.wiDay { + font-weight: bold; + border-color: inherit; + border-top: 1px solid RGBA(255,255,255,0.2); + padding: 5px 0; +} + +.flatWeatherPlugin.forecast ul.wiForecasts li.wiDay { + border-bottom: 1px solid RGBA(255,255,255,0.2); + border-top: none; +} + +.flatWeatherPlugin ul.wiForecasts li.wiDay:last-child { + border-bottom: none; +} + + +/*************************************************************************************************/ +/* Font mappings */ +/*************************************************************************************************/ + +/*************************** +General +****************************/ +.wi.sunrise:before { + content: "\f051"; +} + +.wi.sunset:before { + content: "\f052"; +} + +.wi.wind:before { + content: "\f050"; +} + +.wi.humidity:before { + content: "\f04e"; +} + +.wi.pressure:before { + content: "\f040"; +} + +.wi.cloudiness:before { + content: "\f041"; +} + +.wi.temperature.metric:after { + content: "\f03c"; +} + +.wi.temperature.imperial:after { + content: "\f045"; +} + +.wi.loading:after { + content: "\f04c"; +} + +/*************************** +Thunderstorm +****************************/ + +/* thunderstorm with light rain */ +.wi.wi200:before { + content: "\f01d"; +} + +/* thunderstorm with rain */ +.wi.wi201:before { + content: "\f01d"; +} + +/* thunderstorm with heavy rain */ +.wi.wi202:before { + content: "\f01e"; +} + +/* light thunderstorm */ +.wi.wi210:before { + content: "\f010"; +} + +/* thunderstorm */ +.wi.wi211:before { + content: "\f01e"; +} + +/* heavy thunderstorm */ +.wi.wi212:before { + content: "\f01e"; +} + +/* ragged thunderstorm */ +.wi.wi221:before { + content: "\f016"; +} + +/* thunderstorm with light drizzle */ +.wi.wi230:before { + content: "\f01d"; +} + +/* thunderstorm with drizzle */ +.wi.wi231:before { + content: "\f01d"; +} + +/* thunderstorm with heavy drizzle */ +.wi.wi232:before { + content: "\f01d"; +} + +/*************************** +Drizzle +****************************/ + +/* light intensity drizzle */ +.wi.wi300:before { + content: "\f01c"; +} + +/* drizzle */ +.wi.wi301:before { + content: "\f01c"; +} + +/* heavy intensity drizzle */ +.wi.wi302:before { + content: "\f01c"; +} + +/* light intensity drizzle rain */ +.wi.wi310:before { + content: "\f01c"; +} + +/* drizzle rain */ +.wi.wi311:before { + content: "\f017"; +} + +/* heavy intensity drizzle rain */ +.wi.wi312:before { + content: "\f017"; +} + +/* shower rain and drizzle */ +.wi.wi313:before { + content: "\f01a"; +} + +/* heavy shower rain and drizzle */ +.wi.wi314:before { + content: "\f01a"; +} + +/* shower drizzle */ +.wi.wi321:before { + content: "\f01a"; +} + +/*************************** +Rain +****************************/ + +/* light rain */ +.wi.wi500:before { + content: "\f01a"; +} + +/* moderate rain */ +.wi.wi501:before { + content: "\f017"; +} + +/* heavy intensity rain */ +.wi.wi502:before { + content: "\f019"; +} + +/* very heavy rain */ +.wi.wi503:before { + content: "\f019"; +} + +/* extreme rain */ +.wi.wi504:before { + content: "\f018"; +} + +/* freezing rain */ +.wi.wi511:before { + content: "\f015"; +} + +/* light intensity shower rain */ +.wi.wi520:before { + content: "\f01a"; +} + +/* shower rain */ +.wi.wi521:before { + content: "\f01a"; +} + +/* heavy intensity shower rain */ +.wi.wi522:before { + content: "\f01a"; +} + +/* ragged shower rain */ +.wi.wi531:before { + content: "\f01a"; +} + +/*************************** +Snow +****************************/ + +/* light snow */ +.wi.wi600:before { + content: "\f01b"; +} + +/* snow */ +.wi.wi601:before { + content: "\f01b"; +} + +/* heavy snow */ +.wi.wi602:before { + content: "\f01b"; +} + +/* sleet */ +.wi.wi611:before { + content: "\f015"; +} + +/* shower sleet */ +.wi.wi612:before { + content: "\f015"; +} + +/* light rain and snow */ +.wi.wi615:before { + content: "\f017"; +} + +/* rain and snow */ +.wi.wi616:before { + content: "\f017"; +} + +/* light shower snow */ +.wi.wi620:before { + content: "\f017"; +} + +/* shower snow */ +.wi.wi621:before { + content: "\f017"; +} + +/* heavy shower snow */ +.wi.wi622:before { + content: "\f017"; +} + +/*************************** +Atmosphere +****************************/ + +/* mist */ +.wi.wi701:before { + content: "\f014"; +} + +/* smoke */ +.wi.wi711:before { + content: "\f062"; +} + +/* haze */ +.wi.wi721:before { + content: "\f014"; +} + +/* sand, dust whirls */ +.wi.wi731:before { + content: "\f063"; +} + +/* fog */ +.wi.wi741:before { + content: "\f014"; +} + +/* sand */ +.wi.wi751:before { + content: "\f063"; +} + +/* dust */ +.wi.wi761:before { + content: "\f063"; +} + +/* volcanic ash */ +.wi.wi762:before { + content: "\f063"; +} + +/* squalls */ +.wi.wi771:before { + content: "\f050"; +} + +/* tornado */ +.wi.wi781:before { + content: "\f056"; +} + +/*************************** +Clouds +****************************/ + +/* clear sky */ +.wi.wi800:before { + content: "\f00d"; +} + +/* few clouds */ +.wi.wi801:before { + content: "\f002"; +} + +/* scattered clouds */ +.wi.wi802:before { + content: "\f002"; +} + +/* broken clouds */ +.wi.wi803:before { + content: "\f002"; +} + +/* overcast clouds */ +.wi.wi804:before { + content: "\f00c"; +} + +/*************************** +Extreme +****************************/ + +/* tornado */ +.wi.wi900:before { + content: "\f056"; +} + +/* tropical storm */ +.wi.wi901:before { + content: "\f073"; +} + +/* hurricane */ +.wi.wi902:before { + content: "\f073"; +} + +/* cold */ +.wi.wi903:before { + content: "\f076"; +} + +/* hot */ +.wi.wi904:before { + content: "\f072"; +} + +/* windy */ +.wi.wi905:before { + content: "\f050"; +} + +/* hail */ +.wi.wi906:before { + content: "\f015"; +} + +/*************************** +Additional +****************************/ + +/* calm */ +.wi.wi951:before { + content: "\f00d"; +} + +/* light breeze */ +.wi.wi952:before { + content: "\f021"; +} + +/* gentle breeze */ +.wi.wi953:before { + content: "\f021"; +} + +/* moderate breeze */ +.wi.wi954:before { + content: "\f021"; +} + +/* fresh breeze */ +.wi.wi955:before { + content: "\f021"; +} + +/* strong breeze */ +.wi.wi956:before { + content: "\f050"; +} + +/* high wind, near gale */ +.wi.wi957:before { + content: "\f050"; +} + +/* gale */ +.wi.wi958:before { + content: "\f050"; +} + +/* severe gale */ +.wi.wi959:before { + content: "\f073"; +} + +/* storm */ +.wi.wi960:before { + content: "\f073"; +} + +/* violent storm */ +.wi.wi961:before { + content: "\f073"; +} + +/* hurricane */ +.wi.wi962:before { + content: "\f073"; +} \ No newline at end of file diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/css/flipclock.css b/mdot/mDotServer.censis/mDotServer.censis/app/css/flipclock.css new file mode 100644 index 0000000..d3998a6 --- /dev/null +++ b/mdot/mDotServer.censis/mDotServer.censis/app/css/flipclock.css @@ -0,0 +1,431 @@ +/* Get the bourbon mixin from http://bourbon.io */ +/* Reset */ +.flip-clock-wrapper * { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + -o-box-sizing: border-box; + box-sizing: border-box; + -webkit-backface-visibility: hidden; + -moz-backface-visibility: hidden; + -ms-backface-visibility: hidden; + -o-backface-visibility: hidden; + backface-visibility: hidden; +} + +.flip-clock-wrapper a { + cursor: pointer; + text-decoration: none; + color: #ccc; } + +.flip-clock-wrapper a:hover { + color: #fff; } + +.flip-clock-wrapper ul { + list-style: none; } + +.flip-clock-wrapper.clearfix:before, +.flip-clock-wrapper.clearfix:after { + content: " "; + display: table; } + +.flip-clock-wrapper.clearfix:after { + clear: both; } + +.flip-clock-wrapper.clearfix { + *zoom: 1; } + +/* Main */ +.flip-clock-wrapper { + font: normal 11px "Helvetica Neue", Helvetica, sans-serif; + -webkit-user-select: none; } + +.flip-clock-meridium { + background: none !important; + box-shadow: 0 0 0 !important; + font-size: 36px !important; } + +.flip-clock-meridium a { color: #313333; } + +.flip-clock-wrapper { + text-align: center; + position: relative; + width: 100%; + margin: 1em; +} + +.flip-clock-wrapper:before, +.flip-clock-wrapper:after { + content: " "; /* 1 */ + display: table; /* 2 */ +} +.flip-clock-wrapper:after { + clear: both; +} + +/* Skeleton */ +.flip-clock-wrapper ul { + position: relative; + float: left; + margin: 5px; + width: 60px; + height: 90px; + font-size: 80px; + font-weight: bold; + line-height: 87px; + border-radius: 6px; + background: #000; +} + +.flip-clock-wrapper ul li { + z-index: 1; + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + line-height: 87px; + text-decoration: none !important; +} + +.flip-clock-wrapper ul li:first-child { + z-index: 2; } + +.flip-clock-wrapper ul li a { + display: block; + height: 100%; + -webkit-perspective: 200px; + -moz-perspective: 200px; + perspective: 200px; + margin: 0 !important; + overflow: visible !important; + cursor: default !important; } + +.flip-clock-wrapper ul li a div { + z-index: 1; + position: absolute; + left: 0; + width: 100%; + height: 50%; + font-size: 80px; + overflow: hidden; + outline: 1px solid transparent; } + +.flip-clock-wrapper ul li a div .shadow { + position: absolute; + width: 100%; + height: 100%; + z-index: 2; } + +.flip-clock-wrapper ul li a div.up { + -webkit-transform-origin: 50% 100%; + -moz-transform-origin: 50% 100%; + -ms-transform-origin: 50% 100%; + -o-transform-origin: 50% 100%; + transform-origin: 50% 100%; + top: 0; } + +.flip-clock-wrapper ul li a div.up:after { + content: ""; + position: absolute; + top: 44px; + left: 0; + z-index: 5; + width: 100%; + height: 3px; + background-color: #000; + background-color: rgba(0, 0, 0, 0.4); } + +.flip-clock-wrapper ul li a div.down { + -webkit-transform-origin: 50% 0; + -moz-transform-origin: 50% 0; + -ms-transform-origin: 50% 0; + -o-transform-origin: 50% 0; + transform-origin: 50% 0; + bottom: 0; + border-bottom-left-radius: 6px; + border-bottom-right-radius: 6px; +} + +.flip-clock-wrapper ul li a div div.inn { + position: absolute; + left: 0; + z-index: 1; + width: 100%; + height: 200%; + color: #FD5F00; + text-shadow: 0 1px 2px #000; + text-align: center; + background-color: #333; + border-radius: 6px; + font-size: 70px; } + +.flip-clock-wrapper ul li a div.up div.inn { + top: 0; } + +.flip-clock-wrapper ul li a div.down div.inn { + bottom: 0; } + +/* PLAY */ +.flip-clock-wrapper ul.play li.flip-clock-before { + z-index: 3; } + +.flip-clock-wrapper .flip { box-shadow: 0 2px 5px rgba(0, 0, 0, 0.7); } + +.flip-clock-wrapper ul.play li.flip-clock-active { + -webkit-animation: asd 0.5s 0.5s linear both; + -moz-animation: asd 0.5s 0.5s linear both; + animation: asd 0.5s 0.5s linear both; + z-index: 5; } + +.flip-clock-divider { + float: left; + display: inline-block; + position: relative; + width: 20px; + height: 100px; } + +.flip-clock-divider:first-child { + width: 0; } + +.flip-clock-dot { + display: block; + background: #323434; + width: 10px; + height: 10px; + position: absolute; + border-radius: 50%; + box-shadow: 0 0 5px rgba(0, 0, 0, 0.5); + left: 5px; } + +.flip-clock-divider .flip-clock-label { + position: absolute; + top: -1.5em; + right: -86px; + color: black; + text-shadow: none; } + +.flip-clock-divider.minutes .flip-clock-label { + right: -88px; } + +.flip-clock-divider.seconds .flip-clock-label { + right: -91px; } + +.flip-clock-dot.top { + top: 30px; } + +.flip-clock-dot.bottom { + bottom: 30px; } + +@-webkit-keyframes asd { + 0% { + z-index: 2; } + + 20% { + z-index: 4; } + + 100% { + z-index: 4; } } + +@-moz-keyframes asd { + 0% { + z-index: 2; } + + 20% { + z-index: 4; } + + 100% { + z-index: 4; } } + +@-o-keyframes asd { + 0% { + z-index: 2; } + + 20% { + z-index: 4; } + + 100% { + z-index: 4; } } + +@keyframes asd { + 0% { + z-index: 2; } + + 20% { + z-index: 4; } + + 100% { + z-index: 4; } } + +.flip-clock-wrapper ul.play li.flip-clock-active .down { + z-index: 2; + -webkit-animation: turn 0.5s 0.5s linear both; + -moz-animation: turn 0.5s 0.5s linear both; + animation: turn 0.5s 0.5s linear both; } + +@-webkit-keyframes turn { + 0% { + -webkit-transform: rotateX(90deg); } + + 100% { + -webkit-transform: rotateX(0deg); } } + +@-moz-keyframes turn { + 0% { + -moz-transform: rotateX(90deg); } + + 100% { + -moz-transform: rotateX(0deg); } } + +@-o-keyframes turn { + 0% { + -o-transform: rotateX(90deg); } + + 100% { + -o-transform: rotateX(0deg); } } + +@keyframes turn { + 0% { + transform: rotateX(90deg); } + + 100% { + transform: rotateX(0deg); } } + +.flip-clock-wrapper ul.play li.flip-clock-before .up { + z-index: 2; + -webkit-animation: turn2 0.5s linear both; + -moz-animation: turn2 0.5s linear both; + animation: turn2 0.5s linear both; } + +@-webkit-keyframes turn2 { + 0% { + -webkit-transform: rotateX(0deg); } + + 100% { + -webkit-transform: rotateX(-90deg); } } + +@-moz-keyframes turn2 { + 0% { + -moz-transform: rotateX(0deg); } + + 100% { + -moz-transform: rotateX(-90deg); } } + +@-o-keyframes turn2 { + 0% { + -o-transform: rotateX(0deg); } + + 100% { + -o-transform: rotateX(-90deg); } } + +@keyframes turn2 { + 0% { + transform: rotateX(0deg); } + + 100% { + transform: rotateX(-90deg); } } + +.flip-clock-wrapper ul li.flip-clock-active { + z-index: 3; } + +/* SHADOW */ +.flip-clock-wrapper ul.play li.flip-clock-before .up .shadow { + background: -moz-linear-gradient(top, rgba(0, 0, 0, 0.1) 0%, black 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(0, 0, 0, 0.1)), color-stop(100%, black)); + background: linear, top, rgba(0, 0, 0, 0.1) 0%, black 100%; + background: -o-linear-gradient(top, rgba(0, 0, 0, 0.1) 0%, black 100%); + background: -ms-linear-gradient(top, rgba(0, 0, 0, 0.1) 0%, black 100%); + background: linear, to bottom, rgba(0, 0, 0, 0.1) 0%, black 100%; + -webkit-animation: show 0.5s linear both; + -moz-animation: show 0.5s linear both; + animation: show 0.5s linear both; } + +.flip-clock-wrapper ul.play li.flip-clock-active .up .shadow { + background: -moz-linear-gradient(top, rgba(0, 0, 0, 0.1) 0%, black 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(0, 0, 0, 0.1)), color-stop(100%, black)); + background: linear, top, rgba(0, 0, 0, 0.1) 0%, black 100%; + background: -o-linear-gradient(top, rgba(0, 0, 0, 0.1) 0%, black 100%); + background: -ms-linear-gradient(top, rgba(0, 0, 0, 0.1) 0%, black 100%); + background: linear, to bottom, rgba(0, 0, 0, 0.1) 0%, black 100%; + -webkit-animation: hide 0.5s 0.3s linear both; + -moz-animation: hide 0.5s 0.3s linear both; + animation: hide 0.5s 0.3s linear both; } + +/*DOWN*/ +.flip-clock-wrapper ul.play li.flip-clock-before .down .shadow { + background: -moz-linear-gradient(top, black 0%, rgba(0, 0, 0, 0.1) 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, black), color-stop(100%, rgba(0, 0, 0, 0.1))); + background: linear, top, black 0%, rgba(0, 0, 0, 0.1) 100%; + background: -o-linear-gradient(top, black 0%, rgba(0, 0, 0, 0.1) 100%); + background: -ms-linear-gradient(top, black 0%, rgba(0, 0, 0, 0.1) 100%); + background: linear, to bottom, black 0%, rgba(0, 0, 0, 0.1) 100%; + -webkit-animation: show 0.5s linear both; + -moz-animation: show 0.5s linear both; + animation: show 0.5s linear both; } + +.flip-clock-wrapper ul.play li.flip-clock-active .down .shadow { + background: -moz-linear-gradient(top, black 0%, rgba(0, 0, 0, 0.1) 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, black), color-stop(100%, rgba(0, 0, 0, 0.1))); + background: linear, top, black 0%, rgba(0, 0, 0, 0.1) 100%; + background: -o-linear-gradient(top, black 0%, rgba(0, 0, 0, 0.1) 100%); + background: -ms-linear-gradient(top, black 0%, rgba(0, 0, 0, 0.1) 100%); + background: linear, to bottom, black 0%, rgba(0, 0, 0, 0.1) 100%; + -webkit-animation: hide 0.5s 0.3s linear both; + -moz-animation: hide 0.5s 0.3s linear both; + animation: hide 0.5s 0.2s linear both; } + +@-webkit-keyframes show { + 0% { + opacity: 0; } + + 100% { + opacity: 1; } } + +@-moz-keyframes show { + 0% { + opacity: 0; } + + 100% { + opacity: 1; } } + +@-o-keyframes show { + 0% { + opacity: 0; } + + 100% { + opacity: 1; } } + +@keyframes show { + 0% { + opacity: 0; } + + 100% { + opacity: 1; } } + +@-webkit-keyframes hide { + 0% { + opacity: 1; } + + 100% { + opacity: 0; } } + +@-moz-keyframes hide { + 0% { + opacity: 1; } + + 100% { + opacity: 0; } } + +@-o-keyframes hide { + 0% { + opacity: 1; } + + 100% { + opacity: 0; } } + +@keyframes hide { + 0% { + opacity: 1; } + + 100% { + opacity: 0; } } diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/fonts/Material_Icons-normal-400.woff b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/Material_Icons-normal-400.woff new file mode 100644 index 0000000..0d59b5c Binary files /dev/null and b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/Material_Icons-normal-400.woff differ diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/fonts/Ubuntu-normal-300.woff b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/Ubuntu-normal-300.woff new file mode 100644 index 0000000..eeff903 Binary files /dev/null and b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/Ubuntu-normal-300.woff differ diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/fonts/Ubuntu-normal-400.woff b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/Ubuntu-normal-400.woff new file mode 100644 index 0000000..f8c1d67 Binary files /dev/null and b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/Ubuntu-normal-400.woff differ diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/fonts/Ubuntu-normal-500.woff b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/Ubuntu-normal-500.woff new file mode 100644 index 0000000..1166e73 Binary files /dev/null and b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/Ubuntu-normal-500.woff differ diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/fonts/Ubuntu-normal-700.woff b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/Ubuntu-normal-700.woff new file mode 100644 index 0000000..a387b46 Binary files /dev/null and b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/Ubuntu-normal-700.woff differ diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/fonts/Ubuntu_Condensed-normal-400.woff b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/Ubuntu_Condensed-normal-400.woff new file mode 100644 index 0000000..47864fe Binary files /dev/null and b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/Ubuntu_Condensed-normal-400.woff differ diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/fonts/WeatherIcons-Regular.otf b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/WeatherIcons-Regular.otf new file mode 100644 index 0000000..ed3d7dd Binary files /dev/null and b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/WeatherIcons-Regular.otf differ diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/fonts/fonts.css b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/fonts.css new file mode 100644 index 0000000..1bd87c9 --- /dev/null +++ b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/fonts.css @@ -0,0 +1,41 @@ +@font-face { + font-family: 'Material Icons'; + font-style: normal; + font-weight: 400; + src: url(Material_Icons-normal-400.woff) format('woff'); +} + +@font-face { + font-family: 'Ubuntu'; + font-style: normal; + font-weight: 300; + src: url(Ubuntu-normal-300.woff) format('woff'); +} + +@font-face { + font-family: 'Ubuntu'; + font-style: normal; + font-weight: 400; + src: url(Ubuntu-normal-400.woff) format('woff'); +} + +@font-face { + font-family: 'Ubuntu'; + font-style: normal; + font-weight: 500; + src: url(Ubuntu-normal-500.woff) format('woff'); +} + +@font-face { + font-family: 'Ubuntu'; + font-style: normal; + font-weight: 700; + src: url(Ubuntu-normal-700.woff) format('woff'); +} + +@font-face { + font-family: 'Ubuntu Condensed'; + font-style: normal; + font-weight: 400; + src: url(Ubuntu_Condensed-normal-400.woff) format('woff'); +} \ No newline at end of file diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/fonts/weathericons-regular-webfont.eot b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/weathericons-regular-webfont.eot new file mode 100644 index 0000000..3ae46ac Binary files /dev/null and b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/weathericons-regular-webfont.eot differ diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/fonts/weathericons-regular-webfont.svg b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/weathericons-regular-webfont.svg new file mode 100644 index 0000000..224188d --- /dev/null +++ b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/weathericons-regular-webfont.svg @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/fonts/weathericons-regular-webfont.ttf b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/weathericons-regular-webfont.ttf new file mode 100644 index 0000000..8d8a1c4 Binary files /dev/null and b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/weathericons-regular-webfont.ttf differ diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/fonts/weathericons-regular-webfont.woff b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/weathericons-regular-webfont.woff new file mode 100644 index 0000000..87f3070 Binary files /dev/null and b/mdot/mDotServer.censis/mDotServer.censis/app/fonts/weathericons-regular-webfont.woff differ diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/js/mdot.js b/mdot/mDotServer.censis/mDotServer.censis/app/js/mdot.js index b8231a3..df17210 100644 --- a/mdot/mDotServer.censis/mDotServer.censis/app/js/mdot.js +++ b/mdot/mDotServer.censis/mDotServer.censis/app/js/mdot.js @@ -5,6 +5,7 @@ (function($) { + var Widget; var GraphView; var sendAuthentication = function(xhr) { @@ -17,10 +18,7 @@ |_| |_|\___/|___/|___|____|___/ */ - - var MainModel = Backbone.Model.extend({ - - }); + var MainModel = Backbone.Model.extend({}); var EventsModel = Backbone.Model.extend({ initialize: function() { @@ -219,6 +217,13 @@ }); + /////////////////// + /// Colors /////// + /////////////////// + var mainColors = ['#404040', '#ff0063', '#33ffad']; //Panel, text, logo, cs1, cs2, cs3, cs4, cs5, cs6 + var chartColors = ['#b3b3ff', '#ff66b3', '#e600e6', '#80dfff', '#33ffad']; //Panel, text, logo, cs1, cs2, cs3, cs4, cs5, cs6 + + var MainView = Backbone.View.extend({ el: $('#main'), template: _.template($('#main-template').html()), events: { @@ -229,7 +234,7 @@ } }, initialize: function() { - _.bindAll(this, 'render', 'changeDevice', 'updateDevice','setSocket'); + _.bindAll(this, 'render', 'changeDevice', 'updateDevice'); this.model.on('change', this.updateDevice); this.render(); }, render: function() { @@ -238,8 +243,6 @@ }, changeDevice: function() { var newDevice; newDevice = this.$el.find('#device')[0].value; - console.log('NewDevice', newDevice); - this.model.set('device', newDevice); if (this.socketHandler) { @@ -288,172 +291,260 @@ this.collection.on('update', function() { // Trigger the redraw this.updateGraphV2(); - console.log(this); + if (typeof this.socketHandler === 'object') { this.socketHandler.turnOn(); } }, this); - }, events: { 'change select#displaymode': 'changeMode' }, setupChart: function() { - this.categoryAxesSettings.minPeriod = 'mm'; - this.chart.categoryAxesSettings = this.categoryAxesSettings; + //This.categoryAxesSettings.minPeriod = 'mm'; + //this.chart.categoryAxesSettings = this.categoryAxesSettings; - this.dataSet.color = '#b0de09'; + //this.dataSet.color = '#b0de09'; - this.chart.dataSets = [this.dataSet]; + //this.chart.dataSets = [this.dataSet]; }, doChartV2: function(chartData) { var self = this; console.time('doChartV2'); - self.chart = AmCharts.makeChart('chartdiv', { - type: 'serial', - theme: 'light', + var chart = new AmCharts.AmStockChart(); + //chart.pathToImages = "http://www.amcharts.com/lib/images/"; + chart.categoryAxesSettings.minPeriod = '15mm'; + chart.categoryAxesSettings.minorGridEnabled = true; + chart.theme = 'dark'; - legend: { - useGraphSettings: true, - color: '#fff', - switchColor: '#556374' - }, - color: '#ffffff', - dataProvider: chartData, - dataDateFormat: 'YYYY-MM-DDTHH:NN:SS.QQQ', - synchronizeGrid: true, - valueAxes: [ - { - id: 'lux', - axisColor: '#FFC802', - axisThickness: 2, - axisAlpha: 1, - position: 'left', - gridColor: '#556374' - }, - { - id: 'co2', - axisColor: 'rgba(0,191,255,1)', - axisThickness: 2, - axisAlpha: 1, - position: 'right', - gridColor: '#556374' - }, - { - id: 'temp', - axisColor: 'rgba(46,255,0,1)', - axisThickness: 2, - gridAlpha: 0, - offset: 50, - axisAlpha: 1, - position: 'left', - gridColor: '#556374' - }, - { - id: 'humid', - axisColor: 'rgba(255,0,99,1)', - axisThickness: 2, - axisAlpha: 1, - offset: 50, - position: 'right', - gridColor: '#556374' - }, - { - id: 'occupancy', - axisColor: '#aaaaaa', - axisThickness: 2, - gridAlpha: 0, - offset: 100, - axisAlpha: 1, - position: 'right', - gridColor: '#556374' - } - ], - graphs: [{id: 'occ', - valueAxis: 'occupancy', - type: 'line', - clustered: false, - columnWidth: 1, - lineColor: '#aaaaaa', - title: 'Occupancy', - valueField: 'occupancy', - fillColor: '#888888', - fillAlphas: 0.2, - fillToAxis: 'x' - }, - { - valueAxis: 'lux', - lineColor: '#FFC802', - title: 'Light Level', - valueField: 'lux', - fillAlphas: 0 - }, - { - valueAxis: 'co2', - lineColor: 'rgba(0,191,255,1)', - title: 'Co2', - valueField: 'co2', - fillAlphas: 0 - }, - { - valueAxis: 'temp', - lineColor: 'rgba(46,255,0,1)', - title: 'Temperature', - valueField: 'temp', - fillAlphas: 0 - }, - { - valueAxis: 'humid', - lineColor: 'rgba(255,0,99,1)', - title: 'Humidity', - valueField: 'humid', - fillAlphas: 0 - }, - { - valueAxis: 'co2', - lineColor: 'rgba(255,0,255,1)', - title: 'sub100', - valueField: 'sub100', - fillAlphas: 0 - } - ], - chartScrollbar: { - graph: 'occ',oppositeAxis: false, - offset: 30, - scrollbarHeight: 80, - backgroundAlpha: 0, - selectedBackgroundAlpha: 0.1, - selectedBackgroundColor: '#888888', - graphFillAlpha: 0, - graphLineAlpha: 0.5, - selectedGraphFillAlpha: 0, - selectedGraphLineAlpha: 1, - autoGridCount: true, - color: '#AAAAAA', - updateOnReleaseOnly: true + // DATASETS ////////////////////////////////////////// + // create data sets first + var dataSet1 = new AmCharts.DataSet(); + dataSet1.title = 'first data set'; + dataSet1.fieldMappings = [{ + fromField: 'co2', + toField: 'co2' }, - chartCursor: { - cursorPosition: 'mouse', - cursorColor: '#14bfff', - color: '#000' + { + fromField: 'humid', + toField: 'humid' }, - categoryField: 'date', - categoryAxis: { - minPeriod: '15mm', - parseDates: true, - axisColor: 'rgba(255,255,255,0.8)', - minorGridEnabled: true, - gridColor: '#556374' + { + fromField: 'lux', + toField: 'lux' }, - export: { - enabled: true, position: 'bottom-right' - } - }); + { + fromField: 'temp', + toField: 'temp' + }, + { + fromField: 'occupancy', + toField: 'occupancy' + }]; + dataSet1.dataProvider = chartData; + dataSet1.categoryField = 'date'; + + + // Set data sets to the chart + chart.dataSets = [dataSet1]; + + // PANELS /////////////////////////////////////////// + // first stock panel + var stockPanel1 = new AmCharts.StockPanel(); + stockPanel1.showCategoryAxis = false; + stockPanel1.title = 'Environment'; + stockPanel1.percentHeight = 60; + //StockPanel1.backgroundColor = "#696969"; + + + // add value axes + var valueAxis1 = new AmCharts.ValueAxis(); + valueAxis1.axisColor = '#b3b3ff'; + valueAxis1.color = '#b3b3ff'; + valueAxis1.offset = 0; + valueAxis1.minorGridEnabled = true; + valueAxis1.minorTickLength = 8; + //ValueAxis1.title = "ppm"; + + stockPanel1.addValueAxis(valueAxis1); + + var valueAxis2 = new AmCharts.ValueAxis(); + valueAxis2.position = 'right'; + valueAxis2.axisColor = '#ff66b3'; + valueAxis2.color = '#ff66b3'; + valueAxis2.offset = 0; + valueAxis2.minorGridEnabled = true; + valueAxis2.minorTickLength = 8; + stockPanel1.addValueAxis(valueAxis2); + + var valueAxis3 = new AmCharts.ValueAxis(); + valueAxis3.position = 'right'; + valueAxis3.axisColor = '#e600e6'; + valueAxis3.color = '#e600e6'; + valueAxis3.offset = 50; + valueAxis3.minorGridEnabled = true; + valueAxis3.minorTickLength = 8; + stockPanel1.addValueAxis(valueAxis3); + + var valueAxis4 = new AmCharts.ValueAxis(); + valueAxis4.position = 'left'; + valueAxis4.axisColor = '#80dfff'; + valueAxis4.color = '#80dfff'; + valueAxis4.offset = 50; + valueAxis4.minorGridEnabled = true; + valueAxis4.minorTickLength = 8; + stockPanel1.addValueAxis(valueAxis4); + + + + + + + // Graph of first stock panel + var graph1 = new AmCharts.StockGraph(); + graph1.title = 'CO2'; + graph1.valueField = 'co2'; + graph1.lineThickness = 2; + graph1.lineColor = '#b3b3ff'; + graph1.useDataSetColors = false; + graph1.valueAxis = valueAxis1; + stockPanel1.addStockGraph(graph1); + + // Create stock legend + stockPanel1.stockLegend = new AmCharts.StockLegend(); + stockPanel1.stockLegend.color = '#f0f5f5'; + + + var graph2 = new AmCharts.StockGraph(); + graph2.title = 'Humidity'; + graph2.valueField = 'humid'; + graph2.lineThickness = 2; + graph2.lineColor = '#ff66b3'; + graph2.useDataSetColors = false; + graph2.valueAxis = valueAxis2; + stockPanel1.addStockGraph(graph2); + + var graph3 = new AmCharts.StockGraph(); + graph3.title = 'LUX'; + graph3.valueField = 'lux'; + graph3.lineThickness = 2; + graph3.lineColor = '#e600e6'; + graph3.useDataSetColors = false; + graph3.valueAxis = valueAxis3; + stockPanel1.addStockGraph(graph3); + + var graph4 = new AmCharts.StockGraph(); + graph4.title = 'Temperature'; + graph4.valueField = 'temp'; + graph4.lineThickness = 2; + graph4.lineColor = '#80dfff'; + graph4.useDataSetColors = false; + graph4.valueAxis = valueAxis4; + stockPanel1.addStockGraph(graph4); + + + // Set panels to the chart + chart.panels = [stockPanel1]; + + var stockPanel2 = new AmCharts.StockPanel(); + stockPanel2.showCategoryAxis = false; + stockPanel2.title = 'Occupancy'; + stockPanel2.percentHeight = 60; + + var valueAxis5 = new AmCharts.ValueAxis(); + valueAxis5.position = 'left'; + valueAxis5.axisColor = '#33ffad'; + valueAxis5.color = '#33ffad'; + valueAxis5.offset = 0; + valueAxis5.minorGridEnabled = true; + valueAxis5.minorTickLength = 8; + stockPanel2.addValueAxis(valueAxis5); + + + + var graph5 = new AmCharts.StockGraph(); + graph5.title = 'Count'; + graph5.type = 'column'; + graph5.valueField = 'occupancy'; + graph5.cornerRadiusTop = 1; + graph5.fillAlphas = 1; + graph5.lineColor = '#33ffad'; + //Graph4.fillColors = "#ff66ff"; + graph5.useDataSetColors = false; + + stockPanel2.addStockGraph(graph5); + + // Create stock legend + stockPanel2.stockLegend = new AmCharts.StockLegend(); + stockPanel2.stockLegend.color = '#f0f5f5'; + + chart.addPanelAt(stockPanel2, 1); + //Chart.validateNow(); + + // chart.panels = [stockPanel2]; + + // OTHER SETTINGS //////////////////////////////////// + var sbsettings = new AmCharts.ChartScrollbarSettings(); + sbsettings.graph = graph1; + sbsettings.usePeriod = 'hh'; + sbsettings.backgroundColor = '#404040'; + sbsettings.graph = graph5; + sbsettings.graphFillColor = '#33ffad'; + sbsettings.selectedBackgroundColor = '#333333'; + //Sbsettings.selectedGraphLineColor = "#ff0063"; + chart.chartScrollbarSettings = sbsettings; + + + var valueAxesSettings = new AmCharts.ValueAxesSettings(); + valueAxesSettings.axisThickness = 2; + valueAxesSettings.gridAlpha = 0; + valueAxesSettings.axisAlpha = 1; + valueAxesSettings.inside = false; + chart.valueAxesSettings = valueAxesSettings; + + var panelsSettings = new AmCharts.PanelsSettings(); + panelsSettings.marginLeft = 100; + panelsSettings.marginRight = 100; + panelsSettings.marginTop = 10; + panelsSettings.marginBottom = 10; + chart.panelsSettings = panelsSettings; + + + // PERIOD SELECTOR /////////////////////////////////// + // var periodSelector = new AmCharts.PeriodSelector(); + // periodSelector.position = "bottom"; + // periodSelector.inputFieldsEnabled = false; + // periodSelector.width = 20; + // //periodSelector.dateFormat = "YYYY-MM-DD JJ:NN" + // periodSelector.periods = [ + // { + // period: "hh", + // count: 1, + // label: "1 hour", + + // }, + // { + // period: "hh", + // count: 12, + // label: "12 hours", + + // }, + // { + // period: "DD", + // count: 5, + // label: "10 days", + // selected: true + // }, + //]; + // chart.periodSelector = periodSelector; + + //$('#chartdiv').empty(); + chart.write('chartdiv'); + + - $('#chartdiv').empty(); - self.chart.write('chartdiv'); console.timeEnd('doChartV2'); }, updateGraphV2: function() { @@ -506,35 +597,33 @@ }); - - var Widget = Backbone.View.extend({ - //el: '#widgets', - template: _.template($('#widget-template').html()), - initialize: function() { + Widget = Backbone.View.extend({ + template: _.template($('#widget-template').html()), initialize: function() { _.bindAll(this, 'render'); - this.modes = ['', 'lux', 'temp', 'co2', 'humid', 'noise']; + this.modes = ['', 'lux', 'temp', 'co2', 'humidity', 'noise']; + this.suffixList = ['', '', '°c', '', '%', '']; this.titles = [ - '', 'Light Levels', 'Temperature', 'Co2 Levels', 'Humidity', 'Sound' - ]; - this.listenTo(this.model,'change',function() { + '', 'Light Levels', 'Temperature', 'Co2 Levels', 'Humidity', 'Sound' + ]; + this.listenTo(this.model, 'change', function() { this.render(); }); this.widgetMode = this.id.split('-')[1]; this.title = this.titles[this.modes.indexOf(this.widgetMode)]; + this.suffix = this.suffixList[this.modes.indexOf(this.widgetMode)]; this.render(); - }, - render: function() { + }, render: function() { let data = this.model.get('data'); + // console.log(data); let value = (typeof data !== 'undefined') ? data[this.widgetMode] : 0; - var html = this.template({name: this.title,value: value}); - console.log(html); - console.log(this.$el); - console.log('rendering'); - this.$el.append(html); + value = value.toString().concat(this.suffix); + var html = this.template({value: value}); + this.$el.html(html); return this; - }}); + } + }); notification.configProfile('global', { @@ -561,6 +650,11 @@ views.mainview.setSocket(webSocketModel); views.grapher.setSocket(webSocketModel); - var tempWidget = new Widget({model: webSocketModel, id: 'widget-temp'}); - var co2Widget = new Widget({model: webSocketModel, id: 'widget-co2'}); + views.tempWidget = new Widget({model: webSocketModel, id: 'widget-temp', el: $('#widget-temp')}); + views.co2Widget = new Widget({model: webSocketModel, id: 'widget-co2', el: $('#widget-co2')}); + views.humidityWidget = new Widget({model: webSocketModel, id: 'widget-humidity', el: $('#widget-humidity')}); + views.luxWidget = new Widget({model: webSocketModel, id: 'widget-lux', el: $('#widget-lux')}); + + + })(jQuery); diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/js/socketmanager.js b/mdot/mDotServer.censis/mDotServer.censis/app/js/socketmanager.js index 3403249..64f4cda 100644 --- a/mdot/mDotServer.censis/mDotServer.censis/app/js/socketmanager.js +++ b/mdot/mDotServer.censis/mDotServer.censis/app/js/socketmanager.js @@ -5,69 +5,50 @@ * Time: 11:38 * */ -/* global Backbone, _, $, AmCharts, notification, WEBSOCKET */ -/* global mainview */ +/* global Backbone, _, WEBSOCKET */ /* jshint browser: true , devel: true*/ 'use strict'; - var SOCKETMANAGER = (function() { var SocketManager = Backbone.Model.extend({ - deviceId : ['CENSIS-LoRa-1','CENSIS-LoRa-2','CENSIS-LoRa-3','CENSIS-LoRa-4','HIE-mobile-1----','HIE-mobile-2----','HIE-smart-campus-1','HIE-smart-campus-2','HIE-smart-campus-3','HIE-smart-campus-4','HIE-smart-campus-5','HIE-smart-campus-6','HIE-smart-campus-7','HIE-mDot-1'], + deviceId: ['CENSIS-LoRa-1','CENSIS-LoRa-2','CENSIS-LoRa-3','CENSIS-LoRa-4','HIE-mobile-1----','HIE-mobile-2----','HIE-smart-campus-1','HIE-smart-campus-2','HIE-smart-campus-3','HIE-smart-campus-4','HIE-smart-campus-5','HIE-smart-campus-6','HIE-smart-campus-7','HIE-mDot-1'], - initialize: function() { - _.bindAll(this, 'turnOn', 'turnOff'); - this.listeningID = null; - this.listening = false; - this.webSocket = new WEBSOCKET(this); + initialize: function() { + _.bindAll(this, 'turnOn', 'turnOff'); + this.listeningID = null; + this.listening = false; + this.webSocket = new WEBSOCKET(this); - this.on('message', function(o) { - if (this.listening) - { - //console.log('Message', o); - this.checkItem(o); - } + this.on('message', function(o) { + if (this.listening) { + this.checkItem(o); + } - }); + }); - this.on('all', function(d) { - console.log('model:all', d); - - }); - }, - turnOn: function() { - console.log('SocketManager:turnOn'); - - this.listening = true; - - }, - turnOff: function() { - console.log('SocketManager:turnOff'); - this.listening = false; - }, - listenFor: function(id) { - - console.log('index of', this.deviceId.indexOf(id)); - this.listeningID = this.deviceId.indexOf(id); - }, - checkItem : function(item) { - //console.log('Checking Item:', item); - if (item.hasOwnProperty('tick')) { - //console.log('Reject heartbeat'); - } else { - console.log('Wanted deviceid', this.listeningID, item.data.deviceid); - //console.log('Data packet!!!'); - if (item.data.deviceid === this.listeningID) { - console.log(item.data); - this.set({data:item.data}); - console.log('this', this) + }, + turnOn: function() { + this.listening = true; + }, + turnOff: function() { + this.listening = false; + }, + listenFor: function(id) { + this.listeningID = this.deviceId.indexOf(id); + }, + checkItem: function(item) { + if (item.hasOwnProperty('tick')) { + // Ticks are ignored + } else { + if (item.data.deviceid === this.listeningID) { + this.set({data: item.data}); + } } - } - } - }); + } + }); return SocketManager; }()); diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/js/websocket.js b/mdot/mDotServer.censis/mDotServer.censis/app/js/websocket.js index 490c731..84f9803 100644 --- a/mdot/mDotServer.censis/mDotServer.censis/app/js/websocket.js +++ b/mdot/mDotServer.censis/mDotServer.censis/app/js/websocket.js @@ -3,7 +3,6 @@ var WEBSOCKET = function(model) { var wsUrl = 'ws://localhost:3001'; this.socket = null; - this.retry = 0; this.timer = 0; this.startWebSocket = function() { @@ -26,14 +25,7 @@ var WEBSOCKET = function(model) { this.handleData = function(d) { - - model.trigger('message',d); - switch (d.id) { - default: - // console.log('Default:',d); - break; - } }; this.handleWebsocketOnOpen = function() { @@ -44,8 +36,6 @@ var WEBSOCKET = function(model) { }; this.handleWebsocketMessage = function(message) { - - console.log('handleWebsocketMessage:',message); var command; try { command = JSON.parse(message.data); @@ -53,9 +43,7 @@ var WEBSOCKET = function(model) { catch (e) { /* Do nothing */ } - if (command) { - //This.dispatchCommand(command); this.handleData.call(this,command); } }; diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/lib/dateTime.js b/mdot/mDotServer.censis/mDotServer.censis/app/lib/dateTime.js new file mode 100644 index 0000000..c0fad2e --- /dev/null +++ b/mdot/mDotServer.censis/mDotServer.censis/app/lib/dateTime.js @@ -0,0 +1,25 @@ +function date_time(id) { + date = new Date; + year = date.getFullYear(); + month = date.getMonth(); + months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'Jully', 'August', 'September', 'October', 'November', 'December'); + d = date.getDate(); + day = date.getDay(); + days = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); + h = date.getHours(); + if (h < 10) { + h = "0" + h; + } + m = date.getMinutes(); + if (m < 10) { + m = "0" + m; + } + s = date.getSeconds(); + if (s < 10) { + s = "0" + s; + } + result = '' + days[day] + ' ' + months[month] + ' ' + d + ' ' + year + ' ' + h + ':' + m + ':' + s; + document.getElementById(id).innerHTML = result; + setTimeout('date_time("' + id + '");', '1000'); + return true; +} \ No newline at end of file diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/lib/flipclock.min.js b/mdot/mDotServer.censis/mDotServer.censis/app/lib/flipclock.min.js new file mode 100644 index 0000000..fb6931d --- /dev/null +++ b/mdot/mDotServer.censis/mDotServer.censis/app/lib/flipclock.min.js @@ -0,0 +1,2 @@ +/*! flipclock 2014-12-12 */ +var Base=function(){};Base.extend=function(a,b){"use strict";var c=Base.prototype.extend;Base._prototyping=!0;var d=new this;c.call(d,a),d.base=function(){},delete Base._prototyping;var e=d.constructor,f=d.constructor=function(){if(!Base._prototyping)if(this._constructing||this.constructor==f)this._constructing=!0,e.apply(this,arguments),delete this._constructing;else if(null!==arguments[0])return(arguments[0].extend||c).call(arguments[0],d)};return f.ancestor=this,f.extend=this.extend,f.forEach=this.forEach,f.implement=this.implement,f.prototype=d,f.toString=this.toString,f.valueOf=function(a){return"object"==a?f:e.valueOf()},c.call(f,b),"function"==typeof f.init&&f.init(),f},Base.prototype={extend:function(a,b){if(arguments.length>1){var c=this[a];if(c&&"function"==typeof b&&(!c.valueOf||c.valueOf()!=b.valueOf())&&/\bbase\b/.test(b)){var d=b.valueOf();b=function(){var a=this.base||Base.prototype.base;this.base=c;var b=d.apply(this,arguments);return this.base=a,b},b.valueOf=function(a){return"object"==a?b:d},b.toString=Base.toString}this[a]=b}else if(a){var e=Base.prototype.extend;Base._prototyping||"function"==typeof this||(e=this.extend||e);for(var f={toSource:null},g=["constructor","toString","valueOf"],h=Base._prototyping?0:1;i=g[h++];)a[i]!=f[i]&&e.call(this,i,a[i]);for(var i in a)f[i]||e.call(this,i,a[i])}return this}},Base=Base.extend({constructor:function(){this.extend(arguments[0])}},{ancestor:Object,version:"1.1",forEach:function(a,b,c){for(var d in a)void 0===this.prototype[d]&&b.call(c,a[d],d,a)},implement:function(){for(var a=0;a',''].join("");d&&(e=""),b=this.factory.localize(b);var f=['',''+(b?b:"")+"",e,""],g=a(f.join(""));return this.dividers.push(g),g},createList:function(a,b){"object"==typeof a&&(b=a,a=0);var c=new FlipClock.List(this.factory,a,b);return this.lists.push(c),c},reset:function(){this.factory.time=new FlipClock.Time(this.factory,this.factory.original?Math.round(this.factory.original):0,{minimumDigits:this.factory.minimumDigits}),this.flip(this.factory.original,!1)},appendDigitToClock:function(a){a.$el.append(!1)},addDigit:function(a){var b=this.createList(a,{classes:{active:this.factory.classes.active,before:this.factory.classes.before,flip:this.factory.classes.flip}});this.appendDigitToClock(b)},start:function(){},stop:function(){},autoIncrement:function(){this.factory.countdown?this.decrement():this.increment()},increment:function(){this.factory.time.addSecond()},decrement:function(){0==this.factory.time.getTimeSeconds()?this.factory.stop():this.factory.time.subSecond()},flip:function(b,c){var d=this;a.each(b,function(a,b){var e=d.lists[a];e?(c||b==e.digit||e.play(),e.select(b)):d.addDigit(b)})}})}(jQuery),function(a){"use strict";FlipClock.Factory=FlipClock.Base.extend({animationRate:1e3,autoStart:!0,callbacks:{destroy:!1,create:!1,init:!1,interval:!1,start:!1,stop:!1,reset:!1},classes:{active:"flip-clock-active",before:"flip-clock-before",divider:"flip-clock-divider",dot:"flip-clock-dot",label:"flip-clock-label",flip:"flip",play:"play",wrapper:"flip-clock-wrapper"},clockFace:"HourlyCounter",countdown:!1,defaultClockFace:"HourlyCounter",defaultLanguage:"english",$el:!1,face:!0,lang:!1,language:"english",minimumDigits:0,original:!1,running:!1,time:!1,timer:!1,$wrapper:!1,constructor:function(b,c,d){d||(d={}),this.lists=[],this.running=!1,this.base(d),this.$el=a(b).addClass(this.classes.wrapper),this.$wrapper=this.$el,this.original=c instanceof Date?c:c?Math.round(c):0,this.time=new FlipClock.Time(this,this.original,{minimumDigits:this.minimumDigits,animationRate:this.animationRate}),this.timer=new FlipClock.Timer(this,d),this.loadLanguage(this.language),this.loadClockFace(this.clockFace,d),this.autoStart&&this.start()},loadClockFace:function(a,b){var c,d="Face",e=!1;return a=a.ucfirst()+d,this.face.stop&&(this.stop(),e=!0),this.$el.html(""),this.time.minimumDigits=this.minimumDigits,c=FlipClock[a]?new FlipClock[a](this,b):new FlipClock[this.defaultClockFace+d](this,b),c.build(),this.face=c,e&&this.start(),this.face},loadLanguage:function(a){var b;return b=FlipClock.Lang[a.ucfirst()]?FlipClock.Lang[a.ucfirst()]:FlipClock.Lang[a]?FlipClock.Lang[a]:FlipClock.Lang[this.defaultLanguage],this.lang=b},localize:function(a,b){var c=this.lang;if(!a)return null;var d=a.toLowerCase();return"object"==typeof b&&(c=b),c&&c[d]?c[d]:a},start:function(a){var b=this;b.running||b.countdown&&!(b.countdown&&b.time.time>0)?b.log("Trying to start timer when countdown already at 0"):(b.face.start(b.time),b.timer.start(function(){b.flip(),"function"==typeof a&&a()}))},stop:function(a){this.face.stop(),this.timer.stop(a);for(var b in this.lists)this.lists.hasOwnProperty(b)&&this.lists[b].stop()},reset:function(a){this.timer.reset(a),this.face.reset()},setTime:function(a){this.time.time=a,this.flip(!0)},getTime:function(){return this.time},setCountdown:function(a){var b=this.running;this.countdown=a?!0:!1,b&&(this.stop(),this.start())},flip:function(a){this.face.flip(!1,a)}})}(jQuery),function(a){"use strict";FlipClock.List=FlipClock.Base.extend({digit:0,classes:{active:"flip-clock-active",before:"flip-clock-before",flip:"flip"},factory:!1,$el:!1,$obj:!1,items:[],lastDigit:0,constructor:function(a,b){this.factory=a,this.digit=b,this.lastDigit=b,this.$el=this.createList(),this.$obj=this.$el,b>0&&this.select(b),this.factory.$el.append(this.$el)},select:function(a){if("undefined"==typeof a?a=this.digit:this.digit=a,this.digit!=this.lastDigit){var b=this.$el.find("."+this.classes.before).removeClass(this.classes.before);this.$el.find("."+this.classes.active).removeClass(this.classes.active).addClass(this.classes.before),this.appendListItem(this.classes.active,this.digit),b.remove(),this.lastDigit=this.digit}},play:function(){this.$el.addClass(this.factory.classes.play)},stop:function(){var a=this;setTimeout(function(){a.$el.removeClass(a.factory.classes.play)},this.factory.timer.interval)},createListItem:function(a,b){return['
  • ','','
    ','
    ','
    '+(b?b:"")+"
    ","
    ",'
    ','
    ','
    '+(b?b:"")+"
    ","
    ","
    ","
  • "].join("")},appendListItem:function(a,b){var c=this.createListItem(a,b);this.$el.append(c)},createList:function(){var b=this.getPrevDigit()?this.getPrevDigit():this.digit,c=a(['
      ',this.createListItem(this.classes.before,b),this.createListItem(this.classes.active,this.digit),"
    "].join(""));return c},getNextDigit:function(){return 9==this.digit?0:this.digit+1},getPrevDigit:function(){return 0==this.digit?9:this.digit-1}})}(jQuery),function(a){"use strict";String.prototype.ucfirst=function(){return this.substr(0,1).toUpperCase()+this.substr(1)},a.fn.FlipClock=function(b,c){return new FlipClock(a(this),b,c)},a.fn.flipClock=function(b,c){return a.fn.FlipClock(b,c)}}(jQuery),function(a){"use strict";FlipClock.Time=FlipClock.Base.extend({time:0,factory:!1,minimumDigits:0,constructor:function(a,b,c){"object"!=typeof c&&(c={}),c.minimumDigits||(c.minimumDigits=a.minimumDigits),this.base(c),this.factory=a,b&&(this.time=b)},convertDigitsToArray:function(a){var b=[];a=a.toString();for(var c=0;cthis.minimumDigits&&(this.minimumDigits=c.length),this.minimumDigits>c.length)for(var d=c.length;d12?c-12:0===c?12:c,a.getMinutes()];return b===!0&&d.push(a.getSeconds()),this.digitize(d)},getSeconds:function(a){var b=this.getTimeSeconds();return a&&(60==b?b=0:b%=60),Math.ceil(b)},getWeeks:function(a){var b=this.getTimeSeconds()/60/60/24/7;return a&&(b%=52),Math.floor(b)},removeLeadingZeros:function(b,c){var d=0,e=[];return a.each(c,function(a){b>a?d+=parseInt(c[a],10):e.push(c[a])}),0===d?e:c},addSeconds:function(a){this.time instanceof Date?this.time.setSeconds(this.time.getSeconds()+a):this.time+=a},addSecond:function(){this.addSeconds(1)},subSeconds:function(a){this.time instanceof Date?this.time.setSeconds(this.time.getSeconds()-a):this.time-=a},subSecond:function(){this.subSeconds(1)},toString:function(){return this.getTimeSeconds().toString()}})}(jQuery),function(){"use strict";FlipClock.Timer=FlipClock.Base.extend({callbacks:{destroy:!1,create:!1,init:!1,interval:!1,start:!1,stop:!1,reset:!1},count:0,factory:!1,interval:1e3,animationRate:1e3,constructor:function(a,b){this.base(b),this.factory=a,this.callback(this.callbacks.init),this.callback(this.callbacks.create)},getElapsed:function(){return this.count*this.interval},getElapsedTime:function(){return new Date(this.time+this.getElapsed())},reset:function(a){clearInterval(this.timer),this.count=0,this._setInterval(a),this.callback(this.callbacks.reset)},start:function(a){this.factory.running=!0,this._createTimer(a),this.callback(this.callbacks.start)},stop:function(a){this.factory.running=!1,this._clearInterval(a),this.callback(this.callbacks.stop),this.callback(a)},_clearInterval:function(){clearInterval(this.timer)},_createTimer:function(a){this._setInterval(a)},_destroyTimer:function(a){this._clearInterval(),this.timer=!1,this.callback(a),this.callback(this.callbacks.destroy)},_interval:function(a){this.callback(this.callbacks.interval),this.callback(a),this.count++},_setInterval:function(a){var b=this;b._interval(a),b.timer=setInterval(function(){b._interval(a)},this.interval)}})}(jQuery),function(a){FlipClock.TwentyFourHourClockFace=FlipClock.Face.extend({constructor:function(a,b){this.base(a,b)},build:function(b){var c=this,d=this.factory.$el.find("ul");this.factory.time.time||(this.factory.original=new Date,this.factory.time=new FlipClock.Time(this.factory,this.factory.original));var b=b?b:this.factory.time.getMilitaryTime(!1,this.showSeconds);b.length>d.length&&a.each(b,function(a,b){c.createList(b)}),this.createDivider(),this.createDivider(),a(this.dividers[0]).insertBefore(this.lists[this.lists.length-2].$el),a(this.dividers[1]).insertBefore(this.lists[this.lists.length-4].$el),this.base()},flip:function(a,b){this.autoIncrement(),a=a?a:this.factory.time.getMilitaryTime(!1,this.showSeconds),this.base(a,b)}})}(jQuery),function(a){FlipClock.CounterFace=FlipClock.Face.extend({shouldAutoIncrement:!1,constructor:function(a,b){"object"!=typeof b&&(b={}),a.autoStart=b.autoStart?!0:!1,b.autoStart&&(this.shouldAutoIncrement=!0),a.increment=function(){a.countdown=!1,a.setTime(a.getTime().getTimeSeconds()+1)},a.decrement=function(){a.countdown=!0;var b=a.getTime().getTimeSeconds();b>0&&a.setTime(b-1)},a.setValue=function(b){a.setTime(b)},a.setCounter=function(b){a.setTime(b)},this.base(a,b)},build:function(){var b=this,c=this.factory.$el.find("ul"),d=this.factory.getTime().digitize([this.factory.getTime().time]);d.length>c.length&&a.each(d,function(a,c){var d=b.createList(c);d.select(c)}),a.each(this.lists,function(a,b){b.play()}),this.base()},flip:function(a,b){this.shouldAutoIncrement&&this.autoIncrement(),a||(a=this.factory.getTime().digitize([this.factory.getTime().time])),this.base(a,b)},reset:function(){this.factory.time=new FlipClock.Time(this.factory,this.factory.original?Math.round(this.factory.original):0),this.flip()}})}(jQuery),function(a){FlipClock.DailyCounterFace=FlipClock.Face.extend({showSeconds:!0,constructor:function(a,b){this.base(a,b)},build:function(b){var c=this,d=this.factory.$el.find("ul"),e=0;b=b?b:this.factory.time.getDayCounter(this.showSeconds),b.length>d.length&&a.each(b,function(a,b){c.createList(b)}),this.showSeconds?a(this.createDivider("Seconds")).insertBefore(this.lists[this.lists.length-2].$el):e=2,a(this.createDivider("Minutes")).insertBefore(this.lists[this.lists.length-4+e].$el),a(this.createDivider("Hours")).insertBefore(this.lists[this.lists.length-6+e].$el),a(this.createDivider("Days",!0)).insertBefore(this.lists[0].$el),this.base()},flip:function(a,b){a||(a=this.factory.time.getDayCounter(this.showSeconds)),this.autoIncrement(),this.base(a,b)}})}(jQuery),function(a){FlipClock.HourlyCounterFace=FlipClock.Face.extend({constructor:function(a,b){this.base(a,b)},build:function(b,c){var d=this,e=this.factory.$el.find("ul");c=c?c:this.factory.time.getHourCounter(),c.length>e.length&&a.each(c,function(a,b){d.createList(b)}),a(this.createDivider("Seconds")).insertBefore(this.lists[this.lists.length-2].$el),a(this.createDivider("Minutes")).insertBefore(this.lists[this.lists.length-4].$el),b||a(this.createDivider("Hours",!0)).insertBefore(this.lists[0].$el),this.base()},flip:function(a,b){a||(a=this.factory.time.getHourCounter()),this.autoIncrement(),this.base(a,b)},appendDigitToClock:function(a){this.base(a),this.dividers[0].insertAfter(this.dividers[0].next())}})}(jQuery),function(){FlipClock.MinuteCounterFace=FlipClock.HourlyCounterFace.extend({clearExcessDigits:!1,constructor:function(a,b){this.base(a,b)},build:function(){this.base(!0,this.factory.time.getMinuteCounter())},flip:function(a,b){a||(a=this.factory.time.getMinuteCounter()),this.base(a,b)}})}(jQuery),function(a){FlipClock.TwelveHourClockFace=FlipClock.TwentyFourHourClockFace.extend({meridium:!1,meridiumText:"AM",build:function(){var b=this.factory.time.getTime(!1,this.showSeconds);this.base(b),this.meridiumText=this.getMeridium(),this.meridium=a(['"].join("")),this.meridium.insertAfter(this.lists[this.lists.length-1].$el)},flip:function(a,b){this.meridiumText!=this.getMeridium()&&(this.meridiumText=this.getMeridium(),this.meridium.find("a").html(this.meridiumText)),this.base(this.factory.time.getTime(!1,this.showSeconds),b)},getMeridium:function(){return(new Date).getHours()>=12?"PM":"AM"},isPM:function(){return"PM"==this.getMeridium()?!0:!1},isAM:function(){return"AM"==this.getMeridium()?!0:!1}})}(jQuery),function(){FlipClock.Lang.Arabic={years:"سنوات",months:"شهور",days:"أيام",hours:"ساعات",minutes:"دقائق",seconds:"ثواني"},FlipClock.Lang.ar=FlipClock.Lang.Arabic,FlipClock.Lang["ar-ar"]=FlipClock.Lang.Arabic,FlipClock.Lang.arabic=FlipClock.Lang.Arabic}(jQuery),function(){FlipClock.Lang.Danish={years:"År",months:"Måneder",days:"Dage",hours:"Timer",minutes:"Minutter",seconds:"Sekunder"},FlipClock.Lang.da=FlipClock.Lang.Danish,FlipClock.Lang["da-dk"]=FlipClock.Lang.Danish,FlipClock.Lang.danish=FlipClock.Lang.Danish}(jQuery),function(){FlipClock.Lang.German={years:"Jahre",months:"Monate",days:"Tage",hours:"Stunden",minutes:"Minuten",seconds:"Sekunden"},FlipClock.Lang.de=FlipClock.Lang.German,FlipClock.Lang["de-de"]=FlipClock.Lang.German,FlipClock.Lang.german=FlipClock.Lang.German}(jQuery),function(){FlipClock.Lang.English={years:"Years",months:"Months",days:"Days",hours:"Hours",minutes:"Minutes",seconds:"Seconds"},FlipClock.Lang.en=FlipClock.Lang.English,FlipClock.Lang["en-us"]=FlipClock.Lang.English,FlipClock.Lang.english=FlipClock.Lang.English}(jQuery),function(){FlipClock.Lang.Spanish={years:"Años",months:"Meses",days:"DÍas",hours:"Horas",minutes:"Minutos",seconds:"Segundo"},FlipClock.Lang.es=FlipClock.Lang.Spanish,FlipClock.Lang["es-es"]=FlipClock.Lang.Spanish,FlipClock.Lang.spanish=FlipClock.Lang.Spanish}(jQuery),function(){FlipClock.Lang.Finnish={years:"Vuotta",months:"Kuukautta",days:"Päivää",hours:"Tuntia",minutes:"Minuuttia",seconds:"Sekuntia"},FlipClock.Lang.fi=FlipClock.Lang.Finnish,FlipClock.Lang["fi-fi"]=FlipClock.Lang.Finnish,FlipClock.Lang.finnish=FlipClock.Lang.Finnish}(jQuery),function(){FlipClock.Lang.French={years:"Ans",months:"Mois",days:"Jours",hours:"Heures",minutes:"Minutes",seconds:"Secondes"},FlipClock.Lang.fr=FlipClock.Lang.French,FlipClock.Lang["fr-ca"]=FlipClock.Lang.French,FlipClock.Lang.french=FlipClock.Lang.French}(jQuery),function(){FlipClock.Lang.Italian={years:"Anni",months:"Mesi",days:"Giorni",hours:"Ore",minutes:"Minuti",seconds:"Secondi"},FlipClock.Lang.it=FlipClock.Lang.Italian,FlipClock.Lang["it-it"]=FlipClock.Lang.Italian,FlipClock.Lang.italian=FlipClock.Lang.Italian}(jQuery),function(){FlipClock.Lang.Latvian={years:"Gadi",months:"Mēneši",days:"Dienas",hours:"Stundas",minutes:"Minūtes",seconds:"Sekundes"},FlipClock.Lang.lv=FlipClock.Lang.Latvian,FlipClock.Lang["lv-lv"]=FlipClock.Lang.Latvian,FlipClock.Lang.latvian=FlipClock.Lang.Latvian}(jQuery),function(){FlipClock.Lang.Dutch={years:"Jaren",months:"Maanden",days:"Dagen",hours:"Uren",minutes:"Minuten",seconds:"Seconden"},FlipClock.Lang.nl=FlipClock.Lang.Dutch,FlipClock.Lang["nl-be"]=FlipClock.Lang.Dutch,FlipClock.Lang.dutch=FlipClock.Lang.Dutch}(jQuery),function(){FlipClock.Lang.Norwegian={years:"År",months:"Måneder",days:"Dager",hours:"Timer",minutes:"Minutter",seconds:"Sekunder"},FlipClock.Lang.no=FlipClock.Lang.Norwegian,FlipClock.Lang.nb=FlipClock.Lang.Norwegian,FlipClock.Lang["no-nb"]=FlipClock.Lang.Norwegian,FlipClock.Lang.norwegian=FlipClock.Lang.Norwegian}(jQuery),function(){FlipClock.Lang.Portuguese={years:"Anos",months:"Meses",days:"Dias",hours:"Horas",minutes:"Minutos",seconds:"Segundos"},FlipClock.Lang.pt=FlipClock.Lang.Portuguese,FlipClock.Lang["pt-br"]=FlipClock.Lang.Portuguese,FlipClock.Lang.portuguese=FlipClock.Lang.Portuguese}(jQuery),function(){FlipClock.Lang.Russian={years:"лет",months:"месяцев",days:"дней",hours:"часов",minutes:"минут",seconds:"секунд"},FlipClock.Lang.ru=FlipClock.Lang.Russian,FlipClock.Lang["ru-ru"]=FlipClock.Lang.Russian,FlipClock.Lang.russian=FlipClock.Lang.Russian}(jQuery),function(){FlipClock.Lang.Swedish={years:"År",months:"Månader",days:"Dagar",hours:"Timmar",minutes:"Minuter",seconds:"Sekunder"},FlipClock.Lang.sv=FlipClock.Lang.Swedish,FlipClock.Lang["sv-se"]=FlipClock.Lang.Swedish,FlipClock.Lang.swedish=FlipClock.Lang.Swedish}(jQuery); \ No newline at end of file diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/lib/images/CarbonDioxide.png b/mdot/mDotServer.censis/mDotServer.censis/app/lib/images/CarbonDioxide.png new file mode 100644 index 0000000..5e8674a Binary files /dev/null and b/mdot/mDotServer.censis/mDotServer.censis/app/lib/images/CarbonDioxide.png differ diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/lib/images/Humidity.png b/mdot/mDotServer.censis/mDotServer.censis/app/lib/images/Humidity.png new file mode 100644 index 0000000..a21cc57 Binary files /dev/null and b/mdot/mDotServer.censis/mDotServer.censis/app/lib/images/Humidity.png differ diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/lib/images/Lux.png b/mdot/mDotServer.censis/mDotServer.censis/app/lib/images/Lux.png new file mode 100644 index 0000000..fe9b40a Binary files /dev/null and b/mdot/mDotServer.censis/mDotServer.censis/app/lib/images/Lux.png differ diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/lib/images/SB_logo.png b/mdot/mDotServer.censis/mDotServer.censis/app/lib/images/SB_logo.png new file mode 100644 index 0000000..bb8e817 Binary files /dev/null and b/mdot/mDotServer.censis/mDotServer.censis/app/lib/images/SB_logo.png differ diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/lib/images/Temperature.png b/mdot/mDotServer.censis/mDotServer.censis/app/lib/images/Temperature.png new file mode 100644 index 0000000..c37f37c Binary files /dev/null and b/mdot/mDotServer.censis/mDotServer.censis/app/lib/images/Temperature.png differ diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/lib/images/censis_logo_white.png b/mdot/mDotServer.censis/mDotServer.censis/app/lib/images/censis_logo_white.png new file mode 100644 index 0000000..10631a9 Binary files /dev/null and b/mdot/mDotServer.censis/mDotServer.censis/app/lib/images/censis_logo_white.png differ diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/lib/jquery.flatWeatherPlugin.js b/mdot/mDotServer.censis/mDotServer.censis/app/lib/jquery.flatWeatherPlugin.js new file mode 100644 index 0000000..9fe710c --- /dev/null +++ b/mdot/mDotServer.censis/mDotServer.censis/app/lib/jquery.flatWeatherPlugin.js @@ -0,0 +1,598 @@ + + +// the semi-colon before function invocation is a safety net against concatenated +// scripts and/or other plugins which may not be closed properly. +;(function ( $, window, document, undefined ) { + + + var pluginName = "flatWeatherPlugin"; + + // Create the defaults once + var defaults = { + location: "Waterloo, ON", //city, region + country: "Canada", //country + displayCityNameOnly: false, + api : "openweathermap", //api: yahoo or openweathermap + forecast: 5, //number of days to forecast, max 5 + apikey : "", //optional api key for openweathermap + view : "full", //options: simple, today, partial, forecast, full + render : true, //render: false if you to make your own markup, true plugin generates markup + loadingAnimation: true, //show loading animation + //units : "metric" or "imperial" default: "auto" + }; + + var apiurls = { + "openweathermap" : ["http://api.openweathermap.org/data/2.5/weather", "http://api.openweathermap.org/data/2.5/forecast/daily"], + "yahoo" : ["https://query.yahooapis.com/v1/public/yql"] + }; + + // Plugin Constructor + function Plugin (element, options ) { + + this.element = element; + + // jQuery has an extend method which merges the contents of two or + // more objects, storing the result in the first object. The first object + // is generally empty as we don't want to alter the default options for + // future instances of the plugin + this.settings = $.extend( {}, defaults, options ); + + //set units if otherwise not set + if (!this.settings.units || this.settings.units == "auto") { + //basically just support for auto units of USA + this.settings.units = (["united states", "usa", "united states of america", "us"].indexOf(this.settings.country.toLowerCase()) == -1)?"metric":"imperial"; + } + + //bound forecast to max of 5 days, api won't return more then that + this.settings.forecast = Math.min(this.settings.forecast, 5); + + //store plugin name for local reference + this._name = pluginName; + + this.once = false; + + //call initilizaiton + this.init(); + }; + + // Avoid Plugin.prototype conflicts + $.extend(Plugin.prototype, { + init: function () { + //if you want the pluging to render markup init will do all the work + //otherwise you are on your own + if (this.settings.render) { + + //if first run show loading icon (if enabled) + if (this.settings.loadingAnimation && !this.once) { + //add a loading spinner, animated with css + this.loading = $("
    ", {"id" : "flatWeatherLoading", "class" : "wi loading"}); + this.loading.appendTo(this.element); + } + + this.fetchWeather().then(this.render, this.error); + + } + this.once = true; //init has happened, can be used to prevent some init tasks happening again + }, + fetchWeather: function () { + //Fetches the weather from the API with an ajax request + //Returns a promise of (weather object, this) + + //scope of this for nested functions + var that = this; + + //create promise + var promise = new $.Deferred(); + + + //data params to send along with each ajax request + //array because some apis may require multiple requests + //params[0] is sent to apiurls[api][0] and so on + var params = []; + + //build location query string + var location = this.settings.location + " " + this.settings.country; + + //build the paramaters required for specified api + if (this.settings.api == "openweathermap") { + //openweathermap requires two requests: one for today, another for the forecast. + + //see openweathermap api for details on params passed to api + + //the first request grabs the daily forecast + var parameters = {}; + parameters.q = location; + parameters.units = this.settings.units; + if(this.settings.apikey) parameters.appid = this.settings.apikey; + + params.push(parameters); //params for first request url + + //same as the first with added cnt forecast paramater in days + //the second request grabs the forecast for the number of days requested + parameters.cnt = this.settings.forecast + 1; //plus one to include today + params.push(parameters); //params for second request url + + } + else if (this.settings.api == "yahoo") { + //yahoo weather uses c and f for metric/imperial unit identifiers, + //convert our stored text string to match what they expect + var u = (this.settings.units == "metric")?"c":"f"; + + //see yahoo yql weather api for details on params passed to api + var parameters = {}; + parameters.q = "select * from weather.forecast where woeid in (select woeid from geo.places(1) where text='" + location + "') AND u='" + u +"'"; + parameters.env = "store://datatables.org/alltableswithkeys"; //some sort of api version info... because yahoo. + parameters.format = "json"; + params.push(parameters); + + } + + + //for each request send the associated paramaters, then when all are done render all data + var requests = []; //requests sent + //for each url in apiurls for the api set, send the associated params to it in an ajax request + for (var i = 0; i < apiurls[this.settings.api].length; i++) { + //jquery ajax request promise + requests.push($.get(apiurls[this.settings.api][i], params[i])); + } + + //when all request promises are done + $.when.apply(this, requests) + .done(function(){ + + //grab the result from the promise as passed by arguments + //and convert it to an actual array with slice + var args = Array.prototype.slice.call(arguments); + + //remove a layer of nesting for easier use + //the [0] element is the result, the rest of the array is + //info about the ajax request and promise that we can toss + if (requests.length > 1) { + //if multiple requests, each promise result of the ajax request is part of an array + args = args.map(function(val) { return val[0]}); + } + else { + args = args[0]; + } + + + //check for results that returned http 200 but had errors from api + if (that.settings.api == "openweathermap" && !(args[0].cod == "200" && args[1].cod == "200")) { + console.log("Error interacting with the openweathermap api see error object below for details:"); + console.log(args); + promise.reject(args, that); + } + else if (that.settings.api == "yahoo" && (args.query.count == 0 || args.query.results.channel.description == "Yahoo! Weather Error")) { + //yahoo weather really should return a better error checking method. + console.log("Error interacting with the yahoo api see error object below for details:"); + console.log(args); + promise.reject(args, that); + } + else { + + //now take that fancy api data and map it to a common format with datamapper function + var weather = datamapper(args, that.settings); + + that._weather = weather; //store it on the instance + + $.data( that.element, "weather", weather); //and store it on the DOM for general use + + promise.resolve(weather, that); + + } + + + }) + .fail(function(error){ + //TODO draw fails. + console.log("fail"); + promise.reject(error, that); + }); + + return promise; + + }, + error : function(error, context) { + + if (!context) { + //if called directly and not via plugin we need to set context to this vs passed when a promise + context = this; + } + + if (context.settings.loadingAnimation && context.settings.render) { + context.loading.remove(); //remove loading spinner + } + + if (context.settings.api == "openweathermap") { + if (error[0].cod != "200") { + error = error[0].cod + " " + error[0].message + ". See console log for details."; + } + else { + error = error[1] + " See console log for details."; + } + } + else if (context.settings.api == "yahoo") { + + if (error.query.results) { + error = "Error: " + error.query.results.channel.item.title + ". See console log for details."; + } + else { + error = "Error: no results. See console log for details."; + } + } + + var div = $("
    ", {"class": "flatWeatherPlugin " + context.settings.view}); + $("

    ").text("Error").appendTo(div); + $("

    ").text(error).appendTo(div); + $(context.element).html(div); //recall that this.element is set in plugin constructor + return $(context.element); + }, + //Generates the DOM elements + render : function (weather, context) { + + if (!context) { + //if called directly and not via plugin we need to set context to this vs passed when a promise + context = this; + weather = this._weather; + } + + //string showing degree symbol + F or C + var degrees = context.settings.units == "metric"?"°C":"°F"; + + if (context.settings.loadingAnimation && context.settings.render) { + context.loading.remove(); //remove loading spinner + } + + //Now that we have everything lets make a dom fragment of our data. + //Then append that fragment once to the dom once its all made. + //There is a bunch of if switches for various view options but this + //is mostly self-explainatory dom generating code from the weather object + var div = $("

    ", {"class": "flatWeatherPlugin " + context.settings.view}); + + if (context.settings.displayCityNameOnly) { + $("

    ").text(weather.city).appendTo(div); + } + else { + $("

    ").text(weather.location).appendTo(div); + } + + + if (context.settings.view != "forecast") { + var today = $("
    ", {"class": "wiToday"}); + var iconGroup = $("
    ", {"class": "wiIconGroup"}); + $("
    ", {"class" : "wi "+ "wi"+weather.today.code}).appendTo(iconGroup); + $("

    ", {"class" : "wiText"}).text(weather.today.desc).appendTo(iconGroup); + iconGroup.appendTo(today); + $("

    ", {"class" : "wiTemperature"}).html(weather.today.temp.now + "" + degrees + "").appendTo(today); + today.appendTo(div); + } + + if (context.settings.view != "simple") { + var detail = $("

    ", {"class": "wiDetail"}); + + if (context.settings.view == "partial") { + $("

    ", {"class" : "wiDay"}).text(weather.today.day).appendTo(today); + } + + if (context.settings.view != "partial") { + if (context.settings.view != "today") { + $("

    ", {"class" : "wiDay"}).text(weather.today.day).appendTo(detail); + } + var astro = $("

      ", {"class" : "astronomy"}).appendTo(detail); + $("
    • ", {"class" : "wi sunrise"}).text(weather.today.sunrise).appendTo(astro); + $("
    • ", {"class" : "wi sunset"}).text(weather.today.sunset).appendTo(astro); + var temp = $("
        ", {"class" : "temp"}).appendTo(detail); + $("
      • ").html("Max : " + weather.today.temp.max + "" + degrees + "").appendTo(temp); + $("
      • ").html("Min : " + weather.today.temp.min + "" + degrees + "").appendTo(temp); + var atmo = $("
          ", {"class" : "atmosphere"}).appendTo(detail); + $("
        • ", {"class" : "wi humidity"}).text(weather.today.humidity).appendTo(atmo); + $("
        • ", {"class" : "wi pressure"}).text(weather.today.pressure).appendTo(atmo); + $("
        • ", {"class" : "wi wind"}).text(formatWind(weather.today.wind.speed, weather.today.wind.deg, context.settings.units)).appendTo(atmo); + detail.appendTo(today); + } + + + if (context.settings.view != "today" || context.settings.view == "forecast") { + var forecast = $("
            ", {"class": "wiForecasts"}); + var startingIndex = (context.settings.view == "forecast")?0:1; + //index should include today for forecast view exclude for other views + for (var i = startingIndex; i < weather.forecast.length; i++) { + var day = $("
          • ", {"class" : "wiDay"}).html(""+weather.forecast[i].day+"").appendTo(forecast); + var sub = $("
              ", {"class" : "wiForecast"}).appendTo(day); + $("
            • ", {"class" : "wi "+ "wi"+ weather.forecast[i].code}).appendTo(sub); + $("
            • ", {"class" : "wiMax"}).html(weather.forecast[i].temp.max + "" + degrees + "").appendTo(sub); + $("
            • ", {"class" : "wiMin"}).html(weather.forecast[i].temp.min + "" + degrees + "").appendTo(sub); + } + forecast.appendTo(div); + } + } + + + //now append our dom fragment to the target element + $(context.element).html(div); //recall that this.element is set in plugin constructor + + return $(context.element); + + } + + }); + + + //jQuery Constructor + // A lightweight plugin wrapper on the jquery fn constructor, + // preventing against multiple instantiations on the same element + $.fn[pluginName] = function ( options, args ) { + if ($.isFunction(Plugin.prototype[options])) { + //enable function access via .flatWeatherPlugin('function', 'args') + //grab the plugin instance from the dom reference and call function with any args + //return the results of the + return this.data("plugin_" + pluginName)[options](args); + } + //return this for jquery chainability + return this.each(function() { + //check if plugin has been attached to the dom + if (!$.data(this, "plugin_" + pluginName)) { + var plugin = new Plugin(this, options); //call constructor + return $.data(this, "plugin_" + pluginName, plugin); //attach plugin instance to the dom data + } + }); + }; + + + /* + //datamapper converts raw aka dirty un-standardize data from either api + //into a unified format for easier use as follows: + { + location : String, //as returned back from api + today : { + temp : { + //temperatures are in units requested from api + now : Number, ex. 18 + min : Number, ex. 24 + max : Number ex. 12 + }, + desc : String, ex. "Partly Cloudy" + code : Number, ex. "801" see css or weather codes for meaning + wind : { + speed : 4, //either km/h or mph + deg : Number, //direction in degrees from North + }, + pressure : Number, //barometric pressure + humidity : Number, //% humidity + sunrise : Time, + sunset : Time, + day : String, + + }, + forecast : [{Day: String, code:Number, desc: String, temp : {min:number, max:number}}] + } + //note: input data is in an array of the returned api result request(s) in the same order as setup in the apiurls + //All data manipulation and cleaning up happens below + //making this was tedious. + */ + function datamapper (input, settings) { + + var out = {}; //map input to out + + if (settings.api == "openweathermap") { + + //data[0] is current weather, data[1] is forecast + if (input[0].name != "") { + out.location = input[0].name + ", " + input[0].sys.country; + out.city = input[0].name; + } + else if (input[1].city.name != ""){ //sometimes the api doesn't return a location. weird, try the name from second request + out.location = input[1].city.name + ", " + input[1].city.country; + out.city = input[1].city.name; + } + else { //still no location? fall back to settings + out.location = settings.location + ", " + settings.country; + out.city = settings.location; + } + + out.today = {}; + out.today.temp = {}; + out.today.temp.now = Math.round(input[0].main.temp); + out.today.temp.min = Math.round(input[0].main.temp_min); + out.today.temp.max = Math.round(input[0].main.temp_max); + + out.today.desc = input[0].weather[0].description.capitalize(); + out.today.code = input[0].weather[0].id; + //no weather id code remapping needed, we will use this as our default weather code system + //and convert all other codes to the openweathermap weather code format + + out.today.wind = input[0].wind; + out.today.humidity = input[0].main.humidity; + out.today.pressure = input[0].main.pressure; + out.today.sunrise = epochToHours(input[0].sys.sunrise); + out.today.sunset = epochToHours(input[0].sys.sunset); + + out.today.day = getDayString(new Date()); + + out.forecast = []; + for (var i = 0; i < settings.forecast; i++) { + var forecast = {}; + forecast.day = getDayString(new Date(input[1].list[i].dt * 1000)); //api time is in unix epoch + forecast.code = input[1].list[i].weather[0].id; + forecast.desc = input[1].list[i].weather[0].description.capitalize(); + forecast.temp = {max: Math.round(input[1].list[i].temp.max), min: Math.round(input[1].list[i].temp.min)} + out.forecast.push(forecast); + } + + } + else if (settings.api == "yahoo") { + + //key = yahoo code, value = standard code (based on openweathermap codes) + var codes = { + 0 : "900", //tornado + 1 : "901", //tropical storm + 2 : "902", //hurricane + 3 : "212", //severe thunderstorms + 4 : "200", //thunderstorms + 5 : "616", //mixed rain and snow + 6 : "612", //mixed rain and sleet + 7 : "611", //mixed snow and sleet + 8 : "511", //freezing drizzle + 9 : "301", //drizzle + 10 : "511", //freezing rain + 11 : "521", //showers + 12 : "521", //showers + 13 : "600", //snow flurries + 14 : "615", //light snow showers + 15 : "601", //blowing snow + 16 : "601", //snow + 17 : "906", //hail + 18 : "611", //sleet + 19 : "761", //dust + 20 : "741", //foggy + 21 : "721", //haze + 22 : "711", //smoky + 23 : "956", //blustery + 24 : "954", //windy + 25 : "903", //cold + 26 : "802", //cloudy + 27 : "802", //mostly cloudy (night) + 28 : "802", //mostly cloudy (day) + 29 : "802", //partly cloudy (night) + 30 : "802", //partly cloudy (day) + 31 : "800", //clear (night) + 32 : "800", //sunny + 33 : "951", //fair (night) + 34 : "951", //fair (day) + 35 : "906", //mixed rain and hail + 36 : "904", //hot + 37 : "210", //isolated thunderstorms + 38 : "210", //scattered thunderstorms + 39 : "210", //scattered thunderstorms + 40 : "521", //scattered showers + 41 : "602", //heavy snow + 42 : "621", //scattered snow showers + 43 : "602", //heavy snow + 44 : "802", //partly cloudy + 45 : "201", //thundershowers + 46 : "621", //snow showers + 47 : "210", //isolated thundershowers + 3200: "951", //not available... alright... lets make that sunny. + } + + input = input.query.results.channel; //get rid of a bunch of silly yahoo nested objects; + + out.location = input.location.city + ", " + input.location.country; + out.city = input.location.city; + + out.today = {}; + out.today.temp = {}; + out.today.temp.now = Math.round(input.item.condition.temp); + out.today.temp.min = Math.round(input.item.forecast[0].low); + out.today.temp.max = Math.round(input.item.forecast[0].high); + + out.today.desc = input.item.condition.text.capitalize(); + out.today.code = codes[input.item.condition.code]; //map weather code + + out.today.wind = {}; + out.today.wind.speed = input.wind.speed; + out.today.wind.deg = input.wind.direction; + out.today.humidity = input.atmosphere.humidity; + out.today.pressure = input.atmosphere.pressure; + out.today.sunrise = input.astronomy.sunrise.toUpperCase(); + out.today.sunset = input.astronomy.sunset.toUpperCase(); + + out.today.day = getDayString(new Date()); + + out.forecast = []; + //grab only the number of forecast days desired from settings + for (var i = 0; i < settings.forecast; i++) { + var forecast = {}; + forecast.day = getDayString(new Date(input.item.forecast[i].date)); + forecast.code = codes[input.item.forecast[i].code]; //map weather code + forecast.desc = input.item.forecast[i].text.capitalize(); + forecast.temp = {max: Math.round(input.item.forecast[i].high), min: Math.round(input.item.forecast[i].low)} + out.forecast.push(forecast); + } + } + + return out; + + }; + + //Helpers + String.prototype.capitalize = function() { + return this.charAt(0).toUpperCase() + this.slice(1); + }; + + //take a date object and return a day string + function getDayString(date) { + return ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'][date.getDay()]; + }; + + //converts and epoch time in seconds to hours in the day + function epochToHours(date) { + date = new Date(date * 1000); + var hours = date.getHours(); + var minutes = date.getMinutes(); + var ampm = hours >= 12 ? 'PM' : 'AM'; + hours = hours % 12; + hours = hours ? hours : 12; // the hour '0' should be '12' + minutes = minutes < 10 ? '0'+minutes : minutes; + var strTime = hours + ':' + minutes + ' ' + ampm; + return strTime; + }; + + //Takes wind speed, direction in degrees and units + //and returns a string ex. (8.5, 270, "metric") returns "W 8.5 km/h" + function formatWind(speed, degrees, units) { + var wd = degrees; + if ((wd >= 0 && wd <= 11.25) || (wd > 348.75 && wd <= 360)) { + wd = "N"; + } + else if (wd > 11.25 && wd <= 33.75){ + wd = "NNE"; + } + else if (wd > 33.75 && wd <= 56.25){ + wd = "NE"; + } + else if (wd > 56.25 && wd <= 78.75){ + wd = "ENE"; + } + else if (wd > 78.75 && wd <= 101.25){ + wd = "E"; + } + else if (wd > 101.25 && wd <= 123.75){ + wd = "ESE"; + } + else if (wd > 123.75 && wd <= 146.25){ + wd = "SE"; + } + else if (wd > 146.25 && wd <= 168.75){ + wd = "SSE"; + } + else if (wd > 168.75 && wd <= 191.25){ + wd = "S"; + } + else if (wd > 191.25 && wd <= 213.75){ + wd = "SSW"; + } + else if (wd > 213.75 && wd <= 236.25){ + wd = "SW"; + } + else if (wd > 236.25 && wd <= 258.75){ + wd = "WSW"; + } + else if (wd > 258.75 && wd <= 281.25){ + wd = "W"; + } + else if (wd > 281.25 && wd <= 303.75){ + wd = "WNW"; + } + else if (wd > 303.75 && wd <= 326.25){ + wd = "NW"; + } + else if (wd > 326.25 && wd <= 348.75){ + wd = "NNW"; + } + var speedUnits = (units == "metric")?"km/h":"mph"; + return wd + " " + speed + " " + speedUnits; + }; + + +})( jQuery, window, document ); diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/lib/jquery.flatWeatherPlugin.min.js b/mdot/mDotServer.censis/mDotServer.censis/app/lib/jquery.flatWeatherPlugin.min.js new file mode 100644 index 0000000..1cc2e8e --- /dev/null +++ b/mdot/mDotServer.censis/mDotServer.censis/app/lib/jquery.flatWeatherPlugin.min.js @@ -0,0 +1,3 @@ +//flatWeatherJqueryPlugin min +//2014-10-21 +(function(e,t,n,r){function u(t,n){this.element=t;this.settings=e.extend({},s,n);if(!this.settings.units||this.settings.units=="auto"){this.settings.units=["united states","usa","united states of america","us"].indexOf(this.settings.country.toLowerCase())==-1?"metric":"imperial"}this.settings.forecast=Math.min(this.settings.forecast,5);this._name=i;this.once=false;this.init()}function a(e,t){var n={};if(t.api=="openweathermap"){if(e[0].name!=""){n.location=e[0].name+", "+e[0].sys.country;n.city=e[0].name}else if(e[1].city.name!=""){n.location=e[1].city.name+", "+e[1].city.country;n.city=e[1].city.name}else{n.location=t.location+", "+t.country;n.city=t.location}n.today={};n.today.temp={};n.today.temp.now=Math.round(e[0].main.temp);n.today.temp.min=Math.round(e[0].main.temp_min);n.today.temp.max=Math.round(e[0].main.temp_max);n.today.desc=e[0].weather[0].description.capitalize();n.today.code=e[0].weather[0].id;n.today.wind=e[0].wind;n.today.humidity=e[0].main.humidity;n.today.pressure=e[0].main.pressure;n.today.sunrise=l(e[0].sys.sunrise);n.today.sunset=l(e[0].sys.sunset);n.today.day=f(new Date);n.forecast=[];for(var r=0;r=12?"PM":"AM";t=t%12;t=t?t:12;n=n<10?"0"+n:n;var i=t+":"+n+" "+r;return i}function c(e,t,n){var r=t;if(r>=0&&r<=11.25||r>348.75&&r<=360){r="N"}else if(r>11.25&&r<=33.75){r="NNE"}else if(r>33.75&&r<=56.25){r="NE"}else if(r>56.25&&r<=78.75){r="ENE"}else if(r>78.75&&r<=101.25){r="E"}else if(r>101.25&&r<=123.75){r="ESE"}else if(r>123.75&&r<=146.25){r="SE"}else if(r>146.25&&r<=168.75){r="SSE"}else if(r>168.75&&r<=191.25){r="S"}else if(r>191.25&&r<=213.75){r="SSW"}else if(r>213.75&&r<=236.25){r="SW"}else if(r>236.25&&r<=258.75){r="WSW"}else if(r>258.75&&r<=281.25){r="W"}else if(r>281.25&&r<=303.75){r="WNW"}else if(r>303.75&&r<=326.25){r="NW"}else if(r>326.25&&r<=348.75){r="NNW"}var i=n=="metric"?"km/h":"mph";return r+" "+e+" "+i}var i="flatWeatherPlugin";var s={location:"Waterloo, ON",country:"Canada",displayCityNameOnly:false,api:"openweathermap",forecast:5,apikey:"",view:"full",render:true,loadingAnimation:true};var o={openweathermap:["http://api.openweathermap.org/data/2.5/weather","http://api.openweathermap.org/data/2.5/forecast/daily"],yahoo:["https://query.yahooapis.com/v1/public/yql"]};e.extend(u.prototype,{init:function(){if(this.settings.render){if(this.settings.loadingAnimation&&!this.once){this.loading=e("
              ",{id:"flatWeatherLoading","class":"wi loading"});this.loading.appendTo(this.element)}this.fetchWeather().then(this.render,this.error)}this.once=true},fetchWeather:function(){var t=this;var n=new e.Deferred;var r=[];var i=this.settings.location+" "+this.settings.country;if(this.settings.api=="openweathermap"){var s={};s.q=i;s.units=this.settings.units;if(this.settings.apikey)s.appid=this.settings.apikey;r.push(s);s.cnt=this.settings.forecast+1;r.push(s)}else if(this.settings.api=="yahoo"){var u=this.settings.units=="metric"?"c":"f";var s={};s.q="select * from weather.forecast where woeid in (select woeid from geo.places(1) where text='"+i+"') AND u='"+u+"'";s.env="store://datatables.org/alltableswithkeys";s.format="json";r.push(s)}var f=[];for(var l=0;l1){r=r.map(function(e){return e[0]})}else{r=r[0]}if(t.settings.api=="openweathermap"&&!(r[0].cod=="200"&&r[1].cod=="200")){console.log("Error interacting with the openweathermap api see error object below for details:");console.log(r);n.reject(r,t)}else if(t.settings.api=="yahoo"&&(r.query.count==0||r.query.results.channel.description=="Yahoo! Weather Error")){console.log("Error interacting with the yahoo api see error object below for details:");console.log(r);n.reject(r,t)}else{var i=a(r,t.settings);t._weather=i;e.data(t.element,"weather",i);n.resolve(i,t)}}).fail(function(e){console.log("fail");n.reject(e,t)});return n},error:function(t,n){if(!n){n=this}if(n.settings.loadingAnimation&&n.settings.render){n.loading.remove()}if(n.settings.api=="openweathermap"){if(t[0].cod!="200"){t=t[0].cod+" "+t[0].message+". See console log for details."}else{t=t[1]+" See console log for details."}}else if(n.settings.api=="yahoo"){if(t.query.results){t="Error: "+t.query.results.channel.item.title+". See console log for details."}else{t="Error: no results. See console log for details."}}var r=e("
              ",{"class":"flatWeatherPlugin "+n.settings.view});e("

              ").text("Error").appendTo(r);e("

              ").text(t).appendTo(r);e(n.element).html(r);return e(n.element)},render:function(t,n){if(!n){n=this;t=this._weather}var r=n.settings.units=="metric"?"°C":"°F";if(n.settings.loadingAnimation&&n.settings.render){n.loading.remove()}var i=e("

              ",{"class":"flatWeatherPlugin "+n.settings.view});if(n.settings.displayCityNameOnly){e("

              ").text(t.city).appendTo(i)}else{e("

              ").text(t.location).appendTo(i)}if(n.settings.view!="forecast"){var s=e("
              ",{"class":"wiToday"});var o=e("
              ",{"class":"wiIconGroup"});e("
              ",{"class":"wi "+"wi"+t.today.code}).appendTo(o);e("

              ",{"class":"wiText"}).text(t.today.desc).appendTo(o);o.appendTo(s);e("

              ",{"class":"wiTemperature"}).html(t.today.temp.now+""+r+"").appendTo(s);s.appendTo(i)}if(n.settings.view!="simple"){var u=e("

              ",{"class":"wiDetail"});if(n.settings.view=="partial"){e("

              ",{"class":"wiDay"}).text(t.today.day).appendTo(s)}if(n.settings.view!="partial"){if(n.settings.view!="today"){e("

              ",{"class":"wiDay"}).text(t.today.day).appendTo(u)}var a=e("

                ",{"class":"astronomy"}).appendTo(u);e("
              • ",{"class":"wi sunrise"}).text(t.today.sunrise).appendTo(a);e("
              • ",{"class":"wi sunset"}).text(t.today.sunset).appendTo(a);var f=e("
                  ",{"class":"temp"}).appendTo(u);e("
                • ").html("Max : "+t.today.temp.max+""+r+"").appendTo(f);e("
                • ").html("Min : "+t.today.temp.min+""+r+"").appendTo(f);var l=e("
                    ",{"class":"atmosphere"}).appendTo(u);e("
                  • ",{"class":"wi humidity"}).text(t.today.humidity).appendTo(l);e("
                  • ",{"class":"wi pressure"}).text(t.today.pressure).appendTo(l);e("
                  • ",{"class":"wi wind"}).text(c(t.today.wind.speed,t.today.wind.deg,n.settings.units)).appendTo(l);u.appendTo(s)}if(n.settings.view!="today"||n.settings.view=="forecast"){var h=e("
                      ",{"class":"wiForecasts"});var p=n.settings.view=="forecast"?0:1;for(var d=p;d",{"class":"wiDay"}).html(""+t.forecast[d].day+"").appendTo(h);var m=e("
                        ",{"class":"wiForecast"}).appendTo(v);e("
                      • ",{"class":"wi "+"wi"+t.forecast[d].code}).appendTo(m);e("
                      • ",{"class":"wiMax"}).html(t.forecast[d].temp.max+""+r+"").appendTo(m);e("
                      • ",{"class":"wiMin"}).html(t.forecast[d].temp.min+""+r+"").appendTo(m)}h.appendTo(i)}}e(n.element).html(i);return e(n.element)}});e.fn[i]=function(t,n){if(e.isFunction(u.prototype[t])){return this.data("plugin_"+i)[t](n)}return this.each(function(){if(!e.data(this,"plugin_"+i)){var n=new u(this,t);return e.data(this,"plugin_"+i,n)}})};String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.slice(1)};})(jQuery,window,document) \ No newline at end of file diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/lib/themes/dark.js b/mdot/mDotServer.censis/mDotServer.censis/app/lib/themes/dark.js new file mode 100644 index 0000000..fa7bbd6 --- /dev/null +++ b/mdot/mDotServer.censis/mDotServer.censis/app/lib/themes/dark.js @@ -0,0 +1,195 @@ +AmCharts.themes.dark = { + + themeName: "dark", + + AmChart: { + color: "#e7e7e7", backgroundColor: "#282828" + }, + + AmCoordinateChart: { + colors: ["#ae85c9", "#aab9f7", "#b6d2ff", "#c9e6f2", "#c9f0e1", "#e8d685", "#e0ad63", "#d48652", "#d27362", "#495fba", "#7a629b", "#8881cc"] + }, + + AmStockChart: { + colors: ["#639dbd", "#e8d685", "#ae85c9", "#c9f0e1", "#d48652", "#629b6d", "#719dc3", "#719dc3"] + }, + + AmSlicedChart: { + outlineAlpha: 1, + outlineThickness: 2, + labelTickColor: "#FFFFFF", + labelTickAlpha: 0.3, + colors: ["#495fba", "#e8d685", "#ae85c9", "#c9f0e1", "#d48652", "#629b6d", "#719dc3", "#719dc3"] + }, + + AmRectangularChart: { + zoomOutButtonColor: '#FFFFFF', + zoomOutButtonRollOverAlpha: 0.15, + zoomOutButtonImage: "lensWhite" + }, + + AxisBase: { + axisColor: "#FFFFFF", + axisAlpha: 0.3, + gridAlpha: 0.1, + gridColor: "#FFFFFF", + dashLength: 3 + }, + + ChartScrollbar: { + backgroundColor: "#000000", + backgroundAlpha: 0.2, + graphFillAlpha: 0.2, + graphLineAlpha: 0, + graphFillColor: "#FFFFFF", + selectedGraphFillColor: "#FFFFFF", + selectedGraphFillAlpha: 0.4, + selectedGraphLineColor: "#FFFFFF", + selectedBackgroundColor: "#FFFFFF", + selectedBackgroundAlpha: 0.09, + gridAlpha: 0.15 + }, + + ChartCursor: { + cursorColor: "#FFFFFF", + color: "#000000", + cursorAlpha: 0.5 + }, + + AmLegend: { + color: "#e7e7e7" + }, + + AmGraph: { + lineAlpha: 0.9 + }, + + + GaugeArrow: { + color: "#FFFFFF", + alpha: 0.8, + nailAlpha: 0, + innerRadius: "40%", + nailRadius: 15, + startWidth: 15, + borderAlpha: 0.8, + nailBorderAlpha: 0 + }, + + GaugeAxis: { + tickColor: "#FFFFFF", + tickAlpha: 1, + tickLength: 15, + minorTickLength: 8, + axisThickness: 3, + axisColor: '#FFFFFF', + axisAlpha: 1, + bandAlpha: 0.8 + }, + + TrendLine: { + lineColor: "#c03246", + lineAlpha: 0.8 + }, + + // ammap + AreasSettings: { + alpha: 0.8, + color: "#FFFFFF", + colorSolid: "#000000", + unlistedAreasAlpha: 0.4, + unlistedAreasColor: "#FFFFFF", + outlineColor: "#000000", + outlineAlpha: 0.5, + outlineThickness: 0.5, + rollOverColor: "#3c5bdc", + rollOverOutlineColor: "#000000", + selectedOutlineColor: "#000000", + selectedColor: "#f15135", + unlistedAreasOutlineColor: "#000000", + unlistedAreasOutlineAlpha: 0.5 + }, + + LinesSettings: { + color: "#FFFFFF", + alpha: 0.8 + }, + + ImagesSettings: { + alpha: 0.8, + labelColor: "#FFFFFF", + color: "#FFFFFF", + labelRollOverColor: "#3c5bdc" + }, + + ZoomControl: { + buttonFillAlpha:0.7, + buttonIconColor:"#494949" + }, + + SmallMap: { + mapColor: "#FFFFFF", + rectangleColor: "#FFFFFF", + backgroundColor: "#000000", + backgroundAlpha: 0.7, + borderThickness: 1, + borderAlpha: 0.8 + }, + + // the defaults below are set using CSS syntax, you can use any existing css property + // if you don't use Stock chart, you can delete lines below + PeriodSelector: { + color: "#e7e7e7" + }, + + PeriodButton: { + color: "#e7e7e7", + background: "transparent", + opacity: 0.7, + border: "1px solid rgba(255, 255, 255, .15)", + MozBorderRadius: "5px", + borderRadius: "5px", + margin: "1px", + outline: "none", + boxSizing: "border-box" + }, + + PeriodButtonSelected: { + color: "#e7e7e7", + backgroundColor: "rgba(255, 255, 255, 0.1)", + border: "1px solid rgba(255, 255, 255, .3)", + MozBorderRadius: "5px", + borderRadius: "5px", + margin: "1px", + outline: "none", + opacity: 1, + boxSizing: "border-box" + }, + + PeriodInputField: { + color: "#e7e7e7", + background: "transparent", + border: "1px solid rgba(255, 255, 255, .15)", + outline: "none" + }, + + DataSetSelector: { + color: "#e7e7e7", + selectedBackgroundColor: "rgba(255, 255, 255, .25)", + rollOverBackgroundColor: "rgba(255, 255, 255, .15)" + }, + + DataSetCompareList: { + color: "#e7e7e7", + lineHeight: "100%", + boxSizing: "initial", + webkitBoxSizing: "initial", + border: "1px solid rgba(255, 255, 255, .15)" + }, + + DataSetSelect: { + border: "1px solid rgba(255, 255, 255, .15)", + outline: "none" + } + +}; \ No newline at end of file diff --git a/mdot/mDotServer.censis/mDotServer.censis/app/test.html b/mdot/mDotServer.censis/mDotServer.censis/app/test.html new file mode 100644 index 0000000..3ec545c --- /dev/null +++ b/mdot/mDotServer.censis/mDotServer.censis/app/test.html @@ -0,0 +1,390 @@ + + + + + Graph + + + + + + + + + + + + + + +
                        +
                        +
                        +
                        +
                        + + +
                        +
                        +
                        +
                        +
                        + +
                        + + +
                        + + + +
                        + + +
                        + +
                        + + +
                        + + +
                        +
                        + +
                        +
                        +
                        + +
                        +
                        +

                        + 647 +

                        +
                        + +
                        +
                        + + +
                        + +
                        +
                        +
                        + +
                        + + +
                        +
                        +
                        + +
                        +
                        +

                        + 28 +

                        +
                        +
                        +
                        +
                        + +
                        +
                        +

                        + 55% +

                        +
                        +
                        +
                        +
                        + +
                        +
                        +

                        + 2404 +

                        +
                        +
                        + +
                        + +
                        + + + +
                        + +
                        + + + + + + + + + + +
                        +
                        +
                        +
                        + +
                        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mdot/mDotServer.censis/mDotServer.censis/gulpfile.js b/mdot/mDotServer.censis/mDotServer.censis/gulpfile.js index a3a693f..6935238 100644 --- a/mdot/mDotServer.censis/mDotServer.censis/gulpfile.js +++ b/mdot/mDotServer.censis/mDotServer.censis/gulpfile.js @@ -23,9 +23,8 @@ var filePath = { var fontOptions = { }; - gulp.task('appJS', function() { - return gulp.src(['app/js/mdot.js']) + return gulp.src(['app/js/websocket.js','app/js/socketmanager.js','app/js/mdot.js']) .pipe(stripDebug()) .pipe(jshint('.jshintrc')) .pipe(jshint.reporter('default')) @@ -54,6 +53,7 @@ gulp.task('appJS', function() { .pipe(gulp.dest('dist/js')); }); + gulp.task('vendor', function() { return gulp.src(['src/bower_modules/mui/packages/cdn/js/mui.min.js', 'src/bower_modules/jquery/dist/jquery.min.js', @@ -64,17 +64,24 @@ gulp.task('vendor', function() { 'src/bower_modules/notification-js/build/notification.min.js', 'src/bower_modules/amstock3/amcharts/amcharts.js', 'src/bower_modules/amstock3/amcharts/serial.js', - 'src/bower_modules/amstock3/amcharts/amstock.js' + 'src/bower_modules/amstock3/amcharts/amstock.js', + 'app/lib/themes/dark.js', + 'app/lib/dateTime.js', + 'app/lib/flipclock.min.js', + 'app/lib/jquery.flatWeatherPlugin.min.js' ]) .pipe(concat('vendor.js')) .pipe(uglify({mangle: false})) .pipe(gulp.dest('dist/js')); }); - - gulp.task('styles', function() { - return gulp.src(['src/bower_modules/mui/packages/cdn/css/mui.min.css','app/css/test.css','app/css/style.css','src/bower_modules/notification-js/build/notification.min.css']) + return gulp.src(['src/bower_modules/mui/packages/cdn/css/mui.min.css', + 'app/css/test.css', + 'app/css/style.css', + 'src/bower_modules/notification-js/build/notification.min.css', + 'app/css/flipclock.css', + 'css/flatWeatherPlugin.css']) .pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4')) .pipe(cssnano()) .pipe(concat('app.css')) @@ -101,6 +108,7 @@ gulp.task('index', function() { gulp.task('partials', function() { gulp.src(['app/fav/**/*']).pipe(gulp.dest('dist/fav')); + gulp.src(['app/fonts/**/*']).pipe(gulp.dest('dist/fonts')); gulp.src(['app/lib/images/**/*']).pipe(gulp.dest('dist/amcharts/images')); // Gulp.src(['app/libs/ejs_production.js']).pipe(gulp.dest('dist/libs')); // gulp.src(['app/libs/microevent.js']).pipe(gulp.dest('dist/libs')); diff --git a/mdot/mDotServer.censis/mDotServer.censis/views/test.ejs b/mdot/mDotServer.censis/mDotServer.censis/views/test.ejs index 3dfc86b..8dae437 100644 --- a/mdot/mDotServer.censis/mDotServer.censis/views/test.ejs +++ b/mdot/mDotServer.censis/mDotServer.censis/views/test.ejs @@ -6,46 +6,145 @@ + + + - - - - - - - - - - - - - - - - - - - - + + + - -
                        -
                        -
                        + +
                        +
                        +
                        +
                        +
                        + + +
                        +
                        +
                        +
                        +
                        + +
                        + + +
                        + + + +
                        + + +
                        + +
                        + + +
                        + + +
                        +
                        + +
                        +
                        +
                        + +
                        +
                        + +
                        + +
                        +
                        + + +
                        + +
                        +
                        +
                        + +
                        + + +
                        +
                        +
                        + +
                        +
                        + +
                        +
                        +
                        +
                        + +
                        +
                        + +
                        +
                        +
                        +
                        + +
                        +
                        + +
                        +
                        + +
                        + +
                        + + +
                        -
                        -
                        -
                        -
                        -
                        -
                        +
                        - - + - - - + + + - + +
                        --> + - + + @@ -240,11 +333,45 @@ + + + + + + - - - + + + + + + + +