diff --git a/templates/package.julius b/templates/package.julius index 732088b..7aa2749 100644 --- a/templates/package.julius +++ b/templates/package.julius @@ -1,4 +1,5 @@ $(function(){ + var loggedIn = $('.user-handle').length > 0; var tags = Object.create(null); $('.tags').find('.tag').each(function(){ tags[$(this).find('a').text()] = true; @@ -13,8 +14,6 @@ $(function(){ } }); $('#like').click(function(){ - var loggedIn = $('.user-handle').length > 0; - var $this = $(this); if (loggedIn) { @@ -39,10 +38,11 @@ $(function(){ $.post("@{PackageUnlikeR pn}"); } } else { - window.location.href = '@{AuthR LoginR}'; + login(); } }); $('#add-tag').click(function(){ + if (!loggedIn) login(); $('#add-tag-form').toggleClass('hidden'); $('#new-tag').focus(); }); @@ -105,3 +105,7 @@ if( Object.create === undefined ) { return new F(); }; } + +function login(){ + window.location.href = '@{AuthR LoginR}'; +}