$(document).ready(function(){var usersinfo={};sessionStorage.removeItem('followAction');$('#memberlist a[href^="/u"], .mentiontag, .postprofile-name a[href^="/u"], .postprofile strong a[href^="/u"], .postprofile a[href^="/u"]:not(:has(>img)), .username a[href^="/u"], .post-author a[href^="/u"], .name a[href^="/u"] ').tooltipster({animation:'fade',interactive:true,contentAsHTML:true,minWidth:300,maxWidth:300,delay:500,arrowColor:"#EEE",autoClose:true,content:'Loading...',functionBefore:function(origin,continueTooltip){var userid=$(this).data('id')||$(this).attr('href').match(/\d+$/)[0];var fromMention=$(this).hasClass('mentiontag');var nocache=sessionStorage.getItem('followAction'+userid);if(nocache==='1'){origin.data('ajax','');delete usersinfo[userid]}if(origin.data('ajax')!=='cached'){if(usersinfo[userid]!=undefined){origin.tooltipster('content',usersinfo[userid]).data('ajax','cached');continueTooltip()}else{$.ajax({type:'GET',url:"/ajax/index.php",dataType:"html",data:{f:"m",user_id:userid,frm:fromMention},success:function(html){usersinfo[userid]=html;origin.tooltipster('content',html).data('ajax','cached');continueTooltip()}})}}else{continueTooltip()}sessionStorage.removeItem('followAction'+userid)}})});function doFollowAction(el){let follow=el.classList.contains('follow');let mid=el.getAttribute('data-id');let data={mid:mid,follow:follow?1:0,_:+new Date()};fetch("/ajax_follow.php",{method:"POST",body:JSON.stringify(data)}).then(function(res){switch(res.status){case 200:let content=' '+(follow?_lang["Unfollow"]:_lang["Follow"]);if(_userdata['tpl_used']==='modernbb'){el.classList.remove(follow?'ion-android-notifications':'ion-android-notifications-off');el.classList.add(follow?'ion-android-notifications-off':'ion-android-notifications')}else if(_userdata['tpl_used']==='awesomebb'||_userdata['tpl_mobile']==='mobi_modern'){content='notifications'+(follow?'_off':'')+''+content}el.classList.remove(follow?'follow':'unfollow');el.classList.add(follow?'unfollow':'follow');el.innerHTML=content;break;default:}}).catch(function(res){console.log(res)});sessionStorage.setItem('followAction'+mid,'1')}