-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfind.html
More file actions
74 lines (67 loc) · 1.89 KB
/
Copy pathfind.html
File metadata and controls
74 lines (67 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<html>
<head>
<title>YES 24 찾기</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<style>
#text {
width: 80%;
float: left;
height: 40px;
}
#find {
width: 20%;
float: left;
height: 40px;
}
</style>
</head>
<body>
<input class="form-control" id="text">
<button class="button button-success" id="find">검색하기</button>
<div id="result"></div>
<div id="result_list"></div>
<script>
$("#find").click(function() {
$.getJSON("http://www.yes24.com/SearchCorner/Sniper/GetSniperSearch?Parsing=true&Domain=0&Page=0&PageSize=3&Query="+trans($("#text").val()),function(data){
if(data.TotalCount>0){
$("#result").text("찾았습니다!"+TotalCount+"개 검색 완료");
$("#result_list").empty();
for(var i=0;i<data.List.length;i++){
var item = data.List[i];
$("#result_list").append($item=$("div").addClass("result-item"));
$item.append($("h2").addClass("result-item-title").html(detrans(item.GOODS_NM)).attr("href",item.GOODS_NO));
}
}
else{
$("#result").text("못찾았습니다 T.T");
$("#result_list").empty();
}
});
});
$("#text").keydown(function(event) {
if (event.keyCode == 13) {
console.log("keydown");
$("#find").click();
}
});
function trans(str) {
return encodeURI(replaceAll(escape(str), "%", "\\"));
}
function detrans(str) {
return unescape(replaceAll(str, "\\", "%"));
}
function replaceAll(strTemp, strValue1, strValue2) {
while (true) {
if (strTemp.indexOf(strValue1) != -1) {
strTemp = strTemp.replace(strValue1, strValue2);
} else {
break;
}
}
return strTemp;
}
</script>
</body>
</html>