-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdemo3.html
329 lines (304 loc) · 13 KB
/
demo3.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/nav.css" rel="stylesheet">
<link rel="shortcut icon" href="img/favicon.ico" />
<title>SwiftCHEM</title>
<style>
body {
background-image: url("http://i.imgur.com/ElmwGmK.jpg");
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
background-color: #464646;
}
.buttona {
margin-left : 10px;
background-color: white;/* Green */
border: none;
color: #4CAF50;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
display: inline;
-webkit-transition-duration: 0.4s; /* Safari */
transition-duration: 0.4s;
border: 2px solid #4CAF50;
border-radius: 4px;
}
.buttona:hover {
-webkit-transition-duration: 0.4s; /* Safari */
transition-duration: 0.4s;
background-color: #4CAF50; /* Green */
color: white;
}
.InputB {
width: 100px;
height : 50px;
box-sizing: border-box;
border: 0.5px solid #ccc;
border-radius: 4px;
font-size: 16px;
background-color: white;
padding: 2px 2px 2px 10px;
-webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
.InputB:focus {
border: 1.5px solid #2B90F5;
-webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
/* Tooltip container */
/*.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black;
}*/
.tooltip-inner {
max-width: 200px;
padding: 3px 8px;
color: white;
text-align: center;
text-decoration: none;
background-color: rgba(17,20,2,1);
border-radius: 4px;
}
.tooltip:hover .tooltiptext {
visibility: visible;
}
.wrapper {
/*border:1px solid #000;*/
display:inline-block;
position:relative;
}
.InputB {
padding-right:30px; /* button padding */
}
input::-webkit-calendar-picker-indicator {
display: none;
}
#main_content {
background: white; /* For browsers that do not support gradients */
}
.remove-icon {
right : 20%;
color : #120000;
}
.remove-icon:hover {
color : #5a0000;
font-size: 105%;
}
.result{
font-size: 15;
font-size: xx-large;
text-align: -webkit-center
}
dl.codebox {
background-color: #a7bad4;
padding:5px;
font-family: calibri;
font-size:11px;
margin : auto;
}
dl.codebox dt {
font-size:11px;
font-weight:700;
color: black;
text-align: left;
margin-bottom:3px;
font-family:Calibri;
border-bottom: 1px dotted #000000;
}
</style>
</head>
<body>
<nav class="cd-stretchy-nav">
<a class="cd-nav-trigger" href="#0">
Menu
<span aria-hidden="true"></span>
</a>
<ul>
<li><a href="./demo.html" ><span class="stk">Demo 1</span></a></li>
<li><a href="./demo2.html"><span class="active stk">Demo 2</span></a></li>
<li><a href="./demo3.html" class="active" ><span class="stk">Demo 3</span></a></li>
<li><a href="./demo4.html"><span class="stk">Demo 4</span></a></li>
<li><a href="#0"><span class="stk">DONATE</span></a></li>
</ul>
<span aria-hidden="true" class="stretchy-nav-bg"></span>
</nav>
<div id="search_form" style="position: absolute; top: 10%; left: 0; right: 0;" >
<div id="logo" style = "text-align: center"><img src="http://i.imgur.com/sHgQKoD.png"></div>
<div id = "InputDiv" style = "text-align: center">
<div id="title" style="color: white; font-size: 30px;"> Nhập các chất </div>
<a href="" onclick="dummy(0);return false;" ><img id="logo2" style= "vertical-align:middle; display: none; width: 200px; height : auto;" src="http://i.imgur.com/sHgQKoD.png"></a>
<div id = "emtydiv" style = "height: 20px"></div>
<div id="BoxDiv" style="text-align: center; display: inline;">
<!--<div id="BDiv"class="wrapper" style="text-align: center;">
<input type="text" id="InputBox" class="InputB" onkeypress="return runScript(event)" list = "suggestions"/>
<span onclick="removeBox(this)" class="glyphicon glyphicon-remove remove-icon"></span>
</div>-->
</div>
<datalist id="suggestions" >
</datalist>
<button onclick="addInputBox()"> + </button>
<button class="buttona" onclick="Click_Search()"> ➦ </button>
</div>
<div id="main_content" style = "display : none; width: 100%; height : 600px;" >
<div><h1 style="left: 30%; position: absolute;">Kết Quả Là</h1></div>
<div style = "left : 25%; top: 20%; position : absolute;">
<dl class="codebox" style=" width : 700px; cursor: pointer;" onclick="this.getElementsByTagName('div')[0].style.display=((this.getElementsByTagName('div')[0].style.display=='none')?'':'none');">
<dt style = "margin : 10px 10px;font-size: 30px;">FeS<sub>2</sub> → SO<sub>2</sub></dt>
<dd>
<div style="display:none; font-size : 20px; margin : 10px 10px; color:black;">
<div>4 FeS<sub>2</sub> + 11 O<sub>2</sub> → 2 Fe<sub>2</sub>SO<sub>3</sub></div>
</div>
</dd>
</dl>
<div style = "height : 20px"></div>
<dl class="codebox" style=" width : 700px; cursor: pointer;" onclick="this.getElementsByTagName('div')[0].style.display=((this.getElementsByTagName('div')[0].style.display=='none')?'':'none');">
<dt style = "margin : 10px 10px;font-size: 30px;">SO<sub>2</sub> → H<sub>2</sub>SO<sub>4</sub></dt>
<dd>
<div style="display:none; font-size : 20px; margin : 10px 10px; color : black;">
<div>2 SO<sub>2</sub> + O<sub>2</sub> → 2 SO<sub>3</sub></div>
<div>SO<sub>3</sub> + H<sub>2</sub>O → H<sub>2</sub>SO<sub>4</sub><div>
</div>
</dd>
</dl>
</div>
</div>
</div>
<script src="js/jquery-2.1.4.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>
function Click_Search() {
var indexInput = 1;
var BDivId = 'BDiv' + indexInput;
var inputId = '#' + BDivId + ' input';
indexInput++;
//var result = $("#Result");
$('[data-toggle="tooltip"]').tooltip();
var input = $(inputId);
var inputBoxs = $("#BoxDiv input");
// Checking
inputBoxs.each(function(){
if (this.value.length>0)
{
$('#title').remove();
//MOVING
div_move = document.getElementById("search_form");
logo_move = document.getElementById("logo");
logo2 = document.getElementById("logo2");
content = document.getElementById("main_content");
emty_div = document.getElementById("emtydiv");
emty_div.style.display = "none";
content.style.display = "block";
content.style.position = "absolute";
content.style.top = "60px";
logo2.style.display = "inline";
div_move.style.top = "5px";
logo_move.style.display = "none";
//result.text("BaCl2 + H2SO4 -> BaSO4 + 2HCl");
// SEARCHING
// var st = chuanhoa(document.getElementById("_search").value);
// var ele = [];
// var fir = 0;
// for (i = 0 ; i<st.length; i++)
// if (st[i]==' ') {
// ele.push(st.slice(fir,i+1));
// fir = i+1;
// }
// document.getElementById("lk_hc").innerHTML = "Các chất có trong input : " + ele;
}
})
}
function runScript(e) {
if (e.keyCode == 13) {
Click_Search();
return false;
}
};
// function isChemical(){
// var
// }
function addSuggestion(chats) {
var parrent = $('#suggestions');
chats.forEach(function(chat) {
var appendString = '<option value=' + chat + '>';
parrent.append(appendString);
});
}
var indexInput = 1;
var sl = 1;
function removeBox(self){
if (sl>3) {
sl--;
var id = ($(self).parent().attr('id'));
$('#' + id).remove();
}
}
function checkSize(name) {
box = document.getElementById(name);
if (box.value.length>=8) {box.style.width = "150px";}
if (box.value.length>5&&box.value.length<8) {box.style.width = "130px";}
if (box.value.length<=5&&box.value.length>2) {box.style.width = "100px";}
}
function addInputBox(){
if (sl<=5) {
sl++;
var parrent = $('#BoxDiv')
var BDivId = 'BDiv' + indexInput;
var inputId = '#' + BDivId + ' input';
var InputBox = "InputBox" + indexInput;
var appendString = '<div id="' + BDivId + '"class="wrapper" style="text-align: center;"><input type="text" id="'+InputBox+'" class="InputB" onkeypress="return runScript(event)" onchange="checkSize(\''+InputBox+'\')" onkeyup="checkSize(\''+InputBox+'\')" list = "suggestions"/><span onclick="removeBox(this)" class="glyphicon glyphicon-remove remove-icon"></span></div>';
parrent.append(appendString);
indexInput++;
var input = $(inputId);
input.keypress(function(event) {
if(event.charCode == 40 || event.charCode == 41) return true;
if(event.charCode >= 33 && event.charCode <= 48 || event.charCode >= 58 && event.charCode <= 64 ||
event.charCode >= 91 && event.charCode <= 96 ||event.charCode >= 123 && event.charCode <= 126 ) {
return false;
}
return true;
});
var div = $(BDivId);
var spanSelectString = '#' + BDivId + ' span';
// div.mouseenter(function() {
// $(spanSelectString).show();
// });
// input.mouseleave(function() {
// $(spanSelectString).hide();
// });
}
}
$(document).ready(function() {
addInputBox();
addInputBox();
// Add suggestions
var chats = ['Na', 'K', 'Ba', 'Li', 'KOH', 'K2SO4', 'KNO3', 'KCl', 'CuSO4', 'CuCl2', 'H2O', 'CaCO3', 'CaSO4', 'BaSO4', 'Ca', 'HCl', 'BaCl2', 'H2SO4'];
addSuggestion(chats);
// Add key press event. Preventing other keys.
var input = $("#BoxDiv input");
input.keypress(function(event) {
if(event.charCode == 40 || event.charCode == 41) return true;
if(event.charCode >= 33 && event.charCode <= 48 || event.charCode >= 58 && event.charCode <= 64 ||
event.charCode >= 91 && event.charCode <= 96 ||event.charCode >= 123 && event.charCode <= 126 ) {
return false;
}
return true;
});
});
</script>
<script src="js/main.js"></script>
<script src="js/modernizr.js"></script> <!-- Modernizr -->
</body>
</html>