diff --git a/cv/design/index.js b/cv/design/index.js index c51dbf8..8472332 100644 --- a/cv/design/index.js +++ b/cv/design/index.js @@ -1,6 +1,65 @@ (function(global) { + const dispatch_profile = () => { + + let profile = global.document.querySelector('#profile'); + if (profile !== null) { + + profile.addEventListener('click', (event) => { + + let avatar = profile.querySelector('#avatar img'); + + if (event.target === avatar) { + + [ + profile.querySelector('img'), + profile.querySelector('figcaption b'), + profile.querySelector('aside a[href^="mailto:"]') + ].filter((element) => { + return element !== null; + }).forEach((element) => { + + if (element.getAttribute('data-src') !== null) { + + let tmp = element.src; + + element.setAttribute('src', element.getAttribute('data-src')); + element.setAttribute('data-src', tmp); + + } + + if (element.getAttribute('data-html') !== null) { + + let tmp = element.innerHTML; + + element.innerHTML = element.getAttribute('data-html'); + element.setAttribute('data-html', tmp); + + } + + if (element.getAttribute('data-href') !== null) { + + let tmp = element.href; + + element.href = element.getAttribute('data-href'); + element.setAttribute('data-href', tmp); + + } + + }); + + event.preventDefault(); + event.stopPropagation(); + + } + + }); + + } + + }; + const replace = (section, data) => { let str0 = data.indexOf('
{ - - let profile = global.document.querySelector('#profile'); - if (profile !== null) { - - let avatar = profile.querySelector('#avatar'); - - avatar.addEventListener('click', () => { - - [ - profile.querySelector('img'), - profile.querySelector('figcaption b'), - profile.querySelector('aside a[href^="mailto:"]') - ].forEach((element) => { - - if (element.getAttribute('data-src') !== null) { - - let tmp = element.src; - - element.setAttribute('src', element.getAttribute('data-src')); - element.setAttribute('data-src', tmp); - - } - - if (element.getAttribute('data-html') !== null) { - - let tmp = element.innerHTML; - - element.innerHTML = element.getAttribute('data-html'); - element.setAttribute('data-html', tmp); - - } - - if (element.getAttribute('data-href') !== null) { - - let tmp = element.href; - - element.href = element.getAttribute('data-href'); - element.setAttribute('data-href', tmp); - - } - - }); - - }); - - } - - }, 1000); + dispatch_profile(); + }, 100); } @@ -140,6 +153,12 @@ }); + } else { + + setTimeout(() => { + dispatch_profile(); + }, 100) + } })(typeof window !== 'undefined' ? window : this); diff --git a/cv/design/open-source.css b/cv/design/open-source.css index 4a28ed0..0a44191 100644 --- a/cv/design/open-source.css +++ b/cv/design/open-source.css @@ -1,6 +1,6 @@ section#open-source aside { - top: 16px; + top: 0px; padding: calc(64px + 16px) 0px 0px 0px; }