From: maxious Date: Wed, 16 Mar 2011 07:24:01 +0000 Subject: More lax geolocation X-Git-Url: http://maxious.lambdacomplex.org/git/?p=busui.git&a=commitdiff&h=c6a81e7cb2be952cfca5805d5af6f8ce0bf70b6c --- More lax geolocation --- --- a/common-template.inc.php +++ b/common-template.inc.php @@ -6,14 +6,15 @@ ' . $pageTitle . ''; - echo ''; if (isDebugServer()) echo ' '; - else echo ' - - '; - echo ' + '; + echo ' + + "; @@ -147,4 +153,3 @@ '; } ?> - --- a/common.inc.php +++ b/common.inc.php @@ -150,5 +150,33 @@ { return str_replace(")", "", str_replace("(", "
", $input)); } + +function sksort(&$array, $subkey="id", $sort_ascending=false) { + + if (count($array)) + $temp_array[key($array)] = array_shift($array); + + foreach($array as $key => $val){ + $offset = 0; + $found = false; + foreach($temp_array as $tmp_key => $tmp_val) + { + if(!$found and strtolower($val[$subkey]) > strtolower($tmp_val[$subkey])) + { + $temp_array = array_merge( (array)array_slice($temp_array,0,$offset), + array($key => $val), + array_slice($temp_array,$offset) + ); + $found = true; + } + $offset++; + } + if(!$found) $temp_array = array_merge($temp_array, array($key => $val)); + } + + if ($sort_ascending) $array = array_reverse($temp_array); + + else $array = $temp_array; +} ?> --- a/css/jquery.ui.datepicker.mobile.css +++ b/css/jquery.ui.datepicker.mobile.css @@ -1,18 +1,30 @@ -div.hasDatepicker{display:block;padding:0;overflow:visible;margin:8px 0;} -.ui-datepicker{overflow:visible;margin:0;max-width:500px;} -.ui-datepicker .ui-datepicker-header{position:relative;padding:.4em 0;border-bottom:0;font-weight:bold;} -.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next{padding:1px 0 1px 2px;position:absolute;top:.5em;margin-top:0;text-indent:-9999px;} -.ui-datepicker .ui-datepicker-prev{left:6px;} -.ui-datepicker .ui-datepicker-next{right:6px;} -.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center;} -.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0;} -.ui-datepicker select.ui-datepicker-month-year{width:100%;} -.ui-datepicker select.ui-datepicker-month, .ui-datepicker select.ui-datepicker-year{width:49%;} -.ui-datepicker table{width:100%;border-collapse:collapse;margin:0;} -.ui-datepicker td{border-width:1px;padding:0;text-align:center;} -.ui-datepicker td span, .ui-datepicker td a{display:block;padding:.2em 0;font-weight:bold;margin:0;border-width:0;text-align:center;text-decoration:none;} -.ui-datepicker-calendar th{padding-top:.3em;padding-bottom:.3em;} -.ui-datepicker-calendar th span, .ui-datepicker-calendar span.ui-state-default{opacity:.3;} -.ui-datepicker-calendar td a{padding-top:.5em;padding-bottom:.5em;} -.min-width-480px div.hasDatepicker{width:63%;display:inline-block;margin:0;} +/* + * jQuery UI Datepicker @VERSION + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Datepicker#theming + */ +div.hasDatepicker{ display: block; padding: 0; overflow: visible; margin: 8px 0; } +.ui-datepicker { overflow: visible; margin: 0; max-width: 500px; } +.ui-datepicker .ui-datepicker-header { position:relative; padding:.4em 0; border-bottom: 0; font-weight: bold; } +.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { padding: 1px 0 1px 2px; position:absolute; top: .5em; margin-top: 0; text-indent: -9999px; } +.ui-datepicker .ui-datepicker-prev { left:6px; } +.ui-datepicker .ui-datepicker-next { right:6px; } +.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } +.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; } +.ui-datepicker select.ui-datepicker-month-year {width: 100%;} +.ui-datepicker select.ui-datepicker-month, +.ui-datepicker select.ui-datepicker-year { width: 49%;} +.ui-datepicker table {width: 100%; border-collapse: collapse; margin:0; } +.ui-datepicker td { border-width: 1px; padding: 0; text-align: center; } +.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em 0; font-weight: bold; margin: 0; border-width: 0; text-align: center; text-decoration: none; } + +.ui-datepicker-calendar th { padding-top: .3em; padding-bottom: .3em; } +.ui-datepicker-calendar th span, .ui-datepicker-calendar span.ui-state-default { opacity: .3; } +.ui-datepicker-calendar td a { padding-top: .5em; padding-bottom: .5em; } + +.min-width-480px div.hasDatepicker { width: 63%; display: inline-block; margin: 0; } --- a/index.php +++ b/index.php @@ -19,6 +19,7 @@
  • Timetables - Routes
  • Routes By Final Destination
  • Routes By Number
  • +
  • Stops By Suburb
  • Nearby Routes
  • " ).datepicker({ altField: "#" + $(this).attr( "id" ), showOtherMonths: true }) ); - $(this).addClass("hasDatepicker"); - } - }); - }); -})( jQuery ); - +; --- /dev/null +++ b/js/jquery.ui.datepicker.mobile.js @@ -1,1 +1,59 @@ +/* +* jQuery Mobile Framework : temporary extension to port jQuery UI's datepicker for mobile +* Copyright (c) jQuery Project +* Dual licensed under the MIT or GPL Version 2 licenses. +* http://jquery.org/license +*/ +(function($, undefined ) { + //cache previous datepicker ui method + var prevDp = $.fn.datepicker; + + //rewrite datepicker + $.fn.datepicker = function( options ){ + + var dp = this; + + //call cached datepicker plugin + prevDp.call( this, options ); + + //extend with some dom manipulation to update the markup for jQM + //call immediately + function updateDatepicker(){ + $( ".ui-datepicker-header", dp ).addClass("ui-body-c ui-corner-top").removeClass("ui-corner-all"); + $( ".ui-datepicker-prev, .ui-datepicker-next", dp ).attr("href", "#"); + $( ".ui-datepicker-prev", dp ).buttonMarkup({iconpos: "notext", icon: "arrow-l", shadow: true, corners: true}); + $( ".ui-datepicker-next", dp ).buttonMarkup({iconpos: "notext", icon: "arrow-r", shadow: true, corners: true}); + $( ".ui-datepicker-calendar th", dp ).addClass("ui-bar-c"); + $( ".ui-datepicker-calendar td", dp ).addClass("ui-body-c"); + $( ".ui-datepicker-calendar a", dp ).buttonMarkup({corners: false, shadow: false}); + $( ".ui-datepicker-calendar a.ui-state-active", dp ).addClass("ui-btn-active"); // selected date + $( ".ui-datepicker-calendar a.ui-state-highlight", dp ).addClass("ui-btn-up-e"); // today"s date + $( ".ui-datepicker-calendar .ui-btn", dp ).each(function(){ + var el = $(this); + // remove extra button markup - necessary for date value to be interpreted correctly + el.html( el.find( ".ui-btn-text" ).text() ); + }); + }; + + //update now + updateDatepicker(); + + // and on click + $( dp ).click( updateDatepicker ); + + //return jqm obj + return this; + }; + + //bind to pagecreate to automatically enhance date inputs + $( ".ui-page" ).live( "pagecreate", function(){ + $( "#date, input[type='date'], input[data-type='date']" ).each(function(){ + if ($(this).hasClass("hasDatepicker") == false) { + $(this).after( $( "
    " ).datepicker({ altField: "#" + $(this).attr( "id" ), showOtherMonths: true }) ); + $(this).addClass("hasDatepicker"); + } + }); + }); +})( jQuery ); + --- a/routeList.php +++ b/routeList.php @@ -1,7 +1,8 @@
    '; -echo '