2018-11-08 01:09:33 +01:00
|
|
|
import Vue from 'vue'
|
2018-11-17 20:32:28 +01:00
|
|
|
import { Component } from 'vue-property-decorator'
|
2019-03-04 20:29:30 +01:00
|
|
|
import { GlobalStore, UserStore } from '@store'
|
2018-11-08 01:09:33 +01:00
|
|
|
|
2019-01-30 01:05:31 +01:00
|
|
|
import { Logo } from '../../components/logo'
|
2019-01-08 01:22:09 +01:00
|
|
|
|
2019-03-13 13:40:17 +01:00
|
|
|
import VueScrollReveal from 'vue-scroll-reveal'
|
|
|
|
|
import { tools } from '@src/store/Modules/tools'
|
2019-03-09 02:56:02 +01:00
|
|
|
|
|
|
|
|
Vue.use(VueScrollReveal, {
|
|
|
|
|
class: 'v-scroll-reveal', // A CSS class applied to elements with the v-scroll-reveal directive; useful for animation overrides.
|
|
|
|
|
duration: 1200,
|
|
|
|
|
scale: 0.95,
|
|
|
|
|
distance: '10px',
|
|
|
|
|
rotate: {
|
|
|
|
|
x: 0,
|
|
|
|
|
y: 0,
|
|
|
|
|
z: 0
|
|
|
|
|
}
|
|
|
|
|
// mobile: true
|
2019-03-13 13:40:17 +01:00
|
|
|
})
|
2019-03-09 02:56:02 +01:00
|
|
|
|
2018-11-08 01:09:33 +01:00
|
|
|
@Component({
|
2019-01-08 01:22:09 +01:00
|
|
|
components: { Logo }
|
2018-11-08 01:09:33 +01:00
|
|
|
})
|
|
|
|
|
export default class Home extends Vue {
|
2019-03-13 13:40:17 +01:00
|
|
|
public text: string = ''
|
|
|
|
|
public visibile: boolean = false
|
|
|
|
|
public cardvisible: string = 'hidden'
|
|
|
|
|
public displaycard: string = 'block'
|
|
|
|
|
public svgclass: string = 'svgclass'
|
|
|
|
|
public $t: any
|
2019-03-14 01:24:59 +01:00
|
|
|
// public firstClassSection: string = 'landing_background fade homep-cover-img animate-fade homep-cover-img-1'
|
|
|
|
|
public firstClassSection: string = 'fade homep-cover-img animate-fade homep-cover-img-1'
|
2018-11-11 19:27:04 +01:00
|
|
|
public $q
|
2019-03-13 13:40:17 +01:00
|
|
|
public polling
|
2019-03-14 01:24:59 +01:00
|
|
|
public slide = 'first'
|
2018-11-11 19:27:04 +01:00
|
|
|
|
2018-11-08 01:09:33 +01:00
|
|
|
constructor() {
|
|
|
|
|
super()
|
2019-01-31 13:52:52 +01:00
|
|
|
// console.log('Home constructor...')
|
2018-11-08 01:09:33 +01:00
|
|
|
this.initprompt()
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-13 13:40:17 +01:00
|
|
|
public mounted() {
|
2019-03-08 02:04:56 +01:00
|
|
|
let primo = true
|
2019-03-13 13:40:17 +01:00
|
|
|
const mytime = 10000
|
2019-03-08 02:04:56 +01:00
|
|
|
this.polling = setInterval(() => {
|
|
|
|
|
|
2019-03-14 01:24:59 +01:00
|
|
|
this.firstClassSection = 'landing_background fade homep-cover-img ' + (primo ? 'homep-cover-img-2' : 'homep-cover-img-1')
|
2019-03-08 02:04:56 +01:00
|
|
|
primo = !primo
|
2019-02-05 18:17:36 +01:00
|
|
|
|
2019-03-09 02:56:02 +01:00
|
|
|
// console.log('this.firstClassSection', this.firstClassSection)
|
2019-03-08 02:04:56 +01:00
|
|
|
|
|
|
|
|
}, mytime)
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-13 13:40:17 +01:00
|
|
|
public beforeDestroy() {
|
2019-03-08 02:04:56 +01:00
|
|
|
console.log('beforeDestroy')
|
|
|
|
|
clearInterval(this.polling)
|
|
|
|
|
}
|
2019-03-13 13:40:17 +01:00
|
|
|
public created() {
|
2019-02-22 10:23:00 +01:00
|
|
|
|
2019-02-05 18:17:36 +01:00
|
|
|
GlobalStore.actions.prova()
|
2018-12-26 21:02:16 +01:00
|
|
|
}
|
|
|
|
|
|
2019-03-08 02:04:56 +01:00
|
|
|
get isLogged() {
|
2019-03-04 20:29:30 +01:00
|
|
|
return UserStore.state.isLogged
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-08 02:04:56 +01:00
|
|
|
get TelegramSupport() {
|
|
|
|
|
return process.env.TELEGRAM_SUPPORT
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-13 13:40:17 +01:00
|
|
|
public meta() {
|
2019-02-22 10:23:00 +01:00
|
|
|
return {
|
|
|
|
|
keywords: { name: 'keywords', content: 'Quasar website' },
|
|
|
|
|
// meta tags
|
|
|
|
|
meta: {
|
|
|
|
|
mykey: { name: 'mykey', content: 'Key 1' },
|
|
|
|
|
description: { name: 'description', content: 'Page 1' },
|
|
|
|
|
keywords: { name: 'keywords', content: 'Quasar website' },
|
2019-03-13 13:40:17 +01:00
|
|
|
equiv: { 'http-equiv': 'Content-Type', 'content': 'text/html; charset=UTF-8' }
|
2019-02-22 10:23:00 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-13 13:40:17 +01:00
|
|
|
public mystilecard() {
|
2018-11-08 01:09:33 +01:00
|
|
|
return {
|
|
|
|
|
visibility: this.cardvisible,
|
|
|
|
|
display: this.displaycard
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get conta() {
|
2018-12-26 21:02:16 +01:00
|
|
|
return GlobalStore.state.conta
|
2018-11-08 01:09:33 +01:00
|
|
|
}
|
2019-02-05 18:17:36 +01:00
|
|
|
|
2019-03-13 13:40:17 +01:00
|
|
|
public getenv(myvar) {
|
2019-03-08 02:04:56 +01:00
|
|
|
return process.env[myvar]
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-08 01:09:33 +01:00
|
|
|
set conta(valore) {
|
2018-11-17 20:32:28 +01:00
|
|
|
GlobalStore.actions.setConta(valore)
|
2019-03-13 13:40:17 +01:00
|
|
|
const my = this.$q.lang.isoName
|
|
|
|
|
tools.showNotif(this.$q, String(my))
|
2018-11-08 01:09:33 +01:00
|
|
|
}
|
|
|
|
|
|
2019-03-13 13:40:17 +01:00
|
|
|
public initprompt() {
|
|
|
|
|
window.addEventListener('beforeinstallprompt', function(event) {
|
2019-02-13 18:48:30 +01:00
|
|
|
// console.log('******************************** beforeinstallprompt fired')
|
2018-11-08 01:09:33 +01:00
|
|
|
event.preventDefault()
|
2019-02-14 18:38:23 +01:00
|
|
|
// console.log('§§§§§§§§§§§§§§§§§§§§ IMPOSTA DEFERRED PROMPT !!!!!!!!!!!!!!!!! ')
|
|
|
|
|
// #Todo++ IMPOSTA DEFERRED PROMPT
|
2018-11-08 01:09:33 +01:00
|
|
|
return false
|
|
|
|
|
})
|
2019-02-01 04:10:31 +01:00
|
|
|
|
2018-11-08 01:09:33 +01:00
|
|
|
}
|
|
|
|
|
|
2019-03-13 13:40:17 +01:00
|
|
|
get isInCostruction() {
|
2019-03-04 20:29:30 +01:00
|
|
|
return process.env.IN_CONSTRUCTION === '1'
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-13 13:40:17 +01:00
|
|
|
public getPermission() {
|
2019-02-04 16:47:15 +01:00
|
|
|
return Notification.permission
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-13 13:40:17 +01:00
|
|
|
public NotServiceWorker() {
|
2019-02-14 18:38:23 +01:00
|
|
|
return (!('serviceWorker' in navigator))
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-13 13:40:17 +01:00
|
|
|
public PagLogin() {
|
2019-03-04 20:29:30 +01:00
|
|
|
this.$router.replace('/signin')
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-13 13:40:17 +01:00
|
|
|
public PagReg() {
|
2019-03-04 20:29:30 +01:00
|
|
|
this.$router.replace('/signup')
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-13 13:40:17 +01:00
|
|
|
public displayConfirmNotification() {
|
2019-02-04 16:47:15 +01:00
|
|
|
let options = null
|
|
|
|
|
if ('serviceWorker' in navigator) {
|
|
|
|
|
options = {
|
|
|
|
|
body: 'You successfully subscribed to our Notification service!',
|
2019-02-05 03:39:56 +01:00
|
|
|
icon: '/statics/icons/app-icon-96x96.png',
|
2019-03-05 23:44:48 +01:00
|
|
|
image: '/statics/images/sf-boat.jpg',
|
2019-02-04 16:47:15 +01:00
|
|
|
dir: 'ltr',
|
2019-02-16 02:01:17 +01:00
|
|
|
lang: 'enUs', // BCP 47,
|
2019-02-04 16:47:15 +01:00
|
|
|
vibrate: [100, 50, 200],
|
2019-02-05 03:39:56 +01:00
|
|
|
badge: '/statics/icons/app-icon-96x96.png',
|
2019-02-04 16:47:15 +01:00
|
|
|
tag: 'confirm-notification',
|
|
|
|
|
renotify: true, // if it's already sent, will Vibrate anyway
|
|
|
|
|
actions: [
|
2019-02-05 03:39:56 +01:00
|
|
|
{ action: 'confirm', title: 'Okay', icon: '/statics/icons/app-icon-96x96.png' },
|
|
|
|
|
{ action: 'cancel', title: 'Cancel', icon: '/statics/icons/app-icon-96x96.png' }
|
2019-02-04 16:47:15 +01:00
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-14 18:38:23 +01:00
|
|
|
if ('serviceWorker' in navigator) {
|
|
|
|
|
navigator.serviceWorker.ready
|
2019-03-13 13:40:17 +01:00
|
|
|
.then(function(swreg) {
|
2019-02-14 18:38:23 +01:00
|
|
|
swreg.showNotification('Successfully subscribed!', options)
|
|
|
|
|
})
|
|
|
|
|
}
|
2019-02-04 16:47:15 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-13 13:40:17 +01:00
|
|
|
public urlBase64ToUint8Array(base64String) {
|
|
|
|
|
const padding = '='.repeat((4 - base64String.length % 4) % 4)
|
|
|
|
|
const base64 = (base64String + padding)
|
2019-02-05 03:39:56 +01:00
|
|
|
.replace(/\-/g, '+')
|
2019-02-05 18:17:36 +01:00
|
|
|
.replace(/_/g, '/')
|
2019-02-05 03:39:56 +01:00
|
|
|
|
2019-03-13 13:40:17 +01:00
|
|
|
const rawData = window.atob(base64)
|
|
|
|
|
const outputArray = new Uint8Array(rawData.length)
|
2019-02-05 03:39:56 +01:00
|
|
|
|
|
|
|
|
for (let i = 0; i < rawData.length; ++i) {
|
2019-02-05 18:17:36 +01:00
|
|
|
outputArray[i] = rawData.charCodeAt(i)
|
2019-02-05 03:39:56 +01:00
|
|
|
}
|
2019-02-05 18:17:36 +01:00
|
|
|
return outputArray
|
2019-02-05 03:39:56 +01:00
|
|
|
}
|
|
|
|
|
|
2019-03-13 13:40:17 +01:00
|
|
|
public dataURItoBlob(dataURI) {
|
|
|
|
|
const byteString = atob(dataURI.split(',')[1])
|
|
|
|
|
const mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]
|
|
|
|
|
const ab = new ArrayBuffer(byteString.length)
|
|
|
|
|
const ia = new Uint8Array(ab)
|
2019-02-05 03:39:56 +01:00
|
|
|
for (let i = 0; i < byteString.length; i++) {
|
2019-02-05 18:17:36 +01:00
|
|
|
ia[i] = byteString.charCodeAt(i)
|
2019-02-05 03:39:56 +01:00
|
|
|
}
|
2019-03-13 13:40:17 +01:00
|
|
|
const blob = new Blob([ab], { type: mimeString })
|
2019-02-05 18:17:36 +01:00
|
|
|
return blob
|
2019-02-05 03:39:56 +01:00
|
|
|
}
|
|
|
|
|
|
2019-03-13 13:40:17 +01:00
|
|
|
public showNotificationExample() {
|
2019-02-04 16:47:15 +01:00
|
|
|
let options = null
|
2019-03-13 13:40:17 +01:00
|
|
|
const mythis = this
|
2019-02-04 16:47:15 +01:00
|
|
|
if ('serviceWorker' in navigator) {
|
|
|
|
|
options = {
|
|
|
|
|
body: mythis.$t('notification.subscribed'),
|
|
|
|
|
icon: '/statics/icons/android-chrome-192x192.png',
|
2019-03-05 23:44:48 +01:00
|
|
|
image: '/statics/images/freeplanet.png',
|
2019-02-04 16:47:15 +01:00
|
|
|
dir: 'ltr',
|
2019-02-16 02:01:17 +01:00
|
|
|
lang: 'enUs', // BCP 47,
|
2019-02-04 16:47:15 +01:00
|
|
|
vibrate: [100, 50, 200],
|
|
|
|
|
badge: '/statics/icons/android-chrome-192x192.png',
|
|
|
|
|
tag: 'confirm-notification',
|
|
|
|
|
renotify: true, // if it's already sent, will Vibrate anyway
|
|
|
|
|
actions: [
|
2019-03-08 02:04:56 +01:00
|
|
|
{ action: 'confirm', title: mythis.$t('dialog.ok'), icon: '/statics/icons/android-chrome-192x192.png' }
|
2019-02-04 16:47:15 +01:00
|
|
|
// { action: 'cancel', title: 'Cancel', icon: '/statics/icons/android-chrome-192x192.png', }
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
navigator.serviceWorker.ready
|
2019-03-13 13:40:17 +01:00
|
|
|
.then(function(swreg) {
|
2019-02-05 18:17:36 +01:00
|
|
|
swreg.showNotification('aaa', options)
|
2019-02-04 16:47:15 +01:00
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-13 13:40:17 +01:00
|
|
|
public askfornotification() {
|
|
|
|
|
tools.showNotif(this.$q, this.$t('notification.waitingconfirm'), {color: 'positive', icon: 'notifications'})
|
2019-02-04 16:47:15 +01:00
|
|
|
|
2019-03-08 02:04:56 +01:00
|
|
|
Notification.requestPermission((result) => {
|
2019-02-04 16:47:15 +01:00
|
|
|
console.log('User Choice', result)
|
|
|
|
|
if (result === 'granted') {
|
2019-03-13 13:40:17 +01:00
|
|
|
tools.showNotif(this.$q, this.$t('notification.confirmed'), {color: 'positive', icon: 'notifications'})
|
2019-02-04 16:47:15 +01:00
|
|
|
} else {
|
2019-03-13 13:40:17 +01:00
|
|
|
tools.showNotif(this.$q, this.$t('notification.denied'), {color: 'negative', icon: 'notifications'})
|
2019-02-04 16:47:15 +01:00
|
|
|
|
|
|
|
|
// displayConfirmNotification();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-13 13:40:17 +01:00
|
|
|
public test_fetch() {
|
2018-11-08 01:09:33 +01:00
|
|
|
fetch('https:/httpbin.org/post', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
|
'Accept': 'application/json'
|
|
|
|
|
},
|
|
|
|
|
// mode: 'no-cors',
|
|
|
|
|
mode: 'cors',
|
|
|
|
|
body: JSON.stringify({ message: 'Does this work?' })
|
2019-03-13 13:40:17 +01:00
|
|
|
}).then(function(response) {
|
2018-11-08 01:09:33 +01:00
|
|
|
console.log(response)
|
2019-03-13 13:40:17 +01:00
|
|
|
if (response) {
|
2018-11-08 01:09:33 +01:00
|
|
|
return response.json()
|
2019-03-13 13:40:17 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2018-11-08 01:09:33 +01:00
|
|
|
return null
|
2019-03-13 13:40:17 +01:00
|
|
|
}
|
|
|
|
|
}).then(function(data) {
|
2018-11-08 01:09:33 +01:00
|
|
|
console.log(data)
|
2019-03-13 13:40:17 +01:00
|
|
|
}).catch(function(err) {
|
2018-11-08 01:09:33 +01:00
|
|
|
console.log(err)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-13 13:40:17 +01:00
|
|
|
public openCreatePostModal() {
|
2018-11-08 01:09:33 +01:00
|
|
|
console.log('APERTO ! openCreatePostModal')
|
|
|
|
|
|
|
|
|
|
this.conta = this.conta + 1
|
|
|
|
|
|
|
|
|
|
this.visibile = !this.visibile
|
|
|
|
|
|
|
|
|
|
if (this.visibile) {
|
|
|
|
|
this.displaycard = 'block'
|
|
|
|
|
this.cardvisible = 'visible'
|
|
|
|
|
} else {
|
|
|
|
|
this.displaycard = 'block'
|
|
|
|
|
this.cardvisible = 'hidden'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2019-03-08 02:04:56 +01:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
backgroundSequence() {
|
|
|
|
|
window.clearTimeout()
|
|
|
|
|
let k = 0
|
|
|
|
|
for (let i = 0; i < bgImageArray.length; i++) {
|
|
|
|
|
const mythis = this
|
|
|
|
|
setTimeout(function() {
|
|
|
|
|
document.documentElement.style.background = 'url(' + mythis.base + mythis.bgImageArray[k] + ') no-repeat center center fixed'
|
|
|
|
|
document.documentElement.style.backgroundSize = 'cover'
|
|
|
|
|
if ((k + 1) === mythis.bgImageArray.length) { setTimeout(function() { mythis.backgroundSequence() }, (mythis.secs * 1000))} else { k++ }
|
|
|
|
|
}, (mythis.secs * 1000) * i)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
backgroundSequence()
|
|
|
|
|
*/
|
2018-11-08 01:09:33 +01:00
|
|
|
}
|