topical media & game development

talk show tell print

mobile-application-11-DerbyApp.iPhone-www-index.htm / htm



  <!DOCTYPE HTML>
  <html>
      <head>
          <title>PhoneGap</title>
                          <link rel=StyleSheet href="main.css" type="text/css" media=screen>
              <script type="text/javascript" charset="utf-8" src="phonegap-1.3.0.js"></script>
              <script type="text/javascript" src="js\jquery.min.js"></script>
              <script type="text/javascript" src="js\helper.js"></script>
              <script type="text/javascript" src="js\xui-2.0.0.min.js"></script>
              <script type="text/javascript" src="js\Odata.js"></script>
              <script type="text/javascript" src="js\DerbyService.js"></script>
                          <script type="application/javascript" src="js\iscroll.js"></script>
                          <meta name="viewport" content="width=device-width" />      
      </head>
      <body onload="onLoad()">
          
          <div id="main" ontouchmove="touchMove(event);">
                           <div class="header">
                          <a id="btnLeague" href='index.html' class="btnTwoLeft">Leagues</a>
                          <a id="btnIndividuals" href='individualList.html' class="btnTwoRightSelected" >Players</a>
                          </div>
                          
              <div class="Leaguesguide" >
                                  <div>
                      <!--<form onsubmit="getData(event, this.Form);"> -->
                          <input id="txtSearch" type="search" placeholder="Search" class="searchbar"><button id="btnSubmit" type="button" class="gobtn" label="Go" >GO</button>
                      <!--</form> -->
                  </div>
                  <div id="wrapper">
                          <div id="scroller">
                              <ul>
                                                  </ul>
                          </div>
                                  </div>
              </div>
          </div>    
          </body>
                      
          <script type="text/javascript" charset="utf-8">
                  var scrollView;        
                  var skipCount = 50;
      
                  function onLoad() {
                            document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
                  document.addEventListener("deviceready", onDeviceReady, false);
              }
          
              function onDeviceReady() {
                          setHeight();
                          searchAll(
                                  function(){
                                          setTimeout(function () {
                                                  scrollView = new iScroll('wrapper', {desktopCompatibility:true});
                                          }, 1000);
                                  });
                          jQuery("#btnSubmit").click(function(){
                                  var searchCriteria = jQuery("#txtSearch").val();
                                  skipCount = 50;
                                  searchLeagues(searchCriteria);
                          });
                                                  
  
                  }
                  
                  function LoadMorePushed(){
                          var service = new DerbyService();
  
                          service.getNextSetOfAllLeagues(skipCount, function(){
                                  jQuery("#scroller").find("#liAddMore").remove();
                                  appendAllLeagueDataOnScreen(this.responseText, "", "scroller");
                                  skipCount = skipCount + 50;                
                                  scrollView.refresh();                
                          });
                  }
          
                  function LoadMoreSearchPushed(searchCriteria){
                          var service = new DerbyService();
  
                          service.searchSkipLeagues(skipCount, searchCriteria,  function(){
                                  alert('searchCriteria: ' + searchCriteria);
                                  alert(skipCount);
                                  jQuery("#scroller").find("#liAddMore").remove();
                                  appendAllLeagueDataOnScreen(this.responseText, searchCriteria, "scroller");
                                  skipCount = skipCount + 50;                                
                                  scrollView.refresh();
                          });
                  }
  
                  function searchLeagues(searchCriteria){
                          var service = new DerbyService();
                          
                          service.searchLeagues(searchCriteria, function(){
                                  displayAllLeagueDataOnScreen(this.responseText, searchCriteria, "scroller");
                          });
                  }
          
              function searchAll(callback){
              var service = new DerbyService();
                  service.searchAllLeagues(function(){
                                          try{
                                     displayAllLeagueDataOnScreen(this.responseText, "", "scroller");   
                                          }
                                          catch(err){
                                                  alert('SeachAll ' + err);
                                          }
                          });
                          callback();
              }
                  
                  function getData(event, form){
                          jQuery('#btnSubmit').click().focus();
                          event.preventDefault();                
                  }
  
          </script>
  </html>
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.