-
Notifications
You must be signed in to change notification settings - Fork 47
/
demo.html
137 lines (133 loc) · 3.85 KB
/
demo.html
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Widget Smartphone Spesifikasi - iBacor</title>
<link type="text/css" rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
<style>
td{
padding: 10px
}
a{
color: #999;
text-decoration: none;
text-transform:uppercase
}
a:hover{
text-decoration: none;
}
a.w{
color: #999;
text-decoration: none;
font-size: 8px;
text-transform: none
}
</style>
</head>
<body>
<div class="content">
<table align="center">
<tr>
<td>
Keyword:
</td>
<td>
<input type="text" placeholder="Asus Zenfone" id="query" value="Zenfone" class="form-control"/>
</td>
</tr>
<tr>
<td>
Name:
</td>
<td>
<select id="nama" class="form-control"></select>
</td>
</tr>
<tr>
<td colspan="3" style="text-align:center">
<input type="button" value="Ok" class="btn btn-danger" id="ok"/>
</td>
</tr>
</table>
<div id='spek' align="center"></div>
<p align="center"><a href="http://ibacor.com/widget" class="w" target="_BLANK">Widget by iBacor.com</a></p>
</div>
<script type="text/javascript" src="//code.jquery.com/jquery-2.2.0.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/js/bootstrap.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var x = $('#query').val();
cari(x);
});
$('body').on('focus', '#query', function() {
$(this).keydown(function() {
setTimeout(function() {
var d = $('#query').val(),
jum = d.length;
if (jum > 2) {
cari(d);
}
}, 50);
});
});
$('body').on('click', '#ok', function() {
$("#spek").html('<img src="http://ibacor.com/bcr_asset/images/load.gif" alt="Process.."/>');
var x = $('#nama').val();
if(x != 'not found'){
$.ajax({
url: 'api/?slug=' + x,
crossDomain: true,
dataType: 'json'
}).done(function(b) {
var c = '<h3>'+b.title+'</h3>';
c += '<img src="'+b.img+'"/>';
c += '<div class = "panel-group" id = "accordion">';
$.each(b.data, function(index, value) {
c += '<div class = "panel panel-default">';
c += ' <div class = "panel-heading">';
c += ' <h4 class = "panel-title">';
c += ' <a data-toggle = "collapse" data-parent = "#accordion" href = "#collapse'+index+'">';
c += index;
c += ' </a>';
c += ' </h4>';
c += ' </div>';
c += ' <div id = "collapse'+index+'" class = "panel-collapse collapse">';
c += ' <div class = "panel-body">';
c += ' <table class = "table table-bordered">';
$.each(value, function(i, v) {
c += ' <tr><td><strong style="text-transform:uppercase">'+ i.replace("_", " ") +'</strong></td><td>'+ v +'</td></tr>';
});
c += ' </table>';
c += ' </div>';
c += ' </div>';
c += '</div>';
});
$('#spek').html(c);
});
}else{
$('#spek').html('Not Found.');
}
return false;
});
function cari(d) {
$.ajax({
url: 'api/?query=' + d,
crossDomain: true,
dataType: 'json'
}).done(function(b) {
var c = '';
if(b.status != 'error'){
$.each(b.data, function(i, a) {
c += '<option value="' + b.data[i].slug + '">' + b.data[i].title + '</option>';
});
}else{
c += '<option value="not found">Not Found</option>';
}
$('#nama').html(c);
});
}
</script>
</body>
</html>