Created
November 15, 2016 20:39
-
-
Save arubis/241106e6643c9241292860ddad1ff2e7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// depends on js-cookie.js: https://github.com/js-cookie/js-cookie | |
// | |
$(function(){ | |
var user_logged_in = function() { | |
if(Cookies.get('auth_type')) { | |
console.log('user is logged in'); | |
$(".menu-item > a[href|='/login']").replaceWith('<a title="Main Site" href="/">Main Site</a>'); | |
$(".menu-item > a[href|='/signup']").hide(); | |
} else { | |
console.log('user is _not_ logged in'); | |
$(".menu-item > a[href|='/'").replaceWith('<a title="Log in" href="/login">Log in</a>'); | |
$(".menu-item > a[href|='/signup']").show(); | |
} | |
}; | |
console.log(user_logged_in()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment