From 799075d63da6a424a32df6d397fc93ee564bd18d Mon Sep 17 00:00:00 2001 From: PliablePixels Date: Sun, 23 Aug 2015 09:03:18 -0400 Subject: upgraded to ionic content 1.0.1 --- www/lib/ionic-content-banner/.bower.json | 12 +++---- www/lib/ionic-content-banner/bower.json | 4 +-- .../dist/ionic.content.banner.js | 41 ++++++++++++++++++++-- .../dist/ionic.content.banner.min.js | 2 +- 4 files changed, 48 insertions(+), 11 deletions(-) (limited to 'www/lib') diff --git a/www/lib/ionic-content-banner/.bower.json b/www/lib/ionic-content-banner/.bower.json index d23a9107..1a29595f 100644 --- a/www/lib/ionic-content-banner/.bower.json +++ b/www/lib/ionic-content-banner/.bower.json @@ -1,6 +1,6 @@ { "name": "ionic-content-banner", - "version": "1.0.0", + "version": "1.0.1", "description": "A content banner directive for Ionic apps that animates in on the active ion-content", "author": "Devin Jett (https://github.com/djett41)", "main": [ @@ -25,7 +25,7 @@ "dependencies": {}, "devDependencies": { "ionic": "^1.0.0-rc.0", - "angular-mocks": "1.3.13" + "angular-mocks": "1.4.3" }, "keywords": [ "mobile", @@ -42,14 +42,14 @@ "license": "MIT", "private": false, "homepage": "https://github.com/djett41/ionic-content-banner", - "_release": "1.0.0", + "_release": "1.0.1", "_resolution": { "type": "version", - "tag": "v1.0.0", - "commit": "08f9779e742299e7dbe17e8481450f2763a1f6f5" + "tag": "v1.0.1", + "commit": "79ce49f1df0b70079424f07e3c9940262cfe8123" }, "_source": "git://github.com/djett41/ionic-content-banner.git", - "_target": "~1.0.0", + "_target": "~1.0.1", "_originalSource": "ionic-content-banner", "_direct": true } \ No newline at end of file diff --git a/www/lib/ionic-content-banner/bower.json b/www/lib/ionic-content-banner/bower.json index 10918b46..7e330544 100644 --- a/www/lib/ionic-content-banner/bower.json +++ b/www/lib/ionic-content-banner/bower.json @@ -1,6 +1,6 @@ { "name": "ionic-content-banner", - "version": "1.0.0", + "version": "1.0.1", "description": "A content banner directive for Ionic apps that animates in on the active ion-content", "author": "Devin Jett (https://github.com/djett41)", "main": [ @@ -25,7 +25,7 @@ "dependencies": {}, "devDependencies": { "ionic": "^1.0.0-rc.0", - "angular-mocks": "1.3.13" + "angular-mocks": "1.4.3" }, "keywords": [ "mobile", 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
'}}])}(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('')(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
'}}])}(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('')(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 -- cgit v1.2.3