@qhealth-design-system/core 1.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +15 -0
- package/.browserslistrc +5 -0
- package/.editorconfig +19 -0
- package/.eslintignore +1 -0
- package/.eslintrc +25 -0
- package/.gitattributes +2 -0
- package/.github/workflows/release_package.yml +103 -0
- package/CHANGELOG.md +14 -0
- package/README.md +534 -0
- package/dist/api/service_finder/schemas.json +1 -0
- package/dist/component-abstract.html +884 -0
- package/dist/component-accordion.html +1157 -0
- package/dist/component-banner.html +928 -0
- package/dist/component-banner_advanced.html +1524 -0
- package/dist/component-banner_basic.html +1189 -0
- package/dist/component-banner_intermediate.html +1288 -0
- package/dist/component-body.html +919 -0
- package/dist/component-breadcrumbs.html +881 -0
- package/dist/component-btn.html +829 -0
- package/dist/component-callout.html +964 -0
- package/dist/component-card_feature.html +1805 -0
- package/dist/component-card_multi_action.html +1965 -0
- package/dist/component-card_no_action.html +1632 -0
- package/dist/component-card_single_action.html +1772 -0
- package/dist/component-code.html +928 -0
- package/dist/component-footer.html +1131 -0
- package/dist/component-forms.html +1297 -0
- package/dist/component-global-elements.html +1243 -0
- package/dist/component-global_alert.html +891 -0
- package/dist/component-header.html +1155 -0
- package/dist/component-in_page_navigation.html +920 -0
- package/dist/component-internal_navigation.html +1097 -0
- package/dist/component-left_hand_navigation.html +995 -0
- package/dist/component-main_navigation.html +999 -0
- package/dist/component-mega_main_navigation.html +1145 -0
- package/dist/component-multi_column.html +1116 -0
- package/dist/component-page_alert.html +911 -0
- package/dist/component-pagination.html +971 -0
- package/dist/component-tag_list.html +979 -0
- package/dist/component-updated_date.html +778 -0
- package/dist/component-widgets.html +851 -0
- package/dist/components/_global/import.xml +95 -0
- package/dist/components/_global/manifest.json +11 -0
- package/dist/components/_global/presentation.js +50 -0
- package/dist/components/_global/static.html +30 -0
- package/dist/components/_template/import.xml +299 -0
- package/dist/components/_template/manifest.json +40 -0
- package/dist/components/_template/presentation.js +12 -0
- package/dist/components/_template/static.html +4 -0
- package/dist/components/abstract/import.xml +231 -0
- package/dist/components/abstract/manifest.json +29 -0
- package/dist/components/abstract/presentation.js +33 -0
- package/dist/components/abstract/static.html +9 -0
- package/dist/components/accordion/import.xml +1929 -0
- package/dist/components/accordion/manifest.json +427 -0
- package/dist/components/accordion/presentation.js +112 -0
- package/dist/components/accordion/static.html +56 -0
- package/dist/components/banner/import.xml +95 -0
- package/dist/components/banner/manifest.json +11 -0
- package/dist/components/banner/presentation.js +138 -0
- package/dist/components/banner/static.html +39 -0
- package/dist/components/banner_advanced/import.xml +1969 -0
- package/dist/components/banner_advanced/manifest.json +1450 -0
- package/dist/components/banner_advanced/presentation.js +564 -0
- package/dist/components/banner_advanced/static.html +159 -0
- package/dist/components/banner_basic/import.xml +907 -0
- package/dist/components/banner_basic/manifest.json +151 -0
- package/dist/components/banner_basic/presentation.js +325 -0
- package/dist/components/banner_basic/static.html +86 -0
- package/dist/components/banner_intermediate/import.xml +1473 -0
- package/dist/components/banner_intermediate/manifest.json +248 -0
- package/dist/components/banner_intermediate/presentation.js +410 -0
- package/dist/components/banner_intermediate/static.html +102 -0
- package/dist/components/body/import.xml +343 -0
- package/dist/components/body/manifest.json +46 -0
- package/dist/components/body/presentation.js +37 -0
- package/dist/components/body/static.html +5 -0
- package/dist/components/breadcrumbs/import.xml +95 -0
- package/dist/components/breadcrumbs/manifest.json +9 -0
- package/dist/components/breadcrumbs/presentation.js +99 -0
- package/dist/components/breadcrumbs/static.html +21 -0
- package/dist/components/callout/import.xml +953 -0
- package/dist/components/callout/manifest.json +121 -0
- package/dist/components/callout/presentation.js +103 -0
- package/dist/components/callout/static.html +10 -0
- package/dist/components/card_feature/import.xml +2355 -0
- package/dist/components/card_feature/manifest.json +1390 -0
- package/dist/components/card_feature/presentation.js +365 -0
- package/dist/components/card_feature/static.html +80 -0
- package/dist/components/card_multi_action/import.xml +1539 -0
- package/dist/components/card_multi_action/manifest.json +1314 -0
- package/dist/components/card_multi_action/presentation.js +638 -0
- package/dist/components/card_multi_action/static.html +120 -0
- package/dist/components/card_no_action/import.xml +1449 -0
- package/dist/components/card_no_action/manifest.json +1264 -0
- package/dist/components/card_no_action/presentation.js +454 -0
- package/dist/components/card_no_action/static.html +94 -0
- package/dist/components/card_single_action/import.xml +1539 -0
- package/dist/components/card_single_action/manifest.json +1273 -0
- package/dist/components/card_single_action/presentation.js +498 -0
- package/dist/components/card_single_action/static.html +103 -0
- package/dist/components/code/import.xml +569 -0
- package/dist/components/code/manifest.json +112 -0
- package/dist/components/code/presentation.js +124 -0
- package/dist/components/code/static.html +15 -0
- package/dist/components/footer/import.xml +95 -0
- package/dist/components/footer/manifest.json +9 -0
- package/dist/components/footer/presentation.js +409 -0
- package/dist/components/footer/static.html +146 -0
- package/dist/components/global_alert/import.xml +95 -0
- package/dist/components/global_alert/manifest.json +9 -0
- package/dist/components/global_alert/presentation.js +81 -0
- package/dist/components/global_alert/static.html +26 -0
- package/dist/components/header/import.xml +95 -0
- package/dist/components/header/manifest.json +11 -0
- package/dist/components/header/presentation.js +190 -0
- package/dist/components/header/static.html +158 -0
- package/dist/components/horizontal_rule/import.xml +547 -0
- package/dist/components/horizontal_rule/manifest.json +69 -0
- package/dist/components/horizontal_rule/presentation.js +50 -0
- package/dist/components/horizontal_rule/static.html +4 -0
- package/dist/components/in_page_navigation/import.xml +253 -0
- package/dist/components/in_page_navigation/manifest.json +35 -0
- package/dist/components/in_page_navigation/presentation.js +14 -0
- package/dist/components/in_page_navigation/static.html +13 -0
- package/dist/components/internal_navigation/import.xml +95 -0
- package/dist/components/internal_navigation/manifest.json +11 -0
- package/dist/components/internal_navigation/presentation.js +165 -0
- package/dist/components/internal_navigation/static.html +130 -0
- package/dist/components/left_hand_navigation/import.xml +299 -0
- package/dist/components/left_hand_navigation/manifest.json +40 -0
- package/dist/components/left_hand_navigation/presentation.js +178 -0
- package/dist/components/left_hand_navigation/static.html +64 -0
- package/dist/components/main_navigation/import.xml +95 -0
- package/dist/components/main_navigation/manifest.json +11 -0
- package/dist/components/main_navigation/presentation.js +150 -0
- package/dist/components/main_navigation/static.html +80 -0
- package/dist/components/mega_main_navigation/import.xml +95 -0
- package/dist/components/mega_main_navigation/manifest.json +9 -0
- package/dist/components/mega_main_navigation/presentation.js +380 -0
- package/dist/components/mega_main_navigation/static.html +153 -0
- package/dist/components/multi_column/import.xml +1631 -0
- package/dist/components/multi_column/manifest.json +233 -0
- package/dist/components/multi_column/presentation.js +249 -0
- package/dist/components/multi_column/static.html +36 -0
- package/dist/components/page_alert/import.xml +479 -0
- package/dist/components/page_alert/manifest.json +63 -0
- package/dist/components/page_alert/presentation.js +67 -0
- package/dist/components/page_alert/static.html +8 -0
- package/dist/components/pagination/import.xml +95 -0
- package/dist/components/pagination/manifest.json +42 -0
- package/dist/components/pagination/presentation.js +84 -0
- package/dist/components/pagination/static.html +5 -0
- package/dist/components/updated_date/import.xml +95 -0
- package/dist/components/updated_date/manifest.json +9 -0
- package/dist/components/updated_date/presentation.js +34 -0
- package/dist/components/updated_date/static.html +6 -0
- package/dist/components/widgets/import.xml +95 -0
- package/dist/components/widgets/manifest.json +9 -0
- package/dist/components/widgets/presentation.js +40 -0
- package/dist/components/widgets/static.html +0 -0
- package/dist/components.html +790 -0
- package/dist/externals/componentPreview.js +101 -0
- package/dist/externals/dsComponentLoader.js +410 -0
- package/dist/externals/esri-leaflet-vector.js +5 -0
- package/dist/externals/esri-leaflet.js +12 -0
- package/dist/externals/fb-handlebars.min.js +29 -0
- package/dist/externals/fb-typeahead.bundle.min.js +6 -0
- package/dist/externals/funnelback.autocompletion-2.6.0.js +678 -0
- package/dist/externals/getPagination.js +62 -0
- package/dist/externals/handlebars.min-v4.7.6.js +29 -0
- package/dist/externals/leaflet.js +6 -0
- package/dist/externals/populateDatastoreSim.js +381 -0
- package/dist/externals/tinymce_classes.css +62 -0
- package/dist/home.html +694 -0
- package/dist/index.html +710 -0
- package/dist/inner-with-nav.html +1853 -0
- package/dist/inner.html +671 -0
- package/dist/js/helpers.js +892 -0
- package/dist/js/main.js +55 -0
- package/dist/js/main.js.map +1 -0
- package/dist/js/runtime.js +2 -0
- package/dist/js/runtime.js.map +1 -0
- package/dist/main.css +918 -0
- package/dist/main.css.map +1 -0
- package/dist/mysource_files/ajax-loader.gif +0 -0
- package/dist/mysource_files/favicons/favicon.ico +0 -0
- package/dist/mysource_files/img/100x100.jpg +0 -0
- package/dist/mysource_files/img/600x260.jpg +0 -0
- package/dist/mysource_files/img/Heart-Pattern-Dark.png +0 -0
- package/dist/mysource_files/img/Heart-Pattern.png +0 -0
- package/dist/mysource_files/img/banner-background--desktop.png +0 -0
- package/dist/mysource_files/img/banner-background--mobile.png +0 -0
- package/dist/mysource_files/img/banner-bg.png +0 -0
- package/dist/mysource_files/img/banner.png +0 -0
- package/dist/mysource_files/img/card--brand.png +0 -0
- package/dist/mysource_files/img/card--components.png +0 -0
- package/dist/mysource_files/img/card--content.png +0 -0
- package/dist/mysource_files/img/header-logo-agov.png +0 -0
- package/dist/mysource_files/img/header-logo-qgov--dark.svg +63 -0
- package/dist/mysource_files/img/header-logo-qgov--light.svg +56 -0
- package/dist/mysource_files/img/header-logo-qgov--pre-dark.svg +56 -0
- package/dist/mysource_files/img/header-search.svg +3 -0
- package/dist/mysource_files/img/layers-2x.png +0 -0
- package/dist/mysource_files/img/layers.png +0 -0
- package/dist/mysource_files/img/marker-icon.png +0 -0
- package/dist/mysource_files/img/svg-icons.svg +155 -0
- package/dist/mysource_files/img/video-play.svg +3 -0
- package/dist/mysource_files/slick.eot +0 -0
- package/dist/mysource_files/slick.svg +14 -0
- package/dist/mysource_files/slick.ttf +0 -0
- package/dist/mysource_files/slick.woff +0 -0
- package/package-lock.json +14276 -0
- package/package.json +79 -0
- package/scripts/add_component.sh +109 -0
- package/src/assets/favicons/favicon.ico +0 -0
- package/src/assets/img/100x100.jpg +0 -0
- package/src/assets/img/600x260.jpg +0 -0
- package/src/assets/img/Heart-Pattern-Dark.png +0 -0
- package/src/assets/img/Heart-Pattern.png +0 -0
- package/src/assets/img/banner-background--desktop.png +0 -0
- package/src/assets/img/banner-background--mobile.png +0 -0
- package/src/assets/img/banner-bg.png +0 -0
- package/src/assets/img/banner.png +0 -0
- package/src/assets/img/card--brand.png +0 -0
- package/src/assets/img/card--components.png +0 -0
- package/src/assets/img/card--content.png +0 -0
- package/src/assets/img/header-logo-agov.png +0 -0
- package/src/assets/img/header-logo-qgov--dark.svg +63 -0
- package/src/assets/img/header-logo-qgov--light.svg +56 -0
- package/src/assets/img/header-logo-qgov--pre-dark.svg +56 -0
- package/src/assets/img/header-search.svg +3 -0
- package/src/assets/img/layers-2x.png +0 -0
- package/src/assets/img/layers.png +0 -0
- package/src/assets/img/marker-icon.png +0 -0
- package/src/assets/img/svg-icons.svg +155 -0
- package/src/assets/img/video-play.svg +3 -0
- package/src/components/_global/css/admin/component.scss +71 -0
- package/src/components/_global/css/body/component.scss +897 -0
- package/src/components/_global/css/btn/component.scss +564 -0
- package/src/components/_global/css/cta_links/component.scss +121 -0
- package/src/components/_global/css/direction_links/component.scss +196 -0
- package/src/components/_global/css/example/component.scss +54 -0
- package/src/components/_global/css/forms/control_inputs/component.scss +349 -0
- package/src/components/_global/css/forms/general/component.scss +298 -0
- package/src/components/_global/css/forms/select/component.scss +230 -0
- package/src/components/_global/css/forms/text/component.scss +402 -0
- package/src/components/_global/css/global.scss +42 -0
- package/src/components/_global/css/grid-12/component.scss +331 -0
- package/src/components/_global/css/headings/component.scss +172 -0
- package/src/components/_global/css/icons/component.scss +29 -0
- package/src/components/_global/css/link_columns/component.scss +194 -0
- package/src/components/_global/css/link_list/component.scss +37 -0
- package/src/components/_global/css/modal/component.scss +182 -0
- package/src/components/_global/css/slick/component.scss +25 -0
- package/src/components/_global/css/table/component.scss +211 -0
- package/src/components/_global/css/tabs/component.scss +43 -0
- package/src/components/_global/css/tags/component.scss +272 -0
- package/src/components/_global/css/user_location/component.scss +38 -0
- package/src/components/_global/css/version/component.scss +47 -0
- package/src/components/_global/html/component.hbs +108 -0
- package/src/components/_global/html/ds_component.hbs +30 -0
- package/src/components/_global/html/head.html +63 -0
- package/src/components/_global/html/scripts.html +58 -0
- package/src/components/_global/js/_polyfills/global.js +18 -0
- package/src/components/_global/js/animate/global.js +324 -0
- package/src/components/_global/js/forms/global.js +182 -0
- package/src/components/_global/js/global.js +302 -0
- package/src/components/_global/js/manifest.json +11 -0
- package/src/components/_global/js/modal/global.js +236 -0
- package/src/components/_global/js/slick/global.js +153 -0
- package/src/components/_global/js/tabs/global.js +305 -0
- package/src/components/_global/js/user_location/global.js +116 -0
- package/src/components/_template/css/component.scss +22 -0
- package/src/components/_template/html/component-page.html +85 -0
- package/src/components/_template/html/component.hbs +4 -0
- package/src/components/_template/js/global.js +6 -0
- package/src/components/_template/js/manifest.json +40 -0
- package/src/components/abstract/css/component.scss +91 -0
- package/src/components/abstract/html/component.hbs +9 -0
- package/src/components/abstract/js/manifest.json +29 -0
- package/src/components/accordion/css/component.scss +329 -0
- package/src/components/accordion/html/accordion-group.html +157 -0
- package/src/components/accordion/html/component.hbs +46 -0
- package/src/components/accordion/html/default.html +92 -0
- package/src/components/accordion/js/global.js +413 -0
- package/src/components/accordion/js/manifest.json +427 -0
- package/src/components/banner/css/component.scss +664 -0
- package/src/components/banner/html/component.hbs +52 -0
- package/src/components/banner/js/manifest.json +11 -0
- package/src/components/banner_advanced/css/component.scss +7 -0
- package/src/components/banner_advanced/html/component.hbs +213 -0
- package/src/components/banner_advanced/js/global.js +6 -0
- package/src/components/banner_advanced/js/manifest.json +1450 -0
- package/src/components/banner_basic/css/component.scss +52 -0
- package/src/components/banner_basic/html/component.hbs +130 -0
- package/src/components/banner_basic/js/global.js +6 -0
- package/src/components/banner_basic/js/manifest.json +151 -0
- package/src/components/banner_intermediate/css/component.scss +276 -0
- package/src/components/banner_intermediate/html/component.hbs +165 -0
- package/src/components/banner_intermediate/js/global.js +6 -0
- package/src/components/banner_intermediate/js/manifest.json +248 -0
- package/src/components/body/css/component.scss +16 -0
- package/src/components/body/html/component.hbs +5 -0
- package/src/components/body/js/manifest.json +46 -0
- package/src/components/breadcrumbs/css/component.scss +236 -0
- package/src/components/breadcrumbs/html/component.hbs +29 -0
- package/src/components/breadcrumbs/js/manifest.json +9 -0
- package/src/components/callout/css/component.scss +146 -0
- package/src/components/callout/html/component.hbs +28 -0
- package/src/components/callout/js/manifest.json +121 -0
- package/src/components/card_feature/css/component.scss +224 -0
- package/src/components/card_feature/html/component.hbs +129 -0
- package/src/components/card_feature/js/manifest.json +1390 -0
- package/src/components/card_multi_action/css/component.scss +229 -0
- package/src/components/card_multi_action/html/component.hbs +192 -0
- package/src/components/card_multi_action/js/manifest.json +1314 -0
- package/src/components/card_no_action/css/component.scss +551 -0
- package/src/components/card_no_action/html/component.hbs +127 -0
- package/src/components/card_no_action/js/global.js +6 -0
- package/src/components/card_no_action/js/manifest.json +1264 -0
- package/src/components/card_single_action/css/component.scss +164 -0
- package/src/components/card_single_action/html/component.hbs +161 -0
- package/src/components/card_single_action/js/manifest.json +1273 -0
- package/src/components/code/css/component.scss +355 -0
- package/src/components/code/html/component.hbs +84 -0
- package/src/components/code/js/global.js +160 -0
- package/src/components/code/js/manifest.json +112 -0
- package/src/components/footer/css/component.scss +437 -0
- package/src/components/footer/html/component.hbs +177 -0
- package/src/components/footer/js/manifest.json +9 -0
- package/src/components/global_alert/css/component.scss +169 -0
- package/src/components/global_alert/html/component.hbs +38 -0
- package/src/components/global_alert/js/global.js +39 -0
- package/src/components/global_alert/js/manifest.json +9 -0
- package/src/components/header/css/component.scss +697 -0
- package/src/components/header/html/component.hbs +186 -0
- package/src/components/header/js/global.js +188 -0
- package/src/components/header/js/manifest.json +11 -0
- package/src/components/horizontal_rule/css/component.scss +37 -0
- package/src/components/horizontal_rule/html/component.hbs +6 -0
- package/src/components/horizontal_rule/js/manifest.json +69 -0
- package/src/components/in_page_navigation/css/component.scss +54 -0
- package/src/components/in_page_navigation/html/component.hbs +17 -0
- package/src/components/in_page_navigation/js/global.js +51 -0
- package/src/components/in_page_navigation/js/manifest.json +35 -0
- package/src/components/internal_navigation/css/component.scss +437 -0
- package/src/components/internal_navigation/html/component.hbs +57 -0
- package/src/components/internal_navigation/js/manifest.json +11 -0
- package/src/components/left_hand_navigation/css/component.scss +280 -0
- package/src/components/left_hand_navigation/html/component.hbs +77 -0
- package/src/components/left_hand_navigation/js/global.js +36 -0
- package/src/components/left_hand_navigation/js/manifest.json +40 -0
- package/src/components/main_navigation/css/component.scss +706 -0
- package/src/components/main_navigation/html/component.hbs +87 -0
- package/src/components/main_navigation/js/global.js +373 -0
- package/src/components/main_navigation/js/manifest.json +11 -0
- package/src/components/mega_main_navigation/css/component.scss +535 -0
- package/src/components/mega_main_navigation/html/component.hbs +157 -0
- package/src/components/mega_main_navigation/js/global.js +170 -0
- package/src/components/mega_main_navigation/js/manifest.json +9 -0
- package/src/components/multi_column/css/component.scss +11 -0
- package/src/components/multi_column/html/component.hbs +98 -0
- package/src/components/multi_column/js/manifest.json +233 -0
- package/src/components/page_alert/css/component.scss +132 -0
- package/src/components/page_alert/html/component.hbs +26 -0
- package/src/components/page_alert/js/manifest.json +63 -0
- package/src/components/pagination/css/component.scss +196 -0
- package/src/components/pagination/html/component.hbs +41 -0
- package/src/components/pagination/html/default.html +30 -0
- package/src/components/pagination/js/manifest.json +42 -0
- package/src/components/search_box/css/component.scss +48 -0
- package/src/components/search_box/html/component.html +11 -0
- package/src/components/search_box/js/manifest.json +73 -0
- package/src/components/updated_date/css/component.scss +0 -0
- package/src/components/updated_date/html/component.hbs +31 -0
- package/src/components/updated_date/js/manifest.json +9 -0
- package/src/components/widgets/css/component.scss +82 -0
- package/src/components/widgets/html/component.hbs +19 -0
- package/src/components/widgets/html/default.html +4 -0
- package/src/components/widgets/js/current.json +483 -0
- package/src/components/widgets/js/manifest.json +9 -0
- package/src/components/widgets/js/site.json +358 -0
- package/src/data/current.json +522 -0
- package/src/data/current_admin.json +305 -0
- package/src/data/model_component.js +14 -0
- package/src/data/site.json +762 -0
- package/src/externals/componentPreview.js +101 -0
- package/src/externals/dsComponentLoader.js +410 -0
- package/src/externals/esri-leaflet-vector.js +5 -0
- package/src/externals/esri-leaflet.js +12 -0
- package/src/externals/fb-handlebars.min.js +29 -0
- package/src/externals/fb-typeahead.bundle.min.js +6 -0
- package/src/externals/funnelback.autocompletion-2.6.0.js +678 -0
- package/src/externals/getPagination.js +62 -0
- package/src/externals/handlebars.min-v4.7.6.js +29 -0
- package/src/externals/leaflet.js +6 -0
- package/src/externals/populateDatastoreSim.js +381 -0
- package/src/externals/tinymce_classes.css +62 -0
- package/src/helpers/Handlebars/appendIf.js +6 -0
- package/src/helpers/Handlebars/arrayLength.js +3 -0
- package/src/helpers/Handlebars/arrayWith.js +13 -0
- package/src/helpers/Handlebars/capitaliseFirst.js +8 -0
- package/src/helpers/Handlebars/charMax.js +8 -0
- package/src/helpers/Handlebars/checkIf.js +20 -0
- package/src/helpers/Handlebars/columnWidth.js +39 -0
- package/src/helpers/Handlebars/contains.js +7 -0
- package/src/helpers/Handlebars/createMap.js +19 -0
- package/src/helpers/Handlebars/dsMapFromID.js +8 -0
- package/src/helpers/Handlebars/dsMapFromProp.js +8 -0
- package/src/helpers/Handlebars/eachByName.js +18 -0
- package/src/helpers/Handlebars/eachDS.js +7 -0
- package/src/helpers/Handlebars/eachFrom.js +13 -0
- package/src/helpers/Handlebars/eachUpTo.js +8 -0
- package/src/helpers/Handlebars/eachWhen.js +33 -0
- package/src/helpers/Handlebars/formatDate.js +62 -0
- package/src/helpers/Handlebars/generateDates.js +74 -0
- package/src/helpers/Handlebars/getDistance.js +40 -0
- package/src/helpers/Handlebars/getObject.js +3 -0
- package/src/helpers/Handlebars/getParamaterByName.js +11 -0
- package/src/helpers/Handlebars/getPossibleValues.js +13 -0
- package/src/helpers/Handlebars/getProp.js +3 -0
- package/src/helpers/Handlebars/getTags.js +20 -0
- package/src/helpers/Handlebars/getTitle.js +4 -0
- package/src/helpers/Handlebars/ifAny.js +9 -0
- package/src/helpers/Handlebars/ifArray.js +3 -0
- package/src/helpers/Handlebars/ifCond.js +31 -0
- package/src/helpers/Handlebars/ifEqualsOrChained.js +12 -0
- package/src/helpers/Handlebars/ifProp.js +3 -0
- package/src/helpers/Handlebars/if_eq.js +9 -0
- package/src/helpers/Handlebars/inArray.js +8 -0
- package/src/helpers/Handlebars/isPage.js +7 -0
- package/src/helpers/Handlebars/itemAt.js +11 -0
- package/src/helpers/Handlebars/jsonParse.js +8 -0
- package/src/helpers/Handlebars/jsonStringify.js +3 -0
- package/src/helpers/Handlebars/listAZ.js +51 -0
- package/src/helpers/Handlebars/listAZOptions.js +34 -0
- package/src/helpers/Handlebars/listByClosest.js +60 -0
- package/src/helpers/Handlebars/listByClosestWithOffset.js +63 -0
- package/src/helpers/Handlebars/math.js +11 -0
- package/src/helpers/Handlebars/newLineToBreak.js +6 -0
- package/src/helpers/Handlebars/nonBreakingSpaces.js +6 -0
- package/src/helpers/Handlebars/objectFromSelect.js +21 -0
- package/src/helpers/Handlebars/partialReplace.js +9 -0
- package/src/helpers/Handlebars/printAccordion.js +24 -0
- package/src/helpers/Handlebars/replace.js +8 -0
- package/src/helpers/Handlebars/replaceMany.js +5 -0
- package/src/helpers/Handlebars/sizeFormat.js +11 -0
- package/src/helpers/Handlebars/split.js +6 -0
- package/src/helpers/Handlebars/toUpperCase.js +7 -0
- package/src/helpers/Handlebars/urldecode.js +3 -0
- package/src/helpers/Handlebars/urlencode.js +3 -0
- package/src/helpers/Handlebars/withinObject.js +13 -0
- package/src/html/component-abstract.html +86 -0
- package/src/html/component-accordion.html +87 -0
- package/src/html/component-banner.html +84 -0
- package/src/html/component-banner_advanced.html +97 -0
- package/src/html/component-banner_basic.html +163 -0
- package/src/html/component-banner_intermediate.html +91 -0
- package/src/html/component-body.html +116 -0
- package/src/html/component-breadcrumbs.html +88 -0
- package/src/html/component-btn.html +117 -0
- package/src/html/component-callout.html +86 -0
- package/src/html/component-card_feature.html +631 -0
- package/src/html/component-card_multi_action.html +793 -0
- package/src/html/component-card_no_action.html +521 -0
- package/src/html/component-card_single_action.html +631 -0
- package/src/html/component-code.html +84 -0
- package/src/html/component-footer.html +87 -0
- package/src/html/component-forms.html +585 -0
- package/src/html/component-global-elements.html +531 -0
- package/src/html/component-global_alert.html +87 -0
- package/src/html/component-header.html +88 -0
- package/src/html/component-in_page_navigation.html +109 -0
- package/src/html/component-internal_navigation.html +87 -0
- package/src/html/component-left_hand_navigation.html +85 -0
- package/src/html/component-main_navigation.html +87 -0
- package/src/html/component-mega_main_navigation.html +88 -0
- package/src/html/component-multi_column.html +86 -0
- package/src/html/component-page_alert.html +86 -0
- package/src/html/component-pagination.html +86 -0
- package/src/html/component-tag_list.html +340 -0
- package/src/html/component-updated_date.html +88 -0
- package/src/html/component-widgets.html +90 -0
- package/src/html/components.html +136 -0
- package/src/html/home.html +126 -0
- package/src/html/index.html +142 -0
- package/src/html/inner-with-nav.html +1126 -0
- package/src/html/inner.html +107 -0
- package/src/index.js +12 -0
- package/src/styles/global.scss +120 -0
- package/src/styles/imports/figma.scss +0 -0
- package/src/styles/imports/functions.scss +519 -0
- package/src/styles/imports/mixins.scss +658 -0
- package/src/styles/imports/placeholders.scss +68 -0
- package/src/styles/imports/utilities.scss +185 -0
- package/src/styles/imports/variables.scss +484 -0
- package/src/styles/postcss.config.js +4 -0
- package/webpack/JsonMergePlugin.js +35 -0
- package/webpack/PrecompilePlugin.js +369 -0
- package/webpack/webpack.common.js +151 -0
- package/webpack/webpack.dev.js +54 -0
- package/webpack/webpack.prod.js +70 -0
|
@@ -0,0 +1,892 @@
|
|
|
1
|
+
Handlebars.registerHelper('appendIf', function (head, tail, options) {
|
|
2
|
+
if (options.hash.prepend === 'true') {
|
|
3
|
+
return !head ? '' : tail + head;
|
|
4
|
+
}
|
|
5
|
+
return !head ? '' : head + tail;
|
|
6
|
+
});
|
|
7
|
+
Handlebars.registerHelper('arrayLength', function (json) {
|
|
8
|
+
return Object.keys(json).length;
|
|
9
|
+
});
|
|
10
|
+
Handlebars.registerHelper('arrayWith', function(array,key,value,options) {
|
|
11
|
+
var childArray = []
|
|
12
|
+
for(var x = 0; x<array.length;x++) {
|
|
13
|
+
if(array[x][key] == value) {
|
|
14
|
+
childArray.push(array[x]);
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if(childArray.length > 0){
|
|
19
|
+
return options.fn(childArray)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
});
|
|
23
|
+
Handlebars.registerHelper('capitaliseFirst', function(str) {
|
|
24
|
+
var splitStr = str.toLowerCase().split(' ');
|
|
25
|
+
for (var i = 0; i < splitStr.length; i++) {
|
|
26
|
+
splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1);
|
|
27
|
+
}
|
|
28
|
+
return splitStr.join(' ');
|
|
29
|
+
|
|
30
|
+
});
|
|
31
|
+
Handlebars.registerHelper('charMax', function (str, limit) {
|
|
32
|
+
|
|
33
|
+
if (str.length > limit) {
|
|
34
|
+
return str.substring(0, 160) + '...';
|
|
35
|
+
}else{
|
|
36
|
+
return str
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
Handlebars.registerHelper('checkIf', function (v1, o1, v2, mainOperator, v3, o2, v4, options) {
|
|
40
|
+
var operators = {
|
|
41
|
+
'==': function(a, b){ return a==b},
|
|
42
|
+
'===': function(a, b){ return a===b},
|
|
43
|
+
'!=': function(a, b){ return a!=b},
|
|
44
|
+
'!==': function(a, b){ return a!==b},
|
|
45
|
+
'<': function(a, b){ return a<b},
|
|
46
|
+
'<=': function(a, b){ return a<=b},
|
|
47
|
+
'>': function(a, b){ return a>b},
|
|
48
|
+
'>=': function(a, b){ return a>=b},
|
|
49
|
+
'&&': function(a, b){ return a&&b},
|
|
50
|
+
'||': function(a, b){ return a||b},
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
var a1 = operators[o1](v1,v2);
|
|
54
|
+
var a2 = operators[o2](v3,v4);
|
|
55
|
+
var isTrue = operators[mainOperator](a1, a2);
|
|
56
|
+
|
|
57
|
+
return isTrue ? options.fn(this) : options.inverse(this);
|
|
58
|
+
});
|
|
59
|
+
Handlebars.registerHelper('columnWidth', function(target_col, data) {
|
|
60
|
+
|
|
61
|
+
var col_widths = [
|
|
62
|
+
data.col_1_width.value,
|
|
63
|
+
data.col_2_width.value,
|
|
64
|
+
data.col_3_width.value
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
var col_num = Number(data.col_num.value);
|
|
68
|
+
target_col = Number(target_col);
|
|
69
|
+
var width = 12;
|
|
70
|
+
|
|
71
|
+
// Use width override if available
|
|
72
|
+
var width_override = Number(col_widths[target_col-1]);
|
|
73
|
+
if (width_override > 0) {
|
|
74
|
+
width = width_override;
|
|
75
|
+
|
|
76
|
+
// Else loop through columns and accumulate manual width
|
|
77
|
+
} else {
|
|
78
|
+
|
|
79
|
+
var width_acc = 0;
|
|
80
|
+
var auto_cols = 0;
|
|
81
|
+
for (var i = 0; i < col_num; i++) {
|
|
82
|
+
var col_width_override = Number(col_widths[i]);
|
|
83
|
+
if (col_width_override > 0) {
|
|
84
|
+
width_acc += col_width_override;
|
|
85
|
+
} else {
|
|
86
|
+
auto_cols++;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
var width_available = 12 - width_acc;
|
|
92
|
+
width = width_available / auto_cols;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Return bootstrap column class
|
|
96
|
+
return 'col-xs-12 col-lg-' + width;
|
|
97
|
+
});
|
|
98
|
+
Handlebars.registerHelper('contains', function(string, contains, options) {
|
|
99
|
+
if(string.indexOf(contains) !== -1) {
|
|
100
|
+
return options.fn(this);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return options.inverse(this);
|
|
104
|
+
});
|
|
105
|
+
Handlebars.registerHelper('createMap', function(array, key, prop) {
|
|
106
|
+
Array.prototype.polyReduce = function(callbackFn, initialValue) {
|
|
107
|
+
var accumulator = initialValue;
|
|
108
|
+
|
|
109
|
+
for (var i = 0; i < this.length; i++) {
|
|
110
|
+
if (accumulator !== undefined) {
|
|
111
|
+
accumulator = callbackFn.call(undefined, accumulator, this[i], i, this);
|
|
112
|
+
} else {
|
|
113
|
+
accumulator = this[i];
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return accumulator;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return array.polyReduce(function(acc,item) {
|
|
120
|
+
acc[item[key]] = item[prop];
|
|
121
|
+
return acc;
|
|
122
|
+
}, {});
|
|
123
|
+
});
|
|
124
|
+
Handlebars.registerHelper('dsMapFromID', function(datastore, collection, key) {
|
|
125
|
+
return datastore[collection].reduce(function(acc,item) {
|
|
126
|
+
var id = item.id;
|
|
127
|
+
var value = item[key];
|
|
128
|
+
acc[id] = value;
|
|
129
|
+
return acc;
|
|
130
|
+
}, {});
|
|
131
|
+
});
|
|
132
|
+
Handlebars.registerHelper('dsMapFromProp', function(datastore, collection, property, key) {
|
|
133
|
+
return datastore[collection].reduce(function(acc,item) {
|
|
134
|
+
var prop = item[property];
|
|
135
|
+
var value = item[key];
|
|
136
|
+
acc[prop] = value;
|
|
137
|
+
return acc;
|
|
138
|
+
}, {});
|
|
139
|
+
});
|
|
140
|
+
Handlebars.registerHelper('eachByName', function(context,options) {
|
|
141
|
+
var output = "";
|
|
142
|
+
var sorted = context.sort(function(a, b){
|
|
143
|
+
if(a.name < b.name) { return -1; }
|
|
144
|
+
if(a.name > b.name) { return 1; }
|
|
145
|
+
return 0;
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
for(let item in sorted) {
|
|
149
|
+
let i = Object.keys(sorted).indexOf(item);
|
|
150
|
+
|
|
151
|
+
if(i >= 0) {
|
|
152
|
+
output += options.fn(sorted[item]);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
return output;
|
|
157
|
+
});
|
|
158
|
+
Handlebars.registerHelper('eachDS', function(ds,context,options) {
|
|
159
|
+
var ret = "";
|
|
160
|
+
for (var i = 0, j = ds[context].length; i < j; i++) {
|
|
161
|
+
ret = ret + options.fn(ds[context][i]);
|
|
162
|
+
}
|
|
163
|
+
return ret;
|
|
164
|
+
});
|
|
165
|
+
Handlebars.registerHelper('eachFrom', function(context, count, options) {
|
|
166
|
+
var ret = "";
|
|
167
|
+
|
|
168
|
+
if (window.NodeList && !NodeList.prototype.forEach) {
|
|
169
|
+
NodeList.prototype.forEach = Array.prototype.forEach;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
context.slice(count).forEach(function(elem) {
|
|
173
|
+
ret += options.fn(elem);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
return ret;
|
|
177
|
+
});
|
|
178
|
+
Handlebars.registerHelper('eachUpTo', function (arr, max, options) {
|
|
179
|
+
var item = "";
|
|
180
|
+
var totalCount = max < arr.length ? max : arr.length;
|
|
181
|
+
for (var i = 0; i < totalCount; i++) {
|
|
182
|
+
item = item + options.fn(arr[i]);
|
|
183
|
+
}
|
|
184
|
+
return item;
|
|
185
|
+
});
|
|
186
|
+
Handlebars.registerHelper('eachWhen', function(list, key, value, options) {
|
|
187
|
+
var result = "";
|
|
188
|
+
var arr = [];
|
|
189
|
+
var data = Handlebars.createFrame(options.data);
|
|
190
|
+
var index = 0;
|
|
191
|
+
|
|
192
|
+
for(var i in list) {
|
|
193
|
+
if(list[i][key] === value) {
|
|
194
|
+
arr.push({
|
|
195
|
+
key: i,
|
|
196
|
+
index: index,
|
|
197
|
+
first: 0 === index,
|
|
198
|
+
last: false,
|
|
199
|
+
value: list[i]
|
|
200
|
+
});
|
|
201
|
+
index++;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
arr[arr.length - 1].last = true;
|
|
206
|
+
|
|
207
|
+
for (var i = 0; i < arr.length; i++) {
|
|
208
|
+
data.key = arr[i].key;
|
|
209
|
+
data.index = arr[i].index;
|
|
210
|
+
data.first = arr[i].first;
|
|
211
|
+
data.last = arr[i].last;
|
|
212
|
+
result = result + options.fn(arr[i].value, {
|
|
213
|
+
data: data
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
return result;
|
|
217
|
+
});
|
|
218
|
+
Handlebars.registerHelper('formatDate', function (datetime, formatStr) {
|
|
219
|
+
var date = new Date(datetime);
|
|
220
|
+
|
|
221
|
+
console.log(date);
|
|
222
|
+
|
|
223
|
+
if (isNaN(date.valueOf())) {
|
|
224
|
+
// date is not valid
|
|
225
|
+
return datetime;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
var days = [
|
|
229
|
+
"Sunday",
|
|
230
|
+
"Monday",
|
|
231
|
+
"Tuesday",
|
|
232
|
+
"Wednesday",
|
|
233
|
+
"Thursday",
|
|
234
|
+
"Friday",
|
|
235
|
+
"Saturday",
|
|
236
|
+
];
|
|
237
|
+
var months = [
|
|
238
|
+
"January",
|
|
239
|
+
"February",
|
|
240
|
+
"March",
|
|
241
|
+
"April",
|
|
242
|
+
"May",
|
|
243
|
+
"June",
|
|
244
|
+
"July",
|
|
245
|
+
"August",
|
|
246
|
+
"September",
|
|
247
|
+
"October",
|
|
248
|
+
"November",
|
|
249
|
+
"December",
|
|
250
|
+
];
|
|
251
|
+
|
|
252
|
+
var day = days[date.getDay()];
|
|
253
|
+
var month = months[date.getMonth()];
|
|
254
|
+
|
|
255
|
+
// Tuesday 1 June 2021
|
|
256
|
+
var formatMap = {
|
|
257
|
+
s: String("0" + date.getSeconds()).slice(-2),
|
|
258
|
+
i: String("0" + date.getMinutes()).slice(-2),
|
|
259
|
+
h: String("0" + date.getHours()).slice(-2),
|
|
260
|
+
A: date.getHours() >= 12 ? 'PM' : 'AM',
|
|
261
|
+
a: date.getHours() >= 12 ? 'am' : 'am',
|
|
262
|
+
d: ("0" + date.getDate()).slice(-2), // 01
|
|
263
|
+
D: day.slice(0, 3), // Tue
|
|
264
|
+
F: month, // June
|
|
265
|
+
l: day, // Tuesday
|
|
266
|
+
m: ("0" + (date.getMonth() + 1)).slice(-2), // 06
|
|
267
|
+
M: month.slice(0, 3), // Jun
|
|
268
|
+
n: String(date.getMonth() + 1), // 6
|
|
269
|
+
j: String(date.getDate()), // 1
|
|
270
|
+
y: String(date.getFullYear()).slice(-2), // 21
|
|
271
|
+
Y: String(date.getFullYear()), // 2021
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
var _formatStr = formatStr || "l j F Y";
|
|
275
|
+
|
|
276
|
+
return _formatStr.replace(/[sihAadDFlmMnjyY]/g, function (match) {
|
|
277
|
+
return formatMap[match] || match;
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
Handlebars.registerHelper('generateDates', function (dates) {
|
|
281
|
+
var dateArray = (dates === '' || dates === null) ? [] : dates.split(', ');
|
|
282
|
+
var pastDates = [];
|
|
283
|
+
var futureDates = [];
|
|
284
|
+
var yesterday = new Date();
|
|
285
|
+
yesterday.setDate(yesterday.getDate() - 1);
|
|
286
|
+
var month = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ];
|
|
287
|
+
var html = '';
|
|
288
|
+
|
|
289
|
+
for (let i = 0; i < dateArray.length; i++) {
|
|
290
|
+
dateArray[i] = new Date(dateArray[i]);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
dateArray.sort(function(a,b){
|
|
294
|
+
return a - b;
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
var pastDates = [];
|
|
298
|
+
var futureDates = [];
|
|
299
|
+
|
|
300
|
+
for (let i = 0; i < dateArray.length; i++) {
|
|
301
|
+
if (dateArray[i] < yesterday) {
|
|
302
|
+
pastDates.push(dateArray[i]);
|
|
303
|
+
} else {
|
|
304
|
+
futureDates.push(dateArray[i]);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
convertIntoRange(futureDates, 'upcoming', '');
|
|
309
|
+
convertIntoRange(pastDates, 'past', 'hidden="hidden"');
|
|
310
|
+
|
|
311
|
+
function convertIntoRange(dateArray, type, hidden) {
|
|
312
|
+
var dateRange = false;
|
|
313
|
+
html += `<div role="tabpanel" id="qhealth__service_dates__tab-panel--${type}" aria-labelledby="qhealth__service_dates__tab-heading--${type}" class="qhealth__tab_panel mt-1" ${hidden}>`;
|
|
314
|
+
if (dateArray.length > 0) {
|
|
315
|
+
for (let i = 0; i < dateArray.length; i++) {
|
|
316
|
+
var j = i + 1;
|
|
317
|
+
var nextDate = new Date(dateArray[i]);
|
|
318
|
+
nextDate.setDate(dateArray[i].getDate() + 1);
|
|
319
|
+
if (dateArray.length > j) {
|
|
320
|
+
if (dateArray[j] - nextDate == 0) {
|
|
321
|
+
if (!dateRange) {
|
|
322
|
+
dateRange = true;
|
|
323
|
+
html += `<div>${("0" + dateArray[i].getDate()).slice(-2)} ${month[dateArray[i].getMonth()]} - `;
|
|
324
|
+
}
|
|
325
|
+
} else if (dateRange){
|
|
326
|
+
dateRange = false;
|
|
327
|
+
html += `${("0" + dateArray[i].getDate()).slice(-2)} ${month[dateArray[i].getMonth()]} ${dateArray[i].getFullYear()}</div>`;
|
|
328
|
+
} else {
|
|
329
|
+
dateRange = false;
|
|
330
|
+
html += `<div>${("0" + dateArray[i].getDate()).slice(-2)} ${month[dateArray[i].getMonth()]} ${dateArray[i].getFullYear()}</div>`;
|
|
331
|
+
}
|
|
332
|
+
} else {
|
|
333
|
+
if (dateRange){
|
|
334
|
+
dateRange = false;
|
|
335
|
+
html += `${("0" + dateArray[i].getDate()).slice(-2)} ${month[dateArray[i].getMonth()]} ${dateArray[i].getFullYear()}</div>`;
|
|
336
|
+
} else {
|
|
337
|
+
dateRange = false;
|
|
338
|
+
html += `<div>${("0" + dateArray[i].getDate()).slice(-2)} ${month[dateArray[i].getMonth()]} ${dateArray[i].getFullYear()}</div>`;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
} else {
|
|
343
|
+
if (type == 'upcoming') {
|
|
344
|
+
html += '<div>No upcoming dates are scheduled at this stage. Please check again later.</div>';
|
|
345
|
+
} else {
|
|
346
|
+
html += '<div>There are no past dates for this service.</div>';
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
html += '</div>';
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
return html;
|
|
353
|
+
});
|
|
354
|
+
Handlebars.registerHelper('getDistance', function (lat, lng, userLat, userLong) {
|
|
355
|
+
var distanceAway = "";
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Haversine formula - calculate distance "as the crow flies" between two sets of lat/long coordinates
|
|
359
|
+
* https://stackoverflow.com/questions/27928/calculate-distance-between-two-latitude-longitude-points-haversine-formula
|
|
360
|
+
*
|
|
361
|
+
* @param {number} lat1
|
|
362
|
+
* @param {number} lon1
|
|
363
|
+
* @param {number} lat2
|
|
364
|
+
* @param {number} lon2
|
|
365
|
+
*
|
|
366
|
+
* @returns {number}
|
|
367
|
+
*/
|
|
368
|
+
function getDistance(lat1, lon1, lat2, lon2) {
|
|
369
|
+
var p = 0.017453292519943295; // Math.PI / 180
|
|
370
|
+
var c = Math.cos;
|
|
371
|
+
var a = 0.5 - c((lat2 - lat1) * p)/2 +
|
|
372
|
+
c(lat1 * p) * c(lat2 * p) *
|
|
373
|
+
(1 - c((lon2 - lon1) * p))/2;
|
|
374
|
+
|
|
375
|
+
var result = 12742 * Math.asin(Math.sqrt(a)); // 2 * R; R = 6371 km
|
|
376
|
+
|
|
377
|
+
if (result >= 10) {
|
|
378
|
+
return round(result);
|
|
379
|
+
} else {
|
|
380
|
+
return round(result, 1)
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
function round(value, precision) {
|
|
385
|
+
var multiplier = Math.pow(10, precision || 0);
|
|
386
|
+
return Math.round(value * multiplier) / multiplier;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// Init
|
|
390
|
+
distanceAway = getDistance(lat, lng, userLat, userLong);
|
|
391
|
+
|
|
392
|
+
return distanceAway;
|
|
393
|
+
});
|
|
394
|
+
Handlebars.registerHelper('getObject', function (obj,key,prop) {
|
|
395
|
+
return obj[key][prop];
|
|
396
|
+
});
|
|
397
|
+
Handlebars.registerHelper('getParamaterByName', function(name,req) {
|
|
398
|
+
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
|
|
399
|
+
var regexS = "[\\?&]"+name+"=([^&#]*)";
|
|
400
|
+
var regex = new RegExp( regexS );
|
|
401
|
+
var results = regex.exec( req.originalUrl );
|
|
402
|
+
if( results == null ) {
|
|
403
|
+
return "";
|
|
404
|
+
} else {
|
|
405
|
+
return decodeURIComponent(results[1].replace(/\+/g, " "));
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
Handlebars.registerHelper('getPossibleValues', function(obj,key) {
|
|
409
|
+
var possibleValues = [];
|
|
410
|
+
for(var i in obj) {
|
|
411
|
+
if (obj[i].hasOwnProperty(key)) {
|
|
412
|
+
var value = obj[i][key];
|
|
413
|
+
if (possibleValues.indexOf(value) === -1) {
|
|
414
|
+
possibleValues.push(value);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
return possibleValues;
|
|
420
|
+
});
|
|
421
|
+
Handlebars.registerHelper('getProp', function (obj,prop) {
|
|
422
|
+
return obj[prop];
|
|
423
|
+
});
|
|
424
|
+
Handlebars.registerHelper('getTags', function(selectValues, tags, options) {
|
|
425
|
+
let output = "";
|
|
426
|
+
let splitSelectValues = [];
|
|
427
|
+
|
|
428
|
+
if(tags){
|
|
429
|
+
|
|
430
|
+
if(selectValues) {
|
|
431
|
+
splitSelectValues = selectValues.replace(/_/g, ' ').split('; ');
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
for(let selectValue in splitSelectValues) {
|
|
435
|
+
if(splitSelectValues.hasOwnProperty(selectValue)) {
|
|
436
|
+
var key = splitSelectValues[selectValue].replace(/ /g, '_');
|
|
437
|
+
output = output + options.fn({key: key, value: tags[key]})
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
return output;
|
|
443
|
+
});
|
|
444
|
+
Handlebars.registerHelper('getTitle', function (obj,name) {
|
|
445
|
+
var index = name.replace(/\D/g, "");
|
|
446
|
+
return obj['title_' + index].value;
|
|
447
|
+
});
|
|
448
|
+
Handlebars.registerHelper('if_eq', function () {
|
|
449
|
+
const args = Array.prototype.slice.call(arguments, 0, -1);
|
|
450
|
+
const options = arguments[arguments.length - 1];
|
|
451
|
+
const allEqual = args.every(function (expression) {
|
|
452
|
+
return args[0] === expression;
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
return allEqual ? options.fn(this) : options.inverse(this);
|
|
456
|
+
});
|
|
457
|
+
Handlebars.registerHelper('ifAny', function () {
|
|
458
|
+
var options = arguments[arguments.length - 1];
|
|
459
|
+
for (var i = 0; i < arguments.length - 1; i++) {
|
|
460
|
+
if (arguments[i]) {
|
|
461
|
+
return options.fn(this);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
return options.inverse(this);
|
|
465
|
+
});
|
|
466
|
+
Handlebars.registerHelper('ifArray', function (input,options) {
|
|
467
|
+
return Array.isArray(input) ? options.fn(this) : options.inverse(this);
|
|
468
|
+
});
|
|
469
|
+
Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) {
|
|
470
|
+
switch (operator) {
|
|
471
|
+
case '==':
|
|
472
|
+
return (v1 == v2) ? options.fn(this) : options.inverse(this);
|
|
473
|
+
case '===':
|
|
474
|
+
return (v1 === v2) ? options.fn(this) : options.inverse(this);
|
|
475
|
+
case '!=':
|
|
476
|
+
return (v1 != v2) ? options.fn(this) : options.inverse(this);
|
|
477
|
+
case '!==':
|
|
478
|
+
return (v1 !== v2) ? options.fn(this) : options.inverse(this);
|
|
479
|
+
case '<':
|
|
480
|
+
return (v1 < v2) ? options.fn(this) : options.inverse(this);
|
|
481
|
+
case '<=':
|
|
482
|
+
return (v1 <= v2) ? options.fn(this) : options.inverse(this);
|
|
483
|
+
case '>':
|
|
484
|
+
return (v1 > v2) ? options.fn(this) : options.inverse(this);
|
|
485
|
+
case '>=':
|
|
486
|
+
return (v1 >= v2) ? options.fn(this) : options.inverse(this);
|
|
487
|
+
case '&&':
|
|
488
|
+
return (v1 && v2) ? options.fn(this) : options.inverse(this);
|
|
489
|
+
case '||':
|
|
490
|
+
return (v1 || v2) ? options.fn(this) : options.inverse(this);
|
|
491
|
+
case 'contains':
|
|
492
|
+
if(typeof v1 == 'string' && typeof v2 == 'string') {
|
|
493
|
+
return (v1.toLowerCase().indexOf(v2.toLowerCase()) >= 0) ? options.fn(this) : options.inverse(this);
|
|
494
|
+
}
|
|
495
|
+
else return options.inverse(this);
|
|
496
|
+
default:
|
|
497
|
+
return options.inverse(this);
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
Handlebars.registerHelper('ifEqualsOrChained', function() {
|
|
501
|
+
var options = arguments[arguments.length-1];
|
|
502
|
+
// Assuming that all wanted operator are '||'
|
|
503
|
+
var valueToTest = arguments[0];
|
|
504
|
+
|
|
505
|
+
for (var i = 1; i < (arguments.length - 1); i++) {
|
|
506
|
+
if (valueToTest === arguments[i]) {
|
|
507
|
+
return options.fn(this);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
return options.inverse(this);
|
|
511
|
+
});
|
|
512
|
+
Handlebars.registerHelper('ifProp', function (obj,key,prop,options) {
|
|
513
|
+
return (obj[key][prop]) ? options.fn(this) : options.inverse(this);
|
|
514
|
+
});
|
|
515
|
+
Handlebars.registerHelper('inArray', function(array,key,value,options) {
|
|
516
|
+
for(var x = 0; x<array.length;x++) {
|
|
517
|
+
if(array[x][key] === value) {
|
|
518
|
+
return options.fn(this)
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
return options.inverse(this);
|
|
522
|
+
});
|
|
523
|
+
Handlebars.registerHelper('isPage', function(pageType, options) {
|
|
524
|
+
if (pageType == 'page_standard' || pageType == 'page_redirect') {
|
|
525
|
+
return options.fn(this)
|
|
526
|
+
} else {
|
|
527
|
+
return options.inverse(this)
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
Handlebars.registerHelper('itemAt', function (array, index) {
|
|
531
|
+
var idx = parseInt(index, 10);
|
|
532
|
+
if (Array.isArray(array) && !isNaN(idx)) {
|
|
533
|
+
if (idx < 0) {
|
|
534
|
+
return array[array.length + idx];
|
|
535
|
+
}
|
|
536
|
+
if (idx < array.length) {
|
|
537
|
+
return array[idx];
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
Handlebars.registerHelper('jsonParse', function(string) {
|
|
542
|
+
try {
|
|
543
|
+
return JSON.parse(string);
|
|
544
|
+
} catch (error) {
|
|
545
|
+
return {};
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
});
|
|
549
|
+
Handlebars.registerHelper('jsonStringify', function(string) {
|
|
550
|
+
return JSON.stringify(string);
|
|
551
|
+
});
|
|
552
|
+
Handlebars.registerHelper('listAZ', function(items, url, options) {
|
|
553
|
+
var html = '<li class="qhealth__services_a-z__list__item">';
|
|
554
|
+
var services = [];
|
|
555
|
+
var letters = [];
|
|
556
|
+
|
|
557
|
+
for(var i = 0; i < items.length; i++) {
|
|
558
|
+
var service = items[i].name;
|
|
559
|
+
var serviceUrl = items[i].web_path;
|
|
560
|
+
if(service == ""){
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
var firstLetter = service.substring(0,1);
|
|
565
|
+
var arrayWithFirstLetter = services[firstLetter];
|
|
566
|
+
|
|
567
|
+
if(arrayWithFirstLetter == null){
|
|
568
|
+
services[firstLetter] = [];
|
|
569
|
+
letters.push(firstLetter);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
services[firstLetter].push({"web_path" : serviceUrl, "name" : service});
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
services = services.sort(function(a, b){
|
|
576
|
+
if(a.name < b.name) { return -1; }
|
|
577
|
+
if(a.name > b.name) { return 1; }
|
|
578
|
+
return 0;
|
|
579
|
+
})
|
|
580
|
+
|
|
581
|
+
letters = letters.sort(function(a, b){
|
|
582
|
+
if(a < b) { return -1; }
|
|
583
|
+
if(a > b) { return 1; }
|
|
584
|
+
return 0;
|
|
585
|
+
})
|
|
586
|
+
|
|
587
|
+
url = url ? url : '';
|
|
588
|
+
|
|
589
|
+
for(var i = 0; i < letters.length; i++) {
|
|
590
|
+
html += '<h3 class="qhealth__services_a-z__list__item__header"><span id="'+letters[i]+'">'+letters[i]+'</span></h3>';
|
|
591
|
+
html += '<ul class="row qhealth__services_a-z__list__item__services">';
|
|
592
|
+
for(var k = 0; k < services[letters[i]].length; k++) {
|
|
593
|
+
html += '<li class="col-lg-4 col-md-6 col-xs-12 qhealth__services_a-z__list__item__services__item"><a class="qhealth__services_a-z__list__item__services__item__link" href="'+url+'/'+services[letters[i]][k].web_path+'"><span>'+services[letters[i]][k].name+'</span><i class="fas fa-arrow-right"></i></a></li>';
|
|
594
|
+
}
|
|
595
|
+
html += '</ul>';
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
html += '</li>';
|
|
600
|
+
|
|
601
|
+
return html;
|
|
602
|
+
});
|
|
603
|
+
Handlebars.registerHelper('listAZOptions', function(items, options) {
|
|
604
|
+
var html = '';
|
|
605
|
+
var services = [];
|
|
606
|
+
var letters = [];
|
|
607
|
+
for(var i = 0; i < items.length; i++) {
|
|
608
|
+
var service = items[i].name;
|
|
609
|
+
|
|
610
|
+
if(service == ""){
|
|
611
|
+
continue;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
var firstLetter = service.substring(0,1);
|
|
615
|
+
var arrayWithFirstLetter = services[firstLetter];
|
|
616
|
+
|
|
617
|
+
if(arrayWithFirstLetter == null){
|
|
618
|
+
services[firstLetter] = [];
|
|
619
|
+
letters.push(firstLetter);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
letters = letters.sort(function(a, b){
|
|
624
|
+
if(a < b) { return -1; }
|
|
625
|
+
if(a > b) { return 1; }
|
|
626
|
+
return 0;
|
|
627
|
+
})
|
|
628
|
+
|
|
629
|
+
for(var i = 0; i < letters.length; i++) {
|
|
630
|
+
|
|
631
|
+
html += '<li class="qld__services_a-z__options__item"><a class="qld__services_a-z__options__item__link" href="#' + letters[i] + '">' + letters[i] + '</a></li>';
|
|
632
|
+
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
return html;
|
|
636
|
+
});
|
|
637
|
+
Handlebars.registerHelper('listByClosest', function (arr, max, userLat, userLong, options) {
|
|
638
|
+
var item = "";
|
|
639
|
+
var totalCount = max < arr.length ? max : arr.length;
|
|
640
|
+
|
|
641
|
+
Array.prototype.polyMap = function(callbackFn) {
|
|
642
|
+
var arr = [];
|
|
643
|
+
for (var i = 0; i < this.length; i++) {
|
|
644
|
+
/* call the callback function for every value of this array and push the returned value into our resulting array
|
|
645
|
+
*/
|
|
646
|
+
arr.push(callbackFn(this[i], i, this));
|
|
647
|
+
}
|
|
648
|
+
return arr;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
arr = arr.polyMap(function(item) {
|
|
652
|
+
item.distanceAway = getDistance(item.latitude, item.longitude, userLat, userLong);
|
|
653
|
+
return item;
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
arr.sort(function(a, b) {
|
|
657
|
+
return a.distanceAway - b.distanceAway;
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
for (var i = 0; i < totalCount; i++) {
|
|
661
|
+
item = item + options.fn(arr[i]);
|
|
662
|
+
}
|
|
663
|
+
return item;
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Haversine formula - calculate distance "as the crow flies" between two sets of lat/long coordinates
|
|
667
|
+
* https://stackoverflow.com/questions/27928/calculate-distance-between-two-latitude-longitude-points-haversine-formula
|
|
668
|
+
*
|
|
669
|
+
* @param {number} lat1
|
|
670
|
+
* @param {number} lon1
|
|
671
|
+
* @param {number} lat2
|
|
672
|
+
* @param {number} lon2
|
|
673
|
+
*
|
|
674
|
+
* @returns {number}
|
|
675
|
+
*/
|
|
676
|
+
function getDistance(lat1, lon1, lat2, lon2) {
|
|
677
|
+
var p = 0.017453292519943295; // Math.PI / 180
|
|
678
|
+
var c = Math.cos;
|
|
679
|
+
var a = 0.5 - c((lat2 - lat1) * p)/2 +
|
|
680
|
+
c(lat1 * p) * c(lat2 * p) *
|
|
681
|
+
(1 - c((lon2 - lon1) * p))/2;
|
|
682
|
+
|
|
683
|
+
var result = 12742 * Math.asin(Math.sqrt(a)); // 2 * R; R = 6371 km
|
|
684
|
+
|
|
685
|
+
if (result >= 10) {
|
|
686
|
+
return round(result);
|
|
687
|
+
} else {
|
|
688
|
+
return round(result, 1)
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
function round(value, precision) {
|
|
693
|
+
var multiplier = Math.pow(10, precision || 0);
|
|
694
|
+
return Math.round(value * multiplier) / multiplier;
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
Handlebars.registerHelper('listByClosestWithOffset', function (arr, max, offset, userLat, userLong, options) {
|
|
698
|
+
var item = "";
|
|
699
|
+
var totalCount = max < arr.length ? max : arr.length;
|
|
700
|
+
|
|
701
|
+
if(offset === null) {
|
|
702
|
+
offset = 0;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
Array.prototype.polyMap = function(callbackFn) {
|
|
706
|
+
var arr = [];
|
|
707
|
+
for (var i = 0; i < this.length; i++) {
|
|
708
|
+
arr.push(callbackFn(this[i], i, this));
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
return arr;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
arr = arr.polyMap(function(item) {
|
|
715
|
+
item.distanceAway = getDistance(item.latitude, item.longitude, userLat, userLong);
|
|
716
|
+
return item;
|
|
717
|
+
});
|
|
718
|
+
|
|
719
|
+
arr.sort(function(a, b) {
|
|
720
|
+
return a.distanceAway - b.distanceAway;
|
|
721
|
+
});
|
|
722
|
+
|
|
723
|
+
for (var i = 0 + offset; i < totalCount; i++) {
|
|
724
|
+
item = item + options.fn(arr[i]);
|
|
725
|
+
}
|
|
726
|
+
return item;
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Haversine formula - calculate distance "as the crow flies" between two sets of lat/long coordinates
|
|
730
|
+
* https://stackoverflow.com/questions/27928/calculate-distance-between-two-latitude-longitude-points-haversine-formula
|
|
731
|
+
*
|
|
732
|
+
* @param {number} lat1
|
|
733
|
+
* @param {number} lon1
|
|
734
|
+
* @param {number} lat2
|
|
735
|
+
* @param {number} lon2
|
|
736
|
+
*
|
|
737
|
+
* @returns {number}
|
|
738
|
+
*/
|
|
739
|
+
function getDistance(lat1, lon1, lat2, lon2) {
|
|
740
|
+
var p = 0.017453292519943295; // Math.PI / 180
|
|
741
|
+
var c = Math.cos;
|
|
742
|
+
var a = 0.5 - c((lat2 - lat1) * p)/2 +
|
|
743
|
+
c(lat1 * p) * c(lat2 * p) *
|
|
744
|
+
(1 - c((lon2 - lon1) * p))/2;
|
|
745
|
+
|
|
746
|
+
var result = 12742 * Math.asin(Math.sqrt(a)); // 2 * R; R = 6371 km
|
|
747
|
+
|
|
748
|
+
if (result >= 10) {
|
|
749
|
+
return round(result);
|
|
750
|
+
} else {
|
|
751
|
+
return round(result, 1)
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
function round(value, precision) {
|
|
756
|
+
var multiplier = Math.pow(10, precision || 0);
|
|
757
|
+
return Math.round(value * multiplier) / multiplier;
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
Handlebars.registerHelper('math', function(lvalue, operator, rvalue) {
|
|
761
|
+
lvalue = parseFloat(lvalue);
|
|
762
|
+
rvalue = parseFloat(rvalue);
|
|
763
|
+
return {
|
|
764
|
+
"+": lvalue + rvalue,
|
|
765
|
+
"-": lvalue - rvalue,
|
|
766
|
+
"*": lvalue * rvalue,
|
|
767
|
+
"/": lvalue / rvalue,
|
|
768
|
+
"%": lvalue % rvalue
|
|
769
|
+
}[operator];
|
|
770
|
+
});
|
|
771
|
+
Handlebars.registerHelper('newLineToBreak', function (str) {
|
|
772
|
+
if(typeof str == 'string') {
|
|
773
|
+
return str.replace(/\n/g, '<br />');
|
|
774
|
+
}
|
|
775
|
+
else return str;
|
|
776
|
+
});
|
|
777
|
+
Handlebars.registerHelper('nonBreakingSpaces', function(str) {
|
|
778
|
+
if(typeof str == 'string') {
|
|
779
|
+
return str.replace(/ /g, ' ');
|
|
780
|
+
}
|
|
781
|
+
else return '';
|
|
782
|
+
});
|
|
783
|
+
Handlebars.registerHelper('objectFromSelect', function(selectValues, options) {
|
|
784
|
+
let output = "";
|
|
785
|
+
let outputArr = [];
|
|
786
|
+
let splitSelectValues = [];
|
|
787
|
+
|
|
788
|
+
if(selectValues) {
|
|
789
|
+
splitSelectValues = selectValues.replace(/_/g, ' ').split('; ');
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
// if(num !== 0) {
|
|
793
|
+
// splitSelectValues.splice(num);
|
|
794
|
+
// }
|
|
795
|
+
|
|
796
|
+
for(let selectValue in splitSelectValues) {
|
|
797
|
+
if(splitSelectValues.hasOwnProperty(selectValue)) {
|
|
798
|
+
output = output + options.fn({key: splitSelectValues[selectValue].replace(/ /g, '_'), value:splitSelectValues[selectValue].charAt(0).toUpperCase() + splitSelectValues[selectValue].slice(1)})
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
return output;
|
|
803
|
+
});
|
|
804
|
+
Handlebars.registerHelper('partialReplace', function (str, search, replacement) {
|
|
805
|
+
var cleanReplacement = " " + replacement + " ";
|
|
806
|
+
if(typeof str == 'string') {
|
|
807
|
+
console.log(str);
|
|
808
|
+
var regex = new RegExp(search, "g"); // need double backslashes in search to use them in regex
|
|
809
|
+
return str.replace(regex, cleanReplacement);
|
|
810
|
+
}
|
|
811
|
+
else return '';
|
|
812
|
+
});
|
|
813
|
+
Handlebars.registerHelper('printAccordion', function (metadata, options) {
|
|
814
|
+
var accordions = "";
|
|
815
|
+
var accNum = Number(metadata.accordion_num.value);
|
|
816
|
+
var accordion = {"title": "", "content": "", "fieldid":""};
|
|
817
|
+
|
|
818
|
+
for (var property in metadata) {
|
|
819
|
+
var accIndex = property.replace('title_','').replace('content_','');
|
|
820
|
+
accIndex = Number(accIndex);
|
|
821
|
+
|
|
822
|
+
if (property.indexOf('title_') > -1) {
|
|
823
|
+
if (accNum >= accIndex) {
|
|
824
|
+
accordion.title = metadata[property].value;
|
|
825
|
+
}
|
|
826
|
+
} else if(property.indexOf('content_') > -1) {
|
|
827
|
+
if (accNum >= accIndex) {
|
|
828
|
+
accordion.content = metadata[property].value;
|
|
829
|
+
accordion.fieldid = metadata[property].fieldid;
|
|
830
|
+
accordions = accordions + options.fn(accordion);
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
return accordions;
|
|
836
|
+
});
|
|
837
|
+
Handlebars.registerHelper('replace', function (str, search, replacement) {
|
|
838
|
+
if(typeof str == 'string') {
|
|
839
|
+
console.log(str);
|
|
840
|
+
var regex = new RegExp(search, "g"); // need double backslashes in search to use them in regex
|
|
841
|
+
return str.replace(regex, replacement);
|
|
842
|
+
}
|
|
843
|
+
else return '';
|
|
844
|
+
});
|
|
845
|
+
Handlebars.registerHelper('replaceMany', function (find, replace, options) {
|
|
846
|
+
var string = options.fn(this);
|
|
847
|
+
var regex = new RegExp(find, "g");
|
|
848
|
+
return string.replace(regex, replace);
|
|
849
|
+
});
|
|
850
|
+
Handlebars.registerHelper('sizeFormat', function (bytes, decimals) {
|
|
851
|
+
if (bytes === 0) return '0 Bytes';
|
|
852
|
+
|
|
853
|
+
const k = 1024;
|
|
854
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
855
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
856
|
+
|
|
857
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
858
|
+
|
|
859
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
|
860
|
+
});
|
|
861
|
+
Handlebars.registerHelper('split', function(string, separator) {
|
|
862
|
+
if(typeof string == 'string') {
|
|
863
|
+
return string.split(separator);
|
|
864
|
+
}
|
|
865
|
+
else return '';
|
|
866
|
+
});
|
|
867
|
+
Handlebars.registerHelper('toUpperCase', function(string) {
|
|
868
|
+
if(string) {
|
|
869
|
+
return string.toUpperCase();
|
|
870
|
+
} else {
|
|
871
|
+
return '';
|
|
872
|
+
}
|
|
873
|
+
});
|
|
874
|
+
Handlebars.registerHelper('urldecode', function (url) {
|
|
875
|
+
return decodeURIComponent(url || '');
|
|
876
|
+
});
|
|
877
|
+
Handlebars.registerHelper('urlencode', function (url) {
|
|
878
|
+
return encodeURIComponent(url || '');
|
|
879
|
+
});
|
|
880
|
+
Handlebars.registerHelper('withinObject', function(obj,key,options) {
|
|
881
|
+
|
|
882
|
+
var within = Object.keys(obj).some(function() {
|
|
883
|
+
return obj[key] !== "";
|
|
884
|
+
});
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
if(within) {
|
|
888
|
+
return options.fn(this);
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
return options.inverse(this);
|
|
892
|
+
});
|