feat(PublicPage): add http padding to website, facebook, twitter and instagram
This commit is contained in:
parent
359274ca0b
commit
61a9a703e9
1 changed files with 30 additions and 24 deletions
|
@ -170,30 +170,36 @@ export default class PublicController {
|
|||
// }
|
||||
// console.log(version.contacts.websiteLabel)
|
||||
// }
|
||||
// if (Utils.isStrUsable(version.contacts, 'facebook')) {
|
||||
// try {
|
||||
// version.contacts.facebookLabel = new URL(version.contacts.facebook).pathname.replace('/', '')
|
||||
// } catch (err) {
|
||||
// console.error(err)
|
||||
// version.contacts.facebook = version.contacts.facebookLabel = "OULA, c'est pas bon :("
|
||||
// }
|
||||
// }
|
||||
// if (Utils.isStrUsable(version.contacts, 'twitter')) {
|
||||
// try {
|
||||
// version.contacts.twitterLabel = new URL(version.contacts.twitter).pathname.replace('/', '')
|
||||
// } catch (err) {
|
||||
// console.error(err)
|
||||
// version.contacts.twitter = version.contacts.twitterLabel = "OULA, c'est pas bon :("
|
||||
// }
|
||||
// }
|
||||
// if (Utils.isStrUsable(version.contacts, 'instagram')) {
|
||||
// try {
|
||||
// version.contacts.instagramLabel = new URL(version.contacts.instagram).pathname.replace('/', '')
|
||||
// } catch (err) {
|
||||
// console.error(err)
|
||||
// version.contacts.instagram = version.contacts.instagramLabel = "OULA, c'est pas bon :("
|
||||
// }
|
||||
// }
|
||||
const httpPadding = (url: string) => {
|
||||
if (url.indexOf('http://') !== 0 && url.indexOf('https://') !== 0) {
|
||||
return 'http://' + url
|
||||
}
|
||||
return url
|
||||
}
|
||||
if (Utils.isStrUsable(version.contacts, 'website')) {
|
||||
version.contacts.website = httpPadding(version.contacts.website)
|
||||
}
|
||||
if (Utils.isStrUsable(version.contacts, 'facebook')) {
|
||||
// try {
|
||||
// version.contacts.facebookLabel = new URL(version.contacts.facebook).pathname.replace('/', '')
|
||||
// } catch (err) {
|
||||
// console.error(err)
|
||||
// version.contacts.facebook = version.contacts.facebookLabel = "OULA, c'est pas bon :("
|
||||
// }
|
||||
version.contacts.facebook = httpPadding(version.contacts.facebook)
|
||||
}
|
||||
if (Utils.isStrUsable(version.contacts, 'twitter')) {
|
||||
// try {
|
||||
// version.contacts.twitterLabel = new URL(version.contacts.twitter).pathname.replace('/', '')
|
||||
// } catch (err) {
|
||||
// console.error(err)
|
||||
// version.contacts.twitter = version.contacts.twitterLabel = "OULA, c'est pas bon :("
|
||||
// }
|
||||
version.contacts.twitter = httpPadding(version.contacts.twitter)
|
||||
}
|
||||
if (Utils.isStrUsable(version.contacts, 'instagram')) {
|
||||
version.contacts.instagram = httpPadding(version.contacts.instagram)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue