Skip to content

Commit

Permalink
fix robots.txt and detail.html img not load
Browse files Browse the repository at this point in the history
  • Loading branch information
Dotos committed Apr 5, 2017
1 parent 4f5d47d commit 851b91d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ app.use('/weibo', weibo);
app.use('/ranking', ranking);
app.use('/v1', v1);

app.use('/about.html', function(req, res, next) {
app.get('/about.html', function(req, res, next) {
res.render('about');
});
/**
Expand Down
2 changes: 2 additions & 0 deletions robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-Agent: *
Allow: /
8 changes: 7 additions & 1 deletion static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,13 @@
.detail .preview img {
width: 0;
height: 0;
position: absolute;
border: 0;
}

.detail .preview .progressive {
background: transparent;
}

.detail .preview .options {
font-size: .12rem;
padding: .1rem;
Expand All @@ -224,6 +227,9 @@
text-align: right;
-webkit-transition: all .5s ease;
transition: all .5s ease;
position: absolute;
right: 0;
top: 0;
}

.detail .preview .ctrl {
Expand Down
36 changes: 25 additions & 11 deletions views/detail.pug
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ html(lang="en")
- location = doc.continent ? (location ? doc.continent + ', ' + location : doc.continent) : location;
meta(name="keywords",content=`${doc.copyright}, ${doc.title}, ${location}`)
meta(name="description",content=`${doc.description}`)
link(rel='stylesheet',href="/static/css/progressively.css")
link(rel='stylesheet', href='/static/css/common.css')
link(rel='stylesheet', href='/static/css/main.css')
style.


body.detail
div.preview
- var small = doc.photo;
img.target(src=`https://static.ioliu.cn/bing/${small}_1920x1080.jpg?imageView2/1/w/19/h/11/q/100`,data-src=`https://static.ioliu.cn/bing/${small}_1920x1080.jpg`)
div.progressive
img.target.progressive__img.progressive--not-loaded(src=`https://static.ioliu.cn/bing/${small}_1920x1080.jpg?imageView2/1/w/19/h/11/q/100`,data-progressive=`https://static.ioliu.cn/bing/${small}_1920x1080.jpg`)
div.mark
div.options
a.ctrl.left(href=`${doc.back_url}`)
Expand All @@ -39,26 +43,36 @@ body.detail
em.t #{location}

script(src='/static/js/jquery-1.12.4.min.js')
script(src='/static/js/progressively.js')
script(src='/static/js/baidu-analysis.js')
script(src='/static/js/like.js')
//- script(data-no-instant,src="/static/js/instantclick.min.js")
//- script(data-no-instant,src="/static/js/mine-instantclick.js")
script.
$(function() {
var i=0;
var img = $('.target');
var mini = img.attr('src');
var big = img.attr('data-src');
var mark = $('.mark');
mark.css({
'background-image': `url(${mini})`
});
img = img[0];
img.src = big;
img.onload = function() {
mark.css({
backgroundImage: `url(${big})`,
filter: 'blur(0)'
});
img.remove();
}
progressively.init({
delay: 20,
throttle: 300,
onLoad: function(elem) {
},
onLoadComplete: function() {
i++;
if(i>=2){
var big = img.attr('src');
mark.css({
backgroundImage: `url(${big})`,
filter: 'blur(0)'
});
img.remove();
}
}
});

});

0 comments on commit 851b91d

Please sign in to comment.