이승윤

chore: 불필요한 내용 수정/삭제

1 -var express = require('express');
2 -var router = express.Router();
3 -
4 -router.get('/', function(req,res){
5 - if(!req.isAuthenticated()){
6 - res.send('<script>alert("로그인이 필요한 서비스입니다.");location.href="/accounts/login";</script>');
7 - }else{
8 - res.render('chat/index');
9 - }
10 -});
11 -
12 -module.exports = router;
...\ No newline at end of file ...\ No newline at end of file
1 -var express = require('express');
2 -var router = express.Router();
3 -var ProductsModel = require('../models/ProductsModel');
4 -
5 -/* GET home page. */
6 -router.get('/', function(req,res){
7 - ProductsModel.find( function(err,products){ //첫번째 인자는 err, 두번째는 받을 변수명
8 - res.render( 'home' ,
9 - { products : products } // DB에서 받은 products를 products변수명으로 내보냄
10 - );
11 - });
12 -});
13 -
14 -module.exports = router;
...\ No newline at end of file ...\ No newline at end of file
1 -<% include ../includes/header.ejs %>
2 -<div class="row">
3 - <div class="col-sm-10">
4 - <div class="panel panel-default" id="chatWrap">
5 - <div class="panel-heading">대화내용</div>
6 - <div class="panel-body">
7 - <ul id="chatBody"></ul>
8 - </div>
9 - </div>
10 - </div>
11 - <div class="col-sm-2">
12 - <div class="panel panel-default" id="userWrap">
13 - <div class="panel-heading">User</div>
14 - <div class="panel-body">
15 - <ul id="userList"></ul>
16 - </div>
17 - </div>
18 - </div>
19 -</div>
20 -
21 -<div>
22 - <form action="" method="post" id="sendForm">
23 -
24 - <div class="input-group">
25 - <input type="hidden" name="socketId">
26 - <input type="text" name="message" class="form-control" placeholder="대화내용을 입력해주세요.">
27 - <span class="input-group-btn">
28 - <button class="btn btn-primary">작성하기</button>
29 - </span>
30 - </div><!-- /input-group -->
31 -
32 - </form>
33 -
34 -</div>
35 -
36 -<style type="text/css">
37 -.panel-default ul { padding-left:0px; }
38 -.panel-default ul li { list-style:none; padding-left:0px;}
39 -.panel-default .panel-body {min-height:350px; max-height:350px; overflow-y:scroll; }
40 -#chatWrap ul li strong::after { content: " : "; }
41 -@media (max-width: 768px) {
42 - #userWrap { display:none; }
43 - #chatWrap .panel-body { min-height:250px; }
44 -}
45 -</style>
46 -<script src="/socket.io/socket.io.js"></script>
47 -<script>
48 -(function(){
49 - var socket = io();
50 -
51 - function updateUserList(userList){
52 - $('#userList').html("");
53 - for(var key in userList){
54 - $('#userList').append('<li>' + userList[key] + '</li>');
55 - }
56 - }
57 -
58 - socket.on('join', function(data){
59 - updateUserList(data);
60 - });
61 - socket.on('server message', function(data){
62 - $('#chatBody').append('<li><strong>'+ data.displayname +'</strong>' + data.message + '</li>');
63 - });
64 -
65 - socket.on('leave', function(data){
66 - updateUserList(data);
67 - });
68 -
69 - $(document).ready(function() {
70 - $('#sendForm').submit(function(){
71 - var $massage = $('#sendForm input[name=message]');
72 - socket.emit('client message', { message : $massage.val()});
73 - $massage.val('');
74 - return false;
75 - });
76 - });
77 -})();
78 -</script>
79 -<% include ../includes/footer.ejs %>
80 -
1 <% include ./includes/header.ejs %> 1 <% include ./includes/header.ejs %>
2 <div class="container" id="masonry_container"> 2 <div class="container" id="masonry_container">
3 - <% products.forEach(function(product){ %> 3 + <% for (var i in videos) { %>
4 - <div class="masonry-grid"> 4 + <div id="<%=videos[i].id%>" vid="<%=videos[i].video_id%>">
5 - <%if(product.thumbnail){%>
6 - <img src="/uploads/<%=product.thumbnail%>">
7 - <%}%>
8 - <p>
9 - <%=product.title%><br />
10 - by <%=product.username%>(
11 - <%=product.getDate.year%>.
12 - <%=product.getDate.month%>.
13 - <%=product.getDate.day%>
14 - )
15 - </p>
16 </div> 5 </div>
17 - <%});%> 6 + <%};%>
18 </div> 7 </div>
8 +
19 <style type="text/css"> 9 <style type="text/css">
20 .masonry-grid img { max-width: 260px; } 10 .masonry-grid img { max-width: 260px; }
21 </style> 11 </style>
...@@ -30,4 +20,40 @@ ...@@ -30,4 +20,40 @@
30 }); 20 });
31 }); 21 });
32 </script> 22 </script>
23 +<script>
24 + var tag = document.createElement('script');
25 +
26 + tag.src = "https://www.youtube.com/iframe_api";
27 + var firstScriptTag = document.getElementsByTagName('script')[0];
28 + firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
29 +
30 + var player;
31 + var players = [];
32 + var videoIds = [];
33 + for (var i = 0;i<10;i++) {
34 + players.push(String(i));
35 + videoIds.push($('#'+i).attr('vid'));
36 + }
37 +
38 + function onYouTubeIframeAPIReady() {
39 + for (var i = 0; i < videoIds.length; i++) {
40 + player = new YT.Player(players[i], {
41 + height: '360',
42 + width: '640',
43 + videoId: videoIds[i],
44 + events: {
45 + // 'onReady': onPlayerReady,
46 + // 'onStateChange': onPlayerStateChange
47 + }
48 + });
49 + }
50 + }
51 +
52 + // function onPlayerReady(event) {
53 + // }
54 + // function onPlayerStateChange(event) {
55 + // }
56 + // function stopVideo() {
57 + // }
58 +</script>
33 <% include ./includes/footer.ejs %> 59 <% include ./includes/footer.ejs %>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
4 <meta charset="UTF-8"> 4 <meta charset="UTF-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <meta http-equiv="X-UA-Compatible" content="ie=edge"> 6 <meta http-equiv="X-UA-Compatible" content="ie=edge">
7 - <title>Node.js 예제</title> 7 + <title>MYCOOK</title>
8 <script 8 <script
9 src="https://code.jquery.com/jquery-3.2.1.min.js" 9 src="https://code.jquery.com/jquery-3.2.1.min.js"
10 integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" 10 integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
...@@ -26,19 +26,18 @@ ...@@ -26,19 +26,18 @@
26 <span class="icon-bar"></span> 26 <span class="icon-bar"></span>
27 <span class="icon-bar"></span> 27 <span class="icon-bar"></span>
28 </button> 28 </button>
29 - <a href="/" class="navbar-brand">Nodejs</a> 29 + <a href="/" class="navbar-brand">MyCookBook</a>
30 </div> 30 </div>
31 <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-9"> 31 <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-9">
32 <ul class="nav navbar-nav"> 32 <ul class="nav navbar-nav">
33 <li class="active"> 33 <li class="active">
34 <a href="/">Home</a> 34 <a href="/">Home</a>
35 </li> 35 </li>
36 - <li><a href="/admin/products">ADMIN</a></li> 36 + <li><a href="/admin/products">Categori</a></li>
37 - <li><a href="/chat">CHAT</a></li>
38 <% if(isLogin){%> 37 <% if(isLogin){%>
39 <li><a href="/accounts/logout" onclick="return confirm('로그아웃 하시겠습니까?')">LOGOUT</a></li> 38 <li><a href="/accounts/logout" onclick="return confirm('로그아웃 하시겠습니까?')">LOGOUT</a></li>
40 <%}else{%> 39 <%}else{%>
41 - <li><a href="/accounts/join">JOIN</a></li> 40 + <li><a href="/accounts/join">SignUp</a></li>
42 <li><a href="/accounts/login">LOGIN</a></li> 41 <li><a href="/accounts/login">LOGIN</a></li>
43 <%}%> 42 <%}%>
44 </ul> 43 </ul>
......