feat(PublicPages): add email and phone obfucations
This commit is contained in:
parent
9ae135f816
commit
4d46ed86f4
4 changed files with 139 additions and 29 deletions
|
|
@ -123,3 +123,51 @@ let closeModal = () => {
|
|||
video.pause()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decode things
|
||||
*/
|
||||
|
||||
let formatPhone = (phone) => {
|
||||
if (phone.indexOf('+33') === 0) {
|
||||
phone = '0' + phone.substr(3)
|
||||
}
|
||||
let phoneSplit = ''
|
||||
let partEnd = false
|
||||
for (var i = 0; i < phone.length; i++) {
|
||||
phoneSplit += phone.charAt(i)
|
||||
if (partEnd === true) {
|
||||
phoneSplit += ' '
|
||||
}
|
||||
partEnd = !partEnd
|
||||
}
|
||||
return ["+33" + phone.substr(1), phoneSplit]
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode email and phone data
|
||||
*/
|
||||
document.querySelectorAll('.offuscated').forEach(node => {
|
||||
let data = node.getAttribute('data-source')
|
||||
let type = node.getAttribute('data-source-type')
|
||||
data = data.replace(/'/gm, '"').replace(/%_/gm, '')
|
||||
data = data.replace(/\$/gm, 'A')
|
||||
data = data.replace(/£/gm, 'c')
|
||||
data = data.replace(/ù/gm, 'b')
|
||||
data = data.replace(/#/gm, 'd')
|
||||
data = data.replace(/µ/gm, 'e')
|
||||
data = data.replace(/§/gm, 'z')
|
||||
data = data.replace(/à/gm, 'i')
|
||||
data = data.replace(/\|/gm, 'f')
|
||||
data = JSON.parse(data).join('')
|
||||
data = atob(data)
|
||||
if (type === 'phone') {
|
||||
data = formatPhone(data)
|
||||
node.href = node.href.replace('data', data[0])
|
||||
data = data[1]
|
||||
} else {
|
||||
node.href = node.href.replace('data', data)
|
||||
}
|
||||
node.textContent = data
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue