shared_writable_dirs: | |
- /labs/tiles | |
- /lib/staticmaplite/cache | |
php_extensions: [pgsql, pdo, pdo_pgsql, curl] | |
<?php | <?php |
include ('include/common.inc.php'); | include ('include/common.inc.php'); |
include_header("About", "about") | include_header("About", "about") |
?> | ?> |
<p> | <p> |
Busness Time - An ACT bus timetable webapp<br /> | Busness Time - An ACT bus timetable webapp<br /> |
Based on the maxious-canberra-transit-feed (<a | Based on the maxious-canberra-transit-feed (<a |
href="http://s3-ap-southeast-1.amazonaws.com/busresources/cbrfeed.zip">download</a>, | href="http://s3-ap-southeast-1.amazonaws.com/busresources/cbrfeed.zip">download</a>, |
last updated <?php | last updated <?php |
echo date("F d Y.", @filemtime('cbrfeed.zip')); ?>)<br /> | echo date("F d Y.", @filemtime('cbrfeed.zip')); ?>)<br /> |
Source code for the <a | Source code for the <a |
href="https://github.com/maxious/ACTBus-data">transit | href="https://github.com/maxious/ACTBus-data">transit |
feed</a> and <a href="https://github.com/maxious/ACTBus-ui">this | feed</a> and <a href="https://github.com/maxious/ACTBus-ui">this |
site</a> available from github.<br /> | site</a> available from github.<br /> |
Uses jQuery Mobile, PHP, PostgreSQL, OpenTripPlanner, OpenLayers, OpenStreetMap, Cloudmade Geocoder and Tile Service<br /> | Uses jQuery Mobile, PHP, PostgreSQL, OpenTripPlanner, OpenLayers, OpenStreetMap, Cloudmade Geocoder and Tile Service<br /> |
<br /> | <br /> |
Feedback encouraged; contact maxious@lambdacomplex.org<br /> | Feedback encouraged; contact maxious@lambdacomplex.org<br /> |
<br /> | <br /> |
Some icons by Joseph Wain / glyphish.com<br /> | Some icons by Joseph Wain / glyphish.com<br /> |
Native clients also available for iPhone(<a href="http://itunes.apple.com/au/app/cbrtimetable/id444287349?mt=8">cbrTimetable by Sandor Kolotenko</a> | |
, <a href="http://itunes.apple.com/au/app/act-buses/id376634797?mt=8">ACT Buses by David Sullivan</a>) | |
and Android (<a href="https://market.android.com/details?id=com.action">MyBus 2.0 by Imagine Team</a>) | |
<br /> | |
<br /> | <br /> |
<small>Disclaimer: The content of this website is of a general and informative nature. Please check with printed timetables or those available on http://action.act.gov.au before your trip. | <small>Disclaimer: The content of this website is of a general and informative nature. Please check with printed timetables or those available on http://action.act.gov.au before your trip. |
Whilst every effort has been made to ensure the high quality and accuracy of the Site, the Author makes no warranty, | Whilst every effort has been made to ensure the high quality and accuracy of the Site, the Author makes no warranty, |
express or implied concerning the topicality, correctness, completeness or quality of the information, which is provided | express or implied concerning the topicality, correctness, completeness or quality of the information, which is provided |
"as is". The Author expressly disclaims all warranties, including but not limited to warranties of fitness for a particular purpose and warranties of merchantability. | "as is". The Author expressly disclaims all warranties, including but not limited to warranties of fitness for a particular purpose and warranties of merchantability. |
All offers are not binding and without obligation. The Author expressly reserves the right, in his discretion, to suspend, | All offers are not binding and without obligation. The Author expressly reserves the right, in his discretion, to suspend, |
change, modify, add or remove portions of the Site and to restrict or terminate the use and accessibility of the Site | change, modify, add or remove portions of the Site and to restrict or terminate the use and accessibility of the Site |
without prior notice. </small> | without prior notice. </small> |
<?php | <?php |
include_footer(); | include_footer(); |
?> | ?> |
#!/bin/bash | #!/bin/bash |
#this script should be run from a fresh git checkout from github | #this script should be run from a fresh git checkout from github |
#ami base must have yum install lighttpd-fastcgi, git, tomcat6 | #ami base must have yum install lighttpd-fastcgi, git, tomcat6 |
#php-cli php-gd tomcat6-webapps tomcat6-admin-webapps svn maven2 | #php-cli php-gd tomcat6-webapps tomcat6-admin-webapps svn maven2 |
#postgres postgres-server php-pg | #postgres postgres-server php-pg |
#http://www.how2forge.org/installing-lighttpd-with-php5-and-mysql-support-on-fedora-12 | #http://www.how2forge.org/installing-lighttpd-with-php5-and-mysql-support-on-fedora-12 |
cp /root/aws.php /tmp/ | cp /root/aws.php /tmp/ |
mkdir /var/www/lib/staticmaplite/cache | mkdir /var/www/lib/staticmaplite/cache |
chcon -h system_u:object_r:httpd_sys_content_t /var/www | chcon -h system_u:object_r:httpd_sys_content_t /var/www |
chcon -R -h root:object_r:httpd_sys_content_t /var/www/* | chcon -R -h root:object_r:httpd_sys_content_t /var/www/* |
chcon -R -t httpd_sys_content_rw_t /var/www/lib/staticmaplite/cache | chcon -R -t httpd_sys_content_rw_t /var/www/lib/staticmaplite/cache |
chmod -R 777 /var/www/lib/staticmaplite/cache | chmod -R 777 /var/www/lib/staticmaplite/cache |
chcon -R -t httpd_sys_content_rw_t /var/www/labs/tiles | chcon -R -t httpd_sys_content_rw_t /var/www/labs/tiles |
chmod -R 777 /var/www/labs/tiles | chmod -R 777 /var/www/labs/tiles |
wget http://s3-ap-southeast-1.amazonaws.com/busresources/cbrfeed.zip \ | wget http://s3-ap-southeast-1.amazonaws.com/busresources/cbrfeed.zip \ |
-O /var/www/cbrfeed.zip | -O /var/www/cbrfeed.zip |
createdb transitdata | createdb transitdata |
createlang -d transitdata plpgsql | createlang -d transitdata plpgsql |
psql -d transitdata -f /var/www/lib/postgis.sql | psql -d transitdata -f /var/www/lib/postgis.sql |
# curl https://github.com/maxious/ACTBus-ui/raw/master/transitdata.cbrfeed.sql.gz -o transitdata.cbrfeed.sql.gz | # curl https://github.com/maxious/ACTBus-ui/raw/master/transitdata.cbrfeed.sql.gz -o transitdata.cbrfeed.sql.gz |
#made with pg_dump transitdata | gzip -c > transitdata.cbrfeed.sql.gz | #made with pg_dump transitdata | gzip -c > transitdata.cbrfeed.sql.gz |
gunzip /var/www/transitdata.cbrfeed.sql.gz | gunzip /var/www/transitdata.cbrfeed.sql.gz |
psql -d transitdata -f /var/www/transitdata.cbrfeed.sql | psql -d transitdata -f /var/www/transitdata.cbrfeed.sql |
#createuser transitdata -SDRP | #createuser transitdata -SDRP |
#password transitdata | #password transitdata |
#psql -d transitdata -c \"GRANT SELECT ON TABLE agency,calendar,calendar_dates,routes,stop_times,stops,trips TO transitdata;\" | #psql -d transitdata -c \"GRANT SELECT ON TABLE agency,calendar,calendar_dates,routes,stop_times,stops,trips TO transitdata;\" |
#psql -d transitdata -c "GRANT SELECT,INSERT ON TABLE myway_observations,myway_routes,myway_stops,myway_timingdeltas TO transitdata;" | |
#psql -d transitdata -c "GRANT SELECT,INSERT,UPDATE ON TABLE myway_routes,myway_stops TO transitdata;" | |
##psql -d transitdata -c "GRANT SELECT ON ALL TABLES IN SCHEMA public TO transitdata;" | |
php /var/www/updatedb.php | php /var/www/updatedb.php |
wget http://s3-ap-southeast-1.amazonaws.com/busresources/Graph.obj \ | wget http://s3-ap-southeast-1.amazonaws.com/busresources/Graph.obj \ |
-O /tmp/Graph.obj | -O /tmp/Graph.obj |
rm -rfv /usr/share/tomcat6/webapps/opentripplanner* | rm -rfv /usr/share/tomcat6/webapps/opentripplanner* |
wget http://s3-ap-southeast-1.amazonaws.com/busresources/opentripplanner-webapp.war \ | wget http://s3-ap-southeast-1.amazonaws.com/busresources/opentripplanner-webapp.war \ |
-O /usr/share/tomcat6/webapps/opentripplanner-webapp.war | -O /usr/share/tomcat6/webapps/opentripplanner-webapp.war |
wget http://s3-ap-southeast-1.amazonaws.com/busresources/opentripplanner-api-webapp.war \ | wget http://s3-ap-southeast-1.amazonaws.com/busresources/opentripplanner-api-webapp.war \ |
-O /usr/share/tomcat6/webapps/opentripplanner-api-webapp.war | -O /usr/share/tomcat6/webapps/opentripplanner-api-webapp.war |
/etc/init.d/tomcat6 restart | /etc/init.d/tomcat6 restart |
/*! | |
* jQuery Mobile v1.0b1 | |
* http://jquerymobile.com/ | |
* | |
* Copyright 2010, jQuery Project | |
* Dual licensed under the MIT or GPL Version 2 licenses. | |
* http://jquery.org/license | |
*/ | |
/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. | |
* Note: Code is in draft form and is subject to change | |
*/ | |
/* A | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-bar-a { | |
border: 1px solid #2A2A2A; | |
background: #111111; | |
color: #ffffff; | |
font-weight: bold; | |
text-shadow: 0 -1px 1px #000000; | |
background-image: -moz-linear-gradient(top, | |
#3c3c3c, | |
#111111); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #3c3c3c), | |
color-stop(1, #111111)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#3c3c3c', EndColorStr='#111111')"; | |
} | |
.ui-bar-a, | |
.ui-bar-a input, | |
.ui-bar-a select, | |
.ui-bar-a textarea, | |
.ui-bar-a button { | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.ui-bar-a .ui-link-inherit { | |
color: #fff; | |
} | |
.ui-bar-a .ui-link { | |
color: #7cc4e7; | |
font-weight: bold; | |
} | |
.ui-body-a { | |
border: 1px solid #2A2A2A; | |
background: #222222; | |
color: #fff; | |
text-shadow: 0 1px 0 #000; | |
font-weight: normal; | |
background-image: -moz-linear-gradient(top, | |
#666666, | |
#222222); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #666666), | |
color-stop(1, #222222)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#666666', EndColorStr='#222222)')"; | |
} | |
.ui-body-a, | |
.ui-body-a input, | |
.ui-body-a select, | |
.ui-body-a textarea, | |
.ui-body-a button { | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.ui-body-a .ui-link-inherit { | |
color: #fff; | |
} | |
.ui-body-a .ui-link { | |
color: #2489CE; | |
font-weight: bold; | |
} | |
.ui-br { | |
border-bottom: rgb(130,130,130); | |
border-bottom: rgba(130,130,130,.3); | |
border-bottom-width: 1px; | |
border-bottom-style: solid; | |
} | |
.ui-btn-up-a { | |
border: 1px solid #222; | |
background: #333333; | |
font-weight: bold; | |
color: #fff; | |
text-shadow: 0 -1px 1px #000; | |
background-image: -moz-linear-gradient(top, | |
#555555, | |
#333333); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #555555), | |
color-stop(1, #333333)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#555555', EndColorStr='#333333')"; | |
} | |
.ui-btn-up-a a.ui-link-inherit { | |
color: #fff; | |
} | |
.ui-btn-hover-a { | |
border: 1px solid #000; | |
background: #444444; | |
font-weight: bold; | |
color: #fff; | |
text-shadow: 0 -1px 1px #000; | |
background-image: -moz-linear-gradient(top, | |
#666666, | |
#444444); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #666666), | |
color-stop(1, #444444)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#666666', EndColorStr='#444444')"; | |
} | |
.ui-btn-hover-a a.ui-link-inherit { | |
color: #fff; | |
} | |
.ui-btn-down-a { | |
border: 1px solid #000; | |
background: #3d3d3d; | |
font-weight: bold; | |
color: #fff; | |
text-shadow: 0 -1px 1px #000; | |
background-image: -moz-linear-gradient(top, | |
#333333, | |
#5a5a5a); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #333333), | |
color-stop(1, #5a5a5a)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#333333', EndColorStr='#5a5a5a')"; | |
} | |
.ui-btn-down-a a.ui-link-inherit { | |
color: #fff; | |
} | |
.ui-btn-up-a, | |
.ui-btn-hover-a, | |
.ui-btn-down-a { | |
font-family: Helvetica, Arial, sans-serif; | |
text-decoration: none; | |
} | |
/* B | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-bar-b { | |
border: 1px solid #456f9a; | |
background: #5e87b0; | |
color: #fff; | |
font-weight: bold; | |
text-shadow: 0 -1px 1px #254f7a; | |
background-image: -moz-linear-gradient(top, | |
#81a8ce, | |
#5e87b0); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #81a8ce), | |
color-stop(1, #5e87b0)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#81a8ce', EndColorStr='#5e87b0')"; | |
} | |
.ui-bar-b, | |
.ui-bar-b input, | |
.ui-bar-b select, | |
.ui-bar-b textarea, | |
.ui-bar-b button { | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.ui-bar-b .ui-link-inherit { | |
color: #fff; | |
} | |
.ui-bar-b .ui-link { | |
color: #7cc4e7; | |
font-weight: bold; | |
} | |
.ui-body-b { | |
border: 1px solid #C6C6C6; | |
background: #cccccc; | |
color: #333333; | |
text-shadow: 0 1px 0 #fff; | |
font-weight: normal; | |
background-image: -moz-linear-gradient(top, | |
#e6e6e6, | |
#cccccc); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #e6e6e6), | |
color-stop(1, #cccccc)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#e6e6e6', EndColorStr='#cccccc')"; | |
} | |
.ui-body-b, | |
.ui-body-b input, | |
.ui-body-b select, | |
.ui-body-b textarea, | |
.ui-body-b button { | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.ui-body-b .ui-link-inherit { | |
color: #333333; | |
} | |
.ui-body-b .ui-link { | |
color: #2489CE; | |
font-weight: bold; | |
} | |
.ui-btn-up-b { | |
border: 1px solid #145072; | |
background: #2567ab; | |
font-weight: bold; | |
color: #fff; | |
text-shadow: 0 -1px 1px #145072; | |
background-image: -moz-linear-gradient(top, | |
#4e89c5, | |
#2567ab); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #5f9cc5), | |
color-stop(1, #396b9e)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#4e89c5', EndColorStr='#2567ab')"; | |
} | |
.ui-btn-up-b a.ui-link-inherit { | |
color: #fff; | |
} | |
.ui-btn-hover-b { | |
border: 1px solid #00516e; | |
background: #4b88b6; | |
font-weight: bold; | |
color: #fff; | |
text-shadow: 0 -1px 1px #014D68; | |
background-image: -moz-linear-gradient(top, | |
#72b0d4, | |
#4b88b6); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #72b0d4), | |
color-stop(1, #4b88b6)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#72b0d4', EndColorStr='#4b88b6')"; | |
} | |
.ui-btn-hover-b a.ui-link-inherit { | |
color: #fff; | |
} | |
.ui-btn-down-b { | |
border: 1px solid #225377; | |
background: #4e89c5; | |
font-weight: bold; | |
color: #fff; | |
text-shadow: 0 -1px 1px #225377; | |
background-image: -moz-linear-gradient(top, | |
#396b9e, | |
#4e89c5); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #396b9e), | |
color-stop(1, #4e89c5)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#396b9e', EndColorStr='#4e89c5')"; | |
} | |
.ui-btn-down-b a.ui-link-inherit { | |
color: #fff; | |
} | |
.ui-btn-up-b, | |
.ui-btn-hover-b, | |
.ui-btn-down-b { | |
font-family: Helvetica, Arial, sans-serif; | |
text-decoration: none; | |
} | |
/* C | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-bar-c { | |
border: 1px solid #B3B3B3; | |
background: #e9eaeb; | |
color: #3E3E3E; | |
font-weight: bold; | |
text-shadow: 0 1px 1px #fff; | |
background-image: -moz-linear-gradient(top, | |
#f0f0f0, | |
#e9eaeb); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #f0f0f0), | |
color-stop(1, #e9eaeb)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#f0f0f0', EndColorStr='#e9eaeb')"; | |
} | |
.ui-bar-c, | |
.ui-bar-c input, | |
.ui-bar-c select, | |
.ui-bar-c textarea, | |
.ui-bar-c button { | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.ui-body-c { | |
border: 1px solid #B3B3B3; | |
color: #333333; | |
text-shadow: 0 1px 0 #fff; | |
background: #f0f0f0; | |
background-image: -moz-linear-gradient(top, | |
#eeeeee, | |
#dddddd); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #eeeeee), | |
color-stop(1, #dddddd)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#eeeeee', EndColorStr='#dddddd')"; | |
} | |
.ui-body-c, | |
.ui-body-c input, | |
.ui-body-c select, | |
.ui-body-c textarea, | |
.ui-body-c button { | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.ui-body-c .ui-link-inherit { | |
color: #333333; | |
} | |
.ui-body-c .ui-link { | |
color: #2489CE; | |
font-weight: bold; | |
} | |
.ui-btn-up-c { | |
border: 1px solid #ccc; | |
background: #eee; | |
font-weight: bold; | |
color: #444; | |
text-shadow: 0 1px 1px #f6f6f6; | |
background-image: -moz-linear-gradient(top, | |
#fefefe, | |
#eeeeee); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #fdfdfd), | |
color-stop(1, #eeeeee)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#fdfdfd', EndColorStr='#eeeeee')"; | |
} | |
.ui-btn-up-c a.ui-link-inherit { | |
color: #2F3E46; | |
} | |
.ui-btn-hover-c { | |
border: 1px solid #bbb; | |
background: #dadada; | |
font-weight: bold; | |
color: #101010; | |
text-shadow: 0 1px 1px #fff; | |
background-image: -moz-linear-gradient(top, | |
#ededed, | |
#dadada); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #ededed), | |
color-stop(1, #dadada)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#ededed', EndColorStr='#dadada')"; | |
} | |
.ui-btn-hover-c a.ui-link-inherit { | |
color: #2F3E46; | |
} | |
.ui-btn-down-c { | |
border: 1px solid #808080; | |
background: #fdfdfd; | |
font-weight: bold; | |
color: #111111; | |
text-shadow: 0 1px 1px #ffffff; | |
background-image: -moz-linear-gradient(top, | |
#eeeeee, | |
#fdfdfd); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #eeeeee), | |
color-stop(1, #fdfdfd)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#eeeeee', EndColorStr='#fdfdfd')"; | |
} | |
.ui-btn-down-c a.ui-link-inherit { | |
color: #2F3E46; | |
} | |
.ui-btn-up-c, | |
.ui-btn-hover-c, | |
.ui-btn-down-c { | |
font-family: Helvetica, Arial, sans-serif; | |
text-decoration: none; | |
} | |
/* D | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-bar-d { | |
border: 1px solid #ccc; | |
background: #bbb; | |
color: #333; | |
text-shadow: 0 1px 0 #eee; | |
background-image: -moz-linear-gradient(top, | |
#ddd, | |
#bbb); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #ddd), | |
color-stop(1, #bbb)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#dddddd', EndColorStr='#bbbbbb')"; | |
} | |
.ui-bar-d, | |
.ui-bar-d input, | |
.ui-bar-d select, | |
.ui-bar-d textarea, | |
.ui-bar-d button { | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.ui-bar-d .ui-link-inherit { | |
color: #333; | |
} | |
.ui-bar-d .ui-link { | |
color: #2489CE; | |
font-weight: bold; | |
} | |
.ui-body-d { | |
border: 1px solid #ccc; | |
color: #333333; | |
text-shadow: 0 1px 0 #fff; | |
background: #ffffff; | |
} | |
.ui-body-d, | |
.ui-body-d input, | |
.ui-body-d select, | |
.ui-body-d textarea, | |
.ui-body-d button { | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.ui-body-d .ui-link-inherit { | |
color: #333333; | |
} | |
.ui-body-d .ui-link { | |
color: #2489CE; | |
font-weight: bold; | |
} | |
.ui-btn-up-d { | |
border: 1px solid #ccc; | |
background: #fff; | |
font-weight: bold; | |
color: #444; | |
text-shadow: 0 1px 1px #fff; | |
} | |
.ui-btn-up-d a.ui-link-inherit { | |
color: #333; | |
} | |
.ui-btn-hover-d { | |
border: 1px solid #aaa; | |
background: #eeeeee; | |
font-weight: bold; | |
color: #222; | |
cursor: pointer; | |
text-shadow: 0 1px 1px #fff; | |
background-image: -moz-linear-gradient(top, | |
#fdfdfd, | |
#eeeeee); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #fdfdfd), | |
color-stop(1, #eeeeee)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#fdfdfd', EndColorStr='#eeeeee')"; | |
} | |
.ui-btn-hover-d a.ui-link-inherit { | |
color: #222; | |
} | |
.ui-btn-down-d { | |
border: 1px solid #aaaaaa; | |
background: #ffffff; | |
font-weight: bold; | |
color: #111; | |
text-shadow: 0 1px 1px #ffffff; | |
background-image: -moz-linear-gradient(top, | |
#eeeeee, | |
#ffffff); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #eeeeee), | |
color-stop(1, #ffffff)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#eeeeee', EndColorStr='#ffffff')"; | |
} | |
.ui-btn-down-d a.ui-link-inherit { | |
color: #111; | |
} | |
.ui-btn-up-d, | |
.ui-btn-hover-d, | |
.ui-btn-down-d { | |
font-family: Helvetica, Arial, sans-serif; | |
text-decoration: none; | |
} | |
/* E | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-bar-e { | |
border: 1px solid #F7C942; | |
background: #fadb4e; | |
color: #333; | |
text-shadow: 0 1px 0 #fff; | |
background-image: -moz-linear-gradient(top, | |
#fceda7, | |
#fadb4e); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #fceda7), | |
color-stop(1, #fadb4e)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#fceda7', EndColorStr='#fadb4e')"; | |
} | |
.ui-bar-e, | |
.ui-bar-e input, | |
.ui-bar-e select, | |
.ui-bar-e textarea, | |
.ui-bar-d button { | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.ui-bar-e .ui-link-inherit { | |
color: #333; | |
} | |
.ui-bar-e .ui-link { | |
color: #2489CE; | |
font-weight: bold; | |
} | |
.ui-body-e { | |
border: 1px solid #F7C942; | |
color: #333333; | |
text-shadow: 0 1px 0 #fff; | |
background: #faeb9e; | |
background-image: -moz-linear-gradient(top, | |
#fff, | |
#faeb9e); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #fff), | |
color-stop(1, #faeb9e)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffffff', EndColorStr='#faeb9e')"; | |
} | |
.ui-body-e, | |
.ui-body-e input, | |
.ui-body-e select, | |
.ui-body-e textarea, | |
.ui-body-e button { | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.ui-body-e .ui-link-inherit { | |
color: #333333; | |
} | |
.ui-body-e .ui-link { | |
color: #2489CE; | |
font-weight: bold; | |
} | |
.ui-btn-up-e { | |
border: 1px solid #F7C942; | |
background: #fadb4e; | |
font-weight: bold; | |
color: #333; | |
text-shadow: 0 1px 0 #fff; | |
background-image: -moz-linear-gradient(top, | |
#fceda7, | |
#fadb4e); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #fceda7), | |
color-stop(1, #fadb4e)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#fceda7', EndColorStr='#fadb4e')"; | |
} | |
.ui-btn-up-e a.ui-link-inherit { | |
color: #333; | |
} | |
.ui-btn-hover-e { | |
border: 1px solid #e79952; | |
background: #fbe26f; | |
font-weight: bold; | |
color: #111; | |
text-shadow: 0 1px 1px #fff; | |
background-image: -moz-linear-gradient(top, | |
#fcf0b5, | |
#fbe26f); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #fcf0b5), | |
color-stop(1, #fbe26f)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#fcf0b5', EndColorStr='#fbe26f')"; | |
} | |
.ui-btn-hover-e a.ui-link-inherit { | |
color: #333; | |
} | |
.ui-btn-down-e { | |
border: 1px solid #F7C942; | |
background: #fceda7; | |
font-weight: bold; | |
color: #111; | |
text-shadow: 0 1px 1px #ffffff; | |
background-image: -moz-linear-gradient(top, | |
#fadb4e, | |
#fceda7); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #fadb4e), | |
color-stop(1, #fceda7)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#fadb4e', EndColorStr='#fceda7')"; | |
} | |
.ui-btn-down-e a.ui-link-inherit { | |
color: #333; | |
} | |
.ui-btn-up-e, | |
.ui-btn-hover-e, | |
.ui-btn-down-e { | |
font-family: Helvetica, Arial, sans-serif; | |
text-decoration: none; | |
} | |
/* links within "buttons" | |
-----------------------------------------------------------------------------------------------------------*/ | |
a.ui-link-inherit { | |
text-decoration: none !important; | |
} | |
/* Active class used as the "on" state across all themes | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-btn-active { | |
border: 1px solid #155678; | |
background: #4596ce; | |
font-weight: bold; | |
color: #fff; | |
cursor: pointer; | |
text-shadow: 0 -1px 1px #145072; | |
text-decoration: none; | |
background-image: -moz-linear-gradient(top, | |
#85bae4, | |
#5393c5); | |
background-image: -webkit-gradient(linear,left top,left bottom, | |
color-stop(0, #85bae4), | |
color-stop(1, #5393c5)); | |
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#85bae4', EndColorStr='#5393c5')"; | |
outline: none; | |
} | |
.ui-btn-active a.ui-link-inherit { | |
color: #fff; | |
} | |
/* button inner top highlight | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-btn-inner { | |
border-top: 1px solid #fff; | |
border-color: rgba(255,255,255,.3); | |
} | |
/* corner rounding classes | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-corner-tl { | |
-moz-border-radius-topleft: .6em; | |
-webkit-border-top-left-radius: .6em; | |
border-top-left-radius: .6em; | |
} | |
.ui-corner-tr { | |
-moz-border-radius-topright: .6em; | |
-webkit-border-top-right-radius: .6em; | |
border-top-right-radius: .6em; | |
} | |
.ui-corner-bl { | |
-moz-border-radius-bottomleft: .6em; | |
-webkit-border-bottom-left-radius: .6em; | |
border-bottom-left-radius: .6em; | |
} | |
.ui-corner-br { | |
-moz-border-radius-bottomright: .6em; | |
-webkit-border-bottom-right-radius: .6em; | |
border-bottom-right-radius: .6em; | |
} | |
.ui-corner-top { | |
-moz-border-radius-topleft: .6em; | |
-webkit-border-top-left-radius: .6em; | |
border-top-left-radius: .6em; | |
-moz-border-radius-topright: .6em; | |
-webkit-border-top-right-radius: .6em; | |
border-top-right-radius: .6em; | |
} | |
.ui-corner-bottom { | |
-moz-border-radius-bottomleft: .6em; | |
-webkit-border-bottom-left-radius: .6em; | |
border-bottom-left-radius: .6em; | |
-moz-border-radius-bottomright: .6em; | |
-webkit-border-bottom-right-radius: .6em; | |
border-bottom-right-radius: .6em; | |
} | |
.ui-corner-right { | |
-moz-border-radius-topright: .6em; | |
-webkit-border-top-right-radius: .6em; | |
border-top-right-radius: .6em; | |
-moz-border-radius-bottomright: .6em; | |
-webkit-border-bottom-right-radius: .6em; | |
border-bottom-right-radius: .6em; | |
} | |
.ui-corner-left { | |
-moz-border-radius-topleft: .6em; | |
-webkit-border-top-left-radius: .6em; | |
border-top-left-radius: .6em; | |
-moz-border-radius-bottomleft: .6em; | |
-webkit-border-bottom-left-radius: .6em; | |
border-bottom-left-radius: .6em; | |
} | |
.ui-corner-all { | |
-moz-border-radius: .6em; | |
-webkit-border-radius: .6em; | |
border-radius: .6em; | |
} | |
/* Interaction cues | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-disabled { | |
opacity: .3; | |
} | |
.ui-disabled, | |
.ui-disabled a { | |
cursor: default; | |
} | |
/* Icons | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-icon { | |
background: #666; | |
background: rgba(0,0,0,.4); | |
background-image: url(images/icons-18-white.png); | |
background-repeat: no-repeat; | |
-moz-border-radius: 9px; | |
-webkit-border-radius: 9px; | |
border-radius: 9px; | |
} | |
/* Alt icon color | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-icon-alt { | |
background: #fff; | |
background: rgba(255,255,255,.3); | |
background-image: url(images/icons-18-black.png); | |
background-repeat: no-repeat; | |
} | |
/* HD/"retina" sprite | |
-----------------------------------------------------------------------------------------------------------*/ | |
@media only screen and (-webkit-min-device-pixel-ratio: 1.5), | |
only screen and (min--moz-device-pixel-ratio: 1.5), | |
only screen and (min-resolution: 240dpi) { | |
.ui-icon-plus, .ui-icon-minus, .ui-icon-delete, .ui-icon-arrow-r, | |
.ui-icon-arrow-l, .ui-icon-arrow-u, .ui-icon-arrow-d, .ui-icon-check, | |
.ui-icon-gear, .ui-icon-refresh, .ui-icon-forward, .ui-icon-back, | |
.ui-icon-grid, .ui-icon-star, .ui-icon-alert, .ui-icon-info, .ui-icon-home, .ui-icon-search, | |
.ui-icon-checkbox-off, .ui-icon-checkbox-on, .ui-icon-radio-off, .ui-icon-radio-on { | |
background-image: url(images/icons-36-white.png); | |
-moz-background-size: 776px 18px; | |
-o-background-size: 776px 18px; | |
-webkit-background-size: 776px 18px; | |
background-size: 776px 18px; | |
} | |
.ui-icon-alt { | |
background-image: url(images/icons-36-black.png); | |
} | |
} | |
/* plus minus */ | |
.ui-icon-plus { | |
background-position: -0 50%; | |
} | |
.ui-icon-minus { | |
background-position: -36px 50%; | |
} | |
/* delete/close */ | |
.ui-icon-delete { | |
background-position: -72px 50%; | |
} | |
/* arrows */ | |
.ui-icon-arrow-r { | |
background-position: -108px 50%; | |
} | |
.ui-icon-arrow-l { | |
background-position: -144px 50%; | |
} | |
.ui-icon-arrow-u { | |
background-position: -180px 50%; | |
} | |
.ui-icon-arrow-d { | |
background-position: -216px 50%; | |
} | |
/* misc */ | |
.ui-icon-check { | |
background-position: -252px 50%; | |
} | |
.ui-icon-gear { | |
background-position: -288px 50%; | |
} | |
.ui-icon-refresh { | |
background-position: -324px 50%; | |
} | |
.ui-icon-forward { | |
background-position: -360px 50%; | |
} | |
.ui-icon-back { | |
background-position: -396px 50%; | |
} | |
.ui-icon-grid { | |
background-position: -432px 50%; | |
} | |
.ui-icon-star { | |
background-position: -468px 50%; | |
} | |
.ui-icon-alert { | |
background-position: -504px 50%; | |
} | |
.ui-icon-info { | |
background-position: -540px 50%; | |
} | |
.ui-icon-home { | |
background-position: -576px 50%; | |
} | |
.ui-icon-search { | |
background-position: -612px 50%; | |
} | |
.ui-icon-checkbox-off { | |
background-position: -684px 50%; | |
} | |
.ui-icon-checkbox-on { | |
background-position: -648px 50%; | |
} | |
.ui-icon-radio-off { | |
background-position: -756px 50%; | |
} | |
.ui-icon-radio-on { | |
background-position: -720px 50%; | |
} | |
/* checks,radios */ | |
.ui-icon-checkbox-off, | |
.ui-icon-checkbox-on, | |
.ui-icon-radio-off, | |
.ui-icon-radio-on { | |
background-color: transparent; | |
-moz-border-radius: 0; | |
-webkit-border-radius: 0; | |
border-radius: 0; | |
} | |
.ui-icon-searchfield { | |
background-image: url(images/icon-search-black.png); | |
background-size: 16px 16px; | |
} | |
/* loading icon */ | |
.ui-icon-loading { | |
background-image: url(images/ajax-loader.png); | |
width: 40px; | |
height: 40px; | |
-moz-border-radius: 20px; | |
-webkit-border-radius: 20px; | |
border-radius: 20px; | |
background-size: 35px 35px; | |
} | |
/* Button corner classes | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-btn-corner-tl { | |
-moz-border-radius-topleft: 1em; | |
-webkit-border-top-left-radius: 1em; | |
border-top-left-radius: 1em; | |
} | |
.ui-btn-corner-tr { | |
-moz-border-radius-topright: 1em; | |
-webkit-border-top-right-radius: 1em; | |
border-top-right-radius: 1em; | |
} | |
.ui-btn-corner-bl { | |
-moz-border-radius-bottomleft: 1em; | |
-webkit-border-bottom-left-radius: 1em; | |
border-bottom-left-radius: 1em; | |
} | |
.ui-btn-corner-br { | |
-moz-border-radius-bottomright: 1em; | |
-webkit-border-bottom-right-radius: 1em; | |
border-bottom-right-radius: 1em; | |
} | |
.ui-btn-corner-top { | |
-moz-border-radius-topleft: 1em; | |
-webkit-border-top-left-radius: 1em; | |
border-top-left-radius: 1em; | |
-moz-border-radius-topright: 1em; | |
-webkit-border-top-right-radius: 1em; | |
border-top-right-radius: 1em; | |
} | |
.ui-btn-corner-bottom { | |
-moz-border-radius-bottomleft: 1em; | |
-webkit-border-bottom-left-radius: 1em; | |
border-bottom-left-radius: 1em; | |
-moz-border-radius-bottomright: 1em; | |
-webkit-border-bottom-right-radius: 1em; | |
border-bottom-right-radius: 1em; | |
} | |
.ui-btn-corner-right { | |
-moz-border-radius-topright: 1em; | |
-webkit-border-top-right-radius: 1em; | |
border-top-right-radius: 1em; | |
-moz-border-radius-bottomright: 1em; | |
-webkit-border-bottom-right-radius: 1em; | |
border-bottom-right-radius: 1em; | |
} | |
.ui-btn-corner-left { | |
-moz-border-radius-topleft: 1em; | |
-webkit-border-top-left-radius: 1em; | |
border-top-left-radius: 1em; | |
-moz-border-radius-bottomleft: 1em; | |
-webkit-border-bottom-left-radius: 1em; | |
border-bottom-left-radius: 1em; | |
} | |
.ui-btn-corner-all { | |
-moz-border-radius: 1em; | |
-webkit-border-radius: 1em; | |
border-radius: 1em; | |
} | |
/* radius clip workaround for cleaning up corner trapping */ | |
.ui-corner-tl, | |
.ui-corner-tr, | |
.ui-corner-bl, | |
.ui-corner-br, | |
.ui-corner-top, | |
.ui-corner-bottom, | |
.ui-corner-right, | |
.ui-corner-left, | |
.ui-corner-all, | |
.ui-btn-corner-tl, | |
.ui-btn-corner-tr, | |
.ui-btn-corner-bl, | |
.ui-btn-corner-br, | |
.ui-btn-corner-top, | |
.ui-btn-corner-bottom, | |
.ui-btn-corner-right, | |
.ui-btn-corner-left, | |
.ui-btn-corner-all { | |
-webkit-background-clip: padding-box; | |
-moz-background-clip: padding-box; | |
background-clip: padding-box; | |
} | |
/* Overlay / modal | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-overlay { | |
background: #666; | |
opacity: .5; | |
filter: Alpha(Opacity=50); | |
position: absolute; | |
width: 100%; | |
height: 100%; | |
} | |
.ui-overlay-shadow { | |
-moz-box-shadow: 0px 0px 12px rgba(0,0,0,.6); | |
-webkit-box-shadow: 0px 0px 12px rgba(0,0,0,.6); | |
box-shadow: 0px 0px 12px rgba(0,0,0,.6); | |
} | |
.ui-shadow { | |
-moz-box-shadow: 0px 1px 4px rgba(0,0,0,.3); | |
-webkit-box-shadow: 0px 1px 4px rgba(0,0,0,.3); | |
box-shadow: 0px 1px 4px rgba(0,0,0,.3); | |
} | |
.ui-bar-a .ui-shadow, | |
.ui-bar-b .ui-shadow , | |
.ui-bar-c .ui-shadow { | |
-moz-box-shadow: 0px 1px 0 rgba(255,255,255,.3); | |
-webkit-box-shadow: 0px 1px 0 rgba(255,255,255,.3); | |
box-shadow: 0px 1px 0 rgba(255,255,255,.3); | |
} | |
.ui-shadow-inset { | |
-moz-box-shadow: inset 0px 1px 4px rgba(0,0,0,.2); | |
-webkit-box-shadow: inset 0px 1px 4px rgba(0,0,0,.2); | |
box-shadow: inset 0px 1px 4px rgba(0,0,0,.2); | |
} | |
.ui-icon-shadow { | |
-moz-box-shadow: 0px 1px 0 rgba(255,255,255,.4); | |
-webkit-box-shadow: 0px 1px 0 rgba(255,255,255,.4); | |
box-shadow: 0px 1px 0 rgba(255,255,255,.4); | |
} | |
/* Focus state - set here for specificity | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-focus { | |
-moz-box-shadow: 0px 0px 12px #387bbe; | |
-webkit-box-shadow: 0px 0px 12px #387bbe; | |
box-shadow: 0px 0px 12px #387bbe; | |
} | |
/* unset box shadow in browsers that don't do it right | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-mobile-nosupport-boxshadow * { | |
-moz-box-shadow: none !important; | |
-webkit-box-shadow: none !important; | |
box-shadow: none !important; | |
} | |
/* ...and bring back focus */ | |
.ui-mobile-nosupport-boxshadow .ui-focus { | |
outline-width: 2px; | |
}/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. | |
* Note: Code is in draft form and is subject to change | |
*/ | |
/* some unsets - more probably needed */ | |
.ui-mobile, .ui-mobile body { height: 100%; } | |
.ui-mobile fieldset, .ui-page { padding: 0; margin: 0; } | |
.ui-mobile a img, .ui-mobile fieldset { border: 0; } | |
/* responsive page widths */ | |
.ui-mobile-viewport { margin: 0; overflow-x: hidden; -webkit-text-size-adjust: none; -ms-text-size-adjust:none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } | |
/* "page" containers - full-screen views, one should always be in view post-pageload */ | |
.ui-mobile [data-role=page], .ui-mobile [data-role=dialog], .ui-page { top: 0; left: 0; width: 100%; min-height: 100%; position: absolute; display: none; border: 0; } | |
.ui-mobile .ui-page-active { display: block; overflow: visible; } | |
/*orientations from js are available */ | |
.portrait, | |
.portrait .ui-page { min-height: 420px; } | |
.landscape, | |
.landscape .ui-page { min-height: 300px; } | |
/* loading screen */ | |
.ui-loading .ui-mobile-viewport { overflow: hidden !important; } | |
.ui-loading .ui-loader { display: block; } | |
.ui-loading .ui-page { overflow: hidden; } | |
.ui-loader { display: none; position: absolute; opacity: .85; z-index: 100; left: 50%; width: 200px; margin-left: -130px; margin-top: -35px; padding: 10px 30px; } | |
.ui-loader h1 { font-size: 15px; text-align: center; } | |
.ui-loader .ui-icon { position: static; display: block; opacity: .9; margin: 0 auto; width: 35px; height: 35px; background-color: transparent; } | |
/*fouc*/ | |
.ui-mobile-rendering > * { visibility: hidden; } | |
/*headers, content panels*/ | |
.ui-bar, .ui-body { position: relative; padding: .4em 15px; overflow: hidden; display: block; clear:both; } | |
.ui-bar { font-size: 16px; margin: 0; } | |
.ui-bar h1, .ui-bar h2, .ui-bar h3, .ui-bar h4, .ui-bar h5, .ui-bar h6 { margin: 0; padding: 0; font-size: 16px; display: inline-block; } | |
.ui-header, .ui-footer { display: block; } | |
.ui-page .ui-header, .ui-page .ui-footer { position: relative; } | |
.ui-header .ui-btn-left { position: absolute; left: 10px; top: .4em; } | |
.ui-header .ui-btn-right { position: absolute; right: 10px; top: .4em; } | |
.ui-header .ui-title, .ui-footer .ui-title { min-height: 1.1em; text-align: center; font-size: 16px; display: block; margin: .6em 90px .8em; padding: 0; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; outline: 0 !important; } | |
/*content area*/ | |
.ui-content { border-width: 0; overflow: visible; overflow-x: hidden; padding: 15px; } | |
.ui-page-fullscreen .ui-content { padding:0; } | |
/* icons sizing */ | |
.ui-icon { width: 18px; height: 18px; } | |
/* fullscreen class on ui-content div */ | |
.ui-fullscreen { } | |
.ui-fullscreen img { max-width: 100%; } | |
/* non-js content hiding */ | |
.ui-nojs { position: absolute; left: -9999px; } | |
/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
.spin { | |
-webkit-transform: rotate(360deg); | |
-webkit-animation-name: spin; | |
-webkit-animation-duration: 1s; | |
-webkit-animation-iteration-count: infinite; | |
} | |
@-webkit-keyframes spin { | |
from {-webkit-transform: rotate(0deg);} | |
to {-webkit-transform: rotate(360deg);} | |
} | |
/* Transitions from jQtouch (with small modifications): http://www.jqtouch.com/ | |
Built by David Kaneda and maintained by Jonathan Stark. | |
*/ | |
.in, .out { | |
-webkit-animation-timing-function: ease-in-out; | |
-webkit-animation-duration: 350ms; | |
} | |
.slide.in { | |
-webkit-transform: translateX(0); | |
-webkit-animation-name: slideinfromright; | |
} | |
.slide.out { | |
-webkit-transform: translateX(-100%); | |
-webkit-animation-name: slideouttoleft; | |
} | |
.slide.in.reverse { | |
-webkit-transform: translateX(0); | |
-webkit-animation-name: slideinfromleft; | |
} | |
.slide.out.reverse { | |
-webkit-transform: translateX(100%); | |
-webkit-animation-name: slideouttoright; | |
} | |
.slideup.in { | |
-webkit-transform: translateY(0); | |
-webkit-animation-name: slideinfrombottom; | |
z-index: 10; | |
} | |
.slideup.out { | |
-webkit-animation-name: dontmove; | |
z-index: 0; | |
} | |
.slideup.out.reverse { | |
-webkit-transform: translateY(100%); | |
z-index: 10; | |
-webkit-animation-name: slideouttobottom; | |
} | |
.slideup.in.reverse { | |
z-index: 0; | |
-webkit-animation-name: dontmove; | |
} | |
.slidedown.in { | |
-webkit-transform: translateY(0); | |
-webkit-animation-name: slideinfromtop; | |
z-index: 10; | |
} | |
.slidedown.out { | |
-webkit-animation-name: dontmove; | |
z-index: 0; | |
} | |
.slidedown.out.reverse { | |
-webkit-transform: translateY(-100%); | |
z-index: 10; | |
-webkit-animation-name: slideouttotop; | |
} | |
.slidedown.in.reverse { | |
z-index: 0; | |
-webkit-animation-name: dontmove; | |
} | |
@-webkit-keyframes slideinfromright { | |
from { -webkit-transform: translateX(100%); } | |
to { -webkit-transform: translateX(0); } | |
} | |
@-webkit-keyframes slideinfromleft { | |
from { -webkit-transform: translateX(-100%); } | |
to { -webkit-transform: translateX(0); } | |
} | |
@-webkit-keyframes slideouttoleft { | |
from { -webkit-transform: translateX(0); } | |
to { -webkit-transform: translateX(-100%); } | |
} | |
@-webkit-keyframes slideouttoright { | |
from { -webkit-transform: translateX(0); } | |
to { -webkit-transform: translateX(100%); } | |
} | |
@-webkit-keyframes slideinfromtop { | |
from { -webkit-transform: translateY(-100%); } | |
to { -webkit-transform: translateY(0); } | |
} | |
@-webkit-keyframes slideinfrombottom { | |
from { -webkit-transform: translateY(100%); } | |
to { -webkit-transform: translateY(0); } | |
} | |
@-webkit-keyframes slideouttobottom { | |
from { -webkit-transform: translateY(0); } | |
to { -webkit-transform: translateY(100%); } | |
} | |
@-webkit-keyframes slideouttotop { | |
from { -webkit-transform: translateY(0); } | |
to { -webkit-transform: translateY(-100%); } | |
} | |
@-webkit-keyframes fadein { | |
from { opacity: 0; } | |
to { opacity: 1; } | |
} | |
@-webkit-keyframes fadeout { | |
from { opacity: 1; } | |
to { opacity: 0; } | |
} | |
.fade.in { | |
opacity: 1; | |
z-index: 10; | |
-webkit-animation-name: fadein; | |
} | |
.fade.out { | |
z-index: 0; | |
-webkit-animation-name: fadeout; | |
} | |
/* The properties in this rule are only necessary for the 'flip' transition. | |
* We need specify the perspective to create a projection matrix. This will add | |
* some depth as the element flips. The depth number represents the distance of | |
* the viewer from the z-plane. According to the CSS3 spec, 1000 is a moderate | |
* value. | |
*/ | |
.viewport-flip { | |
-webkit-perspective: 1000; | |
position: absolute; | |
} | |
.ui-mobile-viewport-transitioning, | |
.ui-mobile-viewport-transitioning .ui-page { | |
width: 100%; | |
height: 100%; | |
overflow: hidden; | |
} | |
.flip { | |
-webkit-animation-duration: .65s; | |
-webkit-backface-visibility:hidden; | |
-webkit-transform:translateX(0); /* Needed to work around an iOS 3.1 bug that causes listview thumbs to disappear when -webkit-visibility:hidden is used. */ | |
} | |
.flip.in { | |
-webkit-transform: rotateY(0) scale(1); | |
-webkit-animation-name: flipinfromleft; | |
} | |
.flip.out { | |
-webkit-transform: rotateY(-180deg) scale(.8); | |
-webkit-animation-name: flipouttoleft; | |
} | |
/* Shake it all about */ | |
.flip.in.reverse { | |
-webkit-transform: rotateY(0) scale(1); | |
-webkit-animation-name: flipinfromright; | |
} | |
.flip.out.reverse { | |
-webkit-transform: rotateY(180deg) scale(.8); | |
-webkit-animation-name: flipouttoright; | |
} | |
@-webkit-keyframes flipinfromright { | |
from { -webkit-transform: rotateY(-180deg) scale(.8); } | |
to { -webkit-transform: rotateY(0) scale(1); } | |
} | |
@-webkit-keyframes flipinfromleft { | |
from { -webkit-transform: rotateY(180deg) scale(.8); } | |
to { -webkit-transform: rotateY(0) scale(1); } | |
} | |
@-webkit-keyframes flipouttoleft { | |
from { -webkit-transform: rotateY(0) scale(1); } | |
to { -webkit-transform: rotateY(-180deg) scale(.8); } | |
} | |
@-webkit-keyframes flipouttoright { | |
from { -webkit-transform: rotateY(0) scale(1); } | |
to { -webkit-transform: rotateY(180deg) scale(.8); } | |
} | |
/* Hackish, but reliable. */ | |
@-webkit-keyframes dontmove { | |
from { opacity: 1; } | |
to { opacity: 1; } | |
} | |
.pop { | |
-webkit-transform-origin: 50% 50%; | |
} | |
.pop.in { | |
-webkit-transform: scale(1); | |
opacity: 1; | |
-webkit-animation-name: popin; | |
z-index: 10; | |
} | |
.pop.out.reverse { | |
-webkit-transform: scale(.2); | |
opacity: 0; | |
-webkit-animation-name: popout; | |
z-index: 10; | |
} | |
.pop.in.reverse { | |
z-index: 0; | |
-webkit-animation-name: dontmove; | |
} | |
@-webkit-keyframes popin { | |
from { | |
-webkit-transform: scale(.2); | |
opacity: 0; | |
} | |
to { | |
-webkit-transform: scale(1); | |
opacity: 1; | |
} | |
} | |
@-webkit-keyframes popout { | |
from { | |
-webkit-transform: scale(1); | |
opacity: 1; | |
} | |
to { | |
-webkit-transform: scale(.2); | |
opacity: 0; | |
} | |
}/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
/* content configurations. */ | |
.ui-grid-a, .ui-grid-b, .ui-grid-c, .ui-grid-d { overflow: hidden; } | |
.ui-block-a, .ui-block-b, .ui-block-c, .ui-block-d, .ui-block-e { margin: 0; padding: 0; border: 0; float: left; min-height:1px;} | |
/* grid solo: 100 - single item fallback */ | |
.ui-grid-solo .ui-block-a { width: 100%; float: none; } | |
/* grid a: 50/50 */ | |
.ui-grid-a .ui-block-a, .ui-grid-a .ui-block-b { width: 50%; } | |
.ui-grid-a .ui-block-a { clear: left; } | |
/* grid b: 33/33/33 */ | |
.ui-grid-b .ui-block-a, .ui-grid-b .ui-block-b, .ui-grid-b .ui-block-c { width: 33.333%; } | |
.ui-grid-b .ui-block-a { clear: left; } | |
/* grid c: 25/25/25/25 */ | |
.ui-grid-c .ui-block-a, .ui-grid-c .ui-block-b, .ui-grid-c .ui-block-c, .ui-grid-c .ui-block-d { width: 25%; } | |
.ui-grid-c .ui-block-a { clear: left; } | |
/* grid d: 20/20/20/20/20 */ | |
.ui-grid-d .ui-block-a, .ui-grid-d .ui-block-b, .ui-grid-d .ui-block-c, .ui-grid-d .ui-block-d, .ui-grid-d .ui-block-e { width: 20%; } | |
.ui-grid-d .ui-block-a { clear: left; } | |
/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
/* fixed page header & footer configuration */ | |
.ui-header, .ui-footer, .ui-page-fullscreen .ui-header, .ui-page-fullscreen .ui-footer { position: absolute; overflow: hidden; width: 100%; border-left-width: 0; border-right-width: 0; } | |
.ui-header-fixed, .ui-footer-fixed { | |
z-index: 1000; | |
-webkit-transform: translateZ(0); /* Force header/footer rendering to go through the same rendering pipeline as native page scrolling. */ | |
} | |
.ui-footer-duplicate, .ui-page-fullscreen .ui-fixed-inline { display: none; } | |
.ui-page-fullscreen .ui-header, .ui-page-fullscreen .ui-footer { opacity: .9; } | |
/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
.ui-navbar { overflow: hidden; } | |
.ui-navbar ul, .ui-navbar-expanded ul { list-style:none; padding: 0; margin: 0; position: relative; display: block; border: 0;} | |
.ui-navbar-collapsed ul { float: left; width: 75%; margin-right: -2px; } | |
.ui-navbar-collapsed .ui-navbar-toggle { float: left; width: 25%; } | |
.ui-navbar li.ui-navbar-truncate { position: absolute; left: -9999px; top: -9999px; } | |
.ui-navbar li .ui-btn, .ui-navbar .ui-navbar-toggle .ui-btn { display: block; font-size: 12px; text-align: center; margin: 0; border-right-width: 0; } | |
.ui-navbar li .ui-btn { margin-right: -1px; } | |
.ui-navbar li .ui-btn:last-child { margin-right: 0; } | |
.ui-header .ui-navbar li .ui-btn, .ui-header .ui-navbar .ui-navbar-toggle .ui-btn, | |
.ui-footer .ui-navbar li .ui-btn, .ui-footer .ui-navbar .ui-navbar-toggle .ui-btn { border-top-width: 0; border-bottom-width: 0; } | |
.ui-navbar .ui-btn-inner { padding-left: 2px; padding-right: 2px; } | |
.ui-navbar-noicons li .ui-btn .ui-btn-inner, .ui-navbar-noicons .ui-navbar-toggle .ui-btn-inner { padding-top: .8em; padding-bottom: .9em; } | |
/*expanded page styles*/ | |
.ui-navbar-expanded .ui-btn { margin: 0; font-size: 14px; } | |
.ui-navbar-expanded .ui-btn-inner { padding-left: 5px; padding-right: 5px; } | |
.ui-navbar-expanded .ui-btn-icon-top .ui-btn-inner { padding: 45px 5px 15px; text-align: center; } | |
.ui-navbar-expanded .ui-btn-icon-top .ui-icon { top: 15px; } | |
.ui-navbar-expanded .ui-btn-icon-bottom .ui-btn-inner { padding: 15px 5px 45px; text-align: center; } | |
.ui-navbar-expanded .ui-btn-icon-bottom .ui-icon { bottom: 15px; } | |
.ui-navbar-expanded li .ui-btn .ui-btn-inner { min-height: 2.5em; } | |
.ui-navbar-expanded .ui-navbar-noicons .ui-btn .ui-btn-inner { padding-top: 1.8em; padding-bottom: 1.9em; } | |
/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
.ui-btn { display: block; text-align: center; cursor:pointer; position: relative; margin: .5em 5px; padding: 0; } | |
.ui-btn:focus, .ui-btn:active { outline: none; } | |
.ui-header .ui-btn, .ui-footer .ui-btn, .ui-bar .ui-btn { display: inline-block; font-size: 13px; margin: 0; } | |
.ui-btn-inline { display: inline-block; } | |
.ui-btn-inner { padding: .6em 25px; display: block; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; position: relative; } | |
.ui-header .ui-btn-inner, .ui-footer .ui-btn-inner, .ui-bar .ui-btn-inner { padding: .4em 8px .5em; } | |
.ui-btn-icon-notext { display: inline-block; width: 20px; height: 20px; padding: 2px 1px 2px 3px; text-indent: -9999px; } | |
.ui-btn-icon-notext .ui-btn-inner { padding: 0; } | |
.ui-btn-icon-notext .ui-btn-text { position: absolute; left: -999px; } | |
.ui-btn-icon-left .ui-btn-inner { padding-left: 33px; } | |
.ui-header .ui-btn-icon-left .ui-btn-inner, | |
.ui-footer .ui-btn-icon-left .ui-btn-inner, | |
.ui-bar .ui-btn-icon-left .ui-btn-inner { padding-left: 27px; } | |
.ui-btn-icon-right .ui-btn-inner { padding-right: 33px; } | |
.ui-header .ui-btn-icon-right .ui-btn-inner, | |
.ui-footer .ui-btn-icon-right .ui-btn-inner, | |
.ui-bar .ui-btn-icon-right .ui-btn-inner { padding-right: 27px; } | |
.ui-btn-icon-top .ui-btn-inner { padding-top: 33px; } | |
.ui-header .ui-btn-icon-top .ui-btn-inner, | |
.ui-footer .ui-btn-icon-top .ui-btn-inner, | |
.ui-bar .ui-btn-icon-top .ui-btn-inner { padding-top: 27px; } | |
.ui-btn-icon-bottom .ui-btn-inner { padding-bottom: 33px; } | |
.ui-header .ui-btn-icon-bottom .ui-btn-inner, | |
.ui-footer .ui-btn-icon-bottom .ui-btn-inner, | |
.ui-bar .ui-btn-icon-bottom .ui-btn-inner { padding-bottom: 27px; } | |
/*btn icon positioning*/ | |
.ui-btn-icon-notext .ui-icon { display: block; } | |
.ui-btn-icon-left .ui-icon, .ui-btn-icon-right .ui-icon { position: absolute; top: 50%; margin-top: -9px; } | |
.ui-btn-icon-top .ui-icon, .ui-btn-icon-bottom .ui-icon { position: absolute; left: 50%; margin-left: -9px; } | |
.ui-btn-icon-left .ui-icon { left: 10px; } | |
.ui-btn-icon-right .ui-icon {right: 10px; } | |
.ui-header .ui-btn-icon-left .ui-icon, | |
.ui-footer .ui-btn-icon-left .ui-icon, | |
.ui-bar .ui-btn-icon-left .ui-icon { left: 4px; } | |
.ui-header .ui-btn-icon-right .ui-icon, | |
.ui-footer .ui-btn-icon-right .ui-icon, | |
.ui-bar .ui-btn-icon-right .ui-icon { right: 4px; } | |
.ui-header .ui-btn-icon-top .ui-icon, | |
.ui-footer .ui-btn-icon-top .ui-icon, | |
.ui-bar .ui-btn-icon-top .ui-icon { top: 4px; } | |
.ui-header .ui-btn-icon-bottom .ui-icon, | |
.ui-footer .ui-btn-icon-bottom .ui-icon, | |
.ui-bar .ui-btn-icon-bottom .ui-icon { bottom: 4px; } | |
.ui-btn-icon-top .ui-icon { top: 5px; } | |
.ui-btn-icon-bottom .ui-icon { bottom: 5px; } | |
/*hiding native button,inputs */ | |
.ui-btn-hidden { position: absolute; top: 0; left: 0; width: 100%; height: 100%; -webkit-appearance: button; opacity: 0; cursor: pointer; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter: alpha(opacity=0); background: transparent; } | |
/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
.ui-collapsible-contain { margin: .5em 0; } | |
.ui-collapsible-heading { font-size: 16px; display: block; margin: 0 -8px; padding: 0; border-width: 0 0 1px 0; position: relative; } | |
.ui-collapsible-heading a { text-align: left; margin: 0; } | |
.ui-collapsible-heading a .ui-btn-inner { padding-left: 40px; } | |
.ui-collapsible-heading a span.ui-btn { position: absolute; left: 6px; top: 50%; margin: -12px 0 0 0; width: 20px; height: 20px; padding: 1px 0px 1px 2px; text-indent: -9999px; } | |
.ui-collapsible-heading a span.ui-btn .ui-btn-inner { padding: 10px 0; } | |
.ui-collapsible-heading a span.ui-btn .ui-icon { left: 0; margin-top: -10px; } | |
.ui-collapsible-heading-status { position:absolute; left:-9999px; } | |
.ui-collapsible-content { display: block; padding: 10px 0 10px 8px; } | |
.ui-collapsible-content-collapsed { display: none; } | |
.ui-collapsible-set { margin: .5em 0; } | |
.ui-collapsible-set .ui-collapsible-contain { margin: -1px 0 0; } | |
/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
.ui-controlgroup, fieldset.ui-controlgroup { padding: 0; margin: .5em 0 1em; } | |
.ui-bar .ui-controlgroup { margin: 0 .3em; } | |
.ui-controlgroup-label { font-size: 16px; line-height: 1.4; font-weight: normal; margin: 0 0 .3em; } | |
.ui-controlgroup-controls { display: block; width: 95%;} | |
.ui-controlgroup li { list-style: none; } | |
.ui-controlgroup-vertical .ui-btn, | |
.ui-controlgroup-vertical .ui-checkbox, .ui-controlgroup-vertical .ui-radio { margin: 0; border-bottom-width: 0; } | |
.ui-controlgroup-vertical .ui-controlgroup-last { border-bottom-width: 1px; } | |
.ui-controlgroup-horizontal { padding: 0; } | |
.ui-controlgroup-horizontal .ui-btn, | |
.ui-controlgroup-horizontal .ui-checkbox, .ui-controlgroup-horizontal .ui-radio { display: inline-block; margin: 0 -5px 0 0; } | |
.ui-controlgroup-horizontal .ui-checkbox, .ui-controlgroup-horizontal .ui-radio { display: inline; } | |
.ui-controlgroup-horizontal .ui-checkbox .ui-btn, .ui-controlgroup-horizontal .ui-radio .ui-btn, | |
.ui-controlgroup-horizontal .ui-checkbox:last-child, .ui-controlgroup-horizontal .ui-radio:last-child { margin-right: 0; } | |
.ui-controlgroup-horizontal .ui-controlgroup-last { margin-right: 0; } | |
.ui-controlgroup .ui-checkbox label, .ui-controlgroup .ui-radio label { font-size: 16px; } | |
/* conflicts with listview.. | |
.ui-controlgroup .ui-btn-icon-notext { width: 30px; height: 30px; text-indent: -9999px; } | |
.ui-controlgroup .ui-btn-icon-notext .ui-btn-inner { padding: 5px 6px 5px 5px; } | |
*/ | |
@media all and (min-width: 450px){ | |
.ui-controlgroup-label { vertical-align: top; display: inline-block; width: 20%; margin: 0 2% 0 0; } | |
.ui-controlgroup-controls { width: 60%; display: inline-block; } | |
} /* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
.ui-dialog { min-height: 480px; } | |
.ui-dialog .ui-header, .ui-dialog .ui-content, .ui-dialog .ui-footer { margin: 15px; position: relative; } | |
.ui-dialog .ui-header, .ui-dialog .ui-footer { z-index: 10; width: auto; } | |
.ui-dialog .ui-content, .ui-dialog .ui-footer { margin-top: -15px; }/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
.ui-checkbox, .ui-radio { position:relative; margin: .2em 0 .5em; z-index: 1; } | |
.ui-checkbox .ui-btn, .ui-radio .ui-btn { margin: 0; text-align: left; z-index: 2; } | |
.ui-checkbox .ui-btn-inner, .ui-radio .ui-btn-inner { white-space: normal; } | |
.ui-checkbox .ui-btn-icon-left .ui-btn-inner,.ui-radio .ui-btn-icon-left .ui-btn-inner { padding-left: 45px; } | |
.ui-checkbox .ui-btn-icon-right .ui-btn-inner, .ui-radio .ui-btn-icon-right .ui-btn-inner { padding-right: 45px; } | |
.ui-checkbox .ui-icon, .ui-radio .ui-icon { top: 1.1em; } | |
.ui-checkbox .ui-btn-icon-left .ui-icon, .ui-radio .ui-btn-icon-left .ui-icon {left: 15px; } | |
.ui-checkbox .ui-btn-icon-right .ui-icon, .ui-radio .ui-btn-icon-right .ui-icon {right: 15px; } | |
/* input, label positioning */ | |
.ui-checkbox input,.ui-radio input { position:absolute; left:20px; top:50%; width: 10px; height: 10px; margin:-5px 0 0 0; outline: 0 !important; z-index: 1; }/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
.ui-field-contain { background: none; padding: 1.5em 0; margin: 0; border-bottom-width: 1px; overflow: visible; } | |
.ui-field-contain:first-child { border-top-width: 0; } | |
@media all and (min-width: 450px){ | |
.ui-field-contain { border-width: 0; padding: 0; margin: 1em 0; } | |
} /* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
.ui-select { display: block; position: relative; } | |
.ui-select select { position: absolute; left: -9999px; top: -9999px; } | |
.ui-select .ui-btn { overflow: hidden; } | |
.ui-select .ui-btn select { cursor: pointer; -webkit-appearance: button; left: 0; top:0; width: 100%; height: 100%; opacity: 0; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter: alpha(opacity=0); } | |
@-moz-document url-prefix() {.ui-select .ui-btn select { opacity: 0.0001; }} | |
.ui-select .ui-btn select.ui-select-nativeonly { opacity: 1; text-indent: 0; } | |
.ui-select .ui-btn-icon-right .ui-btn-inner { padding-right: 45px; } | |
.ui-select .ui-btn-icon-right .ui-icon { right: 15px; } | |
/* labels */ | |
label.ui-select { font-size: 16px; line-height: 1.4; font-weight: normal; margin: 0 0 .3em; display: block; } | |
/*listbox*/ | |
.ui-select .ui-btn-text, .ui-selectmenu .ui-btn-text { display: inline-block; min-height: 1em; } | |
.ui-select .ui-btn-text { text-overflow: ellipsis; overflow: hidden; display: block;} | |
.ui-selectmenu { position: absolute; padding: 0; z-index: 100 !important; width: 80%; max-width: 350px; padding: 6px; } | |
.ui-selectmenu .ui-listview { margin: 0; } | |
.ui-selectmenu .ui-btn.ui-li-divider { cursor: default; } | |
.ui-selectmenu-hidden { top: -9999px; left: -9999px; } | |
.ui-selectmenu-screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 99; } | |
.ui-screen-hidden, .ui-selectmenu-list .ui-li .ui-icon { display: none; } | |
.ui-selectmenu-list .ui-li .ui-icon { display: block; } | |
.ui-li.ui-selectmenu-placeholder { display: none; } | |
.ui-selectmenu .ui-header .ui-title { margin: 0.6em 46px 0.8em; } | |
@media all and (min-width: 450px){ | |
label.ui-select { display: inline-block; width: 20%; margin: 0 2% 0 0; } | |
.ui-select { width: 60%; display: inline-block; } | |
} | |
/* when no placeholder is defined in a multiple select, the header height doesn't even extend past the close button. this shim's content in there */ | |
.ui-selectmenu .ui-header h1:after { content: '.'; visibility: hidden; }/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
label.ui-input-text { font-size: 16px; line-height: 1.4; display: block; font-weight: normal; margin: 0 0 .3em; } | |
input.ui-input-text, textarea.ui-input-text { background-image: none; padding: .4em; line-height: 1.4; font-size: 16px; display: block; width: 95%; } | |
input.ui-input-text { -webkit-appearance: none; } | |
textarea.ui-input-text { height: 50px; -webkit-transition: height 200ms linear; -moz-transition: height 200ms linear; -o-transition: height 200ms linear; transition: height 200ms linear; } | |
.ui-input-search { padding: 0 30px; width: 77%; background-position: 8px 50%; background-repeat: no-repeat; position: relative; } | |
.ui-input-search input.ui-input-text { border: none; width: 98%; padding: .4em 0; margin: 0; display: block; background: transparent none; outline: 0 !important; } | |
.ui-input-search .ui-input-clear { position: absolute; right: 0; top: 50%; margin-top: -14px; } | |
.ui-input-search .ui-input-clear-hidden { display: none; } | |
/* orientation adjustments - incomplete!*/ | |
@media all and (min-width: 450px){ | |
label.ui-input-text { vertical-align: top; display: inline-block; width: 20%; margin: 0 2% 0 0 } | |
input.ui-input-text, | |
textarea.ui-input-text, | |
.ui-input-search { width: 60%; display: inline-block; } | |
.ui-input-search { width: 50%; } | |
.ui-input-search input.ui-input-text { width: 98%; /*echos rule from above*/ } | |
}/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
.ui-listview { margin: 0; counter-reset: listnumbering; } | |
.ui-content .ui-listview { margin: -15px; } | |
.ui-content .ui-listview-inset { margin: 1em 0; } | |
.ui-listview, .ui-li { list-style:none; padding:0; } | |
.ui-li, .ui-li.ui-field-contain { display: block; margin:0; position: relative; overflow: visible; text-align: left; border-width: 0; border-top-width: 1px; } | |
.ui-li .ui-btn-text a.ui-link-inherit { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; } | |
.ui-li-divider, .ui-li-static { padding: .5em 15px; font-size: 14px; font-weight: bold; } | |
.ui-li-divider { counter-reset: listnumbering; } | |
ol.ui-listview .ui-link-inherit:before, ol.ui-listview .ui-li-static:before, .ui-li-dec { font-size: .8em; display: inline-block; padding-right: .3em; font-weight: normal;counter-increment: listnumbering; content: counter(listnumbering) ". "; } | |
ol.ui-listview .ui-li-jsnumbering:before { content: "" !important; } /* to avoid chance of duplication */ | |
.ui-listview-inset .ui-li { border-right-width: 1px; border-left-width: 1px; } | |
.ui-li:last-child, .ui-li.ui-field-contain:last-child { border-bottom-width: 1px; } | |
.ui-li>.ui-btn-inner { display: block; position: relative; padding: 0; } | |
.ui-li .ui-btn-inner a.ui-link-inherit, .ui-li-static.ui-li { padding: .7em 75px .7em 15px; display: block; } | |
.ui-li-has-thumb .ui-btn-inner a.ui-link-inherit, .ui-li-static.ui-li-has-thumb { min-height: 60px; padding-left: 100px; } | |
.ui-li-has-icon .ui-btn-inner a.ui-link-inherit, .ui-li-static.ui-li-has-icon { min-height: 20px; padding-left: 40px; } | |
.ui-li-heading { font-size: 16px; font-weight: bold; display: block; margin: .6em 0; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; } | |
.ui-li-desc { font-size: 12px; font-weight: normal; display: block; margin: -.5em 0 .6em; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; } | |
.ui-li-thumb, .ui-li-icon { position: absolute; left: 1px; top: 0; max-height: 80px; max-width: 80px; } | |
.ui-li-icon { max-height: 40px; max-width: 40px; left: 10px; top: .9em; } | |
.ui-li-thumb, .ui-li-icon, .ui-li-content { float: left; margin-right: 10px; } | |
.ui-li-aside { float: right; width: 50%; text-align: right; margin: .3em 0; } | |
@media all and (min-width: 480px){ | |
.ui-li-aside { width: 45%; } | |
} | |
.ui-li-divider { cursor: default; } | |
.ui-li-has-alt .ui-btn-inner a.ui-link-inherit, .ui-li-static.ui-li-has-alt { padding-right: 95px; } | |
.ui-li-count { position: absolute; font-size: 11px; font-weight: bold; padding: .2em .5em; top: 50%; margin-top: -.9em; right: 38px; } | |
.ui-li-divider .ui-li-count, .ui-li-static .ui-li-count { right: 10px; } | |
.ui-li-has-alt .ui-li-count { right: 55px; } | |
.ui-li-link-alt { position: absolute; width: 40px; height: 100%; border-width: 0; border-left-width: 1px; top: 0; right: 0; margin: 0; padding: 0; } | |
.ui-li-link-alt .ui-btn { overflow: hidden; position: absolute; right: 8px; top: 50%; margin: -11px 0 0 0; border-bottom-width: 1px; } | |
.ui-li-link-alt .ui-btn-inner { padding: 0; position: static; } | |
.ui-li-link-alt .ui-btn .ui-icon { right: 50%; margin-right: -9px; } | |
.ui-listview-filter { border-width: 0; overflow: hidden; margin: -15px -15px 15px -15px } | |
.ui-listview-filter .ui-input-search { margin: 5px; width: auto; display: block; } | |
.ui-listview-filter-inset { margin: -15px -5px -15px -5px; background: transparent; } | |
.ui-li.ui-screen-hidden{display:none;} | |
/* Odd iPad positioning issue. */ | |
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) { | |
.ui-li .ui-btn-text { overflow: visible; } | |
}/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
label.ui-slider { display: block; } | |
input.ui-slider-input { display: inline-block; width: 50px; } | |
select.ui-slider-switch { display: none; } | |
div.ui-slider { position: relative; display: inline-block; overflow: visible; height: 15px; padding: 0; margin: 0 2% 0 20px; top: 4px; width: 66%; } | |
a.ui-slider-handle { position: absolute; z-index: 10; top: 50%; width: 28px; height: 28px; margin-top: -15px; margin-left: -15px; } | |
a.ui-slider-handle .ui-btn-inner { padding-left: 0; padding-right: 0; } | |
@media all and (min-width: 480px){ | |
label.ui-slider { display: inline-block; width: 20%; margin: 0 2% 0 0; } | |
div.ui-slider { width: 45%; } | |
} | |
div.ui-slider-switch { height: 32px; overflow: hidden; margin-left: 0; } | |
div.ui-slider-inneroffset { margin-left: 50%; position: absolute; top: 1px; height: 100%; width: 50%; } | |
div.ui-slider-handle-snapping { -webkit-transition: left 100ms linear; } | |
div.ui-slider-labelbg { position: absolute; top:0; margin: 0; border-width: 0; } | |
div.ui-slider-switch div.ui-slider-labelbg-a { width: 60%; height: 100%; left: 0; } | |
div.ui-slider-switch div.ui-slider-labelbg-b { width: 60%; height: 100%; right: 0; } | |
.ui-slider-switch-a div.ui-slider-labelbg-a, .ui-slider-switch-b div.ui-slider-labelbg-b { z-index: -1; } | |
.ui-slider-switch-a div.ui-slider-labelbg-b, .ui-slider-switch-b div.ui-slider-labelbg-a { z-index: 0; } | |
div.ui-slider-switch a.ui-slider-handle { z-index: 20; width: 101%; height: 32px; margin-top: -18px; margin-left: -101%; } | |
span.ui-slider-label { width: 100%; position: absolute;height: 32px; font-size: 16px; text-align: center; line-height: 2; background: none; border-color: transparent; } | |
span.ui-slider-label-a { left: -100%; margin-right: -1px } | |
span.ui-slider-label-b { right: -100%; margin-left: -1px } | |
/*! | |
* jQuery Mobile v1.0b2 | |
* http://jquerymobile.com/ | |
* | |
* Copyright 2010, jQuery Project | |
* Dual licensed under the MIT or GPL Version 2 licenses. | |
* http://jquery.org/license | |
*/ | |
/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
/* A | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-bar-a { | |
border: 1px solid #2A2A2A; | |
background: #111111; | |
color: #ffffff; | |
font-weight: bold; | |
text-shadow: 0 -1px 1px #000000; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#3c3c3c), to(#111)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #3c3c3c, #111); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #3c3c3c, #111); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #3c3c3c, #111); /* IE10 */ | |
background-image: -o-linear-gradient(top, #3c3c3c, #111); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #3c3c3c, #111); | |
} | |
.ui-bar-a, | |
.ui-bar-a input, | |
.ui-bar-a select, | |
.ui-bar-a textarea, | |
.ui-bar-a button { | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.ui-bar-a .ui-link-inherit { | |
color: #fff; | |
} | |
.ui-bar-a .ui-link { | |
color: #7cc4e7; | |
font-weight: bold; | |
} | |
.ui-body-a { | |
border: 1px solid #2A2A2A; | |
background: #222222; | |
color: #fff; | |
text-shadow: 0 1px 0 #000; | |
font-weight: normal; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#666), to(#222)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #666, #222); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #666, #222); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #666, #222); /* IE10 */ | |
background-image: -o-linear-gradient(top, #666, #222); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #666, #222); | |
} | |
.ui-body-a, | |
.ui-body-a input, | |
.ui-body-a select, | |
.ui-body-a textarea, | |
.ui-body-a button { | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.ui-body-a .ui-link-inherit { | |
color: #fff; | |
} | |
.ui-body-a .ui-link { | |
color: #2489CE; | |
font-weight: bold; | |
} | |
.ui-br { | |
border-bottom: rgb(130,130,130); | |
border-bottom: rgba(130,130,130,.3); | |
border-bottom-width: 1px; | |
border-bottom-style: solid; | |
} | |
.ui-btn-up-a { | |
border: 1px solid #222; | |
background: #333333; | |
font-weight: bold; | |
color: #fff; | |
text-shadow: 0 -1px 1px #000; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#555), to(#333)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #555, #333); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #555, #333); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #555, #333); /* IE10 */ | |
background-image: -o-linear-gradient(top, #555, #333); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #555, #333); | |
} | |
.ui-btn-up-a a.ui-link-inherit { | |
color: #fff; | |
} | |
.ui-btn-hover-a { | |
border: 1px solid #000; | |
background: #444444; | |
font-weight: bold; | |
color: #fff; | |
text-shadow: 0 -1px 1px #000; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#666), to(#444)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #666, #444); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #666, #444); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #666, #444); /* IE10 */ | |
background-image: -o-linear-gradient(top, #666, #444); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #666, #444); | |
} | |
.ui-btn-hover-a a.ui-link-inherit { | |
color: #fff; | |
} | |
.ui-btn-down-a { | |
border: 1px solid #000; | |
background: #3d3d3d; | |
font-weight: bold; | |
color: #fff; | |
text-shadow: 0 -1px 1px #000; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#333), to(#5a5a5a)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #333, #5a5a5a); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #333, #5a5a5a); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #333, #5a5a5a); /* IE10 */ | |
background-image: -o-linear-gradient(top, #333, #5a5a5a); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #333, #5a5a5a); | |
} | |
.ui-btn-down-a a.ui-link-inherit { | |
color: #fff; | |
} | |
.ui-btn-up-a, | |
.ui-btn-hover-a, | |
.ui-btn-down-a { | |
font-family: Helvetica, Arial, sans-serif; | |
text-decoration: none; | |
} | |
/* B | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-bar-b { | |
border: 1px solid #456f9a; | |
background: #5e87b0; | |
color: #fff; | |
font-weight: bold; | |
text-shadow: 0 -1px 1px #254f7a; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#81a8ce), to(#5e87b0)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #81a8ce, #5e87b0); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #81a8ce, #5e87b0); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #81a8ce, #5e87b0); /* IE10 */ | |
background-image: -o-linear-gradient(top, #81a8ce, #5e87b0); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #81a8ce, #5e87b0); | |
} | |
.ui-bar-b, | |
.ui-bar-b input, | |
.ui-bar-b select, | |
.ui-bar-b textarea, | |
.ui-bar-b button { | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.ui-bar-b .ui-link-inherit { | |
color: #fff; | |
} | |
.ui-bar-b .ui-link { | |
color: #7cc4e7; | |
font-weight: bold; | |
} | |
.ui-body-b { | |
border: 1px solid #C6C6C6; | |
background: #cccccc; | |
color: #333333; | |
text-shadow: 0 1px 0 #fff; | |
font-weight: normal; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#e6e6e6), to(#ccc)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #e6e6e6, #ccc); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #e6e6e6, #ccc); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #e6e6e6, #ccc); /* IE10 */ | |
background-image: -o-linear-gradient(top, #e6e6e6, #ccc); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #e6e6e6, #ccc); | |
} | |
.ui-body-b, | |
.ui-body-b input, | |
.ui-body-b select, | |
.ui-body-b textarea, | |
.ui-body-b button { | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.ui-body-b .ui-link-inherit { | |
color: #333333; | |
} | |
.ui-body-b .ui-link { | |
color: #2489CE; | |
font-weight: bold; | |
} | |
.ui-btn-up-b { | |
border: 1px solid #145072; | |
background: #2567ab; | |
font-weight: bold; | |
color: #fff; | |
text-shadow: 0 -1px 1px #145072; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#5f9cc5), to(#396b9e)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #5f9cc5, #396b9e); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #5f9cc5, #396b9e); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #5f9cc5, #396b9e); /* IE10 */ | |
background-image: -o-linear-gradient(top, #5f9cc5, #396b9e); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #5f9cc5, #396b9e); | |
} | |
.ui-btn-up-b a.ui-link-inherit { | |
color: #fff; | |
} | |
.ui-btn-hover-b { | |
border: 1px solid #00516e; | |
background: #4b88b6; | |
font-weight: bold; | |
color: #fff; | |
text-shadow: 0 -1px 1px #014D68; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#72b0d4), to(#4b88b6)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #72b0d4, #4b88b6); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #72b0d4, #4b88b6); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #72b0d4, #4b88b6); /* IE10 */ | |
background-image: -o-linear-gradient(top, #72b0d4, #4b88b6); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #72b0d4, #4b88b6); | |
} | |
.ui-btn-hover-b a.ui-link-inherit { | |
color: #fff; | |
} | |
.ui-btn-down-b { | |
border: 1px solid #225377; | |
background: #4e89c5; | |
font-weight: bold; | |
color: #fff; | |
text-shadow: 0 -1px 1px #225377; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#396b9e), to(#4e89c5)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #396b9e, #4e89c5); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #396b9e, #4e89c5); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #396b9e, #4e89c5); /* IE10 */ | |
background-image: -o-linear-gradient(top, #396b9e, #4e89c5); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #396b9e, #4e89c5); | |
} | |
.ui-btn-down-b a.ui-link-inherit { | |
color: #fff; | |
} | |
.ui-btn-up-b, | |
.ui-btn-hover-b, | |
.ui-btn-down-b { | |
font-family: Helvetica, Arial, sans-serif; | |
text-decoration: none; | |
} | |
/* C | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-bar-c { | |
border: 1px solid #B3B3B3; | |
background: #e9eaeb; | |
color: #3E3E3E; | |
font-weight: bold; | |
text-shadow: 0 1px 1px #fff; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#f0f0f0), to(#e9eaeb)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #f0f0f0, #e9eaeb); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #f0f0f0, #e9eaeb); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #f0f0f0, #e9eaeb); /* IE10 */ | |
background-image: -o-linear-gradient(top, #f0f0f0, #e9eaeb); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #f0f0f0, #e9eaeb); | |
} | |
.ui-bar-c, | |
.ui-bar-c input, | |
.ui-bar-c select, | |
.ui-bar-c textarea, | |
.ui-bar-c button { | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.ui-body-c { | |
border: 1px solid #B3B3B3; | |
color: #333333; | |
text-shadow: 0 1px 0 #fff; | |
background: #f0f0f0; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#ddd)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #eee, #ddd); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #eee, #ddd); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #eee, #ddd); /* IE10 */ | |
background-image: -o-linear-gradient(top, #eee, #ddd); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #eee, #ddd); | |
} | |
.ui-body-c, | |
.ui-body-c input, | |
.ui-body-c select, | |
.ui-body-c textarea, | |
.ui-body-c button { | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.ui-body-c .ui-link-inherit { | |
color: #333333; | |
} | |
.ui-body-c .ui-link { | |
color: #2489CE; | |
font-weight: bold; | |
} | |
.ui-btn-up-c { | |
border: 1px solid #ccc; | |
background: #eee; | |
font-weight: bold; | |
color: #444; | |
text-shadow: 0 1px 1px #f6f6f6; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#fdfdfd), to(#eee)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #fdfdfd, #eee); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #fdfdfd, #eee); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #fdfdfd, #eee); /* IE10 */ | |
background-image: -o-linear-gradient(top, #fdfdfd, #eee); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #fdfdfd, #eee); | |
} | |
.ui-btn-up-c a.ui-link-inherit { | |
color: #2F3E46; | |
} | |
.ui-btn-hover-c { | |
border: 1px solid #bbb; | |
background: #dadada; | |
font-weight: bold; | |
color: #101010; | |
text-shadow: 0 1px 1px #fff; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#ededed), to(#dadada)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #ededed, #dadada); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #ededed, #dadada); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #ededed, #dadada); /* IE10 */ | |
background-image: -o-linear-gradient(top, #ededed, #dadada); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #ededed, #dadada); | |
} | |
.ui-btn-hover-c a.ui-link-inherit { | |
color: #2F3E46; | |
} | |
.ui-btn-down-c { | |
border: 1px solid #808080; | |
background: #fdfdfd; | |
font-weight: bold; | |
color: #111111; | |
text-shadow: 0 1px 1px #ffffff; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#fdfdfd)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #eee, #fdfdfd); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #eee, #fdfdfd); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #eee, #fdfdfd); /* IE10 */ | |
background-image: -o-linear-gradient(top, #eee, #fdfdfd); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #eee, #fdfdfd); | |
} | |
.ui-btn-down-c a.ui-link-inherit { | |
color: #2F3E46; | |
} | |
.ui-btn-up-c, | |
.ui-btn-hover-c, | |
.ui-btn-down-c { | |
font-family: Helvetica, Arial, sans-serif; | |
text-decoration: none; | |
} | |
/* D | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-bar-d { | |
border: 1px solid #ccc; | |
background: #bbb; | |
color: #333; | |
text-shadow: 0 1px 0 #eee; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#ddd), to(#bbb)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #ddd, #bbb); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #ddd, #bbb); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #ddd, #bbb); /* IE10 */ | |
background-image: -o-linear-gradient(top, #ddd, #bbb); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #ddd, #bbb); | |
} | |
.ui-bar-d, | |
.ui-bar-d input, | |
.ui-bar-d select, | |
.ui-bar-d textarea, | |
.ui-bar-d button { | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.ui-bar-d .ui-link-inherit { | |
color: #333; | |
} | |
.ui-bar-d .ui-link { | |
color: #2489CE; | |
font-weight: bold; | |
} | |
.ui-body-d { | |
border: 1px solid #ccc; | |
color: #333333; | |
text-shadow: 0 1px 0 #fff; | |
background: #ffffff; | |
} | |
.ui-body-d, | |
.ui-body-d input, | |
.ui-body-d select, | |
.ui-body-d textarea, | |
.ui-body-d button { | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.ui-body-d .ui-link-inherit { | |
color: #333333; | |
} | |
.ui-body-d .ui-link { | |
color: #2489CE; | |
font-weight: bold; | |
} | |
.ui-btn-up-d { | |
border: 1px solid #ccc; | |
background: #fff; | |
font-weight: bold; | |
color: #444; | |
text-shadow: 0 1px 1px #fff; | |
} | |
.ui-btn-up-d a.ui-link-inherit { | |
color: #333; | |
} | |
.ui-btn-hover-d { | |
border: 1px solid #aaa; | |
background: #eeeeee; | |
font-weight: bold; | |
color: #222; | |
cursor: pointer; | |
text-shadow: 0 1px 1px #fff; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#fdfdfd), to(#eee)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #fdfdfd, #eee); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #fdfdfd, #eee); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #fdfdfd, #eee); /* IE10 */ | |
background-image: -o-linear-gradient(top, #fdfdfd, #eee); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #fdfdfd, #eee); | |
} | |
.ui-btn-hover-d a.ui-link-inherit { | |
color: #222; | |
} | |
.ui-btn-down-d { | |
border: 1px solid #aaaaaa; | |
background: #ffffff; | |
font-weight: bold; | |
color: #111; | |
text-shadow: 0 1px 1px #ffffff; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#fff)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #eee, #fff); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #eee, #fff); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #eee, #fff); /* IE10 */ | |
background-image: -o-linear-gradient(top, #eee, #fff); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #eee, #fff); | |
} | |
.ui-btn-down-d a.ui-link-inherit { | |
color: #111; | |
} | |
.ui-btn-up-d, | |
.ui-btn-hover-d, | |
.ui-btn-down-d { | |
font-family: Helvetica, Arial, sans-serif; | |
text-decoration: none; | |
} | |
/* E | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-bar-e { | |
border: 1px solid #F7C942; | |
background: #fadb4e; | |
color: #333; | |
text-shadow: 0 1px 0 #fff; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#fceda7), to(#fadb4e)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #fceda7, #fadb4e); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #fceda7, #fadb4e); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #fceda7, #fadb4e); /* IE10 */ | |
background-image: -o-linear-gradient(top, #fceda7, #fadb4e); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #fceda7, #fadb4e); | |
} | |
.ui-bar-e, | |
.ui-bar-e input, | |
.ui-bar-e select, | |
.ui-bar-e textarea, | |
.ui-bar-e button { | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.ui-bar-e .ui-link-inherit { | |
color: #333; | |
} | |
.ui-bar-e .ui-link { | |
color: #2489CE; | |
font-weight: bold; | |
} | |
.ui-body-e { | |
border: 1px solid #F7C942; | |
color: #333333; | |
text-shadow: 0 1px 0 #fff; | |
background: #faeb9e; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#faeb9e)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #fff, #faeb9e); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #fff, #faeb9e); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #fff, #faeb9e); /* IE10 */ | |
background-image: -o-linear-gradient(top, #fff, #faeb9e); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #fff, #faeb9e); | |
} | |
.ui-body-e, | |
.ui-body-e input, | |
.ui-body-e select, | |
.ui-body-e textarea, | |
.ui-body-e button { | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.ui-body-e .ui-link-inherit { | |
color: #333333; | |
} | |
.ui-body-e .ui-link { | |
color: #2489CE; | |
font-weight: bold; | |
} | |
.ui-btn-up-e { | |
border: 1px solid #F7C942; | |
background: #fadb4e; | |
font-weight: bold; | |
color: #333; | |
text-shadow: 0 1px 0 #fff; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#fceda7), to(#fadb4e)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #fceda7, #fadb4e); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #fceda7, #fadb4e); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #fceda7, #fadb4e); /* IE10 */ | |
background-image: -o-linear-gradient(top, #fceda7, #fadb4e); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #fceda7, #fadb4e); | |
} | |
.ui-btn-up-e a.ui-link-inherit { | |
color: #333; | |
} | |
.ui-btn-hover-e { | |
border: 1px solid #e79952; | |
background: #fbe26f; | |
font-weight: bold; | |
color: #111; | |
text-shadow: 0 1px 1px #fff; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf0b5), to(#fbe26f)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #fcf0b5, #fbe26f); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #fcf0b5, #fbe26f); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #fcf0b5, #fbe26f); /* IE10 */ | |
background-image: -o-linear-gradient(top, #fcf0b5, #fbe26f); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #fcf0b5, #fbe26f); | |
} | |
.ui-btn-hover-e a.ui-link-inherit { | |
color: #333; | |
} | |
.ui-btn-down-e { | |
border: 1px solid #F7C942; | |
background: #fceda7; | |
font-weight: bold; | |
color: #111; | |
text-shadow: 0 1px 1px #ffffff; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#fadb4e), to(#fceda7)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #fadb4e, #fceda7); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #fadb4e, #fceda7); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #fadb4e, #fceda7); /* IE10 */ | |
background-image: -o-linear-gradient(top, #fadb4e, #fceda7); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #fadb4e, #fceda7); | |
} | |
.ui-btn-down-e a.ui-link-inherit { | |
color: #333; | |
} | |
.ui-btn-up-e, | |
.ui-btn-hover-e, | |
.ui-btn-down-e { | |
font-family: Helvetica, Arial, sans-serif; | |
text-decoration: none; | |
} | |
/* links within "buttons" | |
-----------------------------------------------------------------------------------------------------------*/ | |
a.ui-link-inherit { | |
text-decoration: none !important; | |
} | |
/* Active class used as the "on" state across all themes | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-btn-active { | |
border: 1px solid #155678; | |
background: #4596ce; | |
font-weight: bold; | |
color: #fff; | |
cursor: pointer; | |
text-shadow: 0 -1px 1px #145072; | |
text-decoration: none; | |
background-image: -webkit-gradient(linear, left top, left bottom, from(#85bae4), to(#5393c5)); /* Saf4+, Chrome */ | |
background-image: -webkit-linear-gradient(top, #85bae4, #5393c5); /* Chrome 10+, Saf5.1+ */ | |
background-image: -moz-linear-gradient(top, #85bae4, #5393c5); /* FF3.6 */ | |
background-image: -ms-linear-gradient(top, #85bae4, #5393c5); /* IE10 */ | |
background-image: -o-linear-gradient(top, #85bae4, #5393c5); /* Opera 11.10+ */ | |
background-image: linear-gradient(top, #85bae4, #5393c5); | |
outline: none; | |
} | |
.ui-btn-active a.ui-link-inherit { | |
color: #fff; | |
} | |
/* button inner top highlight | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-btn-inner { | |
border-top: 1px solid #fff; | |
border-color: rgba(255,255,255,.3); | |
} | |
/* corner rounding classes | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-corner-tl { | |
-moz-border-radius-topleft: .6em; | |
-webkit-border-top-left-radius: .6em; | |
border-top-left-radius: .6em; | |
} | |
.ui-corner-tr { | |
-moz-border-radius-topright: .6em; | |
-webkit-border-top-right-radius: .6em; | |
border-top-right-radius: .6em; | |
} | |
.ui-corner-bl { | |
-moz-border-radius-bottomleft: .6em; | |
-webkit-border-bottom-left-radius: .6em; | |
border-bottom-left-radius: .6em; | |
} | |
.ui-corner-br { | |
-moz-border-radius-bottomright: .6em; | |
-webkit-border-bottom-right-radius: .6em; | |
border-bottom-right-radius: .6em; | |
} | |
.ui-corner-top { | |
-moz-border-radius-topleft: .6em; | |
-webkit-border-top-left-radius: .6em; | |
border-top-left-radius: .6em; | |
-moz-border-radius-topright: .6em; | |
-webkit-border-top-right-radius: .6em; | |
border-top-right-radius: .6em; | |
} | |
.ui-corner-bottom { | |
-moz-border-radius-bottomleft: .6em; | |
-webkit-border-bottom-left-radius: .6em; | |
border-bottom-left-radius: .6em; | |
-moz-border-radius-bottomright: .6em; | |
-webkit-border-bottom-right-radius: .6em; | |
border-bottom-right-radius: .6em; | |
} | |
.ui-corner-right { | |
-moz-border-radius-topright: .6em; | |
-webkit-border-top-right-radius: .6em; | |
border-top-right-radius: .6em; | |
-moz-border-radius-bottomright: .6em; | |
-webkit-border-bottom-right-radius: .6em; | |
border-bottom-right-radius: .6em; | |
} | |
.ui-corner-left { | |
-moz-border-radius-topleft: .6em; | |
-webkit-border-top-left-radius: .6em; | |
border-top-left-radius: .6em; | |
-moz-border-radius-bottomleft: .6em; | |
-webkit-border-bottom-left-radius: .6em; | |
border-bottom-left-radius: .6em; | |
} | |
.ui-corner-all { | |
-moz-border-radius: .6em; | |
-webkit-border-radius: .6em; | |
border-radius: .6em; | |
} | |
/* Interaction cues | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-disabled { | |
opacity: .3; | |
} | |
.ui-disabled, | |
.ui-disabled a { | |
cursor: default; | |
} | |
/* Icons | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-icon { | |
background: #666; | |
background: rgba(0,0,0,.4); | |
background-image: url(images/icons-18-white.png); | |
background-repeat: no-repeat; | |
-moz-border-radius: 9px; | |
-webkit-border-radius: 9px; | |
border-radius: 9px; | |
} | |
/* Alt icon color | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-icon-alt { | |
background: #fff; | |
background: rgba(255,255,255,.3); | |
background-image: url(images/icons-18-black.png); | |
background-repeat: no-repeat; | |
} | |
/* HD/"retina" sprite | |
-----------------------------------------------------------------------------------------------------------*/ | |
@media only screen and (-webkit-min-device-pixel-ratio: 1.5), | |
only screen and (min--moz-device-pixel-ratio: 1.5), | |
only screen and (min-resolution: 240dpi) { | |
.ui-icon-plus, .ui-icon-minus, .ui-icon-delete, .ui-icon-arrow-r, | |
.ui-icon-arrow-l, .ui-icon-arrow-u, .ui-icon-arrow-d, .ui-icon-check, | |
.ui-icon-gear, .ui-icon-refresh, .ui-icon-forward, .ui-icon-back, | |
.ui-icon-grid, .ui-icon-star, .ui-icon-alert, .ui-icon-info, .ui-icon-home, .ui-icon-search, | |
.ui-icon-checkbox-off, .ui-icon-checkbox-on, .ui-icon-radio-off, .ui-icon-radio-on { | |
background-image: url(images/icons-36-white.png); | |
-moz-background-size: 776px 18px; | |
-o-background-size: 776px 18px; | |
-webkit-background-size: 776px 18px; | |
background-size: 776px 18px; | |
} | |
.ui-icon-alt { | |
background-image: url(images/icons-36-black.png); | |
} | |
} | |
/* plus minus */ | |
.ui-icon-plus { | |
background-position: -0 50%; | |
} | |
.ui-icon-minus { | |
background-position: -36px 50%; | |
} | |
/* delete/close */ | |
.ui-icon-delete { | |
background-position: -72px 50%; | |
} | |
/* arrows */ | |
.ui-icon-arrow-r { | |
background-position: -108px 50%; | |
} | |
.ui-icon-arrow-l { | |
background-position: -144px 50%; | |
} | |
.ui-icon-arrow-u { | |
background-position: -180px 50%; | |
} | |
.ui-icon-arrow-d { | |
background-position: -216px 50%; | |
} | |
/* misc */ | |
.ui-icon-check { | |
background-position: -252px 50%; | |
} | |
.ui-icon-gear { | |
background-position: -288px 50%; | |
} | |
.ui-icon-refresh { | |
background-position: -324px 50%; | |
} | |
.ui-icon-forward { | |
background-position: -360px 50%; | |
} | |
.ui-icon-back { | |
background-position: -396px 50%; | |
} | |
.ui-icon-grid { | |
background-position: -432px 50%; | |
} | |
.ui-icon-star { | |
background-position: -468px 50%; | |
} | |
.ui-icon-alert { | |
background-position: -504px 50%; | |
} | |
.ui-icon-info { | |
background-position: -540px 50%; | |
} | |
.ui-icon-home { | |
background-position: -576px 50%; | |
} | |
.ui-icon-search { | |
background-position: -612px 50%; | |
} | |
.ui-icon-checkbox-off { | |
background-position: -684px 50%; | |
} | |
.ui-icon-checkbox-on { | |
background-position: -648px 50%; | |
} | |
.ui-icon-radio-off { | |
background-position: -756px 50%; | |
} | |
.ui-icon-radio-on { | |
background-position: -720px 50%; | |
} | |
/* checks,radios */ | |
.ui-checkbox .ui-icon { | |
-moz-border-radius: 3px; | |
-webkit-border-radius: 3px; | |
border-radius: 3px; | |
} | |
.ui-icon-checkbox-off, | |
.ui-icon-radio-off { | |
background-color: transparent; | |
} | |
.ui-checkbox-on .ui-icon, | |
.ui-radio-on .ui-icon { | |
background-color: #4596ce; /* NOTE: this hex should match the active state color. It's repeated here for cascade */ | |
} | |
.ui-icon-searchfield { | |
background-image: url(images/icon-search-black.png); | |
background-size: 16px 16px; | |
} | |
/* loading icon */ | |
.ui-icon-loading { | |
background-image: url(images/ajax-loader.png); | |
width: 40px; | |
height: 40px; | |
-moz-border-radius: 20px; | |
-webkit-border-radius: 20px; | |
border-radius: 20px; | |
background-size: 35px 35px; | |
} | |
/* Button corner classes | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-btn-corner-tl { | |
-moz-border-radius-topleft: 1em; | |
-webkit-border-top-left-radius: 1em; | |
border-top-left-radius: 1em; | |
} | |
.ui-btn-corner-tr { | |
-moz-border-radius-topright: 1em; | |
-webkit-border-top-right-radius: 1em; | |
border-top-right-radius: 1em; | |
} | |
.ui-btn-corner-bl { | |
-moz-border-radius-bottomleft: 1em; | |
-webkit-border-bottom-left-radius: 1em; | |
border-bottom-left-radius: 1em; | |
} | |
.ui-btn-corner-br { | |
-moz-border-radius-bottomright: 1em; | |
-webkit-border-bottom-right-radius: 1em; | |
border-bottom-right-radius: 1em; | |
} | |
.ui-btn-corner-top { | |
-moz-border-radius-topleft: 1em; | |
-webkit-border-top-left-radius: 1em; | |
border-top-left-radius: 1em; | |
-moz-border-radius-topright: 1em; | |
-webkit-border-top-right-radius: 1em; | |
border-top-right-radius: 1em; | |
} | |
.ui-btn-corner-bottom { | |
-moz-border-radius-bottomleft: 1em; | |
-webkit-border-bottom-left-radius: 1em; | |
border-bottom-left-radius: 1em; | |
-moz-border-radius-bottomright: 1em; | |
-webkit-border-bottom-right-radius: 1em; | |
border-bottom-right-radius: 1em; | |
} | |
.ui-btn-corner-right { | |
-moz-border-radius-topright: 1em; | |
-webkit-border-top-right-radius: 1em; | |
border-top-right-radius: 1em; | |
-moz-border-radius-bottomright: 1em; | |
-webkit-border-bottom-right-radius: 1em; | |
border-bottom-right-radius: 1em; | |
} | |
.ui-btn-corner-left { | |
-moz-border-radius-topleft: 1em; | |
-webkit-border-top-left-radius: 1em; | |
border-top-left-radius: 1em; | |
-moz-border-radius-bottomleft: 1em; | |
-webkit-border-bottom-left-radius: 1em; | |
border-bottom-left-radius: 1em; | |
} | |
.ui-btn-corner-all { | |
-moz-border-radius: 1em; | |
-webkit-border-radius: 1em; | |
border-radius: 1em; | |
} | |
/* radius clip workaround for cleaning up corner trapping */ | |
.ui-corner-tl, | |
.ui-corner-tr, | |
.ui-corner-bl, | |
.ui-corner-br, | |
.ui-corner-top, | |
.ui-corner-bottom, | |
.ui-corner-right, | |
.ui-corner-left, | |
.ui-corner-all, | |
.ui-btn-corner-tl, | |
.ui-btn-corner-tr, | |
.ui-btn-corner-bl, | |
.ui-btn-corner-br, | |
.ui-btn-corner-top, | |
.ui-btn-corner-bottom, | |
.ui-btn-corner-right, | |
.ui-btn-corner-left, | |
.ui-btn-corner-all { | |
-webkit-background-clip: padding-box; | |
-moz-background-clip: padding; | |
background-clip: padding-box; | |
} | |
/* Overlay / modal | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-overlay { | |
background: #666; | |
opacity: .5; | |
filter: Alpha(Opacity=50); | |
position: absolute; | |
width: 100%; | |
height: 100%; | |
} | |
.ui-overlay-shadow { | |
-moz-box-shadow: 0px 0px 12px rgba(0,0,0,.6); | |
-webkit-box-shadow: 0px 0px 12px rgba(0,0,0,.6); | |
box-shadow: 0px 0px 12px rgba(0,0,0,.6); | |
} | |
.ui-shadow { | |
-moz-box-shadow: 0px 1px 4px rgba(0,0,0,.3); | |
-webkit-box-shadow: 0px 1px 4px rgba(0,0,0,.3); | |
box-shadow: 0px 1px 4px rgba(0,0,0,.3); | |
} | |
.ui-bar-a .ui-shadow, | |
.ui-bar-b .ui-shadow , | |
.ui-bar-c .ui-shadow { | |
-moz-box-shadow: 0px 1px 0 rgba(255,255,255,.3); | |
-webkit-box-shadow: 0px 1px 0 rgba(255,255,255,.3); | |
box-shadow: 0px 1px 0 rgba(255,255,255,.3); | |
} | |
.ui-shadow-inset { | |
-moz-box-shadow: inset 0px 1px 4px rgba(0,0,0,.2); | |
-webkit-box-shadow: inset 0px 1px 4px rgba(0,0,0,.2); | |
box-shadow: inset 0px 1px 4px rgba(0,0,0,.2); | |
} | |
.ui-icon-shadow { | |
-moz-box-shadow: 0px 1px 0 rgba(255,255,255,.4); | |
-webkit-box-shadow: 0px 1px 0 rgba(255,255,255,.4); | |
box-shadow: 0px 1px 0 rgba(255,255,255,.4); | |
} | |
/* Focus state - set here for specificity | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-focus { | |
-moz-box-shadow: 0px 0px 12px #387bbe; | |
-webkit-box-shadow: 0px 0px 12px #387bbe; | |
box-shadow: 0px 0px 12px #387bbe; | |
} | |
/* unset box shadow in browsers that don't do it right | |
-----------------------------------------------------------------------------------------------------------*/ | |
.ui-mobile-nosupport-boxshadow * { | |
-moz-box-shadow: none !important; | |
-webkit-box-shadow: none !important; | |
box-shadow: none !important; | |
} | |
/* ...and bring back focus */ | |
.ui-mobile-nosupport-boxshadow .ui-focus { | |
outline-width: 2px; | |
}/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
/* some unsets - more probably needed */ | |
.ui-mobile, .ui-mobile body { height: 100%; } | |
.ui-mobile fieldset, .ui-page { padding: 0; margin: 0; } | |
.ui-mobile a img, .ui-mobile fieldset { border: 0; } | |
/* responsive page widths */ | |
.ui-mobile-viewport { margin: 0; overflow-x: hidden; -webkit-text-size-adjust: none; -ms-text-size-adjust:none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } | |
/* "page" containers - full-screen views, one should always be in view post-pageload */ | |
.ui-mobile [data-role=page], .ui-mobile [data-role=dialog], .ui-page { top: 0; left: 0; width: 100%; min-height: 100%; position: absolute; display: none; border: 0; } | |
.ui-mobile .ui-page-active { display: block; overflow: visible; } | |
/*orientations from js are available */ | |
.portrait, | |
.portrait .ui-page { min-height: 420px; } | |
.landscape, | |
.landscape .ui-page { min-height: 300px; } | |
/* loading screen */ | |
.ui-loading .ui-mobile-viewport { overflow: hidden !important; } | |
.ui-loading .ui-loader { display: block; } | |
.ui-loading .ui-page { overflow: hidden; } | |
.ui-loader { display: none; position: absolute; opacity: .85; z-index: 100; left: 50%; width: 200px; margin-left: -130px; margin-top: -35px; padding: 10px 30px; } | |
.ui-loader h1 { font-size: 15px; text-align: center; } | |
.ui-loader .ui-icon { position: static; display: block; opacity: .9; margin: 0 auto; width: 35px; height: 35px; background-color: transparent; } | |
/*fouc*/ | |
.ui-mobile-rendering > * { visibility: hidden; } | |
/*headers, content panels*/ | |
.ui-bar, .ui-body { position: relative; padding: .4em 15px; overflow: hidden; display: block; clear:both; } | |
.ui-bar { font-size: 16px; margin: 0; } | |
.ui-bar h1, .ui-bar h2, .ui-bar h3, .ui-bar h4, .ui-bar h5, .ui-bar h6 { margin: 0; padding: 0; font-size: 16px; display: inline-block; } | |
.ui-header, .ui-footer { display: block; } | |
.ui-page .ui-header, .ui-page .ui-footer { position: relative; } | |
.ui-header .ui-btn-left { position: absolute; left: 10px; top: .4em; } | |
.ui-header .ui-btn-right { position: absolute; right: 10px; top: .4em; } | |
.ui-header .ui-title, .ui-footer .ui-title { min-height: 1.1em; text-align: center; font-size: 16px; display: block; margin: .6em 90px .8em; padding: 0; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; outline: 0 !important; } | |
/*content area*/ | |
.ui-content { border-width: 0; overflow: visible; overflow-x: hidden; padding: 15px; } | |
.ui-page-fullscreen .ui-content { padding:0; } | |
/* icons sizing */ | |
.ui-icon { width: 18px; height: 18px; } | |
/* fullscreen class on ui-content div */ | |
.ui-fullscreen { } | |
.ui-fullscreen img { max-width: 100%; } | |
/* non-js content hiding */ | |
.ui-nojs { position: absolute; left: -9999px; } | |
/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
.spin { | |
-webkit-transform: rotate(360deg); | |
-webkit-animation-name: spin; | |
-webkit-animation-duration: 1s; | |
-webkit-animation-iteration-count: infinite; | |
-webkit-animation-timing-function: linear; | |
} | |
@-webkit-keyframes spin { | |
from {-webkit-transform: rotate(0deg);} | |
to {-webkit-transform: rotate(360deg);} | |
} | |
/* Transitions from jQtouch (with small modifications): http://www.jqtouch.com/ | |
Built by David Kaneda and maintained by Jonathan Stark. | |
*/ | |
.in, .out { | |
-webkit-animation-timing-function: ease-in-out; | |
-webkit-animation-duration: 350ms; | |
} | |
.slide.in { | |
-webkit-transform: translateX(0); | |
-webkit-animation-name: slideinfromright; | |
} | |
.slide.out { | |
-webkit-transform: translateX(-100%); | |
-webkit-animation-name: slideouttoleft; | |
} | |
.slide.in.reverse { | |
-webkit-transform: translateX(0); | |
-webkit-animation-name: slideinfromleft; | |
} | |
.slide.out.reverse { | |
-webkit-transform: translateX(100%); | |
-webkit-animation-name: slideouttoright; | |
} | |
.slideup.in { | |
-webkit-transform: translateY(0); | |
-webkit-animation-name: slideinfrombottom; | |
z-index: 10; | |
} | |
.slideup.out { | |
-webkit-animation-name: dontmove; | |
z-index: 0; | |
} | |
.slideup.out.reverse { | |
-webkit-transform: translateY(100%); | |
z-index: 10; | |
-webkit-animation-name: slideouttobottom; | |
} | |
.slideup.in.reverse { | |
z-index: 0; | |
-webkit-animation-name: dontmove; | |
} | |
.slidedown.in { | |
-webkit-transform: translateY(0); | |
-webkit-animation-name: slideinfromtop; | |
z-index: 10; | |
} | |
.slidedown.out { | |
-webkit-animation-name: dontmove; | |
z-index: 0; | |
} | |
.slidedown.out.reverse { | |
-webkit-transform: translateY(-100%); | |
z-index: 10; | |
-webkit-animation-name: slideouttotop; | |
} | |
.slidedown.in.reverse { | |
z-index: 0; | |
-webkit-animation-name: dontmove; | |
} | |
@-webkit-keyframes slideinfromright { | |
from { -webkit-transform: translateX(100%); } | |
to { -webkit-transform: translateX(0); } | |
} | |
@-webkit-keyframes slideinfromleft { | |
from { -webkit-transform: translateX(-100%); } | |
to { -webkit-transform: translateX(0); } | |
} | |
@-webkit-keyframes slideouttoleft { | |
from { -webkit-transform: translateX(0); } | |
to { -webkit-transform: translateX(-100%); } | |
} | |
@-webkit-keyframes slideouttoright { | |
from { -webkit-transform: translateX(0); } | |
to { -webkit-transform: translateX(100%); } | |
} | |
@-webkit-keyframes slideinfromtop { | |
from { -webkit-transform: translateY(-100%); } | |
to { -webkit-transform: translateY(0); } | |
} | |
@-webkit-keyframes slideinfrombottom { | |
from { -webkit-transform: translateY(100%); } | |
to { -webkit-transform: translateY(0); } | |
} | |
@-webkit-keyframes slideouttobottom { | |
from { -webkit-transform: translateY(0); } | |
to { -webkit-transform: translateY(100%); } | |
} | |
@-webkit-keyframes slideouttotop { | |
from { -webkit-transform: translateY(0); } | |
to { -webkit-transform: translateY(-100%); } | |
} | |
@-webkit-keyframes fadein { | |
from { opacity: 0; } | |
to { opacity: 1; } | |
} | |
@-webkit-keyframes fadeout { | |
from { opacity: 1; } | |
to { opacity: 0; } | |
} | |
.fade.in { | |
opacity: 1; | |
z-index: 10; | |
-webkit-animation-name: fadein; | |
} | |
.fade.out { | |
z-index: 0; | |
-webkit-animation-name: fadeout; | |
} | |
/* The properties in this rule are only necessary for the 'flip' transition. | |
* We need specify the perspective to create a projection matrix. This will add | |
* some depth as the element flips. The depth number represents the distance of | |
* the viewer from the z-plane. According to the CSS3 spec, 1000 is a moderate | |
* value. | |
*/ | |
.viewport-flip { | |
-webkit-perspective: 1000; | |
position: absolute; | |
} | |
.ui-mobile-viewport-transitioning, | |
.ui-mobile-viewport-transitioning .ui-page { | |
width: 100%; | |
height: 100%; | |
overflow: hidden; | |
} | |
.flip { | |
-webkit-animation-duration: .65s; | |
-webkit-backface-visibility:hidden; | |
-webkit-transform:translateX(0); /* Needed to work around an iOS 3.1 bug that causes listview thumbs to disappear when -webkit-visibility:hidden is used. */ | |
} | |
.flip.in { | |
-webkit-transform: rotateY(0) scale(1); | |
-webkit-animation-name: flipinfromleft; | |
} | |
.flip.out { | |
-webkit-transform: rotateY(-180deg) scale(.8); | |
-webkit-animation-name: flipouttoleft; | |
} | |
/* Shake it all about */ | |
.flip.in.reverse { | |
-webkit-transform: rotateY(0) scale(1); | |
-webkit-animation-name: flipinfromright; | |
} | |
.flip.out.reverse { | |
-webkit-transform: rotateY(180deg) scale(.8); | |
-webkit-animation-name: flipouttoright; | |
} | |
@-webkit-keyframes flipinfromright { | |
from { -webkit-transform: rotateY(-180deg) scale(.8); } | |
to { -webkit-transform: rotateY(0) scale(1); } | |
} | |
@-webkit-keyframes flipinfromleft { | |
from { -webkit-transform: rotateY(180deg) scale(.8); } | |
to { -webkit-transform: rotateY(0) scale(1); } | |
} | |
@-webkit-keyframes flipouttoleft { | |
from { -webkit-transform: rotateY(0) scale(1); } | |
to { -webkit-transform: rotateY(-180deg) scale(.8); } | |
} | |
@-webkit-keyframes flipouttoright { | |
from { -webkit-transform: rotateY(0) scale(1); } | |
to { -webkit-transform: rotateY(180deg) scale(.8); } | |
} | |
/* Hackish, but reliable. */ | |
@-webkit-keyframes dontmove { | |
from { opacity: 1; } | |
to { opacity: 1; } | |
} | |
.pop { | |
-webkit-transform-origin: 50% 50%; | |
} | |
.pop.in { | |
-webkit-transform: scale(1); | |
opacity: 1; | |
-webkit-animation-name: popin; | |
z-index: 10; | |
} | |
.pop.out.reverse { | |
-webkit-transform: scale(.2); | |
opacity: 0; | |
-webkit-animation-name: popout; | |
z-index: 10; | |
} | |
.pop.in.reverse { | |
z-index: 0; | |
-webkit-animation-name: dontmove; | |
} | |
@-webkit-keyframes popin { | |
from { | |
-webkit-transform: scale(.2); | |
opacity: 0; | |
} | |
to { | |
-webkit-transform: scale(1); | |
opacity: 1; | |
} | |
} | |
@-webkit-keyframes popout { | |
from { | |
-webkit-transform: scale(1); | |
opacity: 1; | |
} | |
to { | |
-webkit-transform: scale(.2); | |
opacity: 0; | |
} | |
}/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
/* content configurations. */ | |
.ui-grid-a, .ui-grid-b, .ui-grid-c, .ui-grid-d { overflow: hidden; } | |
.ui-block-a, .ui-block-b, .ui-block-c, .ui-block-d, .ui-block-e { margin: 0; padding: 0; border: 0; float: left; min-height:1px;} | |
/* grid solo: 100 - single item fallback */ | |
.ui-grid-solo .ui-block-a { width: 100%; float: none; } | |
/* grid a: 50/50 */ | |
.ui-grid-a .ui-block-a, .ui-grid-a .ui-block-b { width: 50%; } | |
.ui-grid-a .ui-block-a { clear: left; } | |
/* grid b: 33/33/33 */ | |
.ui-grid-b .ui-block-a, .ui-grid-b .ui-block-b, .ui-grid-b .ui-block-c { width: 33.333%; } | |
.ui-grid-b .ui-block-a { clear: left; } | |
/* grid c: 25/25/25/25 */ | |
.ui-grid-c .ui-block-a, .ui-grid-c .ui-block-b, .ui-grid-c .ui-block-c, .ui-grid-c .ui-block-d { width: 25%; } | |
.ui-grid-c .ui-block-a { clear: left; } | |
/* grid d: 20/20/20/20/20 */ | |
.ui-grid-d .ui-block-a, .ui-grid-d .ui-block-b, .ui-grid-d .ui-block-c, .ui-grid-d .ui-block-d, .ui-grid-d .ui-block-e { width: 20%; } | |
.ui-grid-d .ui-block-a { clear: left; } | |
/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
/* fixed page header & footer configuration */ | |
.ui-header, .ui-footer, .ui-page-fullscreen .ui-header, .ui-page-fullscreen .ui-footer { position: absolute; overflow: hidden; width: 100%; border-left-width: 0; border-right-width: 0; } | |
.ui-header-fixed, .ui-footer-fixed { | |
z-index: 1000; | |
-webkit-transform: translateZ(0); /* Force header/footer rendering to go through the same rendering pipeline as native page scrolling. */ | |
} | |
.ui-footer-duplicate, .ui-page-fullscreen .ui-fixed-inline { display: none; } | |
.ui-page-fullscreen .ui-header, .ui-page-fullscreen .ui-footer { opacity: .9; } | |
/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
.ui-navbar { overflow: hidden; } | |
.ui-navbar ul, .ui-navbar-expanded ul { list-style:none; padding: 0; margin: 0; position: relative; display: block; border: 0;} | |
.ui-navbar-collapsed ul { float: left; width: 75%; margin-right: -2px; } | |
.ui-navbar-collapsed .ui-navbar-toggle { float: left; width: 25%; } | |
.ui-navbar li.ui-navbar-truncate { position: absolute; left: -9999px; top: -9999px; } | |
.ui-navbar li .ui-btn, .ui-navbar .ui-navbar-toggle .ui-btn { display: block; font-size: 12px; text-align: center; margin: 0; border-right-width: 0; } | |
.ui-navbar li .ui-btn { margin-right: -1px; } | |
.ui-navbar li .ui-btn:last-child { margin-right: 0; } | |
.ui-header .ui-navbar li .ui-btn, .ui-header .ui-navbar .ui-navbar-toggle .ui-btn, | |
.ui-footer .ui-navbar li .ui-btn, .ui-footer .ui-navbar .ui-navbar-toggle .ui-btn { border-top-width: 0; border-bottom-width: 0; } | |
.ui-navbar .ui-btn-inner { padding-left: 2px; padding-right: 2px; } | |
.ui-navbar-noicons li .ui-btn .ui-btn-inner, .ui-navbar-noicons .ui-navbar-toggle .ui-btn-inner { padding-top: .8em; padding-bottom: .9em; } | |
/*expanded page styles*/ | |
.ui-navbar-expanded .ui-btn { margin: 0; font-size: 14px; } | |
.ui-navbar-expanded .ui-btn-inner { padding-left: 5px; padding-right: 5px; } | |
.ui-navbar-expanded .ui-btn-icon-top .ui-btn-inner { padding: 45px 5px 15px; text-align: center; } | |
.ui-navbar-expanded .ui-btn-icon-top .ui-icon { top: 15px; } | |
.ui-navbar-expanded .ui-btn-icon-bottom .ui-btn-inner { padding: 15px 5px 45px; text-align: center; } | |
.ui-navbar-expanded .ui-btn-icon-bottom .ui-icon { bottom: 15px; } | |
.ui-navbar-expanded li .ui-btn .ui-btn-inner { min-height: 2.5em; } | |
.ui-navbar-expanded .ui-navbar-noicons .ui-btn .ui-btn-inner { padding-top: 1.8em; padding-bottom: 1.9em; } | |
/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
.ui-btn { display: block; text-align: center; cursor:pointer; position: relative; margin: .5em 5px; padding: 0; } | |
.ui-btn:focus, .ui-btn:active { outline: none; } | |
.ui-header .ui-btn, .ui-footer .ui-btn, .ui-bar .ui-btn { display: inline-block; font-size: 13px; margin: 0; } | |
.ui-btn-inline { display: inline-block; } | |
.ui-btn-inner { padding: .6em 25px; display: block; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; position: relative; zoom: 1; } | |
.ui-header .ui-btn-inner, .ui-footer .ui-btn-inner, .ui-bar .ui-btn-inner { padding: .4em 8px .5em; } | |
.ui-btn-icon-notext { display: inline-block; width: 20px; height: 20px; padding: 2px 1px 2px 3px; text-indent: -9999px; } | |
.ui-btn-icon-notext .ui-btn-inner { padding: 0; } | |
.ui-btn-icon-notext .ui-btn-text { position: absolute; left: -999px; } | |
.ui-btn-icon-left .ui-btn-inner { padding-left: 33px; } | |
.ui-header .ui-btn-icon-left .ui-btn-inner, | |
.ui-footer .ui-btn-icon-left .ui-btn-inner, | |
.ui-bar .ui-btn-icon-left .ui-btn-inner { padding-left: 27px; } | |
.ui-btn-icon-right .ui-btn-inner { padding-right: 33px; } | |
.ui-header .ui-btn-icon-right .ui-btn-inner, | |
.ui-footer .ui-btn-icon-right .ui-btn-inner, | |
.ui-bar .ui-btn-icon-right .ui-btn-inner { padding-right: 27px; } | |
.ui-btn-icon-top .ui-btn-inner { padding-top: 33px; } | |
.ui-header .ui-btn-icon-top .ui-btn-inner, | |
.ui-footer .ui-btn-icon-top .ui-btn-inner, | |
.ui-bar .ui-btn-icon-top .ui-btn-inner { padding-top: 27px; } | |
.ui-btn-icon-bottom .ui-btn-inner { padding-bottom: 33px; } | |
.ui-header .ui-btn-icon-bottom .ui-btn-inner, | |
.ui-footer .ui-btn-icon-bottom .ui-btn-inner, | |
.ui-bar .ui-btn-icon-bottom .ui-btn-inner { padding-bottom: 27px; } | |
/*btn icon positioning*/ | |
.ui-btn-icon-notext .ui-icon { display: block; } | |
.ui-btn-icon-left .ui-icon, .ui-btn-icon-right .ui-icon { position: absolute; top: 50%; margin-top: -9px; } | |
.ui-btn-icon-top .ui-icon, .ui-btn-icon-bottom .ui-icon { position: absolute; left: 50%; margin-left: -9px; } | |
.ui-btn-icon-left .ui-icon { left: 10px; } | |
.ui-btn-icon-right .ui-icon {right: 10px; } | |
.ui-header .ui-btn-icon-left .ui-icon, | |
.ui-footer .ui-btn-icon-left .ui-icon, | |
.ui-bar .ui-btn-icon-left .ui-icon { left: 4px; } | |
.ui-header .ui-btn-icon-right .ui-icon, | |
.ui-footer .ui-btn-icon-right .ui-icon, | |
.ui-bar .ui-btn-icon-right .ui-icon { right: 4px; } | |
.ui-header .ui-btn-icon-top .ui-icon, | |
.ui-footer .ui-btn-icon-top .ui-icon, | |
.ui-bar .ui-btn-icon-top .ui-icon { top: 4px; } | |
.ui-header .ui-btn-icon-bottom .ui-icon, | |
.ui-footer .ui-btn-icon-bottom .ui-icon, | |
.ui-bar .ui-btn-icon-bottom .ui-icon { bottom: 4px; } | |
.ui-btn-icon-top .ui-icon { top: 5px; } | |
.ui-btn-icon-bottom .ui-icon { bottom: 5px; } | |
/*hiding native button,inputs */ | |
.ui-btn-hidden { position: absolute; top: 0; left: 0; width: 100%; height: 100%; -webkit-appearance: button; opacity: 0; cursor: pointer; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter: alpha(opacity=0); background: transparent; } | |
/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
.ui-collapsible-contain { margin: .5em 0; } | |
.ui-collapsible-heading { font-size: 16px; display: block; margin: 0 -8px; padding: 0; border-width: 0 0 1px 0; position: relative; } | |
.ui-collapsible-heading a { text-align: left; margin: 0; } | |
.ui-collapsible-heading a .ui-btn-inner { padding-left: 40px; } | |
.ui-collapsible-heading a span.ui-btn { position: absolute; left: 6px; top: 50%; margin: -12px 0 0 0; width: 20px; height: 20px; padding: 1px 0px 1px 2px; text-indent: -9999px; } | |
.ui-collapsible-heading a span.ui-btn .ui-btn-inner { padding: 10px 0; } | |
.ui-collapsible-heading a span.ui-btn .ui-icon { left: 0; margin-top: -10px; } | |
.ui-collapsible-heading-status { position:absolute; left:-9999px; } | |
.ui-collapsible-content { display: block; padding: 10px 0 10px 8px; } | |
.ui-collapsible-content-collapsed { display: none; } | |
.ui-collapsible-set { margin: .5em 0; } | |
.ui-collapsible-set .ui-collapsible-contain { margin: -1px 0 0; } | |
/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
.ui-controlgroup, fieldset.ui-controlgroup { padding: 0; margin: .5em 0 1em; } | |
.ui-bar .ui-controlgroup { margin: 0 .3em; } | |
.ui-controlgroup-label { font-size: 16px; line-height: 1.4; font-weight: normal; margin: 0 0 .3em; } | |
.ui-controlgroup-controls { display: block; width: 95%;} | |
.ui-controlgroup li { list-style: none; } | |
.ui-controlgroup-vertical .ui-btn, | |
.ui-controlgroup-vertical .ui-checkbox, .ui-controlgroup-vertical .ui-radio { margin: 0; border-bottom-width: 0; } | |
.ui-controlgroup-vertical .ui-controlgroup-last { border-bottom-width: 1px; } | |
.ui-controlgroup-horizontal { padding: 0; } | |
.ui-controlgroup-horizontal .ui-btn, | |
.ui-controlgroup-horizontal .ui-checkbox, .ui-controlgroup-horizontal .ui-radio { display: inline-block; margin: 0 -5px 0 0; } | |
.ui-controlgroup-horizontal .ui-checkbox, .ui-controlgroup-horizontal .ui-radio { display: inline; } | |
.ui-controlgroup-horizontal .ui-checkbox .ui-btn, .ui-controlgroup-horizontal .ui-radio .ui-btn, | |
.ui-controlgroup-horizontal .ui-checkbox:last-child, .ui-controlgroup-horizontal .ui-radio:last-child { margin-right: 0; } | |
.ui-controlgroup-horizontal .ui-controlgroup-last { margin-right: 0; } | |
.ui-controlgroup .ui-checkbox label, .ui-controlgroup .ui-radio label { font-size: 16px; } | |
/* conflicts with listview.. | |
.ui-controlgroup .ui-btn-icon-notext { width: 30px; height: 30px; text-indent: -9999px; } | |
.ui-controlgroup .ui-btn-icon-notext .ui-btn-inner { padding: 5px 6px 5px 5px; } | |
*/ | |
@media all and (min-width: 450px){ | |
.ui-controlgroup-label { vertical-align: top; display: inline-block; width: 20%; margin: 0 2% 0 0; } | |
.ui-controlgroup-controls { width: 60%; display: inline-block; } | |
} /* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
.ui-dialog { min-height: 480px; } | |
.ui-dialog .ui-header, .ui-dialog .ui-content, .ui-dialog .ui-footer { margin: 15px; position: relative; } | |
.ui-dialog .ui-header, .ui-dialog .ui-footer { z-index: 10; width: auto; } | |
.ui-dialog .ui-content, .ui-dialog .ui-footer { margin-top: -15px; }/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
.ui-checkbox, .ui-radio { position:relative; margin: .2em 0 .5em; z-index: 1; } | |
.ui-checkbox .ui-btn, .ui-radio .ui-btn { margin: 0; text-align: left; z-index: 2; } | |
.ui-checkbox .ui-btn-inner, .ui-radio .ui-btn-inner { white-space: normal; } | |
.ui-checkbox .ui-btn-icon-left .ui-btn-inner,.ui-radio .ui-btn-icon-left .ui-btn-inner { padding-left: 45px; } | |
.ui-checkbox .ui-btn-icon-right .ui-btn-inner, .ui-radio .ui-btn-icon-right .ui-btn-inner { padding-right: 45px; } | |
.ui-checkbox .ui-icon, .ui-radio .ui-icon { top: 1.1em; } | |
.ui-checkbox .ui-btn-icon-left .ui-icon, .ui-radio .ui-btn-icon-left .ui-icon {left: 15px; } | |
.ui-checkbox .ui-btn-icon-right .ui-icon, .ui-radio .ui-btn-icon-right .ui-icon {right: 15px; } | |
/* input, label positioning */ | |
.ui-checkbox input,.ui-radio input { position:absolute; left:20px; top:50%; width: 10px; height: 10px; margin:-5px 0 0 0; outline: 0 !important; z-index: 1; }/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
.ui-field-contain { padding: 1.5em 0; margin: 0; border-bottom-width: 1px; overflow: visible; } | |
.ui-field-contain:first-child { border-top-width: 0; } | |
@media all and (min-width: 450px){ | |
.ui-field-contain { border-width: 0; padding: 0; margin: 1em 0; } | |
} /* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
.ui-select { display: block; position: relative; } | |
.ui-select select { position: absolute; left: -9999px; top: -9999px; } | |
.ui-select .ui-btn { overflow: hidden; } | |
.ui-select .ui-btn select { cursor: pointer; -webkit-appearance: button; left: 0; top:0; width: 100%; height: 100%; opacity: 0; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter: alpha(opacity=0); } | |
@-moz-document url-prefix() {.ui-select .ui-btn select { opacity: 0.0001; }} | |
.ui-select .ui-btn select.ui-select-nativeonly { opacity: 1; text-indent: 0; } | |
.ui-select .ui-btn-icon-right .ui-btn-inner { padding-right: 45px; } | |
.ui-select .ui-btn-icon-right .ui-icon { right: 15px; } | |
/* labels */ | |
label.ui-select { font-size: 16px; line-height: 1.4; font-weight: normal; margin: 0 0 .3em; display: block; } | |
/*listbox*/ | |
.ui-select .ui-btn-text, .ui-selectmenu .ui-btn-text { display: block; min-height: 1em; } | |
.ui-select .ui-btn-text { text-overflow: ellipsis; overflow: hidden;} | |
.ui-selectmenu { position: absolute; padding: 0; z-index: 100 !important; width: 80%; max-width: 350px; padding: 6px; } | |
.ui-selectmenu .ui-listview { margin: 0; } | |
.ui-selectmenu .ui-btn.ui-li-divider { cursor: default; } | |
.ui-selectmenu-hidden { top: -9999px; left: -9999px; } | |
.ui-selectmenu-screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 99; } | |
.ui-screen-hidden, .ui-selectmenu-list .ui-li .ui-icon { display: none; } | |
.ui-selectmenu-list .ui-li .ui-icon { display: block; } | |
.ui-li.ui-selectmenu-placeholder { display: none; } | |
.ui-selectmenu .ui-header .ui-title { margin: 0.6em 46px 0.8em; } | |
@media all and (min-width: 450px){ | |
label.ui-select { display: inline-block; width: 20%; margin: 0 2% 0 0; } | |
.ui-select { width: 60%; display: inline-block; } | |
} | |
/* when no placeholder is defined in a multiple select, the header height doesn't even extend past the close button. this shim's content in there */ | |
.ui-selectmenu .ui-header h1:after { content: '.'; visibility: hidden; }/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
label.ui-input-text { font-size: 16px; line-height: 1.4; display: block; font-weight: normal; margin: 0 0 .3em; } | |
input.ui-input-text, textarea.ui-input-text { background-image: none; padding: .4em; line-height: 1.4; font-size: 16px; display: block; width: 95%; } | |
input.ui-input-text { -webkit-appearance: none; } | |
textarea.ui-input-text { height: 50px; -webkit-transition: height 200ms linear; -moz-transition: height 200ms linear; -o-transition: height 200ms linear; transition: height 200ms linear; } | |
.ui-input-search { padding: 0 30px; width: 77%; background-position: 8px 50%; background-repeat: no-repeat; position: relative; } | |
.ui-input-search input.ui-input-text { border: none; width: 98%; padding: .4em 0; margin: 0; display: block; background: transparent none; outline: 0 !important; } | |
.ui-input-search .ui-input-clear { position: absolute; right: 0; top: 50%; margin-top: -14px; } | |
.ui-input-search .ui-input-clear-hidden { display: none; } | |
/* orientation adjustments - incomplete!*/ | |
@media all and (min-width: 450px){ | |
label.ui-input-text { vertical-align: top; display: inline-block; width: 20%; margin: 0 2% 0 0 } | |
input.ui-input-text, | |
textarea.ui-input-text, | |
.ui-input-search { width: 60%; display: inline-block; } | |
.ui-input-search { width: 50%; } | |
.ui-input-search input.ui-input-text { width: 98%; /*echos rule from above*/ } | |
}/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
.ui-listview { margin: 0; counter-reset: listnumbering; } | |
.ui-content .ui-listview { margin: -15px; } | |
.ui-content .ui-listview-inset { margin: 1em 0; } | |
.ui-listview, .ui-li { list-style:none; padding:0; } | |
.ui-li, .ui-li.ui-field-contain { display: block; margin:0; position: relative; overflow: visible; text-align: left; border-width: 0; border-top-width: 1px; } | |
.ui-li .ui-btn-text a.ui-link-inherit { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; } | |
.ui-li-divider, .ui-li-static { padding: .5em 15px; font-size: 14px; font-weight: bold; } | |
.ui-li-divider { counter-reset: listnumbering; } | |
ol.ui-listview .ui-link-inherit:before, ol.ui-listview .ui-li-static:before, .ui-li-dec { font-size: .8em; display: inline-block; padding-right: .3em; font-weight: normal;counter-increment: listnumbering; content: counter(listnumbering) ". "; } | |
ol.ui-listview .ui-li-jsnumbering:before { content: "" !important; } /* to avoid chance of duplication */ | |
.ui-listview-inset .ui-li { border-right-width: 1px; border-left-width: 1px; } | |
.ui-li:last-child, .ui-li.ui-field-contain:last-child { border-bottom-width: 1px; } | |
.ui-li>.ui-btn-inner { display: block; position: relative; padding: 0; } | |
.ui-li .ui-btn-inner a.ui-link-inherit, .ui-li-static.ui-li { padding: .7em 75px .7em 15px; display: block; } | |
.ui-li-has-thumb .ui-btn-inner a.ui-link-inherit, .ui-li-static.ui-li-has-thumb { min-height: 60px; padding-left: 100px; } | |
.ui-li-has-icon .ui-btn-inner a.ui-link-inherit, .ui-li-static.ui-li-has-icon { min-height: 20px; padding-left: 40px; } | |
.ui-li-heading { font-size: 16px; font-weight: bold; display: block; margin: .6em 0; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; } | |
.ui-li-desc { font-size: 12px; font-weight: normal; display: block; margin: -.5em 0 .6em; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; } | |
.ui-li-thumb, .ui-li-icon { position: absolute; left: 1px; top: 0; max-height: 80px; max-width: 80px; } | |
.ui-li-icon { max-height: 40px; max-width: 40px; left: 10px; top: .9em; } | |
.ui-li-thumb, .ui-li-icon, .ui-li-content { float: left; margin-right: 10px; } | |
.ui-li-aside { float: right; width: 50%; text-align: right; margin: .3em 0; } | |
@media all and (min-width: 480px){ | |
.ui-li-aside { width: 45%; } | |
} | |
.ui-li-divider { cursor: default; } | |
.ui-li-has-alt .ui-btn-inner a.ui-link-inherit, .ui-li-static.ui-li-has-alt { padding-right: 95px; } | |
.ui-li-count { position: absolute; font-size: 11px; font-weight: bold; padding: .2em .5em; top: 50%; margin-top: -.9em; right: 38px; } | |
.ui-li-divider .ui-li-count, .ui-li-static .ui-li-count { right: 10px; } | |
.ui-li-has-alt .ui-li-count { right: 55px; } | |
.ui-li-link-alt { position: absolute; width: 40px; height: 100%; border-width: 0; border-left-width: 1px; top: 0; right: 0; margin: 0; padding: 0; } | |
.ui-li-link-alt .ui-btn { overflow: hidden; position: absolute; right: 8px; top: 50%; margin: -11px 0 0 0; border-bottom-width: 1px; } | |
.ui-li-link-alt .ui-btn-inner { padding: 0; position: static; } | |
.ui-li-link-alt .ui-btn .ui-icon { right: 50%; margin-right: -9px; } | |
.ui-listview-filter { border-width: 0; overflow: hidden; margin: -15px -15px 15px -15px } | |
.ui-listview-filter .ui-input-search { margin: 5px; width: auto; display: block; } | |
.ui-listview-filter-inset { margin: -15px -5px -15px -5px; background: transparent; } | |
.ui-li.ui-screen-hidden{display:none;} | |
/* Odd iPad positioning issue. */ | |
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) { | |
.ui-li .ui-btn-text { overflow: visible; } | |
}/* | |
* jQuery Mobile Framework | |
* Copyright (c) jQuery Project | |
* Dual licensed under the MIT (MIT-LICENSE.txt) or GPL (GPL-LICENSE.txt) licenses. | |
*/ | |
label.ui-slider { display: block; } | |
input.ui-slider-input { display: inline-block; width: 50px; } | |
select.ui-slider-switch { display: none; } | |
div.ui-slider { position: relative; display: inline-block; overflow: visible; height: 15px; padding: 0; margin: 0 2% 0 20px; top: 4px; width: 66%; } | |
a.ui-slider-handle { position: absolute; z-index: 10; top: 50%; width: 28px; height: 28px; margin-top: -15px; margin-left: -15px; } | |
a.ui-slider-handle .ui-btn-inner { padding-left: 0; padding-right: 0; } | |
@media all and (min-width: 480px){ | |
label.ui-slider { display: inline-block; width: 20%; margin: 0 2% 0 0; } | |
div.ui-slider { width: 45%; } | |
} | |
div.ui-slider-switch { height: 32px; overflow: hidden; margin-left: 0; } | |
div.ui-slider-inneroffset { margin-left: 50%; position: absolute; top: 1px; height: 100%; width: 50%; } | |
div.ui-slider-handle-snapping { -webkit-transition: left 100ms linear; } | |
div.ui-slider-labelbg { position: absolute; top:0; margin: 0; border-width: 0; } | |
div.ui-slider-switch div.ui-slider-labelbg-a { width: 60%; height: 100%; left: 0; } | |
div.ui-slider-switch div.ui-slider-labelbg-b { width: 60%; height: 100%; right: 0; } | |
.ui-slider-switch-a div.ui-slider-labelbg-a, .ui-slider-switch-b div.ui-slider-labelbg-b { z-index: -1; } | |
.ui-slider-switch-a div.ui-slider-labelbg-b, .ui-slider-switch-b div.ui-slider-labelbg-a { z-index: 0; } | |
div.ui-slider-switch a.ui-slider-handle { z-index: 20; width: 101%; height: 32px; margin-top: -18px; margin-left: -101%; } | |
span.ui-slider-label { width: 100%; position: absolute;height: 32px; font-size: 16px; text-align: center; line-height: 2; background: none; border-color: transparent; } | |
span.ui-slider-label-a { left: -100%; margin-right: -1px } | |
span.ui-slider-label-b { right: -100%; margin-left: -1px } | |
<?php | |
header('Content-type: text/css'); | |
ob_start("compress"); | |
function compress($buffer) { | |
/* remove comments */ | |
$buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer); | |
/* remove tabs, spaces, newlines, etc. */ | |
$buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $buffer); | |
return $buffer; | |
} | |
echo ' | |
.ui-li-thumb, .ui-li-icon { position: relative; } | |
.ui-navbar { | |
width: 100%; | |
} | |
.ui-btn-inner { | |
white-space: normal !important; | |
} | |
.ui-li-heading { | |
white-space: normal !important; | |
} | |
.ui-listview-filter { | |
margin: 0 !important; | |
} | |
.ui-icon-navigation { | |
background-image: url(images/113-navigation.png); | |
background-position: 1px 0; | |
} | |
.ui-icon-beaker { | |
background-image: url(images/91-beaker-2.png); | |
background-position: 1px 0; | |
} | |
#footer { | |
text-size: 0.75em; | |
text-align: center; | |
} | |
body { | |
background-color: #F0F0F0; | |
} | |
#jqm-homeheader { | |
text-align: center; | |
} | |
.viaPoints { | |
display: none; | |
text-size: 0.2em; | |
} | |
.min-width-480px .viaPoints { | |
display: inline; | |
} | |
#extrainfo { | |
visibility: hidden; | |
display: none; | |
} | |
#servicewarning { | |
padding: 1em; | |
margin-bottom: 0.5em; | |
text-size: 0.2em; | |
background-color: #FF9; | |
-moz-border-radius: 15px; | |
border-radius: 15px; | |
} | |
#footer { | |
clear:both; | |
text-align:center; | |
} | |
// source http://webaim.org/techniques/skipnav/ | |
#skip a, #skip a:hover, #skip a:visited | |
{ | |
position:absolute; | |
left:0px; | |
top:-500px; | |
width:1px; | |
height:1px; | |
overflow:hidden; | |
} | |
#skip a:active, #skip a:focus | |
{ | |
position:static; | |
width:auto; | |
height:auto; | |
}'; | |
//if (false) | |
echo ' | |
// adaptive layout from jQuery Mobile docs site | |
.type-interior .content-secondary { | |
border-right: 0; | |
border-left: 0; | |
margin: 10px -15px 0; | |
background: #fff; | |
border-top: 1px solid #ccc; | |
} | |
.type-home .ui-content { | |
margin-top: 5px; | |
} | |
.type-interior .ui-content { | |
padding-bottom: 0; | |
} | |
.content-secondary .ui-collapsible-contain { | |
padding: 10px 15px; | |
} | |
.content-secondary .ui-collapsible-heading { | |
margin: 0 0 30px; | |
} | |
.content-secondary .ui-collapsible-heading-collapsed, | |
.content-secondary .ui-collapsible-content { | |
padding:0; | |
margin: 0; | |
} | |
@media all and (min-width: 650px){ | |
.content-secondary { | |
text-align: left; | |
float: left; | |
width: 45%; | |
background: none; | |
border-top: 0; | |
} | |
.content-secondary, | |
.type-interior .content-secondary { | |
margin: 30px 0 20px 2%; | |
padding: 20px 4% 0 0; | |
background: none; | |
} | |
.type-index .content-secondary { | |
padding: 0; | |
} | |
.type-index .content-secondary .ui-listview { | |
margin: 0; | |
} | |
.content-primary { | |
width: 45%; | |
float: right; | |
margin-top: 30px; | |
margin-right: 1%; | |
padding-right: 1%; | |
} | |
.content-primary ul:first-child { | |
margin-top: 0; | |
} | |
.type-interior .content-primary { | |
padding: 1.5em 6% 3em 0; | |
margin: 0; | |
} | |
/* fix up the collapsibles - expanded on desktop */ | |
.content-secondary .ui-collapsible-heading { | |
display: none; | |
} | |
.content-secondary .ui-collapsible-contain { | |
margin:0; | |
} | |
.content-secondary .ui-collapsible-content { | |
display: block; | |
margin: 0; | |
padding: 0; | |
} | |
.type-interior .content-secondary .ui-li-divider { | |
padding-top: 1em; | |
padding-bottom: 1em; | |
} | |
.type-interior .content-secondary { | |
margin: 0; | |
padding: 0; | |
} | |
} | |
@media all and (min-width: 750px){ | |
.type-home .ui-content, | |
.type-interior .ui-content { | |
background-position: 39%; | |
} | |
.content-secondary { | |
width: 34%; | |
} | |
.content-primary { | |
width: 56%; | |
padding-right: 1%; | |
} | |
.type-interior .ui-content { | |
background-position: 34%; | |
} | |
} | |
@media all and (min-width: 1200px){ | |
.type-home .ui-content{ | |
background-position: 38.5%; | |
} | |
.type-interior .ui-content { | |
background-position: 30%; | |
} | |
.content-secondary { | |
width: 30%; | |
padding-right:6%; | |
margin: 30px 0 20px 5%; | |
} | |
.type-interior .content-secondary { | |
margin: 0; | |
padding: 0; | |
} | |
.content-primary { | |
width: 50%; | |
margin-right: 5%; | |
padding-right: 3%; | |
} | |
.type-interior .content-primary { | |
width: 60%; | |
} | |
}'; | |
ob_end_flush(); | |
?> | |
#!/bin/bash | #!/bin/bash |
#dotcloud postinstall | #dotcloud postinstall |
curl http://s3-ap-southeast-1.amazonaws.com/busresources/cbrfeed.zip \ | curl http://s3-ap-southeast-1.amazonaws.com/busresources/cbrfeed.zip \ |
-o /home/dotcloud/current/cbrfeed.zip | -o /home/dotcloud/current/cbrfeed.zip |
wget http://s3-ap-southeast-1.amazonaws.com/busresources/Graph.obj \ | curl http://s3-ap-southeast-1.amazonaws.com/busresources/Graph.obj \ |
-O /tmp/Graph.obj | -o /tmp/Graph.obj |
#db setup | #db setup |
#curl https://github.com/maxious/ACTBus-ui/raw/master/transitdata.cbrfeed.sql.gz -o transitdata.cbrfeed.sql.gz | #curl https://github.com/maxious/ACTBus-ui/raw/master/transitdata.cbrfeed.sql.gz -o transitdata.cbrfeed.sql.gz |
#curl https://github.com/maxious/ACTBus-ui/raw/master/lib/postgis.sql -o postgis.sql | #curl https://github.com/maxious/ACTBus-ui/raw/master/lib/postgis.sql -o postgis.sql |
#createlang -d transitdata plpgsql | #createlang -d transitdata plpgsql |
#psql -d transitdata -f postgis.sql | #psql -d transitdata -f postgis.sql |
#gunzip /var/www/transitdata.cbrfeed.sql.gz | #gunzip /var/www/transitdata.cbrfeed.sql.gz |
#psql -d transitdata -f transitdata.cbrfeed.sql | #psql -d transitdata -f transitdata.cbrfeed.sql |
#createuser transitdata -SDRP | #createuser transitdata -SDRP |
#password transitdata | #password transitdata |
#psql -c \"GRANT SELECT ON TABLE agency,calendar,calendar_dates,routes,stop_times,stops,trips TO transitdata;\" | #psql -c \"GRANT SELECT ON TABLE agency,calendar,calendar_dates,routes,stop_times,stops,trips TO transitdata;\" |
<?php | <?php |
// SELECT array_to_string(array(SELECT REPLACE(name_2006, ',', '\,') as name FROM suburbs order by name), ',') | // SELECT array_to_string(array(SELECT REPLACE(name_2006, ',', '\,') as name FROM suburbs order by name), ',') |
$suburbs = explode(",", "Acton,Ainslie,Amaroo,Aranda,Banks,Barton,Belconnen,Bonner,Bonython,Braddon,Bruce,Calwell,Campbell,Chapman,Charnwood,Chifley,Chisholm,City,Conder,Cook,Curtin,Deakin,Dickson,Downer,Duffy,Dunlop,Evatt,Fadden,Farrer,Fisher,Florey,Flynn,Forrest,Franklin,Fraser,Fyshwick,Garran,Gilmore,Giralang,Gordon,Gowrie,Greenway,Griffith,Gungahlin,Hackett,Hall,Harrison,Hawker,Higgins,Holder,Holt,Hughes,Hume,Isaacs,Isabella Plains,Kaleen,Kambah,Kingston,Latham,Lawson,Lyneham,Lyons,Macarthur,Macgregor,Macquarie,Mawson,McKellar,Melba,Mitchell,Monash,Narrabundah,Ngunnawal,Nicholls,Oaks Estate,O'Connor,O'Malley,Oxley,Page,Palmerston,Parkes,Pearce,Phillip,Pialligo,Red Hill,Reid,Richardson,Rivett,Russell,Scullin,Spence,Stirling,Symonston,Tharwa,Theodore,Torrens,Turner,Wanniassa,Waramanga,Watson,Weetangera,Weston,Yarralumla"); | $suburbs = explode(",", "Acton,Ainslie,Amaroo,Aranda,Banks,Barton,Belconnen,Bonner,Bonython,Braddon,Bruce,Calwell,Campbell,Chapman,Charnwood,Chifley,Chisholm,City,Conder,Cook,Curtin,Deakin,Dickson,Downer,Duffy,Dunlop,Evatt,Fadden,Farrer,Fisher,Florey,Flynn,Forrest,Franklin,Fraser,Fyshwick,Garran,Gilmore,Giralang,Gordon,Gowrie,Greenway,Griffith,Gungahlin,Hackett,Hall,Harrison,Hawker,Higgins,Holder,Holt,Hughes,Hume,Isaacs,Isabella Plains,Kaleen,Kambah,Kingston,Latham,Lawson,Lyneham,Lyons,Macarthur,Macgregor,Macquarie,Mawson,McKellar,Melba,Mitchell,Monash,Narrabundah,Ngunnawal,Nicholls,Oaks Estate,O'Connor,O'Malley,Oxley,Page,Palmerston,Parkes,Pearce,Phillip,Pialligo,Red Hill,Reid,Richardson,Rivett,Russell,Scullin,Spence,Stirling,Symonston,Tharwa,Theodore,Torrens,Turner,Wanniassa,Waramanga,Watson,Weetangera,Weston,Yarralumla"); |
function staticmap($mapPoints, $zoom = 0, $markerImage = "iconb", $collapsible = true) | function staticmap($mapPoints, $zoom = 0, $markerImage = "iconb", $collapsible = true, $twotone = false) |
{ | { |
global $labsPath; | |
$width = 300; | $width = 300; |
$height = 300; | $height = 300; |
$metersperpixel[9] = 305.492 * $width; | $metersperpixel[9] = 305.492 * $width; |
$metersperpixel[10] = 152.746 * $width; | $metersperpixel[10] = 152.746 * $width; |
$metersperpixel[11] = 76.373 * $width; | $metersperpixel[11] = 76.373 * $width; |
$metersperpixel[12] = 38.187 * $width; | $metersperpixel[12] = 38.187 * $width; |
$metersperpixel[13] = 19.093 * $width; | $metersperpixel[13] = 19.093 * $width; |
$metersperpixel[14] = 9.547 * $width; | $metersperpixel[14] = 9.547 * $width; |
$metersperpixel[15] = 4.773 * $width; | $metersperpixel[15] = 4.773 * $width; |
$metersperpixel[16] = 2.387 * $width; | //$metersperpixel[16] = 2.387 * $width; |
// $metersperpixel[17]=1.193*$width; | // $metersperpixel[17]=1.193*$width; |
$center = ""; | $center = ""; |
$markers = ""; | $markers = ""; |
$minlat = 999; | $mapwidthinmeters = 50; |
$minlon = 999; | |
$maxlat = 0; | |
$maxlon = 0; | |
if (sizeof($mapPoints) < 1) return "map error"; | if (sizeof($mapPoints) < 1) return "map error"; |
if (sizeof($mapPoints) === 1) { | if (sizeof($mapPoints) === 1) { |
if ($zoom == 0) $zoom = 14; | if ($zoom == 0) $zoom = 14; |
$markers.= "{$mapPoints[0][0]},{$mapPoints[0][1]},$markerimage"; | $markers.= "{$mapPoints[0][0]},{$mapPoints[0][1]},$markerimage"; |
$center = "{$mapPoints[0][0]},{$mapPoints[0][1]}"; | $center = "{$mapPoints[0][0]},{$mapPoints[0][1]}"; |
} | } |
else { | else { |
foreach ($mapPoints as $index => $mapPoint) { | foreach ($mapPoints as $index => $mapPoint) { |
$markers.= $mapPoint[0] . "," . $mapPoint[1] . "," . $markerImage . ($index + 1); | if ($twotone && $index == 0) { |
$markers.= $mapPoint[0] . "," . $mapPoint[1] . "," . "iconr" . ($index + 1); | |
$center = "{$mapPoints[0][0]},{$mapPoints[0][1]}"; | |
} | |
else { | |
$markers.= $mapPoint[0] . "," . $mapPoint[1] . "," . $markerImage . ($index + 1); | |
} | |
if ($index + 1 != sizeof($mapPoints)) $markers.= "|"; | if ($index + 1 != sizeof($mapPoints)) $markers.= "|"; |
if ($mapPoint[0] < $minlat) $minlat = $mapPoint[0]; | $dist = distance($mapPoints[0][0], $mapPoint[0][1], $mapPoint[0], $mapPoint[1]); |
if ($mapPoint[0] > $maxlat) $maxlat = $mapPoint[0]; | $mapwidthinmeters = ($dist > $mapwidthinmeters ? $dist : $mapwidthinmeters); |
if ($mapPoint[1] < $minlon) $minlon = $mapPoint[1]; | |
if ($mapPoint[1] > $maxlon) $maxlon = $mapPoint[1]; | |
$totalLat+= $mapPoint[0]; | $totalLat+= $mapPoint[0]; |
$totalLon+= $mapPoint[1]; | $totalLon+= $mapPoint[1]; |
} | } |
if ($zoom == 0) { | if ($zoom == 0) { |
$mapwidthinmeters = distance($minlat, $minlon, $minlat, $maxlon); | $mapwidthinmeters = distance($minlat, $minlon, $minlat, $maxlon); |
foreach (array_reverse($metersperpixel, true) as $zoomLevel => $maxdistance) { | foreach (array_reverse($metersperpixel, true) as $zoomLevel => $maxdistance) { |
if ($zoom == 0 && $mapwidthinmeters < ($maxdistance + 50)) $zoom = $zoomLevel; | if ($zoom == 0 && $mapwidthinmeters * 1.5 < ($maxdistance)) $zoom = $zoomLevel; |
} | } |
} | } |
$center = $totalLat / sizeof($mapPoints) . "," . $totalLon / sizeof($mapPoints); | $center = $totalLat / sizeof($mapPoints) . "," . $totalLon / sizeof($mapPoints); |
} | } |
$output = ""; | $output = ""; |
if ($collapsible) $output.= '<div class="map" data-role="collapsible" data-collapsed="true"><h3>Open Map...</h3>'; | if ($collapsible) $output.= '<div class="map" data-role="collapsible" data-collapsed="true"><h3>Open Map...</h3>'; |
$output.= '<img class="map" src="' . curPageURL() . '/lib/staticmaplite/staticmap.php?center=' . $center . '&zoom=' . $zoom . '&size=' . $width . 'x' . $height . '&markers=' . | $output.= '<img class="map" src="' . curPageURL() . '/' . $labsPath . '/lib/staticmaplite/staticmap.php?center=' . $center . '&zoom=' . $zoom . '&size=' . $width . 'x' . $height . '&markers=' . $markers . '" width=' . $width . ' height=' . $height . '>'; |
$markers . '" width=' . $width . ' height=' . $height . '>'; | |
if ($collapsible) $output.= '</div>'; | if ($collapsible) $output.= '</div>'; |
return $output; | return $output; |
} | } |
function distance($lat1, $lng1, $lat2, $lng2, $roundLargeValues = false) | function distance($lat1, $lng1, $lat2, $lng2, $roundLargeValues = false) |
{ | { |
$pi80 = M_PI / 180; | $pi80 = M_PI / 180; |
$lat1*= $pi80; | $lat1*= $pi80; |
$lng1*= $pi80; | $lng1*= $pi80; |
$lat2*= $pi80; | $lat2*= $pi80; |
$lng2*= $pi80; | $lng2*= $pi80; |
$r = 6372.797; // mean radius of Earth in km | $r = 6372.797; // mean radius of Earth in km |
$dlat = $lat2 - $lat1; | $dlat = $lat2 - $lat1; |
$dlng = $lng2 - $lng1; | $dlng = $lng2 - $lng1; |
$a = sin($dlat / 2) * sin($dlat / 2) + cos($lat1) * cos($lat2) * sin($dlng / 2) * sin($dlng / 2); | $a = sin($dlat / 2) * sin($dlat / 2) + cos($lat1) * cos($lat2) * sin($dlng / 2) * sin($dlng / 2); |
$c = 2 * atan2(sqrt($a) , sqrt(1 - $a)); | $c = 2 * atan2(sqrt($a) , sqrt(1 - $a)); |
$km = $r * $c; | $km = $r * $c; |
if ($roundLargeValues) { | if ($roundLargeValues) { |
if ($km < 1) return floor($km * 1000); | if ($km < 1) return floor($km * 1000); |
else return round($km,2)."k"; | else return round($km, 2) . "k"; |
} else return floor($km * 1000); | } |
else return floor($km * 1000); | |
} | } |
function decodePolylineToArray($encoded) | function decodePolylineToArray($encoded) |
{ | { |
// source: http://latlongeeks.com/forum/viewtopic.php?f=4&t=5 | // source: http://latlongeeks.com/forum/viewtopic.php?f=4&t=5 |
$length = strlen($encoded); | $length = strlen($encoded); |
$index = 0; | $index = 0; |
$points = array(); | $points = array(); |
$lat = 0; | $lat = 0; |
$lng = 0; | $lng = 0; |
while ($index < $length) { | while ($index < $length) { |
// Temporary variable to hold each ASCII byte. | // Temporary variable to hold each ASCII byte. |
$b = 0; | $b = 0; |
// The encoded polyline consists of a latitude value followed by a | // The encoded polyline consists of a latitude value followed by a |
// longitude value. They should always come in pairs. Read the | // longitude value. They should always come in pairs. Read the |
// latitude value first. | // latitude value first. |
$shift = 0; | $shift = 0; |
$result = 0; | $result = 0; |
do { | do { |
// The `ord(substr($encoded, $index++))` statement returns the ASCII | // The `ord(substr($encoded, $index++))` statement returns the ASCII |
// code for the character at $index. Subtract 63 to get the original | // code for the character at $index. Subtract 63 to get the original |
// value. (63 was added to ensure proper ASCII characters are displayed | // value. (63 was added to ensure proper ASCII characters are displayed |
// in the encoded polyline string, which is `human` readable) | // in the encoded polyline string, which is `human` readable) |
$b = ord(substr($encoded, $index++)) - 63; | $b = ord(substr($encoded, $index++)) - 63; |
// AND the bits of the byte with 0x1f to get the original 5-bit `chunk. | // AND the bits of the byte with 0x1f to get the original 5-bit `chunk. |
// Then left shift the bits by the required amount, which increases | // Then left shift the bits by the required amount, which increases |
// by 5 bits each time. | // by 5 bits each time. |
// OR the value into $results, which sums up the individual 5-bit chunks | // OR the value into $results, which sums up the individual 5-bit chunks |
// into the original value. Since the 5-bit chunks were reversed in | // into the original value. Since the 5-bit chunks were reversed in |
// order during encoding, reading them in this way ensures proper | // order during encoding, reading them in this way ensures proper |
// summation. | // summation. |
$result|= ($b & 0x1f) << $shift; | $result|= ($b & 0x1f) << $shift; |
$shift+= 5; | $shift+= 5; |
} | } |
// Continue while the read byte is >= 0x20 since the last `chunk` | // Continue while the read byte is >= 0x20 since the last `chunk` |
// was not OR'd with 0x20 during the conversion process. (Signals the end) | // was not OR'd with 0x20 during the conversion process. (Signals the end) |
while ($b >= 0x20); | while ($b >= 0x20); |
// Check if negative, and convert. (All negative values have the last bit | // Check if negative, and convert. (All negative values have the last bit |
// set) | // set) |
$dlat = (($result & 1) ? ~($result >> 1) : ($result >> 1)); | $dlat = (($result & 1) ? ~($result >> 1) : ($result >> 1)); |
// Compute actual latitude since value is offset from previous value. | // Compute actual latitude since value is offset from previous value. |
$lat+= $dlat; | $lat+= $dlat; |
// The next values will correspond to the longitude for this point. | // The next values will correspond to the longitude for this point. |
$shift = 0; | $shift = 0; |
$result = 0; | $result = 0; |
do { | do { |
$b = ord(substr($encoded, $index++)) - 63; | $b = ord(substr($encoded, $index++)) - 63; |
$result|= ($b & 0x1f) << $shift; | $result|= ($b & 0x1f) << $shift; |
$shift+= 5; | $shift+= 5; |
} while ($b >= 0x20); | } while ($b >= 0x20); |
$dlng = (($result & 1) ? ~($result >> 1) : ($result >> 1)); | $dlng = (($result & 1) ? ~($result >> 1) : ($result >> 1)); |
$lng+= $dlng; | $lng+= $dlng; |
// The actual latitude and longitude values were multiplied by | // The actual latitude and longitude values were multiplied by |
// 1e5 before encoding so that they could be converted to a 32-bit | // 1e5 before encoding so that they could be converted to a 32-bit |
// integer representation. (With a decimal accuracy of 5 places) | // integer representation. (With a decimal accuracy of 5 places) |
// Convert back to original values. | // Convert back to original values. |
$points[] = array( | $points[] = array( |
$lat * 1e-5, | $lat * 1e-5, |
$lng * 1e-5 | $lng * 1e-5 |
); | ); |
} | } |
return $points; | return $points; |
} | } |
function geocode($query, $giveOptions) | function geocode($query, $giveOptions) |
{ | { |
global $cloudmadeAPIkey; | global $cloudmadeAPIkey; |
$url = "http://geocoding.cloudmade.com/$cloudmadeAPIkey/geocoding/v2/find.js?query=" . urlencode($query) . "&bbox=-35.5,149.00,-35.15,149.1930&return_location=true&bbox_only=true"; | $url = "http://geocoding.cloudmade.com/$cloudmadeAPIkey/geocoding/v2/find.js?query=" . urlencode($query) . "&bbox=-35.5,149.00,-35.15,149.1930&return_location=true&bbox_only=true"; |
$contents = json_decode(getPage($url)); | $contents = json_decode(getPage($url)); |
if ($giveOptions) return $contents->features; | if ($giveOptions) return $contents->features; |
elseif (isset($contents->features[0]->centroid)) return $contents->features[0]->centroid->coordinates[0] . "," . $contents->features[0]->centroid->coordinates[1]; | elseif (isset($contents->features[0]->centroid)) return $contents->features[0]->centroid->coordinates[0] . "," . $contents->features[0]->centroid->coordinates[1]; |
else return ""; | else return ""; |
} | } |
function reverseGeocode($lat, $lng) | function reverseGeocode($lat, $lng) |
{ | { |
global $cloudmadeAPIkey; | global $cloudmadeAPIkey; |
$url = "http://geocoding.cloudmade.com/$cloudmadeAPIkey/geocoding/v2/find.js?around=" . $lat . "," . $lng . "&distance=closest&object_type=road"; | $url = "http://geocoding.cloudmade.com/$cloudmadeAPIkey/geocoding/v2/find.js?around=" . $lat . "," . $lng . "&distance=closest&object_type=road"; |
$contents = json_decode(getPage($url)); | $contents = json_decode(getPage($url)); |
return $contents->features[0]->properties->name; | return $contents->features[0]->properties->name; |
} | } |
?> | ?> |
<?php | <?php |
if (isset($_REQUEST['firstLetter'])) { | if (isset($_REQUEST['firstLetter'])) { |
$firstLetter = filter_var($_REQUEST['firstLetter'], FILTER_SANITIZE_STRING); | $firstLetter = filter_var($_REQUEST['firstLetter'], FILTER_SANITIZE_STRING); |
} | } |
if (isset($_REQUEST['bysuburbs'])) { | if (isset($_REQUEST['bysuburbs'])) { |
$bysuburbs = true; | $bysuburbs = true; |
} | } |
if (isset($_REQUEST['bynumber'])) { | if (isset($_REQUEST['bynumber'])) { |
$bynumber = true; | $bynumber = true; |
} | } |
if (isset($_REQUEST['allstops'])) { | if (isset($_REQUEST['allstops'])) { |
$allstops = true; | $allstops = true; |
} | } |
if (isset($_REQUEST['nearby'])) { | if (isset($_REQUEST['nearby'])) { |
$nearby = true; | $nearby = true; |
} | } |
if (isset($_REQUEST['suburb'])) { | if (isset($_REQUEST['suburb'])) { |
$suburb = filter_var($_REQUEST['suburb'], FILTER_SANITIZE_STRING); | $suburb = $_REQUEST['suburb']; |
} | } |
$pageKey = filter_var($_REQUEST['pageKey'], FILTER_SANITIZE_NUMBER_INT); | $pageKey = filter_var($_REQUEST['pageKey'], FILTER_SANITIZE_NUMBER_INT); |
$lat = filter_var($_REQUEST['lat'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); | $lat = filter_var($_REQUEST['lat'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
$lon = filter_var($_REQUEST['lon'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); | $lon = filter_var($_REQUEST['lon'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
$max_distance = filter_var($_REQUEST['radius'], FILTER_SANITIZE_NUMBER_INT); | $max_distance = filter_var($_REQUEST['radius'], FILTER_SANITIZE_NUMBER_INT); |
if (isset($_REQUEST['numberSeries'])) { | if (isset($_REQUEST['numberSeries'])) { |
$numberSeries = filter_var($_REQUEST['numberSeries'], FILTER_SANITIZE_NUMBER_INT); | $numberSeries = filter_var($_REQUEST['numberSeries'], FILTER_SANITIZE_NUMBER_INT); |
} | } |
if (isset($_REQUEST['routeDestination'])) { | if (isset($_REQUEST['routeDestination'])) { |
$routeDestination = urldecode(filter_var($_REQUEST['routeDestination'], FILTER_SANITIZE_ENCODED)); | $routeDestination = urldecode(filter_var($_REQUEST['routeDestination'], FILTER_SANITIZE_ENCODED)); |
} | } |
if (isset($_REQUEST['stopcode'])) { | if (isset($_REQUEST['stopcode'])) { |
$stopcode = filter_var($_REQUEST['stopcode'], FILTER_SANITIZE_STRING); | $stopcode = filter_var($_REQUEST['stopcode'], FILTER_SANITIZE_STRING); |
} | } |
if (isset($_REQUEST['stopids'])) { | if (isset($_REQUEST['stopids'])) { |
$stopids = explode(",", filter_var($_REQUEST['stopids'], FILTER_SANITIZE_STRING)); | $stopids = explode(",", filter_var($_REQUEST['stopids'], FILTER_SANITIZE_STRING)); |
} | } |
if (isset($_REQUEST['tripid'])) { | if (isset($_REQUEST['tripid'])) { |
$tripid = filter_var($_REQUEST['tripid'], FILTER_SANITIZE_NUMBER_INT); | $tripid = filter_var($_REQUEST['tripid'], FILTER_SANITIZE_NUMBER_INT); |
} | } |
if (isset($_REQUEST['stopid'])) { | if (isset($_REQUEST['stopid'])) { |
$stopid = filter_var($_REQUEST['stopid'], FILTER_SANITIZE_NUMBER_INT); | $stopid = filter_var($_REQUEST['stopid'], FILTER_SANITIZE_NUMBER_INT); |
} | } |
if (isset($_REQUEST['routeid'])) { | if (isset($_REQUEST['routeid'])) { |
$routeid = filter_var($_REQUEST['routeid'], FILTER_SANITIZE_NUMBER_INT); | $routeid = filter_var($_REQUEST['routeid'], FILTER_SANITIZE_NUMBER_INT); |
} | } |
if (isset($_REQUEST['geolocate'])) { | if (isset($_REQUEST['geolocate'])) { |
$geolocate = filter_var($_REQUEST['geolocate'], FILTER_SANITIZE_URL); | $geolocate = filter_var($_REQUEST['geolocate'], FILTER_SANITIZE_URL); |
} | } |
?> | ?> |
<?php | <?php |
// Copyright 2009 Google Inc. All Rights Reserved. | // Copyright 2009 Google Inc. All Rights Reserved. |
$GA_ACCOUNT = "MO-22173039-1"; | $GA_ACCOUNT = "MO-22173039-1"; |
$GA_PIXEL = "/lib/ga.php"; | $GA_PIXEL = "/lib/ga.php"; |
function googleAnalyticsGetImageUrl() | function googleAnalyticsGetImageUrl() |
{ | { |
global $GA_ACCOUNT, $GA_PIXEL; | global $GA_ACCOUNT, $GA_PIXEL; |
//if (stristr($_SERVER['HTTP_USER_AGENT'], 'Googlebot') return ""; | //if (stristr($_SERVER['HTTP_USER_AGENT'], 'Googlebot') return ""; |
$url = ""; | $url = ""; |
$url.= $GA_PIXEL . "?"; | $url.= $GA_PIXEL . "?"; |
$url.= "utmac=" . $GA_ACCOUNT; | $url.= "utmac=" . $GA_ACCOUNT; |
$url.= "&utmn=" . rand(0, 0x7fffffff); | $url.= "&utmn=" . rand(0, 0x7fffffff); |
$referer = $_SERVER["HTTP_REFERER"]; | $referer = $_SERVER["HTTP_REFERER"]; |
$query = $_SERVER["QUERY_STRING"]; | $query = $_SERVER["QUERY_STRING"]; |
$path = $_SERVER["REQUEST_URI"]; | $path = $_SERVER["REQUEST_URI"]; |
if (empty($referer)) { | if (empty($referer)) { |
$referer = "-"; | $referer = "-"; |
} | } |
$url.= "&utmr=" . urlencode($referer); | $url.= "&utmr=" . urlencode($referer); |
if (!empty($path)) { | if (!empty($path)) { |
$url.= "&utmp=" . urlencode($path); | $url.= "&utmp=" . urlencode($path); |
} | } |
$url.= "&guid=ON"; | $url.= "&guid=ON"; |
return str_replace("&", "&", $url); | return str_replace("&", "&", $url); |
} | } |
function include_header($pageTitle, $pageType, $opendiv = true, $geolocate = false, $datepicker = false) | function include_header($pageTitle, $pageType, $opendiv = true, $geolocate = false, $datepicker = false) |
{ | { |
global $labsPath; | |
echo ' | echo ' |
<!DOCTYPE html> | <!DOCTYPE html> |
<html lang="en"> | <html lang="en"> |
<head> | <head> |
<meta charset="UTF-8"> | <meta charset="UTF-8"> |
<title>' . $pageTitle . '</title> | <meta name="viewport" content="width=device-width, initial-scale=1"> |
<meta name="google-site-verification" | <title>' . $pageTitle . '</title> |
content="-53T5Qn4TB_de1NyfR_ZZkEVdUNcNFSaYKSFkWKx-sY" /> | <meta name="google-site-verification" content="-53T5Qn4TB_de1NyfR_ZZkEVdUNcNFSaYKSFkWKx-sY" /> |
<link rel="stylesheet" href="css/jquery-ui-1.8.12.custom.css" />'; | <link rel="dns-prefetch" href="//code.jquery.com"> |
<link rel="dns-prefetch" href="//ajax.googleapis.com"> | |
<link rel="stylesheet" href="' . $labsPath . 'css/jquery-ui-1.8.12.custom.css" />'; | |
if (isDebugServer()) { | if (isDebugServer()) { |
echo '<link rel="stylesheet" href="css/jquery.mobile-1.0b1.css" /> | $jqmcss = $labsPath . 'css/jquery.mobile-1.0b2.css'; |
$jqjs = $labsPath . 'js/jquery-1.6.2.min.js'; | |
<script type="text/javascript" src="js/jquery-1.6.1.min.js"></script> | $jqmjs = $labsPath . 'js/jquery.mobile-1.0b2.js'; |
<script>$(document).bind("mobileinit", function(){ | } |
else { | |
$jqmcss = "//code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.css"; | |
$jqjs = "//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"; | |
$jqmjs = "//code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.js"; | |
} | |
echo '<link rel="stylesheet" href="' . $jqmcss . '" /> | |
<script src="'.$jqjs.'"></script> | |
<script>$(document).bind("mobileinit", function(){ | |
$.mobile.ajaxEnabled = false; | $.mobile.ajaxEnabled = false; |
}); | }); |
</script> | </script> |
<script type="text/javascript" src="js/jquery.mobile-1.0b1.js"></script>'; | <script src="'.$jqmjs.'"></script> |
} | |
else { | <script src="' . $labsPath . 'js/jquery.ui.core.min.js"></script> |
echo '<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css" /> | <script src="' . $labsPath . 'js/jquery.ui.position.min.js"></script> |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> | <script src="' . $labsPath . 'js/jquery.ui.widget.min.js"></script> |
<script>$(document).bind("mobileinit", function(){ | <script src="' . $labsPath . 'js/jquery.ui.autocomplete.min.js"></script> |
$.mobile.ajaxEnabled = false; | |
}); | |
</script> | |
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"></script>'; | |
} | |
echo ' | |
<script src="js/jquery.ui.autocomplete.min.js"></script> | |
<script src="js/jquery.ui.core.min.js"></script> | |
<script src="js/jquery.ui.position.min.js"></script> | |
<script src="js/jquery.ui.widget.min.js"></script> | |
<script> | <script> |
$(function() { | $(function() { |
$( "#geolocate" ).autocomplete({ | $( "#geolocate" ).autocomplete({ |
source: "lib/autocomplete.php", | source: "lib/autocomplete.php", |
minLength: 2 | minLength: 2 |
}); | }); |
$( "#from" ).autocomplete({ | $( "#from" ).autocomplete({ |
source: "lib/autocomplete.php", | source: "lib/autocomplete.php", |
minLength: 2 | minLength: 2 |
}); | }); |
$( "#to" ).autocomplete({ | $( "#to" ).autocomplete({ |
source: "lib/autocomplete.php", | source: "lib/autocomplete.php", |
minLength: 2 | minLength: 2 |
}); | }); |
}); | }); |
</script> | </script>'; |
'; | echo '<style type="text/css">'; |
echo '<style type="text/css"> | if (strstr($_SERVER['HTTP_USER_AGENT'], 'Android')) echo '.ui-shadow,.ui-btn-up-a,.ui-btn-hover-a,.ui-btn-down-a,.ui-body-b,.ui-btn-up-b,.ui-btn-hover-b, |
.ui-li-thumb, .ui-li-icon { position: relative; } | .ui-btn-down-b,.ui-bar-c,.ui-body-c,.ui-btn-up-c,.ui-btn-hover-c,.ui-btn-down-c,.ui-bar-c,.ui-body-d, |
.ui-navbar { | .ui-btn-up-d,.ui-btn-hover-d,.ui-btn-down-d,.ui-bar-d,.ui-body-e,.ui-btn-up-e,.ui-btn-hover-e, |
width: 100%; | .ui-btn-down-e,.ui-bar-e,.ui-overlay-shadow,.ui-shadow,.ui-btn-active,.ui-body-a,.ui-bar-a { |
} | text-shadow: none; |
.ui-btn-inner { | box-shadow: none; |
white-space: normal !important; | -webkit-box-shadow: none; |
} | }'; |
.ui-li-heading { | echo '</style>'; |
white-space: normal !important; | echo '<link rel="stylesheet" href="' . $labsPath . 'css/local.css.php" />'; |
} | |
.ui-listview-filter { | |
margin: 0 !important; | |
} | |
.ui-icon-navigation { | |
background-image: url(css/images/113-navigation.png); | |
background-position: 1px 0; | |
} | |
.ui-icon-beaker { | |
background-image: url(css/images/91-beaker-2.png); | |
background-position: 1px 0; | |
} | |
#footer { | |
text-size: 0.75em; | |
text-align: center; | |
} | |
body { | |
background-color: #F0F0F0; | |
} | |
#jqm-homeheader { | |
text-align: center; | |
} | |
.viaPoints { | |
display: none; | |
text-size: 0.2em; | |
} | |
.min-width-480px .viaPoints { | |
display: inline; | |
} | |
#extrainfo { | |
visibility: hidden; | |
display: none; | |
} | |
#servicewarning { | |
padding: 1em; | |
margin-bottom: 0.5em; | |
text-size: 0.2em; | |
background-color: #FF9; | |
-moz-border-radius: 15px; | |
border-radius: 15px; | |
} | |
/*#leftcolumn { | |
float: none; | |
} | |
.min-width-768px #leftcolumn { | |
float: left; | |
width: 30%; | |
} | |
#rightcolumn { | |
float: none; | |
} | |
.min-width-768px #rightcolumn { | |
float: right; | |
width: 68%; | |
}*/ | |
#footer { | |
clear:both; | |
text-align:center; | |
} | |
// source http://webaim.org/techniques/skipnav/ | |
#skip a, #skip a:hover, #skip a:visited | |
{ | |
position:absolute; | |
left:0px; | |
top:-500px; | |
width:1px; | |
height:1px; | |
overflow:hidden; | |
} | |
#skip a:active, #skip a:focus | |
{ | |
position:static; | |
width:auto; | |
height:auto; | |
} | |
</style>'; | |
if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPod') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPad')) { | if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPod') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPad')) { |
echo '<meta name="apple-mobile-web-app-capable" content="yes" /> | echo '<meta name="apple-mobile-web-app-capable" content="yes" /> |
<meta name="apple-mobile-web-app-status-bar-style" content="black" /> | <meta name="apple-mobile-web-app-status-bar-style" content="black" /> |
<link rel="apple-touch-startup-image" href="startup.png" /> | <link rel="apple-touch-startup-image" href="startup.png" /> |
<link rel="apple-touch-icon" href="apple-touch-icon.png" />'; | <link rel="apple-touch-icon" href="apple-touch-icon.png" />'; |
} | } |
if ($geolocate) { | if ($geolocate) { |
echo "<script> | echo "<script> |
function success(position) { | function success(position) { |
$('#error').val('Location now detected. Please wait for data to load.'); | $('#error').val('Location now detected. Please wait for data to load.'); |
$('#geolocate').val(position.coords.latitude+','+position.coords.longitude); | $('#geolocate').val(position.coords.latitude+','+position.coords.longitude); |
$.ajax({ url: \"include/common.inc.php?geolocate=yes&lat=\"+position.coords.latitude+\"&lon=\"+position.coords.longitude }); | $.ajax({ url: \"include/common.inc.php?geolocate=yes&lat=\"+position.coords.latitude+\"&lon=\"+position.coords.longitude }); |
location.reload(true); | location.reload(true); |
} | } |
function error(msg) { | function error(msg) { |
$('#error').val('Error: '+msg); | $('#error').val('Error: '+msg); |
} | } |
function geolocate() { | function geolocate() { |
if (navigator.geolocation) { | if (navigator.geolocation) { |
var options = { | var options = { |
enableHighAccuracy: true, | enableHighAccuracy: true, |
timeout: 60000, | timeout: 60000, |
maximumAge: 10000 | maximumAge: 10000 |
} | } |
navigator.geolocation.getCurrentPosition(success, error, options); | navigator.geolocation.getCurrentPosition(success, error, options); |
} | } |
} | } |
$(document).ready(function() { | $(document).ready(function() { |
$('#here').click(function(event) { $('#geolocate').val(geolocate()); return false;}); | $('#here').click(function(event) { $('#geolocate').val(geolocate()); return false;}); |
$('#here').show(); | $('#here').show(); |
/*if ($.mobile.media('screen and (min-width: 768px)')) { | |
$('map a:first').click(); | |
$('#settings a:first').click(); | |
}*/ | |
}); | }); |
"; | "; |
if (!isset($_SESSION['lat']) || $_SESSION['lat'] == "") echo "geolocate();"; | if (!isset($_SESSION['lat']) || $_SESSION['lat'] == "") echo "geolocate();"; |
echo "</script> "; | echo "</script> "; |
} | } |
if (isAnalyticsOn()) echo ' | if (isAnalyticsOn()) echo ' |
<script type="text/javascript">' . " | <script type="text/javascript">' . " |
var _gaq = _gaq || []; | var _gaq = _gaq || []; |
_gaq.push(['_setAccount', 'UA-22173039-1']); | _gaq.push(['_setAccount', 'UA-22173039-1']); |
_gaq.push(['_trackPageview']); | _gaq.push(['_trackPageview']); |
_gaq.push(['_trackPageLoadTime']); | _gaq.push(['_trackPageLoadTime']); |
</script>"; | </script>"; |
echo '</head> | echo '</head> |
<body> | <body> |
<div id="skip"> | <div id="skip"> |
<a href="#maincontent">Skip to content</a> | <a href="#maincontent">Skip to content</a> |
</div> | </div> |
'; | '; |
if ($opendiv) { | if ($opendiv) { |
echo '<div data-role="page"> | echo '<div data-role="page"> |
<div data-role="header" data-position="inline"> | <div data-role="header" data-position="inline"> |
<a href="' . (isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "javascript:history.go(-1)") . '" data-icon="arrow-l" data-rel="back" class="ui-btn-left">Back</a> | <a href="' . (isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "javascript:history.go(-1)") . '" data-icon="arrow-l" data-rel="back" class="ui-btn-left">Back</a> |
<h1>' . $pageTitle . '</h1> | <h1>' . $pageTitle . '</h1> |
<a href="/index.php" data-icon="home" class="ui-btn-right">Home</a> | <a href="' . $labsPath . '/index.php" data-icon="home" class="ui-btn-right">Home</a> |
</div><!-- /header --> | </div><!-- /header --> |
<a name="maincontent" id="maincontent"></a> | <a name="maincontent" id="maincontent"></a> |
<div data-role="content"> '; | <div data-role="content"> '; |
$overrides = getServiceOverride(); | $overrides = getServiceOverride(); |
if ($overrides['service_id']) { | if ($overrides['service_id']) { |
if ($overrides['service_id'] == "noservice") { | if ($overrides['service_id'] == "noservice") { |
echo '<div id="servicewarning">Buses are <strong>not running today</strong> due to industrial action/public holiday. See <a | echo '<div id="servicewarning">Buses are <strong>not running today</strong> due to industrial action/public holiday. See <a |
href="http://www.action.act.gov.au">http://www.action.act.gov.au</a> for details.</div>'; | href="http://www.action.act.gov.au">http://www.action.act.gov.au</a> for details.</div>'; |
} | } |
else { | else { |
echo '<div id="servicewarning">Buses are running on an altered timetable today due to industrial action/public holiday. See <a href="http://www.action.act.gov.au">http://www.action.act.gov.au</a> for details.</div>'; | echo '<div id="servicewarning">Buses are running on an altered timetable today due to industrial action/public holiday. See <a href="http://www.action.act.gov.au">http://www.action.act.gov.au</a> for details.</div>'; |
} | |
} | } |
} | } |
} | |
} | } |
function include_footer() | function include_footer() |
{ | { |
echo '<div id="footer"><a href="about.php">About/Contact Us</a> <a href="feedback.php">Feedback/Bug Report</a> <a href="privacy.php">Privacy Policy</a>'; | global $labsPath; |
echo '<div id="footer"><a href="' . $labsPath . 'about.php">About/Contact Us</a> <a href="' . $labsPath . 'feedback.php">Feedback/Bug Report</a> <a href="' . $labsPath . 'privacy.php">Privacy Policy</a>'; | |
echo '</div>'; | echo '</div>'; |
if (isAnalyticsOn()) { | if (isAnalyticsOn()) { |
echo "<script> (function() { | echo "<script> (function() { |
var ga = document.createElement('script'); ga.type = | var ga = document.createElement('script'); ga.type = |
'text/javascript'; ga.async = true; | 'text/javascript'; ga.async = true; |
ga.src = ('https:' == document.location.protocol ? | ga.src = ('https:' == document.location.protocol ? |
'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; |
var s = document.getElementsByTagName('script')[0]; | var s = document.getElementsByTagName('script')[0]; |
s.parentNode.insertBefore(ga, s); | s.parentNode.insertBefore(ga, s); |
})();</script>"; | })();</script>"; |
$googleAnalyticsImageUrl = googleAnalyticsGetImageUrl(); | $googleAnalyticsImageUrl = googleAnalyticsGetImageUrl(); |
echo '<noscript><img src="' . $googleAnalyticsImageUrl . '" /></noscript>'; | echo '<noscript><img src="' . $googleAnalyticsImageUrl . '" /></noscript>'; |
} | |
} | echo "\n</div></div></body></html>"; |
echo "\n</div></div></body></html>"; | } |
} | function placeSettings() |
function timePlaceSettings($geolocate = false) | |
{ | { |
global $service_periods; | global $service_periods; |
$geoerror = false; | $geoerror = false; |
if ($geolocate == true) { | |
$geoerror = !isset($_SESSION['lat']) || !isset($_SESSION['lat']) || $_SESSION['lat'] == "" || $_SESSION['lon'] == ""; | $geoerror = !isset($_SESSION['lat']) || !isset($_SESSION['lat']) || $_SESSION['lat'] == "" || $_SESSION['lon'] == ""; |
} | |
echo '<div id="error">'; | echo '<div id="error">'; |
if ($geoerror) { | if ($geoerror) { |
echo 'Sorry, but your location could not currently be detected. | echo 'Sorry, but your location could not currently be detected. |
Please allow location permission, wait for your location to be detected, | Please allow location permission, wait for your location to be detected, |
or enter an address/co-ordinates in the box below.'; | or enter an address/co-ordinates in the box below.'; |
} | } |
echo '</div>'; | echo '</div>'; |
echo '<div id="settings" data-role="collapsible" data-collapsed="' . !$geoerror . '"> | echo '<div id="settings" data-role="collapsible" data-collapsed="' . !$geoerror . '"> |
<h3>Change Time/Place (' . (isset($_SESSION['time']) ? $_SESSION['time'] : "Current Time,") . ' ' . ucwords(service_period()) . ')...</h3> | <h3>Change Location...</h3> |
<form action="' . basename($_SERVER['PHP_SELF']) . "?" . $_SERVER['QUERY_STRING'] . '" method="post"> | <form action="' . basename($_SERVER['PHP_SELF']) . "?" . $_SERVER['QUERY_STRING'] . '" method="post"> |
<div class="ui-body"> | <div class="ui-body"> |
<div data-role="fieldcontain"> | <div data-role="fieldcontain"> |
<label for="geolocate"> Current Location: </label> | <label for="geolocate"> Current Location: </label> |
<input type="text" id="geolocate" name="geolocate" value="' . (isset($_SESSION['lat']) && isset($_SESSION['lon']) ? $_SESSION['lat'] . "," . $_SESSION['lon'] : "Enter co-ordinates or address here") . '"/> <a href="#" style="display:none" name="here" id="here">Here?</a> | <input type="text" id="geolocate" name="geolocate" value="' . (isset($_SESSION['lat']) && isset($_SESSION['lon']) ? $_SESSION['lat'] . "," . $_SESSION['lon'] : "Enter co-ordinates or address here") . '"/> <a href="#" style="display:none" name="here" id="here">Here?</a> |
</div> | </div> |
<div data-role="fieldcontain"> | |
<label for="time"> Time: </label> | |
<input type="time" name="time" id="time" value="' . (isset($_SESSION['time']) ? $_SESSION['time'] : date("H:i")) . '"/> | |
<a href="#" name="currentTime" id="currentTime" onClick="var d = new Date();' . "$('#time').val(d.getHours() +':'+ (d.getMinutes().toString().length == 1 ? '0'+ d.getMinutes(): d.getMinutes()));" . '">Current Time?</a> | |
</div> | |
<div data-role="fieldcontain"> | |
<label for="service_period"> Service Period: </label> | |
<select name="service_period" id="service_period">'; | |
foreach ($service_periods as $service_period) { | |
echo "<option value=\"$service_period\"" . (service_period() === $service_period ? " SELECTED" : "") . '>' . ucwords($service_period) . '</option>'; | |
} | |
echo '</select> | |
<a href="#" style="display:none" name="currentPeriod" id="currentPeriod">Current Period?</a> | |
</div> | |
<input type="submit" value="Update"/> | <input type="submit" value="Update"/> |
</div></form> | </div></form> |
</div>'; | </div>'; |
} | } |
function trackEvent($category, $action, $label = "", $value = - 1) | function trackEvent($category, $action, $label = "", $value = - 1) |
{ | { |
if (isAnalyticsOn()) { | if (isAnalyticsOn()) { |
echo "\n<script> _gaq.push(['_trackEvent', '$category', '$action'" . ($label != "" ? ", '$label'" : "") . ($value != - 1 ? ", $value" : "") . "]);</script>"; | echo "\n<script> _gaq.push(['_trackEvent', '$category', '$action'" . ($label != "" ? ", '$label'" : "") . ($value != - 1 ? ", $value" : "") . "]);</script>"; |
} | } |
} | } |
?> | ?> |
<?php | <?php |
$service_periods = Array( | $service_periods = Array( |
'sunday', | 'sunday', |
'saturday', | 'saturday', |
'weekday' | 'weekday' |
); | ); |
function service_period() | function service_period($date = "") |
{ | { |
if (isset($_SESSION['service_period'])) return $_SESSION['service_period']; | if (isset($_SESSION['service_period'])) return $_SESSION['service_period']; |
$override = getServiceOverride(); | $override = getServiceOverride($date); |
if ($override['service_id']){ | if ($override['service_id']){ |
return $override['service_id']; | return $override['service_id']; |
} | } |
switch (date('w')) { | switch (date('w',($date != "" ? $date : time()))) { |
case 0: | case 0: |
return 'sunday'; | return 'sunday'; |
case 6: | case 6: |
return 'saturday'; | return 'saturday'; |
default: | default: |
return 'weekday'; | return 'weekday'; |
} | } |
} | } |
function midnight_seconds() | function midnight_seconds($time = "") |
{ | { |
// from http://www.perturb.org/display/Perlfunc__Seconds_Since_Midnight.html | // from http://www.perturb.org/display/Perlfunc__Seconds_Since_Midnight.html |
if ($time != "") { | |
return (date("G", $time) * 3600) + (date("i", $time) * 60) + date("s", $time); | |
} | |
if (isset($_SESSION['time'])) { | if (isset($_SESSION['time'])) { |
$time = strtotime($_SESSION['time']); | $time = strtotime($_SESSION['time']); |
return (date("G", $time) * 3600) + (date("i", $time) * 60) + date("s", $time); | return (date("G", $time) * 3600) + (date("i", $time) * 60) + date("s", $time); |
} | } |
return (date("G") * 3600) + (date("i") * 60) + date("s"); | return (date("G") * 3600) + (date("i") * 60) + date("s"); |
} | } |
function midnight_seconds_to_time($seconds) | function midnight_seconds_to_time($seconds) |
{ | { |
if ($seconds > 0) { | if ($seconds > 0) { |
$midnight = mktime(0, 0, 0, date("n") , date("j") , date("Y")); | $midnight = mktime(0, 0, 0, date("n") , date("j") , date("Y")); |
return date("h:ia", $midnight + $seconds); | return date("h:ia", $midnight + $seconds); |
} | } |
else { | else { |
return ""; | return ""; |
} | } |
} | } |
?> | ?> |
<?php | <?php |
date_default_timezone_set('Australia/ACT'); | date_default_timezone_set('Australia/ACT'); |
$debugOkay = Array( | $debugOkay = Array( |
"session", | "session", |
"json", | "json", |
"phperror", | "phperror", |
"awsotp", | "awsotp", |
//"squallotp", | //"squallotp", |
"vanilleotp", | //"vanilleotp", |
"database", | "database", |
"other" | "other" |
); | ); |
$cloudmadeAPIkey = "daa03470bb8740298d4b10e3f03d63e6"; | $cloudmadeAPIkey = "daa03470bb8740298d4b10e3f03d63e6"; |
$googleMapsAPIkey = "ABQIAAAA95XYXN0cki3Yj_Sb71CFvBTPaLd08ONybQDjcH_VdYtHHLgZvRTw2INzI_m17_IoOUqH3RNNmlTk1Q"; | $googleMapsAPIkey = "ABQIAAAA95XYXN0cki3Yj_Sb71CFvBTPaLd08ONybQDjcH_VdYtHHLgZvRTw2INzI_m17_IoOUqH3RNNmlTk1Q"; |
$otpAPIurl = 'http://localhost:8080/opentripplanner-api-webapp/'; | $otpAPIurl = 'http://localhost:8080/opentripplanner-api-webapp/'; |
if (isDebug("awsotp") || php_uname('n') == "maxious.xen.prgmr.com") { | if (isDebug("awsotp") || php_uname('n') == "maxious.xen.prgmr.com") { |
$otpAPIurl = 'http://bus-main.lambdacomplex.org:8080/opentripplanner-api-webapp/'; | $otpAPIurl = 'http://bus-main.lambdacomplex.org:8080/opentripplanner-api-webapp/'; |
} | } |
if (isDebug("dotcloudotp") || php_uname('n') == "actbus-www") { | if (isDebug("dotcloudotp") || php_uname('n') == "actbus-www") { |
$otpAPIurl = 'http://otp.actbus.dotcloud.com/opentripplanner-api-webapp/'; | $otpAPIurl = 'http://otp.actbus.dotcloud.com/opentripplanner-api-webapp/'; |
} | } |
if (isDebug("squallotp")) { | if (isDebug("squallotp")) { |
$otpAPIurl = 'http://10.0.1.108:5080/opentripplanner-api-webapp/'; | $otpAPIurl = 'http://10.0.1.108:5080/opentripplanner-api-webapp/'; |
} | } |
if (isDebug("vanilleotp")) { | if (isDebug("vanilleotp")) { |
$otpAPIurl = 'http://10.0.1.135:8080/opentripplanner-api-webapp/'; | $otpAPIurl = 'http://10.0.1.135:8080/opentripplanner-api-webapp/'; |
} | } |
if (isDebug("phperror")) error_reporting(E_ALL ^ E_NOTICE); | if (isDebug("phperror")) error_reporting(E_ALL ^ E_NOTICE); |
$labsPath = ""; | |
if (strstr($_SERVER['PHP_SELF'],"labs")) $labsPath = "../"; | |
function isDebugServer() | |
{ | |
return php_sapi_name() == "cli" || isset($_SERVER['SERVER_NAME']) && ( $_SERVER['SERVER_NAME'] == "10.0.1.154" || $_SERVER['SERVER_NAME'] == "10.1.0.4" || $_SERVER['SERVER_NAME'] == | |
"localhost" || $_SERVER['SERVER_NAME'] == "127.0.0.1") ; | |
} | |
include_once ("common-geo.inc.php"); | include_once ("common-geo.inc.php"); |
include_once ("common-net.inc.php"); | include_once ("common-net.inc.php"); |
include_once ("common-transit.inc.php"); | include_once ("common-transit.inc.php"); |
include_once ("common-db.inc.php"); | include_once ("common-db.inc.php"); |
include_once ("common-request.inc.php"); | include_once ("common-request.inc.php"); |
include_once ("common-session.inc.php"); | include_once ("common-session.inc.php"); |
include_once ("common-template.inc.php"); | include_once ("common-template.inc.php"); |
function isDebugServer() | |
{ | |
return $_SERVER['SERVER_NAME'] == "10.0.1.154" || $_SERVER['SERVER_NAME'] == "localhost" || $_SERVER['SERVER_NAME'] == "127.0.0.1" || !$_SERVER['SERVER_NAME']; | |
} | |
function isAnalyticsOn() | function isAnalyticsOn() |
{ | { |
return !isDebugServer(); | return !isDebugServer(); |
} | } |
function isDebug($debugReason = "other") | function isDebug($debugReason = "other") |
{ | { |
global $debugOkay; | global $debugOkay; |
return in_array($debugReason, $debugOkay, false) && isDebugServer(); | return in_array($debugReason, $debugOkay, false) && isDebugServer(); |
} | } |
function debug($msg, $debugReason = "other") | function debug($msg, $debugReason = "other") |
{ | { |
if (isDebug($debugReason)) echo "\n<!-- " . date(DATE_RFC822) . "\n $msg -->\n"; | if (isDebug($debugReason)) echo "\n<!-- " . date(DATE_RFC822) . "\n $msg -->\n"; |
} | } |
function isJQueryMobileDevice() | function isJQueryMobileDevice() |
{ | { |
// http://forum.jquery.com/topic/what-is-the-best-way-to-detect-all-useragents-which-can-handle-jquery-mobile#14737000002087897 | // http://forum.jquery.com/topic/what-is-the-best-way-to-detect-all-useragents-which-can-handle-jquery-mobile#14737000002087897 |
$user_agent = $_SERVER['HTTP_USER_AGENT']; | $user_agent = $_SERVER['HTTP_USER_AGENT']; |
return preg_match('/iphone/i', $user_agent) || preg_match('/android/i', $user_agent) || preg_match('/webos/i', $user_agent) || preg_match('/ios/i', $user_agent) || preg_match('/bada/i', $user_agent) || preg_match('/maemo/i', $user_agent) || preg_match('/meego/i', $user_agent) || preg_match('/fennec/i', $user_agent) || (preg_match('/symbian/i', $user_agent) && preg_match('/s60/i', $user_agent) && $browser['majorver'] >= 5) || (preg_match('/symbian/i', $user_agent) && preg_match('/platform/i', $user_agent) && $browser['majorver'] >= 3) || (preg_match('/blackberry/i', $user_agent) && $browser['majorver'] >= 5) || (preg_match('/opera mobile/i', $user_agent) && $browser['majorver'] >= 10) || (preg_match('/opera mini/i', $user_agent) && $browser['majorver'] >= 5); | return preg_match('/iphone/i', $user_agent) || preg_match('/android/i', $user_agent) || preg_match('/webos/i', $user_agent) || preg_match('/ios/i', $user_agent) || preg_match('/bada/i', $user_agent) || preg_match('/maemo/i', $user_agent) || preg_match('/meego/i', $user_agent) || preg_match('/fennec/i', $user_agent) || (preg_match('/symbian/i', $user_agent) && preg_match('/s60/i', $user_agent) && $browser['majorver'] >= 5) || (preg_match('/symbian/i', $user_agent) && preg_match('/platform/i', $user_agent) && $browser['majorver'] >= 3) || (preg_match('/blackberry/i', $user_agent) && $browser['majorver'] >= 5) || (preg_match('/opera mobile/i', $user_agent) && $browser['majorver'] >= 10) || (preg_match('/opera mini/i', $user_agent) && $browser['majorver'] >= 5); |
} | } |
function isFastDevice() | function isFastDevice() |
{ | { |
$ua = $_SERVER['HTTP_USER_AGENT']; | $ua = $_SERVER['HTTP_USER_AGENT']; |
$fastDevices = Array( | $fastDevices = Array( |
"Mozilla/5.0 (X11;", | "Mozilla/5.0 (X11;", |
"Mozilla/5.0 (Windows;", | "Mozilla/5.0 (Windows;", |
"Mozilla/5.0 (iP", | "Mozilla/5.0 (iP", |
"Mozilla/5.0 (Linux; U; Android", | "Mozilla/5.0 (Linux; U; Android", |
"Mozilla/4.0 (compatible; MSIE" | "Mozilla/4.0 (compatible; MSIE" |
); | ); |
$slowDevices = Array( | $slowDevices = Array( |
"J2ME", | "J2ME", |
"MIDP", | "MIDP", |
"Opera/", | "Opera/", |
"Mozilla/2.0 (compatible;", | "Mozilla/2.0 (compatible;", |
"Mozilla/3.0 (compatible;" | "Mozilla/3.0 (compatible;" |
); | ); |
return true; | return true; |
} | } |
function array_flatten($a, $f = array()) | function array_flatten($a, $f = array()) |
{ | { |
if (!$a || !is_array($a)) return ''; | if (!$a || !is_array($a)) return ''; |
foreach ($a as $k => $v) { | foreach ($a as $k => $v) { |
if (is_array($v)) $f = array_flatten($v, $f); | if (is_array($v)) $f = array_flatten($v, $f); |
else $f[$k] = $v; | else $f[$k] = $v; |
} | } |
return $f; | return $f; |
} | } |
function remove_spaces($string) | function remove_spaces($string) |
{ | { |
return str_replace(' ', '', $string); | return str_replace(' ', '', $string); |
} | } |
function object2array($object) | function object2array($object) |
{ | { |
if (is_object($object)) { | if (is_object($object)) { |
foreach ($object as $key => $value) { | foreach ($object as $key => $value) { |
$array[$key] = $value; | $array[$key] = $value; |
} | } |
} | } |
else { | else { |
$array = $object; | $array = $object; |
} | } |
return $array; | return $array; |
} | } |
function startsWith($haystack, $needle, $case = true) | function startsWith($haystack, $needle, $case = true) |
{ | { |
if ($case) { | if ($case) { |
return (strcmp(substr($haystack, 0, strlen($needle)) , $needle) === 0); | return (strcmp(substr($haystack, 0, strlen($needle)) , $needle) === 0); |
} | } |
return (strcasecmp(substr($haystack, 0, strlen($needle)) , $needle) === 0); | return (strcasecmp(substr($haystack, 0, strlen($needle)) , $needle) === 0); |
} | } |
function endsWith($haystack, $needle, $case = true) | function endsWith($haystack, $needle, $case = true) |
{ | { |
if ($case) { | if ($case) { |
return (strcmp(substr($haystack, strlen($haystack) - strlen($needle)) , $needle) === 0); | return (strcmp(substr($haystack, strlen($haystack) - strlen($needle)) , $needle) === 0); |
} | } |
return (strcasecmp(substr($haystack, strlen($haystack) - strlen($needle)) , $needle) === 0); | return (strcasecmp(substr($haystack, strlen($haystack) - strlen($needle)) , $needle) === 0); |
} | } |
function bracketsMeanNewLine($input) | function bracketsMeanNewLine($input) |
{ | { |
return str_replace(")", "</small>", str_replace("(", "<br><small>", $input)); | return str_replace(")", "</small>", str_replace("(", "<br><small>", $input)); |
} | } |
function sksort(&$array, $subkey = "id", $sort_ascending = false) | function sksort(&$array, $subkey = "id", $sort_ascending = false) |
{ | { |
if (count($array)) $temp_array[key($array) ] = array_shift($array); | if (count($array)) $temp_array[key($array) ] = array_shift($array); |
foreach ($array as $key => $val) { | foreach ($array as $key => $val) { |
$offset = 0; | $offset = 0; |
$found = false; | $found = false; |
foreach ($temp_array as $tmp_key => $tmp_val) { | foreach ($temp_array as $tmp_key => $tmp_val) { |
if (!$found and strtolower($val[$subkey]) > strtolower($tmp_val[$subkey])) { | if (!$found and strtolower($val[$subkey]) > strtolower($tmp_val[$subkey])) { |
$temp_array = array_merge((array)array_slice($temp_array, 0, $offset) , array( | $temp_array = array_merge((array)array_slice($temp_array, 0, $offset) , array( |
$key => $val | $key => $val |
) , array_slice($temp_array, $offset)); | ) , array_slice($temp_array, $offset)); |
$found = true; | $found = true; |
} | } |
$offset++; | $offset++; |
} | } |
if (!$found) $temp_array = array_merge($temp_array, array( | if (!$found) $temp_array = array_merge($temp_array, array( |
$key => $val | $key => $val |
)); | )); |
} | } |
if ($sort_ascending) $array = array_reverse($temp_array); | if ($sort_ascending) $array = array_reverse($temp_array); |
else $array = $temp_array; | else $array = $temp_array; |
} | } |
function sktimesort(&$array, $subkey = "id", $sort_ascending = false) | function sktimesort(&$array, $subkey = "id", $sort_ascending = false) |
{ | { |
if (count($array)) $temp_array[key($array) ] = array_shift($array); | if (count($array)) $temp_array[key($array) ] = array_shift($array); |
foreach ($array as $key => $val) { | foreach ($array as $key => $val) { |
$offset = 0; | $offset = 0; |
$found = false; | $found = false; |
foreach ($temp_array as $tmp_key => $tmp_val) { | foreach ($temp_array as $tmp_key => $tmp_val) { |
if (!$found and strtotime($val[$subkey]) > strtotime($tmp_val[$subkey])) { | if (!$found and strtotime($val[$subkey]) > strtotime($tmp_val[$subkey])) { |
$temp_array = array_merge((array)array_slice($temp_array, 0, $offset) , array( | $temp_array = array_merge((array)array_slice($temp_array, 0, $offset) , array( |
$key => $val | $key => $val |
) , array_slice($temp_array, $offset)); | ) , array_slice($temp_array, $offset)); |
$found = true; | $found = true; |
} | } |
$offset++; | $offset++; |
} | } |
if (!$found) $temp_array = array_merge($temp_array, array( | if (!$found) $temp_array = array_merge($temp_array, array( |
$key => $val | $key => $val |
)); | )); |
} | } |
if ($sort_ascending && isset($temp_array)) $array = array_reverse($temp_array); | if ($sort_ascending && isset($temp_array)) $array = array_reverse($temp_array); |
else $array = $temp_array; | else $array = $temp_array; |
} | } |
function r_implode( $glue, $pieces ) | function r_implode( $glue, $pieces ) |
{ | { |
foreach( $pieces as $r_pieces ) | foreach( $pieces as $r_pieces ) |
{ | { |
if( is_array( $r_pieces ) ) | if( is_array( $r_pieces ) ) |
{ | { |
$retVal[] = r_implode( $glue, $r_pieces ); | $retVal[] = r_implode( $glue, $r_pieces ); |
} | } |
else | else |
{ | { |
$retVal[] = $r_pieces; | $retVal[] = $r_pieces; |
} | } |
} | } |
return implode( $glue, $retVal ); | return implode( $glue, $retVal ); |
} | } |
?> | ?> |
<?php | <?php |
function getRoute($routeID) | function getRoute($routeID) |
{ | { |
global $conn; | global $conn; |
$query = "Select * from routes where route_id = :routeID LIMIT 1"; | $query = "Select * from routes where route_id = :routeID LIMIT 1"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":routeID", $routeID); | $query->bindParam(":routeID", $routeID); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetch(PDO::FETCH_ASSOC); | return $query->fetch(PDO::FETCH_ASSOC); |
} | } |
function getRouteByFullName($routeFullName) | |
{ | |
global $conn; | |
$query = "Select * from routes where route_short_name||route_long_name = :routeFullName LIMIT 1"; | |
debug($query, "database"); | |
$query = $conn->prepare($query); | |
$query->bindParam(":routeFullName", $routeFullName); | |
$query->execute(); | |
if (!$query) { | |
databaseError($conn->errorInfo()); | |
return Array(); | |
} | |
return $query->fetch(PDO::FETCH_ASSOC); | |
} | |
function getRoutes() | function getRoutes() |
{ | { |
global $conn; | global $conn; |
$query = "Select * from routes order by route_short_name;"; | $query = "Select * from routes order by route_short_name;"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetchAll(); | return $query->fetchAll(); |
} | } |
function getRoutesByNumber($routeNumber = "") | function getRoutesByNumber($routeNumber = "") |
{ | { |
global $conn; | global $conn; |
if ($routeNumber != "") { | if ($routeNumber != "") { |
$query = "Select distinct routes.route_id,routes.route_short_name,routes.route_long_name,service_id from routes join trips on trips.route_id = | $query = "Select distinct routes.route_id,routes.route_short_name,routes.route_long_name,service_id from routes join trips on trips.route_id = |
routes.route_id join stop_times on stop_times.trip_id = trips.trip_id where route_short_name = :routeNumber order by route_short_name;"; | routes.route_id join stop_times on stop_times.trip_id = trips.trip_id |
where route_short_name = :routeNumber OR route_short_name LIKE :routeNumber2 order by route_short_name;"; | |
} | } |
else { | else { |
$query = "SELECT DISTINCT route_short_name from routes order by route_short_name"; | $query = "SELECT DISTINCT route_short_name from routes order by route_short_name"; |
} | } |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
if ($routeNumber != "") { | if ($routeNumber != "") { |
$query->bindParam(":routeNumber", $routeNumber); | $query->bindParam(":routeNumber", $routeNumber); |
$routeNumber2 = "% ".$routeNumber; | |
$query->bindParam(":routeNumber2", $routeNumber2); | |
} | } |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetchAll(); | return $query->fetchAll(); |
} | } |
function getRoutesByNumberSeries($routeNumberSeries = "") | function getRoutesByNumberSeries($routeNumberSeries = "") |
{ | { |
global $conn; | global $conn; |
if (strlen($routeNumberSeries) == 1) { | if (strlen($routeNumberSeries) == 1) { |
return getRoutesByNumber($routeNumberSeries); | return getRoutesByNumber($routeNumberSeries); |
} | } |
$seriesMin = substr($routeNumberSeries, 0, -1) . "0"; | $seriesMin = substr($routeNumberSeries, 0, -1) . "0"; |
$seriesMax = substr($routeNumberSeries, 0, -1) . "9"; | $seriesMax = substr($routeNumberSeries, 0, -1) . "9"; |
$query = "Select distinct routes.route_id,routes.route_short_name,routes.route_long_name,service_id from routes join trips on trips.route_id = | $query = "Select distinct routes.route_id,routes.route_short_name,routes.route_long_name,service_id from routes join trips on trips.route_id = |
routes.route_id join stop_times on stop_times.trip_id = trips.trip_id where to_number(route_short_name, 'FM999') between :seriesMin and :seriesMax OR route_short_name LIKE :routeNumberSeries order by route_short_name;"; | routes.route_id join stop_times on stop_times.trip_id = trips.trip_id where to_number(route_short_name, 'FM999') between :seriesMin and :seriesMax OR route_short_name LIKE :routeNumberSeries order by route_short_name;"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":seriesMin", $seriesMin); | $query->bindParam(":seriesMin", $seriesMin); |
$query->bindParam(":seriesMax", $seriesMax); | $query->bindParam(":seriesMax", $seriesMax); |
$routeNumberSeries = "% ".substr($routeNumberSeries, 0, -1)."%"; | $routeNumberSeries = "% ".substr($routeNumberSeries, 0, -1)."%"; |
$query->bindParam(":routeNumberSeries", $routeNumberSeries); | $query->bindParam(":routeNumberSeries", $routeNumberSeries); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetchAll(); | return $query->fetchAll(); |
} | } |
function getRouteNextTrip($routeID) | function getRouteNextTrip($routeID) |
{ | { |
global $conn; | global $conn; |
$query = "select * from routes join trips on trips.route_id = routes.route_id | $query = "select * from routes join trips on trips.route_id = routes.route_id |
join stop_times on stop_times.trip_id = trips.trip_id where | join stop_times on stop_times.trip_id = trips.trip_id where |
arrival_time > :currentTime and routes.route_id = :routeID order by | arrival_time > :currentTime and routes.route_id = :routeID order by |
arrival_time limit 1"; | arrival_time limit 1"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":currentTime", current_time()); | $query->bindParam(":currentTime", current_time()); |
$query->bindParam(":routeID", $routeID); | $query->bindParam(":routeID", $routeID); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
$r = $query->fetch(PDO::FETCH_ASSOC); | $r = $query->fetch(PDO::FETCH_ASSOC); |
// past last trip of the day special case | // past last trip of the day special case |
if (sizeof($r) < 16) { | if (sizeof($r) < 16) { |
$query = "select * from routes join trips on trips.route_id = routes.route_id | $query = "select * from routes join trips on trips.route_id = routes.route_id |
join stop_times on stop_times.trip_id = trips.trip_id where routes.route_id = :routeID order by | join stop_times on stop_times.trip_id = trips.trip_id where routes.route_id = :routeID order by |
arrival_time DESC limit 1"; | arrival_time DESC limit 1"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":routeID", $routeID); | $query->bindParam(":routeID", $routeID); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
$r = $query->fetch(PDO::FETCH_ASSOC); | $r = $query->fetch(PDO::FETCH_ASSOC); |
} | } |
return $r; | return $r; |
} | } |
function getTimeInterpolatedRouteAtStop($routeID, $stop_id) | function getTimeInterpolatedRouteAtStop($routeID, $stop_id) |
{ | { |
$nextTrip = getRouteNextTrip($routeID); | $nextTrip = getRouteNextTrip($routeID); |
if ($nextTrip['trip_id']) { | if ($nextTrip['trip_id']) { |
foreach (getTimeInterpolatedTrip($nextTrip['trip_id']) as $tripStop) { | foreach (getTimeInterpolatedTrip($nextTrip['trip_id']) as $tripStop) { |
if ($tripStop['stop_id'] == $stop_id) return $tripStop; | if ($tripStop['stop_id'] == $stop_id) return $tripStop; |
} | } |
} | } |
return Array(); | return Array(); |
} | } |
function getRouteTrips($routeID) | function getRouteTrips($routeID) |
{ | { |
global $conn; | global $conn; |
$query = "select routes.route_id,trips.trip_id,service_id,arrival_time, stop_id, stop_sequence from routes join trips on trips.route_id = routes.route_id | $query = "select routes.route_id,trips.trip_id,service_id,arrival_time, stop_id, stop_sequence from routes join trips on trips.route_id = routes.route_id |
join stop_times on stop_times.trip_id = trips.trip_id where routes.route_id = :routeID and stop_sequence = '1' order by | join stop_times on stop_times.trip_id = trips.trip_id where routes.route_id = :routeID and stop_sequence = '1' order by |
arrival_time "; | arrival_time "; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":routeID", $routeID); | $query->bindParam(":routeID", $routeID); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetchAll(); | return $query->fetchAll(); |
} | } |
function getRoutesByDestination($destination = "", $service_period = "") | function getRoutesByDestination($destination = "", $service_period = "") |
{ | { |
global $conn; | global $conn; |
if ($service_period == "") $service_period = service_period(); | if ($service_period == "") $service_period = service_period(); |
if ($destination != "") { | if ($destination != "") { |
$query = "SELECT DISTINCT trips.route_id,route_short_name,route_long_name, service_id | $query = "SELECT DISTINCT trips.route_id,route_short_name,route_long_name, service_id |
FROM stop_times join trips on trips.trip_id = | FROM stop_times join trips on trips.trip_id = |
stop_times.trip_id join routes on trips.route_id = routes.route_id | stop_times.trip_id join routes on trips.route_id = routes.route_id |
WHERE route_long_name = :destination AND service_id=:service_period order by route_short_name"; | WHERE route_long_name = :destination AND service_id=:service_period order by route_short_name"; |
} | } |
else { | else { |
$query = "SELECT DISTINCT route_long_name | $query = "SELECT DISTINCT route_long_name |
FROM stop_times join trips on trips.trip_id = | FROM stop_times join trips on trips.trip_id = |
stop_times.trip_id join routes on trips.route_id = routes.route_id | stop_times.trip_id join routes on trips.route_id = routes.route_id |
WHERE service_id= :service_period order by route_long_name"; | WHERE service_id= :service_period order by route_long_name"; |
} | } |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":service_period", $service_period); | $query->bindParam(":service_period", $service_period); |
if ($destination != "") $query->bindParam(":destination", $destination); | if ($destination != "") $query->bindParam(":destination", $destination); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetchAll(); | return $query->fetchAll(); |
} | } |
function getRoutesBySuburb($suburb, $service_period = "") | function getRoutesBySuburb($suburb, $service_period = "") |
{ | { |
if ($service_period == "") $service_period = service_period(); | if ($service_period == "") $service_period = service_period(); |
global $conn; | global $conn; |
$query = "SELECT DISTINCT service_id,trips.route_id,route_short_name,route_long_name | $query = "SELECT DISTINCT service_id,trips.route_id,route_short_name,route_long_name |
FROM stop_times join trips on trips.trip_id = stop_times.trip_id | FROM stop_times join trips on trips.trip_id = stop_times.trip_id |
join routes on trips.route_id = routes.route_id | join routes on trips.route_id = routes.route_id |
join stops on stops.stop_id = stop_times.stop_id | join stops on stops.stop_id = stop_times.stop_id |
WHERE zone_id LIKE ':suburb AND service_id=:service_period ORDER BY route_short_name"; | WHERE zone_id LIKE ':suburb AND service_id=:service_period ORDER BY route_short_name"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":service_period", $service_period); | $query->bindParam(":service_period", $service_period); |
$suburb = "%" . $suburb . ";%"; | $suburb = "%" . $suburb . ";%"; |
$query->bindParam(":suburb", $suburb); | $query->bindParam(":suburb", $suburb); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetchAll(); | return $query->fetchAll(); |
} | } |
function getRoutesNearby($lat, $lng, $limit = "", $distance = 500) | function getRoutesNearby($lat, $lng, $limit = "", $distance = 500) |
{ | { |
if ($service_period == "") $service_period = service_period(); | if ($service_period == "") $service_period = service_period(); |
if ($limit != "") $limitSQL = " LIMIT :limit "; | if ($limit != "") $limitSQL = " LIMIT :limit "; |
global $conn; | global $conn; |
$query = "SELECT service_id,trips.route_id,route_short_name,route_long_name,min(stops.stop_id) as stop_id, | $query = "SELECT service_id,trips.route_id,route_short_name,route_long_name,min(stops.stop_id) as stop_id, |
min(ST_Distance(position, ST_GeographyFromText('SRID=4326;POINT($lng $lat)'), FALSE)) as distance | min(ST_Distance(position, ST_GeographyFromText('SRID=4326;POINT($lng $lat)'), FALSE)) as distance |
FROM stop_times | FROM stop_times |
join trips on trips.trip_id = stop_times.trip_id | join trips on trips.trip_id = stop_times.trip_id |
join routes on trips.route_id = routes.route_id | join routes on trips.route_id = routes.route_id |
join stops on stops.stop_id = stop_times.stop_id | join stops on stops.stop_id = stop_times.stop_id |
WHERE service_id=:service_period | WHERE service_id=:service_period |
AND ST_DWithin(position, ST_GeographyFromText('SRID=4326;POINT($lng $lat)'), :distance, FALSE) | AND ST_DWithin(position, ST_GeographyFromText('SRID=4326;POINT($lng $lat)'), :distance, FALSE) |
group by service_id,trips.route_id,route_short_name,route_long_name | group by service_id,trips.route_id,route_short_name,route_long_name |
order by distance $limitSQL"; | order by distance $limitSQL"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":service_period", $service_period); | $query->bindParam(":service_period", $service_period); |
$query->bindParam(":distance", $distance); | $query->bindParam(":distance", $distance); |
if ($limit != "") $query->bindParam(":limit", $limit); | if ($limit != "") $query->bindParam(":limit", $limit); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetchAll(); | return $query->fetchAll(); |
} | } |
?> | ?> |
<?php | <?php |
function getServiceOverride() { | function getServiceOverride($date="") { |
global $conn; | global $conn; |
$query = "Select * from calendar_dates where date = :date and exception_type = '1' LIMIT 1"; | $query = "Select * from calendar_dates where date = :date and exception_type = '1' LIMIT 1"; |
debug($query,"database"); | // debug($query,"database"); |
$query = $conn->prepare($query); // Create a prepared statement | $query = $conn->prepare($query); // Create a prepared statement |
$query->bindParam(":date", date("Ymd")); | $query->bindParam(":date", date("Ymd",($date != "" ? $date : time()))); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetch(PDO::FETCH_ASSOC); | return $query->fetch(PDO::FETCH_ASSOC); |
} | } |
function getCurrentAlerts() { | |
global $conn; | |
$query = "SELECT * from servicealerts_alerts"; | |
//debug($query, "database"); | |
$query = $conn->prepare($query); | |
//if ($stop_sequence != "") $query->bindParam(":stop_sequence", $stop_sequence); | |
$query->execute(); | |
if (!$query) { | |
databaseError($conn->errorInfo()); | |
return Array(); | |
} | |
return $query->fetchAll(); | |
} | |
function getInformedAlerts($id,$filter_class,$filter_id) { | |
global $conn; | |
$query = "SELECT * from servicealerts_informed where servicealert_id = :servicealert_id"; | |
if ($filter_class != "" && $filter_id != "") { | |
$query .= " AND (informed_class = :informed_class OR informed_class = 'network') AND informed_id = :informed_id"; | |
} | |
//debug($query, "database"); | |
$query = $conn->prepare($query); | |
if ($filter_class != "" && $filter_id != "") { | |
$query->bindParam(":informed_class", $filter_class); | |
$query->bindParam(":informed_id", $filter_id); | |
} | |
$query->bindParam(":servicealert_id", $id); | |
$query->execute(); | |
if (!$query) { | |
databaseError($conn->errorInfo()); | |
return Array(); | |
} | |
return $query->fetchAll(); | |
} | |
?> | ?> |
<?php | <?php |
function getStop($stopID) | function getStop($stopID) |
{ | { |
global $conn; | global $conn; |
$query = "Select * from stops where stop_id = :stopID LIMIT 1"; | $query = "Select * from stops where stop_id = :stopID LIMIT 1"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":stopID", $stopID); | $query->bindParam(":stopID", $stopID); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetch(PDO::FETCH_ASSOC); | return $query->fetch(PDO::FETCH_ASSOC); |
} | } |
function getStops($timingPointsOnly = false, $firstLetter = "") | function getStops($timingPointsOnly = false, $firstLetter = "", $startsWith = "") |
{ | { |
global $conn; | global $conn; |
$conditions = Array(); | $conditions = Array(); |
if ($timingPointsOnly) $conditions[] = "substr(stop_code,1,2) != 'Wj'"; | if ($timingPointsOnly) $conditions[] = "substr(stop_code,1,2) != 'Wj'"; |
if ($firstLetter != "") $conditions[] = "substr(stop_name,1,1) = :firstLetter"; | if ($firstLetter != "") $conditions[] = "substr(stop_name,1,1) = :firstLetter"; |
if ($startsWith != "") $conditions[] = "stop_name like :startsWith"; | |
$query = "Select * from stops"; | $query = "Select * from stops"; |
if (sizeof($conditions) > 0) { | if (sizeof($conditions) > 0) { |
if (sizeof($conditions) > 1) { | if (sizeof($conditions) > 1) { |
$query.= " Where " . implode(" AND ", $conditions) . " "; | $query.= " Where " . implode(" AND ", $conditions) . " "; |
} | } |
else { | else { |
$query.= " Where " . $conditions[0] . " "; | $query.= " Where " . $conditions[0] . " "; |
} | } |
} | } |
$query.= " order by stop_name;"; | $query.= " order by stop_name;"; |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
if ($firstLetter != "") $query->bindParam(":firstLetter", $firstLetter); | if ($firstLetter != "") $query->bindParam(":firstLetter", $firstLetter); |
if ($startsWith != "") { | |
$startsWith = $startsWith."%"; | |
$query->bindParam(":startsWith", $startsWith); | |
} | |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetchAll(); | return $query->fetchAll(); |
} | } |
function getNearbyStops($lat, $lng, $limit = "", $distance = 1000) | function getNearbyStops($lat, $lng, $limit = "", $distance = 1000) |
{ | { |
if ($lat == null || $lng == null) return Array(); | if ($lat == null || $lng == null) return Array(); |
if ($limit != "") $limitSQL = " LIMIT :limit "; | if ($limit != "") $limitSQL = " LIMIT :limit "; |
global $conn; | global $conn; |
$query = "Select *, ST_Distance(position, ST_GeographyFromText('SRID=4326;POINT($lng $lat)'), FALSE) as distance | $query = "Select *, ST_Distance(position, ST_GeographyFromText('SRID=4326;POINT($lng $lat)'), FALSE) as distance |
from stops WHERE ST_DWithin(position, ST_GeographyFromText('SRID=4326;POINT($lng $lat)'), :distance, FALSE) | from stops WHERE ST_DWithin(position, ST_GeographyFromText('SRID=4326;POINT($lng $lat)'), :distance, FALSE) |
order by distance $limitSQL;"; | order by distance $limitSQL;"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":distance", $distance); | $query->bindParam(":distance", $distance); |
$query->bindParam(":limit", $limit); | $query->bindParam(":limit", $limit); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetchAll(); | return $query->fetchAll(); |
} | } |
function getStopsBySuburb($suburb) | function getStopsBySuburb($suburb) |
{ | { |
global $conn; | global $conn; |
$query = "Select * from stops where zone_id LIKE :suburb order by stop_name;"; | $query = "Select * from stops where zone_id LIKE :suburb order by stop_name;"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$suburb = "%" . $suburb . ";%"; | $suburb = "%" . $suburb . ";%"; |
$query->bindParam(":suburb", $suburb); | $query->bindParam(":suburb", $suburb); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetchAll(); | return $query->fetchAll(); |
} | } |
function getStopsByStopCode($stop_code,$startsWith = "") | |
{ | |
global $conn; | |
$query = "Select * from stops where (stop_code = :stop_code OR stop_code LIKE :stop_code2)"; | |
if ($startsWith != "") $query .= " AND stop_name like :startsWith"; | |
debug($query, "database"); | |
$query = $conn->prepare($query); | |
$query->bindParam(":stop_code", $stop_code); | |
$stop_code2 = $stop_code . "%"; | |
$query->bindParam(":stop_code2", $stop_code2); | |
if ($startsWith != "") { | |
$startsWith = $startsWith."%"; | |
$query->bindParam(":startsWith", $startsWith); | |
} | |
$query->execute(); | |
if (!$query) { | |
databaseError($conn->errorInfo()); | |
return Array(); | |
} | |
return $query->fetchAll(); | |
} | |
function getStopRoutes($stopID, $service_period) | function getStopRoutes($stopID, $service_period) |
{ | { |
if ($service_period == "") $service_period = service_period(); | if ($service_period == "") $service_period = service_period(); |
global $conn; | global $conn; |
$query = "SELECT service_id,trips.route_id,route_short_name,route_long_name | $query = "SELECT distinct service_id,trips.route_id,route_short_name,route_long_name |
FROM stop_times join trips on trips.trip_id = | FROM stop_times join trips on trips.trip_id = |
stop_times.trip_id join routes on trips.route_id = routes.route_id WHERE stop_id = :stopID AND service_id=:service_period"; | stop_times.trip_id join routes on trips.route_id = routes.route_id WHERE stop_id = :stopID AND service_id=:service_period"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":service_period", $service_period); | $query->bindParam(":service_period", $service_period); |
$query->bindParam(":stopID", $stopID); | $query->bindParam(":stopID", $stopID); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetchAll(); | return $query->fetchAll(); |
} | } |
function getStopTrips($stopID, $service_period = "", $afterTime = "") | function getStopTrips($stopID, $service_period = "", $afterTime = "", $limit = "") |
{ | { |
if ($service_period == "") $service_period = service_period(); | if ($service_period == "") $service_period = service_period(); |
if ($limit != "") $limitSQL = " LIMIT :limit "; | |
global $conn; | global $conn; |
if ($afterTime != "") { | if ($afterTime != "") { |
$query = " SELECT stop_times.trip_id,stop_times.arrival_time,stop_times.stop_id,stop_sequence,service_id,trips.route_id,route_short_name,route_long_name, end_times.arrival_time as end_time | $query = " SELECT stop_times.trip_id,stop_times.arrival_time,stop_times.stop_id,stop_sequence,service_id,trips.route_id,route_short_name,route_long_name, end_times.arrival_time as end_time |
FROM stop_times | FROM stop_times |
join trips on trips.trip_id = | join trips on trips.trip_id = |
stop_times.trip_id | stop_times.trip_id |
join routes on trips.route_id = routes.route_id , (SELECT trip_id,max(arrival_time) as arrival_time from stop_times | join routes on trips.route_id = routes.route_id , (SELECT trip_id,max(arrival_time) as arrival_time from stop_times |
WHERE stop_times.arrival_time IS NOT NULL group by trip_id) as end_times | WHERE stop_times.arrival_time IS NOT NULL group by trip_id) as end_times |
WHERE stop_times.stop_id = :stopID | WHERE stop_times.stop_id = :stopID |
AND stop_times.trip_id = end_times.trip_id | AND stop_times.trip_id = end_times.trip_id |
AND service_id=:service_period | AND service_id=:service_period |
AND end_times.arrival_time > :afterTime | AND end_times.arrival_time > :afterTime |
ORDER BY end_time"; | ORDER BY end_time $limitSQL"; |
} | } |
else { | else { |
$query = "SELECT stop_times.trip_id,arrival_time,stop_times.stop_id,stop_sequence,service_id,trips.route_id,route_short_name,route_long_name | $query = "SELECT stop_times.trip_id,arrival_time,stop_times.stop_id,stop_sequence,service_id,trips.route_id,route_short_name,route_long_name |
FROM stop_times | FROM stop_times |
join trips on trips.trip_id = | join trips on trips.trip_id = |
stop_times.trip_id | stop_times.trip_id |
join routes on trips.route_id = routes.route_id | join routes on trips.route_id = routes.route_id |
WHERE stop_times.stop_id = :stopID | WHERE stop_times.stop_id = :stopID |
AND service_id=:service_period | AND service_id=:service_period |
ORDER BY arrival_time"; | ORDER BY arrival_time $limitSQL"; |
} | } |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":service_period", $service_period); | $query->bindParam(":service_period", $service_period); |
$query->bindParam(":stopID", $stopID); | $query->bindParam(":stopID", $stopID); |
if ($limit != "") $query->bindParam(":limit", $limit); | |
if ($afterTime != "") $query->bindParam(":afterTime", $afterTime); | if ($afterTime != "") $query->bindParam(":afterTime", $afterTime); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetchAll(); | return $query->fetchAll(); |
} | } |
function getStopTripsWithTimes($stopID, $time = "", $service_period = "", $time_range = "", $limit = "") | function getStopTripsWithTimes($stopID, $time = "", $service_period = "", $time_range = "", $limit = "") |
{ | { |
if ($service_period == "") $service_period = service_period(); | if ($service_period == "") $service_period = service_period(); |
if ($time_range == "") $time_range = (24 * 60 * 60); | if ($time_range == "") $time_range = (24 * 60 * 60); |
if ($time == "") $time = current_time(); | if ($time == "") $time = current_time(); |
if ($limit == "") $limit = 10; | if ($limit == "") $limit = 10; |
$trips = getStopTrips($stopID, $service_period, $time); | $trips = getStopTrips($stopID, $service_period, $time); |
$timedTrips = Array(); | $timedTrips = Array(); |
if ($trips && sizeof($trips) > 0) { | if ($trips && sizeof($trips) > 0) { |
foreach ($trips as $trip) { | foreach ($trips as $trip) { |
if ($trip['arrival_time'] != "") { | if ($trip['arrival_time'] != "") { |
if (strtotime($trip['arrival_time']) > strtotime($time) and strtotime($trip['arrival_time']) < (strtotime($time) + $time_range)) { | if (strtotime($trip['arrival_time']) > strtotime($time) and strtotime($trip['arrival_time']) < (strtotime($time) + $time_range)) { |
$timedTrips[] = $trip; | $timedTrips[] = $trip; |
} | } |
} | } |
else { | else { |
$timedTrip = getTimeInterpolatedTripAtStop($trip['trip_id'], $trip['stop_sequence']); | $timedTrip = getTimeInterpolatedTripAtStop($trip['trip_id'], $trip['stop_sequence']); |
if ($timedTrip['arrival_time'] > $time and strtotime($timedTrip['arrival_time']) < (strtotime($time) + $time_range)) { | if ($timedTrip['arrival_time'] > $time and strtotime($timedTrip['arrival_time']) < (strtotime($time) + $time_range)) { |
$timedTrips[] = $timedTrip; | $timedTrips[] = $timedTrip; |
} | } |
} | } |
if (sizeof($timedTrips) > $limit) break; | if (sizeof($timedTrips) > $limit) break; |
} | } |
sktimesort($timedTrips, "arrival_time", true); | sktimesort($timedTrips, "arrival_time", true); |
} | } |
return $timedTrips; | return $timedTrips; |
} | } |
?> | ?> |
<?php | <?php |
function getTrip($tripID) | function getTrip($tripID) |
{ | { |
global $conn; | global $conn; |
$query = "Select * from trips | $query = "Select * from trips |
join routes on trips.route_id = routes.route_id | join routes on trips.route_id = routes.route_id |
where trip_id = :tripID | where trip_id = :tripID |
LIMIT 1"; | LIMIT 1"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":tripID", $tripID); | $query->bindParam(":tripID", $tripID); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetch(PDO::FETCH_ASSOC); | return $query->fetch(PDO::FETCH_ASSOC); |
} | } |
function getTripShape($tripID) | function getTripShape($tripID) |
{ | { |
global $conn; | global $conn; |
$query = "SELECT ST_AsKML(ST_MakeLine(geometry(a.position))) as the_route | $query = "SELECT ST_AsKML(ST_MakeLine(geometry(a.position))) as the_route |
FROM (SELECT position, | FROM (SELECT position, |
stop_sequence, trips.trip_id | stop_sequence, trips.trip_id |
FROM stop_times | FROM stop_times |
join trips on trips.trip_id = stop_times.trip_id | join trips on trips.trip_id = stop_times.trip_id |
join stops on stops.stop_id = stop_times.stop_id | join stops on stops.stop_id = stop_times.stop_id |
WHERE trips.trip_id = :tripID ORDER BY stop_sequence) as a group by a.trip_id"; | WHERE trips.trip_id = :tripID ORDER BY stop_sequence) as a group by a.trip_id"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":tripID", $tripID); | $query->bindParam(":tripID", $tripID); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetchColumn(0); | return $query->fetchColumn(0); |
} | } |
function getTimeInterpolatedTrip($tripID, $range = "") | function getTimeInterpolatedTrip($tripID, $range = "") |
{ | { |
global $conn; | global $conn; |
$query = "SELECT stop_times.trip_id,arrival_time,stop_times.stop_id,stop_lat,stop_lon,stop_name,stop_code, | $query = "SELECT stop_times.trip_id,arrival_time,stop_times.stop_id,stop_lat,stop_lon,stop_name,stop_code, |
stop_sequence,service_id,trips.route_id,route_short_name,route_long_name | stop_sequence,service_id,trips.route_id,route_short_name,route_long_name |
FROM stop_times | FROM stop_times |
join trips on trips.trip_id = stop_times.trip_id | join trips on trips.trip_id = stop_times.trip_id |
join routes on trips.route_id = routes.route_id | join routes on trips.route_id = routes.route_id |
join stops on stops.stop_id = stop_times.stop_id | join stops on stops.stop_id = stop_times.stop_id |
WHERE trips.trip_id = :tripID $range ORDER BY stop_sequence"; | WHERE trips.trip_id = :tripID $range ORDER BY stop_sequence"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":tripID", $tripID); | $query->bindParam(":tripID", $tripID); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
$stopTimes = $query->fetchAll(); | $stopTimes = $query->fetchAll(); |
$cur_timepoint = Array(); | $cur_timepoint = Array(); |
$next_timepoint = Array(); | $next_timepoint = Array(); |
$distance_between_timepoints = 0.0; | $distance_between_timepoints = 0.0; |
$distance_traveled_between_timepoints = 0.0; | $distance_traveled_between_timepoints = 0.0; |
$rv = Array(); | $rv = Array(); |
foreach ($stopTimes as $i => $stopTime) { | foreach ($stopTimes as $i => $stopTime) { |
if ($stopTime['arrival_time'] != "") { | if ($stopTime['arrival_time'] != "") { |
// is timepoint | // is timepoint |
$cur_timepoint = $stopTime; | $cur_timepoint = $stopTime; |
$distance_between_timepoints = 0.0; | $distance_between_timepoints = 0.0; |
$distance_traveled_between_timepoints = 0.0; | $distance_traveled_between_timepoints = 0.0; |
if ($i + 1 < sizeof($stopTimes)) { | if ($i + 1 < sizeof($stopTimes)) { |
$k = $i + 1; | $k = $i + 1; |
$distance_between_timepoints+= distance($stopTimes[$k - 1]["stop_lat"], $stopTimes[$k - 1]["stop_lon"], $stopTimes[$k]["stop_lat"], $stopTimes[$k]["stop_lon"]); | $distance_between_timepoints+= distance($stopTimes[$k - 1]["stop_lat"], $stopTimes[$k - 1]["stop_lon"], $stopTimes[$k]["stop_lat"], $stopTimes[$k]["stop_lon"]); |
while ($stopTimes[$k]["arrival_time"] == "" && $k + 1 < sizeof($stopTimes)) { | while ($stopTimes[$k]["arrival_time"] == "" && $k + 1 < sizeof($stopTimes)) { |
$k+= 1; | $k+= 1; |
//echo "k".$k; | //echo "k".$k; |
$distance_between_timepoints+= distance($stopTimes[$k - 1]["stop_lat"], $stopTimes[$k - 1]["stop_lon"], $stopTimes[$k]["stop_lat"], $stopTimes[$k]["stop_lon"]); | $distance_between_timepoints+= distance($stopTimes[$k - 1]["stop_lat"], $stopTimes[$k - 1]["stop_lon"], $stopTimes[$k]["stop_lat"], $stopTimes[$k]["stop_lon"]); |
} | } |
$next_timepoint = $stopTimes[$k]; | $next_timepoint = $stopTimes[$k]; |
$rv[] = $stopTime; | |
} | } |
$rv[] = $stopTime; | |
} | } |
else { | else { |
// is untimed point | // is untimed point |
//echo "i".$i; | //echo "i".$i; |
$distance_traveled_between_timepoints+= distance($stopTimes[$i - 1]["stop_lat"], $stopTimes[$i - 1]["stop_lon"], $stopTimes[$i]["stop_lat"], $stopTimes[$i]["stop_lon"]); | $distance_traveled_between_timepoints+= distance($stopTimes[$i - 1]["stop_lat"], $stopTimes[$i - 1]["stop_lon"], $stopTimes[$i]["stop_lat"], $stopTimes[$i]["stop_lon"]); |
//echo "$distance_traveled_between_timepoints / $distance_between_timepoints<br>"; | //echo "$distance_traveled_between_timepoints / $distance_between_timepoints<br>"; |
$distance_percent = $distance_traveled_between_timepoints / $distance_between_timepoints; | $distance_percent = $distance_traveled_between_timepoints / $distance_between_timepoints; |
if ($next_timepoint["arrival_time"] != "") { | if ($next_timepoint["arrival_time"] != "") { |
$total_time = strtotime($next_timepoint["arrival_time"]) - strtotime($cur_timepoint["arrival_time"]); | $total_time = strtotime($next_timepoint["arrival_time"]) - strtotime($cur_timepoint["arrival_time"]); |
//echo strtotime($next_timepoint["arrival_time"])." - ".strtotime($cur_timepoint["arrival_time"])."<br>"; | //echo strtotime($next_timepoint["arrival_time"])." - ".strtotime($cur_timepoint["arrival_time"])."<br>"; |
$time_estimate = ($distance_percent * $total_time) + strtotime($cur_timepoint["arrival_time"]); | $time_estimate = ($distance_percent * $total_time) + strtotime($cur_timepoint["arrival_time"]); |
$stopTime["arrival_time"] = date("H:i:s", $time_estimate); | $stopTime["arrival_time"] = date("H:i:s", $time_estimate); |
} | } |
else { | else { |
$stopTime["arrival_time"] = $cur_timepoint["arrival_time"]; | $stopTime["arrival_time"] = $cur_timepoint["arrival_time"]; |
} | } |
$rv[] = $stopTime; | $rv[] = $stopTime; |
//var_dump($rv); | |
} | } |
} | } |
//var_dump($rv); | |
return $rv; | return $rv; |
} | } |
function getTripPreviousTimePoint($tripID, $stop_sequence) | function getTripPreviousTimePoint($tripID, $stop_sequence) |
{ | { |
global $conn; | global $conn; |
$query = " SELECT trip_id,stop_id, | $query = " SELECT trip_id,stop_id, |
stop_sequence | stop_sequence |
FROM stop_times | FROM stop_times |
WHERE trip_id = :tripID and stop_sequence < :stop_sequence | WHERE trip_id = :tripID and stop_sequence < :stop_sequence |
and stop_times.arrival_time IS NOT NULL ORDER BY stop_sequence DESC LIMIT 1"; | and stop_times.arrival_time IS NOT NULL ORDER BY stop_sequence DESC LIMIT 1"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":tripID", $tripID); | $query->bindParam(":tripID", $tripID); |
$query->bindParam(":stop_sequence", $stop_sequence); | $query->bindParam(":stop_sequence", $stop_sequence); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetch(PDO::FETCH_ASSOC); | return $query->fetch(PDO::FETCH_ASSOC); |
} | } |
function getTripNextTimePoint($tripID, $stop_sequence) | function getTripNextTimePoint($tripID, $stop_sequence) |
{ | { |
global $conn; | global $conn; |
$query = " SELECT trip_id,stop_id, | $query = " SELECT trip_id,stop_id, |
stop_sequence | stop_sequence |
FROM stop_times | FROM stop_times |
WHERE trip_id = :tripID and stop_sequence > :stop_sequence | WHERE trip_id = :tripID and stop_sequence > :stop_sequence |
and stop_times.arrival_time IS NOT NULL ORDER BY stop_sequence LIMIT 1"; | and stop_times.arrival_time IS NOT NULL ORDER BY stop_sequence LIMIT 1"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":tripID", $tripID); | $query->bindParam(":tripID", $tripID); |
$query->bindParam(":stop_sequence", $stop_sequence); | $query->bindParam(":stop_sequence", $stop_sequence); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetch(PDO::FETCH_ASSOC); | return $query->fetch(PDO::FETCH_ASSOC); |
} | } |
function getTimeInterpolatedTripAtStop($tripID, $stop_sequence) | function getTimeInterpolatedTripAtStop($tripID, $stop_sequence) |
{ | { |
global $conn; | global $conn; |
// limit interpolation to between nearest actual points. | // limit interpolation to between nearest actual points. |
$prevTimePoint = getTripPreviousTimePoint($tripID, $stop_sequence); | $prevTimePoint = getTripPreviousTimePoint($tripID, $stop_sequence); |
$nextTimePoint = getTripNextTimePoint($tripID, $stop_sequence); | $nextTimePoint = getTripNextTimePoint($tripID, $stop_sequence); |
$range = "AND stop_sequence >= '{$prevTimePoint['stop_sequence']}' AND stop_sequence <= '{$nextTimePoint['stop_sequence']}'"; | //echo " prev {$lowestDelta['stop_sequence']} next {$nextTimePoint['stop_sequence']} "; |
$range = ""; | |
if ($prevTimePoint != "") $range .= " AND stop_sequence >= '{$prevTimePoint['stop_sequence']}'"; | |
if ($nextTimePoint != "") $range .= " AND stop_sequence <= '{$nextTimePoint['stop_sequence']}'"; | |
foreach (getTimeInterpolatedTrip($tripID, $range) as $tripStop) { | foreach (getTimeInterpolatedTrip($tripID, $range) as $tripStop) { |
if ($tripStop['stop_sequence'] == $stop_sequence) return $tripStop; | if ($tripStop['stop_sequence'] == $stop_sequence) return $tripStop; |
} | } |
return Array(); | return Array(); |
} | } |
function getTripStartTime($tripID) | function getTripStartTime($tripID) |
{ | { |
global $conn; | global $conn; |
$query = "Select * from stop_times | $query = "Select * from stop_times |
where trip_id = :tripID | where trip_id = :tripID |
AND arrival_time IS NOT NULL | AND arrival_time IS NOT NULL |
AND stop_sequence = '1'"; | AND stop_sequence = '1'"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":tripID", $tripID); | $query->bindParam(":tripID", $tripID); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
$r = $query->fetch(PDO::FETCH_ASSOC); | $r = $query->fetch(PDO::FETCH_ASSOC); |
return $r['arrival_time']; | return $r['arrival_time']; |
} | } |
function getTripEndTime($tripID) | |
{ | |
global $conn; | |
$query = "SELECT trip_id,max(arrival_time) as arrival_time from stop_times | |
WHERE stop_times.arrival_time IS NOT NULL and trip_id = :tripID group by trip_id"; | |
debug($query, "database"); | |
$query = $conn->prepare($query); | |
$query->bindParam(":tripID", $tripID); | |
$query->execute(); | |
if (!$query) { | |
databaseError($conn->errorInfo()); | |
return Array(); | |
} | |
$r = $query->fetch(PDO::FETCH_ASSOC); | |
return $r['arrival_time']; | |
} | |
function getActiveTrips($time) | function getActiveTrips($time) |
{ | { |
global $conn; | global $conn; |
if ($time == "") $time = current_time(); | if ($time == "") $time = current_time(); |
$query = "Select distinct stop_times.trip_id, start_times.arrival_time as start_time, end_times.arrival_time as end_time from stop_times, (SELECT trip_id,arrival_time from stop_times WHERE stop_times.arrival_time IS NOT NULL | $query = "Select distinct stop_times.trip_id, start_times.arrival_time as start_time, end_times.arrival_time as end_time from stop_times, (SELECT trip_id,arrival_time from stop_times WHERE stop_times.arrival_time IS NOT NULL |
AND stop_sequence = '1') as start_times, (SELECT trip_id,max(arrival_time) as arrival_time from stop_times WHERE stop_times.arrival_time IS NOT NULL group by trip_id) as end_times | AND stop_sequence = '1') as start_times, (SELECT trip_id,max(arrival_time) as arrival_time from stop_times WHERE stop_times.arrival_time IS NOT NULL group by trip_id) as end_times |
WHERE start_times.trip_id = end_times.trip_id AND stop_times.trip_id = end_times.trip_id AND :time > start_times.arrival_time AND :time < end_times.arrival_time"; | WHERE start_times.trip_id = end_times.trip_id AND stop_times.trip_id = end_times.trip_id AND :time > start_times.arrival_time AND :time < end_times.arrival_time"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":time", $time); | $query->bindParam(":time", $time); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetchAll(); | return $query->fetchAll(); |
} | } |
function viaPoints($tripID, $stop_sequence = "") | function viaPoints($tripID, $stop_sequence = "") |
{ | { |
global $conn; | global $conn; |
$query = "SELECT stops.stop_id, stop_name, arrival_time | $query = "SELECT stops.stop_id, stop_name, arrival_time |
FROM stop_times join stops on stops.stop_id = stop_times.stop_id | FROM stop_times join stops on stops.stop_id = stop_times.stop_id |
WHERE stop_times.trip_id = :tripID | WHERE stop_times.trip_id = :tripID |
" . ($stop_sequence != "" ? " AND stop_sequence > :stop_sequence " : "") . "AND substr(stop_code,1,2) != 'Wj' ORDER BY stop_sequence"; | " . ($stop_sequence != "" ? " AND stop_sequence > :stop_sequence " : "") . "AND substr(stop_code,1,2) != 'Wj' ORDER BY stop_sequence"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
if ($stop_sequence != "") $query->bindParam(":stop_sequence", $stop_sequence); | if ($stop_sequence != "") $query->bindParam(":stop_sequence", $stop_sequence); |
$query->bindParam(":tripID", $tripID); | $query->bindParam(":tripID", $tripID); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetchAll(); | return $query->fetchAll(); |
} | } |
function viaPointNames($tripid, $stop_sequence = "") | function viaPointNames($tripid, $stop_sequence = "") |
{ | { |
$viaPointNames = Array(); | $viaPointNames = Array(); |
foreach (viaPoints($tripid, $stop_sequence) as $point) { | foreach (viaPoints($tripid, $stop_sequence) as $point) { |
$viaPointNames[] = $point['stop_name']; | $viaPointNames[] = $point['stop_name']; |
} | } |
if (sizeof($viaPointNames) > 0) { | if (sizeof($viaPointNames) > 0) { |
return r_implode(", ", $viaPointNames); | return r_implode(", ", $viaPointNames); |
} | } |
else { | else { |
return ""; | return ""; |
} | } |
} | } |
?> | ?> |
<?php | <?php |
include ('include/common.inc.php'); | include ('include/common.inc.php'); |
include_header("bus.lambdacomplex.org", "index", false) | include_header("bus.lambdacomplex.org", "index", false) |
?> | ?> |
<div data-role="page"> | <div data-role="page"> |
<div data-role="content"> | <div data-role="content"> |
<div id="jqm-homeheader"> | <div id="jqm-homeheader"> |
<h1>busness time</h1><br><small>Canberra Bus Timetables and Trip Planner</small> | <h1>busness time</h1><br><small>Canberra Bus Timetables and Trip Planner</small> |
</div> | </div> |
<a name="maincontent" id="maincontent"></a> | <a name="maincontent" id="maincontent"></a> |
<a href="tripPlanner.php" data-role="button" data-icon="navigation">Launch Trip Planner...</a> | <a href="tripPlanner.php" data-role="button" data-icon="navigation">Launch Trip Planner...</a> |
<ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b"> | <ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b"> |
<li data-role="list-divider">Timetables - Stops</li> | <li data-role="list-divider">Timetables - Stops</li> |
<li><a href="stopList.php">Major (Timing Point) Stops</a></li> | <li><a href="stopList.php">Major (Timing Point) Stops</a></li> |
<li><a href="stopList.php?allstops=yes">All Stops</a></li> | <li><a href="stopList.php?allstops=yes">All Stops</a></li> |
<li><a href="stopList.php?bysuburbs=yes">Stops By Suburb</a></li> | <li><a href="stopList.php?bysuburbs=yes">Stops By Suburb</a></li> |
<li><a class="nearby" href="stopList.php?nearby=yes">Nearby Stops</a></li> | <li><a class="nearby" href="stopList.php?nearby=yes">Nearby Stops</a></li> |
</ul> | </ul> |
<ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b"> | <ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b"> |
<li data-role="list-divider">Timetables - Routes</li> | <li data-role="list-divider">Timetables - Routes</li> |
<li><a href="routeList.php">Routes By Final Destination</a></li> | <li><a href="routeList.php">Routes By Final Destination</a></li> |
<li><a href="routeList.php?bynumber=yes">Routes By Number</a></li> | <li><a href="routeList.php?bynumber=yes">Routes By Number</a></li> |
<li><a href="routeList.php?bysuburbs=yes">Routes By Suburb</a></li> | <li><a href="routeList.php?bysuburbs=yes">Routes By Suburb</a></li> |
<li><a class="nearby" href="routeList.php?nearby=yes">Nearby Routes</a></li> | <li><a class="nearby" href="routeList.php?nearby=yes">Nearby Routes</a></li> |
</ul> | </ul> |
<?php | <?php |
echo timePlaceSettings(); | |
echo ' <a href="labs/index.php" data-role="button" data-icon="beaker">Busness R&D</a>'; | echo ' <a href="labs/index.php" data-role="button" data-icon="beaker">Busness R&D</a>'; |
include_footer(true) | include_footer(true) |
?> | ?> |
/*! LAB.js (LABjs :: Loading And Blocking JavaScript) | |
v2.0.1 (c) Kyle Simpson | |
MIT License | |
*/ | |
(function(o){var K=o.$LAB,y="UseLocalXHR",z="AlwaysPreserveOrder",u="AllowDuplicates",A="CacheBust",B="BasePath",C=/^[^?#]*\//.exec(location.href)[0],D=/^\w+\:\/\/\/?[^\/]+/.exec(C)[0],i=document.head||document.getElementsByTagName("head"),L=(o.opera&&Object.prototype.toString.call(o.opera)=="[object Opera]")||("MozAppearance"in document.documentElement.style),q=document.createElement("script"),E=typeof q.preload=="boolean",r=E||(q.readyState&&q.readyState=="uninitialized"),F=!r&&q.async===true,M=!r&&!F&&!L;function G(a){return Object.prototype.toString.call(a)=="[object Function]"}function H(a){return Object.prototype.toString.call(a)=="[object Array]"}function N(a,c){var b=/^\w+\:\/\//;if(/^\/\/\/?/.test(a)){a=location.protocol+a}else if(!b.test(a)&&a.charAt(0)!="/"){a=(c||"")+a}return b.test(a)?a:((a.charAt(0)=="/"?D:C)+a)}function s(a,c){for(var b in a){if(a.hasOwnProperty(b)){c[b]=a[b]}}return c}function O(a){var c=false;for(var b=0;b<a.scripts.length;b++){if(a.scripts[b].ready&&a.scripts[b].exec_trigger){c=true;a.scripts[b].exec_trigger();a.scripts[b].exec_trigger=null}}return c}function t(a,c,b,d){a.onload=a.onreadystatechange=function(){if((a.readyState&&a.readyState!="complete"&&a.readyState!="loaded")||c[b])return;a.onload=a.onreadystatechange=null;d()}}function I(a){a.ready=a.finished=true;for(var c=0;c<a.finished_listeners.length;c++){setTimeout(a.finished_listeners[c],0)}a.ready_listeners=[];a.finished_listeners=[]}function P(d,f,e,g,h){setTimeout(function(){var a,c=f.real_src,b;if("item"in i){if(!i[0]){setTimeout(arguments.callee,25);return}i=i[0]}a=document.createElement("script");if(f.type)a.type=f.type;if(f.charset)a.charset=f.charset;if(h){if(r){e.elem=a;if(E){a.preload=true;a.onpreload=g}else{a.onreadystatechange=function(){if(a.readyState=="loaded")g();a.onreadystatechange=null}}a.src=c}else if(h&&c.indexOf(D)==0&&d[y]){b=new XMLHttpRequest();b.onreadystatechange=function(){if(b.readyState==4){b.onreadystatechange=function(){};e.text=b.responseText+"\n//@ sourceURL="+c;g()}};b.open("GET",c);b.send()}else{a.type="text/cache-script";t(a,e,"ready",function(){i.removeChild(a);g()});a.src=c;i.insertBefore(a,i.firstChild)}}else if(F){a.async=false;t(a,e,"finished",g);a.src=c;i.insertBefore(a,i.firstChild)}else{t(a,e,"finished",g);a.src=c;i.insertBefore(a,i.firstChild)}},0)}function J(){var l={},Q=r||M,n=[],p={},m;l[y]=true;l[z]=false;l[u]=false;l[A]=false;l[B]="";function R(a,c,b){var d;function f(){if(d!=null){I(b);d=null}}if(p[c.src].finished)return;if(!a[u])p[c.src].finished=true;d=b.elem||document.createElement("script");if(c.type)d.type=c.type;if(c.charset)d.charset=c.charset;t(d,b,"finished",f);if(b.elem){b.elem=null}else if(b.text){d.onload=d.onreadystatechange=null;d.text=b.text}else{d.src=c.real_src}i.insertBefore(d,i.firstChild);if(b.text){f()}}function S(c,b,d,f){var e,g,h=function(){b.ready_cb(b,function(){R(c,b,e)})},j=function(){b.finished_cb(b,d)};b.src=N(b.src,c[B]);b.real_src=b.src+(c[A]?((/\?.*$/.test(b.src)?"&_":"?_")+~~(Math.random()*1E9)+"="):"");if(!p[b.src])p[b.src]={items:[],finished:false};g=p[b.src].items;if(c[u]||g.length==0){e=g[g.length]={ready:false,finished:false,ready_listeners:[h],finished_listeners:[j]};P(c,b,e,((f)?function(){e.ready=true;for(var a=0;a<e.ready_listeners.length;a++){setTimeout(e.ready_listeners[a],0)}e.ready_listeners=[]}:function(){I(e)}),f)}else{e=g[0];if(e.finished){setTimeout(j,0)}else{e.finished_listeners.push(j)}}}function v(){var e,g=s(l,{}),h=[],j=0,w=false,k;function T(a,c){a.ready=true;a.exec_trigger=c;x()}function U(a,c){a.ready=a.finished=true;a.exec_trigger=null;for(var b=0;b<c.scripts.length;b++){if(!c.scripts[b].finished)return}c.finished=true;x()}function x(){while(j<h.length){if(G(h[j])){try{h[j]()}catch(err){}}else if(!h[j].finished){if(O(h[j]))continue;break}j++}if(j==h.length){w=false;k=false}}function V(){if(!k||!k.scripts){h.push(k={scripts:[],finished:true})}}e={script:function(){for(var f=0;f<arguments.length;f++){(function(a,c){var b;if(!H(a)){c=[a]}for(var d=0;d<c.length;d++){V();a=c[d];if(G(a))a=a();if(!a)continue;if(H(a)){b=[].slice.call(a);b.push(d,1);c.splice.call(c,b);d--;continue}if(typeof a=="string")a={src:a};a=s(a,{ready:false,ready_cb:T,finished:false,finished_cb:U});k.finished=false;k.scripts.push(a);S(g,a,k,(Q&&w));w=true;if(g[z])e.wait()}})(arguments[f],arguments[f])}return e},wait:function(){if(arguments.length>0){for(var a=0;a<arguments.length;a++){h.push(arguments[a])}k=h[h.length-1]}else k=false;x();return e}};return{script:e.script,wait:e.wait,setOptions:function(a){s(a,g);return e}}}m={setGlobalDefaults:function(a){s(a,l);return m},setOptions:function(){return v().setOptions.apply(null,arguments)},script:function(){return v().script.apply(null,arguments)},wait:function(){return v().wait.apply(null,arguments)},queueScript:function(){n[n.length]={type:"script",args:[].slice.call(arguments)};return m},queueWait:function(){n[n.length]={type:"wait",args:[].slice.call(arguments)};return m},runQueue:function(){var a=m,c=n.length,b=c,d;for(;--b>=0;){d=n.shift();a=a[d.type].apply(null,d.args)}return a},noConflict:function(){o.$LAB=K;return m},sandbox:function(){return J()}};return m}o.$LAB=J();(function(a,c,b){if(document.readyState==null&&document[a]){document.readyState="loading";document[a](c,b=function(){document.removeEventListener(c,b,false);document.readyState="complete"},false)}})("addEventListener","DOMContentLoaded")})(this); |
// Copyright 2006 Google Inc. | |
// | |
// Licensed under the Apache License, Version 2.0 (the "License"); | |
// you may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at | |
// | |
// http://www.apache.org/licenses/LICENSE-2.0 | |
// | |
// Unless required by applicable law or agreed to in writing, software | |
// distributed under the License is distributed on an "AS IS" BASIS, | |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
// See the License for the specific language governing permissions and | |
// limitations under the License. | |
// Known Issues: | |
// | |
// * Patterns only support repeat. | |
// * Radial gradient are not implemented. The VML version of these look very | |
// different from the canvas one. | |
// * Clipping paths are not implemented. | |
// * Coordsize. The width and height attribute have higher priority than the | |
// width and height style values which isn't correct. | |
// * Painting mode isn't implemented. | |
// * Canvas width/height should is using content-box by default. IE in | |
// Quirks mode will draw the canvas using border-box. Either change your | |
// doctype to HTML5 | |
// (http://www.whatwg.org/specs/web-apps/current-work/#the-doctype) | |
// or use Box Sizing Behavior from WebFX | |
// (http://webfx.eae.net/dhtml/boxsizing/boxsizing.html) | |
// * Non uniform scaling does not correctly scale strokes. | |
// * Filling very large shapes (above 5000 points) is buggy. | |
// * Optimize. There is always room for speed improvements. | |
// Only add this code if we do not already have a canvas implementation | |
if (!document.createElement('canvas').getContext) { | |
(function() { | |
// alias some functions to make (compiled) code shorter | |
var m = Math; | |
var mr = m.round; | |
var ms = m.sin; | |
var mc = m.cos; | |
var abs = m.abs; | |
var sqrt = m.sqrt; | |
// this is used for sub pixel precision | |
var Z = 10; | |
var Z2 = Z / 2; | |
/** | |
* This funtion is assigned to the <canvas> elements as element.getContext(). | |
* @this {HTMLElement} | |
* @return {CanvasRenderingContext2D_} | |
*/ | |
function getContext() { | |
return this.context_ || | |
(this.context_ = new CanvasRenderingContext2D_(this)); | |
} | |
var slice = Array.prototype.slice; | |
/** | |
* Binds a function to an object. The returned function will always use the | |
* passed in {@code obj} as {@code this}. | |
* | |
* Example: | |
* | |
* g = bind(f, obj, a, b) | |
* g(c, d) // will do f.call(obj, a, b, c, d) | |
* | |
* @param {Function} f The function to bind the object to | |
* @param {Object} obj The object that should act as this when the function | |
* is called | |
* @param {*} var_args Rest arguments that will be used as the initial | |
* arguments when the function is called | |
* @return {Function} A new function that has bound this | |
*/ | |
function bind(f, obj, var_args) { | |
var a = slice.call(arguments, 2); | |
return function() { | |
return f.apply(obj, a.concat(slice.call(arguments))); | |
}; | |
} | |
function encodeHtmlAttribute(s) { | |
return String(s).replace(/&/g, '&').replace(/"/g, '"'); | |
} | |
function addNamespacesAndStylesheet(doc) { | |
// create xmlns | |
if (!doc.namespaces['g_vml_']) { | |
doc.namespaces.add('g_vml_', 'urn:schemas-microsoft-com:vml', | |
'#default#VML'); | |
} | |
if (!doc.namespaces['g_o_']) { | |
doc.namespaces.add('g_o_', 'urn:schemas-microsoft-com:office:office', | |
'#default#VML'); | |
} | |
// Setup default CSS. Only add one style sheet per document | |
if (!doc.styleSheets['ex_canvas_']) { | |
var ss = doc.createStyleSheet(); | |
ss.owningElement.id = 'ex_canvas_'; | |
ss.cssText = 'canvas{display:inline-block;overflow:hidden;' + | |
// default size is 300x150 in Gecko and Opera | |
'text-align:left;width:300px;height:150px}'; | |
} | |
} | |
// Add namespaces and stylesheet at startup. | |
addNamespacesAndStylesheet(document); | |
var G_vmlCanvasManager_ = { | |
init: function(opt_doc) { | |
if (/MSIE/.test(navigator.userAgent) && !window.opera) { | |
var doc = opt_doc || document; | |
// Create a dummy element so that IE will allow canvas elements to be | |
// recognized. | |
doc.createElement('canvas'); | |
doc.attachEvent('onreadystatechange', bind(this.init_, this, doc)); | |
} | |
}, | |
init_: function(doc) { | |
// find all canvas elements | |
var els = doc.getElementsByTagName('canvas'); | |
for (var i = 0; i < els.length; i++) { | |
this.initElement(els[i]); | |
} | |
}, | |
/** | |
* Public initializes a canvas element so that it can be used as canvas | |
* element from now on. This is called automatically before the page is | |
* loaded but if you are creating elements using createElement you need to | |
* make sure this is called on the element. | |
* @param {HTMLElement} el The canvas element to initialize. | |
* @return {HTMLElement} the element that was created. | |
*/ | |
initElement: function(el) { | |
if (!el.getContext) { | |
el.getContext = getContext; | |
// Add namespaces and stylesheet to document of the element. | |
addNamespacesAndStylesheet(el.ownerDocument); | |
// Remove fallback content. There is no way to hide text nodes so we | |
// just remove all childNodes. We could hide all elements and remove | |
// text nodes but who really cares about the fallback content. | |
el.innerHTML = ''; | |
// do not use inline function because that will leak memory | |
el.attachEvent('onpropertychange', onPropertyChange); | |
el.attachEvent('onresize', onResize); | |
var attrs = el.attributes; | |
if (attrs.width && attrs.width.specified) { | |
// TODO: use runtimeStyle and coordsize | |
// el.getContext().setWidth_(attrs.width.nodeValue); | |
el.style.width = attrs.width.nodeValue + 'px'; | |
} else { | |
el.width = el.clientWidth; | |
} | |
if (attrs.height && attrs.height.specified) { | |
// TODO: use runtimeStyle and coordsize | |
// el.getContext().setHeight_(attrs.height.nodeValue); | |
el.style.height = attrs.height.nodeValue + 'px'; | |
} else { | |
el.height = el.clientHeight; | |
} | |
//el.getContext().setCoordsize_() | |
} | |
return el; | |
} | |
}; | |
function onPropertyChange(e) { | |
var el = e.srcElement; | |
switch (e.propertyName) { | |
case 'width': | |
el.getContext().clearRect(); | |
el.style.width = el.attributes.width.nodeValue + 'px'; | |
// In IE8 this does not trigger onresize. | |
el.firstChild.style.width = el.clientWidth + 'px'; | |
break; | |
case 'height': | |
el.getContext().clearRect(); | |
el.style.height = el.attributes.height.nodeValue + 'px'; | |
el.firstChild.style.height = el.clientHeight + 'px'; | |
break; | |
} | |
} | |
function onResize(e) { | |
var el = e.srcElement; | |
if (el.firstChild) { | |
el.firstChild.style.width = el.clientWidth + 'px'; | |
el.firstChild.style.height = el.clientHeight + 'px'; | |
} | |
} | |
G_vmlCanvasManager_.init(); | |
// precompute "00" to "FF" | |
var decToHex = []; | |
for (var i = 0; i < 16; i++) { | |
for (var j = 0; j < 16; j++) { | |
decToHex[i * 16 + j] = i.toString(16) + j.toString(16); | |
} | |
} | |
function createMatrixIdentity() { | |
return [ | |
[1, 0, 0], | |
[0, 1, 0], | |
[0, 0, 1] | |
]; | |
} | |
function matrixMultiply(m1, m2) { | |
var result = createMatrixIdentity(); | |
for (var x = 0; x < 3; x++) { | |
for (var y = 0; y < 3; y++) { | |
var sum = 0; | |
for (var z = 0; z < 3; z++) { | |
sum += m1[x][z] * m2[z][y]; | |
} | |
result[x][y] = sum; | |
} | |
} | |
return result; | |
} | |
function copyState(o1, o2) { | |
o2.fillStyle = o1.fillStyle; | |
o2.lineCap = o1.lineCap; | |
o2.lineJoin = o1.lineJoin; | |
o2.lineWidth = o1.lineWidth; | |
o2.miterLimit = o1.miterLimit; | |
o2.shadowBlur = o1.shadowBlur; | |
o2.shadowColor = o1.shadowColor; | |
o2.shadowOffsetX = o1.shadowOffsetX; | |
o2.shadowOffsetY = o1.shadowOffsetY; | |
o2.strokeStyle = o1.strokeStyle; | |
o2.globalAlpha = o1.globalAlpha; | |
o2.font = o1.font; | |
o2.textAlign = o1.textAlign; | |
o2.textBaseline = o1.textBaseline; | |
o2.arcScaleX_ = o1.arcScaleX_; | |
o2.arcScaleY_ = o1.arcScaleY_; | |
o2.lineScale_ = o1.lineScale_; | |
} | |
var colorData = { | |
aliceblue: '#F0F8FF', | |
antiquewhite: '#FAEBD7', | |
aquamarine: '#7FFFD4', | |
azure: '#F0FFFF', | |
beige: '#F5F5DC', | |
bisque: '#FFE4C4', | |
black: '#000000', | |
blanchedalmond: '#FFEBCD', | |
blueviolet: '#8A2BE2', | |
brown: '#A52A2A', | |
burlywood: '#DEB887', | |
cadetblue: '#5F9EA0', | |
chartreuse: '#7FFF00', | |
chocolate: '#D2691E', | |
coral: '#FF7F50', | |
cornflowerblue: '#6495ED', | |
cornsilk: '#FFF8DC', | |
crimson: '#DC143C', | |
cyan: '#00FFFF', | |
darkblue: '#00008B', | |
darkcyan: '#008B8B', | |
darkgoldenrod: '#B8860B', | |
darkgray: '#A9A9A9', | |
darkgreen: '#006400', | |
darkgrey: '#A9A9A9', | |
darkkhaki: '#BDB76B', | |
darkmagenta: '#8B008B', | |
darkolivegreen: '#556B2F', | |
darkorange: '#FF8C00', | |
darkorchid: '#9932CC', | |
darkred: '#8B0000', | |
darksalmon: '#E9967A', | |
darkseagreen: '#8FBC8F', | |
darkslateblue: '#483D8B', | |
darkslategray: '#2F4F4F', | |
darkslategrey: '#2F4F4F', | |
darkturquoise: '#00CED1', | |
darkviolet: '#9400D3', | |
deeppink: '#FF1493', | |
deepskyblue: '#00BFFF', | |
dimgray: '#696969', | |
dimgrey: '#696969', | |
dodgerblue: '#1E90FF', | |
firebrick: '#B22222', | |
floralwhite: '#FFFAF0', | |
forestgreen: '#228B22', | |
gainsboro: '#DCDCDC', | |
ghostwhite: '#F8F8FF', | |
gold: '#FFD700', | |
goldenrod: '#DAA520', | |
grey: '#808080', | |
greenyellow: '#ADFF2F', | |
honeydew: '#F0FFF0', | |
hotpink: '#FF69B4', | |
indianred: '#CD5C5C', | |
indigo: '#4B0082', | |
ivory: '#FFFFF0', | |
khaki: '#F0E68C', | |
lavender: '#E6E6FA', | |
lavenderblush: '#FFF0F5', | |
lawngreen: '#7CFC00', | |
lemonchiffon: '#FFFACD', | |
lightblue: '#ADD8E6', | |
lightcoral: '#F08080', | |
lightcyan: '#E0FFFF', | |
lightgoldenrodyellow: '#FAFAD2', | |
lightgreen: '#90EE90', | |
lightgrey: '#D3D3D3', | |
lightpink: '#FFB6C1', | |
lightsalmon: '#FFA07A', | |
lightseagreen: '#20B2AA', | |
lightskyblue: '#87CEFA', | |
lightslategray: '#778899', | |
lightslategrey: '#778899', | |
lightsteelblue: '#B0C4DE', | |
lightyellow: '#FFFFE0', | |
limegreen: '#32CD32', | |
linen: '#FAF0E6', | |
magenta: '#FF00FF', | |
mediumaquamarine: '#66CDAA', | |
mediumblue: '#0000CD', | |
mediumorchid: '#BA55D3', | |
mediumpurple: '#9370DB', | |
mediumseagreen: '#3CB371', | |
mediumslateblue: '#7B68EE', | |
mediumspringgreen: '#00FA9A', | |
mediumturquoise: '#48D1CC', | |
mediumvioletred: '#C71585', | |
midnightblue: '#191970', | |
mintcream: '#F5FFFA', | |
mistyrose: '#FFE4E1', | |
moccasin: '#FFE4B5', | |
navajowhite: '#FFDEAD', | |
oldlace: '#FDF5E6', | |
olivedrab: '#6B8E23', | |
orange: '#FFA500', | |
orangered: '#FF4500', | |
orchid: '#DA70D6', | |
palegoldenrod: '#EEE8AA', | |
palegreen: '#98FB98', | |
paleturquoise: '#AFEEEE', | |
palevioletred: '#DB7093', | |
papayawhip: '#FFEFD5', | |
peachpuff: '#FFDAB9', | |
peru: '#CD853F', | |
pink: '#FFC0CB', | |
plum: '#DDA0DD', | |
powderblue: '#B0E0E6', | |
rosybrown: '#BC8F8F', | |
royalblue: '#4169E1', | |
saddlebrown: '#8B4513', | |
salmon: '#FA8072', | |
sandybrown: '#F4A460', | |
seagreen: '#2E8B57', | |
seashell: '#FFF5EE', | |
sienna: '#A0522D', | |
skyblue: '#87CEEB', | |
slateblue: '#6A5ACD', | |
slategray: '#708090', | |
slategrey: '#708090', | |
snow: '#FFFAFA', | |
springgreen: '#00FF7F', | |
steelblue: '#4682B4', | |
tan: '#D2B48C', | |
thistle: '#D8BFD8', | |
tomato: '#FF6347', | |
turquoise: '#40E0D0', | |
violet: '#EE82EE', | |
wheat: '#F5DEB3', | |
whitesmoke: '#F5F5F5', | |
yellowgreen: '#9ACD32' | |
}; | |
function getRgbHslContent(styleString) { | |
var start = styleString.indexOf('(', 3); | |
var end = styleString.indexOf(')', start + 1); | |
var parts = styleString.substring(start + 1, end).split(','); | |
// add alpha if needed | |
if (parts.length == 4 && styleString.substr(3, 1) == 'a') { | |
alpha = Number(parts[3]); | |
} else { | |
parts[3] = 1; | |
} | |
return parts; | |
} | |
function percent(s) { | |
return parseFloat(s) / 100; | |
} | |
function clamp(v, min, max) { | |
return Math.min(max, Math.max(min, v)); | |
} | |
function hslToRgb(parts){ | |
var r, g, b; | |
h = parseFloat(parts[0]) / 360 % 360; | |
if (h < 0) | |
h++; | |
s = clamp(percent(parts[1]), 0, 1); | |
l = clamp(percent(parts[2]), 0, 1); | |
if (s == 0) { | |
r = g = b = l; // achromatic | |
} else { | |
var q = l < 0.5 ? l * (1 + s) : l + s - l * s; | |
var p = 2 * l - q; | |
r = hueToRgb(p, q, h + 1 / 3); | |
g = hueToRgb(p, q, h); | |
b = hueToRgb(p, q, h - 1 / 3); | |
} | |
return '#' + decToHex[Math.floor(r * 255)] + | |
decToHex[Math.floor(g * 255)] + | |
decToHex[Math.floor(b * 255)]; | |
} | |
function hueToRgb(m1, m2, h) { | |
if (h < 0) | |
h++; | |
if (h > 1) | |
h--; | |
if (6 * h < 1) | |
return m1 + (m2 - m1) * 6 * h; | |
else if (2 * h < 1) | |
return m2; | |
else if (3 * h < 2) | |
return m1 + (m2 - m1) * (2 / 3 - h) * 6; | |
else | |
return m1; | |
} | |
function processStyle(styleString) { | |
var str, alpha = 1; | |
styleString = String(styleString); | |
if (styleString.charAt(0) == '#') { | |
str = styleString; | |
} else if (/^rgb/.test(styleString)) { | |
var parts = getRgbHslContent(styleString); | |
var str = '#', n; | |
for (var i = 0; i < 3; i++) { | |
if (parts[i].indexOf('%') != -1) { | |
n = Math.floor(percent(parts[i]) * 255); | |
} else { | |
n = Number(parts[i]); | |
} | |
str += decToHex[clamp(n, 0, 255)]; | |
} | |
alpha = parts[3]; | |
} else if (/^hsl/.test(styleString)) { | |
var parts = getRgbHslContent(styleString); | |
str = hslToRgb(parts); | |
alpha = parts[3]; | |
} else { | |
str = colorData[styleString] || styleString; | |
} | |
return {color: str, alpha: alpha}; | |
} | |
var DEFAULT_STYLE = { | |
style: 'normal', | |
variant: 'normal', | |
weight: 'normal', | |
size: 10, | |
family: 'sans-serif' | |
}; | |
// Internal text style cache | |
var fontStyleCache = {}; | |
function processFontStyle(styleString) { | |
if (fontStyleCache[styleString]) { | |
return fontStyleCache[styleString]; | |
} | |
var el = document.createElement('div'); | |
var style = el.style; | |
try { | |
style.font = styleString; | |
} catch (ex) { | |
// Ignore failures to set to invalid font. | |
} | |
return fontStyleCache[styleString] = { | |
style: style.fontStyle || DEFAULT_STYLE.style, | |
variant: style.fontVariant || DEFAULT_STYLE.variant, | |
weight: style.fontWeight || DEFAULT_STYLE.weight, | |
size: style.fontSize || DEFAULT_STYLE.size, | |
family: style.fontFamily || DEFAULT_STYLE.family | |
}; | |
} | |
function getComputedStyle(style, element) { | |
var computedStyle = {}; | |
for (var p in style) { | |
computedStyle[p] = style[p]; | |
} | |
// Compute the size | |
var canvasFontSize = parseFloat(element.currentStyle.fontSize), | |
fontSize = parseFloat(style.size); | |
if (typeof style.size == 'number') { | |
computedStyle.size = style.size; | |
} else if (style.size.indexOf('px') != -1) { | |
computedStyle.size = fontSize; | |
} else if (style.size.indexOf('em') != -1) { | |
computedStyle.size = canvasFontSize * fontSize; | |
} else if(style.size.indexOf('%') != -1) { | |
computedStyle.size = (canvasFontSize / 100) * fontSize; | |
} else if (style.size.indexOf('pt') != -1) { | |
computedStyle.size = fontSize / .75; | |
} else { | |
computedStyle.size = canvasFontSize; | |
} | |
// Different scaling between normal text and VML text. This was found using | |
// trial and error to get the same size as non VML text. | |
computedStyle.size *= 0.981; | |
return computedStyle; | |
} | |
function buildStyle(style) { | |
return style.style + ' ' + style.variant + ' ' + style.weight + ' ' + | |
style.size + 'px ' + style.family; | |
} | |
function processLineCap(lineCap) { | |
switch (lineCap) { | |
case 'butt': | |
return 'flat'; | |
case 'round': | |
return 'round'; | |
case 'square': | |
default: | |
return 'square'; | |
} | |
} | |
/** | |
* This class implements CanvasRenderingContext2D interface as described by | |
* the WHATWG. | |
* @param {HTMLElement} surfaceElement The element that the 2D context should | |
* be associated with | |
*/ | |
function CanvasRenderingContext2D_(surfaceElement) { | |
this.m_ = createMatrixIdentity(); | |
this.mStack_ = []; | |
this.aStack_ = []; | |
this.currentPath_ = []; | |
// Canvas context properties | |
this.strokeStyle = '#000'; | |
this.fillStyle = '#000'; | |
this.lineWidth = 1; | |
this.lineJoin = 'miter'; | |
this.lineCap = 'butt'; | |
this.miterLimit = Z * 1; | |
this.globalAlpha = 1; | |
this.font = '10px sans-serif'; | |
this.textAlign = 'left'; | |
this.textBaseline = 'alphabetic'; | |
this.canvas = surfaceElement; | |
var el = surfaceElement.ownerDocument.createElement('div'); | |
el.style.width = surfaceElement.clientWidth + 'px'; | |
el.style.height = surfaceElement.clientHeight + 'px'; | |
el.style.overflow = 'hidden'; | |
el.style.position = 'absolute'; | |
surfaceElement.appendChild(el); | |
this.element_ = el; | |
this.arcScaleX_ = 1; | |
this.arcScaleY_ = 1; | |
this.lineScale_ = 1; | |
} | |
var contextPrototype = CanvasRenderingContext2D_.prototype; | |
contextPrototype.clearRect = function() { | |
if (this.textMeasureEl_) { | |
this.textMeasureEl_.removeNode(true); | |
this.textMeasureEl_ = null; | |
} | |
this.element_.innerHTML = ''; | |
}; | |
contextPrototype.beginPath = function() { | |
// TODO: Branch current matrix so that save/restore has no effect | |
// as per safari docs. | |
this.currentPath_ = []; | |
}; | |
contextPrototype.moveTo = function(aX, aY) { | |
var p = this.getCoords_(aX, aY); | |
this.currentPath_.push({type: 'moveTo', x: p.x, y: p.y}); | |
this.currentX_ = p.x; | |
this.currentY_ = p.y; | |
}; | |
contextPrototype.lineTo = function(aX, aY) { | |
var p = this.getCoords_(aX, aY); | |
this.currentPath_.push({type: 'lineTo', x: p.x, y: p.y}); | |
this.currentX_ = p.x; | |
this.currentY_ = p.y; | |
}; | |
contextPrototype.bezierCurveTo = function(aCP1x, aCP1y, | |
aCP2x, aCP2y, | |
aX, aY) { | |
var p = this.getCoords_(aX, aY); | |
var cp1 = this.getCoords_(aCP1x, aCP1y); | |
var cp2 = this.getCoords_(aCP2x, aCP2y); | |
bezierCurveTo(this, cp1, cp2, p); | |
}; | |
// Helper function that takes the already fixed cordinates. | |
function bezierCurveTo(self, cp1, cp2, p) { | |
self.currentPath_.push({ | |
type: 'bezierCurveTo', | |
cp1x: cp1.x, | |
cp1y: cp1.y, | |
cp2x: cp2.x, | |
cp2y: cp2.y, | |
x: p.x, | |
y: p.y | |
}); | |
self.currentX_ = p.x; | |
self.currentY_ = p.y; | |
} | |
contextPrototype.quadraticCurveTo = function(aCPx, aCPy, aX, aY) { | |
// the following is lifted almost directly from | |
// http://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes | |
var cp = this.getCoords_(aCPx, aCPy); | |
var p = this.getCoords_(aX, aY); | |
var cp1 = { | |
x: this.currentX_ + 2.0 / 3.0 * (cp.x - this.currentX_), | |
y: this.currentY_ + 2.0 / 3.0 * (cp.y - this.currentY_) | |
}; | |
var cp2 = { | |
x: cp1.x + (p.x - this.currentX_) / 3.0, | |
y: cp1.y + (p.y - this.currentY_) / 3.0 | |
}; | |
bezierCurveTo(this, cp1, cp2, p); | |
}; | |
contextPrototype.arc = function(aX, aY, aRadius, | |
aStartAngle, aEndAngle, aClockwise) { | |
aRadius *= Z; | |
var arcType = aClockwise ? 'at' : 'wa'; | |
var xStart = aX + mc(aStartAngle) * aRadius - Z2; | |
var yStart = aY + ms(aStartAngle) * aRadius - Z2; | |
var xEnd = aX + mc(aEndAngle) * aRadius - Z2; | |
var yEnd = aY + ms(aEndAngle) * aRadius - Z2; | |
// IE won't render arches drawn counter clockwise if xStart == xEnd. | |
if (xStart == xEnd && !aClockwise) { | |
xStart += 0.125; // Offset xStart by 1/80 of a pixel. Use something | |
// that can be represented in binary | |
} | |
var p = this.getCoords_(aX, aY); | |
var pStart = this.getCoords_(xStart, yStart); | |
var pEnd = this.getCoords_(xEnd, yEnd); | |
this.currentPath_.push({type: arcType, | |
x: p.x, | |
y: p.y, | |
radius: aRadius, | |
xStart: pStart.x, | |
yStart: pStart.y, | |
xEnd: pEnd.x, | |
yEnd: pEnd.y}); | |
}; | |
contextPrototype.rect = function(aX, aY, aWidth, aHeight) { | |
this.moveTo(aX, aY); | |
this.lineTo(aX + aWidth, aY); | |
this.lineTo(aX + aWidth, aY + aHeight); | |
this.lineTo(aX, aY + aHeight); | |
this.closePath(); | |
}; | |
contextPrototype.strokeRect = function(aX, aY, aWidth, aHeight) { | |
var oldPath = this.currentPath_; | |
this.beginPath(); | |
this.moveTo(aX, aY); | |
this.lineTo(aX + aWidth, aY); | |
this.lineTo(aX + aWidth, aY + aHeight); | |
this.lineTo(aX, aY + aHeight); | |
this.closePath(); | |
this.stroke(); | |
this.currentPath_ = oldPath; | |
}; | |
contextPrototype.fillRect = function(aX, aY, aWidth, aHeight) { | |
var oldPath = this.currentPath_; | |
this.beginPath(); | |
this.moveTo(aX, aY); | |
this.lineTo(aX + aWidth, aY); | |
this.lineTo(aX + aWidth, aY + aHeight); | |
this.lineTo(aX, aY + aHeight); | |
this.closePath(); | |
this.fill(); | |
this.currentPath_ = oldPath; | |
}; | |
contextPrototype.createLinearGradient = function(aX0, aY0, aX1, aY1) { | |
var gradient = new CanvasGradient_('gradient'); | |
gradient.x0_ = aX0; | |
gradient.y0_ = aY0; | |
gradient.x1_ = aX1; | |
gradient.y1_ = aY1; | |
return gradient; | |
}; | |
contextPrototype.createRadialGradient = function(aX0, aY0, aR0, | |
aX1, aY1, aR1) { | |
var gradient = new CanvasGradient_('gradientradial'); | |
gradient.x0_ = aX0; | |
gradient.y0_ = aY0; | |
gradient.r0_ = aR0; | |
gradient.x1_ = aX1; | |
gradient.y1_ = aY1; | |
gradient.r1_ = aR1; | |
return gradient; | |
}; | |
contextPrototype.drawImage = function(image, var_args) { | |
var dx, dy, dw, dh, sx, sy, sw, sh; | |
// to find the original width we overide the width and height | |
var oldRuntimeWidth = image.runtimeStyle.width; | |
var oldRuntimeHeight = image.runtimeStyle.height; | |
image.runtimeStyle.width = 'auto'; | |
image.runtimeStyle.height = 'auto'; | |
// get the original size | |
var w = image.width; | |
var h = image.height; | |
// and remove overides | |
image.runtimeStyle.width = oldRuntimeWidth; | |
image.runtimeStyle.height = oldRuntimeHeight; | |
if (arguments.length == 3) { | |
dx = arguments[1]; | |
dy = arguments[2]; | |
sx = sy = 0; | |
sw = dw = w; | |
sh = dh = h; | |
} else if (arguments.length == 5) { | |
dx = arguments[1]; | |
dy = arguments[2]; | |
dw = arguments[3]; | |
dh = arguments[4]; | |
sx = sy = 0; | |
sw = w; | |
sh = h; | |
} else if (arguments.length == 9) { | |
sx = arguments[1]; | |
sy = arguments[2]; | |
sw = arguments[3]; | |
sh = arguments[4]; | |
dx = arguments[5]; | |
dy = arguments[6]; | |
dw = arguments[7]; | |
dh = arguments[8]; | |
} else { | |
throw Error('Invalid number of arguments'); | |
} | |
var d = this.getCoords_(dx, dy); | |
var w2 = sw / 2; | |
var h2 = sh / 2; | |
var vmlStr = []; | |
var W = 10; | |
var H = 10; | |
// For some reason that I've now forgotten, using divs didn't work | |
vmlStr.push(' <g_vml_:group', | |
' coordsize="', Z * W, ',', Z * H, '"', | |
' coordorigin="0,0"' , | |
' style="width:', W, 'px;height:', H, 'px;position:absolute;'); | |
// If filters are necessary (rotation exists), create them | |
// filters are bog-slow, so only create them if abbsolutely necessary | |
// The following check doesn't account for skews (which don't exist | |
// in the canvas spec (yet) anyway. | |
if (this.m_[0][0] != 1 || this.m_[0][1] || | |
this.m_[1][1] != 1 || this.m_[1][0]) { | |
var filter = []; | |
// Note the 12/21 reversal | |
filter.push('M11=', this.m_[0][0], ',', | |
'M12=', this.m_[1][0], ',', | |
'M21=', this.m_[0][1], ',', | |
'M22=', this.m_[1][1], ',', | |
'Dx=', mr(d.x / Z), ',', | |
'Dy=', mr(d.y / Z), ''); | |
// Bounding box calculation (need to minimize displayed area so that | |
// filters don't waste time on unused pixels. | |
var max = d; | |
var c2 = this.getCoords_(dx + dw, dy); | |
var c3 = this.getCoords_(dx, dy + dh); | |
var c4 = this.getCoords_(dx + dw, dy + dh); | |
max.x = m.max(max.x, c2.x, c3.x, c4.x); | |
max.y = m.max(max.y, c2.y, c3.y, c4.y); | |
vmlStr.push('padding:0 ', mr(max.x / Z), 'px ', mr(max.y / Z), | |
'px 0;filter:progid:DXImageTransform.Microsoft.Matrix(', | |
filter.join(''), ", sizingmethod='clip');"); | |
} else { | |
vmlStr.push('top:', mr(d.y / Z), 'px;left:', mr(d.x / Z), 'px;'); | |
} | |
vmlStr.push(' ">' , | |
'<g_vml_:image src="', image.src, '"', | |
' style="width:', Z * dw, 'px;', | |
' height:', Z * dh, 'px"', | |
' cropleft="', sx / w, '"', | |
' croptop="', sy / h, '"', | |
' cropright="', (w - sx - sw) / w, '"', | |
' cropbottom="', (h - sy - sh) / h, '"', | |
' />', | |
'</g_vml_:group>'); | |
this.element_.insertAdjacentHTML('BeforeEnd', vmlStr.join('')); | |
}; | |
contextPrototype.stroke = function(aFill) { | |
var W = 10; | |
var H = 10; | |
// Divide the shape into chunks if it's too long because IE has a limit | |
// somewhere for how long a VML shape can be. This simple division does | |
// not work with fills, only strokes, unfortunately. | |
var chunkSize = 5000; | |
var min = {x: null, y: null}; | |
var max = {x: null, y: null}; | |
for (var j = 0; j < this.currentPath_.length; j += chunkSize) { | |
var lineStr = []; | |
var lineOpen = false; | |
lineStr.push('<g_vml_:shape', | |
' filled="', !!aFill, '"', | |
' style="position:absolute;width:', W, 'px;height:', H, 'px;"', | |
' coordorigin="0,0"', | |
' coordsize="', Z * W, ',', Z * H, '"', | |
' stroked="', !aFill, '"', | |
' path="'); | |
var newSeq = false; | |
for (var i = j; i < Math.min(j + chunkSize, this.currentPath_.length); i++) { | |
if (i % chunkSize == 0 && i > 0) { // move into position for next chunk | |
lineStr.push(' m ', mr(this.currentPath_[i-1].x), ',', mr(this.currentPath_[i-1].y)); | |
} | |
var p = this.currentPath_[i]; | |
var c; | |
switch (p.type) { | |
case 'moveTo': | |
c = p; | |
lineStr.push(' m ', mr(p.x), ',', mr(p.y)); | |
break; | |
case 'lineTo': | |
lineStr.push(' l ', mr(p.x), ',', mr(p.y)); | |
break; | |
case 'close': | |
lineStr.push(' x '); | |
p = null; | |
break; | |
case 'bezierCurveTo': | |
lineStr.push(' c ', | |
mr(p.cp1x), ',', mr(p.cp1y), ',', | |
mr(p.cp2x), ',', mr(p.cp2y), ',', | |
mr(p.x), ',', mr(p.y)); | |
break; | |
case 'at': | |
case 'wa': | |
lineStr.push(' ', p.type, ' ', | |
mr(p.x - this.arcScaleX_ * p.radius), ',', | |
mr(p.y - this.arcScaleY_ * p.radius), ' ', | |
mr(p.x + this.arcScaleX_ * p.radius), ',', | |
mr(p.y + this.arcScaleY_ * p.radius), ' ', | |
mr(p.xStart), ',', mr(p.yStart), ' ', | |
mr(p.xEnd), ',', mr(p.yEnd)); | |
break; | |
} | |
// TODO: Following is broken for curves due to | |
// move to proper paths. | |
// Figure out dimensions so we can do gradient fills | |
// properly | |
if (p) { | |
if (min.x == null || p.x < min.x) { | |
min.x = p.x; | |
} | |
if (max.x == null || p.x > max.x) { | |
max.x = p.x; | |
} | |
if (min.y == null || p.y < min.y) { | |
min.y = p.y; | |
} | |
if (max.y == null || p.y > max.y) { | |
max.y = p.y; | |
} | |
} | |
} | |
lineStr.push(' ">'); | |
if (!aFill) { | |
appendStroke(this, lineStr); | |
} else { | |
appendFill(this, lineStr, min, max); | |
} | |
lineStr.push('</g_vml_:shape>'); | |
this.element_.insertAdjacentHTML('beforeEnd', lineStr.join('')); | |
} | |
}; | |
function appendStroke(ctx, lineStr) { | |
var a = processStyle(ctx.strokeStyle); | |
var color = a.color; | |
var opacity = a.alpha * ctx.globalAlpha; | |
var lineWidth = ctx.lineScale_ * ctx.lineWidth; | |
// VML cannot correctly render a line if the width is less than 1px. | |
// In that case, we dilute the color to make the line look thinner. | |
if (lineWidth < 1) { | |
opacity *= lineWidth; | |
} | |
lineStr.push( | |
'<g_vml_:stroke', | |
' opacity="', opacity, '"', | |
' joinstyle="', ctx.lineJoin, '"', | |
' miterlimit="', ctx.miterLimit, '"', | |
' endcap="', processLineCap(ctx.lineCap), '"', | |
' weight="', lineWidth, 'px"', | |
' color="', color, '" />' | |
); | |
} | |
function appendFill(ctx, lineStr, min, max) { | |
var fillStyle = ctx.fillStyle; | |
var arcScaleX = ctx.arcScaleX_; | |
var arcScaleY = ctx.arcScaleY_; | |
var width = max.x - min.x; | |
var height = max.y - min.y; | |
if (fillStyle instanceof CanvasGradient_) { | |
// TODO: Gradients transformed with the transformation matrix. | |
var angle = 0; | |
var focus = {x: 0, y: 0}; | |
// additional offset | |
var shift = 0; | |
// scale factor for offset | |
var expansion = 1; | |
if (fillStyle.type_ == 'gradient') { | |
var x0 = fillStyle.x0_ / arcScaleX; | |
var y0 = fillStyle.y0_ / arcScaleY; | |
var x1 = fillStyle.x1_ / arcScaleX; | |
var y1 = fillStyle.y1_ / arcScaleY; | |
var p0 = ctx.getCoords_(x0, y0); | |
var p1 = ctx.getCoords_(x1, y1); | |
var dx = p1.x - p0.x; | |
var dy = p1.y - p0.y; | |
angle = Math.atan2(dx, dy) * 180 / Math.PI; | |
// The angle should be a non-negative number. | |
if (angle < 0) { | |
angle += 360; | |
} | |
// Very small angles produce an unexpected result because they are | |
// converted to a scientific notation string. | |
if (angle < 1e-6) { | |
angle = 0; | |
} | |
} else { | |
var p0 = ctx.getCoords_(fillStyle.x0_, fillStyle.y0_); | |
focus = { | |
x: (p0.x - min.x) / width, | |
y: (p0.y - min.y) / height | |
}; | |
width /= arcScaleX * Z; | |
height /= arcScaleY * Z; | |
var dimension = m.max(width, height); | |
shift = 2 * fillStyle.r0_ / dimension; | |
expansion = 2 * fillStyle.r1_ / dimension - shift; | |
} | |
// We need to sort the color stops in ascending order by offset, | |
// otherwise IE won't interpret it correctly. | |
var stops = fillStyle.colors_; | |
stops.sort(function(cs1, cs2) { | |
return cs1.offset - cs2.offset; | |
}); | |
var length = stops.length; | |
var color1 = stops[0].color; | |
var color2 = stops[length - 1].color; | |
var opacity1 = stops[0].alpha * ctx.globalAlpha; | |
var opacity2 = stops[length - 1].alpha * ctx.globalAlpha; | |
var colors = []; | |
for (var i = 0; i < length; i++) { | |
var stop = stops[i]; | |
colors.push(stop.offset * expansion + shift + ' ' + stop.color); | |
} | |
// When colors attribute is used, the meanings of opacity and o:opacity2 | |
// are reversed. | |
lineStr.push('<g_vml_:fill type="', fillStyle.type_, '"', | |
' method="none" focus="100%"', | |
' color="', color1, '"', | |
' color2="', color2, '"', | |
' colors="', colors.join(','), '"', | |
' opacity="', opacity2, '"', | |
' g_o_:opacity2="', opacity1, '"', | |
' angle="', angle, '"', | |
' focusposition="', focus.x, ',', focus.y, '" />'); | |
} else if (fillStyle instanceof CanvasPattern_) { | |
if (width && height) { | |
var deltaLeft = -min.x; | |
var deltaTop = -min.y; | |
lineStr.push('<g_vml_:fill', | |
' position="', | |
deltaLeft / width * arcScaleX * arcScaleX, ',', | |
deltaTop / height * arcScaleY * arcScaleY, '"', | |
' type="tile"', | |
// TODO: Figure out the correct size to fit the scale. | |
//' size="', w, 'px ', h, 'px"', | |
' src="', fillStyle.src_, '" />'); | |
} | |
} else { | |
var a = processStyle(ctx.fillStyle); | |
var color = a.color; | |
var opacity = a.alpha * ctx.globalAlpha; | |
lineStr.push('<g_vml_:fill color="', color, '" opacity="', opacity, | |
'" />'); | |
} | |
} | |
contextPrototype.fill = function() { | |
this.stroke(true); | |
}; | |
contextPrototype.closePath = function() { | |
this.currentPath_.push({type: 'close'}); | |
}; | |
/** | |
* @private | |
*/ | |
contextPrototype.getCoords_ = function(aX, aY) { | |
var m = this.m_; | |
return { | |
x: Z * (aX * m[0][0] + aY * m[1][0] + m[2][0]) - Z2, | |
y: Z * (aX * m[0][1] + aY * m[1][1] + m[2][1]) - Z2 | |
}; | |
}; | |
contextPrototype.save = function() { | |
var o = {}; | |
copyState(this, o); | |
this.aStack_.push(o); | |
this.mStack_.push(this.m_); | |
this.m_ = matrixMultiply(createMatrixIdentity(), this.m_); | |
}; | |
contextPrototype.restore = function() { | |
if (this.aStack_.length) { | |
copyState(this.aStack_.pop(), this); | |
this.m_ = this.mStack_.pop(); | |
} | |
}; | |
function matrixIsFinite(m) { | |
return isFinite(m[0][0]) && isFinite(m[0][1]) && | |
isFinite(m[1][0]) && isFinite(m[1][1]) && | |
isFinite(m[2][0]) && isFinite(m[2][1]); | |
} | |
function setM(ctx, m, updateLineScale) { | |
if (!matrixIsFinite(m)) { | |
return; | |
} | |
ctx.m_ = m; | |
if (updateLineScale) { | |
// Get the line scale. | |
// Determinant of this.m_ means how much the area is enlarged by the | |
// transformation. So its square root can be used as a scale factor | |
// for width. | |
var det = m[0][0] * m[1][1] - m[0][1] * m[1][0]; | |
ctx.lineScale_ = sqrt(abs(det)); | |
} | |
} | |
contextPrototype.translate = function(aX, aY) { | |
var m1 = [ | |
[1, 0, 0], | |
[0, 1, 0], | |
[aX, aY, 1] | |
]; | |
setM(this, matrixMultiply(m1, this.m_), false); | |
}; | |
contextPrototype.rotate = function(aRot) { | |
var c = mc(aRot); | |
var s = ms(aRot); | |
var m1 = [ | |
[c, s, 0], | |
[-s, c, 0], | |
[0, 0, 1] | |
]; | |
setM(this, matrixMultiply(m1, this.m_), false); | |
}; | |
contextPrototype.scale = function(aX, aY) { | |
this.arcScaleX_ *= aX; | |
this.arcScaleY_ *= aY; | |
var m1 = [ | |
[aX, 0, 0], | |
[0, aY, 0], | |
[0, 0, 1] | |
]; | |
setM(this, matrixMultiply(m1, this.m_), true); | |
}; | |
contextPrototype.transform = function(m11, m12, m21, m22, dx, dy) { | |
var m1 = [ | |
[m11, m12, 0], | |
[m21, m22, 0], | |
[dx, dy, 1] | |
]; | |
setM(this, matrixMultiply(m1, this.m_), true); | |
}; | |
contextPrototype.setTransform = function(m11, m12, m21, m22, dx, dy) { | |
var m = [ | |
[m11, m12, 0], | |
[m21, m22, 0], | |
[dx, dy, 1] | |
]; | |
setM(this, m, true); | |
}; | |
/** | |
* The text drawing function. | |
* The maxWidth argument isn't taken in account, since no browser supports | |
* it yet. | |
*/ | |
contextPrototype.drawText_ = function(text, x, y, maxWidth, stroke) { | |
var m = this.m_, | |
delta = 1000, | |
left = 0, | |
right = delta, | |
offset = {x: 0, y: 0}, | |
lineStr = []; | |
var fontStyle = getComputedStyle(processFontStyle(this.font), | |
this.element_); | |
var fontStyleString = buildStyle(fontStyle); | |
var elementStyle = this.element_.currentStyle; | |
var textAlign = this.textAlign.toLowerCase(); | |
switch (textAlign) { | |
case 'left': | |
case 'center': | |
case 'right': | |
break; | |
case 'end': | |
textAlign = elementStyle.direction == 'ltr' ? 'right' : 'left'; | |
break; | |
case 'start': | |
textAlign = elementStyle.direction == 'rtl' ? 'right' : 'left'; | |
break; | |
default: | |
textAlign = 'left'; | |
} | |
// 1.75 is an arbitrary number, as there is no info about the text baseline | |
switch (this.textBaseline) { | |
case 'hanging': | |
case 'top': | |
offset.y = fontStyle.size / 1.75; | |
break; | |
case 'middle': | |
break; | |
default: | |
case null: | |
case 'alphabetic': | |
case 'ideographic': | |
case 'bottom': | |
offset.y = -fontStyle.size / 2.25; | |
break; | |
} | |
switch(textAlign) { | |
case 'right': | |
left = delta; | |
right = 0.05; | |
break; | |
case 'center': | |
left = right = delta / 2; | |
break; | |
} | |
var d = this.getCoords_(x + offset.x, y + offset.y); | |
lineStr.push('<g_vml_:line from="', -left ,' 0" to="', right ,' 0.05" ', | |
' coordsize="100 100" coordorigin="0 0"', | |
' filled="', !stroke, '" stroked="', !!stroke, | |
'" style="position:absolute;width:1px;height:1px;">'); | |
if (stroke) { | |
appendStroke(this, lineStr); | |
} else { | |
// TODO: Fix the min and max params. | |
appendFill(this, lineStr, {x: -left, y: 0}, | |
{x: right, y: fontStyle.size}); | |
} | |
var skewM = m[0][0].toFixed(3) + ',' + m[1][0].toFixed(3) + ',' + | |
m[0][1].toFixed(3) + ',' + m[1][1].toFixed(3) + ',0,0'; | |
var skewOffset = mr(d.x / Z) + ',' + mr(d.y / Z); | |
lineStr.push('<g_vml_:skew on="t" matrix="', skewM ,'" ', | |
' offset="', skewOffset, '" origin="', left ,' 0" />', | |
'<g_vml_:path textpathok="true" />', | |
'<g_vml_:textpath on="true" string="', | |
encodeHtmlAttribute(text), | |
'" style="v-text-align:', textAlign, | |
';font:', encodeHtmlAttribute(fontStyleString), | |
'" /></g_vml_:line>'); | |
this.element_.insertAdjacentHTML('beforeEnd', lineStr.join('')); | |
}; | |
contextPrototype.fillText = function(text, x, y, maxWidth) { | |
this.drawText_(text, x, y, maxWidth, false); | |
}; | |
contextPrototype.strokeText = function(text, x, y, maxWidth) { | |
this.drawText_(text, x, y, maxWidth, true); | |
}; | |
contextPrototype.measureText = function(text) { | |
if (!this.textMeasureEl_) { | |
var s = '<span style="position:absolute;' + | |
'top:-20000px;left:0;padding:0;margin:0;border:none;' + | |
'white-space:pre;"></span>'; | |
this.element_.insertAdjacentHTML('beforeEnd', s); | |
this.textMeasureEl_ = this.element_.lastChild; | |
} | |
var doc = this.element_.ownerDocument; | |
this.textMeasureEl_.innerHTML = ''; | |
this.textMeasureEl_.style.font = this.font; | |
// Don't use innerHTML or innerText because they allow markup/whitespace. | |
this.textMeasureEl_.appendChild(doc.createTextNode(text)); | |
return {width: this.textMeasureEl_.offsetWidth}; | |
}; | |
/******** STUBS ********/ | |
contextPrototype.clip = function() { | |
// TODO: Implement | |
}; | |
contextPrototype.arcTo = function() { | |
// TODO: Implement | |
}; | |
contextPrototype.createPattern = function(image, repetition) { | |
return new CanvasPattern_(image, repetition); | |
}; | |
// Gradient / Pattern Stubs | |
function CanvasGradient_(aType) { | |
this.type_ = aType; | |
this.x0_ = 0; | |
this.y0_ = 0; | |
this.r0_ = 0; | |
this.x1_ = 0; | |
this.y1_ = 0; | |
this.r1_ = 0; | |
this.colors_ = []; | |
} | |
CanvasGradient_.prototype.addColorStop = function(aOffset, aColor) { | |
aColor = processStyle(aColor); | |
this.colors_.push({offset: aOffset, | |
color: aColor.color, | |
alpha: aColor.alpha}); | |
}; | |
function CanvasPattern_(image, repetition) { | |
assertImageIsValid(image); | |
switch (repetition) { | |
case 'repeat': | |
case null: | |
case '': | |
this.repetition_ = 'repeat'; | |
break | |
case 'repeat-x': | |
case 'repeat-y': | |
case 'no-repeat': | |
this.repetition_ = repetition; | |
break; | |
default: | |
throwException('SYNTAX_ERR'); | |
} | |
this.src_ = image.src; | |
this.width_ = image.width; | |
this.height_ = image.height; | |
} | |
function throwException(s) { | |
throw new DOMException_(s); | |
} | |
function assertImageIsValid(img) { | |
if (!img || img.nodeType != 1 || img.tagName != 'IMG') { | |
throwException('TYPE_MISMATCH_ERR'); | |
} | |
if (img.readyState != 'complete') { | |
throwException('INVALID_STATE_ERR'); | |
} | |
} | |
function DOMException_(s) { | |
this.code = this[s]; | |
this.message = s +': DOM Exception ' + this.code; | |
} | |
var p = DOMException_.prototype = new Error; | |
p.INDEX_SIZE_ERR = 1; | |
p.DOMSTRING_SIZE_ERR = 2; | |
p.HIERARCHY_REQUEST_ERR = 3; | |
p.WRONG_DOCUMENT_ERR = 4; | |
p.INVALID_CHARACTER_ERR = 5; | |
p.NO_DATA_ALLOWED_ERR = 6; | |
p.NO_MODIFICATION_ALLOWED_ERR = 7; | |
p.NOT_FOUND_ERR = 8; | |
p.NOT_SUPPORTED_ERR = 9; | |
p.INUSE_ATTRIBUTE_ERR = 10; | |
p.INVALID_STATE_ERR = 11; | |
p.SYNTAX_ERR = 12; | |
p.INVALID_MODIFICATION_ERR = 13; | |
p.NAMESPACE_ERR = 14; | |
p.INVALID_ACCESS_ERR = 15; | |
p.VALIDATION_ERR = 16; | |
p.TYPE_MISMATCH_ERR = 17; | |
// set up externs | |
G_vmlCanvasManager = G_vmlCanvasManager_; | |
CanvasRenderingContext2D = CanvasRenderingContext2D_; | |
CanvasGradient = CanvasGradient_; | |
CanvasPattern = CanvasPattern_; | |
DOMException = DOMException_; | |
})(); | |
} // if | |
if(!document.createElement("canvas").getContext){(function(){var z=Math;var K=z.round;var J=z.sin;var U=z.cos;var b=z.abs;var k=z.sqrt;var D=10;var F=D/2;function T(){return this.context_||(this.context_=new W(this))}var O=Array.prototype.slice;function G(i,j,m){var Z=O.call(arguments,2);return function(){return i.apply(j,Z.concat(O.call(arguments)))}}function AD(Z){return String(Z).replace(/&/g,"&").replace(/"/g,""")}function r(i){if(!i.namespaces.g_vml_){i.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml","#default#VML")}if(!i.namespaces.g_o_){i.namespaces.add("g_o_","urn:schemas-microsoft-com:office:office","#default#VML")}if(!i.styleSheets.ex_canvas_){var Z=i.createStyleSheet();Z.owningElement.id="ex_canvas_";Z.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"}}r(document);var E={init:function(Z){if(/MSIE/.test(navigator.userAgent)&&!window.opera){var i=Z||document;i.createElement("canvas");i.attachEvent("onreadystatechange",G(this.init_,this,i))}},init_:function(m){var j=m.getElementsByTagName("canvas");for(var Z=0;Z<j.length;Z++){this.initElement(j[Z])}},initElement:function(i){if(!i.getContext){i.getContext=T;r(i.ownerDocument);i.innerHTML="";i.attachEvent("onpropertychange",S);i.attachEvent("onresize",w);var Z=i.attributes;if(Z.width&&Z.width.specified){i.style.width=Z.width.nodeValue+"px"}else{i.width=i.clientWidth}if(Z.height&&Z.height.specified){i.style.height=Z.height.nodeValue+"px"}else{i.height=i.clientHeight}}return i}};function S(i){var Z=i.srcElement;switch(i.propertyName){case"width":Z.getContext().clearRect();Z.style.width=Z.attributes.width.nodeValue+"px";Z.firstChild.style.width=Z.clientWidth+"px";break;case"height":Z.getContext().clearRect();Z.style.height=Z.attributes.height.nodeValue+"px";Z.firstChild.style.height=Z.clientHeight+"px";break}}function w(i){var Z=i.srcElement;if(Z.firstChild){Z.firstChild.style.width=Z.clientWidth+"px";Z.firstChild.style.height=Z.clientHeight+"px"}}E.init();var I=[];for(var AC=0;AC<16;AC++){for(var AB=0;AB<16;AB++){I[AC*16+AB]=AC.toString(16)+AB.toString(16)}}function V(){return[[1,0,0],[0,1,0],[0,0,1]]}function d(m,j){var i=V();for(var Z=0;Z<3;Z++){for(var AF=0;AF<3;AF++){var p=0;for(var AE=0;AE<3;AE++){p+=m[Z][AE]*j[AE][AF]}i[Z][AF]=p}}return i}function Q(i,Z){Z.fillStyle=i.fillStyle;Z.lineCap=i.lineCap;Z.lineJoin=i.lineJoin;Z.lineWidth=i.lineWidth;Z.miterLimit=i.miterLimit;Z.shadowBlur=i.shadowBlur;Z.shadowColor=i.shadowColor;Z.shadowOffsetX=i.shadowOffsetX;Z.shadowOffsetY=i.shadowOffsetY;Z.strokeStyle=i.strokeStyle;Z.globalAlpha=i.globalAlpha;Z.font=i.font;Z.textAlign=i.textAlign;Z.textBaseline=i.textBaseline;Z.arcScaleX_=i.arcScaleX_;Z.arcScaleY_=i.arcScaleY_;Z.lineScale_=i.lineScale_}var B={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgreen:"#006400",darkgrey:"#A9A9A9",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",grey:"#808080",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgreen:"#90EE90",lightgrey:"#D3D3D3",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",oldlace:"#FDF5E6",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",whitesmoke:"#F5F5F5",yellowgreen:"#9ACD32"};function g(i){var m=i.indexOf("(",3);var Z=i.indexOf(")",m+1);var j=i.substring(m+1,Z).split(",");if(j.length==4&&i.substr(3,1)=="a"){alpha=Number(j[3])}else{j[3]=1}return j}function C(Z){return parseFloat(Z)/100}function N(i,j,Z){return Math.min(Z,Math.max(j,i))}function c(AF){var j,i,Z;h=parseFloat(AF[0])/360%360;if(h<0){h++}s=N(C(AF[1]),0,1);l=N(C(AF[2]),0,1);if(s==0){j=i=Z=l}else{var m=l<0.5?l*(1+s):l+s-l*s;var AE=2*l-m;j=A(AE,m,h+1/3);i=A(AE,m,h);Z=A(AE,m,h-1/3)}return"#"+I[Math.floor(j*255)]+I[Math.floor(i*255)]+I[Math.floor(Z*255)]}function A(i,Z,j){if(j<0){j++}if(j>1){j--}if(6*j<1){return i+(Z-i)*6*j}else{if(2*j<1){return Z}else{if(3*j<2){return i+(Z-i)*(2/3-j)*6}else{return i}}}}function Y(Z){var AE,p=1;Z=String(Z);if(Z.charAt(0)=="#"){AE=Z}else{if(/^rgb/.test(Z)){var m=g(Z);var AE="#",AF;for(var j=0;j<3;j++){if(m[j].indexOf("%")!=-1){AF=Math.floor(C(m[j])*255)}else{AF=Number(m[j])}AE+=I[N(AF,0,255)]}p=m[3]}else{if(/^hsl/.test(Z)){var m=g(Z);AE=c(m);p=m[3]}else{AE=B[Z]||Z}}}return{color:AE,alpha:p}}var L={style:"normal",variant:"normal",weight:"normal",size:10,family:"sans-serif"};var f={};function X(Z){if(f[Z]){return f[Z]}var m=document.createElement("div");var j=m.style;try{j.font=Z}catch(i){}return f[Z]={style:j.fontStyle||L.style,variant:j.fontVariant||L.variant,weight:j.fontWeight||L.weight,size:j.fontSize||L.size,family:j.fontFamily||L.family}}function P(j,i){var Z={};for(var AF in j){Z[AF]=j[AF]}var AE=parseFloat(i.currentStyle.fontSize),m=parseFloat(j.size);if(typeof j.size=="number"){Z.size=j.size}else{if(j.size.indexOf("px")!=-1){Z.size=m}else{if(j.size.indexOf("em")!=-1){Z.size=AE*m}else{if(j.size.indexOf("%")!=-1){Z.size=(AE/100)*m}else{if(j.size.indexOf("pt")!=-1){Z.size=m/0.75}else{Z.size=AE}}}}}Z.size*=0.981;return Z}function AA(Z){return Z.style+" "+Z.variant+" "+Z.weight+" "+Z.size+"px "+Z.family}function t(Z){switch(Z){case"butt":return"flat";case"round":return"round";case"square":default:return"square"}}function W(i){this.m_=V();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.strokeStyle="#000";this.fillStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=D*1;this.globalAlpha=1;this.font="10px sans-serif";this.textAlign="left";this.textBaseline="alphabetic";this.canvas=i;var Z=i.ownerDocument.createElement("div");Z.style.width=i.clientWidth+"px";Z.style.height=i.clientHeight+"px";Z.style.overflow="hidden";Z.style.position="absolute";i.appendChild(Z);this.element_=Z;this.arcScaleX_=1;this.arcScaleY_=1;this.lineScale_=1}var M=W.prototype;M.clearRect=function(){if(this.textMeasureEl_){this.textMeasureEl_.removeNode(true);this.textMeasureEl_=null}this.element_.innerHTML=""};M.beginPath=function(){this.currentPath_=[]};M.moveTo=function(i,Z){var j=this.getCoords_(i,Z);this.currentPath_.push({type:"moveTo",x:j.x,y:j.y});this.currentX_=j.x;this.currentY_=j.y};M.lineTo=function(i,Z){var j=this.getCoords_(i,Z);this.currentPath_.push({type:"lineTo",x:j.x,y:j.y});this.currentX_=j.x;this.currentY_=j.y};M.bezierCurveTo=function(j,i,AI,AH,AG,AE){var Z=this.getCoords_(AG,AE);var AF=this.getCoords_(j,i);var m=this.getCoords_(AI,AH);e(this,AF,m,Z)};function e(Z,m,j,i){Z.currentPath_.push({type:"bezierCurveTo",cp1x:m.x,cp1y:m.y,cp2x:j.x,cp2y:j.y,x:i.x,y:i.y});Z.currentX_=i.x;Z.currentY_=i.y}M.quadraticCurveTo=function(AG,j,i,Z){var AF=this.getCoords_(AG,j);var AE=this.getCoords_(i,Z);var AH={x:this.currentX_+2/3*(AF.x-this.currentX_),y:this.currentY_+2/3*(AF.y-this.currentY_)};var m={x:AH.x+(AE.x-this.currentX_)/3,y:AH.y+(AE.y-this.currentY_)/3};e(this,AH,m,AE)};M.arc=function(AJ,AH,AI,AE,i,j){AI*=D;var AN=j?"at":"wa";var AK=AJ+U(AE)*AI-F;var AM=AH+J(AE)*AI-F;var Z=AJ+U(i)*AI-F;var AL=AH+J(i)*AI-F;if(AK==Z&&!j){AK+=0.125}var m=this.getCoords_(AJ,AH);var AG=this.getCoords_(AK,AM);var AF=this.getCoords_(Z,AL);this.currentPath_.push({type:AN,x:m.x,y:m.y,radius:AI,xStart:AG.x,yStart:AG.y,xEnd:AF.x,yEnd:AF.y})};M.rect=function(j,i,Z,m){this.moveTo(j,i);this.lineTo(j+Z,i);this.lineTo(j+Z,i+m);this.lineTo(j,i+m);this.closePath()};M.strokeRect=function(j,i,Z,m){var p=this.currentPath_;this.beginPath();this.moveTo(j,i);this.lineTo(j+Z,i);this.lineTo(j+Z,i+m);this.lineTo(j,i+m);this.closePath();this.stroke();this.currentPath_=p};M.fillRect=function(j,i,Z,m){var p=this.currentPath_;this.beginPath();this.moveTo(j,i);this.lineTo(j+Z,i);this.lineTo(j+Z,i+m);this.lineTo(j,i+m);this.closePath();this.fill();this.currentPath_=p};M.createLinearGradient=function(i,m,Z,j){var p=new v("gradient");p.x0_=i;p.y0_=m;p.x1_=Z;p.y1_=j;return p};M.createRadialGradient=function(m,AE,j,i,p,Z){var AF=new v("gradientradial");AF.x0_=m;AF.y0_=AE;AF.r0_=j;AF.x1_=i;AF.y1_=p;AF.r1_=Z;return AF};M.drawImage=function(AO,j){var AH,AF,AJ,AV,AM,AK,AQ,AX;var AI=AO.runtimeStyle.width;var AN=AO.runtimeStyle.height;AO.runtimeStyle.width="auto";AO.runtimeStyle.height="auto";var AG=AO.width;var AT=AO.height;AO.runtimeStyle.width=AI;AO.runtimeStyle.height=AN;if(arguments.length==3){AH=arguments[1];AF=arguments[2];AM=AK=0;AQ=AJ=AG;AX=AV=AT}else{if(arguments.length==5){AH=arguments[1];AF=arguments[2];AJ=arguments[3];AV=arguments[4];AM=AK=0;AQ=AG;AX=AT}else{if(arguments.length==9){AM=arguments[1];AK=arguments[2];AQ=arguments[3];AX=arguments[4];AH=arguments[5];AF=arguments[6];AJ=arguments[7];AV=arguments[8]}else{throw Error("Invalid number of arguments")}}}var AW=this.getCoords_(AH,AF);var m=AQ/2;var i=AX/2;var AU=[];var Z=10;var AE=10;AU.push(" <g_vml_:group",' coordsize="',D*Z,",",D*AE,'"',' coordorigin="0,0"',' style="width:',Z,"px;height:",AE,"px;position:absolute;");if(this.m_[0][0]!=1||this.m_[0][1]||this.m_[1][1]!=1||this.m_[1][0]){var p=[];p.push("M11=",this.m_[0][0],",","M12=",this.m_[1][0],",","M21=",this.m_[0][1],",","M22=",this.m_[1][1],",","Dx=",K(AW.x/D),",","Dy=",K(AW.y/D),"");var AS=AW;var AR=this.getCoords_(AH+AJ,AF);var AP=this.getCoords_(AH,AF+AV);var AL=this.getCoords_(AH+AJ,AF+AV);AS.x=z.max(AS.x,AR.x,AP.x,AL.x);AS.y=z.max(AS.y,AR.y,AP.y,AL.y);AU.push("padding:0 ",K(AS.x/D),"px ",K(AS.y/D),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",p.join(""),", sizingmethod='clip');")}else{AU.push("top:",K(AW.y/D),"px;left:",K(AW.x/D),"px;")}AU.push(' ">','<g_vml_:image src="',AO.src,'"',' style="width:',D*AJ,"px;"," height:",D*AV,'px"',' cropleft="',AM/AG,'"',' croptop="',AK/AT,'"',' cropright="',(AG-AM-AQ)/AG,'"',' cropbottom="',(AT-AK-AX)/AT,'"'," />","</g_vml_:group>");this.element_.insertAdjacentHTML("BeforeEnd",AU.join(""))};M.stroke=function(AM){var m=10;var AN=10;var AE=5000;var AG={x:null,y:null};var AL={x:null,y:null};for(var AH=0;AH<this.currentPath_.length;AH+=AE){var AK=[];var AF=false;AK.push("<g_vml_:shape",' filled="',!!AM,'"',' style="position:absolute;width:',m,"px;height:",AN,'px;"',' coordorigin="0,0"',' coordsize="',D*m,",",D*AN,'"',' stroked="',!AM,'"',' path="');var AO=false;for(var AI=AH;AI<Math.min(AH+AE,this.currentPath_.length);AI++){if(AI%AE==0&&AI>0){AK.push(" m ",K(this.currentPath_[AI-1].x),",",K(this.currentPath_[AI-1].y))}var Z=this.currentPath_[AI];var AJ;switch(Z.type){case"moveTo":AJ=Z;AK.push(" m ",K(Z.x),",",K(Z.y));break;case"lineTo":AK.push(" l ",K(Z.x),",",K(Z.y));break;case"close":AK.push(" x ");Z=null;break;case"bezierCurveTo":AK.push(" c ",K(Z.cp1x),",",K(Z.cp1y),",",K(Z.cp2x),",",K(Z.cp2y),",",K(Z.x),",",K(Z.y));break;case"at":case"wa":AK.push(" ",Z.type," ",K(Z.x-this.arcScaleX_*Z.radius),",",K(Z.y-this.arcScaleY_*Z.radius)," ",K(Z.x+this.arcScaleX_*Z.radius),",",K(Z.y+this.arcScaleY_*Z.radius)," ",K(Z.xStart),",",K(Z.yStart)," ",K(Z.xEnd),",",K(Z.yEnd));break}if(Z){if(AG.x==null||Z.x<AG.x){AG.x=Z.x}if(AL.x==null||Z.x>AL.x){AL.x=Z.x}if(AG.y==null||Z.y<AG.y){AG.y=Z.y}if(AL.y==null||Z.y>AL.y){AL.y=Z.y}}}AK.push(' ">');if(!AM){R(this,AK)}else{a(this,AK,AG,AL)}AK.push("</g_vml_:shape>");this.element_.insertAdjacentHTML("beforeEnd",AK.join(""))}};function R(j,AE){var i=Y(j.strokeStyle);var m=i.color;var p=i.alpha*j.globalAlpha;var Z=j.lineScale_*j.lineWidth;if(Z<1){p*=Z}AE.push("<g_vml_:stroke",' opacity="',p,'"',' joinstyle="',j.lineJoin,'"',' miterlimit="',j.miterLimit,'"',' endcap="',t(j.lineCap),'"',' weight="',Z,'px"',' color="',m,'" />')}function a(AO,AG,Ah,AP){var AH=AO.fillStyle;var AY=AO.arcScaleX_;var AX=AO.arcScaleY_;var Z=AP.x-Ah.x;var m=AP.y-Ah.y;if(AH instanceof v){var AL=0;var Ac={x:0,y:0};var AU=0;var AK=1;if(AH.type_=="gradient"){var AJ=AH.x0_/AY;var j=AH.y0_/AX;var AI=AH.x1_/AY;var Aj=AH.y1_/AX;var Ag=AO.getCoords_(AJ,j);var Af=AO.getCoords_(AI,Aj);var AE=Af.x-Ag.x;var p=Af.y-Ag.y;AL=Math.atan2(AE,p)*180/Math.PI;if(AL<0){AL+=360}if(AL<0.000001){AL=0}}else{var Ag=AO.getCoords_(AH.x0_,AH.y0_);Ac={x:(Ag.x-Ah.x)/Z,y:(Ag.y-Ah.y)/m};Z/=AY*D;m/=AX*D;var Aa=z.max(Z,m);AU=2*AH.r0_/Aa;AK=2*AH.r1_/Aa-AU}var AS=AH.colors_;AS.sort(function(Ak,i){return Ak.offset-i.offset});var AN=AS.length;var AR=AS[0].color;var AQ=AS[AN-1].color;var AW=AS[0].alpha*AO.globalAlpha;var AV=AS[AN-1].alpha*AO.globalAlpha;var Ab=[];for(var Ae=0;Ae<AN;Ae++){var AM=AS[Ae];Ab.push(AM.offset*AK+AU+" "+AM.color)}AG.push('<g_vml_:fill type="',AH.type_,'"',' method="none" focus="100%"',' color="',AR,'"',' color2="',AQ,'"',' colors="',Ab.join(","),'"',' opacity="',AV,'"',' g_o_:opacity2="',AW,'"',' angle="',AL,'"',' focusposition="',Ac.x,",",Ac.y,'" />')}else{if(AH instanceof u){if(Z&&m){var AF=-Ah.x;var AZ=-Ah.y;AG.push("<g_vml_:fill",' position="',AF/Z*AY*AY,",",AZ/m*AX*AX,'"',' type="tile"',' src="',AH.src_,'" />')}}else{var Ai=Y(AO.fillStyle);var AT=Ai.color;var Ad=Ai.alpha*AO.globalAlpha;AG.push('<g_vml_:fill color="',AT,'" opacity="',Ad,'" />')}}}M.fill=function(){this.stroke(true)};M.closePath=function(){this.currentPath_.push({type:"close"})};M.getCoords_=function(j,i){var Z=this.m_;return{x:D*(j*Z[0][0]+i*Z[1][0]+Z[2][0])-F,y:D*(j*Z[0][1]+i*Z[1][1]+Z[2][1])-F}};M.save=function(){var Z={};Q(this,Z);this.aStack_.push(Z);this.mStack_.push(this.m_);this.m_=d(V(),this.m_)};M.restore=function(){if(this.aStack_.length){Q(this.aStack_.pop(),this);this.m_=this.mStack_.pop()}};function H(Z){return isFinite(Z[0][0])&&isFinite(Z[0][1])&&isFinite(Z[1][0])&&isFinite(Z[1][1])&&isFinite(Z[2][0])&&isFinite(Z[2][1])}function y(i,Z,j){if(!H(Z)){return }i.m_=Z;if(j){var p=Z[0][0]*Z[1][1]-Z[0][1]*Z[1][0];i.lineScale_=k(b(p))}}M.translate=function(j,i){var Z=[[1,0,0],[0,1,0],[j,i,1]];y(this,d(Z,this.m_),false)};M.rotate=function(i){var m=U(i);var j=J(i);var Z=[[m,j,0],[-j,m,0],[0,0,1]];y(this,d(Z,this.m_),false)};M.scale=function(j,i){this.arcScaleX_*=j;this.arcScaleY_*=i;var Z=[[j,0,0],[0,i,0],[0,0,1]];y(this,d(Z,this.m_),true)};M.transform=function(p,m,AF,AE,i,Z){var j=[[p,m,0],[AF,AE,0],[i,Z,1]];y(this,d(j,this.m_),true)};M.setTransform=function(AE,p,AG,AF,j,i){var Z=[[AE,p,0],[AG,AF,0],[j,i,1]];y(this,Z,true)};M.drawText_=function(AK,AI,AH,AN,AG){var AM=this.m_,AQ=1000,i=0,AP=AQ,AF={x:0,y:0},AE=[];var Z=P(X(this.font),this.element_);var j=AA(Z);var AR=this.element_.currentStyle;var p=this.textAlign.toLowerCase();switch(p){case"left":case"center":case"right":break;case"end":p=AR.direction=="ltr"?"right":"left";break;case"start":p=AR.direction=="rtl"?"right":"left";break;default:p="left"}switch(this.textBaseline){case"hanging":case"top":AF.y=Z.size/1.75;break;case"middle":break;default:case null:case"alphabetic":case"ideographic":case"bottom":AF.y=-Z.size/2.25;break}switch(p){case"right":i=AQ;AP=0.05;break;case"center":i=AP=AQ/2;break}var AO=this.getCoords_(AI+AF.x,AH+AF.y);AE.push('<g_vml_:line from="',-i,' 0" to="',AP,' 0.05" ',' coordsize="100 100" coordorigin="0 0"',' filled="',!AG,'" stroked="',!!AG,'" style="position:absolute;width:1px;height:1px;">');if(AG){R(this,AE)}else{a(this,AE,{x:-i,y:0},{x:AP,y:Z.size})}var AL=AM[0][0].toFixed(3)+","+AM[1][0].toFixed(3)+","+AM[0][1].toFixed(3)+","+AM[1][1].toFixed(3)+",0,0";var AJ=K(AO.x/D)+","+K(AO.y/D);AE.push('<g_vml_:skew on="t" matrix="',AL,'" ',' offset="',AJ,'" origin="',i,' 0" />','<g_vml_:path textpathok="true" />','<g_vml_:textpath on="true" string="',AD(AK),'" style="v-text-align:',p,";font:",AD(j),'" /></g_vml_:line>');this.element_.insertAdjacentHTML("beforeEnd",AE.join(""))};M.fillText=function(j,Z,m,i){this.drawText_(j,Z,m,i,false)};M.strokeText=function(j,Z,m,i){this.drawText_(j,Z,m,i,true)};M.measureText=function(j){if(!this.textMeasureEl_){var Z='<span style="position:absolute;top:-20000px;left:0;padding:0;margin:0;border:none;white-space:pre;"></span>';this.element_.insertAdjacentHTML("beforeEnd",Z);this.textMeasureEl_=this.element_.lastChild}var i=this.element_.ownerDocument;this.textMeasureEl_.innerHTML="";this.textMeasureEl_.style.font=this.font;this.textMeasureEl_.appendChild(i.createTextNode(j));return{width:this.textMeasureEl_.offsetWidth}};M.clip=function(){};M.arcTo=function(){};M.createPattern=function(i,Z){return new u(i,Z)};function v(Z){this.type_=Z;this.x0_=0;this.y0_=0;this.r0_=0;this.x1_=0;this.y1_=0;this.r1_=0;this.colors_=[]}v.prototype.addColorStop=function(i,Z){Z=Y(Z);this.colors_.push({offset:i,color:Z.color,alpha:Z.alpha})};function u(i,Z){q(i);switch(Z){case"repeat":case null:case"":this.repetition_="repeat";break;case"repeat-x":case"repeat-y":case"no-repeat":this.repetition_=Z;break;default:n("SYNTAX_ERR")}this.src_=i.src;this.width_=i.width;this.height_=i.height}function n(Z){throw new o(Z)}function q(Z){if(!Z||Z.nodeType!=1||Z.tagName!="IMG"){n("TYPE_MISMATCH_ERR")}if(Z.readyState!="complete"){n("INVALID_STATE_ERR")}}function o(Z){this.code=this[Z];this.message=Z+": DOM Exception "+this.code}var x=o.prototype=new Error;x.INDEX_SIZE_ERR=1;x.DOMSTRING_SIZE_ERR=2;x.HIERARCHY_REQUEST_ERR=3;x.WRONG_DOCUMENT_ERR=4;x.INVALID_CHARACTER_ERR=5;x.NO_DATA_ALLOWED_ERR=6;x.NO_MODIFICATION_ALLOWED_ERR=7;x.NOT_FOUND_ERR=8;x.NOT_SUPPORTED_ERR=9;x.INUSE_ATTRIBUTE_ERR=10;x.INVALID_STATE_ERR=11;x.SYNTAX_ERR=12;x.INVALID_MODIFICATION_ERR=13;x.NAMESPACE_ERR=14;x.INVALID_ACCESS_ERR=15;x.VALIDATION_ERR=16;x.TYPE_MISMATCH_ERR=17;G_vmlCanvasManager=E;CanvasRenderingContext2D=W;CanvasGradient=v;CanvasPattern=u;DOMException=o})()}; |
/* Plugin for jQuery for working with colors. | |
* | |
* Version 1.1. | |
* | |
* Inspiration from jQuery color animation plugin by John Resig. | |
* | |
* Released under the MIT license by Ole Laursen, October 2009. | |
* | |
* Examples: | |
* | |
* $.color.parse("#fff").scale('rgb', 0.25).add('a', -0.5).toString() | |
* var c = $.color.extract($("#mydiv"), 'background-color'); | |
* console.log(c.r, c.g, c.b, c.a); | |
* $.color.make(100, 50, 25, 0.4).toString() // returns "rgba(100,50,25,0.4)" | |
* | |
* Note that .scale() and .add() return the same modified object | |
* instead of making a new one. | |
* | |
* V. 1.1: Fix error handling so e.g. parsing an empty string does | |
* produce a color rather than just crashing. | |
*/ | |
(function($) { | |
$.color = {}; | |
// construct color object with some convenient chainable helpers | |
$.color.make = function (r, g, b, a) { | |
var o = {}; | |
o.r = r || 0; | |
o.g = g || 0; | |
o.b = b || 0; | |
o.a = a != null ? a : 1; | |
o.add = function (c, d) { | |
for (var i = 0; i < c.length; ++i) | |
o[c.charAt(i)] += d; | |
return o.normalize(); | |
}; | |
o.scale = function (c, f) { | |
for (var i = 0; i < c.length; ++i) | |
o[c.charAt(i)] *= f; | |
return o.normalize(); | |
}; | |
o.toString = function () { | |
if (o.a >= 1.0) { | |
return "rgb("+[o.r, o.g, o.b].join(",")+")"; | |
} else { | |
return "rgba("+[o.r, o.g, o.b, o.a].join(",")+")"; | |
} | |
}; | |
o.normalize = function () { | |
function clamp(min, value, max) { | |
return value < min ? min: (value > max ? max: value); | |
} | |
o.r = clamp(0, parseInt(o.r), 255); | |
o.g = clamp(0, parseInt(o.g), 255); | |
o.b = clamp(0, parseInt(o.b), 255); | |
o.a = clamp(0, o.a, 1); | |
return o; | |
}; | |
o.clone = function () { | |
return $.color.make(o.r, o.b, o.g, o.a); | |
}; | |
return o.normalize(); | |
} | |
// extract CSS color property from element, going up in the DOM | |
// if it's "transparent" | |
$.color.extract = function (elem, css) { | |
var c; | |
do { | |
c = elem.css(css).toLowerCase(); | |
// keep going until we find an element that has color, or | |
// we hit the body | |
if (c != '' && c != 'transparent') | |
break; | |
elem = elem.parent(); | |
} while (!$.nodeName(elem.get(0), "body")); | |
// catch Safari's way of signalling transparent | |
if (c == "rgba(0, 0, 0, 0)") | |
c = "transparent"; | |
return $.color.parse(c); | |
} | |
// parse CSS color string (like "rgb(10, 32, 43)" or "#fff"), | |
// returns color object, if parsing failed, you get black (0, 0, | |
// 0) out | |
$.color.parse = function (str) { | |
var res, m = $.color.make; | |
// Look for rgb(num,num,num) | |
if (res = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(str)) | |
return m(parseInt(res[1], 10), parseInt(res[2], 10), parseInt(res[3], 10)); | |
// Look for rgba(num,num,num,num) | |
if (res = /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str)) | |
return m(parseInt(res[1], 10), parseInt(res[2], 10), parseInt(res[3], 10), parseFloat(res[4])); | |
// Look for rgb(num%,num%,num%) | |
if (res = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(str)) | |
return m(parseFloat(res[1])*2.55, parseFloat(res[2])*2.55, parseFloat(res[3])*2.55); | |
// Look for rgba(num%,num%,num%,num) | |
if (res = /rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str)) | |
return m(parseFloat(res[1])*2.55, parseFloat(res[2])*2.55, parseFloat(res[3])*2.55, parseFloat(res[4])); | |
// Look for #a0b1c2 | |
if (res = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(str)) | |
return m(parseInt(res[1], 16), parseInt(res[2], 16), parseInt(res[3], 16)); | |
// Look for #fff | |
if (res = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(str)) | |
return m(parseInt(res[1]+res[1], 16), parseInt(res[2]+res[2], 16), parseInt(res[3]+res[3], 16)); | |
// Otherwise, we're most likely dealing with a named color | |
var name = $.trim(str).toLowerCase(); | |
if (name == "transparent") | |
return m(255, 255, 255, 0); | |
else { | |
// default to black | |
res = lookupColors[name] || [0, 0, 0]; | |
return m(res[0], res[1], res[2]); | |
} | |
} | |
var lookupColors = { | |
aqua:[0,255,255], | |
azure:[240,255,255], | |
beige:[245,245,220], | |
black:[0,0,0], | |
blue:[0,0,255], | |
brown:[165,42,42], | |
cyan:[0,255,255], | |
darkblue:[0,0,139], | |
darkcyan:[0,139,139], | |
darkgrey:[169,169,169], | |
darkgreen:[0,100,0], | |
darkkhaki:[189,183,107], | |
darkmagenta:[139,0,139], | |
darkolivegreen:[85,107,47], | |
darkorange:[255,140,0], | |
darkorchid:[153,50,204], | |
darkred:[139,0,0], | |
darksalmon:[233,150,122], | |
darkviolet:[148,0,211], | |
fuchsia:[255,0,255], | |
gold:[255,215,0], | |
green:[0,128,0], | |
indigo:[75,0,130], | |
khaki:[240,230,140], | |
lightblue:[173,216,230], | |
lightcyan:[224,255,255], | |
lightgreen:[144,238,144], | |
lightgrey:[211,211,211], | |
lightpink:[255,182,193], | |
lightyellow:[255,255,224], | |
lime:[0,255,0], | |
magenta:[255,0,255], | |
maroon:[128,0,0], | |
navy:[0,0,128], | |
olive:[128,128,0], | |
orange:[255,165,0], | |
pink:[255,192,203], | |
purple:[128,0,128], | |
violet:[128,0,128], | |
red:[255,0,0], | |
silver:[192,192,192], | |
white:[255,255,255], | |
yellow:[255,255,0] | |
}; | |
})(jQuery); | |
(function(b){b.color={};b.color.make=function(f,e,c,d){var h={};h.r=f||0;h.g=e||0;h.b=c||0;h.a=d!=null?d:1;h.add=function(k,j){for(var g=0;g<k.length;++g){h[k.charAt(g)]+=j}return h.normalize()};h.scale=function(k,j){for(var g=0;g<k.length;++g){h[k.charAt(g)]*=j}return h.normalize()};h.toString=function(){if(h.a>=1){return"rgb("+[h.r,h.g,h.b].join(",")+")"}else{return"rgba("+[h.r,h.g,h.b,h.a].join(",")+")"}};h.normalize=function(){function g(j,k,i){return k<j?j:(k>i?i:k)}h.r=g(0,parseInt(h.r),255);h.g=g(0,parseInt(h.g),255);h.b=g(0,parseInt(h.b),255);h.a=g(0,h.a,1);return h};h.clone=function(){return b.color.make(h.r,h.b,h.g,h.a)};return h.normalize()};b.color.extract=function(e,d){var f;do{f=e.css(d).toLowerCase();if(f!=""&&f!="transparent"){break}e=e.parent()}while(!b.nodeName(e.get(0),"body"));if(f=="rgba(0, 0, 0, 0)"){f="transparent"}return b.color.parse(f)};b.color.parse=function(f){var e,c=b.color.make;if(e=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(f)){return c(parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3],10))}if(e=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(f)){return c(parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3],10),parseFloat(e[4]))}if(e=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(f)){return c(parseFloat(e[1])*2.55,parseFloat(e[2])*2.55,parseFloat(e[3])*2.55)}if(e=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(f)){return c(parseFloat(e[1])*2.55,parseFloat(e[2])*2.55,parseFloat(e[3])*2.55,parseFloat(e[4]))}if(e=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(f)){return c(parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16))}if(e=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(f)){return c(parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16))}var d=b.trim(f).toLowerCase();if(d=="transparent"){return c(255,255,255,0)}else{e=a[d]||[0,0,0];return c(e[0],e[1],e[2])}};var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery); |
/* | |
Flot plugin for showing crosshairs, thin lines, when the mouse hovers | |
over the plot. | |
crosshair: { | |
mode: null or "x" or "y" or "xy" | |
color: color | |
lineWidth: number | |
} | |
Set the mode to one of "x", "y" or "xy". The "x" mode enables a | |
vertical crosshair that lets you trace the values on the x axis, "y" | |
enables a horizontal crosshair and "xy" enables them both. "color" is | |
the color of the crosshair (default is "rgba(170, 0, 0, 0.80)"), | |
"lineWidth" is the width of the drawn lines (default is 1). | |
The plugin also adds four public methods: | |
- setCrosshair(pos) | |
Set the position of the crosshair. Note that this is cleared if | |
the user moves the mouse. "pos" is in coordinates of the plot and | |
should be on the form { x: xpos, y: ypos } (you can use x2/x3/... | |
if you're using multiple axes), which is coincidentally the same | |
format as what you get from a "plothover" event. If "pos" is null, | |
the crosshair is cleared. | |
- clearCrosshair() | |
Clear the crosshair. | |
- lockCrosshair(pos) | |
Cause the crosshair to lock to the current location, no longer | |
updating if the user moves the mouse. Optionally supply a position | |
(passed on to setCrosshair()) to move it to. | |
Example usage: | |
var myFlot = $.plot( $("#graph"), ..., { crosshair: { mode: "x" } } }; | |
$("#graph").bind("plothover", function (evt, position, item) { | |
if (item) { | |
// Lock the crosshair to the data point being hovered | |
myFlot.lockCrosshair({ x: item.datapoint[0], y: item.datapoint[1] }); | |
} | |
else { | |
// Return normal crosshair operation | |
myFlot.unlockCrosshair(); | |
} | |
}); | |
- unlockCrosshair() | |
Free the crosshair to move again after locking it. | |
*/ | |
(function ($) { | |
var options = { | |
crosshair: { | |
mode: null, // one of null, "x", "y" or "xy", | |
color: "rgba(170, 0, 0, 0.80)", | |
lineWidth: 1 | |
} | |
}; | |
function init(plot) { | |
// position of crosshair in pixels | |
var crosshair = { x: -1, y: -1, locked: false }; | |
plot.setCrosshair = function setCrosshair(pos) { | |
if (!pos) | |
crosshair.x = -1; | |
else { | |
var o = plot.p2c(pos); | |
crosshair.x = Math.max(0, Math.min(o.left, plot.width())); | |
crosshair.y = Math.max(0, Math.min(o.top, plot.height())); | |
} | |
plot.triggerRedrawOverlay(); | |
}; | |
plot.clearCrosshair = plot.setCrosshair; // passes null for pos | |
plot.lockCrosshair = function lockCrosshair(pos) { | |
if (pos) | |
plot.setCrosshair(pos); | |
crosshair.locked = true; | |
} | |
plot.unlockCrosshair = function unlockCrosshair() { | |
crosshair.locked = false; | |
} | |
function onMouseOut(e) { | |
if (crosshair.locked) | |
return; | |
if (crosshair.x != -1) { | |
crosshair.x = -1; | |
plot.triggerRedrawOverlay(); | |
} | |
} | |
function onMouseMove(e) { | |
if (crosshair.locked) | |
return; | |
if (plot.getSelection && plot.getSelection()) { | |
crosshair.x = -1; // hide the crosshair while selecting | |
return; | |
} | |
var offset = plot.offset(); | |
crosshair.x = Math.max(0, Math.min(e.pageX - offset.left, plot.width())); | |
crosshair.y = Math.max(0, Math.min(e.pageY - offset.top, plot.height())); | |
plot.triggerRedrawOverlay(); | |
} | |
plot.hooks.bindEvents.push(function (plot, eventHolder) { | |
if (!plot.getOptions().crosshair.mode) | |
return; | |
eventHolder.mouseout(onMouseOut); | |
eventHolder.mousemove(onMouseMove); | |
}); | |
plot.hooks.drawOverlay.push(function (plot, ctx) { | |
var c = plot.getOptions().crosshair; | |
if (!c.mode) | |
return; | |
var plotOffset = plot.getPlotOffset(); | |
ctx.save(); | |
ctx.translate(plotOffset.left, plotOffset.top); | |
if (crosshair.x != -1) { | |
ctx.strokeStyle = c.color; | |
ctx.lineWidth = c.lineWidth; | |
ctx.lineJoin = "round"; | |
ctx.beginPath(); | |
if (c.mode.indexOf("x") != -1) { | |
ctx.moveTo(crosshair.x, 0); | |
ctx.lineTo(crosshair.x, plot.height()); | |
} | |
if (c.mode.indexOf("y") != -1) { | |
ctx.moveTo(0, crosshair.y); | |
ctx.lineTo(plot.width(), crosshair.y); | |
} | |
ctx.stroke(); | |
} | |
ctx.restore(); | |
}); | |
plot.hooks.shutdown.push(function (plot, eventHolder) { | |
eventHolder.unbind("mouseout", onMouseOut); | |
eventHolder.unbind("mousemove", onMouseMove); | |
}); | |
} | |
$.plot.plugins.push({ | |
init: init, | |
options: options, | |
name: 'crosshair', | |
version: '1.0' | |
}); | |
})(jQuery); | |
(function(b){var a={crosshair:{mode:null,color:"rgba(170, 0, 0, 0.80)",lineWidth:1}};function c(h){var j={x:-1,y:-1,locked:false};h.setCrosshair=function e(l){if(!l){j.x=-1}else{var k=h.p2c(l);j.x=Math.max(0,Math.min(k.left,h.width()));j.y=Math.max(0,Math.min(k.top,h.height()))}h.triggerRedrawOverlay()};h.clearCrosshair=h.setCrosshair;h.lockCrosshair=function f(k){if(k){h.setCrosshair(k)}j.locked=true};h.unlockCrosshair=function g(){j.locked=false};function d(k){if(j.locked){return}if(j.x!=-1){j.x=-1;h.triggerRedrawOverlay()}}function i(k){if(j.locked){return}if(h.getSelection&&h.getSelection()){j.x=-1;return}var l=h.offset();j.x=Math.max(0,Math.min(k.pageX-l.left,h.width()));j.y=Math.max(0,Math.min(k.pageY-l.top,h.height()));h.triggerRedrawOverlay()}h.hooks.bindEvents.push(function(l,k){if(!l.getOptions().crosshair.mode){return}k.mouseout(d);k.mousemove(i)});h.hooks.drawOverlay.push(function(m,k){var n=m.getOptions().crosshair;if(!n.mode){return}var l=m.getPlotOffset();k.save();k.translate(l.left,l.top);if(j.x!=-1){k.strokeStyle=n.color;k.lineWidth=n.lineWidth;k.lineJoin="round";k.beginPath();if(n.mode.indexOf("x")!=-1){k.moveTo(j.x,0);k.lineTo(j.x,m.height())}if(n.mode.indexOf("y")!=-1){k.moveTo(0,j.y);k.lineTo(m.width(),j.y)}k.stroke()}k.restore()});h.hooks.shutdown.push(function(l,k){k.unbind("mouseout",d);k.unbind("mousemove",i)})}b.plot.plugins.push({init:c,options:a,name:"crosshair",version:"1.0"})})(jQuery); |
/* | |
Flot plugin for computing bottoms for filled line and bar charts. | |
The case: you've got two series that you want to fill the area | |
between. In Flot terms, you need to use one as the fill bottom of the | |
other. You can specify the bottom of each data point as the third | |
coordinate manually, or you can use this plugin to compute it for you. | |
In order to name the other series, you need to give it an id, like this | |
var dataset = [ | |
{ data: [ ... ], id: "foo" } , // use default bottom | |
{ data: [ ... ], fillBetween: "foo" }, // use first dataset as bottom | |
]; | |
$.plot($("#placeholder"), dataset, { line: { show: true, fill: true }}); | |
As a convenience, if the id given is a number that doesn't appear as | |
an id in the series, it is interpreted as the index in the array | |
instead (so fillBetween: 0 can also mean the first series). | |
Internally, the plugin modifies the datapoints in each series. For | |
line series, extra data points might be inserted through | |
interpolation. Note that at points where the bottom line is not | |
defined (due to a null point or start/end of line), the current line | |
will show a gap too. The algorithm comes from the jquery.flot.stack.js | |
plugin, possibly some code could be shared. | |
*/ | |
(function ($) { | |
var options = { | |
series: { fillBetween: null } // or number | |
}; | |
function init(plot) { | |
function findBottomSeries(s, allseries) { | |
var i; | |
for (i = 0; i < allseries.length; ++i) { | |
if (allseries[i].id == s.fillBetween) | |
return allseries[i]; | |
} | |
if (typeof s.fillBetween == "number") { | |
i = s.fillBetween; | |
if (i < 0 || i >= allseries.length) | |
return null; | |
return allseries[i]; | |
} | |
return null; | |
} | |
function computeFillBottoms(plot, s, datapoints) { | |
if (s.fillBetween == null) | |
return; | |
var other = findBottomSeries(s, plot.getData()); | |
if (!other) | |
return; | |
var ps = datapoints.pointsize, | |
points = datapoints.points, | |
otherps = other.datapoints.pointsize, | |
otherpoints = other.datapoints.points, | |
newpoints = [], | |
px, py, intery, qx, qy, bottom, | |
withlines = s.lines.show, | |
withbottom = ps > 2 && datapoints.format[2].y, | |
withsteps = withlines && s.lines.steps, | |
fromgap = true, | |
i = 0, j = 0, l; | |
while (true) { | |
if (i >= points.length) | |
break; | |
l = newpoints.length; | |
if (points[i] == null) { | |
// copy gaps | |
for (m = 0; m < ps; ++m) | |
newpoints.push(points[i + m]); | |
i += ps; | |
} | |
else if (j >= otherpoints.length) { | |
// for lines, we can't use the rest of the points | |
if (!withlines) { | |
for (m = 0; m < ps; ++m) | |
newpoints.push(points[i + m]); | |
} | |
i += ps; | |
} | |
else if (otherpoints[j] == null) { | |
// oops, got a gap | |
for (m = 0; m < ps; ++m) | |
newpoints.push(null); | |
fromgap = true; | |
j += otherps; | |
} | |
else { | |
// cases where we actually got two points | |
px = points[i]; | |
py = points[i + 1]; | |
qx = otherpoints[j]; | |
qy = otherpoints[j + 1]; | |
bottom = 0; | |
if (px == qx) { | |
for (m = 0; m < ps; ++m) | |
newpoints.push(points[i + m]); | |
//newpoints[l + 1] += qy; | |
bottom = qy; | |
i += ps; | |
j += otherps; | |
} | |
else if (px > qx) { | |
// we got past point below, might need to | |
// insert interpolated extra point | |
if (withlines && i > 0 && points[i - ps] != null) { | |
intery = py + (points[i - ps + 1] - py) * (qx - px) / (points[i - ps] - px); | |
newpoints.push(qx); | |
newpoints.push(intery) | |
for (m = 2; m < ps; ++m) | |
newpoints.push(points[i + m]); | |
bottom = qy; | |
} | |
j += otherps; | |
} | |
else { // px < qx | |
if (fromgap && withlines) { | |
// if we come from a gap, we just skip this point | |
i += ps; | |
continue; | |
} | |
for (m = 0; m < ps; ++m) | |
newpoints.push(points[i + m]); | |
// we might be able to interpolate a point below, | |
// this can give us a better y | |
if (withlines && j > 0 && otherpoints[j - otherps] != null) | |
bottom = qy + (otherpoints[j - otherps + 1] - qy) * (px - qx) / (otherpoints[j - otherps] - qx); | |
//newpoints[l + 1] += bottom; | |
i += ps; | |
} | |
fromgap = false; | |
if (l != newpoints.length && withbottom) | |
newpoints[l + 2] = bottom; | |
} | |
// maintain the line steps invariant | |
if (withsteps && l != newpoints.length && l > 0 | |
&& newpoints[l] != null | |
&& newpoints[l] != newpoints[l - ps] | |
&& newpoints[l + 1] != newpoints[l - ps + 1]) { | |
for (m = 0; m < ps; ++m) | |
newpoints[l + ps + m] = newpoints[l + m]; | |
newpoints[l + 1] = newpoints[l - ps + 1]; | |
} | |
} | |
datapoints.points = newpoints; | |
} | |
plot.hooks.processDatapoints.push(computeFillBottoms); | |
} | |
$.plot.plugins.push({ | |
init: init, | |
options: options, | |
name: 'fillbetween', | |
version: '1.0' | |
}); | |
})(jQuery); | |
(function(b){var a={series:{fillBetween:null}};function c(f){function d(j,h){var g;for(g=0;g<h.length;++g){if(h[g].id==j.fillBetween){return h[g]}}if(typeof j.fillBetween=="number"){g=j.fillBetween;if(g<0||g>=h.length){return null}return h[g]}return null}function e(B,u,g){if(u.fillBetween==null){return}var p=d(u,B.getData());if(!p){return}var y=g.pointsize,E=g.points,h=p.datapoints.pointsize,x=p.datapoints.points,r=[],w,v,k,G,F,q,t=u.lines.show,o=y>2&&g.format[2].y,n=t&&u.lines.steps,D=true,C=0,A=0,z;while(true){if(C>=E.length){break}z=r.length;if(E[C]==null){for(m=0;m<y;++m){r.push(E[C+m])}C+=y}else{if(A>=x.length){if(!t){for(m=0;m<y;++m){r.push(E[C+m])}}C+=y}else{if(x[A]==null){for(m=0;m<y;++m){r.push(null)}D=true;A+=h}else{w=E[C];v=E[C+1];G=x[A];F=x[A+1];q=0;if(w==G){for(m=0;m<y;++m){r.push(E[C+m])}q=F;C+=y;A+=h}else{if(w>G){if(t&&C>0&&E[C-y]!=null){k=v+(E[C-y+1]-v)*(G-w)/(E[C-y]-w);r.push(G);r.push(k);for(m=2;m<y;++m){r.push(E[C+m])}q=F}A+=h}else{if(D&&t){C+=y;continue}for(m=0;m<y;++m){r.push(E[C+m])}if(t&&A>0&&x[A-h]!=null){q=F+(x[A-h+1]-F)*(w-G)/(x[A-h]-G)}C+=y}}D=false;if(z!=r.length&&o){r[z+2]=q}}}}if(n&&z!=r.length&&z>0&&r[z]!=null&&r[z]!=r[z-y]&&r[z+1]!=r[z-y+1]){for(m=0;m<y;++m){r[z+y+m]=r[z+m]}r[z+1]=r[z-y+1]}}g.points=r}f.hooks.processDatapoints.push(e)}b.plot.plugins.push({init:c,options:a,name:"fillbetween",version:"1.0"})})(jQuery); |
/* | |
Flot plugin for plotting images, e.g. useful for putting ticks on a | |
prerendered complex visualization. | |
The data syntax is [[image, x1, y1, x2, y2], ...] where (x1, y1) and | |
(x2, y2) are where you intend the two opposite corners of the image to | |
end up in the plot. Image must be a fully loaded Javascript image (you | |
can make one with new Image()). If the image is not complete, it's | |
skipped when plotting. | |
There are two helpers included for retrieving images. The easiest work | |
the way that you put in URLs instead of images in the data (like | |
["myimage.png", 0, 0, 10, 10]), then call $.plot.image.loadData(data, | |
options, callback) where data and options are the same as you pass in | |
to $.plot. This loads the images, replaces the URLs in the data with | |
the corresponding images and calls "callback" when all images are | |
loaded (or failed loading). In the callback, you can then call $.plot | |
with the data set. See the included example. | |
A more low-level helper, $.plot.image.load(urls, callback) is also | |
included. Given a list of URLs, it calls callback with an object | |
mapping from URL to Image object when all images are loaded or have | |
failed loading. | |
Options for the plugin are | |
series: { | |
images: { | |
show: boolean | |
anchor: "corner" or "center" | |
alpha: [0,1] | |
} | |
} | |
which can be specified for a specific series | |
$.plot($("#placeholder"), [{ data: [ ... ], images: { ... } ]) | |
Note that because the data format is different from usual data points, | |
you can't use images with anything else in a specific data series. | |
Setting "anchor" to "center" causes the pixels in the image to be | |
anchored at the corner pixel centers inside of at the pixel corners, | |
effectively letting half a pixel stick out to each side in the plot. | |
A possible future direction could be support for tiling for large | |
images (like Google Maps). | |
*/ | |
(function ($) { | |
var options = { | |
series: { | |
images: { | |
show: false, | |
alpha: 1, | |
anchor: "corner" // or "center" | |
} | |
} | |
}; | |
$.plot.image = {}; | |
$.plot.image.loadDataImages = function (series, options, callback) { | |
var urls = [], points = []; | |
var defaultShow = options.series.images.show; | |
$.each(series, function (i, s) { | |
if (!(defaultShow || s.images.show)) | |
return; | |
if (s.data) | |
s = s.data; | |
$.each(s, function (i, p) { | |
if (typeof p[0] == "string") { | |
urls.push(p[0]); | |
points.push(p); | |
} | |
}); | |
}); | |
$.plot.image.load(urls, function (loadedImages) { | |
$.each(points, function (i, p) { | |
var url = p[0]; | |
if (loadedImages[url]) | |
p[0] = loadedImages[url]; | |
}); | |
callback(); | |
}); | |
} | |
$.plot.image.load = function (urls, callback) { | |
var missing = urls.length, loaded = {}; | |
if (missing == 0) | |
callback({}); | |
$.each(urls, function (i, url) { | |
var handler = function () { | |
--missing; | |
loaded[url] = this; | |
if (missing == 0) | |
callback(loaded); | |
}; | |
$('<img />').load(handler).error(handler).attr('src', url); | |
}); | |
} | |
function drawSeries(plot, ctx, series) { | |
var plotOffset = plot.getPlotOffset(); | |
if (!series.images || !series.images.show) | |
return; | |
var points = series.datapoints.points, | |
ps = series.datapoints.pointsize; | |
for (var i = 0; i < points.length; i += ps) { | |
var img = points[i], | |
x1 = points[i + 1], y1 = points[i + 2], | |
x2 = points[i + 3], y2 = points[i + 4], | |
xaxis = series.xaxis, yaxis = series.yaxis, | |
tmp; | |
// actually we should check img.complete, but it | |
// appears to be a somewhat unreliable indicator in | |
// IE6 (false even after load event) | |
if (!img || img.width <= 0 || img.height <= 0) | |
continue; | |
if (x1 > x2) { | |
tmp = x2; | |
x2 = x1; | |
x1 = tmp; | |
} | |
if (y1 > y2) { | |
tmp = y2; | |
y2 = y1; | |
y1 = tmp; | |
} | |
// if the anchor is at the center of the pixel, expand the | |
// image by 1/2 pixel in each direction | |
if (series.images.anchor == "center") { | |
tmp = 0.5 * (x2-x1) / (img.width - 1); | |
x1 -= tmp; | |
x2 += tmp; | |
tmp = 0.5 * (y2-y1) / (img.height - 1); | |
y1 -= tmp; | |
y2 += tmp; | |
} | |
// clip | |
if (x1 == x2 || y1 == y2 || | |
x1 >= xaxis.max || x2 <= xaxis.min || | |
y1 >= yaxis.max || y2 <= yaxis.min) | |
continue; | |
var sx1 = 0, sy1 = 0, sx2 = img.width, sy2 = img.height; | |
if (x1 < xaxis.min) { | |
sx1 += (sx2 - sx1) * (xaxis.min - x1) / (x2 - x1); | |
x1 = xaxis.min; | |
} | |
if (x2 > xaxis.max) { | |
sx2 += (sx2 - sx1) * (xaxis.max - x2) / (x2 - x1); | |
x2 = xaxis.max; | |
} | |
if (y1 < yaxis.min) { | |
sy2 += (sy1 - sy2) * (yaxis.min - y1) / (y2 - y1); | |
y1 = yaxis.min; | |
} | |
if (y2 > yaxis.max) { | |
sy1 += (sy1 - sy2) * (yaxis.max - y2) / (y2 - y1); | |
y2 = yaxis.max; | |
} | |
x1 = xaxis.p2c(x1); | |
x2 = xaxis.p2c(x2); | |
y1 = yaxis.p2c(y1); | |
y2 = yaxis.p2c(y2); | |
// the transformation may have swapped us | |
if (x1 > x2) { | |
tmp = x2; | |
x2 = x1; | |
x1 = tmp; | |
} | |
if (y1 > y2) { | |
tmp = y2; | |
y2 = y1; | |
y1 = tmp; | |
} | |
tmp = ctx.globalAlpha; | |
ctx.globalAlpha *= series.images.alpha; | |
ctx.drawImage(img, | |
sx1, sy1, sx2 - sx1, sy2 - sy1, | |
x1 + plotOffset.left, y1 + plotOffset.top, | |
x2 - x1, y2 - y1); | |
ctx.globalAlpha = tmp; | |
} | |
} | |
function processRawData(plot, series, data, datapoints) { | |
if (!series.images.show) | |
return; | |
// format is Image, x1, y1, x2, y2 (opposite corners) | |
datapoints.format = [ | |
{ required: true }, | |
{ x: true, number: true, required: true }, | |
{ y: true, number: true, required: true }, | |
{ x: true, number: true, required: true }, | |
{ y: true, number: true, required: true } | |
]; | |
} | |
function init(plot) { | |
plot.hooks.processRawData.push(processRawData); | |
plot.hooks.drawSeries.push(drawSeries); | |
} | |
$.plot.plugins.push({ | |
init: init, | |
options: options, | |
name: 'image', | |
version: '1.1' | |
}); | |
})(jQuery); | |
(function(c){var a={series:{images:{show:false,alpha:1,anchor:"corner"}}};c.plot.image={};c.plot.image.loadDataImages=function(g,f,k){var j=[],h=[];var i=f.series.images.show;c.each(g,function(l,m){if(!(i||m.images.show)){return}if(m.data){m=m.data}c.each(m,function(n,o){if(typeof o[0]=="string"){j.push(o[0]);h.push(o)}})});c.plot.image.load(j,function(l){c.each(h,function(n,o){var m=o[0];if(l[m]){o[0]=l[m]}});k()})};c.plot.image.load=function(h,i){var g=h.length,f={};if(g==0){i({})}c.each(h,function(k,j){var l=function(){--g;f[j]=this;if(g==0){i(f)}};c("<img />").load(l).error(l).attr("src",j)})};function d(q,o,l){var m=q.getPlotOffset();if(!l.images||!l.images.show){return}var r=l.datapoints.points,n=l.datapoints.pointsize;for(var t=0;t<r.length;t+=n){var y=r[t],w=r[t+1],g=r[t+2],v=r[t+3],f=r[t+4],h=l.xaxis,u=l.yaxis,x;if(!y||y.width<=0||y.height<=0){continue}if(w>v){x=v;v=w;w=x}if(g>f){x=f;f=g;g=x}if(l.images.anchor=="center"){x=0.5*(v-w)/(y.width-1);w-=x;v+=x;x=0.5*(f-g)/(y.height-1);g-=x;f+=x}if(w==v||g==f||w>=h.max||v<=h.min||g>=u.max||f<=u.min){continue}var k=0,s=0,j=y.width,p=y.height;if(w<h.min){k+=(j-k)*(h.min-w)/(v-w);w=h.min}if(v>h.max){j+=(j-k)*(h.max-v)/(v-w);v=h.max}if(g<u.min){p+=(s-p)*(u.min-g)/(f-g);g=u.min}if(f>u.max){s+=(s-p)*(u.max-f)/(f-g);f=u.max}w=h.p2c(w);v=h.p2c(v);g=u.p2c(g);f=u.p2c(f);if(w>v){x=v;v=w;w=x}if(g>f){x=f;f=g;g=x}x=o.globalAlpha;o.globalAlpha*=l.images.alpha;o.drawImage(y,k,s,j-k,p-s,w+m.left,g+m.top,v-w,f-g);o.globalAlpha=x}}function b(i,f,g,h){if(!f.images.show){return}h.format=[{required:true},{x:true,number:true,required:true},{y:true,number:true,required:true},{x:true,number:true,required:true},{y:true,number:true,required:true}]}function e(f){f.hooks.processRawData.push(b);f.hooks.drawSeries.push(d)}c.plot.plugins.push({init:e,options:a,name:"image",version:"1.1"})})(jQuery); |
/*! Javascript plotting library for jQuery, v. 0.7. | |
* | |
* Released under the MIT license by IOLA, December 2007. | |
* | |
*/ | |
// first an inline dependency, jquery.colorhelpers.js, we inline it here | |
// for convenience | |
/* Plugin for jQuery for working with colors. | |
* | |
* Version 1.1. | |
* | |
* Inspiration from jQuery color animation plugin by John Resig. | |
* | |
* Released under the MIT license by Ole Laursen, October 2009. | |
* | |
* Examples: | |
* | |
* $.color.parse("#fff").scale('rgb', 0.25).add('a', -0.5).toString() | |
* var c = $.color.extract($("#mydiv"), 'background-color'); | |
* console.log(c.r, c.g, c.b, c.a); | |
* $.color.make(100, 50, 25, 0.4).toString() // returns "rgba(100,50,25,0.4)" | |
* | |
* Note that .scale() and .add() return the same modified object | |
* instead of making a new one. | |
* | |
* V. 1.1: Fix error handling so e.g. parsing an empty string does | |
* produce a color rather than just crashing. | |
*/ | |
(function(B){B.color={};B.color.make=function(F,E,C,D){var G={};G.r=F||0;G.g=E||0;G.b=C||0;G.a=D!=null?D:1;G.add=function(J,I){for(var H=0;H<J.length;++H){G[J.charAt(H)]+=I}return G.normalize()};G.scale=function(J,I){for(var H=0;H<J.length;++H){G[J.charAt(H)]*=I}return G.normalize()};G.toString=function(){if(G.a>=1){return"rgb("+[G.r,G.g,G.b].join(",")+")"}else{return"rgba("+[G.r,G.g,G.b,G.a].join(",")+")"}};G.normalize=function(){function H(J,K,I){return K<J?J:(K>I?I:K)}G.r=H(0,parseInt(G.r),255);G.g=H(0,parseInt(G.g),255);G.b=H(0,parseInt(G.b),255);G.a=H(0,G.a,1);return G};G.clone=function(){return B.color.make(G.r,G.b,G.g,G.a)};return G.normalize()};B.color.extract=function(D,C){var E;do{E=D.css(C).toLowerCase();if(E!=""&&E!="transparent"){break}D=D.parent()}while(!B.nodeName(D.get(0),"body"));if(E=="rgba(0, 0, 0, 0)"){E="transparent"}return B.color.parse(E)};B.color.parse=function(F){var E,C=B.color.make;if(E=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(F)){return C(parseInt(E[1],10),parseInt(E[2],10),parseInt(E[3],10))}if(E=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(F)){return C(parseInt(E[1],10),parseInt(E[2],10),parseInt(E[3],10),parseFloat(E[4]))}if(E=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(F)){return C(parseFloat(E[1])*2.55,parseFloat(E[2])*2.55,parseFloat(E[3])*2.55)}if(E=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(F)){return C(parseFloat(E[1])*2.55,parseFloat(E[2])*2.55,parseFloat(E[3])*2.55,parseFloat(E[4]))}if(E=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(F)){return C(parseInt(E[1],16),parseInt(E[2],16),parseInt(E[3],16))}if(E=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(F)){return C(parseInt(E[1]+E[1],16),parseInt(E[2]+E[2],16),parseInt(E[3]+E[3],16))}var D=B.trim(F).toLowerCase();if(D=="transparent"){return C(255,255,255,0)}else{E=A[D]||[0,0,0];return C(E[0],E[1],E[2])}};var A={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery); | |
// the actual Flot code | |
(function($) { | |
function Plot(placeholder, data_, options_, plugins) { | |
// data is on the form: | |
// [ series1, series2 ... ] | |
// where series is either just the data as [ [x1, y1], [x2, y2], ... ] | |
// or { data: [ [x1, y1], [x2, y2], ... ], label: "some label", ... } | |
var series = [], | |
options = { | |
// the color theme used for graphs | |
colors: ["#edc240", "#afd8f8", "#cb4b4b", "#4da74d", "#9440ed"], | |
legend: { | |
show: true, | |
noColumns: 1, // number of colums in legend table | |
labelFormatter: null, // fn: string -> string | |
labelBoxBorderColor: "#ccc", // border color for the little label boxes | |
container: null, // container (as jQuery object) to put legend in, null means default on top of graph | |
position: "ne", // position of default legend container within plot | |
margin: 5, // distance from grid edge to default legend container within plot | |
backgroundColor: null, // null means auto-detect | |
backgroundOpacity: 0.85 // set to 0 to avoid background | |
}, | |
xaxis: { | |
show: null, // null = auto-detect, true = always, false = never | |
position: "bottom", // or "top" | |
mode: null, // null or "time" | |
color: null, // base color, labels, ticks | |
tickColor: null, // possibly different color of ticks, e.g. "rgba(0,0,0,0.15)" | |
transform: null, // null or f: number -> number to transform axis | |
inverseTransform: null, // if transform is set, this should be the inverse function | |
min: null, // min. value to show, null means set automatically | |
max: null, // max. value to show, null means set automatically | |
autoscaleMargin: null, // margin in % to add if auto-setting min/max | |
ticks: null, // either [1, 3] or [[1, "a"], 3] or (fn: axis info -> ticks) or app. number of ticks for auto-ticks | |
tickFormatter: null, // fn: number -> string | |
labelWidth: null, // size of tick labels in pixels | |
labelHeight: null, | |
reserveSpace: null, // whether to reserve space even if axis isn't shown | |
tickLength: null, // size in pixels of ticks, or "full" for whole line | |
alignTicksWithAxis: null, // axis number or null for no sync | |
// mode specific options | |
tickDecimals: null, // no. of decimals, null means auto | |
tickSize: null, // number or [number, "unit"] | |
minTickSize: null, // number or [number, "unit"] | |
monthNames: null, // list of names of months | |
timeformat: null, // format string to use | |
twelveHourClock: false // 12 or 24 time in time mode | |
}, | |
yaxis: { | |
autoscaleMargin: 0.02, | |
position: "left" // or "right" | |
}, | |
xaxes: [], | |
yaxes: [], | |
series: { | |
points: { | |
show: false, | |
radius: 3, | |
lineWidth: 2, // in pixels | |
fill: true, | |
fillColor: "#ffffff", | |
symbol: "circle" // or callback | |
}, | |
lines: { | |
// we don't put in show: false so we can see | |
// whether lines were actively disabled | |
lineWidth: 2, // in pixels | |
fill: false, | |
fillColor: null, | |
steps: false | |
}, | |
bars: { | |
show: false, | |
lineWidth: 2, // in pixels | |
barWidth: 1, // in units of the x axis | |
fill: true, | |
fillColor: null, | |
align: "left", // or "center" | |
horizontal: false | |
}, | |
shadowSize: 3 | |
}, | |
grid: { | |
show: true, | |
aboveData: false, | |
color: "#545454", // primary color used for outline and labels | |
backgroundColor: null, // null for transparent, else color | |
borderColor: null, // set if different from the grid color | |
tickColor: null, // color for the ticks, e.g. "rgba(0,0,0,0.15)" | |
labelMargin: 5, // in pixels | |
axisMargin: 8, // in pixels | |
borderWidth: 2, // in pixels | |
minBorderMargin: null, // in pixels, null means taken from points radius | |
markings: null, // array of ranges or fn: axes -> array of ranges | |
markingsColor: "#f4f4f4", | |
markingsLineWidth: 2, | |
// interactive stuff | |
clickable: false, | |
hoverable: false, | |
autoHighlight: true, // highlight in case mouse is near | |
mouseActiveRadius: 10 // how far the mouse can be away to activate an item | |
}, | |
hooks: {} | |
}, | |
canvas = null, // the canvas for the plot itself | |
overlay = null, // canvas for interactive stuff on top of plot | |
eventHolder = null, // jQuery object that events should be bound to | |
ctx = null, octx = null, | |
xaxes = [], yaxes = [], | |
plotOffset = { left: 0, right: 0, top: 0, bottom: 0}, | |
canvasWidth = 0, canvasHeight = 0, | |
plotWidth = 0, plotHeight = 0, | |
hooks = { | |
processOptions: [], | |
processRawData: [], | |
processDatapoints: [], | |
drawSeries: [], | |
draw: [], | |
bindEvents: [], | |
drawOverlay: [], | |
shutdown: [] | |
}, | |
plot = this; | |
// public functions | |
plot.setData = setData; | |
plot.setupGrid = setupGrid; | |
plot.draw = draw; | |
plot.getPlaceholder = function() { return placeholder; }; | |
plot.getCanvas = function() { return canvas; }; | |
plot.getPlotOffset = function() { return plotOffset; }; | |
plot.width = function () { return plotWidth; }; | |
plot.height = function () { return plotHeight; }; | |
plot.offset = function () { | |
var o = eventHolder.offset(); | |
o.left += plotOffset.left; | |
o.top += plotOffset.top; | |
return o; | |
}; | |
plot.getData = function () { return series; }; | |
plot.getAxes = function () { | |
var res = {}, i; | |
$.each(xaxes.concat(yaxes), function (_, axis) { | |
if (axis) | |
res[axis.direction + (axis.n != 1 ? axis.n : "") + "axis"] = axis; | |
}); | |
return res; | |
}; | |
plot.getXAxes = function () { return xaxes; }; | |
plot.getYAxes = function () { return yaxes; }; | |
plot.c2p = canvasToAxisCoords; | |
plot.p2c = axisToCanvasCoords; | |
plot.getOptions = function () { return options; }; | |
plot.highlight = highlight; | |
plot.unhighlight = unhighlight; | |
plot.triggerRedrawOverlay = triggerRedrawOverlay; | |
plot.pointOffset = function(point) { | |
return { | |
left: parseInt(xaxes[axisNumber(point, "x") - 1].p2c(+point.x) + plotOffset.left), | |
top: parseInt(yaxes[axisNumber(point, "y") - 1].p2c(+point.y) + plotOffset.top) | |
}; | |
}; | |
plot.shutdown = shutdown; | |
plot.resize = function () { | |
getCanvasDimensions(); | |
resizeCanvas(canvas); | |
resizeCanvas(overlay); | |
}; | |
// public attributes | |
plot.hooks = hooks; | |
// initialize | |
initPlugins(plot); | |
parseOptions(options_); | |
setupCanvases(); | |
setData(data_); | |
setupGrid(); | |
draw(); | |
bindEvents(); | |
function executeHooks(hook, args) { | |
args = [plot].concat(args); | |
for (var i = 0; i < hook.length; ++i) | |
hook[i].apply(this, args); | |
} | |
function initPlugins() { | |
for (var i = 0; i < plugins.length; ++i) { | |
var p = plugins[i]; | |
p.init(plot); | |
if (p.options) | |
$.extend(true, options, p.options); | |
} | |
} | |
function parseOptions(opts) { | |
var i; | |
$.extend(true, options, opts); | |
if (options.xaxis.color == null) | |
options.xaxis.color = options.grid.color; | |
if (options.yaxis.color == null) | |
options.yaxis.color = options.grid.color; | |
if (options.xaxis.tickColor == null) // backwards-compatibility | |
options.xaxis.tickColor = options.grid.tickColor; | |
if (options.yaxis.tickColor == null) // backwards-compatibility | |
options.yaxis.tickColor = options.grid.tickColor; | |
if (options.grid.borderColor == null) | |
options.grid.borderColor = options.grid.color; | |
if (options.grid.tickColor == null) | |
options.grid.tickColor = $.color.parse(options.grid.color).scale('a', 0.22).toString(); | |
// fill in defaults in axes, copy at least always the | |
// first as the rest of the code assumes it'll be there | |
for (i = 0; i < Math.max(1, options.xaxes.length); ++i) | |
options.xaxes[i] = $.extend(true, {}, options.xaxis, options.xaxes[i]); | |
for (i = 0; i < Math.max(1, options.yaxes.length); ++i) | |
options.yaxes[i] = $.extend(true, {}, options.yaxis, options.yaxes[i]); | |
// backwards compatibility, to be removed in future | |
if (options.xaxis.noTicks && options.xaxis.ticks == null) | |
options.xaxis.ticks = options.xaxis.noTicks; | |
if (options.yaxis.noTicks && options.yaxis.ticks == null) | |
options.yaxis.ticks = options.yaxis.noTicks; | |
if (options.x2axis) { | |
options.xaxes[1] = $.extend(true, {}, options.xaxis, options.x2axis); | |
options.xaxes[1].position = "top"; | |
} | |
if (options.y2axis) { | |
options.yaxes[1] = $.extend(true, {}, options.yaxis, options.y2axis); | |
options.yaxes[1].position = "right"; | |
} | |
if (options.grid.coloredAreas) | |
options.grid.markings = options.grid.coloredAreas; | |
if (options.grid.coloredAreasColor) | |
options.grid.markingsColor = options.grid.coloredAreasColor; | |
if (options.lines) | |
$.extend(true, options.series.lines, options.lines); | |
if (options.points) | |
$.extend(true, options.series.points, options.points); | |
if (options.bars) | |
$.extend(true, options.series.bars, options.bars); | |
if (options.shadowSize != null) | |
options.series.shadowSize = options.shadowSize; | |
// save options on axes for future reference | |
for (i = 0; i < options.xaxes.length; ++i) | |
getOrCreateAxis(xaxes, i + 1).options = options.xaxes[i]; | |
for (i = 0; i < options.yaxes.length; ++i) | |
getOrCreateAxis(yaxes, i + 1).options = options.yaxes[i]; | |
// add hooks from options | |
for (var n in hooks) | |
if (options.hooks[n] && options.hooks[n].length) | |
hooks[n] = hooks[n].concat(options.hooks[n]); | |
executeHooks(hooks.processOptions, [options]); | |
} | |
function setData(d) { | |
series = parseData(d); | |
fillInSeriesOptions(); | |
processData(); | |
} | |
function parseData(d) { | |
var res = []; | |
for (var i = 0; i < d.length; ++i) { | |
var s = $.extend(true, {}, options.series); | |
if (d[i].data != null) { | |
s.data = d[i].data; // move the data instead of deep-copy | |
delete d[i].data; | |
$.extend(true, s, d[i]); | |
d[i].data = s.data; | |
} | |
else | |
s.data = d[i]; | |
res.push(s); | |
} | |
return res; | |
} | |
function axisNumber(obj, coord) { | |
var a = obj[coord + "axis"]; | |
if (typeof a == "object") // if we got a real axis, extract number | |
a = a.n; | |
if (typeof a != "number") | |
a = 1; // default to first axis | |
return a; | |
} | |
function allAxes() { | |
// return flat array without annoying null entries | |
return $.grep(xaxes.concat(yaxes), function (a) { return a; }); | |
} | |
function canvasToAxisCoords(pos) { | |
// return an object with x/y corresponding to all used axes | |
var res = {}, i, axis; | |
for (i = 0; i < xaxes.length; ++i) { | |
axis = xaxes[i]; | |
if (axis && axis.used) | |
res["x" + axis.n] = axis.c2p(pos.left); | |
} | |
for (i = 0; i < yaxes.length; ++i) { | |
axis = yaxes[i]; | |
if (axis && axis.used) | |
res["y" + axis.n] = axis.c2p(pos.top); | |
} | |
if (res.x1 !== undefined) | |
res.x = res.x1; | |
if (res.y1 !== undefined) | |
res.y = res.y1; | |
return res; | |
} | |
function axisToCanvasCoords(pos) { | |
// get canvas coords from the first pair of x/y found in pos | |
var res = {}, i, axis, key; | |
for (i = 0; i < xaxes.length; ++i) { | |
axis = xaxes[i]; | |
if (axis && axis.used) { | |
key = "x" + axis.n; | |
if (pos[key] == null && axis.n == 1) | |
key = "x"; | |
if (pos[key] != null) { | |
res.left = axis.p2c(pos[key]); | |
break; | |
} | |
} | |
} | |
for (i = 0; i < yaxes.length; ++i) { | |
axis = yaxes[i]; | |
if (axis && axis.used) { | |
key = "y" + axis.n; | |
if (pos[key] == null && axis.n == 1) | |
key = "y"; | |
if (pos[key] != null) { | |
res.top = axis.p2c(pos[key]); | |
break; | |
} | |
} | |
} | |
return res; | |
} | |
function getOrCreateAxis(axes, number) { | |
if (!axes[number - 1]) | |
axes[number - 1] = { | |
n: number, // save the number for future reference | |
direction: axes == xaxes ? "x" : "y", | |
options: $.extend(true, {}, axes == xaxes ? options.xaxis : options.yaxis) | |
}; | |
return axes[number - 1]; | |
} | |
function fillInSeriesOptions() { | |
var i; | |
// collect what we already got of colors | |
var neededColors = series.length, | |
usedColors = [], | |
assignedColors = []; | |
for (i = 0; i < series.length; ++i) { | |
var sc = series[i].color; | |
if (sc != null) { | |
--neededColors; | |
if (typeof sc == "number") | |
assignedColors.push(sc); | |
else | |
usedColors.push($.color.parse(series[i].color)); | |
} | |
} | |
// we might need to generate more colors if higher indices | |
// are assigned | |
for (i = 0; i < assignedColors.length; ++i) { | |
neededColors = Math.max(neededColors, assignedColors[i] + 1); | |
} | |
// produce colors as needed | |
var colors = [], variation = 0; | |
i = 0; | |
while (colors.length < neededColors) { | |
var c; | |
if (options.colors.length == i) // check degenerate case | |
c = $.color.make(100, 100, 100); | |
else | |
c = $.color.parse(options.colors[i]); | |
// vary color if needed | |
var sign = variation % 2 == 1 ? -1 : 1; | |
c.scale('rgb', 1 + sign * Math.ceil(variation / 2) * 0.2) | |
// FIXME: if we're getting to close to something else, | |
// we should probably skip this one | |
colors.push(c); | |
++i; | |
if (i >= options.colors.length) { | |
i = 0; | |
++variation; | |
} | |
} | |
// fill in the options | |
var colori = 0, s; | |
for (i = 0; i < series.length; ++i) { | |
s = series[i]; | |
// assign colors | |
if (s.color == null) { | |
s.color = colors[colori].toString(); | |
++colori; | |
} | |
else if (typeof s.color == "number") | |
s.color = colors[s.color].toString(); | |
// turn on lines automatically in case nothing is set | |
if (s.lines.show == null) { | |
var v, show = true; | |
for (v in s) | |
if (s[v] && s[v].show) { | |
show = false; | |
break; | |
} | |
if (show) | |
s.lines.show = true; | |
} | |
// setup axes | |
s.xaxis = getOrCreateAxis(xaxes, axisNumber(s, "x")); | |
s.yaxis = getOrCreateAxis(yaxes, axisNumber(s, "y")); | |
} | |
} | |
function processData() { | |
var topSentry = Number.POSITIVE_INFINITY, | |
bottomSentry = Number.NEGATIVE_INFINITY, | |
fakeInfinity = Number.MAX_VALUE, | |
i, j, k, m, length, | |
s, points, ps, x, y, axis, val, f, p; | |
function updateAxis(axis, min, max) { | |
if (min < axis.datamin && min != -fakeInfinity) | |
axis.datamin = min; | |
if (max > axis.datamax && max != fakeInfinity) | |
axis.datamax = max; | |
} | |
$.each(allAxes(), function (_, axis) { | |
// init axis | |
axis.datamin = topSentry; | |
axis.datamax = bottomSentry; | |
axis.used = false; | |
}); | |
for (i = 0; i < series.length; ++i) { | |
s = series[i]; | |
s.datapoints = { points: [] }; | |
executeHooks(hooks.processRawData, [ s, s.data, s.datapoints ]); | |
} | |
// first pass: clean and copy data | |
for (i = 0; i < series.length; ++i) { | |
s = series[i]; | |
var data = s.data, format = s.datapoints.format; | |
if (!format) { | |
format = []; | |
// find out how to copy | |
format.push({ x: true, number: true, required: true }); | |
format.push({ y: true, number: true, required: true }); | |
if (s.bars.show || (s.lines.show && s.lines.fill)) { | |
format.push({ y: true, number: true, required: false, defaultValue: 0 }); | |
if (s.bars.horizontal) { | |
delete format[format.length - 1].y; | |
format[format.length - 1].x = true; | |
} | |
} | |
s.datapoints.format = format; | |
} | |
if (s.datapoints.pointsize != null) | |
continue; // already filled in | |
s.datapoints.pointsize = format.length; | |
ps = s.datapoints.pointsize; | |
points = s.datapoints.points; | |
insertSteps = s.lines.show && s.lines.steps; | |
s.xaxis.used = s.yaxis.used = true; | |
for (j = k = 0; j < data.length; ++j, k += ps) { | |
p = data[j]; | |
var nullify = p == null; | |
if (!nullify) { | |
for (m = 0; m < ps; ++m) { | |
val = p[m]; | |
f = format[m]; | |
if (f) { | |
if (f.number && val != null) { | |
val = +val; // convert to number | |
if (isNaN(val)) | |
val = null; | |
else if (val == Infinity) | |
val = fakeInfinity; | |
else if (val == -Infinity) | |
val = -fakeInfinity; | |
} | |
if (val == null) { | |
if (f.required) | |
nullify = true; | |
if (f.defaultValue != null) | |
val = f.defaultValue; | |
} | |
} | |
points[k + m] = val; | |
} | |
} | |
if (nullify) { | |
for (m = 0; m < ps; ++m) { | |
val = points[k + m]; | |
if (val != null) { | |
f = format[m]; | |
// extract min/max info | |
if (f.x) | |
updateAxis(s.xaxis, val, val); | |
if (f.y) | |
updateAxis(s.yaxis, val, val); | |
} | |
points[k + m] = null; | |
} | |
} | |
else { | |
// a little bit of line specific stuff that | |
// perhaps shouldn't be here, but lacking | |
// better means... | |
if (insertSteps && k > 0 | |
&& points[k - ps] != null | |
&& points[k - ps] != points[k] | |
&& points[k - ps + 1] != points[k + 1]) { | |
// copy the point to make room for a middle point | |
for (m = 0; m < ps; ++m) | |
points[k + ps + m] = points[k + m]; | |
// middle point has same y | |
points[k + 1] = points[k - ps + 1]; | |
// we've added a point, better reflect that | |
k += ps; | |
} | |
} | |
} | |
} | |
// give the hooks a chance to run | |
for (i = 0; i < series.length; ++i) { | |
s = series[i]; | |
executeHooks(hooks.processDatapoints, [ s, s.datapoints]); | |
} | |
// second pass: find datamax/datamin for auto-scaling | |
for (i = 0; i < series.length; ++i) { | |
s = series[i]; | |
points = s.datapoints.points, | |
ps = s.datapoints.pointsize; | |
var xmin = topSentry, ymin = topSentry, | |
xmax = bottomSentry, ymax = bottomSentry; | |
for (j = 0; j < points.length; j += ps) { | |
if (points[j] == null) | |
continue; | |
for (m = 0; m < ps; ++m) { | |
val = points[j + m]; | |
f = format[m]; | |
if (!f || val == fakeInfinity || val == -fakeInfinity) | |
continue; | |
if (f.x) { | |
if (val < xmin) | |
xmin = val; | |
if (val > xmax) | |
xmax = val; | |
} | |
if (f.y) { | |
if (val < ymin) | |
ymin = val; | |
if (val > ymax) | |
ymax = val; | |
} | |
} | |
} | |
if (s.bars.show) { | |
// make sure we got room for the bar on the dancing floor | |
var delta = s.bars.align == "left" ? 0 : -s.bars.barWidth/2; | |
if (s.bars.horizontal) { | |
ymin += delta; | |
ymax += delta + s.bars.barWidth; | |
} | |
else { | |
xmin += delta; | |
xmax += delta + s.bars.barWidth; | |
} | |
} | |
updateAxis(s.xaxis, xmin, xmax); | |
updateAxis(s.yaxis, ymin, ymax); | |
} | |
$.each(allAxes(), function (_, axis) { | |
if (axis.datamin == topSentry) | |
axis.datamin = null; | |
if (axis.datamax == bottomSentry) | |
axis.datamax = null; | |
}); | |
} | |
function makeCanvas(skipPositioning, cls) { | |
var c = document.createElement('canvas'); | |
c.className = cls; | |
c.width = canvasWidth; | |
c.height = canvasHeight; | |
if (!skipPositioning) | |
$(c).css({ position: 'absolute', left: 0, top: 0 }); | |
$(c).appendTo(placeholder); | |
if (!c.getContext) // excanvas hack | |
c = window.G_vmlCanvasManager.initElement(c); | |
// used for resetting in case we get replotted | |
c.getContext("2d").save(); | |
return c; | |
} | |
function getCanvasDimensions() { | |
canvasWidth = placeholder.width(); | |
canvasHeight = placeholder.height(); | |
if (canvasWidth <= 0 || canvasHeight <= 0) | |
throw "Invalid dimensions for plot, width = " + canvasWidth + ", height = " + canvasHeight; | |
} | |
function resizeCanvas(c) { | |
// resizing should reset the state (excanvas seems to be | |
// buggy though) | |
if (c.width != canvasWidth) | |
c.width = canvasWidth; | |
if (c.height != canvasHeight) | |
c.height = canvasHeight; | |
// so try to get back to the initial state (even if it's | |
// gone now, this should be safe according to the spec) | |
var cctx = c.getContext("2d"); | |
cctx.restore(); | |
// and save again | |
cctx.save(); | |
} | |
function setupCanvases() { | |
var reused, | |
existingCanvas = placeholder.children("canvas.base"), | |
existingOverlay = placeholder.children("canvas.overlay"); | |
if (existingCanvas.length == 0 || existingOverlay == 0) { | |
// init everything | |
placeholder.html(""); // make sure placeholder is clear | |
placeholder.css({ padding: 0 }); // padding messes up the positioning | |
if (placeholder.css("position") == 'static') | |
placeholder.css("position", "relative"); // for positioning labels and overlay | |
getCanvasDimensions(); | |
canvas = makeCanvas(true, "base"); | |
overlay = makeCanvas(false, "overlay"); // overlay canvas for interactive features | |
reused = false; | |
} | |
else { | |
// reuse existing elements | |
canvas = existingCanvas.get(0); | |
overlay = existingOverlay.get(0); | |
reused = true; | |
} | |
ctx = canvas.getContext("2d"); | |
octx = overlay.getContext("2d"); | |
// we include the canvas in the event holder too, because IE 7 | |
// sometimes has trouble with the stacking order | |
eventHolder = $([overlay, canvas]); | |
if (reused) { | |
// run shutdown in the old plot object | |
placeholder.data("plot").shutdown(); | |
// reset reused canvases | |
plot.resize(); | |
// make sure overlay pixels are cleared (canvas is cleared when we redraw) | |
octx.clearRect(0, 0, canvasWidth, canvasHeight); | |
// then whack any remaining obvious garbage left | |
eventHolder.unbind(); | |
placeholder.children().not([canvas, overlay]).remove(); | |
} | |
// save in case we get replotted | |
placeholder.data("plot", plot); | |
} | |
function bindEvents() { | |
// bind events | |
if (options.grid.hoverable) { | |
eventHolder.mousemove(onMouseMove); | |
eventHolder.mouseleave(onMouseLeave); | |
} | |
if (options.grid.clickable) | |
eventHolder.click(onClick); | |
executeHooks(hooks.bindEvents, [eventHolder]); | |
} | |
function shutdown() { | |
if (redrawTimeout) | |
clearTimeout(redrawTimeout); | |
eventHolder.unbind("mousemove", onMouseMove); | |
eventHolder.unbind("mouseleave", onMouseLeave); | |
eventHolder.unbind("click", onClick); | |
executeHooks(hooks.shutdown, [eventHolder]); | |
} | |
function setTransformationHelpers(axis) { | |
// set helper functions on the axis, assumes plot area | |
// has been computed already | |
function identity(x) { return x; } | |
var s, m, t = axis.options.transform || identity, | |
it = axis.options.inverseTransform; | |
// precompute how much the axis is scaling a point | |
// in canvas space | |
if (axis.direction == "x") { | |
s = axis.scale = plotWidth / Math.abs(t(axis.max) - t(axis.min)); | |
m = Math.min(t(axis.max), t(axis.min)); | |
} | |
else { | |
s = axis.scale = plotHeight / Math.abs(t(axis.max) - t(axis.min)); | |
s = -s; | |
m = Math.max(t(axis.max), t(axis.min)); | |
} | |
// data point to canvas coordinate | |
if (t == identity) // slight optimization | |
axis.p2c = function (p) { return (p - m) * s; }; | |
else | |
axis.p2c = function (p) { return (t(p) - m) * s; }; | |
// canvas coordinate to data point | |
if (!it) | |
axis.c2p = function (c) { return m + c / s; }; | |
else | |
axis.c2p = function (c) { return it(m + c / s); }; | |
} | |
function measureTickLabels(axis) { | |
var opts = axis.options, i, ticks = axis.ticks || [], labels = [], | |
l, w = opts.labelWidth, h = opts.labelHeight, dummyDiv; | |
function makeDummyDiv(labels, width) { | |
return $('<div style="position:absolute;top:-10000px;' + width + 'font-size:smaller">' + | |
'<div class="' + axis.direction + 'Axis ' + axis.direction + axis.n + 'Axis">' | |
+ labels.join("") + '</div></div>') | |
.appendTo(placeholder); | |
} | |
if (axis.direction == "x") { | |
// to avoid measuring the widths of the labels (it's slow), we | |
// construct fixed-size boxes and put the labels inside | |
// them, we don't need the exact figures and the | |
// fixed-size box content is easy to center | |
if (w == null) | |
w = Math.floor(canvasWidth / (ticks.length > 0 ? ticks.length : 1)); | |
// measure x label heights | |
if (h == null) { | |
labels = []; | |
for (i = 0; i < ticks.length; ++i) { | |
l = ticks[i].label; | |
if (l) | |
labels.push('<div class="tickLabel" style="float:left;width:' + w + 'px">' + l + '</div>'); | |
} | |
if (labels.length > 0) { | |
// stick them all in the same div and measure | |
// collective height | |
labels.push('<div style="clear:left"></div>'); | |
dummyDiv = makeDummyDiv(labels, "width:10000px;"); | |
h = dummyDiv.height(); | |
dummyDiv.remove(); | |
} | |
} | |
} | |
else if (w == null || h == null) { | |
// calculate y label dimensions | |
for (i = 0; i < ticks.length; ++i) { | |
l = ticks[i].label; | |
if (l) | |
labels.push('<div class="tickLabel">' + l + '</div>'); | |
} | |
if (labels.length > 0) { | |
dummyDiv = makeDummyDiv(labels, ""); | |
if (w == null) | |
w = dummyDiv.children().width(); | |
if (h == null) | |
h = dummyDiv.find("div.tickLabel").height(); | |
dummyDiv.remove(); | |
} | |
} | |
if (w == null) | |
w = 0; | |
if (h == null) | |
h = 0; | |
axis.labelWidth = w; | |
axis.labelHeight = h; | |
} | |
function allocateAxisBoxFirstPhase(axis) { | |
// find the bounding box of the axis by looking at label | |
// widths/heights and ticks, make room by diminishing the | |
// plotOffset | |
var lw = axis.labelWidth, | |
lh = axis.labelHeight, | |
pos = axis.options.position, | |
tickLength = axis.options.tickLength, | |
axismargin = options.grid.axisMargin, | |
padding = options.grid.labelMargin, | |
all = axis.direction == "x" ? xaxes : yaxes, | |
index; | |
// determine axis margin | |
var samePosition = $.grep(all, function (a) { | |
return a && a.options.position == pos && a.reserveSpace; | |
}); | |
if ($.inArray(axis, samePosition) == samePosition.length - 1) | |
axismargin = 0; // outermost | |
// determine tick length - if we're innermost, we can use "full" | |
if (tickLength == null) | |
tickLength = "full"; | |
var sameDirection = $.grep(all, function (a) { | |
return a && a.reserveSpace; | |
}); | |
var innermost = $.inArray(axis, sameDirection) == 0; | |
if (!innermost && tickLength == "full") | |
tickLength = 5; | |
if (!isNaN(+tickLength)) | |
padding += +tickLength; | |
// compute box | |
if (axis.direction == "x") { | |
lh += padding; | |
if (pos == "bottom") { | |
plotOffset.bottom += lh + axismargin; | |
axis.box = { top: canvasHeight - plotOffset.bottom, height: lh }; | |
} | |
else { | |
axis.box = { top: plotOffset.top + axismargin, height: lh }; | |
plotOffset.top += lh + axismargin; | |
} | |
} | |
else { | |
lw += padding; | |
if (pos == "left") { | |
axis.box = { left: plotOffset.left + axismargin, width: lw }; | |
plotOffset.left += lw + axismargin; | |
} | |
else { | |
plotOffset.right += lw + axismargin; | |
axis.box = { left: canvasWidth - plotOffset.right, width: lw }; | |
} | |
} | |
// save for future reference | |
axis.position = pos; | |
axis.tickLength = tickLength; | |
axis.box.padding = padding; | |
axis.innermost = innermost; | |
} | |
function allocateAxisBoxSecondPhase(axis) { | |
// set remaining bounding box coordinates | |
if (axis.direction == "x") { | |
axis.box.left = plotOffset.left; | |
axis.box.width = plotWidth; | |
} | |
else { | |
axis.box.top = plotOffset.top; | |
axis.box.height = plotHeight; | |
} | |
} | |
function setupGrid() { | |
var i, axes = allAxes(); | |
// first calculate the plot and axis box dimensions | |
$.each(axes, function (_, axis) { | |
axis.show = axis.options.show; | |
if (axis.show == null) | |
axis.show = axis.used; // by default an axis is visible if it's got data | |
axis.reserveSpace = axis.show || axis.options.reserveSpace; | |
setRange(axis); | |
}); | |
allocatedAxes = $.grep(axes, function (axis) { return axis.reserveSpace; }); | |
plotOffset.left = plotOffset.right = plotOffset.top = plotOffset.bottom = 0; | |
if (options.grid.show) { | |
$.each(allocatedAxes, function (_, axis) { | |
// make the ticks | |
setupTickGeneration(axis); | |
setTicks(axis); | |
snapRangeToTicks(axis, axis.ticks); | |
// find labelWidth/Height for axis | |
measureTickLabels(axis); | |
}); | |
// with all dimensions in house, we can compute the | |
// axis boxes, start from the outside (reverse order) | |
for (i = allocatedAxes.length - 1; i >= 0; --i) | |
allocateAxisBoxFirstPhase(allocatedAxes[i]); | |
// make sure we've got enough space for things that | |
// might stick out | |
var minMargin = options.grid.minBorderMargin; | |
if (minMargin == null) { | |
minMargin = 0; | |
for (i = 0; i < series.length; ++i) | |
minMargin = Math.max(minMargin, series[i].points.radius + series[i].points.lineWidth/2); | |
} | |
for (var a in plotOffset) { | |
plotOffset[a] += options.grid.borderWidth; | |
plotOffset[a] = Math.max(minMargin, plotOffset[a]); | |
} | |
} | |
plotWidth = canvasWidth - plotOffset.left - plotOffset.right; | |
plotHeight = canvasHeight - plotOffset.bottom - plotOffset.top; | |
// now we got the proper plotWidth/Height, we can compute the scaling | |
$.each(axes, function (_, axis) { | |
setTransformationHelpers(axis); | |
}); | |
if (options.grid.show) { | |
$.each(allocatedAxes, function (_, axis) { | |
allocateAxisBoxSecondPhase(axis); | |
}); | |
insertAxisLabels(); | |
} | |
insertLegend(); | |
} | |
function setRange(axis) { | |
var opts = axis.options, | |
min = +(opts.min != null ? opts.min : axis.datamin), | |
max = +(opts.max != null ? opts.max : axis.datamax), | |
delta = max - min; | |
if (delta == 0.0) { | |
// degenerate case | |
var widen = max == 0 ? 1 : 0.01; | |
if (opts.min == null) | |
min -= widen; | |
// always widen max if we couldn't widen min to ensure we | |
// don't fall into min == max which doesn't work | |
if (opts.max == null || opts.min != null) | |
max += widen; | |
} | |
else { | |
// consider autoscaling | |
var margin = opts.autoscaleMargin; | |
if (margin != null) { | |
if (opts.min == null) { | |
min -= delta * margin; | |
// make sure we don't go below zero if all values | |
// are positive | |
if (min < 0 && axis.datamin != null && axis.datamin >= 0) | |
min = 0; | |
} | |
if (opts.max == null) { | |
max += delta * margin; | |
if (max > 0 && axis.datamax != null && axis.datamax <= 0) | |
max = 0; | |
} | |
} | |
} | |
axis.min = min; | |
axis.max = max; | |
} | |
function setupTickGeneration(axis) { | |
var opts = axis.options; | |
// estimate number of ticks | |
var noTicks; | |
if (typeof opts.ticks == "number" && opts.ticks > 0) | |
noTicks = opts.ticks; | |
else | |
// heuristic based on the model a*sqrt(x) fitted to | |
// some data points that seemed reasonable | |
noTicks = 0.3 * Math.sqrt(axis.direction == "x" ? canvasWidth : canvasHeight); | |
var delta = (axis.max - axis.min) / noTicks, | |
size, generator, unit, formatter, i, magn, norm; | |
if (opts.mode == "time") { | |
// pretty handling of time | |
// map of app. size of time units in milliseconds | |
var timeUnitSize = { | |
"second": 1000, | |
"minute": 60 * 1000, | |
"hour": 60 * 60 * 1000, | |
"day": 24 * 60 * 60 * 1000, | |
"month": 30 * 24 * 60 * 60 * 1000, | |
"year": 365.2425 * 24 * 60 * 60 * 1000 | |
}; | |
// the allowed tick sizes, after 1 year we use | |
// an integer algorithm | |
var spec = [ | |
[1, "second"], [2, "second"], [5, "second"], [10, "second"], | |
[30, "second"], | |
[1, "minute"], [2, "minute"], [5, "minute"], [10, "minute"], | |
[30, "minute"], | |
[1, "hour"], [2, "hour"], [4, "hour"], | |
[8, "hour"], [12, "hour"], | |
[1, "day"], [2, "day"], [3, "day"], | |
[0.25, "month"], [0.5, "month"], [1, "month"], | |
[2, "month"], [3, "month"], [6, "month"], | |
[1, "year"] | |
]; | |
var minSize = 0; | |
if (opts.minTickSize != null) { | |
if (typeof opts.tickSize == "number") | |
minSize = opts.tickSize; | |
else | |
minSize = opts.minTickSize[0] * timeUnitSize[opts.minTickSize[1]]; | |
} | |
for (var i = 0; i < spec.length - 1; ++i) | |
if (delta < (spec[i][0] * timeUnitSize[spec[i][1]] | |
+ spec[i + 1][0] * timeUnitSize[spec[i + 1][1]]) / 2 | |
&& spec[i][0] * timeUnitSize[spec[i][1]] >= minSize) | |
break; | |
size = spec[i][0]; | |
unit = spec[i][1]; | |
// special-case the possibility of several years | |
if (unit == "year") { | |
magn = Math.pow(10, Math.floor(Math.log(delta / timeUnitSize.year) / Math.LN10)); | |
norm = (delta / timeUnitSize.year) / magn; | |
if (norm < 1.5) | |
size = 1; | |
else if (norm < 3) | |
size = 2; | |
else if (norm < 7.5) | |
size = 5; | |
else | |
size = 10; | |
size *= magn; | |
} | |
axis.tickSize = opts.tickSize || [size, unit]; | |
generator = function(axis) { | |
var ticks = [], | |
tickSize = axis.tickSize[0], unit = axis.tickSize[1], | |
d = new Date(axis.min); | |
var step = tickSize * timeUnitSize[unit]; | |
if (unit == "second") | |
d.setUTCSeconds(floorInBase(d.getUTCSeconds(), tickSize)); | |
if (unit == "minute") | |
d.setUTCMinutes(floorInBase(d.getUTCMinutes(), tickSize)); | |
if (unit == "hour") | |
d.setUTCHours(floorInBase(d.getUTCHours(), tickSize)); | |
if (unit == "month") | |
d.setUTCMonth(floorInBase(d.getUTCMonth(), tickSize)); | |
if (unit == "year") | |
d.setUTCFullYear(floorInBase(d.getUTCFullYear(), tickSize)); | |
// reset smaller components | |
d.setUTCMilliseconds(0); | |
if (step >= timeUnitSize.minute) | |
d.setUTCSeconds(0); | |
if (step >= timeUnitSize.hour) | |
d.setUTCMinutes(0); | |
if (step >= timeUnitSize.day) | |
d.setUTCHours(0); | |
if (step >= timeUnitSize.day * 4) | |
d.setUTCDate(1); | |
if (step >= timeUnitSize.year) | |
d.setUTCMonth(0); | |
var carry = 0, v = Number.NaN, prev; | |
do { | |
prev = v; | |
v = d.getTime(); | |
ticks.push(v); | |
if (unit == "month") { | |
if (tickSize < 1) { | |
// a bit complicated - we'll divide the month | |
// up but we need to take care of fractions | |
// so we don't end up in the middle of a day | |
d.setUTCDate(1); | |
var start = d.getTime(); | |
d.setUTCMonth(d.getUTCMonth() + 1); | |
var end = d.getTime(); | |
d.setTime(v + carry * timeUnitSize.hour + (end - start) * tickSize); | |
carry = d.getUTCHours(); | |
d.setUTCHours(0); | |
} | |
else | |
d.setUTCMonth(d.getUTCMonth() + tickSize); | |
} | |
else if (unit == "year") { | |
d.setUTCFullYear(d.getUTCFullYear() + tickSize); | |
} | |
else | |
d.setTime(v + step); | |
} while (v < axis.max && v != prev); | |
return ticks; | |
}; | |
formatter = function (v, axis) { | |
var d = new Date(v); | |
// first check global format | |
if (opts.timeformat != null) | |
return $.plot.formatDate(d, opts.timeformat, opts.monthNames); | |
var t = axis.tickSize[0] * timeUnitSize[axis.tickSize[1]]; | |
var span = axis.max - axis.min; | |
var suffix = (opts.twelveHourClock) ? " %p" : ""; | |
if (t < timeUnitSize.minute) | |
fmt = "%h:%M:%S" + suffix; | |
else if (t < timeUnitSize.day) { | |
if (span < 2 * timeUnitSize.day) | |
fmt = "%h:%M" + suffix; | |
else | |
fmt = "%b %d %h:%M" + suffix; | |
} | |
else if (t < timeUnitSize.month) | |
fmt = "%b %d"; | |
else if (t < timeUnitSize.year) { | |
if (span < timeUnitSize.year) | |
fmt = "%b"; | |
else | |
fmt = "%b %y"; | |
} | |
else | |
fmt = "%y"; | |
return $.plot.formatDate(d, fmt, opts.monthNames); | |
}; | |
} | |
else { | |
// pretty rounding of base-10 numbers | |
var maxDec = opts.tickDecimals; | |
var dec = -Math.floor(Math.log(delta) / Math.LN10); | |
if (maxDec != null && dec > maxDec) | |
dec = maxDec; | |
magn = Math.pow(10, -dec); | |
norm = delta / magn; // norm is between 1.0 and 10.0 | |
if (norm < 1.5) | |
size = 1; | |
else if (norm < 3) { | |
size = 2; | |
// special case for 2.5, requires an extra decimal | |
if (norm > 2.25 && (maxDec == null || dec + 1 <= maxDec)) { | |
size = 2.5; | |
++dec; | |
} | |
} | |
else if (norm < 7.5) | |
size = 5; | |
else | |
size = 10; | |
size *= magn; | |
if (opts.minTickSize != null && size < opts.minTickSize) | |
size = opts.minTickSize; | |
axis.tickDecimals = Math.max(0, maxDec != null ? maxDec : dec); | |
axis.tickSize = opts.tickSize || size; | |
generator = function (axis) { | |
var ticks = []; | |
// spew out all possible ticks | |
var start = floorInBase(axis.min, axis.tickSize), | |
i = 0, v = Number.NaN, prev; | |
do { | |
prev = v; | |
v = start + i * axis.tickSize; | |
ticks.push(v); | |
++i; | |
} while (v < axis.max && v != prev); | |
return ticks; | |
}; | |
formatter = function (v, axis) { | |
return v.toFixed(axis.tickDecimals); | |
}; | |
} | |
if (opts.alignTicksWithAxis != null) { | |
var otherAxis = (axis.direction == "x" ? xaxes : yaxes)[opts.alignTicksWithAxis - 1]; | |
if (otherAxis && otherAxis.used && otherAxis != axis) { | |
// consider snapping min/max to outermost nice ticks | |
var niceTicks = generator(axis); | |
if (niceTicks.length > 0) { | |
if (opts.min == null) | |
axis.min = Math.min(axis.min, niceTicks[0]); | |
if (opts.max == null && niceTicks.length > 1) | |
axis.max = Math.max(axis.max, niceTicks[niceTicks.length - 1]); | |
} | |
generator = function (axis) { | |
// copy ticks, scaled to this axis | |
var ticks = [], v, i; | |
for (i = 0; i < otherAxis.ticks.length; ++i) { | |
v = (otherAxis.ticks[i].v - otherAxis.min) / (otherAxis.max - otherAxis.min); | |
v = axis.min + v * (axis.max - axis.min); | |
ticks.push(v); | |
} | |
return ticks; | |
}; | |
// we might need an extra decimal since forced | |
// ticks don't necessarily fit naturally | |
if (axis.mode != "time" && opts.tickDecimals == null) { | |
var extraDec = Math.max(0, -Math.floor(Math.log(delta) / Math.LN10) + 1), | |