-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes and enhancements. [11] #1649
Changes from 19 commits
8480df6
d3b4b15
50dd71e
7d5abe7
7c02491
4912038
f2d6a60
618a2b4
98c2694
d09b5d1
90e1972
957fbbe
5dd2d14
0d6c0f6
402eb9c
ec70baa
eac8d8f
3ecd980
cdd36b6
8bc43cc
3e06c4b
32b1837
a153fbf
ede932a
707c0bc
5527001
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{% if theme.rating.enable and (not is_home() and is_post()) %} | ||
<script type="text/javascript"> | ||
wpac_init = window.wpac_init || []; | ||
wpac_init.push({widget: 'Rating', id: {{ theme.rating.id }}, | ||
el: 'wpac-rating', | ||
color: '{{ theme.rating.color }}' | ||
}); | ||
(function() { | ||
if ('WIDGETPACK_LOADED' in window) return; | ||
WIDGETPACK_LOADED = true; | ||
var mc = document.createElement('script'); | ||
mc.type = 'text/javascript'; | ||
mc.async = true; | ||
mc.src = '//embed.widgetpack.com/widget.js'; | ||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(mc, s.nextSibling); | ||
})(); | ||
</script> | ||
{% endif %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* global hexo */ | ||
// Usage: {% lazyimage /path/to/image, alt, title %} | ||
// Alias: {% li /path/to/image, alt, title %} | ||
|
||
function lazyImage(args) { | ||
args = args.join(' ').split(','); | ||
var src = args[0]; | ||
var alt = args[1] || ''; | ||
var title = args[2] || ''; | ||
|
||
if (!src) { | ||
hexo.log.warn('Image src can NOT be empty'); | ||
} | ||
alt = alt.trim(); | ||
title = title.trim(); | ||
|
||
var image = ['<span itemprop="image" itemscope itemtype="http://schema.org/ImageObject"><img itemprop="url image" src="/images/loading.gif" data-original="' + src + '" class="full-image"']; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
alt.length > 0 && image.push('alt="' + alt + '"'); | ||
title.length > 0 && image.push('title="' + title + '"'); | ||
image.push('/><meta itemprop="width" content="auto"><meta itemprop="height" content="auto"></span>'); | ||
|
||
return image.join(' '); | ||
} | ||
|
||
hexo.extend.tag.register('lazyimage', lazyImage); | ||
hexo.extend.tag.register('li', lazyImage); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.post-wordcount { | ||
display: inline-block; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,8 @@ NexT.utils = NexT.$u = { | |
var $imageWrapLink = $image.parent('a'); | ||
|
||
if ($imageWrapLink.size() < 1) { | ||
$imageWrapLink = $image.wrap('<a href="' + this.getAttribute('src') + '"></a>').parent('a'); | ||
var imageLink = ($image.attr('data-original')) ? this.getAttribute('data-original') : this.getAttribute('src'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
$imageWrapLink = $image.wrap('<a href="' + imageLink + '"></a>').parent('a'); | ||
} | ||
|
||
$imageWrapLink.addClass('fancybox fancybox.image'); | ||
|
@@ -39,8 +40,9 @@ NexT.utils = NexT.$u = { | |
|
||
lazyLoadPostsImages: function () { | ||
$('#posts').find('img').lazyload({ | ||
placeholder: '/images/loading.gif', | ||
effect: 'fadeIn' | ||
//placeholder: '/images/loading.gif', | ||
effect: 'fadeIn', | ||
threshold : 0 | ||
}); | ||
}, | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long.