forked from georgelu/Quotely
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquote.php
More file actions
193 lines (151 loc) · 6.2 KB
/
quote.php
File metadata and controls
193 lines (151 loc) · 6.2 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
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
<!DOCTYPE html>
<html>
<head>
<title>Quotely</title>
<meta charset="utf-8">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="jquery.mobile-1.2.0/jquery.mobile-1.2.0.css" />
<link rel="stylesheet" href="themes/quotelytheme2.min.css" />
<script src="./jQuery/jquery-1.8.2.min.js"></script>
<script src="./jquery.mobile-1.2.0/jquery.mobile-1.2.0.js"></script>
<style>
.ui-btn {text-align: left}
#content {
background:url(darkathens.jpg);
background-size:320px 460px;
background-repeat:no-repeat;
border-width:0px;
}
</style>
</head>
<body>
<!-- Start of first page: #one -->
<div data-role="page" id="quote" data-theme="a" data-content-theme="a">
<div data-role="header" style="border-color:white;">
<a href="index.html" data-icon="home">Home</a>
<!--<a href="#popup">Share</a> -->
<h1 id="category">
<?php echo $_GET['category']; ?>
<?php echo $_GET['subcat']; ?>
<a href="#help" data-rel="popup" data-theme="a" data-icon="info" data-mini="true" data-iconpos="notext" style="border-width:0px;"</a>
<div data-role="popup" id="help" style="color:black;">
<p><strong>Confused?</strong><br>
Try swiping to view another quotation.<br>
Click outside of the box to go back.</p>
</div>
</h1>
<?php include("header.php"); ?>
</div><!-- /header -->
<div id="content" data-role="content" style="height:340px;">
<?php
$query = "";
$id = $_GET['id'];
$category = $_GET['category'];
$subcat = $_GET['subcat'];
$subid = $_GET['subid'];
$cur_id = '0';
include("content.php");
?>
<a href="#popup" data-role="button" data-inline="true" data-mini="true">Share this story</a>
<script type="text/javascript">
// This handles all the swiping between each page. You really
// needn't understand it all.
$(document).on('pageshow', 'div:jqmData(role="page")', function(){
var page = $(this), nextpage, prevpage;
// check if the page being shown already has a binding
if ( page.jqmData('bound') != true ){
// if not, set blocker
page.jqmData('bound', true)
// bind
.on('swipeleft.paginate', function() {
if($.mobile.activePage.attr('id') == 'quote') {
console.log("binding to swipe-left on "+page.attr('id'));
var subcat = getQueryVariable('subcat');
var php_id = "<?php echo $id; ?>";
if (subcat != null) {
window.location = "quote.php?subcat=" + subcat + "&subid=" + (parseInt(php_id) + 1);
//window.location = "quote.php?subcat=" + subcat + "&subid=" + (parseInt(getQueryVariable('subid')) + 1);
} else {
window.location = "quote.php?category=" + getQueryVariable('category') + "&id=" + (parseInt(php_id) + 1);
//window.location = "quote.php?category=" + getQueryVariable('category') + "&id=" + (parseInt(getQueryVariable('id')) + 1);
}
}
})
.on('swiperight.paginate', function(){
if($.mobile.activePage.attr('id') == 'quote') {
console.log("binding to swipe-right " + page.attr('id'));
var subcat = getQueryVariable('subcat');
var php_id = parseInt("<?php echo $id; ?>");
if (subcat != null) {
if (php_id - 1 < 1) {
window.location = "quote.php?subcat=" + subcat + "&subid=" + php_id;
} else {
window.location = "quote.php?subcat=" + subcat + "&subid=" + (php_id - 1);
}
} else {
//var id = parseInt(getQueryVariable('id'));
if (php_id - 1 < 1) {
window.location = "quote.php?category=" + getQueryVariable('category') + "&id=" + php_id;
} else {
window.location = "quote.php?category=" + getQueryVariable('category') + "&id=" + (php_id - 1);
}
}
}
});
}
});
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split('&');
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
if (decodeURIComponent(pair[0]) == variable) {
return decodeURIComponent(pair[1]);
}
}
console.log('Query variable %s not found', variable);
return null;
}
</script>
<div style="text-align: center ;">
<br>
<img src="paginate-white.png">
</div>
<br>
</div><!-- /content -->
</div><!-- /page one -->
<!-- Start of third page: #popup -->
<div data-role="popup" id="popup">
<div data-role="header" data-theme="a">
<h1>Share</h1>
</div><!-- /header -->
<div data-role="content" data-theme="a" style="color:black;">
<h2>Share this quote with your friends.</h2>
<p><a href="#" onclick="sharefb()" data-rel="facebook" data-role="button" data-inline="true">Facebook</a></p>
<p><a href="#" onclick="sharetw()" data-role="button" data-inline="true">Twitter</a></p>
<p><a href="#one" data-rel="back" data-role="button" data-inline="true" data-icon="back">Back</a></p>
</div><!-- /content -->
</div><!-- /page popup -->
<script type="text/javascript">
function sharefb() {
window.open("http://www.facebook.com/sharer.php?u=" + window.location.href.replace(/&/g, '%26') + "&t=Quotely");
}
</script>
<script type="text/javascript">
function sharetw() {
window.open("https://twitter.com/intent/tweet?url=" + window.location.href.replace(/&/g, '%26') + "&text=Quotely&original_referer=" + window.location.href.replace(/&/g, '%26'));
}
</script>
<script type="text/javascript">
window.addEventListener("load",function() {
// Set a timeout...
setTimeout(function(){
// Hide the address bar!
window.scrollTo(0, 1);
}, 0);
});
</script>
</body>
</html>