Skip to content
This repository was archived by the owner on Apr 16, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/af.lockscreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* Copyright 2015 - Intel
*/

/* global FastClick*/
/** global FastClick **/

/* jshint camelcase:false*/
/** jshint camelcase:false **/


(function($){
Expand Down Expand Up @@ -86,7 +86,7 @@
$(item).on("touchstart",function(evt){
$(evt.target).addClass("touched");
}).on("touchend",function(evt){
$(evt.target).removeClass("touched");
$(evt.target).removeClass("touched");
});
},
hide:function(){
Expand Down
2 changes: 1 addition & 1 deletion src/af.swipereveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
target=$(e.target).closest(".swipe-content");

width=target.closest(".swipe-reveal").find(".swipe-hidden").width();
if ($(e.target).parents('.swipe-content').length===0) {
if ($(e.target).parents(".swipe-content").length===0) {
if($.getCssMatrix(e.target).e===0)
return ;
}
Expand Down
100 changes: 66 additions & 34 deletions src/af.ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,13 @@
id = "#" + that.firstPanel.id;
if (id === "") return;
if ($(id).filter(".panel").length === 0) return;

if (id !== "#" + that.activeDiv.id) that.goBack();
if (id !== "#" + that.activeDiv.id) {
//Make a custom event object for goBack
var evt = {
"target" : $(id)
};
that.goBack(evt);
}

}, false);

Expand Down Expand Up @@ -376,27 +381,39 @@
*/
goBack: function(e) {
//find the view
var view=$(this.activeDiv).closest(".view");
if(e&&e.target)
view=$(e.target).closest(".view");
var isSameView = true;
var currentView=$(this.activeDiv).closest(".view");
var targetView=currentView;
if(e&&e.target) {
targetView=$(e.target).closest(".view");
isSameView = targetView.prop("id") === (currentView.prop("id"));
}

if(view.length===0) return;
if(targetView.length===0) return;

//history entry
if(!this.views[view.prop("id")]) return;
var hist=this.views[view.prop("id")];
if(!this.views[targetView.prop("id")]) return;
var hist=this.views[targetView.prop("id")];

if(hist.length===0) return;
var item=hist.pop();

//If not in same view, just push back to keep last states
if (!isSameView) {
hist.push(item);
}
if(item.length===0) return;
if(hist.length>0){

var toTarget=hist[hist.length-1].target;
if(!toTarget||item.target===toTarget) return;
this.runTransition(item.transition,item.target,toTarget,true);
this.loadContentData(toTarget,view,true);

var toTarget = hist[hist.length-1].target;
if(!toTarget) return;
if(isSameView && (item.target===toTarget)) return;
if (!isSameView) {
this.clearHistory(); //Clear current view history
this.runViewTransition(this.transitionType, targetView, currentView, item.target, true);
}
else {
this.runTransition(item.transition, item.target, toTarget, true);
}
this.loadContentData(toTarget, targetView, true);
this.updateHash(toTarget.id);
}
else {
Expand Down Expand Up @@ -609,9 +626,9 @@
var self = this;
//set another timeout to auto-hide the mask if something goes wrong after 15 secs
setTimeout(function() {
if(self.showingMask) {
if(self.showingMask) {
self.hideMask();
}
}
}, 15000);
},
/**
Expand Down Expand Up @@ -843,6 +860,11 @@
//Add the back button if it's not there
if(hdr.find(".backButton").length===1) return;
hdr.prepend("<a class='backButton back'>" + this.backButtonText + "</a>");
//Fix device click no response issue
hdr.on("click", ".backButton", function() {
if(this.useInternalRouting)
this.goBack(this);
});
}
else {
hdr.find(".backButton").remove();
Expand Down Expand Up @@ -933,58 +955,69 @@
doPush=true;
}


$(show).css("zIndex","10");
$(hide).css("zIndex","1");
$(noTrans).css("zIndex","1").addClass("active");

var from=$(hide).animation().remove(transition+"-in");
if(!doPush&&from){
if(back)
if(back) {
from.reverse();
}
from.end(function(){
if(!back){
this.classList.remove("active");
$(this).trigger("panelunload");
//If 'this' is view, then find active panel and remove active from it
var activePanel = $(this).find(".active").get(0);
if (undefined !== activePanel) {
activePanel.classList.remove("active");
}
$(this).trigger("panelunload", [back]);
}
else{

this.classList.add("active");
$(this).trigger("panelload");
$(this).trigger("panelload", [back]);
}
that.doingTransition=false;
}).run(transition+"-out");
}
else {
if(!back){
$(hide).trigger("panelunload");
//If 'hide' is view, then find active panel and remove active from it
var activePanel = $(hide).find(".active").get(0);
if (undefined !== activePanel) {
activePanel.classList.remove("active");
}
$(hide).trigger("panelunload", [back]);
}
else{
$(hide).trigger("panelload");
$(hide).addClass("activeDiv");

$(hide).trigger("panelload", [back]);
$(hide).addClass("active");
}
}

var to=$(show).animation().remove(transition+"-out");
if(back)
if(back) {
to.reverse();
}
to.end(function(){
that.doingTransition=false;
if(!back){

this.classList.add("active");
$(this).trigger("panelload");
$(noTrans).trigger("panelload");
$(this).trigger("panelload", [back]);
$(noTrans).trigger("panelload", [back]);
}
else{
if(noTrans){
$(noTrans).css("zIndex","10");

}

this.classList.remove("active");
$(this).trigger("panelunload");
//If 'hide' is view, then find active panel and remove active from it
var activePanel = $(this).find(".active").get(0);
if (undefined !== activePanel) {
activePanel.classList.remove("active");
}
$(this).trigger("panelunload", [back]);
}
}).run(transition+"-in");
},
Expand All @@ -1001,7 +1034,6 @@
//find the active

view.addClass("active");
//view.find(".panel").removeClass("active");
$(newDiv).addClass("active");

if(transition==="none"){
Expand Down