윤혜원

니툰 기능 확인완료 + 니툰,내툰 페이지 scroll up 기능 수정

This diff is collapsed. Click to expand it.
......@@ -14,7 +14,7 @@ var yourtoons=require('./routes/yourtoons');
var passport = require('passport');
var setting = require('./routes/setting');
var session = require('express-session');
var toonviewer = require('./routes/toonviewer');
//port
passport.serializeUser(function(user, done) {
......
var express = require('express');
var cheerio = require('cheerio');
var request = require('request');
var async = require('async');
var router = express.Router();
......@@ -20,7 +18,6 @@ function getMyToons(id,cb){
});
}
/* GET home page. */
router.get('/', function(req, res, next) {
if(!req.isAuthenticated()){
......
var express = require('express');
var router = express.Router();
var request = require('request');
var cheerio = require('cheerio');
var async = require('async');
function getToonImages(toon_index, num, cb){
var imageList = [];
var toonUrl = "http://comic.naver.com/webtoon/detail.nhn?titleId=" + toon_index + "&no=" + num;
request(toonUrl, function(err, res, html){
if(!err){
var $ = cheerio.load(html);
var p = Promise.resolve();
var eachs = $("div.wt_viewer > img").each(function(index, element) {
p = p.then(function() {
var toonHref = $(element).attr('src');
imageList.push(toonHref);
});
});
p.then(function(){
cb(imageList);
});
}else{
console.log("웹툰 이미지 못가져왔습니다.");
}
});
}
router.get('/:toon_index/:num',function(req,res){
if(!req.isAuthenticated()){
res.redirect('/');
return;
}
getToonImages(req.params.toon_index, req.params.num, function(imageList){
res.render('toonviewer',{
title: "zzz",
images: imageList
});
});
// })
});
module.exports = router;
\ No newline at end of file
var express = require('express');
var cheerio = require('cheerio');
var request = require('request');
var async = require('async');
var router = express.Router();
......
......@@ -67,7 +67,17 @@
<!-- /.navbar-collapse -->
</div>
</nav>
<div id="mylist">
<div class="section-title text-center center">
<div class="overlay">
<h2>내툰</h2>
<hr>
<p>웹툰 담기를 통해 담은 웹툰들의 리스트입니다</p>
</div>
</div>
<div class="container">
<div class="row">
<div class="categories">
<table>
<tr>
<th>썸네일</th>
......@@ -168,8 +178,10 @@
</table>
</br>
</div>
</div>
</div>
</div>
</body>
</html>
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><%= title %></title>
</head>
<body>
<%
for(image in images){
%>
<img src="<%= images[image] %>" alt=""/>
<%
}
%>
</body>
</html>
\ No newline at end of file
......@@ -58,7 +58,7 @@
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li><a href="#mylist" class="page-scroll">OtherList</a></li>
<li><a href="#otherlist" class="page-scroll">OtherList</a></li>
<li><a href="/mytoons" class="page-scroll">MyList</a></li>
<li><a href="/auth/logout/kakao" class="page-scroll">Logout</a></li>
</ul>
......@@ -66,9 +66,21 @@
<!-- /.navbar-collapse -->
</div>
</nav>
<div id="otherlist">
<div class="section-title text-center center">
<div class="overlay">
<h2>니툰</h2>
<hr>
<p>다른 사용자들의 내툰 리스트입니다</p>
</div>
</div>
<div class="container">
<div class="row">
<div class="categories">
<table>
<tr>
<th>KakaoID</th>
<th>썸네일</th>
<th>웹툰명</th>
<th>요일</th>
......@@ -97,8 +109,10 @@
</table>
</br>
</div>
</div>
</div>
</div>
</body>
</html>
......