Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function maintenanceAjaxLoad(clickedMenuItem){
- /* new logo position */
- var logo = document.getElementById('ufk__animated');
- var mainCont = document.getElementById('mainContent');
- var ajaxHref = clickedMenuItem.href;
- var ajaxData = ajaxHref.replace(/(#[^-]+)/,'') + '.json';
- var ajaxCont = document.getElementById('bodyCont');
- const mutationObserver = new MutationObserver(function (mutationsList, observer) {
- mutationsList.forEach(mutation => {
- console.log(mutation.target);
- if (mutation.target.classList.contains('finished')) {
- console.log('finished' + logo);
- logo.classList.add('ufk_newpos');
- logo.addEventListener('animationend', function(){
- logo.classList.replace('finished', 'anicomplete');
- mainCont.style.flex = '1 0 auto';
- mainCont.style.justifyContent = 'flex-start';
- ajaxCont.classList.add('fade-in');
- ajaxLoad(ajaxData, ajaxCont, function(response){
- let htmlTitle = response.title;
- let htmlText = response.text;
- ajaxCont.innerHTML = htmlTitle + htmlText;
- history.pushState(htmlText, ajaxData, ajaxHref);
- });
- });
- }
- });
- });
- mutationObserver.observe(logo, { attributes: true});
- if(logo.classList.contains('anicomplete')){
- ajaxLoad(ajaxData, ajaxCont, function(response){
- let htmlTitle = response.title;
- let htmlText = response.text;
- ajaxCont.innerHTML = htmlTitle + htmlText;
- history.pushState(htmlText, ajaxData, ajaxHref);
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment