-
Notifications
You must be signed in to change notification settings - Fork 0
/
test 3 - bootstrap.html
371 lines (332 loc) · 13.4 KB
/
test 3 - bootstrap.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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>BootStrap testing</title>
<script type="text/javascript" src="includes/jquery-1.11.1.min.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="includes/style.css" /> -->
<!-- Bootstrap core CSS -->
<link href="includes/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<link href="includes/bootstrap/css/ie10-viewport-bug-workaround.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="includes/bootstrap/css/carousel.css" rel="stylesheet">
<link href="includes/style.css" rel="stylesheet">
</head>
<body>
<div id="loader" class="loader"></div>
<!-- menu -->
<div class="navbar-wrapper">
<div class="container">
<nav class="navbar navbar-inverse navbar-static-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Doggers Husky Protfolio</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav" id="menu">
</ul>
</div>
</div>
</nav>
</div>
</div>
<!-- end of menu -->
<!-- Carousel
================================================== -->
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="item active">
<img class="first-slide" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="First slide">
<div class="container">
<div class="carousel-caption">
<h1>Example headline.</h1>
<p>Note: If you're viewing this page via a <code>file://</code> URL, the "next" and "previous" Glyphicon buttons on the left and right might not load/display properly due to web browser security rules.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Sign up today</a></p>
</div>
</div>
</div>
<div class="item">
<img class="second-slide" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Second slide">
<div class="container">
<div class="carousel-caption">
<h1>Another example headline.</h1>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Learn more</a></p>
</div>
</div>
</div>
<div class="item">
<img class="third-slide" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Third slide">
<div class="container">
<div class="carousel-caption">
<h1>One more for good measure.</h1>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Browse gallery</a></p>
</div>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div><!-- /.carousel -->
<!-- Wrap the rest of the page in another container to center all the content. -->
<div class="container marketing">
<div class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<strong>Warning!</strong> Website is still in the early testing phase!
</div>
<!-- START THE FEATURETTES -->
<div id="content">
</div>
<!-- /END THE FEATURETTES -->
<!-- FOOTER -->
<footer>
<p class="pull-right"><a href="#">Back to top</a></p>
<p>© 2015 Company, Inc. · <a href="#">Privacy</a> · <a href="#">Terms</a></p>
</footer>
</div><!-- /.container -->
</body>
<script src="includes/bootstrap/js/bootstrap.min.js"></script>
<script>
// server sided script to retrieve the json for the content
var retrieveScript = "test 1 - script.php?page=index";
//server sided script to retreive the menu content
var menuRetrieveScript = "test 2 - menu.php";
//get page
var currentPage = 0;
//post per page
var postPerPage = 2;
// JSON data returned from server
var json;
//used to get footer infomation
var currentContent = $("#content").html();
//note function to populate footer should be called first before anything else
// send request to get content
$.ajax({
type: "GET",
url: retrieveScript,
contentType: "application/json",
success: onResponse,
error: onError
});
// send request to get menu items
$.ajax({
type: "GET",
url: menuRetrieveScript,
contentType: "application/json",
success: onResponseMenu,
error: onError
});
function onError() {
}
// used for the menu
function testMe(e) {
$("#loader").show(0);
if (e != "") {
currentPage = 0;
// send request to get pictures from JSON
$.ajax({
type: "GET",
url: "test 1 - script.php?page=" + e,
contentType: "application/json",
success: onResponse,
error: onError
});
}
}
// used for the menu
function goToPage(page) {
$("#loader").show(0);
currentPage = page;
buildContent();
}
//--------------------
function onResponseMenu(result, textStatus, xmlhttp) {
//store this in a local json variable to prevent using the global one
var json = JSON.parse(xmlhttp.responseText);
var i;
var count = 0;
var out = "";
totalData = json.length;
for (i = 0; i < totalData; i++) {
if (json[i].linkUnderPage === "") {
for (var n = 0; n < totalData; n++) {
if (json[i].page === json[n].linkUnderPage) {
count++;
}
}
if (count > 0) {
//there is menu items
out += "<li class=\"dropdown\" id=\"" + ((json[i].pageMenu == 1) ? "" : json[i].page) + "\">";
out += "<a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\" role=\"button\" aria-haspopup=\"true\" aria-expanded=\"false\">" + json[i].pageLinkName + "<span class=\"caret\"></span></a>";
out += "<ul class=\"dropdown-menu\">";
for (var n = 0; n < totalData; n++) {
if (json[i].page === json[n].linkUnderPage) {
out += "<li id=\"" + json[n].page + "\">";
out += "<a href=\"#\" onclick=\"testMe('" + json[n].page + "')\">" +json[n].pageLinkName + "</a></li>";
}
}
out += "</ul>";
out += "</li>";
}else{
//no menu items to be found
out += "<li>";
out += "<a href=\"#\" onclick=\"testMe('" + json[i].page + "')\">" + json[i].pageLinkName + "</a>";
out += "</li>";
}
count = 0;
}
}
$("#menu").append(out);
}
function buildContent() {
var i;
var out = "";
var totalData = json.length;
//move to gobal variable
var totalPages = Math.ceil(totalData/postPerPage);
var count = 0;
out += "<hr class=\"featurette-divider\" style=\"margin: 20px 0;\">";
var length = (currentPage * postPerPage) + postPerPage;
if (length > totalData) {
length = totalData;
}
//current page times the ammount to show per page
for (i = (currentPage * postPerPage); i < length; i++) {
out += "<div class=\"row featurette\">";
if (count == 1) {
out += "<div class=\"col-md-7\">";
}else{
out += "<div class=\"col-md-7 col-md-push-5\">";
}
out += "<h2 class=\"featurette-heading\">" + json[i].contentTitle + "</h2>";
out += htmlspecialchars_decode(json[i].content);
out += "</div>";
if (count == 1) {
out += "<div class=\"col-md-5\">";
count = 0;
}else{
out += "<div class=\"col-md-5 col-md-pull-7\">";
count = 1;
}
out += "<img class=\"featurette-image img-responsive center-block\" src=\"" + json[i].imgUrl +"\">";
out += "</div>";
out += "</div>";
out += "<hr class=\"featurette-divider\">";
}
out += "<nav><ul class=\"pagination pagination-lg\">";
for (i = 0; i < totalPages; i++) {
if (currentPage == i) {
out += "<li class=\"active\"><a href=\"#\" >" + (i + 1) + "</a></li>";
}else{
out += "<li><a href=\"#\" onclick=\"goToPage(" + i + ")\">" + (i + 1) + "</a></li>";
}
}
out += "</ul></nav>";
$("#content").html(out);
$("#content").append(currentContent);
$("#loader").delay(800).fadeOut("slow");
}
function onResponse(result, textStatus, xmlhttp) {
//set the json object
json = JSON.parse(xmlhttp.responseText);
//build the content
buildContent();
}
base64_decode = function(s) {
var e={},i,b=0,c,x,l=0,a,r='',w=String.fromCharCode,L=s.length;
var A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
for(i=0;i<64;i++){e[A.charAt(i)]=i;}
for(x=0;x<L;x++){
c=e[s.charAt(x)];b=(b<<6)+c;l+=6;
while(l>=8){((a=(b>>>(l-=8))&0xff)||(x<(L-2)))&&(r+=w(a));}
}
return r;
};
function htmlspecialchars_decode(string, quote_style) {
// discuss at: http://phpjs.org/functions/htmlspecialchars_decode/
// original by: Mirek Slugen
// improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// bugfixed by: Mateusz "loonquawl" Zalega
// bugfixed by: Onno Marsman
// bugfixed by: Brett Zamir (http://brett-zamir.me)
// bugfixed by: Brett Zamir (http://brett-zamir.me)
// input by: ReverseSyntax
// input by: Slawomir Kaniecki
// input by: Scott Cariss
// input by: Francois
// input by: Ratheous
// input by: Mailfaker (http://www.weedem.fr/)
// revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// reimplemented by: Brett Zamir (http://brett-zamir.me)
// example 1: htmlspecialchars_decode("<p>this -> "</p>", 'ENT_NOQUOTES');
// returns 1: '<p>this -> "</p>'
// example 2: htmlspecialchars_decode("&quot;");
// returns 2: '"'
var optTemp = 0,
i = 0,
noquotes = false;
if (typeof quote_style === 'undefined') {
quote_style = 2;
}
string = string.toString()
.replace(/</g, '<')
.replace(/>/g, '>');
var OPTS = {
'ENT_NOQUOTES': 0,
'ENT_HTML_QUOTE_SINGLE': 1,
'ENT_HTML_QUOTE_DOUBLE': 2,
'ENT_COMPAT': 2,
'ENT_QUOTES': 3,
'ENT_IGNORE': 4
};
if (quote_style === 0) {
noquotes = true;
}
if (typeof quote_style !== 'number') { // Allow for a single string or an array of string flags
quote_style = [].concat(quote_style);
for (i = 0; i < quote_style.length; i++) {
// Resolve string input to bitwise e.g. 'PATHINFO_EXTENSION' becomes 4
if (OPTS[quote_style[i]] === 0) {
noquotes = true;
} else if (OPTS[quote_style[i]]) {
optTemp = optTemp | OPTS[quote_style[i]];
}
}
quote_style = optTemp;
}
if (quote_style & OPTS.ENT_HTML_QUOTE_SINGLE) {
string = string.replace(/�*39;/g, "'"); // PHP doesn't currently escape if more than one 0, but it should
// string = string.replace(/'|�*27;/g, "'"); // This would also be useful here, but not a part of PHP
}
if (!noquotes) {
string = string.replace(/"/g, '"');
}
// Put this in last place to avoid escape being double-decoded
string = string.replace(/&/g, '&');
return string;
}
</script>
</html>