-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest3.html
194 lines (155 loc) · 5.05 KB
/
test3.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
<!DOCTYPE html>
<html>
<head>
<title># 3 LightRange</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no">
<link rel="stylesheet" href="https://cdn.rawgit.com/necolas/normalize.css/master/normalize.css">
<link href='https://fonts.googleapis.com/css?family=Roboto:400,300,300italic,400italic,500,700,100,100italic' rel='stylesheet' type='text/css'>
<style>
html { font-size:62.5%; }
*, *:before, *:after { box-sizing: border-box; }
* { font-family: 'Roboto', arial, helvetica, sans-serif; font-weight:400; }
body { padding:40px 0; background: #fafafa; font-size:1.6rem; color:#333; }
#c { width: 760px; padding:60px; margin:0 auto; min-height:1000px; background:#fff; border:1px solid #eee; border-top-width:2px; }
h1 { margin:0; font-size: 3.7rem; font-weight:200; line-height:100%; }
h1 b { font-weight: 800; }
p { line-height:150%; }
p.sub { margin:5px 0 40px; color:#aaa; font-weight:300; text-transform: uppercase; padding-bottom:20px; }
span { font-weight: 300; }
/* TEMP-TIP */
.tip {
position:absolute;
top:-50px;
left:-50%;
background: #888;
color:#fff;
font-size:14px;
padding:10px;
z-index:2;
width: 100px;
border-radius:3px;
}
#c, td { position:relative; }
#cal p { text-align:center; color:#aaa; font-size:12px; padding-top: 40px; clear:both; line-height: 200%; }
#cal p em { font-size:11px; font-style:normal; color:#bbb; display: block; margin:0; padding:0; }
#color { position:absolute; right:60px; top:60px; width:120px; }
#color i, #color em { font-style:normal; color:#aaa; font-size:12px; display:block; margin:0 0 5px; }
#color input { width:100%; height:30px; border:0; padding:0; margin:0; outline:0; background: none; cursor: pointer; }
#color .selColor { float:right; }
</style>
</head>
<body>
<div id="c">
<h1><b>Light</b>Range</h1>
<p class="sub">Responsive date range selection under 5kb</p>
<!--
REQUIRED HTML
Instead of appending this on init
Also makes it easier to translate everything (serverside)
-->
<div id="cal">
<!-- the calendars -->
<div id="r_cals">
<div id="r_nav">
<i class="nav next" id="next">›</i>
<i class="nav prev off" id="prev">‹</i>
</div>
<div id="dp"></div>
</div>
<div id="dactions">
<i class="navTip" style="float:left;padding-top:15px;font-style:italic;font-size:14px;color:#aaa;">Tip: Use <b>scroll wheel</b> or <b>keyboard arrows</b> to navigate</i>
<button class="dbtn red">Cancel</button><button class="dbtn green">Apply</button>
</div>
</div>
<div id="lrovr"></div><!-- overlay -->
<style>
form i, form p { font-style:normal; color: 888; }
form div { width:49%; float:left; }
form div:first-child { margin-right:2%; }
form div:last-of-type { width:100%; }
input { width:100%; margin:0;padding:10px; border:1px solid #aaa; }
form button { background:#03A9F4;color:#fff;border:0; margin-top:20px; width:auto; padding: 12px 24px; text-transform: uppercase; }
</style>
<form id="form">
<!--
FIELDS
value="Wednesday, 9 Dec 2016 – Friday 22 Dec 2016"
-->
<div>
<input type="text" value="Stockholm (STO)">
</div>
<div>
<input type="text" value="Bangkok (BKK)">
</div>
<div onclick="$(this).find('input').focus()">
<br>
<input
id="dateField"
type="text"
value=""
placeholder="Select Departure and Return dates"
data-days = "Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday"
data-months = "January,February,March,April,May,June,Juli,August,September,October,November,December"
data-monthsNum = "50"
readonly="true"
>
</div>
<style>
#lightRange {
width:100%;
max-width:800px;
text-align: center;
padding:15px;
border: 1px solid #aaa;
}
#lightRange b i { font-weight: 600; }
#lightRange i { font-style: normal; }
</style>
<input id="date1" type="hidden" value="2016-07-10">
<input id="date2" type="hidden" value="2016-07-17">
<button>Search</button>
</form>
<!--
INIT
1. Get data-text
2. Bind dateField to action
-->
</div><!-- /#c -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<div id="scripts"></div>
<script>
// script load (without caching)
function jsLoad(sel, uri, type){
uri = uri + '?v=' + Math.random();
if(type == 'js'){
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = uri;
}
else {
var script = document.createElement('link');
script.rel = 'stylesheet';
script.type = 'text/css';
script.id = 'css';
<!-- <link rel="stylesheet" href="https://cdn.rawgit.com/necolas/normalize.css/master/normalize.css" /> --></link>
script.href = uri;
}
sel.appendChild(script);
if(type == 'js'){
script.onload = function(){
var dateInput = $('#dateField');
rangeCal.init(dateInput);
}
}
}
var sel = document.getElementById('scripts');
jsLoad(sel, 'test3.js', 'js');
jsLoad(sel, 'test3.css', 'css');
$(window).on('load', function(){
$('#dateField').trigger('click');
})
// <link href='test2.css' rel='stylesheet' type='text/css' id='css'>
</script>
</body>
</html>