Permalink
Browse files

* Working completlely on nokia now

  • Loading branch information...
1 parent 655be51 commit 6b95432f3025a98332bc5e932f671f4ece64928f @bnolan committed Nov 24, 2010
Showing with 41 additions and 10 deletions.
  1. +1 −1 application.coffee
  2. +1 −1 application.js
  3. +4 −4 index.html
  4. +35 −4 jquery-mobile.js
View
@@ -18,7 +18,7 @@ app =
$.mobile.changePage page
goBack: ->
- history.back()
+ $.historyBack()
#
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -11,18 +11,16 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<script type="text/javascript" charset="utf-8" src="jquery.js"></script>
- <script type="text/javascript" charset="utf-8" src="jquery-mobile.js"></script>
<script type="text/javascript" charset="utf-8" src="underscore.js"></script>
<script type="text/javascript" charset="utf-8" src="backbone.js"></script>
<script type="text/javascript" charset="utf-8" src="foursquare.json"></script>
- <script type="text/javascript" charset="utf-8" src="application.js"></script>
<link rel="stylesheet" href="jquery-mobile.css" />
<script type="text/javascript" charset="utf-8">
// document.write("<script type='text/javascript' charset='utf-8' src='jquery.js?" + Math.random() + "'></" + "script>");
- // document.write("<script type='text/javascript' charset='utf-8' src='jquery-mobile.js?" + Math.random() + "'></" + "script>");
- // document.write("<script type='text/javascript' charset='utf-8' src='application.js?" + Math.random() + "'></" + "script>");
+ document.write("<script type='text/javascript' charset='utf-8' src='jquery-mobile.js?" + Math.random() + "'></" + "script>");
+ document.write("<script type='text/javascript' charset='utf-8' src='application.js?" + Math.random() + "'></" + "script>");
function onBodyLoad(){
document.addEventListener("deviceready",onDeviceReady,false);
@@ -35,6 +33,8 @@
}
</script>
+ <!--script type="text/javascript" charset="utf-8" src="application.js"></script-->
+
</head>
<body onload="onBodyLoad()">
View
@@ -864,6 +864,7 @@ $.each({
fake_onhashchange = (function(){
var self = {},
timeout_id,
+ histories = [location.href.replace( /#.*/, '' )],
// Remember the initial hash so it doesn't get triggered immediately.
last_hash = get_fragment(),
@@ -882,7 +883,30 @@ $.each({
timeout_id && clearTimeout( timeout_id );
timeout_id = undefined;
};
-
+
+ /*
+ * @bnolan hack to make work on nokia
+ */
+
+ if(supports_onhashchange){
+ $.historyBack = function(){
+ history.back();
+ }
+ }else{
+ $.historyBack = function(){
+ if(histories.length > 1){
+ // Remove the top
+ histories.pop()
+
+ // Get the prior..
+ var url = histories.pop();
+ location.href = url;
+ }
+ }
+ }
+
+ /* end hack */
+
// This polling loop checks every $.fn.hashchange.delay milliseconds to see
// if location.hash has changed, and triggers the 'hashchange' event on
// window when necessary.
@@ -892,7 +916,14 @@ $.each({
if ( hash !== last_hash ) {
history_set( last_hash = hash, history_hash );
-
+
+ /*
+ * @bnolan hack to make work on nokia
+ */
+ var url = location.href.replace( /#.*/, '' ) + hash;
+ histories.push(url);
+ /* end hack */
+
$(window).trigger( str_hashchange );
} else if ( history_hash !== last_hash ) {
@@ -901,7 +932,7 @@ $.each({
timeout_id = setTimeout( poll, $.fn[ str_hashchange ].delay );
};
-
+
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
// vvvvvvvvvvvvvvvvvvv REMOVE IF NOT SUPPORTING IE6/7/8 vvvvvvvvvvvvvvvvvvv
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
@@ -1077,7 +1108,7 @@ $.widget( "mobile.page", $.mobile.widget, {
$( "<a href='#' class='ui-btn-left' data-icon='arrow-l'>"+ o.backBtnText +"</a>" )
.click(function() {
- history.back();
+ $.historyBack();
return false;
})
.prependTo( $this );

0 comments on commit 6b95432

Please sign in to comment.