Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

bugfix for refreshing pages

  • Loading branch information...
commit 00607b12d7dfb743a744ca5d5dcdcc23c368c016 1 parent 7683493
Tobias Bosch authored
View
9 compiled/jquery-mobile-angular-adapter-1.0.7-SNAPSHOT.js
@@ -1005,13 +1005,17 @@ jqmng.define('jqmng/widgets/pageCompile', ['jquery', 'angular'], function ($, an
}
return _apply.apply(this, arguments);
};
-
+ var refreshing = false;
var _digest = $rootScope.$digest;
$rootScope.$digest = function() {
if ($rootScope.$$phase) {
return;
}
var res = _digest.apply(this, arguments);
+ if (refreshing) {
+ return;
+ }
+ refreshing = true;
// run the jquery mobile page compiler
// AFTER the angular compiler is completely finished.
// (Cannot be done in an angular directive...)
@@ -1029,11 +1033,12 @@ jqmng.define('jqmng/widgets/pageCompile', ['jquery', 'angular'], function ($, an
}
}
var pages = jqmRefreshPages;
+ jqmRefreshPages = [];
for (var i=0; i<pages.length; i++) {
pages[i].trigger("create");
}
}
-
+ refreshing = false;
return res;
};
}
View
9 compiled/jquery-mobile-angular-adapter-standalone-1.0.7-SNAPSHOT.js
@@ -32340,13 +32340,17 @@ jqmng.define('jqmng/widgets/pageCompile', ['jquery', 'angular'], function ($, an
}
return _apply.apply(this, arguments);
};
-
+ var refreshing = false;
var _digest = $rootScope.$digest;
$rootScope.$digest = function() {
if ($rootScope.$$phase) {
return;
}
var res = _digest.apply(this, arguments);
+ if (refreshing) {
+ return;
+ }
+ refreshing = true;
// run the jquery mobile page compiler
// AFTER the angular compiler is completely finished.
// (Cannot be done in an angular directive...)
@@ -32364,11 +32368,12 @@ jqmng.define('jqmng/widgets/pageCompile', ['jquery', 'angular'], function ($, an
}
}
var pages = jqmRefreshPages;
+ jqmRefreshPages = [];
for (var i=0; i<pages.length; i++) {
pages[i].trigger("create");
}
}
-
+ refreshing = false;
return res;
};
}
View
2  compiled/min/jquery-mobile-angular-adapter-1.0.7-SNAPSHOT.js
@@ -1 +1 @@
-(function(a){var b=[],c,d=a.jqmng={};d.define=c=function(a,c,d){var e=a.indexOf(".js");e!==-1&&(a=a.substring(0,e)),arguments.length==2&&(d=c,c=[]);if(typeof d=="function"){var f=[];for(var g=0;g<c.length;g++){var h=c[g];f.push(b[h])}d=d.apply(this,f)}b[a]=d},d.require=function(a,c){if(typeof c=="function"){var d=[];for(var e=0;e<a.length;e++){var f=a[e];d.push(b[f])}c.apply(this,d)}}})(window),jqmng.define("angular",function(){if(typeof angular!="undefined")return angular}),jqmng.define("jquery",function(){if(typeof $!="undefined")return $}),jqmng.define("jqmng/scopeReconnect",["angular"],function(a){var b=a.module("ng");b.run(["$rootScope",function(a){var b=a.$destroy;a.$destroy=function(){return this.$$destroyed=!0,b.apply(this,arguments)},a.$reconnect=function(){var b=this;if(b===a)return;if(!b.$$destroyed)return;b.$$destroyed=!1,b.$$prevSibling=a.$$childTail,a.$$childHead?(a.$$childTail.$$nextSibling=b,a.$$childTail=b):a.$$childHead=a.$$childTail=b}}])}),jqmng.define("jqmng/event",["angular"],function(a){function c(a,b,c,d){b.bind(c,function(e){var f=a.$apply(d,b);c.charAt(0)=="v"&&e.preventDefault()})}function d(a,d){b.directive(a,function(){return function(b,e,f){var g=f[a];c(b,e,d,g)}})}var b=a.module("ng");b.directive("ngmEvent",function(){return{compile:function(b,d){var e=a.fromJson(d.ngmEvent);return function(a,b,d){for(var f in e)c(a,b,f,e[f])}}}});var e={ngmTaphold:"taphold",ngmSwipe:"swipe",ngmSwiperight:"swiperight",ngmSwipeleft:"swipeleft",ngmPagebeforeshow:"pagebeforeshow",ngmPagebeforehide:"pagebeforehide",ngmPageshow:"pageshow",ngmPagehide:"pagehide",ngmClick:"vclick"};for(var f in e)d(f,e[f])}),jqmng.define("jqmng/if",["angular"],function(a){var b=a.module("ng"),c={transclude:"element",priority:1e3,terminal:!0,compile:function(a,b,c){return function(a,b,d){var e=d.ngmIf,f,g;a.$watch(e,function(d){d?(g=a.$new(),c(g,function(a){f=a,b.after(a)})):(f&&f.remove(),g&&g.$destroy())})}}};b.directive("ngmIf",function(){return c})}),jqmng.define("jqmng/navigate",["jquery","angular"],function(a,b){function c(a){var b=a.indexOf(":");return b===-1?[a]:[a.substring(0,b),a.substring(b+1)]}function d(b,c){b&&a(document).one("pagebeforechange",function(d,e){function h(){var a=g.scope();a[b].apply(a,c)}var f=a.mobile.path.parseUrl(e.toPage),g=a("#"+f.hash.substring(1));if(!g.data("page")){g.one("pagecreate",h);return}h()})}function e(a,b){var e=Array.prototype.slice.call(arguments,2),g,i;d(b,e);if(typeof a=="object")g=a,i=g.target;else{var j=c(a);if(j.length===2&&j[0]==="back"){var i=j[1],k=h(i);k===undefined?i=f(i,{reverse:!0}):window.history.go(k);return}j.length===2?(g={transition:j[0]},i=j[1]):(i=j[0],g=undefined)}i==="back"?window.history.go(-1):f(i,g)}function f(b,c){b.charAt(0)!=="#"&&(b="#"+b);var d=[b];return c&&d.push(c),a.mobile.changePage.apply(a.mobile,d),b}function h(b){var c=a.mobile.urlHistory.stack,d=0,e;for(var f=c.length-2;f>=0;f--){e=c[f].pageUrl;if(e===b)return f-c.length+1}return undefined}var g=b.module("ng");return g.factory("$navigate",function(){return e}),g.run(["$rootScope","$navigate",function(a,b){a.$navigate=function(){var a=Array.prototype.slice.call(arguments);return a.unshift(b),navigateExpression.apply(this,a)}}]),g.filter("navigate",["$navigate",function(a){return function(b){var d={},e;for(var f=1;f<arguments.length;f++)e=c(arguments[f]),d[e[0]]=e[1];b&&b.then?b.then(function(b){d[b]?a(d[b]):d.success&&a(d.success)},function(b){d[b]?a(d[b]):d.failure&&a(d.failure)}):d[b]?a(d[b]):b!==!1&&d.success?a(d.success):b===!1&&d.failure&&a(d.failure)}}]),e}),jqmng.define("jqmng/sharedController",["angular"],function(a){function c(a){return a[b]=a[b]||{}}function d(a,b,d,e){var f=c(a),g=f[b];return g||(g=a.$new(),d(b,{$scope:g}),f[b]=g,g.$$referenceCount=0),g.$$referenceCount++,e.bind("$destroy",function(){g.$$referenceCount--,g.$$referenceCount===0&&(g.$destroy(),delete f[b])}),g}function e(a){var b=/([^\s,:]+)\s*:\s*([^\s,:]+)/g,c,d=!1,e={};while(c=b.exec(a))d=!0,e[c[1]]=c[2];if(!d)throw"Expression "+a+" needs to have the syntax <name>:<controller>,...";return e}var b="$$sharedControllers",f=a.module("ng");f.directive("ngmSharedController",["$controller",function(a){return{scope:!0,compile:function(b,c){var f=c.ngmSharedController,g=e(f),h=function(c){for(var e in g)c[e]=d(c.$root,g[e],a,b)};return{pre:h}}}}])}),jqmng.define("jqmng/waitDialog",["jquery"],function(a){function c(a){var c=b[b.length-1];c.callback&&n.$apply(function(){c.callback.apply(this,arguments)}),a.preventDefault()}function e(){if(!d||d.length==0)d=a(".ui-loader"),d.bind("vclick",c)}function f(){e();if(b.length>0){var c=b[b.length-1],d=c.msg,f=a.mobile.loadingMessage,g=a.mobile.loadingMessageTextVisible;d&&(a.mobile.loadingMessage=d,a.mobile.loadingMessageTextVisible=!0),a.mobile.showPageLoadingMsg(),a.mobile.loadingMessageTextVisible=g,a.mobile.loadingMessage=f}else a.mobile.hidePageLoadingMsg()}function g(){var a,c;typeof arguments[0]=="string"&&(a=arguments[0]),typeof arguments[0]=="function"&&(c=arguments[0]),typeof arguments[1]=="function"&&(c=arguments[1]),b.push({msg:a,callback:c}),f()}function h(){b.pop(),f()}function i(a,b){a.then(b,b)}function j(a,b){g(b),i(a,function(){h()})}function k(b,c,d){d||(d=a.mobile.loadingMessageWithCancel),g(d,function(){b.reject(c)}),i(b.promise,function(){h()})}var b=[],d;a.mobile.loadingMessageWithCancel||(a.mobile.loadingMessageWithCancel="Loading. Click to cancel."),a("div").live("pageshow",function(a,b){f()});var l={show:g,hide:h,waitFor:j,waitForWithCancel:k},m=angular.module("ng"),n;return m.factory("$waitDialog",["$rootScope",function(a){return n=a,l}]),l}),jqmng.define("jqmng/widgets/angularInput",["jquery","angular"],function(a,b){function c(b){return b.filter(a.mobile.checkboxradio.prototype.options.initSelector).not(":jqmData(role='none'), :jqmData(role='nojs')").length>0}function d(b){return b.filter(a.mobile.textinput.prototype.options.initSelector).not(":jqmData(role='none'), :jqmData(role='nojs')").length>0}var e=b.module("ng");e.directive("input",function(){return{restrict:"E",require:"?ngModel",compile:function(a,b){var e=d(a),f=c(a),g=a.attr("name"),h=a.attr("type");return{pre:function(a,b,c,d){if(!d)return;var e=b.bind;f&&(b.bind=function(a,b){return a.indexOf("click")!=-1&&(a="change"),e.call(this,a,b)})},post:function(a,b,c,d){if(!d)return;var e=d.$render;d.$render=function(){var a=e.apply(this,arguments);f&&b.attr("checked",b[0].checked);var c=b.data();for(var d in c){var g=c[d];g.refresh&&b[d]("refresh")}return a}}}}}})}),jqmng.define("jqmng/widgets/angularRepeat",["jquery","angular"],function(a,b){function c(a,b,c){var e=b[c];b[c]=function(b){var c=this;while(c.parent()[0]!==a){c=c.parent();if(c.length===0)throw new Error("Could not find the expected parent in the node path",this,a)}return d(a,b),e.call(c,b)}}function d(a,b){var d=["after","before"];for(var e=0;e<d.length;e++)c(a,b,d[e])}var e=b.module("ng");e.directive("ngRepeat",function(){return{priority:1e3,compile:function(a,b,c){return{pre:function(a,b,c){d(b.parent()[0],b)}}}}})}),jqmng.define("jqmng/widgets/angularSelect",["jquery","angular"],function(a,b){var c=b.module("ng");c.directive("select",function(){return{restrict:"E",require:"?ngModel",compile:function(a,b){return{post:function(a,b,c,d){if(!d)return;var e=d.$render;d.$render=function(){var a=e.apply(this,arguments),c=b.data();for(var d in c){var f=c[d];f.refresh&&b[d]("refresh")}return a}}}}}})}),jqmng.define("jqmng/widgets/disabledHandling",["jquery","angular"],function(a,b){function d(a,b){var c=b.$set;if(c.instrumented)return;b.$set=function(b,d){var e=c.apply(this,arguments);if(b==="disabled"){var f="enable";if(d==="disabled"||d=="true")f="disable";var g=a.data();for(var b in g){var h=g[b];h[f]&&a[b](f)}}return e},b.$set.instrumented=!0}var c=b.module("ng");c.directive("ngBindAttr",function(){return{compile:function(){return{post:function(a,b,c){d(b,c)}}}}}),c.directive("disabled",function(){return{compile:function(){return{post:function(a,b,c){d(b,c)}}}}}),c.directive("ngDisabled",function(){return{compile:function(){return{post:function(a,b,c){d(b,c)}}}}})}),jqmng.define("jqmng/widgets/jqmButton",["jquery"],function(a){var b=a.mobile.button.prototype,c=b.destroy;b.destroy=function(){c.apply(this,arguments),this.button.remove()}}),jqmng.define("jqmng/widgets/jqmListView",["jquery"],function(a){var b=a.mobile.listview.prototype,c=b.destroy;b.destroy=function(){var b=this.element.attr("id"),d=new RegExp(a.mobile.subPageUrlKey+"="+b+"-"),e=this.childPages();c.apply(this,arguments);for(var f=0;f<e.length;f++){var g=a(e[f]),h=g.attr("data-url");h.match(d)&&g.remove()}};var d=b._create;b._create=function(){var a=this,b=d.apply(this,arguments);this.element.bind("create",function(b){a.refresh();var c=a.element.children("li"),d,e;for(e=0;e<c.length;e++)d=c.eq(e),d.data("listlistener")||(d.data("listlistener",!0),d.bind("remove",function(){a.refresh()}))})}}),jqmng.define("jqmng/widgets/jqmSelectMenu",["jquery"],function(a){var b=a.mobile.selectmenu.prototype,c=b.destroy;b.destroy=function(){var a=this.element.closest(".ui-select"),b=this.menuPage,d=this.screen,e=this.listbox;c.apply(this,arguments),a&&a.remove(),b&&b.remove(),d&&d.remove(),e&&e.remove()};var d=b._create;b._create=function(){var a=d.apply(this,arguments),b=this,c=b.open;b.open=function(){return this.refresh(),c.apply(this,arguments)}}}),jqmng.define("jqmng/widgets/jqmSlider",["jquery"],function(a){var b=a.mobile.slider.prototype,c=b.destroy;b.destroy=function(){c.apply(this,arguments),this.slider.remove()}}),jqmng.define("jqmng/widgets/pageCompile",["jquery","angular"],function(a,b){function c(b){var c=a.fn[b];a.fn[b]=function(){return this.parent().trigger("requestrefresh"),c.apply(this,arguments)}}function d(){var a=["domManip","html","remove"];for(var b=0;b<a.length;b++)c(a[b])}function e(a){var b=a.prototype._create;a.prototype._create=function(){var a=b.apply(this,arguments),c=this;return this.element.bind("requestrefresh",function(){c.requestrefresh=!0}),a};var c=a.prototype._init;a.prototype._init=function(){var a=c.apply(this,arguments);return this.requestrefresh&&(this.requestrefresh=!1,this.refresh()),a}}function f(){for(var b in a.mobile){var c=a.mobile[b];typeof c=="function"&&c.prototype.refresh&&e(c)}}function h(b){b.onHashChange=function(b){return a(window).bind("hashchange",b),b};var c=location.href;b.url=function(a){return a&&(c=a),c}}function k(b){var c=b.$apply;b.$apply=function(){return b.$$phase?b.$eval.apply(this,arguments):c.apply(this,arguments)};var d=b.$digest;b.$digest=function(){if(b.$$phase)return;var c=d.apply(this,arguments);if(this===b){if(i.length>0){var e=i;i=[],b.jqmInitialized||(b.jqmInitialized=!0,a.mobile.initializePage());for(var f=0;f<e.length;f++)e[f].page()}var e=j;for(var f=0;f<e.length;f++)e[f].trigger("create")}return c}}function l(b){var c=a.mobile.page.prototype.options;b.find("input").not(c.keepNativeDefault).each(function(){var b=a(this),d=this.getAttribute("type"),e=c.degradeInputs[d]||"text";if(c.degradeInputs[d]){var f=a("<div>").html(b.clone()).html(),g=f.indexOf(" type=")>-1,h=g?/\s+type=["']?\w+['"]?/:/\/?>/,i=' type="'+e+'" data-'+a.mobile.ns+'type="'+d+'"'+(g?"":">");b.replaceWith(f.replace(h,i))}})}a.mobile.page.prototype.widgetEventPrefix="jqmngpage",d(),f(),a("div").live("jqmngpagebeforecreate",function(b){var c=a(b.target);c.trigger("pagebeforecreate")}),a("div").live("jqmngpagecreate",function(b){var c=a(b.target);c.trigger("pagecreate")}),a("div").live("jqmngpagebeforeshow",function(b,c){var d=a(b.target),e=d.scope();d.data("angularLinked")&&e&&(e.$reconnect(),e.$root.$digest());var d=a(b.target);d.trigger("pagebeforeshow",c)}),a("div").live("jqmngpagebeforehide",function(b,c){var d=a(b.target),e=d.scope();d.data("angularLinked")&&e&&e.$destroy(),d.trigger("pagebeforehide",c)}),a("div").live("jqmngpagehide",function(b,c){var d=a(b.target);d.trigger("pagehide",c)}),a("div").live("jqmngpageshow",function(b,c){var d=a(b.target);d.trigger("pageshow",c)});var g=b.module("ng");g.run(k),g.run(h),h.$inject=["$browser"];var i=[],j=[];k.$inject=["$rootScope"],a.mobile.autoInitializePage=!1,g.directive("role",function(){return{restrict:"A",scope:!0,compile:function(b,c){return c.role!=="page"&&c.role!=="dialog"?{}:(l(b),{pre:function(b,c,d){i.push(c),c.data("angularLinked",!0),b.$destroy(),c.bind("requestrefresh",function(){j.push(c)})}})}}})}),jqmng.define("jqmng/paging",["jquery","angular"],function(a,b){function c(a,c,d){function e(e){function r(a){u(-1),i=a,j=[],k=!0,z()}function s(){var a=i;j=[].concat(a),l&&(a=c(a,l)),m&&(a=d(a,m)),n<h&&(n=h),n>a.length&&(n=a.length),o=a.length;var b=a.slice(0,n),e=[0,g.length].concat(b);g.splice.apply(g,e),g.refreshCount++}function t(){if(i.length!=j.length)k=!0;else for(var a=0;a<i.length;a++)if(i[a]!==j[a]){k=!0;break}return k&&(s(),k=!1),g}function u(b){if(!b||b<0)b=a;b!==h&&(h=b,k=!0)}function v(a){b.equals(l,a)||(l=a,k=!0)}function w(a){b.equals(m,a)||(m=a,k=!0)}function x(){n+=h,k=!0}function y(){return t(),n<o}function z(){n=0,k=!0}var f={refreshIfNeeded:t,setFilter:v,setOrderBy:w,setPageSize:u,loadNextPage:x,hasMorePages:y,reset:z,refreshCount:0},g=[],h,i,j,k,l,m,n,o;for(var p in f)g[p]=f[p];r(e);var q=g.hasOwnProperty;return g.hasOwnProperty=function(a){return a in f?!1:q.apply(this,arguments)},g}return function(a,b){if(!a)return a;var c=a.pagedList;if(typeof b=="string"){if(!c)return;if(b==="loadMore")c.loadNextPage();else if(b==="hasMore")return c.hasMorePages();return}return c||(c=e(a),a.pagedList=c),b&&(c.setPageSize(b.pageSize),c.setFilter(b.filter),c.setOrderBy(b.orderBy)),c.refreshIfNeeded(),c}}c.$inject=["defaultListPageSize","filterFilter","orderByFilter"];var d=b.module(["ng"]);d.constant("defaultListPageSize",10),d.filter("paged",c)}),jqmng.define("jqmng/fadein",["angular"],function(a){a.module(["ng"]).directive("ngmFadein",function(){return{compile:function(a){return a.css({opacity:.1}),function(a,b,c){b.animate({opacity:1},parseInt(c.ngmFadein))}}}})})
+(function(a){var b=[],c,d=a.jqmng={};d.define=c=function(a,c,d){var e=a.indexOf(".js");e!==-1&&(a=a.substring(0,e)),arguments.length==2&&(d=c,c=[]);if(typeof d=="function"){var f=[];for(var g=0;g<c.length;g++){var h=c[g];f.push(b[h])}d=d.apply(this,f)}b[a]=d},d.require=function(a,c){if(typeof c=="function"){var d=[];for(var e=0;e<a.length;e++){var f=a[e];d.push(b[f])}c.apply(this,d)}}})(window),jqmng.define("angular",function(){if(typeof angular!="undefined")return angular}),jqmng.define("jquery",function(){if(typeof $!="undefined")return $}),jqmng.define("jqmng/scopeReconnect",["angular"],function(a){var b=a.module("ng");b.run(["$rootScope",function(a){var b=a.$destroy;a.$destroy=function(){return this.$$destroyed=!0,b.apply(this,arguments)},a.$reconnect=function(){var b=this;if(b===a)return;if(!b.$$destroyed)return;b.$$destroyed=!1,b.$$prevSibling=a.$$childTail,a.$$childHead?(a.$$childTail.$$nextSibling=b,a.$$childTail=b):a.$$childHead=a.$$childTail=b}}])}),jqmng.define("jqmng/event",["angular"],function(a){function c(a,b,c,d){b.bind(c,function(e){var f=a.$apply(d,b);c.charAt(0)=="v"&&e.preventDefault()})}function d(a,d){b.directive(a,function(){return function(b,e,f){var g=f[a];c(b,e,d,g)}})}var b=a.module("ng");b.directive("ngmEvent",function(){return{compile:function(b,d){var e=a.fromJson(d.ngmEvent);return function(a,b,d){for(var f in e)c(a,b,f,e[f])}}}});var e={ngmTaphold:"taphold",ngmSwipe:"swipe",ngmSwiperight:"swiperight",ngmSwipeleft:"swipeleft",ngmPagebeforeshow:"pagebeforeshow",ngmPagebeforehide:"pagebeforehide",ngmPageshow:"pageshow",ngmPagehide:"pagehide",ngmClick:"vclick"};for(var f in e)d(f,e[f])}),jqmng.define("jqmng/if",["angular"],function(a){var b=a.module("ng"),c={transclude:"element",priority:1e3,terminal:!0,compile:function(a,b,c){return function(a,b,d){var e=d.ngmIf,f,g;a.$watch(e,function(d){d?(g=a.$new(),c(g,function(a){f=a,b.after(a)})):(f&&f.remove(),g&&g.$destroy())})}}};b.directive("ngmIf",function(){return c})}),jqmng.define("jqmng/navigate",["jquery","angular"],function(a,b){function c(a){var b=a.indexOf(":");return b===-1?[a]:[a.substring(0,b),a.substring(b+1)]}function d(b,c){b&&a(document).one("pagebeforechange",function(d,e){function h(){var a=g.scope();a[b].apply(a,c)}var f=a.mobile.path.parseUrl(e.toPage),g=a("#"+f.hash.substring(1));if(!g.data("page")){g.one("pagecreate",h);return}h()})}function e(a,b){var e=Array.prototype.slice.call(arguments,2),g,i;d(b,e);if(typeof a=="object")g=a,i=g.target;else{var j=c(a);if(j.length===2&&j[0]==="back"){var i=j[1],k=h(i);k===undefined?i=f(i,{reverse:!0}):window.history.go(k);return}j.length===2?(g={transition:j[0]},i=j[1]):(i=j[0],g=undefined)}i==="back"?window.history.go(-1):f(i,g)}function f(b,c){b.charAt(0)!=="#"&&(b="#"+b);var d=[b];return c&&d.push(c),a.mobile.changePage.apply(a.mobile,d),b}function h(b){var c=a.mobile.urlHistory.stack,d=0,e;for(var f=c.length-2;f>=0;f--){e=c[f].pageUrl;if(e===b)return f-c.length+1}return undefined}var g=b.module("ng");return g.factory("$navigate",function(){return e}),g.run(["$rootScope","$navigate",function(a,b){a.$navigate=function(){var a=Array.prototype.slice.call(arguments);return a.unshift(b),navigateExpression.apply(this,a)}}]),g.filter("navigate",["$navigate",function(a){return function(b){var d={},e;for(var f=1;f<arguments.length;f++)e=c(arguments[f]),d[e[0]]=e[1];b&&b.then?b.then(function(b){d[b]?a(d[b]):d.success&&a(d.success)},function(b){d[b]?a(d[b]):d.failure&&a(d.failure)}):d[b]?a(d[b]):b!==!1&&d.success?a(d.success):b===!1&&d.failure&&a(d.failure)}}]),e}),jqmng.define("jqmng/sharedController",["angular"],function(a){function c(a){return a[b]=a[b]||{}}function d(a,b,d,e){var f=c(a),g=f[b];return g||(g=a.$new(),d(b,{$scope:g}),f[b]=g,g.$$referenceCount=0),g.$$referenceCount++,e.bind("$destroy",function(){g.$$referenceCount--,g.$$referenceCount===0&&(g.$destroy(),delete f[b])}),g}function e(a){var b=/([^\s,:]+)\s*:\s*([^\s,:]+)/g,c,d=!1,e={};while(c=b.exec(a))d=!0,e[c[1]]=c[2];if(!d)throw"Expression "+a+" needs to have the syntax <name>:<controller>,...";return e}var b="$$sharedControllers",f=a.module("ng");f.directive("ngmSharedController",["$controller",function(a){return{scope:!0,compile:function(b,c){var f=c.ngmSharedController,g=e(f),h=function(c){for(var e in g)c[e]=d(c.$root,g[e],a,b)};return{pre:h}}}}])}),jqmng.define("jqmng/waitDialog",["jquery"],function(a){function c(a){var c=b[b.length-1];c.callback&&n.$apply(function(){c.callback.apply(this,arguments)}),a.preventDefault()}function e(){if(!d||d.length==0)d=a(".ui-loader"),d.bind("vclick",c)}function f(){e();if(b.length>0){var c=b[b.length-1],d=c.msg,f=a.mobile.loadingMessage,g=a.mobile.loadingMessageTextVisible;d&&(a.mobile.loadingMessage=d,a.mobile.loadingMessageTextVisible=!0),a.mobile.showPageLoadingMsg(),a.mobile.loadingMessageTextVisible=g,a.mobile.loadingMessage=f}else a.mobile.hidePageLoadingMsg()}function g(){var a,c;typeof arguments[0]=="string"&&(a=arguments[0]),typeof arguments[0]=="function"&&(c=arguments[0]),typeof arguments[1]=="function"&&(c=arguments[1]),b.push({msg:a,callback:c}),f()}function h(){b.pop(),f()}function i(a,b){a.then(b,b)}function j(a,b){g(b),i(a,function(){h()})}function k(b,c,d){d||(d=a.mobile.loadingMessageWithCancel),g(d,function(){b.reject(c)}),i(b.promise,function(){h()})}var b=[],d;a.mobile.loadingMessageWithCancel||(a.mobile.loadingMessageWithCancel="Loading. Click to cancel."),a("div").live("pageshow",function(a,b){f()});var l={show:g,hide:h,waitFor:j,waitForWithCancel:k},m=angular.module("ng"),n;return m.factory("$waitDialog",["$rootScope",function(a){return n=a,l}]),l}),jqmng.define("jqmng/widgets/angularInput",["jquery","angular"],function(a,b){function c(b){return b.filter(a.mobile.checkboxradio.prototype.options.initSelector).not(":jqmData(role='none'), :jqmData(role='nojs')").length>0}function d(b){return b.filter(a.mobile.textinput.prototype.options.initSelector).not(":jqmData(role='none'), :jqmData(role='nojs')").length>0}var e=b.module("ng");e.directive("input",function(){return{restrict:"E",require:"?ngModel",compile:function(a,b){var e=d(a),f=c(a),g=a.attr("name"),h=a.attr("type");return{pre:function(a,b,c,d){if(!d)return;var e=b.bind;f&&(b.bind=function(a,b){return a.indexOf("click")!=-1&&(a="change"),e.call(this,a,b)})},post:function(a,b,c,d){if(!d)return;var e=d.$render;d.$render=function(){var a=e.apply(this,arguments);f&&b.attr("checked",b[0].checked);var c=b.data();for(var d in c){var g=c[d];g.refresh&&b[d]("refresh")}return a}}}}}})}),jqmng.define("jqmng/widgets/angularRepeat",["jquery","angular"],function(a,b){function c(a,b,c){var e=b[c];b[c]=function(b){var c=this;while(c.parent()[0]!==a){c=c.parent();if(c.length===0)throw new Error("Could not find the expected parent in the node path",this,a)}return d(a,b),e.call(c,b)}}function d(a,b){var d=["after","before"];for(var e=0;e<d.length;e++)c(a,b,d[e])}var e=b.module("ng");e.directive("ngRepeat",function(){return{priority:1e3,compile:function(a,b,c){return{pre:function(a,b,c){d(b.parent()[0],b)}}}}})}),jqmng.define("jqmng/widgets/angularSelect",["jquery","angular"],function(a,b){var c=b.module("ng");c.directive("select",function(){return{restrict:"E",require:"?ngModel",compile:function(a,b){return{post:function(a,b,c,d){if(!d)return;var e=d.$render;d.$render=function(){var a=e.apply(this,arguments),c=b.data();for(var d in c){var f=c[d];f.refresh&&b[d]("refresh")}return a}}}}}})}),jqmng.define("jqmng/widgets/disabledHandling",["jquery","angular"],function(a,b){function d(a,b){var c=b.$set;if(c.instrumented)return;b.$set=function(b,d){var e=c.apply(this,arguments);if(b==="disabled"){var f="enable";if(d==="disabled"||d=="true")f="disable";var g=a.data();for(var b in g){var h=g[b];h[f]&&a[b](f)}}return e},b.$set.instrumented=!0}var c=b.module("ng");c.directive("ngBindAttr",function(){return{compile:function(){return{post:function(a,b,c){d(b,c)}}}}}),c.directive("disabled",function(){return{compile:function(){return{post:function(a,b,c){d(b,c)}}}}}),c.directive("ngDisabled",function(){return{compile:function(){return{post:function(a,b,c){d(b,c)}}}}})}),jqmng.define("jqmng/widgets/jqmButton",["jquery"],function(a){var b=a.mobile.button.prototype,c=b.destroy;b.destroy=function(){c.apply(this,arguments),this.button.remove()}}),jqmng.define("jqmng/widgets/jqmListView",["jquery"],function(a){var b=a.mobile.listview.prototype,c=b.destroy;b.destroy=function(){var b=this.element.attr("id"),d=new RegExp(a.mobile.subPageUrlKey+"="+b+"-"),e=this.childPages();c.apply(this,arguments);for(var f=0;f<e.length;f++){var g=a(e[f]),h=g.attr("data-url");h.match(d)&&g.remove()}};var d=b._create;b._create=function(){var a=this,b=d.apply(this,arguments);this.element.bind("create",function(b){a.refresh();var c=a.element.children("li"),d,e;for(e=0;e<c.length;e++)d=c.eq(e),d.data("listlistener")||(d.data("listlistener",!0),d.bind("remove",function(){a.refresh()}))})}}),jqmng.define("jqmng/widgets/jqmSelectMenu",["jquery"],function(a){var b=a.mobile.selectmenu.prototype,c=b.destroy;b.destroy=function(){var a=this.element.closest(".ui-select"),b=this.menuPage,d=this.screen,e=this.listbox;c.apply(this,arguments),a&&a.remove(),b&&b.remove(),d&&d.remove(),e&&e.remove()};var d=b._create;b._create=function(){var a=d.apply(this,arguments),b=this,c=b.open;b.open=function(){return this.refresh(),c.apply(this,arguments)}}}),jqmng.define("jqmng/widgets/jqmSlider",["jquery"],function(a){var b=a.mobile.slider.prototype,c=b.destroy;b.destroy=function(){c.apply(this,arguments),this.slider.remove()}}),jqmng.define("jqmng/widgets/pageCompile",["jquery","angular"],function(a,b){function c(b){var c=a.fn[b];a.fn[b]=function(){return this.parent().trigger("requestrefresh"),c.apply(this,arguments)}}function d(){var a=["domManip","html","remove"];for(var b=0;b<a.length;b++)c(a[b])}function e(a){var b=a.prototype._create;a.prototype._create=function(){var a=b.apply(this,arguments),c=this;return this.element.bind("requestrefresh",function(){c.requestrefresh=!0}),a};var c=a.prototype._init;a.prototype._init=function(){var a=c.apply(this,arguments);return this.requestrefresh&&(this.requestrefresh=!1,this.refresh()),a}}function f(){for(var b in a.mobile){var c=a.mobile[b];typeof c=="function"&&c.prototype.refresh&&e(c)}}function h(b){b.onHashChange=function(b){return a(window).bind("hashchange",b),b};var c=location.href;b.url=function(a){return a&&(c=a),c}}function k(b){var c=b.$apply;b.$apply=function(){return b.$$phase?b.$eval.apply(this,arguments):c.apply(this,arguments)};var d=!1,e=b.$digest;b.$digest=function(){if(b.$$phase)return;var c=e.apply(this,arguments);if(d)return;d=!0;if(this===b){if(i.length>0){var f=i;i=[],b.jqmInitialized||(b.jqmInitialized=!0,a.mobile.initializePage());for(var g=0;g<f.length;g++)f[g].page()}var f=j;j=[];for(var g=0;g<f.length;g++)f[g].trigger("create")}return d=!1,c}}function l(b){var c=a.mobile.page.prototype.options;b.find("input").not(c.keepNativeDefault).each(function(){var b=a(this),d=this.getAttribute("type"),e=c.degradeInputs[d]||"text";if(c.degradeInputs[d]){var f=a("<div>").html(b.clone()).html(),g=f.indexOf(" type=")>-1,h=g?/\s+type=["']?\w+['"]?/:/\/?>/,i=' type="'+e+'" data-'+a.mobile.ns+'type="'+d+'"'+(g?"":">");b.replaceWith(f.replace(h,i))}})}a.mobile.page.prototype.widgetEventPrefix="jqmngpage",d(),f(),a("div").live("jqmngpagebeforecreate",function(b){var c=a(b.target);c.trigger("pagebeforecreate")}),a("div").live("jqmngpagecreate",function(b){var c=a(b.target);c.trigger("pagecreate")}),a("div").live("jqmngpagebeforeshow",function(b,c){var d=a(b.target),e=d.scope();d.data("angularLinked")&&e&&(e.$reconnect(),e.$root.$digest());var d=a(b.target);d.trigger("pagebeforeshow",c)}),a("div").live("jqmngpagebeforehide",function(b,c){var d=a(b.target),e=d.scope();d.data("angularLinked")&&e&&e.$destroy(),d.trigger("pagebeforehide",c)}),a("div").live("jqmngpagehide",function(b,c){var d=a(b.target);d.trigger("pagehide",c)}),a("div").live("jqmngpageshow",function(b,c){var d=a(b.target);d.trigger("pageshow",c)});var g=b.module("ng");g.run(k),g.run(h),h.$inject=["$browser"];var i=[],j=[];k.$inject=["$rootScope"],a.mobile.autoInitializePage=!1,g.directive("role",function(){return{restrict:"A",scope:!0,compile:function(b,c){return c.role!=="page"&&c.role!=="dialog"?{}:(l(b),{pre:function(b,c,d){i.push(c),c.data("angularLinked",!0),b.$destroy(),c.bind("requestrefresh",function(){j.push(c)})}})}}})}),jqmng.define("jqmng/paging",["jquery","angular"],function(a,b){function c(a,c,d){function e(e){function r(a){u(-1),i=a,j=[],k=!0,z()}function s(){var a=i;j=[].concat(a),l&&(a=c(a,l)),m&&(a=d(a,m)),n<h&&(n=h),n>a.length&&(n=a.length),o=a.length;var b=a.slice(0,n),e=[0,g.length].concat(b);g.splice.apply(g,e),g.refreshCount++}function t(){if(i.length!=j.length)k=!0;else for(var a=0;a<i.length;a++)if(i[a]!==j[a]){k=!0;break}return k&&(s(),k=!1),g}function u(b){if(!b||b<0)b=a;b!==h&&(h=b,k=!0)}function v(a){b.equals(l,a)||(l=a,k=!0)}function w(a){b.equals(m,a)||(m=a,k=!0)}function x(){n+=h,k=!0}function y(){return t(),n<o}function z(){n=0,k=!0}var f={refreshIfNeeded:t,setFilter:v,setOrderBy:w,setPageSize:u,loadNextPage:x,hasMorePages:y,reset:z,refreshCount:0},g=[],h,i,j,k,l,m,n,o;for(var p in f)g[p]=f[p];r(e);var q=g.hasOwnProperty;return g.hasOwnProperty=function(a){return a in f?!1:q.apply(this,arguments)},g}return function(a,b){if(!a)return a;var c=a.pagedList;if(typeof b=="string"){if(!c)return;if(b==="loadMore")c.loadNextPage();else if(b==="hasMore")return c.hasMorePages();return}return c||(c=e(a),a.pagedList=c),b&&(c.setPageSize(b.pageSize),c.setFilter(b.filter),c.setOrderBy(b.orderBy)),c.refreshIfNeeded(),c}}c.$inject=["defaultListPageSize","filterFilter","orderByFilter"];var d=b.module(["ng"]);d.constant("defaultListPageSize",10),d.filter("paged",c)}),jqmng.define("jqmng/fadein",["angular"],function(a){a.module(["ng"]).directive("ngmFadein",function(){return{compile:function(a){return a.css({opacity:.1}),function(a,b,c){b.animate({opacity:1},parseInt(c.ngmFadein))}}}})})
View
2  compiled/min/jquery-mobile-angular-adapter-standalone-1.0.7-SNAPSHOT.js
1 addition, 1 deletion not shown
View
9 src/main/webapp/jqmng/widgets/pageCompile.js
@@ -156,13 +156,17 @@ jqmng.define('jqmng/widgets/pageCompile', ['jquery', 'angular'], function ($, an
}
return _apply.apply(this, arguments);
};
-
+ var refreshing = false;
var _digest = $rootScope.$digest;
$rootScope.$digest = function() {
if ($rootScope.$$phase) {
return;
}
var res = _digest.apply(this, arguments);
+ if (refreshing) {
+ return;
+ }
+ refreshing = true;
// run the jquery mobile page compiler
// AFTER the angular compiler is completely finished.
// (Cannot be done in an angular directive...)
@@ -180,11 +184,12 @@ jqmng.define('jqmng/widgets/pageCompile', ['jquery', 'angular'], function ($, an
}
}
var pages = jqmRefreshPages;
+ jqmRefreshPages = [];
for (var i=0; i<pages.length; i++) {
pages[i].trigger("create");
}
}
-
+ refreshing = false;
return res;
};
}
Please sign in to comment.
Something went wrong with that request. Please try again.