Animation feature OK
This commit is contained in:
parent
5d1991a14e
commit
20d91b2777
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Hello World</name>
|
||||
<name>Momo</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#Last build type
|
||||
#Wed, 04 Feb 2015 10:26:33 +0100
|
||||
#Wed, 04 Feb 2015 19:20:17 +0100
|
||||
|
||||
build.last.target=debug
|
||||
|
||||
|
|
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<manifest android:hardwareAccelerated="true" android:versionCode="10000" android:versionName="1.0.0" package="com.phonegap.helloworld" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<manifest android:hardwareAccelerated="true" android:versionCode="10000" android:versionName="1.0.0" package="com.cadoles.momo" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,4 +0,0 @@
|
|||
/home/ghis/Workspace/momo/platforms/android/ant-build/CordovaApp-release-unsigned.apk : \
|
||||
/home/ghis/Workspace/momo/platforms/android/ant-build/CordovaApp.ap_ \
|
||||
/home/ghis/Workspace/momo/platforms/android/ant-build/classes.dex \
|
||||
/home/ghis/Workspace/momo/platforms/android/CordovaLib/ant-build/classes.jar \
|
Binary file not shown.
|
@ -1,7 +1,6 @@
|
|||
/home/ghis/Workspace/momo/platforms/android/ant-build/CordovaApp.ap_ \
|
||||
: /home/ghis/Workspace/momo/platforms/android/res/drawable-port-mdpi/screen.png \
|
||||
/home/ghis/Workspace/momo/platforms/android/res/drawable-hdpi/icon.png \
|
||||
/home/ghis/Workspace/momo/platforms/android/res/drawable-hdpi/drawable-mdpi \
|
||||
/home/ghis/Workspace/momo/platforms/android/res/drawable-land-ldpi/screen.png \
|
||||
/home/ghis/Workspace/momo/platforms/android/res/drawable-port-xhdpi/screen.png \
|
||||
/home/ghis/Workspace/momo/platforms/android/res/drawable-land-mdpi/screen.png \
|
||||
|
@ -38,13 +37,16 @@
|
|||
/home/ghis/Workspace/momo/platforms/android/assets/www/spec.html \
|
||||
/home/ghis/Workspace/momo/platforms/android/assets/www/res \
|
||||
/home/ghis/Workspace/momo/platforms/android/assets/www/fonts \
|
||||
/home/ghis/Workspace/momo/platforms/android/assets/www/js/tmpl.min.js \
|
||||
/home/ghis/Workspace/momo/platforms/android/assets/www/js/bootstrap.min.js \
|
||||
/home/ghis/Workspace/momo/platforms/android/assets/www/js/index.js \
|
||||
/home/ghis/Workspace/momo/platforms/android/assets/www/js/pagetransitions.js \
|
||||
/home/ghis/Workspace/momo/platforms/android/assets/www/img/logo.png \
|
||||
/home/ghis/Workspace/momo/platforms/android/assets/www/css/bootstrap.min.css \
|
||||
/home/ghis/Workspace/momo/platforms/android/assets/www/css/index.css \
|
||||
/home/ghis/Workspace/momo/platforms/android/assets/www/css/bootstrap-theme.min.css \
|
||||
/home/ghis/Workspace/momo/platforms/android/assets/www/css/font-awesome.min.css \
|
||||
/home/ghis/Workspace/momo/platforms/android/assets/www/css/animations.css \
|
||||
/home/ghis/Workspace/momo/platforms/android/assets/www/spec/lib \
|
||||
/home/ghis/Workspace/momo/platforms/android/assets/www/spec/helper.js \
|
||||
/home/ghis/Workspace/momo/platforms/android/assets/www/spec/index.js \
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#Last build type
|
||||
#Wed, 04 Feb 2015 10:26:40 +0100
|
||||
#Wed, 04 Feb 2015 19:20:21 +0100
|
||||
|
||||
build.last.target=debug
|
||||
|
||||
|
|
Binary file not shown.
|
@ -1,9 +1,9 @@
|
|||
/home/ghis/Workspace/momo/platforms/android/ant-build/classes.dex : \
|
||||
/home/ghis/Workspace/momo/platforms/android/ant-build/classes/com/phonegap/helloworld/R.class \
|
||||
/home/ghis/Workspace/momo/platforms/android/ant-build/classes/com/phonegap/helloworld/R$xml.class \
|
||||
/home/ghis/Workspace/momo/platforms/android/ant-build/classes/com/phonegap/helloworld/BuildConfig.class \
|
||||
/home/ghis/Workspace/momo/platforms/android/ant-build/classes/com/phonegap/helloworld/R$drawable.class \
|
||||
/home/ghis/Workspace/momo/platforms/android/ant-build/classes/com/phonegap/helloworld/CordovaApp.class \
|
||||
/home/ghis/Workspace/momo/platforms/android/ant-build/classes/com/phonegap/helloworld/R$attr.class \
|
||||
/home/ghis/Workspace/momo/platforms/android/ant-build/classes/com/phonegap/helloworld/R$string.class \
|
||||
/home/ghis/Workspace/momo/platforms/android/ant-build/classes/com/cadoles/momo/R.class \
|
||||
/home/ghis/Workspace/momo/platforms/android/ant-build/classes/com/cadoles/momo/R$xml.class \
|
||||
/home/ghis/Workspace/momo/platforms/android/ant-build/classes/com/cadoles/momo/BuildConfig.class \
|
||||
/home/ghis/Workspace/momo/platforms/android/ant-build/classes/com/cadoles/momo/R$drawable.class \
|
||||
/home/ghis/Workspace/momo/platforms/android/ant-build/classes/com/cadoles/momo/CordovaApp.class \
|
||||
/home/ghis/Workspace/momo/platforms/android/ant-build/classes/com/cadoles/momo/R$attr.class \
|
||||
/home/ghis/Workspace/momo/platforms/android/ant-build/classes/com/cadoles/momo/R$string.class \
|
||||
/home/ghis/Workspace/momo/platforms/android/ant-build/dexedLibs/classes-703f86d81f0ed180098d872ee1ccf45c.jar \
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,3 +1,3 @@
|
|||
# view AndroidManifest.xml #generated:6
|
||||
-keep class com.phonegap.helloworld.CordovaApp { <init>(...); }
|
||||
-keep class com.cadoles.momo.CordovaApp { <init>(...); }
|
||||
|
||||
|
|
|
@ -34,6 +34,11 @@ html, body,
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
.momo-page {
|
||||
background: url("http://subtlepatterns.com/patterns/greyzz.png") repeat scroll 0 0 rgba(0, 0, 0, 0);
|
||||
box-shadow: 0 0 20px #000;
|
||||
}
|
||||
|
||||
body {
|
||||
-webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */
|
||||
-webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */
|
||||
|
|
|
@ -152,31 +152,6 @@ var app = {
|
|||
$page.innerHTML = tmpl("momo-page-tmpl", page);
|
||||
document.getElementById('momo-pages').appendChild($page);
|
||||
|
||||
//if(page.external){
|
||||
// navigator.app.loadUrl(page.url, { openExternal:true });
|
||||
// return false;
|
||||
//}
|
||||
|
||||
//app.utils.updateEl('.momo-page-content', '');
|
||||
//app.utils.updateEl('.momo-page-pages', '');
|
||||
//app.utils.updateEl('.momo-page-seealso', '');
|
||||
//app.utils.updateEl('.momo-page-title', page.title);
|
||||
//var $seealso = document.querySelector('.momo-page-seealso');
|
||||
//$seealso.parentElement.style.display = 'none';
|
||||
|
||||
//if(page.content){
|
||||
// app.utils.updateEl('.momo-page-content', page.content);
|
||||
//} else
|
||||
//if(page.url){
|
||||
// app.utils.updateEl('.momo-page-content', '<div class="momo-container"><iframe src="'+page.url+'"></iframe></div>');
|
||||
//}
|
||||
//if(page.pages instanceof Array){
|
||||
// app.utils.updateEl('.momo-page-pages', app.utils.renderLinks(page.pages));
|
||||
//}
|
||||
//if(page.seealso instanceof Array){
|
||||
// $seealso.parentElement.style.display = 'block';
|
||||
// app.utils.updateEl('.momo-page-seealso', app.utils.renderLinks(page.seealso));
|
||||
//}
|
||||
} else
|
||||
if(typeof page === 'string' || page instanceof String || page instanceof Number){
|
||||
//console.log('Render page '+page);
|
||||
|
@ -191,16 +166,30 @@ var app = {
|
|||
|
||||
navigate: function(page){
|
||||
|
||||
var page_obj = app.pages[page];
|
||||
|
||||
if(page_obj.external){
|
||||
navigator.app.loadUrl(page_obj.url, { openExternal:true });
|
||||
return false;
|
||||
}
|
||||
|
||||
if(app.isAnimating) {
|
||||
return false;
|
||||
}
|
||||
|
||||
app.isAnimating = true;
|
||||
|
||||
var $outpage = document.getElementById(app.current_page);
|
||||
var $inpage = document.getElementById(page);
|
||||
|
||||
//$inpage.classList.add('momo-page-current');
|
||||
//$outpage.classList.remove('momo-page-current');
|
||||
|
||||
var outCb = function(){
|
||||
$outpage.removeEventListener('animationend', outCb);
|
||||
$outpage.removeEventListener('animationend', outCb);
|
||||
$outpage.removeEventListener('webkitAnimationEnd', outCb);
|
||||
$outpage.removeEventListener('oAnimationEnd', outCb);
|
||||
$outpage.removeEventListener('MSAnimationEnd', outCb);
|
||||
app.endCurrPage = true;
|
||||
if(app.endNextPage){
|
||||
app.onAnimationEnd($outpage, $inpage);
|
||||
|
@ -209,33 +198,44 @@ var app = {
|
|||
|
||||
var inCb = function(){
|
||||
$inpage.removeEventListener('animationend', inCb);
|
||||
$inpage.removeEventListener('webkitAnimationEnd', inCb);
|
||||
$inpage.removeEventListener('oAnimationEnd', inCb);
|
||||
$inpage.removeEventListener('MSAnimationEnd', inCb);
|
||||
app.endNextPage = true;
|
||||
if(app.endCurrPage){
|
||||
app.onAnimationEnd($outpage, $inpage);
|
||||
}
|
||||
};
|
||||
|
||||
var out_classes = ANIMATION_OUT_CLASS.split(' ');
|
||||
for(var i = 0; i < out_classes.length; i++)
|
||||
$outpage.classList.add(out_classes[i]);
|
||||
$outpage.addEventListener('animationend', outCb, false);
|
||||
$outpage.addEventListener('animationend', outCb, false);
|
||||
$outpage.addEventListener('webkitAnimationEnd', outCb, false);
|
||||
$outpage.addEventListener('oAnimationEnd', outCb, false);
|
||||
$outpage.addEventListener('MSAnimationEnd', outCb, false);
|
||||
|
||||
$inpage.classList.add('momo-page-current');
|
||||
|
||||
var in_classes = ANIMATION_IN_CLASS.split(' ');
|
||||
for(var i = 0; i < in_classes.length; i++)
|
||||
$inpage.classList.add(in_classes[i]);
|
||||
$inpage.addEventListener('animationend', inCb);
|
||||
$inpage.addEventListener('animationend', inCb, false);
|
||||
$inpage.addEventListener('webkitAnimationEnd', inCb, false);
|
||||
$inpage.addEventListener('oAnimationEnd', inCb, false);
|
||||
$inpage.addEventListener('MSAnimationEnd', inCb, false);
|
||||
|
||||
app.current_page = page;
|
||||
},
|
||||
|
||||
onAnimationEnd($outpage, $inpage) {
|
||||
onAnimationEnd: function($outpage, $inpage) {
|
||||
app.endCurrPage = false;
|
||||
app.endNextPage = false;
|
||||
var out_classes = ANIMATION_OUT_CLASS.split(' ');
|
||||
for(var i = 0; i < out_classes.length; i++)
|
||||
$outpage.classList.remove(out_classes[i]);
|
||||
if( $outpage != $inpage)
|
||||
$outpage.classList.remove('momo-page-current');
|
||||
if($outpage != $inpage)
|
||||
$outpage.classList.remove('momo-page-current');
|
||||
var in_classes = ANIMATION_IN_CLASS.split(' ');
|
||||
for(var i = 0; i < in_classes.length; i++)
|
||||
$inpage.classList.remove(in_classes[i]);
|
||||
|
@ -252,7 +252,7 @@ var app = {
|
|||
if(!app.pages.hasOwnProperty(page)){
|
||||
page = 'home';
|
||||
}
|
||||
if(app.current_page != page)
|
||||
//if(app.current_page != page)
|
||||
app.navigate(page);
|
||||
},
|
||||
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
package com.phonegap.helloworld;
|
||||
|
||||
import android.os.Bundle;
|
||||
import org.apache.cordova.*;
|
||||
|
||||
public class CordovaApp extends CordovaActivity
|
||||
{
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
super.init();
|
||||
// Set by <content src="index.html" /> in config.xml
|
||||
loadUrl(launchUrl);
|
||||
}
|
||||
}
|
|
@ -34,6 +34,11 @@ html, body,
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
.momo-page {
|
||||
background: url("http://subtlepatterns.com/patterns/greyzz.png") repeat scroll 0 0 rgba(0, 0, 0, 0);
|
||||
box-shadow: 0 0 20px #000;
|
||||
}
|
||||
|
||||
body {
|
||||
-webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */
|
||||
-webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */
|
||||
|
|
|
@ -73,10 +73,19 @@
|
|||
|
||||
<nav class="navbar navbar-inverse navbar-static-top momo-subnavbar">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-header">
|
||||
<span class="navbar-brand">
|
||||
<div class="row">
|
||||
<div class="col-xs-2 navbar-btn text-left">
|
||||
{% if(o.id != 'home'){ %}
|
||||
<a href="#" class="btn btn-success pull-left" onclick="window.history.back(); return false;">
|
||||
<i class="fa fa-chevron-left"></i>
|
||||
</a>
|
||||
{% } %}
|
||||
</div>
|
||||
<div class="col-xs-8 navbar-brand text-center">
|
||||
{%= o.title %}
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-xs-2">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
112
www/js/index.js
112
www/js/index.js
|
@ -19,6 +19,8 @@
|
|||
|
||||
var ANIMATION_OUT_CLASS = 'pt-page-moveToLeftEasing pt-page-ontop';
|
||||
var ANIMATION_IN_CLASS = 'pt-page-moveFromRight';
|
||||
var ANIMATION_BACK_OUT_CLASS = 'pt-page-moveToRightEasing pt-page-ontop';
|
||||
var ANIMATION_BACK_IN_CLASS = 'pt-page-moveFromLeft';
|
||||
|
||||
var extend = function ( defaults, options ) {
|
||||
var extended = {};
|
||||
|
@ -45,10 +47,12 @@ var app = {
|
|||
'contact': 'contact@cadoles.com'
|
||||
},
|
||||
|
||||
current : 0,
|
||||
isAnimating: false,
|
||||
endCurrPage: false,
|
||||
endNextPage: false,
|
||||
current : 0,
|
||||
isAnimating : false,
|
||||
endCurrPage : false,
|
||||
endNextPage : false,
|
||||
hashHistory : [window.location.hash],
|
||||
historyLength : window.history.length,
|
||||
|
||||
// Application Constructor
|
||||
initialize: function() {
|
||||
|
@ -152,31 +156,6 @@ var app = {
|
|||
$page.innerHTML = tmpl("momo-page-tmpl", page);
|
||||
document.getElementById('momo-pages').appendChild($page);
|
||||
|
||||
//if(page.external){
|
||||
// navigator.app.loadUrl(page.url, { openExternal:true });
|
||||
// return false;
|
||||
//}
|
||||
|
||||
//app.utils.updateEl('.momo-page-content', '');
|
||||
//app.utils.updateEl('.momo-page-pages', '');
|
||||
//app.utils.updateEl('.momo-page-seealso', '');
|
||||
//app.utils.updateEl('.momo-page-title', page.title);
|
||||
//var $seealso = document.querySelector('.momo-page-seealso');
|
||||
//$seealso.parentElement.style.display = 'none';
|
||||
|
||||
//if(page.content){
|
||||
// app.utils.updateEl('.momo-page-content', page.content);
|
||||
//} else
|
||||
//if(page.url){
|
||||
// app.utils.updateEl('.momo-page-content', '<div class="momo-container"><iframe src="'+page.url+'"></iframe></div>');
|
||||
//}
|
||||
//if(page.pages instanceof Array){
|
||||
// app.utils.updateEl('.momo-page-pages', app.utils.renderLinks(page.pages));
|
||||
//}
|
||||
//if(page.seealso instanceof Array){
|
||||
// $seealso.parentElement.style.display = 'block';
|
||||
// app.utils.updateEl('.momo-page-seealso', app.utils.renderLinks(page.seealso));
|
||||
//}
|
||||
} else
|
||||
if(typeof page === 'string' || page instanceof String || page instanceof Number){
|
||||
//console.log('Render page '+page);
|
||||
|
@ -189,54 +168,79 @@ var app = {
|
|||
}
|
||||
},
|
||||
|
||||
navigate: function(page){
|
||||
navigate: function(page, back){
|
||||
|
||||
var page_obj = app.pages[page];
|
||||
|
||||
if(page_obj.external){
|
||||
navigator.app.loadUrl(page_obj.url, { openExternal:true });
|
||||
return false;
|
||||
}
|
||||
|
||||
if(app.isAnimating) {
|
||||
return false;
|
||||
}
|
||||
|
||||
app.isAnimating = true;
|
||||
|
||||
var $outpage = document.getElementById(app.current_page);
|
||||
var $inpage = document.getElementById(page);
|
||||
|
||||
//$inpage.classList.add('momo-page-current');
|
||||
//$outpage.classList.remove('momo-page-current');
|
||||
|
||||
var outCb = function(){
|
||||
$outpage.removeEventListener('animationend', outCb);
|
||||
$outpage.removeEventListener('animationend', outCb);
|
||||
$outpage.removeEventListener('webkitAnimationEnd', outCb);
|
||||
$outpage.removeEventListener('oAnimationEnd', outCb);
|
||||
$outpage.removeEventListener('MSAnimationEnd', outCb);
|
||||
app.endCurrPage = true;
|
||||
if(app.endNextPage){
|
||||
app.onAnimationEnd($outpage, $inpage);
|
||||
app.onAnimationEnd($outpage, $inpage, back);
|
||||
}
|
||||
};
|
||||
|
||||
var inCb = function(){
|
||||
$inpage.removeEventListener('animationend', inCb);
|
||||
$inpage.removeEventListener('animationend', inCb);
|
||||
$inpage.removeEventListener('webkitAnimationEnd', inCb);
|
||||
$inpage.removeEventListener('oAnimationEnd', inCb);
|
||||
$inpage.removeEventListener('MSAnimationEnd', inCb);
|
||||
app.endNextPage = true;
|
||||
if(app.endCurrPage){
|
||||
app.onAnimationEnd($outpage, $inpage);
|
||||
app.onAnimationEnd($outpage, $inpage, back);
|
||||
}
|
||||
};
|
||||
var out_classes = ANIMATION_OUT_CLASS.split(' ');
|
||||
|
||||
var out_classes = (back ? ANIMATION_BACK_OUT_CLASS : ANIMATION_OUT_CLASS).split(' ');
|
||||
for(var i = 0; i < out_classes.length; i++)
|
||||
$outpage.classList.add(out_classes[i]);
|
||||
$outpage.addEventListener('animationend', outCb, false);
|
||||
$outpage.addEventListener('animationend', outCb, false);
|
||||
$outpage.addEventListener('webkitAnimationEnd', outCb, false);
|
||||
$outpage.addEventListener('oAnimationEnd', outCb, false);
|
||||
$outpage.addEventListener('MSAnimationEnd', outCb, false);
|
||||
|
||||
$inpage.classList.add('momo-page-current');
|
||||
var in_classes = ANIMATION_IN_CLASS.split(' ');
|
||||
|
||||
var in_classes = (back ? ANIMATION_BACK_IN_CLASS : ANIMATION_IN_CLASS).split(' ');
|
||||
for(var i = 0; i < in_classes.length; i++)
|
||||
$inpage.classList.add(in_classes[i]);
|
||||
$inpage.addEventListener('animationend', inCb);
|
||||
$inpage.addEventListener('animationend', inCb, false);
|
||||
$inpage.addEventListener('webkitAnimationEnd', inCb, false);
|
||||
$inpage.addEventListener('oAnimationEnd', inCb, false);
|
||||
$inpage.addEventListener('MSAnimationEnd', inCb, false);
|
||||
|
||||
app.current_page = page;
|
||||
},
|
||||
|
||||
onAnimationEnd($outpage, $inpage) {
|
||||
onAnimationEnd: function($outpage, $inpage, back) {
|
||||
app.endCurrPage = false;
|
||||
app.endNextPage = false;
|
||||
var out_classes = ANIMATION_OUT_CLASS.split(' ');
|
||||
var out_classes = (back ? ANIMATION_BACK_OUT_CLASS : ANIMATION_OUT_CLASS).split(' ');
|
||||
for(var i = 0; i < out_classes.length; i++)
|
||||
$outpage.classList.remove(out_classes[i]);
|
||||
if( $outpage != $inpage)
|
||||
$outpage.classList.remove('momo-page-current');
|
||||
var in_classes = ANIMATION_IN_CLASS.split(' ');
|
||||
if($outpage != $inpage)
|
||||
$outpage.classList.remove('momo-page-current');
|
||||
var in_classes = (back ? ANIMATION_BACK_IN_CLASS : ANIMATION_IN_CLASS).split(' ');
|
||||
for(var i = 0; i < in_classes.length; i++)
|
||||
$inpage.classList.remove(in_classes[i]);
|
||||
app.isAnimating = false;
|
||||
|
@ -247,13 +251,31 @@ var app = {
|
|||
window.addEventListener('hashchange', this.onHashChange, false);
|
||||
},
|
||||
|
||||
|
||||
onHashChange: function(e) {
|
||||
var back = false;
|
||||
var hash = window.location.hash, length = window.history.length;
|
||||
var page = window.location.hash.slice(1);
|
||||
|
||||
if (app.hashHistory.length && app.historyLength == length) {
|
||||
if (app.hashHistory[app.hashHistory.length - 2] == hash) {
|
||||
app.hashHistory = app.hashHistory.slice(0, -1);
|
||||
back = true;
|
||||
} else {
|
||||
app.hashHistory.push(hash);
|
||||
}
|
||||
} else {
|
||||
app.hashHistory.push(hash);
|
||||
app.historyLength = length;
|
||||
}
|
||||
|
||||
if(!app.pages.hasOwnProperty(page)){
|
||||
page = 'home';
|
||||
}
|
||||
if(app.current_page != page)
|
||||
app.navigate(page);
|
||||
|
||||
if(app.current_page != page){
|
||||
app.navigate(page, back);
|
||||
}
|
||||
},
|
||||
|
||||
onDeviceReady: function() {
|
||||
|
|
Reference in New Issue