<commit_before><!DOCTYPE html>

<!--

	This sample index.html is a "bare bones" example of using web development
	to produce a webOS app using mini Mojo. This is *not* designed to illustrate
	best practices (as the advanced developer will notice right off), but
	rather to show that even basic "web 1.0" skills can successfully create an
	app.

-->


<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>PhoneGap WebOS</title>
	
	<script type="text/javascript" src="phonegap-1.0.0.js"></script>   
	<script type="text/javascript">
		// create global var for sqlite database instance
		var db;
	</script>
		
	<link rel="stylesheet" type="text/css" href="menu.css">
	
</head>
<body>

<div id="menu">
	<a onclick="page('screen');">Adjust Screen Settings</a>
	<a onclick="page('notifications');">Notification Examples</a>
	<a onclick="info();">Show Device Info</a>
	<a onclick="net();">Show Network Info</a>		
	<a onclick="window.debug.log('trace this');">Console Logging</a>
	<a onclick="launchmap()">Launch Map App</a>
	<a onclick="navigator.window.newCard('dashboard.html'); menu(false);">Launch New Card</a>
	<a onclick="getPicture();">Launch Camera</a>
	<a onclick="storage();">Storage Tests</a> 
	<a onclick="callPhoneGapExec();menu(false);">PhoneGap Exec</a>
	<a onclick="page('touchDemo');">Touch Events Examples</a>
	<a onclick="menu(false);">Done</a>
</div>

<div id="screen">
	<p><input type="checkbox" onchange="navigator.window.setFullScreen(this.checked);">navigator.window.setFullScreen();</p>
	<p><input type="checkbox" onchange="navigator.window.blockScreenTimeout(this.checked);">navigator.window.blockScreenTimeout();</p>
	<p><input type="checkbox" onchange="navigator.accelerometer.setFastAccelerometer(this.checked);">navigator.accelerometer.fastAccelerometer();</p>
	
	<p>navigator.orientation.setWindowOrientation();</p>
	<input type="radio" onchange="navigator.orientation.setOrientation(this.value);" value="up" name="orientation" checked>up
	<input type="radio" onchange="navigator.orientation.setOrientation(this.value);" value="down" name="orientation">down
	<input type="radio" onchange="navigator.orientation.setOrientation(this.value);" value="left" name="orientation">left
	<input type="radio" onchange="navigator.orientation.setOrientation(this.value);" value="right" name="orientation">right
	<input type="radio" onchange="navigator.orientation.setOrientation(this.value);" value="free" name="orientation">free
		
	<p>navigator.orientation.getCurrentOrientation()</p>
	<button onclick="displayCurrentOrientation();">Get Current Orientation</button>  	
</div>

<div id="notifications" style="display: none;">
	<p>navigator.notification.newDashboard();</p>
	<button onclick="navigator.notification.newDashboard('dashboard.html');">Dashboard</button>
	
	<p>navigator.notification.alert();</p>
	<button onclick="navigator.notification.alert('alert');">Show Alert</button>
	
	<p>navigator.notification.showBanner();</p>
	<button onclick="navigator.notification.showBanner('Banner test','banner');">Show Banner Message</button>	
</div>

<div id="blank" width="100%" height="100%" style="background: #FFFFFF;"></div>

<div id="info" style="display: none;"></div>

<div id="net" style="display: none;"></div>

<div id="camera" style="display: none;"></div>

<div id="touchDemo" style="display: none;">
	<p>Touch Events Demo</p>
	<button id="btnTouchStart">Touch Start</button>
	<button id="btnTouchEnd">Touch End</button>
	<p>Run your finger/mouse along button to trigger touchmove</p>
	<button id="btnTouchMove" width="250">Touch Move</button>	
	<p>Mouse Events Demo</p>
	<button id="btnMouseDown">Mouse Down</button>
	<button id="btnMouseUp">Mouse Up</button>
	<p>Run your finger/mouse along button to trigger mousemove</p>
	<button id="btnMouseMove" width="250">Mouse Move</button>
</div> 

<div id="storage" style="display: none">
	<p>storage tests</p>
	<button onclick="createDB();">Test SQLite DB</button> 
	<div id="storageResults"></div>
</div>

<script>                         
document.addEventListener('deviceready', function () {
    // PhoneGap is ready, do all your stuf here
}, false);

// setup event listeners for touch events 
document.querySelector('#btnTouchStart').addEventListener('touchstart', onTouchEvent, false);
document.querySelector('#btnTouchEnd').addEventListener('touchend', onTouchEvent, false);
document.querySelector('#btnTouchMove').addEventListener('touchmove', onTouchEvent, false);<commit_msg>update sample application to demo compass api<commit_after><!DOCTYPE html>

<!--

	This sample index.html is a "bare bones" example of using web development
	to produce a webOS app using mini Mojo. This is *not* designed to illustrate
	best practices (as the advanced developer will notice right off), but
	rather to show that even basic "web 1.0" skills can successfully create an
	app.

-->


<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>PhoneGap WebOS</title>
	
	<script type="text/javascript" src="phonegap-1.0.0.js"></script>   
	<script type="text/javascript">
		// create global var for sqlite database instance
		var db;
	</script>
		
	<link rel="stylesheet" type="text/css" href="menu.css">
	
</head>
<body>

<div id="menu">
	<a onclick="page('screen');">Adjust Screen Settings</a>
	<a onclick="page('notifications');">Notification Examples</a>
	<a onclick="info();">Show Device Info</a>
	<a onclick="net();">Show Network Info</a>		
	<a onclick="window.debug.log('trace this');">Console Logging</a>
	<a onclick="launchmap()">Launch Map App</a>
	<a onclick="navigator.window.newCard('dashboard.html'); menu(false);">Launch New Card</a>
	<a onclick="getPicture();">Launch Camera</a>
	<a onclick="storage();">Storage Tests</a> 
	<a onclick="callPhoneGapExec();menu(false);">PhoneGap Exec</a>
	<a onclick="page('touchDemo');">Touch Events Examples</a>
	<a onclick="page('compassDemo');">Compass API</a>
	<a onclick="menu(false);">Done</a>
</div>

<div id="screen">
	<p><input type="checkbox" onchange="navigator.window.setFullScreen(this.checked);">navigator.window.setFullScreen();</p>
	<p><input type="checkbox" onchange="navigator.window.blockScreenTimeout(this.checked);">navigator.window.blockScreenTimeout();</p>
	<p><input type="checkbox" onchange="navigator.accelerometer.setFastAccelerometer(this.checked);">navigator.accelerometer.fastAccelerometer();</p>
	
	<p>navigator.orientation.setWindowOrientation();</p>
	<input type="radio" onchange="navigator.orientation.setOrientation(this.value);" value="up" name="orientation" checked>up
	<input type="radio" onchange="navigator.orientation.setOrientation(this.value);" value="down" name="orientation">down
	<input type="radio" onchange="navigator.orientation.setOrientation(this.value);" value="left" name="orientation">left
	<input type="radio" onchange="navigator.orientation.setOrientation(this.value);" value="right" name="orientation">right
	<input type="radio" onchange="navigator.orientation.setOrientation(this.value);" value="free" name="orientation">free
		
	<p>navigator.orientation.getCurrentOrientation()</p>
	<button onclick="displayCurrentOrientation();">Get Current Orientation</button>  	
</div>

<div id="notifications" style="display: none;">
	<p>navigator.notification.newDashboard();</p>
	<button onclick="navigator.notification.newDashboard('dashboard.html');">Dashboard</button>
	
	<p>navigator.notification.alert();</p>
	<button onclick="navigator.notification.alert('alert');">Show Alert</button>
	
	<p>navigator.notification.showBanner();</p>
	<button onclick="navigator.notification.showBanner('Banner test','banner');">Show Banner Message</button>	
</div>

<div id="blank" width="100%" height="100%" style="background: #FFFFFF;"></div>

<div id="info" style="display: none;"></div>

<div id="net" style="display: none;"></div>

<div id="camera" style="display: none;"></div>

<div id="touchDemo" style="display: none;">
	<p>Touch Events Demo</p>
	<button id="btnTouchStart">Touch Start</button>
	<button id="btnTouchEnd">Touch End</button>
	<p>Run your finger/mouse along button to trigger touchmove</p>
	<button id="btnTouchMove" width="250">Touch Move</button>	
	<p>Mouse Events Demo</p>
	<button id="btnMouseDown">Mouse Down</button>
	<button id="btnMouseUp">Mouse Up</button>
	<p>Run your finger/mouse along button to trigger mousemove</p>
	<button id="btnMouseMove" width="250">Mouse Move</button>
</div> 

<div id="storage" style="display: none">
	<p>storage tests</p>
	<button onclick="createDB();">Test SQLite DB</button> 
	<div id="storageResults"></div>
</div>

<div id="compassDemo" style="display: none;">
    <p>Compass Demo</p>
	<button id="btnGetCurrentHeading" onclick="displayCurrentHeading();">Get Current Heading</button>    
    <p>Watch Heading</p>
    <button id="btnStartCompassWatch" onclick="startCompassWatch();">Start Compass Watch</button>
    <button id="btnStopCompassWatch" onclick="stopCompassWatch();">Stop Compass Watch</button>

</div>

<script>                         
document.addEventListener('deviceready', function () {
    // PhoneGap is ready, do all your stuf here
}, false);

var watchId = null;

function displayCurrentHeading() {
    
    function successful(response) {
        navigator.notification.alert("last heading: " + response);
    }
    
    var request = navigator.compass.getCurrentHeading(successful, {});
    
}

function startCompassWatch() {
    // set frequency of compass updates in milliseconds
    var options = { frequency: 5000 };
    
    function onStartCompassSuccess(heading) {
        navigator.notification.alert("Heading: " + heading);
    }
    
    watchId = navigator.compass.watchHeading(onStartCompassSuccess, onCompassError, options);
}

function stopCompassWatch() {
    if (watchId) {
        navigator.compass.clearWatch(watchId);
        watchId = null;
    }
}

function onCompassError(compassError) {
    navigator.notification.alert("Compass error: " + compassError.code);
}


// setup event listeners for touch events 
document.querySelector('#btnTouchStart').addEventListener('touchstart', onTouchEvent, false);
document.querySelector('#btnTouchEnd').addEventListener('touchend', onTouchEvent, false);
document.querySelector('#btnTouchMove').addEventListener('touchmove', onTouchEvent, false);
{'fraction_non_alphanumeric': 0.17232704402515722, 'fraction_numerical': 0.0038703434929850023, 'mean_word_length': 6.351351351351352, 'pattern_counts': {'":': 0, '<': 247, '<?xml version=': 0, '>': 247, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2840468', 'n_tokens_mistral': 3306, 'n_tokens_neox': 3174, 'n_words': 670}