From: maxious Date: Fri, 22 Jul 2011 06:11:55 +0000 Subject: Fix css images and use some async js loading X-Git-Url: http://maxious.lambdacomplex.org/git/?p=busui.git&a=commitdiff&h=cc98b39a586f8facb21baeac0299a674fbe11f96 --- Fix css images and use some async js loading --- --- a/about.php +++ b/about.php @@ -17,6 +17,10 @@ Feedback encouraged; contact maxious@lambdacomplex.org

Some icons by Joseph Wain / glyphish.com
+Native clients also available for iPhone(cbrTimetable by Sandor Kolotenko +, ACT Buses by David Sullivan) +and Android (MyBus 2.0 by Imagine Team) +

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, --- a/css/local.css.php +++ b/css/local.css.php @@ -25,11 +25,11 @@ margin: 0 !important; } .ui-icon-navigation { - background-image: url('.$_REQUEST['labsPath'].'css/images/113-navigation.png); + background-image: url(images/113-navigation.png); background-position: 1px 0; } .ui-icon-beaker { - background-image: url('.$_REQUEST['labsPath'].'css/images/91-beaker-2.png); + background-image: url(images/91-beaker-2.png); background-position: 1px 0; } #footer { --- a/include/common-template.inc.php +++ b/include/common-template.inc.php @@ -23,10 +23,9 @@ $url.= "&guid=ON"; return str_replace("&", "&", $url); } - function include_header($pageTitle, $pageType, $opendiv = true, $geolocate = false, $datepicker = false) { -global $labsPath; + global $labsPath; echo ' @@ -34,34 +33,36 @@ ' . $pageTitle . ' - - '; + + + '; if (isDebugServer()) { - echo ' - - - + - '; - } - else { - echo ' - - - '; - } - echo ' - - - - - + + + - '; +}); + '; echo ''; - -echo ''; - - + echo ''; + echo ''; if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPod') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPad')) { echo ' @@ -149,28 +146,26 @@
Back

' . $pageTitle . '

- Home + Home
'; $overrides = getServiceOverride(); if ($overrides['service_id']) { - if ($overrides['service_id'] == "noservice") { - echo '
Buses are not running today due to industrial action/public holiday. See Buses are not running today due to industrial action/public holiday. See http://www.action.act.gov.au for details.
'; - } - else { - echo '
Buses are running on an altered timetable today due to industrial action/public holiday. See http://www.action.act.gov.au for details.
'; - } + } + else { + echo '
Buses are running on an altered timetable today due to industrial action/public holiday. See http://www.action.act.gov.au for details.
'; } } - + } } function include_footer() { - -global $labsPath; - echo '
"; + } + echo "\n"; } function timePlaceSettings($geolocate = false) { --- /dev/null +++ b/js/LAB.min.js @@ -1,1 +1,5 @@ - +/*! 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;b0){for(var a=0;a=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); --- a/labs/index.php +++ b/labs/index.php @@ -18,11 +18,11 @@

Displays the deviation from the timetable over the day

  • Frequency Distribution of Time Deviation

    Displays spread of time deviations

  • - + $timeDiff, - "stop_code" => $potentialStop['stop_code'] + "stop_code" => $potentialStop['stop_code'], + "stop_sequence" => $timedTrip['stop_sequence'] ); echo "Found trip {$trip['trip_id']} at stop {$potentialStop['stop_code']} (#{$potentialStop['stop_id']}, sequence #{$trip['stop_sequence']})
    "; echo "Arriving at {$timedTrip['arrival_time']}, difference of " . round($timeDiff / 60, 2) . " minutes
    "; @@ -110,18 +111,18 @@ echo "Lowest difference of " . round($lowestDelta / 60, 2) . " minutes will be recorded for this observation
    "; $observation_id = $obsv['observation_id']; $route_full_name = $obsv['route_full_name']; - $myway_route = $obsv['myway_stop']; $stop_code = $timeDeltas[0]["stop_code"]; - $stmt = $conn->prepare("insert into myway_timingdeltas (observation_id, route_full_name, myway_route, stop_code, timing_delta, time, date, timing_period) - values (:observation_id, :route_full_name, :myway_route, :stop_code, :timing_delta, :time, :date, :timing_period)"); + $stop_sequence = $timeDeltas[0]["stop_sequence"]; + $stmt = $conn->prepare("insert into myway_timingdeltas (observation_id, route_full_name, stop_code, timing_delta, time, date, timing_period, stop_sequence) + values (:observation_id, :route_full_name, :stop_code, :timing_delta, :time, :date, :timing_period, :stop_sequence)"); $stmt->bindParam(':observation_id', $observation_id); $stmt->bindParam(':route_full_name', $route_full_name); - $stmt->bindParam(':myway_route', $myway_route); $stmt->bindParam(':stop_code', $stop_code); $stmt->bindParam(':timing_delta', $lowestDelta); $stmt->bindParam(':time', $time); $stmt->bindParam(':date', $date); $stmt->bindParam(':timing_period', $timing_period); + $stmt->bindParam(':stop_sequence', $stop_sequence); // insert a record $stmt->execute(); if ($stmt->rowCount() > 0) { --- /dev/null +++ b/labs/myway_timeliness_route.json.php @@ -1,1 +1,25 @@ - + +{ + "label": "", + "data": prepare($query); +$query->bindParam(':route_full_name', $_REQUEST['routeid'],PDO::PARAM_STR, 42); + +$query->execute(); +if (!$query) { + databaseError($conn->errorInfo()); + return Array(); +} +foreach ($query->fetchAll() as $delta) { + $points[] = "[{$delta['stop_sequence']}, {$delta['timing_delta']}]"; +}; +echo "[".implode(",",$points)."]"; +?> +} --- /dev/null +++ b/labs/myway_timeliness_route.php @@ -1,1 +1,120 @@ + + + + +
    + +
    + --- /dev/null +++ b/labs/myway_timeliness_stop.json.php @@ -1,1 +1,31 @@ - + +{ + "label": "", + "data": prepare($query); +$query->bindParam(':myway_stop', $_REQUEST['stopid'],PDO::PARAM_STR, 42); + +$query->execute(); +if (!$query) { + databaseError($conn->errorInfo()); + return Array(); +} +foreach ($query->fetchAll() as $delta) { + $points[] = "[".((strtotime("00:00Z") + midnight_seconds(strtotime($delta['time'])))*1000).", {$delta['timing_delta']}]"; +}; +if (count($points) == 0) { + echo "[]"; } + else echo "[".implode(",",$points)."]"; +?> +} --- /dev/null +++ b/labs/myway_timeliness_stop.php @@ -1,1 +1,131 @@ + + + + + +
    + --- a/servicealerts_api.php +++ b/servicealerts_api.php @@ -36,7 +36,7 @@ $return['entities'][] = $entity; } } -//header('Content-Type: text/javascript; charset=utf8'); +header('Content-Type: text/javascript; charset=utf8'); // header('Access-Control-Allow-Origin: http://bus.lambdacomplex.org/'); header('Access-Control-Max-Age: 3628800'); header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE'); --- a/sitemap.xml.php +++ b/sitemap.xml.php @@ -3,10 +3,13 @@ $last_updated = date('Y-m-d',@filemtime('cbrfeed.zip')); header("Content-Type: text/xml"); echo ""; - echo '' . "\n"; + echo '' . "\n"; echo " ".curPageURL()."index.php1.0\n"; foreach (scandir("./") as $file) { if (strpos($file,".php") !== false && $file != "index.php" && $file != "sitemap.xml.php") echo " ".curPageURL()."$file0.3\n"; +} +foreach (scandir("./labs") as $file) { + if (strpos($file,".php") !== false) echo " ".curPageURL()."/labs/$file0.3\n"; } foreach (getStops() as $stop) { echo " ".curPageURL()."stop.php?stopid=".htmlspecialchars ($stop["stop_id"]).""; --- a/updatedb.php +++ b/updatedb.php @@ -1,4 +1,5 @@