main
			
			
		
		
							parent
							
								
									4535107883
								
							
						
					
					
						commit
						595c6f160d
					
				@ -0,0 +1,19 @@ | 
				
			||||
include post_item.pug | 
				
			||||
 | 
				
			||||
.post-list | 
				
			||||
  - const posts = page.posts | 
				
			||||
  - const MAX_SUMMARY_LENGTH = 140 | 
				
			||||
  - posts.each(function(post) { | 
				
			||||
      - const post_date = date(post.date, 'MM/DD/YYYY') | 
				
			||||
      - const post_time = date(post.time === undefined ? post.date : post.time, 'HH:mm:ss') | 
				
			||||
      - let summary = '尚未编写简介...' | 
				
			||||
      if post.description | 
				
			||||
        - summary = post.description  | 
				
			||||
      if post.describe | 
				
			||||
        - summary = post.describe  | 
				
			||||
      else | 
				
			||||
        - const content = (post.more !== undefined) ? post.more : post.content | 
				
			||||
        - const strip = strip_html(content).substr(0, MAX_SUMMARY_LENGTH) | 
				
			||||
        - summary = strip.length < MAX_SUMMARY_LENGTH ? strip : strip + '...' | 
				
			||||
      +post_item(post.title, post.cover, post_date, trim(summary), post_time, url_for(post.path)) | 
				
			||||
  - }) | 
				
			||||
@ -1,27 +1,10 @@ | 
				
			||||
extends includes/layout.pug | 
				
			||||
include includes/_partials/information_card.pug | 
				
			||||
include includes/_partials/post_list/post_item.pug | 
				
			||||
 | 
				
			||||
block content | 
				
			||||
  .index-content | 
				
			||||
    .left-content | 
				
			||||
      include includes/_partials/left_declaration.pug | 
				
			||||
      .post-list | 
				
			||||
        - const posts = page.posts | 
				
			||||
        - posts.each(function(post) { | 
				
			||||
            - const date = moment(post.date).format('MM/DD/YYYY') | 
				
			||||
            - const time = moment(post.date).format('HH:mm:ss') | 
				
			||||
            - let summary = '' | 
				
			||||
            if post.description | 
				
			||||
              summary = post.description  | 
				
			||||
            else if post.more | 
				
			||||
              - const strip = strip_html(post.more).substr(0, 128) | 
				
			||||
              - summary = strip.length < 128 ? strip : strip + '...' | 
				
			||||
            else  | 
				
			||||
              - const strip = strip_html(post.content).substr(0, 128) | 
				
			||||
              - summary = strip.length < 128 ? strip : strip + '...' | 
				
			||||
            +post_item(post.title, post.cover, date , summary, time) | 
				
			||||
        - }) | 
				
			||||
           | 
				
			||||
      include includes/_partials/post_list/post_list.pug | 
				
			||||
    .right-content | 
				
			||||
      +information_card({name: '全站总字数', value: totalcount(site)}) | 
				
			||||
@ -0,0 +1,14 @@ | 
				
			||||
/* | 
				
			||||
  edited from post_lazyload.js in Butterfly theme | 
				
			||||
*/ | 
				
			||||
 | 
				
			||||
function lazyload(htmlContent) { | 
				
			||||
  const config = hexo.theme.config.lazyload | 
				
			||||
  if (!config.enable) return | 
				
			||||
  const bg = hexo.theme.config.lazyload.placeholder ? urlFor(hexo.theme.config.lazyload.placeholder) : 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' | 
				
			||||
  return htmlContent.replace(/(<img.*? src=)/ig, `$1 "${bg}" data-src=`) | 
				
			||||
} | 
				
			||||
 | 
				
			||||
hexo.extend.filter.register('after_render:html', data => { | 
				
			||||
  return lazyload.call(this, data) | 
				
			||||
}) | 
				
			||||
| 
		 Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 886 B  | 
| 
		 Before Width: | Height: | Size: 401 B After Width: | Height: | Size: 98 B  | 
@ -0,0 +1,4 @@ | 
				
			||||
window.lazyLoad = new LazyLoad({ | 
				
			||||
  elements_selector: 'img', | 
				
			||||
  threshold: 0 | 
				
			||||
}); | 
				
			||||
									
										
											File diff suppressed because one or more lines are too long
										
									
								
							
						
									
										
											File diff suppressed because one or more lines are too long
										
									
								
							
						
					Loading…
					
					
				
		Reference in new issue