//const dburl = "http://localhost:3000/db" //const dburl = "https://ed.brz9.dev/proj/map/asset/json/db.json" const dburl = "https://ed.brz9.dev/proj/map/asset/json/endpoint/" Vue.component('Time', { template : `

{{ this.days.mon.fr }} {{ this.days.mon.en }} {{ this.days.mon.it }} {{ this.obj.mon }}

{{ this.days.tue.fr }} {{ this.days.tue.en }} {{ this.days.tue.it }} {{ this.obj.tue }}

{{ this.days.wed.fr }} {{ this.days.wed.en }} {{ this.days.wed.it }} {{ this.obj.wed }}

{{ this.days.thu.fr }} {{ this.days.thu.en }} {{ this.days.thu.it }} {{ this.obj.thu }}

{{ this.days.fri.fr }} {{ this.days.fri.en }} {{ this.days.fri.it }} {{ this.obj.fri }}

{{ this.days.sat.fr }} {{ this.days.sat.en }} {{ this.days.sat.it }} {{ this.obj.sat }}

{{ this.days.sun.fr }} {{ this.days.sun.en }} {{ this.days.sun.it }} {{ this.obj.sun }}

`, props : { obj : Object }, data () { return { message : "hello from time", days : { mon : { fr : "Lundi", en : "Monday", it : "Lunedì" }, tue : { fr : "Mardi", en : "Tuesday", it : "Martedì" }, wed : { fr : "Mercredi", en : "Wednesday", it : "Mercoledì" }, thu : { fr : "Jeudi", en : "Thursday", it : "Giovedì" }, fri : { fr : "Vendredi", en : "Friday", it : "Venerdì" }, sat : { fr : "Samedi", en : "Saturday", it : "Sabato" }, sun : { fr : "Dimanche", en : "Sunday", it : "Domenica" }, } } }, methods : { getTime () { tabtype } } }); Vue.component('Accordeon', { template : `
`, props : { list : Object }, data () { return { isActive : false, displayCard : "block", cardTop : "110vh", tabrollxoff : 0, tabind : 0, markerL : 0, markerW : 0, } }, computed: { xy: function () { if ('xy' in this.list) { return this.list.xy } else { return [0,0] } }, dirxy: function () { if ('dirxy' in this.list) { return this.list.dirxy } else { return [0,0] } }, dirzl: function () { if ('dirzl' in this.list) { return this.list.dirzl } else { return 1 } }, href: function () { return "#" + this.list.id; }, cardid: function () { return "card" + this.list.id; }, tabcount: function () { if ('card' in this.list){ console.log(this.list + " has a card") var arr = Object.entries(this.list.card.tabs); return arr.length } else { return 0; } }, tabrollw: function () { return this.tabcount + "00vw"; }, tabrollTransX: function () { return "translateX(-" + this.tabrollxoff + "00vw)"; }, }, methods : { getMarkerId(i) { return this.cardid + this.getIndex(i).toString() }, getIndex(obj) { var arr = Object.entries(this.list.card.tabs); let ind = arr.findIndex(e => e[0] === obj.tabtype); return ind }, setTab(ind) { this.tabrollxoff = ind; this.tabind = ind t = document.getElementById(this.cardid + ind); this.markerL = t.offsetLeft + "px" this.markerW = t.offsetWidth + "px" console.log(this.markerL) }, getTabLogo(obj) { switch(obj.tabtype) { case "menu": return "byl-icon-restaurant" // code block break; case "time": return "byl-icon-clock" // code block break; default: // code block } }, showCard() { this.displayCard = "block"; this.setTab(0) console.log("showing card") this.cardTop = "0vh" this.setTab(0) this.setTab(0) this.setMap() this.setTab(0) }, hideCard() { this.cardTop = "110vh" }, donothing () { }, toggleActive () { this.list.isActive = !this.list.isActive document.getElementById(this.list.id).scrollIntoView(); }, setMap () { map.setView(this.dirxy, this.dirzl) this.list.marker.openPopup() console.log("setMap") } }, }) const jsonurl = "https://ed.brz9.dev/proj/map/asset/json/db.json" /* let jdnb fetch(jsonurl) .then(res => res.json()) .then(data => jdnb = data) */ let vm = new Vue({ el: '#root', data : jdb.data, methods: { hidelang: function(lang) { langClass = "b9h-lang-" + lang; langElms = document.getElementsByClassName(langClass); for (i = 0; i < langElms.length; i++) { langElms[i].style.display = 'none'; } }, hidelangs: function() { this.hidelang('fr'); this.hidelang('en'); this.hidelang('it'); }, showlang: function(lang) { this.hidelangs(); langClass = "b9h-lang-" + lang; langElms = document.getElementsByClassName(langClass); for (i = 0; i < langElms.length; i++) { langElms[i].style.display = 'revert'; } }, setlang: function (lang) { target = document.querySelector("#"+"tab-"+lang); marker = document.querySelector("#lang-marker"); marker.style.left = target.offsetLeft + "px"; marker.style.width = target.offsetWidth + "px"; this.showlang(lang); }, }, created: function(){ this.setlang('fr'); }, mounted: function() { console.log("mounting"); this.setlang('fr'); console.log("mounted"); this.setlang('fr'); this.setlang('fr'); this.setlang('fr'); this.setlang('fr'); }, updated: function() { this.setlang('fr'); this.setlang('fr'); this.setlang('fr'); this.setlang('fr'); } })