From 3d2fda7dd39e2363682f1fa353c951ab0d44ddfa Mon Sep 17 00:00:00 2001 From: Fulup Ar Foll Date: Tue, 9 Feb 2016 18:40:49 +0100 Subject: Implemented URL query parsing for initial token /opa/?token=abcde --- .../dist/js/foundation-apps-templates.js | 170 ++ .../dist/js/foundation-apps-templates.min.js | 1 + .../foundation-apps/dist/js/foundation-apps.js | 3136 ++++++++++++++++++++ .../foundation-apps/dist/js/foundation-apps.min.js | 2 + 4 files changed, 3309 insertions(+) create mode 100644 afb-client/bower_components/foundation-apps/dist/js/foundation-apps-templates.js create mode 100644 afb-client/bower_components/foundation-apps/dist/js/foundation-apps-templates.min.js create mode 100755 afb-client/bower_components/foundation-apps/dist/js/foundation-apps.js create mode 100755 afb-client/bower_components/foundation-apps/dist/js/foundation-apps.min.js (limited to 'afb-client/bower_components/foundation-apps/dist/js') diff --git a/afb-client/bower_components/foundation-apps/dist/js/foundation-apps-templates.js b/afb-client/bower_components/foundation-apps/dist/js/foundation-apps-templates.js new file mode 100644 index 0000000..0225773 --- /dev/null +++ b/afb-client/bower_components/foundation-apps/dist/js/foundation-apps-templates.js @@ -0,0 +1,170 @@ +angular.module('foundation').run(['$templateCache', function($templateCache) { + $templateCache.put('components/accordion/accordion-item.html', + '
\n' + + '
{{ title }}
\n' + + '
\n' + + '
\n' + + ''); +}]); + +angular.module('foundation').run(['$templateCache', function($templateCache) { + $templateCache.put('components/accordion/accordion.html', + '
\n' + + '
\n' + + ''); +}]); + +angular.module('foundation').run(['$templateCache', function($templateCache) { + $templateCache.put('components/actionsheet/actionsheet-button.html', + '
\n' + + ' {{ title }}\n' + + '
\n' + + '
\n' + + ''); +}]); + +angular.module('foundation').run(['$templateCache', function($templateCache) { + $templateCache.put('components/actionsheet/actionsheet-content.html', + '\n' + + ' \n' + + ' \n' + + '\n' + + ''); +}]); + +angular.module('foundation').run(['$templateCache', function($templateCache) { + $templateCache.put('components/actionsheet/actionsheet.html', + '
\n' + + '
\n' + + ''); +}]); + +angular.module('foundation').run(['$templateCache', function($templateCache) { + $templateCache.put('components/modal/modal.html', + '\n' + + ' \n' + + ' \n' + + '\n' + + ''); +}]); + +angular.module('foundation').run(['$templateCache', function($templateCache) { + $templateCache.put('components/notification/notification-set.html', + '
\n' + + ' {{ notification.content }}\n' + + '
'); +}]); + +angular.module('foundation').run(['$templateCache', function($templateCache) { + $templateCache.put('components/notification/notification-static.html', + '
\n' + + ' ×\n' + + '
\n' + + ' \n' + + '
\n' + + '
\n' + + '

{{ title }}

\n' + + '

\n' + + '
\n' + + '
\n' + + ''); +}]); + +angular.module('foundation').run(['$templateCache', function($templateCache) { + $templateCache.put('components/notification/notification.html', + '
\n' + + ' ×\n' + + '
\n' + + ' \n' + + '
\n' + + '
\n' + + '

{{ title }}

\n' + + '

\n' + + '
\n' + + '
\n' + + ''); +}]); + +angular.module('foundation').run(['$templateCache', function($templateCache) { + $templateCache.put('components/offcanvas/offcanvas.html', + '\n' + + '\n' + + ''); +}]); + +angular.module('foundation').run(['$templateCache', function($templateCache) { + $templateCache.put('components/panel/panel.html', + '\n' + + '\n' + + ''); +}]); + +angular.module('foundation').run(['$templateCache', function($templateCache) { + $templateCache.put('components/popup/popup.html', + '\n' + + ''); +}]); + +angular.module('foundation').run(['$templateCache', function($templateCache) { + $templateCache.put('components/tabs/tab-content.html', + '
\n' + + '
\n' + + '
\n' + + '
\n' + + ''); +}]); + +angular.module('foundation').run(['$templateCache', function($templateCache) { + $templateCache.put('components/tabs/tab.html', + '
{{ title }}
\n' + + ''); +}]); + +angular.module('foundation').run(['$templateCache', function($templateCache) { + $templateCache.put('components/tabs/tabs.html', + '
\n' + + '
\n' + + '
\n' + + '
\n' + + '
\n' + + '
\n' + + ''); +}]); diff --git a/afb-client/bower_components/foundation-apps/dist/js/foundation-apps-templates.min.js b/afb-client/bower_components/foundation-apps/dist/js/foundation-apps-templates.min.js new file mode 100644 index 0000000..7ab7adb --- /dev/null +++ b/afb-client/bower_components/foundation-apps/dist/js/foundation-apps-templates.min.js @@ -0,0 +1 @@ +angular.module("foundation").run(["$templateCache",function(n){n.put("components/accordion/accordion-item.html",'
\n
{{ title }}
\n
\n
\n')}]),angular.module("foundation").run(["$templateCache",function(n){n.put("components/accordion/accordion.html",'
\n
\n')}]),angular.module("foundation").run(["$templateCache",function(n){n.put("components/actionsheet/actionsheet-button.html",'
\n {{ title }}\n
\n
\n')}]),angular.module("foundation").run(["$templateCache",function(n){n.put("components/actionsheet/actionsheet-content.html",'\n \n \n\n')}]),angular.module("foundation").run(["$templateCache",function(n){n.put("components/actionsheet/actionsheet.html",'
\n
\n')}]),angular.module("foundation").run(["$templateCache",function(n){n.put("components/modal/modal.html",'\n \n \n\n')}]),angular.module("foundation").run(["$templateCache",function(n){n.put("components/notification/notification-set.html",'
\n {{ notification.content }}\n
')}]),angular.module("foundation").run(["$templateCache",function(n){n.put("components/notification/notification-static.html",'
\n ×\n
\n \n
\n
\n

{{ title }}

\n

\n
\n
\n')}]),angular.module("foundation").run(["$templateCache",function(n){n.put("components/notification/notification.html",'
\n ×\n
\n \n
\n
\n

{{ title }}

\n

\n
\n
\n')}]),angular.module("foundation").run(["$templateCache",function(n){n.put("components/offcanvas/offcanvas.html",'\n\n')}]),angular.module("foundation").run(["$templateCache",function(n){n.put("components/panel/panel.html",'\n\n')}]),angular.module("foundation").run(["$templateCache",function(n){n.put("components/popup/popup.html",'\n')}]),angular.module("foundation").run(["$templateCache",function(n){n.put("components/tabs/tab-content.html",'
\n
\n
\n
\n')}]),angular.module("foundation").run(["$templateCache",function(n){n.put("components/tabs/tab.html",'
{{ title }}
\n')}]),angular.module("foundation").run(["$templateCache",function(n){n.put("components/tabs/tabs.html",'
\n
\n
\n
\n
\n
\n')}]); \ No newline at end of file diff --git a/afb-client/bower_components/foundation-apps/dist/js/foundation-apps.js b/afb-client/bower_components/foundation-apps/dist/js/foundation-apps.js new file mode 100755 index 0000000..1ad0c21 --- /dev/null +++ b/afb-client/bower_components/foundation-apps/dist/js/foundation-apps.js @@ -0,0 +1,3136 @@ +/*! + * iconic.js v0.4.0 - The Iconic JavaScript library + * Copyright (c) 2014 Waybury - http://useiconic.com + */ + +!function(a){"object"==typeof exports?module.exports=a():"function"==typeof define&&define.amd?define(a):"undefined"!=typeof window?window.IconicJS=a():"undefined"!=typeof global?global.IconicJS=a():"undefined"!=typeof self&&(self.IconicJS=a())}(function(){var a;return function b(a,c,d){function e(g,h){if(!c[g]){if(!a[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};a[g][0].call(j.exports,function(b){var c=a[g][1][b];return e(c?c:b)},j,j.exports,b,a,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g>>0;for(c=0;d>c;++c)c in this&&a.call(b,this[c],c,this)}),function(){if(Event.prototype.preventDefault||(Event.prototype.preventDefault=function(){this.returnValue=!1}),Event.prototype.stopPropagation||(Event.prototype.stopPropagation=function(){this.cancelBubble=!0}),!Element.prototype.addEventListener){var a=[],b=function(b,c){var d=this,e=function(a){a.target=a.srcElement,a.currentTarget=d,c.handleEvent?c.handleEvent(a):c.call(d,a)};if("DOMContentLoaded"==b){var f=function(a){"complete"==document.readyState&&e(a)};if(document.attachEvent("onreadystatechange",f),a.push({object:this,type:b,listener:c,wrapper:f}),"complete"==document.readyState){var g=new Event;g.srcElement=window,f(g)}}else this.attachEvent("on"+b,e),a.push({object:this,type:b,listener:c,wrapper:e})},c=function(b,c){for(var d=0;df?d.width:d.height;var g;g=32>b?"iconic-sm":b>=32&&128>b?"iconic-md":"iconic-lg";var h=a.getAttribute("class"),i=c.test(h)?h.replace(c,g):h+" "+g;a.setAttribute("class",i)}},h=function(){var a=document.querySelectorAll(".injected-svg.iconic-fluid");Array.prototype.forEach.call(a,function(a){g(a)})};document.addEventListener("DOMContentLoaded",function(){f()}),window.addEventListener("resize",function(){h()}),b.exports={refresh:g,refreshAll:h}},{}],8:[function(b,c,d){!function(b,e){"use strict";function f(a){a=a.split(" ");for(var b={},c=a.length,d=[];c--;)b.hasOwnProperty(a[c])||(b[a[c]]=1,d.unshift(a[c]));return d.join(" ")}var g="file:"===b.location.protocol,h=e.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"),i=Array.prototype.forEach||function(a,b){if(void 0===this||null===this||"function"!=typeof a)throw new TypeError;var c,d=this.length>>>0;for(c=0;d>c;++c)c in this&&a.call(b,this[c],c,this)},j={},k=0,l=[],m=[],n={},o=function(a){return a.cloneNode(!0)},p=function(a,b){m[a]=m[a]||[],m[a].push(b)},q=function(a){for(var b=0,c=m[a].length;c>b;b++)!function(b){setTimeout(function(){m[a][b](o(j[a]))},0)}(b)},r=function(a,c){if(void 0!==j[a])j[a]instanceof SVGSVGElement?c(o(j[a])):p(a,c);else{if(!b.XMLHttpRequest)return c("Browser does not support XMLHttpRequest"),!1;j[a]={},p(a,c);var d=new XMLHttpRequest;d.onreadystatechange=function(){if(4===d.readyState){if(404===d.status||null===d.responseXML)return c("Unable to load SVG file: "+a),g&&c("Note: SVG injection ajax calls do not work locally without adjusting security setting in your browser. Or consider using a local webserver."),c(),!1;if(!(200===d.status||g&&0===d.status))return c("There was a problem injecting the SVG: "+d.status+" "+d.statusText),!1;if(d.responseXML instanceof Document)j[a]=d.responseXML.documentElement;else if(DOMParser&&DOMParser instanceof Function){var b;try{var e=new DOMParser;b=e.parseFromString(d.responseText,"text/xml")}catch(f){b=void 0}if(!b||b.getElementsByTagName("parsererror").length)return c("Unable to parse SVG file: "+a),!1;j[a]=b.documentElement}q(a)}},d.open("GET",a),d.overrideMimeType&&d.overrideMimeType("text/xml"),d.send()}},s=function(a,c,d,e){var g=a.getAttribute("data-src")||a.getAttribute("src");if(!/svg$/i.test(g))return e("Attempted to inject a file with a non-svg extension: "+g),void 0;if(!h){var j=a.getAttribute("data-fallback")||a.getAttribute("data-png");return j?(a.setAttribute("src",j),e(null)):d?(a.setAttribute("src",d+"/"+g.split("/").pop().replace(".svg",".png")),e(null)):e("This browser does not support SVG and no PNG fallback was defined."),void 0}-1===l.indexOf(a)&&(l.push(a),a.setAttribute("src",""),r(g,function(d){if("undefined"==typeof d||"string"==typeof d)return e(d),!1;var h=a.getAttribute("id");h&&d.setAttribute("id",h);var j=a.getAttribute("title");j&&d.setAttribute("title",j);var m=[].concat(d.getAttribute("class")||[],"injected-svg",a.getAttribute("class")||[]).join(" ");d.setAttribute("class",f(m));var o=a.getAttribute("style");o&&d.setAttribute("style",o);var p=[].filter.call(a.attributes,function(a){return/^data-\w[\w\-]*$/.test(a.name)});i.call(p,function(a){a.name&&a.value&&d.setAttribute(a.name,a.value)});for(var q,r=d.querySelectorAll("defs clipPath[id]"),s=0,t=r.length;t>s;s++){q=r[s].id+"-"+k;for(var u=d.querySelectorAll('[clip-path*="'+r[s].id+'"]'),v=0,w=u.length;w>v;v++)u[v].setAttribute("clip-path","url(#"+q+")");r[s].id=q}d.removeAttribute("xmlns:a");for(var x,y,z=d.querySelectorAll("script"),A=[],B=0,C=z.length;C>B;B++)y=z[B].getAttribute("type"),y&&"application/ecmascript"!==y&&"application/javascript"!==y||(x=z[B].innerText||z[B].textContent,A.push(x),d.removeChild(z[B]));if(A.length>0&&("always"===c||"once"===c&&!n[g])){for(var D=0,E=A.length;E>D;D++)new Function(A[D])(b);n[g]=!0}a.parentNode.replaceChild(d,a),delete l[l.indexOf(a)],a=null,k++,e(d)}))},t=function(a,b,c){b=b||{};var d=b.evalScripts||"always",e=b.pngFallback||!1,f=b.each;if(void 0!==a.length){var g=0;i.call(a,function(b){s(b,d,e,function(b){f&&"function"==typeof f&&f(b),c&&a.length===++g&&c(g)})})}else a?s(a,d,e,function(b){f&&"function"==typeof f&&f(b),c&&c(1),a=null}):c&&c(0)};"object"==typeof c&&"object"==typeof c.exports?c.exports=d=t:"function"==typeof a&&a.amd?a(function(){return t}):"object"==typeof b&&(b.SVGInjector=t)}(window,document)},{}]},{},[1])(1)}); +(function() { + 'use strict'; + + angular.module('foundation.core.animation', []) + .service('FoundationAnimation', FoundationAnimation) + ; + + function FoundationAnimation() { + var animations = []; + var service = {}; + + var initClasses = ['ng-enter', 'ng-leave']; + var activeClasses = ['ng-enter-active', 'ng-leave-active']; + var activeGenericClass = 'is-active'; + var events = [ + 'webkitAnimationEnd', 'mozAnimationEnd', + 'MSAnimationEnd', 'oanimationend', + 'animationend', 'webkitTransitionEnd', + 'otransitionend', 'transitionend' + ]; + + service.animate = animate; + service.toggleAnimation = toggleAnimation; + + return service; + + function toggleAnimation(element, futureState) { + if(futureState) { + element.addClass(activeGenericClass); + } else { + element.removeClass(activeGenericClass); + } + } + + function animate(element, futureState, animationIn, animationOut) { + var timedOut = true; + var self = this; + self.cancelAnimation = cancelAnimation; + + var animationClass = futureState ? animationIn: animationOut; + var activation = futureState; + var initClass = activation ? initClasses[0] : initClasses[1]; + var activeClass = activation ? activeClasses[0] : activeClasses[1]; + //stop animation + registerElement(element); + reset(); + element.addClass(animationClass); + element.addClass(initClass); + + element.addClass(activeGenericClass); + + //force a "tick" + reflow(); + + //activate + element[0].style.transitionDuration = ''; + element.addClass(activeClass); + + element.one(events.join(' '), function() { + finishAnimation(); + }); + + setTimeout(function() { + if(timedOut) { + finishAnimation(); + } + }, 3000); + + function finishAnimation() { + deregisterElement(element); + reset(); //reset all classes + element[0].style.transitionDuration = ''; + element.removeClass(!activation ? activeGenericClass : ''); //if not active, remove active class + reflow(); + timedOut = false; + } + + + function cancelAnimation(element) { + deregisterElement(element); + angular.element(element).off(events.join(' ')); //kill all animation event handlers + timedOut = false; + } + + function registerElement(el) { + var elObj = { + el: el, + animation: self + }; + + //kill in progress animations + var inProgress = animations.filter(function(obj) { + return obj.el === el; + }); + if(inProgress.length > 0) { + var target = inProgress[0].el[0]; + + inProgress[0].animation.cancelAnimation(target); + } + + animations.push(elObj); + } + + function deregisterElement(el) { + var index; + var currentAnimation = animations.filter(function(obj, ind) { + if(obj.el === el) { + index = ind; + } + }); + + if(index >= 0) { + animations.splice(index, 1); + } + + } + + function reflow() { + return element[0].offsetWidth; + } + + function reset() { + element[0].style.transitionDuration = 0; + element.removeClass(initClasses.join(' ') + ' ' + activeClasses.join(' ') + ' ' + animationIn + ' ' + animationOut); + } + } + } + +})(); + +(function() { + 'use strict'; + + angular.module('foundation.core', [ + 'foundation.core.animation' + ]) + .service('FoundationApi', FoundationApi) + .service('FoundationAdapter', FoundationAdapter) + .factory('Utils', Utils) + ; + + FoundationApi.$inject = ['FoundationAnimation']; + + function FoundationApi(FoundationAnimation) { + var listeners = {}; + var settings = {}; + var uniqueIds = []; + var service = {}; + + service.subscribe = subscribe; + service.unsubscribe = unsubscribe; + service.publish = publish; + service.getSettings = getSettings; + service.modifySettings = modifySettings; + service.generateUuid = generateUuid; + service.toggleAnimate = toggleAnimate; + service.closeActiveElements = closeActiveElements; + service.animate = animate; + + return service; + + function subscribe(name, callback) { + if (!listeners[name]) { + listeners[name] = []; + } + + listeners[name].push(callback); + return true; + } + + function unsubscribe(name, callback) { + if (listeners[name] !== undefined) { + delete listeners[name]; + } + if (typeof callback == 'function') { + callback.call(this); + } + } + + function publish(name, msg) { + if (!listeners[name]) { + listeners[name] = []; + } + + listeners[name].forEach(function(cb) { + cb(msg); + }); + + return; + } + + function getSettings() { + return settings; + } + + function modifySettings(tree) { + settings = angular.extend(settings, tree); + return settings; + } + + function generateUuid() { + var uuid = ''; + + //little trick to produce semi-random IDs + do { + uuid += 'zf-uuid-'; + for (var i=0; i<15; i++) { + uuid += Math.floor(Math.random()*16).toString(16); + } + } while(!uniqueIds.indexOf(uuid)); + + uniqueIds.push(uuid); + return uuid; + } + + function toggleAnimate(element, futureState) { + FoundationAnimation.toggleAnimate(element, futureState); + } + + function closeActiveElements(options) { + var self = this; + options = options || {}; + var activeElements = document.querySelectorAll('.is-active[zf-closable]'); + // action sheets are nested zf-closable elements, so we have to target the parent + var nestedActiveElements = document.querySelectorAll('[zf-closable] > .is-active') + + if (activeElements.length) { + angular.forEach(activeElements, function(el) { + if (options.exclude !== el.id) { + self.publish(el.id, 'close'); + } + }); + } + if (nestedActiveElements.length) { + angular.forEach(nestedActiveElements, function(el) { + var parentId = el.parentNode.id; + if (options.exclude !== parentId) { + self.publish(parentId, 'close'); + } + }) + } + } + + function animate(element, futureState, animationIn, animationOut) { + FoundationAnimation.animate(element, futureState, animationIn, animationOut); + } + } + + FoundationAdapter.$inject = ['FoundationApi']; + + function FoundationAdapter(foundationApi) { + + var service = {}; + + service.activate = activate; + service.deactivate = deactivate; + + return service; + + function activate(target) { + foundationApi.publish(target, 'show'); + } + + function deactivate(target) { + foundationApi.publish(target, 'hide'); + } + } + + + function Utils() { + var utils = {}; + + utils.throttle = throttleUtil; + + return utils; + + function throttleUtil(func, delay) { + var timer = null; + + return function () { + var context = this, args = arguments; + + if (timer === null) { + timer = setTimeout(function () { + func.apply(context, args); + timer = null; + }, delay); + } + }; + } + } + +})(); + +(function() { + 'use strict'; + + angular.module('foundation.dynamicRouting.animations', ['foundation.dynamicRouting']) + .directive('uiView', uiView) + ; + + uiView.$inject = ['$rootScope', '$state']; + + function uiView($rootScope, $state) { + var directive = { + restrict : 'ECA', + priority : -400, + link : link + }; + + return directive; + + function link(scope, element) { + var animation = {}; + var animationEnded = false; + var presetHeight; + + var cleanup = [ + $rootScope.$on('$stateChangeStart', onStateChangeStart), + $rootScope.$on('$stateChangeError', onStateChangeError), + scope.$on('$stateChangeSuccess', onStateChangeSuccess), + scope.$on('$viewContentAnimationEnded', onViewContentAnimationEnded) + ]; + + var destroyed = scope.$on('$destroy', function onDestroy() { + angular.forEach(cleanup, function (cb) { + if (angular.isFunction(cb)) { + cb(); + } + }); + + destroyed(); + }); + + function onStateChangeStart(event, toState, toParams, fromState, fromParams) { + + if (fromState.animation) { + if (!fromState.animation.leave && !toState.animation.leave) { + return; + } + else { + animationRouter(event, toState, fromState); + } + } + } + + function animationRouter(event, toState, fromState) { + if (!animationEnded) { + resetParent(); + prepareParent(); + + element.removeClass(fromState.animation.leave); + } + else { + prepareParent(); + + element.addClass(fromState.animation.leave); + } + + } + + function onStateChangeError() { + if(animation.leave) { + element.removeClass(animation.leave); + } + + resetParent(); //reset parent if state change fails + } + + function onStateChangeSuccess() { + resetParent(); + if ($state.includes(getState()) && animation.enter) { + element.addClass(animation.enter); + } + } + + function onViewContentAnimationEnded(event) { + if (event.targetScope === scope && animation.enter) { + element.removeClass(animation.enter); + } + + animationEnded = true; + + } + + function getState() { + var view = element.data('$uiView'); + var state = view && view.state && view.state.self; + + if (state) { + angular.extend(animation, state.animation); + } + + return state; + } + + function resetParent() { + element.parent().removeClass('position-absolute'); + if(presetHeight !== true) { + element.parent()[0].style.height = null; + } + } + + function prepareParent() { + var parentHeight = parseInt(element.parent()[0].style.height); + var elHeight = parseInt(window.getComputedStyle(element[0], null).getPropertyValue('height')); + var tempHeight = parentHeight > 0 ? parentHeight : elHeight > 0 ? elHeight : ''; + + if(parentHeight > 0) { + presetHeight = true; + } + + element.parent()[0].style.height = tempHeight + 'px'; + element.parent().addClass('position-absolute'); + } + } + } + +})(); +(function() { + 'use strict'; + + angular.module('foundation.dynamicRouting', ['ui.router']) + .provider('$FoundationState', FoundationState) + .controller('DefaultController', DefaultController) + .config(DynamicRoutingConfig) + .run(DynamicRoutingRun) + ; + + FoundationState.$inject = ['$stateProvider']; + + function FoundationState($stateProvider) { + var complexViews = {}; + + this.registerDynamicRoutes = function(routes) { + var dynamicRoutes = routes || foundationRoutes; + + angular.forEach(dynamicRoutes, function(page) { + if (page.hasComposed) { + if (!angular.isDefined(complexViews[page.parent])) { + complexViews[page.parent] = { children: {} }; + } + + if (page.controller) { + page.controller = getController(page); + } + + complexViews[page.parent].children[page.name] = page; + + } else if (page.composed) { + if(!angular.isDefined(complexViews[page.name])) { + complexViews[page.name] = { children: {} }; + } + + if (page.controller) { + page.controller = getController(page); + } + + angular.extend(complexViews[page.name], page); + } else { + var state = { + url: page.url, + templateUrl: page.path, + abstract: page.abstract || false, + parent: page.parent || '', + controller: getController(page), + data: getData(page), + animation: buildAnimations(page), + }; + + $stateProvider.state(page.name, state); + } + }); + + angular.forEach(complexViews, function(page) { + var state = { + url: page.url, + parent: page.parent || '', + abstract: page.abstract || false, + data: getData(page), + animation: buildAnimations(page), + views: { + '': buildState(page.path, page) + } + }; + + angular.forEach(page.children, function(sub) { + state.views[sub.name + '@' + page.name] = buildState(sub.path, page); + }); + + $stateProvider.state(page.name, state); + }); + }; + + this.$get = angular.noop; + + function getData(page) { + var data = { vars: {} }; + if (page.data) { + if (typeof page.data.vars === "object") { + data.vars = page.data.vars; + } + delete page.data.vars; + angular.extend(data, page.data); + } + delete page.data; + angular.extend(data.vars, page); + return data; + } + + function buildState(path, state) { + return { + templateUrl: path, + controller: getController(state), + }; + } + + function getController(state) { + var ctrl = state.controller || 'DefaultController'; + + if (!/\w\s+as\s+\w/.test(ctrl)) { + ctrl += ' as PageCtrl'; + } + + return ctrl; + } + + function buildAnimations(state) { + var animations = {}; + + if (state.animationIn) { + animations.enter = state.animationIn; + } + + if (state.animationOut) { + animations.leave = state.animationOut; + } + + return animations; + } + } + + DefaultController.$inject = ['$scope', '$stateParams', '$state']; + + function DefaultController($scope, $stateParams, $state) { + var params = {}; + angular.forEach($stateParams, function(value, key) { + params[key] = value; + }); + + $scope.params = params; + $scope.current = $state.current.name; + + if($state.current.views) { + $scope.vars = $state.current.data.vars; + $scope.composed = $state.current.data.vars.children; + } else { + $scope.vars = $state.current.data.vars; + } + } + + DynamicRoutingConfig.$inject = ['$FoundationStateProvider']; + + function DynamicRoutingConfig(FoundationStateProvider) { + FoundationStateProvider.registerDynamicRoutes(foundationRoutes); + } + + DynamicRoutingRun.$inject = ['$rootScope', '$state', '$stateParams']; + + function DynamicRoutingRun($rootScope, $state, $stateParams) { + $rootScope.$state = $state; + $rootScope.$stateParams = $stateParams; + } + +})(); + +(function() { + 'use strict'; + + angular.module('foundation.mediaquery', ['foundation.core']) + .run(mqInitRun) + .factory('FoundationMQInit', FoundationMQInit) + .factory('mqHelpers', mqHelpers) + .service('FoundationMQ', FoundationMQ) + ; + + mqInitRun.$inject = ['FoundationMQInit']; + + function mqInitRun(mqInit) { + mqInit.init(); + } + + FoundationMQInit.$inject = ['mqHelpers', 'FoundationApi', 'Utils']; + + function FoundationMQInit(helpers, foundationApi, u){ + var factory = {}; + var namedQueries = { + 'default' : 'only screen', + landscape : 'only screen and (orientation: landscape)', + portrait : 'only screen and (orientation: portrait)', + retina : 'only screen and (-webkit-min-device-pixel-ratio: 2),' + + 'only screen and (min--moz-device-pixel-ratio: 2),' + + 'only screen and (-o-min-device-pixel-ratio: 2/1),' + + 'only screen and (min-device-pixel-ratio: 2),' + + 'only screen and (min-resolution: 192dpi),' + + 'only screen and (min-resolution: 2dppx)' + }; + + factory.init = init; + + return factory; + + function init() { + var mediaQueries; + var extractedMedia; + var mediaObject; + + helpers.headerHelper(['foundation-mq']); + extractedMedia = helpers.getStyle('.foundation-mq', 'font-family'); + + mediaQueries = helpers.parseStyleToObject((extractedMedia)); + + for(var key in mediaQueries) { + mediaQueries[key] = 'only screen and (min-width: ' + mediaQueries[key].replace('rem', 'em') + ')'; + } + + + foundationApi.modifySettings({ + mediaQueries: angular.extend(mediaQueries, namedQueries) + }); + + window.addEventListener('resize', u.throttle(function() { + foundationApi.publish('resize', 'window resized'); + }, 50)); + + } + } + + + function mqHelpers() { + var factory = {}; + + factory.headerHelper = headerHelper; + factory.getStyle = getStyle; + factory.parseStyleToObject = parseStyleToObject; + + return factory; + + function headerHelper(classArray) { + var i = classArray.length; + var head = angular.element(document.querySelectorAll('head')); + + while(i--) { + head.append(''); + } + + return; + } + + function getStyle(selector, styleName) { + var elem = document.querySelectorAll(selector)[0]; + var style = window.getComputedStyle(elem, null); + + return style.getPropertyValue('font-family'); + } + + // https://github.com/sindresorhus/query-string + function parseStyleToObject(str) { + var styleObject = {}; + + if (typeof str !== 'string') { + return styleObject; + } + + str = str.trim().slice(1, -1); // browsers re-quote string style values + + if (!str) { + return styleObject; + } + + styleObject = str.split('&').reduce(function(ret, param) { + var parts = param.replace(/\+/g, ' ').split('='); + var key = parts[0]; + var val = parts[1]; + key = decodeURIComponent(key); + + // missing `=` should be `null`: + // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters + val = val === undefined ? null : decodeURIComponent(val); + + if (!ret.hasOwnProperty(key)) { + ret[key] = val; + } else if (Array.isArray(ret[key])) { + ret[key].push(val); + } else { + ret[key] = [ret[key], val]; + } + return ret; + }, {}); + + return styleObject; + } + } + + FoundationMQ.$inject = ['FoundationApi']; + + function FoundationMQ(foundationApi) { + var service = []; + + service.getMediaQueries = getMediaQueries; + service.match = match; + service.collectScenariosFromElement = collectScenariosFromElement; + + return service; + + function getMediaQueries() { + return foundationApi.getSettings().mediaQueries; + } + + function match(scenarios) { + var count = scenarios.length; + var queries = service.getMediaQueries(); + var matches = []; + + if (count > 0) { + while (count--) { + var mq; + var rule = scenarios[count].media; + + if (queries[rule]) { + mq = matchMedia(queries[rule]); + } else { + mq = matchMedia(rule); + } + + if (mq.matches) { + matches.push({ ind: count}); + } + } + } + + return matches; + } + + // Collects a scenario object and templates from element + function collectScenariosFromElement(parentElement) { + var scenarios = []; + var templates = []; + + var elements = parentElement.children(); + var i = 0; + + angular.forEach(elements, function(el) { + var elem = angular.element(el); + + + //if no source or no html, capture element itself + if (!elem.attr('src') || !elem.attr('src').match(/.html$/)) { + templates[i] = elem; + scenarios[i] = { media: elem.attr('media'), templ: i }; + } else { + scenarios[i] = { media: elem.attr('media'), src: elem.attr('src') }; + } + + i++; + }); + + return { + scenarios: scenarios, + templates: templates + }; + } + } +})(); + +angular.module('markdown', []) + .directive('markdown', function() { + return { + restrict: 'A', + link: function(scope, element, attrs, controller) { + element.html(marked(element.html())); + } + }; + +}); + +'use strict'; + +(function(){ + var svgDirectives = {}; + + angular.forEach([ + 'clipPath', + 'colorProfile', + 'src', + 'cursor', + 'fill', + 'filter', + 'marker', + 'markerStart', + 'markerMid', + 'markerEnd', + 'mask', + 'stroke' + ], + function(attr) { + svgDirectives[attr] = [ + '$rootScope', + '$location', + '$interpolate', + '$sniffer', + 'urlResolve', + 'computeSVGAttrValue', + 'svgAttrExpressions', + function( + $rootScope, + $location, + $interpolate, + $sniffer, + urlResolve, + computeSVGAttrValue, + svgAttrExpressions) { + return { + restrict: 'A', + link: function(scope, element, attrs) { + var initialUrl; + + //Only apply to svg elements to avoid unnecessary observing + //Check that is in html5Mode and that history is supported + if ((!svgAttrExpressions.SVG_ELEMENT.test(element[0] && + element[0].toString())) || + !$location.$$html5 || + !$sniffer.history) return; + + //Assumes no expressions, since svg is unforgiving of xml violations + initialUrl = attrs[attr]; + attrs.$observe(attr, updateValue); + $rootScope.$on('$locationChangeSuccess', updateValue); + + function updateValue () { + var newVal = computeSVGAttrValue(initialUrl); + //Prevent recursive updating + if (newVal && attrs[attr] !== newVal) attrs.$set(attr, newVal); + } + } + }; + }]; + }); + + angular.module('ngSVGAttributes', []). + factory('urlResolve', [function() { + //Duplicate of urlResolve & urlParsingNode in angular core + var urlParsingNode = document.createElement('a'); + return function urlResolve(url) { + urlParsingNode.setAttribute('href', url); + return urlParsingNode; + }; + }]). + value('svgAttrExpressions', { + FUNC_URI: /^url\((.*)\)$/, + SVG_ELEMENT: /SVG[a-zA-Z]*Element/, + HASH_PART: /#.*/ + }). + factory('computeSVGAttrValue', [ + '$location', '$sniffer', 'svgAttrExpressions', 'urlResolve', + function($location, $sniffer, svgAttrExpressions, urlResolve) { + return function computeSVGAttrValue(url) { + var match, fullUrl; + if (match = svgAttrExpressions.FUNC_URI.exec(url)) { + //hash in html5Mode, forces to be relative to current url instead of base + if (match[1].indexOf('#') === 0) { + fullUrl = $location.absUrl(). + replace(svgAttrExpressions.HASH_PART, '') + + match[1]; + } + //Presumably links to external SVG document + else { + fullUrl = urlResolve(match[1]); + } + } + return fullUrl ? 'url(' + fullUrl + ')' : null; + }; + } + ] + ). + directive(svgDirectives); +}()); + +(function() { + 'use strict'; + + angular.module('foundation.accordion', []) + .controller('ZfAccordionController', zfAccordionController) + .directive('zfAccordion', zfAccordion) + .directive('zfAccordionItem', zfAccordionItem) + ; + + zfAccordionController.$inject = ['$scope']; + + function zfAccordionController($scope) { + var controller = this; + var sections = controller.sections = $scope.sections = []; + var multiOpen = controller.multiOpen = $scope.multiOpen = $scope.multiOpen || false; + var collapsible = controller.collapsible = $scope.collapsible = $scope.multiOpen || $scope.collapsible || true; //multi open infers a collapsible true + var autoOpen = controller.autoOpen = $scope.autoOpen = $scope.autoOpen || true; //auto open opens first tab on render + + controller.select = function(selectSection) { + sections.forEach(function(section) { + //if multi open is allowed, toggle a tab + if(controller.multiOpen) { + if(section.scope === selectSection) { + section.scope.active = !section.scope.active; + } + } else { + //non multi open will close all tabs and open one + if(section.scope === selectSection) { + //if collapsible is allowed, a tab will toggle + section.scope.active = collapsible ? !section.scope.active : true; + } else { + section.scope.active = false; + } + } + + }); + }; + + controller.addSection = function addsection(sectionScope) { + sections.push({ scope: sectionScope }); + + if(sections.length === 1 && autoOpen === true) { + sections[0].active = true; + sections[0].scope.active = true; + } + }; + + controller.closeAll = function() { + sections.forEach(function(section) { + section.scope.active = false; + }); + }; + } + + function zfAccordion() { + var directive = { + restrict: 'EA', + transclude: 'true', + replace: true, + templateUrl: 'components/accordion/accordion.html', + controller: 'ZfAccordionController', + scope: { + multiOpen: '@?', + collapsible: '@?', + autoOpen: '@?' + }, + link: link + }; + + return directive; + + function link(scope, element, attrs, controller) { + scope.multiOpen = controller.multiOpen = scope.multiOpen === "true" ? true : false; + scope.collapsible = controller.collapsible = scope.collapsible === "true" ? true : false; + scope.autoOpen = controller.autoOpen = scope.autoOpen === "true" ? true : false; + } + } + + //accordion item + function zfAccordionItem() { + var directive = { + restrict: 'EA', + templateUrl: 'components/accordion/accordion-item.html', + transclude: true, + scope: { + title: '@' + }, + require: '^zfAccordion', + replace: true, + controller: function() {}, + link: link + }; + + return directive; + + function link(scope, element, attrs, controller, transclude) { + scope.active = false; + controller.addSection(scope); + + scope.activate = function() { + controller.select(scope); + }; + + } + } + +})(); + +(function() { + 'use strict'; + + angular.module('foundation.actionsheet', ['foundation.core']) + .controller('ZfActionSheetController', zfActionSheetController) + .directive('zfActionSheet', zfActionSheet) + .directive('zfAsContent', zfAsContent) + .directive('zfAsButton', zfAsButton) + .service('FoundationActionSheet', FoundationActionSheet) + ; + + FoundationActionSheet.$inject = ['FoundationApi']; + + function FoundationActionSheet(foundationApi) { + var service = {}; + + service.activate = activate; + service.deactivate = deactivate; + + return service; + + //target should be element ID + function activate(target) { + foundationApi.publish(target, 'show'); + } + + //target should be element ID + function deactivate(target) { + foundationApi.publish(target, 'hide'); + } + } + + zfActionSheetController.$inject = ['$scope', 'FoundationApi']; + + function zfActionSheetController($scope, foundationApi) { + var controller = this; + var content = controller.content = $scope.content; + var container = controller.container = $scope.container; + var body = angular.element(document.body); + + controller.registerContent = function(scope) { + content = scope; + content.active = false; + }; + + controller.registerContainer = function(scope) { + container = scope; + container.active = false; + }; + + controller.toggle = toggle; + controller.hide = hide; + + controller.registerListener = function() { + document.body.addEventListener('click', listenerLogic); + }; + + controller.deregisterListener = function() { + document.body.removeEventListener('click', listenerLogic); + } + + function listenerLogic(e) { + var el = e.target; + var insideActionSheet = false; + + do { + if(el.classList && el.classList.contains('action-sheet-container')) { + insideActionSheet = true; + break; + } + + } while ((el = el.parentNode)); + + if(!insideActionSheet) { + // if the element has a toggle attribute, do nothing + if (e.target.attributes['zf-toggle'] || e.target.attributes['zf-hard-toggle']) { + return; + }; + // if the element is outside the action sheet and is NOT a toggle element, hide + hide(); + } + } + + function hide() { + content.hide(); + container.hide(); + + content.$apply(); + container.$apply(); + } + + function toggle() { + content.toggle(); + container.toggle(); + + content.$apply(); + container.$apply(); + } + } + + zfActionSheet.$inject = ['FoundationApi']; + + function zfActionSheet(foundationApi) { + var directive = { + restrict: 'EA', + transclude: true, + replace: true, + templateUrl: 'components/actionsheet/actionsheet.html', + controller: 'ZfActionSheetController', + compile: compile + }; + + return directive; + + function compile() { + + return { + pre: preLink, + post: postLink + }; + + function preLink(scope, iElement, iAttrs) { + iAttrs.$set('zf-closable', 'actionsheet'); + } + + function postLink(scope, element, attrs, controller) { + var id = attrs.id || foundationApi.generateUuid(); + attrs.$set('id', id); + + scope.active = false; + + foundationApi.subscribe(id, function(msg) { + if (msg === 'toggle') { + controller.toggle(); + } + + if (msg === 'hide' || msg === 'close') { + controller.hide(); + } + + }); + + controller.registerContainer(scope); + + scope.toggle = function() { + scope.active = !scope.active; + return; + }; + + scope.hide = function() { + scope.active = false; + return; + }; + } + } + } + + zfAsContent.$inject = ['FoundationApi']; + + function zfAsContent(foundationApi) { + var directive = { + restrict: 'EA', + transclude: true, + replace: true, + templateUrl: 'components/actionsheet/actionsheet-content.html', + require: '^zfActionSheet', + scope: { + position: '@?' + }, + link: link + }; + + return directive; + + function link(scope, element, attrs, controller) { + scope.active = false; + scope.position = scope.position || 'bottom'; + controller.registerContent(scope); + + scope.toggle = function() { + scope.active = !scope.active; + if(scope.active) { + controller.registerListener(); + } else { + controller.deregisterListener(); + } + + return; + }; + + scope.hide = function() { + scope.active = false; + controller.deregisterListener(); + return; + }; + } + } + + zfAsButton.$inject = ['FoundationApi']; + + function zfAsButton(foundationApi) { + var directive = { + restrict: 'EA', + transclude: true, + replace: true, + templateUrl: 'components/actionsheet/actionsheet-button.html', + require: '^zfActionSheet', + scope: { + title: '@?' + }, + link: link + } + + return directive; + + function link(scope, element, attrs, controller) { + + element.on('click', function(e) { + controller.toggle(); + e.preventDefault(); + }); + + } + } + +})(); + +(function() { + 'use strict'; + + angular.module('foundation.common', ['foundation.core']) + .directive('zfClose', zfClose) + .directive('zfOpen', zfOpen) + .directive('zfToggle', zfToggle) + .directive('zfEscClose', zfEscClose) + .directive('zfSwipeClose', zfSwipeClose) + .directive('zfHardToggle', zfHardToggle) + ; + + zfClose.$inject = ['FoundationApi']; + + function zfClose(foundationApi) { + var directive = { + restrict: 'A', + link: link + }; + + return directive; + + function link(scope, element, attrs) { + var targetId = ''; + if (attrs.zfClose) { + targetId = attrs.zfClose; + } else { + var parentElement= false; + var tempElement = element.parent(); + //find parent modal + while(parentElement === false) { + if(tempElement[0].nodeName == 'BODY') { + parentElement = ''; + } + + if(typeof tempElement.attr('zf-closable') !== 'undefined' && tempElement.attr('zf-closable') !== false) { + parentElement = tempElement; + } + + tempElement = tempElement.parent(); + } + targetId = parentElement.attr('id'); + } + + element.on('click', function(e) { + foundationApi.publish(targetId, 'close'); + e.preventDefault(); + }); + } + } + + zfOpen.$inject = ['FoundationApi']; + + function zfOpen(foundationApi) { + var directive = { + restrict: 'A', + link: link + }; + + return directive; + + function link(scope, element, attrs) { + element.on('click', function(e) { + foundationApi.publish(attrs.zfOpen, 'open'); + e.preventDefault(); + }); + } + } + + zfToggle.$inject = ['FoundationApi']; + + function zfToggle(foundationApi) { + var directive = { + restrict: 'A', + link: link + } + + return directive; + + function link(scope, element, attrs) { + element.on('click', function(e) { + foundationApi.publish(attrs.zfToggle, 'toggle'); + e.preventDefault(); + }); + } + } + + zfEscClose.$inject = ['FoundationApi']; + + function zfEscClose(foundationApi) { + var directive = { + restrict: 'A', + link: link + }; + + return directive; + + function link(scope, element, attrs) { + element.on('keyup', function(e) { + if (e.keyCode === 27) { + foundationApi.closeActiveElements(); + } + e.preventDefault(); + }); + } + } + + zfSwipeClose.$inject = ['FoundationApi']; + + function zfSwipeClose(foundationApi) { + var directive = { + restrict: 'A', + link: link + }; + return directive; + + function link($scope, element, attrs) { + var swipeDirection; + var hammerElem; + if (Hammer) { + hammerElem = new Hammer(element[0]); + // set the options for swipe (to make them a bit more forgiving in detection) + hammerElem.get('swipe').set({ + direction: Hammer.DIRECTION_ALL, + threshold: 5, // this is how far the swipe has to travel + velocity: 0.5 // and this is how fast the swipe must travel + }); + } + // detect what direction the directive is pointing + switch (attrs.zfSwipeClose) { + case 'right': + swipeDirection = 'swiperight'; + break; + case 'left': + swipeDirection = 'swipeleft'; + break; + case 'up': + swipeDirection = 'swipeup'; + break; + case 'down': + swipeDirection = 'swipedown'; + break; + default: + swipeDirection = 'swipe'; + } + hammerElem.on(swipeDirection, function() { + foundationApi.publish(attrs.id, 'close'); + }); + } + } + + zfHardToggle.$inject = ['FoundationApi']; + + function zfHardToggle(foundationApi) { + var directive = { + restrict: 'A', + link: link + }; + + return directive; + + function link(scope, element, attrs) { + element.on('click', function(e) { + foundationApi.closeActiveElements({exclude: attrs.zfHardToggle}); + foundationApi.publish(attrs.zfHardToggle, 'toggle'); + e.preventDefault(); + }); + } + } + +})(); + +(function () { + 'use strict'; + + angular.module('foundation.iconic', []) + .provider('Iconic', Iconic) + .directive('zfIconic', zfIconic) + ; + + // iconic wrapper + function Iconic() { + // default path + var assetPath = 'assets/img/iconic/'; + + /** + * Sets the path used to locate the iconic SVG files + * @param {string} path - the base path used to locate the iconic SVG files + */ + this.setAssetPath = function (path) { + assetPath = angular.isString(path) ? path : assetPath; + }; + + /** + * Service implementation + * @returns {{}} + */ + this.$get = function () { + var iconicObject = new IconicJS(); + + var service = { + getAccess: getAccess, + getAssetPath: getAssetPath + }; + + return service; + + /** + * + * @returns {Window.IconicJS} + */ + function getAccess() { + return iconicObject; + } + + /** + * + * @returns {string} + */ + function getAssetPath() { + return assetPath; + } + }; + } + + zfIconic.$inject = ['Iconic', 'FoundationApi', '$compile']; + + function zfIconic(iconic, foundationApi, $compile) { + var directive = { + restrict: 'A', + template: '', + transclude: true, + replace: true, + scope: { + dynSrc: '=?', + dynIcon: '=?', + size: '@?', + icon: '@', + iconDir: '@?' + }, + compile: compile + }; + + return directive; + + function compile() { + var contents, assetPath; + + return { + pre: preLink, + post: postLink + }; + + function preLink(scope, element, attrs) { + + if (scope.iconDir) { + // path set via attribute + assetPath = scope.iconDir; + } else { + // default path + assetPath = iconic.getAssetPath(); + } + // make sure ends with / + if (assetPath.charAt(assetPath.length - 1) !== '/') { + assetPath += '/'; + } + + if (scope.dynSrc) { + attrs.$set('data-src', scope.dynSrc); + } else if (scope.dynIcon) { + attrs.$set('data-src', assetPath + scope.dynIcon + '.svg'); + } else { + if (scope.icon) { + attrs.$set('data-src', assetPath + scope.icon + '.svg'); + } else { + // To support expressions on data-src + attrs.$set('data-src', attrs.src); + } + } + + // check if size already added as class + if (!element.hasClass('iconic-sm') && !element.hasClass('iconic-md') && !element.hasClass('iconic-lg')) { + var iconicClass; + switch (scope.size) { + case 'small': + iconicClass = 'iconic-sm'; + break; + case 'medium': + iconicClass = 'iconic-md'; + break; + case 'large': + iconicClass = 'iconic-lg'; + break; + default: + iconicClass = 'iconic-fluid'; + } + element.addClass(iconicClass); + } + + // save contents of un-inject html, to use for dynamic re-injection + contents = element[0].outerHTML; + } + + function postLink(scope, element, attrs) { + var svgElement, ico = iconic.getAccess(); + + injectSvg(element[0]); + + foundationApi.subscribe('resize', function () { + // only run update on current element + ico.update(element[0]); + }); + + // handle dynamic updating of src + if (scope.dynSrc) { + scope.$watch('dynSrc', function (newVal, oldVal) { + if (newVal && newVal !== oldVal) { + reinjectSvg(scope.dynSrc); + } + }); + } + // handle dynamic updating of icon + if (scope.dynIcon) { + scope.$watch('dynIcon', function (newVal, oldVal) { + if (newVal && newVal !== oldVal) { + reinjectSvg(assetPath + scope.dynIcon + '.svg'); + } + }); + } + + function reinjectSvg(newSrc) { + if (svgElement) { + // set html + svgElement.empty(); + svgElement.append(angular.element(contents)); + + // set new source + svgElement.attr('data-src', newSrc); + + // reinject + injectSvg(svgElement[0]); + } + } + + function injectSvg(element) { + ico.inject(element, { + each: function (injectedElem) { + // compile injected svg + var angElem = angular.element(injectedElem); + svgElement = $compile(angElem)(angElem.scope()); + } + }); + } + } + } + } + +})(); + +(function() { + 'use strict'; + + angular.module('foundation.interchange', ['foundation.core', 'foundation.mediaquery']) + .directive('zfInterchange', zfInterchange) + ; + + zfInterchange.$inject = [ '$compile', '$http', '$templateCache', 'FoundationApi', 'FoundationMQ']; + + function zfInterchange($compile, $http, $templateCache, foundationApi, foundationMQ) { + + var directive = { + restrict: 'EA', + transclude: 'element', + scope: { + position: '@' + }, + replace: true, + template: '
', + link: link + }; + + return directive; + + function link(scope, element, attrs, ctrl, transclude) { + var childScope, current, scenarios, innerTemplates; + + var globalQueries = foundationMQ.getMediaQueries(); + + //setup + foundationApi.subscribe('resize', function(msg) { + transclude(function(clone, newScope) { + if(!scenarios || !innerTemplates) { + collectInformation(clone); + } + + var ruleMatches = foundationMQ.match(scenarios); + var scenario = ruleMatches.length === 0 ? null : scenarios[ruleMatches[0].ind]; + + //this could use some love + if(scenario && checkScenario(scenario)) { + var compiled; + + if(childScope) { + childScope.$destroy(); + childScope = null; + } + + if(typeof scenario.templ !== 'undefined') { + childScope = newScope; + + //temp container + var tmp = document.createElement('div'); + tmp.appendChild(innerTemplates[scenario.templ][0]); + + element.html(tmp.innerHTML); + $compile(element.contents())(childScope); + current = scenario; + } else { + var loader = templateLoader(scenario.src); + loader.success(function(html) { + childScope = newScope; + element.html(html); + }).then(function(){ + $compile(element.contents())(childScope); + current = scenario; + }); + } + } + }); + + }); + + //init + foundationApi.publish('resize', 'initial resize'); + + function templateLoader(templateUrl) { + return $http.get(templateUrl, {cache: $templateCache}); + } + + function collectInformation(el) { + var data = foundationMQ.collectScenariosFromElement(el); + + scenarios = data.scenarios; + innerTemplates = data.templates; + } + + function checkScenario(scenario) { + return !current || current !== scenario; + } + } + } + +})(); + +(function() { + 'use strict'; + + angular.module('foundation.modal', ['foundation.core']) + .directive('zfModal', modalDirective) + .factory('ModalFactory', ModalFactory) + ; + + FoundationModal.$inject = ['FoundationApi', 'ModalFactory']; + + function FoundationModal(foundationApi, ModalFactory) { + var service = {}; + + service.activate = activate; + service.deactivate = deactivate; + service.newModal = newModal; + + return service; + + //target should be element ID + function activate(target) { + foundationApi.publish(target, 'show'); + } + + //target should be element ID + function deactivate(target) { + foundationApi.publish(target, 'hide'); + } + + //new modal has to be controlled via the new instance + function newModal(config) { + return new ModalFactory(config); + } + } + + modalDirective.$inject = ['FoundationApi']; + + function modalDirective(foundationApi) { + + var directive = { + restrict: 'EA', + templateUrl: 'components/modal/modal.html', + transclude: true, + scope: true, + replace: true, + compile: compile + }; + + return directive; + + function compile(tElement, tAttrs, transclude) { + var type = 'modal'; + + return { + pre: preLink, + post: postLink + }; + + function preLink(scope, iElement, iAttrs, controller) { + iAttrs.$set('zf-closable', type); + } + + function postLink(scope, element, attrs) { + var dialog = angular.element(element.children()[0]); + + scope.active = scope.active || false; + scope.overlay = attrs.overlay === 'false' ? false : true; + scope.overlayClose = attrs.overlayClose === 'false' ? false : true; + + var animationIn = attrs.animationIn || 'fadeIn'; + var animationOut = attrs.animationOut || 'fadeOut'; + + var overlayIn = 'fadeIn'; + var overlayOut = 'fadeOut'; + + scope.hideOverlay = function() { + if(scope.overlayClose) { + scope.hide(); + } + }; + + scope.hide = function() { + scope.active = false; + animate(); + return; + }; + + scope.show = function() { + scope.active = true; + animate(); + dialog.tabIndex = -1; + dialog[0].focus(); + return; + }; + + scope.toggle = function() { + scope.active = !scope.active; + animate(); + return; + }; + + init(); + + //setup + foundationApi.subscribe(attrs.id, function(msg) { + if(msg === 'show' || msg === 'open') { + scope.show(); + } else if (msg === 'close' || msg === 'hide') { + scope.hide(); + } else if (msg === 'toggle') { + scope.toggle(); + } + + if (scope.$root && !scope.$root.$$phase) { + scope.$apply(); + } + + return; + }); + + function animate() { + //animate both overlay and dialog + if(!scope.overlay) { + element.css('background', 'transparent'); + } + + foundationApi.animate(element, scope.active, overlayIn, overlayOut); + foundationApi.animate(dialog, scope.active, animationIn, animationOut); + } + + function init() { + if(scope.active) { + scope.show(); + } + } + } + } + } + + ModalFactory.$inject = ['$http', '$templateCache', '$rootScope', '$compile', '$timeout', '$q', 'FoundationApi']; + + function ModalFactory($http, $templateCache, $rootScope, $compile, $timeout, $q, foundationApi) { + return modalFactory; + + function modalFactory(config) { + var self = this, //for prototype functions + container = angular.element(config.container || document.body), + id = config.id || foundationApi.generateUuid(), + attached = false, + destroyed = false, + html, + element, + fetched, + scope, + contentScope + ; + + var props = [ + 'animationIn', + 'animationOut', + 'overlay', + 'overlayClose' + ]; + + if(config.templateUrl) { + //get template + fetched = $http.get(config.templateUrl, { + cache: $templateCache + }).then(function (response) { + html = response.data; + assembleDirective(); + }); + + } else if(config.template) { + //use provided template + fetched = true; + html = config.template; + assembleDirective(); + } + + self.activate = activate; + self.deactivate = deactivate; + self.toggle = toggle; + self.destroy = destroy; + + + return { + activate: activate, + deactivate: deactivate, + toggle: toggle, + destroy: destroy + }; + + function checkStatus() { + if(destroyed) { + throw "Error: Modal was destroyed. Delete the object and create a new ModalFactory instance." + } + } + + function activate() { + checkStatus(); + $timeout(function() { + init(true); + foundationApi.publish(id, 'show'); + }, 0, false); + } + + function deactivate() { + checkStatus(); + $timeout(function() { + init(false); + foundationApi.publish(id, 'hide'); + }, 0, false); + } + + function toggle() { + checkStatus(); + $timeout(function() { + init(true); + foundationApi.publish(id, 'toggle'); + }, 0, false); + } + + function init(state) { + $q.when(fetched).then(function() { + if(!attached && html.length > 0) { + var modalEl = container.append(element); + + scope.active = state; + $compile(element)(scope); + + attached = true; + } + }); + } + + function assembleDirective() { + // check for duplicate elements to prevent factory from cloning modals + if (document.getElementById(id)) { + return; + } + + html = '' + html + ''; + + element = angular.element(html); + + scope = $rootScope.$new(); + + // account for directive attributes + for(var i = 0; i < props.length; i++) { + var prop = props[i]; + + if(config[prop]) { + switch (prop) { + case 'animationIn': + element.attr('animation-in', config[prop]); + break; + case 'animationOut': + element.attr('animation-out', config[prop]); + break; + default: + element.attr(prop, config[prop]); + } + } + } + // access view scope variables + if (config.contentScope) { + contentScope = config.contentScope; + for (var prop in config.contentScope) { + if (config.contentScope.hasOwnProperty(prop)) { + scope[prop] = config.contentScope[prop]; + } + } + } + } + + function destroy() { + self.deactivate(); + setTimeout(function() { + scope.$destroy(); + element.remove(); + destroyed = true; + }, 3000); + foundationApi.unsubscribe(id); + } + + } + + } + +})(); + +(function() { + 'use strict'; + + angular.module('foundation.notification', ['foundation.core']) + .controller('ZfNotificationController', ZfNotificationController) + .directive('zfNotificationSet', zfNotificationSet) + .directive('zfNotification', zfNotification) + .directive('zfNotificationStatic', zfNotificationStatic) + .directive('zfNotify', zfNotify) + .factory('NotificationFactory', NotificationFactory) + .service('FoundationNotification', FoundationNotification) + ; + + FoundationNotification.$inject = ['FoundationApi', 'NotificationFactory']; + + function FoundationNotification(foundationApi, NotificationFactory) { + var service = {}; + + service.activate = activate; + service.deactivate = deactivate; + + return service; + + //target should be element ID + function activate(target) { + foundationApi.publish(target, 'show'); + } + + //target should be element ID + function deactivate(target) { + foundationApi.publish(target, 'hide'); + } + + function toggle(target) { + foundationApi.publish(target, 'toggle'); + } + + function createNotificationSet(config) { + return new NotificationFactory(config); + } + } + + + ZfNotificationController.$inject = ['$scope', 'FoundationApi']; + + function ZfNotificationController($scope, foundationApi) { + var controller = this; + controller.notifications = $scope.notifications = $scope.notifications || []; + + controller.addNotification = function(info) { + var id = foundationApi.generateUuid(); + info.id = id; + $scope.notifications.push(info); + }; + + controller.removeNotification = function(id) { + $scope.notifications.forEach(function(notification) { + if(notification.id === id) { + var ind = $scope.notifications.indexOf(notification); + $scope.notifications.splice(ind, 1); + } + }); + }; + + controller.clearAll = function() { + while($scope.notifications.length > 0) { + $scope.notifications.pop(); + } + }; + } + + zfNotificationSet.$inject = ['FoundationApi']; + + function zfNotificationSet(foundationApi) { + var directive = { + restrict: 'EA', + templateUrl: 'components/notification/notification-set.html', + controller: 'ZfNotificationController', + replace: true, + scope: { + position: '@' + }, + link: link + }; + + return directive; + + function link(scope, element, attrs, controller) { + scope.position = scope.position ? scope.position.split(' ').join('-') : 'top-right'; + + foundationApi.subscribe(attrs.id, function(msg) { + if(msg === 'clearall') { + controller.clearAll(); + } + else { + controller.addNotification(msg); + if (!scope.$root.$$phase) { + scope.$apply(); + } + } + }); + } + } + + zfNotification.$inject = ['FoundationApi']; + + function zfNotification(foundationApi) { + var directive = { + restrict: 'EA', + templateUrl: 'components/notification/notification.html', + replace: true, + transclude: true, + require: '^zfNotificationSet', + controller: function() { }, + scope: { + title: '=?', + content: '=?', + image: '=?', + notifId: '=', + color: '=?', + autoclose: '=?' + }, + compile: compile + }; + + return directive; + + function compile() { + + return { + pre: preLink, + post: postLink + }; + + function preLink(scope, iElement, iAttrs) { + iAttrs.$set('zf-closable', 'notification'); + } + + function postLink(scope, element, attrs, controller) { + scope.active = false; + var animationIn = attrs.animationIn || 'fadeIn'; + var animationOut = attrs.animationOut || 'fadeOut'; + var hammerElem; + + //due to dynamic insertion of DOM, we need to wait for it to show up and get working! + setTimeout(function() { + scope.active = true; + foundationApi.animate(element, scope.active, animationIn, animationOut); + }, 50); + + scope.hide = function() { + scope.active = false; + foundationApi.animate(element, scope.active, animationIn, animationOut); + setTimeout(function() { + controller.removeNotification(scope.notifId); + }, 50); + }; + + // close if autoclose + if (scope.autoclose) { + setTimeout(function() { + if (scope.active) { + scope.hide(); + } + }, parseInt(scope.autoclose)); + }; + + // close on swipe + if (Hammer) { + hammerElem = new Hammer(element[0]); + // set the options for swipe (to make them a bit more forgiving in detection) + hammerElem.get('swipe').set({ + direction: Hammer.DIRECTION_ALL, + threshold: 5, // this is how far the swipe has to travel + velocity: 0.5 // and this is how fast the swipe must travel + }); + } + + hammerElem.on('swipe', function() { + if (scope.active) { + scope.hide(); + } + }); + } + } + } + + zfNotificationStatic.$inject = ['FoundationApi']; + + function zfNotificationStatic(foundationApi) { + var directive = { + restrict: 'EA', + templateUrl: 'components/notification/notification-static.html', + replace: true, + transclude: true, + scope: { + title: '@?', + content: '@?', + image: '@?', + color: '@?', + autoclose: '@?' + }, + compile: compile + }; + + return directive; + + function compile() { + var type = 'notification'; + + return { + pre: preLink, + post: postLink + }; + + function preLink(scope, iElement, iAttrs, controller) { + iAttrs.$set('zf-closable', type); + } + + function postLink(scope, element, attrs, controller) { + scope.position = attrs.position ? attrs.position.split(' ').join('-') : 'top-right'; + + var animationIn = attrs.animationIn || 'fadeIn'; + var animationOut = attrs.animationOut || 'fadeOut'; + + //setup + foundationApi.subscribe(attrs.id, function(msg) { + if(msg == 'show' || msg == 'open') { + scope.show(); + // close if autoclose + if (scope.autoclose) { + setTimeout(function() { + if (scope.active) { + scope.hide(); + } + }, parseInt(scope.autoclose)); + }; + } else if (msg == 'close' || msg == 'hide') { + scope.hide(); + } else if (msg == 'toggle') { + scope.toggle(); + // close if autoclose + if (scope.autoclose) { + setTimeout(function() { + if (scope.active) { + scope.toggle(); + } + }, parseInt(scope.autoclose)); + }; + } + + foundationApi.animate(element, scope.active, animationIn, animationOut); + scope.$apply(); + + return; + }); + + scope.hide = function() { + scope.active = false; + foundationApi.animate(element, scope.active, animationIn, animationOut); + return; + }; + + scope.show = function() { + scope.active = true; + foundationApi.animate(element, scope.active, animationIn, animationOut); + return; + }; + + scope.toggle = function() { + scope.active = !scope.active; + foundationApi.animate(element, scope.active, animationIn, animationOut); + return; + }; + + } + } + } + + zfNotify.$inject = ['FoundationApi']; + + function zfNotify(foundationApi) { + var directive = { + restrict: 'A', + scope: { + title: '@?', + content: '@?', + color: '@?', + image: '@?', + autoclose: '@?' + }, + link: link + }; + + return directive; + + function link(scope, element, attrs, controller) { + element.on('click', function(e) { + foundationApi.publish(attrs.zfNotify, { + title: scope.title, + content: scope.content, + color: scope.color, + image: scope.image, + autoclose: scope.autoclose + }); + e.preventDefault(); + }); + } + } + + NotificationFactory.$inject = ['$http', '$templateCache', '$rootScope', '$compile', '$timeout', 'FoundationApi']; + + function NotificationFactory($http, $templateCache, $rootScope, $compile, $timeout, foundationApi) { + return notificationFactory; + + function notificationFactory(config) { + var self = this, //for prototype functions + container = angular.element(config.container || document.body), + id = config.id || foundationApi.generateUuid(), + attached = false, + destroyed = false, + html, + element, + scope, + contentScope + ; + + var props = [ + 'position' + ]; + + assembleDirective(); + + self.addNotification = addNotification; + self.clearAll = clearAll; + self.destroy = destroy; + + return { + addNotification: addNotification, + clearAll: clearAll, + destroy: destroy + }; + + function checkStatus() { + if(destroyed) { + throw "Error: Notification Set was destroyed. Delete the object and create a new NotificationFactory instance." + } + } + + function addNotification(notification) { + checkStatus(); + $timeout(function() { + foundationApi.publish(id, notification); + }, 0, false); + } + + function clearAll() { + checkStatus(); + $timeout(function() { + foundationApi.publish(id, 'clearall'); + }, 0, false); + } + + function init(state) { + if(!attached && html.length > 0) { + var modalEl = container.append(element); + + scope.active = state; + $compile(element)(scope); + + attached = true; + } + } + + function assembleDirective() { + // check for duplicate element to prevent factory from cloning notification sets + if (document.getElementById(id)) { + return; + } + html = ''; + + element = angular.element(html); + + scope = $rootScope.$new(); + + for(var i = 0; i < props.length; i++) { + if(config[props[i]]) { + element.attr(props[i], config[props[i]]); + } + } + + // access view scope variables + if (config.contentScope) { + contentScope = config.contentScope; + for (var prop in contentScope) { + if (contentScope.hasOwnProperty(prop)) { + scope[prop] = contentScope[prop]; + } + } + } + init(true); + } + + function destroy() { + self.clearAll(); + setTimeout(function() { + scope.$destroy(); + element.remove(); + destroyed = true; + }, 3000); + foundationApi.unsubscribe(id); + } + + } + + } +})(); + +(function() { + 'use strict'; + + angular.module('foundation.offcanvas', ['foundation.core']) + .directive('zfOffcanvas', zfOffcanvas) + .service('FoundationOffcanvas', FoundationOffcanvas) + ; + + FoundationOffcanvas.$inject = ['FoundationApi']; + + function FoundationOffcanvas(foundationApi) { + var service = {}; + + service.activate = activate; + service.deactivate = deactivate; + + return service; + + //target should be element ID + function activate(target) { + foundationApi.publish(target, 'show'); + } + + //target should be element ID + function deactivate(target) { + foundationApi.publish(target, 'hide'); + } + + function toggle(target) { + foundationApi.publish(target, 'toggle'); + } + } + + zfOffcanvas.$inject = ['FoundationApi']; + + function zfOffcanvas(foundationApi) { + var directive = { + restrict: 'EA', + templateUrl: 'components/offcanvas/offcanvas.html', + transclude: true, + scope: { + position: '@' + }, + replace: true, + compile: compile + }; + + return directive; + + function compile(tElement, tAttrs, transclude) { + var type = 'offcanvas'; + + return { + pre: preLink, + post: postLink + } + + function preLink(scope, iElement, iAttrs, controller) { + iAttrs.$set('zf-closable', type); + document.body.classList.add('has-off-canvas'); + } + + function postLink(scope, element, attrs) { + scope.position = scope.position || 'left'; + + scope.active = false; + //setup + foundationApi.subscribe(attrs.id, function(msg) { + if(msg === 'show' || msg === 'open') { + scope.show(); + } else if (msg === 'close' || msg === 'hide') { + scope.hide(); + } else if (msg === 'toggle') { + scope.toggle(); + } + + if (!scope.$root.$$phase) { + scope.$apply(); + } + + return; + }); + + scope.hide = function() { + scope.active = false; + return; + }; + + scope.show = function() { + scope.active = true; + return; + }; + + scope.toggle = function() { + scope.active = !scope.active; + return; + }; + } + } + } + +})(); + +(function() { + 'use strict'; + + angular.module('foundation.panel', ['foundation.core']) + .directive('zfPanel', zfPanel) + .service('FoundationPanel', FoundationPanel) + ; + + FoundationPanel.$inject = ['FoundationApi']; + + function FoundationPanel(foundationApi) { + var service = {}; + + service.activate = activate; + service.deactivate = deactivate; + + return service; + + //target should be element ID + function activate(target) { + foundationApi.publish(target, 'show'); + } + + //target should be element ID + function deactivate(target) { + foundationApi.publish(target, 'hide'); + } + } + + zfPanel.$inject = ['FoundationApi', '$window']; + + function zfPanel(foundationApi, $window) { + var directive = { + restrict: 'EA', + templateUrl: 'components/panel/panel.html', + transclude: true, + scope: { + position: '@?' + }, + replace: true, + compile: compile + }; + + return directive; + + function compile(tElement, tAttrs, transclude) { + var type = 'panel'; + + return { + pre: preLink, + post: postLink + }; + + function preLink(scope, iElement, iAttrs, controller) { + iAttrs.$set('zf-closable', type); + scope.position = scope.position || 'left'; + scope.positionClass = 'panel-' + scope.position; + } + + function postLink(scope, element, attrs) { + scope.active = false; + var animationIn, animationOut; + var globalQueries = foundationApi.getSettings().mediaQueries; + + //urgh, there must be a better way + if(scope.position === 'left') { + animationIn = attrs.animationIn || 'slideInRight'; + animationOut = attrs.animationOut || 'slideOutLeft'; + } else if (scope.position === 'right') { + animationIn = attrs.animationIn || 'slideInLeft'; + animationOut = attrs.animationOut || 'slideOutRight'; + } else if (scope.position === 'top') { + animationIn = attrs.animationIn || 'slideInDown'; + animationOut = attrs.animationOut || 'slideOutUp'; + } else if (scope.position === 'bottom') { + animationIn = attrs.animationIn || 'slideInUp'; + animationOut = attrs.animationOut || 'slideOutBottom'; + } + + + //setup + foundationApi.subscribe(attrs.id, function(msg) { + var panelPosition = $window.getComputedStyle(element[0]).getPropertyValue("position"); + + // patch to prevent panel animation on larger screen devices + if (panelPosition !== 'absolute') { + return; + } + + if(msg == 'show' || msg == 'open') { + scope.show(); + } else if (msg == 'close' || msg == 'hide') { + scope.hide(); + } else if (msg == 'toggle') { + scope.toggle(); + } + + if (!scope.$root.$$phase) { + scope.$apply(); + } + + return; + }); + + scope.hide = function() { + if(scope.active){ + scope.active = false; + foundationApi.animate(element, scope.active, animationIn, animationOut); + } + + return; + }; + + scope.show = function() { + if(!scope.active){ + scope.active = true; + foundationApi.animate(element, scope.active, animationIn, animationOut); + } + + return; + }; + + scope.toggle = function() { + scope.active = !scope.active; + foundationApi.animate(element, scope.active, animationIn, animationOut); + + return; + }; + + element.on('click', function(e) { + //check sizing + var srcEl = e.srcElement; + + if(!matchMedia(globalQueries.medium).matches && srcEl.href && srcEl.href.length > 0) { + //hide element if it can't match at least medium + scope.hide(); + foundationApi.animate(element, scope.active, animationIn, animationOut); + } + }); + } + } + } + +})(); + +(function() { + 'use strict'; + + angular.module('foundation.popup', ['foundation.core']) + .directive('zfPopup', zfPopup) + .directive('zfPopupToggle', zfPopupToggle) + .service('FoundationPopup', FoundationPopup) + ; + + FoundationPopup.$inject = ['FoundationApi']; + + function FoundationPopup(foundationApi) { + var service = {}; + + service.activate = activate; + service.deactivate = deactivate; + + return service; + + //target should be element ID + function activate(target) { + foundationApi.publish(target, 'show'); + } + + //target should be element ID + function deactivate(target) { + foundationApi.publish(target, 'hide'); + } + + function toggle(target, popupTarget) { + foundationApi.publish(target, ['toggle', popupTarget]); + } + } + + zfPopup.$inject = ['FoundationApi']; + + function zfPopup(foundationApi) { + var directive = { + restrict: 'EA', + transclude: true, + replace: true, + templateUrl: 'components/popup/popup.html', + scope: { + pinTo: '@?', + pinAt: '@?', + target: '@?' + }, + compile: compile + }; + + return directive; + + function compile() { + return { + pre: preLink, + post: postLink + }; + + function preLink(scope, iElement, iAttrs) { + iAttrs.$set('zf-closable', 'popup'); + } + + function postLink(scope, element, attrs) { + scope.active = false; + scope.target = scope.target || false; + + var attachment = scope.pinTo || 'top center'; + var targetAttachment = scope.pinAt || 'bottom center'; + var tetherInit = false; + var tether = {}; + + //setup + foundationApi.subscribe(attrs.id, function(msg) { + if(msg[0] === 'show' || msg[0] === 'open') { + scope.show(msg[1]); + } else if (msg[0] === 'close' || msg[0] === 'hide') { + scope.hide(); + } else if (msg[0] === 'toggle') { + scope.toggle(msg[1]); + } + + scope.$apply(); + + return; + }); + + + scope.hide = function() { + scope.active = false; + tetherElement(); + tether.disable(); + return; + }; + + scope.show = function(newTarget) { + scope.active = true; + tetherElement(newTarget); + tether.enable(); + + return; + }; + + scope.toggle = function(newTarget) { + scope.active = !scope.active; + tetherElement(newTarget); + + if(scope.active) { + tether.enable(); + } else { + tether.disable(); + } + + return; + }; + + function tetherElement(target) { + if(tetherInit) { + return; + } + + scope.target = scope.target ? document.getElementById(scope.target) : document.getElementById(target); + + tether = new Tether({ + element: element[0], + target: scope.target, + attachment: attachment, + targetAttachment: targetAttachment, + enable: false + }); + + tetherInit = true; + } + + } + } + } + + zfPopupToggle.$inject = ['FoundationApi']; + + function zfPopupToggle(foundationApi) { + var directive = { + restrict: 'A', + link: link + }; + + return directive; + + function link(scope, element, attrs) { + var target = attrs.zfPopupToggle; + var id = attrs.id || foundationApi.generateUuid(); + attrs.$set('id', id); + + element.on('click', function(e) { + foundationApi.publish(target, ['toggle', id]); + e.preventDefault(); + }); + } + } + +})(); + +(function() { + 'use strict'; + + angular.module('foundation.tabs', ['foundation.core']) + .controller('ZfTabsController', ZfTabsController) + .directive('zfTabs', zfTabs) + .directive('zfTabContent', zfTabContent) + .directive('zfTab', zfTab) + .directive('zfTabIndividual', zfTabIndividual) + .directive('zfTabHref', zfTabHref) + .directive('zfTabCustom', zfTabCustom) + .directive('zfTabContentCustom', zfTabContentCustom) + .service('FoundationTabs', FoundationTabs) + ; + + FoundationTabs.$inject = ['FoundationApi']; + + function FoundationTabs(foundationApi) { + var service = {}; + + service.activate = activate; + + return service; + + //target should be element ID + function activate(target) { + foundationApi.publish(target, 'show'); + } + + } + + ZfTabsController.$inject = ['$scope', 'FoundationApi']; + + function ZfTabsController($scope, foundationApi) { + var controller = this; + var tabs = controller.tabs = $scope.tabs = []; + var id = ''; + + controller.select = function(selectTab) { + tabs.forEach(function(tab) { + tab.active = false; + tab.scope.active = false; + + if(tab.scope === selectTab) { + foundationApi.publish(id, ['activate', tab]); + + tab.active = true; + tab.scope.active = true; + } + }); + + }; + + controller.addTab = function addTab(tabScope) { + tabs.push({ scope: tabScope, active: false, parentContent: controller.id }); + + if(tabs.length === 1) { + tabs[0].active = true; + tabScope.active = true; + } + }; + + controller.getId = function() { + return id; + }; + + controller.setId = function(newId) { + id = newId; + }; + } + + zfTabs.$inject = ['FoundationApi']; + + function zfTabs(foundationApi) { + var directive = { + restrict: 'EA', + transclude: 'true', + replace: true, + templateUrl: 'components/tabs/tabs.html', + controller: 'ZfTabsController', + scope: { + displaced: '@?' + }, + link: link + }; + + return directive; + + function link(scope, element, attrs, controller) { + scope.id = attrs.id || foundationApi.generateUuid(); + scope.showTabContent = scope.displaced !== 'true'; + attrs.$set('id', scope.id); + controller.setId(scope.id); + + //update tabs in case tab-content doesn't have them + var updateTabs = function() { + foundationApi.publish(scope.id + '-tabs', scope.tabs); + }; + + foundationApi.subscribe(scope.id + '-get-tabs', function() { + updateTabs(); + }); + } + } + + zfTabContent.$inject = ['FoundationApi']; + + function zfTabContent(foundationApi) { + var directive = { + restrict: 'A', + transclude: 'true', + replace: true, + scope: { + tabs: '=?', + target: '@' + }, + templateUrl: 'components/tabs/tab-content.html', + link: link + }; + + return directive; + + function link(scope, element, attrs, ctrl) { + scope.tabs = scope.tabs || []; + var id = scope.target; + + foundationApi.subscribe(id, function(msg) { + if(msg[0] === 'activate') { + var tabId = msg[1]; + scope.tabs.forEach(function (tab) { + tab.scope.active = false; + tab.active = false; + + if(tab.scope.id === id) { + tab.scope.active = true; + tab.active = true; + } + }); + } + }); + + //if tabs empty, request tabs + if(scope.tabs.length === 0) { + foundationApi.subscribe(id + '-tabs', function(tabs) { + scope.tabs = tabs; + }); + + foundationApi.publish(id + '-get-tabs', ''); + } + } + } + + zfTab.$inject = ['FoundationApi']; + + function zfTab(foundationApi) { + var directive = { + restrict: 'EA', + templateUrl: 'components/tabs/tab.html', + transclude: true, + scope: { + title: '@' + }, + require: '^zfTabs', + replace: true, + link: link + }; + + return directive; + + function link(scope, element, attrs, controller, transclude) { + scope.id = attrs.id || foundationApi.generateUuid(); + scope.active = false; + scope.transcludeFn = transclude; + controller.addTab(scope); + + foundationApi.subscribe(scope.id, function(msg) { + if(msg === 'show' || msg === 'open' || msg === 'activate') { + scope.makeActive(); + } + }); + + scope.makeActive = function() { + controller.select(scope); + }; + } + } + + zfTabIndividual.$inject = ['FoundationApi']; + + function zfTabIndividual(foundationApi) { + var directive = { + restrict: 'EA', + transclude: 'true', + link: link + }; + + return directive; + + function link(scope, element, attrs, ctrl, transclude) { + var tab = scope.$eval(attrs.tab); + var id = tab.scope.id; + + tab.scope.transcludeFn(tab.scope, function(tabContent) { + element.append(tabContent); + }); + + foundationApi.subscribe(tab.scope.id, function(msg) { + foundationApi.publish(tab.parentContent, ['activate', tab.scope.id]); + scope.$apply(); + }); + + } + } + + //custom tabs + + zfTabHref.$inject = ['FoundationApi']; + + function zfTabHref(foundationApi) { + var directive = { + restrict: 'A', + replace: false, + link: link + } + + return directive; + + function link(scope, element, attrs, ctrl) { + var target = attrs.zfTabHref; + + foundationApi.subscribe(target, function(msg) { + if(msg === 'activate' || msg === 'show' || msg === 'open') { + makeActive(); + } + }); + + + element.on('click', function(e) { + foundationApi.publish(target, 'activate'); + makeActive(); + e.preventDefault(); + }); + + function makeActive() { + element.parent().children().removeClass('is-active'); + element.addClass('is-active'); + } + } + } + + zfTabCustom.$inject = ['FoundationApi']; + + function zfTabCustom(foundationApi) { + var directive = { + restrict: 'A', + replace: false, + link: link + }; + + return directive; + + function link(scope, element, attrs, ctrl, transclude) { + var children = element.children(); + angular.element(children[0]).addClass('is-active'); + } + } + + zfTabContentCustom.$inject = ['FoundationApi']; + + function zfTabContentCustom(foundationApi) { + return { + restrict: 'A', + link: link + }; + + function link(scope, element, attrs) { + var tabs = []; + var children = element.children(); + + angular.forEach(children, function(node) { + if(node.id) { + var tabId = node.id; + tabs.push(tabId); + foundationApi.subscribe(tabId, function(msg) { + if(msg === 'activate' || msg === 'show' || msg === 'open') { + activateTabs(tabId); + } + }); + + if(tabs.length === 1) { + var el = angular.element(node); + el.addClass('is-active'); + } + } + }); + + function activateTabs(tabId) { + var tabNodes = element.children(); + angular.forEach(tabNodes, function(node) { + var el = angular.element(node); + el.removeClass('is-active'); + if(el.attr('id') === tabId) { + el.addClass('is-active'); + } + + }); + } + } + } + +})(); + +(function() { + 'use strict'; + + // imports all components and dependencies under a single namespace + + angular.module('foundation', [ + 'foundation.core', + 'foundation.mediaquery', + 'foundation.accordion', + 'foundation.actionsheet', + 'foundation.common', + 'foundation.iconic', + 'foundation.interchange', + 'foundation.modal', + 'foundation.notification', + 'foundation.offcanvas', + 'foundation.panel', + 'foundation.popup', + 'foundation.tabs' + ]); + +})(); diff --git a/afb-client/bower_components/foundation-apps/dist/js/foundation-apps.min.js b/afb-client/bower_components/foundation-apps/dist/js/foundation-apps.min.js new file mode 100755 index 0000000..81c53e5 --- /dev/null +++ b/afb-client/bower_components/foundation-apps/dist/js/foundation-apps.min.js @@ -0,0 +1,2 @@ +!function(t){"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):"undefined"!=typeof window?window.IconicJS=t():"undefined"!=typeof global?global.IconicJS=t():"undefined"!=typeof self&&(self.IconicJS=t())}(function(){var t;return function e(t,n,i){function o(a,r){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!r&&u)return u(a,!0);if(c)return c(a,!0);throw new Error("Cannot find module '"+a+"'")}var s=n[a]={exports:{}};t[a][0].call(s.exports,function(e){var n=t[a][1][e];return o(n?n:e)},s,s.exports,e,t,n,i)}return n[a].exports}for(var c="function"==typeof require&&require,a=0;a>>0;for(n=0;i>n;++n)n in this&&t.call(e,this[n],n,this)}),function(){if(Event.prototype.preventDefault||(Event.prototype.preventDefault=function(){this.returnValue=!1}),Event.prototype.stopPropagation||(Event.prototype.stopPropagation=function(){this.cancelBubble=!0}),!Element.prototype.addEventListener){var t=[],e=function(e,n){var i=this,o=function(t){t.target=t.srcElement,t.currentTarget=i,n.handleEvent?n.handleEvent(t):n.call(i,t)};if("DOMContentLoaded"==e){var c=function(t){"complete"==document.readyState&&o(t)};if(document.attachEvent("onreadystatechange",c),t.push({object:this,type:e,listener:n,wrapper:c}),"complete"==document.readyState){var a=new Event;a.srcElement=window,c(a)}}else this.attachEvent("on"+e,o),t.push({object:this,type:e,listener:n,wrapper:o})},n=function(e,n){for(var i=0;ic?i.width:i.height;var a;a=32>e?"iconic-sm":e>=32&&128>e?"iconic-md":"iconic-lg";var r=t.getAttribute("class"),u=n.test(r)?r.replace(n,a):r+" "+a;t.setAttribute("class",u)}},r=function(){var t=document.querySelectorAll(".injected-svg.iconic-fluid");Array.prototype.forEach.call(t,function(t){a(t)})};document.addEventListener("DOMContentLoaded",function(){c()}),window.addEventListener("resize",function(){r()}),e.exports={refresh:a,refreshAll:r}},{}],8:[function(e,n,i){!function(e,o){"use strict";function c(t){t=t.split(" ");for(var e={},n=t.length,i=[];n--;)e.hasOwnProperty(t[n])||(e[t[n]]=1,i.unshift(t[n]));return i.join(" ")}var a="file:"===e.location.protocol,r=o.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"),u=Array.prototype.forEach||function(t,e){if(void 0===this||null===this||"function"!=typeof t)throw new TypeError;var n,i=this.length>>>0;for(n=0;i>n;++n)n in this&&t.call(e,this[n],n,this)},s={},l=0,f=[],d=[],p={},v=function(t){return t.cloneNode(!0)},m=function(t,e){d[t]=d[t]||[],d[t].push(e)},g=function(t){for(var e=0,n=d[t].length;n>e;e++)!function(e){setTimeout(function(){d[t][e](v(s[t]))},0)}(e)},h=function(t,n){if(void 0!==s[t])s[t]instanceof SVGSVGElement?n(v(s[t])):m(t,n);else{if(!e.XMLHttpRequest)return n("Browser does not support XMLHttpRequest"),!1;s[t]={},m(t,n);var i=new XMLHttpRequest;i.onreadystatechange=function(){if(4===i.readyState){if(404===i.status||null===i.responseXML)return n("Unable to load SVG file: "+t),a&&n("Note: SVG injection ajax calls do not work locally without adjusting security setting in your browser. Or consider using a local webserver."),n(),!1;if(!(200===i.status||a&&0===i.status))return n("There was a problem injecting the SVG: "+i.status+" "+i.statusText),!1;if(i.responseXML instanceof Document)s[t]=i.responseXML.documentElement;else if(DOMParser&&DOMParser instanceof Function){var e;try{var o=new DOMParser;e=o.parseFromString(i.responseText,"text/xml")}catch(c){e=void 0}if(!e||e.getElementsByTagName("parsererror").length)return n("Unable to parse SVG file: "+t),!1;s[t]=e.documentElement}g(t)}},i.open("GET",t),i.overrideMimeType&&i.overrideMimeType("text/xml"),i.send()}},b=function(t,n,i,o){var a=t.getAttribute("data-src")||t.getAttribute("src");if(!/svg$/i.test(a))return void o("Attempted to inject a file with a non-svg extension: "+a);if(!r){var s=t.getAttribute("data-fallback")||t.getAttribute("data-png");return void(s?(t.setAttribute("src",s),o(null)):i?(t.setAttribute("src",i+"/"+a.split("/").pop().replace(".svg",".png")),o(null)):o("This browser does not support SVG and no PNG fallback was defined."))}-1===f.indexOf(t)&&(f.push(t),t.setAttribute("src",""),h(a,function(i){if("undefined"==typeof i||"string"==typeof i)return o(i),!1;var r=t.getAttribute("id");r&&i.setAttribute("id",r);var s=t.getAttribute("title");s&&i.setAttribute("title",s);var d=[].concat(i.getAttribute("class")||[],"injected-svg",t.getAttribute("class")||[]).join(" ");i.setAttribute("class",c(d));var v=t.getAttribute("style");v&&i.setAttribute("style",v);var m=[].filter.call(t.attributes,function(t){return/^data-\w[\w\-]*$/.test(t.name)});u.call(m,function(t){t.name&&t.value&&i.setAttribute(t.name,t.value)});for(var g,h=i.querySelectorAll("defs clipPath[id]"),b=0,y=h.length;y>b;b++){g=h[b].id+"-"+l;for(var A=i.querySelectorAll('[clip-path*="'+h[b].id+'"]'),w=0,$=A.length;$>w;w++)A[w].setAttribute("clip-path","url(#"+g+")");h[b].id=g}i.removeAttribute("xmlns:a");for(var E,S,j=i.querySelectorAll("script"),C=[],z=0,I=j.length;I>z;z++)S=j[z].getAttribute("type"),S&&"application/ecmascript"!==S&&"application/javascript"!==S||(E=j[z].innerText||j[z].textContent,C.push(E),i.removeChild(j[z]));if(C.length>0&&("always"===n||"once"===n&&!p[a])){for(var k=0,F=C.length;F>k;k++)new Function(C[k])(e);p[a]=!0}t.parentNode.replaceChild(i,t),delete f[f.indexOf(t)],t=null,l++,o(i)}))},y=function(t,e,n){e=e||{};var i=e.evalScripts||"always",o=e.pngFallback||!1,c=e.each;if(void 0!==t.length){var a=0;u.call(t,function(e){b(e,i,o,function(e){c&&"function"==typeof c&&c(e),n&&t.length===++a&&n(a)})})}else t?b(t,i,o,function(e){c&&"function"==typeof c&&c(e),n&&n(1),t=null}):n&&n(0)};"object"==typeof n&&"object"==typeof n.exports?n.exports=i=y:"function"==typeof t&&t.amd?t(function(){return y}):"object"==typeof e&&(e.SVGInjector=y)}(window,document)},{}]},{},[1])(1)}),function(){"use strict";function t(){function t(t,e){e?t.addClass(a):t.removeClass(a)}function e(t,e,i,u){function s(){d(t),v(),t[0].style.transitionDuration="",t.removeClass(b?"":a),p(),m=!1}function l(t){d(t),angular.element(t).off(r.join(" ")),m=!1}function f(t){var e={el:t,animation:g},i=n.filter(function(e){return e.el===t});if(i.length>0){var o=i[0].el[0];i[0].animation.cancelAnimation(o)}n.push(e)}function d(t){{var e;n.filter(function(n,i){n.el===t&&(e=i)})}e>=0&&n.splice(e,1)}function p(){return t[0].offsetWidth}function v(){t[0].style.transitionDuration=0,t.removeClass(o.join(" ")+" "+c.join(" ")+" "+i+" "+u)}var m=!0,g=this;g.cancelAnimation=l;var h=e?i:u,b=e,y=b?o[0]:o[1],A=b?c[0]:c[1];f(t),v(),t.addClass(h),t.addClass(y),t.addClass(a),p(),t[0].style.transitionDuration="",t.addClass(A),t.one(r.join(" "),function(){s()}),setTimeout(function(){m&&s()},3e3)}var n=[],i={},o=["ng-enter","ng-leave"],c=["ng-enter-active","ng-leave-active"],a="is-active",r=["webkitAnimationEnd","mozAnimationEnd","MSAnimationEnd","oanimationend","animationend","webkitTransitionEnd","otransitionend","transitionend"];return i.animate=e,i.toggleAnimation=t,i}angular.module("foundation.core.animation",[]).service("FoundationAnimation",t)}(),function(){"use strict";function t(t){function e(t,e){return l[t]||(l[t]=[]),l[t].push(e),!0}function n(t,e){void 0!==l[t]&&delete l[t],"function"==typeof e&&e.call(this)}function i(t,e){l[t]||(l[t]=[]),l[t].forEach(function(t){t(e)})}function o(){return f}function c(t){return f=angular.extend(f,t)}function a(){var t="";do{t+="zf-uuid-";for(var e=0;15>e;e++)t+=Math.floor(16*Math.random()).toString(16)}while(!d.indexOf(t));return d.push(t),t}function r(e,n){t.toggleAnimate(e,n)}function u(t){var e=this;t=t||{};var n=document.querySelectorAll(".is-active[zf-closable]"),i=document.querySelectorAll("[zf-closable] > .is-active");n.length&&angular.forEach(n,function(n){t.exclude!==n.id&&e.publish(n.id,"close")}),i.length&&angular.forEach(i,function(n){var i=n.parentNode.id;t.exclude!==i&&e.publish(i,"close")})}function s(e,n,i,o){t.animate(e,n,i,o)}var l={},f={},d=[],p={};return p.subscribe=e,p.unsubscribe=n,p.publish=i,p.getSettings=o,p.modifySettings=c,p.generateUuid=a,p.toggleAnimate=r,p.closeActiveElements=u,p.animate=s,p}function e(t){function e(e){t.publish(e,"show")}function n(e){t.publish(e,"hide")}var i={};return i.activate=e,i.deactivate=n,i}function n(){function t(t,e){var n=null;return function(){var i=this,o=arguments;null===n&&(n=setTimeout(function(){t.apply(i,o),n=null},e))}}var e={};return e.throttle=t,e}angular.module("foundation.core",["foundation.core.animation"]).service("FoundationApi",t).service("FoundationAdapter",e).factory("Utils",n),t.$inject=["FoundationAnimation"],e.$inject=["FoundationApi"]}(),function(){"use strict";function t(t,e){function n(n,i){function o(t,e,n,i){if(i.animation){if(!i.animation.leave&&!e.animation.leave)return;c(t,e,i)}}function c(t,e,n){v?(f(),i.addClass(n.animation.leave)):(l(),f(),i.removeClass(n.animation.leave))}function a(){p.leave&&i.removeClass(p.leave),l()}function r(){l(),e.includes(s())&&p.enter&&i.addClass(p.enter)}function u(t){t.targetScope===n&&p.enter&&i.removeClass(p.enter),v=!0}function s(){var t=i.data("$uiView"),e=t&&t.state&&t.state.self;return e&&angular.extend(p,e.animation),e}function l(){i.parent().removeClass("position-absolute"),d!==!0&&(i.parent()[0].style.height=null)}function f(){var t=parseInt(i.parent()[0].style.height),e=parseInt(window.getComputedStyle(i[0],null).getPropertyValue("height")),n=t>0?t:e>0?e:"";t>0&&(d=!0),i.parent()[0].style.height=n+"px",i.parent().addClass("position-absolute")}var d,p={},v=!1,m=[t.$on("$stateChangeStart",o),t.$on("$stateChangeError",a),n.$on("$stateChangeSuccess",r),n.$on("$viewContentAnimationEnded",u)],g=n.$on("$destroy",function(){angular.forEach(m,function(t){angular.isFunction(t)&&t()}),g()})}var i={restrict:"ECA",priority:-400,link:n};return i}angular.module("foundation.dynamicRouting.animations",["foundation.dynamicRouting"]).directive("uiView",t),t.$inject=["$rootScope","$state"]}(),function(){"use strict";function t(t){function e(t){var e={vars:{}};return t.data&&("object"==typeof t.data.vars&&(e.vars=t.data.vars),delete t.data.vars,angular.extend(e,t.data)),delete t.data,angular.extend(e.vars,t),e}function n(t,e){return{templateUrl:t,controller:i(e)}}function i(t){var e=t.controller||"DefaultController";return/\w\s+as\s+\w/.test(e)||(e+=" as PageCtrl"),e}function o(t){var e={};return t.animationIn&&(e.enter=t.animationIn),t.animationOut&&(e.leave=t.animationOut),e}var c={};this.registerDynamicRoutes=function(a){var r=a||foundationRoutes;angular.forEach(r,function(n){if(n.hasComposed)angular.isDefined(c[n.parent])||(c[n.parent]={children:{}}),n.controller&&(n.controller=i(n)),c[n.parent].children[n.name]=n;else if(n.composed)angular.isDefined(c[n.name])||(c[n.name]={children:{}}),n.controller&&(n.controller=i(n)),angular.extend(c[n.name],n);else{var a={url:n.url,templateUrl:n.path,"abstract":n["abstract"]||!1,parent:n.parent||"",controller:i(n),data:e(n),animation:o(n)};t.state(n.name,a)}}),angular.forEach(c,function(i){var c={url:i.url,parent:i.parent||"","abstract":i["abstract"]||!1,data:e(i),animation:o(i),views:{"":n(i.path,i)}};angular.forEach(i.children,function(t){c.views[t.name+"@"+i.name]=n(t.path,i)}),t.state(i.name,c)})},this.$get=angular.noop}function e(t,e,n){var i={};angular.forEach(e,function(t,e){i[e]=t}),t.params=i,t.current=n.current.name,n.current.views?(t.vars=n.current.data.vars,t.composed=n.current.data.vars.children):t.vars=n.current.data.vars}function n(t){t.registerDynamicRoutes(foundationRoutes)}function i(t,e,n){t.$state=e,t.$stateParams=n}angular.module("foundation.dynamicRouting",["ui.router"]).provider("$FoundationState",t).controller("DefaultController",e).config(n).run(i),t.$inject=["$stateProvider"],e.$inject=["$scope","$stateParams","$state"],n.$inject=["$FoundationStateProvider"],i.$inject=["$rootScope","$state","$stateParams"]}(),function(){"use strict";function t(t){t.init()}function e(t,e,n){function i(){var i,o;t.headerHelper(["foundation-mq"]),o=t.getStyle(".foundation-mq","font-family"),i=t.parseStyleToObject(o);for(var a in i)i[a]="only screen and (min-width: "+i[a].replace("rem","em")+")";e.modifySettings({mediaQueries:angular.extend(i,c)}),window.addEventListener("resize",n.throttle(function(){e.publish("resize","window resized")},50))}var o={},c={"default":"only screen",landscape:"only screen and (orientation: landscape)",portrait:"only screen and (orientation: portrait)",retina:"only screen and (-webkit-min-device-pixel-ratio: 2),only screen and (min--moz-device-pixel-ratio: 2),only screen and (-o-min-device-pixel-ratio: 2/1),only screen and (min-device-pixel-ratio: 2),only screen and (min-resolution: 192dpi),only screen and (min-resolution: 2dppx)"};return o.init=i,o}function n(){function t(t){for(var e=t.length,n=angular.element(document.querySelectorAll("head"));e--;)n.append('')}function e(t){var e=document.querySelectorAll(t)[0],n=window.getComputedStyle(e,null);return n.getPropertyValue("font-family")}function n(t){var e={};return"string"!=typeof t?e:(t=t.trim().slice(1,-1))?e=t.split("&").reduce(function(t,e){var n=e.replace(/\+/g," ").split("="),i=n[0],o=n[1];return i=decodeURIComponent(i),o=void 0===o?null:decodeURIComponent(o),t.hasOwnProperty(i)?Array.isArray(t[i])?t[i].push(o):t[i]=[t[i],o]:t[i]=o,t},{}):e}var i={};return i.headerHelper=t,i.getStyle=e,i.parseStyleToObject=n,i}function i(t){function e(){return t.getSettings().mediaQueries}function n(t){var e=t.length,n=o.getMediaQueries(),i=[];if(e>0)for(;e--;){var c,a=t[e].media;c=matchMedia(n[a]?n[a]:a),c.matches&&i.push({ind:e})}return i}function i(t){var e=[],n=[],i=t.children(),o=0;return angular.forEach(i,function(t){var i=angular.element(t);i.attr("src")&&i.attr("src").match(/.html$/)?e[o]={media:i.attr("media"),src:i.attr("src")}:(n[o]=i,e[o]={media:i.attr("media"),templ:o}),o++}),{scenarios:e,templates:n}}var o=[];return o.getMediaQueries=e,o.match=n,o.collectScenariosFromElement=i,o}angular.module("foundation.mediaquery",["foundation.core"]).run(t).factory("FoundationMQInit",e).factory("mqHelpers",n).service("FoundationMQ",i),t.$inject=["FoundationMQInit"],e.$inject=["mqHelpers","FoundationApi","Utils"],i.$inject=["FoundationApi"]}(),angular.module("markdown",[]).directive("markdown",function(){return{restrict:"A",link:function(t,e){e.html(marked(e.html()))}}}),function(){var t={};angular.forEach(["clipPath","colorProfile","src","cursor","fill","filter","marker","markerStart","markerMid","markerEnd","mask","stroke"],function(e){t[e]=["$rootScope","$location","$interpolate","$sniffer","urlResolve","computeSVGAttrValue","svgAttrExpressions",function(t,n,i,o,c,a,r){return{restrict:"A",link:function(i,c,u){function s(){var t=a(l);t&&u[e]!==t&&u.$set(e,t)}var l;r.SVG_ELEMENT.test(c[0]&&c[0].toString())&&n.$$html5&&o.history&&(l=u[e],u.$observe(e,s),t.$on("$locationChangeSuccess",s))}}}]}),angular.module("ngSVGAttributes",[]).factory("urlResolve",[function(){var t=document.createElement("a");return function(e){return t.setAttribute("href",e),t}}]).value("svgAttrExpressions",{FUNC_URI:/^url\((.*)\)$/,SVG_ELEMENT:/SVG[a-zA-Z]*Element/,HASH_PART:/#.*/}).factory("computeSVGAttrValue",["$location","$sniffer","svgAttrExpressions","urlResolve",function(t,e,n,i){return function(e){var o,c;return(o=n.FUNC_URI.exec(e))&&(c=0===o[1].indexOf("#")?t.absUrl().replace(n.HASH_PART,"")+o[1]:i(o[1])),c?"url("+c+")":null}}]).directive(t)}(),function(){"use strict";function t(t){var e=this,n=e.sections=t.sections=[],i=(e.multiOpen=t.multiOpen=t.multiOpen||!1,e.collapsible=t.collapsible=t.multiOpen||t.collapsible||!0),o=e.autoOpen=t.autoOpen=t.autoOpen||!0;e.select=function(t){n.forEach(function(n){e.multiOpen?n.scope===t&&(n.scope.active=!n.scope.active):n.scope.active=n.scope===t?i?!n.scope.active:!0:!1})},e.addSection=function(t){n.push({scope:t}),1===n.length&&o===!0&&(n[0].active=!0,n[0].scope.active=!0)},e.closeAll=function(){n.forEach(function(t){t.scope.active=!1})}}function e(){function t(t,e,n,i){t.multiOpen=i.multiOpen="true"===t.multiOpen?!0:!1,t.collapsible=i.collapsible="true"===t.collapsible?!0:!1,t.autoOpen=i.autoOpen="true"===t.autoOpen?!0:!1}var e={restrict:"EA",transclude:"true",replace:!0,templateUrl:"components/accordion/accordion.html",controller:"ZfAccordionController",scope:{multiOpen:"@?",collapsible:"@?",autoOpen:"@?"},link:t};return e}function n(){function t(t,e,n,i){t.active=!1,i.addSection(t),t.activate=function(){i.select(t)}}var e={restrict:"EA",templateUrl:"components/accordion/accordion-item.html",transclude:!0,scope:{title:"@"},require:"^zfAccordion",replace:!0,controller:function(){},link:t};return e}angular.module("foundation.accordion",[]).controller("ZfAccordionController",t).directive("zfAccordion",e).directive("zfAccordionItem",n),t.$inject=["$scope"]}(),function(){"use strict";function t(t){function e(e){t.publish(e,"show")}function n(e){t.publish(e,"hide")}var i={};return i.activate=e,i.deactivate=n,i}function e(t){function e(t){var e=t.target,i=!1;do if(e.classList&&e.classList.contains("action-sheet-container")){i=!0;break}while(e=e.parentNode);if(!i){if(t.target.attributes["zf-toggle"]||t.target.attributes["zf-hard-toggle"])return;n()}}function n(){c.hide(),a.hide(),c.$apply(),a.$apply()}function i(){c.toggle(),a.toggle(),c.$apply(),a.$apply()}{var o=this,c=o.content=t.content,a=o.container=t.container;angular.element(document.body)}o.registerContent=function(t){c=t,c.active=!1},o.registerContainer=function(t){a=t,a.active=!1},o.toggle=i,o.hide=n,o.registerListener=function(){document.body.addEventListener("click",e)},o.deregisterListener=function(){document.body.removeEventListener("click",e)}}function n(t){function e(){function e(t,e,n){n.$set("zf-closable","actionsheet")}function n(e,n,i,o){var c=i.id||t.generateUuid();i.$set("id",c),e.active=!1,t.subscribe(c,function(t){"toggle"===t&&o.toggle(),("hide"===t||"close"===t)&&o.hide()}),o.registerContainer(e),e.toggle=function(){e.active=!e.active},e.hide=function(){e.active=!1}}return{pre:e,post:n}}var n={restrict:"EA",transclude:!0,replace:!0,templateUrl:"components/actionsheet/actionsheet.html",controller:"ZfActionSheetController",compile:e};return n}function i(){function t(t,e,n,i){t.active=!1,t.position=t.position||"bottom",i.registerContent(t),t.toggle=function(){t.active=!t.active,t.active?i.registerListener():i.deregisterListener()},t.hide=function(){t.active=!1,i.deregisterListener()}}var e={restrict:"EA",transclude:!0,replace:!0,templateUrl:"components/actionsheet/actionsheet-content.html",require:"^zfActionSheet",scope:{position:"@?"},link:t};return e}function o(){function t(t,e,n,i){e.on("click",function(t){i.toggle(),t.preventDefault()})}var e={restrict:"EA",transclude:!0,replace:!0,templateUrl:"components/actionsheet/actionsheet-button.html",require:"^zfActionSheet",scope:{title:"@?"},link:t};return e}angular.module("foundation.actionsheet",["foundation.core"]).controller("ZfActionSheetController",e).directive("zfActionSheet",n).directive("zfAsContent",i).directive("zfAsButton",o).service("FoundationActionSheet",t),t.$inject=["FoundationApi"],e.$inject=["$scope","FoundationApi"],n.$inject=["FoundationApi"],i.$inject=["FoundationApi"],o.$inject=["FoundationApi"]}(),function(){"use strict";function t(t){function e(e,n,i){var o="";if(i.zfClose)o=i.zfClose;else{for(var c=!1,a=n.parent();c===!1;)"BODY"==a[0].nodeName&&(c=""),"undefined"!=typeof a.attr("zf-closable")&&a.attr("zf-closable")!==!1&&(c=a),a=a.parent();o=c.attr("id")}n.on("click",function(e){t.publish(o,"close"),e.preventDefault()})}var n={restrict:"A",link:e};return n}function e(t){function e(e,n,i){n.on("click",function(e){t.publish(i.zfOpen,"open"),e.preventDefault()})}var n={restrict:"A",link:e};return n}function n(t){function e(e,n,i){n.on("click",function(e){t.publish(i.zfToggle,"toggle"),e.preventDefault()})}var n={restrict:"A",link:e};return n}function i(t){function e(e,n){n.on("keyup",function(e){27===e.keyCode&&t.closeActiveElements(),e.preventDefault()})}var n={restrict:"A",link:e};return n}function o(t){function e(e,n,i){var o,c;switch(Hammer&&(c=new Hammer(n[0]),c.get("swipe").set({direction:Hammer.DIRECTION_ALL,threshold:5,velocity:.5})),i.zfSwipeClose){case"right":o="swiperight";break;case"left":o="swipeleft";break;case"up":o="swipeup";break;case"down":o="swipedown";break;default:o="swipe"}c.on(o,function(){t.publish(i.id,"close")})}var n={restrict:"A",link:e};return n}function c(t){function e(e,n,i){n.on("click",function(e){t.closeActiveElements({exclude:i.zfHardToggle}),t.publish(i.zfHardToggle,"toggle"),e.preventDefault()})}var n={restrict:"A",link:e};return n}angular.module("foundation.common",["foundation.core"]).directive("zfClose",t).directive("zfOpen",e).directive("zfToggle",n).directive("zfEscClose",i).directive("zfSwipeClose",o).directive("zfHardToggle",c),t.$inject=["FoundationApi"],e.$inject=["FoundationApi"],n.$inject=["FoundationApi"],i.$inject=["FoundationApi"],o.$inject=["FoundationApi"],c.$inject=["FoundationApi"]}(),function(){"use strict";function t(){var t="assets/img/iconic/";this.setAssetPath=function(e){t=angular.isString(e)?e:t},this.$get=function(){function e(){return i}function n(){return t}var i=new IconicJS,o={getAccess:e,getAssetPath:n};return o}}function e(t,e,n){function i(){function i(e,n,i){if(a=e.iconDir?e.iconDir:t.getAssetPath(),"/"!==a.charAt(a.length-1)&&(a+="/"),e.dynSrc?i.$set("data-src",e.dynSrc):e.dynIcon?i.$set("data-src",a+e.dynIcon+".svg"):e.icon?i.$set("data-src",a+e.icon+".svg"):i.$set("data-src",i.src),!n.hasClass("iconic-sm")&&!n.hasClass("iconic-md")&&!n.hasClass("iconic-lg")){var o;switch(e.size){case"small":o="iconic-sm";break;case"medium":o="iconic-md";break;case"large":o="iconic-lg";break;default:o="iconic-fluid"}n.addClass(o)}c=n[0].outerHTML}function o(i,o){function r(t){s&&(s.empty(),s.append(angular.element(c)),s.attr("data-src",t),u(s[0]))}function u(t){l.inject(t,{each:function(t){var e=angular.element(t);s=n(e)(e.scope())}})}var s,l=t.getAccess();u(o[0]),e.subscribe("resize",function(){l.update(o[0])}),i.dynSrc&&i.$watch("dynSrc",function(t,e){t&&t!==e&&r(i.dynSrc)}),i.dynIcon&&i.$watch("dynIcon",function(t,e){t&&t!==e&&r(a+i.dynIcon+".svg")})}var c,a;return{pre:i,post:o}}var o={restrict:"A",template:"",transclude:!0,replace:!0,scope:{dynSrc:"=?",dynIcon:"=?",size:"@?",icon:"@",iconDir:"@?"},compile:i};return o}angular.module("foundation.iconic",[]).provider("Iconic",t).directive("zfIconic",e),e.$inject=["Iconic","FoundationApi","$compile"]}(),function(){"use strict";function t(t,e,n,i,o){function c(c,a,r,u,s){function l(t){return e.get(t,{cache:n})}function f(t){var e=o.collectScenariosFromElement(t);m=e.scenarios,g=e.templates}function d(t){return!v||v!==t}{var p,v,m,g;o.getMediaQueries()}i.subscribe("resize",function(){s(function(e,n){m&&g||f(e);var i=o.match(m),c=0===i.length?null:m[i[0].ind];if(c&&d(c)){if(p&&(p.$destroy(),p=null),"undefined"!=typeof c.templ){p=n;var r=document.createElement("div");r.appendChild(g[c.templ][0]),a.html(r.innerHTML),t(a.contents())(p),v=c}else{var u=l(c.src);u.success(function(t){p=n,a.html(t)}).then(function(){t(a.contents())(p),v=c})}}})}),i.publish("resize","initial resize")}var a={restrict:"EA",transclude:"element",scope:{position:"@"},replace:!0,template:"
",link:c};return a}angular.module("foundation.interchange",["foundation.core","foundation.mediaquery"]).directive("zfInterchange",t),t.$inject=["$compile","$http","$templateCache","FoundationApi","FoundationMQ"]}(),function(){"use strict";function t(t,e){function n(e){t.publish(e,"show")}function i(e){t.publish(e,"hide")}function o(t){return new e(t)}var c={};return c.activate=n,c.deactivate=i,c.newModal=o,c}function e(t){function e(){function e(t,e,n){n.$set("zf-closable",i)}function n(e,n,i){function o(){e.overlay||n.css("background","transparent"),t.animate(n,e.active,s,l),t.animate(a,e.active,r,u)}function c(){e.active&&e.show()}var a=angular.element(n.children()[0]);e.active=e.active||!1,e.overlay="false"===i.overlay?!1:!0,e.overlayClose="false"===i.overlayClose?!1:!0;var r=i.animationIn||"fadeIn",u=i.animationOut||"fadeOut",s="fadeIn",l="fadeOut";e.hideOverlay=function(){e.overlayClose&&e.hide()},e.hide=function(){e.active=!1,o()},e.show=function(){e.active=!0,o(),a.tabIndex=-1,a[0].focus()},e.toggle=function(){e.active=!e.active,o()},c(),t.subscribe(i.id,function(t){"show"===t||"open"===t?e.show():"close"===t||"hide"===t?e.hide():"toggle"===t&&e.toggle(),e.$root&&!e.$root.$$phase&&e.$apply()})}var i="modal";return{pre:e,post:n}}var n={restrict:"EA",templateUrl:"components/modal/modal.html",transclude:!0,scope:!0,replace:!0,compile:e};return n}function n(t,e,n,i,o,c,a){function r(r){function u(){if(S)throw"Error: Modal was destroyed. Delete the object and create a new ModalFactory instance."}function s(){u(),o(function(){d(!0),a.publish($,"show") +},0,!1)}function l(){u(),o(function(){d(!1),a.publish($,"hide")},0,!1)}function f(){u(),o(function(){d(!0),a.publish($,"toggle")},0,!1)}function d(t){c.when(h).then(function(){if(!E&&m.length>0){{w.append(g)}b.active=t,i(g)(b),E=!0}})}function p(){if(!document.getElementById($)){m=''+m+"",g=angular.element(m),b=n.$new();for(var t=0;t0;)t.notifications.pop()}}function n(t){function e(e,n,i,o){e.position=e.position?e.position.split(" ").join("-"):"top-right",t.subscribe(i.id,function(t){"clearall"===t?o.clearAll():(o.addNotification(t),e.$root.$$phase||e.$apply())})}var n={restrict:"EA",templateUrl:"components/notification/notification-set.html",controller:"ZfNotificationController",replace:!0,scope:{position:"@"},link:e};return n}function i(t){function e(){function e(t,e,n){n.$set("zf-closable","notification")}function n(e,n,i,o){e.active=!1;var c,a=i.animationIn||"fadeIn",r=i.animationOut||"fadeOut";setTimeout(function(){e.active=!0,t.animate(n,e.active,a,r)},50),e.hide=function(){e.active=!1,t.animate(n,e.active,a,r),setTimeout(function(){o.removeNotification(e.notifId)},50)},e.autoclose&&setTimeout(function(){e.active&&e.hide()},parseInt(e.autoclose)),Hammer&&(c=new Hammer(n[0]),c.get("swipe").set({direction:Hammer.DIRECTION_ALL,threshold:5,velocity:.5})),c.on("swipe",function(){e.active&&e.hide()})}return{pre:e,post:n}}var n={restrict:"EA",templateUrl:"components/notification/notification.html",replace:!0,transclude:!0,require:"^zfNotificationSet",controller:function(){},scope:{title:"=?",content:"=?",image:"=?",notifId:"=",color:"=?",autoclose:"=?"},compile:e};return n}function o(t){function e(){function e(t,e,n){n.$set("zf-closable",i)}function n(e,n,i){e.position=i.position?i.position.split(" ").join("-"):"top-right";var o=i.animationIn||"fadeIn",c=i.animationOut||"fadeOut";t.subscribe(i.id,function(i){"show"==i||"open"==i?(e.show(),e.autoclose&&setTimeout(function(){e.active&&e.hide()},parseInt(e.autoclose))):"close"==i||"hide"==i?e.hide():"toggle"==i&&(e.toggle(),e.autoclose&&setTimeout(function(){e.active&&e.toggle()},parseInt(e.autoclose))),t.animate(n,e.active,o,c),e.$apply()}),e.hide=function(){e.active=!1,t.animate(n,e.active,o,c)},e.show=function(){e.active=!0,t.animate(n,e.active,o,c)},e.toggle=function(){e.active=!e.active,t.animate(n,e.active,o,c)}}var i="notification";return{pre:e,post:n}}var n={restrict:"EA",templateUrl:"components/notification/notification-static.html",replace:!0,transclude:!0,scope:{title:"@?",content:"@?",image:"@?",color:"@?",autoclose:"@?"},compile:e};return n}function c(t){function e(e,n,i){n.on("click",function(n){t.publish(i.zfNotify,{title:e.title,content:e.content,color:e.color,image:e.image,autoclose:e.autoclose}),n.preventDefault()})}var n={restrict:"A",scope:{title:"@?",content:"@?",color:"@?",image:"@?",autoclose:"@?"},link:e};return n}function a(t,e,n,i,o,c){function a(t){function e(){if(y)throw"Error: Notification Set was destroyed. Delete the object and create a new NotificationFactory instance."}function a(t){e(),o(function(){c.publish(h,t)},0,!1)}function r(){e(),o(function(){c.publish(h,"clearall")},0,!1)}function u(t){if(!b&&f.length>0){{g.append(d)}p.active=t,i(d)(p),b=!0}}function s(){if(!document.getElementById(h)){f='',d=angular.element(f),p=n.$new();for(var e=0;e0&&(n.hide(),t.animate(i,n.active,c,a))})}var o="panel";return{pre:n,post:i}}var i={restrict:"EA",templateUrl:"components/panel/panel.html",transclude:!0,scope:{position:"@?"},replace:!0,compile:n};return i}angular.module("foundation.panel",["foundation.core"]).directive("zfPanel",e).service("FoundationPanel",t),t.$inject=["FoundationApi"],e.$inject=["FoundationApi","$window"]}(),function(){"use strict";function t(t){function e(e){t.publish(e,"show")}function n(e){t.publish(e,"hide")}var i={};return i.activate=e,i.deactivate=n,i}function e(t){function e(){function e(t,e,n){n.$set("zf-closable","popup")}function n(e,n,i){function o(t){r||(e.target=document.getElementById(e.target?e.target:t),u=new Tether({element:n[0],target:e.target,attachment:c,targetAttachment:a,enable:!1}),r=!0)}e.active=!1,e.target=e.target||!1;var c=e.pinTo||"top center",a=e.pinAt||"bottom center",r=!1,u={};t.subscribe(i.id,function(t){"show"===t[0]||"open"===t[0]?e.show(t[1]):"close"===t[0]||"hide"===t[0]?e.hide():"toggle"===t[0]&&e.toggle(t[1]),e.$apply()}),e.hide=function(){e.active=!1,o(),u.disable()},e.show=function(t){e.active=!0,o(t),u.enable()},e.toggle=function(t){e.active=!e.active,o(t),e.active?u.enable():u.disable()}}return{pre:e,post:n}}var n={restrict:"EA",transclude:!0,replace:!0,templateUrl:"components/popup/popup.html",scope:{pinTo:"@?",pinAt:"@?",target:"@?"},compile:e};return n}function n(t){function e(e,n,i){var o=i.zfPopupToggle,c=i.id||t.generateUuid();i.$set("id",c),n.on("click",function(e){t.publish(o,["toggle",c]),e.preventDefault()})}var n={restrict:"A",link:e};return n}angular.module("foundation.popup",["foundation.core"]).directive("zfPopup",e).directive("zfPopupToggle",n).service("FoundationPopup",t),t.$inject=["FoundationApi"],e.$inject=["FoundationApi"],n.$inject=["FoundationApi"]}(),function(){"use strict";function t(t){function e(e){t.publish(e,"show")}var n={};return n.activate=e,n}function e(t,e){var n=this,i=n.tabs=t.tabs=[],o="";n.select=function(t){i.forEach(function(n){n.active=!1,n.scope.active=!1,n.scope===t&&(e.publish(o,["activate",n]),n.active=!0,n.scope.active=!0)})},n.addTab=function(t){i.push({scope:t,active:!1,parentContent:n.id}),1===i.length&&(i[0].active=!0,t.active=!0)},n.getId=function(){return o},n.setId=function(t){o=t}}function n(t){function e(e,n,i,o){e.id=i.id||t.generateUuid(),e.showTabContent="true"!==e.displaced,i.$set("id",e.id),o.setId(e.id);var c=function(){t.publish(e.id+"-tabs",e.tabs)};t.subscribe(e.id+"-get-tabs",function(){c()})}var n={restrict:"EA",transclude:"true",replace:!0,templateUrl:"components/tabs/tabs.html",controller:"ZfTabsController",scope:{displaced:"@?"},link:e};return n}function i(t){function e(e){e.tabs=e.tabs||[];var n=e.target;t.subscribe(n,function(t){if("activate"===t[0]){{t[1]}e.tabs.forEach(function(t){t.scope.active=!1,t.active=!1,t.scope.id===n&&(t.scope.active=!0,t.active=!0)})}}),0===e.tabs.length&&(t.subscribe(n+"-tabs",function(t){e.tabs=t}),t.publish(n+"-get-tabs",""))}var n={restrict:"A",transclude:"true",replace:!0,scope:{tabs:"=?",target:"@"},templateUrl:"components/tabs/tab-content.html",link:e};return n}function o(t){function e(e,n,i,o,c){e.id=i.id||t.generateUuid(),e.active=!1,e.transcludeFn=c,o.addTab(e),t.subscribe(e.id,function(t){("show"===t||"open"===t||"activate"===t)&&e.makeActive()}),e.makeActive=function(){o.select(e)}}var n={restrict:"EA",templateUrl:"components/tabs/tab.html",transclude:!0,scope:{title:"@"},require:"^zfTabs",replace:!0,link:e};return n}function c(t){function e(e,n,i){{var o=e.$eval(i.tab);o.scope.id}o.scope.transcludeFn(o.scope,function(t){n.append(t)}),t.subscribe(o.scope.id,function(){t.publish(o.parentContent,["activate",o.scope.id]),e.$apply()})}var n={restrict:"EA",transclude:"true",link:e};return n}function a(t){function e(e,n,i){function o(){n.parent().children().removeClass("is-active"),n.addClass("is-active")}var c=i.zfTabHref;t.subscribe(c,function(t){("activate"===t||"show"===t||"open"===t)&&o()}),n.on("click",function(e){t.publish(c,"activate"),o(),e.preventDefault()})}var n={restrict:"A",replace:!1,link:e};return n}function r(){function t(t,e){var n=e.children();angular.element(n[0]).addClass("is-active")}var e={restrict:"A",replace:!1,link:t};return e}function u(t){function e(e,n){function i(t){var e=n.children();angular.forEach(e,function(e){var n=angular.element(e);n.removeClass("is-active"),n.attr("id")===t&&n.addClass("is-active")})}var o=[],c=n.children();angular.forEach(c,function(e){if(e.id){var n=e.id;if(o.push(n),t.subscribe(n,function(t){("activate"===t||"show"===t||"open"===t)&&i(n)}),1===o.length){var c=angular.element(e);c.addClass("is-active")}}})}return{restrict:"A",link:e}}angular.module("foundation.tabs",["foundation.core"]).controller("ZfTabsController",e).directive("zfTabs",n).directive("zfTabContent",i).directive("zfTab",o).directive("zfTabIndividual",c).directive("zfTabHref",a).directive("zfTabCustom",r).directive("zfTabContentCustom",u).service("FoundationTabs",t),t.$inject=["FoundationApi"],e.$inject=["$scope","FoundationApi"],n.$inject=["FoundationApi"],i.$inject=["FoundationApi"],o.$inject=["FoundationApi"],c.$inject=["FoundationApi"],a.$inject=["FoundationApi"],r.$inject=["FoundationApi"],u.$inject=["FoundationApi"]}(),function(){"use strict";angular.module("foundation",["foundation.core","foundation.mediaquery","foundation.accordion","foundation.actionsheet","foundation.common","foundation.iconic","foundation.interchange","foundation.modal","foundation.notification","foundation.offcanvas","foundation.panel","foundation.popup","foundation.tabs"])}(); \ No newline at end of file -- cgit 1.2.3-korg