jQM Template

by softwareinnovator

HTML

<link rel="stylesheet" href="http://jeromeetienne.github.com/jquery-mobile-960/css/jquery-mobile-fluid960.css">
<script src="http://timeago.yarp.com/jquery.timeago.js"></script>
<script src="http://imakewebthings.github.com/jquery-waypoints/waypoints.min.js"></script>
<!DOCTYPE html>
<html>
    <head>
        <title>jQM Complex Demo</title>
        <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
        <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=no; target-densityDpi=device-dpi"/>
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
        <!--<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>-->
        <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>    
    </head>
    <body>
        <div data-role="page" id="index">
            <div data-theme="b" data-role="header">
                <h1>Index page</h1>
            </div>
            
            <div data-role="content">
                <div data-role="fieldcontain">
                    <label for="textA">
                        Input A
                    </label>
                    <input class="inputField" id="textA" value="" type="text" value="This is default text A" />
                </div>
                <div data-role="fieldcontain">
                    <label for="textB">
                        Input B
                    </label>
                    <input class="inputField" id="textB" value="" type="text" value="This is default text B" />
                </div>
                <div class="ui-grid-b">
                    <div class="ui-block-a">
                        <input type="button" id="goButton" value="Go" />
                    </div>
                    <div class="ui-block-b">
                        <input type="button" id="testButton" value="Alert" />
                    </div>
 ...

JavaScript

$(document).on('pagebeforeshow', '#index', function(){ 
    $(document).on('click', '#testButton', function(){ 
        alert('Alerted!');       
    });
    
    $(document).on('click', '#goButton', function(){ 
        alert('Button Pressed');      
    });        
    
    $(document).on('keypress', '#textB, #textA', function(evt){ 
        var keyPressed = evt.which || evt.keyCode;
        //alert(keyPressed);
        if (keyPressed == 13) {
            document.getElementById('goButton').click();
            evt.cancel = true;
        }     else
        {
        	return AmharicPhoneticKeyPress(evt,this);
        }
    });    
});


// Copyright: (c) 2009 by SelamSoft Inc.
// Product title: Amharic Phonetic Typing Javascript
// Product version details: 2.1.0, 01-28-2009  Updated and tested on IE, Firefox, Opera, Safari and Google Chrome
// Product URL: http://www.amharicdictionary.com/js/amharictyping.js
// Contact info: [email protected]
// Notes: You are free to use this script on your website with the requirement that you 
//        link to www.AmharicDictionary.com on your site's front page. 
// Feel free to copy, use and change this script as long as this head part remains unchanged.  
// If you improve on this script, please send us your updates.


function getCursorPosition() {
  var range;
  range = document.selection.createRange();
  range.moveStart("Textedit", -1);
  return range.text.length;
};

function isRootLetter(amharicValue) {
  var isRoot = false;

  switch (amharicValue) {
    case 4629:
    case 4677:
    case 4741:
    case 4797:
    case 4813:
    case 4653:k
    case 4845:
    case 4725:
    case 4901:
    case 4949:
    case 4661:
    case 4853:
    case 4941:
    case 4821:
    case 4877:
    case 4613:
    case 4869:
    case 4781:
    case 4621:
    case 4829:
    case 4933:
    case 4733:
    case 4717:
    case 4709:
    case 4765:
    case 4757:
    case 4637:
    case 4909:
    case 4637:
    case 4917:
    case 4669:
    case...