* Add JS tips section to frontend documentation
* Replace document.getElementsByTagName('body') with document.body
* Replace querySelectorAll with faster selecting methods where appropriate
* Replace querySelector with faster selecting methods where appropriate
* Fix typo
* Fix forEach and getElementsByClassName
* Change querySelector* to faster methods in erb files
* Change querySelector* to faster methods in ruby files
* Fix runkit tag
* Various fixes
* Update app/assets/javascripts/initializers/initializeEllipsisMenu.js
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
* Update app/assets/javascripts/utilities/slideSidebar.js
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
* Commenting out flaky spec
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
27 lines
977 B
JavaScript
27 lines
977 B
JavaScript
function slideSidebar(side, direction) {
|
|
if (!document.getElementById('sidebar-wrapper-' + side)) {
|
|
return;
|
|
}
|
|
if (direction === 'intoView') {
|
|
document.getElementById('articles-list').classList.add('modal-open');
|
|
document.body.classList.add('modal-open');
|
|
document
|
|
.getElementById('sidebar-wrapper-' + side)
|
|
.classList.add('swiped-in');
|
|
document
|
|
.getElementById('articles-list')
|
|
.addEventListener('touchmove', preventDefaultAction, false);
|
|
} else {
|
|
document.getElementById('articles-list').classList.remove('modal-open');
|
|
document.body.classList.remove('modal-open');
|
|
document
|
|
.getElementById('sidebar-wrapper-' + side)
|
|
.getElementsByClassName('side-bar')[0].scrollTop = 0;
|
|
document
|
|
.getElementById('sidebar-wrapper-' + side)
|
|
.classList.remove('swiped-in');
|
|
document
|
|
.getElementById('articles-list')
|
|
.removeEventListener('touchmove', preventDefaultAction, false);
|
|
}
|
|
}
|