theme: dark
share: true
noti: 이 글자가 보이시는 분은 <https://www.alrimi.click/down-price-list> 로 재접속 부탁드립니다.
<!-- 수평형 -->
<ins class="adsbygoogle"
     style="display:inline-block;width:900px;height:90px"
     data-ad-client="ca-pub-6350989486427019"
     data-ad-slot="2336271101"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<head>
  <style type="text/css">
    html {
      overflow-y: scroll;
    }

    html, body {
      width: 100%;
      height: 100%;
      margin: 0;
      padding: 0;
      border: 0;
      overflow-x: visible;
      -webkit-font-smoothing: antialiased;
    }

    #product_view, .product {
      margin: 0;
      padding: 0;
      font-weight: normal;
      font-size: 12px;
      color: #212121;
      letter-spacing: 0.03em;
    }

    table {
      width: 100%;
      min-width: 100%;
      max-width: none;
      table-layout: fixed;
      border-spacing: 0;
      border-collapse: collapse;
    }

    form, fieldset, img {
      border: 0;
    }

    address, caption, cite, code, dfn, em, th, var {
      font-weight: normal;
      font-style: normal;
    }

    ol, ul, li {
      list-style: none;
    }

    abbr, acronym {
      border: 0;
    }

    hr {
      display: none;
    }

    .notion-page-content {
      padding: 0 0 var(--page-content-padding-bottom) 0 !important;
    }

    .product_list {
      background-color: white
    }

    .product_list ul {
      display: flex;
      flex-wrap: wrap;
    }

    @media only screen and (max-width: 900px) {
      .product_list ul li {
        width: 50%;
      }
    }

    @media only screen and (min-width: 900px) {
      .product_list ul li {
        width: 33.3%;
      }
    }

    @media only screen and (min-width: 1150px) {
      .product_list ul li {
        width: 25%;
      }
    }

    .custom-select {
      -webkit-appearance: none;
      -moz-appearance: none;
      appearance: none;
      height: 30px;
      padding: 5px 10px 5px 15px;
      background-size: 10px;
      transition: border-color .1s ease-in-out, box-shadow .1s ease-in-out;
      border: 1px solid #ddd;
      border-radius: 3px;
    }

    #alrimi_search_text {
      -webkit-appearance: none;
      -moz-appearance: none;
      appearance: none;
      height: 30px;
      padding: 0px 0px 0px 15px;
      width: 210px;
      background-size: 10px;
      transition: border-color .1s ease-in-out, box-shadow .1s ease-in-out;
      border: 1px solid #ddd;
      border-radius: 3px;
    }

    #min_price, #max_price {
      -webkit-appearance: none;
      -moz-appearance: none;
      appearance: none;
      height: 30px;
      padding: 0px 0px 0px 15px;
      width: 115px;
      background-size: 10px;
      transition: border-color .1s ease-in-out, box-shadow .1s ease-in-out;
      border: 1px solid #ddd;
      border-radius: 3px;
    }

    .custom-select:hover {
      border: 1px solid #999;
    }

    .custom-select:focus {
      border: 1px solid #999;
      box-shadow: 0 3px 5px 0 rgba(0, 0, 0, .2);
      outline: none;
    }

    /* remove default arrow in IE */
    select::-ms-expand {
      display: none;
    }
  </style>

  <script>
    let loading = false
    let finish = false
    let page = 0
    let sort = 'c'
    let type = 'price'
    let products = new Set();
    let category = '00'
    let search_text = ''
    let min_price = ''
    let max_price = ''

		$(function () {
      let params = getUrlParams()
      if (params.s !== undefined) {
        sort = params.s
      }
      if (params.c !== undefined) {
        category = params.c
      }
      if (params.mn !== undefined) {
        min_price = decodeURI(params.mn)
      }
      if (params.mx !== undefined) {
        max_price = decodeURI(params.mx)
      }
      if (params.t !== undefined) {
        search_text = decodeURI(params.t)
      }

      document.getElementById("alrimi_category").value = category
      document.getElementById("alrimi_sort").value = sort
      document.getElementById("min_price").value = min_price
      document.getElementById("max_price").value = max_price
      document.getElementById("alrimi_search_text").value = search_text

      get_product_list(page, sort, type, category, min_price, max_price, search_text)
      const container = document.querySelector('.product_list');

      window.addEventListener('scroll', () => {
        const {scrollHeight, scrollTop, clientHeight} = document.documentElement;

        if (scrollTop + clientHeight > scrollHeight - 1200 && !loading) {
          get_product_list(++page, sort, type, category, min_price, max_price, search_text)
        }
      });

      const ENTER_BUTTON_KEY_CODE = 13;

      document.getElementById("alrimi_search_text").addEventListener('keyup', event => {
        if (event.keyCode === ENTER_BUTTON_KEY_CODE) {
          search()
        }
      });
      document.getElementById("min_price").addEventListener('keyup', event => {
        if (event.keyCode === ENTER_BUTTON_KEY_CODE) {
          search()
        }
      });
      document.getElementById("max_price").addEventListener('keyup', event => {
        if (event.keyCode === ENTER_BUTTON_KEY_CODE) {
          search()
        }
      });
    })

    function get_product_list(page, sort, type, category, min_price, max_price, search_text) {
      loading = true
      if (finish) {
        return
      }

      fetch("<https://jr289qyc6a.execute-api.ap-northeast-2.amazonaws.com/default/get_products?type=>" + type + "&sort=" + sort + "&page=" + page +
            "&search_text=" + search_text + "&category=" + category + "&min_price=" + min_price + "&max_price=" + max_price)
        .then((response) => response.json())
        .then((data) => {
          if (data.length == 0) {
            finish = true

            if (page == 0) {
              alert("검색 결과가 없습니다.")
            }
          }

          data.forEach(product => {
            if (!products.has(product['url'])) {
              products.add(product['url'])
              price_render(product)
            }
          })
        });
      setTimeout(function () {
        loading = false
      }, 500)
    }

    function price_render(product) {
      let c_at = new Date(product['c_at'].$date);
      let month = (c_at.getMonth() + 1) + "";
      let date = c_at.getDate() + "";
      let hour = checkZero(c_at.getHours() + "");
      let minutes = checkZero(c_at.getMinutes() + "");
      let url = product['url']
      if (product['v_url'] !== undefined) {
        url = product['v_url']
      }

      let elem = document.querySelector('#product_view')
      const product_id = product['m_p_i'].$oid

      let html_txt = '<li style="padding: 0 0 20px 0; box-sizing: border-box;" class="product">'
      html_txt += '        <a href="' + url + '" style="color: #212121; text-decoration: none;" target="_blank">'
      html_txt += '    <div className="thumb" style="text-align: center; position: relative">'
      html_txt += '        <img style="width: 100%; height: auto;" src="' + product["p_img_url"] + '" alt="상품 이미지">'
      html_txt += '        <a href="<https://t.me/coupang_alarm_bot?start=a_p_>' + product_id + '" ' +
                  'style="position:absolute; right:15px; bottom:5px; width: 30px; height: auto;" target="_blank"> ' +
                  '<img width="100%" src="<https://false-date-d45.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F45436fa8-c5bb-4400-81fd-724b347e970a%2Fplus.png?id=983f51bc-9dcd-44b3-a116-1171ea442e39&table=block&spaceId=2d39864b-974a-418c-9df1-0a85709c9cd8&width=1020&userId=&cache=v2>" ' +
                  'alt="알리미에 상품 추가"></a>'
      html_txt += '        <a href="<https://alrimi.oopy.io/item?id=>' + product_id + '" ' +
                  'style="position:absolute; left:15px; bottom:5px; width: 30px; height: auto;" target="_blank"> ' +
                  '<img width="100%" src="<https://false-date-d45.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F11fd469d-a376-4e5e-a595-b7222821aa84%2Fgraph-report.png?id=1646fd19-bb0b-435a-8751-358c05b0954f&table=block&spaceId=2d39864b-974a-418c-9df1-0a85709c9cd8&width=130&userId=&cache=v2>" ' +
                  'alt="알리미에 상품 추가"></a>'
      html_txt += '    </div>'
      html_txt += '</a>'
      html_txt += '<a href="' + url + '" style="color: #212121; text-decoration: none;" target="_blank">'
      html_txt += '    <div className="info" style="margin: 5px 10px 0;">'
      html_txt += '        <div className="name">'
      html_txt +=
        '            <span className="name_text" style="font-size: 14px; color: #212121; line-height: 16px; word-break: break-all; text-decoration: none;" target="_blank">' +
        product["p_nm"] + '</span>'
      html_txt += '        </div>'
      html_txt += '        <div className="price" style="margin-top: 8px;">'
      html_txt += '            <em style="display: block;">변동 시간 : ' + month + '월 ' + date + '일 ' + hour + ':' + minutes + '</em>'
      html_txt += '            <em style="display: block;">이전 가격 : ' + product['prev_price'].toLocaleString() + '원</em>'
      html_txt += '            <em className="down_price" style="display: block; font-size: 12px; color: #ae0000; font-weight: bold;">하락 가격 : -' +
                  product["diff_price"].toLocaleString() + '원 (-' + product["diff_percent"] + '%)</em>'
      html_txt += '            <strong style="display: block; margin-top: 5px; font-size: 16px; color: #ae0000; font-weight: bold;">' +
                  product["price"].toLocaleString() + '원</strong>'
      html_txt += '        </div>'
      html_txt += '    </div>'
      html_txt += '        </a>'
      html_txt += '</li>'

      elem.innerHTML = elem.innerHTML + html_txt;
    }

    function checkZero(data) {
      if (data.length == 1) {
        data = "0" + data;
      }
      return data;
    }

    function search() {
      let category = document.getElementById("alrimi_category").value;
      let sort = document.getElementById("alrimi_sort").value;
      let text = document.getElementById("alrimi_search_text").value;
      let min_price = document.getElementById("min_price").value;
      let max_price = document.getElementById("max_price").value;

      location.href = "<https://alrimi.oopy.io/down-price-list?c=>" + category + "&s=" + sort + "&t=" + text + "&mn=" + min_price + "&mx=" + max_price;
    }

    function getUrlParams() {
      var params = {};

      window.location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi,
        function (str, key, value) {
          params[key] = value;
        }
      );

      return params;
    }
  </script>
</head>
<body>
<section>
  <div class="product_list">
    <div style="text-align: center">
      <div style="display: inline-block">
        <ul style="padding-left: 15px; text-align: center">
          <select id="alrimi_category" class="custom-select" style="width:135px; color:black; font-size: 14px">
            <option value="00" selected>전체</option>
            <option value="01">가전디지털</option>
            <option value="02">식품</option>
            <option value="03">로켓프레시</option>
            <option value="04">출산/유아</option>
            <option value="05">생활용품</option>
            <option value="06">뷰티</option>
            <option value="07">패션의류</option>
            <option value="08">주방용품</option>
            <option value="09">패션잡화</option>
            <option value="10">가구/홈인테리어</option>
            <option value="11">완구/취미</option>
            <option value="12">도서/음반</option>
            <option value="13">자동차용품</option>
            <option value="14">스포츠/레저용품</option>
            <option value="15">반려/애완용품</option>
            <option value="16">문구/사무용품</option>
          </select>&nbsp;&nbsp;&nbsp;
          <select id="alrimi_sort" class="custom-select" style="width:100px; color:black; font-size: 14px">
            <option value="c" selected>최신순</option>
            <option value="d">하락가격순</option>
            <option value="p">하락비율순</option>
          </select>
        </ul>
        <ul style="padding-left: 15px; text-align: center">
          <input type="text" style="color:black; font-size: 14px" id="min_price" placeholder="최소 가격">
          <p style="color:black; margin: auto">&nbsp;~&nbsp;</p>
          <input type="text" style="color:black; font-size: 14px" id="max_price" placeholder="최대 가격">&nbsp;
        </ul>
        <ul style="padding-left: 15px; text-align: center">
          <input type="text" style="color:black; font-size: 14px" id="alrimi_search_text" placeholder="제품명">&nbsp;
          <img onclick="search()" style="cursor: pointer"
               src="<https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F0c59ce59-5d44-44a7-8647-d98617d5ba2c%2Ficons8-search-30.png?id=7d4ed91c-a063-418c-b4c5-03e5dc022c63&table=block&spaceId=2d39864b-974a-418c-9df1-0a85709c9cd8&width=60&userId=c4128ffa-6cb9-4beb-afb5-cd4e1746ab6e&cache=v2>"
               width=30px />
        </ul>
      </div>
    </div>
    <ul id="product_view">
    </ul>
  </div>
</section>
</body>
<!-- display_footer -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-6350989486427019"
     data-ad-slot="3060063943"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>