search.html 5.55 KB
<html>

<head>
    <link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
    <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <!------ Include the above in your HEAD tag ---------->

    <div style="padding-left: 500px;">
        <input id="search1" name="q" type="text" size="40" placeholder="Search..." />
        <button class="btn-search" type="button" onclick="movePage1()">검색</button>
        <script type="text/javascript">
            function movePage1() { //페이지 이동을 위한 함수 search버튼을 누르면 실행됨
                location.href = document.location.href + "/" + document.getElementById('search1').value //url을 이렇게 변경함
            }
        </script>
    </div>
    <style>
        #search input[type="text"] {
            background: url(search-white.png) no-repeat 10px 6px #fcfcfc;
            border: 1px solid #d1d1d1;
            font: bold 12px Arial, Helvetica, Sans-serif;
            color: #bebebe;
            width: 150px;
            padding: 6px 15px 6px 35px;
            -webkit-border-radius: 20px;
            -moz-border-radius: 20px;
            border-radius: 20px;
            text-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
            -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
            -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
            -webkit-transition: all 0.7s ease 0s;
            -moz-transition: all 0.7s ease 0s;
            -o-transition: all 0.7s ease 0s;
            transition: all 0.7s ease 0s;
        }

        #search input[type="text"]:focus {
            width: 200px;
        }

        #search input[type="text"]:focus {
            width: 200px;
        }

        ul.timeline {
            list-style-type: none;
            position: relative;
        }

        ul.timeline:before {
            content: ' ';
            background: #d4d9df;
            display: inline-block;
            position: absolute;
            left: 29px;
            width: 2px;
            height: 100%;
            z-index: 400;
        }

        ul.timeline>li {
            margin: 20px 0;
            padding-left: 20px;
        }

        ul.timeline>li:before {
            content: ' ';
            background: white;
            display: inline-block;
            position: absolute;
            border-radius: 50%;
            border: 3px solid #22c0e8;
            left: 20px;
            width: 20px;
            height: 20px;
            z-index: 400;
        }
    </style>
</head>

<body>
    <!--검색된 타임라인 출력-->
    <div class="container mt-5 mb-5">
        <div class="row">
            <div class="col-md-6 offset-md-3">
                <!--<h4>timeline</h4>-->
                <ul class="Timeline">
                    <% for (var i=0; i<timeline.length; i++){ %>
                        <!--받아온 타임라인 수 만큼 반복-->
                        <% if((timeline[i].text).indexOf(keyword) !=-1) { %>
                            <!--현재 글에 검색 키워드가 존재하면 그 글을 보여줌-->
                            <li>

                                <% if(timeline[i].hasOwnProperty('retweeted_status')) { %>
                                    <!--내가 다른사람 글을 리트윗한거면 원글을 쓴 사람 닉네임 출력-->
                                    <a style="font-weight: bold;" target="_blank" href=>
                                        <%= timeline[i].retweeted_status.user.name %>
                                    </a>
                                    <% } else { %>
                                        <!--아니면 내 닉네임-->
                                        <a style="font-weight: bold;" target="_blank" href=>
                                            <%= timeline[i].user.name %>
                                        </a>
                                        <% } %>

                                            <a href="#" class="float-right">
                                                <%= timeline[i].created_at %>
                                            </a>

                                            <p>
                                                <%=timeline[i].text%>
                                            </p>

                                            <% if(timeline[i].hasOwnProperty('extended_entities')) { %>
                                                <!--미디어가 존재하면 출력-->
                                                <img alt="Web Studio" class="img-fluid" width="300" height="300"
                                                    src=<%=timeline[i].extended_entities.media[0].media_url_https %> />
                                                <% } %>

                                                    <p style="color: #22c0e8;">리트윗: <%= timeline[i].retweet_count %> 마음에
                                                            들어요: <%= timeline[i].favorite_count%>
                                                    </p>

                            </li>
                            <% } %>
                                <% } %>

                </ul>
            </div>
        </div>
    </div>

    <div class="text-muted mt-5 mb-5 text-center small">by : <a class="text-muted" target="_blank"
            href="http://totoprayogo.com">totoprayogo.com</a></div>


</body>

</html>