summaryrefslogtreecommitdiff
path: root/www/lib/ionic-content-banner/dist
diff options
context:
space:
mode:
authorPliablePixels <pliablepixels@gmail.com>2015-08-23 09:03:18 -0400
committerPliablePixels <pliablepixels@gmail.com>2015-08-23 09:03:18 -0400
commit799075d63da6a424a32df6d397fc93ee564bd18d (patch)
treecb06802df530df732fd232a58be12f221fc97e55 /www/lib/ionic-content-banner/dist
parent09a2f3ccfe1afd1de54ecc8bef52540279dcd641 (diff)
upgraded to ionic content 1.0.1
Diffstat (limited to 'www/lib/ionic-content-banner/dist')
-rw-r--r--www/lib/ionic-content-banner/dist/ionic.content.banner.js41
-rw-r--r--www/lib/ionic-content-banner/dist/ionic.content.banner.min.js2
2 files changed, 40 insertions, 3 deletions
diff --git a/www/lib/ionic-content-banner/dist/ionic.content.banner.js b/www/lib/ionic-content-banner/dist/ionic.content.banner.js
index 0dec733b..e79f46ca 100644
--- a/www/lib/ionic-content-banner/dist/ionic.content.banner.js
+++ b/www/lib/ionic-content-banner/dist/ionic.content.banner.js
@@ -57,6 +57,36 @@ angular.module('jett.ionic.content.banner', ['ionic']);
'$ionicPlatform',
function ($document, $rootScope, $compile, $timeout, $ionicPlatform) {
+ function isActiveView (node) {
+ // walk up the child-parent node chain until we get to the root or the BODY
+ while (node !== null && node.nodeName !== 'BODY') {
+ var navView = node.getAttribute("nav-view");
+
+ // as soon as we encounter a cached (parent) view then we know the view can't be active
+ if (navView !== null && navView === 'cached') {
+ return false;
+ }
+ node = node.parentNode;
+ }
+ // no cached parent seen, the view must be really active
+ return true;
+ }
+
+ function getActiveView (body) {
+ // get the candidate active views
+ var views = body.querySelectorAll('ion-view[nav-view="active"]');
+
+ // only one candidate, so we just take it
+ if (views.length === 1) {
+ return views[0];
+ }
+
+ // convert the NodeList to an array, filter it using 'isActiveView' and return the first element
+ return Array.prototype.slice.call(views).filter(function (view) {
+ return isActiveView(view);
+ })[0];
+ }
+
/**
* @ngdoc method
* @name $ionicContentBanner#show
@@ -72,7 +102,8 @@ angular.module('jett.ionic.content.banner', ['ionic']);
interval: 7000,
type: 'info',
$deregisterBackButton: angular.noop,
- closeOnStateChange: true
+ closeOnStateChange: true,
+ autoClose: null
}, opts);
// Compile the template
@@ -115,11 +146,17 @@ angular.module('jett.ionic.content.banner', ['ionic']);
return;
}
- body.querySelector('ion-view[nav-view="active"] .scroll-content').appendChild(element[0]);
+ getActiveView(body).querySelector('.scroll-content').appendChild(element[0]);
ionic.requestAnimationFrame(function () {
$timeout(function () {
element.addClass('content-banner-in');
+ //automatically close if autoClose is configured
+ if (scope.autoClose) {
+ $timeout(function () {
+ scope.close();
+ }, scope.autoClose, false);
+ }
}, 20, false);
});
};
diff --git a/www/lib/ionic-content-banner/dist/ionic.content.banner.min.js b/www/lib/ionic-content-banner/dist/ionic.content.banner.min.js
index d293e517..4fd070e9 100644
--- a/www/lib/ionic-content-banner/dist/ionic.content.banner.min.js
+++ b/www/lib/ionic-content-banner/dist/ionic.content.banner.min.js
@@ -1 +1 @@
-angular.module("jett.ionic.content.banner",["ionic"]),function(n){"use strict";n.module("jett.ionic.content.banner").directive("ionContentBanner",["$interval",function(n){return{restrict:"E",scope:!0,link:function(e,t){var o;e.currentIndex=0,e.text.length>1&&(o=n(function(){e.currentIndex=e.currentIndex<e.text.length-1?e.currentIndex+1:0},e.interval)),e.$on("$destroy",function(){t.remove(),o&&n.cancel(o)})},template:'<div class="content-banner-text-wrapper"><div ng-repeat="item in text track by $index" ng-class="{active: $index === currentIndex}" class="content-banner-text" ng-bind="item"></div></div><button class="content-banner-close button button-icon icon {{::icon}}" ng-click="close()"></button>'}}])}(angular),function(n,e){"use strict";n.module("jett.ionic.content.banner").factory("$ionicContentBanner",["$document","$rootScope","$compile","$timeout","$ionicPlatform",function(t,o,c,i,r){function a(a){var s=o.$new(!0);n.extend(s,{icon:"ion-ios-close-empty",transition:"vertical",interval:7e3,type:"info",$deregisterBackButton:n.noop,closeOnStateChange:!0},a);var u="content-banner "+s.type+" content-banner-transition-"+s.transition,l=s.element=c('<ion-content-banner class="'+u+'"></ion-content-banner>')(s),d=t[0].body,v=s.closeOnStateChange?o.$on("$stateChangeSuccess",function(){s.close()}):n.noop;return s.$deregisterBackButton=r.registerBackButtonAction(function(){i(s.close)},300),s.close=function(){s.removed||(s.removed=!0,e.requestAnimationFrame(function(){l.removeClass("content-banner-in"),i(function(){s.$destroy(),l.remove(),d=v=null},400)}),s.$deregisterBackButton(),v())},s.show=function(){s.removed||(d.querySelector('ion-view[nav-view="active"] .scroll-content').appendChild(l[0]),e.requestAnimationFrame(function(){i(function(){l.addClass("content-banner-in")},20,!1)}))},i(function(){s.show()},10,!1),s.close.$scope=s,s.close}return{show:a}}])}(angular,ionic); \ No newline at end of file
+angular.module("jett.ionic.content.banner",["ionic"]),function(n){"use strict";n.module("jett.ionic.content.banner").directive("ionContentBanner",["$interval",function(n){return{restrict:"E",scope:!0,link:function(e,t){var o;e.currentIndex=0,e.text.length>1&&(o=n(function(){e.currentIndex=e.currentIndex<e.text.length-1?e.currentIndex+1:0},e.interval)),e.$on("$destroy",function(){t.remove(),o&&n.cancel(o)})},template:'<div class="content-banner-text-wrapper"><div ng-repeat="item in text track by $index" ng-class="{active: $index === currentIndex}" class="content-banner-text" ng-bind="item"></div></div><button class="content-banner-close button button-icon icon {{::icon}}" ng-click="close()"></button>'}}])}(angular),function(n,e){"use strict";n.module("jett.ionic.content.banner").factory("$ionicContentBanner",["$document","$rootScope","$compile","$timeout","$ionicPlatform",function(t,o,c,r,i){function a(n){for(;null!==n&&"BODY"!==n.nodeName;){var e=n.getAttribute("nav-view");if(null!==e&&"cached"===e)return!1;n=n.parentNode}return!0}function u(n){var e=n.querySelectorAll('ion-view[nav-view="active"]');return 1===e.length?e[0]:Array.prototype.slice.call(e).filter(function(n){return a(n)})[0]}function l(a){var l=o.$new(!0);n.extend(l,{icon:"ion-ios-close-empty",transition:"vertical",interval:7e3,type:"info",$deregisterBackButton:n.noop,closeOnStateChange:!0,autoClose:null},a);var s="content-banner "+l.type+" content-banner-transition-"+l.transition,d=l.element=c('<ion-content-banner class="'+s+'"></ion-content-banner>')(l),f=t[0].body,v=l.closeOnStateChange?o.$on("$stateChangeSuccess",function(){l.close()}):n.noop;return l.$deregisterBackButton=i.registerBackButtonAction(function(){r(l.close)},300),l.close=function(){l.removed||(l.removed=!0,e.requestAnimationFrame(function(){d.removeClass("content-banner-in"),r(function(){l.$destroy(),d.remove(),f=v=null},400)}),l.$deregisterBackButton(),v())},l.show=function(){l.removed||(u(f).querySelector(".scroll-content").appendChild(d[0]),e.requestAnimationFrame(function(){r(function(){d.addClass("content-banner-in"),l.autoClose&&r(function(){l.close()},l.autoClose,!1)},20,!1)}))},r(function(){l.show()},10,!1),l.close.$scope=l,l.close}return{show:l}}])}(angular,ionic); \ No newline at end of file