diff --git a/build/appframework.ui.js b/build/appframework.ui.js index 99b22b5d9..34ab8207c 100644 --- a/build/appframework.ui.js +++ b/build/appframework.ui.js @@ -1,4 +1,4 @@ -/*! intel-appframework - v3.0.0 - 2016-03-24 */ +/*! intel-appframework - v3.0.0 - 2016-03-26 */ /** * af.shim.js @@ -929,19 +929,20 @@ window.af=window.jq=jQuery; * @param {string=} text * @title $.afui.showMask(text); */ - showMask: function(text) { + showMask: function(text, value) { if (!text) text = this.loadingText || ""; + if (!value || typeof value !== "number") timeout = 15000; $.query("#afui_mask>h1").html(text); $.query("#afui_mask").show(); this.showingMask = true; var self = this; - //set another timeout to auto-hide the mask if something goes wrong after 15 secs + //set another timeout to auto-hide the mask if something goes wrong, default is 15 sec setTimeout(function() { if(self.showingMask) { self.hideMask(); } - }, 15000); + }, value); }, /** * Hide the loading mask @@ -1315,7 +1316,8 @@ window.af=window.jq=jQuery; tmpActive.classList.remove("active"); } - $(hide).trigger("panelunload", [back]); + //fix #903 + //$(hide).trigger("panelunload", [back]); } else{ if(noTrans){ diff --git a/build/appframework.ui.min.js b/build/appframework.ui.min.js index 358ac77c8..b2112f6bb 100644 --- a/build/appframework.ui.min.js +++ b/build/appframework.ui.min.js @@ -1,4 +1,4 @@ -/*! intel-appframework - v3.0.0 - 2016-03-24 */ +/*! intel-appframework - v3.0.0 - 2016-03-26 */ /* Intel 2014 @@ -21,90 +21,90 @@ */ (function(a,h){function g(a,c){if(a)if(a.nodeType)c[c.length++]=a;else for(var d=0,b=a.length;dd.clientHeight,f="touch"=== -a(d).computedStyle("-webkit-overflow-scrolling"),e="hidden"!==a(d).computedStyle("overflowY"),k=parseInt(a(d).computedStyle("height"),10);b&&(f&&e)&&(b=c.touches[0].screenY,k=this._startTouchY>=b&&d.scrollHeight-d.scrollTop===k,(this._startTouchY<=b&&0===d.scrollTop||k)&&c.preventDefault())}},registerDataDirective:function(a,d){b.push({sel:a,cb:d})},enableTabBar:function(){a(document).on("click",".button-grouped.tabbed",function(c){var d=a(c.target);d.closest(".tabbed").find(".button").data("ignore-pressed", +(!1===c?(window.removeEventListener("touchmove",this.handlePageBounce,!1),window.removeEventListener("touchstart",this.handlePageBounce,!1)):(window.addEventListener("touchmove",this.handlePageBounce,!1),window.addEventListener("touchstart",this.handlePageBounce,!1)))},handlePageBounce:function(c){if("touchstart"===c.type)this._startTouchY=c.touches[0].screenY;else{var d=a(c.target).closest(".panel");if(0===d.length)return c.preventDefault();var d=d.get(0),b=d.scrollHeight>d.clientHeight,l="touch"=== +a(d).computedStyle("-webkit-overflow-scrolling"),f="hidden"!==a(d).computedStyle("overflowY"),e=parseInt(a(d).computedStyle("height"),10);b&&l&&f&&(b=c.touches[0].screenY,e=this._startTouchY>=b&&d.scrollHeight-d.scrollTop===e,(this._startTouchY<=b&&0===d.scrollTop||e)&&c.preventDefault())}},registerDataDirective:function(a,d){b.push({sel:a,cb:d})},enableTabBar:function(){a(document).on("click",".button-grouped.tabbed",function(c){var d=a(c.target);d.closest(".tabbed").find(".button").data("ignore-pressed", "true").removeClass("pressed");d.closest(".button").addClass("pressed");setTimeout(function(){d.closest(".button").addClass("pressed")})})},disableTabBar:function(){a(document).off("click",".button-grouped.tabbed");a(".button-grouped.tabbed .button").removeAttr("data-ignore-pressed")},manageHistory:!0,loadDefaultHash:!0,actionsheet:function(c){return a.query(document.body).actionsheet(c)},popup:function(c){return a.query(document.body).popup(c)},blockUI:function(c){a.blockUI(c)},unblockUI:function(){a.unblockUI()}, -autoLaunch:!0,ready:function(c){if(this.launchCompleted)c();else a(document).one("afui:ready",function(){c()})},goBack:function(c){var d=!0,b=a(this.activeDiv).closest(".view"),f=b;c&&c.target&&(f=a(c.target).closest(".view"),d=f.prop("id")===b.prop("id"));if(0!==f.length&&this.views[f.prop("id")]){var e=this.views[f.prop("id")];if(0!==e.length&&(c=e.pop(),d||e.push(c),0!==c.length))if(0h1").html(c);a.query("#afui_mask").show();this.showingMask=!0;var d=this;setTimeout(function(){d.showingMask&&d.hideMask()}, -15E3)},hideMask:function(){a.query("#afui_mask").hide();this.showingMask=!1},dismissView:function(c,d){d=d.replace(":dismiss","");var b=a(c).closest(".view");this.runTransition(d,b,null,!0,a(c.hash).addClass("active").closest(".view"));this.activeDiv=a(".view").not(b).find(".panel.active").get(0);this.updateHash(this.activeDiv.id)},loadContent:function(a,d,b,e,f){this.doingTransition||(f=f||document.createElement("a"),0!==a.length&&(-1!==a.indexOf("#")?this.loadDiv(a,d,b,e,f):this.loadAjax(a,d,b, -e,f)))},loadDiv:function(c,d,b,f,e){var k=c,g=k.indexOf("#"),h=k.indexOf("/");-1!==h&&-1!==g&&h>g&&(k=k.substr(0,h));k=k.replace("#","");if(k=a.query("#"+k).get(0))if(k===this.activeDiv&&!b)this.doingTransition=!1;else{this.transitionType=f;var g=this.findViewTarget(k),h=this.findPreviousPanel(k,g),p=(e=e?this.findViewTarget(e):this.findViewTarget(this.activeDiv))&&e.get(0)!==g.get(0)&&e.closest(".splitview").get(0)===g.closest(".splitview").get(0)&&0!==e.closest(".splitview").length;p&&(d=!1);a(k).trigger("panelbeforeload"); -a(h).trigger("panelbeforeunload");var s=!1;p||(p=1===e.parent().closest(".view").length);p&&(e&&e.get(0)!==g.get(0))&&a(e).trigger("nestedviewunload");!p&&(d||e&&e.get(0)!==g.get(0))?(this.runViewTransition(f,g,e||d,k,b),this.updateViewHistory(g,k,f,c),s=!0):(this.runTransition(f,h,k,b),this.updateViewHistory(g,k,f,c));this.loadContentData(k,g,!1,s)}else a(document).trigger("missingpanel",null,{missingTarget:c}),this.doingTransition=!1},findViewTarget:function(c){c=a(c).closest(".view");if(!c)return!1; -this.views[c.prop("id")]||(this.views[c.prop("id")]=[]);return c},findPreviousPanel:function(c,d){var b=a(d).find(">.pages .panel.active").not(c);0===b.length&&(b=a(d).find(">.pages .panel:first-of-type"));return b.get(0)},loadContentData:function(a,d,b,e){this.activeDiv=a;this.setTitle(a,d,b,e);this.showBackButton(d,e);this.setActiveTab(a,d)},setActiveTab:function(c,d){var b;"string"!==typeof c&&(b=a(c).prop("id"));if(!(0===d.find("footer").find("a").filter("[href='"+b+"']").length&&0===d.find("footer").find("a").filter("[href='#"+ -b+"']").length)){var e=d.find("footer").find("a").removeClass("pressed").attr("data-ignore-pressed","true");e.filter("[href='"+b+"']").addClass("pressed");e.filter("[href='#"+b+"']").addClass("pressed")}},showBackButton:function(a,d){var b=this.views[a.prop("id")].length,e=a.children("header");0!==e.length&&(2<=b&&!0!==d?1!==e.find(".backButton").length&&e.prepend(""+this.backButtonText+""):e.find(".backButton").remove())},loadAjax:function(c,d,b,f,g){var k=this,h=e(c), -n=a(".panel[data-crc='"+h+"']"),p=g.getAttribute("data-refresh");if(0

Loading Content

"}).css({"z-index":2E4,display:"none"});document.body.appendChild(d.get(0));d=a(".view[data-default='true']");if(0===d.length&&(d=a(".view").eq(0), -0===d.length))throw"You need to create a view";d.addClass("active");this.views[d.prop("id")]=[];var e=window.location.hash,g=0===d.find(".panel[data-selected='true']").length?d.find(".panel").eq(0):d.find(".panel[data-selected='true']");g.addClass("active");this.activeDiv=g.get(0);this.views[d.prop("id")].push({target:g.get(0),transition:this.transitionType});this.defaultPanel=g.get(0);this.loadContentData(g.get(0),d,!1,!0);this.updateHash(g.get(0).id);this.loadDefaultHash&&setTimeout(function(){this.loadContent(e, -!1,0,"none")}.bind(this));this.enableTabBar();a(document).on("click","a",function(a){c.useInternalRouting&&f(a,a.currentTarget)});a(document).on("click",function(d){for(var e=b.length,f=a(d.target),g=0;gh1").html(c);a.query("#afui_mask").show();this.showingMask=!0;var b=this;setTimeout(function(){b.showingMask&& +b.hideMask()},d)},hideMask:function(){a.query("#afui_mask").hide();this.showingMask=!1},dismissView:function(c,d){d=d.replace(":dismiss","");var b=a(c).closest(".view");this.runTransition(d,b,null,!0,a(c.hash).addClass("active").closest(".view"));this.activeDiv=a(".view").not(b).find(".panel.active").get(0);this.updateHash(this.activeDiv.id)},loadContent:function(a,d,b,f,e){this.doingTransition||(e=e||document.createElement("a"),0!==a.length&&(-1!==a.indexOf("#")?this.loadDiv(a,d,b,f,e):this.loadAjax(a, +d,b,f,e)))},loadDiv:function(c,d,b,f,e){var k=c,g=k.indexOf("#"),h=k.indexOf("/");-1!==h&&-1!==g&&h>g&&(k=k.substr(0,h));k=k.replace("#","");if(k=a.query("#"+k).get(0))if(k!==this.activeDiv||b){this.transitionType=f;var g=this.findViewTarget(k),h=this.findPreviousPanel(k,g),q=(e=e?this.findViewTarget(e):this.findViewTarget(this.activeDiv))&&e.get(0)!==g.get(0)&&e.closest(".splitview").get(0)===g.closest(".splitview").get(0)&&0!==e.closest(".splitview").length;q&&(d=!1);a(k).trigger("panelbeforeload"); +a(h).trigger("panelbeforeunload");var t=!1;q||(q=1===e.parent().closest(".view").length);q&&e&&e.get(0)!==g.get(0)&&a(e).trigger("nestedviewunload");!q&&(d||e&&e.get(0)!==g.get(0))?(this.runViewTransition(f,g,e||d,k,b),this.updateViewHistory(g,k,f,c),t=!0):(this.runTransition(f,h,k,b),this.updateViewHistory(g,k,f,c));this.loadContentData(k,g,!1,t)}else this.doingTransition=!1;else a(document).trigger("missingpanel",null,{missingTarget:c}),this.doingTransition=!1},findViewTarget:function(c){c=a(c).closest(".view"); +if(!c)return!1;this.views[c.prop("id")]||(this.views[c.prop("id")]=[]);return c},findPreviousPanel:function(c,d){var b=a(d).find(">.pages .panel.active").not(c);0===b.length&&(b=a(d).find(">.pages .panel:first-of-type"));return b.get(0)},loadContentData:function(a,d,b,e){this.activeDiv=a;this.setTitle(a,d,b,e);this.showBackButton(d,e);this.setActiveTab(a,d)},setActiveTab:function(c,d){var b;"string"!==typeof c&&(b=a(c).prop("id"));if(0!==d.find("footer").find("a").filter("[href='"+b+"']").length|| +0!==d.find("footer").find("a").filter("[href='#"+b+"']").length){var e=d.find("footer").find("a").removeClass("pressed").attr("data-ignore-pressed","true");e.filter("[href='"+b+"']").addClass("pressed");e.filter("[href='#"+b+"']").addClass("pressed")}},showBackButton:function(a,d){var b=this.views[a.prop("id")].length,e=a.children("header");0!==e.length&&(2<=b&&!0!==d?1!==e.find(".backButton").length&&e.prepend(""+this.backButtonText+""):e.find(".backButton").remove())}, +loadAjax:function(c,d,b,e,g){var k=this,h=f(c),n=a(".panel[data-crc='"+h+"']"),q=g.getAttribute("data-refresh");if(0

Loading Content

"}).css({"z-index":2E4,display:"none"});document.body.appendChild(d.get(0));d=a(".view[data-default='true']");if(0===d.length&&(d=a(".view").eq(0), +0===d.length))throw"You need to create a view";d.addClass("active");this.views[d.prop("id")]=[];var f=window.location.hash,g=0===d.find(".panel[data-selected='true']").length?d.find(".panel").eq(0):d.find(".panel[data-selected='true']");g.addClass("active");this.activeDiv=g.get(0);this.views[d.prop("id")].push({target:g.get(0),transition:this.transitionType});this.defaultPanel=g.get(0);this.loadContentData(g.get(0),d,!1,!0);this.updateHash(g.get(0).id);this.loadDefaultHash&&setTimeout(function(){this.loadContent(f, +!1,0,"none")}.bind(this));this.enableTabBar();a(document).on("click","a",function(a){c.useInternalRouting&&e(a,a.currentTarget)});a(document).on("click",function(d){for(var e=b.length,f=a(d.target),g=0;g>>8^e;return(b^-1)>>>0};a.afui=new g;a.afui.init=!0;a(window).trigger("afui:preinit");a(window).trigger("afui:init")})(jQuery); -(function(a){a.fn.actionsheet=function(a){for(var b,f=0;f
"+b+"Cancel
");else if("object"=== -typeof b){e=a("
");var c=a(e.children().get(0));b.push({text:"Cancel",cssClasses:"cancel"});for(var d=0;d"+(b[d].text||"TEXT NOT ENTERED")+"");m[0].onclick=b[d].handler||f;b[d].cssClasses&&0");setTimeout(function(){e.vendorCss("Transition","all 300ms");e.cssTranslate("0,0")},10);a("#af_action_mask").bind("touchstart touchmove touchend click",function(a){a.preventDefault();a.stopPropagation()})}else window.alert("Could not find element for actionsheet "+ +(function(a){a.fn.actionsheet=function(a){for(var b,e=0;e
"+b+"Cancel
");else if("object"=== +typeof b){f=a("
");var c=a(f.children().get(0));b.push({text:"Cancel",cssClasses:"cancel"});for(var d=0;d"+(b[d].text||"TEXT NOT ENTERED")+"");m[0].onclick=b[d].handler||e;b[d].cssClasses&&0");setTimeout(function(){f.vendorCss("Transition","all 300ms");f.cssTranslate("0,0")},10);a("#af_action_mask").bind("touchstart touchmove touchend click",function(a){a.preventDefault();a.stopPropagation()})}else window.alert("Could not find element for actionsheet "+ g)};h.prototype={activeSheet:null,sheetClickHandler:function(){this.hideSheet();return!1},hideSheet:function(){this.activeSheet.off("click","a",this.sheetClickHandler);a(this.el).find("#af_action_mask").unbind("click").remove();this.activeSheet.vendorCss("Transition","all 0ms");var g=this.activeSheet,b=this.el;setTimeout(function(){g.vendorCss("Transition","all 300ms");g.cssTranslate("0,"+(g.height()+60)+"px");setTimeout(function(){g.remove();g=null;b.style.overflow="none"},350)},10)}};a.afui.actionsheet= function(g){return a(document.body).actionsheet(g)}})(jQuery); -(function(a){a.afui.registerDataDirective("[data-grower]",function(h,g){var b=a(h).closest("[data-grower]"),f=b.offset(),e=b.closest(".view"),c=g.target.hash||b.attr("data-grower");e.css("zIndex","1");var d=a(c).closest(".view"),m=b.width()/window.innerWidth,l=b.height()/window.innerHeight,q={left:f.left,top:f.top,x:m,y:l};a(c).trigger("panelgrowstart",[b.get(0)]);d.addClass("active").css("zIndex","10");d.vendorCss("TransformOrigin","0 0");d.data("growTransProps",q);d.vendorCss("TransitionDuration", -"0");d.vendorCss("Transform","translate3d("+f.left+"px,"+f.top+"px,0) scale("+m+","+l+")");d.data("growTarget",b.closest(".panel"));d.data("growFrom",a(c).attr("id"));a.afui.loadContent(c,e,!1,"stretch");a(c).one("panelload",function(){d.vendorCss("Transform","");a(c).trigger("panelgrowcomplete",[b.get(0)])})});a.afui.registerDataDirective("[data-grower-back]",function(h){var g=a(h).closest(".view"),b=a("#"+g.data("growFrom"));b.trigger("panelgrowendstart");h=g.data("growTransProps");var f="#"+g.data("growTarget").prop("id"); -a(f).closest(".view").addClass("active");g.addClass("animation-active");g.transition().end(function(){g.removeClass("active");b.trigger("panelgrowendstart");a.afui.loadContent(f,!1,!1,"none")}).run("translate3d("+h.left+"px,"+h.top+"px,0) scale("+h.x+","+h.y+")","300ms")})})(jQuery); -(function(a){function h(a,c,b,e){var f=Math.abs(a-c),d=Math.abs(b-e);return f>=d?0=e&&(b.el.trigger("longTap"),b={})}var b={},f,e=750,c,d=!1,m=!1;a(document).ready(function(){var l;a(document.body).bind("touchstart",function(h){h.originalEvent&&(h=h.originalEvent);if(h.touches&&0!==h.touches.length){var k=Date.now(),r=k-(b.last||k);h.touches&&0!==h.touches.length&&(b.el=a("tagName"in h.touches[0].target?h.touches[0].target: -h.touches[0].target.parentNode),f&&clearTimeout(f),b.x1=h.touches[0].pageX,b.y1=h.touches[0].pageY,b.x2=b.y2=0,0=r&&(b.isDoubleTap=!0),b.last=k,c=setTimeout(g,e),a.afui.useAutoPressed&&!b.el.attr("data-ignore-pressed")&&b.el.addClass("pressed"),l&&(a.afui.useAutoPressed&&!l.attr("data-ignore-pressed")&&l[0]!==b.el[0])&&l.removeClass("pressed"),l=b.el,m=d=!1)}}).bind("touchmove",function(e){e.originalEvent&&(e=e.originalEvent);b.x2=e.touches[0].pageX;b.y2=e.touches[0].pageY;if(!m&&(5"+f+""), -b.append(c),c.animation().end(function(){a(this).remove()}).run(e)))}:h}})(jQuery); -(function(a){a.fn.popup=function(a){return new g(this[0],a)};var h=[],g=function(b,e){if(this.container="string"===typeof b||b instanceof String?document.getElementById(b):b)try{if("string"===typeof e||"number"===typeof e)e={message:e,cancelOnly:"true",cancelText:"OK"};this.id=e.id=e.id||a.uuid();this.addCssClass=e.addCssClass?e.addCssClass:"";this.suppressTitle=e.suppressTitle||this.suppressTitle;this.title=e.suppressTitle?"":e.title||"Alert";this.message=e.message||"";this.cancelText=e.cancelText|| -"Cancel";this.cancelCallback=e.cancelCallback||function(){};this.cancelClass=e.cancelClass||"button";this.doneText=e.doneText||"Done";this.doneCallback=e.doneCallback||function(){};this.doneClass=e.doneClass||"button";this.cancelOnly=e.cancelOnly||!1;this.onShow=e.onShow||function(){};this.autoCloseDone=void 0!==e.autoCloseDone?e.autoCloseDone:!0;h.push(this);1===h.length&&this.show()}catch(c){console.log("error adding popup "+c)}else window.alert("Error finding container for popup "+b)};g.prototype= -{id:null,addCssClass:null,title:null,message:null,cancelText:null,cancelCallback:null,cancelClass:null,doneText:null,doneCallback:null,doneClass:null,cancelOnly:!1,onShow:null,autoCloseDone:!0,suppressTitle:!1,show:function(){var b=this,e=a("");a(this.container).append(e);e.bind("close",function(){b.hide()});this.cancelOnly&&(e.find("A#action").hide(),e.find("A#cancel").addClass("center"));e.find("A").each(function(){var c=a(this);c.bind("click",function(a){"cancel"===c.attr("id")?(b.cancelCallback.call(b.cancelCallback,b),b.hide()):(b.doneCallback.call(b.doneCallback,b),b.autoCloseDone&&b.hide());a.preventDefault()})});b.positionPopup();a.blockUI(0.5);e.bind("orientationchange", -function(){b.positionPopup()});e.find("header").show();e.find("footer").show();setTimeout(function(){e.removeClass("hidden").addClass("show");b.onShow(b)},50)},hide:function(){var b=this;a.query("#"+b.id).addClass("hidden");a.unblockUI();!a.os.ie&&!a.os.android?setTimeout(function(){b.remove()},250):b.remove()},remove:function(){var b=a.query("#"+this.id);b.unbind("close");b.find("BUTTON#action").unbind("click");b.find("BUTTON#cancel").unbind("click");b.unbind("orientationchange").remove();h.splice(0, -1);0")),a.query("BODY DIV#mask").bind("touchstart",function(a){a.preventDefault()}),a.query("BODY DIV#mask").bind("touchmove",function(a){a.preventDefault()}),b=!0)}; +(function(a){a.afui.registerDataDirective("[data-grower]",function(h,g){var b=a(h).closest("[data-grower]"),e=b.offset(),f=b.closest(".view"),c=g.target.hash||b.attr("data-grower");f.css("zIndex","1");var d=a(c).closest(".view"),m=b.width()/window.innerWidth,l=b.height()/window.innerHeight,p={left:e.left,top:e.top,x:m,y:l};a(c).trigger("panelgrowstart",[b.get(0)]);d.addClass("active").css("zIndex","10");d.vendorCss("TransformOrigin","0 0");d.data("growTransProps",p);d.vendorCss("TransitionDuration", +"0");d.vendorCss("Transform","translate3d("+e.left+"px,"+e.top+"px,0) scale("+m+","+l+")");d.data("growTarget",b.closest(".panel"));d.data("growFrom",a(c).attr("id"));a.afui.loadContent(c,f,!1,"stretch");a(c).one("panelload",function(){d.vendorCss("Transform","");a(c).trigger("panelgrowcomplete",[b.get(0)])})});a.afui.registerDataDirective("[data-grower-back]",function(h){var g=a(h).closest(".view"),b=a("#"+g.data("growFrom"));b.trigger("panelgrowendstart");h=g.data("growTransProps");var e="#"+g.data("growTarget").prop("id"); +a(e).closest(".view").addClass("active");g.addClass("animation-active");g.transition().end(function(){g.removeClass("active");b.trigger("panelgrowendstart");a.afui.loadContent(e,!1,!1,"none")}).run("translate3d("+h.left+"px,"+h.top+"px,0) scale("+h.x+","+h.y+")","300ms")})})(jQuery); +(function(a){function h(a,c,b,e){return Math.abs(a-c)>=Math.abs(b-e)?0=k&&(b.isDoubleTap=!0);b.last=p;f=setTimeout(g,750);a.afui.useAutoPressed&&!b.el.attr("data-ignore-pressed")&&b.el.addClass("pressed");m&&a.afui.useAutoPressed&&!m.attr("data-ignore-pressed")&&m[0]!==b.el[0]&&m.removeClass("pressed");m=b.el;d=c=!1}}}).bind("touchmove",function(e){e.originalEvent&&(e=e.originalEvent);b.x2=e.touches[0].pageX;b.y2=e.touches[0].pageY;if(!d&&(5"+e+""), +b.append(c),c.animation().end(function(){a(this).remove()}).run(f)))}:h}})(jQuery); +(function(a){a.fn.popup=function(a){return new g(this[0],a)};var h=[],g=function(b,f){if(this.container="string"===typeof b||b instanceof String?document.getElementById(b):b)try{if("string"===typeof f||"number"===typeof f)f={message:f,cancelOnly:"true",cancelText:"OK"};this.id=f.id=f.id||a.uuid();this.addCssClass=f.addCssClass?f.addCssClass:"";this.suppressTitle=f.suppressTitle||this.suppressTitle;this.title=f.suppressTitle?"":f.title||"Alert";this.message=f.message||"";this.cancelText=f.cancelText|| +"Cancel";this.cancelCallback=f.cancelCallback||function(){};this.cancelClass=f.cancelClass||"button";this.doneText=f.doneText||"Done";this.doneCallback=f.doneCallback||function(){};this.doneClass=f.doneClass||"button";this.cancelOnly=f.cancelOnly||!1;this.onShow=f.onShow||function(){};this.autoCloseDone=void 0!==f.autoCloseDone?f.autoCloseDone:!0;h.push(this);1===h.length&&this.show()}catch(c){console.log("error adding popup "+c)}else window.alert("Error finding container for popup "+b)};g.prototype= +{id:null,addCssClass:null,title:null,message:null,cancelText:null,cancelCallback:null,cancelClass:null,doneText:null,doneCallback:null,doneClass:null,cancelOnly:!1,onShow:null,autoCloseDone:!0,suppressTitle:!1,show:function(){var b=this,f=a("");a(this.container).append(f);f.bind("close",function(){b.hide()});this.cancelOnly&&(f.find("A#action").hide(),f.find("A#cancel").addClass("center"));f.find("A").each(function(){var c=a(this);c.bind("click",function(a){"cancel"===c.attr("id")?(b.cancelCallback.call(b.cancelCallback,b),b.hide()):(b.doneCallback.call(b.doneCallback,b),b.autoCloseDone&&b.hide());a.preventDefault()})});b.positionPopup();a.blockUI(.5);f.bind("orientationchange", +function(){b.positionPopup()});f.find("header").show();f.find("footer").show();setTimeout(function(){f.removeClass("hidden").addClass("show");b.onShow(b)},50)},hide:function(){var b=this;a.query("#"+b.id).addClass("hidden");a.unblockUI();a.os.ie||a.os.android?b.remove():setTimeout(function(){b.remove()},250)},remove:function(){var b=a.query("#"+this.id);b.unbind("close");b.find("BUTTON#action").unbind("click");b.find("BUTTON#cancel").unbind("click");b.unbind("orientationchange").remove();h.splice(0, +1);0")),a.query("BODY DIV#mask").bind("touchstart",function(a){a.preventDefault()}),a.query("BODY DIV#mask").bind("touchmove",function(a){a.preventDefault()}),b=!0)}; a.unblockUI=function(){b=!1;a.query("BODY DIV#mask").unbind("touchstart");a.query("BODY DIV#mask").unbind("touchmove");a("BODY DIV#mask").remove()};a.afui.registerDataDirective("[data-alert]",function(b){b=a(b).attr("data-message");0!==b.length&&a(document.body).popup(b)});a.afui.popup=function(b){return a(document.body).popup(b)}})(jQuery); (function(a){function h(a){this.element=a;this.element.classList.remove("animation-reverse");this.keepClass=!1}function g(a){this.element=a;this.element}a.fn.animation=function(){var a=this;this.each(function(){a=new h(this)});return a};var b=function(a){this.element.removeEventListener("webkitAnimationEnd",this.endCBCache,!1);this.element.removeEventListener("animationend",this.endCBCache,!1);this.element.removeEventListener("MSAnimationEnd",this.endCBCache,!1);this.endcb&&this.endcb.call(this.element, a);this.element.classList.remove("animation-reverse");this.element.classList.remove("animation-active");this.keepClass||this.element.classList.remove(this.animClass)};h.prototype={element:null,animClass:null,runEnd:!1,keepClass:!1,keep:function(){this.keepClass=!0;return this},remove:function(a){this.element.classList.remove(a);this.element.offsetWidth=this.element.offsetWidth;return this},endCBCache:null,run:function(a,c){this.runEnd=!1;this.element.classList.add("animation-active");this.element.offsetWidth= -this.element.offsetWidth;this.element.classList.add(a);this.animClass=a;var d=window.getComputedStyle(this.element,null),f=d.animation-c;f||(f=d.animationDuration);f||(f=d.MozAnimationDuration);f||(f=d.webkitAnimationDuration);f=parseFloat(f);if(0.01>=f||isNaN(f))this.runEnd=!0;this.endCBCache=b.bind(this);if(this.runEnd)return this.endCBCache(),this;this.element.addEventListener("webkitAnimationEnd",this.endCBCache,!1);this.element.addEventListener("animationend",this.endCBCache,!1);this.element.addEventListener("MSAnimationEnd", -this.endCBCache,!1);return this},reverse:function(){this.element.classList.add("animation-reverse");return this},reRun:function(a){this.remove(a);return this.run(a)},endcb:function(){},end:function(a){this.endcb=a;return this}};a.fn.transition=function(){var a=this;this.each(function(){a=new g(this)});return a};var f=function(b){clearTimeout(this.timer);this.element.removeEventListener("webkitTransitionEnd",this.endCBCache,!1);this.element.removeEventListener("transitionend",this.endCBCache,!1);this.element.removeEventListener("MSTransitionEnd", -this.endCBCache,!1);this.endcb&&this.endcb.call(this.element,b);this.keepEnd||(a(this.element).vendorCss("TransitionDuration",""),a(this.element).vendorCss("Transform",""))};g.prototype={element:null,runEnd:!1,keepEnd:!1,keep:function(){this.keepEnd=!0;return this},endCBCache:null,timer:null,run:function(b,c){this.endCBCache=f.bind(this);this.element.addEventListener("webkitTransitionEnd",this.endCBCache,!1);this.element.addEventListener("transitionend",this.endCBCache,!1);this.element.addEventListener("MSTransitionEnd", +this.element.offsetWidth;this.element.classList.add(a);this.animClass=a;var d=window.getComputedStyle(this.element,null),e=d.animation-c;e||(e=d.animationDuration);e||(e=d.MozAnimationDuration);e||(e=d.webkitAnimationDuration);e=parseFloat(e);if(.01>=e||isNaN(e))this.runEnd=!0;this.endCBCache=b.bind(this);if(this.runEnd)return this.endCBCache(),this;this.element.addEventListener("webkitAnimationEnd",this.endCBCache,!1);this.element.addEventListener("animationend",this.endCBCache,!1);this.element.addEventListener("MSAnimationEnd", +this.endCBCache,!1);return this},reverse:function(){this.element.classList.add("animation-reverse");return this},reRun:function(a){this.remove(a);return this.run(a)},endcb:function(){},end:function(a){this.endcb=a;return this}};a.fn.transition=function(){var a=this;this.each(function(){a=new g(this)});return a};var e=function(b){clearTimeout(this.timer);this.element.removeEventListener("webkitTransitionEnd",this.endCBCache,!1);this.element.removeEventListener("transitionend",this.endCBCache,!1);this.element.removeEventListener("MSTransitionEnd", +this.endCBCache,!1);this.endcb&&this.endcb.call(this.element,b);this.keepEnd||(a(this.element).vendorCss("TransitionDuration",""),a(this.element).vendorCss("Transform",""))};g.prototype={element:null,runEnd:!1,keepEnd:!1,keep:function(){this.keepEnd=!0;return this},endCBCache:null,timer:null,run:function(b,c){this.endCBCache=e.bind(this);this.element.addEventListener("webkitTransitionEnd",this.endCBCache,!1);this.element.addEventListener("transitionend",this.endCBCache,!1);this.element.addEventListener("MSTransitionEnd", this.endCBCache,!1);a(this.element).vendorCss("TransitionDuration",c);a(this.element).vendorCss("Transform",b);this.timer=setTimeout(function(){this.endCBCache()}.bind(this),parseInt(c,10)+50);return this},endcb:function(){},end:function(a){this.endcb=a;return this}}})(jQuery);(function(a){a.afui.ready(function(){setTimeout(function(){a("#splashscreen").remove()},250)})})(jQuery); -(function(a){function h(){return this}var g=null,b,f={push:function(b,c,d){b=a(b).closest(".view").children().filter(":not(nav):not(aside)");d=d||g;for(var f=0;fa.afui.swipeThreshold&&(f=0);h.transition().keep().end(function(){h=f=null}).run("translate3d("+-f+"px,0px,0)","100ms")}))});var e=function(a){a=-(g-a.touches[0].pageX); -a<-f?a="-"+f:0a.afui.swipeThreshold&&(e=0);h.transition().keep().end(function(){h=e=null}).run("translate3d("+-e+"px,0px,0)","100ms")})});var f=function(a){a=-(g-a.touches[0].pageX); +a<-e?a="-"+e:0");this.container=this.container.find(".afToastContainer");this.container.removeClass("tr br tl bl tc bc").addClass(this.addCssClass);!1===f.autoClose&&(this.autoClose=!1);this.show()}else window.alert("Error finding container for toast "+b)};g.prototype={addCssClass:null,message:null,delay:5E3,el:null,container:null,timer:null,autoClose:!0,show:function(){var b=this;this.el=a("
"+this.message+"
").get(0); -this.container.append(this.el);var f=a(this.el),e=this.el.clientHeight;f.addClass("hidden");setTimeout(function(){f.css("height",e);f.removeClass("hidden")},20);this.autoClose&&(this.timer=setTimeout(function(){b.hide()},this.delay));f.bind("click",function(){b.hide()})},hide:function(){var b=this;clearTimeout(this.timer);a(this.el).unbind("click").addClass("hidden");a(this.el).css("height","0px");!a.os.ie&&!a.os.android?setTimeout(function(){b.remove()},300):b.remove()},remove:function(){a(this.el).remove()}}; -return g}();a.afui.toast=function(g){a(document.body).toast(g)};a.afui.registerDataDirective("[data-toast]",function(g){var b=a(g);g=b.attr("data-message")||"";if(0!==g.length){var f=b.attr("data-position")||"tr",e=b.attr("data-type"),c="false"===b.attr("data-auto-close")?!1:!0,b=b.attr("data-delay")||0;g={message:g,position:f,delay:b,autoClose:c,type:e};a(document.body).toast(g)}})})(jQuery); -(function(a){a.fn.lockScreen=function(a){for(var b,f=0;f",roundKeyboard:!1,validatePassword:function(){},renderKeyboard:function(){for(var a="",b=0;8>b;b+=3){for(var a=a+"
",f=1;3>=f;f++)var e=b+f,a=a+("
"+e+"
");a+="
"}return a+"
 
0
<=
"}, -show:function(){if(!this.visible){var g="
"+this.logo+"
Invalid Password
",g=g+("
"+this.renderKeyboard()+"
"),b=a("
");b.html(g);this.roundKeyboard&&(b.addClass("round"),b.find("input[type='password']").attr("placeholder","\u25cc\u25cc\u25cc\u25cc"));this.lockscreen=b;a(document.body).append(b); -var f=a("#lockScreen input[type='password']"),e=this;a(b).on("click",function(b){b=a(b.target);if(0!==b.length&&(b=b.attr("data-key")))"delete"===b?f.val(f.val().substring(0,f.val().length-1)):(4>f.val().length&&f.val(f.val()+b),4===f.val().length&&(e.validatePassword(f.val())?e.hide():(e.lockscreen.find(".error").css("visibility","visible"),setTimeout(function(){e.lockscreen.find(".error").css("visibility","hidden");f.val("")},1E3))))});a(b).on("touchstart",function(b){a(b.target).addClass("touched")}).on("touchend", +b)),c=c.parentElement;d.dispatchEvent(f)},c=!1,d=null,m=0,l=0;window.navigator.msPointerEnabled?(document.addEventListener("MSPointerDown",function(a){c=!0;d=a.target;"a"===a.target.nodeName.toLowerCase()&&"javascript:;"===a.target.href.toLowerCase()&&(a.target.href="");f("touchstart",a,null,!0);h=!1;m=a.clientX;l=a.clientY;return!0},!0),document.addEventListener("MSPointerUp",function(a){if(c)return f("touchend",a,d,!0),d=null,c=!1,!0},!0),document.addEventListener("MSPointerMove",function(a){if(!(Math.abs(a.clientX- +m)<=b||Math.abs(a.clientY-l)<=b)&&c)return f("touchmove",a,d,!0),h=!0},!0)):(document.addEventListener("mousedown",function(a){c=!0;d=a.target;"a"===a.target.nodeName.toLowerCase()&&"javascript:;"===a.target.href.toLowerCase()&&(a.target.href="#");f("touchstart",a);h=!1;m=a.clientX;l=a.clientY},!0),document.addEventListener("mouseup",function(a){c&&(f("touchend",a,d),d=null,c=!1)},!0),document.addEventListener("mousemove",function(a){a.clientX===m&&a.clientY===l||!c||(f("touchmove",a,d),h=!0)},!0)); +document.addEventListener("drag",g,!0);document.addEventListener("dragstart",g,!0);document.addEventListener("dragenter",g,!0);document.addEventListener("dragover",g,!0);document.addEventListener("dragleave",g,!0);document.addEventListener("dragend",g,!0);document.addEventListener("drop",g,!0);document.addEventListener("selectstart",function(a){e(a,a.target)},!0);document.addEventListener("click",function(a){a.mouseToTouch||a.target!==d||g(a);h&&(g(a),h=!1)},!0)}})(jQuery,window); +(function(a){a.fn.toast=function(a){return new h(this[0],a)};var h=function(){var g=function(b,e){if(this.container="string"===typeof b||b instanceof String?document.getElementById(b):b){if("string"===typeof e||"number"===typeof e)e={message:e};this.addCssClass=e.addCssClass?e.addCssClass:"";this.message=e.message||"";this.delay=e.delay||this.delay;this.position=e.position||"";this.addCssClass+=" "+this.position;this.type=e.type||"";this.container=a(this.container);0===this.container.find(".afToastContainer").length&& +this.container.append("
");this.container=this.container.find(".afToastContainer");this.container.removeClass("tr br tl bl tc bc").addClass(this.addCssClass);!1===e.autoClose&&(this.autoClose=!1);this.show()}else window.alert("Error finding container for toast "+b)};g.prototype={addCssClass:null,message:null,delay:5E3,el:null,container:null,timer:null,autoClose:!0,show:function(){var b=this;this.el=a("
"+this.message+"
").get(0); +this.container.append(this.el);var e=a(this.el),f=this.el.clientHeight;e.addClass("hidden");setTimeout(function(){e.css("height",f);e.removeClass("hidden")},20);this.autoClose&&(this.timer=setTimeout(function(){b.hide()},this.delay));e.bind("click",function(){b.hide()})},hide:function(){var b=this;clearTimeout(this.timer);a(this.el).unbind("click").addClass("hidden");a(this.el).css("height","0px");a.os.ie||a.os.android?b.remove():setTimeout(function(){b.remove()},300)},remove:function(){a(this.el).remove()}}; +return g}();a.afui.toast=function(g){a(document.body).toast(g)};a.afui.registerDataDirective("[data-toast]",function(g){var b=a(g);g=b.attr("data-message")||"";if(0!==g.length){var e=b.attr("data-position")||"tr",f=b.attr("data-type"),c="false"===b.attr("data-auto-close")?!1:!0,b=b.attr("data-delay")||0;g={message:g,position:e,delay:b,autoClose:c,type:f};a(document.body).toast(g)}})})(jQuery); +(function(a){a.fn.lockScreen=function(a){for(var b,e=0;e
",roundKeyboard:!1,validatePassword:function(){},renderKeyboard:function(){for(var a="",b=0;8>b;b+=3){for(var a=a+"
",e=1;3>=e;e++)var f=b+e,a=a+("
"+f+"
");a+="
"}return a+"
 
0
<=
"}, +show:function(){if(!this.visible){var g;g="
"+this.logo+"
Invalid Password
"+("
"+this.renderKeyboard()+"
");var b=a("
");b.html(g);this.roundKeyboard&&(b.addClass("round"),b.find("input[type='password']").attr("placeholder","\u25cc\u25cc\u25cc\u25cc"));this.lockscreen=b;a(document.body).append(b); +var e=a("#lockScreen input[type='password']"),f=this;a(b).on("click",function(b){b=a(b.target);0!==b.length&&(b=b.attr("data-key"))&&("delete"===b?e.val(e.val().substring(0,e.val().length-1)):(4>e.val().length&&e.val(e.val()+b),4===e.val().length&&(f.validatePassword(e.val())?f.hide():(f.lockscreen.find(".error").css("visibility","visible"),setTimeout(function(){f.lockscreen.find(".error").css("visibility","hidden");e.val("")},1E3)))))});a(b).on("touchstart",function(b){a(b.target).addClass("touched")}).on("touchend", function(b){a(b.target).removeClass("touched")})}},hide:function(){this.lockscreen&&this.lockscreen.remove()}}})(jQuery); diff --git a/docs/af.ui.json b/docs/af.ui.json index a06e4f026..fcfa4406a 100644 --- a/docs/af.ui.json +++ b/docs/af.ui.json @@ -603,14 +603,17 @@ { "type": "param", "types": [ - "string=" + "string=", + "number=" ], "name": "text", - "description": "" + "description": "", + "name": "value", + "description": "maximum number of milliseconds to display the mask" }, { "type": "title", - "string": "$.afui.showMask(text);" + "string": "$.afui.showMask(text, value);" } ], "description": { @@ -1089,4 +1092,4 @@ "ignore": false, "code": "crc) {\n if (crc === undefined) crc = 0;\n var n = 0; //a number between 0 and 255\n var x = 0; //an hex number\n crc = crc ^ (-1);\n for (var i = 0, iTop = str.length; i < iTop; i++) {\n n = (crc ^ str.charCodeAt(i)) & 0xFF;\n x = \"0x\" + table.substr(n * 9, 8);\n crc = (crc >>> 8) ^ x;\n }\n return (crc ^ (-1))>>>0;\n };\n\n $.afui = new AFUi();\n $.afui.init=true;\n\n $(window).trigger(\"afui:preinit\");\n $(window).trigger(\"afui:init\");\n})(jQuery);" } -] \ No newline at end of file +] diff --git a/docs/af.ui/$.afui.showMask.md b/docs/af.ui/$.afui.showMask.md index d5908f419..24225bc14 100644 --- a/docs/af.ui/$.afui.showMask.md +++ b/docs/af.ui/$.afui.showMask.md @@ -1,9 +1,9 @@ -#$.afui.showMask(text); +#$.afui.showMask(text, value); ``` Show the loading mask with specificed text - + ``` ##Example @@ -11,6 +11,7 @@ Show the loading mask with specificed text ``` $.afui.showMask() $.afui.showMask('Fetching data...') + $.afui.showMask('Fetching data...', 20000) //number of milliseconds to display the mask, default 15 secs ``` @@ -19,6 +20,7 @@ Show the loading mask with specificed text ``` text string= +value number= ``` diff --git a/src/af.ui.js b/src/af.ui.js index 33cd247ef..acb2d69c1 100644 --- a/src/af.ui.js +++ b/src/af.ui.js @@ -617,19 +617,20 @@ * @param {string=} text * @title $.afui.showMask(text); */ - showMask: function(text) { + showMask: function(text, value) { if (!text) text = this.loadingText || ""; + if (!value || typeof value !== "number") timeout = 15000; $.query("#afui_mask>h1").html(text); $.query("#afui_mask").show(); this.showingMask = true; var self = this; - //set another timeout to auto-hide the mask if something goes wrong after 15 secs + //set another timeout to auto-hide the mask if something goes wrong, default is 15 sec setTimeout(function() { if(self.showingMask) { self.hideMask(); } - }, 15000); + }, value); }, /** * Hide the loading mask @@ -1003,7 +1004,8 @@ tmpActive.classList.remove("active"); } - $(hide).trigger("panelunload", [back]); + //fix #903 + //$(hide).trigger("panelunload", [back]); } else{ if(noTrans){