Author: joewitt
Date: Thu May 14 02:29:30 2015
New Revision: 1679304
URL: http://svn.apache.org/r1679304
Log:
Updated main index page for the feature highlights
Modified:
incubator/nifi/site/trunk/assets/js/foundation.js
incubator/nifi/site/trunk/assets/js/jquery.min.js
incubator/nifi/site/trunk/assets/js/webfontloader.js
incubator/nifi/site/trunk/docs/administration-guide.html
incubator/nifi/site/trunk/docs/developer-guide.html
incubator/nifi/site/trunk/docs/expression-language-guide.html
incubator/nifi/site/trunk/docs/overview.html
incubator/nifi/site/trunk/docs/user-guide.html
incubator/nifi/site/trunk/index.html
Modified: incubator/nifi/site/trunk/assets/js/foundation.js
URL:
http://svn.apache.org/viewvc/incubator/nifi/site/trunk/assets/js/foundation.js?rev=1679304&r1=1679303&r2=1679304&view=diff
==============================================================================
--- incubator/nifi/site/trunk/assets/js/foundation.js (original)
+++ incubator/nifi/site/trunk/assets/js/foundation.js Thu May 14 02:29:30 2015
@@ -14,7 +14,7 @@
var head = $('head');
while (i--) {
- if(head.has('.' + class_array[i]).length === 0) {
+ if (head.has('.' + class_array[i]).length === 0) {
head.append('<meta class="' + class_array[i] + '" />');
}
}
@@ -34,7 +34,7 @@
// Enable FastClick if present
- $(function() {
+ $(function () {
if (typeof FastClick !== 'undefined') {
// Don't attach to body if undefined
if (typeof document.body !== 'undefined') {
@@ -52,7 +52,9 @@
var cont;
if (context.jquery) {
cont = context[0];
- if (!cont) return context;
+ if (!cont) {
+ return context;
+ }
} else {
cont = context;
}
@@ -69,8 +71,12 @@
var attr_name = function (init) {
var arr = [];
- if (!init) arr.push('data');
- if (this.namespace.length > 0) arr.push(this.namespace);
+ if (!init) {
+ arr.push('data');
+ }
+ if (this.namespace.length > 0) {
+ arr.push(this.namespace);
+ }
arr.push(this.name);
return arr.join('-');
@@ -100,24 +106,20 @@
var bindings = function (method, options) {
var self = this,
- should_bind_events = !S(this).data(this.attr_name(true));
-
- if (S(this.scope).is('[' + this.attr_name() +']')) {
- S(this.scope).data(this.attr_name(true) + '-init', $.extend({},
this.settings, (options || method), this.data_options(S(this.scope))));
+ bind = function(){
+ var $this = S(this),
+ should_bind_events = !$this.data(self.attr_name(true) + '-init');
+ $this.data(self.attr_name(true) + '-init', $.extend({},
self.settings, (options || method), self.data_options($this)));
- if (should_bind_events) {
- this.events(this.scope);
- }
+ if (should_bind_events) {
+ self.events(this);
+ }
+ };
+ if (S(this.scope).is('[' + this.attr_name() +']')) {
+ bind.call(this.scope);
} else {
- S('[' + this.attr_name() +']', this.scope).each(function () {
- var should_bind_events = !S(this).data(self.attr_name(true) + '-init');
- S(this).data(self.attr_name(true) + '-init', $.extend({},
self.settings, (options || method), self.data_options(S(this))));
-
- if (should_bind_events) {
- self.events(this);
- }
- });
+ S('[' + this.attr_name() +']', this.scope).each(bind);
}
// # Patch to fix #5043 to move this *after* the if/else clause in order
for Backbone and similar frameworks to have improved control over event binding
and data-options updating.
if (typeof method === 'string') {
@@ -155,42 +157,52 @@
}
};
- /*
- https://github.com/paulirish/matchMedia.js
- */
+ /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors &
copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual
MIT/BSD license */
- window.matchMedia = window.matchMedia || (function( doc ) {
+ window.matchMedia || (window.matchMedia = function() {
+ "use strict";
- 'use strict';
+ // For browsers that support matchMedium api such as IE 9 and webkit
+ var styleMedia = (window.styleMedia || window.media);
- var bool,
- docElem = doc.documentElement,
- refNode = docElem.firstElementChild || docElem.firstChild,
- // fakeBody required for <FF4 when executed in <head>
- fakeBody = doc.createElement( 'body' ),
- div = doc.createElement( 'div' );
+ // For those that don't support matchMedium
+ if (!styleMedia) {
+ var style = document.createElement('style'),
+ script = document.getElementsByTagName('script')[0],
+ info = null;
- div.id = 'mq-test-1';
- div.style.cssText = 'position:absolute;top:-100em';
- fakeBody.style.background = 'none';
- fakeBody.appendChild(div);
+ style.type = 'text/css';
+ style.id = 'matchmediajs-test';
- return function (q) {
+ script.parentNode.insertBefore(style, script);
- div.innerHTML = '­<style media="' + q + '"> #mq-test-1 { width:
42px; }</style>';
+ // 'style.currentStyle' is used by IE <= 8 and
'window.getComputedStyle' for all other browsers
+ info = ('getComputedStyle' in window) &&
window.getComputedStyle(style, null) || style.currentStyle;
- docElem.insertBefore( fakeBody, refNode );
- bool = div.offsetWidth === 42;
- docElem.removeChild( fakeBody );
+ styleMedia = {
+ matchMedium: function(media) {
+ var text = '@media ' + media + '{ #matchmediajs-test {
width: 1px; } }';
- return {
- matches: bool,
- media: q
- };
+ // 'style.styleSheet' is used by IE <= 8 and
'style.textContent' for all other browsers
+ if (style.styleSheet) {
+ style.styleSheet.cssText = text;
+ } else {
+ style.textContent = text;
+ }
- };
+ // Test if media query is true or false
+ return info.width === '1px';
+ }
+ };
+ }
- }( document ));
+ return function(media) {
+ return {
+ matches: styleMedia.matchMedium(media || 'all'),
+ media: media || 'all'
+ };
+ };
+ }());
/*
* jquery.requestAnimationFrame
@@ -203,6 +215,7 @@
(function(jQuery) {
+
// requestAnimationFrame polyfill adapted from Erik Möller
// fixes from Paul Irish and Tino Zijdel
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
@@ -269,7 +282,6 @@
}( $ ));
-
function removeQuotes (string) {
if (typeof string === 'string' || string instanceof String) {
string = string.replace(/^['\\/"]+|(;\s?})+|['\\/"]+$/g, '');
@@ -281,7 +293,7 @@
window.Foundation = {
name : 'Foundation',
- version : '5.5.0',
+ version : '5.5.2',
media_queries : {
'small' :
S('.foundation-mq-small').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g,
''),
@@ -297,8 +309,8 @@
stylesheet : $('<style></style>').appendTo('head')[0].sheet,
- global: {
- namespace: undefined
+ global : {
+ namespace : undefined
},
init : function (scope, libraries, method, options, response) {
@@ -323,7 +335,7 @@
}
}
- S(window).load(function(){
+ S(window).load(function () {
S(window)
.trigger('resize.fndtn.clearing')
.trigger('resize.fndtn.dropdown')
@@ -345,8 +357,7 @@
if (args && args.hasOwnProperty(lib)) {
if (typeof this.libs[lib].settings !== 'undefined') {
$.extend(true, this.libs[lib].settings, args[lib]);
- }
- else if (typeof this.libs[lib].defaults !== 'undefined') {
+ } else if (typeof this.libs[lib].defaults !== 'undefined') {
$.extend(true, this.libs[lib].defaults, args[lib]);
}
return this.libs[lib].init.apply(this.libs[lib], [this.scope,
args[lib]]);
@@ -381,7 +392,7 @@
}
},
- set_namespace: function () {
+ set_namespace : function () {
// Description:
// Don't bother reading the namespace out of the meta tag
@@ -469,12 +480,16 @@
var context = this, args = arguments;
var later = function () {
timeout = null;
- if (!immediate) result = func.apply(context, args);
+ if (!immediate) {
+ result = func.apply(context, args);
+ }
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, delay);
- if (callNow) result = func.apply(context, args);
+ if (callNow) {
+ result = func.apply(context, args);
+ }
return result;
};
},
@@ -511,11 +526,13 @@
ii = opts_arr.length;
function isNumber (o) {
- return ! isNaN (o-0) && o !== null && o !== '' && o !== false && o
!== true;
+ return !isNaN (o - 0) && o !== null && o !== '' && o !== false && o
!== true;
}
function trim (str) {
- if (typeof str === 'string') return $.trim(str);
+ if (typeof str === 'string') {
+ return $.trim(str);
+ }
return str;
}
@@ -523,8 +540,12 @@
p = opts_arr[ii].split(':');
p = [p[0], p.slice(1).join(':')];
- if (/true/i.test(p[1])) p[1] = true;
- if (/false/i.test(p[1])) p[1] = false;
+ if (/true/i.test(p[1])) {
+ p[1] = true;
+ }
+ if (/false/i.test(p[1])) {
+ p[1] = false;
+ }
if (isNumber(p[1])) {
if (p[1].indexOf('.') === -1) {
p[1] = parseInt(p[1], 10);
@@ -550,7 +571,7 @@
//
// Class (String): Class name for the generated <meta> tag
register_media : function (media, media_class) {
- if(Foundation.media_queries[media] === undefined) {
+ if (Foundation.media_queries[media] === undefined) {
$('head').append('<meta class="' + media_class + '"/>');
Foundation.media_queries[media] = removeQuotes($('.' +
media_class).css('font-family'));
}
@@ -572,7 +593,7 @@
if (query !== undefined) {
Foundation.stylesheet.insertRule('@media ' +
- Foundation.media_queries[media] + '{ ' + rule + ' }');
+ Foundation.media_queries[media] + '{ ' + rule + ' }',
Foundation.stylesheet.cssRules.length);
}
}
},
@@ -588,7 +609,19 @@
var self = this,
unloaded = images.length;
- if (unloaded === 0) {
+ function pictures_has_height(images) {
+ var pictures_number = images.length;
+
+ for (var i = pictures_number - 1; i >= 0; i--) {
+ if(images.attr('height') === undefined) {
+ return false;
+ };
+ };
+
+ return true;
+ }
+
+ if (unloaded === 0 || pictures_has_height(images)) {
callback(images);
}
@@ -612,7 +645,9 @@
// Returns:
// Rand (String): Pseudo-random, alphanumeric string.
random_str : function () {
- if (!this.fidx) this.fidx = 0;
+ if (!this.fidx) {
+ this.fidx = 0;
+ }
this.prefix = this.prefix || [(this.name || 'F'), (+new
Date).toString(36)].join('-');
return this.prefix + (this.fidx++).toString(36);
@@ -694,17 +729,19 @@
Foundation.libs.topbar = {
name : 'topbar',
- version: '5.5.0',
+ version : '5.5.2',
settings : {
index : 0,
+ start_offset : 0,
sticky_class : 'sticky',
- custom_back_text: true,
- back_text: 'Back',
- mobile_show_parent_link: true,
- is_hover: true,
+ custom_back_text : true,
+ back_text : 'Back',
+ mobile_show_parent_link : true,
+ is_hover : true,
scrolltop : true, // jump to top when sticky nav menu toggle is clicked
- sticky_on : 'all'
+ sticky_on : 'all',
+ dropdown_autoclose: true
},
init : function (section, method, options) {
@@ -750,29 +787,29 @@
},
- is_sticky: function (topbar, topbarContainer, settings) {
- var sticky = topbarContainer.hasClass(settings.sticky_class);
+ is_sticky : function (topbar, topbarContainer, settings) {
+ var sticky = topbarContainer.hasClass(settings.sticky_class);
+ var smallMatch = matchMedia(Foundation.media_queries.small).matches;
+ var medMatch = matchMedia(Foundation.media_queries.medium).matches;
+ var lrgMatch = matchMedia(Foundation.media_queries.large).matches;
if (sticky && settings.sticky_on === 'all') {
return true;
- } else if (sticky && this.small() && settings.sticky_on === 'small') {
- return (matchMedia(Foundation.media_queries.small).matches &&
!matchMedia(Foundation.media_queries.medium).matches &&
- !matchMedia(Foundation.media_queries.large).matches);
- //return true;
- } else if (sticky && this.medium() && settings.sticky_on === 'medium') {
- return (matchMedia(Foundation.media_queries.small).matches &&
matchMedia(Foundation.media_queries.medium).matches &&
- !matchMedia(Foundation.media_queries.large).matches);
- //return true;
- } else if(sticky && this.large() && settings.sticky_on === 'large') {
- return (matchMedia(Foundation.media_queries.small).matches &&
matchMedia(Foundation.media_queries.medium).matches &&
- matchMedia(Foundation.media_queries.large).matches);
- //return true;
+ }
+ if (sticky && this.small() && settings.sticky_on.indexOf('small') !==
-1) {
+ if (smallMatch && !medMatch && !lrgMatch) { return true; }
+ }
+ if (sticky && this.medium() && settings.sticky_on.indexOf('medium') !==
-1) {
+ if (smallMatch && medMatch && !lrgMatch) { return true; }
+ }
+ if (sticky && this.large() && settings.sticky_on.indexOf('large') !==
-1) {
+ if (smallMatch && medMatch && lrgMatch) { return true; }
}
- return false;
+ return false;
},
- toggle: function (toggleEl) {
+ toggle : function (toggleEl) {
var self = this,
topbar;
@@ -788,11 +825,11 @@
if (self.breakpoint()) {
if (!self.rtl) {
- section.css({left: '0%'});
- $('>.name', section).css({left: '100%'});
+ section.css({left : '0%'});
+ $('>.name', section).css({left : '100%'});
} else {
- section.css({right: '0%'});
- $('>.name', section).css({right: '100%'});
+ section.css({right : '0%'});
+ $('>.name', section).css({right : '100%'});
}
self.S('li.moved', section).removeClass('moved');
@@ -816,7 +853,7 @@
topbar.addClass('fixed');
self.S('body').removeClass('f-topbar-fixed');
- window.scrollTo(0,0);
+ window.scrollTo(0, 0);
} else {
topbar.parent().removeClass('expanded');
}
@@ -852,12 +889,19 @@
e.preventDefault();
self.toggle(this);
})
- .on('click.fndtn.topbar','.top-bar .top-bar-section li a[href^="#"],['
+ this.attr_name() + '] .top-bar-section li a[href^="#"]',function (e) {
- var li = $(this).closest('li');
- if(self.breakpoint() && !li.hasClass('back') &&
!li.hasClass('has-dropdown'))
- {
- self.toggle();
+ .on('click.fndtn.topbar contextmenu.fndtn.topbar', '.top-bar
.top-bar-section li a[href^="#"],[' + this.attr_name() + '] .top-bar-section li
a[href^="#"]', function (e) {
+ var li = $(this).closest('li'),
+ topbar = li.closest('[' + self.attr_name() + ']'),
+ settings = topbar.data(self.attr_name(true) + '-init');
+
+ if (settings.dropdown_autoclose && settings.is_hover) {
+ var hoverLi = $(this).closest('.hover');
+ hoverLi.removeClass('hover');
+ }
+ if (self.breakpoint() && !li.hasClass('back') &&
!li.hasClass('has-dropdown')) {
+ self.toggle();
}
+
})
.on('click.fndtn.topbar', '[' + this.attr_name() + ']
li.has-dropdown', function (e) {
var li = S(this),
@@ -865,13 +909,18 @@
topbar = li.closest('[' + self.attr_name() + ']'),
settings = topbar.data(self.attr_name(true) + '-init');
- if(target.data('revealId')) {
+ if (target.data('revealId')) {
self.toggle();
return;
}
- if (self.breakpoint()) return;
- if (settings.is_hover && !Modernizr.touch) return;
+ if (self.breakpoint()) {
+ return;
+ }
+
+ if (settings.is_hover && !Modernizr.touch) {
+ return;
+ }
e.stopImmediatePropagation();
@@ -908,20 +957,20 @@
$selectedLi.addClass('moved');
if (!self.rtl) {
- section.css({left: -(100 * topbar.data('index')) + '%'});
- section.find('>.name').css({left: 100 * topbar.data('index') +
'%'});
+ section.css({left : -(100 * topbar.data('index')) + '%'});
+ section.find('>.name').css({left : 100 * topbar.data('index') +
'%'});
} else {
- section.css({right: -(100 * topbar.data('index')) + '%'});
- section.find('>.name').css({right: 100 * topbar.data('index') +
'%'});
+ section.css({right : -(100 * topbar.data('index')) + '%'});
+ section.find('>.name').css({right : 100 * topbar.data('index') +
'%'});
}
topbar.css('height', $this.siblings('ul').outerHeight(true) +
topbar.data('height'));
}
});
- S(window).off('.topbar').on('resize.fndtn.topbar',
self.throttle(function() {
+ S(window).off('.topbar').on('resize.fndtn.topbar',
self.throttle(function () {
self.resize.call(self);
- }, 50)).trigger('resize').trigger('resize.fndtn.topbar').load(function(){
+ }, 50)).trigger('resize.fndtn.topbar').load(function () {
// Ensure that the offset is calculated after all of the pages
resources have loaded
S(this).trigger('resize.fndtn.topbar');
});
@@ -950,11 +999,11 @@
topbar.data('index', topbar.data('index') - 1);
if (!self.rtl) {
- section.css({left: -(100 * topbar.data('index')) + '%'});
- section.find('>.name').css({left: 100 * topbar.data('index') + '%'});
+ section.css({left : -(100 * topbar.data('index')) + '%'});
+ section.find('>.name').css({left : 100 * topbar.data('index') +
'%'});
} else {
- section.css({right: -(100 * topbar.data('index')) + '%'});
- section.find('>.name').css({right: 100 * topbar.data('index') +
'%'});
+ section.css({right : -(100 * topbar.data('index')) + '%'});
+ section.find('>.name').css({right : 100 * topbar.data('index') +
'%'});
}
if (topbar.data('index') === 0) {
@@ -970,10 +1019,10 @@
// Show dropdown menus when their items are focused
S(this.scope).find('.dropdown a')
- .focus(function() {
+ .focus(function () {
$(this).parents('.has-dropdown').addClass('hover');
})
- .blur(function() {
+ .blur(function () {
$(this).parents('.has-dropdown').removeClass('hover');
});
},
@@ -995,18 +1044,18 @@
.find('li')
.removeClass('hover');
- if(doToggle) {
+ if (doToggle) {
self.toggle(topbar);
}
}
- if(self.is_sticky(topbar, stickyContainer, settings)) {
- if(stickyContainer.hasClass('fixed')) {
+ if (self.is_sticky(topbar, stickyContainer, settings)) {
+ if (stickyContainer.hasClass('fixed')) {
// Remove the fixed to allow for correct calculation of the offset.
stickyContainer.removeClass('fixed');
stickyOffset = stickyContainer.offset().top;
- if(self.S(document.body).hasClass('f-topbar-fixed')) {
+ if (self.S(document.body).hasClass('f-topbar-fixed')) {
stickyOffset -= topbar.data('height');
}
@@ -1051,11 +1100,10 @@
url = $link.attr('href'),
$titleLi;
-
if (!$dropdown.find('.title.back').length) {
if (settings.mobile_show_parent_link == true && url) {
- $titleLi = $('<li class="title back js-generated"><h5><a
href="javascript:void(0)"></a></h5></li><li class="parent-link
show-for-small-only"><a class="parent-link js-generated" href="' + url + '">' +
$link.html() +'</a></li>');
+ $titleLi = $('<li class="title back js-generated"><h5><a
href="javascript:void(0)"></a></h5></li><li class="parent-link
hide-for-medium-up"><a class="parent-link js-generated" href="' + url + '">' +
$link.html() +'</a></li>');
} else {
$titleLi = $('<li class="title back js-generated"><h5><a
href="javascript:void(0)"></a></h5>');
}
@@ -1080,7 +1128,7 @@
},
assembled : function (topbar) {
- topbar.data(this.attr_name(true), $.extend({},
topbar.data(this.attr_name(true)), {assembled: true}));
+ topbar.data(this.attr_name(true), $.extend({},
topbar.data(this.attr_name(true)), {assembled : true}));
},
height : function (ul) {
@@ -1097,18 +1145,18 @@
sticky : function () {
var self = this;
- this.S(window).on('scroll', function() {
+ this.S(window).on('scroll', function () {
self.update_sticky_positioning();
});
},
- update_sticky_positioning: function() {
+ update_sticky_positioning : function () {
var klass = '.' + this.settings.sticky_class,
$window = this.S(window),
self = this;
if (self.settings.sticky_topbar &&
self.is_sticky(this.settings.sticky_topbar,this.settings.sticky_topbar.parent(),
this.settings)) {
- var distance = this.settings.sticky_topbar.data('stickyoffset');
+ var distance = this.settings.sticky_topbar.data('stickyoffset') +
this.settings.start_offset;
if (!self.S(klass).hasClass('expanded')) {
if ($window.scrollTop() > (distance)) {
if (!self.S(klass).hasClass('fixed')) {
@@ -1139,33 +1187,35 @@
Foundation.libs.reveal = {
name : 'reveal',
- version : '5.5.0',
+ version : '5.5.2',
locked : false,
settings : {
- animation: 'fadeAndPop',
- animation_speed: 250,
- close_on_background_click: true,
- close_on_esc: true,
- dismiss_modal_class: 'close-reveal-modal',
- bg_class: 'reveal-modal-bg',
- root_element: 'body',
- open: function(){},
- opened: function(){},
- close: function(){},
- closed: function(){},
+ animation : 'fadeAndPop',
+ animation_speed : 250,
+ close_on_background_click : true,
+ close_on_esc : true,
+ dismiss_modal_class : 'close-reveal-modal',
+ multiple_opened : false,
+ bg_class : 'reveal-modal-bg',
+ root_element : 'body',
+ open : function(){},
+ opened : function(){},
+ close : function(){},
+ closed : function(){},
+ on_ajax_error: $.noop,
bg : $('.reveal-modal-bg'),
css : {
open : {
- 'opacity': 0,
- 'visibility': 'visible',
+ 'opacity' : 0,
+ 'visibility' : 'visible',
'display' : 'block'
},
close : {
- 'opacity': 1,
- 'visibility': 'hidden',
- 'display': 'none'
+ 'opacity' : 1,
+ 'visibility' : 'hidden',
+ 'display' : 'none'
}
}
},
@@ -1186,7 +1236,8 @@
if (!self.locked) {
var element = S(this),
- ajax = element.data(self.data_attr('reveal-ajax'));
+ ajax = element.data(self.data_attr('reveal-ajax')),
+ replaceContentSel =
element.data(self.data_attr('reveal-replace-content'));
self.locked = true;
@@ -1194,8 +1245,7 @@
self.open.call(self, element);
} else {
var url = ajax === true ? element.attr('href') : ajax;
-
- self.open.call(self, element, {url: url});
+ self.open.call(self, element, {url : url}, { replaceContentSel :
replaceContentSel });
}
}
});
@@ -1216,11 +1266,11 @@
}
self.locked = true;
- self.close.call(self, bg_clicked ? S('[' + self.attr_name() +
'].open') : S(this).closest('[' + self.attr_name() + ']'));
+ self.close.call(self, bg_clicked ? S('[' + self.attr_name() +
'].open:not(.toback)') : S(this).closest('[' + self.attr_name() + ']'));
}
});
- if(S('[' + self.attr_name() + ']', this.scope).length > 0) {
+ if (S('[' + self.attr_name() + ']', this.scope).length > 0) {
S(this.scope)
// .off('.reveal')
.on('open.fndtn.reveal', this.settings.open)
@@ -1267,7 +1317,6 @@
return true;
},
-
open : function (target, ajax_settings) {
var self = this,
modal;
@@ -1301,8 +1350,15 @@
.data('offset', this.cache_offset(modal));
}
+ modal.attr('tabindex','0').attr('aria-hidden','false');
+
this.key_up_on(modal); // PATCH #3: turning on key up capture only
when a reveal window is open
+ // Prevent namespace event from triggering twice
+ modal.on('open.fndtn.reveal', function(e) {
+ if (e.namespace !== 'fndtn.reveal') return;
+ });
+
modal.on('open.fndtn.reveal').trigger('open.fndtn.reveal');
if (open_modal.length < 1) {
@@ -1311,37 +1367,58 @@
if (typeof ajax_settings === 'string') {
ajax_settings = {
- url: ajax_settings
+ url : ajax_settings
};
}
if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
if (open_modal.length > 0) {
- this.hide(open_modal, settings.css.close);
+ if (settings.multiple_opened) {
+ self.to_back(open_modal);
+ } else {
+ self.hide(open_modal, settings.css.close);
+ }
}
this.show(modal, settings.css.open);
} else {
var old_success = typeof ajax_settings.success !== 'undefined' ?
ajax_settings.success : null;
-
$.extend(ajax_settings, {
- success: function (data, textStatus, jqXHR) {
+ success : function (data, textStatus, jqXHR) {
if ( $.isFunction(old_success) ) {
var result = old_success(data, textStatus, jqXHR);
- if (typeof result == 'string') data = result;
+ if (typeof result == 'string') {
+ data = result;
+ }
+ }
+
+ if (typeof options !== 'undefined' && typeof
options.replaceContentSel !== 'undefined') {
+ modal.find(options.replaceContentSel).html(data);
+ } else {
+ modal.html(data);
}
- modal.html(data);
self.S(modal).foundation('section', 'reflow');
self.S(modal).children().foundation();
if (open_modal.length > 0) {
- self.hide(open_modal, settings.css.close);
+ if (settings.multiple_opened) {
+ self.to_back(open_modal);
+ } else {
+ self.hide(open_modal, settings.css.close);
+ }
}
self.show(modal, settings.css.open);
}
});
+ // check for if user initalized with error callback
+ if (settings.on_ajax_error !== $.noop) {
+ $.extend(ajax_settings, {
+ error : settings.on_ajax_error
+ });
+ }
+
$.ajax(ajax_settings);
}
}
@@ -1351,14 +1428,29 @@
close : function (modal) {
var modal = modal && modal.length ? modal : this.S(this.scope),
open_modals = this.S('[' + this.attr_name() + '].open'),
- settings = modal.data(this.attr_name(true) + '-init') ||
this.settings;
+ settings = modal.data(this.attr_name(true) + '-init') ||
this.settings,
+ self = this;
if (open_modals.length > 0) {
+
+ modal.removeAttr('tabindex','0').attr('aria-hidden','true');
+
this.locked = true;
this.key_up_off(modal); // PATCH #3: turning on key up capture only
when a reveal window is open
- modal.trigger('close').trigger('close.fndtn.reveal');
- this.toggle_bg(modal, false);
- this.hide(open_modals, settings.css.close, settings);
+
+ modal.trigger('close.fndtn.reveal');
+
+ if ((settings.multiple_opened && open_modals.length === 1) ||
!settings.multiple_opened || modal.length > 1) {
+ self.toggle_bg(modal, false);
+ self.to_front(modal);
+ }
+
+ if (settings.multiple_opened) {
+ self.hide(modal, settings.css.close, settings);
+ self.to_front($($.makeArray(open_modals).reverse()[1]));
+ } else {
+ self.hide(open_modals, settings.css.close, settings);
+ }
}
},
@@ -1392,12 +1484,13 @@
// is modal
if (css) {
var settings = el.data(this.attr_name(true) + '-init') ||
this.settings,
- root_element = settings.root_element;
+ root_element = settings.root_element,
+ context = this;
if (el.parent(root_element).length === 0) {
var placeholder = el.wrap('<div style="display: none;" />').parent();
- el.on('closed.fndtn.reveal.wrapped', function() {
+ el.on('closed.fndtn.reveal.wrapped', function () {
el.detach().appendTo(placeholder);
el.unwrap().unbind('closed.fndtn.reveal.wrapped');
});
@@ -1420,11 +1513,11 @@
return el
.css(css)
.animate(end_css, settings.animation_speed, 'linear', function
() {
- this.locked = false;
- el.trigger('opened').trigger('opened.fndtn.reveal');
- }.bind(this))
+ context.locked = false;
+ el.trigger('opened.fndtn.reveal');
+ })
.addClass('open');
- }.bind(this), settings.animation_speed / 2);
+ }, settings.animation_speed / 2);
}
if (animData.fade) {
@@ -1435,14 +1528,14 @@
return el
.css(css)
.animate(end_css, settings.animation_speed, 'linear', function
() {
- this.locked = false;
- el.trigger('opened').trigger('opened.fndtn.reveal');
- }.bind(this))
+ context.locked = false;
+ el.trigger('opened.fndtn.reveal');
+ })
.addClass('open');
- }.bind(this), settings.animation_speed / 2);
+ }, settings.animation_speed / 2);
}
- return el.css(css).show().css({opacity:
1}).addClass('open').trigger('opened').trigger('opened.fndtn.reveal');
+ return el.css(css).show().css({opacity :
1}).addClass('open').trigger('opened.fndtn.reveal');
}
var settings = this.settings;
@@ -1457,10 +1550,19 @@
return el.show();
},
+ to_back : function(el) {
+ el.addClass('toback');
+ },
+
+ to_front : function(el) {
+ el.removeClass('toback');
+ },
+
hide : function (el, css) {
// is modal
if (css) {
- var settings = el.data(this.attr_name(true) + '-init');
+ var settings = el.data(this.attr_name(true) + '-init'),
+ context = this;
settings = settings || this.settings;
var animData = getAnimationData(settings.animation);
@@ -1476,27 +1578,27 @@
return setTimeout(function () {
return el
.animate(end_css, settings.animation_speed, 'linear', function
() {
- this.locked = false;
- el.css(css).trigger('closed').trigger('closed.fndtn.reveal');
- }.bind(this))
+ context.locked = false;
+ el.css(css).trigger('closed.fndtn.reveal');
+ })
.removeClass('open');
- }.bind(this), settings.animation_speed / 2);
+ }, settings.animation_speed / 2);
}
if (animData.fade) {
- var end_css = {opacity: 0};
+ var end_css = {opacity : 0};
return setTimeout(function () {
return el
.animate(end_css, settings.animation_speed, 'linear', function
() {
- this.locked = false;
- el.css(css).trigger('closed').trigger('closed.fndtn.reveal');
- }.bind(this))
+ context.locked = false;
+ el.css(css).trigger('closed.fndtn.reveal');
+ })
.removeClass('open');
- }.bind(this), settings.animation_speed / 2);
+ }, settings.animation_speed / 2);
}
- return
el.hide().css(css).removeClass('open').trigger('closed').trigger('closed.fndtn.reveal');
+ return
el.hide().css(css).removeClass('open').trigger('closed.fndtn.reveal');
}
var settings = this.settings;
@@ -1537,7 +1639,7 @@
}
},
- data_attr: function (str) {
+ data_attr : function (str) {
if (this.namespace.length > 0) {
return this.namespace + '-' + str;
}
@@ -1546,7 +1648,7 @@
},
cache_offset : function (modal) {
- var offset = modal.show().height() + parseInt(modal.css('top'), 10);
+ var offset = modal.show().height() + parseInt(modal.css('top'), 10) +
modal.scrollY;
modal.hide();
@@ -1571,9 +1673,9 @@
var fade = /fade/i.test(str);
var pop = /pop/i.test(str);
return {
- animate: fade || pop,
- pop: pop,
- fade: fade
+ animate : fade || pop,
+ pop : pop,
+ fade : fade
};
}
}(jQuery, window, window.document));