Permalink
Browse files

fixed bugs

  • Loading branch information...
1 parent 0b8ef9a commit 7f1bfb0fbc45d5ac74f9a9598b29d6d4d2912021 @mnowakowski committed Jun 7, 2011
Showing with 42 additions and 100 deletions.
  1. +32 −55 assets/js/app.js
  2. +10 −45 index.html
View
87 assets/js/app.js
@@ -1,59 +1,36 @@
-//
-// --- our app behavior logic ---
-//
-run(function () {
- // immediately invoked on first run
- var init = (function () {
- navigator.network.isReachable("google.com", function(status) {
- var connectivity = (status.internetConnectionStatus || status.code || status);
- if (connectivity === NetworkStatus.NOT_REACHABLE) {
- alert("No internet connection - we won't be able to show you any maps");
- } else {
- alert("We can reach Google - get ready for some awesome maps!");
- }
- });
- })();
-
- // a little inline controller
- when('#welcome');
- when('#settings', function() {
- // load settings from store and make sure we persist radio buttons.
- store.get('config', function(saved) {
- if (saved) {
- if (saved.map) {
- x$('input[value=' + saved.map + ']').attr('checked',true);
- }
- if (saved.zoom) {
- x$('input[name=zoom][value="' + saved.zoom + '"]').attr('checked',true);
- }
+$( function() {
+ $('#searchButton').click(function() {
+
+ var $tweet_list = $('#tweet_list');
+ var tweet_list_html = "";
+ var tweet_id = $('#searchBox').val();
+
+ $tweet_list.html('<li>Loading '+ tweet_id +'\'s tweets</li>');
+
+ $.jsonp({
+ url: 'http://twitter.com/status/user_timeline/'+ tweet_id + '.json?count=20',
+ callbackParameter: 'callback',
+ timeout: 25000,
+ success: function(data, status) {
+ //$('#your-tweets').append('<li>The feed loads fine');
+ $tweet_list.html('');
+ $.each(data, function(i,item){
+ var tweet = item.text;
+ tweet_list_html = tweet_list_html + '<li>'+tweet+'</li>';
+ });
+ $tweet_list.html(tweet_list_html).listview('refresh');
+ },
+ error: function(){
+ $tweet_list.html('<li>There was an error loading the feed</li>');
}
});
+
});
- when('#map', function () {
- store.get('config', function (saved) {
- // construct a gmap str
- var map = saved ? saved.map || ui('map') : ui('map')
- , zoom = saved ? saved.zoom || ui('zoom') : ui('zoom')
- , path = "http://maps.google.com/maps/api/staticmap?center=";
-
- navigator.geolocation.getCurrentPosition(function (position) {
- var location = "" + position.coords.latitude + "," + position.coords.longitude;
- path += location + "&zoom=" + zoom;
- path += "&size=250x250&maptype=" + map + "&markers=color:red|label:P|";
- path += location + "&sensor=false";
-
- x$('img#static_map').attr('src', path);
- }, function () {
- x$('img#static_map').attr('src', "assets/img/gpsfailed.png");
- });
- });
- });
- when('#save', function () {
- store.save({
- key:'config',
- map:ui('map'),
- zoom:ui('zoom')
- });
- display('#welcome');
- });
+ document.addEventListener("deviceready", onDeviceReady, false);
});
+
+ // PhoneGap is loaded and it is now safe to make calls PhoneGap methods
+ //
+ function onDeviceReady() {
+ //
+ }
View
55 index.html
@@ -11,59 +11,21 @@
<script src="assets/js/jquery-1.5.2.min.js"></script>
<script src="assets/js/jquery.mobile-1.0a4.1.min.js"></script>
+ <!--
<script src="assets/js/xui.js" type="text/javascript" charset="utf-8"></script>
<script src="assets/js/lawnchair/adaptors/LawnchairAdaptorHelpers.js" type="text/javascript" charset="utf-8"></script>
<script src="assets/js/lawnchair/adaptors/DOMStorageAdaptor.js" type="text/javascript" charset="utf-8"></script>
<script src="assets/js/lawnchair/adaptors/WebkitSQLiteAdaptor.js" type="text/javascript" charset="utf-8"></script>
<script src="assets/js/lawnchair/Lawnchair.js" type="text/javascript" charset="utf-8"></script>
<script src="assets/js/dsl.js" type="text/javascript" charset="utf-8"></script>
+ -->
<script src="assets/js/jquery.jsonp-2.1.4.min.js"></script>
<script src="assets/js/app.js" type="text/javascript" charset="utf-8"></script>
-
-
-<script>
- $( function() {
- $('#searchButton').click(function() {
-
- var $tweet_list = $('#tweet_list');
- var tweet_list_html = "";
- var tweet_id = $('#searchBox').val();
-
- $tweet_list.html('<li>Loading '+ tweet_id +'\'s tweets</li>');
-
- $.jsonp({
- url: 'http://twitter.com/status/user_timeline/'+ tweet_id + '.json?count=20',
- callbackParameter: 'callback',
- timeout: 25000,
- success: function(data, status) {
- //$('#your-tweets').append('<li>The feed loads fine');
- $tweet_list.html('');
- $.each(data, function(i,item){
- var tweet = item.text;
- tweet_list_html = tweet_list_html + '<li>'+tweet+'</li>';
- });
- $tweet_list.html(tweet_list_html).listview('refresh');
- },
- error: function(){
- $tweet_list.html('<li>There was an error loading the feed</li>');
- }
- });
-
- });
- document.addEventListener("deviceready", onDeviceReady, false);
- });
-
- // PhoneGap is loaded and it is now safe to make calls PhoneGap methods
- //
- function onDeviceReady() {
- //
- }
-
- </script>
</head>
+
<body>
<div data-role="page" id="home">
@@ -73,10 +35,14 @@
</div>
<div data-role="content">
- <p>Find Alternatives To Your favourite Softwares </p>
+ <p>Get fresh tweets for typed tweeter id.</p>
<p><a href="#search" data-role="button">Show tweets</a></p>
<p><a href="#recent" data-role="button">About</a></p>
</div>
+
+ <div data-role="footer">
+ <h4>mymanufactory.com</h4>
+ </div>
</div>
@@ -109,10 +75,9 @@
<div data-role="content">
<p>This app rocks!</p>
-
</div>
- </div>
-
+ </div>
+
</body>
</html>

0 comments on commit 7f1bfb0

Please sign in to comment.