fix: wrong blog tag address when not using subdomain

When the blog doesn't use subdomain, the tag address will be wrong. Add a situation check to find out the right tag address.
This commit is contained in:
MascoSkray 2017-04-25 15:25:53 +08:00
parent 2c303fd7d4
commit 10deda3561
No known key found for this signature in database
GPG Key ID: 6ABABD8325167A2E
2 changed files with 4 additions and 1 deletions

View File

@ -18,3 +18,6 @@
</div><!--/.nav-collapse -->
</div>
</div>
<script type="text/javascript">
var uojBlogUrl = '<?= HTML::blog_url(UOJContext::userid(), '')?>';
</script>

View File

@ -287,7 +287,7 @@ $.fn.uoj_problem_tag = function() {
}
$.fn.uoj_blog_tag = function() {
return this.each(function() {
$(this).attr('href', '/archive?tag=' + encodeURIComponent($(this).text()));
$(this).attr('href', uojBlogUrl + '/archive?tag=' + encodeURIComponent($(this).text()));
});
}