Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!

Untitled

By: jackiboi on Dec 20th, 2012  |  syntax: HTML  |  size: 3.06 KB  |  views: 63  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <!doctype html>
  2. <html>
  3.     <head>
  4.         <meta charset="utf-8">
  5.         <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
  6.         <meta name="apple-mobile-web-app-capable" content="yes">
  7.         <meta name="apple-mobile-web-app-status-bar-style" content="black">
  8.         <link rel="stylesheet" href="css/style.css" />
  9.          <script type="text/javascript" charset="utf-8">
  10.             //add listener when device ready
  11.         document.addEventListener("deviceready", onDeviceReady, false);
  12.         var db = window.openDatabase("Dummy_DB", "1.0", "Just a Dummy DB", 200000); //will create database Dummy_DB or open it
  13.  
  14.         //function will be called when device ready
  15.         function onDeviceReady(){
  16.         db.transaction(populateDB, errorCB, successCB);
  17.         }
  18.  
  19.         //create table and insert some record
  20.         function populateDB(tx) {
  21.         tx.executeSql('CREATE TABLE IF NOT EXISTS SoccerPlayer (id INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT NOT NULL, Club TEXT NOT NULL)');
  22.         tx.executeSql('INSERT INTO SoccerPlayer(Name,Club) VALUES ("Alexandre Pato", "AC Milan")');
  23.         tx.executeSql('INSERT INTO SoccerPlayer(Name,Club) VALUES ("Van Persie", "Arsenal")');
  24.     }
  25.  
  26.         //function will be called when an error occurred
  27.         function errorCB(err) {
  28.         alert("Error processing SQL: "+err.code);
  29.         }
  30.  
  31.         //function will be called when process succeed
  32.         function successCB() {
  33.         alert("success!");
  34.         db.transaction(queryDB,errorCB);
  35.     }
  36.  
  37.         //select all from SoccerPlayer
  38.         function queryDB(tx){
  39.                 tx.executeSql('SELECT * FROM SoccerPlayer',[],querySuccess,errorCB);
  40.         }
  41.  
  42.         function querySuccess(tx,result){
  43.                 $('#SoccerPlayerList').empty();
  44.                 $.each(result.rows,function(index){
  45.                         var row = result.rows.item(index);
  46.                         $('#SoccerPlayerList').append('<li><a href="#"><p class="record">'+row['Name']+'</p><p class="small">Club '+row['Club']+'</p></a></li>');
  47.                 });
  48.  
  49.                 $('#SoccerPlayerList').listview();
  50.         }
  51. </script>
  52.         <script src="js/iscroll.js"></script>
  53.         <script type="text/javascript">var myScroll;function loaded() {myScroll = new iScroll('wrapper');}document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);document.addEventListener('DOMContentLoaded', function () { setTimeout(loaded, 200); }, false);</script>
  54.         <script src="js/cordova-2.2.0.js"></script>
  55. </head>
  56. <body>
  57.     <header>
  58.         <img class="gear" src="img/cogwheel.png" width="33" height="33" />
  59.         <p class="heading">
  60.             iLOCKER
  61.         </p>
  62.         <img class="newItem" src="img/new.png" width="30,9" height="31,5" />
  63.     </header>
  64.     <div class="headerShadow"></div>
  65.     <div class="searchDiv">
  66.         <img class="searchImg" src="img/search.png" width="20,9" height="21,5" />
  67.         <div class="searchPlaceholder"><input class="search" id="search" type="text" placeholder="Sök efter något..." name="search" /><hr class="search" /></div>
  68.     </div>
  69.     <div id="wrapper">
  70.         <div id="scroller">
  71.                 <ul id="SoccerPlayerList">
  72.                 </ul>
  73.         </div>
  74. </div>
  75. </body>
  76. </html>