Downloads - mylife Diabetescare – Deutschland (2024)

{{ result.title }}<\/a><\/h5>

{{ result.description }}<\/p>

{{ labels.asset }}:<\/strong> {{ result.filename }}<\/div>

{{ labels.categories }}: <\/strong>{{ category.meta.title }}<\/span><\/div><\/versions><\/div><\/div>", data: function () { return { labels: { asset: "Datei", categories: "Kategorien", }, }; }, }); Vue.component('addresses', { props: ['result'], mixins: [domDecoderMixin], template: '

', data: function () { return {}; }, }); Vue.component('versions', { props: ['versions'], template: '

{{ older_versions_label }}

', data: function () { return { older_versions_label: 'Frühere Versionen:', show: false }; }, methods: { enter: function(el, done) { var targetHeight = Math.round(parseFloat(el.scrollHeight)); var start = null; var time = 250; el.style.height = '0px'; var animation = function(timestamp) { if (!start) { start = timestamp; } var progress = timestamp - start; el.style.height = Math.min((targetHeight / time) * progress, targetHeight) + 'px'; if (progress < time) { window.requestAnimationFrame(animation); } else { done(); } }; requestAnimationFrame(animation); }, leave: function(el, done) { var height = Math.round(parseFloat(el.scrollHeight)); var start = null; var time = 250; var animation = function(timestamp) { if (!start) { start = timestamp; } var progress = timestamp - start; el.style.height = Math.max(height - ((height / time) * progress), 0) + 'px'; if (progress < time) { window.requestAnimationFrame(animation); } else { done(); } }; requestAnimationFrame(animation); }, }, }); Vue.component('pagination', { props: ['pagination', 'totalResults', 'current'], template: '
', data: function () { return { label: 'Seite %1s von %2s', targetPage: this.current, }; }, watch: { current: function () { this.targetPage = this.current; }, }, computed: { total: function () { return Math.max(1, Math.ceil((this.totalResults / this.pagination.perPage))); }, totalText: function () { var translation = this.label; return translation.replace('%1s', this.targetPage).replace('%2s', this.total); }, hasFirst: function () { return this.targetPage > 2; }, hasPrevious: function () { return this.targetPage > 1; }, hasNext: function () { return this.targetPage < this.total; }, hasLast: function () { return this.targetPage < (this.total - 1); }, displayedPages: function () { const pagesToShow = 7; const halfRange = Math.floor(pagesToShow / 2); let start = Math.max(1, this.targetPage - halfRange); let end = start + pagesToShow - 1; if (end > this.total) { end = this.total; start = Math.max(1, end - pagesToShow + 1); } return Array.from({ length: end - start + 1 }, (_, i) => start + i); }, }, methods: { emitTargetPage: function (targetPage) { this.targetPage = targetPage; this.$emit('input', this.targetPage); }, }, }); var vm = new Vue({ el: '#app', mixins: [VueClickaway.mixin], template: '
', data: { input: {"id":"search","value":"","label":"Suchen"}, areaSearch: {postcode: '', radius: ''}, facets: [], levels: [], selected: {}, preSelected: {}, locale: 'de_DE', pagination: { numberOfItems: 0, perPage: 10, currentPage: 1, }, totalResults: 0, resultType: '', results: [], allCategoriesFromResults: [], defaultConfiguration: {"showDefaultResults":"","numberOfItems":"0","perPage":"8","rootCategories":[1,29],"fixedCategories":[56],"generator":"assets","filters":["category","search"]}, generatorConfiguration: [], labels: { apply: "Anwenden", reset: "Zur\u00fccksetzen", }, executeScrollToResults: false //dynamically controls if scrolling should happen on updated lifecycle event }, mounted: function () { this.pagination.numberOfItems = this.defaultConfiguration.numberOfItems; this.pagination.perPage = this.defaultConfiguration.perPage; this.initFromUrl(); this.updateFacets(); }, updated: function() { this.$nextTick(function() { this.scrollToResults(); }); }, methods: { scrollToResults: function() { var resultElements = this.$el.getElementsByClassName('faceted-results'); if (resultElements.length > 0 && this.executeScrollToResults) { var resultsContainer = resultElements.item(0); var header = document.getElementById('header'); var headerPosition = window.getComputedStyle(header).getPropertyValue('position'); var scrollTo = 0; //in lower resolutions header is fixed, thus we do not need to take it into account when scrolling if (headerPosition !== 'fixed') { scrollTo += document.getElementById('container').offsetTop; } scrollTo += resultsContainer.offsetTop; /** * bah screw it we use jquery. js ecosystem is f*cked up anyways, the most stupid things require 3rd * party polyfills for compat against older browsers or you end up writing mad conditions so that * unsupported browsers don't break when using new experimental tech like element.scrollIntoView(), * or if you want to make old browsers smooth scroll like the newer browser you write a custom * functions which requires dozens of lines for something so mindbogglingly stupid * * how about no? so jquery it is */ jQuery('html, body').animate({scrollTop: scrollTo}); this.executeScrollToResults = false; } }, activeFacet: function (cssId, currentState) { this.facets.forEach(function (facet, index) { if (facet.id === cssId) { Vue.set(facet, 'isActive', !currentState); Vue.set(facet, 'isDisabled', false); } else { Vue.set(facet, 'isActive', false); Vue.set(facet, 'isDisabled', !currentState); } }); }, away: function() { //passing no cssId and true will close all facets and enable disabled ones this.activeFacet('', true); }, initFromUrl: function() { var vue = this; window.location.search.substring(1).split('&').forEach(function(keyValue) { if (keyValue.length > 0) { var split = keyValue.split('='); var key = decodeURIComponent(split[0]); var value = decodeURIComponent(split[1]); if (key.search(/\[\]/g) !== -1) { //replace [] if its in the key name key = key.replace(/\[\]/g, ''); if (!vue.preSelected.hasOwnProperty(key)) { //add new array to store values in vue.preSelected[key] = []; } vue.preSelected[key].push(value); } else { vue.preSelected[key] = value; } } }); if (this.preSelected.hasOwnProperty('search')) { this.input.value = this.preSelected.search; } }, apply: function() { this.pagination.currentPage = 1; this.updateFacets(); var selectedFacets = []; Object.values(this.selected).forEach(type => { Object.values(type).forEach(names => { names.forEach(value => { selectedFacets.push(value); }); }); }); var urlParams = new URLSearchParams(window.location.search); urlParams.delete('category[]'); if (selectedFacets.length > 0) { selectedFacets.forEach((selectedFacet) => { urlParams.append('category[]', selectedFacet); }); var newUrl = window.location.pathname + '?' + urlParams.toString(); window.history.pushState({}, '', newUrl); return; } window.history.pushState({}, '', window.location.pathname); this.preSelected = {}; this.resetSelected(); this.updateFacets(); }, reset: function() { this.areaSearch.postcode = ''; this.areaSearch.radius = ''; this.input = ''; this.preSelected = {}; window.history.pushState({}, '', window.location.pathname); this.resetSelected(); this.updateFacets(); }, updateFacets: function () { this.pagination.currentPage = 1; this.updateSelected(); this.loadFacets(); }, loadFacets: function () { var vue = this; var params = { selected: this.selected, locale: this.locale, preSelected: this.preSelected, defaultConfiguration: this.defaultConfiguration, generatorConfiguration: this.generatorConfiguration, }; axios.post("/facetedsearch/load/facets", params).then(function (response) { var activeId = vue.findActiveFacet(); //reset levels, need to be rebuild (easier than detecting removal and removing it vue.$data.levels = []; vue.$data.facets = response.data.facets; //initialize the facet types - otherwise our v-model defined for facet-filter will cause errors response.data.facets.forEach(function (facet) { if (!vue.$data.selected.hasOwnProperty(facet.type)) { vue.$set(vue.$data.selected, facet.type, {}); } if (!vue.$data.selected[facet.type].hasOwnProperty(facet.name)) { vue.$set(vue.$data.selected[facet.type], facet.name, []); } }); // add additional class to selected categories vue.$data.facets.forEach(function (facet, index) { // Set default values on first init var active = false; if (facet.id === activeId) { active = true; } Vue.set(facet, 'isActive', active); if (activeId.length > 0 && facet.id !== activeId) { Vue.set(facet, 'isDisabled', true); } //load the existing levels if (vue.$data.levels.indexOf(facet.level) === -1) { vue.$data.levels.push(facet.level) } }); vue.updateSelected(); vue.loadResults(); }); }, loadResults: function () { var vue = this; axios.post( "/facetedsearch/load/results", { selected: this.selected, search: this.input.value, pagination: this.pagination, locale: this.locale, areaSearch: this.areaSearch, defaultConfiguration: this.defaultConfiguration, generatorConfiguration: this.generatorConfiguration, } ).then(function (response) { if (response.data.results) { vue.$data.results = response.data.results; } if (response.data.allCategoriesFromResults) { vue.$data.allCategoriesFromResults = response.data.allCategoriesFromResults; } if (response.data.totalResults) { vue.$data.totalResults = response.data.totalResults; } if (response.data.resultType) { vue.$data.resultType = response.data.resultType; } vue.$data.executeScrollToResults = true; vue.updateCategoriesFromResults(); }); }, updateSelected: function () { var vue = this; vue.selected = {}; vue.facets.forEach(function (facet) { facet.options.forEach(function (option) { if (option.checked) { if (!vue.selected.hasOwnProperty(facet.type)) { vue.selected[facet.type] = {}; } if (!vue.selected[facet.type].hasOwnProperty(facet.name)) { vue.selected[facet.type][facet.name] = []; } vue.selected[facet.type][facet.name].push(option.value); } }); }); }, resetSelected: function() { var vue = this; vue.levels = []; vue.selected = {}; vue.facets.forEach(function(facet) { if (vue.$data.levels.indexOf(facet.level) === -1) { vue.$data.levels.push(facet.level); } facet.options.forEach(function(option) { option.checked = false; }); }); }, findActiveFacet: function() { var id = ''; this.$data.facets.forEach(function(facet) { if (facet.isActive) { id = facet.id; } }); return id; }, updateCategoriesFromResults: function() { let categoriesFromResults = new Set(); this.allCategoriesFromResults.forEach((category) => { categoriesFromResults.add(category); }); this.facets.forEach(facet => { facet.options = facet.options.filter(option => { return categoriesFromResults.has(option.value); }); }); }, }, });

Downloads - mylife Diabetescare – Deutschland (2024)
Top Articles
Latest Posts
Article information

Author: Horacio Brakus JD

Last Updated:

Views: 6444

Rating: 4 / 5 (71 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Horacio Brakus JD

Birthday: 1999-08-21

Address: Apt. 524 43384 Minnie Prairie, South Edda, MA 62804

Phone: +5931039998219

Job: Sales Strategist

Hobby: Sculling, Kitesurfing, Orienteering, Painting, Computer programming, Creative writing, Scuba diving

Introduction: My name is Horacio Brakus JD, I am a lively, splendid, jolly, vivacious, vast, cheerful, agreeable person who loves writing and wants to share my knowledge and understanding with you.