Skip to content

Instantly share code, notes, and snippets.

@NaniteFactory
Last active August 21, 2023 06:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save NaniteFactory/77ed3d61a7b0db2bbe98831734398a22 to your computer and use it in GitHub Desktop.
Save NaniteFactory/77ed3d61a7b0db2bbe98831734398a22 to your computer and use it in GitHub Desktop.
티스토리 로그인 로그아웃
<li class="tab_login"><a href="#" id="tab_login_toggle" onclick="fnLoginToggle();"></a>
<script>
function fnLoginToggle() {};
$(function() {
if(window.T.config.USER.name) {
$('#tab_login_toggle').text('로그아웃');
fnLoginToggle = function() { document.location.href = "https://www.tistory.com/auth/logout?redirectUrl=" + encodeURIComponent(window.location.href); };
} else {
$('#tab_login_toggle').text('로그인');
fnLoginToggle = function() { document.location.href = "https://www.tistory.com/auth/login?redirectUrl=" + encodeURIComponent(window.location.href); };
}
});
</script>
</li>
<li class="tab_login" >
<script>
//로그아웃, 로그인 표시
if($('script:contains("트랙백을 삭제하기 위해서는 로그인이 필요합니다")').length=='2'){
//로그아웃상태. 로그인해야됨
document.write('<a href="http://www.tistory.com/login">로그인</a>');
}else{//로그아웃
document.write('<a href="http://www.tistory.com/logout">로그아웃</a>');
}
</script>
</li>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment