-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinclude_files_js.php
64 lines (62 loc) · 2.43 KB
/
include_files_js.php
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
<?php
// following line of php code was to determine the device in which app will run.
$mobile_browser = '0';
if (preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|android)/i', strtolower($_SERVER['HTTP_USER_AGENT'])))
{
$mobile_browser++;
}
if ((strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml') > 0) or ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE']))))
{
$mobile_browser++;
}
$mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'], 0, 4));
$mobile_agents = array(
'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',
'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',
'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',
'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',
'newt','noki','oper','palm','pana','pant','phil','play','port','prox',
'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',
'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',
'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',
'wapr','webc','winw','winw','xda ','xda-');
if (in_array($mobile_ua,$mobile_agents))
{
$mobile_browser++;
}
if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'windows') > 0)
{
$mobile_browser = 0;
}
?>
<script src="<?php echo $path_app;?>js/jquery-1.8.2.min.js"></script>
<script src="<?php echo $path_app;?>js/bootstrap.min.js"></script>
<script src="<?php echo $path_app;?>js/jquery.prettyPhoto.js"></script>
<script src="<?php echo $path_app;?>js/modernizr-2.6.1-respond-1.1.0.min.js"></script>
<script src="<?php echo $path_app;?>js/main.js"></script>
<?php
// inlcude rouchswipe.js if and only if similar device recognized.
if($mobile_browser > 0)
{
?>
<script src="<?php echo $path_app;?>js/jquery.touchSwipe.min.js"></script>
<script type="text/javascript">
$(function() {
//Enable swiping...
$(document).swipe({
//Generic swipe handler for all directions
swipeLeft:function(event, direction, distance, duration, fingerCount) // bind leftswipe
{
$('.pp_arrow_previous').click();
},
swipeRight:function(event, direction, distance, duration, fingerCount) // bind rightswipe
{
$('.pp_arrow_next').click();
},
threshold:0
});
});
</script>
<?php
}
?>