|
|
@ -18,6 +18,12 @@ window.addEventListener('message', e => { |
|
|
|
id: data.id, |
|
|
|
height: document.getElementsByTagName('html')[0].scrollHeight, |
|
|
|
}, '*'); |
|
|
|
|
|
|
|
if (document.fonts && document.fonts.ready) { |
|
|
|
document.fonts.ready.then(sizeBioText); |
|
|
|
} else { |
|
|
|
sizeBioText(); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
@ -117,6 +123,25 @@ function main() { |
|
|
|
|
|
|
|
delegate(document, '.custom-emoji', 'mouseover', getEmojiAnimationHandler('data-original')); |
|
|
|
delegate(document, '.custom-emoji', 'mouseout', getEmojiAnimationHandler('data-static')); |
|
|
|
|
|
|
|
if (document.body.classList.contains('with-modals')) { |
|
|
|
const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth; |
|
|
|
const scrollbarWidthStyle = document.createElement('style'); |
|
|
|
scrollbarWidthStyle.id = 'scrollbar-width'; |
|
|
|
document.head.appendChild(scrollbarWidthStyle); |
|
|
|
scrollbarWidthStyle.sheet.insertRule(`body.with-modals--active { margin-right: ${scrollbarWidth}px; }`, 0); |
|
|
|
} |
|
|
|
|
|
|
|
[].forEach.call(document.querySelectorAll('[data-component="Card"]'), (content) => { |
|
|
|
const props = JSON.parse(content.getAttribute('data-props')); |
|
|
|
ReactDOM.render(<CardContainer locale={locale} {...props} />, content); |
|
|
|
}); |
|
|
|
|
|
|
|
if (document.fonts && document.fonts.ready) { |
|
|
|
document.fonts.ready.then(sizeBioText); |
|
|
|
} else { |
|
|
|
sizeBioText(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
delegate(document, '.webapp-btn', 'click', ({ target, button }) => { |
|
|
@ -257,6 +282,22 @@ function main() { |
|
|
|
target.style.display = 'block'; |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
delegate(document, '#account_note', 'input', sizeBioText); |
|
|
|
|
|
|
|
function sizeBioText() { |
|
|
|
const noteCounter = document.querySelector('.note-counter'); |
|
|
|
const bioTextArea = document.querySelector('#account_note'); |
|
|
|
|
|
|
|
if (noteCounter) { |
|
|
|
noteCounter.textContent = 413 - length(bioTextArea.value); |
|
|
|
} |
|
|
|
|
|
|
|
if (bioTextArea) { |
|
|
|
bioTextArea.style.height = 'auto'; |
|
|
|
bioTextArea.style.height = (bioTextArea.scrollHeight+3) + 'px'; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
loadPolyfills().then(main).catch(error => { |
|
|
|