From 4e774a7b6965e4cc5ec67ba97010bf0770c603f6 Mon Sep 17 00:00:00 2001 From: William Troup Date: Sat, 30 Mar 2024 15:14:47 +0000 Subject: [PATCH 01/10] Updated to v3.1.0. --- README.md | 6 +++--- README_NUGET.md | 6 +++--- dist/heat.js | 4 ++-- dist/heat.js.css | 2 +- dist/heat.js.min.css | 2 +- dist/heat.min.js | 4 ++-- dist/themes/dark/heat.js.dark.bright-blue.theme.css | 2 +- dist/themes/dark/heat.js.dark.bright-orange.theme.css | 2 +- dist/themes/dark/heat.js.dark.bright-purple.theme.css | 2 +- dist/themes/dark/heat.js.dark.bright-yellow.theme.css | 2 +- dist/themes/dark/heat.js.dark.cadmium-red.theme.css | 2 +- dist/themes/dark/heat.js.dark.github.theme.css | 2 +- dist/themes/light/heat.js.light.bright-orange.theme.css | 2 +- dist/themes/light/heat.js.light.bright-purple.theme.css | 2 +- dist/themes/light/heat.js.light.gamboge.theme.css | 2 +- dist/themes/light/heat.js.light.neon-blue.theme.css | 2 +- dist/themes/light/heat.js.light.red.theme.css | 2 +- dist/themes/light/heat.js.light.shamrock-green.theme.css | 2 +- dist/translations/heat.translations.af.js | 2 +- dist/translations/heat.translations.ar.js | 2 +- dist/translations/heat.translations.be.js | 2 +- dist/translations/heat.translations.bg.js | 2 +- dist/translations/heat.translations.bn.js | 2 +- dist/translations/heat.translations.ca.js | 2 +- dist/translations/heat.translations.da.js | 2 +- dist/translations/heat.translations.de.js | 2 +- dist/translations/heat.translations.el.js | 2 +- dist/translations/heat.translations.en.js | 2 +- dist/translations/heat.translations.eo.js | 2 +- dist/translations/heat.translations.es.js | 2 +- dist/translations/heat.translations.et.js | 2 +- dist/translations/heat.translations.fa.js | 2 +- dist/translations/heat.translations.fi.js | 2 +- dist/translations/heat.translations.fr.js | 2 +- dist/translations/heat.translations.fy.js | 2 +- dist/translations/heat.translations.ga.js | 2 +- dist/translations/heat.translations.gl.js | 2 +- dist/translations/heat.translations.he.js | 2 +- dist/translations/heat.translations.hi.js | 2 +- dist/translations/heat.translations.hu.js | 2 +- dist/translations/heat.translations.hy.js | 2 +- dist/translations/heat.translations.id.js | 2 +- dist/translations/heat.translations.is.js | 2 +- dist/translations/heat.translations.it.js | 2 +- dist/translations/heat.translations.ja.js | 2 +- dist/translations/heat.translations.ka.js | 2 +- dist/translations/heat.translations.ko.js | 2 +- dist/translations/heat.translations.lb.js | 2 +- dist/translations/heat.translations.lt.js | 2 +- dist/translations/heat.translations.lv.js | 2 +- dist/translations/heat.translations.ms.js | 2 +- dist/translations/heat.translations.ne.js | 2 +- dist/translations/heat.translations.nl.js | 2 +- dist/translations/heat.translations.no.js | 2 +- dist/translations/heat.translations.pl.js | 2 +- dist/translations/heat.translations.pt.js | 2 +- dist/translations/heat.translations.ro.js | 2 +- dist/translations/heat.translations.si.js | 2 +- dist/translations/heat.translations.sk.js | 2 +- dist/translations/heat.translations.sl.js | 2 +- dist/translations/heat.translations.sv.js | 2 +- dist/translations/heat.translations.ta.js | 2 +- dist/translations/heat.translations.te.js | 2 +- dist/translations/heat.translations.th.js | 2 +- dist/translations/heat.translations.tl.js | 2 +- dist/translations/heat.translations.tr.js | 2 +- dist/translations/heat.translations.uk.js | 2 +- dist/translations/heat.translations.zh-tw.js | 2 +- dist/translations/heat.translations.zh.js | 2 +- heat.js.nuspec | 2 +- package.json | 2 +- src/heat.js | 4 ++-- src/heat.js.scss | 2 +- 73 files changed, 80 insertions(+), 80 deletions(-) diff --git a/README.md b/README.md index 9f2740e3..a995e855 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,15 @@ Heat.js [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Heat.js%2C%20a%20free%20JavaScript%heat%20map&url=https://github.com/williamtroup/Heat.js&hashtags=javascript,heat,map) -[![npm](https://img.shields.io/badge/npmjs-v3.0.0-blue)](https://www.npmjs.com/package/jheat.js) -[![nuget](https://img.shields.io/badge/nuget-v3.0.0-purple)](https://www.nuget.org/packages/jHeat.js/) +[![npm](https://img.shields.io/badge/npmjs-v3.1.0-blue)](https://www.npmjs.com/package/jheat.js) +[![nuget](https://img.shields.io/badge/nuget-v3.1.0-purple)](https://www.nuget.org/packages/jHeat.js/) [![license](https://img.shields.io/badge/license-MIT-green)](https://github.com/williamtroup/Heat.js/blob/main/LICENSE.txt) [![discussions Welcome](https://img.shields.io/badge/discussions-Welcome-red)](https://github.com/williamtroup/Heat.js/discussions) [![coded by William Troup](https://img.shields.io/badge/coded_by-William_Troup-yellow)](https://william-troup.com/) >

🌞 A lightweight JavaScript library that generates customizable heat maps, charts, and statistics to visualize date-based activity and trends.

->

v3.0.0

+>

v3.1.0


![Heat.js](docs/images/main.png) diff --git a/README_NUGET.md b/README_NUGET.md index 3fe64279..7895a0bd 100644 --- a/README_NUGET.md +++ b/README_NUGET.md @@ -1,8 +1,8 @@ -# Heat.js v3.0.0 +# Heat.js v3.1.0 [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Heat.js%2C%20a%20free%20JavaScript%heat%20map&url=https://github.com/williamtroup/Heat.js&hashtags=javascript,heat,map) -[![npm](https://img.shields.io/badge/npmjs-v3.0.0-blue)](https://www.npmjs.com/package/jheat.js) -[![nuget](https://img.shields.io/badge/nuget-v3.0.0-purple)](https://www.nuget.org/packages/jHeat.js/) +[![npm](https://img.shields.io/badge/npmjs-v3.1.0-blue)](https://www.npmjs.com/package/jheat.js) +[![nuget](https://img.shields.io/badge/nuget-v3.1.0-purple)](https://www.nuget.org/packages/jHeat.js/) [![license](https://img.shields.io/badge/license-MIT-green)](https://github.com/williamtroup/Heat.js/blob/main/LICENSE.txt) [![discussions Welcome](https://img.shields.io/badge/discussions-Welcome-red)](https://github.com/williamtroup/Heat.js/discussions) [![coded by William Troup](https://img.shields.io/badge/coded_by-William_Troup-yellow)](https://william-troup.com/) diff --git a/dist/heat.js b/dist/heat.js index a0568efa..2cd64c4a 100644 --- a/dist/heat.js +++ b/dist/heat.js @@ -1,4 +1,4 @@ -/*! Heat.js v3.0.0 | (c) Bunoon 2024 | MIT License */ +/*! Heat.js v3.1.0 | (c) Bunoon 2024 | MIT License */ (function() { var _parameter_Document = null, _parameter_Window = null, _parameter_Math = null, _parameter_JSON = null, _public = {}, _configuration = {}, _string = {empty:"", space:" ", newLine:"\n", dash:"-", underscore:"_", plus:"+", zero:"0", colon:":", comma:","}, _value = {notFound:-1}, _internal_Name_Holiday = "HOLIDAY", _local_Storage_Start_ID = "HJS_", _default_MonthsToShow = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], _default_DaysToShow = [1, 2, 3, 4, 5, 6, 7], _elements_Type = {}, _elements_Day_Width = null, _elements_DateCounts = {}, _elements_View_Name_Map = "map", _elements_View_Name_Chart = "chart", _elements_View_Name_Days = "days", _elements_View_Name_Statistics = "statistics", _elements_View_Map = 1, _elements_View_Chart = 2, _elements_View_Days = 3, _elements_View_Statistics = 4, _export_Type_Csv = "csv", _export_Type_Json = "json", _export_Type_Xml = "xml", _export_Type_Txt = "txt", _attribute_Name_Options = "data-heat-options"; @@ -2293,7 +2293,7 @@ return result; }; _public.getVersion = function() { - return "3.0.0"; + return "3.1.0"; }; (function(documentObject, windowObject, mathObject, jsonObject) { _parameter_Document = documentObject; diff --git a/dist/heat.js.css b/dist/heat.js.css index fff47359..ac8c7ced 100644 --- a/dist/heat.js.css +++ b/dist/heat.js.css @@ -1,5 +1,5 @@ /* - * Heat.js Library v3.0.0 + * Heat.js Library v3.1.0 * * Copyright 2024 Bunoon * Released under the MIT License diff --git a/dist/heat.js.min.css b/dist/heat.js.min.css index 827c36be..1b85c001 100644 --- a/dist/heat.js.min.css +++ b/dist/heat.js.min.css @@ -1,2 +1,2 @@ -/*! Heat.js v3.0.0 | (c) Bunoon 2024 | MIT License */ +/*! Heat.js v3.1.0 | (c) Bunoon 2024 | MIT License */ :root{--heat-js-default-font:system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--heat-js-text-bold-weight:400;--heat-js-title-bold-weight:900;--heat-js-sub-title-bold-weight:700;--heat-js-text-bold-weight-active:900;--heat-js-color-black:#3b3a3a;--heat-js-color-white:#adbac7;--heat-js-color-snow-white:#F5F5F5;--heat-js-color-gray:#AAAAAA;--heat-js-container-background-color:#22272e;--heat-js-container-border-color:#454c56;--heat-js-dialog-background-color:var(--heat-js-container-background-color);--heat-js-dialog-border-color:var(--heat-js-container-border-color);--heat-js-dialog-text-color:var(--heat-js-color-white);--heat-js-tooltip-background-color:var(--heat-js-container-background-color);--heat-js-tooltip-border-color:var(--heat-js-container-border-color);--heat-js-tooltip-text-color:var(--heat-js-color-white);--heat-js-years-background-color:var(--heat-js-container-background-color);--heat-js-years-border-color:var(--heat-js-container-border-color);--heat-js-years-text-color:var(--heat-js-color-white);--heat-js-years-background-color-hover:var(--heat-js-button-background-color-hover);--heat-js-years-text-color-hover:var(--heat-js-color-snow-white);--heat-js-title-opener-text-color-hover:var(--heat-js-color-gray);--heat-js-title-background-color:var(--heat-js-container-background-color);--heat-js-title-border-color:var(--heat-js-container-border-color);--heat-js-title-text-color:var(--heat-js-color-white);--heat-js-title-background-color-hover:var(--heat-js-button-background-color-hover);--heat-js-title-text-color-hover:var(--heat-js-color-snow-white);--heat-js-holiday-background-color:rgba( 210, 43, 43, 0.75 );--heat-js-holiday-border-color:rgba( 210, 43, 43, 0.5 );--heat-js-holiday-text-color:var(--heat-js-color-black);--heat-js-day-background-color:#2d333b;--heat-js-day-border-color:var(--heat-js-container-border-color);--heat-js-day-background-color-hover:var(--heat-js-container-border-color);--heat-js-day-spacing:6.3px;--heat-js-day-opacity-hover:0.7;--heat-js-day-opacity-active:0.5;--heat-js-day-size:1.1rem;--heat-js-day-chart-width:10px;--heat-js-day-color-1-background-color:rgba( 80, 200, 120, 0.25 );--heat-js-day-color-1-border-color:rgba( 80, 200, 120, 0.15 );--heat-js-day-color-1-text-color:var(--heat-js-color-white);--heat-js-day-color-2-background-color:rgba( 80, 200, 120, 0.50 );--heat-js-day-color-2-border-color:rgba( 80, 200, 120, 0.25 );--heat-js-day-color-2-text-color:var(--heat-js-color-white);--heat-js-day-color-3-background-color:rgba( 80, 200, 120, 0.75 );--heat-js-day-color-3-border-color:rgba( 80, 200, 120, 0.50 );--heat-js-day-color-3-text-color:var(--heat-js-color-black);--heat-js-day-color-4-background-color:rgba( 80, 200, 120, 1 );--heat-js-day-color-4-border-color:rgba( 80, 200, 120, 0.75 );--heat-js-day-color-4-text-color:var(--heat-js-color-black);--heat-js-view-days-background-color:var(--heat-js-day-color-4-background-color);--heat-js-view-days-border-color:var(--heat-js-day-color-4-border-color);--heat-js-view-days-text-color:var(--heat-js-day-color-4-text-color);--heat-js-button-background-color:var(--heat-js-day-background-color);--heat-js-button-border-color:var(--heat-js-container-border-color);--heat-js-button-text-color:var(--heat-js-color-white);--heat-js-button-background-color-hover:var(--heat-js-container-border-color);--heat-js-button-text-color-hover:var(--heat-js-color-snow-white);--heat-js-button-background-color-active:#616b79;--heat-js-button-text-color-active:var(--heat-js-color-snow-white);--heat-js-checkbox-background-color-checked:rgba( 80, 200, 120, 1 );--heat-js-checkbox-background-color:var(--heat-js-color-black);--heat-js-checkbox-border-color-checked:--heat-js-checkbox-background-color-checked;--heat-js-checkbox-border-color:var(--heat-js-color-white);--heat-js-panel-background-color:var(--heat-js-day-background-color);--heat-js-panel-border-color:var(--heat-js-container-border-color);--heat-js-border-control-radius:0.25rem;--heat-js-border-radius:0.5rem;--heat-js-border-radius-day:0.35rem;--heat-js-border-size:0.5px;--heat-js-border-size-day:1px;--heat-js-spacing:10px;--heat-js-spacing-font-size:0.85rem;--heat-js-spacing-day-font-size:0.6rem;--heat-js-transition:all .3s;--heat-js-animation-length:0.5s}div.heat-js{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;cursor:default;box-sizing:border-box;line-height:normal;font-family:var(--heat-js-default-font);display:inline-block;position:relative;border-radius:var(--heat-js-border-radius);background-color:var(--heat-js-container-background-color);color:var(--heat-js-color-white);border:var(--heat-js-border-size) solid var(--heat-js-container-border-color);padding:var(--heat-js-spacing);font-size:var(--heat-js-spacing-font-size);width:100%;max-width:700px;margin:0!important}div.heat-js div.view-switch{animation:fade-in-animation var(--heat-js-animation-length)}div.heat-js div.no-click{pointer-events:none!important}div.heat-js *{box-sizing:border-box;line-height:normal}div.heat-js *::before,div.heat-js *::after{box-sizing:border-box;line-height:normal}div.heat-js div.disabled{display:none;z-index:1000;position:absolute;background-color:rgba(0,0,0,.3);top:0;left:0;height:100%;width:100%;animation:fade-in-animation var(--heat-js-animation-length)}div.heat-js div.disabled div.dialog{display:none;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);max-width:450px;width:calc(100% - var(--heat-js-spacing) * 2);background-color:var(--heat-js-dialog-background-color);border:var(--heat-js-border-size) solid var(--heat-js-dialog-border-color);color:var(--heat-js-dialog-text-color);border-radius:var(--heat-js-border-radius);animation:fade-in-animation var(--heat-js-animation-length)}div.heat-js div.disabled div.dialog div.dialog-title-bar{position:relative;padding:var(--heat-js-spacing);text-align:left}div.heat-js div.disabled div.dialog div.dialog-title-bar span.dialog-title-bar-text{font-weight:var(--heat-js-title-bold-weight)}div.heat-js div.disabled div.dialog div.dialog-title-bar div.dialog-close{float:right;width:16px;height:16px;position:relative;cursor:pointer}div.heat-js div.disabled div.dialog div.dialog-title-bar div.dialog-close::before,div.heat-js div.disabled div.dialog div.dialog-title-bar div.dialog-close::after{content:"";position:absolute;height:16px;width:3px;left:6.5px;top:0;background-color:var(--heat-js-color-white);border-radius:var(--heat-js-border-radius);transition:var(--heat-js-transition)}div.heat-js div.disabled div.dialog div.dialog-title-bar div.dialog-close::before{transform:rotate(45deg)}div.heat-js div.disabled div.dialog div.dialog-title-bar div.dialog-close::after{transform:rotate(-45deg)}div.heat-js div.disabled div.dialog div.dialog-title-bar div.dialog-close:hover::before,div.heat-js div.disabled div.dialog div.dialog-title-bar div.dialog-close:hover::after{background-color:var(--heat-js-color-gray)}div.heat-js div.disabled div.dialog div.dialog-contents{padding:var(--heat-js-spacing);overflow-x:scroll;overflow-y:hidden}div.heat-js div.disabled div.configuration div.dialog-contents div.panel{background-color:var(--heat-js-panel-background-color);border:var(--heat-js-border-size) solid var(--heat-js-panel-border-color);border-radius:var(--heat-js-border-radius);padding:var(--heat-js-spacing)}div.heat-js div.disabled div.configuration div.dialog-contents div.side-container{vertical-align:top;display:inline-block;width:calc(50% - var(--heat-js-spacing));margin-right:var(--heat-js-spacing)}div.heat-js div.disabled div.configuration div.dialog-contents div.side-container:last-child{margin-right:0;width:50%}div.heat-js div.disabled div.configuration div.dialog-contents div.side-container div.side-container-title-text{margin-bottom:var(--heat-js-spacing);font-weight:var(--heat-js-sub-title-bold-weight)}div.heat-js div.disabled div.configuration div.dialog-contents div.side-container label.checkbox{margin-left:var(--heat-js-spacing)}div.heat-js div.title-bar{text-align:right;margin-bottom:calc(var(--heat-js-spacing) + var(--heat-js-spacing) / 2)}div.heat-js div.title-bar button{background-color:var(--heat-js-button-background-color);border:var(--heat-js-border-size) solid var(--heat-js-button-border-color);color:var(--heat-js-button-text-color);border-radius:var(--heat-js-border-radius);padding-top:5px;padding-bottom:5px;padding-left:9px;padding-right:9px;outline:none;transition:var(--heat-js-transition)}div.heat-js div.title-bar button:disabled{color:var(--heat-js-button-border-color)}div.heat-js div.title-bar button:not(.active):not(:disabled):active{background:var(--heat-js-button-background-color-active)!important;color:var(--heat-js-button-text-color-active)!important}div.heat-js div.title-bar button:not(.active):not(:disabled):hover{cursor:pointer;background:var(--heat-js-button-background-color-hover);color:var(--heat-js-button-text-color-hover)}div.heat-js div.title-bar button.active{cursor:default;background:var(--heat-js-button-background-color-hover);color:var(--heat-js-button-text-color-hover);transition:var(--heat-js-transition);font-weight:var(--heat-js-text-bold-weight-active)}div.heat-js div.title-bar button.back{margin-left:calc(var(--heat-js-spacing) * 2)!important}div.heat-js div.title-bar button.export,div.heat-js div.title-bar button.import{margin-right:calc(var(--heat-js-spacing) / 2)!important}div.heat-js div.title-bar div.configure{display:inline-block;width:8.5px;height:8.5px;position:relative;margin-right:var(--heat-js-spacing);transition:var(--heat-js-transition)}div.heat-js div.title-bar div.configure:hover::before,div.heat-js div.title-bar div.configure:hover::after{border-color:var(--heat-js-title-opener-text-color-hover);cursor:pointer}div.heat-js div.title-bar div.configure::before{content:"";position:absolute;height:8.5px;width:8.5px;border-color:var(--heat-js-color-white);border-width:2px;border-style:solid;transform:rotate(-45deg);top:0;left:0;transition:var(--heat-js-transition)}div.heat-js div.title-bar div.configure::after{content:"";position:absolute;height:8.5px;width:8.5px;border-color:var(--heat-js-color-white);border-width:2px;border-style:solid;transform:rotate(90deg);top:0;left:0;transition:var(--heat-js-transition)}div.heat-js div.title-bar button.export,div.heat-js div.title-bar button.refresh,div.heat-js div.title-bar button.import{display:none}@media (min-width:768px){div.heat-js div.title-bar button.export,div.heat-js div.title-bar button.refresh,div.heat-js div.title-bar button.import{display:inline-block}}div.heat-js div.title-bar div.title{float:left;font-weight:var(--heat-js-title-bold-weight);font-size:1.2rem;padding-bottom:3px;transition:var(--heat-js-transition);cursor:pointer}div.heat-js div.title-bar div.title:hover{color:var(--heat-js-title-opener-text-color-hover)}div.heat-js div.title-bar div.title:hover div.down-arrow{border-top-color:var(--heat-js-title-opener-text-color-hover)}div.heat-js div.title-bar div.title:hover div.titles-menu-container{display:block}div.heat-js div.title-bar div.title div.down-arrow{display:inline-block;width:0;height:0;border-left:8px solid transparent;border-right:8px solid transparent;border-top:14px solid var(--heat-js-color-white);transition:var(--heat-js-transition);margin-right:var(--heat-js-spacing)}div.heat-js div.title-bar div.title div.titles-menu-container{animation:fade-in-animation var(--heat-js-animation-length);padding-top:3px;display:none;position:absolute;min-width:100px;margin-top:3px;z-index:1000}div.heat-js div.title-bar div.title div.titles-menu-container div.titles-menu{border-radius:var(--heat-js-border-radius);background-color:var(--heat-js-title-background-color);border:var(--heat-js-border-size) solid var(--heat-js-title-border-color);color:var(--heat-js-title-text-color);overflow-y:scroll}div.heat-js div.title-bar div.title div.titles-menu-container div.titles-menu div.title-menu-header{color:var(--heat-js-color-white);font-weight:var(--heat-js-title-bold-weight);padding:var(--heat-js-spacing);padding-right:calc(var(--heat-js-spacing) * 3);text-align:left;width:100%;font-size:var(--heat-js-spacing-font-size)!important;cursor:default}div.heat-js div.title-bar div.title div.titles-menu-container div.titles-menu div.title-menu-item{color:var(--heat-js-color-white);font-weight:var(--heat-js-text-bold-weight);padding:var(--heat-js-spacing);padding-right:calc(var(--heat-js-spacing) * 3);padding-left:calc(var(--heat-js-spacing) * 3);text-align:left;width:100%;transition:var(--heat-js-transition);font-size:var(--heat-js-spacing-font-size)!important;position:relative}div.heat-js div.title-bar div.title div.titles-menu-container div.titles-menu div.title-menu-item::before{content:"";position:absolute;left:var(--heat-js-spacing);top:50%;transform:translate(0,-50%);border-radius:50%;width:8px;height:8px;background-color:var(--heat-js-color-white)}div.heat-js div.title-bar div.title div.titles-menu-container div.titles-menu div.title-menu-item:not(.title-menu-item-active):active{opacity:0.5!important}div.heat-js div.title-bar div.title div.titles-menu-container div.titles-menu div.title-menu-item:not(.title-menu-item-active):hover{cursor:pointer;background-color:var(--heat-js-title-background-color-hover);color:var(--heat-js-title-text-color-hover)}div.heat-js div.title-bar div.title div.titles-menu-container div.titles-menu div.title-menu-item:not(.title-menu-item-active):hover::before{background-color:var(--heat-js-title-text-color-hover)}div.heat-js div.title-bar div.title div.titles-menu-container div.titles-menu div.title-menu-item-active{background-color:var(--heat-js-title-background-color-hover);color:var(--heat-js-title-text-color-hover);font-weight:var(--heat-js-text-bold-weight-active);cursor:default!important}div.heat-js div.title-bar div.title div.titles-menu-container div.titles-menu div.title-menu-item-active::before{background-color:var(--heat-js-title-text-color-hover)}div.heat-js div.title-bar div.year-text{margin-left:var(--heat-js-spacing);margin-right:var(--heat-js-spacing);display:inline-block;font-weight:var(--heat-js-title-bold-weight);position:relative;padding-top:5px;padding-bottom:5px;transition:var(--heat-js-transition);cursor:pointer}div.heat-js div.title-bar div.year-text:hover{color:var(--heat-js-title-opener-text-color-hover)}div.heat-js div.title-bar div.year-text:hover div.down-arrow{border-top-color:var(--heat-js-title-opener-text-color-hover)}div.heat-js div.title-bar div.year-text:hover div.years-menu-container{display:block!important}div.heat-js div.title-bar div.year-text div.down-arrow{display:inline-block;width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-top:9px solid var(--heat-js-color-white);transition:var(--heat-js-transition);margin-left:calc(var(--heat-js-spacing) / 2)}div.heat-js div.title-bar div.year-text div.years-menu-container{animation:fade-in-animation var(--heat-js-animation-length);padding-top:5px;display:none;position:absolute;width:80px;left:50%;transform:translateX(-50%);margin-top:5px;z-index:1000}div.heat-js div.title-bar div.year-text div.years-menu-container div.years-menu{border-radius:var(--heat-js-border-radius);background-color:var(--heat-js-years-background-color);border:var(--heat-js-border-size) solid var(--heat-js-years-border-color);color:var(--heat-js-years-text-color);max-height:183px;height:100%;overflow-y:scroll;scroll-snap-type:y mandatory}div.heat-js div.title-bar div.year-text div.years-menu-container div.years-menu div.year-menu-item{color:var(--heat-js-color-white);font-weight:var(--heat-js-text-bold-weight);border-bottom:var(--heat-js-border-size) dashed var(--heat-js-container-border-color);padding:var(--heat-js-spacing);text-align:center;width:100%;transition:var(--heat-js-transition);scroll-snap-align:start}div.heat-js div.title-bar div.year-text div.years-menu-container div.years-menu div.year-menu-item:not(.year-menu-item-active):active{opacity:0.5!important}div.heat-js div.title-bar div.year-text div.years-menu-container div.years-menu div.year-menu-item:not(.year-menu-item-active):hover{cursor:pointer;background-color:var(--heat-js-years-background-color-hover);color:var(--heat-js-years-text-color-hover)}div.heat-js div.title-bar div.year-text div.years-menu-container div.years-menu div.year-menu-item:last-child{border-bottom:none}div.heat-js div.title-bar div.year-text div.years-menu-container div.years-menu div.year-menu-item-active{background-color:var(--heat-js-years-background-color-hover);color:var(--heat-js-years-text-color-hover);font-weight:var(--heat-js-text-bold-weight-active);cursor:default!important}div.heat-js div.title-bar div.year-text div.years-menu-container div.years-menu div.year-menu-item-current{font-style:italic;font-weight:var(--heat-js-text-bold-weight-active)}div.heat-js div.map-contents{overflow-x:scroll;overflow-y:hidden;min-height:191px;position:relative}div.heat-js div.map-contents div.no-data-message{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);font-weight:var(--heat-js-text-bold-weight)}div.heat-js div.map-contents div.map{display:inline-flex;flex-direction:row}div.heat-js div.map-contents div.map div.days,div.heat-js div.map-contents div.map div.days-months-bottom{background-color:var(--heat-js-container-background-color);padding-right:calc(var(--heat-js-spacing) * 3);padding-top:calc(var(--heat-js-spacing-font-size) + var(--heat-js-spacing) + 1px);position:sticky;left:0;display:none;z-index:50}@media (min-width:768px){div.heat-js div.map-contents div.map div.days,div.heat-js div.map-contents div.map div.days-months-bottom{display:block}}div.heat-js div.map-contents div.map div.days div.day-name,div.heat-js div.map-contents div.map div.days-months-bottom div.day-name{font-weight:var(--heat-js-text-bold-weight);text-align:left!important;height:var(--heat-js-day-size);margin-bottom:var(--heat-js-day-spacing);display:flex;justify-content:center;flex-direction:column}div.heat-js div.map-contents div.map div.days-months-bottom{padding-top:0!important}div.heat-js div.map-contents div.map div.months{display:flex;justify-content:space-between;flex-grow:1}div.heat-js div.map-contents div.map div.months div.month{flex:1;pointer-events:none}div.heat-js div.map-contents div.map div.months div.month:last-child div.day-columns div.day-column:last-child div.day{margin-right:0!important}div.heat-js div.map-contents div.map div.months div.month div.month-name,div.heat-js div.map-contents div.map div.months div.month div.month-name-bottom{font-weight:var(--heat-js-text-bold-weight);text-align:left!important;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}div.heat-js div.map-contents div.map div.months div.month div.month-name{margin-bottom:var(--heat-js-spacing)}div.heat-js div.map-contents div.map div.months div.month div.month-name-bottom{margin-top:var(--heat-js-spacing)}div.heat-js div.map-contents div.map div.months div.month div.day-columns{display:flex;justify-content:space-between}div.heat-js div.map-contents div.map div.months div.month div.day-columns div.day-column div.day,div.heat-js div.map-contents div.map div.months div.month div.day-columns div.day-column div.day-disabled{display:flex;border-radius:var(--heat-js-border-radius-day);width:var(--heat-js-day-size);height:var(--heat-js-day-size);margin-right:var(--heat-js-day-spacing);margin-bottom:var(--heat-js-day-spacing);font-size:var(--heat-js-spacing-day-font-size);justify-content:center;align-items:center;overflow:hidden}div.heat-js div.map-contents div.map div.months div.month div.day-columns div.day-column div.day:last-child,div.heat-js div.map-contents div.map div.months div.month div.day-columns div.day-column div.day-disabled:last-child{margin-bottom:0}div.heat-js div.map-contents div.map div.months div.month div.day-columns div.day-column div.day{pointer-events:all;background-color:var(--heat-js-day-background-color);border:var(--heat-js-border-size) solid var(--heat-js-day-border-color);transition:var(--heat-js-transition);transition-property:opacity,background-color,color,border-color}div.heat-js div.map-contents div.map div.months div.month div.day-columns div.day-column div.day:not(.no-hover):hover{cursor:pointer;background:var(--heat-js-day-background-color-hover)}div.heat-js div.chart-contents{display:flex;overflow-x:scroll;overflow-y:hidden;text-wrap:nowrap;white-space:nowrap;position:relative}div.heat-js div.chart-contents div.no-data-message{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);font-weight:var(--heat-js-text-bold-weight)}div.heat-js div.chart-contents div.chart{display:inline-flex;flex-direction:row}div.heat-js div.chart-contents div.chart div.y-labels{background-color:var(--heat-js-container-background-color);padding-right:calc(var(--heat-js-spacing) * 3);padding-top:calc(var(--heat-js-spacing-font-size) + var(--heat-js-spacing) + 1px);position:sticky;left:0;display:none;border-right:var(--heat-js-border-size) solid var(--heat-js-container-border-color);z-index:50}@media (min-width:768px){div.heat-js div.chart-contents div.chart div.y-labels{display:block}}div.heat-js div.chart-contents div.chart div.y-labels div.label-0,div.heat-js div.chart-contents div.chart div.y-labels div.label-25,div.heat-js div.chart-contents div.chart div.y-labels div.label-50,div.heat-js div.chart-contents div.chart div.y-labels div.label-75,div.heat-js div.chart-contents div.chart div.y-labels div.label-100{font-weight:var(--heat-js-text-bold-weight);text-align:left!important;height:var(--heat-js-day-size);display:inline-flex;justify-content:center;flex-direction:column;position:absolute;left:0;padding-right:var(--heat-js-spacing)}div.heat-js div.chart-contents div.chart div.y-labels div.label-0{top:0}div.heat-js div.chart-contents div.chart div.y-labels div.label-25{top:25%;transform:translateY(-25%)}div.heat-js div.chart-contents div.chart div.y-labels div.label-50{top:50%;transform:translateY(-50%)}div.heat-js div.chart-contents div.chart div.y-labels div.label-75{top:75%;transform:translateY(-75%)}div.heat-js div.chart-contents div.chart div.y-labels div.label-100{bottom:0}div.heat-js div.chart-contents div.chart div.day-lines{flex:1;border-bottom:var(--heat-js-border-size) solid var(--heat-js-container-border-color)}div.heat-js div.chart-contents div.chart div.day-lines div.day-line-number{font-size:var(--heat-js-spacing-day-font-size);padding:calc(var(--heat-js-spacing) / 2);overflow:hidden}div.heat-js div.chart-contents div.chart div.day-lines div.day-line{border-top-left-radius:var(--heat-js-border-radius-day);border-top-right-radius:var(--heat-js-border-radius-day);background-color:var(--heat-js-day-background-color);border:var(--heat-js-border-size) solid var(--heat-js-day-border-color);border-bottom:none!important;vertical-align:bottom;min-width:var(--heat-js-day-chart-width);margin-right:1px;display:inline-block;transition:var(--heat-js-transition)}@media (min-width:768px){div.heat-js div.chart-contents div.chart div.day-lines div.day-line:first-child{margin-left:calc(var(--heat-js-spacing) / 2)}}div.heat-js div.chart-contents div.chart div.day-lines div.day-line:last-child{margin-right:0}div.heat-js div.chart-contents div.chart div.day-lines div.day-line:not(.no-hover):hover{cursor:pointer;background:var(--heat-js-day-background-color-hover)}div.heat-js div.chart-contents div.chart-months{position:relative;height:calc(var(--heat-js-spacing-font-size) + var(--heat-js-spacing))}div.heat-js div.chart-contents div.chart-months div.month-name,div.heat-js div.chart-contents div.chart-months div.month-name-space{font-weight:var(--heat-js-text-bold-weight);text-align:left!important;position:absolute;bottom:0}@media (min-width:768px){div.heat-js div.chart-contents div.chart-months div.month-name:first-child{margin-left:calc(var(--heat-js-spacing) / 2)}}div.heat-js div.chart-contents div.chart-months div.month-name:nth-child(2){margin-left:var(--heat-js-day-chart-width)}div.heat-js div.chart-contents div.chart-months div.month-name-space{left:0;top:0;position:sticky;background-color:var(--heat-js-container-background-color)}div.heat-js div.days-contents{display:flex;overflow:hidden;text-wrap:nowrap;white-space:nowrap;position:relative}div.heat-js div.days-contents div.no-days-message{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);font-weight:var(--heat-js-text-bold-weight)}div.heat-js div.days-contents div.days{display:flex;flex-direction:row}div.heat-js div.days-contents div.days div.y-labels{background-color:var(--heat-js-container-background-color);padding-right:calc(var(--heat-js-spacing) * 3);padding-top:calc(var(--heat-js-spacing-font-size) + var(--heat-js-spacing) + 1px);position:sticky;left:0;display:none;border-right:var(--heat-js-border-size) solid var(--heat-js-container-border-color);z-index:50}@media (min-width:768px){div.heat-js div.days-contents div.days div.y-labels{display:block}}div.heat-js div.days-contents div.days div.y-labels div.label-0,div.heat-js div.days-contents div.days div.y-labels div.label-25,div.heat-js div.days-contents div.days div.y-labels div.label-50,div.heat-js div.days-contents div.days div.y-labels div.label-75,div.heat-js div.days-contents div.days div.y-labels div.label-100{font-weight:var(--heat-js-text-bold-weight);text-align:left!important;height:var(--heat-js-day-size);display:inline-flex;justify-content:center;flex-direction:column;position:absolute;left:0;padding-right:var(--heat-js-spacing)}div.heat-js div.days-contents div.days div.y-labels div.label-0{top:0}div.heat-js div.days-contents div.days div.y-labels div.label-25{top:25%;transform:translateY(-25%)}div.heat-js div.days-contents div.days div.y-labels div.label-50{top:50%;transform:translateY(-50%)}div.heat-js div.days-contents div.days div.y-labels div.label-75{top:75%;transform:translateY(-75%)}div.heat-js div.days-contents div.days div.y-labels div.label-100{bottom:0}div.heat-js div.days-contents div.days div.day-lines{display:flex;align-items:baseline;flex:1;border-bottom:var(--heat-js-border-size) solid var(--heat-js-container-border-color);justify-content:space-between}div.heat-js div.days-contents div.days div.day-lines div.day-line-number{font-size:var(--heat-js-spacing-day-font-size);padding:calc(var(--heat-js-spacing) / 2);position:relative;overflow:hidden}div.heat-js div.days-contents div.days div.day-lines div.day-line-number div.count{position:absolute;top:calc(var(--heat-js-spacing) / 2);left:50%;transform:translateX(-50%);color:var(--heat-js-view-days-text-color)}div.heat-js div.days-contents div.days div.day-lines div.day-line{border-top-left-radius:var(--heat-js-border-radius-day);border-top-right-radius:var(--heat-js-border-radius-day);background-color:var(--heat-js-view-days-background-color);border:var(--heat-js-border-size) solid var(--heat-js-view-days-border-color);border-bottom:none!important;vertical-align:bottom;flex:1 100%;margin-right:var(--heat-js-spacing);display:inline-block;transition:var(--heat-js-transition)}@media (min-width:768px){div.heat-js div.days-contents div.days div.day-lines div.day-line:first-child{margin-left:calc(var(--heat-js-spacing) / 2)}}div.heat-js div.days-contents div.days div.day-lines div.day-line:last-child{margin-right:0}div.heat-js div.days-contents div.days div.day-lines div.day-line:not(.no-hover):hover{cursor:pointer;opacity:var(--heat-js-day-opacity-hover)}div.heat-js div.days-contents div.day-names{display:flex;flex:1;position:relative;justify-content:space-between;align-items:baseline;height:calc(var(--heat-js-spacing-font-size) + var(--heat-js-spacing) + 3px)}div.heat-js div.days-contents div.day-names div.day-name{flex:1 100%;margin-top:var(--heat-js-spacing);font-weight:var(--heat-js-text-bold-weight);text-align:center!important;overflow:hidden;text-overflow:ellipsis;margin-right:var(--heat-js-spacing)}@media (min-width:768px){div.heat-js div.days-contents div.day-names div.day-name:first-child{margin-left:calc(var(--heat-js-spacing) / 2)}}div.heat-js div.days-contents div.day-names div.day-name:last-child{margin-right:0}div.heat-js div.statistics-contents{display:flex;overflow:hidden;text-wrap:nowrap;white-space:nowrap;position:relative}div.heat-js div.statistics-contents div.no-statistics-message{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);font-weight:var(--heat-js-text-bold-weight)}div.heat-js div.statistics-contents div.statistics{display:flex;flex-direction:row}div.heat-js div.statistics-contents div.statistics div.y-labels{background-color:var(--heat-js-container-background-color);padding-right:calc(var(--heat-js-spacing) * 3);padding-top:calc(var(--heat-js-spacing-font-size) + var(--heat-js-spacing) + 1px);position:sticky;left:0;display:none;border-right:var(--heat-js-border-size) solid var(--heat-js-container-border-color);z-index:50}@media (min-width:768px){div.heat-js div.statistics-contents div.statistics div.y-labels{display:block}}div.heat-js div.statistics-contents div.statistics div.y-labels div.label-0,div.heat-js div.statistics-contents div.statistics div.y-labels div.label-25,div.heat-js div.statistics-contents div.statistics div.y-labels div.label-50,div.heat-js div.statistics-contents div.statistics div.y-labels div.label-75,div.heat-js div.statistics-contents div.statistics div.y-labels div.label-100{font-weight:var(--heat-js-text-bold-weight);text-align:left!important;height:var(--heat-js-day-size);display:inline-flex;justify-content:center;flex-direction:column;position:absolute;left:0;padding-right:var(--heat-js-spacing)}div.heat-js div.statistics-contents div.statistics div.y-labels div.label-0{top:0}div.heat-js div.statistics-contents div.statistics div.y-labels div.label-25{top:25%;transform:translateY(-25%)}div.heat-js div.statistics-contents div.statistics div.y-labels div.label-50{top:50%;transform:translateY(-50%)}div.heat-js div.statistics-contents div.statistics div.y-labels div.label-75{top:75%;transform:translateY(-75%)}div.heat-js div.statistics-contents div.statistics div.y-labels div.label-100{bottom:0}div.heat-js div.statistics-contents div.statistics div.range-lines{display:flex;align-items:baseline;flex:1;border-bottom:var(--heat-js-border-size) solid var(--heat-js-container-border-color);justify-content:space-between}div.heat-js div.statistics-contents div.statistics div.range-lines div.range-line-number{font-size:var(--heat-js-spacing-day-font-size);padding:calc(var(--heat-js-spacing) / 2);position:relative;overflow:hidden}div.heat-js div.statistics-contents div.statistics div.range-lines div.range-line-number div.count{position:absolute;top:calc(var(--heat-js-spacing) / 2);left:50%;transform:translateX(-50%)}div.heat-js div.statistics-contents div.statistics div.range-lines div.range-line{border-top-left-radius:var(--heat-js-border-radius-day);border-top-right-radius:var(--heat-js-border-radius-day);background-color:var(--heat-js-day-background-color);border:var(--heat-js-border-size) solid var(--heat-js-day-border-color);border-bottom:none!important;vertical-align:bottom;flex:1 100%;margin-right:var(--heat-js-spacing);display:inline-block;transition:var(--heat-js-transition)}@media (min-width:768px){div.heat-js div.statistics-contents div.statistics div.range-lines div.range-line:first-child{margin-left:calc(var(--heat-js-spacing) / 2)}}div.heat-js div.statistics-contents div.statistics div.range-lines div.range-line:last-child{margin-right:0}div.heat-js div.statistics-contents div.statistics div.range-lines div.range-line:not(.no-hover):hover{cursor:pointer;background:var(--heat-js-day-background-color-hover)}div.heat-js div.statistics-contents div.statistics-ranges{display:flex;flex:1;position:relative;justify-content:space-between;align-items:baseline;height:calc(var(--heat-js-spacing-font-size) + var(--heat-js-spacing) + 3px)}div.heat-js div.statistics-contents div.statistics-ranges div.range-name{flex:1 100%;margin-top:var(--heat-js-spacing);font-weight:var(--heat-js-text-bold-weight);text-align:center!important;overflow:hidden;text-overflow:ellipsis;margin-right:var(--heat-js-spacing)}@media (min-width:768px){div.heat-js div.statistics-contents div.statistics-ranges div.range-name:first-child{margin-left:calc(var(--heat-js-spacing) / 2)}}div.heat-js div.statistics-contents div.statistics-ranges div.range-name:last-child{margin-right:0}div.heat-js div.description{text-align:center;margin-top:calc(var(--heat-js-spacing) + var(--heat-js-spacing) / 2);text-align:center}@media (min-width:768px){div.heat-js div.description{text-align:left}}@media (min-width:768px){div.heat-js div.description{text-align:left}}div.heat-js div.description span.label,div.heat-js div.description a.label,div.heat-js div.description a.label:visited{color:var(--heat-js-color-white);font-weight:var(--heat-js-text-bold-weight);text-decoration:none}div.heat-js div.description a.label{transition:var(--heat-js-transition)}div.heat-js div.description a.label:active{color:var(--heat-js-color-gray)}div.heat-js div.description a.label:hover{text-decoration:underline}div.heat-js div.guide{display:block}@media (min-width:768px){div.heat-js div.guide{display:flex}}div.heat-js div.guide div.map-types,div.heat-js div.guide div.map-toggles{margin-top:calc(var(--heat-js-spacing) + var(--heat-js-spacing) / 2);width:100%}@media (min-width:768px){div.heat-js div.guide div.map-types,div.heat-js div.guide div.map-toggles{margin-bottom:0}}div.heat-js div.guide div.map-types{text-align:center;flex-grow:unset;margin-right:0;text-align:center}@media (min-width:768px){div.heat-js div.guide div.map-types{text-align:left;width:unset;flex-grow:1;margin-right:var(--heat-js-spacing)}}div.heat-js div.guide div.map-types button{background-color:var(--heat-js-button-background-color);border:var(--heat-js-border-size) solid var(--heat-js-button-border-color);color:var(--heat-js-button-text-color);border-radius:var(--heat-js-border-radius);padding-top:5px;padding-bottom:5px;padding-left:9px;padding-right:9px;outline:none;transition:var(--heat-js-transition)}div.heat-js div.guide div.map-types button:disabled{color:var(--heat-js-button-border-color)}div.heat-js div.guide div.map-types button:not(.active):not(:disabled):active{background:var(--heat-js-button-background-color-active)!important;color:var(--heat-js-button-text-color-active)!important}div.heat-js div.guide div.map-types button:not(.active):not(:disabled):hover{cursor:pointer;background:var(--heat-js-button-background-color-hover);color:var(--heat-js-button-text-color-hover)}div.heat-js div.guide div.map-types button.active{cursor:default;background:var(--heat-js-button-background-color-hover);color:var(--heat-js-button-text-color-hover);transition:var(--heat-js-transition);font-weight:var(--heat-js-text-bold-weight-active)}@media (min-width:768px){div.heat-js div.guide div.map-types{text-align:left}}div.heat-js div.guide div.map-types span.label,div.heat-js div.guide div.map-types a.label,div.heat-js div.guide div.map-types a.label:visited{color:var(--heat-js-color-white);font-weight:var(--heat-js-text-bold-weight);text-decoration:none}div.heat-js div.guide div.map-types a.label{transition:var(--heat-js-transition)}div.heat-js div.guide div.map-types a.label:active{color:var(--heat-js-color-gray)}div.heat-js div.guide div.map-types a.label:hover{text-decoration:underline}div.heat-js div.guide div.map-types button{margin-left:0!important;margin-right:calc(var(--heat-js-spacing) / 2)!important}div.heat-js div.guide div.map-toggles{display:flex;align-items:center;justify-content:center;text-align:center}@media (min-width:768px){div.heat-js div.guide div.map-toggles{text-align:right;justify-content:right;width:auto}}div.heat-js div.guide div.map-toggles div.less-text,div.heat-js div.guide div.map-toggles div.more-text{display:inline-block;font-weight:var(--heat-js-text-bold-weight);transition:var(--heat-js-transition)}div.heat-js div.guide div.map-toggles div.less-text:hover,div.heat-js div.guide div.map-toggles div.more-text:hover{cursor:pointer;text-decoration:underline}div.heat-js div.guide div.map-toggles div.less-text:active,div.heat-js div.guide div.map-toggles div.more-text:active{color:var(--heat-js-color-gray)}div.heat-js div.guide div.map-toggles div.less-text{margin-right:var(--heat-js-spacing)}div.heat-js div.guide div.map-toggles div.more-text{margin-left:var(--heat-js-spacing)}div.heat-js div.guide div.map-toggles div.days{display:inline-flex;align-items:center;justify-content:right}div.heat-js div.guide div.map-toggles div.days div.day-number{display:inline-flex!important;justify-content:center;align-items:center;overflow:hidden;text-align:center;font-size:var(--heat-js-spacing-day-font-size);padding-left:calc(var(--heat-js-spacing) / 2);padding-right:calc(var(--heat-js-spacing) / 2)}div.heat-js div.guide div.map-toggles div.days div.day{background-color:var(--heat-js-day-background-color);border:var(--heat-js-border-size) solid var(--heat-js-day-border-color);display:inline-block;border-radius:var(--heat-js-border-radius-day);min-width:var(--heat-js-day-size);height:var(--heat-js-day-size);margin-right:var(--heat-js-day-spacing);transition:var(--heat-js-transition)}div.heat-js div.guide div.map-toggles div.days div.day:last-child{margin-right:0}div.heat-js div.guide div.map-toggles div.days div.day:not(.no-hover):hover{cursor:pointer;background:var(--heat-js-day-background-color-hover)}div.heat-js label.checkbox{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;cursor:default;display:inline-block;position:relative;padding-left:20px;padding-top:1px;padding-bottom:2px;color:var(--heat-js-color-white)}div.heat-js label.checkbox input{display:none!important}div.heat-js label.checkbox input:checked~span.check-mark{background-color:var(--heat-js-checkbox-background-color-checked);border:var(--heat-js-border-size) solid var(--heat-js-checkbox-border-color-checked)}div.heat-js label.checkbox input:checked~span.check-mark::before{display:block}div.heat-js label.checkbox input:disabled~span.check-mark,div.heat-js label.checkbox input:disabled~span.text{opacity:.5}div.heat-js label.checkbox input:disabled~span.check-mark{border:var(--heat-js-border-size) solid var(--heat-js-color-black)!important}div.heat-js label.checkbox span.check-mark{position:absolute;top:1px;left:0;height:15px;width:15px;background-color:var(--heat-js-checkbox-background-color);border-radius:var(--heat-js-border-control-radius);border:var(--heat-js-border-size) solid var(--heat-js-checkbox-border-color);transition:var(--heat-js-transition)}div.heat-js label.checkbox span.check-mark::before{content:"";transform:rotate(45deg);position:absolute;display:none;left:4.5px;top:1px;width:6px;height:11px;border:solid var(--heat-js-color-black);border-width:0 3px 3px 0}div.heat-js div.day-color-1:not(.no-hover):active,div.heat-js div.day-color-2:not(.no-hover):active,div.heat-js div.day-color-3:not(.no-hover):active,div.heat-js div.day-color-4:not(.no-hover):active,div.heat-js div.holiday:not(.no-hover):active{opacity:var(--heat-js-day-opacity-active)!important}div.heat-js div.day-color-1:not(.no-hover):hover,div.heat-js div.day-color-2:not(.no-hover):hover,div.heat-js div.day-color-3:not(.no-hover):hover,div.heat-js div.day-color-4:not(.no-hover):hover,div.heat-js div.holiday:not(.no-hover):hover{cursor:pointer;opacity:var(--heat-js-day-opacity-hover)}div.heat-js div.holiday{background-color:var(--heat-js-holiday-background-color)!important;border:var(--heat-js-border-size-day) solid var(--heat-js-holiday-border-color)!important;color:var(--heat-js-holiday-text-color)}div.heat-js div.day-color-1{background-color:var(--heat-js-day-color-1-background-color)!important;border:var(--heat-js-border-size-day) solid var(--heat-js-day-color-1-border-color)!important;color:var(--heat-js-day-color-1-text-color)}div.heat-js div.day-color-2{background-color:var(--heat-js-day-color-2-background-color)!important;border:var(--heat-js-border-size-day) solid var(--heat-js-day-color-2-border-color)!important;color:var(--heat-js-day-color-2-text-color)}div.heat-js div.day-color-3{background-color:var(--heat-js-day-color-3-background-color)!important;border:var(--heat-js-border-size-day) solid var(--heat-js-day-color-3-border-color)!important;color:var(--heat-js-day-color-3-text-color)}div.heat-js div.day-color-4{background-color:var(--heat-js-day-color-4-background-color)!important;border:var(--heat-js-border-size-day) solid var(--heat-js-day-color-4-border-color)!important;color:var(--heat-js-day-color-4-text-color)}div.heat-js-tooltip{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;cursor:default;box-sizing:border-box;line-height:normal;font-family:var(--heat-js-default-font);animation:fade-in-animation var(--heat-js-animation-length);position:absolute;background-color:var(--heat-js-tooltip-background-color);border:var(--heat-js-border-size) solid var(--heat-js-tooltip-border-color);color:var(--heat-js-tooltip-text-color);border-radius:var(--heat-js-border-radius);z-index:2000;max-width:300px;padding:var(--heat-js-spacing);font-size:var(--heat-js-spacing-font-size);font-weight:var(--heat-js-text-bold-weight);display:none}@keyframes fade-in-animation{0%{opacity:0}100%{opacity:1}} \ No newline at end of file diff --git a/dist/heat.min.js b/dist/heat.min.js index 4c4d295d..596f6a59 100644 --- a/dist/heat.min.js +++ b/dist/heat.min.js @@ -1,4 +1,4 @@ -/*! Heat.js v3.0.0 | (c) Bunoon 2024 | MIT License */ +/*! Heat.js v3.1.0 | (c) Bunoon 2024 | MIT License */ (function(){function Da(){for(var a=h.domElementTypes,b=a.length,d=0;d jHeat.js - 3.0.0 + 3.1.0 Heat.js A lightweight JavaScript library that generates customizable heat maps, charts, and statistics to visualize date-based activity and trends. William Troup diff --git a/package.json b/package.json index 6aeaad4f..374bce94 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "jheat.js", "title": "Heat.js", "description": "A lightweight JavaScript library that generates customizable heat maps, charts, and statistics to visualize date-based activity and trends.", - "version": "3.0.0", + "version": "3.1.0", "main": "dist/heat.js", "homepage": "https://www.william-troup.com/heat-js/", "author": { diff --git a/src/heat.js b/src/heat.js index 8b0ecfdf..c38f084c 100644 --- a/src/heat.js +++ b/src/heat.js @@ -4,7 +4,7 @@ * A lightweight JavaScript library that generates customizable heat maps, charts, and statistics to visualize date-based activity and trends. * * @file observe.js - * @version v3.0.0 + * @version v3.1.0 * @author Bunoon * @license MIT License * @copyright Bunoon 2024 @@ -3880,7 +3880,7 @@ * @returns {string} The version number. */ _public.getVersion = function() { - return "3.0.0"; + return "3.1.0"; }; diff --git a/src/heat.js.scss b/src/heat.js.scss index a93d148e..2ac97c43 100644 --- a/src/heat.js.scss +++ b/src/heat.js.scss @@ -1,5 +1,5 @@ /* - * Heat.js Library v3.0.0 + * Heat.js Library v3.1.0 * * Copyright 2024 Bunoon * Released under the MIT License From c234a9456768c3d8eff9d2286517d31c7d043f05 Mon Sep 17 00:00:00 2001 From: William Troup Date: Sat, 30 Mar 2024 15:33:50 +0000 Subject: [PATCH 02/10] BREAKING: The binding attribute "data-heat-options" has been renamed to "data-heat-js". --- README.md | 6 +- README_NUGET.md | 6 +- dist/heat.js | 16 +- dist/heat.min.js | 155 ++++++++++---------- src/heat.js | 16 +- test/dist/heat.js.basic.html | 2 +- test/dist/heat.js.bootstrap.html | 6 +- test/dist/heat.js.data-pull.html | 2 +- test/dist/heat.js.local-storage.html | 2 +- test/dist/heat.js.map-only.html | 2 +- test/dist/heat.js.min.html | 2 +- test/dist/heat.js.no-clicks.html | 2 +- test/dist/heat.js.numbers.html | 2 +- test/dist/heat.js.only-years-available.html | 2 +- test/dist/heat.js.theme.html | 2 +- test/dist/heat.js.translations.html | 2 +- test/dist/heat.js.view-colors.html | 2 +- test/src/heat.js.basic.html | 2 +- test/src/heat.js.bootstrap.html | 6 +- test/src/heat.js.data-pull.html | 2 +- test/src/heat.js.local-storage.html | 2 +- test/src/heat.js.map-only.html | 2 +- test/src/heat.js.no-clicks.html | 2 +- test/src/heat.js.numbers.html | 2 +- test/src/heat.js.only-years-available.html | 2 +- test/src/heat.js.theme.html | 2 +- test/src/heat.js.translations.html | 2 +- test/src/heat.js.view-colors.html | 2 +- 28 files changed, 126 insertions(+), 127 deletions(-) diff --git a/README.md b/README.md index a995e855..8f05b095 100644 --- a/README.md +++ b/README.md @@ -158,14 +158,14 @@ Make sure you include the "DOCTYPE html" tag at the top of your HTML, as follows ### 3. DOM Element Binding: ```markdown -
+
Your HTML.
``` -To see a list of all the available binding options you can use for "data-heat-options", click [here](https://william-troup.com/heat-js/documentation/binding-options.html). +To see a list of all the available binding options you can use for "data-heat-js", click [here](https://william-troup.com/heat-js/documentation/binding-options.html). -To see a list of all the available custom triggers you can use for "data-heat-options", click [here](https://william-troup.com/heat-js/documentation/binding-options-custom-triggers.html). +To see a list of all the available custom triggers you can use for "data-heat-js", click [here](https://william-troup.com/heat-js/documentation/binding-options-custom-triggers.html).
diff --git a/README_NUGET.md b/README_NUGET.md index 7895a0bd..03e0af26 100644 --- a/README_NUGET.md +++ b/README_NUGET.md @@ -133,14 +133,14 @@ Make sure you include the "DOCTYPE html" tag at the top of your HTML, as follows ### 3. DOM Element Binding: ```markdown -
+
Your HTML.
``` -To see a list of all the available binding options you can use for "data-heat-options", click [here](https://william-troup.com/heat-js/documentation/binding-options.html). +To see a list of all the available binding options you can use for "data-heat-js", click [here](https://william-troup.com/heat-js/documentation/binding-options.html). -To see a list of all the available custom triggers you can use for "data-heat-options", click [here](https://william-troup.com/heat-js/documentation/binding-options-custom-triggers.html). +To see a list of all the available custom triggers you can use for "data-heat-js", click [here](https://william-troup.com/heat-js/documentation/binding-options-custom-triggers.html). ### 4. Adding Dates: diff --git a/dist/heat.js b/dist/heat.js index 2cd64c4a..5df20bef 100644 --- a/dist/heat.js +++ b/dist/heat.js @@ -1,7 +1,7 @@ /*! Heat.js v3.1.0 | (c) Bunoon 2024 | MIT License */ (function() { var _parameter_Document = null, _parameter_Window = null, _parameter_Math = null, _parameter_JSON = null, _public = {}, _configuration = {}, _string = {empty:"", space:" ", newLine:"\n", dash:"-", underscore:"_", plus:"+", zero:"0", colon:":", comma:","}, _value = {notFound:-1}, _internal_Name_Holiday = "HOLIDAY", _local_Storage_Start_ID = "HJS_", _default_MonthsToShow = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], _default_DaysToShow = [1, 2, 3, 4, 5, 6, 7], _elements_Type = {}, _elements_Day_Width = - null, _elements_DateCounts = {}, _elements_View_Name_Map = "map", _elements_View_Name_Chart = "chart", _elements_View_Name_Days = "days", _elements_View_Name_Statistics = "statistics", _elements_View_Map = 1, _elements_View_Chart = 2, _elements_View_Days = 3, _elements_View_Statistics = 4, _export_Type_Csv = "csv", _export_Type_Json = "json", _export_Type_Xml = "xml", _export_Type_Txt = "txt", _attribute_Name_Options = "data-heat-options"; + null, _elements_DateCounts = {}, _elements_View_Name_Map = "map", _elements_View_Name_Chart = "chart", _elements_View_Name_Days = "days", _elements_View_Name_Statistics = "statistics", _elements_View_Map = 1, _elements_View_Chart = 2, _elements_View_Days = 3, _elements_View_Statistics = 4, _export_Type_Csv = "csv", _export_Type_Json = "json", _export_Type_Xml = "xml", _export_Type_Txt = "txt", _attribute_Name_Options = "data-heat-js"; function render() { var tagTypes = _configuration.domElementTypes, tagTypesLength = tagTypes.length; for (var tagTypeIndex = 0; tagTypeIndex < tagTypesLength; tagTypeIndex++) { @@ -560,7 +560,7 @@ addClass(day, "no-hover"); } var useColorRange = getColorRange(bindingOptions, colorRanges, dateCount, date); - if (isDefined(useColorRange) && isHeatMapColorVisible(bindingOptions, useColorRange.id)) { + if (isDefined(useColorRange) && isColorRangeVisible(bindingOptions, useColorRange.id)) { if (isDefinedString(useColorRange.mapCssClassName)) { addClass(day, useColorRange.mapCssClassName); } else { @@ -679,7 +679,7 @@ addClass(dayLine, "no-hover"); } var useColorRange = getColorRange(bindingOptions, colorRanges, dateCount, date); - if (isDefined(useColorRange) && isHeatMapColorVisible(bindingOptions, useColorRange.id)) { + if (isDefined(useColorRange) && isColorRangeVisible(bindingOptions, useColorRange.id)) { if (isDefinedString(useColorRange.chartCssClassName)) { addClass(dayLine, useColorRange.chartCssClassName); } else { @@ -859,7 +859,7 @@ } else { addClass(rangeLine, "no-hover"); } - if (isDefined(useColorRange) && isHeatMapColorVisible(bindingOptions, useColorRange.id)) { + if (isDefined(useColorRange) && isColorRangeVisible(bindingOptions, useColorRange.id)) { if (isDefinedString(useColorRange.statisticsCssClassName)) { addClass(rangeLine, useColorRange.statisticsCssClassName); } else { @@ -962,7 +962,7 @@ var day = createElement(days, "div"); day.className = "day"; addToolTip(day, bindingOptions, colorRange.tooltipText); - if (isHeatMapColorVisible(bindingOptions, colorRange.id)) { + if (isColorRangeVisible(bindingOptions, colorRange.id)) { if (bindingOptions.currentView.view === _elements_View_Map && isDefinedString(colorRange.mapCssClassName)) { addClass(day, colorRange.mapCssClassName); } else if (bindingOptions.views.chart.enabled && bindingOptions.currentView.view === _elements_View_Chart && isDefinedString(colorRange.chartCssClassName)) { @@ -1133,7 +1133,7 @@ } } } - function isHeatMapColorVisible(bindingOptions, id) { + function isColorRangeVisible(bindingOptions, id) { var result = false; if (id === _internal_Name_Holiday) { result = true; @@ -1141,7 +1141,7 @@ var colorRangesLength = bindingOptions.colorRanges.length; for (var colorRangesIndex = 0; colorRangesIndex < colorRangesLength; colorRangesIndex++) { var colorRange = bindingOptions.colorRanges[colorRangesIndex]; - if (colorRange.id === id && (!isDefinedBoolean(colorRange.visible) || colorRange.visible)) { + if (colorRange.id === id && getDefaultBoolean(colorRange.visible, true)) { result = true; break; } @@ -1162,7 +1162,7 @@ for (var colorRangesIndex = 0; colorRangesIndex < colorRangesLength; colorRangesIndex++) { var colorRange = bindingOptions.colorRanges[colorRangesIndex]; if (colorRange.id === id) { - colorRange.visible = !(isDefinedBoolean(colorRange.visible) && colorRange.visible); + colorRange.visible = !getDefaultBoolean(colorRange.visible, true); fireCustomTrigger(bindingOptions.onColorRangeTypeToggle, colorRange.id, colorRange.visible); renderControlContainer(bindingOptions); break; diff --git a/dist/heat.min.js b/dist/heat.min.js index 596f6a59..c4bf2c13 100644 --- a/dist/heat.min.js +++ b/dist/heat.min.js @@ -1,90 +1,89 @@ /*! Heat.js v3.1.0 | (c) Bunoon 2024 | MIT License */ -(function(){function Da(){for(var a=h.domElementTypes,b=a.length,d=0;dc;c++)S(a.views.map.daysToShow,c+1)&&u(f,"div","day-name",g&&0!==c%3?q.space:h.dayNames[c]);a.views.map.showDaysInReverseOrder&&R(f)}f=n(e,"div","months");e=ma(a);for(g=0;12>g;g++)if(ba(a.views.map.monthsToShow,g)){c=n(f,"div","month");var t= -n(c,"div","day-columns");var y=ca(l,g),E=n(t,"div","day-column"),B=!1,F=na(new Date(l,g,1)),G=1;y+=F;for(var H=0;H=F?B=!0:S(a.views.map.daysToShow,G)&&n(E,"div","day-disabled");if(B){var L=null;S(a.views.map.daysToShow,G)&&(L=Xa(a,E,H-F,g,l,e));if(0===(H+1)%7&&(a.views.map.showDaysInReverseOrder&&R(E),E=n(t,"div","day-column"),G=0,!w(da)&&w(L))){var Ya=fa(L,"margin-left",!0),Za=fa(L,"margin-right",!0);da=L.offsetWidth+Ya+Za}}G++}a.views.map.showMonthNames&&(E=c.offsetWidth,y=a.views.map.placeMonthNamesOnTheBottom? +n(c,"div","day-columns");var y=ca(l,g),E=n(t,"div","day-column"),B=!1,F=na(new Date(l,g,1)),G=1;y+=F;for(var H=0;H=F?B=!0:S(a.views.map.daysToShow,G)&&n(E,"div","day-disabled");if(B){var L=null;S(a.views.map.daysToShow,G)&&(L=Wa(a,E,H-F,g,l,e));if(0===(H+1)%7&&(a.views.map.showDaysInReverseOrder&&R(E),E=n(t,"div","day-column"),G=0,!w(da)&&w(L))){var Xa=fa(L,"margin-left",!0),Ya=fa(L,"margin-right",!0);da=L.offsetWidth+Xa+Ya}}G++}a.views.map.showMonthNames&&(E=c.offsetWidth,y=a.views.map.placeMonthNamesOnTheBottom? u(c,"div","month-name-bottom",h.monthNames[g]):u(c,"div","month-name",h.monthNames[g],t),w(y)&&(y.style.width=a.views.map.showMonthDayGaps?E+"px":E-da+"px"));b&&w(da)&&(0y;y++)for(E=ca(a.currentView.year,y),B=0;By;y++)for(E=ca(a.currentView.year,y),B=0;BF;F++)for(y=ca(a.currentView.year,F),E=0;Ey;y++)a.currentView.dayCheckBoxes[y].checked&&g.push(y+1);for(y=0;12>y;y++)a.currentView.monthCheckBoxes[y].checked&&l.push(y+1);1<=g.length&&(1===a.currentView.view? a.views.map.daysToShow=g:a.views.chart.enabled&&2===a.currentView.view?a.views.chart.daysToShow=g:a.views.days.enabled&&3===a.currentView.view?a.views.days.daysToShow=g:a.views.statistics.enabled&&4===a.currentView.view?a.views.statistics.daysToShow=g:a.views.map.daysToShow=g,t=!0);1<=l.length&&(1===a.currentView.view?a.views.map.monthsToShow=l:a.views.chart.enabled&&2===a.currentView.view?a.views.chart.monthsToShow=l:a.views.days.enabled&&3===a.currentView.view?a.views.days.monthsToShow=l:a.views.statistics.enabled&& -4===a.currentView.view?a.views.statistics.monthsToShow=l:a.views.map.monthsToShow=l,t=!0);t?(A(a),z(a.onOptionsUpdate,a.currentView.element,a)):aa(a)};for(var f=0;7>f;f++)a.currentView.dayCheckBoxes[f]=Aa(e,h.dayNames[f]).input;for(e=0;7>e;e++)a.currentView.monthCheckBoxes[e]=Aa(b,h.monthNames[e]).input;for(e=7;12>e;e++)a.currentView.monthCheckBoxes[e]=Aa(d,h.monthNames[e]).input;V(c,a,h.closeToolTipText)}function Ia(a,b){var d=(b=m(b,!0))?K.addEventListener:K.removeEventListener;(b?C.addEventListener: -C.removeEventListener)("mousemove",function(){aa(a)});d("scroll",function(){aa(a)})}function V(a,b,d){null!==a&&(a.onmousemove=function(c){cb(c,b,d)})}function cb(a,b,d){ha(a);aa(b);b.currentView.tooltipTimer=setTimeout(function(){b.currentView.tooltip.innerHTML=d;b.currentView.tooltip.style.display="block";var c=b.currentView.tooltip,e=a.pageX,f=a.pageY;var g=K.documentElement;var l=(C.pageXOffset||g.scrollLeft)-(g.clientLeft||0);g=(C.pageYOffset||g.scrollTop)-(g.clientTop||0);c.style.display="block"; -e+c.offsetWidth>C.innerWidth?e-=c.offsetWidth:e++;f+c.offsetHeight>C.innerHeight?f-=c.offsetHeight:f++;ef;f++)a.currentView.dayCheckBoxes[f]=Aa(e,h.dayNames[f]).input;for(e=0;7>e;e++)a.currentView.monthCheckBoxes[e]=Aa(b,h.monthNames[e]).input;for(e=7;12>e;e++)a.currentView.monthCheckBoxes[e]=Aa(d,h.monthNames[e]).input;V(c,a,h.closeToolTipText)}function Ha(a,b){var d=(b=m(b,!0))?K.addEventListener:K.removeEventListener;(b?C.addEventListener: +C.removeEventListener)("mousemove",function(){aa(a)});d("scroll",function(){aa(a)})}function V(a,b,d){null!==a&&(a.onmousemove=function(c){bb(c,b,d)})}function bb(a,b,d){ha(a);aa(b);b.currentView.tooltipTimer=setTimeout(function(){b.currentView.tooltip.innerHTML=d;b.currentView.tooltip.style.display="block";var c=b.currentView.tooltip,e=a.pageX,f=a.pageY;var g=K.documentElement;var l=(C.pageXOffset||g.scrollLeft)-(g.clientLeft||0);g=(C.pageYOffset||g.scrollTop)-(g.clientTop||0);c.style.display="block"; +e+c.offsetWidth>C.innerWidth?e-=c.offsetWidth:e++;f+c.offsetHeight>C.innerHeight?f-=c.offsetHeight:f++;ef;f++)a.currentView.dayCheckBoxes[f].checked=S(c,f+1);for(c=0;12>c;c++)a.currentView.monthCheckBoxes[c].checked=ba(e,c);aa(a)}),b=u(b, -"button","next",h.nextButtonText),b.onclick=function(){ia(a)},0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]&&(b.disabled=!0))}}function db(a,b){b=n(b,"div","titles-menu-container");b=n(b,"div","titles-menu");u(b,"div","title-menu-header",h.dataText+q.colon);var d=u(b,"div","title-menu-item",h.mapText);pa(a,d,1,"map");a.views.chart.enabled&&(d=u(b,"div","title-menu-item",h.chartText),pa(a,d,2,"chart"));a.views.days.enabled&& -(u(b,"div","title-menu-header",h.yearText+q.colon),d=u(b,"div","title-menu-item",h.daysText),pa(a,d,3,"days"));a.views.statistics.enabled&&(u(b,"div","title-menu-header",h.statisticsText+q.colon),b=u(b,"div","title-menu-item",h.colorRangesText),pa(a,b,4,"statistics"))}function pa(a,b,d,c){a.currentView.view===d?x(b,"title-menu-item-active"):b.onclick=function(){a.currentView.view=d;z(a.onViewSwitch,c);A(a,!1,!0)}}function fb(a){n(a.currentView.yearText,"div","down-arrow");var b=n(a.currentView.yearText, -"div","years-menu-container"),d=n(b,"div","years-menu"),c=(new Date).getFullYear(),e=null;b.style.display="block";b.style.visibility="hidden";for(var f=c-a.extraSelectionYears;fg;g++)if(ba(a.views.chart.monthsToShow,g)){y=ca(l,g);var E=1;d++;for(var B=0;Bl;l++)f(l);F.style.width=e.offsetWidth+"px";e=n(F,"div","month-name-space");e.style.height=F.offsetHeight+"px";e.style.width=t+"px"}a.keepScrollPositions&&(a.currentView.chartContents.scrollLeft=a.currentView.chartContentsScrollLeft)}}function ib(a,b,d,c,e,f,g){var l=new Date(e, -c,d);a=n(a,"div","day-line");var t=M(b)[N(l)];t=X(t,0);La(b,a,l,t);b.views.chart.showLineNumbers&&0=g&&(a.style.visibility="hidden");Q(b.onDayClick)?a.onclick=function(){z(b.onDayClick,l,t)}:x(a,"no-hover");f=za(b,f,t,l);w(f)&&qa(b,f.id)&&(v(f.chartCssClassName)?x(a,f.chartCssClassName):x(a,f.cssClassName))}function hb(a){for(var b=0,d=M(a),c=0;12>c;c++)for(var e=ca(a.currentView.year,c),f=0;f=e&&(a.style.visibility="hidden");V(a,c,d.toString());Q(c.onWeekDayClick)?a.onclick=function(){z(c.onWeekDayClick,b,d)}:x(a,"no-hover");c.views.days.showDayNumbers&&0=a&&(b.style.visibility="hidden");V(b,c,d.toString()); -c.views.statistics.showRangeNumbers&&0ja.notFound}function S(a,b){return a.indexOf(b)>ja.notFound}function Sa(a){var b=[];if(a.showOnlyDataForYearsAvailable){a=M(a);for(var d in a)if(a.hasOwnProperty(d)){var c=parseInt(d.split(q.dash)[0]);b.indexOf(c)===ja.notFound&&b.push(c)}}return b=b.sort(function(e,f){return e-f})}function W(a,b){return a.yearsToHide.indexOf(b)===ja.notFound&&(0===a.currentView.yearsAvailable.length|| -a.currentView.yearsAvailable.indexOf(b)>ja.notFound)}function Ta(a){a.currentView.isInFetchMode&&(w(a.currentView.isInFetchModeTimer)||Oa(a),w(a.currentView.isInFetchModeTimer)||(a.currentView.isInFetchModeTimer=setInterval(function(){Oa(a);A(a)},a.dataFetchDelay)))}function Oa(a){var b=a.currentView.element.id,d=z(a.onDataFetch,b);if(J(d)){ya(b,a,!1);for(var c in d)d.hasOwnProperty(c)&&(k[b].type[h.unknownTrendText].hasOwnProperty(c)||(k[b].type[h.unknownTrendText][c]=0),k[b].type[h.unknownTrendText][c]+= -d[c])}}function qa(a,b){var d=!1;if("HOLIDAY"===b)d=!0;else for(var c=a.colorRanges.length,e=0;e=f.minimum)e= -f;else break}return e}function Ja(a,b){for(var d=a.length,c=null,e=0;e');f.push("");for(e in g)g.hasOwnProperty(e)&&(f.push(""),f.push(""+e+""),f.push(""+g[e]+""),f.push(""));f.push("");d=f.join(q.newLine)}else if("txt"===b){g=ra(a);e=[];for(f in g)g.hasOwnProperty(f)&&e.push(f+q.colon+q.space+g[f].toString());d=e.join(q.newLine)}v(d)&&(g=n(K.body,"a"),g.style.display="none",g.setAttribute("target","_blank"),g.setAttribute("href","data:"+ -c+";charset=utf-8,"+encodeURIComponent(d)),c=g.setAttribute,f=new Date,e=T(f.getDate())+q.dash+T(f.getMonth()+1)+q.dash+f.getFullYear(),f=T(f.getHours())+q.dash+T(f.getMinutes()),d=q.empty,a.currentView.type!==h.unknownTrendText&&(d=a.currentView.type.toLowerCase().replace(q.space,q.underscore)+q.underscore),e=d+e+q.underscore+f+"."+a.exportType.toLowerCase(),c.call(g,"download",e),g.click(),K.body.removeChild(g),z(a.onExport,a.currentView.element))}function ra(a){var b={},d=M(a);if(a.exportOnlyYearBeingViewed)for(var c= -0;12>c;c++)for(var e=ca(a.currentView.year,c),f=0;fa.getDay()-1?6:a.getDay()-1}function w(a){return null!==a&&void 0!==a&&a!==q.empty}function J(a){return w(a)&&"object"===typeof a}function Ca(a){return w(a)&&"boolean"===typeof a}function v(a){return w(a)&&"string"===typeof a}function Q(a){return w(a)&&"function"===typeof a}function va(a){return w(a)&&"number"===typeof a}function Y(a){return J(a)&&a instanceof Array}function wa(a){return J(a)&&a instanceof Date}function lb(a){a=a.toLowerCase(); -var b="text"===a;ea.hasOwnProperty(a)||(ea[a]=b?K.createTextNode(q.empty):K.createElement(a));return ea[a].cloneNode(!1)}function n(a,b,d,c){b=b.toLowerCase();var e="text"===b;ea.hasOwnProperty(b)||(ea[b]=e?K.createTextNode(q.empty):K.createElement(b));b=ea[b].cloneNode(!1);w(d)&&(b.className=d);w(c)?a.insertBefore(b,c):a.appendChild(b);return b}function u(a,b,d,c,e){a=n(a,b,d,e);a.innerHTML=c;return a}function fa(a,b,d){var c=null;d=m(d,!1);C.getComputedStyle?c=K.defaultView.getComputedStyle(a,null).getPropertyValue(b): -a.currentStyle&&(c=a.currentStyle[b]);d&&(c=parseFloat(c,10));return c}function x(a,b){a.className+=q.space+b;a.className=a.className.trim()}function ha(a){a.preventDefault();a.cancelBubble=!0}function R(a){for(var b=a.children,d=b.length-1;d--;)a.appendChild(b[d])}function Aa(a,b,d,c){a=n(a,"div");a=n(a,"label","checkbox");var e=n(a,"input");e.type="checkbox";w(c)&&(e.onclick=c);w(d)&&(e.checked=d);n(a,"span","check-mark");u(a,"span","text",b);return{input:e,label:a}}function z(a){var b=null;Q(a)&& -(b=a.apply(null,[].slice.call(arguments,1)));return b}function r(a,b){return v(a)?a:b}function m(a,b){return Ca(a)?a:b}function D(a,b){return Q(a)?a:b}function X(a,b){return va(a)?a:b}function xa(a){var b=!0,d=null;try{v(a)&&(d=ka.parse(a))}catch(c){try{d=eval("("+a+")"),Q(d)&&(d=d())}catch(e){h.safeMode||(console.error(h.objectErrorText.replace("{{error_1}}",c.message).replace("{{error_2}}",e.message)),b=!1),d=null}}return{parsed:b,result:d}}function Z(){for(var a=[],b=0;32>b;b++){8!==b&&12!==b&& -16!==b&&20!==b||a.push(q.dash);var d=I.floor(16*I.random()).toString(16);a.push(d)}return a.join(q.empty)}function T(a){a=a.toString();return 1===a.length?q.zero+a:a}function Ha(a,b){return a.substring(0,b.length).toLowerCase()===b.toLowerCase()}function N(a){return a.getFullYear()+q.dash+T(a.getMonth()+1)+q.dash+T(a.getDate())}function Ba(a,b){b=m(b,!0);var d=!0,c=a.currentView.year;for(c--;!W(a,c);){if(0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]){d=!1;break}c++}d&&(a.currentView.year=c,A(a),b&&z(a.onBackYear,a.currentView.year))}function Qa(a){a.currentView.element.innerHTML=q.empty;var b=a.currentView.element;b.className=b.className.replace("heat-js",q.empty);b.className=b.className.trim(); -Ia(a,!1);K.body.removeChild(a.currentView.tooltip);a.currentView.isInFetchMode&&w(a.currentView.isInFetchModeTimer)&&clearInterval(a.currentView.isInFetchModeTimer);z(a.onDestroy,a.currentView.element)}function Ra(a){h=J(a)?a:{};h.safeMode=m(h.safeMode,!0);a=h;var b=h.domElementTypes,d=["*"];v(b)?(b=b.split(q.space),0===b.length&&(b=d)):b=Y(b)?b:d;a.domElementTypes=b;h.stText=r(h.stText,"st");h.ndText=r(h.ndText,"nd");h.rdText=r(h.rdText,"rd");h.thText=r(h.thText,"th");h.backButtonText=r(h.backButtonText, -"Back");h.nextButtonText=r(h.nextButtonText,"Next");h.refreshButtonText=r(h.refreshButtonText,"Refresh");h.exportButtonText=r(h.exportButtonText,"Export");h.lessText=r(h.lessText,"Less");h.moreText=r(h.moreText,"More");h.dateText=r(h.dateText,"Date");h.countText=r(h.countText,"Count");h.mapText=r(h.mapText,"Map");h.chartText=r(h.chartText,"Chart");h.noChartDataMessage=r(h.noChartDataMessage,"There is currently no data to view.");h.statisticsText=r(h.statisticsText,"Statistics");h.noStatisticsDataMessage= -r(h.noStatisticsDataMessage,"There are currently no statistics to view.");h.unknownTrendText=r(h.unknownTrendText,"Unknown");h.importButtonText=r(h.importButtonText,"Import");h.noMapDataMessage=r(h.noMapDataMessage,"There is currently no data to view.");h.objectErrorText=r(h.objectErrorText,"Errors in object: {{error_1}}, {{error_2}}");h.attributeNotValidErrorText=r(h.attributeNotValidErrorText,"The attribute '{{attribute_name}}' is not a valid object.");h.attributeNotSetErrorText=r(h.attributeNotSetErrorText, -"The attribute '{{attribute_name}}' has not been set correctly.");h.closeToolTipText=r(h.closeToolTipText,"Close");h.configurationToolTipText=r(h.configurationToolTipText,"Configuration");h.configurationTitleText=r(h.configurationTitleText,"Configuration");h.visibleMonthsText=r(h.visibleMonthsText,"Visible Months");h.visibleDaysText=r(h.visibleDaysText,"Visible Days");h.dataText=r(h.dataText,"Data");h.colorRangesText=r(h.colorRangesText,"Color Ranges");h.yearText=r(h.yearText,"Year");h.daysText=r(h.daysText, -"Days");h.noDaysDataMessage=r(h.noDaysDataMessage,"There are currently no days to view.");P(h.monthNames,12)&&(h.monthNames="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "));P(h.dayNames,7)&&(h.dayNames="Mon Tue Wed Thu Fri Sat Sun".split(" "))}function P(a,b){b=va(b)?b:1;return!Y(a)||a.lengthd&&(a.currentView.year=d,W(a,a.currentView.year)?A(a):Ba(a,!1),z(a.onSetYear, -a.currentView.year))}return p};p.moveToPreviousYear=function(a){v(a)&&k.hasOwnProperty(a)&&Ba(k[a].options);return p};p.moveToNextYear=function(a){v(a)&&k.hasOwnProperty(a)&&ia(k[a].options);return p};p.moveToCurrentYear=function(a){v(a)&&k.hasOwnProperty(a)&&(a=k[a].options,a.currentView.year=(new Date).getFullYear(),W(a,a.currentView.year)?A(a):ia(a,!1),z(a.onSetYear,a.currentView.year));return p};p.getYear=function(a){var b=null;v(a)&&k.hasOwnProperty(a)&&(b=k[a].options.currentView.year);return b}; -p.render=function(a,b){J(a)&&J(b)&&Ea(Fa(b,a));return p};p.renderAll=function(){Da();return p};p.switchView=function(a,b){if(v(a)&&v(b)&&k.hasOwnProperty(a)){a=k[a].options;var d=null;"map"===b.toLowerCase()?d=1:"chart"===b.toLowerCase()?d=2:"days"===b.toLowerCase()?d=3:"statistics"===b.toLowerCase()&&(d=4);va(d)&&(a.currentView.view=d,z(a.onViewSwitch,b),A(a,!1,!0))}return p};p.switchType=function(a,b){v(a)&&v(b)&&k.hasOwnProperty(a)&&k[a].type.hasOwnProperty(b)&&(a=k[a].options,a.currentView.type!== -b&&(a.currentView.type=b,z(a.onTypeSwitch,b),A(a)));return p};p.updateOptions=function(a,b){if(v(a)&&J(b)&&k.hasOwnProperty(a)){a=k[a].options;b=Ga(b);var d=!1,c;for(c in b)b.hasOwnProperty(c)&&a.hasOwnProperty(c)&&a[c]!==b[c]&&(a[c]=b[c],d=!0);d&&(A(a,!0),z(a.onRefresh,a.currentView.element),z(a.onOptionsUpdate,a.currentView.element,a))}return p};p.destroyAll=function(){for(var a in k)k.hasOwnProperty(a)&&Qa(k[a].options);k={};return p};p.destroy=function(a){v(a)&&k.hasOwnProperty(a)&&(Qa(k[a].options), -delete k[a]);return p};p.setConfiguration=function(a,b){if(J(a)){var d=!1,c;for(c in a)a.hasOwnProperty(c)&&h.hasOwnProperty(c)&&h[c]!==a[c]&&(h[c]=a[c],d=!0);d&&(b=m(b,!0),Ra(h),b&&p.refreshAll())}return p};p.getIds=function(){var a=[],b;for(b in k)k.hasOwnProperty(b)&&a.push(b);return a};p.getVersion=function(){return"3.1.0"};(function(a,b,d,c){K=a;C=b;I=d;ka=c;Ra();K.addEventListener("DOMContentLoaded",function(){Da()});C.addEventListener("pagehide",function(){for(var e in k)if(k.hasOwnProperty(e)){var f= -k[e].options;w(f.currentView.isInFetchModeTimer)&&clearInterval(f.currentView.isInFetchModeTimer)}});w(C.$heat)||(C.$heat=p)})(document,window,Math,JSON)})(); \ No newline at end of file +"button","next",h.nextButtonText),b.onclick=function(){ia(a)},0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]&&(b.disabled=!0))}}function cb(a,b){b=n(b,"div","titles-menu-container");b=n(b,"div","titles-menu");u(b,"div","title-menu-header",h.dataText+q.colon);var d=u(b,"div","title-menu-item",h.mapText);pa(a,d,1,"map");a.views.chart.enabled&&(d=u(b,"div","title-menu-item",h.chartText),pa(a,d,2,"chart"));a.views.days.enabled&& +(u(b,"div","title-menu-header",h.yearText+q.colon),d=u(b,"div","title-menu-item",h.daysText),pa(a,d,3,"days"));a.views.statistics.enabled&&(u(b,"div","title-menu-header",h.statisticsText+q.colon),b=u(b,"div","title-menu-item",h.colorRangesText),pa(a,b,4,"statistics"))}function pa(a,b,d,c){a.currentView.view===d?x(b,"title-menu-item-active"):b.onclick=function(){a.currentView.view=d;z(a.onViewSwitch,c);A(a,!1,!0)}}function eb(a){n(a.currentView.yearText,"div","down-arrow");var b=n(a.currentView.yearText, +"div","years-menu-container"),d=n(b,"div","years-menu"),c=(new Date).getFullYear(),e=null;b.style.display="block";b.style.visibility="hidden";for(var f=c-a.extraSelectionYears;fg;g++)if(ba(a.views.chart.monthsToShow,g)){y=ca(l,g);var E=1;d++;for(var B=0;Bl;l++)f(l);F.style.width=e.offsetWidth+"px";e=n(F,"div","month-name-space");e.style.height=F.offsetHeight+"px";e.style.width=t+"px"}a.keepScrollPositions&&(a.currentView.chartContents.scrollLeft=a.currentView.chartContentsScrollLeft)}}function hb(a,b,d,c,e,f,g){var l=new Date(e, +c,d);a=n(a,"div","day-line");var t=M(b)[N(l)];t=X(t,0);Ka(b,a,l,t);b.views.chart.showLineNumbers&&0=g&&(a.style.visibility="hidden");Q(b.onDayClick)?a.onclick=function(){z(b.onDayClick,l,t)}:x(a,"no-hover");f=za(b,f,t,l);w(f)&&qa(b,f.id)&&(v(f.chartCssClassName)?x(a,f.chartCssClassName):x(a,f.cssClassName))}function gb(a){for(var b=0,d=M(a),c=0;12>c;c++)for(var e=ca(a.currentView.year,c),f=0;f=e&&(a.style.visibility="hidden");V(a,c,d.toString());Q(c.onWeekDayClick)?a.onclick=function(){z(c.onWeekDayClick,b,d)}:x(a,"no-hover");c.views.days.showDayNumbers&&0=a&&(b.style.visibility="hidden");V(b,c,d.toString()); +c.views.statistics.showRangeNumbers&&0ja.notFound}function S(a,b){return a.indexOf(b)>ja.notFound}function Ra(a){var b=[];if(a.showOnlyDataForYearsAvailable){a=M(a);for(var d in a)if(a.hasOwnProperty(d)){var c=parseInt(d.split(q.dash)[0]);b.indexOf(c)===ja.notFound&&b.push(c)}}return b=b.sort(function(e,f){return e-f})}function W(a,b){return a.yearsToHide.indexOf(b)===ja.notFound&&(0===a.currentView.yearsAvailable.length||a.currentView.yearsAvailable.indexOf(b)>ja.notFound)}function Sa(a){a.currentView.isInFetchMode&& +(w(a.currentView.isInFetchModeTimer)||Na(a),w(a.currentView.isInFetchModeTimer)||(a.currentView.isInFetchModeTimer=setInterval(function(){Na(a);A(a)},a.dataFetchDelay)))}function Na(a){var b=a.currentView.element.id,d=z(a.onDataFetch,b);if(J(d)){ya(b,a,!1);for(var c in d)d.hasOwnProperty(c)&&(k[b].type[h.unknownTrendText].hasOwnProperty(c)||(k[b].type[h.unknownTrendText][c]=0),k[b].type[h.unknownTrendText][c]+=d[c])}}function qa(a,b){var d=!1;if("HOLIDAY"===b)d=!0;else for(var c=a.colorRanges.length, +e=0;e=f.minimum)e=f;else break}return e}function Ia(a,b){for(var d=a.length,c=null,e=0;e');f.push("");for(e in g)g.hasOwnProperty(e)&& +(f.push(""),f.push(""+e+""),f.push(""+g[e]+""),f.push(""));f.push("");d=f.join(q.newLine)}else if("txt"===b){g=ra(a);e=[];for(f in g)g.hasOwnProperty(f)&&e.push(f+q.colon+q.space+g[f].toString());d=e.join(q.newLine)}v(d)&&(g=n(K.body,"a"),g.style.display="none",g.setAttribute("target","_blank"),g.setAttribute("href","data:"+c+";charset=utf-8,"+encodeURIComponent(d)),c=g.setAttribute,f=new Date,e=T(f.getDate())+q.dash+T(f.getMonth()+1)+q.dash+ +f.getFullYear(),f=T(f.getHours())+q.dash+T(f.getMinutes()),d=q.empty,a.currentView.type!==h.unknownTrendText&&(d=a.currentView.type.toLowerCase().replace(q.space,q.underscore)+q.underscore),e=d+e+q.underscore+f+"."+a.exportType.toLowerCase(),c.call(g,"download",e),g.click(),K.body.removeChild(g),z(a.onExport,a.currentView.element))}function ra(a){var b={},d=M(a);if(a.exportOnlyYearBeingViewed)for(var c=0;12>c;c++)for(var e=ca(a.currentView.year,c),f=0;f +a.getDay()-1?6:a.getDay()-1}function w(a){return null!==a&&void 0!==a&&a!==q.empty}function J(a){return w(a)&&"object"===typeof a}function v(a){return w(a)&&"string"===typeof a}function Q(a){return w(a)&&"function"===typeof a}function va(a){return w(a)&&"number"===typeof a}function Y(a){return J(a)&&a instanceof Array}function wa(a){return J(a)&&a instanceof Date}function kb(a){a=a.toLowerCase();var b="text"===a;ea.hasOwnProperty(a)||(ea[a]=b?K.createTextNode(q.empty):K.createElement(a));return ea[a].cloneNode(!1)} +function n(a,b,d,c){b=b.toLowerCase();var e="text"===b;ea.hasOwnProperty(b)||(ea[b]=e?K.createTextNode(q.empty):K.createElement(b));b=ea[b].cloneNode(!1);w(d)&&(b.className=d);w(c)?a.insertBefore(b,c):a.appendChild(b);return b}function u(a,b,d,c,e){a=n(a,b,d,e);a.innerHTML=c;return a}function fa(a,b,d){var c=null;d=m(d,!1);C.getComputedStyle?c=K.defaultView.getComputedStyle(a,null).getPropertyValue(b):a.currentStyle&&(c=a.currentStyle[b]);d&&(c=parseFloat(c,10));return c}function x(a,b){a.className+= +q.space+b;a.className=a.className.trim()}function ha(a){a.preventDefault();a.cancelBubble=!0}function R(a){for(var b=a.children,d=b.length-1;d--;)a.appendChild(b[d])}function Aa(a,b,d,c){a=n(a,"div");a=n(a,"label","checkbox");var e=n(a,"input");e.type="checkbox";w(c)&&(e.onclick=c);w(d)&&(e.checked=d);n(a,"span","check-mark");u(a,"span","text",b);return{input:e,label:a}}function z(a){var b=null;Q(a)&&(b=a.apply(null,[].slice.call(arguments,1)));return b}function r(a,b){return v(a)?a:b}function m(a, +b){return w(a)&&"boolean"===typeof a?a:b}function D(a,b){return Q(a)?a:b}function X(a,b){return va(a)?a:b}function xa(a){var b=!0,d=null;try{v(a)&&(d=ka.parse(a))}catch(c){try{d=eval("("+a+")"),Q(d)&&(d=d())}catch(e){h.safeMode||(console.error(h.objectErrorText.replace("{{error_1}}",c.message).replace("{{error_2}}",e.message)),b=!1),d=null}}return{parsed:b,result:d}}function Z(){for(var a=[],b=0;32>b;b++){8!==b&&12!==b&&16!==b&&20!==b||a.push(q.dash);var d=I.floor(16*I.random()).toString(16);a.push(d)}return a.join(q.empty)} +function T(a){a=a.toString();return 1===a.length?q.zero+a:a}function Ga(a,b){return a.substring(0,b.length).toLowerCase()===b.toLowerCase()}function N(a){return a.getFullYear()+q.dash+T(a.getMonth()+1)+q.dash+T(a.getDate())}function Ba(a,b){b=m(b,!0);var d=!0,c=a.currentView.year;for(c--;!W(a,c);){if(0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]){d=!1;break}c++}d&&(a.currentView.year=c,A(a),b&&z(a.onBackYear,a.currentView.year))}function Pa(a){a.currentView.element.innerHTML=q.empty;var b=a.currentView.element;b.className=b.className.replace("heat-js",q.empty);b.className=b.className.trim();Ha(a,!1);K.body.removeChild(a.currentView.tooltip);a.currentView.isInFetchMode&&w(a.currentView.isInFetchModeTimer)&&clearInterval(a.currentView.isInFetchModeTimer); +z(a.onDestroy,a.currentView.element)}function Qa(a){h=J(a)?a:{};h.safeMode=m(h.safeMode,!0);a=h;var b=h.domElementTypes,d=["*"];v(b)?(b=b.split(q.space),0===b.length&&(b=d)):b=Y(b)?b:d;a.domElementTypes=b;h.stText=r(h.stText,"st");h.ndText=r(h.ndText,"nd");h.rdText=r(h.rdText,"rd");h.thText=r(h.thText,"th");h.backButtonText=r(h.backButtonText,"Back");h.nextButtonText=r(h.nextButtonText,"Next");h.refreshButtonText=r(h.refreshButtonText,"Refresh");h.exportButtonText=r(h.exportButtonText,"Export");h.lessText= +r(h.lessText,"Less");h.moreText=r(h.moreText,"More");h.dateText=r(h.dateText,"Date");h.countText=r(h.countText,"Count");h.mapText=r(h.mapText,"Map");h.chartText=r(h.chartText,"Chart");h.noChartDataMessage=r(h.noChartDataMessage,"There is currently no data to view.");h.statisticsText=r(h.statisticsText,"Statistics");h.noStatisticsDataMessage=r(h.noStatisticsDataMessage,"There are currently no statistics to view.");h.unknownTrendText=r(h.unknownTrendText,"Unknown");h.importButtonText=r(h.importButtonText, +"Import");h.noMapDataMessage=r(h.noMapDataMessage,"There is currently no data to view.");h.objectErrorText=r(h.objectErrorText,"Errors in object: {{error_1}}, {{error_2}}");h.attributeNotValidErrorText=r(h.attributeNotValidErrorText,"The attribute '{{attribute_name}}' is not a valid object.");h.attributeNotSetErrorText=r(h.attributeNotSetErrorText,"The attribute '{{attribute_name}}' has not been set correctly.");h.closeToolTipText=r(h.closeToolTipText,"Close");h.configurationToolTipText=r(h.configurationToolTipText, +"Configuration");h.configurationTitleText=r(h.configurationTitleText,"Configuration");h.visibleMonthsText=r(h.visibleMonthsText,"Visible Months");h.visibleDaysText=r(h.visibleDaysText,"Visible Days");h.dataText=r(h.dataText,"Data");h.colorRangesText=r(h.colorRangesText,"Color Ranges");h.yearText=r(h.yearText,"Year");h.daysText=r(h.daysText,"Days");h.noDaysDataMessage=r(h.noDaysDataMessage,"There are currently no days to view.");P(h.monthNames,12)&&(h.monthNames="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ")); +P(h.dayNames,7)&&(h.dayNames="Mon Tue Wed Thu Fri Sat Sun".split(" "))}function P(a,b){b=va(b)?b:1;return!Y(a)||a.lengthd&&(a.currentView.year=d,W(a,a.currentView.year)?A(a):Ba(a,!1),z(a.onSetYear,a.currentView.year))}return p};p.moveToPreviousYear=function(a){v(a)&&k.hasOwnProperty(a)&&Ba(k[a].options);return p};p.moveToNextYear=function(a){v(a)&&k.hasOwnProperty(a)&& +ia(k[a].options);return p};p.moveToCurrentYear=function(a){v(a)&&k.hasOwnProperty(a)&&(a=k[a].options,a.currentView.year=(new Date).getFullYear(),W(a,a.currentView.year)?A(a):ia(a,!1),z(a.onSetYear,a.currentView.year));return p};p.getYear=function(a){var b=null;v(a)&&k.hasOwnProperty(a)&&(b=k[a].options.currentView.year);return b};p.render=function(a,b){J(a)&&J(b)&&Da(Ea(b,a));return p};p.renderAll=function(){Ca();return p};p.switchView=function(a,b){if(v(a)&&v(b)&&k.hasOwnProperty(a)){a=k[a].options; +var d=null;"map"===b.toLowerCase()?d=1:"chart"===b.toLowerCase()?d=2:"days"===b.toLowerCase()?d=3:"statistics"===b.toLowerCase()&&(d=4);va(d)&&(a.currentView.view=d,z(a.onViewSwitch,b),A(a,!1,!0))}return p};p.switchType=function(a,b){v(a)&&v(b)&&k.hasOwnProperty(a)&&k[a].type.hasOwnProperty(b)&&(a=k[a].options,a.currentView.type!==b&&(a.currentView.type=b,z(a.onTypeSwitch,b),A(a)));return p};p.updateOptions=function(a,b){if(v(a)&&J(b)&&k.hasOwnProperty(a)){a=k[a].options;b=Fa(b);var d=!1,c;for(c in b)b.hasOwnProperty(c)&& +a.hasOwnProperty(c)&&a[c]!==b[c]&&(a[c]=b[c],d=!0);d&&(A(a,!0),z(a.onRefresh,a.currentView.element),z(a.onOptionsUpdate,a.currentView.element,a))}return p};p.destroyAll=function(){for(var a in k)k.hasOwnProperty(a)&&Pa(k[a].options);k={};return p};p.destroy=function(a){v(a)&&k.hasOwnProperty(a)&&(Pa(k[a].options),delete k[a]);return p};p.setConfiguration=function(a,b){if(J(a)){var d=!1,c;for(c in a)a.hasOwnProperty(c)&&h.hasOwnProperty(c)&&h[c]!==a[c]&&(h[c]=a[c],d=!0);d&&(b=m(b,!0),Qa(h),b&&p.refreshAll())}return p}; +p.getIds=function(){var a=[],b;for(b in k)k.hasOwnProperty(b)&&a.push(b);return a};p.getVersion=function(){return"3.1.0"};(function(a,b,d,c){K=a;C=b;I=d;ka=c;Qa();K.addEventListener("DOMContentLoaded",function(){Ca()});C.addEventListener("pagehide",function(){for(var e in k)if(k.hasOwnProperty(e)){var f=k[e].options;w(f.currentView.isInFetchModeTimer)&&clearInterval(f.currentView.isInFetchModeTimer)}});w(C.$heat)||(C.$heat=p)})(document,window,Math,JSON)})(); \ No newline at end of file diff --git a/src/heat.js b/src/heat.js index c38f084c..f63826e6 100644 --- a/src/heat.js +++ b/src/heat.js @@ -80,7 +80,7 @@ _export_Type_Txt = "txt", // Variables: Attribute Names - _attribute_Name_Options = "data-heat-options"; + _attribute_Name_Options = "data-heat-js"; /* @@ -892,7 +892,7 @@ var useColorRange = getColorRange( bindingOptions, colorRanges, dateCount, date ); - if ( isDefined( useColorRange ) && isHeatMapColorVisible( bindingOptions, useColorRange.id ) ) { + if ( isDefined( useColorRange ) && isColorRangeVisible( bindingOptions, useColorRange.id ) ) { if ( isDefinedString( useColorRange.mapCssClassName ) ) { addClass( day, useColorRange.mapCssClassName ); } else { @@ -1072,7 +1072,7 @@ var useColorRange = getColorRange( bindingOptions, colorRanges, dateCount, date ); - if ( isDefined( useColorRange ) && isHeatMapColorVisible( bindingOptions, useColorRange.id ) ) { + if ( isDefined( useColorRange ) && isColorRangeVisible( bindingOptions, useColorRange.id ) ) { if ( isDefinedString( useColorRange.chartCssClassName ) ) { addClass( dayLine, useColorRange.chartCssClassName ); } else { @@ -1355,7 +1355,7 @@ addClass( rangeLine, "no-hover" ); } - if ( isDefined( useColorRange ) && isHeatMapColorVisible( bindingOptions, useColorRange.id ) ) { + if ( isDefined( useColorRange ) && isColorRangeVisible( bindingOptions, useColorRange.id ) ) { if ( isDefinedString( useColorRange.statisticsCssClassName ) ) { addClass( rangeLine, useColorRange.statisticsCssClassName ); } else { @@ -1510,7 +1510,7 @@ addToolTip( day, bindingOptions, colorRange.tooltipText ); - if ( isHeatMapColorVisible( bindingOptions, colorRange.id ) ) { + if ( isColorRangeVisible( bindingOptions, colorRange.id ) ) { if ( bindingOptions.currentView.view === _elements_View_Map && isDefinedString( colorRange.mapCssClassName ) ) { addClass( day, colorRange.mapCssClassName ); } else if ( bindingOptions.views.chart.enabled && bindingOptions.currentView.view === _elements_View_Chart && isDefinedString( colorRange.chartCssClassName ) ) { @@ -1774,7 +1774,7 @@ * ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */ - function isHeatMapColorVisible( bindingOptions, id ) { + function isColorRangeVisible( bindingOptions, id ) { var result = false; if ( id === _internal_Name_Holiday ) { @@ -1786,7 +1786,7 @@ for ( var colorRangesIndex = 0; colorRangesIndex < colorRangesLength; colorRangesIndex++ ) { var colorRange = bindingOptions.colorRanges[ colorRangesIndex ]; - if ( colorRange.id === id && ( !isDefinedBoolean( colorRange.visible ) || colorRange.visible ) ) { + if ( colorRange.id === id && getDefaultBoolean( colorRange.visible, true ) ) { result = true; break; } @@ -1815,7 +1815,7 @@ var colorRange = bindingOptions.colorRanges[ colorRangesIndex ]; if ( colorRange.id === id ) { - colorRange.visible = !( isDefinedBoolean( colorRange.visible ) && colorRange.visible ); + colorRange.visible = !getDefaultBoolean( colorRange.visible, true ); fireCustomTrigger( bindingOptions.onColorRangeTypeToggle, colorRange.id, colorRange.visible ); renderControlContainer( bindingOptions ); diff --git a/test/dist/heat.js.basic.html b/test/dist/heat.js.basic.html index 140cf012..fbc4fbb0 100644 --- a/test/dist/heat.js.basic.html +++ b/test/dist/heat.js.basic.html @@ -16,7 +16,7 @@

Heat.js - Basic

-
+
diff --git a/test/dist/heat.js.bootstrap.html b/test/dist/heat.js.bootstrap.html index b88f76bf..f89d36f9 100644 --- a/test/dist/heat.js.bootstrap.html +++ b/test/dist/heat.js.bootstrap.html @@ -17,13 +17,13 @@

Heat.js - Bootstrap

-
+


-
+


-
+


diff --git a/test/dist/heat.js.data-pull.html b/test/dist/heat.js.data-pull.html index 7772c236..ba127dce 100644 --- a/test/dist/heat.js.data-pull.html +++ b/test/dist/heat.js.data-pull.html @@ -16,7 +16,7 @@

Heat.js - Data Pull

-
+
diff --git a/test/dist/heat.js.local-storage.html b/test/dist/heat.js.local-storage.html index b6a43418..c911fb77 100644 --- a/test/dist/heat.js.local-storage.html +++ b/test/dist/heat.js.local-storage.html @@ -16,7 +16,7 @@

Heat.js - Local Storage

-
+
diff --git a/test/dist/heat.js.map-only.html b/test/dist/heat.js.map-only.html index 1d9323be..c2e64558 100644 --- a/test/dist/heat.js.map-only.html +++ b/test/dist/heat.js.map-only.html @@ -16,7 +16,7 @@

Heat.js - Only Map

-
+
diff --git a/test/dist/heat.js.min.html b/test/dist/heat.js.min.html index bd55e8c0..af8f3509 100644 --- a/test/dist/heat.js.min.html +++ b/test/dist/heat.js.min.html @@ -16,7 +16,7 @@

Heat.js - Minimized

-
+
diff --git a/test/dist/heat.js.no-clicks.html b/test/dist/heat.js.no-clicks.html index 5a23a10f..8ffff200 100644 --- a/test/dist/heat.js.no-clicks.html +++ b/test/dist/heat.js.no-clicks.html @@ -16,7 +16,7 @@

Heat.js - No Clicks

-
+
diff --git a/test/dist/heat.js.numbers.html b/test/dist/heat.js.numbers.html index 51442633..f5120fa0 100644 --- a/test/dist/heat.js.numbers.html +++ b/test/dist/heat.js.numbers.html @@ -16,7 +16,7 @@

Heat.js - Numbers

-
+
diff --git a/test/dist/heat.js.only-years-available.html b/test/dist/heat.js.only-years-available.html index 29809999..068cf074 100644 --- a/test/dist/heat.js.only-years-available.html +++ b/test/dist/heat.js.only-years-available.html @@ -16,7 +16,7 @@

Heat.js - Only Years Available

-
+
diff --git a/test/dist/heat.js.theme.html b/test/dist/heat.js.theme.html index 49dad681..61003cfa 100644 --- a/test/dist/heat.js.theme.html +++ b/test/dist/heat.js.theme.html @@ -17,7 +17,7 @@

Heat.js - Theme

-
+
diff --git a/test/dist/heat.js.translations.html b/test/dist/heat.js.translations.html index aacac82d..6f39584c 100644 --- a/test/dist/heat.js.translations.html +++ b/test/dist/heat.js.translations.html @@ -17,7 +17,7 @@

Heat.js - Translations

-
+
diff --git a/test/dist/heat.js.view-colors.html b/test/dist/heat.js.view-colors.html index d2a12c31..4e88d2be 100644 --- a/test/dist/heat.js.view-colors.html +++ b/test/dist/heat.js.view-colors.html @@ -17,7 +17,7 @@

Heat.js - View Colors

-
+
diff --git a/test/src/heat.js.basic.html b/test/src/heat.js.basic.html index e1f9529d..573222d6 100644 --- a/test/src/heat.js.basic.html +++ b/test/src/heat.js.basic.html @@ -16,7 +16,7 @@

Heat.js - Basic

-
+
diff --git a/test/src/heat.js.bootstrap.html b/test/src/heat.js.bootstrap.html index 600dba9d..45c63637 100644 --- a/test/src/heat.js.bootstrap.html +++ b/test/src/heat.js.bootstrap.html @@ -17,13 +17,13 @@

Heat.js - Bootstrap

-
+


-
+


-
+


diff --git a/test/src/heat.js.data-pull.html b/test/src/heat.js.data-pull.html index fa1250a6..0cd968ea 100644 --- a/test/src/heat.js.data-pull.html +++ b/test/src/heat.js.data-pull.html @@ -16,7 +16,7 @@

Heat.js - Data Pull

-
+
diff --git a/test/src/heat.js.local-storage.html b/test/src/heat.js.local-storage.html index 55cdf5fd..193c009a 100644 --- a/test/src/heat.js.local-storage.html +++ b/test/src/heat.js.local-storage.html @@ -16,7 +16,7 @@

Heat.js - Local Storage

-
+
diff --git a/test/src/heat.js.map-only.html b/test/src/heat.js.map-only.html index 41b0702a..a5863bbd 100644 --- a/test/src/heat.js.map-only.html +++ b/test/src/heat.js.map-only.html @@ -16,7 +16,7 @@

Heat.js - Only Map

-
+
diff --git a/test/src/heat.js.no-clicks.html b/test/src/heat.js.no-clicks.html index 53d96d32..f8f07079 100644 --- a/test/src/heat.js.no-clicks.html +++ b/test/src/heat.js.no-clicks.html @@ -16,7 +16,7 @@

Heat.js - No Clicks

-
+
diff --git a/test/src/heat.js.numbers.html b/test/src/heat.js.numbers.html index aed501fa..b3366d1e 100644 --- a/test/src/heat.js.numbers.html +++ b/test/src/heat.js.numbers.html @@ -16,7 +16,7 @@

Heat.js - Numbers

-
+
diff --git a/test/src/heat.js.only-years-available.html b/test/src/heat.js.only-years-available.html index bd599e40..d8bf082e 100644 --- a/test/src/heat.js.only-years-available.html +++ b/test/src/heat.js.only-years-available.html @@ -16,7 +16,7 @@

Heat.js - Only Years Available

-
+
diff --git a/test/src/heat.js.theme.html b/test/src/heat.js.theme.html index 6531974b..b08cfcec 100644 --- a/test/src/heat.js.theme.html +++ b/test/src/heat.js.theme.html @@ -17,7 +17,7 @@

Heat.js - Theme

-
+
diff --git a/test/src/heat.js.translations.html b/test/src/heat.js.translations.html index 39b80571..218bab0b 100644 --- a/test/src/heat.js.translations.html +++ b/test/src/heat.js.translations.html @@ -17,7 +17,7 @@

Heat.js - Translations

-
+
diff --git a/test/src/heat.js.view-colors.html b/test/src/heat.js.view-colors.html index 6d8b2b8c..ab9a8824 100644 --- a/test/src/heat.js.view-colors.html +++ b/test/src/heat.js.view-colors.html @@ -17,7 +17,7 @@

Heat.js - View Colors

-
+
From 8051e2ce80c8345e602de98bed6a2ad18f8604fc Mon Sep 17 00:00:00 2001 From: William Troup Date: Sat, 30 Mar 2024 15:42:56 +0000 Subject: [PATCH 03/10] Split the binding option "keepScrollPositions" to be view specific. --- dist/heat.js | 13 +++++--- dist/heat.min.js | 79 ++++++++++++++++++++++++------------------------ src/heat.js | 13 +++++--- 3 files changed, 56 insertions(+), 49 deletions(-) diff --git a/dist/heat.js b/dist/heat.js index 5df20bef..09970b2d 100644 --- a/dist/heat.js +++ b/dist/heat.js @@ -540,7 +540,7 @@ if (bindingOptions.views.map.showMonthsInReverseOrder) { reverseElementsOrder(months); } - if (bindingOptions.keepScrollPositions) { + if (bindingOptions.views.map.keepScrollPositions) { bindingOptions.currentView.mapContents.scrollLeft = bindingOptions.currentView.mapContentsScrollLeft; } } @@ -653,7 +653,7 @@ monthNameSpace.style.height = chartMonths.offsetHeight + "px"; monthNameSpace.style.width = labelsWidth + "px"; } - if (bindingOptions.keepScrollPositions) { + if (bindingOptions.views.chart.keepScrollPositions) { bindingOptions.currentView.chartContents.scrollLeft = bindingOptions.currentView.chartContentsScrollLeft; } } @@ -743,7 +743,7 @@ reverseElementsOrder(dayLines); reverseElementsOrder(dayNames); } - if (bindingOptions.keepScrollPositions) { + if (bindingOptions.views.days.keepScrollPositions) { bindingOptions.currentView.daysContents.scrollLeft = bindingOptions.currentView.daysContentsScrollLeft; } } @@ -836,7 +836,7 @@ reverseElementsOrder(rangeLines); reverseElementsOrder(statisticsRanges); } - if (bindingOptions.keepScrollPositions) { + if (bindingOptions.views.statistics.keepScrollPositions) { bindingOptions.currentView.statisticsContents.scrollLeft = bindingOptions.currentView.statisticsContentsScrollLeft; } } @@ -1447,7 +1447,6 @@ options.colorRangeTogglesEnabled = getDefaultBoolean(options.colorRangeTogglesEnabled, true); options.exportOnlyYearBeingViewed = getDefaultBoolean(options.exportOnlyYearBeingViewed, true); options.year = getDefaultNumber(options.year, (new Date()).getFullYear()); - options.keepScrollPositions = getDefaultBoolean(options.keepScrollPositions, false); options.extraSelectionYears = getDefaultNumber(options.extraSelectionYears, 50); options.showYearSelectionDropDown = getDefaultBoolean(options.showYearSelectionDropDown, true); options.view = getDefaultString(options.view, _elements_View_Name_Map); @@ -1520,6 +1519,7 @@ options.views.map.showNoDataMessageWhenDataIsNotAvailable = getDefaultBoolean(options.views.map.showNoDataMessageWhenDataIsNotAvailable, false); options.views.map.showMinimalDayNames = getDefaultBoolean(options.views.map.showMinimalDayNames, false); options.views.map.showMonthsInReverseOrder = getDefaultBoolean(options.views.map.showMonthsInReverseOrder, false); + options.views.map.keepScrollPositions = getDefaultBoolean(options.views.map.keepScrollPositions, false); if (isInvalidOptionArray(options.views.map.monthsToShow)) { options.views.map.monthsToShow = _default_MonthsToShow; } @@ -1535,6 +1535,7 @@ options.views.chart.showMonthNames = getDefaultBoolean(options.views.chart.showMonthNames, true); options.views.chart.showLineNumbers = getDefaultBoolean(options.views.chart.showLineNumbers, false); options.views.chart.showInReverseOrder = getDefaultBoolean(options.views.chart.showInReverseOrder, false); + options.views.chart.keepScrollPositions = getDefaultBoolean(options.views.chart.keepScrollPositions, false); if (isInvalidOptionArray(options.views.chart.monthsToShow)) { options.views.chart.monthsToShow = _default_MonthsToShow; } @@ -1550,6 +1551,7 @@ options.views.days.showDayNames = getDefaultBoolean(options.views.days.showDayNames, true); options.views.days.showInReverseOrder = getDefaultBoolean(options.views.days.showInReverseOrder, false); options.views.days.showDayNumbers = getDefaultBoolean(options.views.days.showDayNumbers, false); + options.views.days.keepScrollPositions = getDefaultBoolean(options.views.days.keepScrollPositions, false); if (isInvalidOptionArray(options.views.days.monthsToShow)) { options.views.days.monthsToShow = _default_MonthsToShow; } @@ -1566,6 +1568,7 @@ options.views.statistics.useColorRangeNamesForLabels = getDefaultBoolean(options.views.statistics.useColorRangeNamesForLabels, false); options.views.statistics.showRangeNumbers = getDefaultBoolean(options.views.statistics.showRangeNumbers, false); options.views.statistics.showInReverseOrder = getDefaultBoolean(options.views.statistics.showInReverseOrder, false); + options.views.statistics.keepScrollPositions = getDefaultBoolean(options.views.statistics.keepScrollPositions, false); if (isInvalidOptionArray(options.views.statistics.monthsToShow)) { options.views.statistics.monthsToShow = _default_MonthsToShow; } diff --git a/dist/heat.min.js b/dist/heat.min.js index c4bf2c13..43fe1422 100644 --- a/dist/heat.min.js +++ b/dist/heat.min.js @@ -9,14 +9,14 @@ n(K.body,"div","heat-js-tooltip"),a.currentView.tooltip.style.display="none",Ha( "div","statistics-contents"),la(a.currentView.statisticsContents,a));Va(a);if(b=a.views.map.showNoDataMessageWhenDataIsNotAvailable){b=!1;e=M(a);g=a.currentView.year.toString();for(var l in e)if(e.hasOwnProperty(l)&&l.split(q.dash)[0]===g){b=!0;break}b=!b}if(b)l=u(a.currentView.mapContents,"div","no-data-message",h.noMapDataMessage),f&&x(l,"view-switch");else{a.currentView.mapContents.style.minHeight="unset";la(a.currentView.mapContents,a);e=n(a.currentView.mapContents,"div","map");l=a.currentView.year; b=!1;f&&x(e,"view-switch");if(a.views.map.showDayNames){f=n(e,"div","days");g=a.views.map.showMinimalDayNames&&7===a.views.map.daysToShow.length;if(!a.views.map.showMonthNames||a.views.map.placeMonthNamesOnTheBottom)f.className="days-months-bottom";for(c=0;7>c;c++)S(a.views.map.daysToShow,c+1)&&u(f,"div","day-name",g&&0!==c%3?q.space:h.dayNames[c]);a.views.map.showDaysInReverseOrder&&R(f)}f=n(e,"div","months");e=ma(a);for(g=0;12>g;g++)if(ba(a.views.map.monthsToShow,g)){c=n(f,"div","month");var t= n(c,"div","day-columns");var y=ca(l,g),E=n(t,"div","day-column"),B=!1,F=na(new Date(l,g,1)),G=1;y+=F;for(var H=0;H=F?B=!0:S(a.views.map.daysToShow,G)&&n(E,"div","day-disabled");if(B){var L=null;S(a.views.map.daysToShow,G)&&(L=Wa(a,E,H-F,g,l,e));if(0===(H+1)%7&&(a.views.map.showDaysInReverseOrder&&R(E),E=n(t,"div","day-column"),G=0,!w(da)&&w(L))){var Xa=fa(L,"margin-left",!0),Ya=fa(L,"margin-right",!0);da=L.offsetWidth+Xa+Ya}}G++}a.views.map.showMonthNames&&(E=c.offsetWidth,y=a.views.map.placeMonthNamesOnTheBottom? -u(c,"div","month-name-bottom",h.monthNames[g]):u(c,"div","month-name",h.monthNames[g],t),w(y)&&(y.style.width=a.views.map.showMonthDayGaps?E+"px":E-da+"px"));b&&w(da)&&(0y;y++)for(E=ca(a.currentView.year,y),B=0;BF;F++)for(y=ca(a.currentView.year,F),E=0;Ey;y++)a.currentView.dayCheckBoxes[y].checked&&g.push(y+1);for(y=0;12>y;y++)a.currentView.monthCheckBoxes[y].checked&&l.push(y+1);1<=g.length&&(1===a.currentView.view? @@ -34,10 +34,10 @@ a.showConfigurationButton&&(d=n(b,"div","configure"),V(d,a,h.configurationToolTi d===c&&x(b,"year-menu-item-current")):(x(b,"year-menu-item-active"),e=b);return e}function Wa(a,b,d,c,e,f){d+=1;b=n(b,"div","day");var g=new Date(e,c,d),l=k[a.currentView.element.id].type[a.currentView.type][N(g)];l=X(l,0);Ka(a,b,g,l);a.views.map.showDayNumbers&&0g;g++)if(ba(a.views.chart.monthsToShow,g)){y=ca(l,g);var E=1;d++;for(var B=0;Bl;l++)f(l);F.style.width=e.offsetWidth+"px";e=n(F,"div","month-name-space");e.style.height=F.offsetHeight+"px";e.style.width=t+"px"}a.keepScrollPositions&&(a.currentView.chartContents.scrollLeft=a.currentView.chartContentsScrollLeft)}}function hb(a,b,d,c,e,f,g){var l=new Date(e, -c,d);a=n(a,"div","day-line");var t=M(b)[N(l)];t=X(t,0);Ka(b,a,l,t);b.views.chart.showLineNumbers&&0=g&&(a.style.visibility="hidden");Q(b.onDayClick)?a.onclick=function(){z(b.onDayClick,l,t)}:x(a,"no-hover");f=za(b,f,t,l);w(f)&&qa(b,f.id)&&(v(f.chartCssClassName)?x(a,f.chartCssClassName):x(a,f.cssClassName))}function gb(a){for(var b=0,d=M(a),c=0;12>c;c++)for(var e=ca(a.currentView.year,c),f=0;f=e&&(a.style.visibility="hidden");V(a,c,d.toString());Q(c.onWeekDayClick)?a.onclick=function(){z(c.onWeekDayClick,b,d)}:x(a,"no-hover");c.views.days.showDayNumbers&&0=a&&(b.style.visibility="hidden");V(b,c,d.toString()); -c.views.statistics.showRangeNumbers&&0l;l++)f(l);F.style.width=e.offsetWidth+"px";e=n(F,"div","month-name-space");e.style.height=F.offsetHeight+"px";e.style.width=t+"px"}a.views.chart.keepScrollPositions&&(a.currentView.chartContents.scrollLeft=a.currentView.chartContentsScrollLeft)}}function hb(a,b,d,c,e, +f,g){var l=new Date(e,c,d);a=n(a,"div","day-line");var t=M(b)[N(l)];t=X(t,0);Ka(b,a,l,t);b.views.chart.showLineNumbers&&0=g&&(a.style.visibility="hidden");Q(b.onDayClick)?a.onclick=function(){z(b.onDayClick,l,t)}:x(a,"no-hover");f=za(b,f,t,l);w(f)&&qa(b,f.id)&&(v(f.chartCssClassName)?x(a,f.chartCssClassName):x(a,f.cssClassName))}function gb(a){for(var b=0,d=M(a),c=0;12>c;c++)for(var e=ca(a.currentView.year,c),f=0;f< +e;f++){var g=N(new Date(a.currentView.year,c,f+1));d.hasOwnProperty(g)&&(b=I.max(b,parseInt(d[g])))}return b}function $a(a,b,d,c,e){a=n(a,"div","day-line");e*=d;a.style.height=e+"px";0>=e&&(a.style.visibility="hidden");V(a,c,d.toString());Q(c.onWeekDayClick)?a.onclick=function(){z(c.onWeekDayClick,b,d)}:x(a,"no-hover");c.views.days.showDayNumbers&&0=a&&(b.style.visibility= +"hidden");V(b,c,d.toString());c.views.statistics.showRangeNumbers&&0"),f.push(""+e+""),f.push(""+g[e]+""),f.push(""));f.push("");d=f.join(q.newLine)}else if("txt"===b){g=ra(a);e=[];for(f in g)g.hasOwnProperty(f)&&e.push(f+q.colon+q.space+g[f].toString());d=e.join(q.newLine)}v(d)&&(g=n(K.body,"a"),g.style.display="none",g.setAttribute("target","_blank"),g.setAttribute("href","data:"+c+";charset=utf-8,"+encodeURIComponent(d)),c=g.setAttribute,f=new Date,e=T(f.getDate())+q.dash+T(f.getMonth()+1)+q.dash+ f.getFullYear(),f=T(f.getHours())+q.dash+T(f.getMinutes()),d=q.empty,a.currentView.type!==h.unknownTrendText&&(d=a.currentView.type.toLowerCase().replace(q.space,q.underscore)+q.underscore),e=d+e+q.underscore+f+"."+a.exportType.toLowerCase(),c.call(g,"download",e),g.click(),K.body.removeChild(g),z(a.onExport,a.currentView.element))}function ra(a){var b={},d=M(a);if(a.exportOnlyYearBeingViewed)for(var c=0;12>c;c++)for(var e=ca(a.currentView.year,c),f=0;f -a.getDay()-1?6:a.getDay()-1}function w(a){return null!==a&&void 0!==a&&a!==q.empty}function J(a){return w(a)&&"object"===typeof a}function v(a){return w(a)&&"string"===typeof a}function Q(a){return w(a)&&"function"===typeof a}function va(a){return w(a)&&"number"===typeof a}function Y(a){return J(a)&&a instanceof Array}function wa(a){return J(a)&&a instanceof Date}function kb(a){a=a.toLowerCase();var b="text"===a;ea.hasOwnProperty(a)||(ea[a]=b?K.createTextNode(q.empty):K.createElement(a));return ea[a].cloneNode(!1)} -function n(a,b,d,c){b=b.toLowerCase();var e="text"===b;ea.hasOwnProperty(b)||(ea[b]=e?K.createTextNode(q.empty):K.createElement(b));b=ea[b].cloneNode(!1);w(d)&&(b.className=d);w(c)?a.insertBefore(b,c):a.appendChild(b);return b}function u(a,b,d,c,e){a=n(a,b,d,e);a.innerHTML=c;return a}function fa(a,b,d){var c=null;d=m(d,!1);C.getComputedStyle?c=K.defaultView.getComputedStyle(a,null).getPropertyValue(b):a.currentStyle&&(c=a.currentStyle[b]);d&&(c=parseFloat(c,10));return c}function x(a,b){a.className+= -q.space+b;a.className=a.className.trim()}function ha(a){a.preventDefault();a.cancelBubble=!0}function R(a){for(var b=a.children,d=b.length-1;d--;)a.appendChild(b[d])}function Aa(a,b,d,c){a=n(a,"div");a=n(a,"label","checkbox");var e=n(a,"input");e.type="checkbox";w(c)&&(e.onclick=c);w(d)&&(e.checked=d);n(a,"span","check-mark");u(a,"span","text",b);return{input:e,label:a}}function z(a){var b=null;Q(a)&&(b=a.apply(null,[].slice.call(arguments,1)));return b}function r(a,b){return v(a)?a:b}function m(a, -b){return w(a)&&"boolean"===typeof a?a:b}function D(a,b){return Q(a)?a:b}function X(a,b){return va(a)?a:b}function xa(a){var b=!0,d=null;try{v(a)&&(d=ka.parse(a))}catch(c){try{d=eval("("+a+")"),Q(d)&&(d=d())}catch(e){h.safeMode||(console.error(h.objectErrorText.replace("{{error_1}}",c.message).replace("{{error_2}}",e.message)),b=!1),d=null}}return{parsed:b,result:d}}function Z(){for(var a=[],b=0;32>b;b++){8!==b&&12!==b&&16!==b&&20!==b||a.push(q.dash);var d=I.floor(16*I.random()).toString(16);a.push(d)}return a.join(q.empty)} -function T(a){a=a.toString();return 1===a.length?q.zero+a:a}function Ga(a,b){return a.substring(0,b.length).toLowerCase()===b.toLowerCase()}function N(a){return a.getFullYear()+q.dash+T(a.getMonth()+1)+q.dash+T(a.getDate())}function Ba(a,b){b=m(b,!0);var d=!0,c=a.currentView.year;for(c--;!W(a,c);){if(0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]){d=!1;break}c++}d&&(a.currentView.year=c,A(a),b&&z(a.onBackYear,a.currentView.year))}function Pa(a){a.currentView.element.innerHTML=q.empty;var b=a.currentView.element;b.className=b.className.replace("heat-js",q.empty);b.className=b.className.trim();Ha(a,!1);K.body.removeChild(a.currentView.tooltip);a.currentView.isInFetchMode&&w(a.currentView.isInFetchModeTimer)&&clearInterval(a.currentView.isInFetchModeTimer); -z(a.onDestroy,a.currentView.element)}function Qa(a){h=J(a)?a:{};h.safeMode=m(h.safeMode,!0);a=h;var b=h.domElementTypes,d=["*"];v(b)?(b=b.split(q.space),0===b.length&&(b=d)):b=Y(b)?b:d;a.domElementTypes=b;h.stText=r(h.stText,"st");h.ndText=r(h.ndText,"nd");h.rdText=r(h.rdText,"rd");h.thText=r(h.thText,"th");h.backButtonText=r(h.backButtonText,"Back");h.nextButtonText=r(h.nextButtonText,"Next");h.refreshButtonText=r(h.refreshButtonText,"Refresh");h.exportButtonText=r(h.exportButtonText,"Export");h.lessText= -r(h.lessText,"Less");h.moreText=r(h.moreText,"More");h.dateText=r(h.dateText,"Date");h.countText=r(h.countText,"Count");h.mapText=r(h.mapText,"Map");h.chartText=r(h.chartText,"Chart");h.noChartDataMessage=r(h.noChartDataMessage,"There is currently no data to view.");h.statisticsText=r(h.statisticsText,"Statistics");h.noStatisticsDataMessage=r(h.noStatisticsDataMessage,"There are currently no statistics to view.");h.unknownTrendText=r(h.unknownTrendText,"Unknown");h.importButtonText=r(h.importButtonText, -"Import");h.noMapDataMessage=r(h.noMapDataMessage,"There is currently no data to view.");h.objectErrorText=r(h.objectErrorText,"Errors in object: {{error_1}}, {{error_2}}");h.attributeNotValidErrorText=r(h.attributeNotValidErrorText,"The attribute '{{attribute_name}}' is not a valid object.");h.attributeNotSetErrorText=r(h.attributeNotSetErrorText,"The attribute '{{attribute_name}}' has not been set correctly.");h.closeToolTipText=r(h.closeToolTipText,"Close");h.configurationToolTipText=r(h.configurationToolTipText, -"Configuration");h.configurationTitleText=r(h.configurationTitleText,"Configuration");h.visibleMonthsText=r(h.visibleMonthsText,"Visible Months");h.visibleDaysText=r(h.visibleDaysText,"Visible Days");h.dataText=r(h.dataText,"Data");h.colorRangesText=r(h.colorRangesText,"Color Ranges");h.yearText=r(h.yearText,"Year");h.daysText=r(h.daysText,"Days");h.noDaysDataMessage=r(h.noDaysDataMessage,"There are currently no days to view.");P(h.monthNames,12)&&(h.monthNames="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ")); -P(h.dayNames,7)&&(h.dayNames="Mon Tue Wed Thu Fri Sat Sun".split(" "))}function P(a,b){b=va(b)?b:1;return!Y(a)||a.lengthd&&(a.currentView.year=d,W(a,a.currentView.year)?A(a):Ba(a,!1),z(a.onSetYear,a.currentView.year))}return p};p.moveToPreviousYear=function(a){v(a)&&k.hasOwnProperty(a)&&Ba(k[a].options);return p};p.moveToNextYear=function(a){v(a)&&k.hasOwnProperty(a)&& -ia(k[a].options);return p};p.moveToCurrentYear=function(a){v(a)&&k.hasOwnProperty(a)&&(a=k[a].options,a.currentView.year=(new Date).getFullYear(),W(a,a.currentView.year)?A(a):ia(a,!1),z(a.onSetYear,a.currentView.year));return p};p.getYear=function(a){var b=null;v(a)&&k.hasOwnProperty(a)&&(b=k[a].options.currentView.year);return b};p.render=function(a,b){J(a)&&J(b)&&Da(Ea(b,a));return p};p.renderAll=function(){Ca();return p};p.switchView=function(a,b){if(v(a)&&v(b)&&k.hasOwnProperty(a)){a=k[a].options; -var d=null;"map"===b.toLowerCase()?d=1:"chart"===b.toLowerCase()?d=2:"days"===b.toLowerCase()?d=3:"statistics"===b.toLowerCase()&&(d=4);va(d)&&(a.currentView.view=d,z(a.onViewSwitch,b),A(a,!1,!0))}return p};p.switchType=function(a,b){v(a)&&v(b)&&k.hasOwnProperty(a)&&k[a].type.hasOwnProperty(b)&&(a=k[a].options,a.currentView.type!==b&&(a.currentView.type=b,z(a.onTypeSwitch,b),A(a)));return p};p.updateOptions=function(a,b){if(v(a)&&J(b)&&k.hasOwnProperty(a)){a=k[a].options;b=Fa(b);var d=!1,c;for(c in b)b.hasOwnProperty(c)&& -a.hasOwnProperty(c)&&a[c]!==b[c]&&(a[c]=b[c],d=!0);d&&(A(a,!0),z(a.onRefresh,a.currentView.element),z(a.onOptionsUpdate,a.currentView.element,a))}return p};p.destroyAll=function(){for(var a in k)k.hasOwnProperty(a)&&Pa(k[a].options);k={};return p};p.destroy=function(a){v(a)&&k.hasOwnProperty(a)&&(Pa(k[a].options),delete k[a]);return p};p.setConfiguration=function(a,b){if(J(a)){var d=!1,c;for(c in a)a.hasOwnProperty(c)&&h.hasOwnProperty(c)&&h[c]!==a[c]&&(h[c]=a[c],d=!0);d&&(b=m(b,!0),Qa(h),b&&p.refreshAll())}return p}; -p.getIds=function(){var a=[],b;for(b in k)k.hasOwnProperty(b)&&a.push(b);return a};p.getVersion=function(){return"3.1.0"};(function(a,b,d,c){K=a;C=b;I=d;ka=c;Qa();K.addEventListener("DOMContentLoaded",function(){Ca()});C.addEventListener("pagehide",function(){for(var e in k)if(k.hasOwnProperty(e)){var f=k[e].options;w(f.currentView.isInFetchModeTimer)&&clearInterval(f.currentView.isInFetchModeTimer)}});w(C.$heat)||(C.$heat=p)})(document,window,Math,JSON)})(); \ No newline at end of file +!1);a.showExportButton=m(a.showExportButton,!1);a.colorRangeTogglesEnabled=m(a.colorRangeTogglesEnabled,!0);a.exportOnlyYearBeingViewed=m(a.exportOnlyYearBeingViewed,!0);a.year=X(a.year,(new Date).getFullYear());a.extraSelectionYears=X(a.extraSelectionYears,50);a.showYearSelectionDropDown=m(a.showYearSelectionDropDown,!0);a.view=r(a.view,"map");a.tooltipDelay=X(a.tooltipDelay,750);a.exportType=r(a.exportType,"csv");a.descriptionText=r(a.descriptionText,null);a.descriptionTextLink=r(a.descriptionTextLink, +null);a.useLocalStorageForData=m(a.useLocalStorageForData,!1);a.allowFileImports=m(a.allowFileImports,!0);var b=a;var d=a.yearsToHide;var c=[];d=Y(d)?d:c;b.yearsToHide=d;a.showLessAndMoreLabels=m(a.showLessAndMoreLabels,!0);a.showNumbersInGuide=m(a.showNumbersInGuide,!1);a.showImportButton=m(a.showImportButton,!1);a.dataFetchDelay=X(a.dataFetchDelay,6E4);a.showOnlyDataForYearsAvailable=m(a.showOnlyDataForYearsAvailable,!1);a.showHolidaysInDayToolTips=m(a.showHolidaysInDayToolTips,!1);a.showConfigurationButton= +m(a.showConfigurationButton,!0);if(Y(a.colorRanges))for(b=a.colorRanges.length,d=0;da.getDay()-1?6:a.getDay()-1}function w(a){return null!==a&&void 0!==a&&a!==q.empty}function J(a){return w(a)&&"object"===typeof a}function v(a){return w(a)&&"string"===typeof a}function Q(a){return w(a)&&"function"===typeof a}function va(a){return w(a)&&"number"===typeof a}function Y(a){return J(a)&&a instanceof Array}function wa(a){return J(a)&& +a instanceof Date}function kb(a){a=a.toLowerCase();var b="text"===a;ea.hasOwnProperty(a)||(ea[a]=b?K.createTextNode(q.empty):K.createElement(a));return ea[a].cloneNode(!1)}function n(a,b,d,c){b=b.toLowerCase();var e="text"===b;ea.hasOwnProperty(b)||(ea[b]=e?K.createTextNode(q.empty):K.createElement(b));b=ea[b].cloneNode(!1);w(d)&&(b.className=d);w(c)?a.insertBefore(b,c):a.appendChild(b);return b}function u(a,b,d,c,e){a=n(a,b,d,e);a.innerHTML=c;return a}function fa(a,b,d){var c=null;d=m(d,!1);C.getComputedStyle? +c=K.defaultView.getComputedStyle(a,null).getPropertyValue(b):a.currentStyle&&(c=a.currentStyle[b]);d&&(c=parseFloat(c,10));return c}function x(a,b){a.className+=q.space+b;a.className=a.className.trim()}function ha(a){a.preventDefault();a.cancelBubble=!0}function R(a){for(var b=a.children,d=b.length-1;d--;)a.appendChild(b[d])}function Aa(a,b,d,c){a=n(a,"div");a=n(a,"label","checkbox");var e=n(a,"input");e.type="checkbox";w(c)&&(e.onclick=c);w(d)&&(e.checked=d);n(a,"span","check-mark");u(a,"span","text", +b);return{input:e,label:a}}function z(a){var b=null;Q(a)&&(b=a.apply(null,[].slice.call(arguments,1)));return b}function r(a,b){return v(a)?a:b}function m(a,b){return w(a)&&"boolean"===typeof a?a:b}function D(a,b){return Q(a)?a:b}function X(a,b){return va(a)?a:b}function xa(a){var b=!0,d=null;try{v(a)&&(d=ka.parse(a))}catch(c){try{d=eval("("+a+")"),Q(d)&&(d=d())}catch(e){h.safeMode||(console.error(h.objectErrorText.replace("{{error_1}}",c.message).replace("{{error_2}}",e.message)),b=!1),d=null}}return{parsed:b, +result:d}}function Z(){for(var a=[],b=0;32>b;b++){8!==b&&12!==b&&16!==b&&20!==b||a.push(q.dash);var d=I.floor(16*I.random()).toString(16);a.push(d)}return a.join(q.empty)}function T(a){a=a.toString();return 1===a.length?q.zero+a:a}function Ga(a,b){return a.substring(0,b.length).toLowerCase()===b.toLowerCase()}function N(a){return a.getFullYear()+q.dash+T(a.getMonth()+1)+q.dash+T(a.getDate())}function Ba(a,b){b=m(b,!0);var d=!0,c=a.currentView.year;for(c--;!W(a,c);){if(0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]){d=!1;break}c++}d&&(a.currentView.year=c,A(a),b&&z(a.onBackYear,a.currentView.year))}function Pa(a){a.currentView.element.innerHTML=q.empty;var b=a.currentView.element;b.className=b.className.replace("heat-js", +q.empty);b.className=b.className.trim();Ha(a,!1);K.body.removeChild(a.currentView.tooltip);a.currentView.isInFetchMode&&w(a.currentView.isInFetchModeTimer)&&clearInterval(a.currentView.isInFetchModeTimer);z(a.onDestroy,a.currentView.element)}function Qa(a){h=J(a)?a:{};h.safeMode=m(h.safeMode,!0);a=h;var b=h.domElementTypes,d=["*"];v(b)?(b=b.split(q.space),0===b.length&&(b=d)):b=Y(b)?b:d;a.domElementTypes=b;h.stText=r(h.stText,"st");h.ndText=r(h.ndText,"nd");h.rdText=r(h.rdText,"rd");h.thText=r(h.thText, +"th");h.backButtonText=r(h.backButtonText,"Back");h.nextButtonText=r(h.nextButtonText,"Next");h.refreshButtonText=r(h.refreshButtonText,"Refresh");h.exportButtonText=r(h.exportButtonText,"Export");h.lessText=r(h.lessText,"Less");h.moreText=r(h.moreText,"More");h.dateText=r(h.dateText,"Date");h.countText=r(h.countText,"Count");h.mapText=r(h.mapText,"Map");h.chartText=r(h.chartText,"Chart");h.noChartDataMessage=r(h.noChartDataMessage,"There is currently no data to view.");h.statisticsText=r(h.statisticsText, +"Statistics");h.noStatisticsDataMessage=r(h.noStatisticsDataMessage,"There are currently no statistics to view.");h.unknownTrendText=r(h.unknownTrendText,"Unknown");h.importButtonText=r(h.importButtonText,"Import");h.noMapDataMessage=r(h.noMapDataMessage,"There is currently no data to view.");h.objectErrorText=r(h.objectErrorText,"Errors in object: {{error_1}}, {{error_2}}");h.attributeNotValidErrorText=r(h.attributeNotValidErrorText,"The attribute '{{attribute_name}}' is not a valid object.");h.attributeNotSetErrorText= +r(h.attributeNotSetErrorText,"The attribute '{{attribute_name}}' has not been set correctly.");h.closeToolTipText=r(h.closeToolTipText,"Close");h.configurationToolTipText=r(h.configurationToolTipText,"Configuration");h.configurationTitleText=r(h.configurationTitleText,"Configuration");h.visibleMonthsText=r(h.visibleMonthsText,"Visible Months");h.visibleDaysText=r(h.visibleDaysText,"Visible Days");h.dataText=r(h.dataText,"Data");h.colorRangesText=r(h.colorRangesText,"Color Ranges");h.yearText=r(h.yearText, +"Year");h.daysText=r(h.daysText,"Days");h.noDaysDataMessage=r(h.noDaysDataMessage,"There are currently no days to view.");P(h.monthNames,12)&&(h.monthNames="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "));P(h.dayNames,7)&&(h.dayNames="Mon Tue Wed Thu Fri Sat Sun".split(" "))}function P(a,b){b=va(b)?b:1;return!Y(a)||a.lengthd&&(a.currentView.year= +d,W(a,a.currentView.year)?A(a):Ba(a,!1),z(a.onSetYear,a.currentView.year))}return p};p.moveToPreviousYear=function(a){v(a)&&k.hasOwnProperty(a)&&Ba(k[a].options);return p};p.moveToNextYear=function(a){v(a)&&k.hasOwnProperty(a)&&ia(k[a].options);return p};p.moveToCurrentYear=function(a){v(a)&&k.hasOwnProperty(a)&&(a=k[a].options,a.currentView.year=(new Date).getFullYear(),W(a,a.currentView.year)?A(a):ia(a,!1),z(a.onSetYear,a.currentView.year));return p};p.getYear=function(a){var b=null;v(a)&&k.hasOwnProperty(a)&& +(b=k[a].options.currentView.year);return b};p.render=function(a,b){J(a)&&J(b)&&Da(Ea(b,a));return p};p.renderAll=function(){Ca();return p};p.switchView=function(a,b){if(v(a)&&v(b)&&k.hasOwnProperty(a)){a=k[a].options;var d=null;"map"===b.toLowerCase()?d=1:"chart"===b.toLowerCase()?d=2:"days"===b.toLowerCase()?d=3:"statistics"===b.toLowerCase()&&(d=4);va(d)&&(a.currentView.view=d,z(a.onViewSwitch,b),A(a,!1,!0))}return p};p.switchType=function(a,b){v(a)&&v(b)&&k.hasOwnProperty(a)&&k[a].type.hasOwnProperty(b)&& +(a=k[a].options,a.currentView.type!==b&&(a.currentView.type=b,z(a.onTypeSwitch,b),A(a)));return p};p.updateOptions=function(a,b){if(v(a)&&J(b)&&k.hasOwnProperty(a)){a=k[a].options;b=Fa(b);var d=!1,c;for(c in b)b.hasOwnProperty(c)&&a.hasOwnProperty(c)&&a[c]!==b[c]&&(a[c]=b[c],d=!0);d&&(A(a,!0),z(a.onRefresh,a.currentView.element),z(a.onOptionsUpdate,a.currentView.element,a))}return p};p.destroyAll=function(){for(var a in k)k.hasOwnProperty(a)&&Pa(k[a].options);k={};return p};p.destroy=function(a){v(a)&& +k.hasOwnProperty(a)&&(Pa(k[a].options),delete k[a]);return p};p.setConfiguration=function(a,b){if(J(a)){var d=!1,c;for(c in a)a.hasOwnProperty(c)&&h.hasOwnProperty(c)&&h[c]!==a[c]&&(h[c]=a[c],d=!0);d&&(b=m(b,!0),Qa(h),b&&p.refreshAll())}return p};p.getIds=function(){var a=[],b;for(b in k)k.hasOwnProperty(b)&&a.push(b);return a};p.getVersion=function(){return"3.1.0"};(function(a,b,d,c){K=a;C=b;I=d;ka=c;Qa();K.addEventListener("DOMContentLoaded",function(){Ca()});C.addEventListener("pagehide",function(){for(var e in k)if(k.hasOwnProperty(e)){var f= +k[e].options;w(f.currentView.isInFetchModeTimer)&&clearInterval(f.currentView.isInFetchModeTimer)}});w(C.$heat)||(C.$heat=p)})(document,window,Math,JSON)})(); \ No newline at end of file diff --git a/src/heat.js b/src/heat.js index f63826e6..e11dcf3e 100644 --- a/src/heat.js +++ b/src/heat.js @@ -861,7 +861,7 @@ reverseElementsOrder( months ); } - if ( bindingOptions.keepScrollPositions ) { + if ( bindingOptions.views.map.keepScrollPositions ) { bindingOptions.currentView.mapContents.scrollLeft = bindingOptions.currentView.mapContentsScrollLeft; } } @@ -1033,7 +1033,7 @@ monthNameSpace.style.width = labelsWidth + "px"; } - if ( bindingOptions.keepScrollPositions ) { + if ( bindingOptions.views.chart.keepScrollPositions ) { bindingOptions.currentView.chartContents.scrollLeft = bindingOptions.currentView.chartContentsScrollLeft; } } @@ -1168,7 +1168,7 @@ reverseElementsOrder( dayNames ); } - if ( bindingOptions.keepScrollPositions ) { + if ( bindingOptions.views.days.keepScrollPositions ) { bindingOptions.currentView.daysContents.scrollLeft = bindingOptions.currentView.daysContentsScrollLeft; } } @@ -1321,7 +1321,7 @@ reverseElementsOrder( statisticsRanges ); } - if ( bindingOptions.keepScrollPositions ) { + if ( bindingOptions.views.statistics.keepScrollPositions ) { bindingOptions.currentView.statisticsContents.scrollLeft = bindingOptions.currentView.statisticsContentsScrollLeft; } } @@ -2247,7 +2247,6 @@ options.colorRangeTogglesEnabled = getDefaultBoolean( options.colorRangeTogglesEnabled, true ); options.exportOnlyYearBeingViewed = getDefaultBoolean( options.exportOnlyYearBeingViewed, true ); options.year = getDefaultNumber( options.year, new Date().getFullYear() ); - options.keepScrollPositions = getDefaultBoolean( options.keepScrollPositions, false ); options.extraSelectionYears = getDefaultNumber( options.extraSelectionYears, 50 ); options.showYearSelectionDropDown = getDefaultBoolean( options.showYearSelectionDropDown, true ); options.view = getDefaultString( options.view, _elements_View_Name_Map ); @@ -2366,6 +2365,7 @@ options.views.map.showNoDataMessageWhenDataIsNotAvailable = getDefaultBoolean( options.views.map.showNoDataMessageWhenDataIsNotAvailable, false ); options.views.map.showMinimalDayNames = getDefaultBoolean( options.views.map.showMinimalDayNames, false ); options.views.map.showMonthsInReverseOrder = getDefaultBoolean( options.views.map.showMonthsInReverseOrder, false ); + options.views.map.keepScrollPositions = getDefaultBoolean( options.views.map.keepScrollPositions, false ); if ( isInvalidOptionArray( options.views.map.monthsToShow ) ) { options.views.map.monthsToShow = _default_MonthsToShow; @@ -2385,6 +2385,7 @@ options.views.chart.showMonthNames = getDefaultBoolean( options.views.chart.showMonthNames, true ); options.views.chart.showLineNumbers = getDefaultBoolean( options.views.chart.showLineNumbers, false ); options.views.chart.showInReverseOrder = getDefaultBoolean( options.views.chart.showInReverseOrder, false ); + options.views.chart.keepScrollPositions = getDefaultBoolean( options.views.chart.keepScrollPositions, false ); if ( isInvalidOptionArray( options.views.chart.monthsToShow ) ) { options.views.chart.monthsToShow = _default_MonthsToShow; @@ -2404,6 +2405,7 @@ options.views.days.showDayNames = getDefaultBoolean( options.views.days.showDayNames, true ); options.views.days.showInReverseOrder = getDefaultBoolean( options.views.days.showInReverseOrder, false ); options.views.days.showDayNumbers = getDefaultBoolean( options.views.days.showDayNumbers, false ); + options.views.days.keepScrollPositions = getDefaultBoolean( options.views.days.keepScrollPositions, false ); if ( isInvalidOptionArray( options.views.days.monthsToShow ) ) { options.views.days.monthsToShow = _default_MonthsToShow; @@ -2424,6 +2426,7 @@ options.views.statistics.useColorRangeNamesForLabels = getDefaultBoolean( options.views.statistics.useColorRangeNamesForLabels, false ); options.views.statistics.showRangeNumbers = getDefaultBoolean( options.views.statistics.showRangeNumbers, false ); options.views.statistics.showInReverseOrder = getDefaultBoolean( options.views.statistics.showInReverseOrder, false ); + options.views.statistics.keepScrollPositions = getDefaultBoolean( options.views.statistics.keepScrollPositions, false ); if ( isInvalidOptionArray( options.views.statistics.monthsToShow ) ) { options.views.statistics.monthsToShow = _default_MonthsToShow; From 789c912c2344b87e7507cc7ce91b675795e9cb31 Mon Sep 17 00:00:00 2001 From: William Troup Date: Sat, 30 Mar 2024 15:59:13 +0000 Subject: [PATCH 04/10] Fixed a fault that caused the "Chart" view to show the incorrect Y-Labels when months with the largest values are hidden. --- dist/heat.js | 4 ++- dist/heat.min.js | 86 ++++++++++++++++++++++++------------------------ src/heat.js | 4 ++- 3 files changed, 49 insertions(+), 45 deletions(-) diff --git a/dist/heat.js b/dist/heat.js index 09970b2d..b51544a5 100644 --- a/dist/heat.js +++ b/dist/heat.js @@ -694,7 +694,9 @@ for (var dayIndex = 0; dayIndex < totalDaysInMonth; dayIndex++) { var storageDate = toStorageDate(new Date(bindingOptions.currentView.year, monthIndex, dayIndex + 1)); if (data.hasOwnProperty(storageDate)) { - result = _parameter_Math.max(result, parseInt(data[storageDate])); + if (isMonthVisible(bindingOptions.views.chart.monthsToShow, monthIndex) && isDayVisible(bindingOptions.views.chart.daysToShow, dayIndex + 1)) { + result = _parameter_Math.max(result, parseInt(data[storageDate])); + } } } } diff --git a/dist/heat.min.js b/dist/heat.min.js index 43fe1422..af03dc0b 100644 --- a/dist/heat.min.js +++ b/dist/heat.min.js @@ -2,49 +2,49 @@ (function(){function Ca(){for(var a=h.domElementTypes,b=a.length,d=0;dc;c++)S(a.views.map.daysToShow,c+1)&&u(f,"div","day-name",g&&0!==c%3?q.space:h.dayNames[c]);a.views.map.showDaysInReverseOrder&&R(f)}f=n(e,"div","months");e=ma(a);for(g=0;12>g;g++)if(ba(a.views.map.monthsToShow,g)){c=n(f,"div","month");var t= -n(c,"div","day-columns");var y=ca(l,g),E=n(t,"div","day-column"),B=!1,F=na(new Date(l,g,1)),G=1;y+=F;for(var H=0;H=F?B=!0:S(a.views.map.daysToShow,G)&&n(E,"div","day-disabled");if(B){var L=null;S(a.views.map.daysToShow,G)&&(L=Wa(a,E,H-F,g,l,e));if(0===(H+1)%7&&(a.views.map.showDaysInReverseOrder&&R(E),E=n(t,"div","day-column"),G=0,!w(da)&&w(L))){var Xa=fa(L,"margin-left",!0),Ya=fa(L,"margin-right",!0);da=L.offsetWidth+Xa+Ya}}G++}a.views.map.showMonthNames&&(E=c.offsetWidth,y=a.views.map.placeMonthNamesOnTheBottom? -u(c,"div","month-name-bottom",h.monthNames[g]):u(c,"div","month-name",h.monthNames[g],t),w(y)&&(y.style.width=a.views.map.showMonthDayGaps?E+"px":E-da+"px"));b&&w(da)&&(0y;y++)for(E=ca(a.currentView.year,y),B=0;Bc;c++)R(a.views.map.daysToShow,c+1)&&u(f,"div","day-name",g&&0!==c%3?q.space:h.dayNames[c]);a.views.map.showDaysInReverseOrder&&S(f)}f=n(e,"div","months");e=ma(a);for(g=0;12>g;g++)if(U(a.views.map.monthsToShow,g)){c=n(f,"div","month");var t=n(c, +"div","day-columns");var y=ca(l,g),E=n(t,"div","day-column"),B=!1,F=na(new Date(l,g,1)),G=1;y+=F;for(var H=0;H=F?B=!0:R(a.views.map.daysToShow,G)&&n(E,"div","day-disabled");if(B){var L=null;R(a.views.map.daysToShow,G)&&(L=Wa(a,E,H-F,g,l,e));if(0===(H+1)%7&&(a.views.map.showDaysInReverseOrder&&S(E),E=n(t,"div","day-column"),G=0,!w(da)&&w(L))){var Xa=fa(L,"margin-left",!0),Ya=fa(L,"margin-right",!0);da=L.offsetWidth+Xa+Ya}}G++}a.views.map.showMonthNames&&(E=c.offsetWidth,y=a.views.map.placeMonthNamesOnTheBottom? +u(c,"div","month-name-bottom",h.monthNames[g]):u(c,"div","month-name",h.monthNames[g],t),w(y)&&(y.style.width=a.views.map.showMonthDayGaps?E+"px":E-da+"px"));b&&w(da)&&(0y;y++)for(E=ca(a.currentView.year,y),B=0;BF;F++)for(y=ca(a.currentView.year,F),E=0;Ey;y++)a.currentView.dayCheckBoxes[y].checked&&g.push(y+1);for(y=0;12>y;y++)a.currentView.monthCheckBoxes[y].checked&&l.push(y+1);1<=g.length&&(1===a.currentView.view? a.views.map.daysToShow=g:a.views.chart.enabled&&2===a.currentView.view?a.views.chart.daysToShow=g:a.views.days.enabled&&3===a.currentView.view?a.views.days.daysToShow=g:a.views.statistics.enabled&&4===a.currentView.view?a.views.statistics.daysToShow=g:a.views.map.daysToShow=g,t=!0);1<=l.length&&(1===a.currentView.view?a.views.map.monthsToShow=l:a.views.chart.enabled&&2===a.currentView.view?a.views.chart.monthsToShow=l:a.views.days.enabled&&3===a.currentView.view?a.views.days.monthsToShow=l:a.views.statistics.enabled&& -4===a.currentView.view?a.views.statistics.monthsToShow=l:a.views.map.monthsToShow=l,t=!0);t?(A(a),z(a.onOptionsUpdate,a.currentView.element,a)):aa(a)};for(var f=0;7>f;f++)a.currentView.dayCheckBoxes[f]=Aa(e,h.dayNames[f]).input;for(e=0;7>e;e++)a.currentView.monthCheckBoxes[e]=Aa(b,h.monthNames[e]).input;for(e=7;12>e;e++)a.currentView.monthCheckBoxes[e]=Aa(d,h.monthNames[e]).input;V(c,a,h.closeToolTipText)}function Ha(a,b){var d=(b=m(b,!0))?K.addEventListener:K.removeEventListener;(b?C.addEventListener: -C.removeEventListener)("mousemove",function(){aa(a)});d("scroll",function(){aa(a)})}function V(a,b,d){null!==a&&(a.onmousemove=function(c){bb(c,b,d)})}function bb(a,b,d){ha(a);aa(b);b.currentView.tooltipTimer=setTimeout(function(){b.currentView.tooltip.innerHTML=d;b.currentView.tooltip.style.display="block";var c=b.currentView.tooltip,e=a.pageX,f=a.pageY;var g=K.documentElement;var l=(C.pageXOffset||g.scrollLeft)-(g.clientLeft||0);g=(C.pageYOffset||g.scrollTop)-(g.clientTop||0);c.style.display="block"; -e+c.offsetWidth>C.innerWidth?e-=c.offsetWidth:e++;f+c.offsetHeight>C.innerHeight?f-=c.offsetHeight:f++;ef;f++)a.currentView.dayCheckBoxes[f]=Aa(e,h.dayNames[f]).input;for(e=0;7>e;e++)a.currentView.monthCheckBoxes[e]=Aa(b,h.monthNames[e]).input;for(e=7;12>e;e++)a.currentView.monthCheckBoxes[e]=Aa(d,h.monthNames[e]).input;W(c,a,h.closeToolTipText)}function Ha(a,b){var d=(b=m(b,!0))?K.addEventListener:K.removeEventListener;(b?C.addEventListener: +C.removeEventListener)("mousemove",function(){ba(a)});d("scroll",function(){ba(a)})}function W(a,b,d){null!==a&&(a.onmousemove=function(c){bb(c,b,d)})}function bb(a,b,d){ha(a);ba(b);b.currentView.tooltipTimer=setTimeout(function(){b.currentView.tooltip.innerHTML=d;b.currentView.tooltip.style.display="block";var c=b.currentView.tooltip,e=a.pageX,f=a.pageY;var g=K.documentElement;var l=(C.pageXOffset||g.scrollLeft)-(g.clientLeft||0);g=(C.pageYOffset||g.scrollTop)-(g.clientTop||0);c.style.display="block"; +e+c.offsetWidth>C.innerWidth?e-=c.offsetWidth:e++;f+c.offsetHeight>C.innerHeight?f-=c.offsetHeight:f++;ef;f++)a.currentView.dayCheckBoxes[f].checked=S(c,f+1);for(c=0;12>c;c++)a.currentView.monthCheckBoxes[c].checked=ba(e,c);aa(a)}),b=u(b, +a.showConfigurationButton&&(d=n(b,"div","configure"),W(d,a,h.configurationToolTipText),d.onclick=function(){w(a.currentView.disabledBackground)&&"block"!==a.currentView.disabledBackground.style.display&&(a.currentView.disabledBackground.style.display="block");w(a.currentView.configurationDialog)&&"block"!==a.currentView.configurationDialog.style.display&&(a.currentView.configurationDialog.style.display="block");if(1===a.currentView.view){var c=a.views.map.daysToShow;var e=a.views.map.monthsToShow}else a.views.chart.enabled&& +2===a.currentView.view?(c=a.views.chart.daysToShow,e=a.views.chart.monthsToShow):a.views.days.enabled&&3===a.currentView.view?(c=a.views.days.daysToShow,e=a.views.days.monthsToShow):a.views.statistics.enabled&&4===a.currentView.view?(c=a.views.statistics.daysToShow,e=a.views.statistics.monthsToShow):(c=a.views.map.daysToShow,e=a.views.map.monthsToShow);for(var f=0;7>f;f++)a.currentView.dayCheckBoxes[f].checked=R(c,f+1);for(c=0;12>c;c++)a.currentView.monthCheckBoxes[c].checked=U(e,c);ba(a)}),b=u(b, "button","next",h.nextButtonText),b.onclick=function(){ia(a)},0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]&&(b.disabled=!0))}}function cb(a,b){b=n(b,"div","titles-menu-container");b=n(b,"div","titles-menu");u(b,"div","title-menu-header",h.dataText+q.colon);var d=u(b,"div","title-menu-item",h.mapText);pa(a,d,1,"map");a.views.chart.enabled&&(d=u(b,"div","title-menu-item",h.chartText),pa(a,d,2,"chart"));a.views.days.enabled&& (u(b,"div","title-menu-header",h.yearText+q.colon),d=u(b,"div","title-menu-item",h.daysText),pa(a,d,3,"days"));a.views.statistics.enabled&&(u(b,"div","title-menu-header",h.statisticsText+q.colon),b=u(b,"div","title-menu-item",h.colorRangesText),pa(a,b,4,"statistics"))}function pa(a,b,d,c){a.currentView.view===d?x(b,"title-menu-item-active"):b.onclick=function(){a.currentView.view=d;z(a.onViewSwitch,c);A(a,!1,!0)}}function eb(a){n(a.currentView.yearText,"div","down-arrow");var b=n(a.currentView.yearText, -"div","years-menu-container"),d=n(b,"div","years-menu"),c=(new Date).getFullYear(),e=null;b.style.display="block";b.style.visibility="hidden";for(var f=c-a.extraSelectionYears;fg;g++)if(ba(a.views.chart.monthsToShow,g)){y=ca(l,g);var E=1;d++;for(var B=0;Bl;l++)f(l);F.style.width=e.offsetWidth+"px";e=n(F,"div","month-name-space");e.style.height=F.offsetHeight+"px";e.style.width=t+"px"}a.views.chart.keepScrollPositions&&(a.currentView.chartContents.scrollLeft=a.currentView.chartContentsScrollLeft)}}function hb(a,b,d,c,e, -f,g){var l=new Date(e,c,d);a=n(a,"div","day-line");var t=M(b)[N(l)];t=X(t,0);Ka(b,a,l,t);b.views.chart.showLineNumbers&&0=g&&(a.style.visibility="hidden");Q(b.onDayClick)?a.onclick=function(){z(b.onDayClick,l,t)}:x(a,"no-hover");f=za(b,f,t,l);w(f)&&qa(b,f.id)&&(v(f.chartCssClassName)?x(a,f.chartCssClassName):x(a,f.cssClassName))}function gb(a){for(var b=0,d=M(a),c=0;12>c;c++)for(var e=ca(a.currentView.year,c),f=0;f< -e;f++){var g=N(new Date(a.currentView.year,c,f+1));d.hasOwnProperty(g)&&(b=I.max(b,parseInt(d[g])))}return b}function $a(a,b,d,c,e){a=n(a,"div","day-line");e*=d;a.style.height=e+"px";0>=e&&(a.style.visibility="hidden");V(a,c,d.toString());Q(c.onWeekDayClick)?a.onclick=function(){z(c.onWeekDayClick,b,d)}:x(a,"no-hover");c.views.days.showDayNumbers&&0=a&&(b.style.visibility= -"hidden");V(b,c,d.toString());c.views.statistics.showRangeNumbers&&0g;g++)if(U(a.views.chart.monthsToShow,g)){y=ca(l,g);var E=1;d++;for(var B=0;Bl;l++)f(l);F.style.width=e.offsetWidth+"px";e=n(F,"div","month-name-space");e.style.height=F.offsetHeight+"px";e.style.width=t+"px"}a.views.chart.keepScrollPositions&&(a.currentView.chartContents.scrollLeft=a.currentView.chartContentsScrollLeft)}}function hb(a,b,d,c,e,f, +g){var l=new Date(e,c,d);a=n(a,"div","day-line");var t=M(b)[N(l)];t=Y(t,0);Ka(b,a,l,t);b.views.chart.showLineNumbers&&0=g&&(a.style.visibility="hidden");Q(b.onDayClick)?a.onclick=function(){z(b.onDayClick,l,t)}:x(a,"no-hover");f=za(b,f,t,l);w(f)&&qa(b,f.id)&&(v(f.chartCssClassName)?x(a,f.chartCssClassName):x(a,f.cssClassName))}function gb(a){for(var b=0,d=M(a),c=0;12>c;c++)for(var e=ca(a.currentView.year,c),f=0;f=e&&(a.style.visibility="hidden");W(a,c,d.toString());Q(c.onWeekDayClick)?a.onclick=function(){z(c.onWeekDayClick,b,d)}:x(a,"no-hover");c.views.days.showDayNumbers&&0=a&&(b.style.visibility="hidden");W(b,c,d.toString());c.views.statistics.showRangeNumbers&&0ja.notFound}function S(a,b){return a.indexOf(b)>ja.notFound}function Ra(a){var b=[];if(a.showOnlyDataForYearsAvailable){a=M(a);for(var d in a)if(a.hasOwnProperty(d)){var c=parseInt(d.split(q.dash)[0]);b.indexOf(c)===ja.notFound&&b.push(c)}}return b=b.sort(function(e,f){return e-f})}function W(a,b){return a.yearsToHide.indexOf(b)===ja.notFound&&(0===a.currentView.yearsAvailable.length||a.currentView.yearsAvailable.indexOf(b)>ja.notFound)}function Sa(a){a.currentView.isInFetchMode&& +d.matched&&v(d.name)&&(c+=q.colon+q.space+d.name));W(b,a,c)}}function ya(a,b,d){d=m(d,!0);k[a]={options:b,type:{},types:1};k[a].type[h.unknownTrendText]={};if(d&&!b.currentView.isInFetchMode&&b.useLocalStorageForData&&C.localStorage)for(a=C.localStorage.length,b=b.currentView.element.id,d=0;dja.notFound}function R(a,b){return a.indexOf(b)>ja.notFound}function Ra(a){var b=[];if(a.showOnlyDataForYearsAvailable){a=M(a);for(var d in a)if(a.hasOwnProperty(d)){var c=parseInt(d.split(q.dash)[0]);b.indexOf(c)===ja.notFound&&b.push(c)}}return b=b.sort(function(e,f){return e-f})}function X(a,b){return a.yearsToHide.indexOf(b)===ja.notFound&&(0===a.currentView.yearsAvailable.length||a.currentView.yearsAvailable.indexOf(b)>ja.notFound)}function Sa(a){a.currentView.isInFetchMode&& (w(a.currentView.isInFetchModeTimer)||Na(a),w(a.currentView.isInFetchModeTimer)||(a.currentView.isInFetchModeTimer=setInterval(function(){Na(a);A(a)},a.dataFetchDelay)))}function Na(a){var b=a.currentView.element.id,d=z(a.onDataFetch,b);if(J(d)){ya(b,a,!1);for(var c in d)d.hasOwnProperty(c)&&(k[b].type[h.unknownTrendText].hasOwnProperty(c)||(k[b].type[h.unknownTrendText][c]=0),k[b].type[h.unknownTrendText][c]+=d[c])}}function qa(a,b){var d=!1;if("HOLIDAY"===b)d=!0;else for(var c=a.colorRanges.length, e=0;e=f.minimum)e=f;else break}return e}function Ia(a,b){for(var d=a.length,c=null,e=0;e"),f.push(""+e+""),f.push(""+g[e]+""),f.push(""));f.push("");d=f.join(q.newLine)}else if("txt"===b){g=ra(a);e=[];for(f in g)g.hasOwnProperty(f)&&e.push(f+q.colon+q.space+g[f].toString());d=e.join(q.newLine)}v(d)&&(g=n(K.body,"a"),g.style.display="none",g.setAttribute("target","_blank"),g.setAttribute("href","data:"+c+";charset=utf-8,"+encodeURIComponent(d)),c=g.setAttribute,f=new Date,e=T(f.getDate())+q.dash+T(f.getMonth()+1)+q.dash+ f.getFullYear(),f=T(f.getHours())+q.dash+T(f.getMinutes()),d=q.empty,a.currentView.type!==h.unknownTrendText&&(d=a.currentView.type.toLowerCase().replace(q.space,q.underscore)+q.underscore),e=d+e+q.underscore+f+"."+a.exportType.toLowerCase(),c.call(g,"download",e),g.click(),K.body.removeChild(g),z(a.onExport,a.currentView.element))}function ra(a){var b={},d=M(a);if(a.exportOnlyYearBeingViewed)for(var c=0;12>c;c++)for(var e=ca(a.currentView.year,c),f=0;fa.getDay()-1?6:a.getDay()-1}function w(a){return null!==a&&void 0!==a&&a!==q.empty}function J(a){return w(a)&&"object"===typeof a}function v(a){return w(a)&&"string"===typeof a}function Q(a){return w(a)&&"function"===typeof a}function va(a){return w(a)&&"number"===typeof a}function Y(a){return J(a)&&a instanceof Array}function wa(a){return J(a)&& +D(a.onOptionsUpdate,null);a.onWeekDayClick=D(a.onWeekDayClick,null);return a}function ca(a,b){return(new Date(a,b+1,0)).getDate()}function na(a){return 0>a.getDay()-1?6:a.getDay()-1}function w(a){return null!==a&&void 0!==a&&a!==q.empty}function J(a){return w(a)&&"object"===typeof a}function v(a){return w(a)&&"string"===typeof a}function Q(a){return w(a)&&"function"===typeof a}function va(a){return w(a)&&"number"===typeof a}function Z(a){return J(a)&&a instanceof Array}function wa(a){return J(a)&& a instanceof Date}function kb(a){a=a.toLowerCase();var b="text"===a;ea.hasOwnProperty(a)||(ea[a]=b?K.createTextNode(q.empty):K.createElement(a));return ea[a].cloneNode(!1)}function n(a,b,d,c){b=b.toLowerCase();var e="text"===b;ea.hasOwnProperty(b)||(ea[b]=e?K.createTextNode(q.empty):K.createElement(b));b=ea[b].cloneNode(!1);w(d)&&(b.className=d);w(c)?a.insertBefore(b,c):a.appendChild(b);return b}function u(a,b,d,c,e){a=n(a,b,d,e);a.innerHTML=c;return a}function fa(a,b,d){var c=null;d=m(d,!1);C.getComputedStyle? -c=K.defaultView.getComputedStyle(a,null).getPropertyValue(b):a.currentStyle&&(c=a.currentStyle[b]);d&&(c=parseFloat(c,10));return c}function x(a,b){a.className+=q.space+b;a.className=a.className.trim()}function ha(a){a.preventDefault();a.cancelBubble=!0}function R(a){for(var b=a.children,d=b.length-1;d--;)a.appendChild(b[d])}function Aa(a,b,d,c){a=n(a,"div");a=n(a,"label","checkbox");var e=n(a,"input");e.type="checkbox";w(c)&&(e.onclick=c);w(d)&&(e.checked=d);n(a,"span","check-mark");u(a,"span","text", -b);return{input:e,label:a}}function z(a){var b=null;Q(a)&&(b=a.apply(null,[].slice.call(arguments,1)));return b}function r(a,b){return v(a)?a:b}function m(a,b){return w(a)&&"boolean"===typeof a?a:b}function D(a,b){return Q(a)?a:b}function X(a,b){return va(a)?a:b}function xa(a){var b=!0,d=null;try{v(a)&&(d=ka.parse(a))}catch(c){try{d=eval("("+a+")"),Q(d)&&(d=d())}catch(e){h.safeMode||(console.error(h.objectErrorText.replace("{{error_1}}",c.message).replace("{{error_2}}",e.message)),b=!1),d=null}}return{parsed:b, -result:d}}function Z(){for(var a=[],b=0;32>b;b++){8!==b&&12!==b&&16!==b&&20!==b||a.push(q.dash);var d=I.floor(16*I.random()).toString(16);a.push(d)}return a.join(q.empty)}function T(a){a=a.toString();return 1===a.length?q.zero+a:a}function Ga(a,b){return a.substring(0,b.length).toLowerCase()===b.toLowerCase()}function N(a){return a.getFullYear()+q.dash+T(a.getMonth()+1)+q.dash+T(a.getDate())}function Ba(a,b){b=m(b,!0);var d=!0,c=a.currentView.year;for(c--;!W(a,c);){if(0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]){d=!1;break}c++}d&&(a.currentView.year=c,A(a),b&&z(a.onBackYear,a.currentView.year))}function Pa(a){a.currentView.element.innerHTML=q.empty;var b=a.currentView.element;b.className=b.className.replace("heat-js", -q.empty);b.className=b.className.trim();Ha(a,!1);K.body.removeChild(a.currentView.tooltip);a.currentView.isInFetchMode&&w(a.currentView.isInFetchModeTimer)&&clearInterval(a.currentView.isInFetchModeTimer);z(a.onDestroy,a.currentView.element)}function Qa(a){h=J(a)?a:{};h.safeMode=m(h.safeMode,!0);a=h;var b=h.domElementTypes,d=["*"];v(b)?(b=b.split(q.space),0===b.length&&(b=d)):b=Y(b)?b:d;a.domElementTypes=b;h.stText=r(h.stText,"st");h.ndText=r(h.ndText,"nd");h.rdText=r(h.rdText,"rd");h.thText=r(h.thText, +c=K.defaultView.getComputedStyle(a,null).getPropertyValue(b):a.currentStyle&&(c=a.currentStyle[b]);d&&(c=parseFloat(c,10));return c}function x(a,b){a.className+=q.space+b;a.className=a.className.trim()}function ha(a){a.preventDefault();a.cancelBubble=!0}function S(a){for(var b=a.children,d=b.length-1;d--;)a.appendChild(b[d])}function Aa(a,b,d,c){a=n(a,"div");a=n(a,"label","checkbox");var e=n(a,"input");e.type="checkbox";w(c)&&(e.onclick=c);w(d)&&(e.checked=d);n(a,"span","check-mark");u(a,"span","text", +b);return{input:e,label:a}}function z(a){var b=null;Q(a)&&(b=a.apply(null,[].slice.call(arguments,1)));return b}function r(a,b){return v(a)?a:b}function m(a,b){return w(a)&&"boolean"===typeof a?a:b}function D(a,b){return Q(a)?a:b}function Y(a,b){return va(a)?a:b}function xa(a){var b=!0,d=null;try{v(a)&&(d=ka.parse(a))}catch(c){try{d=eval("("+a+")"),Q(d)&&(d=d())}catch(e){h.safeMode||(console.error(h.objectErrorText.replace("{{error_1}}",c.message).replace("{{error_2}}",e.message)),b=!1),d=null}}return{parsed:b, +result:d}}function aa(){for(var a=[],b=0;32>b;b++){8!==b&&12!==b&&16!==b&&20!==b||a.push(q.dash);var d=I.floor(16*I.random()).toString(16);a.push(d)}return a.join(q.empty)}function T(a){a=a.toString();return 1===a.length?q.zero+a:a}function Ga(a,b){return a.substring(0,b.length).toLowerCase()===b.toLowerCase()}function N(a){return a.getFullYear()+q.dash+T(a.getMonth()+1)+q.dash+T(a.getDate())}function Ba(a,b){b=m(b,!0);var d=!0,c=a.currentView.year;for(c--;!X(a,c);){if(0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]){d=!1;break}c++}d&&(a.currentView.year=c,A(a),b&&z(a.onBackYear,a.currentView.year))}function Pa(a){a.currentView.element.innerHTML=q.empty;var b=a.currentView.element;b.className=b.className.replace("heat-js", +q.empty);b.className=b.className.trim();Ha(a,!1);K.body.removeChild(a.currentView.tooltip);a.currentView.isInFetchMode&&w(a.currentView.isInFetchModeTimer)&&clearInterval(a.currentView.isInFetchModeTimer);z(a.onDestroy,a.currentView.element)}function Qa(a){h=J(a)?a:{};h.safeMode=m(h.safeMode,!0);a=h;var b=h.domElementTypes,d=["*"];v(b)?(b=b.split(q.space),0===b.length&&(b=d)):b=Z(b)?b:d;a.domElementTypes=b;h.stText=r(h.stText,"st");h.ndText=r(h.ndText,"nd");h.rdText=r(h.rdText,"rd");h.thText=r(h.thText, "th");h.backButtonText=r(h.backButtonText,"Back");h.nextButtonText=r(h.nextButtonText,"Next");h.refreshButtonText=r(h.refreshButtonText,"Refresh");h.exportButtonText=r(h.exportButtonText,"Export");h.lessText=r(h.lessText,"Less");h.moreText=r(h.moreText,"More");h.dateText=r(h.dateText,"Date");h.countText=r(h.countText,"Count");h.mapText=r(h.mapText,"Map");h.chartText=r(h.chartText,"Chart");h.noChartDataMessage=r(h.noChartDataMessage,"There is currently no data to view.");h.statisticsText=r(h.statisticsText, "Statistics");h.noStatisticsDataMessage=r(h.noStatisticsDataMessage,"There are currently no statistics to view.");h.unknownTrendText=r(h.unknownTrendText,"Unknown");h.importButtonText=r(h.importButtonText,"Import");h.noMapDataMessage=r(h.noMapDataMessage,"There is currently no data to view.");h.objectErrorText=r(h.objectErrorText,"Errors in object: {{error_1}}, {{error_2}}");h.attributeNotValidErrorText=r(h.attributeNotValidErrorText,"The attribute '{{attribute_name}}' is not a valid object.");h.attributeNotSetErrorText= r(h.attributeNotSetErrorText,"The attribute '{{attribute_name}}' has not been set correctly.");h.closeToolTipText=r(h.closeToolTipText,"Close");h.configurationToolTipText=r(h.configurationToolTipText,"Configuration");h.configurationTitleText=r(h.configurationTitleText,"Configuration");h.visibleMonthsText=r(h.visibleMonthsText,"Visible Months");h.visibleDaysText=r(h.visibleDaysText,"Visible Days");h.dataText=r(h.dataText,"Data");h.colorRangesText=r(h.colorRangesText,"Color Ranges");h.yearText=r(h.yearText, -"Year");h.daysText=r(h.daysText,"Days");h.noDaysDataMessage=r(h.noDaysDataMessage,"There are currently no days to view.");P(h.monthNames,12)&&(h.monthNames="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "));P(h.dayNames,7)&&(h.dayNames="Mon Tue Wed Thu Fri Sat Sun".split(" "))}function P(a,b){b=va(b)?b:1;return!Y(a)||a.lengthd&&(a.currentView.year= -d,W(a,a.currentView.year)?A(a):Ba(a,!1),z(a.onSetYear,a.currentView.year))}return p};p.moveToPreviousYear=function(a){v(a)&&k.hasOwnProperty(a)&&Ba(k[a].options);return p};p.moveToNextYear=function(a){v(a)&&k.hasOwnProperty(a)&&ia(k[a].options);return p};p.moveToCurrentYear=function(a){v(a)&&k.hasOwnProperty(a)&&(a=k[a].options,a.currentView.year=(new Date).getFullYear(),W(a,a.currentView.year)?A(a):ia(a,!1),z(a.onSetYear,a.currentView.year));return p};p.getYear=function(a){var b=null;v(a)&&k.hasOwnProperty(a)&& +b&&A(d,!0))}return p};p.export=function(a,b){v(a)&&k.hasOwnProperty(a)&&Ja(k[a].options,b);return p};p.refresh=function(a){v(a)&&k.hasOwnProperty(a)&&(a=k[a].options,A(a,!0),z(a.onRefresh,a.currentView.element));return p};p.refreshAll=function(){for(var a in k)if(k.hasOwnProperty(a)){var b=k[a].options;A(b,!0);z(b.onRefresh,b.currentView.element)}return p};p.setYear=function(a,b){v(a)&&va(b)&&k.hasOwnProperty(a)&&(a=k[a].options,a.currentView.year=b,X(a,a.currentView.year)?A(a):ia(a,!1),z(a.onSetYear, +a.currentView.year));return p};p.setYearToHighest=function(a){if(v(a)&&k.hasOwnProperty(a)){a=k[a].options;var b=M(a),d=0,c;for(c in b)b.hasOwnProperty(c)&&(d=I.max(d,parseInt(c.split(q.dash)[0])));0d&&(a.currentView.year= +d,X(a,a.currentView.year)?A(a):Ba(a,!1),z(a.onSetYear,a.currentView.year))}return p};p.moveToPreviousYear=function(a){v(a)&&k.hasOwnProperty(a)&&Ba(k[a].options);return p};p.moveToNextYear=function(a){v(a)&&k.hasOwnProperty(a)&&ia(k[a].options);return p};p.moveToCurrentYear=function(a){v(a)&&k.hasOwnProperty(a)&&(a=k[a].options,a.currentView.year=(new Date).getFullYear(),X(a,a.currentView.year)?A(a):ia(a,!1),z(a.onSetYear,a.currentView.year));return p};p.getYear=function(a){var b=null;v(a)&&k.hasOwnProperty(a)&& (b=k[a].options.currentView.year);return b};p.render=function(a,b){J(a)&&J(b)&&Da(Ea(b,a));return p};p.renderAll=function(){Ca();return p};p.switchView=function(a,b){if(v(a)&&v(b)&&k.hasOwnProperty(a)){a=k[a].options;var d=null;"map"===b.toLowerCase()?d=1:"chart"===b.toLowerCase()?d=2:"days"===b.toLowerCase()?d=3:"statistics"===b.toLowerCase()&&(d=4);va(d)&&(a.currentView.view=d,z(a.onViewSwitch,b),A(a,!1,!0))}return p};p.switchType=function(a,b){v(a)&&v(b)&&k.hasOwnProperty(a)&&k[a].type.hasOwnProperty(b)&& (a=k[a].options,a.currentView.type!==b&&(a.currentView.type=b,z(a.onTypeSwitch,b),A(a)));return p};p.updateOptions=function(a,b){if(v(a)&&J(b)&&k.hasOwnProperty(a)){a=k[a].options;b=Fa(b);var d=!1,c;for(c in b)b.hasOwnProperty(c)&&a.hasOwnProperty(c)&&a[c]!==b[c]&&(a[c]=b[c],d=!0);d&&(A(a,!0),z(a.onRefresh,a.currentView.element),z(a.onOptionsUpdate,a.currentView.element,a))}return p};p.destroyAll=function(){for(var a in k)k.hasOwnProperty(a)&&Pa(k[a].options);k={};return p};p.destroy=function(a){v(a)&& k.hasOwnProperty(a)&&(Pa(k[a].options),delete k[a]);return p};p.setConfiguration=function(a,b){if(J(a)){var d=!1,c;for(c in a)a.hasOwnProperty(c)&&h.hasOwnProperty(c)&&h[c]!==a[c]&&(h[c]=a[c],d=!0);d&&(b=m(b,!0),Qa(h),b&&p.refreshAll())}return p};p.getIds=function(){var a=[],b;for(b in k)k.hasOwnProperty(b)&&a.push(b);return a};p.getVersion=function(){return"3.1.0"};(function(a,b,d,c){K=a;C=b;I=d;ka=c;Qa();K.addEventListener("DOMContentLoaded",function(){Ca()});C.addEventListener("pagehide",function(){for(var e in k)if(k.hasOwnProperty(e)){var f= diff --git a/src/heat.js b/src/heat.js index e11dcf3e..a89cac3d 100644 --- a/src/heat.js +++ b/src/heat.js @@ -1092,7 +1092,9 @@ var storageDate = toStorageDate( new Date( bindingOptions.currentView.year, monthIndex, dayIndex + 1 ) ); if ( data.hasOwnProperty( storageDate ) ) { - result = _parameter_Math.max( result, parseInt( data[ storageDate ] ) ); + if ( isMonthVisible( bindingOptions.views.chart.monthsToShow, monthIndex ) && isDayVisible( bindingOptions.views.chart.daysToShow, dayIndex + 1 ) ) { + result = _parameter_Math.max( result, parseInt( data[ storageDate ] ) ); + } } } } From a4f3c3759128ab69fefcccb167c67042f2f4a701 Mon Sep 17 00:00:00 2001 From: William Troup Date: Sat, 30 Mar 2024 16:36:30 +0000 Subject: [PATCH 05/10] BREAKING: All title bar related binding options are now available under a new area called "title". --- dist/heat.js | 41 +++++---- dist/heat.min.js | 138 +++++++++++++++---------------- src/heat.js | 45 +++++----- test/dist/heat.js.bootstrap.html | 10 +-- test/src/heat.js.bootstrap.html | 10 +-- 5 files changed, 128 insertions(+), 116 deletions(-) diff --git a/dist/heat.js b/dist/heat.js index b51544a5..bfa34a7c 100644 --- a/dist/heat.js +++ b/dist/heat.js @@ -115,7 +115,7 @@ bindingOptions.currentView.yearsAvailable = getYearsAvailableInData(bindingOptions); hideToolTip(bindingOptions); startDataPullTimer(bindingOptions); - if (bindingOptions.showConfigurationButton) { + if (bindingOptions.title.showConfigurationButton) { renderDisabledBackground(bindingOptions); renderConfigurationDialog(bindingOptions); } @@ -308,39 +308,39 @@ } } function renderControlTitleBar(bindingOptions) { - if (bindingOptions.showTitle || bindingOptions.showYearSelector || bindingOptions.showRefreshButton || bindingOptions.showExportButton || bindingOptions.showImportButton) { + if (bindingOptions.title.showText || bindingOptions.title.showYearSelector || bindingOptions.title.showRefreshButton || bindingOptions.title.showExportButton || bindingOptions.title.showImportButton) { var titleBar = createElement(bindingOptions.currentView.element, "div", "title-bar"), title = createElement(titleBar, "div", "title"); if (bindingOptions.views.chart.enabled || bindingOptions.views.days.enabled || bindingOptions.views.statistics.enabled) { createElement(title, "div", "down-arrow"); } else { addClass(title, "no-click"); } - if (bindingOptions.showTitle) { + if (bindingOptions.title.showText) { title.innerHTML += bindingOptions.titleText; } if (bindingOptions.views.chart.enabled || bindingOptions.views.days.enabled || bindingOptions.views.statistics.enabled) { renderTitleDropDownMenu(bindingOptions, title); } - if (bindingOptions.showImportButton && !bindingOptions.currentView.isInFetchMode) { + if (bindingOptions.title.showImportButton && !bindingOptions.currentView.isInFetchMode) { var importData = createElementWithHTML(titleBar, "button", "import", _configuration.importButtonText); importData.onclick = function() { importFromFilesSelected(bindingOptions); }; } - if (bindingOptions.showExportButton) { + if (bindingOptions.title.showExportButton) { var exportData = createElementWithHTML(titleBar, "button", "export", _configuration.exportButtonText); exportData.onclick = function() { exportAllData(bindingOptions); }; } - if (bindingOptions.showRefreshButton) { + if (bindingOptions.title.showRefreshButton) { var refresh = createElementWithHTML(titleBar, "button", "refresh", _configuration.refreshButtonText); refresh.onclick = function() { renderControlContainer(bindingOptions); fireCustomTrigger(bindingOptions.onRefresh, bindingOptions.currentView.element); }; } - if (bindingOptions.showYearSelector) { + if (bindingOptions.title.showYearSelector) { var back = createElementWithHTML(titleBar, "button", "back", _configuration.backButtonText); back.onclick = function() { moveToPreviousYear(bindingOptions); @@ -349,12 +349,12 @@ back.disabled = true; } bindingOptions.currentView.yearText = createElementWithHTML(titleBar, "div", "year-text", bindingOptions.currentView.year); - if (bindingOptions.showYearSelectionDropDown) { + if (bindingOptions.title.showYearSelectionDropDown) { renderYearDropDownMenu(bindingOptions); } else { addClass(bindingOptions.currentView.yearText, "no-click"); } - if (bindingOptions.showConfigurationButton) { + if (bindingOptions.title.showConfigurationButton) { var configureButton = createElement(titleBar, "div", "configure"); addToolTip(configureButton, bindingOptions, _configuration.configurationToolTipText); configureButton.onclick = function() { @@ -407,7 +407,7 @@ var yearsMenuContainer = createElement(bindingOptions.currentView.yearText, "div", "years-menu-container"), yearsMenu = createElement(yearsMenuContainer, "div", "years-menu"), thisYear = (new Date()).getFullYear(), activeYearMenuItem = null; yearsMenuContainer.style.display = "block"; yearsMenuContainer.style.visibility = "hidden"; - for (var currentYear = thisYear - bindingOptions.extraSelectionYears; currentYear < thisYear + bindingOptions.extraSelectionYears; currentYear++) { + for (var currentYear = thisYear - bindingOptions.title.extraSelectionYears; currentYear < thisYear + bindingOptions.title.extraSelectionYears; currentYear++) { if (isYearVisible(bindingOptions, currentYear)) { var yearMenuItem = renderYearDropDownMenuItem(bindingOptions, yearsMenu, currentYear, thisYear); if (!isDefined(activeYearMenuItem)) { @@ -1442,15 +1442,9 @@ var options = !isDefinedObject(newOptions) ? {} : newOptions; options.views = !isDefinedObject(options.views) ? {} : options.views; options.showGuide = getDefaultBoolean(options.showGuide, true); - options.showTitle = getDefaultBoolean(options.showTitle, true); - options.showYearSelector = getDefaultBoolean(options.showYearSelector, true); - options.showRefreshButton = getDefaultBoolean(options.showRefreshButton, false); - options.showExportButton = getDefaultBoolean(options.showExportButton, false); options.colorRangeTogglesEnabled = getDefaultBoolean(options.colorRangeTogglesEnabled, true); options.exportOnlyYearBeingViewed = getDefaultBoolean(options.exportOnlyYearBeingViewed, true); options.year = getDefaultNumber(options.year, (new Date()).getFullYear()); - options.extraSelectionYears = getDefaultNumber(options.extraSelectionYears, 50); - options.showYearSelectionDropDown = getDefaultBoolean(options.showYearSelectionDropDown, true); options.view = getDefaultString(options.view, _elements_View_Name_Map); options.tooltipDelay = getDefaultNumber(options.tooltipDelay, 750); options.exportType = getDefaultString(options.exportType, _export_Type_Csv); @@ -1461,11 +1455,10 @@ options.yearsToHide = getDefaultArray(options.yearsToHide, []); options.showLessAndMoreLabels = getDefaultBoolean(options.showLessAndMoreLabels, true); options.showNumbersInGuide = getDefaultBoolean(options.showNumbersInGuide, false); - options.showImportButton = getDefaultBoolean(options.showImportButton, false); options.dataFetchDelay = getDefaultNumber(options.dataFetchDelay, 60000); options.showOnlyDataForYearsAvailable = getDefaultBoolean(options.showOnlyDataForYearsAvailable, false); options.showHolidaysInDayToolTips = getDefaultBoolean(options.showHolidaysInDayToolTips, false); - options.showConfigurationButton = getDefaultBoolean(options.showConfigurationButton, true); + options = buildAttributeOptionTitle(options); options = buildAttributeOptionColorRanges(options); options = buildAttributeOptionHolidays(options); options = buildAttributeOptionMapView(options); @@ -1476,6 +1469,18 @@ options = buildAttributeOptionCustomTriggers(options); return options; } + function buildAttributeOptionTitle(options) { + options.title = !isDefinedObject(options.title) ? {} : options.title; + options.title.showText = getDefaultBoolean(options.title.showText, true); + options.title.showYearSelector = getDefaultBoolean(options.title.showYearSelector, true); + options.title.showRefreshButton = getDefaultBoolean(options.title.showRefreshButton, false); + options.title.showExportButton = getDefaultBoolean(options.title.showExportButton, false); + options.title.extraSelectionYears = getDefaultNumber(options.title.extraSelectionYears, 50); + options.title.showYearSelectionDropDown = getDefaultBoolean(options.title.showYearSelectionDropDown, true); + options.title.showImportButton = getDefaultBoolean(options.title.showImportButton, false); + options.title.showConfigurationButton = getDefaultBoolean(options.title.showConfigurationButton, true); + return options; + } function buildAttributeOptionColorRanges(options) { if (isDefinedArray(options.colorRanges)) { var colorRangesLength = options.colorRanges.length; diff --git a/dist/heat.min.js b/dist/heat.min.js index af03dc0b..a677555d 100644 --- a/dist/heat.min.js +++ b/dist/heat.min.js @@ -1,20 +1,20 @@ /*! Heat.js v3.1.0 | (c) Bunoon 2024 | MIT License */ -(function(){function Ca(){for(var a=h.domElementTypes,b=a.length,d=0;dc;c++)R(a.views.map.daysToShow,c+1)&&u(f,"div","day-name",g&&0!==c%3?q.space:h.dayNames[c]);a.views.map.showDaysInReverseOrder&&S(f)}f=n(e,"div","months");e=ma(a);for(g=0;12>g;g++)if(U(a.views.map.monthsToShow,g)){c=n(f,"div","month");var t=n(c, "div","day-columns");var y=ca(l,g),E=n(t,"div","day-column"),B=!1,F=na(new Date(l,g,1)),G=1;y+=F;for(var H=0;H=F?B=!0:R(a.views.map.daysToShow,G)&&n(E,"div","day-disabled");if(B){var L=null;R(a.views.map.daysToShow,G)&&(L=Wa(a,E,H-F,g,l,e));if(0===(H+1)%7&&(a.views.map.showDaysInReverseOrder&&S(E),E=n(t,"div","day-column"),G=0,!w(da)&&w(L))){var Xa=fa(L,"margin-left",!0),Ya=fa(L,"margin-right",!0);da=L.offsetWidth+Xa+Ya}}G++}a.views.map.showMonthNames&&(E=c.offsetWidth,y=a.views.map.placeMonthNamesOnTheBottom? u(c,"div","month-name-bottom",h.monthNames[g]):u(c,"div","month-name",h.monthNames[g],t),w(y)&&(y.style.width=a.views.map.showMonthDayGaps?E+"px":E-da+"px"));b&&w(da)&&(0y;y++)for(E=ca(a.currentView.year,y),B=0;BF;F++)for(y=ca(a.currentView.year,F),E=0;Ef;f++)a.currentView.dayCheckBoxes[f]=Aa(e,h.dayNames[f]).input;for(e=0;7>e;e++)a.currentView.monthCheckBoxes[e]=Aa(b,h.monthNames[e]).input;for(e=7;12>e;e++)a.currentView.monthCheckBoxes[e]=Aa(d,h.monthNames[e]).input;W(c,a,h.closeToolTipText)}function Ha(a,b){var d=(b=m(b,!0))?K.addEventListener:K.removeEventListener;(b?C.addEventListener: C.removeEventListener)("mousemove",function(){ba(a)});d("scroll",function(){ba(a)})}function W(a,b,d){null!==a&&(a.onmousemove=function(c){bb(c,b,d)})}function bb(a,b,d){ha(a);ba(b);b.currentView.tooltipTimer=setTimeout(function(){b.currentView.tooltip.innerHTML=d;b.currentView.tooltip.style.display="block";var c=b.currentView.tooltip,e=a.pageX,f=a.pageY;var g=K.documentElement;var l=(C.pageXOffset||g.scrollLeft)-(g.clientLeft||0);g=(C.pageYOffset||g.scrollTop)-(g.clientTop||0);c.style.display="block"; -e+c.offsetWidth>C.innerWidth?e-=c.offsetWidth:e++;f+c.offsetHeight>C.innerHeight?f-=c.offsetHeight:f++;ef;f++)a.currentView.dayCheckBoxes[f].checked=R(c,f+1);for(c=0;12>c;c++)a.currentView.monthCheckBoxes[c].checked=U(e,c);ba(a)}),b=u(b, -"button","next",h.nextButtonText),b.onclick=function(){ia(a)},0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]&&(b.disabled=!0))}}function cb(a,b){b=n(b,"div","titles-menu-container");b=n(b,"div","titles-menu");u(b,"div","title-menu-header",h.dataText+q.colon);var d=u(b,"div","title-menu-item",h.mapText);pa(a,d,1,"map");a.views.chart.enabled&&(d=u(b,"div","title-menu-item",h.chartText),pa(a,d,2,"chart"));a.views.days.enabled&& -(u(b,"div","title-menu-header",h.yearText+q.colon),d=u(b,"div","title-menu-item",h.daysText),pa(a,d,3,"days"));a.views.statistics.enabled&&(u(b,"div","title-menu-header",h.statisticsText+q.colon),b=u(b,"div","title-menu-item",h.colorRangesText),pa(a,b,4,"statistics"))}function pa(a,b,d,c){a.currentView.view===d?x(b,"title-menu-item-active"):b.onclick=function(){a.currentView.view=d;z(a.onViewSwitch,c);A(a,!1,!0)}}function eb(a){n(a.currentView.yearText,"div","down-arrow");var b=n(a.currentView.yearText, -"div","years-menu-container"),d=n(b,"div","years-menu"),c=(new Date).getFullYear(),e=null;b.style.display="block";b.style.visibility="hidden";for(var f=c-a.extraSelectionYears;fg;g++)if(U(a.views.chart.monthsToShow,g)){y=ca(l,g);var E=1;d++;for(var B=0;Bl;l++)f(l);F.style.width=e.offsetWidth+"px";e=n(F,"div","month-name-space");e.style.height=F.offsetHeight+"px";e.style.width=t+"px"}a.views.chart.keepScrollPositions&&(a.currentView.chartContents.scrollLeft=a.currentView.chartContentsScrollLeft)}}function hb(a,b,d,c,e,f, -g){var l=new Date(e,c,d);a=n(a,"div","day-line");var t=M(b)[N(l)];t=Y(t,0);Ka(b,a,l,t);b.views.chart.showLineNumbers&&0=g&&(a.style.visibility="hidden");Q(b.onDayClick)?a.onclick=function(){z(b.onDayClick,l,t)}:x(a,"no-hover");f=za(b,f,t,l);w(f)&&qa(b,f.id)&&(v(f.chartCssClassName)?x(a,f.chartCssClassName):x(a,f.cssClassName))}function gb(a){for(var b=0,d=M(a),c=0;12>c;c++)for(var e=ca(a.currentView.year,c),f=0;f=e&&(a.style.visibility="hidden");W(a,c,d.toString());Q(c.onWeekDayClick)?a.onclick=function(){z(c.onWeekDayClick,b,d)}:x(a,"no-hover");c.views.days.showDayNumbers&&0=a&&(b.style.visibility="hidden");W(b,c,d.toString());c.views.statistics.showRangeNumbers&&0ja.notFound}function R(a,b){return a.indexOf(b)>ja.notFound}function Ra(a){var b=[];if(a.showOnlyDataForYearsAvailable){a=M(a);for(var d in a)if(a.hasOwnProperty(d)){var c=parseInt(d.split(q.dash)[0]);b.indexOf(c)===ja.notFound&&b.push(c)}}return b=b.sort(function(e,f){return e-f})}function X(a,b){return a.yearsToHide.indexOf(b)===ja.notFound&&(0===a.currentView.yearsAvailable.length||a.currentView.yearsAvailable.indexOf(b)>ja.notFound)}function Sa(a){a.currentView.isInFetchMode&& -(w(a.currentView.isInFetchModeTimer)||Na(a),w(a.currentView.isInFetchModeTimer)||(a.currentView.isInFetchModeTimer=setInterval(function(){Na(a);A(a)},a.dataFetchDelay)))}function Na(a){var b=a.currentView.element.id,d=z(a.onDataFetch,b);if(J(d)){ya(b,a,!1);for(var c in d)d.hasOwnProperty(c)&&(k[b].type[h.unknownTrendText].hasOwnProperty(c)||(k[b].type[h.unknownTrendText][c]=0),k[b].type[h.unknownTrendText][c]+=d[c])}}function qa(a,b){var d=!1;if("HOLIDAY"===b)d=!0;else for(var c=a.colorRanges.length, -e=0;e=f.minimum)e=f;else break}return e}function Ia(a,b){for(var d=a.length,c=null,e=0;e');f.push("");for(e in g)g.hasOwnProperty(e)&& -(f.push(""),f.push(""+e+""),f.push(""+g[e]+""),f.push(""));f.push("");d=f.join(q.newLine)}else if("txt"===b){g=ra(a);e=[];for(f in g)g.hasOwnProperty(f)&&e.push(f+q.colon+q.space+g[f].toString());d=e.join(q.newLine)}v(d)&&(g=n(K.body,"a"),g.style.display="none",g.setAttribute("target","_blank"),g.setAttribute("href","data:"+c+";charset=utf-8,"+encodeURIComponent(d)),c=g.setAttribute,f=new Date,e=T(f.getDate())+q.dash+T(f.getMonth()+1)+q.dash+ -f.getFullYear(),f=T(f.getHours())+q.dash+T(f.getMinutes()),d=q.empty,a.currentView.type!==h.unknownTrendText&&(d=a.currentView.type.toLowerCase().replace(q.space,q.underscore)+q.underscore),e=d+e+q.underscore+f+"."+a.exportType.toLowerCase(),c.call(g,"download",e),g.click(),K.body.removeChild(g),z(a.onExport,a.currentView.element))}function ra(a){var b={},d=M(a);if(a.exportOnlyYearBeingViewed)for(var c=0;12>c;c++)for(var e=ca(a.currentView.year,c),f=0;fa.getDay()-1?6:a.getDay()-1}function w(a){return null!==a&&void 0!==a&&a!==q.empty}function J(a){return w(a)&&"object"===typeof a}function v(a){return w(a)&&"string"===typeof a}function Q(a){return w(a)&&"function"===typeof a}function va(a){return w(a)&&"number"===typeof a}function Z(a){return J(a)&&a instanceof Array}function wa(a){return J(a)&& -a instanceof Date}function kb(a){a=a.toLowerCase();var b="text"===a;ea.hasOwnProperty(a)||(ea[a]=b?K.createTextNode(q.empty):K.createElement(a));return ea[a].cloneNode(!1)}function n(a,b,d,c){b=b.toLowerCase();var e="text"===b;ea.hasOwnProperty(b)||(ea[b]=e?K.createTextNode(q.empty):K.createElement(b));b=ea[b].cloneNode(!1);w(d)&&(b.className=d);w(c)?a.insertBefore(b,c):a.appendChild(b);return b}function u(a,b,d,c,e){a=n(a,b,d,e);a.innerHTML=c;return a}function fa(a,b,d){var c=null;d=m(d,!1);C.getComputedStyle? -c=K.defaultView.getComputedStyle(a,null).getPropertyValue(b):a.currentStyle&&(c=a.currentStyle[b]);d&&(c=parseFloat(c,10));return c}function x(a,b){a.className+=q.space+b;a.className=a.className.trim()}function ha(a){a.preventDefault();a.cancelBubble=!0}function S(a){for(var b=a.children,d=b.length-1;d--;)a.appendChild(b[d])}function Aa(a,b,d,c){a=n(a,"div");a=n(a,"label","checkbox");var e=n(a,"input");e.type="checkbox";w(c)&&(e.onclick=c);w(d)&&(e.checked=d);n(a,"span","check-mark");u(a,"span","text", -b);return{input:e,label:a}}function z(a){var b=null;Q(a)&&(b=a.apply(null,[].slice.call(arguments,1)));return b}function r(a,b){return v(a)?a:b}function m(a,b){return w(a)&&"boolean"===typeof a?a:b}function D(a,b){return Q(a)?a:b}function Y(a,b){return va(a)?a:b}function xa(a){var b=!0,d=null;try{v(a)&&(d=ka.parse(a))}catch(c){try{d=eval("("+a+")"),Q(d)&&(d=d())}catch(e){h.safeMode||(console.error(h.objectErrorText.replace("{{error_1}}",c.message).replace("{{error_2}}",e.message)),b=!1),d=null}}return{parsed:b, -result:d}}function aa(){for(var a=[],b=0;32>b;b++){8!==b&&12!==b&&16!==b&&20!==b||a.push(q.dash);var d=I.floor(16*I.random()).toString(16);a.push(d)}return a.join(q.empty)}function T(a){a=a.toString();return 1===a.length?q.zero+a:a}function Ga(a,b){return a.substring(0,b.length).toLowerCase()===b.toLowerCase()}function N(a){return a.getFullYear()+q.dash+T(a.getMonth()+1)+q.dash+T(a.getDate())}function Ba(a,b){b=m(b,!0);var d=!0,c=a.currentView.year;for(c--;!X(a,c);){if(0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]){d=!1;break}c++}d&&(a.currentView.year=c,A(a),b&&z(a.onBackYear,a.currentView.year))}function Pa(a){a.currentView.element.innerHTML=q.empty;var b=a.currentView.element;b.className=b.className.replace("heat-js", -q.empty);b.className=b.className.trim();Ha(a,!1);K.body.removeChild(a.currentView.tooltip);a.currentView.isInFetchMode&&w(a.currentView.isInFetchModeTimer)&&clearInterval(a.currentView.isInFetchModeTimer);z(a.onDestroy,a.currentView.element)}function Qa(a){h=J(a)?a:{};h.safeMode=m(h.safeMode,!0);a=h;var b=h.domElementTypes,d=["*"];v(b)?(b=b.split(q.space),0===b.length&&(b=d)):b=Z(b)?b:d;a.domElementTypes=b;h.stText=r(h.stText,"st");h.ndText=r(h.ndText,"nd");h.rdText=r(h.rdText,"rd");h.thText=r(h.thText, -"th");h.backButtonText=r(h.backButtonText,"Back");h.nextButtonText=r(h.nextButtonText,"Next");h.refreshButtonText=r(h.refreshButtonText,"Refresh");h.exportButtonText=r(h.exportButtonText,"Export");h.lessText=r(h.lessText,"Less");h.moreText=r(h.moreText,"More");h.dateText=r(h.dateText,"Date");h.countText=r(h.countText,"Count");h.mapText=r(h.mapText,"Map");h.chartText=r(h.chartText,"Chart");h.noChartDataMessage=r(h.noChartDataMessage,"There is currently no data to view.");h.statisticsText=r(h.statisticsText, -"Statistics");h.noStatisticsDataMessage=r(h.noStatisticsDataMessage,"There are currently no statistics to view.");h.unknownTrendText=r(h.unknownTrendText,"Unknown");h.importButtonText=r(h.importButtonText,"Import");h.noMapDataMessage=r(h.noMapDataMessage,"There is currently no data to view.");h.objectErrorText=r(h.objectErrorText,"Errors in object: {{error_1}}, {{error_2}}");h.attributeNotValidErrorText=r(h.attributeNotValidErrorText,"The attribute '{{attribute_name}}' is not a valid object.");h.attributeNotSetErrorText= -r(h.attributeNotSetErrorText,"The attribute '{{attribute_name}}' has not been set correctly.");h.closeToolTipText=r(h.closeToolTipText,"Close");h.configurationToolTipText=r(h.configurationToolTipText,"Configuration");h.configurationTitleText=r(h.configurationTitleText,"Configuration");h.visibleMonthsText=r(h.visibleMonthsText,"Visible Months");h.visibleDaysText=r(h.visibleDaysText,"Visible Days");h.dataText=r(h.dataText,"Data");h.colorRangesText=r(h.colorRangesText,"Color Ranges");h.yearText=r(h.yearText, -"Year");h.daysText=r(h.daysText,"Days");h.noDaysDataMessage=r(h.noDaysDataMessage,"There are currently no days to view.");P(h.monthNames,12)&&(h.monthNames="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "));P(h.dayNames,7)&&(h.dayNames="Mon Tue Wed Thu Fri Sat Sun".split(" "))}function P(a,b){b=va(b)?b:1;return!Z(a)||a.lengthd&&(a.currentView.year= -d,X(a,a.currentView.year)?A(a):Ba(a,!1),z(a.onSetYear,a.currentView.year))}return p};p.moveToPreviousYear=function(a){v(a)&&k.hasOwnProperty(a)&&Ba(k[a].options);return p};p.moveToNextYear=function(a){v(a)&&k.hasOwnProperty(a)&&ia(k[a].options);return p};p.moveToCurrentYear=function(a){v(a)&&k.hasOwnProperty(a)&&(a=k[a].options,a.currentView.year=(new Date).getFullYear(),X(a,a.currentView.year)?A(a):ia(a,!1),z(a.onSetYear,a.currentView.year));return p};p.getYear=function(a){var b=null;v(a)&&k.hasOwnProperty(a)&& -(b=k[a].options.currentView.year);return b};p.render=function(a,b){J(a)&&J(b)&&Da(Ea(b,a));return p};p.renderAll=function(){Ca();return p};p.switchView=function(a,b){if(v(a)&&v(b)&&k.hasOwnProperty(a)){a=k[a].options;var d=null;"map"===b.toLowerCase()?d=1:"chart"===b.toLowerCase()?d=2:"days"===b.toLowerCase()?d=3:"statistics"===b.toLowerCase()&&(d=4);va(d)&&(a.currentView.view=d,z(a.onViewSwitch,b),A(a,!1,!0))}return p};p.switchType=function(a,b){v(a)&&v(b)&&k.hasOwnProperty(a)&&k[a].type.hasOwnProperty(b)&& -(a=k[a].options,a.currentView.type!==b&&(a.currentView.type=b,z(a.onTypeSwitch,b),A(a)));return p};p.updateOptions=function(a,b){if(v(a)&&J(b)&&k.hasOwnProperty(a)){a=k[a].options;b=Fa(b);var d=!1,c;for(c in b)b.hasOwnProperty(c)&&a.hasOwnProperty(c)&&a[c]!==b[c]&&(a[c]=b[c],d=!0);d&&(A(a,!0),z(a.onRefresh,a.currentView.element),z(a.onOptionsUpdate,a.currentView.element,a))}return p};p.destroyAll=function(){for(var a in k)k.hasOwnProperty(a)&&Pa(k[a].options);k={};return p};p.destroy=function(a){v(a)&& -k.hasOwnProperty(a)&&(Pa(k[a].options),delete k[a]);return p};p.setConfiguration=function(a,b){if(J(a)){var d=!1,c;for(c in a)a.hasOwnProperty(c)&&h.hasOwnProperty(c)&&h[c]!==a[c]&&(h[c]=a[c],d=!0);d&&(b=m(b,!0),Qa(h),b&&p.refreshAll())}return p};p.getIds=function(){var a=[],b;for(b in k)k.hasOwnProperty(b)&&a.push(b);return a};p.getVersion=function(){return"3.1.0"};(function(a,b,d,c){K=a;C=b;I=d;ka=c;Qa();K.addEventListener("DOMContentLoaded",function(){Ca()});C.addEventListener("pagehide",function(){for(var e in k)if(k.hasOwnProperty(e)){var f= -k[e].options;w(f.currentView.isInFetchModeTimer)&&clearInterval(f.currentView.isInFetchModeTimer)}});w(C.$heat)||(C.$heat=p)})(document,window,Math,JSON)})(); \ No newline at end of file +e+c.offsetWidth>C.innerWidth?e-=c.offsetWidth:e++;f+c.offsetHeight>C.innerHeight?f-=c.offsetHeight:f++;ef;f++)a.currentView.dayCheckBoxes[f].checked=R(c,f+1);for(c=0;12>c;c++)a.currentView.monthCheckBoxes[c].checked= +U(e,c);ba(a)}),b=u(b,"button","next",h.nextButtonText),b.onclick=function(){ia(a)},0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]&&(b.disabled=!0))}}function cb(a,b){b=n(b,"div","titles-menu-container");b=n(b,"div","titles-menu");u(b,"div","title-menu-header",h.dataText+q.colon);var d=u(b,"div","title-menu-item",h.mapText);pa(a,d,1,"map");a.views.chart.enabled&&(d=u(b,"div","title-menu-item",h.chartText),pa(a,d,2,"chart")); +a.views.days.enabled&&(u(b,"div","title-menu-header",h.yearText+q.colon),d=u(b,"div","title-menu-item",h.daysText),pa(a,d,3,"days"));a.views.statistics.enabled&&(u(b,"div","title-menu-header",h.statisticsText+q.colon),b=u(b,"div","title-menu-item",h.colorRangesText),pa(a,b,4,"statistics"))}function pa(a,b,d,c){a.currentView.view===d?x(b,"title-menu-item-active"):b.onclick=function(){a.currentView.view=d;z(a.onViewSwitch,c);A(a,!1,!0)}}function eb(a){n(a.currentView.yearText,"div","down-arrow");var b= +n(a.currentView.yearText,"div","years-menu-container"),d=n(b,"div","years-menu"),c=(new Date).getFullYear(),e=null;b.style.display="block";b.style.visibility="hidden";for(var f=c-a.title.extraSelectionYears;fg;g++)if(U(a.views.chart.monthsToShow,g)){y=ca(l,g);var E=1;d++;for(var B=0;Bl;l++)f(l);F.style.width=e.offsetWidth+"px";e=n(F,"div","month-name-space");e.style.height=F.offsetHeight+"px";e.style.width=t+"px"}a.views.chart.keepScrollPositions&&(a.currentView.chartContents.scrollLeft= +a.currentView.chartContentsScrollLeft)}}function hb(a,b,d,c,e,f,g){var l=new Date(e,c,d);a=n(a,"div","day-line");var t=M(b)[N(l)];t=Y(t,0);Ka(b,a,l,t);b.views.chart.showLineNumbers&&0=g&&(a.style.visibility="hidden");Q(b.onDayClick)?a.onclick=function(){z(b.onDayClick,l,t)}:x(a,"no-hover");f=za(b,f,t,l);w(f)&&qa(b,f.id)&&(v(f.chartCssClassName)?x(a,f.chartCssClassName):x(a,f.cssClassName))}function gb(a){for(var b= +0,d=M(a),c=0;12>c;c++)for(var e=ca(a.currentView.year,c),f=0;f=e&&(a.style.visibility="hidden");W(a,c,d.toString());Q(c.onWeekDayClick)?a.onclick=function(){z(c.onWeekDayClick,b,d)}:x(a,"no-hover");c.views.days.showDayNumbers&&0=a&&(b.style.visibility="hidden");W(b,c,d.toString());c.views.statistics.showRangeNumbers&&0ja.notFound}function R(a,b){return a.indexOf(b)>ja.notFound}function Ra(a){var b=[];if(a.showOnlyDataForYearsAvailable){a=M(a);for(var d in a)if(a.hasOwnProperty(d)){var c=parseInt(d.split(q.dash)[0]);b.indexOf(c)===ja.notFound&&b.push(c)}}return b= +b.sort(function(e,f){return e-f})}function X(a,b){return a.yearsToHide.indexOf(b)===ja.notFound&&(0===a.currentView.yearsAvailable.length||a.currentView.yearsAvailable.indexOf(b)>ja.notFound)}function Sa(a){a.currentView.isInFetchMode&&(w(a.currentView.isInFetchModeTimer)||Na(a),w(a.currentView.isInFetchModeTimer)||(a.currentView.isInFetchModeTimer=setInterval(function(){Na(a);A(a)},a.dataFetchDelay)))}function Na(a){var b=a.currentView.element.id,d=z(a.onDataFetch,b);if(I(d)){ya(b,a,!1);for(var c in d)d.hasOwnProperty(c)&& +(k[b].type[h.unknownTrendText].hasOwnProperty(c)||(k[b].type[h.unknownTrendText][c]=0),k[b].type[h.unknownTrendText][c]+=d[c])}}function qa(a,b){var d=!1;if("HOLIDAY"===b)d=!0;else for(var c=a.colorRanges.length,e=0;e=f.minimum)e=f;else break}return e}function Ia(a,b){for(var d=a.length,c=null,e=0;e');f.push("");for(e in g)g.hasOwnProperty(e)&&(f.push(""),f.push(""+e+""),f.push(""+g[e]+""),f.push(""));f.push("");d=f.join(q.newLine)}else if("txt"===b){g=ra(a);e=[];for(f in g)g.hasOwnProperty(f)&&e.push(f+q.colon+q.space+g[f].toString());d=e.join(q.newLine)}v(d)&&(g=n(K.body,"a"), +g.style.display="none",g.setAttribute("target","_blank"),g.setAttribute("href","data:"+c+";charset=utf-8,"+encodeURIComponent(d)),c=g.setAttribute,f=new Date,e=T(f.getDate())+q.dash+T(f.getMonth()+1)+q.dash+f.getFullYear(),f=T(f.getHours())+q.dash+T(f.getMinutes()),d=q.empty,a.currentView.type!==h.unknownTrendText&&(d=a.currentView.type.toLowerCase().replace(q.space,q.underscore)+q.underscore),e=d+e+q.underscore+f+"."+a.exportType.toLowerCase(),c.call(g,"download",e),g.click(),K.body.removeChild(g), +z(a.onExport,a.currentView.element))}function ra(a){var b={},d=M(a);if(a.exportOnlyYearBeingViewed)for(var c=0;12>c;c++)for(var e=ca(a.currentView.year,c),f=0;f +a.getDay()-1?6:a.getDay()-1}function w(a){return null!==a&&void 0!==a&&a!==q.empty}function I(a){return w(a)&&"object"===typeof a}function v(a){return w(a)&&"string"===typeof a}function Q(a){return w(a)&&"function"===typeof a}function va(a){return w(a)&&"number"===typeof a}function Z(a){return I(a)&&a instanceof Array}function wa(a){return I(a)&&a instanceof Date}function kb(a){a=a.toLowerCase();var b="text"===a;ea.hasOwnProperty(a)||(ea[a]=b?K.createTextNode(q.empty):K.createElement(a));return ea[a].cloneNode(!1)} +function n(a,b,d,c){b=b.toLowerCase();var e="text"===b;ea.hasOwnProperty(b)||(ea[b]=e?K.createTextNode(q.empty):K.createElement(b));b=ea[b].cloneNode(!1);w(d)&&(b.className=d);w(c)?a.insertBefore(b,c):a.appendChild(b);return b}function u(a,b,d,c,e){a=n(a,b,d,e);a.innerHTML=c;return a}function fa(a,b,d){var c=null;d=m(d,!1);C.getComputedStyle?c=K.defaultView.getComputedStyle(a,null).getPropertyValue(b):a.currentStyle&&(c=a.currentStyle[b]);d&&(c=parseFloat(c,10));return c}function x(a,b){a.className+= +q.space+b;a.className=a.className.trim()}function ha(a){a.preventDefault();a.cancelBubble=!0}function S(a){for(var b=a.children,d=b.length-1;d--;)a.appendChild(b[d])}function Aa(a,b,d,c){a=n(a,"div");a=n(a,"label","checkbox");var e=n(a,"input");e.type="checkbox";w(c)&&(e.onclick=c);w(d)&&(e.checked=d);n(a,"span","check-mark");u(a,"span","text",b);return{input:e,label:a}}function z(a){var b=null;Q(a)&&(b=a.apply(null,[].slice.call(arguments,1)));return b}function r(a,b){return v(a)?a:b}function m(a, +b){return w(a)&&"boolean"===typeof a?a:b}function D(a,b){return Q(a)?a:b}function Y(a,b){return va(a)?a:b}function xa(a){var b=!0,d=null;try{v(a)&&(d=ka.parse(a))}catch(c){try{d=eval("("+a+")"),Q(d)&&(d=d())}catch(e){h.safeMode||(console.error(h.objectErrorText.replace("{{error_1}}",c.message).replace("{{error_2}}",e.message)),b=!1),d=null}}return{parsed:b,result:d}}function aa(){for(var a=[],b=0;32>b;b++){8!==b&&12!==b&&16!==b&&20!==b||a.push(q.dash);var d=J.floor(16*J.random()).toString(16);a.push(d)}return a.join(q.empty)} +function T(a){a=a.toString();return 1===a.length?q.zero+a:a}function Ga(a,b){return a.substring(0,b.length).toLowerCase()===b.toLowerCase()}function N(a){return a.getFullYear()+q.dash+T(a.getMonth()+1)+q.dash+T(a.getDate())}function Ba(a,b){b=m(b,!0);var d=!0,c=a.currentView.year;for(c--;!X(a,c);){if(0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]){d=!1;break}c++}d&&(a.currentView.year=c,A(a),b&&z(a.onBackYear,a.currentView.year))}function Pa(a){a.currentView.element.innerHTML=q.empty;var b=a.currentView.element;b.className=b.className.replace("heat-js",q.empty);b.className=b.className.trim();Ha(a,!1);K.body.removeChild(a.currentView.tooltip);a.currentView.isInFetchMode&&w(a.currentView.isInFetchModeTimer)&&clearInterval(a.currentView.isInFetchModeTimer); +z(a.onDestroy,a.currentView.element)}function Qa(a){h=I(a)?a:{};h.safeMode=m(h.safeMode,!0);a=h;var b=h.domElementTypes,d=["*"];v(b)?(b=b.split(q.space),0===b.length&&(b=d)):b=Z(b)?b:d;a.domElementTypes=b;h.stText=r(h.stText,"st");h.ndText=r(h.ndText,"nd");h.rdText=r(h.rdText,"rd");h.thText=r(h.thText,"th");h.backButtonText=r(h.backButtonText,"Back");h.nextButtonText=r(h.nextButtonText,"Next");h.refreshButtonText=r(h.refreshButtonText,"Refresh");h.exportButtonText=r(h.exportButtonText,"Export");h.lessText= +r(h.lessText,"Less");h.moreText=r(h.moreText,"More");h.dateText=r(h.dateText,"Date");h.countText=r(h.countText,"Count");h.mapText=r(h.mapText,"Map");h.chartText=r(h.chartText,"Chart");h.noChartDataMessage=r(h.noChartDataMessage,"There is currently no data to view.");h.statisticsText=r(h.statisticsText,"Statistics");h.noStatisticsDataMessage=r(h.noStatisticsDataMessage,"There are currently no statistics to view.");h.unknownTrendText=r(h.unknownTrendText,"Unknown");h.importButtonText=r(h.importButtonText, +"Import");h.noMapDataMessage=r(h.noMapDataMessage,"There is currently no data to view.");h.objectErrorText=r(h.objectErrorText,"Errors in object: {{error_1}}, {{error_2}}");h.attributeNotValidErrorText=r(h.attributeNotValidErrorText,"The attribute '{{attribute_name}}' is not a valid object.");h.attributeNotSetErrorText=r(h.attributeNotSetErrorText,"The attribute '{{attribute_name}}' has not been set correctly.");h.closeToolTipText=r(h.closeToolTipText,"Close");h.configurationToolTipText=r(h.configurationToolTipText, +"Configuration");h.configurationTitleText=r(h.configurationTitleText,"Configuration");h.visibleMonthsText=r(h.visibleMonthsText,"Visible Months");h.visibleDaysText=r(h.visibleDaysText,"Visible Days");h.dataText=r(h.dataText,"Data");h.colorRangesText=r(h.colorRangesText,"Color Ranges");h.yearText=r(h.yearText,"Year");h.daysText=r(h.daysText,"Days");h.noDaysDataMessage=r(h.noDaysDataMessage,"There are currently no days to view.");P(h.monthNames,12)&&(h.monthNames="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ")); +P(h.dayNames,7)&&(h.dayNames="Mon Tue Wed Thu Fri Sat Sun".split(" "))}function P(a,b){b=va(b)?b:1;return!Z(a)||a.lengthd&&(a.currentView.year=d,X(a,a.currentView.year)?A(a):Ba(a,!1),z(a.onSetYear,a.currentView.year))}return p};p.moveToPreviousYear=function(a){v(a)&&k.hasOwnProperty(a)&&Ba(k[a].options);return p};p.moveToNextYear=function(a){v(a)&&k.hasOwnProperty(a)&& +ia(k[a].options);return p};p.moveToCurrentYear=function(a){v(a)&&k.hasOwnProperty(a)&&(a=k[a].options,a.currentView.year=(new Date).getFullYear(),X(a,a.currentView.year)?A(a):ia(a,!1),z(a.onSetYear,a.currentView.year));return p};p.getYear=function(a){var b=null;v(a)&&k.hasOwnProperty(a)&&(b=k[a].options.currentView.year);return b};p.render=function(a,b){I(a)&&I(b)&&Da(Ea(b,a));return p};p.renderAll=function(){Ca();return p};p.switchView=function(a,b){if(v(a)&&v(b)&&k.hasOwnProperty(a)){a=k[a].options; +var d=null;"map"===b.toLowerCase()?d=1:"chart"===b.toLowerCase()?d=2:"days"===b.toLowerCase()?d=3:"statistics"===b.toLowerCase()&&(d=4);va(d)&&(a.currentView.view=d,z(a.onViewSwitch,b),A(a,!1,!0))}return p};p.switchType=function(a,b){v(a)&&v(b)&&k.hasOwnProperty(a)&&k[a].type.hasOwnProperty(b)&&(a=k[a].options,a.currentView.type!==b&&(a.currentView.type=b,z(a.onTypeSwitch,b),A(a)));return p};p.updateOptions=function(a,b){if(v(a)&&I(b)&&k.hasOwnProperty(a)){a=k[a].options;b=Fa(b);var d=!1,c;for(c in b)b.hasOwnProperty(c)&& +a.hasOwnProperty(c)&&a[c]!==b[c]&&(a[c]=b[c],d=!0);d&&(A(a,!0),z(a.onRefresh,a.currentView.element),z(a.onOptionsUpdate,a.currentView.element,a))}return p};p.destroyAll=function(){for(var a in k)k.hasOwnProperty(a)&&Pa(k[a].options);k={};return p};p.destroy=function(a){v(a)&&k.hasOwnProperty(a)&&(Pa(k[a].options),delete k[a]);return p};p.setConfiguration=function(a,b){if(I(a)){var d=!1,c;for(c in a)a.hasOwnProperty(c)&&h.hasOwnProperty(c)&&h[c]!==a[c]&&(h[c]=a[c],d=!0);d&&(b=m(b,!0),Qa(h),b&&p.refreshAll())}return p}; +p.getIds=function(){var a=[],b;for(b in k)k.hasOwnProperty(b)&&a.push(b);return a};p.getVersion=function(){return"3.1.0"};(function(a,b,d,c){K=a;C=b;J=d;ka=c;Qa();K.addEventListener("DOMContentLoaded",function(){Ca()});C.addEventListener("pagehide",function(){for(var e in k)if(k.hasOwnProperty(e)){var f=k[e].options;w(f.currentView.isInFetchModeTimer)&&clearInterval(f.currentView.isInFetchModeTimer)}});w(C.$heat)||(C.$heat=p)})(document,window,Math,JSON)})(); \ No newline at end of file diff --git a/src/heat.js b/src/heat.js index a89cac3d..3c1a017a 100644 --- a/src/heat.js +++ b/src/heat.js @@ -237,7 +237,7 @@ startDataPullTimer( bindingOptions ); - if ( bindingOptions.showConfigurationButton ) { + if ( bindingOptions.title.showConfigurationButton ) { renderDisabledBackground( bindingOptions ); renderConfigurationDialog( bindingOptions ); } @@ -519,7 +519,7 @@ */ function renderControlTitleBar( bindingOptions ) { - if ( bindingOptions.showTitle || bindingOptions.showYearSelector || bindingOptions.showRefreshButton || bindingOptions.showExportButton || bindingOptions.showImportButton ) { + if ( bindingOptions.title.showText || bindingOptions.title.showYearSelector || bindingOptions.title.showRefreshButton || bindingOptions.title.showExportButton || bindingOptions.title.showImportButton ) { var titleBar = createElement( bindingOptions.currentView.element, "div", "title-bar" ), title = createElement( titleBar, "div", "title" ); @@ -529,7 +529,7 @@ addClass( title, "no-click" ); } - if ( bindingOptions.showTitle ) { + if ( bindingOptions.title.showText ) { title.innerHTML += bindingOptions.titleText; } @@ -537,7 +537,7 @@ renderTitleDropDownMenu( bindingOptions, title ); } - if ( bindingOptions.showImportButton && !bindingOptions.currentView.isInFetchMode ) { + if ( bindingOptions.title.showImportButton && !bindingOptions.currentView.isInFetchMode ) { var importData = createElementWithHTML( titleBar, "button", "import", _configuration.importButtonText ); importData.onclick = function() { @@ -545,7 +545,7 @@ }; } - if ( bindingOptions.showExportButton ) { + if ( bindingOptions.title.showExportButton ) { var exportData = createElementWithHTML( titleBar, "button", "export", _configuration.exportButtonText ); exportData.onclick = function() { @@ -553,7 +553,7 @@ }; } - if ( bindingOptions.showRefreshButton ) { + if ( bindingOptions.title.showRefreshButton ) { var refresh = createElementWithHTML( titleBar, "button", "refresh", _configuration.refreshButtonText ); refresh.onclick = function() { @@ -562,7 +562,7 @@ }; } - if ( bindingOptions.showYearSelector ) { + if ( bindingOptions.title.showYearSelector ) { var back = createElementWithHTML( titleBar, "button", "back", _configuration.backButtonText ); back.onclick = function() { @@ -575,13 +575,13 @@ bindingOptions.currentView.yearText = createElementWithHTML( titleBar, "div", "year-text", bindingOptions.currentView.year ); - if ( bindingOptions.showYearSelectionDropDown ) { + if ( bindingOptions.title.showYearSelectionDropDown ) { renderYearDropDownMenu( bindingOptions ); } else { addClass( bindingOptions.currentView.yearText, "no-click" ); } - if ( bindingOptions.showConfigurationButton ) { + if ( bindingOptions.title.showConfigurationButton ) { var configureButton = createElement( titleBar, "div", "configure" ); addToolTip( configureButton, bindingOptions, _configuration.configurationToolTipText ); @@ -662,7 +662,7 @@ yearsMenuContainer.style.display = "block"; yearsMenuContainer.style.visibility = "hidden"; - for ( var currentYear = thisYear - bindingOptions.extraSelectionYears; currentYear < thisYear + bindingOptions.extraSelectionYears; currentYear++ ) { + for ( var currentYear = thisYear - bindingOptions.title.extraSelectionYears; currentYear < thisYear + bindingOptions.title.extraSelectionYears; currentYear++ ) { if ( isYearVisible( bindingOptions, currentYear ) ) { var yearMenuItem = renderYearDropDownMenuItem( bindingOptions, yearsMenu, currentYear, thisYear ); @@ -2242,15 +2242,9 @@ var options = !isDefinedObject( newOptions ) ? {} : newOptions; options.views = !isDefinedObject( options.views ) ? {} : options.views; options.showGuide = getDefaultBoolean( options.showGuide, true ); - options.showTitle = getDefaultBoolean( options.showTitle, true ); - options.showYearSelector = getDefaultBoolean( options.showYearSelector, true ); - options.showRefreshButton = getDefaultBoolean( options.showRefreshButton, false ); - options.showExportButton = getDefaultBoolean( options.showExportButton, false ); options.colorRangeTogglesEnabled = getDefaultBoolean( options.colorRangeTogglesEnabled, true ); options.exportOnlyYearBeingViewed = getDefaultBoolean( options.exportOnlyYearBeingViewed, true ); options.year = getDefaultNumber( options.year, new Date().getFullYear() ); - options.extraSelectionYears = getDefaultNumber( options.extraSelectionYears, 50 ); - options.showYearSelectionDropDown = getDefaultBoolean( options.showYearSelectionDropDown, true ); options.view = getDefaultString( options.view, _elements_View_Name_Map ); options.tooltipDelay = getDefaultNumber( options.tooltipDelay, 750 ); options.exportType = getDefaultString( options.exportType, _export_Type_Csv ); @@ -2261,12 +2255,11 @@ options.yearsToHide = getDefaultArray( options.yearsToHide, [] ); options.showLessAndMoreLabels = getDefaultBoolean( options.showLessAndMoreLabels, true ); options.showNumbersInGuide = getDefaultBoolean( options.showNumbersInGuide, false ); - options.showImportButton = getDefaultBoolean( options.showImportButton, false ); options.dataFetchDelay = getDefaultNumber( options.dataFetchDelay, 60000 ); options.showOnlyDataForYearsAvailable = getDefaultBoolean( options.showOnlyDataForYearsAvailable, false ); options.showHolidaysInDayToolTips = getDefaultBoolean( options.showHolidaysInDayToolTips, false ); - options.showConfigurationButton = getDefaultBoolean( options.showConfigurationButton, true ); - + + options = buildAttributeOptionTitle( options ); options = buildAttributeOptionColorRanges( options ); options = buildAttributeOptionHolidays( options ); options = buildAttributeOptionMapView( options ); @@ -2279,6 +2272,20 @@ return options; } + function buildAttributeOptionTitle( options ) { + options.title = !isDefinedObject( options.title ) ? {} : options.title; + options.title.showText = getDefaultBoolean( options.title.showText, true ); + options.title.showYearSelector = getDefaultBoolean( options.title.showYearSelector, true ); + options.title.showRefreshButton = getDefaultBoolean( options.title.showRefreshButton, false ); + options.title.showExportButton = getDefaultBoolean( options.title.showExportButton, false ); + options.title.extraSelectionYears = getDefaultNumber( options.title.extraSelectionYears, 50 ); + options.title.showYearSelectionDropDown = getDefaultBoolean( options.title.showYearSelectionDropDown, true ); + options.title.showImportButton = getDefaultBoolean( options.title.showImportButton, false ); + options.title.showConfigurationButton = getDefaultBoolean( options.title.showConfigurationButton, true ); + + return options; + } + function buildAttributeOptionColorRanges( options ) { if ( isDefinedArray( options.colorRanges ) ) { var colorRangesLength = options.colorRanges.length; diff --git a/test/dist/heat.js.bootstrap.html b/test/dist/heat.js.bootstrap.html index f89d36f9..636ae928 100644 --- a/test/dist/heat.js.bootstrap.html +++ b/test/dist/heat.js.bootstrap.html @@ -20,7 +20,7 @@

Heat.js - Bootstrap



-
+


@@ -135,10 +135,10 @@

Manage Instances:


- - - - + + + +

Destroy:

diff --git a/test/src/heat.js.bootstrap.html b/test/src/heat.js.bootstrap.html index 45c63637..f408b021 100644 --- a/test/src/heat.js.bootstrap.html +++ b/test/src/heat.js.bootstrap.html @@ -20,7 +20,7 @@

Heat.js - Bootstrap



-
+


@@ -135,10 +135,10 @@

Manage Instances:


- - - - + + + +

Destroy:

From fc63b4385915a11fee6264069856fdd7ba994aaa Mon Sep 17 00:00:00 2001 From: William Troup Date: Sat, 30 Mar 2024 16:49:45 +0000 Subject: [PATCH 06/10] BREAKING: All guide related binding options are now available under a new area called "guide". --- dist/heat.js | 27 +++++--- dist/heat.min.js | 115 ++++++++++++++++--------------- src/heat.js | 29 +++++--- test/dist/heat.js.no-clicks.html | 2 +- test/dist/heat.js.numbers.html | 2 +- test/src/heat.js.no-clicks.html | 2 +- test/src/heat.js.numbers.html | 2 +- 7 files changed, 96 insertions(+), 83 deletions(-) diff --git a/dist/heat.js b/dist/heat.js index bfa34a7c..e421f834 100644 --- a/dist/heat.js +++ b/dist/heat.js @@ -919,11 +919,11 @@ } else { renderDescription(bindingOptions, mapTypes); } - if (bindingOptions.showGuide) { + if (bindingOptions.guide.enabled) { var mapToggles = createElement(guide, "div", "map-toggles"); - if (bindingOptions.showLessAndMoreLabels) { + if (bindingOptions.guide.showLessAndMoreLabels) { var lessText = createElementWithHTML(mapToggles, "div", "less-text", _configuration.lessText); - if (bindingOptions.colorRangeTogglesEnabled) { + if (bindingOptions.guide.colorRangeTogglesEnabled) { lessText.onclick = function() { updateColorRangeToggles(bindingOptions, false); }; @@ -935,9 +935,9 @@ for (var colorRangesIndex = 0; colorRangesIndex < colorRangesLength; colorRangesIndex++) { renderControlViewGuideDay(bindingOptions, days, colorRanges[colorRangesIndex]); } - if (bindingOptions.showLessAndMoreLabels) { + if (bindingOptions.guide.showLessAndMoreLabels) { var moreText = createElementWithHTML(mapToggles, "div", "more-text", _configuration.moreText); - if (bindingOptions.colorRangeTogglesEnabled) { + if (bindingOptions.guide.colorRangeTogglesEnabled) { moreText.onclick = function() { updateColorRangeToggles(bindingOptions, true); }; @@ -975,11 +975,11 @@ addClass(day, colorRange.cssClassName); } } - if (bindingOptions.showNumbersInGuide) { + if (bindingOptions.guide.showNumbersInGuide) { addClass(day, "day-number"); day.innerHTML = colorRange.minimum + _string.plus; } - if (bindingOptions.colorRangeTogglesEnabled) { + if (bindingOptions.guide.colorRangeTogglesEnabled) { day.onclick = function() { toggleColorRangeVisibleState(bindingOptions, colorRange.id); }; @@ -1441,8 +1441,6 @@ function buildAttributeOptions(newOptions) { var options = !isDefinedObject(newOptions) ? {} : newOptions; options.views = !isDefinedObject(options.views) ? {} : options.views; - options.showGuide = getDefaultBoolean(options.showGuide, true); - options.colorRangeTogglesEnabled = getDefaultBoolean(options.colorRangeTogglesEnabled, true); options.exportOnlyYearBeingViewed = getDefaultBoolean(options.exportOnlyYearBeingViewed, true); options.year = getDefaultNumber(options.year, (new Date()).getFullYear()); options.view = getDefaultString(options.view, _elements_View_Name_Map); @@ -1453,12 +1451,11 @@ options.useLocalStorageForData = getDefaultBoolean(options.useLocalStorageForData, false); options.allowFileImports = getDefaultBoolean(options.allowFileImports, true); options.yearsToHide = getDefaultArray(options.yearsToHide, []); - options.showLessAndMoreLabels = getDefaultBoolean(options.showLessAndMoreLabels, true); - options.showNumbersInGuide = getDefaultBoolean(options.showNumbersInGuide, false); options.dataFetchDelay = getDefaultNumber(options.dataFetchDelay, 60000); options.showOnlyDataForYearsAvailable = getDefaultBoolean(options.showOnlyDataForYearsAvailable, false); options.showHolidaysInDayToolTips = getDefaultBoolean(options.showHolidaysInDayToolTips, false); options = buildAttributeOptionTitle(options); + options = buildAttributeOptionGuide(options); options = buildAttributeOptionColorRanges(options); options = buildAttributeOptionHolidays(options); options = buildAttributeOptionMapView(options); @@ -1481,6 +1478,14 @@ options.title.showConfigurationButton = getDefaultBoolean(options.title.showConfigurationButton, true); return options; } + function buildAttributeOptionGuide(options) { + options.guide = !isDefinedObject(options.guide) ? {} : options.guide; + options.guide.enabled = getDefaultBoolean(options.guide.enabled, true); + options.guide.colorRangeTogglesEnabled = getDefaultBoolean(options.guide.colorRangeTogglesEnabled, true); + options.guide.showLessAndMoreLabels = getDefaultBoolean(options.guide.showLessAndMoreLabels, true); + options.guide.showNumbersInGuide = getDefaultBoolean(options.guide.showNumbersInGuide, false); + return options; + } function buildAttributeOptionColorRanges(options) { if (isDefinedArray(options.colorRanges)) { var colorRangesLength = options.colorRanges.length; diff --git a/dist/heat.min.js b/dist/heat.min.js index a677555d..482ed18a 100644 --- a/dist/heat.min.js +++ b/dist/heat.min.js @@ -1,5 +1,5 @@ /*! Heat.js v3.1.0 | (c) Bunoon 2024 | MIT License */ -(function(){function Ca(){for(var a=h.domElementTypes,b=a.length,d=0;dc;c++)R(a.views.map.daysToShow,c+1)&&u(f,"div","day-name",g&&0!==c%3?q.space:h.dayNames[c]);a.views.map.showDaysInReverseOrder&&S(f)}f=n(e,"div","months");e=ma(a);for(g=0;12>g;g++)if(U(a.views.map.monthsToShow,g)){c=n(f,"div","month");var t=n(c, -"div","day-columns");var y=ca(l,g),E=n(t,"div","day-column"),B=!1,F=na(new Date(l,g,1)),G=1;y+=F;for(var H=0;H=F?B=!0:R(a.views.map.daysToShow,G)&&n(E,"div","day-disabled");if(B){var L=null;R(a.views.map.daysToShow,G)&&(L=Wa(a,E,H-F,g,l,e));if(0===(H+1)%7&&(a.views.map.showDaysInReverseOrder&&S(E),E=n(t,"div","day-column"),G=0,!w(da)&&w(L))){var Xa=fa(L,"margin-left",!0),Ya=fa(L,"margin-right",!0);da=L.offsetWidth+Xa+Ya}}G++}a.views.map.showMonthNames&&(E=c.offsetWidth,y=a.views.map.placeMonthNamesOnTheBottom? +"div","day-columns");var y=ca(l,g),E=n(t,"div","day-column"),B=!1,F=na(new Date(l,g,1)),H=1;y+=F;for(var I=0;I=F?B=!0:R(a.views.map.daysToShow,H)&&n(E,"div","day-disabled");if(B){var L=null;R(a.views.map.daysToShow,H)&&(L=Wa(a,E,I-F,g,l,e));if(0===(I+1)%7&&(a.views.map.showDaysInReverseOrder&&S(E),E=n(t,"div","day-column"),H=0,!w(da)&&w(L))){var Xa=fa(L,"margin-left",!0),Ya=fa(L,"margin-right",!0);da=L.offsetWidth+Xa+Ya}}H++}a.views.map.showMonthNames&&(E=c.offsetWidth,y=a.views.map.placeMonthNamesOnTheBottom? u(c,"div","month-name-bottom",h.monthNames[g]):u(c,"div","month-name",h.monthNames[g],t),w(y)&&(y.style.width=a.views.map.showMonthDayGaps?E+"px":E-da+"px"));b&&w(da)&&(0y;y++)for(E=ca(a.currentView.year,y),B=0;By;y++)for(E=ca(a.currentView.year,y),B=0;BF;F++)for(y=ca(a.currentView.year,F),E=0;EF;F++)for(y=ca(a.currentView.year,F),E=0;Eg;g++)if(U(a.views.chart.monthsToShow,g)){y=ca(l,g);var E=1;d++;for(var B=0;Bl;l++)f(l);F.style.width=e.offsetWidth+"px";e=n(F,"div","month-name-space");e.style.height=F.offsetHeight+"px";e.style.width=t+"px"}a.views.chart.keepScrollPositions&&(a.currentView.chartContents.scrollLeft= +S(e);if(a.views.chart.showMonthNames){var F=n(a.currentView.chartContents,"div","chart-months"),H=e.offsetWidth/d,I=0;f=function(L){U(a.views.chart.monthsToShow,L)&&(u(F,"div","month-name",h.monthNames[L]).style.left=t+H*I+"px",I++)};if(a.views.chart.showInReverseOrder)for(l=12;l--;)f(l);else for(l=0;12>l;l++)f(l);F.style.width=e.offsetWidth+"px";e=n(F,"div","month-name-space");e.style.height=F.offsetHeight+"px";e.style.width=t+"px"}a.views.chart.keepScrollPositions&&(a.currentView.chartContents.scrollLeft= a.currentView.chartContentsScrollLeft)}}function hb(a,b,d,c,e,f,g){var l=new Date(e,c,d);a=n(a,"div","day-line");var t=M(b)[N(l)];t=Y(t,0);Ka(b,a,l,t);b.views.chart.showLineNumbers&&0=g&&(a.style.visibility="hidden");Q(b.onDayClick)?a.onclick=function(){z(b.onDayClick,l,t)}:x(a,"no-hover");f=za(b,f,t,l);w(f)&&qa(b,f.id)&&(v(f.chartCssClassName)?x(a,f.chartCssClassName):x(a,f.cssClassName))}function gb(a){for(var b= 0,d=M(a),c=0;12>c;c++)for(var e=ca(a.currentView.year,c),f=0;f=e&&(a.style.visibility="hidden");W(a,c,d.toString());Q(c.onWeekDayClick)?a.onclick=function(){z(c.onWeekDayClick,b,d)}:x(a,"no-hover");c.views.days.showDayNumbers&&0=a&&(b.style.visibility="hidden");W(b,c,d.toString());c.views.statistics.showRangeNumbers&&0ja.notFound}function R(a,b){return a.indexOf(b)>ja.notFound}function Ra(a){var b=[];if(a.showOnlyDataForYearsAvailable){a=M(a);for(var d in a)if(a.hasOwnProperty(d)){var c=parseInt(d.split(q.dash)[0]);b.indexOf(c)===ja.notFound&&b.push(c)}}return b= -b.sort(function(e,f){return e-f})}function X(a,b){return a.yearsToHide.indexOf(b)===ja.notFound&&(0===a.currentView.yearsAvailable.length||a.currentView.yearsAvailable.indexOf(b)>ja.notFound)}function Sa(a){a.currentView.isInFetchMode&&(w(a.currentView.isInFetchModeTimer)||Na(a),w(a.currentView.isInFetchModeTimer)||(a.currentView.isInFetchModeTimer=setInterval(function(){Na(a);A(a)},a.dataFetchDelay)))}function Na(a){var b=a.currentView.element.id,d=z(a.onDataFetch,b);if(I(d)){ya(b,a,!1);for(var c in d)d.hasOwnProperty(c)&& -(k[b].type[h.unknownTrendText].hasOwnProperty(c)||(k[b].type[h.unknownTrendText][c]=0),k[b].type[h.unknownTrendText][c]+=d[c])}}function qa(a,b){var d=!1;if("HOLIDAY"===b)d=!0;else for(var c=a.colorRanges.length,e=0;e=f.minimum)e=f;else break}return e}function Ia(a,b){for(var d=a.length,c=null,e=0;e');f.push("");for(e in g)g.hasOwnProperty(e)&&(f.push(""),f.push(""+e+""),f.push(""+g[e]+""),f.push(""));f.push("");d=f.join(q.newLine)}else if("txt"===b){g=ra(a);e=[];for(f in g)g.hasOwnProperty(f)&&e.push(f+q.colon+q.space+g[f].toString());d=e.join(q.newLine)}v(d)&&(g=n(K.body,"a"), -g.style.display="none",g.setAttribute("target","_blank"),g.setAttribute("href","data:"+c+";charset=utf-8,"+encodeURIComponent(d)),c=g.setAttribute,f=new Date,e=T(f.getDate())+q.dash+T(f.getMonth()+1)+q.dash+f.getFullYear(),f=T(f.getHours())+q.dash+T(f.getMinutes()),d=q.empty,a.currentView.type!==h.unknownTrendText&&(d=a.currentView.type.toLowerCase().replace(q.space,q.underscore)+q.underscore),e=d+e+q.underscore+f+"."+a.exportType.toLowerCase(),c.call(g,"download",e),g.click(),K.body.removeChild(g), -z(a.onExport,a.currentView.element))}function ra(a){var b={},d=M(a);if(a.exportOnlyYearBeingViewed)for(var c=0;12>c;c++)for(var e=ca(a.currentView.year,c),f=0;f -a.getDay()-1?6:a.getDay()-1}function w(a){return null!==a&&void 0!==a&&a!==q.empty}function I(a){return w(a)&&"object"===typeof a}function v(a){return w(a)&&"string"===typeof a}function Q(a){return w(a)&&"function"===typeof a}function va(a){return w(a)&&"number"===typeof a}function Z(a){return I(a)&&a instanceof Array}function wa(a){return I(a)&&a instanceof Date}function kb(a){a=a.toLowerCase();var b="text"===a;ea.hasOwnProperty(a)||(ea[a]=b?K.createTextNode(q.empty):K.createElement(a));return ea[a].cloneNode(!1)} -function n(a,b,d,c){b=b.toLowerCase();var e="text"===b;ea.hasOwnProperty(b)||(ea[b]=e?K.createTextNode(q.empty):K.createElement(b));b=ea[b].cloneNode(!1);w(d)&&(b.className=d);w(c)?a.insertBefore(b,c):a.appendChild(b);return b}function u(a,b,d,c,e){a=n(a,b,d,e);a.innerHTML=c;return a}function fa(a,b,d){var c=null;d=m(d,!1);C.getComputedStyle?c=K.defaultView.getComputedStyle(a,null).getPropertyValue(b):a.currentStyle&&(c=a.currentStyle[b]);d&&(c=parseFloat(c,10));return c}function x(a,b){a.className+= -q.space+b;a.className=a.className.trim()}function ha(a){a.preventDefault();a.cancelBubble=!0}function S(a){for(var b=a.children,d=b.length-1;d--;)a.appendChild(b[d])}function Aa(a,b,d,c){a=n(a,"div");a=n(a,"label","checkbox");var e=n(a,"input");e.type="checkbox";w(c)&&(e.onclick=c);w(d)&&(e.checked=d);n(a,"span","check-mark");u(a,"span","text",b);return{input:e,label:a}}function z(a){var b=null;Q(a)&&(b=a.apply(null,[].slice.call(arguments,1)));return b}function r(a,b){return v(a)?a:b}function m(a, -b){return w(a)&&"boolean"===typeof a?a:b}function D(a,b){return Q(a)?a:b}function Y(a,b){return va(a)?a:b}function xa(a){var b=!0,d=null;try{v(a)&&(d=ka.parse(a))}catch(c){try{d=eval("("+a+")"),Q(d)&&(d=d())}catch(e){h.safeMode||(console.error(h.objectErrorText.replace("{{error_1}}",c.message).replace("{{error_2}}",e.message)),b=!1),d=null}}return{parsed:b,result:d}}function aa(){for(var a=[],b=0;32>b;b++){8!==b&&12!==b&&16!==b&&20!==b||a.push(q.dash);var d=J.floor(16*J.random()).toString(16);a.push(d)}return a.join(q.empty)} -function T(a){a=a.toString();return 1===a.length?q.zero+a:a}function Ga(a,b){return a.substring(0,b.length).toLowerCase()===b.toLowerCase()}function N(a){return a.getFullYear()+q.dash+T(a.getMonth()+1)+q.dash+T(a.getDate())}function Ba(a,b){b=m(b,!0);var d=!0,c=a.currentView.year;for(c--;!X(a,c);){if(0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]){d=!1;break}c++}d&&(a.currentView.year=c,A(a),b&&z(a.onBackYear,a.currentView.year))}function Pa(a){a.currentView.element.innerHTML=q.empty;var b=a.currentView.element;b.className=b.className.replace("heat-js",q.empty);b.className=b.className.trim();Ha(a,!1);K.body.removeChild(a.currentView.tooltip);a.currentView.isInFetchMode&&w(a.currentView.isInFetchModeTimer)&&clearInterval(a.currentView.isInFetchModeTimer); -z(a.onDestroy,a.currentView.element)}function Qa(a){h=I(a)?a:{};h.safeMode=m(h.safeMode,!0);a=h;var b=h.domElementTypes,d=["*"];v(b)?(b=b.split(q.space),0===b.length&&(b=d)):b=Z(b)?b:d;a.domElementTypes=b;h.stText=r(h.stText,"st");h.ndText=r(h.ndText,"nd");h.rdText=r(h.rdText,"rd");h.thText=r(h.thText,"th");h.backButtonText=r(h.backButtonText,"Back");h.nextButtonText=r(h.nextButtonText,"Next");h.refreshButtonText=r(h.refreshButtonText,"Refresh");h.exportButtonText=r(h.exportButtonText,"Export");h.lessText= -r(h.lessText,"Less");h.moreText=r(h.moreText,"More");h.dateText=r(h.dateText,"Date");h.countText=r(h.countText,"Count");h.mapText=r(h.mapText,"Map");h.chartText=r(h.chartText,"Chart");h.noChartDataMessage=r(h.noChartDataMessage,"There is currently no data to view.");h.statisticsText=r(h.statisticsText,"Statistics");h.noStatisticsDataMessage=r(h.noStatisticsDataMessage,"There are currently no statistics to view.");h.unknownTrendText=r(h.unknownTrendText,"Unknown");h.importButtonText=r(h.importButtonText, -"Import");h.noMapDataMessage=r(h.noMapDataMessage,"There is currently no data to view.");h.objectErrorText=r(h.objectErrorText,"Errors in object: {{error_1}}, {{error_2}}");h.attributeNotValidErrorText=r(h.attributeNotValidErrorText,"The attribute '{{attribute_name}}' is not a valid object.");h.attributeNotSetErrorText=r(h.attributeNotSetErrorText,"The attribute '{{attribute_name}}' has not been set correctly.");h.closeToolTipText=r(h.closeToolTipText,"Close");h.configurationToolTipText=r(h.configurationToolTipText, -"Configuration");h.configurationTitleText=r(h.configurationTitleText,"Configuration");h.visibleMonthsText=r(h.visibleMonthsText,"Visible Months");h.visibleDaysText=r(h.visibleDaysText,"Visible Days");h.dataText=r(h.dataText,"Data");h.colorRangesText=r(h.colorRangesText,"Color Ranges");h.yearText=r(h.yearText,"Year");h.daysText=r(h.daysText,"Days");h.noDaysDataMessage=r(h.noDaysDataMessage,"There are currently no days to view.");P(h.monthNames,12)&&(h.monthNames="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ")); -P(h.dayNames,7)&&(h.dayNames="Mon Tue Wed Thu Fri Sat Sun".split(" "))}function P(a,b){b=va(b)?b:1;return!Z(a)||a.lengthd&&(a.currentView.year=d,X(a,a.currentView.year)?A(a):Ba(a,!1),z(a.onSetYear,a.currentView.year))}return p};p.moveToPreviousYear=function(a){v(a)&&k.hasOwnProperty(a)&&Ba(k[a].options);return p};p.moveToNextYear=function(a){v(a)&&k.hasOwnProperty(a)&& -ia(k[a].options);return p};p.moveToCurrentYear=function(a){v(a)&&k.hasOwnProperty(a)&&(a=k[a].options,a.currentView.year=(new Date).getFullYear(),X(a,a.currentView.year)?A(a):ia(a,!1),z(a.onSetYear,a.currentView.year));return p};p.getYear=function(a){var b=null;v(a)&&k.hasOwnProperty(a)&&(b=k[a].options.currentView.year);return b};p.render=function(a,b){I(a)&&I(b)&&Da(Ea(b,a));return p};p.renderAll=function(){Ca();return p};p.switchView=function(a,b){if(v(a)&&v(b)&&k.hasOwnProperty(a)){a=k[a].options; -var d=null;"map"===b.toLowerCase()?d=1:"chart"===b.toLowerCase()?d=2:"days"===b.toLowerCase()?d=3:"statistics"===b.toLowerCase()&&(d=4);va(d)&&(a.currentView.view=d,z(a.onViewSwitch,b),A(a,!1,!0))}return p};p.switchType=function(a,b){v(a)&&v(b)&&k.hasOwnProperty(a)&&k[a].type.hasOwnProperty(b)&&(a=k[a].options,a.currentView.type!==b&&(a.currentView.type=b,z(a.onTypeSwitch,b),A(a)));return p};p.updateOptions=function(a,b){if(v(a)&&I(b)&&k.hasOwnProperty(a)){a=k[a].options;b=Fa(b);var d=!1,c;for(c in b)b.hasOwnProperty(c)&& -a.hasOwnProperty(c)&&a[c]!==b[c]&&(a[c]=b[c],d=!0);d&&(A(a,!0),z(a.onRefresh,a.currentView.element),z(a.onOptionsUpdate,a.currentView.element,a))}return p};p.destroyAll=function(){for(var a in k)k.hasOwnProperty(a)&&Pa(k[a].options);k={};return p};p.destroy=function(a){v(a)&&k.hasOwnProperty(a)&&(Pa(k[a].options),delete k[a]);return p};p.setConfiguration=function(a,b){if(I(a)){var d=!1,c;for(c in a)a.hasOwnProperty(c)&&h.hasOwnProperty(c)&&h[c]!==a[c]&&(h[c]=a[c],d=!0);d&&(b=m(b,!0),Qa(h),b&&p.refreshAll())}return p}; -p.getIds=function(){var a=[],b;for(b in k)k.hasOwnProperty(b)&&a.push(b);return a};p.getVersion=function(){return"3.1.0"};(function(a,b,d,c){K=a;C=b;J=d;ka=c;Qa();K.addEventListener("DOMContentLoaded",function(){Ca()});C.addEventListener("pagehide",function(){for(var e in k)if(k.hasOwnProperty(e)){var f=k[e].options;w(f.currentView.isInFetchModeTimer)&&clearInterval(f.currentView.isInFetchModeTimer)}});w(C.$heat)||(C.$heat=p)})(document,window,Math,JSON)})(); \ No newline at end of file +d=n(b,"div","map-types"),c=0;for(e in k[a.currentView.element.id].type[h.unknownTrendText])if(k[a.currentView.element.id].type[h.unknownTrendText].hasOwnProperty(e)){c++;break}if(1ja.notFound}function R(a,b){return a.indexOf(b)>ja.notFound}function Ra(a){var b=[];if(a.showOnlyDataForYearsAvailable){a=M(a);for(var d in a)if(a.hasOwnProperty(d)){var c=parseInt(d.split(q.dash)[0]);b.indexOf(c)===ja.notFound&& +b.push(c)}}return b=b.sort(function(e,f){return e-f})}function X(a,b){return a.yearsToHide.indexOf(b)===ja.notFound&&(0===a.currentView.yearsAvailable.length||a.currentView.yearsAvailable.indexOf(b)>ja.notFound)}function Sa(a){a.currentView.isInFetchMode&&(w(a.currentView.isInFetchModeTimer)||Na(a),w(a.currentView.isInFetchModeTimer)||(a.currentView.isInFetchModeTimer=setInterval(function(){Na(a);A(a)},a.dataFetchDelay)))}function Na(a){var b=a.currentView.element.id,d=z(a.onDataFetch,b);if(G(d)){ya(b, +a,!1);for(var c in d)d.hasOwnProperty(c)&&(k[b].type[h.unknownTrendText].hasOwnProperty(c)||(k[b].type[h.unknownTrendText][c]=0),k[b].type[h.unknownTrendText][c]+=d[c])}}function qa(a,b){var d=!1;if("HOLIDAY"===b)d=!0;else for(var c=a.colorRanges.length,e=0;e=f.minimum)e=f;else break}return e}function Ia(a,b){for(var d=a.length,c=null,e=0;e');f.push("");for(e in g)g.hasOwnProperty(e)&&(f.push(""),f.push(""+e+""),f.push(""+g[e]+""),f.push(""));f.push("");d=f.join(q.newLine)}else if("txt"===b){g=ra(a);e=[];for(f in g)g.hasOwnProperty(f)&& +e.push(f+q.colon+q.space+g[f].toString());d=e.join(q.newLine)}v(d)&&(g=n(K.body,"a"),g.style.display="none",g.setAttribute("target","_blank"),g.setAttribute("href","data:"+c+";charset=utf-8,"+encodeURIComponent(d)),c=g.setAttribute,f=new Date,e=T(f.getDate())+q.dash+T(f.getMonth()+1)+q.dash+f.getFullYear(),f=T(f.getHours())+q.dash+T(f.getMinutes()),d=q.empty,a.currentView.type!==h.unknownTrendText&&(d=a.currentView.type.toLowerCase().replace(q.space,q.underscore)+q.underscore),e=d+e+q.underscore+ +f+"."+a.exportType.toLowerCase(),c.call(g,"download",e),g.click(),K.body.removeChild(g),z(a.onExport,a.currentView.element))}function ra(a){var b={},d=M(a);if(a.exportOnlyYearBeingViewed)for(var c=0;12>c;c++)for(var e=ca(a.currentView.year,c),f=0;fa.getDay()-1?6:a.getDay()-1}function w(a){return null!==a&&void 0!==a&&a!==q.empty}function G(a){return w(a)&&"object"===typeof a}function v(a){return w(a)&&"string"===typeof a}function Q(a){return w(a)&&"function"===typeof a}function va(a){return w(a)&&"number"===typeof a}function Z(a){return G(a)&&a instanceof Array}function wa(a){return G(a)&& +a instanceof Date}function kb(a){a=a.toLowerCase();var b="text"===a;ea.hasOwnProperty(a)||(ea[a]=b?K.createTextNode(q.empty):K.createElement(a));return ea[a].cloneNode(!1)}function n(a,b,d,c){b=b.toLowerCase();var e="text"===b;ea.hasOwnProperty(b)||(ea[b]=e?K.createTextNode(q.empty):K.createElement(b));b=ea[b].cloneNode(!1);w(d)&&(b.className=d);w(c)?a.insertBefore(b,c):a.appendChild(b);return b}function u(a,b,d,c,e){a=n(a,b,d,e);a.innerHTML=c;return a}function fa(a,b,d){var c=null;d=m(d,!1);C.getComputedStyle? +c=K.defaultView.getComputedStyle(a,null).getPropertyValue(b):a.currentStyle&&(c=a.currentStyle[b]);d&&(c=parseFloat(c,10));return c}function x(a,b){a.className+=q.space+b;a.className=a.className.trim()}function ha(a){a.preventDefault();a.cancelBubble=!0}function S(a){for(var b=a.children,d=b.length-1;d--;)a.appendChild(b[d])}function Aa(a,b,d,c){a=n(a,"div");a=n(a,"label","checkbox");var e=n(a,"input");e.type="checkbox";w(c)&&(e.onclick=c);w(d)&&(e.checked=d);n(a,"span","check-mark");u(a,"span","text", +b);return{input:e,label:a}}function z(a){var b=null;Q(a)&&(b=a.apply(null,[].slice.call(arguments,1)));return b}function r(a,b){return v(a)?a:b}function m(a,b){return w(a)&&"boolean"===typeof a?a:b}function D(a,b){return Q(a)?a:b}function Y(a,b){return va(a)?a:b}function xa(a){var b=!0,d=null;try{v(a)&&(d=ka.parse(a))}catch(c){try{d=eval("("+a+")"),Q(d)&&(d=d())}catch(e){h.safeMode||(console.error(h.objectErrorText.replace("{{error_1}}",c.message).replace("{{error_2}}",e.message)),b=!1),d=null}}return{parsed:b, +result:d}}function aa(){for(var a=[],b=0;32>b;b++){8!==b&&12!==b&&16!==b&&20!==b||a.push(q.dash);var d=J.floor(16*J.random()).toString(16);a.push(d)}return a.join(q.empty)}function T(a){a=a.toString();return 1===a.length?q.zero+a:a}function Ga(a,b){return a.substring(0,b.length).toLowerCase()===b.toLowerCase()}function N(a){return a.getFullYear()+q.dash+T(a.getMonth()+1)+q.dash+T(a.getDate())}function Ba(a,b){b=m(b,!0);var d=!0,c=a.currentView.year;for(c--;!X(a,c);){if(0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]){d=!1;break}c++}d&&(a.currentView.year=c,A(a),b&&z(a.onBackYear,a.currentView.year))}function Pa(a){a.currentView.element.innerHTML=q.empty;var b=a.currentView.element;b.className=b.className.replace("heat-js", +q.empty);b.className=b.className.trim();Ha(a,!1);K.body.removeChild(a.currentView.tooltip);a.currentView.isInFetchMode&&w(a.currentView.isInFetchModeTimer)&&clearInterval(a.currentView.isInFetchModeTimer);z(a.onDestroy,a.currentView.element)}function Qa(a){h=G(a)?a:{};h.safeMode=m(h.safeMode,!0);a=h;var b=h.domElementTypes,d=["*"];v(b)?(b=b.split(q.space),0===b.length&&(b=d)):b=Z(b)?b:d;a.domElementTypes=b;h.stText=r(h.stText,"st");h.ndText=r(h.ndText,"nd");h.rdText=r(h.rdText,"rd");h.thText=r(h.thText, +"th");h.backButtonText=r(h.backButtonText,"Back");h.nextButtonText=r(h.nextButtonText,"Next");h.refreshButtonText=r(h.refreshButtonText,"Refresh");h.exportButtonText=r(h.exportButtonText,"Export");h.lessText=r(h.lessText,"Less");h.moreText=r(h.moreText,"More");h.dateText=r(h.dateText,"Date");h.countText=r(h.countText,"Count");h.mapText=r(h.mapText,"Map");h.chartText=r(h.chartText,"Chart");h.noChartDataMessage=r(h.noChartDataMessage,"There is currently no data to view.");h.statisticsText=r(h.statisticsText, +"Statistics");h.noStatisticsDataMessage=r(h.noStatisticsDataMessage,"There are currently no statistics to view.");h.unknownTrendText=r(h.unknownTrendText,"Unknown");h.importButtonText=r(h.importButtonText,"Import");h.noMapDataMessage=r(h.noMapDataMessage,"There is currently no data to view.");h.objectErrorText=r(h.objectErrorText,"Errors in object: {{error_1}}, {{error_2}}");h.attributeNotValidErrorText=r(h.attributeNotValidErrorText,"The attribute '{{attribute_name}}' is not a valid object.");h.attributeNotSetErrorText= +r(h.attributeNotSetErrorText,"The attribute '{{attribute_name}}' has not been set correctly.");h.closeToolTipText=r(h.closeToolTipText,"Close");h.configurationToolTipText=r(h.configurationToolTipText,"Configuration");h.configurationTitleText=r(h.configurationTitleText,"Configuration");h.visibleMonthsText=r(h.visibleMonthsText,"Visible Months");h.visibleDaysText=r(h.visibleDaysText,"Visible Days");h.dataText=r(h.dataText,"Data");h.colorRangesText=r(h.colorRangesText,"Color Ranges");h.yearText=r(h.yearText, +"Year");h.daysText=r(h.daysText,"Days");h.noDaysDataMessage=r(h.noDaysDataMessage,"There are currently no days to view.");P(h.monthNames,12)&&(h.monthNames="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "));P(h.dayNames,7)&&(h.dayNames="Mon Tue Wed Thu Fri Sat Sun".split(" "))}function P(a,b){b=va(b)?b:1;return!Z(a)||a.lengthd&&(a.currentView.year= +d,X(a,a.currentView.year)?A(a):Ba(a,!1),z(a.onSetYear,a.currentView.year))}return p};p.moveToPreviousYear=function(a){v(a)&&k.hasOwnProperty(a)&&Ba(k[a].options);return p};p.moveToNextYear=function(a){v(a)&&k.hasOwnProperty(a)&&ia(k[a].options);return p};p.moveToCurrentYear=function(a){v(a)&&k.hasOwnProperty(a)&&(a=k[a].options,a.currentView.year=(new Date).getFullYear(),X(a,a.currentView.year)?A(a):ia(a,!1),z(a.onSetYear,a.currentView.year));return p};p.getYear=function(a){var b=null;v(a)&&k.hasOwnProperty(a)&& +(b=k[a].options.currentView.year);return b};p.render=function(a,b){G(a)&&G(b)&&Da(Ea(b,a));return p};p.renderAll=function(){Ca();return p};p.switchView=function(a,b){if(v(a)&&v(b)&&k.hasOwnProperty(a)){a=k[a].options;var d=null;"map"===b.toLowerCase()?d=1:"chart"===b.toLowerCase()?d=2:"days"===b.toLowerCase()?d=3:"statistics"===b.toLowerCase()&&(d=4);va(d)&&(a.currentView.view=d,z(a.onViewSwitch,b),A(a,!1,!0))}return p};p.switchType=function(a,b){v(a)&&v(b)&&k.hasOwnProperty(a)&&k[a].type.hasOwnProperty(b)&& +(a=k[a].options,a.currentView.type!==b&&(a.currentView.type=b,z(a.onTypeSwitch,b),A(a)));return p};p.updateOptions=function(a,b){if(v(a)&&G(b)&&k.hasOwnProperty(a)){a=k[a].options;b=Fa(b);var d=!1,c;for(c in b)b.hasOwnProperty(c)&&a.hasOwnProperty(c)&&a[c]!==b[c]&&(a[c]=b[c],d=!0);d&&(A(a,!0),z(a.onRefresh,a.currentView.element),z(a.onOptionsUpdate,a.currentView.element,a))}return p};p.destroyAll=function(){for(var a in k)k.hasOwnProperty(a)&&Pa(k[a].options);k={};return p};p.destroy=function(a){v(a)&& +k.hasOwnProperty(a)&&(Pa(k[a].options),delete k[a]);return p};p.setConfiguration=function(a,b){if(G(a)){var d=!1,c;for(c in a)a.hasOwnProperty(c)&&h.hasOwnProperty(c)&&h[c]!==a[c]&&(h[c]=a[c],d=!0);d&&(b=m(b,!0),Qa(h),b&&p.refreshAll())}return p};p.getIds=function(){var a=[],b;for(b in k)k.hasOwnProperty(b)&&a.push(b);return a};p.getVersion=function(){return"3.1.0"};(function(a,b,d,c){K=a;C=b;J=d;ka=c;Qa();K.addEventListener("DOMContentLoaded",function(){Ca()});C.addEventListener("pagehide",function(){for(var e in k)if(k.hasOwnProperty(e)){var f= +k[e].options;w(f.currentView.isInFetchModeTimer)&&clearInterval(f.currentView.isInFetchModeTimer)}});w(C.$heat)||(C.$heat=p)})(document,window,Math,JSON)})(); \ No newline at end of file diff --git a/src/heat.js b/src/heat.js index 3c1a017a..bf114cfe 100644 --- a/src/heat.js +++ b/src/heat.js @@ -1450,13 +1450,13 @@ renderDescription( bindingOptions, mapTypes ); } - if ( bindingOptions.showGuide ) { + if ( bindingOptions.guide.enabled ) { var mapToggles = createElement( guide, "div", "map-toggles" ); - if ( bindingOptions.showLessAndMoreLabels ) { + if ( bindingOptions.guide.showLessAndMoreLabels ) { var lessText = createElementWithHTML( mapToggles, "div", "less-text", _configuration.lessText ); - if ( bindingOptions.colorRangeTogglesEnabled ) { + if ( bindingOptions.guide.colorRangeTogglesEnabled ) { lessText.onclick = function() { updateColorRangeToggles( bindingOptions, false ); }; @@ -1474,10 +1474,10 @@ renderControlViewGuideDay( bindingOptions, days, colorRanges[ colorRangesIndex ] ); } - if ( bindingOptions.showLessAndMoreLabels ) { + if ( bindingOptions.guide.showLessAndMoreLabels ) { var moreText = createElementWithHTML( mapToggles, "div", "more-text", _configuration.moreText ); - if ( bindingOptions.colorRangeTogglesEnabled ) { + if ( bindingOptions.guide.colorRangeTogglesEnabled ) { moreText.onclick = function() { updateColorRangeToggles( bindingOptions, true ); }; @@ -1524,13 +1524,13 @@ } } - if ( bindingOptions.showNumbersInGuide ) { + if ( bindingOptions.guide.showNumbersInGuide ) { addClass( day, "day-number" ); day.innerHTML = colorRange.minimum + _string.plus; } - if ( bindingOptions.colorRangeTogglesEnabled ) { + if ( bindingOptions.guide.colorRangeTogglesEnabled ) { day.onclick = function() { toggleColorRangeVisibleState( bindingOptions, colorRange.id ); }; @@ -2241,8 +2241,6 @@ function buildAttributeOptions( newOptions ) { var options = !isDefinedObject( newOptions ) ? {} : newOptions; options.views = !isDefinedObject( options.views ) ? {} : options.views; - options.showGuide = getDefaultBoolean( options.showGuide, true ); - options.colorRangeTogglesEnabled = getDefaultBoolean( options.colorRangeTogglesEnabled, true ); options.exportOnlyYearBeingViewed = getDefaultBoolean( options.exportOnlyYearBeingViewed, true ); options.year = getDefaultNumber( options.year, new Date().getFullYear() ); options.view = getDefaultString( options.view, _elements_View_Name_Map ); @@ -2253,13 +2251,12 @@ options.useLocalStorageForData = getDefaultBoolean( options.useLocalStorageForData, false ); options.allowFileImports = getDefaultBoolean( options.allowFileImports, true ); options.yearsToHide = getDefaultArray( options.yearsToHide, [] ); - options.showLessAndMoreLabels = getDefaultBoolean( options.showLessAndMoreLabels, true ); - options.showNumbersInGuide = getDefaultBoolean( options.showNumbersInGuide, false ); options.dataFetchDelay = getDefaultNumber( options.dataFetchDelay, 60000 ); options.showOnlyDataForYearsAvailable = getDefaultBoolean( options.showOnlyDataForYearsAvailable, false ); options.showHolidaysInDayToolTips = getDefaultBoolean( options.showHolidaysInDayToolTips, false ); options = buildAttributeOptionTitle( options ); + options = buildAttributeOptionGuide( options ); options = buildAttributeOptionColorRanges( options ); options = buildAttributeOptionHolidays( options ); options = buildAttributeOptionMapView( options ); @@ -2286,6 +2283,16 @@ return options; } + function buildAttributeOptionGuide( options ) { + options.guide = !isDefinedObject( options.guide ) ? {} : options.guide; + options.guide.enabled = getDefaultBoolean( options.guide.enabled, true ); + options.guide.colorRangeTogglesEnabled = getDefaultBoolean( options.guide.colorRangeTogglesEnabled, true ); + options.guide.showLessAndMoreLabels = getDefaultBoolean( options.guide.showLessAndMoreLabels, true ); + options.guide.showNumbersInGuide = getDefaultBoolean( options.guide.showNumbersInGuide, false ); + + return options; + } + function buildAttributeOptionColorRanges( options ) { if ( isDefinedArray( options.colorRanges ) ) { var colorRangesLength = options.colorRanges.length; diff --git a/test/dist/heat.js.no-clicks.html b/test/dist/heat.js.no-clicks.html index 8ffff200..37955248 100644 --- a/test/dist/heat.js.no-clicks.html +++ b/test/dist/heat.js.no-clicks.html @@ -16,7 +16,7 @@

Heat.js - No Clicks

-
+
diff --git a/test/dist/heat.js.numbers.html b/test/dist/heat.js.numbers.html index f5120fa0..859e03f9 100644 --- a/test/dist/heat.js.numbers.html +++ b/test/dist/heat.js.numbers.html @@ -16,7 +16,7 @@

Heat.js - Numbers

-
+
diff --git a/test/src/heat.js.no-clicks.html b/test/src/heat.js.no-clicks.html index f8f07079..30fe7fb8 100644 --- a/test/src/heat.js.no-clicks.html +++ b/test/src/heat.js.no-clicks.html @@ -16,7 +16,7 @@

Heat.js - No Clicks

-
+
diff --git a/test/src/heat.js.numbers.html b/test/src/heat.js.numbers.html index b3366d1e..5b07106a 100644 --- a/test/src/heat.js.numbers.html +++ b/test/src/heat.js.numbers.html @@ -16,7 +16,7 @@

Heat.js - Numbers

-
+
From e5949eef88d76fa35b0f625d5f0fd14daf4ea71f Mon Sep 17 00:00:00 2001 From: William Troup Date: Sat, 30 Mar 2024 16:54:45 +0000 Subject: [PATCH 07/10] More minor internal refactoring. --- dist/heat.js | 23 ++++--- dist/heat.min.js | 168 +++++++++++++++++++++++------------------------ src/heat.js | 24 ++++--- 3 files changed, 111 insertions(+), 104 deletions(-) diff --git a/dist/heat.js b/dist/heat.js index e421f834..79ca48d1 100644 --- a/dist/heat.js +++ b/dist/heat.js @@ -1439,8 +1439,8 @@ return csvValues.join(","); } function buildAttributeOptions(newOptions) { - var options = !isDefinedObject(newOptions) ? {} : newOptions; - options.views = !isDefinedObject(options.views) ? {} : options.views; + var options = getDefaultObject(newOptions, {}); + options.views = getDefaultObject(options.views, {}); options.exportOnlyYearBeingViewed = getDefaultBoolean(options.exportOnlyYearBeingViewed, true); options.year = getDefaultNumber(options.year, (new Date()).getFullYear()); options.view = getDefaultString(options.view, _elements_View_Name_Map); @@ -1467,7 +1467,7 @@ return options; } function buildAttributeOptionTitle(options) { - options.title = !isDefinedObject(options.title) ? {} : options.title; + options.title = getDefaultObject(options.title, {}); options.title.showText = getDefaultBoolean(options.title.showText, true); options.title.showYearSelector = getDefaultBoolean(options.title.showYearSelector, true); options.title.showRefreshButton = getDefaultBoolean(options.title.showRefreshButton, false); @@ -1479,7 +1479,7 @@ return options; } function buildAttributeOptionGuide(options) { - options.guide = !isDefinedObject(options.guide) ? {} : options.guide; + options.guide = getDefaultObject(options.guide, {}); options.guide.enabled = getDefaultBoolean(options.guide.enabled, true); options.guide.colorRangeTogglesEnabled = getDefaultBoolean(options.guide.colorRangeTogglesEnabled, true); options.guide.showLessAndMoreLabels = getDefaultBoolean(options.guide.showLessAndMoreLabels, true); @@ -1521,7 +1521,7 @@ return options; } function buildAttributeOptionMapView(options) { - options.views.map = !isDefinedObject(options.views.map) ? {} : options.views.map; + options.views.map = getDefaultObject(options.views.map, {}); options.views.map.showMonthDayGaps = getDefaultBoolean(options.views.map.showMonthDayGaps, true); options.views.map.showDayNames = getDefaultBoolean(options.views.map.showDayNames, true); options.views.map.placeMonthNamesOnTheBottom = getDefaultBoolean(options.views.map.placeMonthNamesOnTheBottom, false); @@ -1541,7 +1541,7 @@ return options; } function buildAttributeOptionChartView(options) { - options.views.chart = !isDefinedObject(options.views.chart) ? {} : options.views.chart; + options.views.chart = getDefaultObject(options.views.chart, {}); options.views.chart.enabled = getDefaultBoolean(options.views.chart.enabled, true); options.views.chart.showChartYLabels = getDefaultBoolean(options.views.chart.showChartYLabels, true); options.views.chart.showMonthNames = getDefaultBoolean(options.views.chart.showMonthNames, true); @@ -1557,7 +1557,7 @@ return options; } function buildAttributeOptionDaysView(options) { - options.views.days = !isDefinedObject(options.views.days) ? {} : options.views.days; + options.views.days = getDefaultObject(options.views.days, {}); options.views.days.enabled = getDefaultBoolean(options.views.days.enabled, true); options.views.days.showChartYLabels = getDefaultBoolean(options.views.days.showChartYLabels, true); options.views.days.showDayNames = getDefaultBoolean(options.views.days.showDayNames, true); @@ -1573,7 +1573,7 @@ return options; } function buildAttributeOptionStatisticsView(options) { - options.views.statistics = !isDefinedObject(options.views.statistics) ? {} : options.views.statistics; + options.views.statistics = getDefaultObject(options.views.statistics, {}); options.views.statistics.enabled = getDefaultBoolean(options.views.statistics.enabled, true); options.views.statistics.showChartYLabels = getDefaultBoolean(options.views.statistics.showChartYLabels, true); options.views.statistics.showColorRangeLabels = getDefaultBoolean(options.views.statistics.showColorRangeLabels, true); @@ -1788,14 +1788,17 @@ function getDefaultBoolean(value, defaultValue) { return isDefinedBoolean(value) ? value : defaultValue; } + function getDefaultNumber(value, defaultValue) { + return isDefinedNumber(value) ? value : defaultValue; + } function getDefaultFunction(value, defaultValue) { return isDefinedFunction(value) ? value : defaultValue; } function getDefaultArray(value, defaultValue) { return isDefinedArray(value) ? value : defaultValue; } - function getDefaultNumber(value, defaultValue) { - return isDefinedNumber(value) ? value : defaultValue; + function getDefaultObject(value, defaultValue) { + return isDefinedObject(value) ? value : defaultValue; } function getDefaultStringOrArray(value, defaultValue) { if (isDefinedString(value)) { diff --git a/dist/heat.min.js b/dist/heat.min.js index 482ed18a..8701b8d9 100644 --- a/dist/heat.min.js +++ b/dist/heat.min.js @@ -1,91 +1,91 @@ /*! Heat.js v3.1.0 | (c) Bunoon 2024 | MIT License */ -(function(){function Ca(){for(var a=h.domElementTypes,b=a.length,d=0;dc;c++)R(a.views.map.daysToShow,c+1)&&u(f,"div","day-name",g&&0!==c%3?q.space:h.dayNames[c]);a.views.map.showDaysInReverseOrder&&S(f)}f=n(e,"div","months");e=ma(a);for(g=0;12>g;g++)if(U(a.views.map.monthsToShow,g)){c=n(f,"div","month");var t=n(c, -"div","day-columns");var y=ca(l,g),E=n(t,"div","day-column"),B=!1,F=na(new Date(l,g,1)),H=1;y+=F;for(var I=0;I=F?B=!0:R(a.views.map.daysToShow,H)&&n(E,"div","day-disabled");if(B){var L=null;R(a.views.map.daysToShow,H)&&(L=Wa(a,E,I-F,g,l,e));if(0===(I+1)%7&&(a.views.map.showDaysInReverseOrder&&S(E),E=n(t,"div","day-column"),H=0,!w(da)&&w(L))){var Xa=fa(L,"margin-left",!0),Ya=fa(L,"margin-right",!0);da=L.offsetWidth+Xa+Ya}}H++}a.views.map.showMonthNames&&(E=c.offsetWidth,y=a.views.map.placeMonthNamesOnTheBottom? -u(c,"div","month-name-bottom",h.monthNames[g]):u(c,"div","month-name",h.monthNames[g],t),w(y)&&(y.style.width=a.views.map.showMonthDayGaps?E+"px":E-da+"px"));b&&w(da)&&(0y;y++)for(E=ca(a.currentView.year,y),B=0;BF;F++)for(y=ca(a.currentView.year,F),E=0;Ec;c++)R(a.views.map.daysToShow,c+1)&&u(f,"div","day-name",g&&0!==c%3?q.space:h.dayNames[c]);a.views.map.showDaysInReverseOrder&&S(f)}f=n(e,"div","months");e=na(a);for(g=0;12>g;g++)if(V(a.views.map.monthsToShow,g)){c=n(f,"div","month");var t=n(c, +"div","day-columns");var y=da(l,g),E=n(t,"div","day-column"),B=!1,F=oa(new Date(l,g,1)),G=1;y+=F;for(var H=0;H=F?B=!0:R(a.views.map.daysToShow,G)&&n(E,"div","day-disabled");if(B){var K=null;R(a.views.map.daysToShow,G)&&(K=Xa(a,E,H-F,g,l,e));if(0===(H+1)%7&&(a.views.map.showDaysInReverseOrder&&S(E),E=n(t,"div","day-column"),G=0,!w(ea)&&w(K))){var Ya=ha(K,"margin-left",!0),Za=ha(K,"margin-right",!0);ea=K.offsetWidth+Ya+Za}}G++}a.views.map.showMonthNames&&(E=c.offsetWidth,y=a.views.map.placeMonthNamesOnTheBottom? +u(c,"div","month-name-bottom",h.monthNames[g]):u(c,"div","month-name",h.monthNames[g],t),w(y)&&(y.style.width=a.views.map.showMonthDayGaps?E+"px":E-ea+"px"));b&&w(ea)&&(0y;y++)for(E=da(a.currentView.year,y),B=0;BF;F++)for(y=da(a.currentView.year,F),E=0;Ey;y++)a.currentView.dayCheckBoxes[y].checked&&g.push(y+1);for(y=0;12>y;y++)a.currentView.monthCheckBoxes[y].checked&&l.push(y+1);1<=g.length&&(1===a.currentView.view? a.views.map.daysToShow=g:a.views.chart.enabled&&2===a.currentView.view?a.views.chart.daysToShow=g:a.views.days.enabled&&3===a.currentView.view?a.views.days.daysToShow=g:a.views.statistics.enabled&&4===a.currentView.view?a.views.statistics.daysToShow=g:a.views.map.daysToShow=g,t=!0);1<=l.length&&(1===a.currentView.view?a.views.map.monthsToShow=l:a.views.chart.enabled&&2===a.currentView.view?a.views.chart.monthsToShow=l:a.views.days.enabled&&3===a.currentView.view?a.views.days.monthsToShow=l:a.views.statistics.enabled&& -4===a.currentView.view?a.views.statistics.monthsToShow=l:a.views.map.monthsToShow=l,t=!0);t?(A(a),z(a.onOptionsUpdate,a.currentView.element,a)):ba(a)};for(var f=0;7>f;f++)a.currentView.dayCheckBoxes[f]=Aa(e,h.dayNames[f]).input;for(e=0;7>e;e++)a.currentView.monthCheckBoxes[e]=Aa(b,h.monthNames[e]).input;for(e=7;12>e;e++)a.currentView.monthCheckBoxes[e]=Aa(d,h.monthNames[e]).input;W(c,a,h.closeToolTipText)}function Ha(a,b){var d=(b=m(b,!0))?K.addEventListener:K.removeEventListener;(b?C.addEventListener: -C.removeEventListener)("mousemove",function(){ba(a)});d("scroll",function(){ba(a)})}function W(a,b,d){null!==a&&(a.onmousemove=function(c){bb(c,b,d)})}function bb(a,b,d){ha(a);ba(b);b.currentView.tooltipTimer=setTimeout(function(){b.currentView.tooltip.innerHTML=d;b.currentView.tooltip.style.display="block";var c=b.currentView.tooltip,e=a.pageX,f=a.pageY;var g=K.documentElement;var l=(C.pageXOffset||g.scrollLeft)-(g.clientLeft||0);g=(C.pageYOffset||g.scrollTop)-(g.clientTop||0);c.style.display="block"; -e+c.offsetWidth>C.innerWidth?e-=c.offsetWidth:e++;f+c.offsetHeight>C.innerHeight?f-=c.offsetHeight:f++;ef;f++)a.currentView.dayCheckBoxes[f]=Ba(e,h.dayNames[f]).input;for(e=0;7>e;e++)a.currentView.monthCheckBoxes[e]=Ba(b,h.monthNames[e]).input;for(e=7;12>e;e++)a.currentView.monthCheckBoxes[e]=Ba(d,h.monthNames[e]).input;X(c,a,h.closeToolTipText)}function Ia(a,b){var d=(b=m(b,!0))?J.addEventListener:J.removeEventListener;(b?C.addEventListener: +C.removeEventListener)("mousemove",function(){ca(a)});d("scroll",function(){ca(a)})}function X(a,b,d){null!==a&&(a.onmousemove=function(c){cb(c,b,d)})}function cb(a,b,d){ia(a);ca(b);b.currentView.tooltipTimer=setTimeout(function(){b.currentView.tooltip.innerHTML=d;b.currentView.tooltip.style.display="block";var c=b.currentView.tooltip,e=a.pageX,f=a.pageY;var g=J.documentElement;var l=(C.pageXOffset||g.scrollLeft)-(g.clientLeft||0);g=(C.pageYOffset||g.scrollTop)-(g.clientTop||0);c.style.display="block"; +e+c.offsetWidth>C.innerWidth?e-=c.offsetWidth:e++;f+c.offsetHeight>C.innerHeight?f-=c.offsetHeight:f++;ef;f++)a.currentView.dayCheckBoxes[f].checked=R(c,f+1);for(c=0;12>c;c++)a.currentView.monthCheckBoxes[c].checked= -U(e,c);ba(a)}),b=u(b,"button","next",h.nextButtonText),b.onclick=function(){ia(a)},0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]&&(b.disabled=!0))}}function cb(a,b){b=n(b,"div","titles-menu-container");b=n(b,"div","titles-menu");u(b,"div","title-menu-header",h.dataText+q.colon);var d=u(b,"div","title-menu-item",h.mapText);pa(a,d,1,"map");a.views.chart.enabled&&(d=u(b,"div","title-menu-item",h.chartText),pa(a,d,2,"chart")); -a.views.days.enabled&&(u(b,"div","title-menu-header",h.yearText+q.colon),d=u(b,"div","title-menu-item",h.daysText),pa(a,d,3,"days"));a.views.statistics.enabled&&(u(b,"div","title-menu-header",h.statisticsText+q.colon),b=u(b,"div","title-menu-item",h.colorRangesText),pa(a,b,4,"statistics"))}function pa(a,b,d,c){a.currentView.view===d?x(b,"title-menu-item-active"):b.onclick=function(){a.currentView.view=d;z(a.onViewSwitch,c);A(a,!1,!0)}}function eb(a){n(a.currentView.yearText,"div","down-arrow");var b= -n(a.currentView.yearText,"div","years-menu-container"),d=n(b,"div","years-menu"),c=(new Date).getFullYear(),e=null;b.style.display="block";b.style.visibility="hidden";for(var f=c-a.title.extraSelectionYears;fg;g++)if(U(a.views.chart.monthsToShow,g)){y=ca(l,g);var E=1;d++;for(var B=0;Bl;l++)f(l);F.style.width=e.offsetWidth+"px";e=n(F,"div","month-name-space");e.style.height=F.offsetHeight+"px";e.style.width=t+"px"}a.views.chart.keepScrollPositions&&(a.currentView.chartContents.scrollLeft= -a.currentView.chartContentsScrollLeft)}}function hb(a,b,d,c,e,f,g){var l=new Date(e,c,d);a=n(a,"div","day-line");var t=M(b)[N(l)];t=Y(t,0);Ka(b,a,l,t);b.views.chart.showLineNumbers&&0=g&&(a.style.visibility="hidden");Q(b.onDayClick)?a.onclick=function(){z(b.onDayClick,l,t)}:x(a,"no-hover");f=za(b,f,t,l);w(f)&&qa(b,f.id)&&(v(f.chartCssClassName)?x(a,f.chartCssClassName):x(a,f.cssClassName))}function gb(a){for(var b= -0,d=M(a),c=0;12>c;c++)for(var e=ca(a.currentView.year,c),f=0;f=e&&(a.style.visibility="hidden");W(a,c,d.toString());Q(c.onWeekDayClick)?a.onclick=function(){z(c.onWeekDayClick,b,d)}:x(a,"no-hover");c.views.days.showDayNumbers&&0=a&&(b.style.visibility="hidden");W(b,c,d.toString());c.views.statistics.showRangeNumbers&&0ja.notFound}function R(a,b){return a.indexOf(b)>ja.notFound}function Ra(a){var b=[];if(a.showOnlyDataForYearsAvailable){a=M(a);for(var d in a)if(a.hasOwnProperty(d)){var c=parseInt(d.split(q.dash)[0]);b.indexOf(c)===ja.notFound&& -b.push(c)}}return b=b.sort(function(e,f){return e-f})}function X(a,b){return a.yearsToHide.indexOf(b)===ja.notFound&&(0===a.currentView.yearsAvailable.length||a.currentView.yearsAvailable.indexOf(b)>ja.notFound)}function Sa(a){a.currentView.isInFetchMode&&(w(a.currentView.isInFetchModeTimer)||Na(a),w(a.currentView.isInFetchModeTimer)||(a.currentView.isInFetchModeTimer=setInterval(function(){Na(a);A(a)},a.dataFetchDelay)))}function Na(a){var b=a.currentView.element.id,d=z(a.onDataFetch,b);if(G(d)){ya(b, -a,!1);for(var c in d)d.hasOwnProperty(c)&&(k[b].type[h.unknownTrendText].hasOwnProperty(c)||(k[b].type[h.unknownTrendText][c]=0),k[b].type[h.unknownTrendText][c]+=d[c])}}function qa(a,b){var d=!1;if("HOLIDAY"===b)d=!0;else for(var c=a.colorRanges.length,e=0;e=f.minimum)e=f;else break}return e}function Ia(a,b){for(var d=a.length,c=null,e=0;e');f.push("");for(e in g)g.hasOwnProperty(e)&&(f.push(""),f.push(""+e+""),f.push(""+g[e]+""),f.push(""));f.push("");d=f.join(q.newLine)}else if("txt"===b){g=ra(a);e=[];for(f in g)g.hasOwnProperty(f)&& -e.push(f+q.colon+q.space+g[f].toString());d=e.join(q.newLine)}v(d)&&(g=n(K.body,"a"),g.style.display="none",g.setAttribute("target","_blank"),g.setAttribute("href","data:"+c+";charset=utf-8,"+encodeURIComponent(d)),c=g.setAttribute,f=new Date,e=T(f.getDate())+q.dash+T(f.getMonth()+1)+q.dash+f.getFullYear(),f=T(f.getHours())+q.dash+T(f.getMinutes()),d=q.empty,a.currentView.type!==h.unknownTrendText&&(d=a.currentView.type.toLowerCase().replace(q.space,q.underscore)+q.underscore),e=d+e+q.underscore+ -f+"."+a.exportType.toLowerCase(),c.call(g,"download",e),g.click(),K.body.removeChild(g),z(a.onExport,a.currentView.element))}function ra(a){var b={},d=M(a);if(a.exportOnlyYearBeingViewed)for(var c=0;12>c;c++)for(var e=ca(a.currentView.year,c),f=0;fa.getDay()-1?6:a.getDay()-1}function w(a){return null!==a&&void 0!==a&&a!==q.empty}function G(a){return w(a)&&"object"===typeof a}function v(a){return w(a)&&"string"===typeof a}function Q(a){return w(a)&&"function"===typeof a}function va(a){return w(a)&&"number"===typeof a}function Z(a){return G(a)&&a instanceof Array}function wa(a){return G(a)&& -a instanceof Date}function kb(a){a=a.toLowerCase();var b="text"===a;ea.hasOwnProperty(a)||(ea[a]=b?K.createTextNode(q.empty):K.createElement(a));return ea[a].cloneNode(!1)}function n(a,b,d,c){b=b.toLowerCase();var e="text"===b;ea.hasOwnProperty(b)||(ea[b]=e?K.createTextNode(q.empty):K.createElement(b));b=ea[b].cloneNode(!1);w(d)&&(b.className=d);w(c)?a.insertBefore(b,c):a.appendChild(b);return b}function u(a,b,d,c,e){a=n(a,b,d,e);a.innerHTML=c;return a}function fa(a,b,d){var c=null;d=m(d,!1);C.getComputedStyle? -c=K.defaultView.getComputedStyle(a,null).getPropertyValue(b):a.currentStyle&&(c=a.currentStyle[b]);d&&(c=parseFloat(c,10));return c}function x(a,b){a.className+=q.space+b;a.className=a.className.trim()}function ha(a){a.preventDefault();a.cancelBubble=!0}function S(a){for(var b=a.children,d=b.length-1;d--;)a.appendChild(b[d])}function Aa(a,b,d,c){a=n(a,"div");a=n(a,"label","checkbox");var e=n(a,"input");e.type="checkbox";w(c)&&(e.onclick=c);w(d)&&(e.checked=d);n(a,"span","check-mark");u(a,"span","text", -b);return{input:e,label:a}}function z(a){var b=null;Q(a)&&(b=a.apply(null,[].slice.call(arguments,1)));return b}function r(a,b){return v(a)?a:b}function m(a,b){return w(a)&&"boolean"===typeof a?a:b}function D(a,b){return Q(a)?a:b}function Y(a,b){return va(a)?a:b}function xa(a){var b=!0,d=null;try{v(a)&&(d=ka.parse(a))}catch(c){try{d=eval("("+a+")"),Q(d)&&(d=d())}catch(e){h.safeMode||(console.error(h.objectErrorText.replace("{{error_1}}",c.message).replace("{{error_2}}",e.message)),b=!1),d=null}}return{parsed:b, -result:d}}function aa(){for(var a=[],b=0;32>b;b++){8!==b&&12!==b&&16!==b&&20!==b||a.push(q.dash);var d=J.floor(16*J.random()).toString(16);a.push(d)}return a.join(q.empty)}function T(a){a=a.toString();return 1===a.length?q.zero+a:a}function Ga(a,b){return a.substring(0,b.length).toLowerCase()===b.toLowerCase()}function N(a){return a.getFullYear()+q.dash+T(a.getMonth()+1)+q.dash+T(a.getDate())}function Ba(a,b){b=m(b,!0);var d=!0,c=a.currentView.year;for(c--;!X(a,c);){if(0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]){d=!1;break}c++}d&&(a.currentView.year=c,A(a),b&&z(a.onBackYear,a.currentView.year))}function Pa(a){a.currentView.element.innerHTML=q.empty;var b=a.currentView.element;b.className=b.className.replace("heat-js", -q.empty);b.className=b.className.trim();Ha(a,!1);K.body.removeChild(a.currentView.tooltip);a.currentView.isInFetchMode&&w(a.currentView.isInFetchModeTimer)&&clearInterval(a.currentView.isInFetchModeTimer);z(a.onDestroy,a.currentView.element)}function Qa(a){h=G(a)?a:{};h.safeMode=m(h.safeMode,!0);a=h;var b=h.domElementTypes,d=["*"];v(b)?(b=b.split(q.space),0===b.length&&(b=d)):b=Z(b)?b:d;a.domElementTypes=b;h.stText=r(h.stText,"st");h.ndText=r(h.ndText,"nd");h.rdText=r(h.rdText,"rd");h.thText=r(h.thText, -"th");h.backButtonText=r(h.backButtonText,"Back");h.nextButtonText=r(h.nextButtonText,"Next");h.refreshButtonText=r(h.refreshButtonText,"Refresh");h.exportButtonText=r(h.exportButtonText,"Export");h.lessText=r(h.lessText,"Less");h.moreText=r(h.moreText,"More");h.dateText=r(h.dateText,"Date");h.countText=r(h.countText,"Count");h.mapText=r(h.mapText,"Map");h.chartText=r(h.chartText,"Chart");h.noChartDataMessage=r(h.noChartDataMessage,"There is currently no data to view.");h.statisticsText=r(h.statisticsText, -"Statistics");h.noStatisticsDataMessage=r(h.noStatisticsDataMessage,"There are currently no statistics to view.");h.unknownTrendText=r(h.unknownTrendText,"Unknown");h.importButtonText=r(h.importButtonText,"Import");h.noMapDataMessage=r(h.noMapDataMessage,"There is currently no data to view.");h.objectErrorText=r(h.objectErrorText,"Errors in object: {{error_1}}, {{error_2}}");h.attributeNotValidErrorText=r(h.attributeNotValidErrorText,"The attribute '{{attribute_name}}' is not a valid object.");h.attributeNotSetErrorText= +V(e,c);ca(a)}),b=u(b,"button","next",h.nextButtonText),b.onclick=function(){ja(a)},0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]&&(b.disabled=!0))}}function db(a,b){b=n(b,"div","titles-menu-container");b=n(b,"div","titles-menu");u(b,"div","title-menu-header",h.dataText+q.colon);var d=u(b,"div","title-menu-item",h.mapText);qa(a,d,1,"map");a.views.chart.enabled&&(d=u(b,"div","title-menu-item",h.chartText),qa(a,d,2,"chart")); +a.views.days.enabled&&(u(b,"div","title-menu-header",h.yearText+q.colon),d=u(b,"div","title-menu-item",h.daysText),qa(a,d,3,"days"));a.views.statistics.enabled&&(u(b,"div","title-menu-header",h.statisticsText+q.colon),b=u(b,"div","title-menu-item",h.colorRangesText),qa(a,b,4,"statistics"))}function qa(a,b,d,c){a.currentView.view===d?x(b,"title-menu-item-active"):b.onclick=function(){a.currentView.view=d;z(a.onViewSwitch,c);A(a,!1,!0)}}function fb(a){n(a.currentView.yearText,"div","down-arrow");var b= +n(a.currentView.yearText,"div","years-menu-container"),d=n(b,"div","years-menu"),c=(new Date).getFullYear(),e=null;b.style.display="block";b.style.visibility="hidden";for(var f=c-a.title.extraSelectionYears;fg;g++)if(V(a.views.chart.monthsToShow,g)){y=da(l,g);var E=1;d++;for(var B=0;Bl;l++)f(l);F.style.width=e.offsetWidth+"px";e=n(F,"div","month-name-space");e.style.height=F.offsetHeight+"px";e.style.width=t+"px"}a.views.chart.keepScrollPositions&&(a.currentView.chartContents.scrollLeft= +a.currentView.chartContentsScrollLeft)}}function ib(a,b,d,c,e,f,g){var l=new Date(e,c,d);a=n(a,"div","day-line");var t=M(b)[N(l)];t=Z(t,0);La(b,a,l,t);b.views.chart.showLineNumbers&&0=g&&(a.style.visibility="hidden");Q(b.onDayClick)?a.onclick=function(){z(b.onDayClick,l,t)}:x(a,"no-hover");f=Aa(b,f,t,l);w(f)&&ra(b,f.id)&&(v(f.chartCssClassName)?x(a,f.chartCssClassName):x(a,f.cssClassName))}function hb(a){for(var b= +0,d=M(a),c=0;12>c;c++)for(var e=da(a.currentView.year,c),f=0;f=e&&(a.style.visibility="hidden");X(a,c,d.toString());Q(c.onWeekDayClick)?a.onclick=function(){z(c.onWeekDayClick,b,d)}:x(a,"no-hover");c.views.days.showDayNumbers&&0=a&&(b.style.visibility="hidden");X(b,c,d.toString());c.views.statistics.showRangeNumbers&&0ka.notFound}function R(a,b){return a.indexOf(b)>ka.notFound}function Sa(a){var b=[];if(a.showOnlyDataForYearsAvailable){a=M(a);for(var d in a)if(a.hasOwnProperty(d)){var c=parseInt(d.split(q.dash)[0]);b.indexOf(c)===ka.notFound&& +b.push(c)}}return b=b.sort(function(e,f){return e-f})}function Y(a,b){return a.yearsToHide.indexOf(b)===ka.notFound&&(0===a.currentView.yearsAvailable.length||a.currentView.yearsAvailable.indexOf(b)>ka.notFound)}function Ta(a){a.currentView.isInFetchMode&&(w(a.currentView.isInFetchModeTimer)||Oa(a),w(a.currentView.isInFetchModeTimer)||(a.currentView.isInFetchModeTimer=setInterval(function(){Oa(a);A(a)},a.dataFetchDelay)))}function Oa(a){var b=a.currentView.element.id,d=z(a.onDataFetch,b);if(L(d)){za(b, +a,!1);for(var c in d)d.hasOwnProperty(c)&&(k[b].type[h.unknownTrendText].hasOwnProperty(c)||(k[b].type[h.unknownTrendText][c]=0),k[b].type[h.unknownTrendText][c]+=d[c])}}function ra(a,b){var d=!1;if("HOLIDAY"===b)d=!0;else for(var c=a.colorRanges.length,e=0;e=f.minimum)e=f;else break}return e}function Ja(a,b){for(var d=a.length,c=null,e=0;e');f.push("");for(e in g)g.hasOwnProperty(e)&&(f.push(""),f.push(""+e+""),f.push(""+g[e]+""),f.push(""));f.push("");d=f.join(q.newLine)}else if("txt"===b){g=sa(a);e=[];for(f in g)g.hasOwnProperty(f)&& +e.push(f+q.colon+q.space+g[f].toString());d=e.join(q.newLine)}v(d)&&(g=n(J.body,"a"),g.style.display="none",g.setAttribute("target","_blank"),g.setAttribute("href","data:"+c+";charset=utf-8,"+encodeURIComponent(d)),c=g.setAttribute,f=new Date,e=T(f.getDate())+q.dash+T(f.getMonth()+1)+q.dash+f.getFullYear(),f=T(f.getHours())+q.dash+T(f.getMinutes()),d=q.empty,a.currentView.type!==h.unknownTrendText&&(d=a.currentView.type.toLowerCase().replace(q.space,q.underscore)+q.underscore),e=d+e+q.underscore+ +f+"."+a.exportType.toLowerCase(),c.call(g,"download",e),g.click(),J.body.removeChild(g),z(a.onExport,a.currentView.element))}function sa(a){var b={},d=M(a);if(a.exportOnlyYearBeingViewed)for(var c=0;12>c;c++)for(var e=da(a.currentView.year,c),f=0;fa.getDay()-1?6:a.getDay()-1}function w(a){return null!==a&&void 0!==a&&a!==q.empty}function L(a){return w(a)&&"object"===typeof a}function v(a){return w(a)&&"string"===typeof a}function Q(a){return w(a)&&"function"===typeof a}function wa(a){return w(a)&&"number"===typeof a}function aa(a){return L(a)&&a instanceof Array}function xa(a){return L(a)&&a instanceof Date}function lb(a){a=a.toLowerCase();var b="text"=== +a;fa.hasOwnProperty(a)||(fa[a]=b?J.createTextNode(q.empty):J.createElement(a));return fa[a].cloneNode(!1)}function n(a,b,d,c){b=b.toLowerCase();var e="text"===b;fa.hasOwnProperty(b)||(fa[b]=e?J.createTextNode(q.empty):J.createElement(b));b=fa[b].cloneNode(!1);w(d)&&(b.className=d);w(c)?a.insertBefore(b,c):a.appendChild(b);return b}function u(a,b,d,c,e){a=n(a,b,d,e);a.innerHTML=c;return a}function ha(a,b,d){var c=null;d=m(d,!1);C.getComputedStyle?c=J.defaultView.getComputedStyle(a,null).getPropertyValue(b): +a.currentStyle&&(c=a.currentStyle[b]);d&&(c=parseFloat(c,10));return c}function x(a,b){a.className+=q.space+b;a.className=a.className.trim()}function ia(a){a.preventDefault();a.cancelBubble=!0}function S(a){for(var b=a.children,d=b.length-1;d--;)a.appendChild(b[d])}function Ba(a,b,d,c){a=n(a,"div");a=n(a,"label","checkbox");var e=n(a,"input");e.type="checkbox";w(c)&&(e.onclick=c);w(d)&&(e.checked=d);n(a,"span","check-mark");u(a,"span","text",b);return{input:e,label:a}}function z(a){var b=null;Q(a)&& +(b=a.apply(null,[].slice.call(arguments,1)));return b}function r(a,b){return v(a)?a:b}function m(a,b){return w(a)&&"boolean"===typeof a?a:b}function Z(a,b){return wa(a)?a:b}function D(a,b){return Q(a)?a:b}function U(a,b){return L(a)?a:b}function ya(a){var b=!0,d=null;try{v(a)&&(d=la.parse(a))}catch(c){try{d=eval("("+a+")"),Q(d)&&(d=d())}catch(e){h.safeMode||(console.error(h.objectErrorText.replace("{{error_1}}",c.message).replace("{{error_2}}",e.message)),b=!1),d=null}}return{parsed:b,result:d}}function ba(){for(var a= +[],b=0;32>b;b++){8!==b&&12!==b&&16!==b&&20!==b||a.push(q.dash);var d=I.floor(16*I.random()).toString(16);a.push(d)}return a.join(q.empty)}function T(a){a=a.toString();return 1===a.length?q.zero+a:a}function Ha(a,b){return a.substring(0,b.length).toLowerCase()===b.toLowerCase()}function N(a){return a.getFullYear()+q.dash+T(a.getMonth()+1)+q.dash+T(a.getDate())}function Ca(a,b){b=m(b,!0);var d=!0,c=a.currentView.year;for(c--;!Y(a,c);){if(0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]){d=!1;break}c++}d&&(a.currentView.year=c,A(a),b&&z(a.onBackYear,a.currentView.year))}function Qa(a){a.currentView.element.innerHTML=q.empty;var b=a.currentView.element;b.className=b.className.replace("heat-js",q.empty);b.className= +b.className.trim();Ia(a,!1);J.body.removeChild(a.currentView.tooltip);a.currentView.isInFetchMode&&w(a.currentView.isInFetchModeTimer)&&clearInterval(a.currentView.isInFetchModeTimer);z(a.onDestroy,a.currentView.element)}function Ra(a){h=L(a)?a:{};h.safeMode=m(h.safeMode,!0);a=h;var b=h.domElementTypes,d=["*"];v(b)?(b=b.split(q.space),0===b.length&&(b=d)):b=aa(b)?b:d;a.domElementTypes=b;h.stText=r(h.stText,"st");h.ndText=r(h.ndText,"nd");h.rdText=r(h.rdText,"rd");h.thText=r(h.thText,"th");h.backButtonText= +r(h.backButtonText,"Back");h.nextButtonText=r(h.nextButtonText,"Next");h.refreshButtonText=r(h.refreshButtonText,"Refresh");h.exportButtonText=r(h.exportButtonText,"Export");h.lessText=r(h.lessText,"Less");h.moreText=r(h.moreText,"More");h.dateText=r(h.dateText,"Date");h.countText=r(h.countText,"Count");h.mapText=r(h.mapText,"Map");h.chartText=r(h.chartText,"Chart");h.noChartDataMessage=r(h.noChartDataMessage,"There is currently no data to view.");h.statisticsText=r(h.statisticsText,"Statistics"); +h.noStatisticsDataMessage=r(h.noStatisticsDataMessage,"There are currently no statistics to view.");h.unknownTrendText=r(h.unknownTrendText,"Unknown");h.importButtonText=r(h.importButtonText,"Import");h.noMapDataMessage=r(h.noMapDataMessage,"There is currently no data to view.");h.objectErrorText=r(h.objectErrorText,"Errors in object: {{error_1}}, {{error_2}}");h.attributeNotValidErrorText=r(h.attributeNotValidErrorText,"The attribute '{{attribute_name}}' is not a valid object.");h.attributeNotSetErrorText= r(h.attributeNotSetErrorText,"The attribute '{{attribute_name}}' has not been set correctly.");h.closeToolTipText=r(h.closeToolTipText,"Close");h.configurationToolTipText=r(h.configurationToolTipText,"Configuration");h.configurationTitleText=r(h.configurationTitleText,"Configuration");h.visibleMonthsText=r(h.visibleMonthsText,"Visible Months");h.visibleDaysText=r(h.visibleDaysText,"Visible Days");h.dataText=r(h.dataText,"Data");h.colorRangesText=r(h.colorRangesText,"Color Ranges");h.yearText=r(h.yearText, -"Year");h.daysText=r(h.daysText,"Days");h.noDaysDataMessage=r(h.noDaysDataMessage,"There are currently no days to view.");P(h.monthNames,12)&&(h.monthNames="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "));P(h.dayNames,7)&&(h.dayNames="Mon Tue Wed Thu Fri Sat Sun".split(" "))}function P(a,b){b=va(b)?b:1;return!Z(a)||a.lengthd&&(a.currentView.year= -d,X(a,a.currentView.year)?A(a):Ba(a,!1),z(a.onSetYear,a.currentView.year))}return p};p.moveToPreviousYear=function(a){v(a)&&k.hasOwnProperty(a)&&Ba(k[a].options);return p};p.moveToNextYear=function(a){v(a)&&k.hasOwnProperty(a)&&ia(k[a].options);return p};p.moveToCurrentYear=function(a){v(a)&&k.hasOwnProperty(a)&&(a=k[a].options,a.currentView.year=(new Date).getFullYear(),X(a,a.currentView.year)?A(a):ia(a,!1),z(a.onSetYear,a.currentView.year));return p};p.getYear=function(a){var b=null;v(a)&&k.hasOwnProperty(a)&& -(b=k[a].options.currentView.year);return b};p.render=function(a,b){G(a)&&G(b)&&Da(Ea(b,a));return p};p.renderAll=function(){Ca();return p};p.switchView=function(a,b){if(v(a)&&v(b)&&k.hasOwnProperty(a)){a=k[a].options;var d=null;"map"===b.toLowerCase()?d=1:"chart"===b.toLowerCase()?d=2:"days"===b.toLowerCase()?d=3:"statistics"===b.toLowerCase()&&(d=4);va(d)&&(a.currentView.view=d,z(a.onViewSwitch,b),A(a,!1,!0))}return p};p.switchType=function(a,b){v(a)&&v(b)&&k.hasOwnProperty(a)&&k[a].type.hasOwnProperty(b)&& -(a=k[a].options,a.currentView.type!==b&&(a.currentView.type=b,z(a.onTypeSwitch,b),A(a)));return p};p.updateOptions=function(a,b){if(v(a)&&G(b)&&k.hasOwnProperty(a)){a=k[a].options;b=Fa(b);var d=!1,c;for(c in b)b.hasOwnProperty(c)&&a.hasOwnProperty(c)&&a[c]!==b[c]&&(a[c]=b[c],d=!0);d&&(A(a,!0),z(a.onRefresh,a.currentView.element),z(a.onOptionsUpdate,a.currentView.element,a))}return p};p.destroyAll=function(){for(var a in k)k.hasOwnProperty(a)&&Pa(k[a].options);k={};return p};p.destroy=function(a){v(a)&& -k.hasOwnProperty(a)&&(Pa(k[a].options),delete k[a]);return p};p.setConfiguration=function(a,b){if(G(a)){var d=!1,c;for(c in a)a.hasOwnProperty(c)&&h.hasOwnProperty(c)&&h[c]!==a[c]&&(h[c]=a[c],d=!0);d&&(b=m(b,!0),Qa(h),b&&p.refreshAll())}return p};p.getIds=function(){var a=[],b;for(b in k)k.hasOwnProperty(b)&&a.push(b);return a};p.getVersion=function(){return"3.1.0"};(function(a,b,d,c){K=a;C=b;J=d;ka=c;Qa();K.addEventListener("DOMContentLoaded",function(){Ca()});C.addEventListener("pagehide",function(){for(var e in k)if(k.hasOwnProperty(e)){var f= +"Year");h.daysText=r(h.daysText,"Days");h.noDaysDataMessage=r(h.noDaysDataMessage,"There are currently no days to view.");P(h.monthNames,12)&&(h.monthNames="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "));P(h.dayNames,7)&&(h.dayNames="Mon Tue Wed Thu Fri Sat Sun".split(" "))}function P(a,b){b=wa(b)?b:1;return!aa(a)||a.lengthd&&(a.currentView.year= +d,Y(a,a.currentView.year)?A(a):Ca(a,!1),z(a.onSetYear,a.currentView.year))}return p};p.moveToPreviousYear=function(a){v(a)&&k.hasOwnProperty(a)&&Ca(k[a].options);return p};p.moveToNextYear=function(a){v(a)&&k.hasOwnProperty(a)&&ja(k[a].options);return p};p.moveToCurrentYear=function(a){v(a)&&k.hasOwnProperty(a)&&(a=k[a].options,a.currentView.year=(new Date).getFullYear(),Y(a,a.currentView.year)?A(a):ja(a,!1),z(a.onSetYear,a.currentView.year));return p};p.getYear=function(a){var b=null;v(a)&&k.hasOwnProperty(a)&& +(b=k[a].options.currentView.year);return b};p.render=function(a,b){L(a)&&L(b)&&Ea(Fa(b,a));return p};p.renderAll=function(){Da();return p};p.switchView=function(a,b){if(v(a)&&v(b)&&k.hasOwnProperty(a)){a=k[a].options;var d=null;"map"===b.toLowerCase()?d=1:"chart"===b.toLowerCase()?d=2:"days"===b.toLowerCase()?d=3:"statistics"===b.toLowerCase()&&(d=4);wa(d)&&(a.currentView.view=d,z(a.onViewSwitch,b),A(a,!1,!0))}return p};p.switchType=function(a,b){v(a)&&v(b)&&k.hasOwnProperty(a)&&k[a].type.hasOwnProperty(b)&& +(a=k[a].options,a.currentView.type!==b&&(a.currentView.type=b,z(a.onTypeSwitch,b),A(a)));return p};p.updateOptions=function(a,b){if(v(a)&&L(b)&&k.hasOwnProperty(a)){a=k[a].options;b=Ga(b);var d=!1,c;for(c in b)b.hasOwnProperty(c)&&a.hasOwnProperty(c)&&a[c]!==b[c]&&(a[c]=b[c],d=!0);d&&(A(a,!0),z(a.onRefresh,a.currentView.element),z(a.onOptionsUpdate,a.currentView.element,a))}return p};p.destroyAll=function(){for(var a in k)k.hasOwnProperty(a)&&Qa(k[a].options);k={};return p};p.destroy=function(a){v(a)&& +k.hasOwnProperty(a)&&(Qa(k[a].options),delete k[a]);return p};p.setConfiguration=function(a,b){if(L(a)){var d=!1,c;for(c in a)a.hasOwnProperty(c)&&h.hasOwnProperty(c)&&h[c]!==a[c]&&(h[c]=a[c],d=!0);d&&(b=m(b,!0),Ra(h),b&&p.refreshAll())}return p};p.getIds=function(){var a=[],b;for(b in k)k.hasOwnProperty(b)&&a.push(b);return a};p.getVersion=function(){return"3.1.0"};(function(a,b,d,c){J=a;C=b;I=d;la=c;Ra();J.addEventListener("DOMContentLoaded",function(){Da()});C.addEventListener("pagehide",function(){for(var e in k)if(k.hasOwnProperty(e)){var f= k[e].options;w(f.currentView.isInFetchModeTimer)&&clearInterval(f.currentView.isInFetchModeTimer)}});w(C.$heat)||(C.$heat=p)})(document,window,Math,JSON)})(); \ No newline at end of file diff --git a/src/heat.js b/src/heat.js index bf114cfe..a564b7bd 100644 --- a/src/heat.js +++ b/src/heat.js @@ -2239,8 +2239,8 @@ */ function buildAttributeOptions( newOptions ) { - var options = !isDefinedObject( newOptions ) ? {} : newOptions; - options.views = !isDefinedObject( options.views ) ? {} : options.views; + var options = getDefaultObject( newOptions, {} ); + options.views = getDefaultObject( options.views, {} ); options.exportOnlyYearBeingViewed = getDefaultBoolean( options.exportOnlyYearBeingViewed, true ); options.year = getDefaultNumber( options.year, new Date().getFullYear() ); options.view = getDefaultString( options.view, _elements_View_Name_Map ); @@ -2270,7 +2270,7 @@ } function buildAttributeOptionTitle( options ) { - options.title = !isDefinedObject( options.title ) ? {} : options.title; + options.title = getDefaultObject( options.title, {} ); options.title.showText = getDefaultBoolean( options.title.showText, true ); options.title.showYearSelector = getDefaultBoolean( options.title.showYearSelector, true ); options.title.showRefreshButton = getDefaultBoolean( options.title.showRefreshButton, false ); @@ -2284,7 +2284,7 @@ } function buildAttributeOptionGuide( options ) { - options.guide = !isDefinedObject( options.guide ) ? {} : options.guide; + options.guide = getDefaultObject( options.guide, {} ); options.guide.enabled = getDefaultBoolean( options.guide.enabled, true ); options.guide.colorRangeTogglesEnabled = getDefaultBoolean( options.guide.colorRangeTogglesEnabled, true ); options.guide.showLessAndMoreLabels = getDefaultBoolean( options.guide.showLessAndMoreLabels, true ); @@ -2371,7 +2371,7 @@ } function buildAttributeOptionMapView( options ) { - options.views.map = !isDefinedObject( options.views.map ) ? {} : options.views.map; + options.views.map = getDefaultObject( options.views.map, {} ); options.views.map.showMonthDayGaps = getDefaultBoolean( options.views.map.showMonthDayGaps, true ); options.views.map.showDayNames = getDefaultBoolean( options.views.map.showDayNames, true ); options.views.map.placeMonthNamesOnTheBottom = getDefaultBoolean( options.views.map.placeMonthNamesOnTheBottom, false ); @@ -2395,7 +2395,7 @@ } function buildAttributeOptionChartView( options ) { - options.views.chart = !isDefinedObject( options.views.chart ) ? {} : options.views.chart; + options.views.chart = getDefaultObject( options.views.chart, {} ); options.views.chart.enabled = getDefaultBoolean( options.views.chart.enabled, true ); options.views.chart.showChartYLabels = getDefaultBoolean( options.views.chart.showChartYLabels, true ); options.views.chart.showMonthNames = getDefaultBoolean( options.views.chart.showMonthNames, true ); @@ -2415,7 +2415,7 @@ } function buildAttributeOptionDaysView( options ) { - options.views.days = !isDefinedObject( options.views.days ) ? {} : options.views.days; + options.views.days = getDefaultObject( options.views.days, {} ); options.views.days.enabled = getDefaultBoolean( options.views.days.enabled, true ); options.views.days.showChartYLabels = getDefaultBoolean( options.views.days.showChartYLabels, true ); options.views.days.showDayNames = getDefaultBoolean( options.views.days.showDayNames, true ); @@ -2435,7 +2435,7 @@ } function buildAttributeOptionStatisticsView( options ) { - options.views.statistics = !isDefinedObject( options.views.statistics ) ? {} : options.views.statistics; + options.views.statistics = getDefaultObject( options.views.statistics, {} ); options.views.statistics.enabled = getDefaultBoolean( options.views.statistics.enabled, true ); options.views.statistics.showChartYLabels = getDefaultBoolean( options.views.statistics.showChartYLabels, true ); options.views.statistics.showColorRangeLabels = getDefaultBoolean( options.views.statistics.showColorRangeLabels, true ); @@ -2773,6 +2773,10 @@ return isDefinedBoolean( value ) ? value : defaultValue; } + function getDefaultNumber( value, defaultValue ) { + return isDefinedNumber( value ) ? value : defaultValue; + } + function getDefaultFunction( value, defaultValue ) { return isDefinedFunction( value ) ? value : defaultValue; } @@ -2781,8 +2785,8 @@ return isDefinedArray( value ) ? value : defaultValue; } - function getDefaultNumber( value, defaultValue ) { - return isDefinedNumber( value ) ? value : defaultValue; + function getDefaultObject( value, defaultValue ) { + return isDefinedObject( value ) ? value : defaultValue; } function getDefaultStringOrArray( value, defaultValue ) { From 1497aa840bea9b8b5fd3dbb05e7a9c3ddbb923f7 Mon Sep 17 00:00:00 2001 From: William Troup Date: Sat, 30 Mar 2024 17:08:38 +0000 Subject: [PATCH 08/10] BREAKING: All binding option events are now available under a new area called "events". --- dist/heat.js | 185 +++++++++++++------------- dist/heat.min.js | 125 +++++++++--------- src/heat.js | 197 ++++++++++++++-------------- test/dist/heat.js.basic.html | 2 +- test/dist/heat.js.bootstrap.html | 6 +- test/dist/heat.js.data-pull.html | 2 +- test/dist/heat.js.map-only.html | 2 +- test/dist/heat.js.min.html | 2 +- test/dist/heat.js.numbers.html | 2 +- test/dist/heat.js.theme.html | 2 +- test/dist/heat.js.translations.html | 2 +- test/src/heat.js.basic.html | 2 +- test/src/heat.js.bootstrap.html | 6 +- test/src/heat.js.data-pull.html | 2 +- test/src/heat.js.map-only.html | 2 +- test/src/heat.js.numbers.html | 2 +- test/src/heat.js.theme.html | 2 +- test/src/heat.js.translations.html | 2 +- 18 files changed, 274 insertions(+), 271 deletions(-) diff --git a/dist/heat.js b/dist/heat.js index 79ca48d1..1304a48f 100644 --- a/dist/heat.js +++ b/dist/heat.js @@ -50,7 +50,7 @@ bindingOptions.currentView.mapContentsScrollLeft = 0; bindingOptions.currentView.year = bindingOptions.year; bindingOptions.currentView.type = _configuration.unknownTrendText; - bindingOptions.currentView.isInFetchMode = isDefinedFunction(bindingOptions.onDataFetch); + bindingOptions.currentView.isInFetchMode = isDefinedFunction(bindingOptions.events.onDataFetch); bindingOptions.currentView.isInFetchModeTimer = null; bindingOptions.currentView.yearsAvailable = []; if (bindingOptions.views.chart.enabled) { @@ -79,7 +79,7 @@ return bindingOptions; } function renderControl(bindingOptions) { - fireCustomTrigger(bindingOptions.onBeforeRender, bindingOptions.currentView.element); + fireCustomTrigger(bindingOptions.events.onBeforeRender, bindingOptions.currentView.element); if (!isDefinedString(bindingOptions.currentView.element.id)) { bindingOptions.currentView.element.id = newGuid(); } @@ -91,7 +91,7 @@ bindingOptions.currentView.element.removeAttribute(_attribute_Name_Options); createDateStorageForElement(bindingOptions.currentView.element.id, bindingOptions); renderControlContainer(bindingOptions); - fireCustomTrigger(bindingOptions.onRenderComplete, bindingOptions.currentView.element); + fireCustomTrigger(bindingOptions.events.onRenderComplete, bindingOptions.currentView.element); } function renderControlContainer(bindingOptions, isForDataRefresh, isForViewSwitch) { isForDataRefresh = getDefaultBoolean(isForDataRefresh, false); @@ -258,7 +258,7 @@ } if (render) { renderControlContainer(bindingOptions); - fireCustomTrigger(bindingOptions.onOptionsUpdate, bindingOptions.currentView.element, bindingOptions); + fireCustomTrigger(bindingOptions.events.onOptionsUpdate, bindingOptions.currentView.element, bindingOptions); } else { hideToolTip(bindingOptions); } @@ -337,7 +337,7 @@ var refresh = createElementWithHTML(titleBar, "button", "refresh", _configuration.refreshButtonText); refresh.onclick = function() { renderControlContainer(bindingOptions); - fireCustomTrigger(bindingOptions.onRefresh, bindingOptions.currentView.element); + fireCustomTrigger(bindingOptions.events.onRefresh, bindingOptions.currentView.element); }; } if (bindingOptions.title.showYearSelector) { @@ -397,7 +397,7 @@ } else { option.onclick = function() { bindingOptions.currentView.view = view; - fireCustomTrigger(bindingOptions.onViewSwitch, viewName); + fireCustomTrigger(bindingOptions.events.onViewSwitch, viewName); renderControlContainer(bindingOptions, false, true); }; } @@ -427,7 +427,7 @@ year.onclick = function() { bindingOptions.currentView.year = currentYear; renderControlContainer(bindingOptions); - fireCustomTrigger(bindingOptions.onSetYear, bindingOptions.currentView.year); + fireCustomTrigger(bindingOptions.events.onSetYear, bindingOptions.currentView.year); }; if (currentYear === actualYear) { addClass(year, "year-menu-item-current"); @@ -552,9 +552,9 @@ if (bindingOptions.views.map.showDayNumbers && dateCount > 0) { day.innerHTML = dateCount.toString(); } - if (isDefinedFunction(bindingOptions.onDayClick)) { + if (isDefinedFunction(bindingOptions.events.onDayClick)) { day.onclick = function() { - fireCustomTrigger(bindingOptions.onDayClick, date, dateCount); + fireCustomTrigger(bindingOptions.events.onDayClick, date, dateCount); }; } else { addClass(day, "no-hover"); @@ -671,9 +671,9 @@ if (dayLineHeight <= 0) { dayLine.style.visibility = "hidden"; } - if (isDefinedFunction(bindingOptions.onDayClick)) { + if (isDefinedFunction(bindingOptions.events.onDayClick)) { dayLine.onclick = function() { - fireCustomTrigger(bindingOptions.onDayClick, date, dateCount); + fireCustomTrigger(bindingOptions.events.onDayClick, date, dateCount); }; } else { addClass(dayLine, "no-hover"); @@ -757,9 +757,9 @@ dayLine.style.visibility = "hidden"; } addToolTip(dayLine, bindingOptions, dayCount.toString()); - if (isDefinedFunction(bindingOptions.onWeekDayClick)) { + if (isDefinedFunction(bindingOptions.events.onWeekDayClick)) { dayLine.onclick = function() { - fireCustomTrigger(bindingOptions.onWeekDayClick, dayNumber, dayCount); + fireCustomTrigger(bindingOptions.events.onWeekDayClick, dayNumber, dayCount); }; } else { addClass(dayLine, "no-hover"); @@ -854,9 +854,9 @@ addClass(rangeLine, "range-line-number"); createElementWithHTML(rangeLine, "div", "count", rangeCount); } - if (isDefinedFunction(bindingOptions.onStatisticClick)) { + if (isDefinedFunction(bindingOptions.events.onStatisticClick)) { rangeLine.onclick = function() { - fireCustomTrigger(bindingOptions.onStatisticClick, useColorRange); + fireCustomTrigger(bindingOptions.events.onStatisticClick, useColorRange); }; } else { addClass(rangeLine, "no-hover"); @@ -955,7 +955,7 @@ typeButton.onclick = function() { if (bindingOptions.currentView.type !== type) { bindingOptions.currentView.type = type; - fireCustomTrigger(bindingOptions.onTypeSwitch, type); + fireCustomTrigger(bindingOptions.events.onTypeSwitch, type); renderControlContainer(bindingOptions); } }; @@ -999,8 +999,8 @@ } } function renderDayToolTip(bindingOptions, day, date, dateCount) { - if (isDefinedFunction(bindingOptions.onDayToolTipRender)) { - addToolTip(day, bindingOptions, fireCustomTrigger(bindingOptions.onDayToolTipRender, date, dateCount)); + if (isDefinedFunction(bindingOptions.events.onDayToolTipRender)) { + addToolTip(day, bindingOptions, fireCustomTrigger(bindingOptions.events.onDayToolTipRender, date, dateCount)); } else { var tooltip = getCustomFormattedDateText(bindingOptions.dayToolTipText, date); if (bindingOptions.showHolidaysInDayToolTips) { @@ -1112,7 +1112,7 @@ } } function pullDataFromCustomTrigger(bindingOptions) { - var elementId = bindingOptions.currentView.element.id, data = fireCustomTrigger(bindingOptions.onDataFetch, elementId); + var elementId = bindingOptions.currentView.element.id, data = fireCustomTrigger(bindingOptions.events.onDataFetch, elementId); if (isDefinedObject(data)) { createDateStorageForElement(elementId, bindingOptions, false); for (var storageDate in data) { @@ -1155,7 +1155,7 @@ var colorRangesLength = bindingOptions.colorRanges.length; for (var colorRangesIndex = 0; colorRangesIndex < colorRangesLength; colorRangesIndex++) { bindingOptions.colorRanges[colorRangesIndex].visible = flag; - fireCustomTrigger(bindingOptions.onColorRangeTypeToggle, bindingOptions.colorRanges[colorRangesIndex].id, flag); + fireCustomTrigger(bindingOptions.events.onColorRangeTypeToggle, bindingOptions.colorRanges[colorRangesIndex].id, flag); } renderControlContainer(bindingOptions); } @@ -1165,7 +1165,7 @@ var colorRange = bindingOptions.colorRanges[colorRangesIndex]; if (colorRange.id === id) { colorRange.visible = !getDefaultBoolean(colorRange.visible, true); - fireCustomTrigger(bindingOptions.onColorRangeTypeToggle, colorRange.id, colorRange.visible); + fireCustomTrigger(bindingOptions.events.onColorRangeTypeToggle, colorRange.id, colorRange.visible); renderControlContainer(bindingOptions); break; } @@ -1260,7 +1260,7 @@ } } if (filesCompleted.length === filesLength) { - fireCustomTrigger(bindingOptions.onImport, bindingOptions.currentView.element); + fireCustomTrigger(bindingOptions.events.onImport, bindingOptions.currentView.element); renderControlContainer(bindingOptions); } }; @@ -1337,7 +1337,7 @@ tempLink.setAttribute("download", getExportFilename(bindingOptions)); tempLink.click(); _parameter_Document.body.removeChild(tempLink); - fireCustomTrigger(bindingOptions.onExport, bindingOptions.currentView.element); + fireCustomTrigger(bindingOptions.events.onExport, bindingOptions.currentView.element); } } function getCsvContent(bindingOptions) { @@ -1454,38 +1454,18 @@ options.dataFetchDelay = getDefaultNumber(options.dataFetchDelay, 60000); options.showOnlyDataForYearsAvailable = getDefaultBoolean(options.showOnlyDataForYearsAvailable, false); options.showHolidaysInDayToolTips = getDefaultBoolean(options.showHolidaysInDayToolTips, false); - options = buildAttributeOptionTitle(options); - options = buildAttributeOptionGuide(options); options = buildAttributeOptionColorRanges(options); options = buildAttributeOptionHolidays(options); + options = buildAttributeOptionStrings(options); + options = buildAttributeOptionTitle(options); + options = buildAttributeOptionGuide(options); options = buildAttributeOptionMapView(options); options = buildAttributeOptionChartView(options); options = buildAttributeOptionDaysView(options); options = buildAttributeOptionStatisticsView(options); - options = buildAttributeOptionStrings(options); options = buildAttributeOptionCustomTriggers(options); return options; } - function buildAttributeOptionTitle(options) { - options.title = getDefaultObject(options.title, {}); - options.title.showText = getDefaultBoolean(options.title.showText, true); - options.title.showYearSelector = getDefaultBoolean(options.title.showYearSelector, true); - options.title.showRefreshButton = getDefaultBoolean(options.title.showRefreshButton, false); - options.title.showExportButton = getDefaultBoolean(options.title.showExportButton, false); - options.title.extraSelectionYears = getDefaultNumber(options.title.extraSelectionYears, 50); - options.title.showYearSelectionDropDown = getDefaultBoolean(options.title.showYearSelectionDropDown, true); - options.title.showImportButton = getDefaultBoolean(options.title.showImportButton, false); - options.title.showConfigurationButton = getDefaultBoolean(options.title.showConfigurationButton, true); - return options; - } - function buildAttributeOptionGuide(options) { - options.guide = getDefaultObject(options.guide, {}); - options.guide.enabled = getDefaultBoolean(options.guide.enabled, true); - options.guide.colorRangeTogglesEnabled = getDefaultBoolean(options.guide.colorRangeTogglesEnabled, true); - options.guide.showLessAndMoreLabels = getDefaultBoolean(options.guide.showLessAndMoreLabels, true); - options.guide.showNumbersInGuide = getDefaultBoolean(options.guide.showNumbersInGuide, false); - return options; - } function buildAttributeOptionColorRanges(options) { if (isDefinedArray(options.colorRanges)) { var colorRangesLength = options.colorRanges.length; @@ -1520,6 +1500,31 @@ } return options; } + function buildAttributeOptionStrings(options) { + options.titleText = getDefaultString(options.titleText, "Heat.js"); + options.dayToolTipText = getDefaultString(options.dayToolTipText, "{d}{o} {mmmm} {yyyy}"); + return options; + } + function buildAttributeOptionTitle(options) { + options.title = getDefaultObject(options.title, {}); + options.title.showText = getDefaultBoolean(options.title.showText, true); + options.title.showYearSelector = getDefaultBoolean(options.title.showYearSelector, true); + options.title.showRefreshButton = getDefaultBoolean(options.title.showRefreshButton, false); + options.title.showExportButton = getDefaultBoolean(options.title.showExportButton, false); + options.title.extraSelectionYears = getDefaultNumber(options.title.extraSelectionYears, 50); + options.title.showYearSelectionDropDown = getDefaultBoolean(options.title.showYearSelectionDropDown, true); + options.title.showImportButton = getDefaultBoolean(options.title.showImportButton, false); + options.title.showConfigurationButton = getDefaultBoolean(options.title.showConfigurationButton, true); + return options; + } + function buildAttributeOptionGuide(options) { + options.guide = getDefaultObject(options.guide, {}); + options.guide.enabled = getDefaultBoolean(options.guide.enabled, true); + options.guide.colorRangeTogglesEnabled = getDefaultBoolean(options.guide.colorRangeTogglesEnabled, true); + options.guide.showLessAndMoreLabels = getDefaultBoolean(options.guide.showLessAndMoreLabels, true); + options.guide.showNumbersInGuide = getDefaultBoolean(options.guide.showNumbersInGuide, false); + return options; + } function buildAttributeOptionMapView(options) { options.views.map = getDefaultObject(options.views.map, {}); options.views.map.showMonthDayGaps = getDefaultBoolean(options.views.map.showMonthDayGaps, true); @@ -1589,35 +1594,31 @@ } return options; } - function buildAttributeOptionStrings(options) { - options.titleText = getDefaultString(options.titleText, "Heat.js"); - options.dayToolTipText = getDefaultString(options.dayToolTipText, "{d}{o} {mmmm} {yyyy}"); - return options; - } function buildAttributeOptionCustomTriggers(options) { - options.onDayClick = getDefaultFunction(options.onDayClick, null); - options.onBackYear = getDefaultFunction(options.onBackYear, null); - options.onNextYear = getDefaultFunction(options.onNextYear, null); - options.onRefresh = getDefaultFunction(options.onRefresh, null); - options.onBeforeRender = getDefaultFunction(options.onBeforeRender, null); - options.onRenderComplete = getDefaultFunction(options.onRenderComplete, null); - options.onDestroy = getDefaultFunction(options.onDestroy, null); - options.onExport = getDefaultFunction(options.onExport, null); - options.onSetYear = getDefaultFunction(options.onSetYear, null); - options.onTypeSwitch = getDefaultFunction(options.onTypeSwitch, null); - options.onDayToolTipRender = getDefaultFunction(options.onDayToolTipRender, null); - options.onAdd = getDefaultFunction(options.onAdd, null); - options.onRemove = getDefaultFunction(options.onRemove, null); - options.onReset = getDefaultFunction(options.onReset, null); - options.onViewSwitch = getDefaultFunction(options.onViewSwitch, null); - options.onColorRangeTypeToggle = getDefaultFunction(options.onColorRangeTypeToggle, null); - options.onImport = getDefaultFunction(options.onImport, null); - options.onStatisticClick = getDefaultFunction(options.onStatisticClick, null); - options.onDataFetch = getDefaultFunction(options.onDataFetch, null); - options.onClear = getDefaultFunction(options.onClear, null); - options.onUpdate = getDefaultFunction(options.onUpdate, null); - options.onOptionsUpdate = getDefaultFunction(options.onOptionsUpdate, null); - options.onWeekDayClick = getDefaultFunction(options.onWeekDayClick, null); + options.events = getDefaultObject(options.events, {}); + options.events.onDayClick = getDefaultFunction(options.events.onDayClick, null); + options.events.onBackYear = getDefaultFunction(options.events.onBackYear, null); + options.events.onNextYear = getDefaultFunction(options.events.onNextYear, null); + options.events.onRefresh = getDefaultFunction(options.events.onRefresh, null); + options.events.onBeforeRender = getDefaultFunction(options.events.onBeforeRender, null); + options.events.onRenderComplete = getDefaultFunction(options.events.onRenderComplete, null); + options.events.onDestroy = getDefaultFunction(options.events.onDestroy, null); + options.events.onExport = getDefaultFunction(options.events.onExport, null); + options.events.onSetYear = getDefaultFunction(options.events.onSetYear, null); + options.events.onTypeSwitch = getDefaultFunction(options.events.onTypeSwitch, null); + options.events.onDayToolTipRender = getDefaultFunction(options.events.onDayToolTipRender, null); + options.events.onAdd = getDefaultFunction(options.events.onAdd, null); + options.events.onRemove = getDefaultFunction(options.events.onRemove, null); + options.events.onReset = getDefaultFunction(options.events.onReset, null); + options.events.onViewSwitch = getDefaultFunction(options.events.onViewSwitch, null); + options.events.onColorRangeTypeToggle = getDefaultFunction(options.events.onColorRangeTypeToggle, null); + options.events.onImport = getDefaultFunction(options.events.onImport, null); + options.events.onStatisticClick = getDefaultFunction(options.events.onStatisticClick, null); + options.events.onDataFetch = getDefaultFunction(options.events.onDataFetch, null); + options.events.onClear = getDefaultFunction(options.events.onClear, null); + options.events.onUpdate = getDefaultFunction(options.events.onUpdate, null); + options.events.onOptionsUpdate = getDefaultFunction(options.events.onOptionsUpdate, null); + options.events.onWeekDayClick = getDefaultFunction(options.events.onWeekDayClick, null); return options; } function getTotalDaysInMonth(year, month) { @@ -1892,7 +1893,7 @@ _elements_DateCounts[elementId].type[type][storageDate] = 0; } _elements_DateCounts[elementId].type[type][storageDate]++; - fireCustomTrigger(bindingOptions.onAdd, bindingOptions.currentView.element); + fireCustomTrigger(bindingOptions.events.onAdd, bindingOptions.currentView.element); if (triggerRefresh) { renderControlContainer(bindingOptions, true); } @@ -1909,7 +1910,7 @@ if (_elements_DateCounts[elementId].type.hasOwnProperty(type)) { triggerRefresh = getDefaultBoolean(triggerRefresh, true); _elements_DateCounts[elementId].type[type][storageDate] = count; - fireCustomTrigger(bindingOptions.onUpdate, bindingOptions.currentView.element); + fireCustomTrigger(bindingOptions.events.onUpdate, bindingOptions.currentView.element); if (triggerRefresh) { renderControlContainer(bindingOptions, true); } @@ -1946,7 +1947,7 @@ if (_elements_DateCounts[elementId].type[type][storageDate] > 0) { _elements_DateCounts[elementId].type[type][storageDate]--; } - fireCustomTrigger(bindingOptions.onRemove, bindingOptions.currentView.element); + fireCustomTrigger(bindingOptions.events.onRemove, bindingOptions.currentView.element); if (triggerRefresh) { renderControlContainer(bindingOptions, true); } @@ -1964,7 +1965,7 @@ if (_elements_DateCounts[elementId].type.hasOwnProperty(type) && _elements_DateCounts[elementId].type[type].hasOwnProperty(storageDate)) { triggerRefresh = getDefaultBoolean(triggerRefresh, true); delete _elements_DateCounts[elementId].type[type][storageDate]; - fireCustomTrigger(bindingOptions.onClear, bindingOptions.currentView.element); + fireCustomTrigger(bindingOptions.events.onClear, bindingOptions.currentView.element); if (triggerRefresh) { renderControlContainer(bindingOptions, true); } @@ -1988,7 +1989,7 @@ triggerRefresh = getDefaultBoolean(triggerRefresh, true); bindingOptions.currentView.type = _configuration.unknownTrendText; createDateStorageForElement(elementId, bindingOptions, false); - fireCustomTrigger(bindingOptions.onReset, bindingOptions.currentView.element); + fireCustomTrigger(bindingOptions.events.onReset, bindingOptions.currentView.element); if (triggerRefresh) { renderControlContainer(bindingOptions, true); } @@ -2006,7 +2007,7 @@ if (isDefinedString(elementId) && _elements_DateCounts.hasOwnProperty(elementId)) { var bindingOptions = _elements_DateCounts[elementId].options; renderControlContainer(bindingOptions, true); - fireCustomTrigger(bindingOptions.onRefresh, bindingOptions.currentView.element); + fireCustomTrigger(bindingOptions.events.onRefresh, bindingOptions.currentView.element); } return _public; }; @@ -2015,7 +2016,7 @@ if (_elements_DateCounts.hasOwnProperty(elementId)) { var bindingOptions = _elements_DateCounts[elementId].options; renderControlContainer(bindingOptions, true); - fireCustomTrigger(bindingOptions.onRefresh, bindingOptions.currentView.element); + fireCustomTrigger(bindingOptions.events.onRefresh, bindingOptions.currentView.element); } } return _public; @@ -2029,7 +2030,7 @@ } else { renderControlContainer(bindingOptions); } - fireCustomTrigger(bindingOptions.onSetYear, bindingOptions.currentView.year); + fireCustomTrigger(bindingOptions.events.onSetYear, bindingOptions.currentView.year); } return _public; }; @@ -2048,7 +2049,7 @@ } else { renderControlContainer(bindingOptions); } - fireCustomTrigger(bindingOptions.onSetYear, bindingOptions.currentView.year); + fireCustomTrigger(bindingOptions.events.onSetYear, bindingOptions.currentView.year); } } return _public; @@ -2068,7 +2069,7 @@ } else { renderControlContainer(bindingOptions); } - fireCustomTrigger(bindingOptions.onSetYear, bindingOptions.currentView.year); + fireCustomTrigger(bindingOptions.events.onSetYear, bindingOptions.currentView.year); } } return _public; @@ -2094,7 +2095,7 @@ } else { renderControlContainer(bindingOptions); } - fireCustomTrigger(bindingOptions.onSetYear, bindingOptions.currentView.year); + fireCustomTrigger(bindingOptions.events.onSetYear, bindingOptions.currentView.year); } return _public; }; @@ -2130,7 +2131,7 @@ } if (isDefinedNumber(view)) { bindingOptions.currentView.view = view; - fireCustomTrigger(bindingOptions.onViewSwitch, viewName); + fireCustomTrigger(bindingOptions.events.onViewSwitch, viewName); renderControlContainer(bindingOptions, false, true); } } @@ -2141,7 +2142,7 @@ var bindingOptions = _elements_DateCounts[elementId].options; if (bindingOptions.currentView.type !== type) { bindingOptions.currentView.type = type; - fireCustomTrigger(bindingOptions.onTypeSwitch, type); + fireCustomTrigger(bindingOptions.events.onTypeSwitch, type); renderControlContainer(bindingOptions); } } @@ -2158,8 +2159,8 @@ } if (optionChanged) { renderControlContainer(bindingOptions, true); - fireCustomTrigger(bindingOptions.onRefresh, bindingOptions.currentView.element); - fireCustomTrigger(bindingOptions.onOptionsUpdate, bindingOptions.currentView.element, bindingOptions); + fireCustomTrigger(bindingOptions.events.onRefresh, bindingOptions.currentView.element); + fireCustomTrigger(bindingOptions.events.onOptionsUpdate, bindingOptions.currentView.element, bindingOptions); } } return _public; @@ -2179,7 +2180,7 @@ bindingOptions.currentView.year = year; renderControlContainer(bindingOptions); if (callCustomTrigger) { - fireCustomTrigger(bindingOptions.onBackYear, bindingOptions.currentView.year); + fireCustomTrigger(bindingOptions.events.onBackYear, bindingOptions.currentView.year); } } } @@ -2198,7 +2199,7 @@ bindingOptions.currentView.year = year; renderControlContainer(bindingOptions); if (callCustomTrigger) { - fireCustomTrigger(bindingOptions.onBackYear, bindingOptions.currentView.year); + fireCustomTrigger(bindingOptions.events.onBackYear, bindingOptions.currentView.year); } } } @@ -2226,7 +2227,7 @@ if (bindingOptions.currentView.isInFetchMode && isDefined(bindingOptions.currentView.isInFetchModeTimer)) { clearInterval(bindingOptions.currentView.isInFetchModeTimer); } - fireCustomTrigger(bindingOptions.onDestroy, bindingOptions.currentView.element); + fireCustomTrigger(bindingOptions.events.onDestroy, bindingOptions.currentView.element); } _public.setConfiguration = function(newConfiguration, triggerRefresh) { if (isDefinedObject(newConfiguration)) { diff --git a/dist/heat.min.js b/dist/heat.min.js index 8701b8d9..14a884b9 100644 --- a/dist/heat.min.js +++ b/dist/heat.min.js @@ -1,8 +1,8 @@ /*! Heat.js v3.1.0 | (c) Bunoon 2024 | MIT License */ (function(){function Da(){for(var a=h.domElementTypes,b=a.length,d=0;dy;y++)a.currentView.dayCheckBoxes[y].checked&&g.push(y+1);for(y=0;12>y;y++)a.currentView.monthCheckBoxes[y].checked&&l.push(y+1);1<=g.length&&(1===a.currentView.view? a.views.map.daysToShow=g:a.views.chart.enabled&&2===a.currentView.view?a.views.chart.daysToShow=g:a.views.days.enabled&&3===a.currentView.view?a.views.days.daysToShow=g:a.views.statistics.enabled&&4===a.currentView.view?a.views.statistics.daysToShow=g:a.views.map.daysToShow=g,t=!0);1<=l.length&&(1===a.currentView.view?a.views.map.monthsToShow=l:a.views.chart.enabled&&2===a.currentView.view?a.views.chart.monthsToShow=l:a.views.days.enabled&&3===a.currentView.view?a.views.days.monthsToShow=l:a.views.statistics.enabled&& -4===a.currentView.view?a.views.statistics.monthsToShow=l:a.views.map.monthsToShow=l,t=!0);t?(A(a),z(a.onOptionsUpdate,a.currentView.element,a)):ca(a)};for(var f=0;7>f;f++)a.currentView.dayCheckBoxes[f]=Ba(e,h.dayNames[f]).input;for(e=0;7>e;e++)a.currentView.monthCheckBoxes[e]=Ba(b,h.monthNames[e]).input;for(e=7;12>e;e++)a.currentView.monthCheckBoxes[e]=Ba(d,h.monthNames[e]).input;X(c,a,h.closeToolTipText)}function Ia(a,b){var d=(b=m(b,!0))?J.addEventListener:J.removeEventListener;(b?C.addEventListener: +4===a.currentView.view?a.views.statistics.monthsToShow=l:a.views.map.monthsToShow=l,t=!0);t?(A(a),z(a.events.onOptionsUpdate,a.currentView.element,a)):ca(a)};for(var f=0;7>f;f++)a.currentView.dayCheckBoxes[f]=Ba(e,h.dayNames[f]).input;for(e=0;7>e;e++)a.currentView.monthCheckBoxes[e]=Ba(b,h.monthNames[e]).input;for(e=7;12>e;e++)a.currentView.monthCheckBoxes[e]=Ba(d,h.monthNames[e]).input;X(c,a,h.closeToolTipText)}function Ia(a,b){var d=(b=m(b,!0))?J.addEventListener:J.removeEventListener;(b?C.addEventListener: C.removeEventListener)("mousemove",function(){ca(a)});d("scroll",function(){ca(a)})}function X(a,b,d){null!==a&&(a.onmousemove=function(c){cb(c,b,d)})}function cb(a,b,d){ia(a);ca(b);b.currentView.tooltipTimer=setTimeout(function(){b.currentView.tooltip.innerHTML=d;b.currentView.tooltip.style.display="block";var c=b.currentView.tooltip,e=a.pageX,f=a.pageY;var g=J.documentElement;var l=(C.pageXOffset||g.scrollLeft)-(g.clientLeft||0);g=(C.pageYOffset||g.scrollTop)-(g.clientTop||0);c.style.display="block"; e+c.offsetWidth>C.innerWidth?e-=c.offsetWidth:e++;f+c.offsetHeight>C.innerHeight?f-=c.offsetHeight:f++;ef;f++)a.currentView.dayCheckBoxes[f].checked=R(c,f+1);for(c=0;12>c;c++)a.currentView.monthCheckBoxes[c].checked= V(e,c);ca(a)}),b=u(b,"button","next",h.nextButtonText),b.onclick=function(){ja(a)},0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]&&(b.disabled=!0))}}function db(a,b){b=n(b,"div","titles-menu-container");b=n(b,"div","titles-menu");u(b,"div","title-menu-header",h.dataText+q.colon);var d=u(b,"div","title-menu-item",h.mapText);qa(a,d,1,"map");a.views.chart.enabled&&(d=u(b,"div","title-menu-item",h.chartText),qa(a,d,2,"chart")); -a.views.days.enabled&&(u(b,"div","title-menu-header",h.yearText+q.colon),d=u(b,"div","title-menu-item",h.daysText),qa(a,d,3,"days"));a.views.statistics.enabled&&(u(b,"div","title-menu-header",h.statisticsText+q.colon),b=u(b,"div","title-menu-item",h.colorRangesText),qa(a,b,4,"statistics"))}function qa(a,b,d,c){a.currentView.view===d?x(b,"title-menu-item-active"):b.onclick=function(){a.currentView.view=d;z(a.onViewSwitch,c);A(a,!1,!0)}}function fb(a){n(a.currentView.yearText,"div","down-arrow");var b= -n(a.currentView.yearText,"div","years-menu-container"),d=n(b,"div","years-menu"),c=(new Date).getFullYear(),e=null;b.style.display="block";b.style.visibility="hidden";for(var f=c-a.title.extraSelectionYears;fg;g++)if(V(a.views.chart.monthsToShow,g)){y=da(l,g);var E=1;d++;for(var B=0;Bl;l++)f(l);F.style.width=e.offsetWidth+"px";e=n(F,"div","month-name-space");e.style.height=F.offsetHeight+"px";e.style.width=t+"px"}a.views.chart.keepScrollPositions&&(a.currentView.chartContents.scrollLeft= -a.currentView.chartContentsScrollLeft)}}function ib(a,b,d,c,e,f,g){var l=new Date(e,c,d);a=n(a,"div","day-line");var t=M(b)[N(l)];t=Z(t,0);La(b,a,l,t);b.views.chart.showLineNumbers&&0=g&&(a.style.visibility="hidden");Q(b.onDayClick)?a.onclick=function(){z(b.onDayClick,l,t)}:x(a,"no-hover");f=Aa(b,f,t,l);w(f)&&ra(b,f.id)&&(v(f.chartCssClassName)?x(a,f.chartCssClassName):x(a,f.cssClassName))}function hb(a){for(var b= -0,d=M(a),c=0;12>c;c++)for(var e=da(a.currentView.year,c),f=0;f=e&&(a.style.visibility="hidden");X(a,c,d.toString());Q(c.onWeekDayClick)?a.onclick=function(){z(c.onWeekDayClick,b,d)}:x(a,"no-hover");c.views.days.showDayNumbers&&0=a&&(b.style.visibility="hidden");X(b,c,d.toString());c.views.statistics.showRangeNumbers&&0ka.notFound}function R(a,b){return a.indexOf(b)>ka.notFound}function Sa(a){var b=[];if(a.showOnlyDataForYearsAvailable){a=M(a);for(var d in a)if(a.hasOwnProperty(d)){var c=parseInt(d.split(q.dash)[0]);b.indexOf(c)===ka.notFound&& -b.push(c)}}return b=b.sort(function(e,f){return e-f})}function Y(a,b){return a.yearsToHide.indexOf(b)===ka.notFound&&(0===a.currentView.yearsAvailable.length||a.currentView.yearsAvailable.indexOf(b)>ka.notFound)}function Ta(a){a.currentView.isInFetchMode&&(w(a.currentView.isInFetchModeTimer)||Oa(a),w(a.currentView.isInFetchModeTimer)||(a.currentView.isInFetchModeTimer=setInterval(function(){Oa(a);A(a)},a.dataFetchDelay)))}function Oa(a){var b=a.currentView.element.id,d=z(a.onDataFetch,b);if(L(d)){za(b, -a,!1);for(var c in d)d.hasOwnProperty(c)&&(k[b].type[h.unknownTrendText].hasOwnProperty(c)||(k[b].type[h.unknownTrendText][c]=0),k[b].type[h.unknownTrendText][c]+=d[c])}}function ra(a,b){var d=!1;if("HOLIDAY"===b)d=!0;else for(var c=a.colorRanges.length,e=0;e=f.minimum)e=f;else break}return e}function Ja(a,b){for(var d=a.length,c=null,e=0;e');f.push("");for(e in g)g.hasOwnProperty(e)&&(f.push(""),f.push(""+e+""),f.push(""+g[e]+""),f.push(""));f.push("");d=f.join(q.newLine)}else if("txt"===b){g=sa(a);e=[];for(f in g)g.hasOwnProperty(f)&& -e.push(f+q.colon+q.space+g[f].toString());d=e.join(q.newLine)}v(d)&&(g=n(J.body,"a"),g.style.display="none",g.setAttribute("target","_blank"),g.setAttribute("href","data:"+c+";charset=utf-8,"+encodeURIComponent(d)),c=g.setAttribute,f=new Date,e=T(f.getDate())+q.dash+T(f.getMonth()+1)+q.dash+f.getFullYear(),f=T(f.getHours())+q.dash+T(f.getMinutes()),d=q.empty,a.currentView.type!==h.unknownTrendText&&(d=a.currentView.type.toLowerCase().replace(q.space,q.underscore)+q.underscore),e=d+e+q.underscore+ -f+"."+a.exportType.toLowerCase(),c.call(g,"download",e),g.click(),J.body.removeChild(g),z(a.onExport,a.currentView.element))}function sa(a){var b={},d=M(a);if(a.exportOnlyYearBeingViewed)for(var c=0;12>c;c++)for(var e=da(a.currentView.year,c),f=0;fa.getDay()-1?6:a.getDay()-1}function w(a){return null!==a&&void 0!==a&&a!==q.empty}function L(a){return w(a)&&"object"===typeof a}function v(a){return w(a)&&"string"===typeof a}function Q(a){return w(a)&&"function"===typeof a}function wa(a){return w(a)&&"number"===typeof a}function aa(a){return L(a)&&a instanceof Array}function xa(a){return L(a)&&a instanceof Date}function lb(a){a=a.toLowerCase();var b="text"=== -a;fa.hasOwnProperty(a)||(fa[a]=b?J.createTextNode(q.empty):J.createElement(a));return fa[a].cloneNode(!1)}function n(a,b,d,c){b=b.toLowerCase();var e="text"===b;fa.hasOwnProperty(b)||(fa[b]=e?J.createTextNode(q.empty):J.createElement(b));b=fa[b].cloneNode(!1);w(d)&&(b.className=d);w(c)?a.insertBefore(b,c):a.appendChild(b);return b}function u(a,b,d,c,e){a=n(a,b,d,e);a.innerHTML=c;return a}function ha(a,b,d){var c=null;d=m(d,!1);C.getComputedStyle?c=J.defaultView.getComputedStyle(a,null).getPropertyValue(b): -a.currentStyle&&(c=a.currentStyle[b]);d&&(c=parseFloat(c,10));return c}function x(a,b){a.className+=q.space+b;a.className=a.className.trim()}function ia(a){a.preventDefault();a.cancelBubble=!0}function S(a){for(var b=a.children,d=b.length-1;d--;)a.appendChild(b[d])}function Ba(a,b,d,c){a=n(a,"div");a=n(a,"label","checkbox");var e=n(a,"input");e.type="checkbox";w(c)&&(e.onclick=c);w(d)&&(e.checked=d);n(a,"span","check-mark");u(a,"span","text",b);return{input:e,label:a}}function z(a){var b=null;Q(a)&& -(b=a.apply(null,[].slice.call(arguments,1)));return b}function r(a,b){return v(a)?a:b}function m(a,b){return w(a)&&"boolean"===typeof a?a:b}function Z(a,b){return wa(a)?a:b}function D(a,b){return Q(a)?a:b}function U(a,b){return L(a)?a:b}function ya(a){var b=!0,d=null;try{v(a)&&(d=la.parse(a))}catch(c){try{d=eval("("+a+")"),Q(d)&&(d=d())}catch(e){h.safeMode||(console.error(h.objectErrorText.replace("{{error_1}}",c.message).replace("{{error_2}}",e.message)),b=!1),d=null}}return{parsed:b,result:d}}function ba(){for(var a= -[],b=0;32>b;b++){8!==b&&12!==b&&16!==b&&20!==b||a.push(q.dash);var d=I.floor(16*I.random()).toString(16);a.push(d)}return a.join(q.empty)}function T(a){a=a.toString();return 1===a.length?q.zero+a:a}function Ha(a,b){return a.substring(0,b.length).toLowerCase()===b.toLowerCase()}function N(a){return a.getFullYear()+q.dash+T(a.getMonth()+1)+q.dash+T(a.getDate())}function Ca(a,b){b=m(b,!0);var d=!0,c=a.currentView.year;for(c--;!Y(a,c);){if(0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]){d=!1;break}c++}d&&(a.currentView.year=c,A(a),b&&z(a.onBackYear,a.currentView.year))}function Qa(a){a.currentView.element.innerHTML=q.empty;var b=a.currentView.element;b.className=b.className.replace("heat-js",q.empty);b.className= -b.className.trim();Ia(a,!1);J.body.removeChild(a.currentView.tooltip);a.currentView.isInFetchMode&&w(a.currentView.isInFetchModeTimer)&&clearInterval(a.currentView.isInFetchModeTimer);z(a.onDestroy,a.currentView.element)}function Ra(a){h=L(a)?a:{};h.safeMode=m(h.safeMode,!0);a=h;var b=h.domElementTypes,d=["*"];v(b)?(b=b.split(q.space),0===b.length&&(b=d)):b=aa(b)?b:d;a.domElementTypes=b;h.stText=r(h.stText,"st");h.ndText=r(h.ndText,"nd");h.rdText=r(h.rdText,"rd");h.thText=r(h.thText,"th");h.backButtonText= -r(h.backButtonText,"Back");h.nextButtonText=r(h.nextButtonText,"Next");h.refreshButtonText=r(h.refreshButtonText,"Refresh");h.exportButtonText=r(h.exportButtonText,"Export");h.lessText=r(h.lessText,"Less");h.moreText=r(h.moreText,"More");h.dateText=r(h.dateText,"Date");h.countText=r(h.countText,"Count");h.mapText=r(h.mapText,"Map");h.chartText=r(h.chartText,"Chart");h.noChartDataMessage=r(h.noChartDataMessage,"There is currently no data to view.");h.statisticsText=r(h.statisticsText,"Statistics"); -h.noStatisticsDataMessage=r(h.noStatisticsDataMessage,"There are currently no statistics to view.");h.unknownTrendText=r(h.unknownTrendText,"Unknown");h.importButtonText=r(h.importButtonText,"Import");h.noMapDataMessage=r(h.noMapDataMessage,"There is currently no data to view.");h.objectErrorText=r(h.objectErrorText,"Errors in object: {{error_1}}, {{error_2}}");h.attributeNotValidErrorText=r(h.attributeNotValidErrorText,"The attribute '{{attribute_name}}' is not a valid object.");h.attributeNotSetErrorText= -r(h.attributeNotSetErrorText,"The attribute '{{attribute_name}}' has not been set correctly.");h.closeToolTipText=r(h.closeToolTipText,"Close");h.configurationToolTipText=r(h.configurationToolTipText,"Configuration");h.configurationTitleText=r(h.configurationTitleText,"Configuration");h.visibleMonthsText=r(h.visibleMonthsText,"Visible Months");h.visibleDaysText=r(h.visibleDaysText,"Visible Days");h.dataText=r(h.dataText,"Data");h.colorRangesText=r(h.colorRangesText,"Color Ranges");h.yearText=r(h.yearText, -"Year");h.daysText=r(h.daysText,"Days");h.noDaysDataMessage=r(h.noDaysDataMessage,"There are currently no days to view.");P(h.monthNames,12)&&(h.monthNames="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "));P(h.dayNames,7)&&(h.dayNames="Mon Tue Wed Thu Fri Sat Sun".split(" "))}function P(a,b){b=wa(b)?b:1;return!aa(a)||a.lengthd&&(a.currentView.year= -d,Y(a,a.currentView.year)?A(a):Ca(a,!1),z(a.onSetYear,a.currentView.year))}return p};p.moveToPreviousYear=function(a){v(a)&&k.hasOwnProperty(a)&&Ca(k[a].options);return p};p.moveToNextYear=function(a){v(a)&&k.hasOwnProperty(a)&&ja(k[a].options);return p};p.moveToCurrentYear=function(a){v(a)&&k.hasOwnProperty(a)&&(a=k[a].options,a.currentView.year=(new Date).getFullYear(),Y(a,a.currentView.year)?A(a):ja(a,!1),z(a.onSetYear,a.currentView.year));return p};p.getYear=function(a){var b=null;v(a)&&k.hasOwnProperty(a)&& -(b=k[a].options.currentView.year);return b};p.render=function(a,b){L(a)&&L(b)&&Ea(Fa(b,a));return p};p.renderAll=function(){Da();return p};p.switchView=function(a,b){if(v(a)&&v(b)&&k.hasOwnProperty(a)){a=k[a].options;var d=null;"map"===b.toLowerCase()?d=1:"chart"===b.toLowerCase()?d=2:"days"===b.toLowerCase()?d=3:"statistics"===b.toLowerCase()&&(d=4);wa(d)&&(a.currentView.view=d,z(a.onViewSwitch,b),A(a,!1,!0))}return p};p.switchType=function(a,b){v(a)&&v(b)&&k.hasOwnProperty(a)&&k[a].type.hasOwnProperty(b)&& -(a=k[a].options,a.currentView.type!==b&&(a.currentView.type=b,z(a.onTypeSwitch,b),A(a)));return p};p.updateOptions=function(a,b){if(v(a)&&L(b)&&k.hasOwnProperty(a)){a=k[a].options;b=Ga(b);var d=!1,c;for(c in b)b.hasOwnProperty(c)&&a.hasOwnProperty(c)&&a[c]!==b[c]&&(a[c]=b[c],d=!0);d&&(A(a,!0),z(a.onRefresh,a.currentView.element),z(a.onOptionsUpdate,a.currentView.element,a))}return p};p.destroyAll=function(){for(var a in k)k.hasOwnProperty(a)&&Qa(k[a].options);k={};return p};p.destroy=function(a){v(a)&& +a.views.days.enabled&&(u(b,"div","title-menu-header",h.yearText+q.colon),d=u(b,"div","title-menu-item",h.daysText),qa(a,d,3,"days"));a.views.statistics.enabled&&(u(b,"div","title-menu-header",h.statisticsText+q.colon),b=u(b,"div","title-menu-item",h.colorRangesText),qa(a,b,4,"statistics"))}function qa(a,b,d,c){a.currentView.view===d?x(b,"title-menu-item-active"):b.onclick=function(){a.currentView.view=d;z(a.events.onViewSwitch,c);A(a,!1,!0)}}function fb(a){n(a.currentView.yearText,"div","down-arrow"); +var b=n(a.currentView.yearText,"div","years-menu-container"),d=n(b,"div","years-menu"),c=(new Date).getFullYear(),e=null;b.style.display="block";b.style.visibility="hidden";for(var f=c-a.title.extraSelectionYears;fg;g++)if(V(a.views.chart.monthsToShow,g)){y=da(l,g);var E=1;d++;for(var B=0;Bl;l++)f(l);F.style.width=e.offsetWidth+"px";e=n(F,"div","month-name-space");e.style.height=F.offsetHeight+"px";e.style.width=t+"px"}a.views.chart.keepScrollPositions&& +(a.currentView.chartContents.scrollLeft=a.currentView.chartContentsScrollLeft)}}function ib(a,b,d,c,e,f,g){var l=new Date(e,c,d);a=n(a,"div","day-line");var t=M(b)[N(l)];t=Z(t,0);La(b,a,l,t);b.views.chart.showLineNumbers&&0=g&&(a.style.visibility="hidden");Q(b.events.onDayClick)?a.onclick=function(){z(b.events.onDayClick,l,t)}:x(a,"no-hover");f=Aa(b,f,t,l);w(f)&&ra(b,f.id)&&(v(f.chartCssClassName)?x(a,f.chartCssClassName): +x(a,f.cssClassName))}function hb(a){for(var b=0,d=M(a),c=0;12>c;c++)for(var e=da(a.currentView.year,c),f=0;f=e&&(a.style.visibility="hidden");X(a,c,d.toString());Q(c.events.onWeekDayClick)?a.onclick=function(){z(c.events.onWeekDayClick,b,d)}:x(a,"no-hover"); +c.views.days.showDayNumbers&&0=a&&(b.style.visibility="hidden");X(b,c,d.toString());c.views.statistics.showRangeNumbers&&0ka.notFound}function R(a,b){return a.indexOf(b)>ka.notFound}function Sa(a){var b=[];if(a.showOnlyDataForYearsAvailable){a=M(a);for(var d in a)if(a.hasOwnProperty(d)){var c= +parseInt(d.split(q.dash)[0]);b.indexOf(c)===ka.notFound&&b.push(c)}}return b=b.sort(function(e,f){return e-f})}function Y(a,b){return a.yearsToHide.indexOf(b)===ka.notFound&&(0===a.currentView.yearsAvailable.length||a.currentView.yearsAvailable.indexOf(b)>ka.notFound)}function Ta(a){a.currentView.isInFetchMode&&(w(a.currentView.isInFetchModeTimer)||Oa(a),w(a.currentView.isInFetchModeTimer)||(a.currentView.isInFetchModeTimer=setInterval(function(){Oa(a);A(a)},a.dataFetchDelay)))}function Oa(a){var b= +a.currentView.element.id,d=z(a.events.onDataFetch,b);if(L(d)){za(b,a,!1);for(var c in d)d.hasOwnProperty(c)&&(k[b].type[h.unknownTrendText].hasOwnProperty(c)||(k[b].type[h.unknownTrendText][c]=0),k[b].type[h.unknownTrendText][c]+=d[c])}}function ra(a,b){var d=!1;if("HOLIDAY"===b)d=!0;else for(var c=a.colorRanges.length,e=0;e=f.minimum)e=f;else break}return e}function Ja(a,b){for(var d=a.length,c=null,e=0;e');f.push("");for(e in g)g.hasOwnProperty(e)&&(f.push(""),f.push(""+e+""),f.push(""+g[e]+""),f.push(""));f.push("");d=f.join(q.newLine)}else if("txt"=== +b){g=sa(a);e=[];for(f in g)g.hasOwnProperty(f)&&e.push(f+q.colon+q.space+g[f].toString());d=e.join(q.newLine)}v(d)&&(g=n(J.body,"a"),g.style.display="none",g.setAttribute("target","_blank"),g.setAttribute("href","data:"+c+";charset=utf-8,"+encodeURIComponent(d)),c=g.setAttribute,f=new Date,e=U(f.getDate())+q.dash+U(f.getMonth()+1)+q.dash+f.getFullYear(),f=U(f.getHours())+q.dash+U(f.getMinutes()),d=q.empty,a.currentView.type!==h.unknownTrendText&&(d=a.currentView.type.toLowerCase().replace(q.space, +q.underscore)+q.underscore),e=d+e+q.underscore+f+"."+a.exportType.toLowerCase(),c.call(g,"download",e),g.click(),J.body.removeChild(g),z(a.events.onExport,a.currentView.element))}function sa(a){var b={},d=M(a);if(a.exportOnlyYearBeingViewed)for(var c=0;12>c;c++)for(var e=da(a.currentView.year,c),f=0;fa.getDay()-1?6:a.getDay()-1}function w(a){return null!== +a&&void 0!==a&&a!==q.empty}function L(a){return w(a)&&"object"===typeof a}function v(a){return w(a)&&"string"===typeof a}function Q(a){return w(a)&&"function"===typeof a}function wa(a){return w(a)&&"number"===typeof a}function aa(a){return L(a)&&a instanceof Array}function xa(a){return L(a)&&a instanceof Date}function lb(a){a=a.toLowerCase();var b="text"===a;fa.hasOwnProperty(a)||(fa[a]=b?J.createTextNode(q.empty):J.createElement(a));return fa[a].cloneNode(!1)}function n(a,b,d,c){b=b.toLowerCase(); +var e="text"===b;fa.hasOwnProperty(b)||(fa[b]=e?J.createTextNode(q.empty):J.createElement(b));b=fa[b].cloneNode(!1);w(d)&&(b.className=d);w(c)?a.insertBefore(b,c):a.appendChild(b);return b}function u(a,b,d,c,e){a=n(a,b,d,e);a.innerHTML=c;return a}function ha(a,b,d){var c=null;d=m(d,!1);C.getComputedStyle?c=J.defaultView.getComputedStyle(a,null).getPropertyValue(b):a.currentStyle&&(c=a.currentStyle[b]);d&&(c=parseFloat(c,10));return c}function x(a,b){a.className+=q.space+b;a.className=a.className.trim()} +function ia(a){a.preventDefault();a.cancelBubble=!0}function S(a){for(var b=a.children,d=b.length-1;d--;)a.appendChild(b[d])}function Ba(a,b,d,c){a=n(a,"div");a=n(a,"label","checkbox");var e=n(a,"input");e.type="checkbox";w(c)&&(e.onclick=c);w(d)&&(e.checked=d);n(a,"span","check-mark");u(a,"span","text",b);return{input:e,label:a}}function z(a){var b=null;Q(a)&&(b=a.apply(null,[].slice.call(arguments,1)));return b}function r(a,b){return v(a)?a:b}function m(a,b){return w(a)&&"boolean"===typeof a?a: +b}function Z(a,b){return wa(a)?a:b}function D(a,b){return Q(a)?a:b}function T(a,b){return L(a)?a:b}function ya(a){var b=!0,d=null;try{v(a)&&(d=la.parse(a))}catch(c){try{d=eval("("+a+")"),Q(d)&&(d=d())}catch(e){h.safeMode||(console.error(h.objectErrorText.replace("{{error_1}}",c.message).replace("{{error_2}}",e.message)),b=!1),d=null}}return{parsed:b,result:d}}function ba(){for(var a=[],b=0;32>b;b++){8!==b&&12!==b&&16!==b&&20!==b||a.push(q.dash);var d=I.floor(16*I.random()).toString(16);a.push(d)}return a.join(q.empty)} +function U(a){a=a.toString();return 1===a.length?q.zero+a:a}function Ha(a,b){return a.substring(0,b.length).toLowerCase()===b.toLowerCase()}function N(a){return a.getFullYear()+q.dash+U(a.getMonth()+1)+q.dash+U(a.getDate())}function Ca(a,b){b=m(b,!0);var d=!0,c=a.currentView.year;for(c--;!Y(a,c);){if(0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]){d=!1;break}c++}d&&(a.currentView.year=c,A(a),b&&z(a.events.onBackYear,a.currentView.year))}function Qa(a){a.currentView.element.innerHTML=q.empty;var b=a.currentView.element;b.className=b.className.replace("heat-js",q.empty);b.className=b.className.trim();Ia(a,!1);J.body.removeChild(a.currentView.tooltip);a.currentView.isInFetchMode&&w(a.currentView.isInFetchModeTimer)&& +clearInterval(a.currentView.isInFetchModeTimer);z(a.events.onDestroy,a.currentView.element)}function Ra(a){h=L(a)?a:{};h.safeMode=m(h.safeMode,!0);a=h;var b=h.domElementTypes,d=["*"];v(b)?(b=b.split(q.space),0===b.length&&(b=d)):b=aa(b)?b:d;a.domElementTypes=b;h.stText=r(h.stText,"st");h.ndText=r(h.ndText,"nd");h.rdText=r(h.rdText,"rd");h.thText=r(h.thText,"th");h.backButtonText=r(h.backButtonText,"Back");h.nextButtonText=r(h.nextButtonText,"Next");h.refreshButtonText=r(h.refreshButtonText,"Refresh"); +h.exportButtonText=r(h.exportButtonText,"Export");h.lessText=r(h.lessText,"Less");h.moreText=r(h.moreText,"More");h.dateText=r(h.dateText,"Date");h.countText=r(h.countText,"Count");h.mapText=r(h.mapText,"Map");h.chartText=r(h.chartText,"Chart");h.noChartDataMessage=r(h.noChartDataMessage,"There is currently no data to view.");h.statisticsText=r(h.statisticsText,"Statistics");h.noStatisticsDataMessage=r(h.noStatisticsDataMessage,"There are currently no statistics to view.");h.unknownTrendText=r(h.unknownTrendText, +"Unknown");h.importButtonText=r(h.importButtonText,"Import");h.noMapDataMessage=r(h.noMapDataMessage,"There is currently no data to view.");h.objectErrorText=r(h.objectErrorText,"Errors in object: {{error_1}}, {{error_2}}");h.attributeNotValidErrorText=r(h.attributeNotValidErrorText,"The attribute '{{attribute_name}}' is not a valid object.");h.attributeNotSetErrorText=r(h.attributeNotSetErrorText,"The attribute '{{attribute_name}}' has not been set correctly.");h.closeToolTipText=r(h.closeToolTipText, +"Close");h.configurationToolTipText=r(h.configurationToolTipText,"Configuration");h.configurationTitleText=r(h.configurationTitleText,"Configuration");h.visibleMonthsText=r(h.visibleMonthsText,"Visible Months");h.visibleDaysText=r(h.visibleDaysText,"Visible Days");h.dataText=r(h.dataText,"Data");h.colorRangesText=r(h.colorRangesText,"Color Ranges");h.yearText=r(h.yearText,"Year");h.daysText=r(h.daysText,"Days");h.noDaysDataMessage=r(h.noDaysDataMessage,"There are currently no days to view.");P(h.monthNames, +12)&&(h.monthNames="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "));P(h.dayNames,7)&&(h.dayNames="Mon Tue Wed Thu Fri Sat Sun".split(" "))}function P(a,b){b=wa(b)?b:1;return!aa(a)||a.lengthd&&(a.currentView.year=d,Y(a,a.currentView.year)?A(a):Ca(a,!1),z(a.events.onSetYear, +a.currentView.year))}return p};p.moveToPreviousYear=function(a){v(a)&&k.hasOwnProperty(a)&&Ca(k[a].options);return p};p.moveToNextYear=function(a){v(a)&&k.hasOwnProperty(a)&&ja(k[a].options);return p};p.moveToCurrentYear=function(a){v(a)&&k.hasOwnProperty(a)&&(a=k[a].options,a.currentView.year=(new Date).getFullYear(),Y(a,a.currentView.year)?A(a):ja(a,!1),z(a.events.onSetYear,a.currentView.year));return p};p.getYear=function(a){var b=null;v(a)&&k.hasOwnProperty(a)&&(b=k[a].options.currentView.year); +return b};p.render=function(a,b){L(a)&&L(b)&&Ea(Fa(b,a));return p};p.renderAll=function(){Da();return p};p.switchView=function(a,b){if(v(a)&&v(b)&&k.hasOwnProperty(a)){a=k[a].options;var d=null;"map"===b.toLowerCase()?d=1:"chart"===b.toLowerCase()?d=2:"days"===b.toLowerCase()?d=3:"statistics"===b.toLowerCase()&&(d=4);wa(d)&&(a.currentView.view=d,z(a.events.onViewSwitch,b),A(a,!1,!0))}return p};p.switchType=function(a,b){v(a)&&v(b)&&k.hasOwnProperty(a)&&k[a].type.hasOwnProperty(b)&&(a=k[a].options, +a.currentView.type!==b&&(a.currentView.type=b,z(a.events.onTypeSwitch,b),A(a)));return p};p.updateOptions=function(a,b){if(v(a)&&L(b)&&k.hasOwnProperty(a)){a=k[a].options;b=Ga(b);var d=!1,c;for(c in b)b.hasOwnProperty(c)&&a.hasOwnProperty(c)&&a[c]!==b[c]&&(a[c]=b[c],d=!0);d&&(A(a,!0),z(a.events.onRefresh,a.currentView.element),z(a.events.onOptionsUpdate,a.currentView.element,a))}return p};p.destroyAll=function(){for(var a in k)k.hasOwnProperty(a)&&Qa(k[a].options);k={};return p};p.destroy=function(a){v(a)&& k.hasOwnProperty(a)&&(Qa(k[a].options),delete k[a]);return p};p.setConfiguration=function(a,b){if(L(a)){var d=!1,c;for(c in a)a.hasOwnProperty(c)&&h.hasOwnProperty(c)&&h[c]!==a[c]&&(h[c]=a[c],d=!0);d&&(b=m(b,!0),Ra(h),b&&p.refreshAll())}return p};p.getIds=function(){var a=[],b;for(b in k)k.hasOwnProperty(b)&&a.push(b);return a};p.getVersion=function(){return"3.1.0"};(function(a,b,d,c){J=a;C=b;I=d;la=c;Ra();J.addEventListener("DOMContentLoaded",function(){Da()});C.addEventListener("pagehide",function(){for(var e in k)if(k.hasOwnProperty(e)){var f= k[e].options;w(f.currentView.isInFetchModeTimer)&&clearInterval(f.currentView.isInFetchModeTimer)}});w(C.$heat)||(C.$heat=p)})(document,window,Math,JSON)})(); \ No newline at end of file diff --git a/src/heat.js b/src/heat.js index a564b7bd..556ddecb 100644 --- a/src/heat.js +++ b/src/heat.js @@ -152,7 +152,7 @@ bindingOptions.currentView.mapContentsScrollLeft = 0; bindingOptions.currentView.year = bindingOptions.year; bindingOptions.currentView.type = _configuration.unknownTrendText; - bindingOptions.currentView.isInFetchMode = isDefinedFunction( bindingOptions.onDataFetch ); + bindingOptions.currentView.isInFetchMode = isDefinedFunction( bindingOptions.events.onDataFetch ); bindingOptions.currentView.isInFetchModeTimer = null; bindingOptions.currentView.yearsAvailable = []; @@ -187,7 +187,7 @@ } function renderControl( bindingOptions ) { - fireCustomTrigger( bindingOptions.onBeforeRender, bindingOptions.currentView.element ); + fireCustomTrigger( bindingOptions.events.onBeforeRender, bindingOptions.currentView.element ); if ( !isDefinedString( bindingOptions.currentView.element.id ) ) { bindingOptions.currentView.element.id = newGuid(); @@ -203,7 +203,7 @@ createDateStorageForElement( bindingOptions.currentView.element.id, bindingOptions ); renderControlContainer( bindingOptions ); - fireCustomTrigger( bindingOptions.onRenderComplete, bindingOptions.currentView.element ); + fireCustomTrigger( bindingOptions.events.onRenderComplete, bindingOptions.currentView.element ); } function renderControlContainer( bindingOptions, isForDataRefresh, isForViewSwitch ) { @@ -440,7 +440,7 @@ if ( render ) { renderControlContainer( bindingOptions ); - fireCustomTrigger( bindingOptions.onOptionsUpdate, bindingOptions.currentView.element, bindingOptions ); + fireCustomTrigger( bindingOptions.events.onOptionsUpdate, bindingOptions.currentView.element, bindingOptions ); } else { hideToolTip( bindingOptions ); @@ -558,7 +558,7 @@ refresh.onclick = function() { renderControlContainer( bindingOptions ); - fireCustomTrigger( bindingOptions.onRefresh, bindingOptions.currentView.element ); + fireCustomTrigger( bindingOptions.events.onRefresh, bindingOptions.currentView.element ); }; } @@ -645,7 +645,7 @@ option.onclick = function() { bindingOptions.currentView.view = view; - fireCustomTrigger( bindingOptions.onViewSwitch, viewName ); + fireCustomTrigger( bindingOptions.events.onViewSwitch, viewName ); renderControlContainer( bindingOptions, false, true ); }; } @@ -689,7 +689,7 @@ bindingOptions.currentView.year = currentYear; renderControlContainer( bindingOptions ); - fireCustomTrigger( bindingOptions.onSetYear, bindingOptions.currentView.year ); + fireCustomTrigger( bindingOptions.events.onSetYear, bindingOptions.currentView.year ); }; if ( currentYear === actualYear ) { @@ -881,9 +881,9 @@ day.innerHTML = dateCount.toString(); } - if ( isDefinedFunction( bindingOptions.onDayClick ) ) { + if ( isDefinedFunction( bindingOptions.events.onDayClick ) ) { day.onclick = function() { - fireCustomTrigger( bindingOptions.onDayClick, date, dateCount ); + fireCustomTrigger( bindingOptions.events.onDayClick, date, dateCount ); }; } else { @@ -1061,9 +1061,9 @@ dayLine.style.visibility = "hidden"; } - if ( isDefinedFunction( bindingOptions.onDayClick ) ) { + if ( isDefinedFunction( bindingOptions.events.onDayClick ) ) { dayLine.onclick = function() { - fireCustomTrigger( bindingOptions.onDayClick, date, dateCount ); + fireCustomTrigger( bindingOptions.events.onDayClick, date, dateCount ); }; } else { @@ -1188,9 +1188,9 @@ addToolTip( dayLine, bindingOptions, dayCount.toString() ); - if ( isDefinedFunction( bindingOptions.onWeekDayClick ) ) { + if ( isDefinedFunction( bindingOptions.events.onWeekDayClick ) ) { dayLine.onclick = function() { - fireCustomTrigger( bindingOptions.onWeekDayClick, dayNumber, dayCount ); + fireCustomTrigger( bindingOptions.events.onWeekDayClick, dayNumber, dayCount ); }; } else { @@ -1348,9 +1348,9 @@ createElementWithHTML( rangeLine, "div", "count", rangeCount ); } - if ( isDefinedFunction( bindingOptions.onStatisticClick ) ) { + if ( isDefinedFunction( bindingOptions.events.onStatisticClick ) ) { rangeLine.onclick = function() { - fireCustomTrigger( bindingOptions.onStatisticClick, useColorRange ); + fireCustomTrigger( bindingOptions.events.onStatisticClick, useColorRange ); }; } else { @@ -1500,7 +1500,7 @@ if ( bindingOptions.currentView.type !== type ) { bindingOptions.currentView.type = type; - fireCustomTrigger( bindingOptions.onTypeSwitch, type ); + fireCustomTrigger( bindingOptions.events.onTypeSwitch, type ); renderControlContainer( bindingOptions ); } }; @@ -1561,8 +1561,8 @@ */ function renderDayToolTip( bindingOptions, day, date, dateCount ) { - if ( isDefinedFunction( bindingOptions.onDayToolTipRender ) ) { - addToolTip( day, bindingOptions, fireCustomTrigger( bindingOptions.onDayToolTipRender, date, dateCount ) ); + if ( isDefinedFunction( bindingOptions.events.onDayToolTipRender ) ) { + addToolTip( day, bindingOptions, fireCustomTrigger( bindingOptions.events.onDayToolTipRender, date, dateCount ) ); } else { var tooltip = getCustomFormattedDateText( bindingOptions.dayToolTipText, date ); @@ -1740,7 +1740,7 @@ function pullDataFromCustomTrigger( bindingOptions ) { var elementId = bindingOptions.currentView.element.id, - data = fireCustomTrigger( bindingOptions.onDataFetch, elementId ); + data = fireCustomTrigger( bindingOptions.events.onDataFetch, elementId ); if ( isDefinedObject( data ) ) { createDateStorageForElement( elementId, bindingOptions, false ); @@ -1804,7 +1804,7 @@ for ( var colorRangesIndex = 0; colorRangesIndex < colorRangesLength; colorRangesIndex++ ) { bindingOptions.colorRanges[ colorRangesIndex ].visible = flag; - fireCustomTrigger( bindingOptions.onColorRangeTypeToggle, bindingOptions.colorRanges[ colorRangesIndex ].id, flag ); + fireCustomTrigger( bindingOptions.events.onColorRangeTypeToggle, bindingOptions.colorRanges[ colorRangesIndex ].id, flag ); } renderControlContainer( bindingOptions ); @@ -1819,7 +1819,7 @@ if ( colorRange.id === id ) { colorRange.visible = !getDefaultBoolean( colorRange.visible, true ); - fireCustomTrigger( bindingOptions.onColorRangeTypeToggle, colorRange.id, colorRange.visible ); + fireCustomTrigger( bindingOptions.events.onColorRangeTypeToggle, colorRange.id, colorRange.visible ); renderControlContainer( bindingOptions ); break; } @@ -1971,7 +1971,7 @@ } if ( filesCompleted.length === filesLength ) { - fireCustomTrigger( bindingOptions.onImport, bindingOptions.currentView.element ); + fireCustomTrigger( bindingOptions.events.onImport, bindingOptions.currentView.element ); renderControlContainer( bindingOptions ); } }; @@ -2089,7 +2089,7 @@ _parameter_Document.body.removeChild( tempLink ); - fireCustomTrigger( bindingOptions.onExport, bindingOptions.currentView.element ); + fireCustomTrigger( bindingOptions.events.onExport, bindingOptions.currentView.element ); } } @@ -2255,44 +2255,20 @@ options.showOnlyDataForYearsAvailable = getDefaultBoolean( options.showOnlyDataForYearsAvailable, false ); options.showHolidaysInDayToolTips = getDefaultBoolean( options.showHolidaysInDayToolTips, false ); - options = buildAttributeOptionTitle( options ); - options = buildAttributeOptionGuide( options ); options = buildAttributeOptionColorRanges( options ); options = buildAttributeOptionHolidays( options ); + options = buildAttributeOptionStrings( options ); + options = buildAttributeOptionTitle( options ); + options = buildAttributeOptionGuide( options ); options = buildAttributeOptionMapView( options ); options = buildAttributeOptionChartView( options ); options = buildAttributeOptionDaysView( options ); options = buildAttributeOptionStatisticsView( options ); - options = buildAttributeOptionStrings( options ); options = buildAttributeOptionCustomTriggers( options ); return options; } - function buildAttributeOptionTitle( options ) { - options.title = getDefaultObject( options.title, {} ); - options.title.showText = getDefaultBoolean( options.title.showText, true ); - options.title.showYearSelector = getDefaultBoolean( options.title.showYearSelector, true ); - options.title.showRefreshButton = getDefaultBoolean( options.title.showRefreshButton, false ); - options.title.showExportButton = getDefaultBoolean( options.title.showExportButton, false ); - options.title.extraSelectionYears = getDefaultNumber( options.title.extraSelectionYears, 50 ); - options.title.showYearSelectionDropDown = getDefaultBoolean( options.title.showYearSelectionDropDown, true ); - options.title.showImportButton = getDefaultBoolean( options.title.showImportButton, false ); - options.title.showConfigurationButton = getDefaultBoolean( options.title.showConfigurationButton, true ); - - return options; - } - - function buildAttributeOptionGuide( options ) { - options.guide = getDefaultObject( options.guide, {} ); - options.guide.enabled = getDefaultBoolean( options.guide.enabled, true ); - options.guide.colorRangeTogglesEnabled = getDefaultBoolean( options.guide.colorRangeTogglesEnabled, true ); - options.guide.showLessAndMoreLabels = getDefaultBoolean( options.guide.showLessAndMoreLabels, true ); - options.guide.showNumbersInGuide = getDefaultBoolean( options.guide.showNumbersInGuide, false ); - - return options; - } - function buildAttributeOptionColorRanges( options ) { if ( isDefinedArray( options.colorRanges ) ) { var colorRangesLength = options.colorRanges.length; @@ -2370,6 +2346,37 @@ return options; } + function buildAttributeOptionStrings( options ) { + options.titleText = getDefaultString( options.titleText, "Heat.js" ); + options.dayToolTipText = getDefaultString( options.dayToolTipText, "{d}{o} {mmmm} {yyyy}" ); + + return options; + } + + function buildAttributeOptionTitle( options ) { + options.title = getDefaultObject( options.title, {} ); + options.title.showText = getDefaultBoolean( options.title.showText, true ); + options.title.showYearSelector = getDefaultBoolean( options.title.showYearSelector, true ); + options.title.showRefreshButton = getDefaultBoolean( options.title.showRefreshButton, false ); + options.title.showExportButton = getDefaultBoolean( options.title.showExportButton, false ); + options.title.extraSelectionYears = getDefaultNumber( options.title.extraSelectionYears, 50 ); + options.title.showYearSelectionDropDown = getDefaultBoolean( options.title.showYearSelectionDropDown, true ); + options.title.showImportButton = getDefaultBoolean( options.title.showImportButton, false ); + options.title.showConfigurationButton = getDefaultBoolean( options.title.showConfigurationButton, true ); + + return options; + } + + function buildAttributeOptionGuide( options ) { + options.guide = getDefaultObject( options.guide, {} ); + options.guide.enabled = getDefaultBoolean( options.guide.enabled, true ); + options.guide.colorRangeTogglesEnabled = getDefaultBoolean( options.guide.colorRangeTogglesEnabled, true ); + options.guide.showLessAndMoreLabels = getDefaultBoolean( options.guide.showLessAndMoreLabels, true ); + options.guide.showNumbersInGuide = getDefaultBoolean( options.guide.showNumbersInGuide, false ); + + return options; + } + function buildAttributeOptionMapView( options ) { options.views.map = getDefaultObject( options.views.map, {} ); options.views.map.showMonthDayGaps = getDefaultBoolean( options.views.map.showMonthDayGaps, true ); @@ -2455,37 +2462,31 @@ return options; } - function buildAttributeOptionStrings( options ) { - options.titleText = getDefaultString( options.titleText, "Heat.js" ); - options.dayToolTipText = getDefaultString( options.dayToolTipText, "{d}{o} {mmmm} {yyyy}" ); - - return options; - } - function buildAttributeOptionCustomTriggers( options ) { - options.onDayClick = getDefaultFunction( options.onDayClick, null ); - options.onBackYear = getDefaultFunction( options.onBackYear, null ); - options.onNextYear = getDefaultFunction( options.onNextYear, null ); - options.onRefresh = getDefaultFunction( options.onRefresh, null ); - options.onBeforeRender = getDefaultFunction( options.onBeforeRender, null ); - options.onRenderComplete = getDefaultFunction( options.onRenderComplete, null ); - options.onDestroy = getDefaultFunction( options.onDestroy, null ); - options.onExport = getDefaultFunction( options.onExport, null ); - options.onSetYear = getDefaultFunction( options.onSetYear, null ); - options.onTypeSwitch = getDefaultFunction( options.onTypeSwitch, null ); - options.onDayToolTipRender = getDefaultFunction( options.onDayToolTipRender, null ); - options.onAdd = getDefaultFunction( options.onAdd, null ); - options.onRemove = getDefaultFunction( options.onRemove, null ); - options.onReset = getDefaultFunction( options.onReset, null ); - options.onViewSwitch = getDefaultFunction( options.onViewSwitch, null ); - options.onColorRangeTypeToggle = getDefaultFunction( options.onColorRangeTypeToggle, null ); - options.onImport = getDefaultFunction( options.onImport, null ); - options.onStatisticClick = getDefaultFunction( options.onStatisticClick, null ); - options.onDataFetch = getDefaultFunction( options.onDataFetch, null ); - options.onClear = getDefaultFunction( options.onClear, null ); - options.onUpdate = getDefaultFunction( options.onUpdate, null ); - options.onOptionsUpdate = getDefaultFunction( options.onOptionsUpdate, null ); - options.onWeekDayClick = getDefaultFunction( options.onWeekDayClick, null ); + options.events = getDefaultObject( options.events, {} ); + options.events.onDayClick = getDefaultFunction( options.events.onDayClick, null ); + options.events.onBackYear = getDefaultFunction( options.events.onBackYear, null ); + options.events.onNextYear = getDefaultFunction( options.events.onNextYear, null ); + options.events.onRefresh = getDefaultFunction( options.events.onRefresh, null ); + options.events.onBeforeRender = getDefaultFunction( options.events.onBeforeRender, null ); + options.events.onRenderComplete = getDefaultFunction( options.events.onRenderComplete, null ); + options.events.onDestroy = getDefaultFunction( options.events.onDestroy, null ); + options.events.onExport = getDefaultFunction( options.events.onExport, null ); + options.events.onSetYear = getDefaultFunction( options.events.onSetYear, null ); + options.events.onTypeSwitch = getDefaultFunction( options.events.onTypeSwitch, null ); + options.events.onDayToolTipRender = getDefaultFunction( options.events.onDayToolTipRender, null ); + options.events.onAdd = getDefaultFunction( options.events.onAdd, null ); + options.events.onRemove = getDefaultFunction( options.events.onRemove, null ); + options.events.onReset = getDefaultFunction( options.events.onReset, null ); + options.events.onViewSwitch = getDefaultFunction( options.events.onViewSwitch, null ); + options.events.onColorRangeTypeToggle = getDefaultFunction( options.events.onColorRangeTypeToggle, null ); + options.events.onImport = getDefaultFunction( options.events.onImport, null ); + options.events.onStatisticClick = getDefaultFunction( options.events.onStatisticClick, null ); + options.events.onDataFetch = getDefaultFunction( options.events.onDataFetch, null ); + options.events.onClear = getDefaultFunction( options.events.onClear, null ); + options.events.onUpdate = getDefaultFunction( options.events.onUpdate, null ); + options.events.onOptionsUpdate = getDefaultFunction( options.events.onOptionsUpdate, null ); + options.events.onWeekDayClick = getDefaultFunction( options.events.onWeekDayClick, null ); return options; } @@ -2970,7 +2971,7 @@ _elements_DateCounts[ elementId ].type[ type ][ storageDate ]++; - fireCustomTrigger( bindingOptions.onAdd, bindingOptions.currentView.element ); + fireCustomTrigger( bindingOptions.events.onAdd, bindingOptions.currentView.element ); if ( triggerRefresh ) { renderControlContainer( bindingOptions, true ); @@ -3011,7 +3012,7 @@ _elements_DateCounts[ elementId ].type[ type ][ storageDate ] = count; - fireCustomTrigger( bindingOptions.onUpdate, bindingOptions.currentView.element ); + fireCustomTrigger( bindingOptions.events.onUpdate, bindingOptions.currentView.element ); if ( triggerRefresh ) { renderControlContainer( bindingOptions, true ); @@ -3092,7 +3093,7 @@ _elements_DateCounts[ elementId ].type[ type ][ storageDate ]--; } - fireCustomTrigger( bindingOptions.onRemove, bindingOptions.currentView.element ); + fireCustomTrigger( bindingOptions.events.onRemove, bindingOptions.currentView.element ); if ( triggerRefresh ) { renderControlContainer( bindingOptions, true ); @@ -3133,7 +3134,7 @@ delete _elements_DateCounts[ elementId ].type[ type ][ storageDate ]; - fireCustomTrigger( bindingOptions.onClear, bindingOptions.currentView.element ); + fireCustomTrigger( bindingOptions.events.onClear, bindingOptions.currentView.element ); if ( triggerRefresh ) { renderControlContainer( bindingOptions, true ); @@ -3190,7 +3191,7 @@ bindingOptions.currentView.type = _configuration.unknownTrendText; createDateStorageForElement( elementId, bindingOptions, false ); - fireCustomTrigger( bindingOptions.onReset, bindingOptions.currentView.element ); + fireCustomTrigger( bindingOptions.events.onReset, bindingOptions.currentView.element ); if ( triggerRefresh ) { renderControlContainer( bindingOptions, true ); @@ -3246,7 +3247,7 @@ var bindingOptions = _elements_DateCounts[ elementId ].options; renderControlContainer( bindingOptions, true ); - fireCustomTrigger( bindingOptions.onRefresh, bindingOptions.currentView.element ); + fireCustomTrigger( bindingOptions.events.onRefresh, bindingOptions.currentView.element ); } return _public; @@ -3268,7 +3269,7 @@ var bindingOptions = _elements_DateCounts[ elementId ].options; renderControlContainer( bindingOptions, true ); - fireCustomTrigger( bindingOptions.onRefresh, bindingOptions.currentView.element ); + fireCustomTrigger( bindingOptions.events.onRefresh, bindingOptions.currentView.element ); } } @@ -3299,7 +3300,7 @@ renderControlContainer( bindingOptions ); } - fireCustomTrigger( bindingOptions.onSetYear, bindingOptions.currentView.year ); + fireCustomTrigger( bindingOptions.events.onSetYear, bindingOptions.currentView.year ); } return _public; @@ -3338,7 +3339,7 @@ renderControlContainer( bindingOptions ); } - fireCustomTrigger( bindingOptions.onSetYear, bindingOptions.currentView.year ); + fireCustomTrigger( bindingOptions.events.onSetYear, bindingOptions.currentView.year ); } } @@ -3378,7 +3379,7 @@ renderControlContainer( bindingOptions ); } - fireCustomTrigger( bindingOptions.onSetYear, bindingOptions.currentView.year ); + fireCustomTrigger( bindingOptions.events.onSetYear, bindingOptions.currentView.year ); } } @@ -3448,7 +3449,7 @@ renderControlContainer( bindingOptions ); } - fireCustomTrigger( bindingOptions.onSetYear, bindingOptions.currentView.year ); + fireCustomTrigger( bindingOptions.events.onSetYear, bindingOptions.currentView.year ); } return _public; @@ -3543,7 +3544,7 @@ if ( isDefinedNumber( view ) ) { bindingOptions.currentView.view = view; - fireCustomTrigger( bindingOptions.onViewSwitch, viewName ); + fireCustomTrigger( bindingOptions.events.onViewSwitch, viewName ); renderControlContainer( bindingOptions, false, true ); } } @@ -3571,7 +3572,7 @@ if ( bindingOptions.currentView.type !== type ) { bindingOptions.currentView.type = type; - fireCustomTrigger( bindingOptions.onTypeSwitch, type ); + fireCustomTrigger( bindingOptions.events.onTypeSwitch, type ); renderControlContainer( bindingOptions ); } } @@ -3608,8 +3609,8 @@ if ( optionChanged ) { renderControlContainer( bindingOptions, true ); - fireCustomTrigger( bindingOptions.onRefresh, bindingOptions.currentView.element ); - fireCustomTrigger( bindingOptions.onOptionsUpdate, bindingOptions.currentView.element, bindingOptions ); + fireCustomTrigger( bindingOptions.events.onRefresh, bindingOptions.currentView.element ); + fireCustomTrigger( bindingOptions.events.onOptionsUpdate, bindingOptions.currentView.element, bindingOptions ); } } @@ -3639,7 +3640,7 @@ renderControlContainer( bindingOptions ); if ( callCustomTrigger ) { - fireCustomTrigger( bindingOptions.onBackYear, bindingOptions.currentView.year ); + fireCustomTrigger( bindingOptions.events.onBackYear, bindingOptions.currentView.year ); } } } @@ -3667,7 +3668,7 @@ renderControlContainer( bindingOptions ); if ( callCustomTrigger ) { - fireCustomTrigger( bindingOptions.onBackYear, bindingOptions.currentView.year ); + fireCustomTrigger( bindingOptions.events.onBackYear, bindingOptions.currentView.year ); } } } @@ -3735,7 +3736,7 @@ clearInterval( bindingOptions.currentView.isInFetchModeTimer ); } - fireCustomTrigger( bindingOptions.onDestroy, bindingOptions.currentView.element ); + fireCustomTrigger( bindingOptions.events.onDestroy, bindingOptions.currentView.element ); } diff --git a/test/dist/heat.js.basic.html b/test/dist/heat.js.basic.html index fbc4fbb0..62cb05ff 100644 --- a/test/dist/heat.js.basic.html +++ b/test/dist/heat.js.basic.html @@ -16,7 +16,7 @@

Heat.js - Basic

-
+
diff --git a/test/dist/heat.js.bootstrap.html b/test/dist/heat.js.bootstrap.html index 636ae928..1196b6bc 100644 --- a/test/dist/heat.js.bootstrap.html +++ b/test/dist/heat.js.bootstrap.html @@ -17,13 +17,13 @@

Heat.js - Bootstrap

-
+


-
+


-
+


diff --git a/test/dist/heat.js.data-pull.html b/test/dist/heat.js.data-pull.html index ba127dce..fafa24cf 100644 --- a/test/dist/heat.js.data-pull.html +++ b/test/dist/heat.js.data-pull.html @@ -16,7 +16,7 @@

Heat.js - Data Pull

-
+
diff --git a/test/dist/heat.js.map-only.html b/test/dist/heat.js.map-only.html index c2e64558..6c92d9eb 100644 --- a/test/dist/heat.js.map-only.html +++ b/test/dist/heat.js.map-only.html @@ -16,7 +16,7 @@

Heat.js - Only Map

-
+
diff --git a/test/dist/heat.js.min.html b/test/dist/heat.js.min.html index af8f3509..4f41b3e3 100644 --- a/test/dist/heat.js.min.html +++ b/test/dist/heat.js.min.html @@ -16,7 +16,7 @@

Heat.js - Minimized

-
+
diff --git a/test/dist/heat.js.numbers.html b/test/dist/heat.js.numbers.html index 859e03f9..5955ea71 100644 --- a/test/dist/heat.js.numbers.html +++ b/test/dist/heat.js.numbers.html @@ -16,7 +16,7 @@

Heat.js - Numbers

-
+
diff --git a/test/dist/heat.js.theme.html b/test/dist/heat.js.theme.html index 61003cfa..c3f26490 100644 --- a/test/dist/heat.js.theme.html +++ b/test/dist/heat.js.theme.html @@ -17,7 +17,7 @@

Heat.js - Theme

-
+
diff --git a/test/dist/heat.js.translations.html b/test/dist/heat.js.translations.html index 6f39584c..ca6647ef 100644 --- a/test/dist/heat.js.translations.html +++ b/test/dist/heat.js.translations.html @@ -17,7 +17,7 @@

Heat.js - Translations

-
+
diff --git a/test/src/heat.js.basic.html b/test/src/heat.js.basic.html index 573222d6..61ffc62d 100644 --- a/test/src/heat.js.basic.html +++ b/test/src/heat.js.basic.html @@ -16,7 +16,7 @@

Heat.js - Basic

-
+
diff --git a/test/src/heat.js.bootstrap.html b/test/src/heat.js.bootstrap.html index f408b021..47949136 100644 --- a/test/src/heat.js.bootstrap.html +++ b/test/src/heat.js.bootstrap.html @@ -17,13 +17,13 @@

Heat.js - Bootstrap

-
+


-
+


-
+


diff --git a/test/src/heat.js.data-pull.html b/test/src/heat.js.data-pull.html index 0cd968ea..e3419ce8 100644 --- a/test/src/heat.js.data-pull.html +++ b/test/src/heat.js.data-pull.html @@ -16,7 +16,7 @@

Heat.js - Data Pull

-
+
diff --git a/test/src/heat.js.map-only.html b/test/src/heat.js.map-only.html index a5863bbd..6c0b807c 100644 --- a/test/src/heat.js.map-only.html +++ b/test/src/heat.js.map-only.html @@ -16,7 +16,7 @@

Heat.js - Only Map

-
+
diff --git a/test/src/heat.js.numbers.html b/test/src/heat.js.numbers.html index 5b07106a..28e6219b 100644 --- a/test/src/heat.js.numbers.html +++ b/test/src/heat.js.numbers.html @@ -16,7 +16,7 @@

Heat.js - Numbers

-
+
diff --git a/test/src/heat.js.theme.html b/test/src/heat.js.theme.html index b08cfcec..fd4d96f7 100644 --- a/test/src/heat.js.theme.html +++ b/test/src/heat.js.theme.html @@ -17,7 +17,7 @@

Heat.js - Theme

-
+
diff --git a/test/src/heat.js.translations.html b/test/src/heat.js.translations.html index 218bab0b..afe06798 100644 --- a/test/src/heat.js.translations.html +++ b/test/src/heat.js.translations.html @@ -17,7 +17,7 @@

Heat.js - Translations

-
+
From 8c6f7165b0cf0ab63e9d0ebf6e5cb63c96bf6943 Mon Sep 17 00:00:00 2001 From: William Troup Date: Tue, 2 Apr 2024 18:05:46 +0100 Subject: [PATCH 09/10] BREAKING: All binding options for descriptions (text and link) are now available under a new area called "description". --- dist/heat.js | 21 +++-- dist/heat.min.js | 92 ++++++++++----------- src/heat.js | 23 ++++-- test/dist/heat.js.basic.html | 2 +- test/dist/heat.js.bootstrap.html | 2 +- test/dist/heat.js.local-storage.html | 2 +- test/dist/heat.js.map-only.html | 2 +- test/dist/heat.js.numbers.html | 2 +- test/dist/heat.js.only-years-available.html | 2 +- test/dist/heat.js.theme.html | 2 +- test/dist/heat.js.view-colors.html | 4 +- test/src/heat.js.basic.html | 2 +- test/src/heat.js.bootstrap.html | 2 +- test/src/heat.js.local-storage.html | 2 +- test/src/heat.js.map-only.html | 2 +- test/src/heat.js.numbers.html | 2 +- test/src/heat.js.only-years-available.html | 2 +- test/src/heat.js.theme.html | 2 +- test/src/heat.js.view-colors.html | 4 +- 19 files changed, 94 insertions(+), 78 deletions(-) diff --git a/dist/heat.js b/dist/heat.js index 1304a48f..5dd9fb9c 100644 --- a/dist/heat.js +++ b/dist/heat.js @@ -904,7 +904,7 @@ } } if (_elements_DateCounts[bindingOptions.currentView.element.id].types > 1) { - if (isDefinedString(bindingOptions.descriptionText)) { + if (isDefinedString(bindingOptions.description.text)) { var description = createElement(bindingOptions.currentView.element, "div", "description", guide); renderDescription(bindingOptions, description); } @@ -988,13 +988,13 @@ } } function renderDescription(bindingOptions, container) { - if (isDefinedString(bindingOptions.descriptionText)) { - if (isDefinedString(bindingOptions.descriptionTextLink)) { - var link = createElementWithHTML(container, "a", "label", bindingOptions.descriptionText); - link.href = bindingOptions.descriptionTextLink; + if (isDefinedString(bindingOptions.description.text)) { + if (isDefinedString(bindingOptions.description.url)) { + var link = createElementWithHTML(container, "a", "label", bindingOptions.description.text); + link.href = bindingOptions.description.url; link.target = "_blank"; } else { - createElementWithHTML(container, "span", "label", bindingOptions.descriptionText); + createElementWithHTML(container, "span", "label", bindingOptions.description.text); } } } @@ -1446,8 +1446,6 @@ options.view = getDefaultString(options.view, _elements_View_Name_Map); options.tooltipDelay = getDefaultNumber(options.tooltipDelay, 750); options.exportType = getDefaultString(options.exportType, _export_Type_Csv); - options.descriptionText = getDefaultString(options.descriptionText, null); - options.descriptionTextLink = getDefaultString(options.descriptionTextLink, null); options.useLocalStorageForData = getDefaultBoolean(options.useLocalStorageForData, false); options.allowFileImports = getDefaultBoolean(options.allowFileImports, true); options.yearsToHide = getDefaultArray(options.yearsToHide, []); @@ -1458,6 +1456,7 @@ options = buildAttributeOptionHolidays(options); options = buildAttributeOptionStrings(options); options = buildAttributeOptionTitle(options); + options = buildAttributeOptionDescription(options); options = buildAttributeOptionGuide(options); options = buildAttributeOptionMapView(options); options = buildAttributeOptionChartView(options); @@ -1517,6 +1516,12 @@ options.title.showConfigurationButton = getDefaultBoolean(options.title.showConfigurationButton, true); return options; } + function buildAttributeOptionDescription(options) { + options.description = getDefaultObject(options.description, {}); + options.description.text = getDefaultString(options.description.text, null); + options.description.url = getDefaultString(options.description.url, null); + return options; + } function buildAttributeOptionGuide(options) { options.guide = getDefaultObject(options.guide, {}); options.guide.enabled = getDefaultBoolean(options.guide.enabled, true); diff --git a/dist/heat.min.js b/dist/heat.min.js index 14a884b9..2ab9b365 100644 --- a/dist/heat.min.js +++ b/dist/heat.min.js @@ -1,22 +1,22 @@ /*! Heat.js v3.1.0 | (c) Bunoon 2024 | MIT License */ (function(){function Da(){for(var a=h.domElementTypes,b=a.length,d=0;dc;c++)R(a.views.map.daysToShow,c+1)&&u(f,"div","day-name",g&&0!==c%3?q.space:h.dayNames[c]);a.views.map.showDaysInReverseOrder&&S(f)}f=n(e,"div","months");e=na(a);for(g=0;12>g;g++)if(V(a.views.map.monthsToShow,g)){c=n(f,"div","month");var t=n(c, -"div","day-columns");var y=da(l,g),E=n(t,"div","day-column"),B=!1,F=oa(new Date(l,g,1)),G=1;y+=F;for(var H=0;H=F?B=!0:R(a.views.map.daysToShow,G)&&n(E,"div","day-disabled");if(B){var K=null;R(a.views.map.daysToShow,G)&&(K=Xa(a,E,H-F,g,l,e));if(0===(H+1)%7&&(a.views.map.showDaysInReverseOrder&&S(E),E=n(t,"div","day-column"),G=0,!w(ea)&&w(K))){var Ya=ha(K,"margin-left",!0),Za=ha(K,"margin-right",!0);ea=K.offsetWidth+Ya+Za}}G++}a.views.map.showMonthNames&&(E=c.offsetWidth,y=a.views.map.placeMonthNamesOnTheBottom? -u(c,"div","month-name-bottom",h.monthNames[g]):u(c,"div","month-name",h.monthNames[g],t),w(y)&&(y.style.width=a.views.map.showMonthDayGaps?E+"px":E-ea+"px"));b&&w(ea)&&(0c;c++)S(a.views.map.daysToShow,c+1)&&u(f,"div","day-name",g&&0!==c%3?q.space:h.dayNames[c]);a.views.map.showDaysInReverseOrder&&T(f)}f=n(e,"div","months");e=na(a);for(g=0;12>g;g++)if(V(a.views.map.monthsToShow,g)){c=n(f,"div","month");var t=n(c, +"div","day-columns");var y=da(l,g),E=n(t,"div","day-column"),B=!1,F=oa(new Date(l,g,1)),G=1;y+=F;for(var H=0;H=F?B=!0:S(a.views.map.daysToShow,G)&&n(E,"div","day-disabled");if(B){var K=null;S(a.views.map.daysToShow,G)&&(K=Xa(a,E,H-F,g,l,e));if(0===(H+1)%7&&(a.views.map.showDaysInReverseOrder&&T(E),E=n(t,"div","day-column"),G=0,!w(ea)&&w(K))){var Ya=ha(K,"margin-left",!0),Za=ha(K,"margin-right",!0);ea=K.offsetWidth+Ya+Za}}G++}a.views.map.showMonthNames&&(E=c.offsetWidth,y=a.views.map.placeMonthNamesOnTheBottom? +u(c,"div","month-name-bottom",h.monthNames[g]):u(c,"div","month-name",h.monthNames[g],t),w(y)&&(y.style.width=a.views.map.showMonthDayGaps?E+"px":E-ea+"px"));b&&w(ea)&&(0y;y++)for(E=da(a.currentView.year,y),B=0;BF;F++)for(y=da(a.currentView.year,F),E=0;Ey;y++)a.currentView.dayCheckBoxes[y].checked&&g.push(y+1);for(y=0;12>y;y++)a.currentView.monthCheckBoxes[y].checked&&l.push(y+1);1<=g.length&&(1===a.currentView.view? @@ -27,26 +27,26 @@ e+c.offsetWidth>C.innerWidth?e-=c.offsetWidth:e++;f+c.offsetHeight>C.innerHeight a.title.showExportButton||a.title.showImportButton){var b=n(a.currentView.element,"div","title-bar"),d=n(b,"div","title");a.views.chart.enabled||a.views.days.enabled||a.views.statistics.enabled?n(d,"div","down-arrow"):x(d,"no-click");a.title.showText&&(d.innerHTML+=a.titleText);(a.views.chart.enabled||a.views.days.enabled||a.views.statistics.enabled)&&db(a,d);a.title.showImportButton&&!a.currentView.isInFetchMode&&(u(b,"button","import",h.importButtonText).onclick=function(){eb(a)});a.title.showExportButton&& (u(b,"button","export",h.exportButtonText).onclick=function(){Ka(a)});a.title.showRefreshButton&&(u(b,"button","refresh",h.refreshButtonText).onclick=function(){A(a);z(a.events.onRefresh,a.currentView.element)});a.title.showYearSelector&&(d=u(b,"button","back",h.backButtonText),d.onclick=function(){Ca(a)},0f;f++)a.currentView.dayCheckBoxes[f].checked=R(c,f+1);for(c=0;12>c;c++)a.currentView.monthCheckBoxes[c].checked= +var e=a.views.map.monthsToShow}else a.views.chart.enabled&&2===a.currentView.view?(c=a.views.chart.daysToShow,e=a.views.chart.monthsToShow):a.views.days.enabled&&3===a.currentView.view?(c=a.views.days.daysToShow,e=a.views.days.monthsToShow):a.views.statistics.enabled&&4===a.currentView.view?(c=a.views.statistics.daysToShow,e=a.views.statistics.monthsToShow):(c=a.views.map.daysToShow,e=a.views.map.monthsToShow);for(var f=0;7>f;f++)a.currentView.dayCheckBoxes[f].checked=S(c,f+1);for(c=0;12>c;c++)a.currentView.monthCheckBoxes[c].checked= V(e,c);ca(a)}),b=u(b,"button","next",h.nextButtonText),b.onclick=function(){ja(a)},0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]&&(b.disabled=!0))}}function db(a,b){b=n(b,"div","titles-menu-container");b=n(b,"div","titles-menu");u(b,"div","title-menu-header",h.dataText+q.colon);var d=u(b,"div","title-menu-item",h.mapText);qa(a,d,1,"map");a.views.chart.enabled&&(d=u(b,"div","title-menu-item",h.chartText),qa(a,d,2,"chart")); a.views.days.enabled&&(u(b,"div","title-menu-header",h.yearText+q.colon),d=u(b,"div","title-menu-item",h.daysText),qa(a,d,3,"days"));a.views.statistics.enabled&&(u(b,"div","title-menu-header",h.statisticsText+q.colon),b=u(b,"div","title-menu-item",h.colorRangesText),qa(a,b,4,"statistics"))}function qa(a,b,d,c){a.currentView.view===d?x(b,"title-menu-item-active"):b.onclick=function(){a.currentView.view=d;z(a.events.onViewSwitch,c);A(a,!1,!0)}}function fb(a){n(a.currentView.yearText,"div","down-arrow"); var b=n(a.currentView.yearText,"div","years-menu-container"),d=n(b,"div","years-menu"),c=(new Date).getFullYear(),e=null;b.style.display="block";b.style.visibility="hidden";for(var f=c-a.title.extraSelectionYears;fg;g++)if(V(a.views.chart.monthsToShow,g)){y=da(l,g);var E=1;d++;for(var B=0;Bl;l++)f(l);F.style.width=e.offsetWidth+"px";e=n(F,"div","month-name-space");e.style.height=F.offsetHeight+"px";e.style.width=t+"px"}a.views.chart.keepScrollPositions&& -(a.currentView.chartContents.scrollLeft=a.currentView.chartContentsScrollLeft)}}function ib(a,b,d,c,e,f,g){var l=new Date(e,c,d);a=n(a,"div","day-line");var t=M(b)[N(l)];t=Z(t,0);La(b,a,l,t);b.views.chart.showLineNumbers&&0=g&&(a.style.visibility="hidden");Q(b.events.onDayClick)?a.onclick=function(){z(b.events.onDayClick,l,t)}:x(a,"no-hover");f=Aa(b,f,t,l);w(f)&&ra(b,f.id)&&(v(f.chartCssClassName)?x(a,f.chartCssClassName): -x(a,f.cssClassName))}function hb(a){for(var b=0,d=M(a),c=0;12>c;c++)for(var e=da(a.currentView.year,c),f=0;f=e&&(a.style.visibility="hidden");X(a,c,d.toString());Q(c.events.onWeekDayClick)?a.onclick=function(){z(c.events.onWeekDayClick,b,d)}:x(a,"no-hover"); -c.views.days.showDayNumbers&&0=a&&(b.style.visibility="hidden");X(b,c,d.toString());c.views.statistics.showRangeNumbers&&0g;g++)if(V(a.views.chart.monthsToShow,g)){y=da(l,g);var E=1;d++;for(var B=0;Bl;l++)f(l);F.style.width=e.offsetWidth+"px";e=n(F,"div","month-name-space");e.style.height=F.offsetHeight+"px";e.style.width=t+"px"}a.views.chart.keepScrollPositions&& +(a.currentView.chartContents.scrollLeft=a.currentView.chartContentsScrollLeft)}}function ib(a,b,d,c,e,f,g){var l=new Date(e,c,d);a=n(a,"div","day-line");var t=M(b)[N(l)];t=Z(t,0);La(b,a,l,t);b.views.chart.showLineNumbers&&0=g&&(a.style.visibility="hidden");R(b.events.onDayClick)?a.onclick=function(){z(b.events.onDayClick,l,t)}:x(a,"no-hover");f=Aa(b,f,t,l);w(f)&&ra(b,f.id)&&(v(f.chartCssClassName)?x(a,f.chartCssClassName): +x(a,f.cssClassName))}function hb(a){for(var b=0,d=M(a),c=0;12>c;c++)for(var e=da(a.currentView.year,c),f=0;f=e&&(a.style.visibility="hidden");X(a,c,d.toString());R(c.events.onWeekDayClick)?a.onclick=function(){z(c.events.onWeekDayClick,b,d)}:x(a,"no-hover"); +c.views.days.showDayNumbers&&0=a&&(b.style.visibility="hidden");X(b,c,d.toString());c.views.statistics.showRangeNumbers&&0ka.notFound}function R(a,b){return a.indexOf(b)>ka.notFound}function Sa(a){var b=[];if(a.showOnlyDataForYearsAvailable){a=M(a);for(var d in a)if(a.hasOwnProperty(d)){var c= -parseInt(d.split(q.dash)[0]);b.indexOf(c)===ka.notFound&&b.push(c)}}return b=b.sort(function(e,f){return e-f})}function Y(a,b){return a.yearsToHide.indexOf(b)===ka.notFound&&(0===a.currentView.yearsAvailable.length||a.currentView.yearsAvailable.indexOf(b)>ka.notFound)}function Ta(a){a.currentView.isInFetchMode&&(w(a.currentView.isInFetchModeTimer)||Oa(a),w(a.currentView.isInFetchModeTimer)||(a.currentView.isInFetchModeTimer=setInterval(function(){Oa(a);A(a)},a.dataFetchDelay)))}function Oa(a){var b= -a.currentView.element.id,d=z(a.events.onDataFetch,b);if(L(d)){za(b,a,!1);for(var c in d)d.hasOwnProperty(c)&&(k[b].type[h.unknownTrendText].hasOwnProperty(c)||(k[b].type[h.unknownTrendText][c]=0),k[b].type[h.unknownTrendText][c]+=d[c])}}function ra(a,b){var d=!1;if("HOLIDAY"===b)d=!0;else for(var c=a.colorRanges.length,e=0;eka.notFound}function S(a,b){return a.indexOf(b)>ka.notFound}function Sa(a){var b=[];if(a.showOnlyDataForYearsAvailable){a=M(a);for(var d in a)if(a.hasOwnProperty(d)){var c=parseInt(d.split(q.dash)[0]); +b.indexOf(c)===ka.notFound&&b.push(c)}}return b=b.sort(function(e,f){return e-f})}function Y(a,b){return a.yearsToHide.indexOf(b)===ka.notFound&&(0===a.currentView.yearsAvailable.length||a.currentView.yearsAvailable.indexOf(b)>ka.notFound)}function Ta(a){a.currentView.isInFetchMode&&(w(a.currentView.isInFetchModeTimer)||Oa(a),w(a.currentView.isInFetchModeTimer)||(a.currentView.isInFetchModeTimer=setInterval(function(){Oa(a);A(a)},a.dataFetchDelay)))}function Oa(a){var b=a.currentView.element.id,d= +z(a.events.onDataFetch,b);if(L(d)){za(b,a,!1);for(var c in d)d.hasOwnProperty(c)&&(k[b].type[h.unknownTrendText].hasOwnProperty(c)||(k[b].type[h.unknownTrendText][c]=0),k[b].type[h.unknownTrendText][c]+=d[c])}}function ra(a,b){var d=!1;if("HOLIDAY"===b)d=!0;else for(var c=a.colorRanges.length,e=0;e=f.minimum)e=f;else break}return e}function Ja(a,b){for(var d=a.length,c=null,e=0;e');f.push("");for(e in g)g.hasOwnProperty(e)&&(f.push(""),f.push(""+e+""),f.push(""+g[e]+""),f.push(""));f.push("");d=f.join(q.newLine)}else if("txt"=== b){g=sa(a);e=[];for(f in g)g.hasOwnProperty(f)&&e.push(f+q.colon+q.space+g[f].toString());d=e.join(q.newLine)}v(d)&&(g=n(J.body,"a"),g.style.display="none",g.setAttribute("target","_blank"),g.setAttribute("href","data:"+c+";charset=utf-8,"+encodeURIComponent(d)),c=g.setAttribute,f=new Date,e=U(f.getDate())+q.dash+U(f.getMonth()+1)+q.dash+f.getFullYear(),f=U(f.getHours())+q.dash+U(f.getMinutes()),d=q.empty,a.currentView.type!==h.unknownTrendText&&(d=a.currentView.type.toLowerCase().replace(q.space, q.underscore)+q.underscore),e=d+e+q.underscore+f+"."+a.exportType.toLowerCase(),c.call(g,"download",e),g.click(),J.body.removeChild(g),z(a.events.onExport,a.currentView.element))}function sa(a){var b={},d=M(a);if(a.exportOnlyYearBeingViewed)for(var c=0;12>c;c++)for(var e=da(a.currentView.year,c),f=0;fa.getDay()-1?6:a.getDay()-1}function w(a){return null!== -a&&void 0!==a&&a!==q.empty}function L(a){return w(a)&&"object"===typeof a}function v(a){return w(a)&&"string"===typeof a}function Q(a){return w(a)&&"function"===typeof a}function wa(a){return w(a)&&"number"===typeof a}function aa(a){return L(a)&&a instanceof Array}function xa(a){return L(a)&&a instanceof Date}function lb(a){a=a.toLowerCase();var b="text"===a;fa.hasOwnProperty(a)||(fa[a]=b?J.createTextNode(q.empty):J.createElement(a));return fa[a].cloneNode(!1)}function n(a,b,d,c){b=b.toLowerCase(); -var e="text"===b;fa.hasOwnProperty(b)||(fa[b]=e?J.createTextNode(q.empty):J.createElement(b));b=fa[b].cloneNode(!1);w(d)&&(b.className=d);w(c)?a.insertBefore(b,c):a.appendChild(b);return b}function u(a,b,d,c,e){a=n(a,b,d,e);a.innerHTML=c;return a}function ha(a,b,d){var c=null;d=m(d,!1);C.getComputedStyle?c=J.defaultView.getComputedStyle(a,null).getPropertyValue(b):a.currentStyle&&(c=a.currentStyle[b]);d&&(c=parseFloat(c,10));return c}function x(a,b){a.className+=q.space+b;a.className=a.className.trim()} -function ia(a){a.preventDefault();a.cancelBubble=!0}function S(a){for(var b=a.children,d=b.length-1;d--;)a.appendChild(b[d])}function Ba(a,b,d,c){a=n(a,"div");a=n(a,"label","checkbox");var e=n(a,"input");e.type="checkbox";w(c)&&(e.onclick=c);w(d)&&(e.checked=d);n(a,"span","check-mark");u(a,"span","text",b);return{input:e,label:a}}function z(a){var b=null;Q(a)&&(b=a.apply(null,[].slice.call(arguments,1)));return b}function r(a,b){return v(a)?a:b}function m(a,b){return w(a)&&"boolean"===typeof a?a: -b}function Z(a,b){return wa(a)?a:b}function D(a,b){return Q(a)?a:b}function T(a,b){return L(a)?a:b}function ya(a){var b=!0,d=null;try{v(a)&&(d=la.parse(a))}catch(c){try{d=eval("("+a+")"),Q(d)&&(d=d())}catch(e){h.safeMode||(console.error(h.objectErrorText.replace("{{error_1}}",c.message).replace("{{error_2}}",e.message)),b=!1),d=null}}return{parsed:b,result:d}}function ba(){for(var a=[],b=0;32>b;b++){8!==b&&12!==b&&16!==b&&20!==b||a.push(q.dash);var d=I.floor(16*I.random()).toString(16);a.push(d)}return a.join(q.empty)} -function U(a){a=a.toString();return 1===a.length?q.zero+a:a}function Ha(a,b){return a.substring(0,b.length).toLowerCase()===b.toLowerCase()}function N(a){return a.getFullYear()+q.dash+U(a.getMonth()+1)+q.dash+U(a.getDate())}function Ca(a,b){b=m(b,!0);var d=!0,c=a.currentView.year;for(c--;!Y(a,c);){if(0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]){d=!1;break}c++}d&&(a.currentView.year=c,A(a),b&&z(a.events.onBackYear,a.currentView.year))}function Qa(a){a.currentView.element.innerHTML=q.empty;var b=a.currentView.element;b.className=b.className.replace("heat-js",q.empty);b.className=b.className.trim();Ia(a,!1);J.body.removeChild(a.currentView.tooltip);a.currentView.isInFetchMode&&w(a.currentView.isInFetchModeTimer)&& -clearInterval(a.currentView.isInFetchModeTimer);z(a.events.onDestroy,a.currentView.element)}function Ra(a){h=L(a)?a:{};h.safeMode=m(h.safeMode,!0);a=h;var b=h.domElementTypes,d=["*"];v(b)?(b=b.split(q.space),0===b.length&&(b=d)):b=aa(b)?b:d;a.domElementTypes=b;h.stText=r(h.stText,"st");h.ndText=r(h.ndText,"nd");h.rdText=r(h.rdText,"rd");h.thText=r(h.thText,"th");h.backButtonText=r(h.backButtonText,"Back");h.nextButtonText=r(h.nextButtonText,"Next");h.refreshButtonText=r(h.refreshButtonText,"Refresh"); -h.exportButtonText=r(h.exportButtonText,"Export");h.lessText=r(h.lessText,"Less");h.moreText=r(h.moreText,"More");h.dateText=r(h.dateText,"Date");h.countText=r(h.countText,"Count");h.mapText=r(h.mapText,"Map");h.chartText=r(h.chartText,"Chart");h.noChartDataMessage=r(h.noChartDataMessage,"There is currently no data to view.");h.statisticsText=r(h.statisticsText,"Statistics");h.noStatisticsDataMessage=r(h.noStatisticsDataMessage,"There are currently no statistics to view.");h.unknownTrendText=r(h.unknownTrendText, -"Unknown");h.importButtonText=r(h.importButtonText,"Import");h.noMapDataMessage=r(h.noMapDataMessage,"There is currently no data to view.");h.objectErrorText=r(h.objectErrorText,"Errors in object: {{error_1}}, {{error_2}}");h.attributeNotValidErrorText=r(h.attributeNotValidErrorText,"The attribute '{{attribute_name}}' is not a valid object.");h.attributeNotSetErrorText=r(h.attributeNotSetErrorText,"The attribute '{{attribute_name}}' has not been set correctly.");h.closeToolTipText=r(h.closeToolTipText, -"Close");h.configurationToolTipText=r(h.configurationToolTipText,"Configuration");h.configurationTitleText=r(h.configurationTitleText,"Configuration");h.visibleMonthsText=r(h.visibleMonthsText,"Visible Months");h.visibleDaysText=r(h.visibleDaysText,"Visible Days");h.dataText=r(h.dataText,"Data");h.colorRangesText=r(h.colorRangesText,"Color Ranges");h.yearText=r(h.yearText,"Year");h.daysText=r(h.daysText,"Days");h.noDaysDataMessage=r(h.noDaysDataMessage,"There are currently no days to view.");P(h.monthNames, -12)&&(h.monthNames="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "));P(h.dayNames,7)&&(h.dayNames="Mon Tue Wed Thu Fri Sat Sun".split(" "))}function P(a,b){b=wa(b)?b:1;return!aa(a)||a.length +a.getDay()-1?6:a.getDay()-1}function w(a){return null!==a&&void 0!==a&&a!==q.empty}function L(a){return w(a)&&"object"===typeof a}function v(a){return w(a)&&"string"===typeof a}function R(a){return w(a)&&"function"===typeof a}function wa(a){return w(a)&&"number"===typeof a}function aa(a){return L(a)&&a instanceof Array}function xa(a){return L(a)&&a instanceof Date}function lb(a){a=a.toLowerCase();var b="text"===a;fa.hasOwnProperty(a)||(fa[a]=b?J.createTextNode(q.empty):J.createElement(a));return fa[a].cloneNode(!1)} +function n(a,b,d,c){b=b.toLowerCase();var e="text"===b;fa.hasOwnProperty(b)||(fa[b]=e?J.createTextNode(q.empty):J.createElement(b));b=fa[b].cloneNode(!1);w(d)&&(b.className=d);w(c)?a.insertBefore(b,c):a.appendChild(b);return b}function u(a,b,d,c,e){a=n(a,b,d,e);a.innerHTML=c;return a}function ha(a,b,d){var c=null;d=m(d,!1);C.getComputedStyle?c=J.defaultView.getComputedStyle(a,null).getPropertyValue(b):a.currentStyle&&(c=a.currentStyle[b]);d&&(c=parseFloat(c,10));return c}function x(a,b){a.className+= +q.space+b;a.className=a.className.trim()}function ia(a){a.preventDefault();a.cancelBubble=!0}function T(a){for(var b=a.children,d=b.length-1;d--;)a.appendChild(b[d])}function Ba(a,b,d,c){a=n(a,"div");a=n(a,"label","checkbox");var e=n(a,"input");e.type="checkbox";w(c)&&(e.onclick=c);w(d)&&(e.checked=d);n(a,"span","check-mark");u(a,"span","text",b);return{input:e,label:a}}function z(a){var b=null;R(a)&&(b=a.apply(null,[].slice.call(arguments,1)));return b}function r(a,b){return v(a)?a:b}function m(a, +b){return w(a)&&"boolean"===typeof a?a:b}function Z(a,b){return wa(a)?a:b}function D(a,b){return R(a)?a:b}function P(a,b){return L(a)?a:b}function ya(a){var b=!0,d=null;try{v(a)&&(d=la.parse(a))}catch(c){try{d=eval("("+a+")"),R(d)&&(d=d())}catch(e){h.safeMode||(console.error(h.objectErrorText.replace("{{error_1}}",c.message).replace("{{error_2}}",e.message)),b=!1),d=null}}return{parsed:b,result:d}}function ba(){for(var a=[],b=0;32>b;b++){8!==b&&12!==b&&16!==b&&20!==b||a.push(q.dash);var d=I.floor(16* +I.random()).toString(16);a.push(d)}return a.join(q.empty)}function U(a){a=a.toString();return 1===a.length?q.zero+a:a}function Ha(a,b){return a.substring(0,b.length).toLowerCase()===b.toLowerCase()}function N(a){return a.getFullYear()+q.dash+U(a.getMonth()+1)+q.dash+U(a.getDate())}function Ca(a,b){b=m(b,!0);var d=!0,c=a.currentView.year;for(c--;!Y(a,c);){if(0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]){d=!1;break}c++}d&&(a.currentView.year=c,A(a),b&&z(a.events.onBackYear,a.currentView.year))}function Qa(a){a.currentView.element.innerHTML=q.empty;var b=a.currentView.element;b.className=b.className.replace("heat-js",q.empty);b.className=b.className.trim();Ia(a,!1);J.body.removeChild(a.currentView.tooltip); +a.currentView.isInFetchMode&&w(a.currentView.isInFetchModeTimer)&&clearInterval(a.currentView.isInFetchModeTimer);z(a.events.onDestroy,a.currentView.element)}function Ra(a){h=L(a)?a:{};h.safeMode=m(h.safeMode,!0);a=h;var b=h.domElementTypes,d=["*"];v(b)?(b=b.split(q.space),0===b.length&&(b=d)):b=aa(b)?b:d;a.domElementTypes=b;h.stText=r(h.stText,"st");h.ndText=r(h.ndText,"nd");h.rdText=r(h.rdText,"rd");h.thText=r(h.thText,"th");h.backButtonText=r(h.backButtonText,"Back");h.nextButtonText=r(h.nextButtonText, +"Next");h.refreshButtonText=r(h.refreshButtonText,"Refresh");h.exportButtonText=r(h.exportButtonText,"Export");h.lessText=r(h.lessText,"Less");h.moreText=r(h.moreText,"More");h.dateText=r(h.dateText,"Date");h.countText=r(h.countText,"Count");h.mapText=r(h.mapText,"Map");h.chartText=r(h.chartText,"Chart");h.noChartDataMessage=r(h.noChartDataMessage,"There is currently no data to view.");h.statisticsText=r(h.statisticsText,"Statistics");h.noStatisticsDataMessage=r(h.noStatisticsDataMessage,"There are currently no statistics to view."); +h.unknownTrendText=r(h.unknownTrendText,"Unknown");h.importButtonText=r(h.importButtonText,"Import");h.noMapDataMessage=r(h.noMapDataMessage,"There is currently no data to view.");h.objectErrorText=r(h.objectErrorText,"Errors in object: {{error_1}}, {{error_2}}");h.attributeNotValidErrorText=r(h.attributeNotValidErrorText,"The attribute '{{attribute_name}}' is not a valid object.");h.attributeNotSetErrorText=r(h.attributeNotSetErrorText,"The attribute '{{attribute_name}}' has not been set correctly."); +h.closeToolTipText=r(h.closeToolTipText,"Close");h.configurationToolTipText=r(h.configurationToolTipText,"Configuration");h.configurationTitleText=r(h.configurationTitleText,"Configuration");h.visibleMonthsText=r(h.visibleMonthsText,"Visible Months");h.visibleDaysText=r(h.visibleDaysText,"Visible Days");h.dataText=r(h.dataText,"Data");h.colorRangesText=r(h.colorRangesText,"Color Ranges");h.yearText=r(h.yearText,"Year");h.daysText=r(h.daysText,"Days");h.noDaysDataMessage=r(h.noDaysDataMessage,"There are currently no days to view."); +Q(h.monthNames,12)&&(h.monthNames="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "));Q(h.dayNames,7)&&(h.dayNames="Mon Tue Wed Thu Fri Sat Sun".split(" "))}function Q(a,b){b=wa(b)?b:1;return!aa(a)||a.length 1 ) { - if ( isDefinedString( bindingOptions.descriptionText ) ) { + if ( isDefinedString( bindingOptions.description.text ) ) { var description = createElement( bindingOptions.currentView.element, "div", "description", guide ); renderDescription( bindingOptions, description ); @@ -1541,14 +1541,14 @@ } function renderDescription( bindingOptions, container ) { - if ( isDefinedString( bindingOptions.descriptionText ) ) { - if ( isDefinedString( bindingOptions.descriptionTextLink ) ) { - var link = createElementWithHTML( container, "a", "label", bindingOptions.descriptionText ); - link.href = bindingOptions.descriptionTextLink; + if ( isDefinedString( bindingOptions.description.text ) ) { + if ( isDefinedString( bindingOptions.description.url ) ) { + var link = createElementWithHTML( container, "a", "label", bindingOptions.description.text ); + link.href = bindingOptions.description.url; link.target = "_blank"; } else { - createElementWithHTML( container, "span", "label", bindingOptions.descriptionText ); + createElementWithHTML( container, "span", "label", bindingOptions.description.text ); } } } @@ -2246,8 +2246,6 @@ options.view = getDefaultString( options.view, _elements_View_Name_Map ); options.tooltipDelay = getDefaultNumber( options.tooltipDelay, 750 ); options.exportType = getDefaultString( options.exportType, _export_Type_Csv ); - options.descriptionText = getDefaultString( options.descriptionText, null ); - options.descriptionTextLink = getDefaultString( options.descriptionTextLink, null ); options.useLocalStorageForData = getDefaultBoolean( options.useLocalStorageForData, false ); options.allowFileImports = getDefaultBoolean( options.allowFileImports, true ); options.yearsToHide = getDefaultArray( options.yearsToHide, [] ); @@ -2259,6 +2257,7 @@ options = buildAttributeOptionHolidays( options ); options = buildAttributeOptionStrings( options ); options = buildAttributeOptionTitle( options ); + options = buildAttributeOptionDescription( options ); options = buildAttributeOptionGuide( options ); options = buildAttributeOptionMapView( options ); options = buildAttributeOptionChartView( options ); @@ -2367,6 +2366,14 @@ return options; } + function buildAttributeOptionDescription( options ) { + options.description = getDefaultObject( options.description, {} ); + options.description.text = getDefaultString( options.description.text, null ); + options.description.url = getDefaultString( options.description.url, null ); + + return options; + } + function buildAttributeOptionGuide( options ) { options.guide = getDefaultObject( options.guide, {} ); options.guide.enabled = getDefaultBoolean( options.guide.enabled, true ); diff --git a/test/dist/heat.js.basic.html b/test/dist/heat.js.basic.html index 62cb05ff..b5063cb0 100644 --- a/test/dist/heat.js.basic.html +++ b/test/dist/heat.js.basic.html @@ -16,7 +16,7 @@

Heat.js - Basic

-
+
diff --git a/test/dist/heat.js.bootstrap.html b/test/dist/heat.js.bootstrap.html index 1196b6bc..90b580e5 100644 --- a/test/dist/heat.js.bootstrap.html +++ b/test/dist/heat.js.bootstrap.html @@ -17,7 +17,7 @@

Heat.js - Bootstrap

-
+


diff --git a/test/dist/heat.js.local-storage.html b/test/dist/heat.js.local-storage.html index c911fb77..12969b85 100644 --- a/test/dist/heat.js.local-storage.html +++ b/test/dist/heat.js.local-storage.html @@ -16,7 +16,7 @@

Heat.js - Local Storage

-
+
diff --git a/test/dist/heat.js.map-only.html b/test/dist/heat.js.map-only.html index 6c92d9eb..0a909ecc 100644 --- a/test/dist/heat.js.map-only.html +++ b/test/dist/heat.js.map-only.html @@ -16,7 +16,7 @@

Heat.js - Only Map

-
+
diff --git a/test/dist/heat.js.numbers.html b/test/dist/heat.js.numbers.html index 5955ea71..f5194b9e 100644 --- a/test/dist/heat.js.numbers.html +++ b/test/dist/heat.js.numbers.html @@ -16,7 +16,7 @@

Heat.js - Numbers

-
+
diff --git a/test/dist/heat.js.only-years-available.html b/test/dist/heat.js.only-years-available.html index 068cf074..34b1637a 100644 --- a/test/dist/heat.js.only-years-available.html +++ b/test/dist/heat.js.only-years-available.html @@ -16,7 +16,7 @@

Heat.js - Only Years Available

-
+
diff --git a/test/dist/heat.js.theme.html b/test/dist/heat.js.theme.html index c3f26490..d849664b 100644 --- a/test/dist/heat.js.theme.html +++ b/test/dist/heat.js.theme.html @@ -17,7 +17,7 @@

Heat.js - Theme

-
+
diff --git a/test/dist/heat.js.view-colors.html b/test/dist/heat.js.view-colors.html index 4e88d2be..015b0911 100644 --- a/test/dist/heat.js.view-colors.html +++ b/test/dist/heat.js.view-colors.html @@ -64,7 +64,9 @@

Heat.js - View Colors

visible: true } ], onDayClick: onDayClick, - descriptionText: "A basic example of how to use Heat.js." + description: { + text: "A basic example of how to use Heat.js." + } }; } diff --git a/test/src/heat.js.basic.html b/test/src/heat.js.basic.html index 61ffc62d..bafc4c8d 100644 --- a/test/src/heat.js.basic.html +++ b/test/src/heat.js.basic.html @@ -16,7 +16,7 @@

Heat.js - Basic

-
+
diff --git a/test/src/heat.js.bootstrap.html b/test/src/heat.js.bootstrap.html index 47949136..92e62e69 100644 --- a/test/src/heat.js.bootstrap.html +++ b/test/src/heat.js.bootstrap.html @@ -17,7 +17,7 @@

Heat.js - Bootstrap

-
+


diff --git a/test/src/heat.js.local-storage.html b/test/src/heat.js.local-storage.html index 193c009a..09ad0a7f 100644 --- a/test/src/heat.js.local-storage.html +++ b/test/src/heat.js.local-storage.html @@ -16,7 +16,7 @@

Heat.js - Local Storage

-
+
diff --git a/test/src/heat.js.map-only.html b/test/src/heat.js.map-only.html index 6c0b807c..ce6e0211 100644 --- a/test/src/heat.js.map-only.html +++ b/test/src/heat.js.map-only.html @@ -16,7 +16,7 @@

Heat.js - Only Map

-
+
diff --git a/test/src/heat.js.numbers.html b/test/src/heat.js.numbers.html index 28e6219b..35531ae7 100644 --- a/test/src/heat.js.numbers.html +++ b/test/src/heat.js.numbers.html @@ -16,7 +16,7 @@

Heat.js - Numbers

-
+
diff --git a/test/src/heat.js.only-years-available.html b/test/src/heat.js.only-years-available.html index d8bf082e..3852b789 100644 --- a/test/src/heat.js.only-years-available.html +++ b/test/src/heat.js.only-years-available.html @@ -16,7 +16,7 @@

Heat.js - Only Years Available

-
+
diff --git a/test/src/heat.js.theme.html b/test/src/heat.js.theme.html index fd4d96f7..ebe736d2 100644 --- a/test/src/heat.js.theme.html +++ b/test/src/heat.js.theme.html @@ -17,7 +17,7 @@

Heat.js - Theme

-
+
diff --git a/test/src/heat.js.view-colors.html b/test/src/heat.js.view-colors.html index ab9a8824..ab236fa9 100644 --- a/test/src/heat.js.view-colors.html +++ b/test/src/heat.js.view-colors.html @@ -64,7 +64,9 @@

Heat.js - View Colors

visible: true } ], onDayClick: onDayClick, - descriptionText: "A basic example of how to use Heat.js." + description: { + text: "A basic example of how to use Heat.js." + } }; } From fd9320c7b29e73f5ceb0ce45bad540896a706f1d Mon Sep 17 00:00:00 2001 From: William Troup Date: Tue, 2 Apr 2024 20:43:29 +0100 Subject: [PATCH 10/10] BREAKING: All binding options for tooltips (text and delay) are now available under a new area called "tooltip". --- dist/heat.js | 21 +++++++-------- dist/heat.min.js | 66 ++++++++++++++++++++++++------------------------ src/heat.js | 25 +++++++++--------- 3 files changed, 57 insertions(+), 55 deletions(-) diff --git a/dist/heat.js b/dist/heat.js index 5dd9fb9c..0fe1ea79 100644 --- a/dist/heat.js +++ b/dist/heat.js @@ -294,7 +294,7 @@ bindingOptions.currentView.tooltip.innerHTML = text; bindingOptions.currentView.tooltip.style.display = "block"; showElementAtMousePosition(e, bindingOptions.currentView.tooltip); - }, bindingOptions.tooltipDelay); + }, bindingOptions.tooltip.delay); } function hideToolTip(bindingOptions) { if (isDefined(bindingOptions.currentView.tooltip)) { @@ -316,7 +316,7 @@ addClass(title, "no-click"); } if (bindingOptions.title.showText) { - title.innerHTML += bindingOptions.titleText; + title.innerHTML += bindingOptions.title.text; } if (bindingOptions.views.chart.enabled || bindingOptions.views.days.enabled || bindingOptions.views.statistics.enabled) { renderTitleDropDownMenu(bindingOptions, title); @@ -1002,7 +1002,7 @@ if (isDefinedFunction(bindingOptions.events.onDayToolTipRender)) { addToolTip(day, bindingOptions, fireCustomTrigger(bindingOptions.events.onDayToolTipRender, date, dateCount)); } else { - var tooltip = getCustomFormattedDateText(bindingOptions.dayToolTipText, date); + var tooltip = getCustomFormattedDateText(bindingOptions.tooltip.dayText, date); if (bindingOptions.showHolidaysInDayToolTips) { var holiday = isHoliday(bindingOptions, date); if (holiday.matched && isDefinedString(holiday.name)) { @@ -1444,7 +1444,6 @@ options.exportOnlyYearBeingViewed = getDefaultBoolean(options.exportOnlyYearBeingViewed, true); options.year = getDefaultNumber(options.year, (new Date()).getFullYear()); options.view = getDefaultString(options.view, _elements_View_Name_Map); - options.tooltipDelay = getDefaultNumber(options.tooltipDelay, 750); options.exportType = getDefaultString(options.exportType, _export_Type_Csv); options.useLocalStorageForData = getDefaultBoolean(options.useLocalStorageForData, false); options.allowFileImports = getDefaultBoolean(options.allowFileImports, true); @@ -1454,10 +1453,10 @@ options.showHolidaysInDayToolTips = getDefaultBoolean(options.showHolidaysInDayToolTips, false); options = buildAttributeOptionColorRanges(options); options = buildAttributeOptionHolidays(options); - options = buildAttributeOptionStrings(options); options = buildAttributeOptionTitle(options); options = buildAttributeOptionDescription(options); options = buildAttributeOptionGuide(options); + options = buildAttributeOptionToolTip(options); options = buildAttributeOptionMapView(options); options = buildAttributeOptionChartView(options); options = buildAttributeOptionDaysView(options); @@ -1499,13 +1498,9 @@ } return options; } - function buildAttributeOptionStrings(options) { - options.titleText = getDefaultString(options.titleText, "Heat.js"); - options.dayToolTipText = getDefaultString(options.dayToolTipText, "{d}{o} {mmmm} {yyyy}"); - return options; - } function buildAttributeOptionTitle(options) { options.title = getDefaultObject(options.title, {}); + options.title.text = getDefaultString(options.title.text, "Heat.js"); options.title.showText = getDefaultBoolean(options.title.showText, true); options.title.showYearSelector = getDefaultBoolean(options.title.showYearSelector, true); options.title.showRefreshButton = getDefaultBoolean(options.title.showRefreshButton, false); @@ -1530,6 +1525,12 @@ options.guide.showNumbersInGuide = getDefaultBoolean(options.guide.showNumbersInGuide, false); return options; } + function buildAttributeOptionToolTip(options) { + options.tooltip = getDefaultObject(options.tooltip, {}); + options.tooltip.delay = getDefaultNumber(options.tooltip.delay, 750); + options.tooltip.dayText = getDefaultString(options.tooltip.dayText, "{d}{o} {mmmm} {yyyy}"); + return options; + } function buildAttributeOptionMapView(options) { options.views.map = getDefaultObject(options.views.map, {}); options.views.map.showMonthDayGaps = getDefaultBoolean(options.views.map.showMonthDayGaps, true); diff --git a/dist/heat.min.js b/dist/heat.min.js index 2ab9b365..28cdd57c 100644 --- a/dist/heat.min.js +++ b/dist/heat.min.js @@ -6,85 +6,85 @@ a.currentView.element);v(a.currentView.element.id)||(a.currentView.element.id=ba C.localStorage.length,f=[],g=a.currentView.element.id;for(c=0;cc;c++)S(a.views.map.daysToShow,c+1)&&u(f,"div","day-name",g&&0!==c%3?q.space:h.dayNames[c]);a.views.map.showDaysInReverseOrder&&T(f)}f=n(e,"div","months");e=na(a);for(g=0;12>g;g++)if(V(a.views.map.monthsToShow,g)){c=n(f,"div","month");var t=n(c, "div","day-columns");var y=da(l,g),E=n(t,"div","day-column"),B=!1,F=oa(new Date(l,g,1)),G=1;y+=F;for(var H=0;H=F?B=!0:S(a.views.map.daysToShow,G)&&n(E,"div","day-disabled");if(B){var K=null;S(a.views.map.daysToShow,G)&&(K=Xa(a,E,H-F,g,l,e));if(0===(H+1)%7&&(a.views.map.showDaysInReverseOrder&&T(E),E=n(t,"div","day-column"),G=0,!w(ea)&&w(K))){var Ya=ha(K,"margin-left",!0),Za=ha(K,"margin-right",!0);ea=K.offsetWidth+Ya+Za}}G++}a.views.map.showMonthNames&&(E=c.offsetWidth,y=a.views.map.placeMonthNamesOnTheBottom? u(c,"div","month-name-bottom",h.monthNames[g]):u(c,"div","month-name",h.monthNames[g],t),w(y)&&(y.style.width=a.views.map.showMonthDayGaps?E+"px":E-ea+"px"));b&&w(ea)&&(0y;y++)for(E=da(a.currentView.year,y),B=0;By;y++)for(E=da(a.currentView.year,y),B=0;BF;F++)for(y=da(a.currentView.year,F),E=0;EF;F++)for(y=da(a.currentView.year,F),E=0;Ey;y++)a.currentView.dayCheckBoxes[y].checked&&g.push(y+1);for(y=0;12>y;y++)a.currentView.monthCheckBoxes[y].checked&&l.push(y+1);1<=g.length&&(1===a.currentView.view? a.views.map.daysToShow=g:a.views.chart.enabled&&2===a.currentView.view?a.views.chart.daysToShow=g:a.views.days.enabled&&3===a.currentView.view?a.views.days.daysToShow=g:a.views.statistics.enabled&&4===a.currentView.view?a.views.statistics.daysToShow=g:a.views.map.daysToShow=g,t=!0);1<=l.length&&(1===a.currentView.view?a.views.map.monthsToShow=l:a.views.chart.enabled&&2===a.currentView.view?a.views.chart.monthsToShow=l:a.views.days.enabled&&3===a.currentView.view?a.views.days.monthsToShow=l:a.views.statistics.enabled&& 4===a.currentView.view?a.views.statistics.monthsToShow=l:a.views.map.monthsToShow=l,t=!0);t?(A(a),z(a.events.onOptionsUpdate,a.currentView.element,a)):ca(a)};for(var f=0;7>f;f++)a.currentView.dayCheckBoxes[f]=Ba(e,h.dayNames[f]).input;for(e=0;7>e;e++)a.currentView.monthCheckBoxes[e]=Ba(b,h.monthNames[e]).input;for(e=7;12>e;e++)a.currentView.monthCheckBoxes[e]=Ba(d,h.monthNames[e]).input;X(c,a,h.closeToolTipText)}function Ia(a,b){var d=(b=m(b,!0))?J.addEventListener:J.removeEventListener;(b?C.addEventListener: C.removeEventListener)("mousemove",function(){ca(a)});d("scroll",function(){ca(a)})}function X(a,b,d){null!==a&&(a.onmousemove=function(c){cb(c,b,d)})}function cb(a,b,d){ia(a);ca(b);b.currentView.tooltipTimer=setTimeout(function(){b.currentView.tooltip.innerHTML=d;b.currentView.tooltip.style.display="block";var c=b.currentView.tooltip,e=a.pageX,f=a.pageY;var g=J.documentElement;var l=(C.pageXOffset||g.scrollLeft)-(g.clientLeft||0);g=(C.pageYOffset||g.scrollTop)-(g.clientTop||0);c.style.display="block"; -e+c.offsetWidth>C.innerWidth?e-=c.offsetWidth:e++;f+c.offsetHeight>C.innerHeight?f-=c.offsetHeight:f++;eC.innerWidth?e-=c.offsetWidth:e++;f+c.offsetHeight>C.innerHeight?f-=c.offsetHeight:f++;ef;f++)a.currentView.dayCheckBoxes[f].checked=S(c,f+1);for(c=0;12>c;c++)a.currentView.monthCheckBoxes[c].checked= V(e,c);ca(a)}),b=u(b,"button","next",h.nextButtonText),b.onclick=function(){ja(a)},0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]&&(b.disabled=!0))}}function db(a,b){b=n(b,"div","titles-menu-container");b=n(b,"div","titles-menu");u(b,"div","title-menu-header",h.dataText+q.colon);var d=u(b,"div","title-menu-item",h.mapText);qa(a,d,1,"map");a.views.chart.enabled&&(d=u(b,"div","title-menu-item",h.chartText),qa(a,d,2,"chart")); a.views.days.enabled&&(u(b,"div","title-menu-header",h.yearText+q.colon),d=u(b,"div","title-menu-item",h.daysText),qa(a,d,3,"days"));a.views.statistics.enabled&&(u(b,"div","title-menu-header",h.statisticsText+q.colon),b=u(b,"div","title-menu-item",h.colorRangesText),qa(a,b,4,"statistics"))}function qa(a,b,d,c){a.currentView.view===d?x(b,"title-menu-item-active"):b.onclick=function(){a.currentView.view=d;z(a.events.onViewSwitch,c);A(a,!1,!0)}}function fb(a){n(a.currentView.yearText,"div","down-arrow"); var b=n(a.currentView.yearText,"div","years-menu-container"),d=n(b,"div","years-menu"),c=(new Date).getFullYear(),e=null;b.style.display="block";b.style.visibility="hidden";for(var f=c-a.title.extraSelectionYears;fg;g++)if(V(a.views.chart.monthsToShow,g)){y=da(l,g);var E=1;d++;for(var B=0;Bl;l++)f(l);F.style.width=e.offsetWidth+"px";e=n(F,"div","month-name-space");e.style.height=F.offsetHeight+"px";e.style.width=t+"px"}a.views.chart.keepScrollPositions&& -(a.currentView.chartContents.scrollLeft=a.currentView.chartContentsScrollLeft)}}function ib(a,b,d,c,e,f,g){var l=new Date(e,c,d);a=n(a,"div","day-line");var t=M(b)[N(l)];t=Z(t,0);La(b,a,l,t);b.views.chart.showLineNumbers&&0=g&&(a.style.visibility="hidden");R(b.events.onDayClick)?a.onclick=function(){z(b.events.onDayClick,l,t)}:x(a,"no-hover");f=Aa(b,f,t,l);w(f)&&ra(b,f.id)&&(v(f.chartCssClassName)?x(a,f.chartCssClassName): -x(a,f.cssClassName))}function hb(a){for(var b=0,d=M(a),c=0;12>c;c++)for(var e=da(a.currentView.year,c),f=0;f=e&&(a.style.visibility="hidden");X(a,c,d.toString());R(c.events.onWeekDayClick)?a.onclick=function(){z(c.events.onWeekDayClick,b,d)}:x(a,"no-hover"); +(a.currentView.chartContents.scrollLeft=a.currentView.chartContentsScrollLeft)}}function ib(a,b,d,c,e,f,g){var l=new Date(e,c,d);a=n(a,"div","day-line");var t=N(b)[O(l)];t=Z(t,0);La(b,a,l,t);b.views.chart.showLineNumbers&&0=g&&(a.style.visibility="hidden");R(b.events.onDayClick)?a.onclick=function(){z(b.events.onDayClick,l,t)}:x(a,"no-hover");f=Aa(b,f,t,l);w(f)&&ra(b,f.id)&&(v(f.chartCssClassName)?x(a,f.chartCssClassName): +x(a,f.cssClassName))}function hb(a){for(var b=0,d=N(a),c=0;12>c;c++)for(var e=da(a.currentView.year,c),f=0;f=e&&(a.style.visibility="hidden");X(a,c,d.toString());R(c.events.onWeekDayClick)?a.onclick=function(){z(c.events.onWeekDayClick,b,d)}:x(a,"no-hover"); c.views.days.showDayNumbers&&0=a&&(b.style.visibility="hidden");X(b,c,d.toString());c.views.statistics.showRangeNumbers&&0ka.notFound}function S(a,b){return a.indexOf(b)>ka.notFound}function Sa(a){var b=[];if(a.showOnlyDataForYearsAvailable){a=M(a);for(var d in a)if(a.hasOwnProperty(d)){var c=parseInt(d.split(q.dash)[0]); -b.indexOf(c)===ka.notFound&&b.push(c)}}return b=b.sort(function(e,f){return e-f})}function Y(a,b){return a.yearsToHide.indexOf(b)===ka.notFound&&(0===a.currentView.yearsAvailable.length||a.currentView.yearsAvailable.indexOf(b)>ka.notFound)}function Ta(a){a.currentView.isInFetchMode&&(w(a.currentView.isInFetchModeTimer)||Oa(a),w(a.currentView.isInFetchModeTimer)||(a.currentView.isInFetchModeTimer=setInterval(function(){Oa(a);A(a)},a.dataFetchDelay)))}function Oa(a){var b=a.currentView.element.id,d= -z(a.events.onDataFetch,b);if(L(d)){za(b,a,!1);for(var c in d)d.hasOwnProperty(c)&&(k[b].type[h.unknownTrendText].hasOwnProperty(c)||(k[b].type[h.unknownTrendText][c]=0),k[b].type[h.unknownTrendText][c]+=d[c])}}function ra(a,b){var d=!1;if("HOLIDAY"===b)d=!0;else for(var c=a.colorRanges.length,e=0;eka.notFound}function S(a,b){return a.indexOf(b)>ka.notFound}function Sa(a){var b=[];if(a.showOnlyDataForYearsAvailable){a=N(a);for(var d in a)if(a.hasOwnProperty(d)){var c= +parseInt(d.split(q.dash)[0]);b.indexOf(c)===ka.notFound&&b.push(c)}}return b=b.sort(function(e,f){return e-f})}function Y(a,b){return a.yearsToHide.indexOf(b)===ka.notFound&&(0===a.currentView.yearsAvailable.length||a.currentView.yearsAvailable.indexOf(b)>ka.notFound)}function Ta(a){a.currentView.isInFetchMode&&(w(a.currentView.isInFetchModeTimer)||Oa(a),w(a.currentView.isInFetchModeTimer)||(a.currentView.isInFetchModeTimer=setInterval(function(){Oa(a);A(a)},a.dataFetchDelay)))}function Oa(a){var b= +a.currentView.element.id,d=z(a.events.onDataFetch,b);if(L(d)){za(b,a,!1);for(var c in d)d.hasOwnProperty(c)&&(k[b].type[h.unknownTrendText].hasOwnProperty(c)||(k[b].type[h.unknownTrendText][c]=0),k[b].type[h.unknownTrendText][c]+=d[c])}}function ra(a,b){var d=!1;if("HOLIDAY"===b)d=!0;else for(var c=a.colorRanges.length,e=0;e=f.minimum)e=f;else break}return e}function Ja(a,b){for(var d=a.length,c=null,e=0;e');f.push("");for(e in g)g.hasOwnProperty(e)&&(f.push(""),f.push(""+e+""),f.push(""+g[e]+""),f.push(""));f.push("");d=f.join(q.newLine)}else if("txt"=== b){g=sa(a);e=[];for(f in g)g.hasOwnProperty(f)&&e.push(f+q.colon+q.space+g[f].toString());d=e.join(q.newLine)}v(d)&&(g=n(J.body,"a"),g.style.display="none",g.setAttribute("target","_blank"),g.setAttribute("href","data:"+c+";charset=utf-8,"+encodeURIComponent(d)),c=g.setAttribute,f=new Date,e=U(f.getDate())+q.dash+U(f.getMonth()+1)+q.dash+f.getFullYear(),f=U(f.getHours())+q.dash+U(f.getMinutes()),d=q.empty,a.currentView.type!==h.unknownTrendText&&(d=a.currentView.type.toLowerCase().replace(q.space, -q.underscore)+q.underscore),e=d+e+q.underscore+f+"."+a.exportType.toLowerCase(),c.call(g,"download",e),g.click(),J.body.removeChild(g),z(a.events.onExport,a.currentView.element))}function sa(a){var b={},d=M(a);if(a.exportOnlyYearBeingViewed)for(var c=0;12>c;c++)for(var e=da(a.currentView.year,c),f=0;fc;c++)for(var e=da(a.currentView.year,c),f=0;f a.getDay()-1?6:a.getDay()-1}function w(a){return null!==a&&void 0!==a&&a!==q.empty}function L(a){return w(a)&&"object"===typeof a}function v(a){return w(a)&&"string"===typeof a}function R(a){return w(a)&&"function"===typeof a}function wa(a){return w(a)&&"number"===typeof a}function aa(a){return L(a)&&a instanceof Array}function xa(a){return L(a)&&a instanceof Date}function lb(a){a=a.toLowerCase();var b="text"===a;fa.hasOwnProperty(a)||(fa[a]=b?J.createTextNode(q.empty):J.createElement(a));return fa[a].cloneNode(!1)} function n(a,b,d,c){b=b.toLowerCase();var e="text"===b;fa.hasOwnProperty(b)||(fa[b]=e?J.createTextNode(q.empty):J.createElement(b));b=fa[b].cloneNode(!1);w(d)&&(b.className=d);w(c)?a.insertBefore(b,c):a.appendChild(b);return b}function u(a,b,d,c,e){a=n(a,b,d,e);a.innerHTML=c;return a}function ha(a,b,d){var c=null;d=m(d,!1);C.getComputedStyle?c=J.defaultView.getComputedStyle(a,null).getPropertyValue(b):a.currentStyle&&(c=a.currentStyle[b]);d&&(c=parseFloat(c,10));return c}function x(a,b){a.className+= q.space+b;a.className=a.className.trim()}function ia(a){a.preventDefault();a.cancelBubble=!0}function T(a){for(var b=a.children,d=b.length-1;d--;)a.appendChild(b[d])}function Ba(a,b,d,c){a=n(a,"div");a=n(a,"label","checkbox");var e=n(a,"input");e.type="checkbox";w(c)&&(e.onclick=c);w(d)&&(e.checked=d);n(a,"span","check-mark");u(a,"span","text",b);return{input:e,label:a}}function z(a){var b=null;R(a)&&(b=a.apply(null,[].slice.call(arguments,1)));return b}function r(a,b){return v(a)?a:b}function m(a, -b){return w(a)&&"boolean"===typeof a?a:b}function Z(a,b){return wa(a)?a:b}function D(a,b){return R(a)?a:b}function P(a,b){return L(a)?a:b}function ya(a){var b=!0,d=null;try{v(a)&&(d=la.parse(a))}catch(c){try{d=eval("("+a+")"),R(d)&&(d=d())}catch(e){h.safeMode||(console.error(h.objectErrorText.replace("{{error_1}}",c.message).replace("{{error_2}}",e.message)),b=!1),d=null}}return{parsed:b,result:d}}function ba(){for(var a=[],b=0;32>b;b++){8!==b&&12!==b&&16!==b&&20!==b||a.push(q.dash);var d=I.floor(16* -I.random()).toString(16);a.push(d)}return a.join(q.empty)}function U(a){a=a.toString();return 1===a.length?q.zero+a:a}function Ha(a,b){return a.substring(0,b.length).toLowerCase()===b.toLowerCase()}function N(a){return a.getFullYear()+q.dash+U(a.getMonth()+1)+q.dash+U(a.getDate())}function Ca(a,b){b=m(b,!0);var d=!0,c=a.currentView.year;for(c--;!Y(a,c);){if(0b;b++){8!==b&&12!==b&&16!==b&&20!==b||a.push(q.dash);var d=I.floor(16* +I.random()).toString(16);a.push(d)}return a.join(q.empty)}function U(a){a=a.toString();return 1===a.length?q.zero+a:a}function Ha(a,b){return a.substring(0,b.length).toLowerCase()===b.toLowerCase()}function O(a){return a.getFullYear()+q.dash+U(a.getMonth()+1)+q.dash+U(a.getDate())}function Ca(a,b){b=m(b,!0);var d=!0,c=a.currentView.year;for(c--;!Y(a,c);){if(0=a.currentView.yearsAvailable[a.currentView.yearsAvailable.length-1]){d=!1;break}c++}d&&(a.currentView.year=c,A(a),b&&z(a.events.onBackYear,a.currentView.year))}function Qa(a){a.currentView.element.innerHTML=q.empty;var b=a.currentView.element;b.className=b.className.replace("heat-js",q.empty);b.className=b.className.trim();Ia(a,!1);J.body.removeChild(a.currentView.tooltip); a.currentView.isInFetchMode&&w(a.currentView.isInFetchModeTimer)&&clearInterval(a.currentView.isInFetchModeTimer);z(a.events.onDestroy,a.currentView.element)}function Ra(a){h=L(a)?a:{};h.safeMode=m(h.safeMode,!0);a=h;var b=h.domElementTypes,d=["*"];v(b)?(b=b.split(q.space),0===b.length&&(b=d)):b=aa(b)?b:d;a.domElementTypes=b;h.stText=r(h.stText,"st");h.ndText=r(h.ndText,"nd");h.rdText=r(h.rdText,"rd");h.thText=r(h.thText,"th");h.backButtonText=r(h.backButtonText,"Back");h.nextButtonText=r(h.nextButtonText, "Next");h.refreshButtonText=r(h.refreshButtonText,"Refresh");h.exportButtonText=r(h.exportButtonText,"Export");h.lessText=r(h.lessText,"Less");h.moreText=r(h.moreText,"More");h.dateText=r(h.dateText,"Date");h.countText=r(h.countText,"Count");h.mapText=r(h.mapText,"Map");h.chartText=r(h.chartText,"Chart");h.noChartDataMessage=r(h.noChartDataMessage,"There is currently no data to view.");h.statisticsText=r(h.statisticsText,"Statistics");h.noStatisticsDataMessage=r(h.noStatisticsDataMessage,"There are currently no statistics to view."); h.unknownTrendText=r(h.unknownTrendText,"Unknown");h.importButtonText=r(h.importButtonText,"Import");h.noMapDataMessage=r(h.noMapDataMessage,"There is currently no data to view.");h.objectErrorText=r(h.objectErrorText,"Errors in object: {{error_1}}, {{error_2}}");h.attributeNotValidErrorText=r(h.attributeNotValidErrorText,"The attribute '{{attribute_name}}' is not a valid object.");h.attributeNotSetErrorText=r(h.attributeNotSetErrorText,"The attribute '{{attribute_name}}' has not been set correctly."); h.closeToolTipText=r(h.closeToolTipText,"Close");h.configurationToolTipText=r(h.configurationToolTipText,"Configuration");h.configurationTitleText=r(h.configurationTitleText,"Configuration");h.visibleMonthsText=r(h.visibleMonthsText,"Visible Months");h.visibleDaysText=r(h.visibleDaysText,"Visible Days");h.dataText=r(h.dataText,"Data");h.colorRangesText=r(h.colorRangesText,"Color Ranges");h.yearText=r(h.yearText,"Year");h.daysText=r(h.daysText,"Days");h.noDaysDataMessage=r(h.noDaysDataMessage,"There are currently no days to view."); Q(h.monthNames,12)&&(h.monthNames="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "));Q(h.dayNames,7)&&(h.dayNames="Mon Tue Wed Thu Fri Sat Sun".split(" "))}function Q(a,b){b=wa(b)?b:1;return!aa(a)||a.lengthd&&(a.currentView.year=d,Y(a,a.currentView.year)?A(a):Ca(a,!1),z(a.events.onSetYear, +k.hasOwnProperty(a)){a=k[a].options;var b=N(a),d=0,c;for(c in b)b.hasOwnProperty(c)&&(d=I.max(d,parseInt(c.split(q.dash)[0])));0d&&(a.currentView.year=d,Y(a,a.currentView.year)?A(a):Ca(a,!1),z(a.events.onSetYear, a.currentView.year))}return p};p.moveToPreviousYear=function(a){v(a)&&k.hasOwnProperty(a)&&Ca(k[a].options);return p};p.moveToNextYear=function(a){v(a)&&k.hasOwnProperty(a)&&ja(k[a].options);return p};p.moveToCurrentYear=function(a){v(a)&&k.hasOwnProperty(a)&&(a=k[a].options,a.currentView.year=(new Date).getFullYear(),Y(a,a.currentView.year)?A(a):ja(a,!1),z(a.events.onSetYear,a.currentView.year));return p};p.getYear=function(a){var b=null;v(a)&&k.hasOwnProperty(a)&&(b=k[a].options.currentView.year); return b};p.render=function(a,b){L(a)&&L(b)&&Ea(Fa(b,a));return p};p.renderAll=function(){Da();return p};p.switchView=function(a,b){if(v(a)&&v(b)&&k.hasOwnProperty(a)){a=k[a].options;var d=null;"map"===b.toLowerCase()?d=1:"chart"===b.toLowerCase()?d=2:"days"===b.toLowerCase()?d=3:"statistics"===b.toLowerCase()&&(d=4);wa(d)&&(a.currentView.view=d,z(a.events.onViewSwitch,b),A(a,!1,!0))}return p};p.switchType=function(a,b){v(a)&&v(b)&&k.hasOwnProperty(a)&&k[a].type.hasOwnProperty(b)&&(a=k[a].options, a.currentView.type!==b&&(a.currentView.type=b,z(a.events.onTypeSwitch,b),A(a)));return p};p.updateOptions=function(a,b){if(v(a)&&L(b)&&k.hasOwnProperty(a)){a=k[a].options;b=Ga(b);var d=!1,c;for(c in b)b.hasOwnProperty(c)&&a.hasOwnProperty(c)&&a[c]!==b[c]&&(a[c]=b[c],d=!0);d&&(A(a,!0),z(a.events.onRefresh,a.currentView.element),z(a.events.onOptionsUpdate,a.currentView.element,a))}return p};p.destroyAll=function(){for(var a in k)k.hasOwnProperty(a)&&Qa(k[a].options);k={};return p};p.destroy=function(a){v(a)&& diff --git a/src/heat.js b/src/heat.js index a7fd66e8..fccd74c4 100644 --- a/src/heat.js +++ b/src/heat.js @@ -495,7 +495,7 @@ bindingOptions.currentView.tooltip.style.display = "block"; showElementAtMousePosition( e, bindingOptions.currentView.tooltip ); - }, bindingOptions.tooltipDelay ); + }, bindingOptions.tooltip.delay ); } function hideToolTip( bindingOptions ) { @@ -530,7 +530,7 @@ } if ( bindingOptions.title.showText ) { - title.innerHTML += bindingOptions.titleText; + title.innerHTML += bindingOptions.title.text; } if ( bindingOptions.views.chart.enabled || bindingOptions.views.days.enabled || bindingOptions.views.statistics.enabled ) { @@ -1565,7 +1565,7 @@ addToolTip( day, bindingOptions, fireCustomTrigger( bindingOptions.events.onDayToolTipRender, date, dateCount ) ); } else { - var tooltip = getCustomFormattedDateText( bindingOptions.dayToolTipText, date ); + var tooltip = getCustomFormattedDateText( bindingOptions.tooltip.dayText, date ); if ( bindingOptions.showHolidaysInDayToolTips ) { var holiday = isHoliday( bindingOptions, date ); @@ -2244,7 +2244,6 @@ options.exportOnlyYearBeingViewed = getDefaultBoolean( options.exportOnlyYearBeingViewed, true ); options.year = getDefaultNumber( options.year, new Date().getFullYear() ); options.view = getDefaultString( options.view, _elements_View_Name_Map ); - options.tooltipDelay = getDefaultNumber( options.tooltipDelay, 750 ); options.exportType = getDefaultString( options.exportType, _export_Type_Csv ); options.useLocalStorageForData = getDefaultBoolean( options.useLocalStorageForData, false ); options.allowFileImports = getDefaultBoolean( options.allowFileImports, true ); @@ -2255,10 +2254,10 @@ options = buildAttributeOptionColorRanges( options ); options = buildAttributeOptionHolidays( options ); - options = buildAttributeOptionStrings( options ); options = buildAttributeOptionTitle( options ); options = buildAttributeOptionDescription( options ); options = buildAttributeOptionGuide( options ); + options = buildAttributeOptionToolTip( options ); options = buildAttributeOptionMapView( options ); options = buildAttributeOptionChartView( options ); options = buildAttributeOptionDaysView( options ); @@ -2345,15 +2344,9 @@ return options; } - function buildAttributeOptionStrings( options ) { - options.titleText = getDefaultString( options.titleText, "Heat.js" ); - options.dayToolTipText = getDefaultString( options.dayToolTipText, "{d}{o} {mmmm} {yyyy}" ); - - return options; - } - function buildAttributeOptionTitle( options ) { options.title = getDefaultObject( options.title, {} ); + options.title.text = getDefaultString( options.title.text, "Heat.js" ); options.title.showText = getDefaultBoolean( options.title.showText, true ); options.title.showYearSelector = getDefaultBoolean( options.title.showYearSelector, true ); options.title.showRefreshButton = getDefaultBoolean( options.title.showRefreshButton, false ); @@ -2384,6 +2377,14 @@ return options; } + function buildAttributeOptionToolTip( options ) { + options.tooltip = getDefaultObject( options.tooltip, {} ); + options.tooltip.delay = getDefaultNumber( options.tooltip.delay, 750 ); + options.tooltip.dayText = getDefaultString( options.tooltip.dayText, "{d}{o} {mmmm} {yyyy}" ); + + return options; + } + function buildAttributeOptionMapView( options ) { options.views.map = getDefaultObject( options.views.map, {} ); options.views.map.showMonthDayGaps = getDefaultBoolean( options.views.map.showMonthDayGaps, true );