mirror of
https://github.com/sourcey/spectacle.git
synced 2024-09-11 05:25:36 +03:00
parent
e6f49e9602
commit
5ed20126f0
@ -4,6 +4,26 @@ module.exports = function(grunt, options, spec) {
|
||||
return {
|
||||
|
||||
// Compile SCSS source files into the cache directory
|
||||
sass: {
|
||||
options: {
|
||||
includePaths: [
|
||||
options.appDir + '/vendor',
|
||||
options.appDir + '/vendor/foundation/scss'
|
||||
]
|
||||
},
|
||||
scss: {
|
||||
files: {
|
||||
[path.resolve(options.cacheDir, 'stylesheets/spectacle.css')]: path.resolve(options.appDir, 'stylesheets/spectacle.scss')
|
||||
}
|
||||
},
|
||||
foundation_scss: {
|
||||
files: {
|
||||
[path.resolve(options.cacheDir, 'stylesheets/foundation.css')]: path.resolve(options.appDir, 'stylesheets/foundation.scss')
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
/*
|
||||
sass: {
|
||||
scss: {
|
||||
options: {
|
||||
@ -30,6 +50,7 @@ module.exports = function(grunt, options, spec) {
|
||||
}
|
||||
},
|
||||
},
|
||||
*/
|
||||
|
||||
concat: {
|
||||
|
||||
|
2
app/vendor/foundation/LICENSE
vendored
2
app/vendor/foundation/LICENSE
vendored
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2013-2016 ZURB, inc.
|
||||
Copyright (c) 2013-2015 ZURB, inc.
|
||||
|
||||
MIT License
|
||||
|
||||
|
61
app/vendor/foundation/README.md
vendored
61
app/vendor/foundation/README.md
vendored
@ -1,44 +1,51 @@
|
||||
# [Foundation for Sites](http://foundation.zurb.com)
|
||||
# [Foundation for Sites](http://foundation.zurb.com) (v6.1)
|
||||
|
||||
[![npm version](https://badge.fury.io/js/foundation-sites.svg)](https://badge.fury.io/js/foundation-sites) [![Bower version](https://badge.fury.io/bo/foundation-sites.svg)](https://badge.fury.io/bo/foundation-sites) [![Gem Version](https://badge.fury.io/rb/foundation-rails.svg)](https://badge.fury.io/rb/foundation-rails) [![devDependency Status](https://david-dm.org/zurb/foundation-sites/dev-status.svg)](https://david-dm.org/zurb/foundation-sites#info=devDependencies) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/zurb/foundation-sites?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/zurb/foundation-sites?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
|
||||
Foundation is the most advanced responsive front-end framework in the world. Quickly go from prototype to production, building sites or apps that work on any kind of device with Foundation. Includes a fully customizable, responsive grid, a large library of Sass mixins, commonly used JavaScript plugins, and full accessibility support.
|
||||
Foundation is the most advanced responsive front-end framework in the world. Quickly go from prototype to production, building sites or apps that work on any kind of device with Foundation. Includes layout constructs, like a fully customizable, responsive grid, commonly used JavaScript plugins, and full A11Y support.
|
||||
|
||||
## Getting Started
|
||||
## Requirements
|
||||
|
||||
The quickest way to get started is with the [basic CSS download](http://foundation.zurb.com/sites/download/). You can get versions with every component, essential ones only, or a custom build.
|
||||
Requires NodeJS to be installed on your machine. Works with 0.10, 0.12, and 4.1! **Note that parts of our build process will break with NPM 3, due to the changes in how packages are installed.**
|
||||
|
||||
If you're a Sass user, we have two starter project templates, the [Basic Template](https://github.com/zurb/foundation-sites-template) and the [ZURB Template](https://github.com/zurb/foundation-zurb-template). You can install them by manually downloading them from GitHub, or using the [Foundation CLI](https://github.com/zurb/foundation-cli).
|
||||
The Sass is compiled using libsass, which requires the GCC to be installed on your machine. Windows users can install it through [MinGW](http://www.mingw.org/), and Mac users can install it through the [Xcode Command-line Tools](http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/).
|
||||
|
||||
Lastly, if you're rolling your own setup, you can install Foundation through a variety of [package managers](http://foundation.zurb.com/sites/docs/installation.html#package-managers).
|
||||
## Setup
|
||||
|
||||
To get going with Foundation you can:
|
||||
|
||||
|
||||
* [Install Yeti Launch](http://foundation.zurb.com/develop/yeti-launch.html): Seriously though, check it out!
|
||||
* [Install the CLI](https://www.npmjs.com/package/foundation-cli): `npm install -g foundation-cli`
|
||||
* [Download the latest release](http://foundation.zurb.com/sites/download.html)
|
||||
* [Install with Bower](http://bower.io): `bower install foundation-sites`
|
||||
* [Install with npm](http://npmjs.com): `npm install foundation-sites`
|
||||
* [Install with Atmosphere for Meteor](https://atmospherejs.com): `meteor add zurb:foundation-sites`
|
||||
* [Install with Composer](https://getcomposer.org/): `php composer.phar require zurb/foundation`
|
||||
|
||||
## Documentation
|
||||
|
||||
The documentation can be found at <https://foundation.zurb.com/sites/docs>. To run the documentation locally on your machine, you need [Node.js](https://nodejs.org/en/) and [Ruby](https://www.ruby-lang.org/en/) installed on your computer. (Your Node.js version must be 0.12 or higher.)
|
||||
Foundation uses [Gulp](http://gulpjs.com/) and [SuperCollider](https://www.npmjs.com/package/supercollider) to generate its [documentation pages](http://foundation.zurb.com/sites/docs). Documentation can also be run from your local computer:
|
||||
|
||||
Run these commands to set up the documentation:
|
||||
### View documentation locally
|
||||
|
||||
```bash
|
||||
git clone https://github.com/zurb/foundation-sites
|
||||
You'll want to clone the Foundation repo first and install all the dependencies. You can do this using the following commands:
|
||||
|
||||
```
|
||||
git clone git@github.com:zurb/foundation-sites.git
|
||||
cd foundation-sites
|
||||
gem install scss-lint
|
||||
npm install
|
||||
```
|
||||
|
||||
Then run `npm start` to compile the documentation. When it finishes, a new browser window will open pointing to a BrowserSync server displaying the documentation.
|
||||
Then just run `npm start` and the documentation will be compiled. It will also launch an instance of [BrowserSync](http://www.browsersync.io/) and open a tab in your default browser.
|
||||
The file structure:
|
||||
|
||||
## Testing
|
||||
```
|
||||
foundation/
|
||||
├── dist/
|
||||
│ └── ...
|
||||
├── docs/
|
||||
│ └── ...
|
||||
```
|
||||
|
||||
Foundation has three kinds of tests: JavaScript, Sass, and visual regression. Refer to our [testing guide](https://github.com/zurb/foundation-sites/wiki/Testing-Guide) for more details.
|
||||
|
||||
These commands will run the various tests:
|
||||
|
||||
- `npm run test:sass`
|
||||
- `npm run test:javascript`
|
||||
- `npm run test:visual`
|
||||
|
||||
## Contributing
|
||||
|
||||
Check out our [contributing guide](http://foundation.zurb.com/develop/contribute.html) to learn how you can contribute to Foundation. You can also browse the [Help Wanted](https://github.com/zurb/foundation-sites/labels/help%20wanted) tag in our issue tracker to find things to do.
|
||||
|
||||
Copyright (c) 2016 ZURB, inc.
|
||||
Copyright (c) 2015 ZURB, inc.
|
||||
|
545
app/vendor/foundation/js/foundation.abide.js
vendored
545
app/vendor/foundation/js/foundation.abide.js
vendored
@ -1,13 +1,6 @@
|
||||
'use strict';
|
||||
!function(Foundation, $) {
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
|
||||
/**
|
||||
* Abide module.
|
||||
* @module foundation.abide
|
||||
*/
|
||||
|
||||
class Abide {
|
||||
/**
|
||||
* Creates a new instance of Abide.
|
||||
* @class
|
||||
@ -15,7 +8,7 @@ class Abide {
|
||||
* @param {Object} element - jQuery object to add the trigger to.
|
||||
* @param {Object} options - Overrides to the default plugin settings.
|
||||
*/
|
||||
constructor(element, options = {}) {
|
||||
function Abide(element, options) {
|
||||
this.$element = element;
|
||||
this.options = $.extend({}, Abide.defaults, this.$element.data(), options);
|
||||
|
||||
@ -24,66 +17,153 @@ class Abide {
|
||||
Foundation.registerPlugin(this, 'Abide');
|
||||
}
|
||||
|
||||
/**
|
||||
* Default settings for plugin
|
||||
*/
|
||||
Abide.defaults = {
|
||||
/**
|
||||
* The default event to validate inputs. Checkboxes and radios validate immediately.
|
||||
* Remove or change this value for manual validation.
|
||||
* @option
|
||||
* @example 'fieldChange'
|
||||
*/
|
||||
validateOn: 'fieldChange',
|
||||
/**
|
||||
* Class to be applied to input labels on failed validation.
|
||||
* @option
|
||||
* @example 'is-invalid-label'
|
||||
*/
|
||||
labelErrorClass: 'is-invalid-label',
|
||||
/**
|
||||
* Class to be applied to inputs on failed validation.
|
||||
* @option
|
||||
* @example 'is-invalid-input'
|
||||
*/
|
||||
inputErrorClass: 'is-invalid-input',
|
||||
/**
|
||||
* Class selector to use to target Form Errors for show/hide.
|
||||
* @option
|
||||
* @example '.form-error'
|
||||
*/
|
||||
formErrorSelector: '.form-error',
|
||||
/**
|
||||
* Class added to Form Errors on failed validation.
|
||||
* @option
|
||||
* @example 'is-visible'
|
||||
*/
|
||||
formErrorClass: 'is-visible',
|
||||
/**
|
||||
* Set to true to validate text inputs on any value change.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
liveValidate: false,
|
||||
|
||||
patterns: {
|
||||
alpha : /^[a-zA-Z]+$/,
|
||||
alpha_numeric : /^[a-zA-Z0-9]+$/,
|
||||
integer : /^[-+]?\d+$/,
|
||||
number : /^[-+]?\d*(?:[\.\,]\d+)?$/,
|
||||
|
||||
// amex, visa, diners
|
||||
card : /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/,
|
||||
cvv : /^([0-9]){3,4}$/,
|
||||
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address
|
||||
email : /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/,
|
||||
|
||||
url : /^(https?|ftp|file|ssh):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/,
|
||||
// abc.de
|
||||
domain : /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,8}$/,
|
||||
|
||||
datetime : /^([0-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])T([0-5][0-9])\:([0-5][0-9])\:([0-5][0-9])(Z|([\-\+]([0-1][0-9])\:00))$/,
|
||||
// YYYY-MM-DD
|
||||
date : /(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))$/,
|
||||
// HH:MM:SS
|
||||
time : /^(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}$/,
|
||||
dateISO : /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/,
|
||||
// MM/DD/YYYY
|
||||
month_day_year : /^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.]\d{4}$/,
|
||||
// DD/MM/YYYY
|
||||
day_month_year : /^(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.]\d{4}$/,
|
||||
|
||||
// #FFF or #FFFFFF
|
||||
color : /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/
|
||||
},
|
||||
/**
|
||||
* Optional validation functions to be used. `equalTo` being the only default included function.
|
||||
* Functions should return only a boolean if the input is valid or not. Functions are given the following arguments:
|
||||
* el : The jQuery element to validate.
|
||||
* required : Boolean value of the required attribute be present or not.
|
||||
* parent : The direct parent of the input.
|
||||
* @option
|
||||
*/
|
||||
validators: {
|
||||
equalTo: function (el, required, parent) {
|
||||
return $('#' + el.attr('data-equalto')).val() === el.val();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Initializes the Abide plugin and calls functions to get Abide functioning on load.
|
||||
* @private
|
||||
*/
|
||||
_init() {
|
||||
this.$inputs = this.$element.find('input, textarea, select');
|
||||
Abide.prototype._init = function(){
|
||||
this.$inputs = this.$element.find('input, textarea, select').not('[data-abide-ignore]');
|
||||
|
||||
this._events();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes events for Abide.
|
||||
* @private
|
||||
*/
|
||||
_events() {
|
||||
Abide.prototype._events = function() {
|
||||
var _this = this;
|
||||
|
||||
this.$element.off('.abide')
|
||||
.on('reset.zf.abide', () => {
|
||||
this.resetForm();
|
||||
})
|
||||
.on('submit.zf.abide', () => {
|
||||
return this.validateForm();
|
||||
});
|
||||
|
||||
if (this.options.validateOn === 'fieldChange') {
|
||||
this.$inputs
|
||||
.off('change.zf.abide')
|
||||
.on('change.zf.abide', (e) => {
|
||||
this.validateInput($(e.target));
|
||||
.on('reset.zf.abide', function(e){
|
||||
_this.resetForm();
|
||||
})
|
||||
.on('submit.zf.abide', function(e){
|
||||
return _this.validateForm();
|
||||
});
|
||||
|
||||
if(this.options.validateOn === 'fieldChange'){
|
||||
this.$inputs.off('change.zf.abide')
|
||||
.on('change.zf.abide', function(e){
|
||||
_this.validateInput($(this));
|
||||
});
|
||||
}
|
||||
|
||||
if (this.options.liveValidate) {
|
||||
this.$inputs
|
||||
.off('input.zf.abide')
|
||||
.on('input.zf.abide', (e) => {
|
||||
this.validateInput($(e.target));
|
||||
});
|
||||
if(this.options.liveValidate){
|
||||
this.$inputs.off('input.zf.abide')
|
||||
.on('input.zf.abide', function(e){
|
||||
_this.validateInput($(this));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
/**
|
||||
* Calls necessary functions to update Abide upon DOM change
|
||||
* @private
|
||||
*/
|
||||
_reflow() {
|
||||
Abide.prototype._reflow = function() {
|
||||
this._init();
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Checks whether or not a form element has the required attribute and if it's checked or not
|
||||
* @param {Object} element - jQuery object to check for required attribute
|
||||
* @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty
|
||||
*/
|
||||
requiredCheck($el) {
|
||||
if (!$el.attr('required')) return true;
|
||||
|
||||
Abide.prototype.requiredCheck = function($el) {
|
||||
if(!$el.attr('required')) return true;
|
||||
var isGood = true;
|
||||
|
||||
switch ($el[0].type) {
|
||||
|
||||
case 'checkbox':
|
||||
case 'radio':
|
||||
isGood = $el[0].checked;
|
||||
break;
|
||||
|
||||
@ -91,16 +171,14 @@ class Abide {
|
||||
case 'select-one':
|
||||
case 'select-multiple':
|
||||
var opt = $el.find('option:selected');
|
||||
if (!opt.length || !opt.val()) isGood = false;
|
||||
if(!opt.length || !opt.val()) isGood = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
if(!$el.val() || !$el.val().length) isGood = false;
|
||||
}
|
||||
|
||||
return isGood;
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Based on $el, get the first element with selector in this order:
|
||||
* 1. The element's direct sibling('s).
|
||||
@ -111,16 +189,13 @@ class Abide {
|
||||
* @param {Object} $el - jQuery object to use as reference to find the form error selector.
|
||||
* @returns {Object} jQuery object with the selector.
|
||||
*/
|
||||
findFormError($el) {
|
||||
var $error = $el.siblings(this.options.formErrorSelector);
|
||||
|
||||
if (!$error.length) {
|
||||
Abide.prototype.findFormError = function($el){
|
||||
var $error = $el.siblings(this.options.formErrorSelector)
|
||||
if(!$error.length){
|
||||
$error = $el.parent().find(this.options.formErrorSelector);
|
||||
}
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Get the first element in this order:
|
||||
* 2. The <label> with the attribute `[for="someInputId"]`
|
||||
@ -129,105 +204,45 @@ class Abide {
|
||||
* @param {Object} $el - jQuery object to check for required attribute
|
||||
* @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty
|
||||
*/
|
||||
findLabel($el) {
|
||||
var id = $el[0].id;
|
||||
var $label = this.$element.find(`label[for="${id}"]`);
|
||||
|
||||
if (!$label.length) {
|
||||
Abide.prototype.findLabel = function($el) {
|
||||
var $label = this.$element.find('label[for="' + $el[0].id + '"]');
|
||||
if(!$label.length){
|
||||
return $el.closest('label');
|
||||
}
|
||||
|
||||
return $label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the set of labels associated with a set of radio els in this order
|
||||
* 2. The <label> with the attribute `[for="someInputId"]`
|
||||
* 3. The `.closest()` <label>
|
||||
*
|
||||
* @param {Object} $el - jQuery object to check for required attribute
|
||||
* @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty
|
||||
*/
|
||||
findRadioLabels($els) {
|
||||
var labels = $els.map((i, el) => {
|
||||
var id = el.id;
|
||||
var $label = this.$element.find(`label[for="${id}"]`);
|
||||
|
||||
if (!$label.length) {
|
||||
$label = $(el).closest('label');
|
||||
}
|
||||
return $label[0];
|
||||
});
|
||||
|
||||
return $(labels);
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Adds the CSS error class as specified by the Abide settings to the label, input, and the form
|
||||
* @param {Object} $el - jQuery object to add the class to
|
||||
*/
|
||||
addErrorClasses($el) {
|
||||
var $label = this.findLabel($el);
|
||||
var $formError = this.findFormError($el);
|
||||
Abide.prototype.addErrorClasses = function($el){
|
||||
var $label = this.findLabel($el),
|
||||
$formError = this.findFormError($el);
|
||||
|
||||
if ($label.length) {
|
||||
if($label.length){
|
||||
$label.addClass(this.options.labelErrorClass);
|
||||
}
|
||||
|
||||
if ($formError.length) {
|
||||
if($formError.length){
|
||||
$formError.addClass(this.options.formErrorClass);
|
||||
}
|
||||
|
||||
$el.addClass(this.options.inputErrorClass).attr('data-invalid', '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove CSS error classes etc from an entire radio button group
|
||||
* @param {String} groupName - A string that specifies the name of a radio button group
|
||||
*
|
||||
*/
|
||||
|
||||
removeRadioErrorClasses(groupName) {
|
||||
var $els = this.$element.find(`:radio[name="${groupName}"]`);
|
||||
var $labels = this.findRadioLabels($els);
|
||||
var $formErrors = this.findFormError($els);
|
||||
|
||||
if ($labels.length) {
|
||||
$labels.removeClass(this.options.labelErrorClass);
|
||||
}
|
||||
|
||||
if ($formErrors.length) {
|
||||
$formErrors.removeClass(this.options.formErrorClass);
|
||||
}
|
||||
|
||||
$els.removeClass(this.options.inputErrorClass).removeAttr('data-invalid');
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Removes CSS error class as specified by the Abide settings from the label, input, and the form
|
||||
* @param {Object} $el - jQuery object to remove the class from
|
||||
*/
|
||||
removeErrorClasses($el) {
|
||||
// radios need to clear all of the els
|
||||
if($el[0].type == 'radio') {
|
||||
return this.removeRadioErrorClasses($el.attr('name'));
|
||||
}
|
||||
Abide.prototype.removeErrorClasses = function($el){
|
||||
var $label = this.findLabel($el),
|
||||
$formError = this.findFormError($el);
|
||||
|
||||
var $label = this.findLabel($el);
|
||||
var $formError = this.findFormError($el);
|
||||
|
||||
if ($label.length) {
|
||||
if($label.length){
|
||||
$label.removeClass(this.options.labelErrorClass);
|
||||
}
|
||||
|
||||
if ($formError.length) {
|
||||
if($formError.length){
|
||||
$formError.removeClass(this.options.formErrorClass);
|
||||
}
|
||||
|
||||
$el.removeClass(this.options.inputErrorClass).removeAttr('data-invalid');
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Goes through a form to find inputs and proceeds to validate them in ways specific to their type
|
||||
* @fires Abide#invalid
|
||||
@ -235,19 +250,15 @@ class Abide {
|
||||
* @param {Object} element - jQuery object to validate, should be an HTML input
|
||||
* @returns {Boolean} goodToGo - If the input is valid or not.
|
||||
*/
|
||||
validateInput($el) {
|
||||
Abide.prototype.validateInput = function($el){
|
||||
var clearRequire = this.requiredCheck($el),
|
||||
validated = false,
|
||||
customValidator = true,
|
||||
validator = $el.attr('data-validator'),
|
||||
equalTo = true;
|
||||
|
||||
// don't validate ignored inputs or hidden inputs
|
||||
if ($el.is('[data-abide-ignore]') || $el.is('[type="hidden"]')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch ($el[0].type) {
|
||||
|
||||
case 'radio':
|
||||
validated = this.validateRadio($el.attr('name'));
|
||||
break;
|
||||
@ -266,17 +277,11 @@ class Abide {
|
||||
validated = this.validateText($el);
|
||||
}
|
||||
|
||||
if (validator) {
|
||||
customValidator = this.matchValidation($el, validator, $el.attr('required'));
|
||||
}
|
||||
if(validator){ customValidator = this.matchValidation($el, validator, $el.attr('required')); }
|
||||
if($el.attr('data-equalto')){ equalTo = this.options.validators.equalTo($el); }
|
||||
|
||||
if ($el.attr('data-equalto')) {
|
||||
equalTo = this.options.validators.equalTo($el);
|
||||
}
|
||||
|
||||
|
||||
var goodToGo = [clearRequire, validated, customValidator, equalTo].indexOf(false) === -1;
|
||||
var message = (goodToGo ? 'valid' : 'invalid') + '.zf.abide';
|
||||
var goodToGo = [clearRequire, validated, customValidator, equalTo].indexOf(false) === -1,
|
||||
message = (goodToGo ? 'valid' : 'invalid') + '.zf.abide';
|
||||
|
||||
this[goodToGo ? 'removeErrorClasses' : 'addErrorClasses']($el);
|
||||
|
||||
@ -286,104 +291,70 @@ class Abide {
|
||||
* @event Abide#valid
|
||||
* @event Abide#invalid
|
||||
*/
|
||||
$el.trigger(message, [$el]);
|
||||
$el.trigger(message, $el[0]);
|
||||
|
||||
return goodToGo;
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Goes through a form and if there are any invalid inputs, it will display the form error element
|
||||
* @returns {Boolean} noError - true if no errors were detected...
|
||||
* @fires Abide#formvalid
|
||||
* @fires Abide#forminvalid
|
||||
*/
|
||||
validateForm() {
|
||||
var acc = [];
|
||||
var _this = this;
|
||||
Abide.prototype.validateForm = function(){
|
||||
var acc = [],
|
||||
_this = this;
|
||||
|
||||
this.$inputs.each(function() {
|
||||
this.$inputs.each(function(){
|
||||
acc.push(_this.validateInput($(this)));
|
||||
});
|
||||
|
||||
var noError = acc.indexOf(false) === -1;
|
||||
|
||||
this.$element.find('[data-abide-error]').css('display', (noError ? 'none' : 'block'));
|
||||
|
||||
/**
|
||||
* Fires when the form is finished validating. Event trigger is either `formvalid.zf.abide` or `forminvalid.zf.abide`.
|
||||
* Trigger includes the element of the form.
|
||||
* @event Abide#formvalid
|
||||
* @event Abide#forminvalid
|
||||
*/
|
||||
/**
|
||||
* Fires when the form is finished validating. Event trigger is either `formvalid.zf.abide` or `forminvalid.zf.abide`.
|
||||
* Trigger includes the element of the form.
|
||||
* @event Abide#formvalid
|
||||
* @event Abide#forminvalid
|
||||
*/
|
||||
this.$element.trigger((noError ? 'formvalid' : 'forminvalid') + '.zf.abide', [this.$element]);
|
||||
|
||||
return noError;
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Determines whether or a not a text input is valid based on the pattern specified in the attribute. If no matching pattern is found, returns true.
|
||||
* @param {Object} $el - jQuery object to validate, should be a text input HTML element
|
||||
* @param {String} pattern - string value of one of the RegEx patterns in Abide.options.patterns
|
||||
* @returns {Boolean} Boolean value depends on whether or not the input value matches the pattern specified
|
||||
*/
|
||||
validateText($el, pattern) {
|
||||
// A pattern can be passed to this function, or it will be infered from the input's "pattern" attribute, or it's "type" attribute
|
||||
pattern = (pattern || $el.attr('pattern') || $el.attr('type'));
|
||||
var inputText = $el.val();
|
||||
var valid = false;
|
||||
Abide.prototype.validateText = function($el, pattern){
|
||||
// pattern = pattern ? pattern : $el.attr('pattern') ? $el.attr('pattern') : $el.attr('type');
|
||||
pattern = (pattern || $el.attr('pattern') || $el.attr('type'));
|
||||
var inputText = $el.val();
|
||||
|
||||
if (inputText.length) {
|
||||
// If the pattern attribute on the element is in Abide's list of patterns, then test that regexp
|
||||
if (this.options.patterns.hasOwnProperty(pattern)) {
|
||||
valid = this.options.patterns[pattern].test(inputText);
|
||||
}
|
||||
// If the pattern name isn't also the type attribute of the field, then test it as a regexp
|
||||
else if (pattern !== $el.attr('type')) {
|
||||
valid = new RegExp(pattern).test(inputText);
|
||||
}
|
||||
else {
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
// An empty field is valid if it's not required
|
||||
else if (!$el.prop('required')) {
|
||||
valid = true;
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether or a not a radio input is valid based on whether or not it is required and selected. Although the function targets a single `<input>`, it validates by checking the `required` and `checked` properties of all radio buttons in its group.
|
||||
return inputText.length ?//if text, check if the pattern exists, if so, test it, if no text or no pattern, return true.
|
||||
this.options.patterns.hasOwnProperty(pattern) ? this.options.patterns[pattern].test(inputText) :
|
||||
pattern && pattern !== $el.attr('type') ? new RegExp(pattern).test(inputText) : true : true;
|
||||
}; /**
|
||||
* Determines whether or a not a radio input is valid based on whether or not it is required and selected
|
||||
* @param {String} groupName - A string that specifies the name of a radio button group
|
||||
* @returns {Boolean} Boolean value depends on whether or not at least one radio input has been selected (if it's required)
|
||||
*/
|
||||
validateRadio(groupName) {
|
||||
// If at least one radio in the group has the `required` attribute, the group is considered required
|
||||
// Per W3C spec, all radio buttons in a group should have `required`, but we're being nice
|
||||
var $group = this.$element.find(`:radio[name="${groupName}"]`);
|
||||
var valid = false, required = false;
|
||||
Abide.prototype.validateRadio = function(groupName){
|
||||
var $group = this.$element.find(':radio[name="' + groupName + '"]'),
|
||||
counter = [],
|
||||
_this = this;
|
||||
|
||||
// For the group to be required, at least one radio needs to be required
|
||||
$group.each((i, e) => {
|
||||
if ($(e).attr('required')) {
|
||||
required = true;
|
||||
}
|
||||
$group.each(function(){
|
||||
var rdio = $(this),
|
||||
clear = _this.requiredCheck(rdio);
|
||||
counter.push(clear);
|
||||
if(clear) _this.removeErrorClasses(rdio);
|
||||
});
|
||||
if(!required) valid=true;
|
||||
|
||||
if (!valid) {
|
||||
// For the group to be valid, at least one radio needs to be checked
|
||||
$group.each((i, e) => {
|
||||
if ($(e).prop('checked')) {
|
||||
valid = true;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
return counter.indexOf(false) === -1;
|
||||
};
|
||||
/**
|
||||
* Determines if a selected input passes a custom validation function. Multiple validations can be used, if passed to the element with `data-validator="foo bar baz"` in a space separated listed.
|
||||
* @param {Object} $el - jQuery input element.
|
||||
@ -391,153 +362,57 @@ class Abide {
|
||||
* @param {Boolean} required - self explanatory?
|
||||
* @returns {Boolean} - true if validations passed.
|
||||
*/
|
||||
matchValidation($el, validators, required) {
|
||||
Abide.prototype.matchValidation = function($el, validators, required){
|
||||
var _this = this;
|
||||
required = required ? true : false;
|
||||
|
||||
var clear = validators.split(' ').map((v) => {
|
||||
return this.options.validators[v]($el, required, $el.parent());
|
||||
var clear = validators.split(' ').map(function(v){
|
||||
return _this.options.validators[v]($el, required, $el.parent());
|
||||
});
|
||||
return clear.indexOf(false) === -1;
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Resets form inputs and styles
|
||||
* @fires Abide#formreset
|
||||
*/
|
||||
resetForm() {
|
||||
Abide.prototype.resetForm = function() {
|
||||
var $form = this.$element,
|
||||
opts = this.options;
|
||||
|
||||
$(`.${opts.labelErrorClass}`, $form).not('small').removeClass(opts.labelErrorClass);
|
||||
$(`.${opts.inputErrorClass}`, $form).not('small').removeClass(opts.inputErrorClass);
|
||||
$(`${opts.formErrorSelector}.${opts.formErrorClass}`).removeClass(opts.formErrorClass);
|
||||
$('.' + opts.labelErrorClass, $form).not('small').removeClass(opts.labelErrorClass);
|
||||
$('.' + opts.inputErrorClass, $form).not('small').removeClass(opts.inputErrorClass);
|
||||
$(opts.formErrorSelector + '.' + opts.formErrorClass).removeClass(opts.formErrorClass);
|
||||
$form.find('[data-abide-error]').css('display', 'none');
|
||||
$(':input', $form).not(':button, :submit, :reset, :hidden, :radio, :checkbox, [data-abide-ignore]').val('').removeAttr('data-invalid');
|
||||
$(':input:radio', $form).not('[data-abide-ignore]').prop('checked',false).removeAttr('data-invalid');
|
||||
$(':input:checkbox', $form).not('[data-abide-ignore]').prop('checked',false).removeAttr('data-invalid');
|
||||
$(':input', $form).not(':button, :submit, :reset, :hidden, [data-abide-ignore]').val('').removeAttr('data-invalid');
|
||||
/**
|
||||
* Fires when the form has been reset.
|
||||
* @event Abide#formreset
|
||||
*/
|
||||
$form.trigger('formreset.zf.abide', [$form]);
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Destroys an instance of Abide.
|
||||
* Removes error styles and classes from elements, without resetting their values.
|
||||
*/
|
||||
destroy() {
|
||||
Abide.prototype.destroy = function(){
|
||||
var _this = this;
|
||||
this.$element
|
||||
.off('.abide')
|
||||
.find('[data-abide-error]')
|
||||
.css('display', 'none');
|
||||
|
||||
this.$inputs
|
||||
.off('.abide')
|
||||
.each(function() {
|
||||
_this.removeErrorClasses($(this));
|
||||
});
|
||||
this.$element.off('.abide')
|
||||
.find('[data-abide-error]').css('display', 'none');
|
||||
this.$inputs.off('.abide')
|
||||
.each(function(){
|
||||
_this.removeErrorClasses($(this));
|
||||
});
|
||||
|
||||
Foundation.unregisterPlugin(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Default settings for plugin
|
||||
*/
|
||||
Abide.defaults = {
|
||||
/**
|
||||
* The default event to validate inputs. Checkboxes and radios validate immediately.
|
||||
* Remove or change this value for manual validation.
|
||||
* @option
|
||||
* @example 'fieldChange'
|
||||
*/
|
||||
validateOn: 'fieldChange',
|
||||
Foundation.plugin(Abide, 'Abide');
|
||||
|
||||
/**
|
||||
* Class to be applied to input labels on failed validation.
|
||||
* @option
|
||||
* @example 'is-invalid-label'
|
||||
*/
|
||||
labelErrorClass: 'is-invalid-label',
|
||||
// Exports for AMD/Browserify
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined')
|
||||
module.exports = Abide;
|
||||
if (typeof define === 'function')
|
||||
define(['foundation'], function() {
|
||||
return Abide;
|
||||
});
|
||||
|
||||
/**
|
||||
* Class to be applied to inputs on failed validation.
|
||||
* @option
|
||||
* @example 'is-invalid-input'
|
||||
*/
|
||||
inputErrorClass: 'is-invalid-input',
|
||||
|
||||
/**
|
||||
* Class selector to use to target Form Errors for show/hide.
|
||||
* @option
|
||||
* @example '.form-error'
|
||||
*/
|
||||
formErrorSelector: '.form-error',
|
||||
|
||||
/**
|
||||
* Class added to Form Errors on failed validation.
|
||||
* @option
|
||||
* @example 'is-visible'
|
||||
*/
|
||||
formErrorClass: 'is-visible',
|
||||
|
||||
/**
|
||||
* Set to true to validate text inputs on any value change.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
liveValidate: false,
|
||||
|
||||
patterns: {
|
||||
alpha : /^[a-zA-Z]+$/,
|
||||
alpha_numeric : /^[a-zA-Z0-9]+$/,
|
||||
integer : /^[-+]?\d+$/,
|
||||
number : /^[-+]?\d*(?:[\.\,]\d+)?$/,
|
||||
|
||||
// amex, visa, diners
|
||||
card : /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/,
|
||||
cvv : /^([0-9]){3,4}$/,
|
||||
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address
|
||||
email : /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/,
|
||||
|
||||
url : /^(https?|ftp|file|ssh):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/,
|
||||
// abc.de
|
||||
domain : /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,8}$/,
|
||||
|
||||
datetime : /^([0-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])T([0-5][0-9])\:([0-5][0-9])\:([0-5][0-9])(Z|([\-\+]([0-1][0-9])\:00))$/,
|
||||
// YYYY-MM-DD
|
||||
date : /(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))$/,
|
||||
// HH:MM:SS
|
||||
time : /^(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}$/,
|
||||
dateISO : /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/,
|
||||
// MM/DD/YYYY
|
||||
month_day_year : /^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.]\d{4}$/,
|
||||
// DD/MM/YYYY
|
||||
day_month_year : /^(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.]\d{4}$/,
|
||||
|
||||
// #FFF or #FFFFFF
|
||||
color : /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/
|
||||
},
|
||||
|
||||
/**
|
||||
* Optional validation functions to be used. `equalTo` being the only default included function.
|
||||
* Functions should return only a boolean if the input is valid or not. Functions are given the following arguments:
|
||||
* el : The jQuery element to validate.
|
||||
* required : Boolean value of the required attribute be present or not.
|
||||
* parent : The direct parent of the input.
|
||||
* @option
|
||||
*/
|
||||
validators: {
|
||||
equalTo: function (el, required, parent) {
|
||||
return $(`#${el.attr('data-equalto')}`).val() === el.val();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Window exports
|
||||
Foundation.plugin(Abide, 'Abide');
|
||||
|
||||
}(jQuery);
|
||||
}(Foundation, jQuery);
|
||||
|
191
app/vendor/foundation/js/foundation.accordion.js
vendored
191
app/vendor/foundation/js/foundation.accordion.js
vendored
@ -1,23 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
|
||||
/**
|
||||
* Accordion module.
|
||||
* @module foundation.accordion
|
||||
* @requires foundation.util.keyboard
|
||||
* @requires foundation.util.motion
|
||||
*/
|
||||
!function($, Foundation) {
|
||||
'use strict';
|
||||
|
||||
class Accordion {
|
||||
/**
|
||||
* Creates a new instance of an accordion.
|
||||
* @class
|
||||
* @fires Accordion#init
|
||||
* @param {jQuery} element - jQuery object to make into an accordion.
|
||||
* @param {Object} options - a plain object with settings to override the default options.
|
||||
*/
|
||||
constructor(element, options) {
|
||||
function Accordion(element, options){
|
||||
this.$element = element;
|
||||
this.options = $.extend({}, Accordion.defaults, this.$element.data(), options);
|
||||
|
||||
@ -32,19 +28,43 @@ class Accordion {
|
||||
});
|
||||
}
|
||||
|
||||
Accordion.defaults = {
|
||||
/**
|
||||
* Amount of time to animate the opening of an accordion pane.
|
||||
* @option
|
||||
* @example 250
|
||||
*/
|
||||
slideSpeed: 250,
|
||||
/**
|
||||
* Allow the accordion to have multiple open panes.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
multiExpand: false,
|
||||
/**
|
||||
* Allow the accordion to close all panes.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
allowAllClosed: false
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes the accordion by animating the preset active pane(s).
|
||||
* @private
|
||||
*/
|
||||
_init() {
|
||||
Accordion.prototype._init = function() {
|
||||
this.$element.attr('role', 'tablist');
|
||||
this.$tabs = this.$element.children('li, [data-accordion-item]');
|
||||
this.$tabs = this.$element.children('li');
|
||||
if (this.$tabs.length == 0) {
|
||||
this.$tabs = this.$element.children('[data-accordion-item]');
|
||||
}
|
||||
this.$tabs.each(function(idx, el){
|
||||
|
||||
this.$tabs.each(function(idx, el) {
|
||||
var $el = $(el),
|
||||
$content = $el.children('[data-tab-content]'),
|
||||
$content = $el.find('[data-tab-content]'),
|
||||
id = $content[0].id || Foundation.GetYoDigits(6, 'accordion'),
|
||||
linkId = el.id || `${id}-label`;
|
||||
linkId = el.id || id + '-label';
|
||||
|
||||
$el.find('a:first').attr({
|
||||
'aria-controls': id,
|
||||
@ -53,7 +73,6 @@ class Accordion {
|
||||
'aria-expanded': false,
|
||||
'aria-selected': false
|
||||
});
|
||||
|
||||
$content.attr({'role': 'tabpanel', 'aria-labelledby': linkId, 'aria-hidden': true, 'id': id});
|
||||
});
|
||||
var $initActive = this.$element.find('.is-active').children('[data-tab-content]');
|
||||
@ -61,39 +80,41 @@ class Accordion {
|
||||
this.down($initActive, true);
|
||||
}
|
||||
this._events();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds event handlers for items within the accordion.
|
||||
* @private
|
||||
*/
|
||||
_events() {
|
||||
Accordion.prototype._events = function() {
|
||||
var _this = this;
|
||||
|
||||
this.$tabs.each(function() {
|
||||
this.$tabs.each(function(){
|
||||
var $elem = $(this);
|
||||
var $tabContent = $elem.children('[data-tab-content]');
|
||||
if ($tabContent.length) {
|
||||
$elem.children('a').off('click.zf.accordion keydown.zf.accordion')
|
||||
.on('click.zf.accordion', function(e) {
|
||||
.on('click.zf.accordion', function(e){
|
||||
// $(this).children('a').on('click.zf.accordion', function(e) {
|
||||
e.preventDefault();
|
||||
_this.toggle($tabContent);
|
||||
if ($elem.hasClass('is-active')) {
|
||||
if(_this.options.allowAllClosed || $elem.siblings().hasClass('is-active')){
|
||||
_this.up($tabContent);
|
||||
}
|
||||
}
|
||||
else {
|
||||
_this.down($tabContent);
|
||||
}
|
||||
}).on('keydown.zf.accordion', function(e){
|
||||
Foundation.Keyboard.handleKey(e, 'Accordion', {
|
||||
toggle: function() {
|
||||
_this.toggle($tabContent);
|
||||
},
|
||||
next: function() {
|
||||
var $a = $elem.next().find('a').focus();
|
||||
if (!_this.options.multiExpand) {
|
||||
$a.trigger('click.zf.accordion')
|
||||
}
|
||||
$elem.next().find('a').focus().trigger('click.zf.accordion');
|
||||
},
|
||||
previous: function() {
|
||||
var $a = $elem.prev().find('a').focus();
|
||||
if (!_this.options.multiExpand) {
|
||||
$a.trigger('click.zf.accordion')
|
||||
}
|
||||
$elem.prev().find('a').focus().trigger('click.zf.accordion');
|
||||
},
|
||||
handled: function() {
|
||||
e.preventDefault();
|
||||
@ -103,124 +124,106 @@ class Accordion {
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Toggles the selected content pane's open/close state.
|
||||
* @param {jQuery} $target - jQuery object of the pane to toggle (`.accordion-content`).
|
||||
* @param {jQuery} $target - jQuery object of the pane to toggle.
|
||||
* @function
|
||||
*/
|
||||
toggle($target) {
|
||||
if($target.parent().hasClass('is-active')) {
|
||||
this.up($target);
|
||||
} else {
|
||||
Accordion.prototype.toggle = function($target){
|
||||
if($target.parent().hasClass('is-active')){
|
||||
if(this.options.allowAllClosed || $target.parent().siblings().hasClass('is-active')){
|
||||
this.up($target);
|
||||
}else{ return; }
|
||||
}else{
|
||||
this.down($target);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Opens the accordion tab defined by `$target`.
|
||||
* @param {jQuery} $target - Accordion pane to open (`.accordion-content`).
|
||||
* @param {jQuery} $target - Accordion pane to open.
|
||||
* @param {Boolean} firstTime - flag to determine if reflow should happen.
|
||||
* @fires Accordion#down
|
||||
* @function
|
||||
*/
|
||||
down($target, firstTime) {
|
||||
Accordion.prototype.down = function($target, firstTime) {
|
||||
var _this = this;
|
||||
if(!this.options.multiExpand && !firstTime){
|
||||
var $currentActive = this.$element.find('.is-active').children('[data-tab-content]');
|
||||
if($currentActive.length){
|
||||
this.up($currentActive);
|
||||
}
|
||||
}
|
||||
|
||||
$target
|
||||
.attr('aria-hidden', false)
|
||||
.parent('[data-tab-content]')
|
||||
.addBack()
|
||||
.parent().addClass('is-active');
|
||||
|
||||
if (!this.options.multiExpand && !firstTime) {
|
||||
var $currentActive = this.$element.children('.is-active').children('[data-tab-content]');
|
||||
if ($currentActive.length) {
|
||||
this.up($currentActive.not($target));
|
||||
}
|
||||
}
|
||||
// Foundation.Move(_this.options.slideSpeed, $target, function(){
|
||||
$target.slideDown(_this.options.slideSpeed);
|
||||
// });
|
||||
|
||||
$target.slideDown(this.options.slideSpeed, () => {
|
||||
/**
|
||||
* Fires when the tab is done opening.
|
||||
* @event Accordion#down
|
||||
*/
|
||||
this.$element.trigger('down.zf.accordion', [$target]);
|
||||
});
|
||||
|
||||
$(`#${$target.attr('aria-labelledby')}`).attr({
|
||||
// if(!firstTime){
|
||||
// Foundation._reflow(this.$element.attr('data-accordion'));
|
||||
// }
|
||||
$('#' + $target.attr('aria-labelledby')).attr({
|
||||
'aria-expanded': true,
|
||||
'aria-selected': true
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Fires when the tab is done opening.
|
||||
* @event Accordion#down
|
||||
*/
|
||||
this.$element.trigger('down.zf.accordion', [$target]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Closes the tab defined by `$target`.
|
||||
* @param {jQuery} $target - Accordion tab to close (`.accordion-content`).
|
||||
* @param {jQuery} $target - Accordion tab to close.
|
||||
* @fires Accordion#up
|
||||
* @function
|
||||
*/
|
||||
up($target) {
|
||||
Accordion.prototype.up = function($target) {
|
||||
var $aunts = $target.parent().siblings(),
|
||||
_this = this;
|
||||
var canClose = this.options.multiExpand ? $aunts.hasClass('is-active') : $target.parent().hasClass('is-active');
|
||||
|
||||
if((!this.options.allowAllClosed && !$aunts.hasClass('is-active')) || !$target.parent().hasClass('is-active')) {
|
||||
if(!this.options.allowAllClosed && !canClose){
|
||||
return;
|
||||
}
|
||||
|
||||
// Foundation.Move(this.options.slideSpeed, $target, function(){
|
||||
$target.slideUp(_this.options.slideSpeed, function () {
|
||||
/**
|
||||
* Fires when the tab is done collapsing up.
|
||||
* @event Accordion#up
|
||||
*/
|
||||
_this.$element.trigger('up.zf.accordion', [$target]);
|
||||
});
|
||||
$target.slideUp(_this.options.slideSpeed);
|
||||
// });
|
||||
|
||||
$target.attr('aria-hidden', true)
|
||||
.parent().removeClass('is-active');
|
||||
|
||||
$(`#${$target.attr('aria-labelledby')}`).attr({
|
||||
$('#' + $target.attr('aria-labelledby')).attr({
|
||||
'aria-expanded': false,
|
||||
'aria-selected': false
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires when the tab is done collapsing up.
|
||||
* @event Accordion#up
|
||||
*/
|
||||
this.$element.trigger('up.zf.accordion', [$target]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Destroys an instance of an accordion.
|
||||
* @fires Accordion#destroyed
|
||||
* @function
|
||||
*/
|
||||
destroy() {
|
||||
this.$element.find('[data-tab-content]').stop(true).slideUp(0).css('display', '');
|
||||
Accordion.prototype.destroy = function() {
|
||||
this.$element.find('[data-tab-content]').slideUp(0).css('display', '');
|
||||
this.$element.find('a').off('.zf.accordion');
|
||||
|
||||
Foundation.unregisterPlugin(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Accordion.defaults = {
|
||||
/**
|
||||
* Amount of time to animate the opening of an accordion pane.
|
||||
* @option
|
||||
* @example 250
|
||||
*/
|
||||
slideSpeed: 250,
|
||||
/**
|
||||
* Allow the accordion to have multiple open panes.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
multiExpand: false,
|
||||
/**
|
||||
* Allow the accordion to close all panes.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
allowAllClosed: false
|
||||
};
|
||||
|
||||
// Window exports
|
||||
Foundation.plugin(Accordion, 'Accordion');
|
||||
|
||||
}(jQuery);
|
||||
Foundation.plugin(Accordion, 'Accordion');
|
||||
}(jQuery, window.Foundation);
|
||||
|
167
app/vendor/foundation/js/foundation.accordionMenu.js
vendored
167
app/vendor/foundation/js/foundation.accordionMenu.js
vendored
@ -1,7 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
|
||||
/**
|
||||
* AccordionMenu module.
|
||||
* @module foundation.accordionMenu
|
||||
@ -9,8 +5,9 @@
|
||||
* @requires foundation.util.motion
|
||||
* @requires foundation.util.nest
|
||||
*/
|
||||
!function($) {
|
||||
'use strict';
|
||||
|
||||
class AccordionMenu {
|
||||
/**
|
||||
* Creates a new instance of an accordion menu.
|
||||
* @class
|
||||
@ -18,7 +15,7 @@ class AccordionMenu {
|
||||
* @param {jQuery} element - jQuery object to make into an accordion menu.
|
||||
* @param {Object} options - Overrides to the default plugin settings.
|
||||
*/
|
||||
constructor(element, options) {
|
||||
function AccordionMenu(element, options) {
|
||||
this.$element = element;
|
||||
this.options = $.extend({}, AccordionMenu.defaults, this.$element.data(), options);
|
||||
|
||||
@ -34,24 +31,39 @@ class AccordionMenu {
|
||||
'ARROW_UP': 'up',
|
||||
'ARROW_DOWN': 'down',
|
||||
'ARROW_LEFT': 'close',
|
||||
'ESCAPE': 'closeAll'
|
||||
'ESCAPE': 'closeAll',
|
||||
'TAB': 'down',
|
||||
'SHIFT_TAB': 'up'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
AccordionMenu.defaults = {
|
||||
/**
|
||||
* Amount of time to animate the opening of a submenu in ms.
|
||||
* @option
|
||||
* @example 250
|
||||
*/
|
||||
slideSpeed: 250,
|
||||
/**
|
||||
* Allow the menu to have multiple open panes.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
multiOpen: true
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes the accordion menu by hiding all nested menus.
|
||||
* @private
|
||||
*/
|
||||
_init() {
|
||||
AccordionMenu.prototype._init = function() {
|
||||
this.$element.find('[data-submenu]').not('.is-active').slideUp(0);//.find('a').css('padding-left', '1rem');
|
||||
this.$element.attr({
|
||||
'role': 'menu',
|
||||
'role': 'tablist',
|
||||
'aria-multiselectable': this.options.multiOpen
|
||||
});
|
||||
|
||||
this.$menuLinks = this.$element.find('.is-accordion-submenu-parent');
|
||||
this.$menuLinks = this.$element.find('.has-submenu');
|
||||
this.$menuLinks.each(function(){
|
||||
var linkId = this.id || Foundation.GetYoDigits(6, 'acc-menu-link'),
|
||||
$elem = $(this),
|
||||
@ -61,13 +73,14 @@ class AccordionMenu {
|
||||
$elem.attr({
|
||||
'aria-controls': subId,
|
||||
'aria-expanded': isActive,
|
||||
'role': 'menuitem',
|
||||
'aria-selected': false,
|
||||
'role': 'tab',
|
||||
'id': linkId
|
||||
});
|
||||
$sub.attr({
|
||||
'aria-labelledby': linkId,
|
||||
'aria-hidden': !isActive,
|
||||
'role': 'menu',
|
||||
'role': 'tabpanel',
|
||||
'id': subId
|
||||
});
|
||||
});
|
||||
@ -79,20 +92,20 @@ class AccordionMenu {
|
||||
});
|
||||
}
|
||||
this._events();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds event handlers for items within the menu.
|
||||
* @private
|
||||
*/
|
||||
_events() {
|
||||
AccordionMenu.prototype._events = function() {
|
||||
var _this = this;
|
||||
|
||||
this.$element.find('li').each(function() {
|
||||
var $submenu = $(this).children('[data-submenu]');
|
||||
|
||||
if ($submenu.length) {
|
||||
$(this).children('a').off('click.zf.accordionMenu').on('click.zf.accordionMenu', function(e) {
|
||||
$(this).children('a').off('click.zf.accordionmenu').on('click.zf.accordionmenu', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
_this.toggle($submenu);
|
||||
@ -107,30 +120,29 @@ class AccordionMenu {
|
||||
|
||||
$elements.each(function(i) {
|
||||
if ($(this).is($element)) {
|
||||
$prevElement = $elements.eq(Math.max(0, i-1)).find('a').first();
|
||||
$nextElement = $elements.eq(Math.min(i+1, $elements.length-1)).find('a').first();
|
||||
$prevElement = $elements.eq(Math.max(0, i-1));
|
||||
$nextElement = $elements.eq(Math.min(i+1, $elements.length-1));
|
||||
|
||||
if ($(this).children('[data-submenu]:visible').length) { // has open sub menu
|
||||
$nextElement = $element.find('li:first-child').find('a').first();
|
||||
$nextElement = $element.find('li:first-child');
|
||||
}
|
||||
if ($(this).is(':first-child')) { // is first element of sub menu
|
||||
$prevElement = $element.parents('li').first().find('a').first();
|
||||
} else if ($prevElement.parents('li').first().children('[data-submenu]:visible').length) { // if previous element has open sub menu
|
||||
$prevElement = $prevElement.parents('li').find('li:last-child').find('a').first();
|
||||
$prevElement = $element.parents('li').first();
|
||||
} else if ($prevElement.children('[data-submenu]:visible').length) { // if previous element has open sub menu
|
||||
$prevElement = $prevElement.find('li:last-child');
|
||||
}
|
||||
if ($(this).is(':last-child')) { // is last element of sub menu
|
||||
$nextElement = $element.parents('li').first().next('li').find('a').first();
|
||||
$nextElement = $element.parents('li').first().next('li');
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
Foundation.Keyboard.handleKey(e, 'AccordionMenu', {
|
||||
open: function() {
|
||||
if ($target.is(':hidden')) {
|
||||
_this.down($target);
|
||||
$target.find('li').first().find('a').first().focus();
|
||||
$target.find('li').first().focus();
|
||||
}
|
||||
},
|
||||
close: function() {
|
||||
@ -138,16 +150,14 @@ class AccordionMenu {
|
||||
_this.up($target);
|
||||
} else if ($element.parent('[data-submenu]').length) { // close currently open sub
|
||||
_this.up($element.parent('[data-submenu]'));
|
||||
$element.parents('li').first().find('a').first().focus();
|
||||
$element.parents('li').first().focus();
|
||||
}
|
||||
},
|
||||
up: function() {
|
||||
$prevElement.focus();
|
||||
return true;
|
||||
},
|
||||
down: function() {
|
||||
$nextElement.focus();
|
||||
return true;
|
||||
},
|
||||
toggle: function() {
|
||||
if ($element.children('[data-submenu]').length) {
|
||||
@ -157,30 +167,26 @@ class AccordionMenu {
|
||||
closeAll: function() {
|
||||
_this.hideAll();
|
||||
},
|
||||
handled: function(preventDefault) {
|
||||
if (preventDefault) {
|
||||
e.preventDefault();
|
||||
}
|
||||
handled: function() {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
});
|
||||
});//.attr('tabindex', 0);
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Closes all panes of the menu.
|
||||
* @function
|
||||
*/
|
||||
hideAll() {
|
||||
AccordionMenu.prototype.hideAll = function(){
|
||||
this.$element.find('[data-submenu]').slideUp(this.options.slideSpeed);
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Toggles the open/close state of a submenu.
|
||||
* @function
|
||||
* @param {jQuery} $target - the submenu to toggle
|
||||
*/
|
||||
toggle($target){
|
||||
AccordionMenu.prototype.toggle = function($target){
|
||||
if(!$target.is(':animated')) {
|
||||
if (!$target.is(':hidden')) {
|
||||
this.up($target);
|
||||
@ -189,85 +195,68 @@ class AccordionMenu {
|
||||
this.down($target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Opens the sub-menu defined by `$target`.
|
||||
* @param {jQuery} $target - Sub-menu to open.
|
||||
* @fires AccordionMenu#down
|
||||
*/
|
||||
down($target) {
|
||||
AccordionMenu.prototype.down = function($target) {
|
||||
var _this = this;
|
||||
|
||||
if(!this.options.multiOpen) {
|
||||
if(!this.options.multiOpen){
|
||||
this.up(this.$element.find('.is-active').not($target.parentsUntil(this.$element).add($target)));
|
||||
}
|
||||
|
||||
$target.addClass('is-active').attr({'aria-hidden': false})
|
||||
.parent('.is-accordion-submenu-parent').attr({'aria-expanded': true});
|
||||
.parent('.has-submenu').attr({'aria-expanded': true, 'aria-selected': true});
|
||||
|
||||
//Foundation.Move(this.options.slideSpeed, $target, function() {
|
||||
$target.slideDown(_this.options.slideSpeed, function () {
|
||||
/**
|
||||
* Fires when the menu is done opening.
|
||||
* @event AccordionMenu#down
|
||||
*/
|
||||
_this.$element.trigger('down.zf.accordionMenu', [$target]);
|
||||
});
|
||||
//});
|
||||
}
|
||||
Foundation.Move(this.options.slideSpeed, $target, function(){
|
||||
$target.slideDown(_this.options.slideSpeed);
|
||||
});
|
||||
/**
|
||||
* Fires when the menu is done collapsing up.
|
||||
* @event AccordionMenu#down
|
||||
*/
|
||||
this.$element.trigger('down.zf.accordionMenu', [$target]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Closes the sub-menu defined by `$target`. All sub-menus inside the target will be closed as well.
|
||||
* @param {jQuery} $target - Sub-menu to close.
|
||||
* @fires AccordionMenu#up
|
||||
*/
|
||||
up($target) {
|
||||
AccordionMenu.prototype.up = function($target) {
|
||||
var _this = this;
|
||||
//Foundation.Move(this.options.slideSpeed, $target, function(){
|
||||
$target.slideUp(_this.options.slideSpeed, function () {
|
||||
/**
|
||||
* Fires when the menu is done collapsing up.
|
||||
* @event AccordionMenu#up
|
||||
*/
|
||||
_this.$element.trigger('up.zf.accordionMenu', [$target]);
|
||||
});
|
||||
//});
|
||||
Foundation.Move(this.options.slideSpeed, $target, function(){
|
||||
$target.slideUp(_this.options.slideSpeed);
|
||||
});
|
||||
$target.attr('aria-hidden', true)
|
||||
.find('[data-submenu]').slideUp(0).attr('aria-hidden', true).end()
|
||||
.parent('.has-submenu')
|
||||
.attr({'aria-expanded': false, 'aria-selected': false});
|
||||
// $target.slideUp(this.options.slideSpeed, function() {
|
||||
// $target.find('[data-submenu]').slideUp(0).attr('aria-hidden', true);
|
||||
// }).attr('aria-hidden', true).parent('.has-submenu').attr({'aria-expanded': false, 'aria-selected': false});
|
||||
|
||||
var $menus = $target.find('[data-submenu]').slideUp(0).addBack().attr('aria-hidden', true);
|
||||
|
||||
$menus.parent('.is-accordion-submenu-parent').attr('aria-expanded', false);
|
||||
}
|
||||
/**
|
||||
* Fires when the menu is done collapsing up.
|
||||
* @event AccordionMenu#up
|
||||
*/
|
||||
this.$element.trigger('up.zf.accordionMenu', [$target]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Destroys an instance of accordion menu.
|
||||
* @fires AccordionMenu#destroyed
|
||||
*/
|
||||
destroy() {
|
||||
AccordionMenu.prototype.destroy = function(){
|
||||
this.$element.find('[data-submenu]').slideDown(0).css('display', '');
|
||||
this.$element.find('a').off('click.zf.accordionMenu');
|
||||
|
||||
Foundation.Nest.Burn(this.$element, 'accordion');
|
||||
Foundation.unregisterPlugin(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
AccordionMenu.defaults = {
|
||||
/**
|
||||
* Amount of time to animate the opening of a submenu in ms.
|
||||
* @option
|
||||
* @example 250
|
||||
*/
|
||||
slideSpeed: 250,
|
||||
/**
|
||||
* Allow the menu to have multiple open panes.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
multiOpen: true
|
||||
};
|
||||
|
||||
// Window exports
|
||||
Foundation.plugin(AccordionMenu, 'AccordionMenu');
|
||||
|
||||
}(jQuery);
|
||||
Foundation.plugin(AccordionMenu, 'AccordionMenu');
|
||||
}(jQuery, window.Foundation);
|
||||
|
34
app/vendor/foundation/js/foundation.core.js
vendored
34
app/vendor/foundation/js/foundation.core.js
vendored
@ -1,8 +1,7 @@
|
||||
!function($) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var FOUNDATION_VERSION = '6.2.4';
|
||||
var FOUNDATION_VERSION = '6.1.1';
|
||||
|
||||
// Global Foundation object
|
||||
// This is attached to the window, or used as a module for AMD/Browserify
|
||||
@ -18,6 +17,10 @@ var Foundation = {
|
||||
* Stores generated unique ids for plugin instances
|
||||
*/
|
||||
_uuids: [],
|
||||
/**
|
||||
* Stores currently active plugins.
|
||||
*/
|
||||
_activePlugins: {},
|
||||
|
||||
/**
|
||||
* Returns a boolean for RTL support
|
||||
@ -42,24 +45,23 @@ var Foundation = {
|
||||
},
|
||||
/**
|
||||
* @function
|
||||
* Populates the _uuids array with pointers to each individual plugin instance.
|
||||
* Adds the `zfPlugin` data-attribute to programmatically created plugins to allow use of $(selector).foundation(method) calls.
|
||||
* Also fires the initialization event for each plugin, consolidating repetitive code.
|
||||
* Creates a pointer to an instance of a Plugin within the Foundation._activePlugins object.
|
||||
* Sets the `[data-pluginName="uniqueIdHere"]`, allowing easy access to any plugin's internal methods.
|
||||
* Also fires the initialization event for each plugin, consolidating repeditive code.
|
||||
* @param {Object} plugin - an instance of a plugin, usually `this` in context.
|
||||
* @param {String} name - the name of the plugin, passed as a camelCased string.
|
||||
* @fires Plugin#init
|
||||
*/
|
||||
registerPlugin: function(plugin, name){
|
||||
var pluginName = name ? hyphenate(name) : functionName(plugin.constructor).toLowerCase();
|
||||
plugin.uuid = this.GetYoDigits(6, pluginName);
|
||||
|
||||
if(!plugin.$element.attr(`data-${pluginName}`)){ plugin.$element.attr(`data-${pluginName}`, plugin.uuid); }
|
||||
if(!plugin.$element.attr('data-' + pluginName)){ plugin.$element.attr('data-' + pluginName, plugin.uuid); }
|
||||
if(!plugin.$element.data('zfPlugin')){ plugin.$element.data('zfPlugin', plugin); }
|
||||
/**
|
||||
* Fires when the plugin has initialized.
|
||||
* @event Plugin#init
|
||||
*/
|
||||
plugin.$element.trigger(`init.zf.${pluginName}`);
|
||||
plugin.$element.trigger('init.zf.' + pluginName);
|
||||
|
||||
this._uuids.push(plugin.uuid);
|
||||
|
||||
@ -67,9 +69,8 @@ var Foundation = {
|
||||
},
|
||||
/**
|
||||
* @function
|
||||
* Removes the plugins uuid from the _uuids array.
|
||||
* Removes the zfPlugin data attribute, as well as the data-plugin-name attribute.
|
||||
* Also fires the destroyed event for the plugin, consolidating repetitive code.
|
||||
* Removes the pointer for an instance of a Plugin from the Foundation._activePlugins obj.
|
||||
* Also fires the destroyed event for the plugin, consolidating repeditive code.
|
||||
* @param {Object} plugin - an instance of a plugin, usually `this` in context.
|
||||
* @fires Plugin#destroyed
|
||||
*/
|
||||
@ -77,12 +78,12 @@ var Foundation = {
|
||||
var pluginName = hyphenate(functionName(plugin.$element.data('zfPlugin').constructor));
|
||||
|
||||
this._uuids.splice(this._uuids.indexOf(plugin.uuid), 1);
|
||||
plugin.$element.removeAttr(`data-${pluginName}`).removeData('zfPlugin')
|
||||
plugin.$element.removeAttr('data-' + pluginName).removeData('zfPlugin')
|
||||
/**
|
||||
* Fires when the plugin has been destroyed.
|
||||
* @event Plugin#destroyed
|
||||
*/
|
||||
.trigger(`destroyed.zf.${pluginName}`);
|
||||
.trigger('destroyed.zf.' + pluginName);
|
||||
for(var prop in plugin){
|
||||
plugin[prop] = null;//clean up script to prep for garbage collection.
|
||||
}
|
||||
@ -108,12 +109,10 @@ var Foundation = {
|
||||
fns = {
|
||||
'object': function(plgs){
|
||||
plgs.forEach(function(p){
|
||||
p = hyphenate(p);
|
||||
$('[data-'+ p +']').foundation('_init');
|
||||
});
|
||||
},
|
||||
'string': function(){
|
||||
plugins = hyphenate(plugins);
|
||||
$('[data-'+ plugins +']').foundation('_init');
|
||||
},
|
||||
'undefined': function(){
|
||||
@ -139,7 +138,7 @@ var Foundation = {
|
||||
*/
|
||||
GetYoDigits: function(length, namespace){
|
||||
length = length || 6;
|
||||
return Math.round((Math.pow(36, length + 1) - Math.random() * Math.pow(36, length))).toString(36).slice(1) + (namespace ? `-${namespace}` : '');
|
||||
return Math.round((Math.pow(36, length + 1) - Math.random() * Math.pow(36, length))).toString(36).slice(1) + (namespace ? '-' + namespace : '');
|
||||
},
|
||||
/**
|
||||
* Initialize plugins on any elements within `elem` (and `elem` itself) that aren't already initialized.
|
||||
@ -220,6 +219,7 @@ var Foundation = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Foundation.util = {
|
||||
/**
|
||||
* Function for applying a debounce effect to a function call.
|
||||
@ -281,7 +281,7 @@ var foundation = function(method) {
|
||||
throw new ReferenceError("We're sorry, '" + method + "' is not an available method for " + (plugClass ? functionName(plugClass) : 'this element') + '.');
|
||||
}
|
||||
}else{//error for invalid argument type
|
||||
throw new TypeError(`We're sorry, ${type} is not a valid parameter. You must use a string representing the method you wish to invoke.`);
|
||||
throw new TypeError("We're sorry, '" + type + "' is not a valid parameter. You must use a string representing the method you wish to invoke.");
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
240
app/vendor/foundation/js/foundation.drilldown.js
vendored
240
app/vendor/foundation/js/foundation.drilldown.js
vendored
@ -1,7 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
|
||||
/**
|
||||
* Drilldown module.
|
||||
* @module foundation.drilldown
|
||||
@ -9,15 +5,16 @@
|
||||
* @requires foundation.util.motion
|
||||
* @requires foundation.util.nest
|
||||
*/
|
||||
!function($, Foundation){
|
||||
'use strict';
|
||||
|
||||
class Drilldown {
|
||||
/**
|
||||
* Creates a new instance of a drilldown menu.
|
||||
* @class
|
||||
* @param {jQuery} element - jQuery object to make into an accordion menu.
|
||||
* @param {Object} options - Overrides to the default plugin settings.
|
||||
*/
|
||||
constructor(element, options) {
|
||||
function Drilldown(element, options){
|
||||
this.$element = element;
|
||||
this.options = $.extend({}, Drilldown.defaults, this.$element.data(), options);
|
||||
|
||||
@ -38,21 +35,40 @@ class Drilldown {
|
||||
'SHIFT_TAB': 'up'
|
||||
});
|
||||
}
|
||||
|
||||
Drilldown.defaults = {
|
||||
/**
|
||||
* Markup used for JS generated back button. Prepended to submenu lists and deleted on `destroy` method, 'js-drilldown-back' class required. Remove the backslash (`\`) if copy and pasting.
|
||||
* @option
|
||||
* @example '<\li><\a>Back<\/a><\/li>'
|
||||
*/
|
||||
backButton: '<li class="js-drilldown-back"><a>Back</a></li>',
|
||||
/**
|
||||
* Markup used to wrap drilldown menu. Use a class name for independent styling; the JS applied class: `is-drilldown` is required. Remove the backslash (`\`) if copy and pasting.
|
||||
* @option
|
||||
* @example '<\div class="is-drilldown"><\/div>'
|
||||
*/
|
||||
wrapper: '<div></div>',
|
||||
/**
|
||||
* Allow the menu to return to root list on body click.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
closeOnClick: false
|
||||
// holdOpen: false
|
||||
};
|
||||
/**
|
||||
* Initializes the drilldown by creating jQuery collections of elements
|
||||
* @private
|
||||
*/
|
||||
_init() {
|
||||
this.$submenuAnchors = this.$element.find('li.is-drilldown-submenu-parent').children('a');
|
||||
this.$submenus = this.$submenuAnchors.parent('li').children('[data-submenu]');
|
||||
this.$menuItems = this.$element.find('li').not('.js-drilldown-back').attr('role', 'menuitem').find('a');
|
||||
Drilldown.prototype._init = function(){
|
||||
this.$submenuAnchors = this.$element.find('li.has-submenu');
|
||||
this.$submenus = this.$submenuAnchors.children('[data-submenu]');
|
||||
this.$menuItems = this.$element.find('li').not('.js-drilldown-back').attr('role', 'menuitem');
|
||||
|
||||
this._prepareMenu();
|
||||
|
||||
this._keyboardEvents();
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* prepares drilldown menu by setting attributes to links and elements
|
||||
* sets a min height to prevent content jumping
|
||||
@ -60,25 +76,22 @@ class Drilldown {
|
||||
* @private
|
||||
* @function
|
||||
*/
|
||||
_prepareMenu() {
|
||||
Drilldown.prototype._prepareMenu = function(){
|
||||
var _this = this;
|
||||
// if(!this.options.holdOpen){
|
||||
// this._menuLinkEvents();
|
||||
// }
|
||||
this.$submenuAnchors.each(function(){
|
||||
var $link = $(this);
|
||||
var $sub = $link.parent();
|
||||
if(_this.options.parentLink){
|
||||
$link.clone().prependTo($sub.children('[data-submenu]')).wrap('<li class="is-submenu-parent-item is-submenu-item is-drilldown-submenu-item" role="menu-item"></li>');
|
||||
}
|
||||
$link.data('savedHref', $link.attr('href')).removeAttr('href').attr('tabindex', 0);
|
||||
$link.children('[data-submenu]')
|
||||
var $sub = $(this);
|
||||
var $link = $sub.find('a:first');
|
||||
$link.data('savedHref', $link.attr('href')).removeAttr('href');
|
||||
$sub.children('[data-submenu]')
|
||||
.attr({
|
||||
'aria-hidden': true,
|
||||
'tabindex': 0,
|
||||
'role': 'menu'
|
||||
});
|
||||
_this._events($link);
|
||||
_this._events($sub);
|
||||
});
|
||||
this.$submenus.each(function(){
|
||||
var $menu = $(this),
|
||||
@ -89,18 +102,18 @@ class Drilldown {
|
||||
_this._back($menu);
|
||||
});
|
||||
if(!this.$element.parent().hasClass('is-drilldown')){
|
||||
this.$wrapper = $(this.options.wrapper).addClass('is-drilldown');
|
||||
this.$wrapper = this.$element.wrap(this.$wrapper).parent().css(this._getMaxDims());
|
||||
this.$wrapper = $(this.options.wrapper).addClass('is-drilldown').css(this._getMaxDims());
|
||||
this.$element.wrap(this.$wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Adds event handlers to elements in the menu.
|
||||
* @function
|
||||
* @private
|
||||
* @param {jQuery} $elem - the current menu item to add handlers to.
|
||||
*/
|
||||
_events($elem) {
|
||||
Drilldown.prototype._events = function($elem){
|
||||
var _this = this;
|
||||
|
||||
$elem.off('click.zf.drilldown')
|
||||
@ -113,31 +126,27 @@ class Drilldown {
|
||||
// if(e.target !== e.currentTarget.firstElementChild){
|
||||
// return false;
|
||||
// }
|
||||
_this._show($elem.parent('li'));
|
||||
_this._show($elem);
|
||||
|
||||
if(_this.options.closeOnClick){
|
||||
var $body = $('body');
|
||||
var $body = $('body').not(_this.$wrapper);
|
||||
$body.off('.zf.drilldown').on('click.zf.drilldown', function(e){
|
||||
if (e.target === _this.$element[0] || $.contains(_this.$element[0], e.target)) { return; }
|
||||
e.preventDefault();
|
||||
_this._hideAll();
|
||||
$body.off('.zf.drilldown');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Adds keydown event listener to `li`'s in the menu.
|
||||
* @private
|
||||
*/
|
||||
_keyboardEvents() {
|
||||
Drilldown.prototype._keyboardEvents = function() {
|
||||
var _this = this;
|
||||
|
||||
this.$menuItems.add(this.$element.find('.js-drilldown-back > a')).on('keydown.zf.drilldown', function(e){
|
||||
|
||||
this.$menuItems.add(this.$element.find('.js-drilldown-back')).on('keydown.zf.drilldown', function(e){
|
||||
var $element = $(this),
|
||||
$elements = $element.parent('li').parent('ul').children('li').children('a'),
|
||||
$elements = $element.parent('ul').children('li'),
|
||||
$prevElement,
|
||||
$nextElement;
|
||||
|
||||
@ -148,33 +157,28 @@ class Drilldown {
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
Foundation.Keyboard.handleKey(e, 'Drilldown', {
|
||||
next: function() {
|
||||
if ($element.is(_this.$submenuAnchors)) {
|
||||
_this._show($element.parent('li'));
|
||||
$element.parent('li').one(Foundation.transitionend($element), function(){
|
||||
$element.parent('li').find('ul li a').filter(_this.$menuItems).first().focus();
|
||||
_this._show($element);
|
||||
$element.on(Foundation.transitionend($element), function(){
|
||||
$element.find('ul li').filter(_this.$menuItems).first().focus();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
},
|
||||
previous: function() {
|
||||
_this._hide($element.parent('li').parent('ul'));
|
||||
$element.parent('li').parent('ul').one(Foundation.transitionend($element), function(){
|
||||
_this._hide($element.parent('ul'));
|
||||
$element.parent('ul').on(Foundation.transitionend($element), function(){
|
||||
setTimeout(function() {
|
||||
$element.parent('li').parent('ul').parent('li').children('a').first().focus();
|
||||
$element.parent('ul').parent('li').focus();
|
||||
}, 1);
|
||||
});
|
||||
return true;
|
||||
},
|
||||
up: function() {
|
||||
$prevElement.focus();
|
||||
return true;
|
||||
},
|
||||
down: function() {
|
||||
$nextElement.focus();
|
||||
return true;
|
||||
},
|
||||
close: function() {
|
||||
_this._back();
|
||||
@ -182,38 +186,28 @@ class Drilldown {
|
||||
},
|
||||
open: function() {
|
||||
if (!$element.is(_this.$menuItems)) { // not menu item means back button
|
||||
_this._hide($element.parent('li').parent('ul'));
|
||||
$element.parent('li').parent('ul').one(Foundation.transitionend($element), function(){
|
||||
setTimeout(function() {
|
||||
$element.parent('li').parent('ul').parent('li').children('a').first().focus();
|
||||
}, 1);
|
||||
});
|
||||
return true;
|
||||
_this._hide($element.parent('ul'));
|
||||
setTimeout(function(){$element.parent('ul').parent('li').focus();}, 1);
|
||||
} else if ($element.is(_this.$submenuAnchors)) {
|
||||
_this._show($element.parent('li'));
|
||||
$element.parent('li').one(Foundation.transitionend($element), function(){
|
||||
$element.parent('li').find('ul li a').filter(_this.$menuItems).first().focus();
|
||||
});
|
||||
return true;
|
||||
_this._show($element);
|
||||
setTimeout(function(){$element.find('ul li').filter(_this.$menuItems).first().focus();}, 1);
|
||||
}
|
||||
},
|
||||
handled: function(preventDefault) {
|
||||
if (preventDefault) {
|
||||
e.preventDefault();
|
||||
}
|
||||
handled: function() {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
});
|
||||
}); // end keyboardAccess
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Closes all open elements, and returns to root menu.
|
||||
* @function
|
||||
* @fires Drilldown#closed
|
||||
*/
|
||||
_hideAll() {
|
||||
var $elem = this.$element.find('.is-drilldown-submenu.is-active').addClass('is-closing');
|
||||
Drilldown.prototype._hideAll = function(){
|
||||
var $elem = this.$element.find('.is-drilldown-sub.is-active').addClass('is-closing');
|
||||
$elem.one(Foundation.transitionend($elem), function(e){
|
||||
$elem.removeClass('is-active is-closing');
|
||||
});
|
||||
@ -222,15 +216,14 @@ class Drilldown {
|
||||
* @event Drilldown#closed
|
||||
*/
|
||||
this.$element.trigger('closed.zf.drilldown');
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Adds event listener for each `back` button, and closes open menus.
|
||||
* @function
|
||||
* @fires Drilldown#back
|
||||
* @param {jQuery} $elem - the current sub-menu to add `back` event.
|
||||
*/
|
||||
_back($elem) {
|
||||
Drilldown.prototype._back = function($elem){
|
||||
var _this = this;
|
||||
$elem.off('click.zf.drilldown');
|
||||
$elem.children('.js-drilldown-back')
|
||||
@ -238,23 +231,16 @@ class Drilldown {
|
||||
e.stopImmediatePropagation();
|
||||
// console.log('mouseup on back');
|
||||
_this._hide($elem);
|
||||
|
||||
// If there is a parent submenu, call show
|
||||
let parentSubMenu = $elem.parent('li').parent('ul').parent('li');
|
||||
if (parentSubMenu.length) {
|
||||
_this._show(parentSubMenu);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Adds event listener to menu items w/o submenus to close open menus on click.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_menuLinkEvents() {
|
||||
Drilldown.prototype._menuLinkEvents = function(){
|
||||
var _this = this;
|
||||
this.$menuItems.not('.is-drilldown-submenu-parent')
|
||||
this.$menuItems.not('.has-submenu')
|
||||
.off('click.zf.drilldown')
|
||||
.on('click.zf.drilldown', function(e){
|
||||
// e.stopImmediatePropagation();
|
||||
@ -262,120 +248,74 @@ class Drilldown {
|
||||
_this._hideAll();
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Opens a submenu.
|
||||
* @function
|
||||
* @fires Drilldown#open
|
||||
* @param {jQuery} $elem - the current element with a submenu to open, i.e. the `li` tag.
|
||||
* @param {jQuery} $elem - the current element with a submenu to open.
|
||||
*/
|
||||
_show($elem) {
|
||||
$elem.attr('aria-expanded', true);
|
||||
$elem.children('[data-submenu]').addClass('is-active').attr('aria-hidden', false);
|
||||
/**
|
||||
* Fires when the submenu has opened.
|
||||
* @event Drilldown#open
|
||||
*/
|
||||
Drilldown.prototype._show = function($elem){
|
||||
$elem.children('[data-submenu]').addClass('is-active');
|
||||
|
||||
this.$element.trigger('open.zf.drilldown', [$elem]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Hides a submenu
|
||||
* @function
|
||||
* @fires Drilldown#hide
|
||||
* @param {jQuery} $elem - the current sub-menu to hide, i.e. the `ul` tag.
|
||||
* @param {jQuery} $elem - the current sub-menu to hide.
|
||||
*/
|
||||
_hide($elem) {
|
||||
Drilldown.prototype._hide = function($elem){
|
||||
var _this = this;
|
||||
$elem.parent('li').attr('aria-expanded', false);
|
||||
$elem.attr('aria-hidden', true).addClass('is-closing')
|
||||
$elem.addClass('is-closing')
|
||||
.one(Foundation.transitionend($elem), function(){
|
||||
$elem.removeClass('is-active is-closing');
|
||||
$elem.blur();
|
||||
});
|
||||
/**
|
||||
* Fires when the submenu has closed.
|
||||
* Fires when the submenu is has closed.
|
||||
* @event Drilldown#hide
|
||||
*/
|
||||
$elem.trigger('hide.zf.drilldown', [$elem]);
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Iterates through the nested menus to calculate the min-height, and max-width for the menu.
|
||||
* Prevents content jumping.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_getMaxDims() {
|
||||
var biggest = 0
|
||||
var result = {};
|
||||
|
||||
this.$submenus.add(this.$element).each((i, elem) => {
|
||||
var height = elem.getBoundingClientRect().height;
|
||||
if (height > biggest) biggest = height;
|
||||
Drilldown.prototype._getMaxDims = function(){
|
||||
var max = 0, result = {};
|
||||
this.$submenus.add(this.$element).each(function(){
|
||||
var numOfElems = $(this).children('li').length;
|
||||
max = numOfElems > max ? numOfElems : max;
|
||||
});
|
||||
|
||||
result['min-height'] = `${biggest}px`;
|
||||
result['max-width'] = `${this.$element[0].getBoundingClientRect().width}px`;
|
||||
result.height = max * this.$menuItems[0].getBoundingClientRect().height + 'px';
|
||||
result.width = this.$element[0].getBoundingClientRect().width + 'px';
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Destroys the Drilldown Menu
|
||||
* @function
|
||||
*/
|
||||
destroy() {
|
||||
Drilldown.prototype.destroy = function(){
|
||||
this._hideAll();
|
||||
Foundation.Nest.Burn(this.$element, 'drilldown');
|
||||
this.$element.unwrap()
|
||||
.find('.js-drilldown-back, .is-submenu-parent-item').remove()
|
||||
.end().find('.is-active, .is-closing, .is-drilldown-submenu').removeClass('is-active is-closing is-drilldown-submenu')
|
||||
.end().find('[data-submenu]').removeAttr('aria-hidden tabindex role');
|
||||
this.$submenuAnchors.each(function() {
|
||||
$(this).off('.zf.drilldown');
|
||||
});
|
||||
.find('.js-drilldown-back').remove()
|
||||
.end().find('.is-active, .is-closing, .is-drilldown-sub').removeClass('is-active is-closing is-drilldown-sub')
|
||||
.end().find('[data-submenu]').removeAttr('aria-hidden tabindex role')
|
||||
.off('.zf.drilldown').end().off('zf.drilldown');
|
||||
this.$element.find('a').each(function(){
|
||||
var $link = $(this);
|
||||
$link.removeAttr('tabindex');
|
||||
if($link.data('savedHref')){
|
||||
$link.attr('href', $link.data('savedHref')).removeData('savedHref');
|
||||
}else{ return; }
|
||||
});
|
||||
Foundation.unregisterPlugin(this);
|
||||
};
|
||||
}
|
||||
|
||||
Drilldown.defaults = {
|
||||
/**
|
||||
* Markup used for JS generated back button. Prepended to submenu lists and deleted on `destroy` method, 'js-drilldown-back' class required. Remove the backslash (`\`) if copy and pasting.
|
||||
* @option
|
||||
* @example '<\li><\a>Back<\/a><\/li>'
|
||||
*/
|
||||
backButton: '<li class="js-drilldown-back"><a tabindex="0">Back</a></li>',
|
||||
/**
|
||||
* Markup used to wrap drilldown menu. Use a class name for independent styling; the JS applied class: `is-drilldown` is required. Remove the backslash (`\`) if copy and pasting.
|
||||
* @option
|
||||
* @example '<\div class="is-drilldown"><\/div>'
|
||||
*/
|
||||
wrapper: '<div></div>',
|
||||
/**
|
||||
* Adds the parent link to the submenu.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
parentLink: false,
|
||||
/**
|
||||
* Allow the menu to return to root list on body click.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
closeOnClick: false
|
||||
// holdOpen: false
|
||||
};
|
||||
|
||||
// Window exports
|
||||
Foundation.plugin(Drilldown, 'Drilldown');
|
||||
|
||||
}(jQuery);
|
||||
Foundation.plugin(Drilldown, 'Drilldown');
|
||||
}(jQuery, window.Foundation);
|
||||
|
218
app/vendor/foundation/js/foundation.dropdown.js
vendored
218
app/vendor/foundation/js/foundation.dropdown.js
vendored
@ -1,24 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
|
||||
/**
|
||||
* Dropdown module.
|
||||
* @module foundation.dropdown
|
||||
* @requires foundation.util.keyboard
|
||||
* @requires foundation.util.box
|
||||
* @requires foundation.util.triggers
|
||||
*/
|
||||
|
||||
class Dropdown {
|
||||
!function($, Foundation){
|
||||
'use strict';
|
||||
/**
|
||||
* Creates a new instance of a dropdown.
|
||||
* @class
|
||||
* @param {jQuery} element - jQuery object to make into a dropdown.
|
||||
* Object should be of the dropdown panel, rather than its anchor.
|
||||
* @param {jQuery} element - jQuery object to make into an accordion menu.
|
||||
* @param {Object} options - Overrides to the default plugin settings.
|
||||
*/
|
||||
constructor(element, options) {
|
||||
function Dropdown(element, options){
|
||||
this.$element = element;
|
||||
this.options = $.extend({}, Dropdown.defaults, this.$element.data(), options);
|
||||
this._init();
|
||||
@ -33,22 +27,78 @@ class Dropdown {
|
||||
});
|
||||
}
|
||||
|
||||
Dropdown.defaults = {
|
||||
/**
|
||||
* Amount of time to delay opening a submenu on hover event.
|
||||
* @option
|
||||
* @example 250
|
||||
*/
|
||||
hoverDelay: 250,
|
||||
/**
|
||||
* Allow submenus to open on hover events
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
hover: false,
|
||||
/**
|
||||
* Don't close dropdown when hovering over dropdown pane
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
hoverPane: false,
|
||||
/**
|
||||
* Number of pixels between the dropdown pane and the triggering element on open.
|
||||
* @option
|
||||
* @example 1
|
||||
*/
|
||||
vOffset: 1,
|
||||
/**
|
||||
* Number of pixels between the dropdown pane and the triggering element on open.
|
||||
* @option
|
||||
* @example 1
|
||||
*/
|
||||
hOffset: 1,
|
||||
/**
|
||||
* Class applied to adjust open position. JS will test and fill this in.
|
||||
* @option
|
||||
* @example 'top'
|
||||
*/
|
||||
positionClass: '',
|
||||
/**
|
||||
* Allow the plugin to trap focus to the dropdown pane if opened with keyboard commands.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
trapFocus: false,
|
||||
/**
|
||||
* Allow the plugin to set focus to the first focusable element within the pane, regardless of method of opening.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
autoFocus: false,
|
||||
/**
|
||||
* Allows a click on the body to close the dropdown.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
closeOnClick: false
|
||||
};
|
||||
/**
|
||||
* Initializes the plugin by setting/checking options and attributes, adding helper variables, and saving the anchor.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_init() {
|
||||
Dropdown.prototype._init = function(){
|
||||
var $id = this.$element.attr('id');
|
||||
|
||||
this.$anchor = $(`[data-toggle="${$id}"]`).length ? $(`[data-toggle="${$id}"]`) : $(`[data-open="${$id}"]`);
|
||||
this.$anchor = $('[data-toggle="' + $id + '"]') || $('[data-open="' + $id + '"]');
|
||||
this.$anchor.attr({
|
||||
'aria-controls': $id,
|
||||
'data-is-focus': false,
|
||||
'data-yeti-box': $id,
|
||||
'aria-haspopup': true,
|
||||
'aria-expanded': false
|
||||
|
||||
// 'data-resize': $id
|
||||
});
|
||||
|
||||
this.options.positionClass = this.getPositionClass();
|
||||
@ -61,30 +111,24 @@ class Dropdown {
|
||||
'aria-labelledby': this.$anchor[0].id || Foundation.GetYoDigits(6, 'dd-anchor')
|
||||
});
|
||||
this._events();
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Helper function to determine current orientation of dropdown pane.
|
||||
* @function
|
||||
* @returns {String} position - string value of a position class.
|
||||
*/
|
||||
getPositionClass() {
|
||||
var verticalPosition = this.$element[0].className.match(/(top|left|right|bottom)/g);
|
||||
verticalPosition = verticalPosition ? verticalPosition[0] : '';
|
||||
var horizontalPosition = /float-(\S+)/.exec(this.$anchor[0].className);
|
||||
horizontalPosition = horizontalPosition ? horizontalPosition[1] : '';
|
||||
var position = horizontalPosition ? horizontalPosition + ' ' + verticalPosition : verticalPosition;
|
||||
|
||||
Dropdown.prototype.getPositionClass = function(){
|
||||
var position = this.$element[0].className.match(/(top|left|right)/g);
|
||||
position = position ? position[0] : '';
|
||||
return position;
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Adjusts the dropdown panes orientation by adding/removing positioning classes.
|
||||
* @function
|
||||
* @private
|
||||
* @param {String} position - position class to remove.
|
||||
*/
|
||||
_reposition(position) {
|
||||
Dropdown.prototype._reposition = function(position){
|
||||
this.usedPositions.push(position ? position : 'bottom');
|
||||
//default, try switching to opposite side
|
||||
if(!position && (this.usedPositions.indexOf('top') < 0)){
|
||||
@ -116,15 +160,14 @@ class Dropdown {
|
||||
}
|
||||
this.classChanged = true;
|
||||
this.counter--;
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Sets the position and orientation of the dropdown pane, checks for collisions.
|
||||
* Recursively calls itself if a collision is detected, with a new position class.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_setPosition() {
|
||||
Dropdown.prototype._setPosition = function(){
|
||||
if(this.$anchor.attr('aria-expanded') === 'false'){ return false; }
|
||||
var position = this.getPositionClass(),
|
||||
$eleDims = Foundation.Box.GetDimensions(this.$element),
|
||||
@ -134,8 +177,6 @@ class Dropdown {
|
||||
param = (direction === 'top') ? 'height' : 'width',
|
||||
offset = (param === 'height') ? this.options.vOffset : this.options.hOffset;
|
||||
|
||||
|
||||
|
||||
if(($eleDims.width >= $eleDims.windowDims.width) || (!this.counter && !Foundation.Box.ImNotTouchingYou(this.$element))){
|
||||
this.$element.offset(Foundation.Box.GetOffsets(this.$element, this.$anchor, 'center bottom', this.options.vOffset, this.options.hOffset, true)).css({
|
||||
'width': $eleDims.windowDims.width - (this.options.hOffset * 2),
|
||||
@ -147,18 +188,17 @@ class Dropdown {
|
||||
|
||||
this.$element.offset(Foundation.Box.GetOffsets(this.$element, this.$anchor, position, this.options.vOffset, this.options.hOffset));
|
||||
|
||||
while(!Foundation.Box.ImNotTouchingYou(this.$element, false, true) && this.counter){
|
||||
while(!Foundation.Box.ImNotTouchingYou(this.$element) && this.counter){
|
||||
this._reposition(position);
|
||||
this._setPosition();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Adds event listeners to the element utilizing the triggers utility library.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_events() {
|
||||
Dropdown.prototype._events = function(){
|
||||
var _this = this;
|
||||
this.$element.on({
|
||||
'open.zf.trigger': this.open.bind(this),
|
||||
@ -169,14 +209,12 @@ class Dropdown {
|
||||
|
||||
if(this.options.hover){
|
||||
this.$anchor.off('mouseenter.zf.dropdown mouseleave.zf.dropdown')
|
||||
.on('mouseenter.zf.dropdown', function(){
|
||||
if($('body[data-whatinput="mouse"]').is('*')) {
|
||||
clearTimeout(_this.timeout);
|
||||
_this.timeout = setTimeout(function(){
|
||||
_this.open();
|
||||
_this.$anchor.data('hover', true);
|
||||
}, _this.options.hoverDelay);
|
||||
}
|
||||
.on('mouseenter.zf.dropdown', function(){
|
||||
clearTimeout(_this.timeout);
|
||||
_this.timeout = setTimeout(function(){
|
||||
_this.open();
|
||||
_this.$anchor.data('hover', true);
|
||||
}, _this.options.hoverDelay);
|
||||
}).on('mouseleave.zf.dropdown', function(){
|
||||
clearTimeout(_this.timeout);
|
||||
_this.timeout = setTimeout(function(){
|
||||
@ -236,14 +274,13 @@ class Dropdown {
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Adds an event handler to the body to close any dropdowns on a click.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_addBodyHandler() {
|
||||
Dropdown.prototype._addBodyHandler = function(){
|
||||
var $body = $(document.body).not(this.$element),
|
||||
_this = this;
|
||||
$body.off('click.zf.dropdown')
|
||||
@ -257,15 +294,14 @@ class Dropdown {
|
||||
_this.close();
|
||||
$body.off('click.zf.dropdown');
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Opens the dropdown pane, and fires a bubbling event to close other dropdowns.
|
||||
* @function
|
||||
* @fires Dropdown#closeme
|
||||
* @fires Dropdown#show
|
||||
*/
|
||||
open() {
|
||||
Dropdown.prototype.open = function(){
|
||||
// var _this = this;
|
||||
/**
|
||||
* Fires to close other open dropdowns
|
||||
@ -292,15 +328,18 @@ class Dropdown {
|
||||
* Fires once the dropdown is visible.
|
||||
* @event Dropdown#show
|
||||
*/
|
||||
this.$element.trigger('show.zf.dropdown', [this.$element]);
|
||||
}
|
||||
this.$element.trigger('show.zf.dropdown', [this.$element]);
|
||||
//why does this not work correctly for this plugin?
|
||||
// Foundation.reflow(this.$element, 'dropdown');
|
||||
// Foundation._reflow(this.$element.attr('data-dropdown'));
|
||||
};
|
||||
|
||||
/**
|
||||
* Closes the open dropdown pane.
|
||||
* @function
|
||||
* @fires Dropdown#hide
|
||||
*/
|
||||
close() {
|
||||
Dropdown.prototype.close = function(){
|
||||
if(!this.$element.hasClass('is-open')){
|
||||
return false;
|
||||
}
|
||||
@ -322,91 +361,30 @@ class Dropdown {
|
||||
this.usedPositions.length = 0;
|
||||
}
|
||||
this.$element.trigger('hide.zf.dropdown', [this.$element]);
|
||||
}
|
||||
|
||||
// Foundation.reflow(this.$element, 'dropdown');
|
||||
};
|
||||
/**
|
||||
* Toggles the dropdown pane's visibility.
|
||||
* @function
|
||||
*/
|
||||
toggle() {
|
||||
Dropdown.prototype.toggle = function(){
|
||||
if(this.$element.hasClass('is-open')){
|
||||
if(this.$anchor.data('hover')) return;
|
||||
this.close();
|
||||
}else{
|
||||
this.open();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Destroys the dropdown.
|
||||
* @function
|
||||
*/
|
||||
destroy() {
|
||||
Dropdown.prototype.destroy = function(){
|
||||
this.$element.off('.zf.trigger').hide();
|
||||
this.$anchor.off('.zf.dropdown');
|
||||
|
||||
Foundation.unregisterPlugin(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Dropdown.defaults = {
|
||||
/**
|
||||
* Amount of time to delay opening a submenu on hover event.
|
||||
* @option
|
||||
* @example 250
|
||||
*/
|
||||
hoverDelay: 250,
|
||||
/**
|
||||
* Allow submenus to open on hover events
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
hover: false,
|
||||
/**
|
||||
* Don't close dropdown when hovering over dropdown pane
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
hoverPane: false,
|
||||
/**
|
||||
* Number of pixels between the dropdown pane and the triggering element on open.
|
||||
* @option
|
||||
* @example 1
|
||||
*/
|
||||
vOffset: 1,
|
||||
/**
|
||||
* Number of pixels between the dropdown pane and the triggering element on open.
|
||||
* @option
|
||||
* @example 1
|
||||
*/
|
||||
hOffset: 1,
|
||||
/**
|
||||
* Class applied to adjust open position. JS will test and fill this in.
|
||||
* @option
|
||||
* @example 'top'
|
||||
*/
|
||||
positionClass: '',
|
||||
/**
|
||||
* Allow the plugin to trap focus to the dropdown pane if opened with keyboard commands.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
trapFocus: false,
|
||||
/**
|
||||
* Allow the plugin to set focus to the first focusable element within the pane, regardless of method of opening.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
autoFocus: false,
|
||||
/**
|
||||
* Allows a click on the body to close the dropdown.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
closeOnClick: false
|
||||
}
|
||||
|
||||
// Window exports
|
||||
Foundation.plugin(Dropdown, 'Dropdown');
|
||||
|
||||
}(jQuery);
|
||||
Foundation.plugin(Dropdown, 'Dropdown');
|
||||
}(jQuery, window.Foundation);
|
||||
|
382
app/vendor/foundation/js/foundation.dropdownMenu.js
vendored
382
app/vendor/foundation/js/foundation.dropdownMenu.js
vendored
@ -1,7 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
|
||||
/**
|
||||
* DropdownMenu module.
|
||||
* @module foundation.dropdown-menu
|
||||
@ -9,8 +5,9 @@
|
||||
* @requires foundation.util.box
|
||||
* @requires foundation.util.nest
|
||||
*/
|
||||
!function($, Foundation){
|
||||
'use strict';
|
||||
|
||||
class DropdownMenu {
|
||||
/**
|
||||
* Creates a new instance of DropdownMenu.
|
||||
* @class
|
||||
@ -18,7 +15,7 @@ class DropdownMenu {
|
||||
* @param {jQuery} element - jQuery object to make into a dropdown menu.
|
||||
* @param {Object} options - Overrides to the default plugin settings.
|
||||
*/
|
||||
constructor(element, options) {
|
||||
function DropdownMenu(element, options){
|
||||
this.$element = element;
|
||||
this.options = $.extend({}, DropdownMenu.defaults, this.$element.data(), options);
|
||||
|
||||
@ -37,101 +34,161 @@ class DropdownMenu {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Default settings for plugin
|
||||
*/
|
||||
DropdownMenu.defaults = {
|
||||
/**
|
||||
* Disallows hover events from opening submenus
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
disableHover: false,
|
||||
/**
|
||||
* Allow a submenu to automatically close on a mouseleave event, if not clicked open.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
autoclose: true,
|
||||
/**
|
||||
* Amount of time to delay opening a submenu on hover event.
|
||||
* @option
|
||||
* @example 50
|
||||
*/
|
||||
hoverDelay: 50,
|
||||
/**
|
||||
* Allow a submenu to open/remain open on parent click event. Allows cursor to move away from menu.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
clickOpen: false,
|
||||
/**
|
||||
* Amount of time to delay closing a submenu on a mouseleave event.
|
||||
* @option
|
||||
* @example 500
|
||||
*/
|
||||
|
||||
closingTime: 500,
|
||||
/**
|
||||
* Position of the menu relative to what direction the submenus should open. Handled by JS.
|
||||
* @option
|
||||
* @example 'left'
|
||||
*/
|
||||
alignment: 'left',
|
||||
/**
|
||||
* Allow clicks on the body to close any open submenus.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
closeOnClick: true,
|
||||
/**
|
||||
* Class applied to vertical oriented menus, Foundation default is `vertical`. Update this if using your own class.
|
||||
* @option
|
||||
* @example 'vertical'
|
||||
*/
|
||||
verticalClass: 'vertical',
|
||||
/**
|
||||
* Class applied to right-side oriented menus, Foundation default is `align-right`. Update this if using your own class.
|
||||
* @option
|
||||
* @example 'align-right'
|
||||
*/
|
||||
rightClass: 'align-right',
|
||||
/**
|
||||
* Boolean to force overide the clicking of links to perform default action, on second touch event for mobile.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
forceFollow: true
|
||||
};
|
||||
/**
|
||||
* Initializes the plugin, and calls _prepareMenu
|
||||
* @private
|
||||
* @function
|
||||
*/
|
||||
_init() {
|
||||
DropdownMenu.prototype._init = function(){
|
||||
var subs = this.$element.find('li.is-dropdown-submenu-parent');
|
||||
this.$element.children('.is-dropdown-submenu-parent').children('.is-dropdown-submenu').addClass('first-sub');
|
||||
|
||||
this.$menuItems = this.$element.find('[role="menuitem"]');
|
||||
this.$tabs = this.$element.children('[role="menuitem"]');
|
||||
this.isVert = this.$element.hasClass(this.options.verticalClass);
|
||||
this.$tabs.find('ul.is-dropdown-submenu').addClass(this.options.verticalClass);
|
||||
|
||||
if (this.$element.hasClass(this.options.rightClass) || this.options.alignment === 'right' || Foundation.rtl() || this.$element.parents('.top-bar-right').is('*')) {
|
||||
if(this.$element.hasClass(this.options.rightClass) || this.options.alignment === 'right'){
|
||||
this.options.alignment = 'right';
|
||||
subs.addClass('opens-left');
|
||||
} else {
|
||||
subs.addClass('opens-right');
|
||||
subs.addClass('is-left-arrow opens-left');
|
||||
}else{
|
||||
subs.addClass('is-right-arrow opens-right');
|
||||
}
|
||||
if(!this.isVert){
|
||||
this.$tabs.filter('.is-dropdown-submenu-parent').removeClass('is-right-arrow is-left-arrow opens-right opens-left')
|
||||
.addClass('is-down-arrow');
|
||||
}
|
||||
this.changed = false;
|
||||
this._events();
|
||||
};
|
||||
|
||||
_isVertical() {
|
||||
return this.$tabs.css('display') === 'block';
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds event listeners to elements within the menu
|
||||
* @private
|
||||
* @function
|
||||
*/
|
||||
_events() {
|
||||
DropdownMenu.prototype._events = function(){
|
||||
var _this = this,
|
||||
hasTouch = 'ontouchstart' in window || (typeof window.ontouchstart !== 'undefined'),
|
||||
parClass = 'is-dropdown-submenu-parent';
|
||||
parClass = 'is-dropdown-submenu-parent',
|
||||
delay;
|
||||
|
||||
// used for onClick and in the keyboard handlers
|
||||
var handleClickFn = function(e) {
|
||||
var $elem = $(e.target).parentsUntil('ul', `.${parClass}`),
|
||||
hasSub = $elem.hasClass(parClass),
|
||||
hasClicked = $elem.attr('data-is-click') === 'true',
|
||||
$sub = $elem.children('.is-dropdown-submenu');
|
||||
if(this.options.clickOpen || hasTouch){
|
||||
this.$menuItems.on('click.zf.dropdownmenu touchstart.zf.dropdownmenu', function(e){
|
||||
var $elem = $(e.target).parentsUntil('ul', '.' + parClass),
|
||||
hasSub = $elem.hasClass(parClass),
|
||||
hasClicked = $elem.attr('data-is-click') === 'true',
|
||||
$sub = $elem.children('.is-dropdown-submenu');
|
||||
|
||||
if (hasSub) {
|
||||
if (hasClicked) {
|
||||
if (!_this.options.closeOnClick || (!_this.options.clickOpen && !hasTouch) || (_this.options.forceFollow && hasTouch)) { return; }
|
||||
else {
|
||||
e.stopImmediatePropagation();
|
||||
if(hasSub){
|
||||
if(hasClicked){
|
||||
if(!_this.options.closeOnClick || (!_this.options.clickOpen && !hasTouch) || (_this.options.forceFollow && hasTouch)){ return; }
|
||||
else{
|
||||
e.stopImmediatePropagation();
|
||||
e.preventDefault();
|
||||
_this._hide($elem);
|
||||
}
|
||||
}else{
|
||||
e.preventDefault();
|
||||
_this._hide($elem);
|
||||
e.stopImmediatePropagation();
|
||||
_this._show($elem.children('.is-dropdown-submenu'));
|
||||
$elem.add($elem.parentsUntil(_this.$element, '.' + parClass)).attr('data-is-click', true);
|
||||
}
|
||||
} else {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
_this._show($sub);
|
||||
$elem.add($elem.parentsUntil(_this.$element, `.${parClass}`)).attr('data-is-click', true);
|
||||
}
|
||||
} else {
|
||||
if(_this.options.closeOnClickInside){
|
||||
_this._hide($elem);
|
||||
}
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
if (this.options.clickOpen || hasTouch) {
|
||||
this.$menuItems.on('click.zf.dropdownmenu touchstart.zf.dropdownmenu', handleClickFn);
|
||||
}else{ return; }
|
||||
});
|
||||
}
|
||||
|
||||
if (!this.options.disableHover) {
|
||||
this.$menuItems.on('mouseenter.zf.dropdownmenu', function(e) {
|
||||
if(!this.options.disableHover){
|
||||
this.$menuItems.on('mouseenter.zf.dropdownmenu', function(e){
|
||||
e.stopImmediatePropagation();
|
||||
var $elem = $(this),
|
||||
hasSub = $elem.hasClass(parClass);
|
||||
|
||||
if (hasSub) {
|
||||
clearTimeout(_this.delay);
|
||||
_this.delay = setTimeout(function() {
|
||||
if(hasSub){
|
||||
clearTimeout(delay);
|
||||
delay = setTimeout(function(){
|
||||
_this._show($elem.children('.is-dropdown-submenu'));
|
||||
}, _this.options.hoverDelay);
|
||||
}
|
||||
}).on('mouseleave.zf.dropdownmenu', function(e) {
|
||||
}).on('mouseleave.zf.dropdownmenu', function(e){
|
||||
var $elem = $(this),
|
||||
hasSub = $elem.hasClass(parClass);
|
||||
if (hasSub && _this.options.autoclose) {
|
||||
if ($elem.attr('data-is-click') === 'true' && _this.options.clickOpen) { return false; }
|
||||
if(hasSub && _this.options.autoclose){
|
||||
if($elem.attr('data-is-click') === 'true' && _this.options.clickOpen){ return false; }
|
||||
|
||||
clearTimeout(_this.delay);
|
||||
_this.delay = setTimeout(function() {
|
||||
// clearTimeout(delay);
|
||||
delay = setTimeout(function(){
|
||||
_this._hide($elem);
|
||||
}, _this.options.closingTime);
|
||||
}
|
||||
});
|
||||
}
|
||||
this.$menuItems.on('keydown.zf.dropdownmenu', function(e) {
|
||||
this.$menuItems.on('keydown.zf.dropdownmenu', function(e){
|
||||
var $element = $(e.target).parentsUntil('ul', '[role="menuitem"]'),
|
||||
isTab = _this.$tabs.index($element) > -1,
|
||||
$elements = isTab ? _this.$tabs : $element.siblings('li').add($element),
|
||||
@ -147,26 +204,20 @@ class DropdownMenu {
|
||||
});
|
||||
|
||||
var nextSibling = function() {
|
||||
if (!$element.is(':last-child')) {
|
||||
$nextElement.children('a:first').focus();
|
||||
e.preventDefault();
|
||||
}
|
||||
if (!$element.is(':last-child')) $nextElement.children('a:first').focus();
|
||||
}, prevSibling = function() {
|
||||
$prevElement.children('a:first').focus();
|
||||
e.preventDefault();
|
||||
}, openSub = function() {
|
||||
var $sub = $element.children('ul.is-dropdown-submenu');
|
||||
if ($sub.length) {
|
||||
if($sub.length){
|
||||
_this._show($sub);
|
||||
$element.find('li > a:first').focus();
|
||||
e.preventDefault();
|
||||
} else { return; }
|
||||
}else{ return; }
|
||||
}, closeSub = function() {
|
||||
//if ($element.is(':first-child')) {
|
||||
var close = $element.parent('ul').parent('li');
|
||||
close.children('a:first').focus();
|
||||
_this._hide(close);
|
||||
e.preventDefault();
|
||||
close.children('a:first').focus();
|
||||
_this._hide(close);
|
||||
//}
|
||||
};
|
||||
var functions = {
|
||||
@ -174,87 +225,76 @@ class DropdownMenu {
|
||||
close: function() {
|
||||
_this._hide(_this.$element);
|
||||
_this.$menuItems.find('a:first').focus(); // focus to first element
|
||||
e.preventDefault();
|
||||
},
|
||||
handled: function() {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
};
|
||||
|
||||
if (isTab) {
|
||||
if (_this._isVertical()) { // vertical menu
|
||||
if (Foundation.rtl()) { // right aligned
|
||||
$.extend(functions, {
|
||||
down: nextSibling,
|
||||
up: prevSibling,
|
||||
next: closeSub,
|
||||
previous: openSub
|
||||
});
|
||||
} else { // left aligned
|
||||
if (_this.vertical) { // vertical menu
|
||||
if (_this.options.alignment === 'left') { // left aligned
|
||||
$.extend(functions, {
|
||||
down: nextSibling,
|
||||
up: prevSibling,
|
||||
next: openSub,
|
||||
previous: closeSub
|
||||
});
|
||||
} else { // right aligned
|
||||
$.extend(functions, {
|
||||
down: nextSibling,
|
||||
up: prevSibling,
|
||||
next: closeSub,
|
||||
previous: openSub
|
||||
});
|
||||
}
|
||||
} else { // horizontal menu
|
||||
if (Foundation.rtl()) { // right aligned
|
||||
$.extend(functions, {
|
||||
next: prevSibling,
|
||||
previous: nextSibling,
|
||||
down: openSub,
|
||||
up: closeSub
|
||||
});
|
||||
} else { // left aligned
|
||||
$.extend(functions, {
|
||||
next: nextSibling,
|
||||
previous: prevSibling,
|
||||
down: openSub,
|
||||
up: closeSub
|
||||
});
|
||||
}
|
||||
$.extend(functions, {
|
||||
next: nextSibling,
|
||||
previous: prevSibling,
|
||||
down: openSub,
|
||||
up: closeSub
|
||||
});
|
||||
}
|
||||
} else { // not tabs -> one sub
|
||||
if (Foundation.rtl()) { // right aligned
|
||||
$.extend(functions, {
|
||||
next: closeSub,
|
||||
previous: openSub,
|
||||
down: nextSibling,
|
||||
up: prevSibling
|
||||
});
|
||||
} else { // left aligned
|
||||
if (_this.options.alignment === 'left') { // left aligned
|
||||
$.extend(functions, {
|
||||
next: openSub,
|
||||
previous: closeSub,
|
||||
down: nextSibling,
|
||||
up: prevSibling
|
||||
});
|
||||
} else { // right aligned
|
||||
$.extend(functions, {
|
||||
next: closeSub,
|
||||
previous: openSub,
|
||||
down: nextSibling,
|
||||
up: prevSibling
|
||||
});
|
||||
}
|
||||
}
|
||||
Foundation.Keyboard.handleKey(e, 'DropdownMenu', functions);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Adds an event handler to the body to close any dropdowns on a click.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_addBodyHandler() {
|
||||
DropdownMenu.prototype._addBodyHandler = function(){
|
||||
var $body = $(document.body),
|
||||
_this = this;
|
||||
$body.off('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu')
|
||||
.on('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu', function(e) {
|
||||
.on('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu', function(e){
|
||||
var $link = _this.$element.find(e.target);
|
||||
if ($link.length) { return; }
|
||||
if($link.length){ return; }
|
||||
|
||||
_this._hide();
|
||||
$body.off('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu');
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Opens a dropdown pane, and checks for collisions first.
|
||||
* @param {jQuery} $sub - ul element that is a submenu to show
|
||||
@ -262,35 +302,34 @@ class DropdownMenu {
|
||||
* @private
|
||||
* @fires DropdownMenu#show
|
||||
*/
|
||||
_show($sub) {
|
||||
var idx = this.$tabs.index(this.$tabs.filter(function(i, el) {
|
||||
DropdownMenu.prototype._show = function($sub){
|
||||
var idx = this.$tabs.index(this.$tabs.filter(function(i, el){
|
||||
return $(el).find($sub).length > 0;
|
||||
}));
|
||||
var $sibs = $sub.parent('li.is-dropdown-submenu-parent').siblings('li.is-dropdown-submenu-parent');
|
||||
this._hide($sibs, idx);
|
||||
$sub.css('visibility', 'hidden').addClass('js-dropdown-active').attr({'aria-hidden': false})
|
||||
.parent('li.is-dropdown-submenu-parent').addClass('is-active')
|
||||
.attr({'aria-expanded': true});
|
||||
.attr({'aria-selected': true, 'aria-expanded': true});
|
||||
var clear = Foundation.Box.ImNotTouchingYou($sub, null, true);
|
||||
if (!clear) {
|
||||
if(!clear){
|
||||
var oldClass = this.options.alignment === 'left' ? '-right' : '-left',
|
||||
$parentLi = $sub.parent('.is-dropdown-submenu-parent');
|
||||
$parentLi.removeClass(`opens${oldClass}`).addClass(`opens-${this.options.alignment}`);
|
||||
$parentLi.removeClass('opens' + oldClass).addClass('opens-' + this.options.alignment);
|
||||
clear = Foundation.Box.ImNotTouchingYou($sub, null, true);
|
||||
if (!clear) {
|
||||
$parentLi.removeClass(`opens-${this.options.alignment}`).addClass('opens-inner');
|
||||
if(!clear){
|
||||
$parentLi.removeClass('opens-' + this.options.alignment).addClass('opens-inner');
|
||||
}
|
||||
this.changed = true;
|
||||
}
|
||||
$sub.css('visibility', '');
|
||||
if (this.options.closeOnClick) { this._addBodyHandler(); }
|
||||
if(this.options.closeOnClick){ this._addBodyHandler(); }
|
||||
/**
|
||||
* Fires when the new dropdown pane is visible.
|
||||
* @event DropdownMenu#show
|
||||
*/
|
||||
this.$element.trigger('show.zf.dropdownmenu', [$sub]);
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Hides a single, currently open dropdown pane, if passed a parameter, otherwise, hides everything.
|
||||
* @function
|
||||
@ -298,22 +337,23 @@ class DropdownMenu {
|
||||
* @param {Number} idx - index of the $tabs collection to hide
|
||||
* @private
|
||||
*/
|
||||
_hide($elem, idx) {
|
||||
DropdownMenu.prototype._hide = function($elem, idx){
|
||||
var $toClose;
|
||||
if ($elem && $elem.length) {
|
||||
if($elem && $elem.length){
|
||||
$toClose = $elem;
|
||||
} else if (idx !== undefined) {
|
||||
$toClose = this.$tabs.not(function(i, el) {
|
||||
}else if(idx !== undefined){
|
||||
$toClose = this.$tabs.not(function(i, el){
|
||||
return i === idx;
|
||||
});
|
||||
}
|
||||
else {
|
||||
else{
|
||||
$toClose = this.$element;
|
||||
}
|
||||
var somethingToClose = $toClose.hasClass('is-active') || $toClose.find('.is-active').length > 0;
|
||||
|
||||
if (somethingToClose) {
|
||||
if(somethingToClose){
|
||||
$toClose.find('li.is-active').add($toClose).attr({
|
||||
'aria-selected': false,
|
||||
'aria-expanded': false,
|
||||
'data-is-click': false
|
||||
}).removeClass('is-active');
|
||||
@ -322,11 +362,11 @@ class DropdownMenu {
|
||||
'aria-hidden': true
|
||||
}).removeClass('js-dropdown-active');
|
||||
|
||||
if (this.changed || $toClose.find('opens-inner').length) {
|
||||
if(this.changed || $toClose.find('opens-inner').length){
|
||||
var oldClass = this.options.alignment === 'left' ? 'right' : 'left';
|
||||
$toClose.find('li.is-dropdown-submenu-parent').add($toClose)
|
||||
.removeClass(`opens-inner opens-${this.options.alignment}`)
|
||||
.addClass(`opens-${oldClass}`);
|
||||
.removeClass('opens-inner opens-' + this.options.alignment)
|
||||
.addClass('opens-' + oldClass);
|
||||
this.changed = false;
|
||||
}
|
||||
/**
|
||||
@ -335,95 +375,17 @@ class DropdownMenu {
|
||||
*/
|
||||
this.$element.trigger('hide.zf.dropdownmenu', [$toClose]);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Destroys the plugin.
|
||||
* @function
|
||||
*/
|
||||
destroy() {
|
||||
DropdownMenu.prototype.destroy = function(){
|
||||
this.$menuItems.off('.zf.dropdownmenu').removeAttr('data-is-click')
|
||||
.removeClass('is-right-arrow is-left-arrow is-down-arrow opens-right opens-left opens-inner');
|
||||
$(document.body).off('.zf.dropdownmenu');
|
||||
Foundation.Nest.Burn(this.$element, 'dropdown');
|
||||
Foundation.unregisterPlugin(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Default settings for plugin
|
||||
*/
|
||||
DropdownMenu.defaults = {
|
||||
/**
|
||||
* Disallows hover events from opening submenus
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
disableHover: false,
|
||||
/**
|
||||
* Allow a submenu to automatically close on a mouseleave event, if not clicked open.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
autoclose: true,
|
||||
/**
|
||||
* Amount of time to delay opening a submenu on hover event.
|
||||
* @option
|
||||
* @example 50
|
||||
*/
|
||||
hoverDelay: 50,
|
||||
/**
|
||||
* Allow a submenu to open/remain open on parent click event. Allows cursor to move away from menu.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
clickOpen: false,
|
||||
/**
|
||||
* Amount of time to delay closing a submenu on a mouseleave event.
|
||||
* @option
|
||||
* @example 500
|
||||
*/
|
||||
|
||||
closingTime: 500,
|
||||
/**
|
||||
* Position of the menu relative to what direction the submenus should open. Handled by JS.
|
||||
* @option
|
||||
* @example 'left'
|
||||
*/
|
||||
alignment: 'left',
|
||||
/**
|
||||
* Allow clicks on the body to close any open submenus.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
closeOnClick: true,
|
||||
/**
|
||||
* Allow clicks on leaf anchor links to close any open submenus.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
closeOnClickInside: true,
|
||||
/**
|
||||
* Class applied to vertical oriented menus, Foundation default is `vertical`. Update this if using your own class.
|
||||
* @option
|
||||
* @example 'vertical'
|
||||
*/
|
||||
verticalClass: 'vertical',
|
||||
/**
|
||||
* Class applied to right-side oriented menus, Foundation default is `align-right`. Update this if using your own class.
|
||||
* @option
|
||||
* @example 'align-right'
|
||||
*/
|
||||
rightClass: 'align-right',
|
||||
/**
|
||||
* Boolean to force overide the clicking of links to perform default action, on second touch event for mobile.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
forceFollow: true
|
||||
};
|
||||
|
||||
// Window exports
|
||||
Foundation.plugin(DropdownMenu, 'DropdownMenu');
|
||||
|
||||
}(jQuery);
|
||||
Foundation.plugin(DropdownMenu, 'DropdownMenu');
|
||||
}(jQuery, window.Foundation);
|
||||
|
178
app/vendor/foundation/js/foundation.equalizer.js
vendored
178
app/vendor/foundation/js/foundation.equalizer.js
vendored
@ -1,15 +1,6 @@
|
||||
'use strict';
|
||||
!function(Foundation, $) {
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
|
||||
/**
|
||||
* Equalizer module.
|
||||
* @module foundation.equalizer
|
||||
* @requires foundation.util.mediaQuery
|
||||
* @requires foundation.util.timerAndImageLoader if equalizer contains images
|
||||
*/
|
||||
|
||||
class Equalizer {
|
||||
/**
|
||||
* Creates a new instance of Equalizer.
|
||||
* @class
|
||||
@ -17,7 +8,7 @@ class Equalizer {
|
||||
* @param {Object} element - jQuery object to add the trigger to.
|
||||
* @param {Object} options - Overrides to the default plugin settings.
|
||||
*/
|
||||
constructor(element, options){
|
||||
function Equalizer(element, options){
|
||||
this.$element = element;
|
||||
this.options = $.extend({}, Equalizer.defaults, this.$element.data(), options);
|
||||
|
||||
@ -26,13 +17,37 @@ class Equalizer {
|
||||
Foundation.registerPlugin(this, 'Equalizer');
|
||||
}
|
||||
|
||||
/**
|
||||
* Default settings for plugin
|
||||
*/
|
||||
Equalizer.defaults = {
|
||||
/**
|
||||
* Enable height equalization when stacked on smaller screens.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
equalizeOnStack: true,
|
||||
/**
|
||||
* Enable height equalization row by row.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
equalizeByRow: false,
|
||||
/**
|
||||
* String representing the minimum breakpoint size the plugin should equalize heights on.
|
||||
* @option
|
||||
* @example 'medium'
|
||||
*/
|
||||
equalizeOn: ''
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes the Equalizer plugin and calls functions to get equalizer functioning on load.
|
||||
* @private
|
||||
*/
|
||||
_init() {
|
||||
Equalizer.prototype._init = function(){
|
||||
var eqId = this.$element.attr('data-equalizer') || '';
|
||||
var $watched = this.$element.find(`[data-equalizer-watch="${eqId}"]`);
|
||||
var $watched = this.$element.find('[data-equalizer-watch="' + eqId + '"]');
|
||||
|
||||
this.$watched = $watched.length ? $watched : this.$element.find('[data-equalizer-watch]');
|
||||
this.$element.attr('data-resize', (eqId || Foundation.GetYoDigits(6, 'eq')));
|
||||
@ -40,10 +55,6 @@ class Equalizer {
|
||||
this.hasNested = this.$element.find('[data-equalizer]').length > 0;
|
||||
this.isNested = this.$element.parentsUntil(document.body, '[data-equalizer]').length > 0;
|
||||
this.isOn = false;
|
||||
this._bindHandler = {
|
||||
onResizeMeBound: this._onResizeMe.bind(this),
|
||||
onPostEqualizedBound: this._onPostEqualized.bind(this)
|
||||
};
|
||||
|
||||
var imgs = this.$element.find('img');
|
||||
var tooSmall;
|
||||
@ -60,56 +71,37 @@ class Equalizer {
|
||||
this._reflow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Removes event listeners if the breakpoint is too small.
|
||||
* @private
|
||||
*/
|
||||
_pauseEvents() {
|
||||
Equalizer.prototype._pauseEvents = function(){
|
||||
this.isOn = false;
|
||||
this.$element.off({
|
||||
'.zf.equalizer': this._bindHandler.onPostEqualizedBound,
|
||||
'resizeme.zf.trigger': this._bindHandler.onResizeMeBound
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function to handle $elements resizeme.zf.trigger, with bound this on _bindHandler.onResizeMeBound
|
||||
* @private
|
||||
*/
|
||||
_onResizeMe(e) {
|
||||
this._reflow();
|
||||
}
|
||||
|
||||
/**
|
||||
* function to handle $elements postequalized.zf.equalizer, with bound this on _bindHandler.onPostEqualizedBound
|
||||
* @private
|
||||
*/
|
||||
_onPostEqualized(e) {
|
||||
if(e.target !== this.$element[0]){ this._reflow(); }
|
||||
}
|
||||
|
||||
this.$element.off('.zf.equalizer resizeme.zf.trigger');
|
||||
};
|
||||
/**
|
||||
* Initializes events for Equalizer.
|
||||
* @private
|
||||
*/
|
||||
_events() {
|
||||
Equalizer.prototype._events = function(){
|
||||
var _this = this;
|
||||
this._pauseEvents();
|
||||
if(this.hasNested){
|
||||
this.$element.on('postequalized.zf.equalizer', this._bindHandler.onPostEqualizedBound);
|
||||
this.$element.on('postequalized.zf.equalizer', function(e){
|
||||
if(e.target !== _this.$element[0]){ _this._reflow(); }
|
||||
});
|
||||
}else{
|
||||
this.$element.on('resizeme.zf.trigger', this._bindHandler.onResizeMeBound);
|
||||
this.$element.on('resizeme.zf.trigger', this._reflow.bind(this));
|
||||
}
|
||||
this.isOn = true;
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Checks the current breakpoint to the minimum required size.
|
||||
* @private
|
||||
*/
|
||||
_checkMQ() {
|
||||
Equalizer.prototype._checkMQ = function(){
|
||||
var tooSmall = !Foundation.MediaQuery.atLeast(this.options.equalizeOn);
|
||||
if(tooSmall){
|
||||
if(this.isOn){
|
||||
@ -123,20 +115,18 @@ class Equalizer {
|
||||
}
|
||||
return tooSmall;
|
||||
}
|
||||
|
||||
/**
|
||||
* A noop version for the plugin
|
||||
* @private
|
||||
*/
|
||||
_killswitch() {
|
||||
Equalizer.prototype._killswitch = function(){
|
||||
return;
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Calls necessary functions to update Equalizer upon DOM change
|
||||
* @private
|
||||
*/
|
||||
_reflow() {
|
||||
Equalizer.prototype._reflow = function(){
|
||||
if(!this.options.equalizeOnStack){
|
||||
if(this._isStacked()){
|
||||
this.$watched.css('height', 'auto');
|
||||
@ -148,37 +138,34 @@ class Equalizer {
|
||||
}else{
|
||||
this.getHeights(this.applyHeight.bind(this));
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Manually determines if the first 2 elements are *NOT* stacked.
|
||||
* @private
|
||||
*/
|
||||
_isStacked() {
|
||||
return this.$watched[0].getBoundingClientRect().top !== this.$watched[1].getBoundingClientRect().top;
|
||||
}
|
||||
|
||||
Equalizer.prototype._isStacked = function(){
|
||||
return this.$watched[0].offsetTop !== this.$watched[1].offsetTop;
|
||||
};
|
||||
/**
|
||||
* Finds the outer heights of children contained within an Equalizer parent and returns them in an array
|
||||
* @param {Function} cb - A non-optional callback to return the heights array to.
|
||||
* @returns {Array} heights - An array of heights of children within Equalizer container
|
||||
*/
|
||||
getHeights(cb) {
|
||||
Equalizer.prototype.getHeights = function(cb){
|
||||
var heights = [];
|
||||
for(var i = 0, len = this.$watched.length; i < len; i++){
|
||||
this.$watched[i].style.height = 'auto';
|
||||
heights.push(this.$watched[i].offsetHeight);
|
||||
}
|
||||
cb(heights);
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Finds the outer heights of children contained within an Equalizer parent and returns them in an array
|
||||
* @param {Function} cb - A non-optional callback to return the heights array to.
|
||||
* @returns {Array} groups - An array of heights of children within Equalizer container grouped by row with element,height and max as last child
|
||||
*/
|
||||
getHeightsByRow(cb) {
|
||||
var lastElTopOffset = (this.$watched.length ? this.$watched.first().offset().top : 0),
|
||||
Equalizer.prototype.getHeightsByRow = function(cb) {
|
||||
var lastElTopOffset = this.$watched.first().offset().top,
|
||||
groups = [],
|
||||
group = 0;
|
||||
//group by Row
|
||||
@ -191,25 +178,24 @@ class Equalizer {
|
||||
group++;
|
||||
groups[group] = [];
|
||||
lastElTopOffset=elOffsetTop;
|
||||
}
|
||||
};
|
||||
groups[group].push([this.$watched[i],this.$watched[i].offsetHeight]);
|
||||
}
|
||||
|
||||
for (var j = 0, ln = groups.length; j < ln; j++) {
|
||||
var heights = $(groups[j]).map(function(){ return this[1]; }).get();
|
||||
for (var i = 0, len = groups.length; i < len; i++) {
|
||||
var heights = $(groups[i]).map(function () { return this[1]}).get();
|
||||
var max = Math.max.apply(null, heights);
|
||||
groups[j].push(max);
|
||||
groups[i].push(max);
|
||||
}
|
||||
cb(groups);
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Changes the CSS height property of each child in an Equalizer parent to match the tallest
|
||||
* @param {array} heights - An array of heights of children within Equalizer container
|
||||
* @fires Equalizer#preequalized
|
||||
* @fires Equalizer#postequalized
|
||||
*/
|
||||
applyHeight(heights) {
|
||||
Equalizer.prototype.applyHeight = function(heights){
|
||||
var max = Math.max.apply(null, heights);
|
||||
/**
|
||||
* Fires before the heights are applied
|
||||
@ -224,8 +210,7 @@ class Equalizer {
|
||||
* @event Equalizer#postequalized
|
||||
*/
|
||||
this.$element.trigger('postequalized.zf.equalizer');
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Changes the CSS height property of each child in an Equalizer parent to match the tallest by row
|
||||
* @param {array} groups - An array of heights of children within Equalizer container grouped by row with element,height and max as last child
|
||||
@ -234,7 +219,7 @@ class Equalizer {
|
||||
* @fires Equalizer#postequalizedRow
|
||||
* @fires Equalizer#postequalized
|
||||
*/
|
||||
applyHeightByRow(groups) {
|
||||
Equalizer.prototype.applyHeightByRow = function(groups){
|
||||
/**
|
||||
* Fires before the heights are applied
|
||||
*/
|
||||
@ -245,7 +230,7 @@ class Equalizer {
|
||||
if (groupsILength<=2) {
|
||||
$(groups[i][0][0]).css({'height':'auto'});
|
||||
continue;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Fires before the heights per row are applied
|
||||
* @event Equalizer#preequalizedRow
|
||||
@ -264,45 +249,26 @@ class Equalizer {
|
||||
* Fires when the heights have been applied
|
||||
*/
|
||||
this.$element.trigger('postequalized.zf.equalizer');
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Destroys an instance of Equalizer.
|
||||
* @function
|
||||
*/
|
||||
destroy() {
|
||||
Equalizer.prototype.destroy = function(){
|
||||
this._pauseEvents();
|
||||
this.$watched.css('height', 'auto');
|
||||
|
||||
Foundation.unregisterPlugin(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Default settings for plugin
|
||||
*/
|
||||
Equalizer.defaults = {
|
||||
/**
|
||||
* Enable height equalization when stacked on smaller screens.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
equalizeOnStack: false,
|
||||
/**
|
||||
* Enable height equalization row by row.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
equalizeByRow: false,
|
||||
/**
|
||||
* String representing the minimum breakpoint size the plugin should equalize heights on.
|
||||
* @option
|
||||
* @example 'medium'
|
||||
*/
|
||||
equalizeOn: ''
|
||||
};
|
||||
Foundation.plugin(Equalizer, 'Equalizer');
|
||||
|
||||
// Window exports
|
||||
Foundation.plugin(Equalizer, 'Equalizer');
|
||||
// Exports for AMD/Browserify
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined')
|
||||
module.exports = Equalizer;
|
||||
if (typeof define === 'function')
|
||||
define(['foundation'], function() {
|
||||
return Equalizer;
|
||||
});
|
||||
|
||||
}(jQuery);
|
||||
}(Foundation, jQuery);
|
||||
|
144
app/vendor/foundation/js/foundation.interchange.js
vendored
144
app/vendor/foundation/js/foundation.interchange.js
vendored
@ -1,15 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
|
||||
/**
|
||||
* Interchange module.
|
||||
* @module foundation.interchange
|
||||
* @requires foundation.util.mediaQuery
|
||||
* @requires foundation.util.timerAndImageLoader
|
||||
*/
|
||||
!function(Foundation, $) {
|
||||
'use strict';
|
||||
|
||||
class Interchange {
|
||||
/**
|
||||
* Creates a new instance of Interchange.
|
||||
* @class
|
||||
@ -17,7 +14,7 @@ class Interchange {
|
||||
* @param {Object} element - jQuery object to add the trigger to.
|
||||
* @param {Object} options - Overrides to the default plugin settings.
|
||||
*/
|
||||
constructor(element, options) {
|
||||
function Interchange(element, options) {
|
||||
this.$element = element;
|
||||
this.options = $.extend({}, Interchange.defaults, options);
|
||||
this.rules = [];
|
||||
@ -29,63 +26,76 @@ class Interchange {
|
||||
Foundation.registerPlugin(this, 'Interchange');
|
||||
}
|
||||
|
||||
/**
|
||||
* Default settings for plugin
|
||||
*/
|
||||
Interchange.defaults = {
|
||||
/**
|
||||
* Rules to be applied to Interchange elements. Set with the `data-interchange` array notation.
|
||||
* @option
|
||||
*/
|
||||
rules: null
|
||||
};
|
||||
|
||||
Interchange.SPECIAL_QUERIES = {
|
||||
'landscape': 'screen and (orientation: landscape)',
|
||||
'portrait': '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)'
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes the Interchange plugin and calls functions to get interchange functioning on load.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_init() {
|
||||
Interchange.prototype._init = function() {
|
||||
this._addBreakpoints();
|
||||
this._generateRules();
|
||||
this._reflow();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes events for Interchange.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_events() {
|
||||
Interchange.prototype._events = function() {
|
||||
$(window).on('resize.zf.interchange', Foundation.util.throttle(this._reflow.bind(this), 50));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Calls necessary functions to update Interchange upon DOM change
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_reflow() {
|
||||
Interchange.prototype._reflow = function() {
|
||||
var match;
|
||||
|
||||
// Iterate through each rule, but only save the last match
|
||||
for (var i in this.rules) {
|
||||
if(this.rules.hasOwnProperty(i)) {
|
||||
var rule = this.rules[i];
|
||||
var rule = this.rules[i];
|
||||
|
||||
if (window.matchMedia(rule.query).matches) {
|
||||
match = rule;
|
||||
}
|
||||
if (window.matchMedia(rule.query).matches) {
|
||||
match = rule;
|
||||
}
|
||||
}
|
||||
|
||||
if (match) {
|
||||
this.replace(match.path);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the Foundation breakpoints and adds them to the Interchange.SPECIAL_QUERIES object.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_addBreakpoints() {
|
||||
Interchange.prototype._addBreakpoints = function() {
|
||||
for (var i in Foundation.MediaQuery.queries) {
|
||||
if (Foundation.MediaQuery.queries.hasOwnProperty(i)) {
|
||||
var query = Foundation.MediaQuery.queries[i];
|
||||
Interchange.SPECIAL_QUERIES[query.name] = query.value;
|
||||
}
|
||||
var query = Foundation.MediaQuery.queries[i];
|
||||
Interchange.SPECIAL_QUERIES[query.name] = query.value;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks the Interchange element for the provided media query + content pairings
|
||||
@ -94,7 +104,7 @@ class Interchange {
|
||||
* @param {Object} element - jQuery object that is an Interchange instance
|
||||
* @returns {Array} scenarios - Array of objects that have 'mq' and 'path' keys with corresponding keys
|
||||
*/
|
||||
_generateRules(element) {
|
||||
Interchange.prototype._generateRules = function() {
|
||||
var rulesList = [];
|
||||
var rules;
|
||||
|
||||
@ -106,24 +116,22 @@ class Interchange {
|
||||
}
|
||||
|
||||
for (var i in rules) {
|
||||
if(rules.hasOwnProperty(i)) {
|
||||
var rule = rules[i].slice(1, -1).split(', ');
|
||||
var path = rule.slice(0, -1).join('');
|
||||
var query = rule[rule.length - 1];
|
||||
var rule = rules[i].slice(1, -1).split(', ');
|
||||
var path = rule.slice(0, -1).join('');
|
||||
var query = rule[rule.length - 1];
|
||||
|
||||
if (Interchange.SPECIAL_QUERIES[query]) {
|
||||
query = Interchange.SPECIAL_QUERIES[query];
|
||||
}
|
||||
|
||||
rulesList.push({
|
||||
path: path,
|
||||
query: query
|
||||
});
|
||||
if (Interchange.SPECIAL_QUERIES[query]) {
|
||||
query = Interchange.SPECIAL_QUERIES[query];
|
||||
}
|
||||
|
||||
rulesList.push({
|
||||
path: path,
|
||||
query: query
|
||||
});
|
||||
}
|
||||
|
||||
this.rules = rulesList;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Update the `src` property of an image, or change the HTML of a container, to the specified path.
|
||||
@ -131,68 +139,46 @@ class Interchange {
|
||||
* @param {String} path - Path to the image or HTML partial.
|
||||
* @fires Interchange#replaced
|
||||
*/
|
||||
replace(path) {
|
||||
Interchange.prototype.replace = function(path) {
|
||||
if (this.currentPath === path) return;
|
||||
|
||||
var _this = this,
|
||||
trigger = 'replaced.zf.interchange';
|
||||
var _this = this;
|
||||
|
||||
// Replacing images
|
||||
if (this.$element[0].nodeName === 'IMG') {
|
||||
this.$element.attr('src', path).on('load', function() {
|
||||
this.$element.attr('src', path).load(function() {
|
||||
_this.currentPath = path;
|
||||
})
|
||||
.trigger(trigger);
|
||||
});
|
||||
}
|
||||
// Replacing background images
|
||||
else if (path.match(/\.(gif|jpg|jpeg|png|svg|tiff)([?#].*)?/i)) {
|
||||
this.$element.css({ 'background-image': 'url('+path+')' })
|
||||
.trigger(trigger);
|
||||
else if (path.match(/\.(gif|jpg|jpeg|tiff|png)([?#].*)?/i)) {
|
||||
this.$element.css({ 'background-image': 'url('+path+')' });
|
||||
}
|
||||
// Replacing HTML
|
||||
else {
|
||||
$.get(path, function(response) {
|
||||
_this.$element.html(response)
|
||||
.trigger(trigger);
|
||||
_this.$element.html(response);
|
||||
$(response).foundation();
|
||||
_this.currentPath = path;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires when content in an Interchange element is done being loaded.
|
||||
* @event Interchange#replaced
|
||||
*/
|
||||
// this.$element.trigger('replaced.zf.interchange');
|
||||
}
|
||||
|
||||
this.$element.trigger('replaced.zf.interchange');
|
||||
};
|
||||
/**
|
||||
* Destroys an instance of interchange.
|
||||
* @function
|
||||
*/
|
||||
destroy() {
|
||||
Interchange.prototype.destroy = function(){
|
||||
//TODO this.
|
||||
}
|
||||
}
|
||||
};
|
||||
Foundation.plugin(Interchange, 'Interchange');
|
||||
|
||||
/**
|
||||
* Default settings for plugin
|
||||
*/
|
||||
Interchange.defaults = {
|
||||
/**
|
||||
* Rules to be applied to Interchange elements. Set with the `data-interchange` array notation.
|
||||
* @option
|
||||
*/
|
||||
rules: null
|
||||
};
|
||||
// Exports for AMD/Browserify
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined')
|
||||
module.exports = Interchange;
|
||||
if (typeof define === 'function')
|
||||
define(['foundation'], function() {
|
||||
return Interchange;
|
||||
});
|
||||
|
||||
Interchange.SPECIAL_QUERIES = {
|
||||
'landscape': 'screen and (orientation: landscape)',
|
||||
'portrait': '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)'
|
||||
};
|
||||
|
||||
// Window exports
|
||||
Foundation.plugin(Interchange, 'Interchange');
|
||||
|
||||
}(jQuery);
|
||||
}(Foundation, jQuery);
|
||||
|
175
app/vendor/foundation/js/foundation.magellan.js
vendored
175
app/vendor/foundation/js/foundation.magellan.js
vendored
@ -1,13 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
|
||||
/**
|
||||
* Magellan module.
|
||||
* @module foundation.magellan
|
||||
*/
|
||||
!function(Foundation, $) {
|
||||
'use strict';
|
||||
|
||||
class Magellan {
|
||||
/**
|
||||
* Creates a new instance of Magellan.
|
||||
* @class
|
||||
@ -15,7 +12,7 @@ class Magellan {
|
||||
* @param {Object} element - jQuery object to add the trigger to.
|
||||
* @param {Object} options - Overrides to the default plugin settings.
|
||||
*/
|
||||
constructor(element, options) {
|
||||
function Magellan(element, options) {
|
||||
this.$element = element;
|
||||
this.options = $.extend({}, Magellan.defaults, this.$element.data(), options);
|
||||
|
||||
@ -24,13 +21,55 @@ class Magellan {
|
||||
Foundation.registerPlugin(this, 'Magellan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Default settings for plugin
|
||||
*/
|
||||
Magellan.defaults = {
|
||||
/**
|
||||
* Amount of time, in ms, the animated scrolling should take between locations.
|
||||
* @option
|
||||
* @example 500
|
||||
*/
|
||||
animationDuration: 500,
|
||||
/**
|
||||
* Animation style to use when scrolling between locations.
|
||||
* @option
|
||||
* @example 'ease-in-out'
|
||||
*/
|
||||
animationEasing: 'linear',
|
||||
/**
|
||||
* Number of pixels to use as a marker for location changes.
|
||||
* @option
|
||||
* @example 50
|
||||
*/
|
||||
threshold: 50,
|
||||
/**
|
||||
* Class applied to the active locations link on the magellan container.
|
||||
* @option
|
||||
* @example 'active'
|
||||
*/
|
||||
activeClass: 'active',
|
||||
/**
|
||||
* Allows the script to manipulate the url of the current page, and if supported, alter the history.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
deepLinking: false,
|
||||
/**
|
||||
* Number of pixels to offset the scroll of the page on item click if using a sticky nav bar.
|
||||
* @option
|
||||
* @example 25
|
||||
*/
|
||||
barOffset: 0
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes the Magellan plugin and calls functions to get equalizer functioning on load.
|
||||
* @private
|
||||
*/
|
||||
_init() {
|
||||
var id = this.$element[0].id || Foundation.GetYoDigits(6, 'magellan');
|
||||
var _this = this;
|
||||
Magellan.prototype._init = function() {
|
||||
var id = this.$element[0].id || Foundation.GetYoDigits(6, 'magellan'),
|
||||
_this = this;
|
||||
this.$targets = $('[data-magellan-target]');
|
||||
this.$links = this.$element.find('a');
|
||||
this.$element.attr({
|
||||
@ -42,14 +81,13 @@ class Magellan {
|
||||
this.scrollPos = parseInt(window.pageYOffset, 10);
|
||||
|
||||
this._events();
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Calculates an array of pixel values that are the demarcation lines between locations on the page.
|
||||
* Can be invoked if new elements are added or the size of a location changes.
|
||||
* @function
|
||||
*/
|
||||
calcPoints() {
|
||||
Magellan.prototype.calcPoints = function(){
|
||||
var _this = this,
|
||||
body = document.body,
|
||||
html = document.documentElement;
|
||||
@ -64,25 +102,20 @@ class Magellan {
|
||||
$tar.targetPoint = pt;
|
||||
_this.points.push(pt);
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Initializes events for Magellan.
|
||||
* @private
|
||||
*/
|
||||
_events() {
|
||||
Magellan.prototype._events = function() {
|
||||
var _this = this,
|
||||
$body = $('html, body'),
|
||||
opts = {
|
||||
duration: _this.options.animationDuration,
|
||||
easing: _this.options.animationEasing
|
||||
};
|
||||
|
||||
$(window).one('load', function(){
|
||||
if(_this.options.deepLinking){
|
||||
if(location.hash){
|
||||
_this.scrollToLoc(location.hash);
|
||||
}
|
||||
}
|
||||
_this.calcPoints();
|
||||
_this._updateActive();
|
||||
});
|
||||
@ -92,40 +125,32 @@ class Magellan {
|
||||
'scrollme.zf.trigger': this._updateActive.bind(this)
|
||||
}).on('click.zf.magellan', 'a[href^="#"]', function(e) {
|
||||
e.preventDefault();
|
||||
var arrival = this.getAttribute('href');
|
||||
_this.scrollToLoc(arrival);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to scroll to a given location on the page.
|
||||
* @param {String} loc - a properly formatted jQuery id selector. Example: '#foo'
|
||||
* @function
|
||||
*/
|
||||
scrollToLoc(loc) {
|
||||
// Do nothing if target does not exist to prevent errors
|
||||
if (!$(loc).length) {return false;}
|
||||
var scrollPos = Math.round($(loc).offset().top - this.options.threshold / 2 - this.options.barOffset);
|
||||
|
||||
$('html, body').stop(true).animate({ scrollTop: scrollPos }, this.options.animationDuration, this.options.animationEasing);
|
||||
}
|
||||
var arrival = this.getAttribute('href'),
|
||||
scrollPos = $(arrival).offset().top - _this.options.threshold / 2 - _this.options.barOffset;
|
||||
|
||||
// requestAnimationFrame is disabled for this plugin currently
|
||||
// Foundation.Move(_this.options.animationDuration, $body, function(){
|
||||
$body.stop(true).animate({
|
||||
scrollTop: scrollPos
|
||||
}, opts);
|
||||
});
|
||||
// });
|
||||
};
|
||||
/**
|
||||
* Calls necessary functions to update Magellan upon DOM change
|
||||
* @function
|
||||
*/
|
||||
reflow() {
|
||||
Magellan.prototype.reflow = function(){
|
||||
this.calcPoints();
|
||||
this._updateActive();
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Updates the visibility of an active location link, and updates the url hash for the page, if deepLinking enabled.
|
||||
* @private
|
||||
* @function
|
||||
* @fires Magellan#update
|
||||
*/
|
||||
_updateActive(/*evt, elem, scrollPos*/) {
|
||||
Magellan.prototype._updateActive = function(/*evt, elem, scrollPos*/){
|
||||
var winPos = /*scrollPos ||*/ parseInt(window.pageYOffset, 10),
|
||||
curIdx;
|
||||
|
||||
@ -135,13 +160,13 @@ class Magellan {
|
||||
var isDown = this.scrollPos < winPos,
|
||||
_this = this,
|
||||
curVisible = this.points.filter(function(p, i){
|
||||
return isDown ? p - _this.options.barOffset <= winPos : p - _this.options.barOffset - _this.options.threshold <= winPos;
|
||||
return isDown ? p <= winPos : p - _this.options.threshold <= winPos;//&& winPos >= _this.points[i -1] - _this.options.threshold;
|
||||
});
|
||||
curIdx = curVisible.length ? curVisible.length - 1 : 0;
|
||||
}
|
||||
|
||||
this.$active.removeClass(this.options.activeClass);
|
||||
this.$active = this.$links.filter('[href="#' + this.$targets.eq(curIdx).data('magellan-target') + '"]').addClass(this.options.activeClass);
|
||||
this.$active = this.$links.eq(curIdx).addClass(this.options.activeClass);
|
||||
|
||||
if(this.options.deepLinking){
|
||||
var hash = this.$active[0].getAttribute('href');
|
||||
@ -158,15 +183,14 @@ class Magellan {
|
||||
* @event Magellan#update
|
||||
*/
|
||||
this.$element.trigger('update.zf.magellan', [this.$active]);
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Destroys an instance of Magellan and resets the url of the window.
|
||||
* @function
|
||||
*/
|
||||
destroy() {
|
||||
Magellan.prototype.destroy = function(){
|
||||
this.$element.off('.zf.trigger .zf.magellan')
|
||||
.find(`.${this.options.activeClass}`).removeClass(this.options.activeClass);
|
||||
.find('.' + this.options.activeClass).removeClass(this.options.activeClass);
|
||||
|
||||
if(this.options.deepLinking){
|
||||
var hash = this.$active[0].getAttribute('href');
|
||||
@ -174,52 +198,15 @@ class Magellan {
|
||||
}
|
||||
|
||||
Foundation.unregisterPlugin(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
Foundation.plugin(Magellan, 'Magellan');
|
||||
|
||||
/**
|
||||
* Default settings for plugin
|
||||
*/
|
||||
Magellan.defaults = {
|
||||
/**
|
||||
* Amount of time, in ms, the animated scrolling should take between locations.
|
||||
* @option
|
||||
* @example 500
|
||||
*/
|
||||
animationDuration: 500,
|
||||
/**
|
||||
* Animation style to use when scrolling between locations.
|
||||
* @option
|
||||
* @example 'ease-in-out'
|
||||
*/
|
||||
animationEasing: 'linear',
|
||||
/**
|
||||
* Number of pixels to use as a marker for location changes.
|
||||
* @option
|
||||
* @example 50
|
||||
*/
|
||||
threshold: 50,
|
||||
/**
|
||||
* Class applied to the active locations link on the magellan container.
|
||||
* @option
|
||||
* @example 'active'
|
||||
*/
|
||||
activeClass: 'active',
|
||||
/**
|
||||
* Allows the script to manipulate the url of the current page, and if supported, alter the history.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
deepLinking: false,
|
||||
/**
|
||||
* Number of pixels to offset the scroll of the page on item click if using a sticky nav bar.
|
||||
* @option
|
||||
* @example 25
|
||||
*/
|
||||
barOffset: 0
|
||||
}
|
||||
// Exports for AMD/Browserify
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined')
|
||||
module.exports = Magellan;
|
||||
if (typeof define === 'function')
|
||||
define(['foundation'], function() {
|
||||
return Magellan;
|
||||
});
|
||||
|
||||
// Window exports
|
||||
Foundation.plugin(Magellan, 'Magellan');
|
||||
|
||||
}(jQuery);
|
||||
}(Foundation, jQuery);
|
||||
|
651
app/vendor/foundation/js/foundation.offcanvas.js
vendored
651
app/vendor/foundation/js/foundation.offcanvas.js
vendored
@ -1,343 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
|
||||
/**
|
||||
* OffCanvas module.
|
||||
* @module foundation.offcanvas
|
||||
* @requires foundation.util.mediaQuery
|
||||
* @requires foundation.util.triggers
|
||||
* @requires foundation.util.motion
|
||||
*/
|
||||
!function($, Foundation) {
|
||||
|
||||
class OffCanvas {
|
||||
/**
|
||||
* Creates a new instance of an off-canvas wrapper.
|
||||
* @class
|
||||
* @fires OffCanvas#init
|
||||
* @param {Object} element - jQuery object to initialize.
|
||||
* @param {Object} options - Overrides to the default plugin settings.
|
||||
*/
|
||||
constructor(element, options) {
|
||||
this.$element = element;
|
||||
this.options = $.extend({}, OffCanvas.defaults, this.$element.data(), options);
|
||||
this.$lastTrigger = $();
|
||||
this.$triggers = $();
|
||||
'use strict';
|
||||
|
||||
this._init();
|
||||
this._events();
|
||||
/**
|
||||
* Creates a new instance of an off-canvas wrapper.
|
||||
* @class
|
||||
* @fires OffCanvas#init
|
||||
* @param {Object} element - jQuery object to initialize.
|
||||
* @param {Object} options - Overrides to the default plugin settings.
|
||||
*/
|
||||
function OffCanvas(element, options) {
|
||||
this.$element = element;
|
||||
this.options = $.extend({}, OffCanvas.defaults, this.$element.data(), options);
|
||||
this.$lastTrigger = $();
|
||||
|
||||
Foundation.registerPlugin(this, 'OffCanvas')
|
||||
Foundation.Keyboard.register('OffCanvas', {
|
||||
'ESCAPE': 'close'
|
||||
});
|
||||
this._init();
|
||||
this._events();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the off-canvas wrapper by adding the exit overlay (if needed).
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_init() {
|
||||
var id = this.$element.attr('id');
|
||||
|
||||
this.$element.attr('aria-hidden', 'true');
|
||||
|
||||
// Find triggers that affect this element and add aria-expanded to them
|
||||
this.$triggers = $(document)
|
||||
.find('[data-open="'+id+'"], [data-close="'+id+'"], [data-toggle="'+id+'"]')
|
||||
.attr('aria-expanded', 'false')
|
||||
.attr('aria-controls', id);
|
||||
|
||||
// Add a close trigger over the body if necessary
|
||||
if (this.options.closeOnClick) {
|
||||
if ($('.js-off-canvas-exit').length) {
|
||||
this.$exiter = $('.js-off-canvas-exit');
|
||||
} else {
|
||||
var exiter = document.createElement('div');
|
||||
exiter.setAttribute('class', 'js-off-canvas-exit');
|
||||
$('[data-off-canvas-content]').append(exiter);
|
||||
|
||||
this.$exiter = $(exiter);
|
||||
}
|
||||
}
|
||||
|
||||
this.options.isRevealed = this.options.isRevealed || new RegExp(this.options.revealClass, 'g').test(this.$element[0].className);
|
||||
|
||||
if (this.options.isRevealed) {
|
||||
this.options.revealOn = this.options.revealOn || this.$element[0].className.match(/(reveal-for-medium|reveal-for-large)/g)[0].split('-')[2];
|
||||
this._setMQChecker();
|
||||
}
|
||||
if (!this.options.transitionTime) {
|
||||
this.options.transitionTime = parseFloat(window.getComputedStyle($('[data-off-canvas-wrapper]')[0]).transitionDuration) * 1000;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds event handlers to the off-canvas wrapper and the exit overlay.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_events() {
|
||||
this.$element.off('.zf.trigger .zf.offcanvas').on({
|
||||
'open.zf.trigger': this.open.bind(this),
|
||||
'close.zf.trigger': this.close.bind(this),
|
||||
'toggle.zf.trigger': this.toggle.bind(this),
|
||||
'keydown.zf.offcanvas': this._handleKeyboard.bind(this)
|
||||
});
|
||||
|
||||
if (this.options.closeOnClick && this.$exiter.length) {
|
||||
this.$exiter.on({'click.zf.offcanvas': this.close.bind(this)});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies event listener for elements that will reveal at certain breakpoints.
|
||||
* @private
|
||||
*/
|
||||
_setMQChecker() {
|
||||
var _this = this;
|
||||
|
||||
$(window).on('changed.zf.mediaquery', function() {
|
||||
if (Foundation.MediaQuery.atLeast(_this.options.revealOn)) {
|
||||
_this.reveal(true);
|
||||
} else {
|
||||
_this.reveal(false);
|
||||
}
|
||||
}).one('load.zf.offcanvas', function() {
|
||||
if (Foundation.MediaQuery.atLeast(_this.options.revealOn)) {
|
||||
_this.reveal(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the revealing/hiding the off-canvas at breakpoints, not the same as open.
|
||||
* @param {Boolean} isRevealed - true if element should be revealed.
|
||||
* @function
|
||||
*/
|
||||
reveal(isRevealed) {
|
||||
var $closer = this.$element.find('[data-close]');
|
||||
if (isRevealed) {
|
||||
this.close();
|
||||
this.isRevealed = true;
|
||||
// if (!this.options.forceTop) {
|
||||
// var scrollPos = parseInt(window.pageYOffset);
|
||||
// this.$element[0].style.transform = 'translate(0,' + scrollPos + 'px)';
|
||||
// }
|
||||
// if (this.options.isSticky) { this._stick(); }
|
||||
this.$element.off('open.zf.trigger toggle.zf.trigger');
|
||||
if ($closer.length) { $closer.hide(); }
|
||||
} else {
|
||||
this.isRevealed = false;
|
||||
// if (this.options.isSticky || !this.options.forceTop) {
|
||||
// this.$element[0].style.transform = '';
|
||||
// $(window).off('scroll.zf.offcanvas');
|
||||
// }
|
||||
this.$element.on({
|
||||
'open.zf.trigger': this.open.bind(this),
|
||||
'toggle.zf.trigger': this.toggle.bind(this)
|
||||
});
|
||||
if ($closer.length) {
|
||||
$closer.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the off-canvas menu.
|
||||
* @function
|
||||
* @param {Object} event - Event object passed from listener.
|
||||
* @param {jQuery} trigger - element that triggered the off-canvas to open.
|
||||
* @fires OffCanvas#opened
|
||||
*/
|
||||
open(event, trigger) {
|
||||
if (this.$element.hasClass('is-open') || this.isRevealed) { return; }
|
||||
var _this = this,
|
||||
$body = $(document.body);
|
||||
|
||||
if (this.options.forceTop) {
|
||||
$('body').scrollTop(0);
|
||||
}
|
||||
// window.pageYOffset = 0;
|
||||
|
||||
// if (!this.options.forceTop) {
|
||||
// var scrollPos = parseInt(window.pageYOffset);
|
||||
// this.$element[0].style.transform = 'translate(0,' + scrollPos + 'px)';
|
||||
// if (this.$exiter.length) {
|
||||
// this.$exiter[0].style.transform = 'translate(0,' + scrollPos + 'px)';
|
||||
// }
|
||||
// }
|
||||
/**
|
||||
* Fires when the off-canvas menu opens.
|
||||
* @event OffCanvas#opened
|
||||
*/
|
||||
|
||||
var $wrapper = $('[data-off-canvas-wrapper]');
|
||||
$wrapper.addClass('is-off-canvas-open is-open-'+ _this.options.position);
|
||||
|
||||
_this.$element.addClass('is-open')
|
||||
|
||||
// if (_this.options.isSticky) {
|
||||
// _this._stick();
|
||||
// }
|
||||
|
||||
this.$triggers.attr('aria-expanded', 'true');
|
||||
this.$element.attr('aria-hidden', 'false')
|
||||
.trigger('opened.zf.offcanvas');
|
||||
|
||||
if (this.options.closeOnClick) {
|
||||
this.$exiter.addClass('is-visible');
|
||||
}
|
||||
|
||||
if (trigger) {
|
||||
this.$lastTrigger = trigger;
|
||||
}
|
||||
|
||||
if (this.options.autoFocus) {
|
||||
$wrapper.one(Foundation.transitionend($wrapper), function() {
|
||||
if(_this.$element.hasClass('is-open')) { // handle double clicks
|
||||
_this.$element.attr('tabindex', '-1');
|
||||
_this.$element.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (this.options.trapFocus) {
|
||||
$wrapper.one(Foundation.transitionend($wrapper), function() {
|
||||
if(_this.$element.hasClass('is-open')) { // handle double clicks
|
||||
_this.$element.attr('tabindex', '-1');
|
||||
_this.trapFocus();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Traps focus within the offcanvas on open.
|
||||
* @private
|
||||
*/
|
||||
_trapFocus() {
|
||||
var focusable = Foundation.Keyboard.findFocusable(this.$element),
|
||||
first = focusable.eq(0),
|
||||
last = focusable.eq(-1);
|
||||
|
||||
focusable.off('.zf.offcanvas').on('keydown.zf.offcanvas', function(e) {
|
||||
var key = Foundation.Keyboard.parseKey(e);
|
||||
if (key === 'TAB' && e.target === last[0]) {
|
||||
e.preventDefault();
|
||||
first.focus();
|
||||
}
|
||||
if (key === 'SHIFT_TAB' && e.target === first[0]) {
|
||||
e.preventDefault();
|
||||
last.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the offcanvas to appear sticky utilizing translate properties.
|
||||
* @private
|
||||
*/
|
||||
// OffCanvas.prototype._stick = function() {
|
||||
// var elStyle = this.$element[0].style;
|
||||
//
|
||||
// if (this.options.closeOnClick) {
|
||||
// var exitStyle = this.$exiter[0].style;
|
||||
// }
|
||||
//
|
||||
// $(window).on('scroll.zf.offcanvas', function(e) {
|
||||
// console.log(e);
|
||||
// var pageY = window.pageYOffset;
|
||||
// elStyle.transform = 'translate(0,' + pageY + 'px)';
|
||||
// if (exitStyle !== undefined) { exitStyle.transform = 'translate(0,' + pageY + 'px)'; }
|
||||
// });
|
||||
// // this.$element.trigger('stuck.zf.offcanvas');
|
||||
// };
|
||||
/**
|
||||
* Closes the off-canvas menu.
|
||||
* @function
|
||||
* @param {Function} cb - optional cb to fire after closure.
|
||||
* @fires OffCanvas#closed
|
||||
*/
|
||||
close(cb) {
|
||||
if (!this.$element.hasClass('is-open') || this.isRevealed) { return; }
|
||||
|
||||
var _this = this;
|
||||
|
||||
// Foundation.Move(this.options.transitionTime, this.$element, function() {
|
||||
$('[data-off-canvas-wrapper]').removeClass(`is-off-canvas-open is-open-${_this.options.position}`);
|
||||
_this.$element.removeClass('is-open');
|
||||
// Foundation._reflow();
|
||||
// });
|
||||
this.$element.attr('aria-hidden', 'true')
|
||||
/**
|
||||
* Fires when the off-canvas menu opens.
|
||||
* @event OffCanvas#closed
|
||||
*/
|
||||
.trigger('closed.zf.offcanvas');
|
||||
// if (_this.options.isSticky || !_this.options.forceTop) {
|
||||
// setTimeout(function() {
|
||||
// _this.$element[0].style.transform = '';
|
||||
// $(window).off('scroll.zf.offcanvas');
|
||||
// }, this.options.transitionTime);
|
||||
// }
|
||||
if (this.options.closeOnClick) {
|
||||
this.$exiter.removeClass('is-visible');
|
||||
}
|
||||
|
||||
this.$triggers.attr('aria-expanded', 'false');
|
||||
if (this.options.trapFocus) {
|
||||
$('[data-off-canvas-content]').removeAttr('tabindex');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the off-canvas menu open or closed.
|
||||
* @function
|
||||
* @param {Object} event - Event object passed from listener.
|
||||
* @param {jQuery} trigger - element that triggered the off-canvas to open.
|
||||
*/
|
||||
toggle(event, trigger) {
|
||||
if (this.$element.hasClass('is-open')) {
|
||||
this.close(event, trigger);
|
||||
}
|
||||
else {
|
||||
this.open(event, trigger);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles keyboard input when detected. When the escape key is pressed, the off-canvas menu closes, and focus is restored to the element that opened the menu.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_handleKeyboard(e) {
|
||||
Foundation.Keyboard.handleKey(e, 'OffCanvas', {
|
||||
close: () => {
|
||||
this.close();
|
||||
this.$lastTrigger.focus();
|
||||
return true;
|
||||
},
|
||||
handled: () => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroys the offcanvas plugin.
|
||||
* @function
|
||||
*/
|
||||
destroy() {
|
||||
this.close();
|
||||
this.$element.off('.zf.trigger .zf.offcanvas');
|
||||
this.$exiter.off('.zf.offcanvas');
|
||||
|
||||
Foundation.unregisterPlugin(this);
|
||||
}
|
||||
Foundation.registerPlugin(this, 'OffCanvas');
|
||||
}
|
||||
|
||||
OffCanvas.defaults = {
|
||||
@ -347,49 +33,45 @@ OffCanvas.defaults = {
|
||||
* @example true
|
||||
*/
|
||||
closeOnClick: true,
|
||||
|
||||
/**
|
||||
* Amount of time in ms the open and close transition requires. If none selected, pulls from body style.
|
||||
* @option
|
||||
* @example 500
|
||||
*/
|
||||
transitionTime: 0,
|
||||
|
||||
/**
|
||||
* Direction the offcanvas opens from. Determines class applied to body.
|
||||
* @option
|
||||
* @example left
|
||||
*/
|
||||
position: 'left',
|
||||
|
||||
/**
|
||||
* Force the page to scroll to top on open.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
forceTop: true,
|
||||
|
||||
/**
|
||||
* Allow the offcanvas to remain open for certain breakpoints.
|
||||
* Allow the offcanvas to be sticky while open. Does nothing if Sass option `$maincontent-prevent-scroll === true`.
|
||||
* Performance in Safari OSX/iOS is not great.
|
||||
*/
|
||||
// isSticky: false,
|
||||
/**
|
||||
* Allow the offcanvas to remain open for certain breakpoints. Can be used with `isSticky`.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
isRevealed: false,
|
||||
|
||||
/**
|
||||
* Breakpoint at which to reveal. JS will use a RegExp to target standard classes, if changing classnames, pass your class with the `revealClass` option.
|
||||
* Breakpoint at which to reveal. JS will use a RegExp to target standard classes, if changing classnames, pass your class @`revealClass`.
|
||||
* @option
|
||||
* @example reveal-for-large
|
||||
*/
|
||||
revealOn: null,
|
||||
|
||||
/**
|
||||
* Force focus to the offcanvas on open. If true, will focus the opening trigger on close. Sets tabindex of [data-off-canvas-content] to -1 for accessibility purposes.
|
||||
* Force focus to the offcanvas on open. If true, will focus the opening trigger on close.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
autoFocus: true,
|
||||
|
||||
/**
|
||||
* Class used to force an offcanvas to remain open. Foundation defaults for this are `reveal-for-large` & `reveal-for-medium`.
|
||||
* @option
|
||||
@ -397,16 +79,293 @@ OffCanvas.defaults = {
|
||||
* @example reveal-for-large
|
||||
*/
|
||||
revealClass: 'reveal-for-',
|
||||
|
||||
/**
|
||||
* Triggers optional focus trapping when opening an offcanvas. Sets tabindex of [data-off-canvas-content] to -1 for accessibility purposes.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
trapFocus: false
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes the off-canvas wrapper by adding the exit overlay (if needed).
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
OffCanvas.prototype._init = function() {
|
||||
var id = this.$element.attr('id');
|
||||
|
||||
this.$element.attr('aria-hidden', 'true');
|
||||
|
||||
// Find triggers that affect this element and add aria-expanded to them
|
||||
$(document)
|
||||
.find('[data-open="'+id+'"], [data-close="'+id+'"], [data-toggle="'+id+'"]')
|
||||
.attr('aria-expanded', 'false')
|
||||
.attr('aria-controls', id);
|
||||
|
||||
// Add a close trigger over the body if necessary
|
||||
if (this.options.closeOnClick){
|
||||
if($('.js-off-canvas-exit').length){
|
||||
this.$exiter = $('.js-off-canvas-exit');
|
||||
}else{
|
||||
var exiter = document.createElement('div');
|
||||
exiter.setAttribute('class', 'js-off-canvas-exit');
|
||||
$('[data-off-canvas-content]').append(exiter);
|
||||
|
||||
this.$exiter = $(exiter);
|
||||
}
|
||||
}
|
||||
|
||||
this.options.isRevealed = this.options.isRevealed || new RegExp(this.options.revealClass, 'g').test(this.$element[0].className);
|
||||
|
||||
if(this.options.isRevealed){
|
||||
this.options.revealOn = this.options.revealOn || this.$element[0].className.match(/(reveal-for-medium|reveal-for-large)/g)[0].split('-')[2];
|
||||
this._setMQChecker();
|
||||
}
|
||||
if(!this.options.transitionTime){
|
||||
this.options.transitionTime = parseFloat(window.getComputedStyle($('[data-off-canvas-wrapper]')[0]).transitionDuration) * 1000;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds event handlers to the off-canvas wrapper and the exit overlay.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
OffCanvas.prototype._events = function() {
|
||||
this.$element.off('.zf.trigger .zf.offcanvas').on({
|
||||
'open.zf.trigger': this.open.bind(this),
|
||||
'close.zf.trigger': this.close.bind(this),
|
||||
'toggle.zf.trigger': this.toggle.bind(this),
|
||||
'keydown.zf.offcanvas': this._handleKeyboard.bind(this)
|
||||
});
|
||||
|
||||
if (this.$exiter.length) {
|
||||
var _this = this;
|
||||
this.$exiter.on({'click.zf.offcanvas': this.close.bind(this)});
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Applies event listener for elements that will reveal at certain breakpoints.
|
||||
* @private
|
||||
*/
|
||||
OffCanvas.prototype._setMQChecker = function(){
|
||||
var _this = this;
|
||||
|
||||
$(window).on('changed.zf.mediaquery', function(){
|
||||
if(Foundation.MediaQuery.atLeast(_this.options.revealOn)){
|
||||
_this.reveal(true);
|
||||
}else{
|
||||
_this.reveal(false);
|
||||
}
|
||||
}).one('load.zf.offcanvas', function(){
|
||||
if(Foundation.MediaQuery.atLeast(_this.options.revealOn)){
|
||||
_this.reveal(true);
|
||||
}
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Handles the revealing/hiding the off-canvas at breakpoints, not the same as open.
|
||||
* @param {Boolean} isRevealed - true if element should be revealed.
|
||||
* @function
|
||||
*/
|
||||
OffCanvas.prototype.reveal = function(isRevealed){
|
||||
var $closer = this.$element.find('[data-close]');
|
||||
if(isRevealed){
|
||||
this.close();
|
||||
this.isRevealed = true;
|
||||
// if(!this.options.forceTop){
|
||||
// var scrollPos = parseInt(window.pageYOffset);
|
||||
// this.$element[0].style.transform = 'translate(0,' + scrollPos + 'px)';
|
||||
// }
|
||||
// if(this.options.isSticky){ this._stick(); }
|
||||
this.$element.off('open.zf.trigger toggle.zf.trigger');
|
||||
if($closer.length){ $closer.hide(); }
|
||||
}else{
|
||||
this.isRevealed = false;
|
||||
// if(this.options.isSticky || !this.options.forceTop){
|
||||
// this.$element[0].style.transform = '';
|
||||
// $(window).off('scroll.zf.offcanvas');
|
||||
// }
|
||||
this.$element.on({
|
||||
'open.zf.trigger': this.open.bind(this),
|
||||
'toggle.zf.trigger': this.toggle.bind(this)
|
||||
});
|
||||
if($closer.length){
|
||||
$closer.show();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Opens the off-canvas menu.
|
||||
* @function
|
||||
* @param {Object} event - Event object passed from listener.
|
||||
* @param {jQuery} trigger - element that triggered the off-canvas to open.
|
||||
* @fires OffCanvas#opened
|
||||
*/
|
||||
OffCanvas.prototype.open = function(event, trigger) {
|
||||
if (this.$element.hasClass('is-open') || this.isRevealed){ return; }
|
||||
var _this = this,
|
||||
$body = $(document.body);
|
||||
$('body').scrollTop(0);
|
||||
// window.pageYOffset = 0;
|
||||
|
||||
// if(!this.options.forceTop){
|
||||
// var scrollPos = parseInt(window.pageYOffset);
|
||||
// this.$element[0].style.transform = 'translate(0,' + scrollPos + 'px)';
|
||||
// if(this.$exiter.length){
|
||||
// this.$exiter[0].style.transform = 'translate(0,' + scrollPos + 'px)';
|
||||
// }
|
||||
// }
|
||||
/**
|
||||
* Fires when the off-canvas menu opens.
|
||||
* @event OffCanvas#opened
|
||||
*/
|
||||
Foundation.Move(this.options.transitionTime, this.$element, function(){
|
||||
$('[data-off-canvas-wrapper]').addClass('is-off-canvas-open is-open-'+ _this.options.position);
|
||||
|
||||
_this.$element
|
||||
.addClass('is-open')
|
||||
|
||||
// if(_this.options.isSticky){
|
||||
// _this._stick();
|
||||
// }
|
||||
});
|
||||
this.$element.attr('aria-hidden', 'false')
|
||||
.trigger('opened.zf.offcanvas');
|
||||
|
||||
|
||||
if(trigger){
|
||||
this.$lastTrigger = trigger.attr('aria-expanded', 'true');
|
||||
}
|
||||
if(this.options.autoFocus){
|
||||
this.$element.one('finished.zf.animate', function(){
|
||||
_this.$element.find('a, button').eq(0).focus();
|
||||
});
|
||||
}
|
||||
if(this.options.trapFocus){
|
||||
$('[data-off-canvas-content]').attr('tabindex', '-1');
|
||||
this._trapFocus();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Traps focus within the offcanvas on open.
|
||||
* @private
|
||||
*/
|
||||
OffCanvas.prototype._trapFocus = function(){
|
||||
var focusable = Foundation.Keyboard.findFocusable(this.$element),
|
||||
first = focusable.eq(0),
|
||||
last = focusable.eq(-1);
|
||||
|
||||
focusable.off('.zf.offcanvas').on('keydown.zf.offcanvas', function(e){
|
||||
if(e.which === 9 || e.keycode === 9){
|
||||
if(e.target === last[0] && !e.shiftKey){
|
||||
e.preventDefault();
|
||||
first.focus();
|
||||
}
|
||||
if(e.target === first[0] && e.shiftKey){
|
||||
e.preventDefault();
|
||||
last.focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Allows the offcanvas to appear sticky utilizing translate properties.
|
||||
* @private
|
||||
*/
|
||||
// OffCanvas.prototype._stick = function(){
|
||||
// var elStyle = this.$element[0].style;
|
||||
//
|
||||
// if(this.options.closeOnClick){
|
||||
// var exitStyle = this.$exiter[0].style;
|
||||
// }
|
||||
//
|
||||
// $(window).on('scroll.zf.offcanvas', function(e){
|
||||
// console.log(e);
|
||||
// var pageY = window.pageYOffset;
|
||||
// elStyle.transform = 'translate(0,' + pageY + 'px)';
|
||||
// if(exitStyle !== undefined){ exitStyle.transform = 'translate(0,' + pageY + 'px)'; }
|
||||
// });
|
||||
// // this.$element.trigger('stuck.zf.offcanvas');
|
||||
// };
|
||||
/**
|
||||
* Closes the off-canvas menu.
|
||||
* @function
|
||||
* @param {Function} cb - optional cb to fire after closure.
|
||||
* @fires OffCanvas#closed
|
||||
*/
|
||||
OffCanvas.prototype.close = function(cb) {
|
||||
if(!this.$element.hasClass('is-open') || this.isRevealed){ return; }
|
||||
|
||||
var _this = this;
|
||||
|
||||
// Foundation.Move(this.options.transitionTime, this.$element, function(){
|
||||
$('[data-off-canvas-wrapper]').removeClass('is-off-canvas-open is-open-' + _this.options.position);
|
||||
_this.$element.removeClass('is-open');
|
||||
// Foundation._reflow();
|
||||
// });
|
||||
this.$element.attr('aria-hidden', 'true')
|
||||
/**
|
||||
* Fires when the off-canvas menu opens.
|
||||
* @event OffCanvas#closed
|
||||
*/
|
||||
.trigger('closed.zf.offcanvas');
|
||||
// if(_this.options.isSticky || !_this.options.forceTop){
|
||||
// setTimeout(function(){
|
||||
// _this.$element[0].style.transform = '';
|
||||
// $(window).off('scroll.zf.offcanvas');
|
||||
// }, this.options.transitionTime);
|
||||
// }
|
||||
|
||||
this.$lastTrigger.attr('aria-expanded', 'false');
|
||||
if(this.options.trapFocus){
|
||||
$('[data-off-canvas-content]').removeAttr('tabindex');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Toggles the off-canvas menu open or closed.
|
||||
* @function
|
||||
* @param {Object} event - Event object passed from listener.
|
||||
* @param {jQuery} trigger - element that triggered the off-canvas to open.
|
||||
*/
|
||||
OffCanvas.prototype.toggle = function(event, trigger) {
|
||||
if (this.$element.hasClass('is-open')) {
|
||||
this.close(event, trigger);
|
||||
}
|
||||
else {
|
||||
this.open(event, trigger);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Handles keyboard input when detected. When the escape key is pressed, the off-canvas menu closes, and focus is restored to the element that opened the menu.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
OffCanvas.prototype._handleKeyboard = function(event) {
|
||||
if (event.which !== 27) return;
|
||||
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
this.close();
|
||||
this.$lastTrigger.focus();
|
||||
};
|
||||
/**
|
||||
* Destroys the offcanvas plugin.
|
||||
* @function
|
||||
*/
|
||||
OffCanvas.prototype.destroy = function(){
|
||||
this.close();
|
||||
this.$element.off('.zf.trigger .zf.offcanvas');
|
||||
this.$exiter.off('.zf.offcanvas');
|
||||
|
||||
Foundation.unregisterPlugin(this);
|
||||
};
|
||||
|
||||
// Window exports
|
||||
Foundation.plugin(OffCanvas, 'OffCanvas');
|
||||
|
||||
}(jQuery);
|
||||
}(jQuery, Foundation);
|
||||
|
645
app/vendor/foundation/js/foundation.orbit.js
vendored
645
app/vendor/foundation/js/foundation.orbit.js
vendored
@ -1,7 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
|
||||
/**
|
||||
* Orbit module.
|
||||
* @module foundation.orbit
|
||||
@ -10,15 +6,15 @@
|
||||
* @requires foundation.util.timerAndImageLoader
|
||||
* @requires foundation.util.touch
|
||||
*/
|
||||
|
||||
class Orbit {
|
||||
!function($, Foundation){
|
||||
'use strict';
|
||||
/**
|
||||
* Creates a new instance of an orbit carousel.
|
||||
* @class
|
||||
* @param {jQuery} element - jQuery object to make into an Orbit Carousel.
|
||||
* @param {Object} options - Overrides to the default plugin settings.
|
||||
*/
|
||||
constructor(element, options){
|
||||
* Creates a new instance of an orbit carousel.
|
||||
* @class
|
||||
* @param {jQuery} element - jQuery object to make into an Orbit Carousel.
|
||||
* @param {Object} options - Overrides to the default plugin settings.
|
||||
*/
|
||||
function Orbit(element, options){
|
||||
this.$element = element;
|
||||
this.options = $.extend({}, Orbit.defaults, this.$element.data(), options);
|
||||
|
||||
@ -26,429 +22,398 @@ class Orbit {
|
||||
|
||||
Foundation.registerPlugin(this, 'Orbit');
|
||||
Foundation.Keyboard.register('Orbit', {
|
||||
'ltr': {
|
||||
'ARROW_RIGHT': 'next',
|
||||
'ARROW_LEFT': 'previous'
|
||||
},
|
||||
'rtl': {
|
||||
'ARROW_LEFT': 'next',
|
||||
'ARROW_RIGHT': 'previous'
|
||||
}
|
||||
'ltr': {
|
||||
'ARROW_RIGHT': 'next',
|
||||
'ARROW_LEFT': 'previous'
|
||||
},
|
||||
'rtl': {
|
||||
'ARROW_LEFT': 'next',
|
||||
'ARROW_RIGHT': 'previous'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Orbit.defaults = {
|
||||
/**
|
||||
* Tells the JS to loadBullets.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
bullets: true,
|
||||
/**
|
||||
* Tells the JS to apply event listeners to nav buttons
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
navButtons: true,
|
||||
/**
|
||||
* motion-ui animation class to apply
|
||||
* @option
|
||||
* @example 'slide-in-right'
|
||||
*/
|
||||
animInFromRight: 'slide-in-right',
|
||||
/**
|
||||
* motion-ui animation class to apply
|
||||
* @option
|
||||
* @example 'slide-out-right'
|
||||
*/
|
||||
animOutToRight: 'slide-out-right',
|
||||
/**
|
||||
* motion-ui animation class to apply
|
||||
* @option
|
||||
* @example 'slide-in-left'
|
||||
*
|
||||
*/
|
||||
animInFromLeft: 'slide-in-left',
|
||||
/**
|
||||
* motion-ui animation class to apply
|
||||
* @option
|
||||
* @example 'slide-out-left'
|
||||
*/
|
||||
animOutToLeft: 'slide-out-left',
|
||||
/**
|
||||
* Allows Orbit to automatically animate on page load.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
autoPlay: true,
|
||||
/**
|
||||
* Amount of time, in ms, between slide transitions
|
||||
* @option
|
||||
* @example 5000
|
||||
*/
|
||||
timerDelay: 5000,
|
||||
/**
|
||||
* Allows Orbit to infinitely loop through the slides
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
infiniteWrap: true,
|
||||
/**
|
||||
* Allows the Orbit slides to bind to swipe events for mobile, requires an additional util library
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
swipe: true,
|
||||
/**
|
||||
* Allows the timing function to pause animation on hover.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
pauseOnHover: true,
|
||||
/**
|
||||
* Allows Orbit to bind keyboard events to the slider, to animate frames with arrow keys
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
accessible: true,
|
||||
/**
|
||||
* Class applied to the container of Orbit
|
||||
* @option
|
||||
* @example 'orbit-container'
|
||||
*/
|
||||
containerClass: 'orbit-container',
|
||||
/**
|
||||
* Class applied to individual slides.
|
||||
* @option
|
||||
* @example 'orbit-slide'
|
||||
*/
|
||||
slideClass: 'orbit-slide',
|
||||
/**
|
||||
* Class applied to the bullet container. You're welcome.
|
||||
* @option
|
||||
* @example 'orbit-bullets'
|
||||
*/
|
||||
boxOfBullets: 'orbit-bullets',
|
||||
/**
|
||||
* Class applied to the `next` navigation button.
|
||||
* @option
|
||||
* @example 'orbit-next'
|
||||
*/
|
||||
nextClass: 'orbit-next',
|
||||
/**
|
||||
* Class applied to the `previous` navigation button.
|
||||
* @option
|
||||
* @example 'orbit-previous'
|
||||
*/
|
||||
prevClass: 'orbit-previous',
|
||||
/**
|
||||
* Boolean to flag the js to use motion ui classes or not. Default to true for backwards compatability.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
useMUI: true
|
||||
};
|
||||
/**
|
||||
* Initializes the plugin by creating jQuery collections, setting attributes, and starting the animation.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_init() {
|
||||
this.$wrapper = this.$element.find(`.${this.options.containerClass}`);
|
||||
this.$slides = this.$element.find(`.${this.options.slideClass}`);
|
||||
* Initializes the plugin by creating jQuery collections, setting attributes, and starting the animation.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
Orbit.prototype._init = function(){
|
||||
this.$wrapper = this.$element.find('.' + this.options.containerClass);
|
||||
this.$slides = this.$element.find('.' + this.options.slideClass);
|
||||
var $images = this.$element.find('img'),
|
||||
initActive = this.$slides.filter('.is-active');
|
||||
initActive = this.$slides.filter('.is-active');
|
||||
|
||||
if (!initActive.length) {
|
||||
if(!initActive.length){
|
||||
this.$slides.eq(0).addClass('is-active');
|
||||
}
|
||||
|
||||
if (!this.options.useMUI) {
|
||||
if(!this.options.useMUI){
|
||||
this.$slides.addClass('no-motionui');
|
||||
}
|
||||
|
||||
if ($images.length) {
|
||||
if($images.length){
|
||||
Foundation.onImagesLoaded($images, this._prepareForOrbit.bind(this));
|
||||
} else {
|
||||
}else{
|
||||
this._prepareForOrbit();//hehe
|
||||
}
|
||||
|
||||
if (this.options.bullets) {
|
||||
if(this.options.bullets){
|
||||
this._loadBullets();
|
||||
}
|
||||
|
||||
this._events();
|
||||
|
||||
if (this.options.autoPlay && this.$slides.length > 1) {
|
||||
if(this.options.autoPlay){
|
||||
this.geoSync();
|
||||
}
|
||||
|
||||
if (this.options.accessible) { // allow wrapper to be focusable to enable arrow navigation
|
||||
if(this.options.accessible){ // allow wrapper to be focusable to enable arrow navigation
|
||||
this.$wrapper.attr('tabindex', 0);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Creates a jQuery collection of bullets, if they are being used.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_loadBullets() {
|
||||
this.$bullets = this.$element.find(`.${this.options.boxOfBullets}`).find('button');
|
||||
}
|
||||
|
||||
* Creates a jQuery collection of bullets, if they are being used.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
Orbit.prototype._loadBullets = function(){
|
||||
this.$bullets = this.$element.find('.' + this.options.boxOfBullets).find('button');
|
||||
};
|
||||
/**
|
||||
* Sets a `timer` object on the orbit, and starts the counter for the next slide.
|
||||
* @function
|
||||
*/
|
||||
geoSync() {
|
||||
* Sets a `timer` object on the orbit, and starts the counter for the next slide.
|
||||
* @function
|
||||
*/
|
||||
Orbit.prototype.geoSync = function(){
|
||||
var _this = this;
|
||||
this.timer = new Foundation.Timer(
|
||||
this.$element,
|
||||
{
|
||||
duration: this.options.timerDelay,
|
||||
infinite: false
|
||||
},
|
||||
function() {
|
||||
_this.changeSlide(true);
|
||||
});
|
||||
this.$element,
|
||||
{duration: this.options.timerDelay,
|
||||
infinite: false},
|
||||
function(){
|
||||
_this.changeSlide(true);
|
||||
});
|
||||
this.timer.start();
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Sets wrapper and slide heights for the orbit.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_prepareForOrbit() {
|
||||
* Sets wrapper and slide heights for the orbit.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
Orbit.prototype._prepareForOrbit = function(){
|
||||
var _this = this;
|
||||
this._setWrapperHeight(function(max){
|
||||
_this._setSlideHeight(max);
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Calulates the height of each slide in the collection, and uses the tallest one for the wrapper height.
|
||||
* @function
|
||||
* @private
|
||||
* @param {Function} cb - a callback function to fire when complete.
|
||||
*/
|
||||
_setWrapperHeight(cb) {//rewrite this to `for` loop
|
||||
* Calulates the height of each slide in the collection, and uses the tallest one for the wrapper height.
|
||||
* @function
|
||||
* @private
|
||||
* @param {Function} cb - a callback function to fire when complete.
|
||||
*/
|
||||
Orbit.prototype._setWrapperHeight = function(cb){//rewrite this to `for` loop
|
||||
var max = 0, temp, counter = 0;
|
||||
|
||||
this.$slides.each(function() {
|
||||
this.$slides.each(function(){
|
||||
temp = this.getBoundingClientRect().height;
|
||||
$(this).attr('data-slide', counter);
|
||||
|
||||
if (counter) {//if not the first slide, set css position and display property
|
||||
if(counter){//if not the first slide, set css position and display property
|
||||
$(this).css({'position': 'relative', 'display': 'none'});
|
||||
}
|
||||
max = temp > max ? temp : max;
|
||||
counter++;
|
||||
});
|
||||
|
||||
if (counter === this.$slides.length) {
|
||||
this.$wrapper.css({'height': max}); //only change the wrapper height property once.
|
||||
cb(max); //fire callback with max height dimension.
|
||||
if(counter === this.$slides.length){
|
||||
this.$wrapper.css({'height': max});//only change the wrapper height property once.
|
||||
cb(max);//fire callback with max height dimension.
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Sets the max-height of each slide.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_setSlideHeight(height) {
|
||||
this.$slides.each(function() {
|
||||
* Sets the max-height of each slide.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
Orbit.prototype._setSlideHeight = function(height){
|
||||
this.$slides.each(function(){
|
||||
$(this).css('max-height', height);
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Adds event listeners to basically everything within the element.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_events() {
|
||||
* Adds event listeners to basically everything within the element.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
Orbit.prototype._events = function(){
|
||||
var _this = this;
|
||||
|
||||
//***************************************
|
||||
//**Now using custom event - thanks to:**
|
||||
//** Yohai Ararat of Toronto **
|
||||
//***************************************
|
||||
if (this.$slides.length > 1) {
|
||||
if(this.options.swipe){
|
||||
this.$slides.off('swipeleft.zf.orbit swiperight.zf.orbit')
|
||||
.on('swipeleft.zf.orbit', function(e){
|
||||
e.preventDefault();
|
||||
_this.changeSlide(true);
|
||||
}).on('swiperight.zf.orbit', function(e){
|
||||
e.preventDefault();
|
||||
_this.changeSlide(false);
|
||||
});
|
||||
}
|
||||
//***************************************
|
||||
|
||||
if (this.options.swipe) {
|
||||
this.$slides.off('swipeleft.zf.orbit swiperight.zf.orbit')
|
||||
.on('swipeleft.zf.orbit', function(e){
|
||||
e.preventDefault();
|
||||
_this.changeSlide(true);
|
||||
}).on('swiperight.zf.orbit', function(e){
|
||||
e.preventDefault();
|
||||
_this.changeSlide(false);
|
||||
});
|
||||
}
|
||||
//***************************************
|
||||
|
||||
if (this.options.autoPlay) {
|
||||
this.$slides.on('click.zf.orbit', function() {
|
||||
_this.$element.data('clickedOn', _this.$element.data('clickedOn') ? false : true);
|
||||
_this.timer[_this.$element.data('clickedOn') ? 'pause' : 'start']();
|
||||
});
|
||||
|
||||
if (this.options.pauseOnHover) {
|
||||
this.$element.on('mouseenter.zf.orbit', function() {
|
||||
_this.timer.pause();
|
||||
}).on('mouseleave.zf.orbit', function() {
|
||||
if (!_this.$element.data('clickedOn')) {
|
||||
_this.timer.start();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (this.options.navButtons) {
|
||||
var $controls = this.$element.find(`.${this.options.nextClass}, .${this.options.prevClass}`);
|
||||
$controls.attr('tabindex', 0)
|
||||
//also need to handle enter/return and spacebar key presses
|
||||
.on('click.zf.orbit touchend.zf.orbit', function(e){
|
||||
e.preventDefault();
|
||||
_this.changeSlide($(this).hasClass(_this.options.nextClass));
|
||||
});
|
||||
}
|
||||
|
||||
if (this.options.bullets) {
|
||||
this.$bullets.on('click.zf.orbit touchend.zf.orbit', function() {
|
||||
if (/is-active/g.test(this.className)) { return false; }//if this is active, kick out of function.
|
||||
var idx = $(this).data('slide'),
|
||||
ltr = idx > _this.$slides.filter('.is-active').data('slide'),
|
||||
$slide = _this.$slides.eq(idx);
|
||||
|
||||
_this.changeSlide(ltr, $slide, idx);
|
||||
});
|
||||
}
|
||||
|
||||
if (this.options.accessible) {
|
||||
this.$wrapper.add(this.$bullets).on('keydown.zf.orbit', function(e) {
|
||||
// handle keyboard event with keyboard util
|
||||
Foundation.Keyboard.handleKey(e, 'Orbit', {
|
||||
next: function() {
|
||||
_this.changeSlide(true);
|
||||
},
|
||||
previous: function() {
|
||||
_this.changeSlide(false);
|
||||
},
|
||||
handled: function() { // if bullet is focused, make sure focus moves
|
||||
if ($(e.target).is(_this.$bullets)) {
|
||||
_this.$bullets.filter('.is-active').focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
if(this.options.autoPlay){
|
||||
this.$slides.on('click.zf.orbit', function(){
|
||||
_this.$element.data('clickedOn', _this.$element.data('clickedOn') ? false : true);
|
||||
_this.timer[_this.$element.data('clickedOn') ? 'pause' : 'start']();
|
||||
});
|
||||
if(this.options.pauseOnHover){
|
||||
this.$element.on('mouseenter.zf.orbit', function(){
|
||||
_this.timer.pause();
|
||||
}).on('mouseleave.zf.orbit', function(){
|
||||
if(!_this.$element.data('clickedOn')){
|
||||
_this.timer.start();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.options.navButtons){
|
||||
var $controls = this.$element.find('.' + this.options.nextClass + ', .' + this.options.prevClass);
|
||||
$controls.attr('tabindex', 0)
|
||||
//also need to handle enter/return and spacebar key presses
|
||||
.on('click.zf.orbit touchend.zf.orbit', function(){
|
||||
_this.changeSlide($(this).hasClass(_this.options.nextClass));
|
||||
});
|
||||
}
|
||||
|
||||
if(this.options.bullets){
|
||||
this.$bullets.on('click.zf.orbit touchend.zf.orbit', function(){
|
||||
if(/is-active/g.test(this.className)){ return false; }//if this is active, kick out of function.
|
||||
var idx = $(this).data('slide'),
|
||||
ltr = idx > _this.$slides.filter('.is-active').data('slide'),
|
||||
$slide = _this.$slides.eq(idx);
|
||||
|
||||
_this.changeSlide(ltr, $slide, idx);
|
||||
});
|
||||
}
|
||||
|
||||
this.$wrapper.add(this.$bullets).on('keydown.zf.orbit', function(e){
|
||||
// handle keyboard event with keyboard util
|
||||
Foundation.Keyboard.handleKey(e, 'Orbit', {
|
||||
next: function() {
|
||||
_this.changeSlide(true);
|
||||
},
|
||||
previous: function() {
|
||||
_this.changeSlide(false);
|
||||
},
|
||||
handled: function() { // if bullet is focused, make sure focus moves
|
||||
if ($(e.target).is(_this.$bullets)) {
|
||||
_this.$bullets.filter('.is-active').focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Changes the current slide to a new one.
|
||||
* @function
|
||||
* @param {Boolean} isLTR - flag if the slide should move left to right.
|
||||
* @param {jQuery} chosenSlide - the jQuery element of the slide to show next, if one is selected.
|
||||
* @param {Number} idx - the index of the new slide in its collection, if one chosen.
|
||||
* @fires Orbit#slidechange
|
||||
*/
|
||||
changeSlide(isLTR, chosenSlide, idx) {
|
||||
* Changes the current slide to a new one.
|
||||
* @function
|
||||
* @param {Boolean} isLTR - flag if the slide should move left to right.
|
||||
* @param {jQuery} chosenSlide - the jQuery element of the slide to show next, if one is selected.
|
||||
* @param {Number} idx - the index of the new slide in its collection, if one chosen.
|
||||
* @fires Orbit#slidechange
|
||||
*/
|
||||
Orbit.prototype.changeSlide = function(isLTR, chosenSlide, idx){
|
||||
var $curSlide = this.$slides.filter('.is-active').eq(0);
|
||||
|
||||
if (/mui/g.test($curSlide[0].className)) { return false; } //if the slide is currently animating, kick out of the function
|
||||
if(/mui/g.test($curSlide[0].className)){ return false; }//if the slide is currently animating, kick out of the function
|
||||
|
||||
var $firstSlide = this.$slides.first(),
|
||||
$lastSlide = this.$slides.last(),
|
||||
dirIn = isLTR ? 'Right' : 'Left',
|
||||
dirOut = isLTR ? 'Left' : 'Right',
|
||||
_this = this,
|
||||
$newSlide;
|
||||
$lastSlide = this.$slides.last(),
|
||||
dirIn = isLTR ? 'Right' : 'Left',
|
||||
dirOut = isLTR ? 'Left' : 'Right',
|
||||
_this = this,
|
||||
$newSlide;
|
||||
|
||||
if (!chosenSlide) { //most of the time, this will be auto played or clicked from the navButtons.
|
||||
if(!chosenSlide){//most of the time, this will be auto played or clicked from the navButtons.
|
||||
$newSlide = isLTR ? //if wrapping enabled, check to see if there is a `next` or `prev` sibling, if not, select the first or last slide to fill in. if wrapping not enabled, attempt to select `next` or `prev`, if there's nothing there, the function will kick out on next step. CRAZY NESTED TERNARIES!!!!!
|
||||
(this.options.infiniteWrap ? $curSlide.next(`.${this.options.slideClass}`).length ? $curSlide.next(`.${this.options.slideClass}`) : $firstSlide : $curSlide.next(`.${this.options.slideClass}`))//pick next slide if moving left to right
|
||||
:
|
||||
(this.options.infiniteWrap ? $curSlide.prev(`.${this.options.slideClass}`).length ? $curSlide.prev(`.${this.options.slideClass}`) : $lastSlide : $curSlide.prev(`.${this.options.slideClass}`));//pick prev slide if moving right to left
|
||||
} else {
|
||||
(this.options.infiniteWrap ? $curSlide.next('.' + this.options.slideClass).length ? $curSlide.next('.' + this.options.slideClass) : $firstSlide : $curSlide.next('.' + this.options.slideClass))//pick next slide if moving left to right
|
||||
:
|
||||
(this.options.infiniteWrap ? $curSlide.prev('.' + this.options.slideClass).length ? $curSlide.prev('.' + this.options.slideClass) : $lastSlide : $curSlide.prev('.' + this.options.slideClass));//pick prev slide if moving right to left
|
||||
}else{
|
||||
$newSlide = chosenSlide;
|
||||
}
|
||||
|
||||
if ($newSlide.length) {
|
||||
/**
|
||||
* Triggers before the next slide starts animating in and only if a next slide has been found.
|
||||
* @event Orbit#beforeslidechange
|
||||
*/
|
||||
this.$element.trigger('beforeslidechange.zf.orbit', [$curSlide, $newSlide]);
|
||||
|
||||
if (this.options.bullets) {
|
||||
idx = idx || this.$slides.index($newSlide); //grab index to update bullets
|
||||
if($newSlide.length){
|
||||
if(this.options.bullets){
|
||||
idx = idx || this.$slides.index($newSlide);//grab index to update bullets
|
||||
this._updateBullets(idx);
|
||||
}
|
||||
if(this.options.useMUI){
|
||||
|
||||
if (this.options.useMUI) {
|
||||
Foundation.Motion.animateIn(
|
||||
$newSlide.addClass('is-active').css({'position': 'absolute', 'top': 0}),
|
||||
this.options[`animInFrom${dirIn}`],
|
||||
this.options['animInFrom' + dirIn],
|
||||
function(){
|
||||
$newSlide.css({'position': 'relative', 'display': 'block'})
|
||||
.attr('aria-live', 'polite');
|
||||
});
|
||||
.attr('aria-live', 'polite');
|
||||
});
|
||||
|
||||
Foundation.Motion.animateOut(
|
||||
$curSlide.removeClass('is-active'),
|
||||
this.options[`animOutTo${dirOut}`],
|
||||
this.options['animOutTo' + dirOut],
|
||||
function(){
|
||||
$curSlide.removeAttr('aria-live');
|
||||
if(_this.options.autoPlay && !_this.timer.isPaused){
|
||||
if(_this.options.autoPlay){
|
||||
_this.timer.restart();
|
||||
}
|
||||
//do stuff?
|
||||
});
|
||||
} else {
|
||||
}else{
|
||||
$curSlide.removeClass('is-active is-in').removeAttr('aria-live').hide();
|
||||
$newSlide.addClass('is-active is-in').attr('aria-live', 'polite').show();
|
||||
if (this.options.autoPlay && !this.timer.isPaused) {
|
||||
if(this.options.autoPlay){
|
||||
this.timer.restart();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Triggers when the slide has finished animating in.
|
||||
* @event Orbit#slidechange
|
||||
*/
|
||||
/**
|
||||
* Triggers when the slide has finished animating in.
|
||||
* @event Orbit#slidechange
|
||||
*/
|
||||
this.$element.trigger('slidechange.zf.orbit', [$newSlide]);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Updates the active state of the bullets, if displayed.
|
||||
* @function
|
||||
* @private
|
||||
* @param {Number} idx - the index of the current slide.
|
||||
*/
|
||||
_updateBullets(idx) {
|
||||
var $oldBullet = this.$element.find(`.${this.options.boxOfBullets}`)
|
||||
.find('.is-active').removeClass('is-active').blur(),
|
||||
span = $oldBullet.find('span:last').detach(),
|
||||
$newBullet = this.$bullets.eq(idx).addClass('is-active').append(span);
|
||||
}
|
||||
|
||||
* Updates the active state of the bullets, if displayed.
|
||||
* @function
|
||||
* @private
|
||||
* @param {Number} idx - the index of the current slide.
|
||||
*/
|
||||
Orbit.prototype._updateBullets = function(idx){
|
||||
var $oldBullet = this.$element.find('.' + this.options.boxOfBullets)
|
||||
.find('.is-active').removeClass('is-active').blur(),
|
||||
span = $oldBullet.find('span:last').detach(),
|
||||
$newBullet = this.$bullets.eq(idx).addClass('is-active').append(span);
|
||||
};
|
||||
/**
|
||||
* Destroys the carousel and hides the element.
|
||||
* @function
|
||||
*/
|
||||
destroy() {
|
||||
* Destroys the carousel and hides the element.
|
||||
* @function
|
||||
*/
|
||||
Orbit.prototype.destroy = function(){
|
||||
delete this.timer;
|
||||
this.$element.off('.zf.orbit').find('*').off('.zf.orbit').end().hide();
|
||||
Foundation.unregisterPlugin(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Orbit.defaults = {
|
||||
/**
|
||||
* Tells the JS to look for and loadBullets.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
bullets: true,
|
||||
/**
|
||||
* Tells the JS to apply event listeners to nav buttons
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
navButtons: true,
|
||||
/**
|
||||
* motion-ui animation class to apply
|
||||
* @option
|
||||
* @example 'slide-in-right'
|
||||
*/
|
||||
animInFromRight: 'slide-in-right',
|
||||
/**
|
||||
* motion-ui animation class to apply
|
||||
* @option
|
||||
* @example 'slide-out-right'
|
||||
*/
|
||||
animOutToRight: 'slide-out-right',
|
||||
/**
|
||||
* motion-ui animation class to apply
|
||||
* @option
|
||||
* @example 'slide-in-left'
|
||||
*
|
||||
*/
|
||||
animInFromLeft: 'slide-in-left',
|
||||
/**
|
||||
* motion-ui animation class to apply
|
||||
* @option
|
||||
* @example 'slide-out-left'
|
||||
*/
|
||||
animOutToLeft: 'slide-out-left',
|
||||
/**
|
||||
* Allows Orbit to automatically animate on page load.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
autoPlay: true,
|
||||
/**
|
||||
* Amount of time, in ms, between slide transitions
|
||||
* @option
|
||||
* @example 5000
|
||||
*/
|
||||
timerDelay: 5000,
|
||||
/**
|
||||
* Allows Orbit to infinitely loop through the slides
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
infiniteWrap: true,
|
||||
/**
|
||||
* Allows the Orbit slides to bind to swipe events for mobile, requires an additional util library
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
swipe: true,
|
||||
/**
|
||||
* Allows the timing function to pause animation on hover.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
pauseOnHover: true,
|
||||
/**
|
||||
* Allows Orbit to bind keyboard events to the slider, to animate frames with arrow keys
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
accessible: true,
|
||||
/**
|
||||
* Class applied to the container of Orbit
|
||||
* @option
|
||||
* @example 'orbit-container'
|
||||
*/
|
||||
containerClass: 'orbit-container',
|
||||
/**
|
||||
* Class applied to individual slides.
|
||||
* @option
|
||||
* @example 'orbit-slide'
|
||||
*/
|
||||
slideClass: 'orbit-slide',
|
||||
/**
|
||||
* Class applied to the bullet container. You're welcome.
|
||||
* @option
|
||||
* @example 'orbit-bullets'
|
||||
*/
|
||||
boxOfBullets: 'orbit-bullets',
|
||||
/**
|
||||
* Class applied to the `next` navigation button.
|
||||
* @option
|
||||
* @example 'orbit-next'
|
||||
*/
|
||||
nextClass: 'orbit-next',
|
||||
/**
|
||||
* Class applied to the `previous` navigation button.
|
||||
* @option
|
||||
* @example 'orbit-previous'
|
||||
*/
|
||||
prevClass: 'orbit-previous',
|
||||
/**
|
||||
* Boolean to flag the js to use motion ui classes or not. Default to true for backwards compatability.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
useMUI: true
|
||||
};
|
||||
Foundation.plugin(Orbit, 'Orbit');
|
||||
|
||||
// Window exports
|
||||
Foundation.plugin(Orbit, 'Orbit');
|
||||
|
||||
}(jQuery);
|
||||
}(jQuery, window.Foundation);
|
||||
|
@ -1,7 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
|
||||
/**
|
||||
* ResponsiveMenu module.
|
||||
* @module foundation.responsiveMenu
|
||||
@ -11,8 +7,31 @@
|
||||
* @requires foundation.util.drilldown
|
||||
* @requires foundation.util.dropdown-menu
|
||||
*/
|
||||
!function(Foundation, $) {
|
||||
'use strict';
|
||||
|
||||
// The plugin matches the plugin classes with these plugin instances.
|
||||
var MenuPlugins = {
|
||||
dropdown: {
|
||||
cssClass: 'dropdown',
|
||||
plugin: Foundation._plugins['dropdown-menu'] || null
|
||||
},
|
||||
drilldown: {
|
||||
cssClass: 'drilldown',
|
||||
plugin: Foundation._plugins['drilldown'] || null
|
||||
},
|
||||
accordion: {
|
||||
cssClass: 'accordion-menu',
|
||||
plugin: Foundation._plugins['accordion-menu'] || null
|
||||
}
|
||||
};
|
||||
|
||||
// [PH] Media queries
|
||||
var phMedia = {
|
||||
small: '(min-width: 0px)',
|
||||
medium: '(min-width: 640px)'
|
||||
};
|
||||
|
||||
class ResponsiveMenu {
|
||||
/**
|
||||
* Creates a new instance of a responsive menu.
|
||||
* @class
|
||||
@ -20,7 +39,7 @@ class ResponsiveMenu {
|
||||
* @param {jQuery} element - jQuery object to make into a dropdown menu.
|
||||
* @param {Object} options - Overrides to the default plugin settings.
|
||||
*/
|
||||
constructor(element, options) {
|
||||
function ResponsiveMenu(element) {
|
||||
this.$element = $(element);
|
||||
this.rules = this.$element.data('responsive-menu');
|
||||
this.currentMq = null;
|
||||
@ -32,44 +51,43 @@ class ResponsiveMenu {
|
||||
Foundation.registerPlugin(this, 'ResponsiveMenu');
|
||||
}
|
||||
|
||||
ResponsiveMenu.defaults = {};
|
||||
|
||||
/**
|
||||
* Initializes the Menu by parsing the classes from the 'data-ResponsiveMenu' attribute on the element.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_init() {
|
||||
// The first time an Interchange plugin is initialized, this.rules is converted from a string of "classes" to an object of rules
|
||||
if (typeof this.rules === 'string') {
|
||||
let rulesTree = {};
|
||||
ResponsiveMenu.prototype._init = function() {
|
||||
var rulesTree = {};
|
||||
|
||||
// Parse rules from "classes" pulled from data attribute
|
||||
let rules = this.rules.split(' ');
|
||||
// Parse rules from "classes" in data attribute
|
||||
var rules = this.rules.split(' ');
|
||||
|
||||
// Iterate through every rule found
|
||||
for (let i = 0; i < rules.length; i++) {
|
||||
let rule = rules[i].split('-');
|
||||
let ruleSize = rule.length > 1 ? rule[0] : 'small';
|
||||
let rulePlugin = rule.length > 1 ? rule[1] : rule[0];
|
||||
// Iterate through every rule found
|
||||
for (var i = 0; i < rules.length; i++) {
|
||||
var rule = rules[i].split('-');
|
||||
var ruleSize = rule.length > 1 ? rule[0] : 'small';
|
||||
var rulePlugin = rule.length > 1 ? rule[1] : rule[0];
|
||||
|
||||
if (MenuPlugins[rulePlugin] !== null) {
|
||||
rulesTree[ruleSize] = MenuPlugins[rulePlugin];
|
||||
}
|
||||
if (MenuPlugins[rulePlugin] !== null) {
|
||||
rulesTree[ruleSize] = MenuPlugins[rulePlugin];
|
||||
}
|
||||
|
||||
this.rules = rulesTree;
|
||||
}
|
||||
|
||||
if (!$.isEmptyObject(this.rules)) {
|
||||
this.rules = rulesTree;
|
||||
|
||||
if (!$.isEmptyObject(rulesTree)) {
|
||||
this._checkMediaQueries();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes events for the Menu.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_events() {
|
||||
ResponsiveMenu.prototype._events = function() {
|
||||
var _this = this;
|
||||
|
||||
$(window).on('changed.zf.mediaquery', function() {
|
||||
@ -78,14 +96,14 @@ class ResponsiveMenu {
|
||||
// $(window).on('resize.zf.ResponsiveMenu', function() {
|
||||
// _this._checkMediaQueries();
|
||||
// });
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks the current screen width against available media queries. If the media query has changed, and the plugin needed has changed, the plugins will swap out.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_checkMediaQueries() {
|
||||
ResponsiveMenu.prototype._checkMediaQueries = function() {
|
||||
var matchedMq, _this = this;
|
||||
// Iterate through each rule and find the last matching rule
|
||||
$.each(this.rules, function(key) {
|
||||
@ -111,38 +129,17 @@ class ResponsiveMenu {
|
||||
// Create an instance of the new plugin
|
||||
if (this.currentPlugin) this.currentPlugin.destroy();
|
||||
this.currentPlugin = new this.rules[matchedMq].plugin(this.$element, {});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Destroys the instance of the current plugin on this element, as well as the window resize handler that switches the plugins out.
|
||||
* @function
|
||||
*/
|
||||
destroy() {
|
||||
ResponsiveMenu.prototype.destroy = function() {
|
||||
this.currentPlugin.destroy();
|
||||
$(window).off('.zf.ResponsiveMenu');
|
||||
Foundation.unregisterPlugin(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
Foundation.plugin(ResponsiveMenu, 'ResponsiveMenu');
|
||||
|
||||
ResponsiveMenu.defaults = {};
|
||||
|
||||
// The plugin matches the plugin classes with these plugin instances.
|
||||
var MenuPlugins = {
|
||||
dropdown: {
|
||||
cssClass: 'dropdown',
|
||||
plugin: Foundation._plugins['dropdown-menu'] || null
|
||||
},
|
||||
drilldown: {
|
||||
cssClass: 'drilldown',
|
||||
plugin: Foundation._plugins['drilldown'] || null
|
||||
},
|
||||
accordion: {
|
||||
cssClass: 'accordion-menu',
|
||||
plugin: Foundation._plugins['accordion-menu'] || null
|
||||
}
|
||||
};
|
||||
|
||||
// Window exports
|
||||
Foundation.plugin(ResponsiveMenu, 'ResponsiveMenu');
|
||||
|
||||
}(jQuery);
|
||||
}(Foundation, jQuery);
|
||||
|
@ -1,107 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
|
||||
/**
|
||||
* ResponsiveToggle module.
|
||||
* @module foundation.responsiveToggle
|
||||
* @requires foundation.util.mediaQuery
|
||||
*/
|
||||
!function($, Foundation) {
|
||||
|
||||
class ResponsiveToggle {
|
||||
/**
|
||||
* Creates a new instance of Tab Bar.
|
||||
* @class
|
||||
* @fires ResponsiveToggle#init
|
||||
* @param {jQuery} element - jQuery object to attach tab bar functionality to.
|
||||
* @param {Object} options - Overrides to the default plugin settings.
|
||||
*/
|
||||
constructor(element, options) {
|
||||
this.$element = $(element);
|
||||
this.options = $.extend({}, ResponsiveToggle.defaults, this.$element.data(), options);
|
||||
'use strict';
|
||||
|
||||
this._init();
|
||||
this._events();
|
||||
/**
|
||||
* Creates a new instance of Tab Bar.
|
||||
* @class
|
||||
* @fires ResponsiveToggle#init
|
||||
* @param {jQuery} element - jQuery object to attach tab bar functionality to.
|
||||
* @param {Object} options - Overrides to the default plugin settings.
|
||||
*/
|
||||
function ResponsiveToggle(element, options) {
|
||||
this.$element = $(element);
|
||||
this.options = $.extend({}, ResponsiveToggle.defaults, this.$element.data(), options);
|
||||
|
||||
Foundation.registerPlugin(this, 'ResponsiveToggle');
|
||||
}
|
||||
this._init();
|
||||
this._events();
|
||||
|
||||
/**
|
||||
* Initializes the tab bar by finding the target element, toggling element, and running update().
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_init() {
|
||||
var targetID = this.$element.data('responsive-toggle');
|
||||
if (!targetID) {
|
||||
console.error('Your tab bar needs an ID of a Menu as the value of data-tab-bar.');
|
||||
}
|
||||
|
||||
this.$targetMenu = $(`#${targetID}`);
|
||||
this.$toggler = this.$element.find('[data-toggle]');
|
||||
|
||||
this._update();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds necessary event handlers for the tab bar to work.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_events() {
|
||||
var _this = this;
|
||||
|
||||
this._updateMqHandler = this._update.bind(this);
|
||||
|
||||
$(window).on('changed.zf.mediaquery', this._updateMqHandler);
|
||||
|
||||
this.$toggler.on('click.zf.responsiveToggle', this.toggleMenu.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the current media query to determine if the tab bar should be visible or hidden.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_update() {
|
||||
// Mobile
|
||||
if (!Foundation.MediaQuery.atLeast(this.options.hideFor)) {
|
||||
this.$element.show();
|
||||
this.$targetMenu.hide();
|
||||
}
|
||||
|
||||
// Desktop
|
||||
else {
|
||||
this.$element.hide();
|
||||
this.$targetMenu.show();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the element attached to the tab bar. The toggle only happens if the screen is small enough to allow it.
|
||||
* @function
|
||||
* @fires ResponsiveToggle#toggled
|
||||
*/
|
||||
toggleMenu() {
|
||||
if (!Foundation.MediaQuery.atLeast(this.options.hideFor)) {
|
||||
this.$targetMenu.toggle(0);
|
||||
|
||||
/**
|
||||
* Fires when the element attached to the tab bar toggles.
|
||||
* @event ResponsiveToggle#toggled
|
||||
*/
|
||||
this.$element.trigger('toggled.zf.responsiveToggle');
|
||||
}
|
||||
};
|
||||
|
||||
destroy() {
|
||||
this.$element.off('.zf.responsiveToggle');
|
||||
this.$toggler.off('.zf.responsiveToggle');
|
||||
|
||||
$(window).off('changed.zf.mediaquery', this._updateMqHandler);
|
||||
|
||||
Foundation.unregisterPlugin(this);
|
||||
}
|
||||
Foundation.registerPlugin(this, 'ResponsiveToggle');
|
||||
}
|
||||
|
||||
ResponsiveToggle.defaults = {
|
||||
@ -113,7 +33,74 @@ ResponsiveToggle.defaults = {
|
||||
hideFor: 'medium'
|
||||
};
|
||||
|
||||
// Window exports
|
||||
/**
|
||||
* Initializes the tab bar by finding the target element, toggling element, and running update().
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
ResponsiveToggle.prototype._init = function() {
|
||||
var targetID = this.$element.data('responsive-toggle');
|
||||
if (!targetID) {
|
||||
console.error('Your tab bar needs an ID of a Menu as the value of data-tab-bar.');
|
||||
}
|
||||
|
||||
this.$targetMenu = $('#'+targetID);
|
||||
this.$toggler = this.$element.find('[data-toggle]');
|
||||
|
||||
this._update();
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds necessary event handlers for the tab bar to work.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
ResponsiveToggle.prototype._events = function() {
|
||||
var _this = this;
|
||||
|
||||
$(window).on('changed.zf.mediaquery', this._update.bind(this));
|
||||
|
||||
this.$toggler.on('click.zf.responsiveToggle', this.toggleMenu.bind(this));
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks the current media query to determine if the tab bar should be visible or hidden.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
ResponsiveToggle.prototype._update = function() {
|
||||
// Mobile
|
||||
if (!Foundation.MediaQuery.atLeast(this.options.hideFor)) {
|
||||
this.$element.show();
|
||||
this.$targetMenu.hide();
|
||||
}
|
||||
|
||||
// Desktop
|
||||
else {
|
||||
this.$element.hide();
|
||||
this.$targetMenu.show();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Toggles the element attached to the tab bar. The toggle only happens if the screen is small enough to allow it.
|
||||
* @function
|
||||
* @fires ResponsiveToggle#toggled
|
||||
*/
|
||||
ResponsiveToggle.prototype.toggleMenu = function() {
|
||||
if (!Foundation.MediaQuery.atLeast(this.options.hideFor)) {
|
||||
this.$targetMenu.toggle(0);
|
||||
|
||||
/**
|
||||
* Fires when the element attached to the tab bar toggles.
|
||||
* @event ResponsiveToggle#toggled
|
||||
*/
|
||||
this.$element.trigger('toggled.zf.responsiveToggle');
|
||||
}
|
||||
};
|
||||
ResponsiveToggle.prototype.destroy = function(){
|
||||
//TODO this...
|
||||
};
|
||||
Foundation.plugin(ResponsiveToggle, 'ResponsiveToggle');
|
||||
|
||||
}(jQuery);
|
||||
}(jQuery, Foundation);
|
||||
|
643
app/vendor/foundation/js/foundation.reveal.js
vendored
643
app/vendor/foundation/js/foundation.reveal.js
vendored
@ -1,7 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
|
||||
/**
|
||||
* Reveal module.
|
||||
* @module foundation.reveal
|
||||
@ -11,15 +7,17 @@
|
||||
* @requires foundation.util.mediaQuery
|
||||
* @requires foundation.util.motion if using animations
|
||||
*/
|
||||
!function(Foundation, $) {
|
||||
'use strict';
|
||||
|
||||
class Reveal {
|
||||
/**
|
||||
* Creates a new instance of Reveal.
|
||||
* @class
|
||||
* @param {jQuery} element - jQuery object to use for the modal.
|
||||
* @param {Object} options - optional parameters.
|
||||
*/
|
||||
constructor(element, options) {
|
||||
|
||||
function Reveal(element, options) {
|
||||
this.$element = element;
|
||||
this.options = $.extend({}, Reveal.defaults, this.$element.data(), options);
|
||||
this._init();
|
||||
@ -34,28 +32,115 @@ class Reveal {
|
||||
});
|
||||
}
|
||||
|
||||
Reveal.defaults = {
|
||||
/**
|
||||
* Motion-UI class to use for animated elements. If none used, defaults to simple show/hide.
|
||||
* @option
|
||||
* @example 'slide-in-left'
|
||||
*/
|
||||
animationIn: '',
|
||||
/**
|
||||
* Motion-UI class to use for animated elements. If none used, defaults to simple show/hide.
|
||||
* @option
|
||||
* @example 'slide-out-right'
|
||||
*/
|
||||
animationOut: '',
|
||||
/**
|
||||
* Time, in ms, to delay the opening of a modal after a click if no animation used.
|
||||
* @option
|
||||
* @example 10
|
||||
*/
|
||||
showDelay: 0,
|
||||
/**
|
||||
* Time, in ms, to delay the closing of a modal after a click if no animation used.
|
||||
* @option
|
||||
* @example 10
|
||||
*/
|
||||
hideDelay: 0,
|
||||
/**
|
||||
* Allows a click on the body/overlay to close the modal.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
closeOnClick: true,
|
||||
/**
|
||||
* Allows the modal to close if the user presses the `ESCAPE` key.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
closeOnEsc: true,
|
||||
/**
|
||||
* If true, allows multiple modals to be displayed at once.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
multipleOpened: false,
|
||||
/**
|
||||
* Distance, in pixels, the modal should push down from the top of the screen.
|
||||
* @option
|
||||
* @example 100
|
||||
*/
|
||||
vOffset: 100,
|
||||
/**
|
||||
* Distance, in pixels, the modal should push in from the side of the screen.
|
||||
* @option
|
||||
* @example 0
|
||||
*/
|
||||
hOffset: 0,
|
||||
/**
|
||||
* Allows the modal to be fullscreen, completely blocking out the rest of the view. JS checks for this as well.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
fullScreen: false,
|
||||
/**
|
||||
* Percentage of screen height the modal should push up from the bottom of the view.
|
||||
* @option
|
||||
* @example 10
|
||||
*/
|
||||
btmOffsetPct: 10,
|
||||
/**
|
||||
* Allows the modal to generate an overlay div, which will cover the view when modal opens.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
overlay: true,
|
||||
/**
|
||||
* Allows the modal to remove and reinject markup on close. Should be true if using video elements w/o using provider's api.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
resetOnClose: false
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes the modal by adding the overlay and close buttons, (if selected).
|
||||
* @private
|
||||
*/
|
||||
_init() {
|
||||
Reveal.prototype._init = function(){
|
||||
this.id = this.$element.attr('id');
|
||||
this.isActive = false;
|
||||
this.cached = {mq: Foundation.MediaQuery.current};
|
||||
this.isMobile = mobileSniff();
|
||||
|
||||
this.$anchor = $(`[data-open="${this.id}"]`).length ? $(`[data-open="${this.id}"]`) : $(`[data-toggle="${this.id}"]`);
|
||||
this.$anchor.attr({
|
||||
'aria-controls': this.id,
|
||||
'aria-haspopup': true,
|
||||
'tabindex': 0
|
||||
});
|
||||
this.$anchor = $('[data-open="' + this.id + '"]').length ? $('[data-open="' + this.id + '"]') : $('[data-toggle="' + this.id + '"]');
|
||||
|
||||
if (this.options.fullScreen || this.$element.hasClass('full')) {
|
||||
if(this.$anchor.length){
|
||||
var anchorId = this.$anchor[0].id || Foundation.GetYoDigits(6, 'reveal');
|
||||
|
||||
this.$anchor.attr({
|
||||
'aria-controls': this.id,
|
||||
'id': anchorId,
|
||||
'aria-haspopup': true,
|
||||
'tabindex': 0
|
||||
});
|
||||
this.$element.attr({'aria-labelledby': anchorId});
|
||||
}
|
||||
|
||||
// this.options.fullScreen = this.$element.hasClass('full');
|
||||
if(this.options.fullScreen || this.$element.hasClass('full')){
|
||||
this.options.fullScreen = true;
|
||||
this.options.overlay = false;
|
||||
}
|
||||
if (this.options.overlay && !this.$overlay) {
|
||||
if(this.options.overlay && !this.$overlay){
|
||||
this.$overlay = this._makeOverlay(this.id);
|
||||
}
|
||||
|
||||
@ -66,88 +151,47 @@ class Reveal {
|
||||
'data-resize': this.id
|
||||
});
|
||||
|
||||
if(this.$overlay) {
|
||||
this.$element.detach().appendTo(this.$overlay);
|
||||
} else {
|
||||
this.$element.detach().appendTo($('body'));
|
||||
this.$element.addClass('without-overlay');
|
||||
}
|
||||
this._events();
|
||||
if (this.options.deepLink && window.location.hash === ( `#${this.id}`)) {
|
||||
$(window).one('load.zf.reveal', this.open.bind(this));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates an overlay div to display behind the modal.
|
||||
* @private
|
||||
*/
|
||||
_makeOverlay(id) {
|
||||
Reveal.prototype._makeOverlay = function(id){
|
||||
var $overlay = $('<div></div>')
|
||||
.addClass('reveal-overlay')
|
||||
.attr({'tabindex': -1, 'aria-hidden': true})
|
||||
.appendTo('body');
|
||||
if(this.options.closeOnClick){
|
||||
$overlay.attr({
|
||||
'data-close': id
|
||||
});
|
||||
}
|
||||
return $overlay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates position of modal
|
||||
* TODO: Figure out if we actually need to cache these values or if it doesn't matter
|
||||
* @private
|
||||
*/
|
||||
_updatePosition() {
|
||||
var width = this.$element.outerWidth();
|
||||
var outerWidth = $(window).width();
|
||||
var height = this.$element.outerHeight();
|
||||
var outerHeight = $(window).height();
|
||||
var left, top;
|
||||
if (this.options.hOffset === 'auto') {
|
||||
left = parseInt((outerWidth - width) / 2, 10);
|
||||
} else {
|
||||
left = parseInt(this.options.hOffset, 10);
|
||||
}
|
||||
if (this.options.vOffset === 'auto') {
|
||||
if (height > outerHeight) {
|
||||
top = parseInt(Math.min(100, outerHeight / 10), 10);
|
||||
} else {
|
||||
top = parseInt((outerHeight - height) / 4, 10);
|
||||
}
|
||||
} else {
|
||||
top = parseInt(this.options.vOffset, 10);
|
||||
}
|
||||
this.$element.css({top: top + 'px'});
|
||||
// only worry about left if we don't have an overlay or we havea horizontal offset,
|
||||
// otherwise we're perfectly in the middle
|
||||
if(!this.$overlay || (this.options.hOffset !== 'auto')) {
|
||||
this.$element.css({left: left + 'px'});
|
||||
this.$element.css({margin: '0px'});
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds event handlers for the modal.
|
||||
* @private
|
||||
*/
|
||||
_events() {
|
||||
Reveal.prototype._events = function(){
|
||||
var _this = this;
|
||||
|
||||
this.$element.on({
|
||||
'open.zf.trigger': this.open.bind(this),
|
||||
'close.zf.trigger': (event, $element) => {
|
||||
if ((event.target === _this.$element[0]) ||
|
||||
($(event.target).parents('[data-closable]')[0] === $element)) { // only close reveal when it's explicitly called
|
||||
return this.close.apply(this);
|
||||
}
|
||||
},
|
||||
'close.zf.trigger': this.close.bind(this),
|
||||
'toggle.zf.trigger': this.toggle.bind(this),
|
||||
'resizeme.zf.trigger': function() {
|
||||
_this._updatePosition();
|
||||
'resizeme.zf.trigger': function(){
|
||||
if(_this.$element.is(':visible')){
|
||||
_this._setPosition(function(){});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (this.$anchor.length) {
|
||||
this.$anchor.on('keydown.zf.reveal', function(e) {
|
||||
if (e.which === 13 || e.which === 32) {
|
||||
if(this.$anchor.length){
|
||||
this.$anchor.on('keydown.zf.reveal', function(e){
|
||||
if(e.which === 13 || e.which === 32){
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
_this.open();
|
||||
@ -155,30 +199,49 @@ class Reveal {
|
||||
});
|
||||
}
|
||||
|
||||
if (this.options.closeOnClick && this.options.overlay) {
|
||||
this.$overlay.off('.zf.reveal').on('click.zf.reveal', function(e) {
|
||||
if (e.target === _this.$element[0] ||
|
||||
$.contains(_this.$element[0], e.target) ||
|
||||
!$.contains(document, e.target)) {
|
||||
return;
|
||||
}
|
||||
_this.close();
|
||||
});
|
||||
}
|
||||
if (this.options.deepLink) {
|
||||
$(window).on(`popstate.zf.reveal:${this.id}`, this._handleState.bind(this));
|
||||
}
|
||||
}
|
||||
|
||||
if(this.options.closeOnClick && this.options.overlay){
|
||||
this.$overlay.off('.zf.reveal').on('click.zf.reveal', this.close.bind(this));
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Handles modal methods on back/forward button clicks or any other event that triggers popstate.
|
||||
* Sets the position of the modal before opening
|
||||
* @param {Function} cb - a callback function to execute when positioning is complete.
|
||||
* @private
|
||||
*/
|
||||
_handleState(e) {
|
||||
if(window.location.hash === ( '#' + this.id) && !this.isActive){ this.open(); }
|
||||
else{ this.close(); }
|
||||
}
|
||||
Reveal.prototype._setPosition = function(cb){
|
||||
var eleDims = Foundation.Box.GetDimensions(this.$element);
|
||||
var elePos = this.options.fullScreen ? 'reveal full' : (eleDims.height >= (0.5 * eleDims.windowDims.height)) ? 'reveal' : 'center';
|
||||
|
||||
if(elePos === 'reveal full'){
|
||||
//set to full height/width
|
||||
this.$element
|
||||
.offset(Foundation.Box.GetOffsets(this.$element, null, elePos, this.options.vOffset))
|
||||
.css({
|
||||
'height': eleDims.windowDims.height,
|
||||
'width': eleDims.windowDims.width
|
||||
});
|
||||
}else if(!Foundation.MediaQuery.atLeast('medium') || !Foundation.Box.ImNotTouchingYou(this.$element, null, true, false)){
|
||||
//if smaller than medium, resize to 100% width minus any custom L/R margin
|
||||
this.$element
|
||||
.css({
|
||||
'width': eleDims.windowDims.width - (this.options.hOffset * 2)
|
||||
})
|
||||
.offset(Foundation.Box.GetOffsets(this.$element, null, 'center', this.options.vOffset, this.options.hOffset));
|
||||
//flag a boolean so we can reset the size after the element is closed.
|
||||
this.changedSize = true;
|
||||
}else{
|
||||
this.$element
|
||||
.css({
|
||||
'max-height': eleDims.windowDims.height - (this.options.vOffset * (this.options.btmOffsetPct / 100 + 1)),
|
||||
'width': ''
|
||||
})
|
||||
.offset(Foundation.Box.GetOffsets(this.$element, null, elePos, this.options.vOffset));
|
||||
//the max height based on a percentage of vertical offset plus vertical offset
|
||||
}
|
||||
|
||||
cb();
|
||||
};
|
||||
|
||||
/**
|
||||
* Opens the modal controlled by `this.$anchor`, and closes all others by default.
|
||||
@ -186,125 +249,84 @@ class Reveal {
|
||||
* @fires Reveal#closeme
|
||||
* @fires Reveal#open
|
||||
*/
|
||||
open() {
|
||||
if (this.options.deepLink) {
|
||||
var hash = `#${this.id}`;
|
||||
|
||||
if (window.history.pushState) {
|
||||
window.history.pushState(null, null, hash);
|
||||
} else {
|
||||
window.location.hash = hash;
|
||||
}
|
||||
}
|
||||
|
||||
Reveal.prototype.open = function(){
|
||||
var _this = this;
|
||||
this.isActive = true;
|
||||
|
||||
// Make elements invisible, but remove display: none so we can get size and positioning
|
||||
//make element invisible, but remove display: none so we can get size and positioning
|
||||
this.$element
|
||||
.css({ 'visibility': 'hidden' })
|
||||
.css({'visibility': 'hidden'})
|
||||
.show()
|
||||
.scrollTop(0);
|
||||
if (this.options.overlay) {
|
||||
this.$overlay.css({'visibility': 'hidden'}).show();
|
||||
}
|
||||
|
||||
this._updatePosition();
|
||||
|
||||
this.$element
|
||||
.hide()
|
||||
.css({ 'visibility': '' });
|
||||
|
||||
if(this.$overlay) {
|
||||
this.$overlay.css({'visibility': ''}).hide();
|
||||
if(this.$element.hasClass('fast')) {
|
||||
this.$overlay.addClass('fast');
|
||||
} else if (this.$element.hasClass('slow')) {
|
||||
this.$overlay.addClass('slow');
|
||||
this._setPosition(function(){
|
||||
_this.$element.hide()
|
||||
.css({'visibility': ''});
|
||||
if(!_this.options.multipleOpened){
|
||||
/**
|
||||
* Fires immediately before the modal opens.
|
||||
* Closes any other modals that are currently open
|
||||
* @event Reveal#closeme
|
||||
*/
|
||||
_this.$element.trigger('closeme.zf.reveal', _this.id);
|
||||
}
|
||||
}
|
||||
if(_this.options.animationIn){
|
||||
if(_this.options.overlay){
|
||||
Foundation.Motion.animateIn(_this.$overlay, 'fade-in', function(){
|
||||
Foundation.Motion.animateIn(_this.$element, _this.options.animationIn, function(){
|
||||
_this.focusableElements = Foundation.Keyboard.findFocusable(_this.$element);
|
||||
});
|
||||
});
|
||||
}else{
|
||||
Foundation.Motion.animateIn(_this.$element, _this.options.animationIn, function(){
|
||||
_this.focusableElements = Foundation.Keyboard.findFocusable(_this.$element);
|
||||
});
|
||||
}
|
||||
}else{
|
||||
if(_this.options.overlay){
|
||||
_this.$overlay.show(0, function(){
|
||||
_this.$element.show(_this.options.showDelay, function(){
|
||||
});
|
||||
});
|
||||
}else{
|
||||
_this.$element.show(_this.options.showDelay, function(){
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (!this.options.multipleOpened) {
|
||||
/**
|
||||
* Fires immediately before the modal opens.
|
||||
* Closes any other modals that are currently open
|
||||
* @event Reveal#closeme
|
||||
*/
|
||||
this.$element.trigger('closeme.zf.reveal', this.id);
|
||||
}
|
||||
// Motion UI method of reveal
|
||||
if (this.options.animationIn) {
|
||||
var _this = this;
|
||||
function afterAnimationFocus(){
|
||||
_this.$element
|
||||
.attr({
|
||||
'aria-hidden': false,
|
||||
'tabindex': -1
|
||||
})
|
||||
.focus();
|
||||
}
|
||||
if (this.options.overlay) {
|
||||
Foundation.Motion.animateIn(this.$overlay, 'fade-in');
|
||||
}
|
||||
Foundation.Motion.animateIn(this.$element, this.options.animationIn, () => {
|
||||
this.focusableElements = Foundation.Keyboard.findFocusable(this.$element);
|
||||
afterAnimationFocus();
|
||||
});
|
||||
}
|
||||
// jQuery method of reveal
|
||||
else {
|
||||
if (this.options.overlay) {
|
||||
this.$overlay.show(0);
|
||||
}
|
||||
this.$element.show(this.options.showDelay);
|
||||
}
|
||||
|
||||
// handle accessibility
|
||||
this.$element
|
||||
.attr({
|
||||
'aria-hidden': false,
|
||||
'tabindex': -1
|
||||
})
|
||||
.focus();
|
||||
|
||||
this.$element.attr({'aria-hidden': false}).attr('tabindex', -1).focus()
|
||||
/**
|
||||
* Fires when the modal has successfully opened.
|
||||
* @event Reveal#open
|
||||
*/
|
||||
this.$element.trigger('open.zf.reveal');
|
||||
.trigger('open.zf.reveal');
|
||||
|
||||
if (this.isMobile) {
|
||||
this.originalScrollPos = window.pageYOffset;
|
||||
$('html, body').addClass('is-reveal-open');
|
||||
}
|
||||
else {
|
||||
$('body').addClass('is-reveal-open');
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
this._extraHandlers();
|
||||
$('body').addClass('is-reveal-open')
|
||||
.attr({'aria-hidden': (this.options.overlay || this.options.fullScreen) ? true : false});
|
||||
setTimeout(function(){
|
||||
_this._extraHandlers();
|
||||
// Foundation.reflow();
|
||||
}, 0);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds extra event handlers for the body and window if necessary.
|
||||
* @private
|
||||
*/
|
||||
_extraHandlers() {
|
||||
Reveal.prototype._extraHandlers = function(){
|
||||
var _this = this;
|
||||
this.focusableElements = Foundation.Keyboard.findFocusable(this.$element);
|
||||
|
||||
if (!this.options.overlay && this.options.closeOnClick && !this.options.fullScreen) {
|
||||
$('body').on('click.zf.reveal', function(e) {
|
||||
if (e.target === _this.$element[0] ||
|
||||
$.contains(_this.$element[0], e.target) ||
|
||||
!$.contains(document, e.target)) { return; }
|
||||
_this.close();
|
||||
if(!this.options.overlay && this.options.closeOnClick && !this.options.fullScreen){
|
||||
$('body').on('click.zf.reveal', function(e){
|
||||
// if()
|
||||
_this.close();
|
||||
});
|
||||
}
|
||||
|
||||
if (this.options.closeOnEsc) {
|
||||
$(window).on('keydown.zf.reveal', function(e) {
|
||||
if(this.options.closeOnEsc){
|
||||
$(window).on('keydown.zf.reveal', function(e){
|
||||
Foundation.Keyboard.handleKey(e, 'Reveal', {
|
||||
close: function() {
|
||||
if (_this.options.closeOnEsc) {
|
||||
@ -313,6 +335,9 @@ class Reveal {
|
||||
}
|
||||
}
|
||||
});
|
||||
if (_this.focusableElements.length === 0) { // no focusable elements inside the modal at all, prevent tabbing in general
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -322,23 +347,15 @@ class Reveal {
|
||||
// handle keyboard event with keyboard util
|
||||
Foundation.Keyboard.handleKey(e, 'Reveal', {
|
||||
tab_forward: function() {
|
||||
_this.focusableElements = Foundation.Keyboard.findFocusable(_this.$element);
|
||||
if (_this.$element.find(':focus').is(_this.focusableElements.eq(-1))) { // left modal downwards, setting focus to first element
|
||||
_this.focusableElements.eq(0).focus();
|
||||
return true;
|
||||
}
|
||||
if (_this.focusableElements.length === 0) { // no focusable elements inside the modal at all, prevent tabbing in general
|
||||
return true;
|
||||
e.preventDefault();
|
||||
}
|
||||
},
|
||||
tab_backward: function() {
|
||||
_this.focusableElements = Foundation.Keyboard.findFocusable(_this.$element);
|
||||
if (_this.$element.find(':focus').is(_this.focusableElements.eq(0)) || _this.$element.is(':focus')) { // left modal upwards, setting focus to last element
|
||||
_this.focusableElements.eq(-1).focus();
|
||||
return true;
|
||||
}
|
||||
if (_this.focusableElements.length === 0) { // no focusable elements inside the modal at all, prevent tabbing in general
|
||||
return true;
|
||||
e.preventDefault();
|
||||
}
|
||||
},
|
||||
open: function() {
|
||||
@ -355,108 +372,81 @@ class Reveal {
|
||||
_this.close();
|
||||
_this.$anchor.focus();
|
||||
}
|
||||
},
|
||||
handled: function(preventDefault) {
|
||||
if (preventDefault) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Closes the modal.
|
||||
* @function
|
||||
* @fires Reveal#closed
|
||||
*/
|
||||
close() {
|
||||
if (!this.isActive || !this.$element.is(':visible')) {
|
||||
Reveal.prototype.close = function(){
|
||||
if(!this.isActive || !this.$element.is(':visible')){
|
||||
return false;
|
||||
}
|
||||
var _this = this;
|
||||
|
||||
// Motion UI method of hiding
|
||||
if (this.options.animationOut) {
|
||||
if (this.options.overlay) {
|
||||
Foundation.Motion.animateOut(this.$overlay, 'fade-out', finishUp);
|
||||
}
|
||||
else {
|
||||
finishUp();
|
||||
}
|
||||
|
||||
Foundation.Motion.animateOut(this.$element, this.options.animationOut);
|
||||
if(this.options.animationOut){
|
||||
Foundation.Motion.animateOut(this.$element, this.options.animationOut, function(){
|
||||
if(_this.options.overlay){
|
||||
Foundation.Motion.animateOut(_this.$overlay, 'fade-out', function(){
|
||||
});
|
||||
}
|
||||
});
|
||||
}else{
|
||||
this.$element.hide(_this.options.hideDelay, function(){
|
||||
if(_this.options.overlay){
|
||||
_this.$overlay.hide(0, function(){
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// jQuery method of hiding
|
||||
else {
|
||||
if (this.options.overlay) {
|
||||
this.$overlay.hide(0, finishUp);
|
||||
}
|
||||
else {
|
||||
finishUp();
|
||||
}
|
||||
|
||||
this.$element.hide(this.options.hideDelay);
|
||||
}
|
||||
|
||||
// Conditionals to remove extra event listeners added on open
|
||||
if (this.options.closeOnEsc) {
|
||||
//conditionals to remove extra event listeners added on open
|
||||
if(this.options.closeOnEsc){
|
||||
$(window).off('keydown.zf.reveal');
|
||||
}
|
||||
|
||||
if (!this.options.overlay && this.options.closeOnClick) {
|
||||
if(!this.options.overlay && this.options.closeOnClick){
|
||||
$('body').off('click.zf.reveal');
|
||||
}
|
||||
|
||||
this.$element.off('keydown.zf.reveal');
|
||||
|
||||
function finishUp() {
|
||||
if (_this.isMobile) {
|
||||
$('html, body').removeClass('is-reveal-open');
|
||||
if(_this.originalScrollPos) {
|
||||
$('body').scrollTop(_this.originalScrollPos);
|
||||
_this.originalScrollPos = null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$('body').removeClass('is-reveal-open');
|
||||
}
|
||||
|
||||
_this.$element.attr('aria-hidden', true);
|
||||
|
||||
/**
|
||||
* Fires when the modal is done closing.
|
||||
* @event Reveal#closed
|
||||
*/
|
||||
_this.$element.trigger('closed.zf.reveal');
|
||||
//if the modal changed size, reset it
|
||||
if(this.changedSize){
|
||||
this.$element.css({
|
||||
'height': '',
|
||||
'width': ''
|
||||
});
|
||||
}
|
||||
|
||||
$('body').removeClass('is-reveal-open').attr({'aria-hidden': false, 'tabindex': ''});
|
||||
|
||||
/**
|
||||
* Resets the modal content
|
||||
* This prevents a running video to keep going in the background
|
||||
*/
|
||||
if (this.options.resetOnClose) {
|
||||
if(this.options.resetOnClose) {
|
||||
this.$element.html(this.$element.html());
|
||||
}
|
||||
|
||||
this.isActive = false;
|
||||
if (_this.options.deepLink) {
|
||||
if (window.history.replaceState) {
|
||||
window.history.replaceState("", document.title, window.location.pathname);
|
||||
} else {
|
||||
window.location.hash = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.$element.attr({'aria-hidden': true})
|
||||
/**
|
||||
* Fires when the modal is done closing.
|
||||
* @event Reveal#closed
|
||||
*/
|
||||
.trigger('closed.zf.reveal');
|
||||
};
|
||||
/**
|
||||
* Toggles the open/closed state of a modal.
|
||||
* @function
|
||||
*/
|
||||
toggle() {
|
||||
if (this.isActive) {
|
||||
Reveal.prototype.toggle = function(){
|
||||
if(this.isActive){
|
||||
this.close();
|
||||
} else {
|
||||
}else{
|
||||
this.open();
|
||||
}
|
||||
};
|
||||
@ -465,119 +455,24 @@ class Reveal {
|
||||
* Destroys an instance of a modal.
|
||||
* @function
|
||||
*/
|
||||
destroy() {
|
||||
if (this.options.overlay) {
|
||||
this.$element.appendTo($('body')); // move $element outside of $overlay to prevent error unregisterPlugin()
|
||||
Reveal.prototype.destroy = function() {
|
||||
if(this.options.overlay){
|
||||
this.$overlay.hide().off().remove();
|
||||
}
|
||||
this.$element.hide().off();
|
||||
this.$anchor.off('.zf');
|
||||
$(window).off(`.zf.reveal:${this.id}`);
|
||||
this.$element.hide();
|
||||
this.$anchor.off();
|
||||
|
||||
Foundation.unregisterPlugin(this);
|
||||
};
|
||||
}
|
||||
|
||||
Reveal.defaults = {
|
||||
/**
|
||||
* Motion-UI class to use for animated elements. If none used, defaults to simple show/hide.
|
||||
* @option
|
||||
* @example 'slide-in-left'
|
||||
*/
|
||||
animationIn: '',
|
||||
/**
|
||||
* Motion-UI class to use for animated elements. If none used, defaults to simple show/hide.
|
||||
* @option
|
||||
* @example 'slide-out-right'
|
||||
*/
|
||||
animationOut: '',
|
||||
/**
|
||||
* Time, in ms, to delay the opening of a modal after a click if no animation used.
|
||||
* @option
|
||||
* @example 10
|
||||
*/
|
||||
showDelay: 0,
|
||||
/**
|
||||
* Time, in ms, to delay the closing of a modal after a click if no animation used.
|
||||
* @option
|
||||
* @example 10
|
||||
*/
|
||||
hideDelay: 0,
|
||||
/**
|
||||
* Allows a click on the body/overlay to close the modal.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
closeOnClick: true,
|
||||
/**
|
||||
* Allows the modal to close if the user presses the `ESCAPE` key.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
closeOnEsc: true,
|
||||
/**
|
||||
* If true, allows multiple modals to be displayed at once.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
multipleOpened: false,
|
||||
/**
|
||||
* Distance, in pixels, the modal should push down from the top of the screen.
|
||||
* @option
|
||||
* @example auto
|
||||
*/
|
||||
vOffset: 'auto',
|
||||
/**
|
||||
* Distance, in pixels, the modal should push in from the side of the screen.
|
||||
* @option
|
||||
* @example auto
|
||||
*/
|
||||
hOffset: 'auto',
|
||||
/**
|
||||
* Allows the modal to be fullscreen, completely blocking out the rest of the view. JS checks for this as well.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
fullScreen: false,
|
||||
/**
|
||||
* Percentage of screen height the modal should push up from the bottom of the view.
|
||||
* @option
|
||||
* @example 10
|
||||
*/
|
||||
btmOffsetPct: 10,
|
||||
/**
|
||||
* Allows the modal to generate an overlay div, which will cover the view when modal opens.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
overlay: true,
|
||||
/**
|
||||
* Allows the modal to remove and reinject markup on close. Should be true if using video elements w/o using provider's api, otherwise, videos will continue to play in the background.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
resetOnClose: false,
|
||||
/**
|
||||
* Allows the modal to alter the url on open/close, and allows the use of the `back` button to close modals. ALSO, allows a modal to auto-maniacally open on page load IF the hash === the modal's user-set id.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
deepLink: false
|
||||
};
|
||||
Foundation.plugin(Reveal, 'Reveal');
|
||||
|
||||
// Window exports
|
||||
Foundation.plugin(Reveal, 'Reveal');
|
||||
// Exports for AMD/Browserify
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined')
|
||||
module.exports = Reveal;
|
||||
if (typeof define === 'function')
|
||||
define(['foundation'], function() {
|
||||
return Reveal;
|
||||
});
|
||||
|
||||
function iPhoneSniff() {
|
||||
return /iP(ad|hone|od).*OS/.test(window.navigator.userAgent);
|
||||
}
|
||||
|
||||
function androidSniff() {
|
||||
return /Android/.test(window.navigator.userAgent);
|
||||
}
|
||||
|
||||
function mobileSniff() {
|
||||
return iPhoneSniff() || androidSniff();
|
||||
}
|
||||
|
||||
}(jQuery);
|
||||
}(Foundation, jQuery);
|
||||
|
587
app/vendor/foundation/js/foundation.slider.js
vendored
587
app/vendor/foundation/js/foundation.slider.js
vendored
@ -1,7 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
|
||||
/**
|
||||
* Slider module.
|
||||
* @module foundation.slider
|
||||
@ -10,15 +6,16 @@
|
||||
* @requires foundation.util.keyboard
|
||||
* @requires foundation.util.touch
|
||||
*/
|
||||
!function($, Foundation){
|
||||
'use strict';
|
||||
|
||||
class Slider {
|
||||
/**
|
||||
* Creates a new instance of a drilldown menu.
|
||||
* @class
|
||||
* @param {jQuery} element - jQuery object to make into an accordion menu.
|
||||
* @param {Object} options - Overrides to the default plugin settings.
|
||||
*/
|
||||
constructor(element, options) {
|
||||
function Slider(element, options){
|
||||
this.$element = element;
|
||||
this.options = $.extend({}, Slider.defaults, this.$element.data(), options);
|
||||
|
||||
@ -45,56 +42,148 @@ class Slider {
|
||||
});
|
||||
}
|
||||
|
||||
Slider.defaults = {
|
||||
/**
|
||||
* Minimum value for the slider scale.
|
||||
* @option
|
||||
* @example 0
|
||||
*/
|
||||
start: 0,
|
||||
/**
|
||||
* Maximum value for the slider scale.
|
||||
* @option
|
||||
* @example 100
|
||||
*/
|
||||
end: 100,
|
||||
/**
|
||||
* Minimum value change per change event. Not Currently Implemented!
|
||||
|
||||
*/
|
||||
step: 1,
|
||||
/**
|
||||
* Value at which the handle/input *(left handle/first input)* should be set to on initialization.
|
||||
* @option
|
||||
* @example 0
|
||||
*/
|
||||
initialStart: 0,
|
||||
/**
|
||||
* Value at which the right handle/second input should be set to on initialization.
|
||||
* @option
|
||||
* @example 100
|
||||
*/
|
||||
initialEnd: 100,
|
||||
/**
|
||||
* Allows the input to be located outside the container and visible. Set to by the JS
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
binding: false,
|
||||
/**
|
||||
* Allows the user to click/tap on the slider bar to select a value.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
clickSelect: true,
|
||||
/**
|
||||
* Set to true and use the `vertical` class to change alignment to vertical.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
vertical: false,
|
||||
/**
|
||||
* Allows the user to drag the slider handle(s) to select a value.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
draggable: true,
|
||||
/**
|
||||
* Disables the slider and prevents event listeners from being applied. Double checked by JS with `disabledClass`.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
disabled: false,
|
||||
/**
|
||||
* Allows the use of two handles. Double checked by the JS. Changes some logic handling.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
doubleSided: false,
|
||||
/**
|
||||
* Potential future feature.
|
||||
*/
|
||||
// steps: 100,
|
||||
/**
|
||||
* Number of decimal places the plugin should go to for floating point precision.
|
||||
* @option
|
||||
* @example 2
|
||||
*/
|
||||
decimal: 2,
|
||||
/**
|
||||
* Time delay for dragged elements.
|
||||
*/
|
||||
// dragDelay: 0,
|
||||
/**
|
||||
* Time, in ms, to animate the movement of a slider handle if user clicks/taps on the bar. Needs to be manually set if updating the transition time in the Sass settings.
|
||||
* @option
|
||||
* @example 200
|
||||
*/
|
||||
moveTime: 200,//update this if changing the transition time in the sass
|
||||
/**
|
||||
* Class applied to disabled sliders.
|
||||
* @option
|
||||
* @example 'disabled'
|
||||
*/
|
||||
disabledClass: 'disabled'
|
||||
};
|
||||
/**
|
||||
* Initilizes the plugin by reading/setting attributes, creating collections and setting the initial position of the handle(s).
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_init() {
|
||||
Slider.prototype._init = function(){
|
||||
this.inputs = this.$element.find('input');
|
||||
this.handles = this.$element.find('[data-slider-handle]');
|
||||
|
||||
this.$handle = this.handles.eq(0);
|
||||
this.$input = this.inputs.length ? this.inputs.eq(0) : $(`#${this.$handle.attr('aria-controls')}`);
|
||||
this.$input = this.inputs.length ? this.inputs.eq(0) : $('#' + this.$handle.attr('aria-controls'));
|
||||
this.$fill = this.$element.find('[data-slider-fill]').css(this.options.vertical ? 'height' : 'width', 0);
|
||||
|
||||
var isDbl = false,
|
||||
_this = this;
|
||||
if (this.options.disabled || this.$element.hasClass(this.options.disabledClass)) {
|
||||
if(this.options.disabled || this.$element.hasClass(this.options.disabledClass)){
|
||||
this.options.disabled = true;
|
||||
this.$element.addClass(this.options.disabledClass);
|
||||
}
|
||||
if (!this.inputs.length) {
|
||||
if(!this.inputs.length){
|
||||
this.inputs = $().add(this.$input);
|
||||
this.options.binding = true;
|
||||
}
|
||||
this._setInitAttr(0);
|
||||
this._events(this.$handle);
|
||||
|
||||
if (this.handles[1]) {
|
||||
if(this.handles[1]){
|
||||
this.options.doubleSided = true;
|
||||
this.$handle2 = this.handles.eq(1);
|
||||
this.$input2 = this.inputs.length > 1 ? this.inputs.eq(1) : $(`#${this.$handle2.attr('aria-controls')}`);
|
||||
this.$input2 = this.inputs.length > 1 ? this.inputs.eq(1) : $('#' + this.$handle2.attr('aria-controls'));
|
||||
|
||||
if (!this.inputs[1]) {
|
||||
if(!this.inputs[1]){
|
||||
this.inputs = this.inputs.add(this.$input2);
|
||||
}
|
||||
isDbl = true;
|
||||
|
||||
this._setHandlePos(this.$handle, this.options.initialStart, true, function() {
|
||||
this._setHandlePos(this.$handle, this.options.initialStart, true, function(){
|
||||
|
||||
_this._setHandlePos(_this.$handle2, _this.options.initialEnd, true);
|
||||
_this._setHandlePos(_this.$handle2, _this.options.initialEnd);
|
||||
});
|
||||
// this.$handle.triggerHandler('click.zf.slider');
|
||||
this._setInitAttr(1);
|
||||
this._events(this.$handle2);
|
||||
}
|
||||
|
||||
if (!isDbl) {
|
||||
if(!isDbl){
|
||||
this._setHandlePos(this.$handle, this.options.initialStart, true);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Sets the position of the selected handle and fill bar.
|
||||
* @function
|
||||
@ -103,131 +192,93 @@ class Slider {
|
||||
* @param {Number} location - floating point between the start and end values of the slider bar.
|
||||
* @param {Function} cb - callback function to fire on completion.
|
||||
* @fires Slider#moved
|
||||
* @fires Slider#changed
|
||||
*/
|
||||
_setHandlePos($hndl, location, noInvert, cb) {
|
||||
// don't move if the slider has been disabled since its initialization
|
||||
if (this.$element.hasClass(this.options.disabledClass)) {
|
||||
return;
|
||||
}
|
||||
//might need to alter that slightly for bars that will have odd number selections.
|
||||
Slider.prototype._setHandlePos = function($hndl, location, noInvert, cb){
|
||||
//might need to alter that slightly for bars that will have odd number selections.
|
||||
location = parseFloat(location);//on input change events, convert string to number...grumble.
|
||||
// prevent slider from running out of bounds
|
||||
if(location < this.options.start){ location = this.options.start; }
|
||||
else if(location > this.options.end){ location = this.options.end; }
|
||||
|
||||
// prevent slider from running out of bounds, if value exceeds the limits set through options, override the value to min/max
|
||||
if (location < this.options.start) { location = this.options.start; }
|
||||
else if (location > this.options.end) { location = this.options.end; }
|
||||
var isDbl = this.options.doubleSided,
|
||||
callback = cb || null;
|
||||
|
||||
var isDbl = this.options.doubleSided;
|
||||
|
||||
if (isDbl) { //this block is to prevent 2 handles from crossing eachother. Could/should be improved.
|
||||
if (this.handles.index($hndl) === 0) {
|
||||
if(isDbl){
|
||||
if(this.handles.index($hndl) === 0){
|
||||
var h2Val = parseFloat(this.$handle2.attr('aria-valuenow'));
|
||||
location = location >= h2Val ? h2Val - this.options.step : location;
|
||||
} else {
|
||||
}else{
|
||||
var h1Val = parseFloat(this.$handle.attr('aria-valuenow'));
|
||||
location = location <= h1Val ? h1Val + this.options.step : location;
|
||||
}
|
||||
}
|
||||
|
||||
//this is for single-handled vertical sliders, it adjusts the value to account for the slider being "upside-down"
|
||||
//for click and drag events, it's weird due to the scale(-1, 1) css property
|
||||
if (this.options.vertical && !noInvert) {
|
||||
if(this.options.vertical && !noInvert){
|
||||
location = this.options.end - location;
|
||||
}
|
||||
|
||||
var _this = this,
|
||||
vert = this.options.vertical,
|
||||
hOrW = vert ? 'height' : 'width',
|
||||
lOrT = vert ? 'top' : 'left',
|
||||
handleDim = $hndl[0].getBoundingClientRect()[hOrW],
|
||||
halfOfHandle = $hndl[0].getBoundingClientRect()[hOrW] / 2,
|
||||
elemDim = this.$element[0].getBoundingClientRect()[hOrW],
|
||||
//percentage of bar min/max value based on click or drag point
|
||||
pctOfBar = percent(location - this.options.start, this.options.end - this.options.start).toFixed(2),
|
||||
//number of actual pixels to shift the handle, based on the percentage obtained above
|
||||
pxToMove = (elemDim - handleDim) * pctOfBar,
|
||||
//percentage of bar to shift the handle
|
||||
movement = (percent(pxToMove, elemDim) * 100).toFixed(this.options.decimal);
|
||||
//fixing the decimal value for the location number, is passed to other methods as a fixed floating-point value
|
||||
location = parseFloat(location.toFixed(this.options.decimal));
|
||||
// declare empty object for css adjustments, only used with 2 handled-sliders
|
||||
var css = {};
|
||||
pctOfBar = percent(location, this.options.end).toFixed(2),
|
||||
pxToMove = (elemDim - halfOfHandle) * pctOfBar,
|
||||
movement = (percent(pxToMove, elemDim) * 100).toFixed(this.options.decimal),
|
||||
location = location > 0 ? parseFloat(location.toFixed(this.options.decimal)) : 0,
|
||||
anim, prog, start = null, css = {};
|
||||
|
||||
this._setValues($hndl, location);
|
||||
|
||||
// TODO update to calculate based on values set to respective inputs??
|
||||
if (isDbl) {
|
||||
if(this.options.doubleSided){//update to calculate based on values set to respective inputs??
|
||||
var isLeftHndl = this.handles.index($hndl) === 0,
|
||||
//empty variable, will be used for min-height/width for fill bar
|
||||
dim,
|
||||
//percentage w/h of the handle compared to the slider bar
|
||||
handlePct = ~~(percent(handleDim, elemDim) * 100);
|
||||
//if left handle, the math is slightly different than if it's the right handle, and the left/top property needs to be changed for the fill bar
|
||||
if (isLeftHndl) {
|
||||
//left or top percentage value to apply to the fill bar.
|
||||
css[lOrT] = `${movement}%`;
|
||||
//calculate the new min-height/width for the fill bar.
|
||||
dim = parseFloat(this.$handle2[0].style[lOrT]) - movement + handlePct;
|
||||
//this callback is necessary to prevent errors and allow the proper placement and initialization of a 2-handled slider
|
||||
//plus, it means we don't care if 'dim' isNaN on init, it won't be in the future.
|
||||
if (cb && typeof cb === 'function') { cb(); }//this is only needed for the initialization of 2 handled sliders
|
||||
} else {
|
||||
//just caching the value of the left/bottom handle's left/top property
|
||||
var handlePos = parseFloat(this.$handle[0].style[lOrT]);
|
||||
//calculate the new min-height/width for the fill bar. Use isNaN to prevent false positives for numbers <= 0
|
||||
//based on the percentage of movement of the handle being manipulated, less the opposing handle's left/top position, plus the percentage w/h of the handle itself
|
||||
dim = movement - (isNaN(handlePos) ? this.options.initialStart/((this.options.end-this.options.start)/100) : handlePos) + handlePct;
|
||||
idx = this.handles.index($hndl);
|
||||
|
||||
if(isLeftHndl){
|
||||
css[lOrT] = (pctOfBar > 0 ? pctOfBar * 100 : 0) + '%';//
|
||||
dim = /*Math.abs*/((percent(this.$handle2.position()[lOrT] + halfOfHandle, elemDim) - parseFloat(pctOfBar)) * 100).toFixed(this.options.decimal) + '%';
|
||||
css['min-' + hOrW] = dim;
|
||||
if(cb && typeof cb === 'function'){ cb(); }
|
||||
}else{
|
||||
var handleLeft = parseFloat(this.$handle[0].style.left);
|
||||
location = (location < 100 ? location : 100) - (!isNaN(handleLeft) ? handleLeft : this.options.end - location);
|
||||
css['min-' + hOrW] = location + '%';
|
||||
}
|
||||
// assign the min-height/width to our css object
|
||||
css[`min-${hOrW}`] = `${dim}%`;
|
||||
}
|
||||
|
||||
this.$element.one('finished.zf.animate', function() {
|
||||
this.$element.one('finished.zf.animate', function(){
|
||||
_this.animComplete = true;
|
||||
/**
|
||||
* Fires when the handle is done moving.
|
||||
* @event Slider#moved
|
||||
*/
|
||||
_this.$element.trigger('moved.zf.slider', [$hndl]);
|
||||
});
|
||||
|
||||
//because we don't know exactly how the handle will be moved, check the amount of time it should take to move.
|
||||
var moveTime = this.$element.data('dragging') ? 1000/60 : this.options.moveTime;
|
||||
|
||||
Foundation.Move(moveTime, $hndl, function() {
|
||||
//adjusting the left/top property of the handle, based on the percentage calculated above
|
||||
$hndl.css(lOrT, `${movement}%`);
|
||||
|
||||
if (!_this.options.doubleSided) {
|
||||
//if single-handled, a simple method to expand the fill bar
|
||||
_this.$fill.css(hOrW, `${pctOfBar * 100}%`);
|
||||
} else {
|
||||
//otherwise, use the css object we created above
|
||||
var moveTime = _this.$element.data('dragging') ? 1000/60 : _this.options.moveTime;
|
||||
/*var move = new */Foundation.Move(moveTime, $hndl, function(){
|
||||
$hndl.css(lOrT, movement + '%');
|
||||
if(!_this.options.doubleSided){
|
||||
_this.$fill.css(hOrW, pctOfBar * 100 + '%');
|
||||
}else{
|
||||
_this.$fill.css(css);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Fires when the value has not been change for a given time.
|
||||
* @event Slider#changed
|
||||
*/
|
||||
clearTimeout(_this.timeout);
|
||||
_this.timeout = setTimeout(function(){
|
||||
_this.$element.trigger('changed.zf.slider', [$hndl]);
|
||||
}, _this.options.changedDelay);
|
||||
}
|
||||
|
||||
// move.do();
|
||||
};
|
||||
/**
|
||||
* Sets the initial attribute for the slider element.
|
||||
* @function
|
||||
* @private
|
||||
* @param {Number} idx - index of the current handle/input to use.
|
||||
*/
|
||||
_setInitAttr(idx) {
|
||||
Slider.prototype._setInitAttr = function(idx){
|
||||
var id = this.inputs.eq(idx).attr('id') || Foundation.GetYoDigits(6, 'slider');
|
||||
this.inputs.eq(idx).attr({
|
||||
'id': id,
|
||||
'max': this.options.end,
|
||||
'min': this.options.start,
|
||||
'step': this.options.step
|
||||
'min': this.options.start
|
||||
|
||||
});
|
||||
this.handles.eq(idx).attr({
|
||||
'role': 'slider',
|
||||
@ -238,8 +289,7 @@ class Slider {
|
||||
'aria-orientation': this.options.vertical ? 'vertical' : 'horizontal',
|
||||
'tabindex': 0
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Sets the input and `aria-valuenow` values for the slider element.
|
||||
* @function
|
||||
@ -247,12 +297,11 @@ class Slider {
|
||||
* @param {jQuery} $handle - the currently selected handle.
|
||||
* @param {Number} val - floating point of the new value.
|
||||
*/
|
||||
_setValues($handle, val) {
|
||||
Slider.prototype._setValues = function($handle, val){
|
||||
var idx = this.options.doubleSided ? this.handles.index($handle) : 0;
|
||||
this.inputs.eq(idx).val(val);
|
||||
$handle.attr('aria-valuenow', val);
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Handles events on the slider element.
|
||||
* Calculates the new location of the current handle.
|
||||
@ -262,157 +311,106 @@ class Slider {
|
||||
* @param {Object} e - the `event` object passed from the listener.
|
||||
* @param {jQuery} $handle - the current handle to calculate for, if selected.
|
||||
* @param {Number} val - floating point number for the new value of the slider.
|
||||
* TODO clean this up, there's a lot of repeated code between this and the _setHandlePos fn.
|
||||
*/
|
||||
_handleEvent(e, $handle, val) {
|
||||
Slider.prototype._handleEvent = function(e, $handle, val){
|
||||
var value, hasVal;
|
||||
if (!val) {//click or drag events
|
||||
if(!val){//click or drag events
|
||||
e.preventDefault();
|
||||
var _this = this,
|
||||
vertical = this.options.vertical,
|
||||
param = vertical ? 'height' : 'width',
|
||||
direction = vertical ? 'top' : 'left',
|
||||
eventOffset = vertical ? e.pageY : e.pageX,
|
||||
pageXY = vertical ? e.pageY : e.pageX,
|
||||
halfOfHandle = this.$handle[0].getBoundingClientRect()[param] / 2,
|
||||
barDim = this.$element[0].getBoundingClientRect()[param],
|
||||
windowScroll = vertical ? $(window).scrollTop() : $(window).scrollLeft();
|
||||
|
||||
|
||||
var elemOffset = this.$element.offset()[direction];
|
||||
|
||||
// touch events emulated by the touch util give position relative to screen, add window.scroll to event coordinates...
|
||||
// best way to guess this is simulated is if clientY == pageY
|
||||
if (e.clientY === e.pageY) { eventOffset = eventOffset + windowScroll; }
|
||||
var eventFromBar = eventOffset - elemOffset;
|
||||
var barXY;
|
||||
if (eventFromBar < 0) {
|
||||
barXY = 0;
|
||||
} else if (eventFromBar > barDim) {
|
||||
barXY = barDim;
|
||||
} else {
|
||||
barXY = eventFromBar;
|
||||
}
|
||||
var offsetPct = percent(barXY, barDim);
|
||||
|
||||
value = (this.options.end - this.options.start) * offsetPct + this.options.start;
|
||||
|
||||
// turn everything around for RTL, yay math!
|
||||
if (Foundation.rtl() && !this.options.vertical) {value = this.options.end - value;}
|
||||
|
||||
value = _this._adjustValue(null, value);
|
||||
//boolean flag for the setHandlePos fn, specifically for vertical sliders
|
||||
barOffset = (this.$element.offset()[direction] - pageXY),
|
||||
barXY = barOffset > 0 ? -halfOfHandle : (barOffset - halfOfHandle) < -barDim ? barDim : Math.abs(barOffset),//if the cursor position is less than or greater than the elements bounding coordinates, set coordinates within those bounds
|
||||
// eleDim = this.$element[0].getBoundingClientRect()[param],
|
||||
offsetPct = percent(barXY, barDim);
|
||||
value = (this.options.end - this.options.start) * offsetPct;
|
||||
hasVal = false;
|
||||
|
||||
if (!$handle) {//figure out which handle it is, pass it to the next function.
|
||||
if(!$handle){//figure out which handle it is, pass it to the next function.
|
||||
var firstHndlPos = absPosition(this.$handle, direction, barXY, param),
|
||||
secndHndlPos = absPosition(this.$handle2, direction, barXY, param);
|
||||
$handle = firstHndlPos <= secndHndlPos ? this.$handle : this.$handle2;
|
||||
}
|
||||
|
||||
} else {//change event on input
|
||||
value = this._adjustValue(null, val);
|
||||
}else{//change event on input
|
||||
value = val;
|
||||
hasVal = true;
|
||||
}
|
||||
|
||||
this._setHandlePos($handle, value, hasVal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjustes value for handle in regard to step value. returns adjusted value
|
||||
* @function
|
||||
* @private
|
||||
* @param {jQuery} $handle - the selected handle.
|
||||
* @param {Number} value - value to adjust. used if $handle is falsy
|
||||
*/
|
||||
_adjustValue($handle, value) {
|
||||
var val,
|
||||
step = this.options.step,
|
||||
div = parseFloat(step/2),
|
||||
left, prev_val, next_val;
|
||||
if (!!$handle) {
|
||||
val = parseFloat($handle.attr('aria-valuenow'));
|
||||
}
|
||||
else {
|
||||
val = value;
|
||||
}
|
||||
left = val % step;
|
||||
prev_val = val - left;
|
||||
next_val = prev_val + step;
|
||||
if (left === 0) {
|
||||
return val;
|
||||
}
|
||||
val = val >= prev_val + div ? next_val : prev_val;
|
||||
return val;
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Adds event listeners to the slider elements.
|
||||
* @function
|
||||
* @private
|
||||
* @param {jQuery} $handle - the current handle to apply listeners to.
|
||||
*/
|
||||
_events($handle) {
|
||||
Slider.prototype._events = function($handle){
|
||||
if(this.options.disabled){ return false; }
|
||||
|
||||
var _this = this,
|
||||
curHandle,
|
||||
timer;
|
||||
|
||||
this.inputs.off('change.zf.slider').on('change.zf.slider', function(e) {
|
||||
this.inputs.off('change.zf.slider').on('change.zf.slider', function(e){
|
||||
var idx = _this.inputs.index($(this));
|
||||
_this._handleEvent(e, _this.handles.eq(idx), $(this).val());
|
||||
});
|
||||
|
||||
if (this.options.clickSelect) {
|
||||
this.$element.off('click.zf.slider').on('click.zf.slider', function(e) {
|
||||
if (_this.$element.data('dragging')) { return false; }
|
||||
|
||||
if (!$(e.target).is('[data-slider-handle]')) {
|
||||
if (_this.options.doubleSided) {
|
||||
_this._handleEvent(e);
|
||||
} else {
|
||||
_this._handleEvent(e, _this.$handle);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (this.options.draggable) {
|
||||
this.handles.addTouch();
|
||||
|
||||
var $body = $('body');
|
||||
$handle
|
||||
.off('mousedown.zf.slider')
|
||||
.on('mousedown.zf.slider', function(e) {
|
||||
$handle.addClass('is-dragging');
|
||||
_this.$fill.addClass('is-dragging');//
|
||||
_this.$element.data('dragging', true);
|
||||
|
||||
curHandle = $(e.currentTarget);
|
||||
|
||||
$body.on('mousemove.zf.slider', function(e) {
|
||||
e.preventDefault();
|
||||
_this._handleEvent(e, curHandle);
|
||||
|
||||
}).on('mouseup.zf.slider', function(e) {
|
||||
_this._handleEvent(e, curHandle);
|
||||
|
||||
$handle.removeClass('is-dragging');
|
||||
_this.$fill.removeClass('is-dragging');
|
||||
_this.$element.data('dragging', false);
|
||||
|
||||
$body.off('mousemove.zf.slider mouseup.zf.slider');
|
||||
});
|
||||
})
|
||||
// prevent events triggered by touch
|
||||
.on('selectstart.zf.slider touchmove.zf.slider', function(e) {
|
||||
e.preventDefault();
|
||||
if(this.options.clickSelect){
|
||||
this.$element.off('click.zf.slider').on('click.zf.slider', function(e){
|
||||
if(_this.$element.data('dragging')){ return false; }
|
||||
_this.animComplete = false;
|
||||
if(_this.options.doubleSided){
|
||||
_this._handleEvent(e);
|
||||
}else{
|
||||
_this._handleEvent(e, _this.$handle);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$handle.off('keydown.zf.slider').on('keydown.zf.slider', function(e) {
|
||||
var _$handle = $(this),
|
||||
idx = _this.options.doubleSided ? _this.handles.index(_$handle) : 0,
|
||||
oldValue = parseFloat(_this.inputs.eq(idx).val()),
|
||||
newValue;
|
||||
if(this.options.draggable){
|
||||
this.handles.addTouch();
|
||||
// var curHandle,
|
||||
// timer,
|
||||
var $body = $('body');
|
||||
$handle
|
||||
.off('mousedown.zf.slider')
|
||||
.on('mousedown.zf.slider', function(e){
|
||||
$handle.addClass('is-dragging');
|
||||
_this.$fill.addClass('is-dragging');//
|
||||
_this.$element.data('dragging', true);
|
||||
_this.animComplete = false;
|
||||
curHandle = $(e.currentTarget);
|
||||
|
||||
$body.on('mousemove.zf.slider', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
// timer = setTimeout(function(){
|
||||
_this._handleEvent(e, curHandle);
|
||||
// }, _this.options.dragDelay);
|
||||
}).on('mouseup.zf.slider', function(e){
|
||||
// clearTimeout(timer);
|
||||
_this.animComplete = true;
|
||||
_this._handleEvent(e, curHandle);
|
||||
$handle.removeClass('is-dragging');
|
||||
_this.$fill.removeClass('is-dragging');
|
||||
_this.$element.data('dragging', false);
|
||||
// Foundation.reflow(_this.$element, 'slider');
|
||||
$body.off('mousemove.zf.slider mouseup.zf.slider');
|
||||
});
|
||||
});
|
||||
}
|
||||
$handle.off('keydown.zf.slider').on('keydown.zf.slider', function(e){
|
||||
var idx = _this.options.doubleSided ? _this.handles.index($(this)) : 0,
|
||||
oldValue = parseFloat(_this.inputs.eq(idx).val()),
|
||||
newValue;
|
||||
|
||||
var _$handle = $(this);
|
||||
|
||||
// handle keyboard event with keyboard util
|
||||
Foundation.Keyboard.handleKey(e, 'Slider', {
|
||||
@ -438,157 +436,46 @@ class Slider {
|
||||
_this._setHandlePos(_$handle, newValue);
|
||||
}*/
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Destroys the slider plugin.
|
||||
*/
|
||||
destroy() {
|
||||
this.handles.off('.zf.slider');
|
||||
this.inputs.off('.zf.slider');
|
||||
this.$element.off('.zf.slider');
|
||||
Slider.prototype.destroy = function(){
|
||||
this.handles.off('.zf.slider');
|
||||
this.inputs.off('.zf.slider');
|
||||
this.$element.off('.zf.slider');
|
||||
|
||||
Foundation.unregisterPlugin(this);
|
||||
Foundation.unregisterPlugin(this);
|
||||
};
|
||||
|
||||
Foundation.plugin(Slider, 'Slider');
|
||||
|
||||
function percent(frac, num){
|
||||
return (frac / num);
|
||||
}
|
||||
}
|
||||
|
||||
Slider.defaults = {
|
||||
/**
|
||||
* Minimum value for the slider scale.
|
||||
* @option
|
||||
* @example 0
|
||||
*/
|
||||
start: 0,
|
||||
/**
|
||||
* Maximum value for the slider scale.
|
||||
* @option
|
||||
* @example 100
|
||||
*/
|
||||
end: 100,
|
||||
/**
|
||||
* Minimum value change per change event.
|
||||
* @option
|
||||
* @example 1
|
||||
*/
|
||||
step: 1,
|
||||
/**
|
||||
* Value at which the handle/input *(left handle/first input)* should be set to on initialization.
|
||||
* @option
|
||||
* @example 0
|
||||
*/
|
||||
initialStart: 0,
|
||||
/**
|
||||
* Value at which the right handle/second input should be set to on initialization.
|
||||
* @option
|
||||
* @example 100
|
||||
*/
|
||||
initialEnd: 100,
|
||||
/**
|
||||
* Allows the input to be located outside the container and visible. Set to by the JS
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
binding: false,
|
||||
/**
|
||||
* Allows the user to click/tap on the slider bar to select a value.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
clickSelect: true,
|
||||
/**
|
||||
* Set to true and use the `vertical` class to change alignment to vertical.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
vertical: false,
|
||||
/**
|
||||
* Allows the user to drag the slider handle(s) to select a value.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
draggable: true,
|
||||
/**
|
||||
* Disables the slider and prevents event listeners from being applied. Double checked by JS with `disabledClass`.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
disabled: false,
|
||||
/**
|
||||
* Allows the use of two handles. Double checked by the JS. Changes some logic handling.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
doubleSided: false,
|
||||
/**
|
||||
* Potential future feature.
|
||||
*/
|
||||
// steps: 100,
|
||||
/**
|
||||
* Number of decimal places the plugin should go to for floating point precision.
|
||||
* @option
|
||||
* @example 2
|
||||
*/
|
||||
decimal: 2,
|
||||
/**
|
||||
* Time delay for dragged elements.
|
||||
*/
|
||||
// dragDelay: 0,
|
||||
/**
|
||||
* Time, in ms, to animate the movement of a slider handle if user clicks/taps on the bar. Needs to be manually set if updating the transition time in the Sass settings.
|
||||
* @option
|
||||
* @example 200
|
||||
*/
|
||||
moveTime: 200,//update this if changing the transition time in the sass
|
||||
/**
|
||||
* Class applied to disabled sliders.
|
||||
* @option
|
||||
* @example 'disabled'
|
||||
*/
|
||||
disabledClass: 'disabled',
|
||||
/**
|
||||
* Will invert the default layout for a vertical<span data-tooltip title="who would do this???"> </span>slider.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
invertVertical: false,
|
||||
/**
|
||||
* Milliseconds before the `changed.zf-slider` event is triggered after value change.
|
||||
* @option
|
||||
* @example 500
|
||||
*/
|
||||
changedDelay: 500
|
||||
};
|
||||
|
||||
function percent(frac, num) {
|
||||
return (frac / num);
|
||||
}
|
||||
function absPosition($handle, dir, clickPos, param) {
|
||||
return Math.abs(($handle.position()[dir] + ($handle[param]() / 2)) - clickPos);
|
||||
}
|
||||
|
||||
// Window exports
|
||||
Foundation.plugin(Slider, 'Slider');
|
||||
|
||||
}(jQuery);
|
||||
function absPosition($handle, dir, clickPos, param){
|
||||
return Math.abs(($handle.position()[dir] + ($handle[param]() / 2)) - clickPos);
|
||||
}
|
||||
}(jQuery, window.Foundation);
|
||||
|
||||
//*********this is in case we go to static, absolute positions instead of dynamic positioning********
|
||||
// this.setSteps(function() {
|
||||
// this.setSteps(function(){
|
||||
// _this._events();
|
||||
// var initStart = _this.options.positions[_this.options.initialStart - 1] || null;
|
||||
// var initEnd = _this.options.initialEnd ? _this.options.position[_this.options.initialEnd - 1] : null;
|
||||
// if (initStart || initEnd) {
|
||||
// if(initStart || initEnd){
|
||||
// _this._handleEvent(initStart, initEnd);
|
||||
// }
|
||||
// });
|
||||
|
||||
//***********the other part of absolute positions*************
|
||||
// Slider.prototype.setSteps = function(cb) {
|
||||
// Slider.prototype.setSteps = function(cb){
|
||||
// var posChange = this.$element.outerWidth() / this.options.steps;
|
||||
// var counter = 0
|
||||
// while(counter < this.options.steps) {
|
||||
// if (counter) {
|
||||
// while(counter < this.options.steps){
|
||||
// if(counter){
|
||||
// this.options.positions.push(this.options.positions[counter - 1] + posChange);
|
||||
// } else {
|
||||
// }else{
|
||||
// this.options.positions.push(posChange);
|
||||
// }
|
||||
// counter++;
|
||||
|
401
app/vendor/foundation/js/foundation.sticky.js
vendored
401
app/vendor/foundation/js/foundation.sticky.js
vendored
@ -1,22 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
|
||||
/**
|
||||
* Sticky module.
|
||||
* @module foundation.sticky
|
||||
* @requires foundation.util.triggers
|
||||
* @requires foundation.util.mediaQuery
|
||||
*/
|
||||
!function($, Foundation){
|
||||
'use strict';
|
||||
|
||||
class Sticky {
|
||||
/**
|
||||
* Creates a new instance of a sticky thing.
|
||||
* @class
|
||||
* @param {jQuery} element - jQuery object to make sticky.
|
||||
* @param {Object} options - options object passed when creating the element programmatically.
|
||||
*/
|
||||
constructor(element, options) {
|
||||
function Sticky(element, options){
|
||||
this.$element = element;
|
||||
this.options = $.extend({}, Sticky.defaults, this.$element.data(), options);
|
||||
|
||||
@ -24,96 +21,163 @@ class Sticky {
|
||||
|
||||
Foundation.registerPlugin(this, 'Sticky');
|
||||
}
|
||||
Sticky.defaults = {
|
||||
/**
|
||||
* Customizable container template. Add your own classes for styling and sizing.
|
||||
* @option
|
||||
* @example '<div data-sticky-container class="small-6 columns"></div>'
|
||||
*/
|
||||
container: '<div data-sticky-container></div>',
|
||||
/**
|
||||
* Location in the view the element sticks to.
|
||||
* @option
|
||||
* @example 'top'
|
||||
*/
|
||||
stickTo: 'top',
|
||||
/**
|
||||
* If anchored to a single element, the id of that element.
|
||||
* @option
|
||||
* @example 'exampleId'
|
||||
*/
|
||||
anchor: '',
|
||||
/**
|
||||
* If using more than one element as anchor points, the id of the top anchor.
|
||||
* @option
|
||||
* @example 'exampleId:top'
|
||||
*/
|
||||
topAnchor: '',
|
||||
/**
|
||||
* If using more than one element as anchor points, the id of the bottom anchor.
|
||||
* @option
|
||||
* @example 'exampleId:bottom'
|
||||
*/
|
||||
btmAnchor: '',
|
||||
/**
|
||||
* Margin, in `em`'s to apply to the top of the element when it becomes sticky.
|
||||
* @option
|
||||
* @example 1
|
||||
*/
|
||||
marginTop: 1,
|
||||
/**
|
||||
* Margin, in `em`'s to apply to the bottom of the element when it becomes sticky.
|
||||
* @option
|
||||
* @example 1
|
||||
*/
|
||||
marginBottom: 1,
|
||||
/**
|
||||
* Breakpoint string that is the minimum screen size an element should become sticky.
|
||||
* @option
|
||||
* @example 'medium'
|
||||
*/
|
||||
stickyOn: 'medium',
|
||||
/**
|
||||
* Class applied to sticky element, and removed on destruction. Foundation defaults to `sticky`.
|
||||
* @option
|
||||
* @example 'sticky'
|
||||
*/
|
||||
stickyClass: 'sticky',
|
||||
/**
|
||||
* Class applied to sticky container. Foundation defaults to `sticky-container`.
|
||||
* @option
|
||||
* @example 'sticky-container'
|
||||
*/
|
||||
containerClass: 'sticky-container',
|
||||
/**
|
||||
* Number of scroll events between the plugin's recalculating sticky points. Setting it to `0` will cause it to recalc every scroll event, setting it to `-1` will prevent recalc on scroll.
|
||||
* @option
|
||||
* @example 50
|
||||
*/
|
||||
checkEvery: -1
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes the sticky element by adding classes, getting/setting dimensions, breakpoints and attributes
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_init() {
|
||||
Sticky.prototype._init = function(){
|
||||
var $parent = this.$element.parent('[data-sticky-container]'),
|
||||
id = this.$element[0].id || Foundation.GetYoDigits(6, 'sticky'),
|
||||
_this = this;
|
||||
|
||||
if (!$parent.length) {
|
||||
if(!$parent.length){
|
||||
this.wasWrapped = true;
|
||||
}
|
||||
this.$container = $parent.length ? $parent : $(this.options.container).wrapInner(this.$element);
|
||||
this.$container.addClass(this.options.containerClass);
|
||||
|
||||
|
||||
this.$element.addClass(this.options.stickyClass)
|
||||
.attr({'data-resize': id});
|
||||
|
||||
this.scrollCount = this.options.checkEvery;
|
||||
this.isStuck = false;
|
||||
$(window).one('load.zf.sticky', function(){
|
||||
//We calculate the container height to have correct values for anchor points offset calculation.
|
||||
_this.containerHeight = _this.$element.css("display") == "none" ? 0 : _this.$element[0].getBoundingClientRect().height;
|
||||
_this.$container.css('height', _this.containerHeight);
|
||||
_this.elemHeight = _this.containerHeight;
|
||||
if(_this.options.anchor !== ''){
|
||||
_this.$anchor = $('#' + _this.options.anchor);
|
||||
}else{
|
||||
_this._parsePoints();
|
||||
}
|
||||
|
||||
_this._setSizes(function(){
|
||||
_this._calc(false);
|
||||
});
|
||||
_this._events(id.split('-').reverse().join('-'));
|
||||
if(this.options.anchor !== ''){
|
||||
this.$anchor = $('#' + this.options.anchor);
|
||||
}else{
|
||||
this._parsePoints();
|
||||
}
|
||||
|
||||
this._setSizes(function(){
|
||||
_this._calc(false);
|
||||
});
|
||||
}
|
||||
|
||||
this._events(id.split('-').reverse().join('-'));
|
||||
};
|
||||
/**
|
||||
* If using multiple elements as anchors, calculates the top and bottom pixel values the sticky thing should stick and unstick on.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_parsePoints() {
|
||||
var top = this.options.topAnchor == "" ? 1 : this.options.topAnchor,
|
||||
btm = this.options.btmAnchor== "" ? document.documentElement.scrollHeight : this.options.btmAnchor,
|
||||
Sticky.prototype._parsePoints = function(){
|
||||
var top = this.options.topAnchor,
|
||||
btm = this.options.btmAnchor,
|
||||
pts = [top, btm],
|
||||
breaks = {};
|
||||
for (var i = 0, len = pts.length; i < len && pts[i]; i++) {
|
||||
var pt;
|
||||
if (typeof pts[i] === 'number') {
|
||||
pt = pts[i];
|
||||
} else {
|
||||
var place = pts[i].split(':'),
|
||||
anchor = $(`#${place[0]}`);
|
||||
if(top && btm){
|
||||
|
||||
pt = anchor.offset().top;
|
||||
if (place[1] && place[1].toLowerCase() === 'bottom') {
|
||||
pt += anchor[0].getBoundingClientRect().height;
|
||||
for(var i = 0, len = pts.length; i < len && pts[i]; i++){
|
||||
var pt;
|
||||
if(typeof pts[i] === 'number'){
|
||||
pt = pts[i];
|
||||
}else{
|
||||
var place = pts[i].split(':'),
|
||||
anchor = $('#' + place[0]);
|
||||
|
||||
pt = anchor.offset().top;
|
||||
if(place[1] && place[1].toLowerCase() === 'bottom'){
|
||||
pt += anchor[0].getBoundingClientRect().height;
|
||||
}
|
||||
}
|
||||
breaks[i] = pt;
|
||||
}
|
||||
breaks[i] = pt;
|
||||
}else{
|
||||
breaks = {0: 1, 1: document.documentElement.scrollHeight};
|
||||
}
|
||||
|
||||
|
||||
this.points = breaks;
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds event handlers for the scrolling element.
|
||||
* @private
|
||||
* @param {String} id - psuedo-random id for unique scroll event listener.
|
||||
*/
|
||||
_events(id) {
|
||||
Sticky.prototype._events = function(id){
|
||||
var _this = this,
|
||||
scrollListener = this.scrollListener = `scroll.zf.${id}`;
|
||||
if (this.isOn) { return; }
|
||||
if (this.canStick) {
|
||||
scrollListener = this.scrollListener = 'scroll.zf.' + id;
|
||||
if(this.isOn){ return; }
|
||||
if(this.canStick){
|
||||
this.isOn = true;
|
||||
$(window).off(scrollListener)
|
||||
.on(scrollListener, function(e) {
|
||||
if (_this.scrollCount === 0) {
|
||||
.on(scrollListener, function(e){
|
||||
if(_this.scrollCount === 0){
|
||||
_this.scrollCount = _this.options.checkEvery;
|
||||
_this._setSizes(function() {
|
||||
_this._setSizes(function(){
|
||||
_this._calc(false, window.pageYOffset);
|
||||
});
|
||||
} else {
|
||||
}else{
|
||||
_this.scrollCount--;
|
||||
_this._calc(false, window.pageYOffset);
|
||||
}
|
||||
@ -121,26 +185,26 @@ class Sticky {
|
||||
}
|
||||
|
||||
this.$element.off('resizeme.zf.trigger')
|
||||
.on('resizeme.zf.trigger', function(e, el) {
|
||||
_this._setSizes(function() {
|
||||
.on('resizeme.zf.trigger', function(e, el){
|
||||
_this._setSizes(function(){
|
||||
_this._calc(false);
|
||||
if (_this.canStick) {
|
||||
if (!_this.isOn) {
|
||||
if(_this.canStick){
|
||||
if(!_this.isOn){
|
||||
_this._events(id);
|
||||
}
|
||||
} else if (_this.isOn) {
|
||||
}else if(_this.isOn){
|
||||
_this._pauseListeners(scrollListener);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes event handlers for scroll and change events on anchor.
|
||||
* @fires Sticky#pause
|
||||
* @param {String} scrollListener - unique, namespaced scroll listener attached to `window`
|
||||
*/
|
||||
_pauseListeners(scrollListener) {
|
||||
Sticky.prototype._pauseListeners = function(scrollListener){
|
||||
this.isOn = false;
|
||||
$(window).off(scrollListener);
|
||||
|
||||
@ -150,7 +214,7 @@ class Sticky {
|
||||
* @private
|
||||
*/
|
||||
this.$element.trigger('pause.zf.sticky');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Called on every `scroll` event and on `_init`
|
||||
@ -158,35 +222,34 @@ class Sticky {
|
||||
* @param {Boolean} checkSizes - true if plugin should recalculate sizes and breakpoints.
|
||||
* @param {Number} scroll - current scroll position passed from scroll event cb function. If not passed, defaults to `window.pageYOffset`.
|
||||
*/
|
||||
_calc(checkSizes, scroll) {
|
||||
if (checkSizes) { this._setSizes(); }
|
||||
Sticky.prototype._calc = function(checkSizes, scroll){
|
||||
if(checkSizes){ this._setSizes(); }
|
||||
|
||||
if (!this.canStick) {
|
||||
if (this.isStuck) {
|
||||
if(!this.canStick){
|
||||
if(this.isStuck){
|
||||
this._removeSticky(true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!scroll) { scroll = window.pageYOffset; }
|
||||
if(!scroll){ scroll = window.pageYOffset; }
|
||||
|
||||
if (scroll >= this.topPoint) {
|
||||
if (scroll <= this.bottomPoint) {
|
||||
if (!this.isStuck) {
|
||||
if(scroll >= this.topPoint){
|
||||
if(scroll <= this.bottomPoint){
|
||||
if(!this.isStuck){
|
||||
this._setSticky();
|
||||
}
|
||||
} else {
|
||||
if (this.isStuck) {
|
||||
}else{
|
||||
if(this.isStuck){
|
||||
this._removeSticky(false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.isStuck) {
|
||||
}else{
|
||||
if(this.isStuck){
|
||||
this._removeSticky(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Causes the $element to become stuck.
|
||||
* Adds `position: fixed;`, and helper classes.
|
||||
@ -194,31 +257,27 @@ class Sticky {
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_setSticky() {
|
||||
var _this = this,
|
||||
stickTo = this.options.stickTo,
|
||||
Sticky.prototype._setSticky = function(){
|
||||
var stickTo = this.options.stickTo,
|
||||
mrgn = stickTo === 'top' ? 'marginTop' : 'marginBottom',
|
||||
notStuckTo = stickTo === 'top' ? 'bottom' : 'top',
|
||||
css = {};
|
||||
|
||||
css[mrgn] = `${this.options[mrgn]}em`;
|
||||
css[mrgn] = this.options[mrgn] + 'em';
|
||||
css[stickTo] = 0;
|
||||
css[notStuckTo] = 'auto';
|
||||
css['left'] = this.$container.offset().left + parseInt(window.getComputedStyle(this.$container[0])["padding-left"], 10);
|
||||
this.isStuck = true;
|
||||
this.$element.removeClass(`is-anchored is-at-${notStuckTo}`)
|
||||
.addClass(`is-stuck is-at-${stickTo}`)
|
||||
this.$element.removeClass('is-anchored is-at-' + notStuckTo)
|
||||
.addClass('is-stuck is-at-' + stickTo)
|
||||
.css(css)
|
||||
/**
|
||||
* Fires when the $element has become `position: fixed;`
|
||||
* Namespaced to `top` or `bottom`, e.g. `sticky.zf.stuckto:top`
|
||||
* Namespaced to `top` or `bottom`.
|
||||
* @event Sticky#stuckto
|
||||
*/
|
||||
.trigger(`sticky.zf.stuckto:${stickTo}`);
|
||||
this.$element.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd", function() {
|
||||
_this._setSizes();
|
||||
});
|
||||
}
|
||||
.trigger('sticky.zf.stuckto:' + stickTo);
|
||||
};
|
||||
|
||||
/**
|
||||
* Causes the $element to become unstuck.
|
||||
@ -228,7 +287,7 @@ class Sticky {
|
||||
* @fires Sticky#unstuckfrom
|
||||
* @private
|
||||
*/
|
||||
_removeSticky(isTop) {
|
||||
Sticky.prototype._removeSticky = function(isTop){
|
||||
var stickTo = this.options.stickTo,
|
||||
stickToTop = stickTo === 'top',
|
||||
css = {},
|
||||
@ -239,25 +298,26 @@ class Sticky {
|
||||
|
||||
css[mrgn] = 0;
|
||||
|
||||
css['bottom'] = 'auto';
|
||||
if(isTop) {
|
||||
css['top'] = 0;
|
||||
} else {
|
||||
css['top'] = anchorPt;
|
||||
if((isTop && !stickToTop) || (stickToTop && !isTop)){
|
||||
css[stickTo] = anchorPt;
|
||||
css[notStuckTo] = 0;
|
||||
}else{
|
||||
css[stickTo] = 0;
|
||||
css[notStuckTo] = anchorPt;
|
||||
}
|
||||
|
||||
css['left'] = '';
|
||||
this.isStuck = false;
|
||||
this.$element.removeClass(`is-stuck is-at-${stickTo}`)
|
||||
.addClass(`is-anchored is-at-${topOrBottom}`)
|
||||
this.$element.removeClass('is-stuck is-at-' + stickTo)
|
||||
.addClass('is-anchored is-at-' + topOrBottom)
|
||||
.css(css)
|
||||
/**
|
||||
* Fires when the $element has become anchored.
|
||||
* Namespaced to `top` or `bottom`, e.g. `sticky.zf.unstuckfrom:bottom`
|
||||
* Namespaced to `top` or `bottom`.
|
||||
* @event Sticky#unstuckfrom
|
||||
*/
|
||||
.trigger(`sticky.zf.unstuckfrom:${topOrBottom}`);
|
||||
}
|
||||
.trigger('sticky.zf.unstuckfrom:' + topOrBottom);
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the $element and $container sizes for plugin.
|
||||
@ -265,60 +325,50 @@ class Sticky {
|
||||
* @param {Function} cb - optional callback function to fire on completion of `_setBreakPoints`.
|
||||
* @private
|
||||
*/
|
||||
_setSizes(cb) {
|
||||
Sticky.prototype._setSizes = function(cb){
|
||||
this.canStick = Foundation.MediaQuery.atLeast(this.options.stickyOn);
|
||||
if (!this.canStick) {
|
||||
if (cb && typeof cb === 'function') { cb(); }
|
||||
}
|
||||
if(!this.canStick){ cb(); }
|
||||
var _this = this,
|
||||
newElemWidth = this.$container[0].getBoundingClientRect().width,
|
||||
comp = window.getComputedStyle(this.$container[0]),
|
||||
pdng = parseInt(comp['padding-right'], 10);
|
||||
|
||||
if (this.$anchor && this.$anchor.length) {
|
||||
if(this.$anchor && this.$anchor.length){
|
||||
this.anchorHeight = this.$anchor[0].getBoundingClientRect().height;
|
||||
} else {
|
||||
}else{
|
||||
this._parsePoints();
|
||||
}
|
||||
|
||||
this.$element.css({
|
||||
'max-width': `${newElemWidth - pdng}px`
|
||||
'max-width': newElemWidth - pdng + 'px'
|
||||
});
|
||||
|
||||
var newContainerHeight = this.$element[0].getBoundingClientRect().height || this.containerHeight;
|
||||
if (this.$element.css("display") == "none") {
|
||||
newContainerHeight = 0;
|
||||
}
|
||||
this.containerHeight = newContainerHeight;
|
||||
this.$container.css({
|
||||
height: newContainerHeight
|
||||
});
|
||||
this.elemHeight = newContainerHeight;
|
||||
|
||||
if (this.isStuck) {
|
||||
this.$element.css({"left":this.$container.offset().left + parseInt(comp['padding-left'], 10)});
|
||||
} else {
|
||||
if (this.$element.hasClass('is-at-bottom')) {
|
||||
var anchorPt = (this.points ? this.points[1] - this.$container.offset().top : this.anchorHeight) - this.elemHeight;
|
||||
this.$element.css('top', anchorPt);
|
||||
}
|
||||
}
|
||||
if (this.isStuck) {
|
||||
this.$element.css({"left":this.$container.offset().left + parseInt(comp['padding-left'], 10)});
|
||||
}
|
||||
|
||||
this._setBreakPoints(newContainerHeight, function() {
|
||||
if (cb && typeof cb === 'function') { cb(); }
|
||||
this._setBreakPoints(newContainerHeight, function(){
|
||||
if(cb){ cb(); }
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Sets the upper and lower breakpoints for the element to become sticky/unsticky.
|
||||
* @param {Number} elemHeight - px value for sticky.$element height, calculated by `_setSizes`.
|
||||
* @param {Function} cb - optional callback function to be called on completion.
|
||||
* @private
|
||||
*/
|
||||
_setBreakPoints(elemHeight, cb) {
|
||||
if (!this.canStick) {
|
||||
if (cb && typeof cb === 'function') { cb(); }
|
||||
else { return false; }
|
||||
Sticky.prototype._setBreakPoints = function(elemHeight, cb){
|
||||
if(!this.canStick){
|
||||
if(cb){ cb(); }
|
||||
else{ return false; }
|
||||
}
|
||||
var mTop = emCalc(this.options.marginTop),
|
||||
mBtm = emCalc(this.options.marginBottom),
|
||||
@ -328,21 +378,21 @@ class Sticky {
|
||||
// bottomPoint = topPoint + this.anchorHeight || this.points[1],
|
||||
winHeight = window.innerHeight;
|
||||
|
||||
if (this.options.stickTo === 'top') {
|
||||
if(this.options.stickTo === 'top'){
|
||||
topPoint -= mTop;
|
||||
bottomPoint -= (elemHeight + mTop);
|
||||
} else if (this.options.stickTo === 'bottom') {
|
||||
}else if(this.options.stickTo === 'bottom'){
|
||||
topPoint -= (winHeight - (elemHeight + mBtm));
|
||||
bottomPoint -= (winHeight - mBtm);
|
||||
} else {
|
||||
}else{
|
||||
//this would be the stickTo: both option... tricky
|
||||
}
|
||||
|
||||
this.topPoint = topPoint;
|
||||
this.bottomPoint = bottomPoint;
|
||||
|
||||
if (cb && typeof cb === 'function') { cb(); }
|
||||
}
|
||||
if(cb){ cb(); }
|
||||
};
|
||||
|
||||
/**
|
||||
* Destroys the current sticky element.
|
||||
@ -350,10 +400,10 @@ class Sticky {
|
||||
* Removes event listeners, JS-added css properties and classes, and unwraps the $element if the JS added the $container.
|
||||
* @function
|
||||
*/
|
||||
destroy() {
|
||||
Sticky.prototype.destroy = function(){
|
||||
this._removeSticky(true);
|
||||
|
||||
this.$element.removeClass(`${this.options.stickyClass} is-anchored is-at-top`)
|
||||
this.$element.removeClass(this.options.stickyClass + ' is-anchored is-at-top')
|
||||
.css({
|
||||
height: '',
|
||||
top: '',
|
||||
@ -361,101 +411,26 @@ class Sticky {
|
||||
'max-width': ''
|
||||
})
|
||||
.off('resizeme.zf.trigger');
|
||||
if (this.$anchor && this.$anchor.length) {
|
||||
this.$anchor.off('change.zf.sticky');
|
||||
}
|
||||
|
||||
this.$anchor.off('change.zf.sticky');
|
||||
$(window).off(this.scrollListener);
|
||||
|
||||
if (this.wasWrapped) {
|
||||
if(this.wasWrapped){
|
||||
this.$element.unwrap();
|
||||
} else {
|
||||
}else{
|
||||
this.$container.removeClass(this.options.containerClass)
|
||||
.css({
|
||||
height: ''
|
||||
});
|
||||
}
|
||||
Foundation.unregisterPlugin(this);
|
||||
};
|
||||
/**
|
||||
* Helper function to calculate em values
|
||||
* @param Number {em} - number of em's to calculate into pixels
|
||||
*/
|
||||
function emCalc(em){
|
||||
return parseInt(window.getComputedStyle(document.body, null).fontSize, 10) * em;
|
||||
}
|
||||
}
|
||||
|
||||
Sticky.defaults = {
|
||||
/**
|
||||
* Customizable container template. Add your own classes for styling and sizing.
|
||||
* @option
|
||||
* @example '<div data-sticky-container class="small-6 columns"></div>'
|
||||
*/
|
||||
container: '<div data-sticky-container></div>',
|
||||
/**
|
||||
* Location in the view the element sticks to.
|
||||
* @option
|
||||
* @example 'top'
|
||||
*/
|
||||
stickTo: 'top',
|
||||
/**
|
||||
* If anchored to a single element, the id of that element.
|
||||
* @option
|
||||
* @example 'exampleId'
|
||||
*/
|
||||
anchor: '',
|
||||
/**
|
||||
* If using more than one element as anchor points, the id of the top anchor.
|
||||
* @option
|
||||
* @example 'exampleId:top'
|
||||
*/
|
||||
topAnchor: '',
|
||||
/**
|
||||
* If using more than one element as anchor points, the id of the bottom anchor.
|
||||
* @option
|
||||
* @example 'exampleId:bottom'
|
||||
*/
|
||||
btmAnchor: '',
|
||||
/**
|
||||
* Margin, in `em`'s to apply to the top of the element when it becomes sticky.
|
||||
* @option
|
||||
* @example 1
|
||||
*/
|
||||
marginTop: 1,
|
||||
/**
|
||||
* Margin, in `em`'s to apply to the bottom of the element when it becomes sticky.
|
||||
* @option
|
||||
* @example 1
|
||||
*/
|
||||
marginBottom: 1,
|
||||
/**
|
||||
* Breakpoint string that is the minimum screen size an element should become sticky.
|
||||
* @option
|
||||
* @example 'medium'
|
||||
*/
|
||||
stickyOn: 'medium',
|
||||
/**
|
||||
* Class applied to sticky element, and removed on destruction. Foundation defaults to `sticky`.
|
||||
* @option
|
||||
* @example 'sticky'
|
||||
*/
|
||||
stickyClass: 'sticky',
|
||||
/**
|
||||
* Class applied to sticky container. Foundation defaults to `sticky-container`.
|
||||
* @option
|
||||
* @example 'sticky-container'
|
||||
*/
|
||||
containerClass: 'sticky-container',
|
||||
/**
|
||||
* Number of scroll events between the plugin's recalculating sticky points. Setting it to `0` will cause it to recalc every scroll event, setting it to `-1` will prevent recalc on scroll.
|
||||
* @option
|
||||
* @example 50
|
||||
*/
|
||||
checkEvery: -1
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper function to calculate em values
|
||||
* @param Number {em} - number of em's to calculate into pixels
|
||||
*/
|
||||
function emCalc(em) {
|
||||
return parseInt(window.getComputedStyle(document.body, null).fontSize, 10) * em;
|
||||
}
|
||||
|
||||
// Window exports
|
||||
Foundation.plugin(Sticky, 'Sticky');
|
||||
|
||||
}(jQuery);
|
||||
Foundation.plugin(Sticky, 'Sticky');
|
||||
}(jQuery, window.Foundation);
|
||||
|
273
app/vendor/foundation/js/foundation.tabs.js
vendored
273
app/vendor/foundation/js/foundation.tabs.js
vendored
@ -1,15 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
|
||||
/**
|
||||
* Tabs module.
|
||||
* @module foundation.tabs
|
||||
* @requires foundation.util.keyboard
|
||||
* @requires foundation.util.timerAndImageLoader if tabs contain images
|
||||
*/
|
||||
!function($, Foundation) {
|
||||
'use strict';
|
||||
|
||||
class Tabs {
|
||||
/**
|
||||
* Creates a new instance of tabs.
|
||||
* @class
|
||||
@ -17,7 +14,7 @@ class Tabs {
|
||||
* @param {jQuery} element - jQuery object to make into tabs.
|
||||
* @param {Object} options - Overrides to the default plugin settings.
|
||||
*/
|
||||
constructor(element, options) {
|
||||
function Tabs(element, options){
|
||||
this.$element = element;
|
||||
this.options = $.extend({}, Tabs.defaults, this.$element.data(), options);
|
||||
|
||||
@ -35,23 +32,65 @@ class Tabs {
|
||||
});
|
||||
}
|
||||
|
||||
Tabs.defaults = {
|
||||
// /**
|
||||
// * Allows the JS to alter the url of the window. Not yet implemented.
|
||||
// */
|
||||
// deepLinking: false,
|
||||
// /**
|
||||
// * If deepLinking is enabled, allows the window to scroll to content if window is loaded with a hash including a tab-pane id
|
||||
// */
|
||||
// scrollToContent: false,
|
||||
/**
|
||||
* Allows the window to scroll to content of active pane on load if set to true.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
autoFocus: false,
|
||||
/**
|
||||
* Allows keyboard input to 'wrap' around the tab links.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
wrapOnKeys: true,
|
||||
/**
|
||||
* Allows the tab content panes to match heights if set to true.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
matchHeight: false,
|
||||
/**
|
||||
* Class applied to `li`'s in tab link list.
|
||||
* @option
|
||||
* @example 'tabs-title'
|
||||
*/
|
||||
linkClass: 'tabs-title',
|
||||
// contentClass: 'tabs-content',
|
||||
/**
|
||||
* Class applied to the content containers.
|
||||
* @option
|
||||
* @example 'tabs-panel'
|
||||
*/
|
||||
panelClass: 'tabs-panel'
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes the tabs by showing and focusing (if autoFocus=true) the preset active tab.
|
||||
* @private
|
||||
*/
|
||||
_init() {
|
||||
Tabs.prototype._init = function(){
|
||||
var _this = this;
|
||||
|
||||
this.$tabTitles = this.$element.find(`.${this.options.linkClass}`);
|
||||
this.$tabContent = $(`[data-tabs-content="${this.$element[0].id}"]`);
|
||||
this.$tabTitles = this.$element.find('.' + this.options.linkClass);
|
||||
this.$tabContent = $('[data-tabs-content="' + this.$element[0].id + '"]');
|
||||
|
||||
this.$tabTitles.each(function(){
|
||||
var $elem = $(this),
|
||||
$link = $elem.find('a'),
|
||||
isActive = $elem.hasClass('is-active'),
|
||||
hash = $link[0].hash.slice(1),
|
||||
linkId = $link[0].id ? $link[0].id : `${hash}-label`,
|
||||
$tabContent = $(`#${hash}`);
|
||||
hash = $link.attr('href').slice(1),
|
||||
linkId = hash + '-label',
|
||||
$tabContent = $(hash);
|
||||
|
||||
$elem.attr({'role': 'presentation'});
|
||||
|
||||
@ -72,67 +111,58 @@ class Tabs {
|
||||
$link.focus();
|
||||
}
|
||||
});
|
||||
|
||||
if(this.options.matchHeight) {
|
||||
if(this.options.matchHeight){
|
||||
var $images = this.$tabContent.find('img');
|
||||
|
||||
if ($images.length) {
|
||||
if($images.length){
|
||||
Foundation.onImagesLoaded($images, this._setHeight.bind(this));
|
||||
} else {
|
||||
}else{
|
||||
this._setHeight();
|
||||
}
|
||||
}
|
||||
|
||||
this._events();
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Adds event handlers for items within the tabs.
|
||||
* @private
|
||||
*/
|
||||
_events() {
|
||||
Tabs.prototype._events = function(){
|
||||
this._addKeyHandler();
|
||||
this._addClickHandler();
|
||||
this._setHeightMqHandler = null;
|
||||
|
||||
if (this.options.matchHeight) {
|
||||
this._setHeightMqHandler = this._setHeight.bind(this);
|
||||
|
||||
$(window).on('changed.zf.mediaquery', this._setHeightMqHandler);
|
||||
if(this.options.matchHeight){
|
||||
$(window).on('changed.zf.mediaquery', this._setHeight.bind(this));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds click handlers for items within the tabs.
|
||||
* @private
|
||||
*/
|
||||
_addClickHandler() {
|
||||
Tabs.prototype._addClickHandler = function(){
|
||||
var _this = this;
|
||||
|
||||
this.$element
|
||||
.off('click.zf.tabs')
|
||||
.on('click.zf.tabs', `.${this.options.linkClass}`, function(e){
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if ($(this).hasClass('is-active')) {
|
||||
return;
|
||||
}
|
||||
_this._handleTabChange($(this));
|
||||
});
|
||||
}
|
||||
this.$element.off('click.zf.tabs')
|
||||
.on('click.zf.tabs', '.' + this.options.linkClass, function(e){
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if($(this).hasClass('is-active')){
|
||||
return;
|
||||
}
|
||||
_this._handleTabChange($(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds keyboard event handlers for items within the tabs.
|
||||
* @private
|
||||
*/
|
||||
_addKeyHandler() {
|
||||
Tabs.prototype._addKeyHandler = function(){
|
||||
var _this = this;
|
||||
var $firstTab = _this.$element.find('li:first-of-type');
|
||||
var $lastTab = _this.$element.find('li:last-of-type');
|
||||
|
||||
this.$tabTitles.off('keydown.zf.tabs').on('keydown.zf.tabs', function(e){
|
||||
if (e.which === 9) return;
|
||||
|
||||
if(e.which === 9) return;
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
var $element = $(this),
|
||||
$elements = $element.parent('ul').children('li'),
|
||||
@ -165,14 +195,11 @@ class Tabs {
|
||||
next: function() {
|
||||
$nextElement.find('[role="tab"]').focus();
|
||||
_this._handleTabChange($nextElement);
|
||||
},
|
||||
handled: function() {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Opens the tab `$targetContent` defined by `$target`.
|
||||
@ -180,19 +207,16 @@ class Tabs {
|
||||
* @fires Tabs#change
|
||||
* @function
|
||||
*/
|
||||
_handleTabChange($target) {
|
||||
Tabs.prototype._handleTabChange = function($target){
|
||||
var $tabLink = $target.find('[role="tab"]'),
|
||||
hash = $tabLink[0].hash,
|
||||
$targetContent = this.$tabContent.find(hash),
|
||||
$oldTab = this.$element.
|
||||
find(`.${this.options.linkClass}.is-active`)
|
||||
.removeClass('is-active')
|
||||
.find('[role="tab"]')
|
||||
.attr({ 'aria-selected': 'false' });
|
||||
hash = $tabLink.attr('href'),
|
||||
$targetContent = $(hash),
|
||||
|
||||
$(`#${$oldTab.attr('aria-controls')}`)
|
||||
.removeClass('is-active')
|
||||
.attr({ 'aria-hidden': 'true' });
|
||||
$oldTab = this.$element.find('.' + this.options.linkClass + '.is-active')
|
||||
.removeClass('is-active').find('[role="tab"]')
|
||||
.attr({'aria-selected': 'false'}).attr('href');
|
||||
|
||||
$($oldTab).removeClass('is-active').attr({'aria-hidden': 'true'});
|
||||
|
||||
$target.addClass('is-active');
|
||||
|
||||
@ -207,27 +231,26 @@ class Tabs {
|
||||
* @event Tabs#change
|
||||
*/
|
||||
this.$element.trigger('change.zf.tabs', [$target]);
|
||||
}
|
||||
// Foundation.reflow(this.$element, 'tabs');
|
||||
};
|
||||
|
||||
/**
|
||||
* Public method for selecting a content pane to display.
|
||||
* @param {jQuery | String} elem - jQuery object or string of the id of the pane to display.
|
||||
* @function
|
||||
*/
|
||||
selectTab(elem) {
|
||||
Tabs.prototype.selectTab = function(elem){
|
||||
var idStr;
|
||||
|
||||
if (typeof elem === 'object') {
|
||||
if(typeof elem === 'object'){
|
||||
idStr = elem[0].id;
|
||||
} else {
|
||||
}else{
|
||||
idStr = elem;
|
||||
}
|
||||
|
||||
if (idStr.indexOf('#') < 0) {
|
||||
idStr = `#${idStr}`;
|
||||
if(idStr.indexOf('#') < 0){
|
||||
idStr = '#' + idStr;
|
||||
}
|
||||
|
||||
var $target = this.$tabTitles.find(`[href="${idStr}"]`).parent(`.${this.options.linkClass}`);
|
||||
var $target = this.$tabTitles.find('[href="' + idStr + '"]').parent('.' + this.options.linkClass);
|
||||
|
||||
this._handleTabChange($target);
|
||||
};
|
||||
@ -238,96 +261,46 @@ class Tabs {
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_setHeight() {
|
||||
Tabs.prototype._setHeight = function(){
|
||||
var max = 0;
|
||||
this.$tabContent
|
||||
.find(`.${this.options.panelClass}`)
|
||||
.css('height', '')
|
||||
.each(function() {
|
||||
var panel = $(this),
|
||||
isActive = panel.hasClass('is-active');
|
||||
this.$tabContent.find('.' + this.options.panelClass)
|
||||
.css('height', '')
|
||||
.each(function(){
|
||||
var panel = $(this),
|
||||
isActive = panel.hasClass('is-active');
|
||||
|
||||
if (!isActive) {
|
||||
panel.css({'visibility': 'hidden', 'display': 'block'});
|
||||
}
|
||||
if(!isActive){
|
||||
panel.css({'visibility': 'hidden', 'display': 'block'});
|
||||
}
|
||||
var temp = this.getBoundingClientRect().height;
|
||||
|
||||
var temp = this.getBoundingClientRect().height;
|
||||
if(!isActive){
|
||||
panel.css({'visibility': '', 'display': ''});
|
||||
}
|
||||
|
||||
if (!isActive) {
|
||||
panel.css({
|
||||
'visibility': '',
|
||||
'display': ''
|
||||
});
|
||||
}
|
||||
|
||||
max = temp > max ? temp : max;
|
||||
})
|
||||
.css('height', `${max}px`);
|
||||
}
|
||||
max = temp > max ? temp : max;
|
||||
})
|
||||
.css('height', max + 'px');
|
||||
};
|
||||
|
||||
/**
|
||||
* Destroys an instance of an tabs.
|
||||
* @fires Tabs#destroyed
|
||||
*/
|
||||
destroy() {
|
||||
this.$element
|
||||
.find(`.${this.options.linkClass}`)
|
||||
.off('.zf.tabs').hide().end()
|
||||
.find(`.${this.options.panelClass}`)
|
||||
.hide();
|
||||
|
||||
if (this.options.matchHeight) {
|
||||
if (this._setHeightMqHandler != null) {
|
||||
$(window).off('changed.zf.mediaquery', this._setHeightMqHandler);
|
||||
}
|
||||
Tabs.prototype.destroy = function() {
|
||||
this.$element.find('.' + this.options.linkClass)
|
||||
.off('.zf.tabs').hide().end()
|
||||
.find('.' + this.options.panelClass)
|
||||
.hide();
|
||||
if(this.options.matchHeight){
|
||||
$(window).off('changed.zf.mediaquery');
|
||||
}
|
||||
|
||||
Foundation.unregisterPlugin(this);
|
||||
};
|
||||
|
||||
Foundation.plugin(Tabs, 'Tabs');
|
||||
|
||||
function checkClass($elem){
|
||||
return $elem.hasClass('is-active');
|
||||
}
|
||||
}
|
||||
|
||||
Tabs.defaults = {
|
||||
/**
|
||||
* Allows the window to scroll to content of active pane on load if set to true.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
autoFocus: false,
|
||||
|
||||
/**
|
||||
* Allows keyboard input to 'wrap' around the tab links.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
wrapOnKeys: true,
|
||||
|
||||
/**
|
||||
* Allows the tab content panes to match heights if set to true.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
matchHeight: false,
|
||||
|
||||
/**
|
||||
* Class applied to `li`'s in tab link list.
|
||||
* @option
|
||||
* @example 'tabs-title'
|
||||
*/
|
||||
linkClass: 'tabs-title',
|
||||
|
||||
/**
|
||||
* Class applied to the content containers.
|
||||
* @option
|
||||
* @example 'tabs-panel'
|
||||
*/
|
||||
panelClass: 'tabs-panel'
|
||||
};
|
||||
|
||||
function checkClass($elem){
|
||||
return $elem.hasClass('is-active');
|
||||
}
|
||||
|
||||
// Window exports
|
||||
Foundation.plugin(Tabs, 'Tabs');
|
||||
|
||||
}(jQuery);
|
||||
}(jQuery, window.Foundation);
|
||||
|
75
app/vendor/foundation/js/foundation.toggler.js
vendored
75
app/vendor/foundation/js/foundation.toggler.js
vendored
@ -1,15 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
|
||||
/**
|
||||
* Toggler module.
|
||||
* @module foundation.toggler
|
||||
* @requires foundation.util.motion
|
||||
* @requires foundation.util.triggers
|
||||
*/
|
||||
|
||||
class Toggler {
|
||||
!function(Foundation, $) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Creates a new instance of Toggler.
|
||||
* @class
|
||||
@ -17,7 +14,7 @@ class Toggler {
|
||||
* @param {Object} element - jQuery object to add the trigger to.
|
||||
* @param {Object} options - Overrides to the default plugin settings.
|
||||
*/
|
||||
constructor(element, options) {
|
||||
function Toggler(element, options) {
|
||||
this.$element = element;
|
||||
this.options = $.extend({}, Toggler.defaults, element.data(), options);
|
||||
this.className = '';
|
||||
@ -28,12 +25,21 @@ class Toggler {
|
||||
Foundation.registerPlugin(this, 'Toggler');
|
||||
}
|
||||
|
||||
Toggler.defaults = {
|
||||
/**
|
||||
* Tells the plugin if the element should animated when toggled.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
animate: false
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes the Toggler plugin by parsing the toggle class from data-toggler, or animation classes from data-animate.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_init() {
|
||||
Toggler.prototype._init = function() {
|
||||
var input;
|
||||
// Parse animation classes if they were set
|
||||
if (this.options.animate) {
|
||||
@ -51,20 +57,20 @@ class Toggler {
|
||||
|
||||
// Add ARIA attributes to triggers
|
||||
var id = this.$element[0].id;
|
||||
$(`[data-open="${id}"], [data-close="${id}"], [data-toggle="${id}"]`)
|
||||
$('[data-open="'+id+'"], [data-close="'+id+'"], [data-toggle="'+id+'"]')
|
||||
.attr('aria-controls', id);
|
||||
// If the target is hidden, add aria-hidden
|
||||
this.$element.attr('aria-expanded', this.$element.is(':hidden') ? false : true);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes events for the toggle trigger.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_events() {
|
||||
Toggler.prototype._events = function() {
|
||||
this.$element.off('toggle.zf.trigger').on('toggle.zf.trigger', this.toggle.bind(this));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Toggles the target class on the target element. An event is fired from the original trigger depending on if the resultant state was "on" or "off".
|
||||
@ -72,11 +78,11 @@ class Toggler {
|
||||
* @fires Toggler#on
|
||||
* @fires Toggler#off
|
||||
*/
|
||||
toggle() {
|
||||
Toggler.prototype.toggle = function() {
|
||||
this[ this.options.animate ? '_toggleAnimate' : '_toggleClass']();
|
||||
}
|
||||
};
|
||||
|
||||
_toggleClass() {
|
||||
Toggler.prototype._toggleClass = function() {
|
||||
this.$element.toggleClass(this.className);
|
||||
|
||||
var isOn = this.$element.hasClass(this.className);
|
||||
@ -96,49 +102,46 @@ class Toggler {
|
||||
}
|
||||
|
||||
this._updateARIA(isOn);
|
||||
}
|
||||
};
|
||||
|
||||
_toggleAnimate() {
|
||||
Toggler.prototype._toggleAnimate = function() {
|
||||
var _this = this;
|
||||
|
||||
if (this.$element.is(':hidden')) {
|
||||
Foundation.Motion.animateIn(this.$element, this.animationIn, function() {
|
||||
_this._updateARIA(true);
|
||||
this.trigger('on.zf.toggler');
|
||||
_this._updateARIA(true);
|
||||
});
|
||||
}
|
||||
else {
|
||||
Foundation.Motion.animateOut(this.$element, this.animationOut, function() {
|
||||
_this._updateARIA(false);
|
||||
this.trigger('off.zf.toggler');
|
||||
_this._updateARIA(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_updateARIA(isOn) {
|
||||
Toggler.prototype._updateARIA = function(isOn) {
|
||||
this.$element.attr('aria-expanded', isOn ? true : false);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Destroys the instance of Toggler on the element.
|
||||
* @function
|
||||
*/
|
||||
destroy() {
|
||||
Toggler.prototype.destroy= function() {
|
||||
this.$element.off('.zf.toggler');
|
||||
Foundation.unregisterPlugin(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Toggler.defaults = {
|
||||
/**
|
||||
* Tells the plugin if the element should animated when toggled.
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
animate: false
|
||||
};
|
||||
Foundation.plugin(Toggler, 'Toggler');
|
||||
|
||||
// Window exports
|
||||
Foundation.plugin(Toggler, 'Toggler');
|
||||
// Exports for AMD/Browserify
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined')
|
||||
module.exports = Toggler;
|
||||
if (typeof define === 'function')
|
||||
define(['foundation'], function() {
|
||||
return Toggler;
|
||||
});
|
||||
|
||||
}(jQuery);
|
||||
}(Foundation, jQuery);
|
||||
|
340
app/vendor/foundation/js/foundation.tooltip.js
vendored
340
app/vendor/foundation/js/foundation.tooltip.js
vendored
@ -1,16 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
|
||||
/**
|
||||
* Tooltip module.
|
||||
* @module foundation.tooltip
|
||||
* @requires foundation.util.box
|
||||
* @requires foundation.util.mediaQuery
|
||||
* @requires foundation.util.triggers
|
||||
*/
|
||||
!function($, document, Foundation){
|
||||
'use strict';
|
||||
|
||||
class Tooltip {
|
||||
/**
|
||||
* Creates a new instance of a Tooltip.
|
||||
* @class
|
||||
@ -18,7 +14,7 @@ class Tooltip {
|
||||
* @param {jQuery} element - jQuery object to attach a tooltip to.
|
||||
* @param {Object} options - object to extend the default configuration.
|
||||
*/
|
||||
constructor(element, options) {
|
||||
function Tooltip(element, options){
|
||||
this.$element = element;
|
||||
this.options = $.extend({}, Tooltip.defaults, this.$element.data(), options);
|
||||
|
||||
@ -29,14 +25,103 @@ class Tooltip {
|
||||
Foundation.registerPlugin(this, 'Tooltip');
|
||||
}
|
||||
|
||||
Tooltip.defaults = {
|
||||
disableForTouch: false,
|
||||
/**
|
||||
* Time, in ms, before a tooltip should open on hover.
|
||||
* @option
|
||||
* @example 200
|
||||
*/
|
||||
hoverDelay: 200,
|
||||
/**
|
||||
* Time, in ms, a tooltip should take to fade into view.
|
||||
* @option
|
||||
* @example 150
|
||||
*/
|
||||
fadeInDuration: 150,
|
||||
/**
|
||||
* Time, in ms, a tooltip should take to fade out of view.
|
||||
* @option
|
||||
* @example 150
|
||||
*/
|
||||
fadeOutDuration: 150,
|
||||
/**
|
||||
* Disables hover events from opening the tooltip if set to true
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
disableHover: false,
|
||||
/**
|
||||
* Optional addtional classes to apply to the tooltip template on init.
|
||||
* @option
|
||||
* @example 'my-cool-tip-class'
|
||||
*/
|
||||
templateClasses: '',
|
||||
/**
|
||||
* Non-optional class added to tooltip templates. Foundation default is 'tooltip'.
|
||||
* @option
|
||||
* @example 'tooltip'
|
||||
*/
|
||||
tooltipClass: 'tooltip',
|
||||
/**
|
||||
* Class applied to the tooltip anchor element.
|
||||
* @option
|
||||
* @example 'has-tip'
|
||||
*/
|
||||
triggerClass: 'has-tip',
|
||||
/**
|
||||
* Minimum breakpoint size at which to open the tooltip.
|
||||
* @option
|
||||
* @example 'small'
|
||||
*/
|
||||
showOn: 'small',
|
||||
/**
|
||||
* Custom template to be used to generate markup for tooltip.
|
||||
* @option
|
||||
* @example '<div class="tooltip"></div>'
|
||||
*/
|
||||
template: '',
|
||||
/**
|
||||
* Text displayed in the tooltip template on open.
|
||||
* @option
|
||||
* @example 'Some cool space fact here.'
|
||||
*/
|
||||
tipText: '',
|
||||
touchCloseText: 'Tap to close.',
|
||||
/**
|
||||
* Allows the tooltip to remain open if triggered with a click or touch event.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
clickOpen: true,
|
||||
/**
|
||||
* Additional positioning classes, set by the JS
|
||||
* @option
|
||||
* @example 'top'
|
||||
*/
|
||||
positionClass: '',
|
||||
/**
|
||||
* Distance, in pixels, the template should push away from the anchor on the Y axis.
|
||||
* @option
|
||||
* @example 10
|
||||
*/
|
||||
vOffset: 10,
|
||||
/**
|
||||
* Distance, in pixels, the template should push away from the anchor on the X axis, if aligned to a side.
|
||||
* @option
|
||||
* @example 12
|
||||
*/
|
||||
hOffset: 12
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes the tooltip by setting the creating the tip element, adding it's text, setting private variables and setting attributes on the anchor.
|
||||
* @private
|
||||
*/
|
||||
_init() {
|
||||
Tooltip.prototype._init = function(){
|
||||
var elemId = this.$element.attr('aria-describedby') || Foundation.GetYoDigits(6, 'tooltip');
|
||||
|
||||
this.options.positionClass = this.options.positionClass || this._getPositionClass(this.$element);
|
||||
this.options.positionClass = this._getPositionClass(this.$element);
|
||||
this.options.tipText = this.options.tipText || this.$element.attr('title');
|
||||
this.template = this.options.template ? $(this.options.template) : this._buildTemplate(elemId);
|
||||
|
||||
@ -50,7 +135,7 @@ class Tooltip {
|
||||
'data-yeti-box': elemId,
|
||||
'data-toggle': elemId,
|
||||
'data-resize': elemId
|
||||
}).addClass(this.options.triggerClass);
|
||||
}).addClass(this.triggerClass);
|
||||
|
||||
//helper variables to track movement on collisions
|
||||
this.usedPositions = [];
|
||||
@ -58,16 +143,16 @@ class Tooltip {
|
||||
this.classChanged = false;
|
||||
|
||||
this._events();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Grabs the current positioning class, if present, and returns the value or an empty string.
|
||||
* @private
|
||||
*/
|
||||
_getPositionClass(element) {
|
||||
if (!element) { return ''; }
|
||||
Tooltip.prototype._getPositionClass = function(element){
|
||||
if(!element){ return ''; }
|
||||
// var position = element.attr('class').match(/top|left|right/g);
|
||||
var position = element[0].className.match(/\b(top|left|right)\b/g);
|
||||
var position = element[0].className.match(/(top|left|right)/g);
|
||||
position = position ? position[0] : '';
|
||||
return position;
|
||||
};
|
||||
@ -75,8 +160,8 @@ class Tooltip {
|
||||
* builds the tooltip element, adds attributes, and returns the template.
|
||||
* @private
|
||||
*/
|
||||
_buildTemplate(id) {
|
||||
var templateClasses = (`${this.options.tooltipClass} ${this.options.positionClass} ${this.options.templateClasses}`).trim();
|
||||
Tooltip.prototype._buildTemplate = function(id){
|
||||
var templateClasses = (this.options.tooltipClass + ' ' + this.options.positionClass).trim();
|
||||
var $template = $('<div></div>').addClass(templateClasses).attr({
|
||||
'role': 'tooltip',
|
||||
'aria-hidden': true,
|
||||
@ -85,54 +170,55 @@ class Tooltip {
|
||||
'id': id
|
||||
});
|
||||
return $template;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Function that gets called if a collision event is detected.
|
||||
* @param {String} position - positioning class to try
|
||||
* @private
|
||||
*/
|
||||
_reposition(position) {
|
||||
Tooltip.prototype._reposition = function(position){
|
||||
this.usedPositions.push(position ? position : 'bottom');
|
||||
|
||||
//default, try switching to opposite side
|
||||
if (!position && (this.usedPositions.indexOf('top') < 0)) {
|
||||
if(!position && (this.usedPositions.indexOf('top') < 0)){
|
||||
this.template.addClass('top');
|
||||
} else if (position === 'top' && (this.usedPositions.indexOf('bottom') < 0)) {
|
||||
}else if(position === 'top' && (this.usedPositions.indexOf('bottom') < 0)){
|
||||
this.template.removeClass(position);
|
||||
} else if (position === 'left' && (this.usedPositions.indexOf('right') < 0)) {
|
||||
}else if(position === 'left' && (this.usedPositions.indexOf('right') < 0)){
|
||||
this.template.removeClass(position)
|
||||
.addClass('right');
|
||||
} else if (position === 'right' && (this.usedPositions.indexOf('left') < 0)) {
|
||||
}else if(position === 'right' && (this.usedPositions.indexOf('left') < 0)){
|
||||
this.template.removeClass(position)
|
||||
.addClass('left');
|
||||
}
|
||||
|
||||
//if default change didn't work, try bottom or left first
|
||||
else if (!position && (this.usedPositions.indexOf('top') > -1) && (this.usedPositions.indexOf('left') < 0)) {
|
||||
else if(!position && (this.usedPositions.indexOf('top') > -1) && (this.usedPositions.indexOf('left') < 0)){
|
||||
this.template.addClass('left');
|
||||
} else if (position === 'top' && (this.usedPositions.indexOf('bottom') > -1) && (this.usedPositions.indexOf('left') < 0)) {
|
||||
}else if(position === 'top' && (this.usedPositions.indexOf('bottom') > -1) && (this.usedPositions.indexOf('left') < 0)){
|
||||
this.template.removeClass(position)
|
||||
.addClass('left');
|
||||
} else if (position === 'left' && (this.usedPositions.indexOf('right') > -1) && (this.usedPositions.indexOf('bottom') < 0)) {
|
||||
}else if(position === 'left' && (this.usedPositions.indexOf('right') > -1) && (this.usedPositions.indexOf('bottom') < 0)){
|
||||
this.template.removeClass(position);
|
||||
} else if (position === 'right' && (this.usedPositions.indexOf('left') > -1) && (this.usedPositions.indexOf('bottom') < 0)) {
|
||||
}else if(position === 'right' && (this.usedPositions.indexOf('left') > -1) && (this.usedPositions.indexOf('bottom') < 0)){
|
||||
this.template.removeClass(position);
|
||||
}
|
||||
//if nothing cleared, set to bottom
|
||||
else {
|
||||
else{
|
||||
this.template.removeClass(position);
|
||||
}
|
||||
this.classChanged = true;
|
||||
this.counter--;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* sets the position class of an element and recursively calls itself until there are no more possible positions to attempt, or the tooltip element is no longer colliding.
|
||||
* if the tooltip is larger than the screen width, default to full width - any user selected margin
|
||||
* @private
|
||||
*/
|
||||
_setPosition() {
|
||||
Tooltip.prototype._setPosition = function(){
|
||||
var position = this._getPositionClass(this.template),
|
||||
$tipDims = Foundation.Box.GetDimensions(this.template),
|
||||
$anchorDims = Foundation.Box.GetDimensions(this.$element),
|
||||
@ -141,7 +227,7 @@ class Tooltip {
|
||||
offset = (param === 'height') ? this.options.vOffset : this.options.hOffset,
|
||||
_this = this;
|
||||
|
||||
if (($tipDims.width >= $tipDims.windowDims.width) || (!this.counter && !Foundation.Box.ImNotTouchingYou(this.template))) {
|
||||
if(($tipDims.width >= $tipDims.windowDims.width) || (!this.counter && !Foundation.Box.ImNotTouchingYou(this.template))){
|
||||
this.template.offset(Foundation.Box.GetOffsets(this.template, this.$element, 'center bottom', this.options.vOffset, this.options.hOffset, true)).css({
|
||||
// this.$element.offset(Foundation.GetOffsets(this.template, this.$element, 'center bottom', this.options.vOffset, this.options.hOffset, true)).css({
|
||||
'width': $anchorDims.windowDims.width - (this.options.hOffset * 2),
|
||||
@ -152,20 +238,20 @@ class Tooltip {
|
||||
|
||||
this.template.offset(Foundation.Box.GetOffsets(this.template, this.$element,'center ' + (position || 'bottom'), this.options.vOffset, this.options.hOffset));
|
||||
|
||||
while(!Foundation.Box.ImNotTouchingYou(this.template) && this.counter) {
|
||||
while(!Foundation.Box.ImNotTouchingYou(this.template) && this.counter){
|
||||
this._reposition(position);
|
||||
this._setPosition();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* reveals the tooltip, and fires an event to close any other open tooltips on the page
|
||||
* @fires Tooltip#closeme
|
||||
* @fires Closeme#tooltip
|
||||
* @fires Tooltip#show
|
||||
* @function
|
||||
*/
|
||||
show() {
|
||||
if (this.options.showOn !== 'all' && !Foundation.MediaQuery.atLeast(this.options.showOn)) {
|
||||
Tooltip.prototype.show = function(){
|
||||
if(this.options.showOn !== 'all' && !Foundation.MediaQuery.atLeast(this.options.showOn)){
|
||||
// console.error('The screen is too small to display this tooltip');
|
||||
return false;
|
||||
}
|
||||
@ -187,7 +273,7 @@ class Tooltip {
|
||||
});
|
||||
_this.isActive = true;
|
||||
// console.log(this.template);
|
||||
this.template.stop().hide().css('visibility', '').fadeIn(this.options.fadeInDuration, function() {
|
||||
this.template.stop().hide().css('visibility', '').fadeIn(this.options.fadeInDuration, function(){
|
||||
//maybe do stuff?
|
||||
});
|
||||
/**
|
||||
@ -195,23 +281,23 @@ class Tooltip {
|
||||
* @event Tooltip#show
|
||||
*/
|
||||
this.$element.trigger('show.zf.tooltip');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Hides the current tooltip, and resets the positioning class if it was changed due to collision
|
||||
* @fires Tooltip#hide
|
||||
* @function
|
||||
*/
|
||||
hide() {
|
||||
Tooltip.prototype.hide = function(){
|
||||
// console.log('hiding', this.$element.data('yeti-box'));
|
||||
var _this = this;
|
||||
this.template.stop().attr({
|
||||
'aria-hidden': true,
|
||||
'data-is-active': false
|
||||
}).fadeOut(this.options.fadeOutDuration, function() {
|
||||
}).fadeOut(this.options.fadeOutDuration, function(){
|
||||
_this.isActive = false;
|
||||
_this.isClick = false;
|
||||
if (_this.classChanged) {
|
||||
if(_this.classChanged){
|
||||
_this.template
|
||||
.removeClass(_this._getPositionClass(_this.template))
|
||||
.addClass(_this.options.positionClass);
|
||||
@ -226,59 +312,53 @@ class Tooltip {
|
||||
* @event Tooltip#hide
|
||||
*/
|
||||
this.$element.trigger('hide.zf.tooltip');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* adds event listeners for the tooltip and its anchor
|
||||
* TODO combine some of the listeners like focus and mouseenter, etc.
|
||||
* @private
|
||||
*/
|
||||
_events() {
|
||||
Tooltip.prototype._events = function(){
|
||||
var _this = this;
|
||||
var $template = this.template;
|
||||
var isFocus = false;
|
||||
|
||||
if (!this.options.disableHover) {
|
||||
if(!this.options.disableHover){
|
||||
|
||||
this.$element
|
||||
.on('mouseenter.zf.tooltip', function(e) {
|
||||
if (!_this.isActive) {
|
||||
_this.timeout = setTimeout(function() {
|
||||
.on('mouseenter.zf.tooltip', function(e){
|
||||
if(!_this.isActive){
|
||||
_this.timeout = setTimeout(function(){
|
||||
_this.show();
|
||||
}, _this.options.hoverDelay);
|
||||
}
|
||||
})
|
||||
.on('mouseleave.zf.tooltip', function(e) {
|
||||
.on('mouseleave.zf.tooltip', function(e){
|
||||
clearTimeout(_this.timeout);
|
||||
if (!isFocus || (_this.isClick && !_this.options.clickOpen)) {
|
||||
if(!isFocus || (!_this.isClick && _this.options.clickOpen)){
|
||||
_this.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (this.options.clickOpen) {
|
||||
this.$element.on('mousedown.zf.tooltip', function(e) {
|
||||
if(this.options.clickOpen){
|
||||
this.$element.on('mousedown.zf.tooltip', function(e){
|
||||
e.stopImmediatePropagation();
|
||||
if (_this.isClick) {
|
||||
//_this.hide();
|
||||
if(_this.isClick){
|
||||
_this.hide();
|
||||
// _this.isClick = false;
|
||||
} else {
|
||||
}else{
|
||||
_this.isClick = true;
|
||||
if ((_this.options.disableHover || !_this.$element.attr('tabindex')) && !_this.isActive) {
|
||||
if((_this.options.disableHover || !_this.$element.attr('tabindex')) && !_this.isActive){
|
||||
_this.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$element.on('mousedown.zf.tooltip', function(e) {
|
||||
e.stopImmediatePropagation();
|
||||
_this.isClick = true;
|
||||
});
|
||||
}
|
||||
|
||||
if (!this.options.disableForTouch) {
|
||||
if(!this.options.disableForTouch){
|
||||
this.$element
|
||||
.on('tap.zf.tooltip touchend.zf.tooltip', function(e) {
|
||||
.on('tap.zf.tooltip touchend.zf.tooltip', function(e){
|
||||
_this.isActive ? _this.hide() : _this.show();
|
||||
});
|
||||
}
|
||||
@ -290,48 +370,45 @@ class Tooltip {
|
||||
});
|
||||
|
||||
this.$element
|
||||
.on('focus.zf.tooltip', function(e) {
|
||||
.on('focus.zf.tooltip', function(e){
|
||||
isFocus = true;
|
||||
if (_this.isClick) {
|
||||
// If we're not showing open on clicks, we need to pretend a click-launched focus isn't
|
||||
// a real focus, otherwise on hover and come back we get bad behavior
|
||||
if(!_this.options.clickOpen) { isFocus = false; }
|
||||
// console.log(_this.isClick);
|
||||
if(_this.isClick){
|
||||
return false;
|
||||
} else {
|
||||
}else{
|
||||
// $(window)
|
||||
_this.show();
|
||||
}
|
||||
})
|
||||
|
||||
.on('focusout.zf.tooltip', function(e) {
|
||||
.on('focusout.zf.tooltip', function(e){
|
||||
isFocus = false;
|
||||
_this.isClick = false;
|
||||
_this.hide();
|
||||
})
|
||||
|
||||
.on('resizeme.zf.trigger', function() {
|
||||
if (_this.isActive) {
|
||||
.on('resizeme.zf.trigger', function(){
|
||||
if(_this.isActive){
|
||||
_this._setPosition();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* adds a toggle method, in addition to the static show() & hide() functions
|
||||
* @function
|
||||
*/
|
||||
toggle() {
|
||||
if (this.isActive) {
|
||||
Tooltip.prototype.toggle = function(){
|
||||
if(this.isActive){
|
||||
this.hide();
|
||||
} else {
|
||||
}else{
|
||||
this.show();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Destroys an instance of tooltip, removes template element from the view.
|
||||
* @function
|
||||
*/
|
||||
destroy() {
|
||||
Tooltip.prototype.destroy = function(){
|
||||
this.$element.attr('title', this.template.text())
|
||||
.off('.zf.trigger .zf.tootip')
|
||||
// .removeClass('has-tip')
|
||||
@ -343,103 +420,10 @@ class Tooltip {
|
||||
this.template.remove();
|
||||
|
||||
Foundation.unregisterPlugin(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* TODO utilize resize event trigger
|
||||
*/
|
||||
|
||||
Tooltip.defaults = {
|
||||
disableForTouch: false,
|
||||
/**
|
||||
* Time, in ms, before a tooltip should open on hover.
|
||||
* @option
|
||||
* @example 200
|
||||
*/
|
||||
hoverDelay: 200,
|
||||
/**
|
||||
* Time, in ms, a tooltip should take to fade into view.
|
||||
* @option
|
||||
* @example 150
|
||||
*/
|
||||
fadeInDuration: 150,
|
||||
/**
|
||||
* Time, in ms, a tooltip should take to fade out of view.
|
||||
* @option
|
||||
* @example 150
|
||||
*/
|
||||
fadeOutDuration: 150,
|
||||
/**
|
||||
* Disables hover events from opening the tooltip if set to true
|
||||
* @option
|
||||
* @example false
|
||||
*/
|
||||
disableHover: false,
|
||||
/**
|
||||
* Optional addtional classes to apply to the tooltip template on init.
|
||||
* @option
|
||||
* @example 'my-cool-tip-class'
|
||||
*/
|
||||
templateClasses: '',
|
||||
/**
|
||||
* Non-optional class added to tooltip templates. Foundation default is 'tooltip'.
|
||||
* @option
|
||||
* @example 'tooltip'
|
||||
*/
|
||||
tooltipClass: 'tooltip',
|
||||
/**
|
||||
* Class applied to the tooltip anchor element.
|
||||
* @option
|
||||
* @example 'has-tip'
|
||||
*/
|
||||
triggerClass: 'has-tip',
|
||||
/**
|
||||
* Minimum breakpoint size at which to open the tooltip.
|
||||
* @option
|
||||
* @example 'small'
|
||||
*/
|
||||
showOn: 'small',
|
||||
/**
|
||||
* Custom template to be used to generate markup for tooltip.
|
||||
* @option
|
||||
* @example '<div class="tooltip"></div>'
|
||||
*/
|
||||
template: '',
|
||||
/**
|
||||
* Text displayed in the tooltip template on open.
|
||||
* @option
|
||||
* @example 'Some cool space fact here.'
|
||||
*/
|
||||
tipText: '',
|
||||
touchCloseText: 'Tap to close.',
|
||||
/**
|
||||
* Allows the tooltip to remain open if triggered with a click or touch event.
|
||||
* @option
|
||||
* @example true
|
||||
*/
|
||||
clickOpen: true,
|
||||
/**
|
||||
* Additional positioning classes, set by the JS
|
||||
* @option
|
||||
* @example 'top'
|
||||
*/
|
||||
positionClass: '',
|
||||
/**
|
||||
* Distance, in pixels, the template should push away from the anchor on the Y axis.
|
||||
* @option
|
||||
* @example 10
|
||||
*/
|
||||
vOffset: 10,
|
||||
/**
|
||||
* Distance, in pixels, the template should push away from the anchor on the X axis, if aligned to a side.
|
||||
* @option
|
||||
* @example 12
|
||||
*/
|
||||
hOffset: 12
|
||||
};
|
||||
|
||||
/**
|
||||
* TODO utilize resize event trigger
|
||||
*/
|
||||
|
||||
// Window exports
|
||||
Foundation.plugin(Tooltip, 'Tooltip');
|
||||
|
||||
}(jQuery);
|
||||
Foundation.plugin(Tooltip, 'Tooltip');
|
||||
}(jQuery, window.document, window.Foundation);
|
||||
|
352
app/vendor/foundation/js/foundation.util.box.js
vendored
352
app/vendor/foundation/js/foundation.util.box.js
vendored
@ -1,195 +1,169 @@
|
||||
'use strict';
|
||||
!function(Foundation, window){
|
||||
/**
|
||||
* Compares the dimensions of an element to a container and determines collision events with container.
|
||||
* @function
|
||||
* @param {jQuery} element - jQuery object to test for collisions.
|
||||
* @param {jQuery} parent - jQuery object to use as bounding container.
|
||||
* @param {Boolean} lrOnly - set to true to check left and right values only.
|
||||
* @param {Boolean} tbOnly - set to true to check top and bottom values only.
|
||||
* @default if no parent object passed, detects collisions with `window`.
|
||||
* @returns {Boolean} - true if collision free, false if a collision in any direction.
|
||||
*/
|
||||
var ImNotTouchingYou = function(element, parent, lrOnly, tbOnly){
|
||||
var eleDims = GetDimensions(element),
|
||||
top, bottom, left, right;
|
||||
|
||||
!function($) {
|
||||
if(parent){
|
||||
var parDims = GetDimensions(parent);
|
||||
|
||||
Foundation.Box = {
|
||||
ImNotTouchingYou: ImNotTouchingYou,
|
||||
GetDimensions: GetDimensions,
|
||||
GetOffsets: GetOffsets
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares the dimensions of an element to a container and determines collision events with container.
|
||||
* @function
|
||||
* @param {jQuery} element - jQuery object to test for collisions.
|
||||
* @param {jQuery} parent - jQuery object to use as bounding container.
|
||||
* @param {Boolean} lrOnly - set to true to check left and right values only.
|
||||
* @param {Boolean} tbOnly - set to true to check top and bottom values only.
|
||||
* @default if no parent object passed, detects collisions with `window`.
|
||||
* @returns {Boolean} - true if collision free, false if a collision in any direction.
|
||||
*/
|
||||
function ImNotTouchingYou(element, parent, lrOnly, tbOnly) {
|
||||
var eleDims = GetDimensions(element),
|
||||
top, bottom, left, right;
|
||||
|
||||
if (parent) {
|
||||
var parDims = GetDimensions(parent);
|
||||
|
||||
bottom = (eleDims.offset.top + eleDims.height <= parDims.height + parDims.offset.top);
|
||||
top = (eleDims.offset.top >= parDims.offset.top);
|
||||
left = (eleDims.offset.left >= parDims.offset.left);
|
||||
right = (eleDims.offset.left + eleDims.width <= parDims.width + parDims.offset.left);
|
||||
}
|
||||
else {
|
||||
bottom = (eleDims.offset.top + eleDims.height <= eleDims.windowDims.height + eleDims.windowDims.offset.top);
|
||||
top = (eleDims.offset.top >= eleDims.windowDims.offset.top);
|
||||
left = (eleDims.offset.left >= eleDims.windowDims.offset.left);
|
||||
right = (eleDims.offset.left + eleDims.width <= eleDims.windowDims.width);
|
||||
}
|
||||
|
||||
var allDirs = [bottom, top, left, right];
|
||||
|
||||
if (lrOnly) {
|
||||
return left === right === true;
|
||||
}
|
||||
|
||||
if (tbOnly) {
|
||||
return top === bottom === true;
|
||||
}
|
||||
|
||||
return allDirs.indexOf(false) === -1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Uses native methods to return an object of dimension values.
|
||||
* @function
|
||||
* @param {jQuery || HTML} element - jQuery object or DOM element for which to get the dimensions. Can be any element other that document or window.
|
||||
* @returns {Object} - nested object of integer pixel values
|
||||
* TODO - if element is window, return only those values.
|
||||
*/
|
||||
function GetDimensions(elem, test){
|
||||
elem = elem.length ? elem[0] : elem;
|
||||
|
||||
if (elem === window || elem === document) {
|
||||
throw new Error("I'm sorry, Dave. I'm afraid I can't do that.");
|
||||
}
|
||||
|
||||
var rect = elem.getBoundingClientRect(),
|
||||
parRect = elem.parentNode.getBoundingClientRect(),
|
||||
winRect = document.body.getBoundingClientRect(),
|
||||
winY = window.pageYOffset,
|
||||
winX = window.pageXOffset;
|
||||
|
||||
return {
|
||||
width: rect.width,
|
||||
height: rect.height,
|
||||
offset: {
|
||||
top: rect.top + winY,
|
||||
left: rect.left + winX
|
||||
},
|
||||
parentDims: {
|
||||
width: parRect.width,
|
||||
height: parRect.height,
|
||||
offset: {
|
||||
top: parRect.top + winY,
|
||||
left: parRect.left + winX
|
||||
}
|
||||
},
|
||||
windowDims: {
|
||||
width: winRect.width,
|
||||
height: winRect.height,
|
||||
offset: {
|
||||
top: winY,
|
||||
left: winX
|
||||
}
|
||||
bottom = (eleDims.offset.top + eleDims.height <= parDims.height + parDims.offset.top);
|
||||
top = (eleDims.offset.top >= parDims.offset.top);
|
||||
left = (eleDims.offset.left >= parDims.offset.left);
|
||||
right = (eleDims.offset.left + eleDims.width <= parDims.width);
|
||||
}else{
|
||||
bottom = (eleDims.offset.top + eleDims.height <= eleDims.windowDims.height + eleDims.windowDims.offset.top);
|
||||
top = (eleDims.offset.top >= eleDims.windowDims.offset.top);
|
||||
left = (eleDims.offset.left >= eleDims.windowDims.offset.left);
|
||||
right = (eleDims.offset.left + eleDims.width <= eleDims.windowDims.width);
|
||||
}
|
||||
}
|
||||
}
|
||||
var allDirs = [bottom, top, left, right];
|
||||
|
||||
/**
|
||||
* Returns an object of top and left integer pixel values for dynamically rendered elements,
|
||||
* such as: Tooltip, Reveal, and Dropdown
|
||||
* @function
|
||||
* @param {jQuery} element - jQuery object for the element being positioned.
|
||||
* @param {jQuery} anchor - jQuery object for the element's anchor point.
|
||||
* @param {String} position - a string relating to the desired position of the element, relative to it's anchor
|
||||
* @param {Number} vOffset - integer pixel value of desired vertical separation between anchor and element.
|
||||
* @param {Number} hOffset - integer pixel value of desired horizontal separation between anchor and element.
|
||||
* @param {Boolean} isOverflow - if a collision event is detected, sets to true to default the element to full width - any desired offset.
|
||||
* TODO alter/rewrite to work with `em` values as well/instead of pixels
|
||||
*/
|
||||
function GetOffsets(element, anchor, position, vOffset, hOffset, isOverflow) {
|
||||
var $eleDims = GetDimensions(element),
|
||||
$anchorDims = anchor ? GetDimensions(anchor) : null;
|
||||
if(lrOnly){ return left === right === true; }
|
||||
if(tbOnly){ return top === bottom === true; }
|
||||
|
||||
switch (position) {
|
||||
case 'top':
|
||||
return {
|
||||
left: (Foundation.rtl() ? $anchorDims.offset.left - $eleDims.width + $anchorDims.width : $anchorDims.offset.left),
|
||||
top: $anchorDims.offset.top - ($eleDims.height + vOffset)
|
||||
}
|
||||
break;
|
||||
case 'left':
|
||||
return {
|
||||
left: $anchorDims.offset.left - ($eleDims.width + hOffset),
|
||||
top: $anchorDims.offset.top
|
||||
}
|
||||
break;
|
||||
case 'right':
|
||||
return {
|
||||
left: $anchorDims.offset.left + $anchorDims.width + hOffset,
|
||||
top: $anchorDims.offset.top
|
||||
}
|
||||
break;
|
||||
case 'center top':
|
||||
return {
|
||||
left: ($anchorDims.offset.left + ($anchorDims.width / 2)) - ($eleDims.width / 2),
|
||||
top: $anchorDims.offset.top - ($eleDims.height + vOffset)
|
||||
}
|
||||
break;
|
||||
case 'center bottom':
|
||||
return {
|
||||
left: isOverflow ? hOffset : (($anchorDims.offset.left + ($anchorDims.width / 2)) - ($eleDims.width / 2)),
|
||||
top: $anchorDims.offset.top + $anchorDims.height + vOffset
|
||||
}
|
||||
break;
|
||||
case 'center left':
|
||||
return {
|
||||
left: $anchorDims.offset.left - ($eleDims.width + hOffset),
|
||||
top: ($anchorDims.offset.top + ($anchorDims.height / 2)) - ($eleDims.height / 2)
|
||||
}
|
||||
break;
|
||||
case 'center right':
|
||||
return {
|
||||
left: $anchorDims.offset.left + $anchorDims.width + hOffset + 1,
|
||||
top: ($anchorDims.offset.top + ($anchorDims.height / 2)) - ($eleDims.height / 2)
|
||||
}
|
||||
break;
|
||||
case 'center':
|
||||
return {
|
||||
left: ($eleDims.windowDims.offset.left + ($eleDims.windowDims.width / 2)) - ($eleDims.width / 2),
|
||||
top: ($eleDims.windowDims.offset.top + ($eleDims.windowDims.height / 2)) - ($eleDims.height / 2)
|
||||
}
|
||||
break;
|
||||
case 'reveal':
|
||||
return {
|
||||
left: ($eleDims.windowDims.width - $eleDims.width) / 2,
|
||||
top: $eleDims.windowDims.offset.top + vOffset
|
||||
}
|
||||
case 'reveal full':
|
||||
return {
|
||||
left: $eleDims.windowDims.offset.left,
|
||||
top: $eleDims.windowDims.offset.top
|
||||
}
|
||||
break;
|
||||
case 'left bottom':
|
||||
return {
|
||||
left: $anchorDims.offset.left,
|
||||
top: $anchorDims.offset.top + $anchorDims.height
|
||||
};
|
||||
break;
|
||||
case 'right bottom':
|
||||
return {
|
||||
left: $anchorDims.offset.left + $anchorDims.width + hOffset - $eleDims.width,
|
||||
top: $anchorDims.offset.top + $anchorDims.height
|
||||
};
|
||||
break;
|
||||
default:
|
||||
return {
|
||||
left: (Foundation.rtl() ? $anchorDims.offset.left - $eleDims.width + $anchorDims.width : $anchorDims.offset.left + hOffset),
|
||||
top: $anchorDims.offset.top + $anchorDims.height + vOffset
|
||||
}
|
||||
}
|
||||
}
|
||||
return allDirs.indexOf(false) === -1;
|
||||
};
|
||||
|
||||
}(jQuery);
|
||||
/**
|
||||
* Uses native methods to return an object of dimension values.
|
||||
* @function
|
||||
* @param {jQuery || HTML} element - jQuery object or DOM element for which to get the dimensions. Can be any element other that document or window.
|
||||
* @returns {Object} - nested object of integer pixel values
|
||||
* TODO - if element is window, return only those values.
|
||||
*/
|
||||
var GetDimensions = function(elem, test){
|
||||
elem = elem.length ? elem[0] : elem;
|
||||
|
||||
if(elem === window || elem === document){ throw new Error("I'm sorry, Dave. I'm afraid I can't do that."); }
|
||||
|
||||
var rect = elem.getBoundingClientRect(),
|
||||
parRect = elem.parentNode.getBoundingClientRect(),
|
||||
winRect = document.body.getBoundingClientRect(),
|
||||
winY = window.pageYOffset,
|
||||
winX = window.pageXOffset;
|
||||
|
||||
return {
|
||||
width: rect.width,
|
||||
height: rect.height,
|
||||
offset: {
|
||||
top: rect.top + winY,
|
||||
left: rect.left + winX
|
||||
},
|
||||
parentDims: {
|
||||
width: parRect.width,
|
||||
height: parRect.height,
|
||||
offset: {
|
||||
top: parRect.top + winY,
|
||||
left: parRect.left + winX
|
||||
}
|
||||
},
|
||||
windowDims: {
|
||||
width: winRect.width,
|
||||
height: winRect.height,
|
||||
offset: {
|
||||
top: winY,
|
||||
left: winX
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Returns an object of top and left integer pixel values for dynamically rendered elements,
|
||||
* such as: Tooltip, Reveal, and Dropdown
|
||||
* @function
|
||||
* @param {jQuery} element - jQuery object for the element being positioned.
|
||||
* @param {jQuery} anchor - jQuery object for the element's anchor point.
|
||||
* @param {String} position - a string relating to the desired position of the element, relative to it's anchor
|
||||
* @param {Number} vOffset - integer pixel value of desired vertical separation between anchor and element.
|
||||
* @param {Number} hOffset - integer pixel value of desired horizontal separation between anchor and element.
|
||||
* @param {Boolean} isOverflow - if a collision event is detected, sets to true to default the element to full width - any desired offset.
|
||||
* TODO alter/rewrite to work with `em` values as well/instead of pixels
|
||||
*/
|
||||
var GetOffsets = function(element, anchor, position, vOffset, hOffset, isOverflow){
|
||||
var $eleDims = GetDimensions(element),
|
||||
// var $eleDims = GetDimensions(element),
|
||||
$anchorDims = anchor ? GetDimensions(anchor) : null;
|
||||
// $anchorDims = anchor ? GetDimensions(anchor) : null;
|
||||
switch(position){
|
||||
case 'top':
|
||||
return {
|
||||
left: $anchorDims.offset.left,
|
||||
top: $anchorDims.offset.top - ($eleDims.height + vOffset)
|
||||
};
|
||||
break;
|
||||
case 'left':
|
||||
return {
|
||||
left: $anchorDims.offset.left - ($eleDims.width + hOffset),
|
||||
top: $anchorDims.offset.top
|
||||
};
|
||||
break;
|
||||
case 'right':
|
||||
return {
|
||||
left: $anchorDims.offset.left + $anchorDims.width + hOffset,
|
||||
top: $anchorDims.offset.top
|
||||
};
|
||||
break;
|
||||
case 'center top':
|
||||
return {
|
||||
left: ($anchorDims.offset.left + ($anchorDims.width / 2)) - ($eleDims.width / 2),
|
||||
top: $anchorDims.offset.top - ($eleDims.height + vOffset)
|
||||
};
|
||||
break;
|
||||
case 'center bottom':
|
||||
return {
|
||||
left: isOverflow ? hOffset : (($anchorDims.offset.left + ($anchorDims.width / 2)) - ($eleDims.width / 2)),
|
||||
top: $anchorDims.offset.top + $anchorDims.height + vOffset
|
||||
};
|
||||
break;
|
||||
case 'center left':
|
||||
return {
|
||||
left: $anchorDims.offset.left - ($eleDims.width + hOffset),
|
||||
top: ($anchorDims.offset.top + ($anchorDims.height / 2)) - ($eleDims.height / 2)
|
||||
};
|
||||
break;
|
||||
case 'center right':
|
||||
return {
|
||||
left: $anchorDims.offset.left + $anchorDims.width + hOffset + 1,
|
||||
top: ($anchorDims.offset.top + ($anchorDims.height / 2)) - ($eleDims.height / 2)
|
||||
};
|
||||
break;
|
||||
case 'center':
|
||||
return {
|
||||
left: ($eleDims.windowDims.offset.left + ($eleDims.windowDims.width / 2)) - ($eleDims.width / 2),
|
||||
top: ($eleDims.windowDims.offset.top + ($eleDims.windowDims.height / 2)) - ($eleDims.height / 2)
|
||||
};
|
||||
break;
|
||||
case 'reveal':
|
||||
return {
|
||||
left: ($eleDims.windowDims.width - $eleDims.width) / 2,
|
||||
top: $eleDims.windowDims.offset.top + vOffset
|
||||
};
|
||||
case 'reveal full':
|
||||
return {
|
||||
left: $eleDims.windowDims.offset.left,
|
||||
top: $eleDims.windowDims.offset.top
|
||||
};
|
||||
break;
|
||||
default:
|
||||
return {
|
||||
left: $anchorDims.offset.left,
|
||||
top: $anchorDims.offset.top + $anchorDims.height + vOffset
|
||||
};
|
||||
}
|
||||
};
|
||||
Foundation.Box = {
|
||||
ImNotTouchingYou: ImNotTouchingYou,
|
||||
GetDimensions: GetDimensions,
|
||||
GetOffsets: GetOffsets
|
||||
};
|
||||
}(window.Foundation, window);
|
||||
|
104
app/vendor/foundation/js/foundation.util.keyboard.js
vendored
104
app/vendor/foundation/js/foundation.util.keyboard.js
vendored
@ -5,26 +5,32 @@
|
||||
* or the web http://www.mariusolbertz.de/ *
|
||||
* *
|
||||
******************************************/
|
||||
!function($, Foundation){
|
||||
'use strict';
|
||||
Foundation.Keyboard = {};
|
||||
|
||||
'use strict';
|
||||
var keyCodes = {
|
||||
9: 'TAB',
|
||||
13: 'ENTER',
|
||||
27: 'ESCAPE',
|
||||
32: 'SPACE',
|
||||
37: 'ARROW_LEFT',
|
||||
38: 'ARROW_UP',
|
||||
39: 'ARROW_RIGHT',
|
||||
40: 'ARROW_DOWN'
|
||||
};
|
||||
|
||||
!function($) {
|
||||
/*
|
||||
* Constants for easier comparing.
|
||||
* Can be used like Foundation.parseKey(event) === Foundation.keys.SPACE
|
||||
*/
|
||||
var keys = (function(kcs) {
|
||||
var k = {};
|
||||
for (var kc in kcs) k[kcs[kc]] = kcs[kc];
|
||||
return k;
|
||||
})(keyCodes);
|
||||
|
||||
const keyCodes = {
|
||||
9: 'TAB',
|
||||
13: 'ENTER',
|
||||
27: 'ESCAPE',
|
||||
32: 'SPACE',
|
||||
37: 'ARROW_LEFT',
|
||||
38: 'ARROW_UP',
|
||||
39: 'ARROW_RIGHT',
|
||||
40: 'ARROW_DOWN'
|
||||
}
|
||||
|
||||
var commands = {}
|
||||
|
||||
var Keyboard = {
|
||||
keys: getKeyCodes(keyCodes),
|
||||
Foundation.Keyboard.keys = keys;
|
||||
|
||||
/**
|
||||
* Parses the (keyboard) event and returns a String that represents its key
|
||||
@ -32,13 +38,18 @@ var Keyboard = {
|
||||
* @param {Event} event - the event generated by the event handler
|
||||
* @return String key - String that represents the key pressed
|
||||
*/
|
||||
parseKey(event) {
|
||||
var parseKey = function(event) {
|
||||
var key = keyCodes[event.which || event.keyCode] || String.fromCharCode(event.which).toUpperCase();
|
||||
if (event.shiftKey) key = `SHIFT_${key}`;
|
||||
if (event.ctrlKey) key = `CTRL_${key}`;
|
||||
if (event.altKey) key = `ALT_${key}`;
|
||||
if (event.shiftKey) key = 'SHIFT_' + key;
|
||||
if (event.ctrlKey) key = 'CTRL_' + key;
|
||||
if (event.altKey) key = 'ALT_' + key;
|
||||
return key;
|
||||
},
|
||||
};
|
||||
Foundation.Keyboard.parseKey = parseKey;
|
||||
|
||||
|
||||
// plain commands per component go here, ltr and rtl are merged based on orientation
|
||||
var commands = {};
|
||||
|
||||
/**
|
||||
* Handles the given (keyboard) event
|
||||
@ -46,13 +57,12 @@ var Keyboard = {
|
||||
* @param {String} component - Foundation component's name, e.g. Slider or Reveal
|
||||
* @param {Objects} functions - collection of functions that are to be executed
|
||||
*/
|
||||
handleKey(event, component, functions) {
|
||||
var handleKey = function(event, component, functions) {
|
||||
var commandList = commands[component],
|
||||
keyCode = this.parseKey(event),
|
||||
keyCode = parseKey(event),
|
||||
cmds,
|
||||
command,
|
||||
fn;
|
||||
|
||||
if (!commandList) return console.warn('Component not defined!');
|
||||
|
||||
if (typeof commandList.ltr === 'undefined') { // this component does not differentiate between ltr and rtl
|
||||
@ -64,30 +74,33 @@ var Keyboard = {
|
||||
}
|
||||
command = cmds[keyCode];
|
||||
|
||||
|
||||
fn = functions[command];
|
||||
if (fn && typeof fn === 'function') { // execute function if exists
|
||||
var returnValue = fn.apply();
|
||||
if (functions.handled || typeof functions.handled === 'function') { // execute function when event was handled
|
||||
functions.handled(returnValue);
|
||||
}
|
||||
fn.apply();
|
||||
if (functions.handled || typeof functions.handled === 'function') { // execute function when event was handled
|
||||
functions.handled.apply();
|
||||
}
|
||||
} else {
|
||||
if (functions.unhandled || typeof functions.unhandled === 'function') { // execute function when event was not handled
|
||||
functions.unhandled();
|
||||
}
|
||||
if (functions.unhandled || typeof functions.unhandled === 'function') { // execute function when event was not handled
|
||||
functions.unhandled.apply();
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
Foundation.Keyboard.handleKey = handleKey;
|
||||
|
||||
/**
|
||||
* Finds all focusable elements within the given `$element`
|
||||
* @param {jQuery} $element - jQuery object to search within
|
||||
* @return {jQuery} $focusable - all focusable elements within `$element`
|
||||
*/
|
||||
findFocusable($element) {
|
||||
var findFocusable = function($element) {
|
||||
return $element.find('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]').filter(function() {
|
||||
if (!$(this).is(':visible') || $(this).attr('tabindex') < 0) { return false; } //only have visible elements and those that have a tabindex greater or equal 0
|
||||
return true;
|
||||
});
|
||||
},
|
||||
};
|
||||
Foundation.Keyboard.findFocusable = findFocusable;
|
||||
|
||||
/**
|
||||
* Returns the component name name
|
||||
@ -95,21 +108,8 @@ var Keyboard = {
|
||||
* @return String componentName
|
||||
*/
|
||||
|
||||
register(componentName, cmds) {
|
||||
var register = function(componentName, cmds) {
|
||||
commands[componentName] = cmds;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Constants for easier comparing.
|
||||
* Can be used like Foundation.parseKey(event) === Foundation.keys.SPACE
|
||||
*/
|
||||
function getKeyCodes(kcs) {
|
||||
var k = {};
|
||||
for (var kc in kcs) k[kcs[kc]] = kcs[kc];
|
||||
return k;
|
||||
}
|
||||
|
||||
Foundation.Keyboard = Keyboard;
|
||||
|
||||
}(jQuery);
|
||||
};
|
||||
Foundation.Keyboard.register = register;
|
||||
}(jQuery, window.Foundation);
|
||||
|
@ -1,9 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
!function($, Foundation) {
|
||||
|
||||
// Default set of media queries
|
||||
const defaultQueries = {
|
||||
var defaultQueries = {
|
||||
'default' : 'only screen',
|
||||
landscape : 'only screen and (orientation: landscape)',
|
||||
portrait : 'only screen and (orientation: portrait)',
|
||||
@ -17,42 +15,15 @@ const defaultQueries = {
|
||||
|
||||
var MediaQuery = {
|
||||
queries: [],
|
||||
|
||||
current: '',
|
||||
|
||||
/**
|
||||
* Initializes the media query helper, by extracting the breakpoint list from the CSS and activating the breakpoint watcher.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_init() {
|
||||
var self = this;
|
||||
var extractedStyles = $('.foundation-mq').css('font-family');
|
||||
var namedQueries;
|
||||
|
||||
namedQueries = parseStyleToObject(extractedStyles);
|
||||
|
||||
for (var key in namedQueries) {
|
||||
if(namedQueries.hasOwnProperty(key)) {
|
||||
self.queries.push({
|
||||
name: key,
|
||||
value: `only screen and (min-width: ${namedQueries[key]})`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.current = this._getCurrentSize();
|
||||
|
||||
this._watcher();
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks if the screen is at least as wide as a breakpoint.
|
||||
* @function
|
||||
* @param {String} size - Name of the breakpoint to check.
|
||||
* @returns {Boolean} `true` if the breakpoint matches, `false` if it's smaller.
|
||||
*/
|
||||
atLeast(size) {
|
||||
atLeast: function(size) {
|
||||
var query = this.get(size);
|
||||
|
||||
if (query) {
|
||||
@ -68,27 +39,52 @@ var MediaQuery = {
|
||||
* @param {String} size - Name of the breakpoint to get.
|
||||
* @returns {String|null} - The media query of the breakpoint, or `null` if the breakpoint doesn't exist.
|
||||
*/
|
||||
get(size) {
|
||||
get: function(size) {
|
||||
for (var i in this.queries) {
|
||||
if(this.queries.hasOwnProperty(i)) {
|
||||
var query = this.queries[i];
|
||||
if (size === query.name) return query.value;
|
||||
}
|
||||
var query = this.queries[i];
|
||||
if (size === query.name) return query.value;
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Initializes the media query helper, by extracting the breakpoint list from the CSS and activating the breakpoint watcher.
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_init: function() {
|
||||
var self = this;
|
||||
var extractedStyles = $('.foundation-mq').css('font-family');
|
||||
var namedQueries;
|
||||
|
||||
namedQueries = parseStyleToObject(extractedStyles);
|
||||
|
||||
for (var key in namedQueries) {
|
||||
self.queries.push({
|
||||
name: key,
|
||||
value: 'only screen and (min-width: ' + namedQueries[key] + ')'
|
||||
});
|
||||
}
|
||||
|
||||
this.current = this._getCurrentSize();
|
||||
|
||||
this._watcher();
|
||||
|
||||
// Extend default queries
|
||||
// namedQueries = $.extend(defaultQueries, namedQueries);
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the current breakpoint name by testing every breakpoint and returning the last one to match (the biggest one).
|
||||
* @function
|
||||
* @private
|
||||
* @returns {String} Name of the current breakpoint.
|
||||
*/
|
||||
_getCurrentSize() {
|
||||
_getCurrentSize: function() {
|
||||
var matched;
|
||||
|
||||
for (var i = 0; i < this.queries.length; i++) {
|
||||
for (var i in this.queries) {
|
||||
var query = this.queries[i];
|
||||
|
||||
if (window.matchMedia(query.value).matches) {
|
||||
@ -96,7 +92,7 @@ var MediaQuery = {
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof matched === 'object') {
|
||||
if(typeof matched === 'object') {
|
||||
return matched.name;
|
||||
} else {
|
||||
return matched;
|
||||
@ -108,16 +104,18 @@ var MediaQuery = {
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
_watcher() {
|
||||
$(window).on('resize.zf.mediaquery', () => {
|
||||
var newSize = this._getCurrentSize(), currentSize = this.current;
|
||||
_watcher: function() {
|
||||
var _this = this;
|
||||
|
||||
if (newSize !== currentSize) {
|
||||
// Change the current media query
|
||||
this.current = newSize;
|
||||
$(window).on('resize.zf.mediaquery', function() {
|
||||
var newSize = _this._getCurrentSize();
|
||||
|
||||
if (newSize !== _this.current) {
|
||||
// Broadcast the media query change on the window
|
||||
$(window).trigger('changed.zf.mediaquery', [newSize, currentSize]);
|
||||
$(window).trigger('changed.zf.mediaquery', [newSize, _this.current]);
|
||||
|
||||
// Change the current media query
|
||||
_this.current = newSize;
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -142,14 +140,14 @@ window.matchMedia || (window.matchMedia = function() {
|
||||
style.type = 'text/css';
|
||||
style.id = 'matchmediajs-test';
|
||||
|
||||
script && script.parentNode && script.parentNode.insertBefore(style, script);
|
||||
script.parentNode.insertBefore(style, script);
|
||||
|
||||
// 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers
|
||||
info = ('getComputedStyle' in window) && window.getComputedStyle(style, null) || style.currentStyle;
|
||||
|
||||
styleMedia = {
|
||||
matchMedium(media) {
|
||||
var text = `@media ${media}{ #matchmediajs-test { width: 1px; } }`;
|
||||
matchMedium: function(media) {
|
||||
var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }';
|
||||
|
||||
// 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers
|
||||
if (style.styleSheet) {
|
||||
@ -161,7 +159,7 @@ window.matchMedia || (window.matchMedia = function() {
|
||||
// Test if media query is true or false
|
||||
return info.width === '1px';
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return function(media) {
|
||||
@ -169,7 +167,7 @@ window.matchMedia || (window.matchMedia = function() {
|
||||
matches: styleMedia.matchMedium(media || 'all'),
|
||||
media: media || 'all'
|
||||
};
|
||||
}
|
||||
};
|
||||
}());
|
||||
|
||||
// Thank you: https://github.com/sindresorhus/query-string
|
||||
@ -209,6 +207,4 @@ function parseStyleToObject(str) {
|
||||
return styleObject;
|
||||
}
|
||||
|
||||
Foundation.MediaQuery = MediaQuery;
|
||||
|
||||
}(jQuery);
|
||||
}(jQuery, Foundation);
|
||||
|
128
app/vendor/foundation/js/foundation.util.motion.js
vendored
128
app/vendor/foundation/js/foundation.util.motion.js
vendored
@ -1,26 +1,70 @@
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
|
||||
/**
|
||||
* Motion module.
|
||||
* @module foundation.motion
|
||||
*/
|
||||
!function($, Foundation) {
|
||||
|
||||
const initClasses = ['mui-enter', 'mui-leave'];
|
||||
const activeClasses = ['mui-enter-active', 'mui-leave-active'];
|
||||
var initClasses = ['mui-enter', 'mui-leave'];
|
||||
var activeClasses = ['mui-enter-active', 'mui-leave-active'];
|
||||
|
||||
const Motion = {
|
||||
animateIn: function(element, animation, cb) {
|
||||
animate(true, element, animation, cb);
|
||||
},
|
||||
function animate(isIn, element, animation, cb) {
|
||||
element = $(element).eq(0);
|
||||
|
||||
animateOut: function(element, animation, cb) {
|
||||
animate(false, element, animation, cb);
|
||||
if (!element.length) return;
|
||||
|
||||
var initClass = isIn ? initClasses[0] : initClasses[1];
|
||||
var activeClass = isIn ? activeClasses[0] : activeClasses[1];
|
||||
|
||||
// Set up the animation
|
||||
reset();
|
||||
element.addClass(animation)
|
||||
.css('transition', 'none');
|
||||
// .addClass(initClass);
|
||||
// if(isIn) element.show();
|
||||
requestAnimationFrame(function() {
|
||||
element.addClass(initClass);
|
||||
if (isIn) element.show();
|
||||
});
|
||||
// Start the animation
|
||||
requestAnimationFrame(function() {
|
||||
element[0].offsetWidth;
|
||||
element.css('transition', '');
|
||||
element.addClass(activeClass);
|
||||
});
|
||||
// Move(500, element, function(){
|
||||
// // element[0].offsetWidth;
|
||||
// element.css('transition', '');
|
||||
// element.addClass(activeClass);
|
||||
// });
|
||||
|
||||
// Clean up the animation when it finishes
|
||||
element.one(Foundation.transitionend(element), finish);//.one('finished.zf.animate', finish);
|
||||
|
||||
// Hides the element (for out animations), resets the element, and runs a callback
|
||||
function finish() {
|
||||
if (!isIn) element.hide();
|
||||
reset();
|
||||
if (cb) cb.apply(element);
|
||||
}
|
||||
|
||||
// Resets transitions and removes motion-specific classes
|
||||
function reset() {
|
||||
element[0].style.transitionDuration = 0;
|
||||
element.removeClass(initClass + ' ' + activeClass + ' ' + animation);
|
||||
}
|
||||
}
|
||||
|
||||
function Move(duration, elem, fn){
|
||||
var Motion = {
|
||||
animateIn: function(element, animation, /*duration,*/ cb) {
|
||||
animate(true, element, animation, cb);
|
||||
},
|
||||
|
||||
animateOut: function(element, animation, /*duration,*/ cb) {
|
||||
animate(false, element, animation, cb);
|
||||
}
|
||||
};
|
||||
|
||||
var Move = function(duration, elem, fn){
|
||||
var anim, prog, start = null;
|
||||
// console.log('called');
|
||||
|
||||
@ -37,63 +81,9 @@ function Move(duration, elem, fn){
|
||||
}
|
||||
}
|
||||
anim = window.requestAnimationFrame(move);
|
||||
}
|
||||
|
||||
/**
|
||||
* Animates an element in or out using a CSS transition class.
|
||||
* @function
|
||||
* @private
|
||||
* @param {Boolean} isIn - Defines if the animation is in or out.
|
||||
* @param {Object} element - jQuery or HTML object to animate.
|
||||
* @param {String} animation - CSS class to use.
|
||||
* @param {Function} cb - Callback to run when animation is finished.
|
||||
*/
|
||||
function animate(isIn, element, animation, cb) {
|
||||
element = $(element).eq(0);
|
||||
|
||||
if (!element.length) return;
|
||||
|
||||
var initClass = isIn ? initClasses[0] : initClasses[1];
|
||||
var activeClass = isIn ? activeClasses[0] : activeClasses[1];
|
||||
|
||||
// Set up the animation
|
||||
reset();
|
||||
|
||||
element
|
||||
.addClass(animation)
|
||||
.css('transition', 'none');
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
element.addClass(initClass);
|
||||
if (isIn) element.show();
|
||||
});
|
||||
|
||||
// Start the animation
|
||||
requestAnimationFrame(() => {
|
||||
element[0].offsetWidth;
|
||||
element
|
||||
.css('transition', '')
|
||||
.addClass(activeClass);
|
||||
});
|
||||
|
||||
// Clean up the animation when it finishes
|
||||
element.one(Foundation.transitionend(element), finish);
|
||||
|
||||
// Hides the element (for out animations), resets the element, and runs a callback
|
||||
function finish() {
|
||||
if (!isIn) element.hide();
|
||||
reset();
|
||||
if (cb) cb.apply(element);
|
||||
}
|
||||
|
||||
// Resets transitions and removes motion-specific classes
|
||||
function reset() {
|
||||
element[0].style.transitionDuration = 0;
|
||||
element.removeClass(`${initClass} ${activeClass} ${animation}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Foundation.Move = Move;
|
||||
Foundation.Motion = Motion;
|
||||
|
||||
}(jQuery);
|
||||
}(jQuery, Foundation);
|
||||
|
136
app/vendor/foundation/js/foundation.util.nest.js
vendored
136
app/vendor/foundation/js/foundation.util.nest.js
vendored
@ -1,76 +1,64 @@
|
||||
'use strict';
|
||||
!function($, Foundation){
|
||||
'use strict';
|
||||
Foundation.Nest = {
|
||||
Feather: function(menu, type){
|
||||
menu.attr('role', 'menubar');
|
||||
type = type || 'zf';
|
||||
var items = menu.find('li').attr({'role': 'menuitem'}),
|
||||
subMenuClass = 'is-' + type + '-submenu',
|
||||
subItemClass = subMenuClass + '-item',
|
||||
hasSubClass = 'is-' + type + '-submenu-parent';
|
||||
menu.find('a:first').attr('tabindex', 0);
|
||||
items.each(function(){
|
||||
var $item = $(this),
|
||||
$sub = $item.children('ul');
|
||||
if($sub.length){
|
||||
$item.addClass('has-submenu ' + hasSubClass)
|
||||
.attr({
|
||||
'aria-haspopup': true,
|
||||
'aria-selected': false,
|
||||
'aria-expanded': false,
|
||||
'aria-label': $item.children('a:first').text()
|
||||
});
|
||||
$sub.addClass('submenu ' + subMenuClass)
|
||||
.attr({
|
||||
'data-submenu': '',
|
||||
'aria-hidden': true,
|
||||
'role': 'menu'
|
||||
});
|
||||
}
|
||||
if($item.parent('[data-submenu]').length){
|
||||
$item.addClass('is-submenu-item ' + subItemClass);
|
||||
}
|
||||
});
|
||||
return;
|
||||
},
|
||||
Burn: function(menu, type){
|
||||
var items = menu.find('li').removeAttr('tabindex'),
|
||||
subMenuClass = 'is-' + type + '-submenu',
|
||||
subItemClass = subMenuClass + '-item',
|
||||
hasSubClass = 'is-' + type + '-submenu-parent';
|
||||
|
||||
!function($) {
|
||||
// menu.find('.is-active').removeClass('is-active');
|
||||
menu.find('*')
|
||||
// menu.find('.' + subMenuClass + ', .' + subItemClass + ', .is-active, .has-submenu, .is-submenu-item, .submenu, [data-submenu]')
|
||||
.removeClass(subMenuClass + ' ' + subItemClass + ' ' + hasSubClass + ' has-submenu is-submenu-item submenu is-active')
|
||||
.removeAttr('data-submenu').css('display', '');
|
||||
|
||||
const Nest = {
|
||||
Feather(menu, type = 'zf') {
|
||||
menu.attr('role', 'menubar');
|
||||
|
||||
var items = menu.find('li').attr({'role': 'menuitem'}),
|
||||
subMenuClass = `is-${type}-submenu`,
|
||||
subItemClass = `${subMenuClass}-item`,
|
||||
hasSubClass = `is-${type}-submenu-parent`;
|
||||
|
||||
menu.find('a:first').attr('tabindex', 0);
|
||||
|
||||
items.each(function() {
|
||||
var $item = $(this),
|
||||
$sub = $item.children('ul');
|
||||
|
||||
if ($sub.length) {
|
||||
$item
|
||||
.addClass(hasSubClass)
|
||||
.attr({
|
||||
'aria-haspopup': true,
|
||||
'aria-expanded': false,
|
||||
'aria-label': $item.children('a:first').text()
|
||||
});
|
||||
|
||||
$sub
|
||||
.addClass(`submenu ${subMenuClass}`)
|
||||
.attr({
|
||||
'data-submenu': '',
|
||||
'aria-hidden': true,
|
||||
'role': 'menu'
|
||||
});
|
||||
}
|
||||
|
||||
if ($item.parent('[data-submenu]').length) {
|
||||
$item.addClass(`is-submenu-item ${subItemClass}`);
|
||||
}
|
||||
});
|
||||
|
||||
return;
|
||||
},
|
||||
|
||||
Burn(menu, type) {
|
||||
var items = menu.find('li').removeAttr('tabindex'),
|
||||
subMenuClass = `is-${type}-submenu`,
|
||||
subItemClass = `${subMenuClass}-item`,
|
||||
hasSubClass = `is-${type}-submenu-parent`;
|
||||
|
||||
menu
|
||||
.find('>li, .menu, .menu > li')
|
||||
.removeClass(`${subMenuClass} ${subItemClass} ${hasSubClass} is-submenu-item submenu is-active`)
|
||||
.removeAttr('data-submenu').css('display', '');
|
||||
|
||||
// console.log( menu.find('.' + subMenuClass + ', .' + subItemClass + ', .has-submenu, .is-submenu-item, .submenu, [data-submenu]')
|
||||
// .removeClass(subMenuClass + ' ' + subItemClass + ' has-submenu is-submenu-item submenu')
|
||||
// .removeAttr('data-submenu'));
|
||||
// items.each(function(){
|
||||
// var $item = $(this),
|
||||
// $sub = $item.children('ul');
|
||||
// if($item.parent('[data-submenu]').length){
|
||||
// $item.removeClass('is-submenu-item ' + subItemClass);
|
||||
// }
|
||||
// if($sub.length){
|
||||
// $item.removeClass('has-submenu');
|
||||
// $sub.removeClass('submenu ' + subMenuClass).removeAttr('data-submenu');
|
||||
// }
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
Foundation.Nest = Nest;
|
||||
|
||||
}(jQuery);
|
||||
// console.log( menu.find('.' + subMenuClass + ', .' + subItemClass + ', .has-submenu, .is-submenu-item, .submenu, [data-submenu]')
|
||||
// .removeClass(subMenuClass + ' ' + subItemClass + ' has-submenu is-submenu-item submenu')
|
||||
// .removeAttr('data-submenu'));
|
||||
// items.each(function(){
|
||||
// var $item = $(this),
|
||||
// $sub = $item.children('ul');
|
||||
// if($item.parent('[data-submenu]').length){
|
||||
// $item.removeClass('is-submenu-item ' + subItemClass);
|
||||
// }
|
||||
// if($sub.length){
|
||||
// $item.removeClass('has-submenu');
|
||||
// $sub.removeClass('submenu ' + subMenuClass).removeAttr('data-submenu');
|
||||
// }
|
||||
// });
|
||||
}
|
||||
};
|
||||
}(jQuery, window.Foundation);
|
||||
|
@ -1,86 +1,78 @@
|
||||
'use strict';
|
||||
!function($, Foundation){
|
||||
'use strict';
|
||||
var Timer = function(elem, options, cb){
|
||||
var _this = this,
|
||||
duration = options.duration,//options is an object for easily adding features later.
|
||||
nameSpace = Object.keys(elem.data())[0] || 'timer',
|
||||
remain = -1,
|
||||
start,
|
||||
timer;
|
||||
|
||||
!function($) {
|
||||
this.restart = function(){
|
||||
remain = -1;
|
||||
clearTimeout(timer);
|
||||
this.start();
|
||||
};
|
||||
|
||||
function Timer(elem, options, cb) {
|
||||
var _this = this,
|
||||
duration = options.duration,//options is an object for easily adding features later.
|
||||
nameSpace = Object.keys(elem.data())[0] || 'timer',
|
||||
remain = -1,
|
||||
start,
|
||||
timer;
|
||||
this.start = function(){
|
||||
// if(!elem.data('paused')){ return false; }//maybe implement this sanity check if used for other things.
|
||||
clearTimeout(timer);
|
||||
remain = remain <= 0 ? duration : remain;
|
||||
elem.data('paused', false);
|
||||
start = Date.now();
|
||||
timer = setTimeout(function(){
|
||||
if(options.infinite){
|
||||
_this.restart();//rerun the timer.
|
||||
}
|
||||
cb();
|
||||
}, remain);
|
||||
elem.trigger('timerstart.zf.' + nameSpace);
|
||||
};
|
||||
|
||||
this.isPaused = false;
|
||||
this.pause = function(){
|
||||
//if(elem.data('paused')){ return false; }//maybe implement this sanity check if used for other things.
|
||||
clearTimeout(timer);
|
||||
elem.data('paused', true);
|
||||
var end = Date.now();
|
||||
remain = remain - (end - start);
|
||||
elem.trigger('timerpaused.zf.' + nameSpace);
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Runs a callback function when images are fully loaded.
|
||||
* @param {Object} images - Image(s) to check if loaded.
|
||||
* @param {Func} callback - Function to execute when image is fully loaded.
|
||||
*/
|
||||
var onImagesLoaded = function(images, callback){
|
||||
var self = this,
|
||||
unloaded = images.length;
|
||||
|
||||
this.restart = function() {
|
||||
remain = -1;
|
||||
clearTimeout(timer);
|
||||
this.start();
|
||||
}
|
||||
|
||||
this.start = function() {
|
||||
this.isPaused = false;
|
||||
// if(!elem.data('paused')){ return false; }//maybe implement this sanity check if used for other things.
|
||||
clearTimeout(timer);
|
||||
remain = remain <= 0 ? duration : remain;
|
||||
elem.data('paused', false);
|
||||
start = Date.now();
|
||||
timer = setTimeout(function(){
|
||||
if(options.infinite){
|
||||
_this.restart();//rerun the timer.
|
||||
}
|
||||
if (cb && typeof cb === 'function') { cb(); }
|
||||
}, remain);
|
||||
elem.trigger(`timerstart.zf.${nameSpace}`);
|
||||
}
|
||||
|
||||
this.pause = function() {
|
||||
this.isPaused = true;
|
||||
//if(elem.data('paused')){ return false; }//maybe implement this sanity check if used for other things.
|
||||
clearTimeout(timer);
|
||||
elem.data('paused', true);
|
||||
var end = Date.now();
|
||||
remain = remain - (end - start);
|
||||
elem.trigger(`timerpaused.zf.${nameSpace}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs a callback function when images are fully loaded.
|
||||
* @param {Object} images - Image(s) to check if loaded.
|
||||
* @param {Func} callback - Function to execute when image is fully loaded.
|
||||
*/
|
||||
function onImagesLoaded(images, callback){
|
||||
var self = this,
|
||||
unloaded = images.length;
|
||||
|
||||
if (unloaded === 0) {
|
||||
callback();
|
||||
}
|
||||
|
||||
images.each(function() {
|
||||
if (this.complete) {
|
||||
singleImageLoaded();
|
||||
}
|
||||
else if (typeof this.naturalWidth !== 'undefined' && this.naturalWidth > 0) {
|
||||
singleImageLoaded();
|
||||
}
|
||||
else {
|
||||
$(this).one('load', function() {
|
||||
singleImageLoaded();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function singleImageLoaded() {
|
||||
unloaded--;
|
||||
if (unloaded === 0) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Foundation.Timer = Timer;
|
||||
Foundation.onImagesLoaded = onImagesLoaded;
|
||||
var singleImageLoaded = function() {
|
||||
unloaded--;
|
||||
if (unloaded === 0) {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
}(jQuery);
|
||||
images.each(function() {
|
||||
if (this.complete) {
|
||||
singleImageLoaded();
|
||||
}
|
||||
else if (typeof this.naturalWidth !== 'undefined' && this.naturalWidth > 0) {
|
||||
singleImageLoaded();
|
||||
}
|
||||
else {
|
||||
$(this).one('load', function() {
|
||||
singleImageLoaded();
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Foundation.Timer = Timer;
|
||||
Foundation.onImagesLoaded = onImagesLoaded;
|
||||
}(jQuery, window.Foundation);
|
||||
|
@ -43,7 +43,7 @@
|
||||
if(dir) {
|
||||
e.preventDefault();
|
||||
onTouchEnd.call(this);
|
||||
$(this).trigger('swipe', dir).trigger(`swipe${dir}`);
|
||||
$(this).trigger('swipe', dir).trigger('swipe' + dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -70,7 +70,7 @@
|
||||
$.event.special.swipe = { setup: init };
|
||||
|
||||
$.each(['left', 'up', 'down', 'right'], function () {
|
||||
$.event.special[`swipe${this}`] = { setup: function(){
|
||||
$.event.special['swipe' + this] = { setup: function(){
|
||||
$(this).on('swipe', $.noop);
|
||||
} };
|
||||
});
|
||||
@ -96,23 +96,10 @@
|
||||
touchmove: 'mousemove',
|
||||
touchend: 'mouseup'
|
||||
},
|
||||
type = eventTypes[event.type],
|
||||
simulatedEvent
|
||||
;
|
||||
type = eventTypes[event.type];
|
||||
|
||||
if('MouseEvent' in window && typeof window.MouseEvent === 'function') {
|
||||
simulatedEvent = new window.MouseEvent(type, {
|
||||
'bubbles': true,
|
||||
'cancelable': true,
|
||||
'screenX': first.screenX,
|
||||
'screenY': first.screenY,
|
||||
'clientX': first.clientX,
|
||||
'clientY': first.clientY
|
||||
});
|
||||
} else {
|
||||
simulatedEvent = document.createEvent('MouseEvent');
|
||||
simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0/*left*/, null);
|
||||
}
|
||||
var simulatedEvent = document.createEvent('MouseEvent');
|
||||
simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0/*left*/, null);
|
||||
first.target.dispatchEvent(simulatedEvent);
|
||||
};
|
||||
};
|
||||
|
435
app/vendor/foundation/js/foundation.util.triggers.js
vendored
435
app/vendor/foundation/js/foundation.util.triggers.js
vendored
@ -1,239 +1,222 @@
|
||||
'use strict';
|
||||
|
||||
!function($) {
|
||||
|
||||
const MutationObserver = (function () {
|
||||
var prefixes = ['WebKit', 'Moz', 'O', 'Ms', ''];
|
||||
for (var i=0; i < prefixes.length; i++) {
|
||||
if (`${prefixes[i]}MutationObserver` in window) {
|
||||
return window[`${prefixes[i]}MutationObserver`];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}());
|
||||
|
||||
const triggers = (el, type) => {
|
||||
el.data(type).split(' ').forEach(id => {
|
||||
$(`#${id}`)[ type === 'close' ? 'trigger' : 'triggerHandler'](`${type}.zf.trigger`, [el]);
|
||||
!function(Foundation, $) {
|
||||
'use strict';
|
||||
// Elements with [data-open] will reveal a plugin that supports it when clicked.
|
||||
$(document).on('click.zf.trigger', '[data-open]', function() {
|
||||
var id = $(this).data('open');
|
||||
$('#' + id).triggerHandler('open.zf.trigger', [$(this)]);
|
||||
});
|
||||
};
|
||||
// Elements with [data-open] will reveal a plugin that supports it when clicked.
|
||||
$(document).on('click.zf.trigger', '[data-open]', function() {
|
||||
triggers($(this), 'open');
|
||||
});
|
||||
|
||||
// Elements with [data-close] will close a plugin that supports it when clicked.
|
||||
// If used without a value on [data-close], the event will bubble, allowing it to close a parent component.
|
||||
$(document).on('click.zf.trigger', '[data-close]', function() {
|
||||
let id = $(this).data('close');
|
||||
if (id) {
|
||||
triggers($(this), 'close');
|
||||
}
|
||||
else {
|
||||
$(this).trigger('close.zf.trigger');
|
||||
}
|
||||
});
|
||||
|
||||
// Elements with [data-toggle] will toggle a plugin that supports it when clicked.
|
||||
$(document).on('click.zf.trigger', '[data-toggle]', function() {
|
||||
triggers($(this), 'toggle');
|
||||
});
|
||||
|
||||
// Elements with [data-closable] will respond to close.zf.trigger events.
|
||||
$(document).on('close.zf.trigger', '[data-closable]', function(e){
|
||||
e.stopPropagation();
|
||||
let animation = $(this).data('closable');
|
||||
|
||||
if(animation !== ''){
|
||||
Foundation.Motion.animateOut($(this), animation, function() {
|
||||
$(this).trigger('closed.zf');
|
||||
});
|
||||
}else{
|
||||
$(this).fadeOut().trigger('closed.zf');
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('focus.zf.trigger blur.zf.trigger', '[data-toggle-focus]', function() {
|
||||
let id = $(this).data('toggle-focus');
|
||||
$(`#${id}`).triggerHandler('toggle.zf.trigger', [$(this)]);
|
||||
});
|
||||
|
||||
/**
|
||||
* Fires once after all other scripts have loaded
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
$(window).on('load', () => {
|
||||
checkListeners();
|
||||
});
|
||||
|
||||
function checkListeners() {
|
||||
eventsListener();
|
||||
resizeListener();
|
||||
scrollListener();
|
||||
closemeListener();
|
||||
}
|
||||
|
||||
//******** only fires this function once on load, if there's something to watch ********
|
||||
function closemeListener(pluginName) {
|
||||
var yetiBoxes = $('[data-yeti-box]'),
|
||||
plugNames = ['dropdown', 'tooltip', 'reveal'];
|
||||
|
||||
if(pluginName){
|
||||
if(typeof pluginName === 'string'){
|
||||
plugNames.push(pluginName);
|
||||
}else if(typeof pluginName === 'object' && typeof pluginName[0] === 'string'){
|
||||
plugNames.concat(pluginName);
|
||||
}else{
|
||||
console.error('Plugin names must be strings');
|
||||
// Elements with [data-close] will close a plugin that supports it when clicked.
|
||||
// If used without a value on [data-close], the event will bubble, allowing it to close a parent component.
|
||||
$(document).on('click.zf.trigger', '[data-close]', function() {
|
||||
var id = $(this).data('close');
|
||||
if (id) {
|
||||
$('#' + id).triggerHandler('close.zf.trigger', [$(this)]);
|
||||
}
|
||||
}
|
||||
if(yetiBoxes.length){
|
||||
let listeners = plugNames.map((name) => {
|
||||
return `closeme.zf.${name}`;
|
||||
}).join(' ');
|
||||
else {
|
||||
$(this).trigger('close.zf.trigger');
|
||||
}
|
||||
});
|
||||
|
||||
$(window).off(listeners).on(listeners, function(e, pluginId){
|
||||
let plugin = e.namespace.split('.')[0];
|
||||
let plugins = $(`[data-${plugin}]`).not(`[data-yeti-box="${pluginId}"]`);
|
||||
// Elements with [data-toggle] will toggle a plugin that supports it when clicked.
|
||||
$(document).on('click.zf.trigger', '[data-toggle]', function() {
|
||||
var id = $(this).data('toggle');
|
||||
$('#' + id).triggerHandler('toggle.zf.trigger', [$(this)]);
|
||||
});
|
||||
|
||||
plugins.each(function(){
|
||||
let _this = $(this);
|
||||
|
||||
_this.triggerHandler('close.zf.trigger', [_this]);
|
||||
// Elements with [data-closable] will respond to close.zf.trigger events.
|
||||
$(document).on('close.zf.trigger', '[data-closable]', function() {
|
||||
var animation = $(this).data('closable') || 'fade-out';
|
||||
if(Foundation.Motion){
|
||||
Foundation.Motion.animateOut($(this), animation, function() {
|
||||
$(this).trigger('closed.zf');
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function resizeListener(debounce){
|
||||
let timer,
|
||||
$nodes = $('[data-resize]');
|
||||
if($nodes.length){
|
||||
$(window).off('resize.zf.trigger')
|
||||
.on('resize.zf.trigger', function(e) {
|
||||
if (timer) { clearTimeout(timer); }
|
||||
|
||||
timer = setTimeout(function(){
|
||||
|
||||
if(!MutationObserver){//fallback for IE 9
|
||||
$nodes.each(function(){
|
||||
$(this).triggerHandler('resizeme.zf.trigger');
|
||||
});
|
||||
}
|
||||
//trigger all listening elements and signal a resize event
|
||||
$nodes.attr('data-events', "resize");
|
||||
}, debounce || 10);//default time to emit resize event
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function scrollListener(debounce){
|
||||
let timer,
|
||||
$nodes = $('[data-scroll]');
|
||||
if($nodes.length){
|
||||
$(window).off('scroll.zf.trigger')
|
||||
.on('scroll.zf.trigger', function(e){
|
||||
if(timer){ clearTimeout(timer); }
|
||||
|
||||
timer = setTimeout(function(){
|
||||
|
||||
if(!MutationObserver){//fallback for IE 9
|
||||
$nodes.each(function(){
|
||||
$(this).triggerHandler('scrollme.zf.trigger');
|
||||
});
|
||||
}
|
||||
//trigger all listening elements and signal a scroll event
|
||||
$nodes.attr('data-events', "scroll");
|
||||
}, debounce || 10);//default time to emit scroll event
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function eventsListener() {
|
||||
if(!MutationObserver){ return false; }
|
||||
let nodes = document.querySelectorAll('[data-resize], [data-scroll], [data-mutate]');
|
||||
|
||||
//element callback
|
||||
var listeningElementsMutation = function(mutationRecordsList) {
|
||||
var $target = $(mutationRecordsList[0].target);
|
||||
//trigger the event handler for the element depending on type
|
||||
switch ($target.attr("data-events")) {
|
||||
|
||||
case "resize" :
|
||||
$target.triggerHandler('resizeme.zf.trigger', [$target]);
|
||||
break;
|
||||
|
||||
case "scroll" :
|
||||
$target.triggerHandler('scrollme.zf.trigger', [$target, window.pageYOffset]);
|
||||
break;
|
||||
|
||||
// case "mutate" :
|
||||
// console.log('mutate', $target);
|
||||
// $target.triggerHandler('mutate.zf.trigger');
|
||||
//
|
||||
// //make sure we don't get stuck in an infinite loop from sloppy codeing
|
||||
// if ($target.index('[data-mutate]') == $("[data-mutate]").length-1) {
|
||||
// domMutationObserver();
|
||||
// }
|
||||
// break;
|
||||
|
||||
default :
|
||||
return false;
|
||||
//nothing
|
||||
}else{
|
||||
$(this).fadeOut().trigger('closed.zf');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if(nodes.length){
|
||||
//for each element that needs to listen for resizing, scrolling, (or coming soon mutation) add a single observer
|
||||
for (var i = 0; i <= nodes.length-1; i++) {
|
||||
let elementObserver = new MutationObserver(listeningElementsMutation);
|
||||
elementObserver.observe(nodes[i], { attributes: true, childList: false, characterData: false, subtree:false, attributeFilter:["data-events"]});
|
||||
var MutationObserver = (function () {
|
||||
var prefixes = ['WebKit', 'Moz', 'O', 'Ms', ''];
|
||||
for (var i=0; i < prefixes.length; i++) {
|
||||
if (prefixes[i] + 'MutationObserver' in window) {
|
||||
return window[prefixes[i] + 'MutationObserver'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}());
|
||||
|
||||
// ------------------------------------
|
||||
|
||||
// [PH]
|
||||
// Foundation.CheckWatchers = checkWatchers;
|
||||
Foundation.IHearYou = checkListeners;
|
||||
// Foundation.ISeeYou = scrollListener;
|
||||
// Foundation.IFeelYou = closemeListener;
|
||||
var checkListeners = function(){
|
||||
eventsListener();
|
||||
resizeListener();
|
||||
scrollListener();
|
||||
closemeListener();
|
||||
};
|
||||
/**
|
||||
* Fires once after all other scripts have loaded
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
$(window).load(function(){
|
||||
checkListeners();
|
||||
});
|
||||
|
||||
}(jQuery);
|
||||
//******** only fires this function once on load, if there's something to watch ********
|
||||
var closemeListener = function(pluginName){
|
||||
var yetiBoxes = $('[data-yeti-box]'),
|
||||
plugNames = ['dropdown', 'tooltip', 'reveal'];
|
||||
|
||||
// function domMutationObserver(debounce) {
|
||||
// // !!! This is coming soon and needs more work; not active !!! //
|
||||
// var timer,
|
||||
// nodes = document.querySelectorAll('[data-mutate]');
|
||||
// //
|
||||
// if (nodes.length) {
|
||||
// // var MutationObserver = (function () {
|
||||
// // var prefixes = ['WebKit', 'Moz', 'O', 'Ms', ''];
|
||||
// // for (var i=0; i < prefixes.length; i++) {
|
||||
// // if (prefixes[i] + 'MutationObserver' in window) {
|
||||
// // return window[prefixes[i] + 'MutationObserver'];
|
||||
// // }
|
||||
// // }
|
||||
// // return false;
|
||||
// // }());
|
||||
//
|
||||
//
|
||||
// //for the body, we need to listen for all changes effecting the style and class attributes
|
||||
// var bodyObserver = new MutationObserver(bodyMutation);
|
||||
// bodyObserver.observe(document.body, { attributes: true, childList: true, characterData: false, subtree:true, attributeFilter:["style", "class"]});
|
||||
//
|
||||
//
|
||||
// //body callback
|
||||
// function bodyMutation(mutate) {
|
||||
// //trigger all listening elements and signal a mutation event
|
||||
// if (timer) { clearTimeout(timer); }
|
||||
//
|
||||
// timer = setTimeout(function() {
|
||||
// bodyObserver.disconnect();
|
||||
// $('[data-mutate]').attr('data-events',"mutate");
|
||||
// }, debounce || 150);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if(pluginName){
|
||||
if(typeof pluginName === 'string'){
|
||||
plugNames.push(pluginName);
|
||||
}else if(typeof pluginName === 'object' && typeof pluginName[0] === 'string'){
|
||||
plugNames.concat(pluginName);
|
||||
}else{
|
||||
console.error('Plugin names must be strings');
|
||||
}
|
||||
}
|
||||
if(yetiBoxes.length){
|
||||
var listeners = plugNames.map(function(name){
|
||||
return 'closeme.zf.' + name;
|
||||
}).join(' ');
|
||||
|
||||
$(window).off(listeners).on(listeners, function(e, pluginId){
|
||||
var plugin = e.namespace.split('.')[0];
|
||||
var plugins = $('[data-' + plugin + ']').not('[data-yeti-box="' + pluginId + '"]');
|
||||
|
||||
plugins.each(function(){
|
||||
var _this = $(this);
|
||||
|
||||
_this.triggerHandler('close.zf.trigger', [_this]);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
var resizeListener = function(debounce){
|
||||
var timer,
|
||||
$nodes = $('[data-resize]');
|
||||
if($nodes.length){
|
||||
$(window).off('resize.zf.trigger')
|
||||
.on('resize.zf.trigger', function(e) {
|
||||
if (timer) { clearTimeout(timer); }
|
||||
|
||||
timer = setTimeout(function(){
|
||||
|
||||
if(!MutationObserver){//fallback for IE 9
|
||||
$nodes.each(function(){
|
||||
$(this).triggerHandler('resizeme.zf.trigger');
|
||||
});
|
||||
}
|
||||
//trigger all listening elements and signal a resize event
|
||||
$nodes.attr('data-events', "resize");
|
||||
}, debounce || 10);//default time to emit resize event
|
||||
});
|
||||
}
|
||||
};
|
||||
var scrollListener = function(debounce){
|
||||
var timer,
|
||||
$nodes = $('[data-scroll]');
|
||||
if($nodes.length){
|
||||
$(window).off('scroll.zf.trigger')
|
||||
.on('scroll.zf.trigger', function(e){
|
||||
if(timer){ clearTimeout(timer); }
|
||||
|
||||
timer = setTimeout(function(){
|
||||
|
||||
if(!MutationObserver){//fallback for IE 9
|
||||
$nodes.each(function(){
|
||||
$(this).triggerHandler('scrollme.zf.trigger');
|
||||
});
|
||||
}
|
||||
//trigger all listening elements and signal a scroll event
|
||||
$nodes.attr('data-events', "scroll");
|
||||
}, debounce || 10);//default time to emit scroll event
|
||||
});
|
||||
}
|
||||
};
|
||||
// function domMutationObserver(debounce) {
|
||||
// // !!! This is coming soon and needs more work; not active !!! //
|
||||
// var timer,
|
||||
// nodes = document.querySelectorAll('[data-mutate]');
|
||||
// //
|
||||
// if (nodes.length) {
|
||||
// // var MutationObserver = (function () {
|
||||
// // var prefixes = ['WebKit', 'Moz', 'O', 'Ms', ''];
|
||||
// // for (var i=0; i < prefixes.length; i++) {
|
||||
// // if (prefixes[i] + 'MutationObserver' in window) {
|
||||
// // return window[prefixes[i] + 'MutationObserver'];
|
||||
// // }
|
||||
// // }
|
||||
// // return false;
|
||||
// // }());
|
||||
//
|
||||
//
|
||||
// //for the body, we need to listen for all changes effecting the style and class attributes
|
||||
// var bodyObserver = new MutationObserver(bodyMutation);
|
||||
// bodyObserver.observe(document.body, { attributes: true, childList: true, characterData: false, subtree:true, attributeFilter:["style", "class"]});
|
||||
//
|
||||
//
|
||||
// //body callback
|
||||
// function bodyMutation(mutate) {
|
||||
// //trigger all listening elements and signal a mutation event
|
||||
// if (timer) { clearTimeout(timer); }
|
||||
//
|
||||
// timer = setTimeout(function() {
|
||||
// bodyObserver.disconnect();
|
||||
// $('[data-mutate]').attr('data-events',"mutate");
|
||||
// }, debounce || 150);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
var eventsListener = function() {
|
||||
if(!MutationObserver){ return false; }
|
||||
var nodes = document.querySelectorAll('[data-resize], [data-scroll], [data-mutate]');
|
||||
|
||||
//element callback
|
||||
var listeningElementsMutation = function(mutationRecordsList) {
|
||||
var $target = $(mutationRecordsList[0].target);
|
||||
//trigger the event handler for the element depending on type
|
||||
switch ($target.attr("data-events")) {
|
||||
|
||||
case "resize" :
|
||||
$target.triggerHandler('resizeme.zf.trigger', [$target]);
|
||||
break;
|
||||
|
||||
case "scroll" :
|
||||
$target.triggerHandler('scrollme.zf.trigger', [$target, window.pageYOffset]);
|
||||
break;
|
||||
|
||||
// case "mutate" :
|
||||
// console.log('mutate', $target);
|
||||
// $target.triggerHandler('mutate.zf.trigger');
|
||||
//
|
||||
// //make sure we don't get stuck in an infinite loop from sloppy codeing
|
||||
// if ($target.index('[data-mutate]') == $("[data-mutate]").length-1) {
|
||||
// domMutationObserver();
|
||||
// }
|
||||
// break;
|
||||
|
||||
default :
|
||||
return false;
|
||||
//nothing
|
||||
}
|
||||
}
|
||||
|
||||
if(nodes.length){
|
||||
//for each element that needs to listen for resizing, scrolling, (or coming soon mutation) add a single observer
|
||||
for (var i = 0; i <= nodes.length-1; i++) {
|
||||
var elementObserver = new MutationObserver(listeningElementsMutation);
|
||||
elementObserver.observe(nodes[i], { attributes: true, childList: false, characterData: false, subtree:false, attributeFilter:["data-events"]});
|
||||
}
|
||||
}
|
||||
};
|
||||
// ------------------------------------
|
||||
|
||||
// [PH]
|
||||
// Foundation.CheckWatchers = checkWatchers;
|
||||
Foundation.IHearYou = checkListeners;
|
||||
// Foundation.ISeeYou = scrollListener;
|
||||
// Foundation.IFeelYou = closemeListener;
|
||||
|
||||
}(window.Foundation, window.jQuery);
|
||||
|
76
app/vendor/foundation/scss/_global.scss
vendored
76
app/vendor/foundation/scss/_global.scss
vendored
@ -20,15 +20,25 @@ $global-width: rem-calc(1200) !default;
|
||||
/// @type Number
|
||||
$global-lineheight: 1.5 !default;
|
||||
|
||||
/// Colors used for buttons, callouts, links, etc. There must always be a color called `primary`.
|
||||
/// @type Map
|
||||
$foundation-palette: (
|
||||
primary: #2199e8,
|
||||
secondary: #777,
|
||||
success: #3adb76,
|
||||
warning: #ffae00,
|
||||
alert: #ec5840,
|
||||
) !default;
|
||||
/// Primary color for interactive components like links and buttons.
|
||||
/// @type Color
|
||||
$primary-color: #2199e8 !default;
|
||||
|
||||
/// Secondary color, used with components that support the `.secondary` class.
|
||||
/// @type Color
|
||||
$secondary-color: #777 !default;
|
||||
|
||||
/// Color to indicate a positive status or action, used with the `.success` class.
|
||||
/// @type Color
|
||||
$success-color: #3adb76 !default;
|
||||
|
||||
/// Color to indicate a caution status or action, used with the `.warning` class.
|
||||
/// @type Color
|
||||
$warning-color: #ffae00 !default;
|
||||
|
||||
/// Color to indicate a negative status or action, used with the `.alert` class.
|
||||
/// @type Color
|
||||
$alert-color: #ec5840 !default;
|
||||
|
||||
/// Color used for light gray UI items.
|
||||
/// @type Color
|
||||
@ -87,31 +97,20 @@ $global-weight-bold: bold !default;
|
||||
$global-radius: 0 !default;
|
||||
|
||||
/// Sets the text direction of the CSS. Can be either `ltr` or `rtl`.
|
||||
/// @type Keyword
|
||||
$global-text-direction: ltr !default;
|
||||
|
||||
/// Enables flexbox for components that support it.
|
||||
/// @type Boolean
|
||||
$global-flexbox: false !default;
|
||||
|
||||
@if not map-has-key($foundation-palette, primary) {
|
||||
@error 'In $foundation-palette, you must have a color named "primary".';
|
||||
}
|
||||
|
||||
// Internal variables used for text direction
|
||||
$global-left: if($global-text-direction == rtl, right, left);
|
||||
$global-right: if($global-text-direction == rtl, left, right);
|
||||
|
||||
// Internal variables used for colors
|
||||
$primary-color: map-get($foundation-palette, primary);
|
||||
$secondary-color: map-get($foundation-palette, secondary);
|
||||
$success-color: map-get($foundation-palette, success);
|
||||
$warning-color: map-get($foundation-palette, warning);
|
||||
$alert-color: map-get($foundation-palette, alert);
|
||||
|
||||
// Remove this in 6.3
|
||||
$-zf-menu-icon-imported: false;
|
||||
$-zf-flex-classes-imported: false;
|
||||
// Internal map used to iterate through colors, to generate CSS classes with less code
|
||||
$foundation-colors: (
|
||||
primary: $primary-color,
|
||||
secondary: $secondary-color,
|
||||
success: $success-color,
|
||||
alert: $alert-color,
|
||||
warning: $warning-color,
|
||||
) !default;
|
||||
|
||||
@mixin foundation-global-styles {
|
||||
@include -zf-normalize;
|
||||
@ -128,8 +127,8 @@ $-zf-flex-classes-imported: false;
|
||||
|
||||
// Set box-sizing globally to handle padding and border widths
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
*:before,
|
||||
*:after {
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
@ -187,7 +186,6 @@ $-zf-flex-classes-imported: false;
|
||||
|
||||
// Reset <button> styles created by most browsers
|
||||
button {
|
||||
@include disable-mouse-outline;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
background: transparent;
|
||||
@ -196,15 +194,6 @@ $-zf-flex-classes-imported: false;
|
||||
border-radius: $global-radius;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
// Internal classes to show/hide elements in JavaScript
|
||||
.is-visible {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.is-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
/// Loads normalize.css.
|
||||
@ -513,7 +502,7 @@ $-zf-flex-classes-imported: false;
|
||||
|
||||
button[disabled],
|
||||
html input[disabled] {
|
||||
cursor: not-allowed;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -583,14 +572,13 @@ $-zf-flex-classes-imported: false;
|
||||
|
||||
/**
|
||||
* Define consistent border, margin, and padding.
|
||||
* [NOTE] We don't enable this ruleset in Foundation, because we want the <fieldset> element to have plain styling.
|
||||
*/
|
||||
|
||||
/* fieldset {
|
||||
fieldset {
|
||||
border: 1px solid #c0c0c0;
|
||||
margin: 0 2px;
|
||||
padding: 0.35em 0.625em 0.75em;
|
||||
} */
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct `color` not being inherited in IE 8/9/10/11.
|
||||
|
@ -36,7 +36,7 @@ $accordion-content-border: 1px solid $light-gray !default;
|
||||
|
||||
/// Default text color of tab content.
|
||||
/// @type Color
|
||||
$accordion-content-color: foreground($accordion-content-background, $body-font-color) !default;
|
||||
$accordion-content-color: foreground($accordion-background, $primary-color) !default;
|
||||
|
||||
/// Default padding for tab content.
|
||||
/// @type Number | List
|
||||
@ -46,20 +46,11 @@ $accordion-content-padding: 1rem !default;
|
||||
@mixin accordion-container {
|
||||
list-style-type: none;
|
||||
background: $accordion-background;
|
||||
border: $accordion-content-border;
|
||||
border-radius: $global-radius;
|
||||
margin-#{$global-left}: 0;
|
||||
}
|
||||
|
||||
/// Adds styles for the accordion item. Apply this to the list item within an accordion ul.
|
||||
@mixin accordion-item {
|
||||
&:first-child > :first-child {
|
||||
border-radius: $global-radius $global-radius 0 0;
|
||||
}
|
||||
|
||||
&:last-child > :last-child {
|
||||
border-radius: 0 0 $global-radius $global-radius;
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds styles for the title of an accordion item. Apply this to the link within an accordion item.
|
||||
@mixin accordion-title {
|
||||
display: block;
|
||||
@ -68,19 +59,18 @@ $accordion-content-padding: 1rem !default;
|
||||
font-size: rem-calc(12);
|
||||
color: $accordion-item-color;
|
||||
position: relative;
|
||||
border: $accordion-content-border;
|
||||
border-bottom: 0;
|
||||
|
||||
:last-child:not(.is-active) > & {
|
||||
border-radius: 0 0 $global-radius $global-radius;
|
||||
border-bottom: $accordion-content-border;
|
||||
}
|
||||
border-bottom: $accordion-content-border;
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
background-color: $accordion-item-background-hover;
|
||||
}
|
||||
|
||||
// Remove the border on the last title
|
||||
:last-child > & {
|
||||
border-bottom-width: 0;
|
||||
}
|
||||
|
||||
@if $accordion-plusminus {
|
||||
&::before {
|
||||
content: '+';
|
||||
@ -100,14 +90,8 @@ $accordion-content-padding: 1rem !default;
|
||||
@mixin accordion-content {
|
||||
padding: $accordion-content-padding;
|
||||
display: none;
|
||||
border: $accordion-content-border;
|
||||
border-bottom: 0;
|
||||
border-bottom: $accordion-content-border;
|
||||
background-color: $accordion-content-background;
|
||||
color: $accordion-content-color;
|
||||
|
||||
:last-child > &:last-child {
|
||||
border-bottom: $accordion-content-border;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin foundation-accordion {
|
||||
@ -116,7 +100,7 @@ $accordion-content-padding: 1rem !default;
|
||||
}
|
||||
|
||||
.accordion-item {
|
||||
@include accordion-item;
|
||||
// This class doesn't need styles!
|
||||
}
|
||||
|
||||
.accordion-title {
|
||||
|
@ -43,7 +43,7 @@ $badge-font-size: 0.6rem !default;
|
||||
background: $badge-background;
|
||||
color: $badge-color;
|
||||
|
||||
@each $name, $color in $foundation-palette {
|
||||
@each $name, $color in $foundation-colors {
|
||||
@if $name != primary {
|
||||
&.#{$name} {
|
||||
background: $color;
|
||||
|
@ -89,7 +89,6 @@ $breadcrumbs-item-slash: true !default;
|
||||
|
||||
.disabled {
|
||||
color: $breadcrumbs-item-color-disabled;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,67 +29,37 @@ $buttongroup-expand-max: 6 !default;
|
||||
) {
|
||||
@include clearfix;
|
||||
margin-bottom: $buttongroup-margin;
|
||||
|
||||
@if $global-flexbox {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
align-items: stretch;
|
||||
}
|
||||
@else {
|
||||
font-size: 0;
|
||||
}
|
||||
font-size: map-get($button-sizes, default);
|
||||
|
||||
#{$child-selector} {
|
||||
float: #{$global-left};
|
||||
margin: 0;
|
||||
margin-#{$global-right}: $buttongroup-spacing;
|
||||
margin-bottom: $buttongroup-spacing;
|
||||
font-size: map-get($button-sizes, default);
|
||||
font-size: inherit;
|
||||
|
||||
@if $global-flexbox {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-#{$global-right}: 0;
|
||||
&:not(:last-child) {
|
||||
border-#{$global-right}: $buttongroup-spacing solid $body-background;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a full-width button group, making each button equal width.
|
||||
/// @param {Keyword|Number} $count [auto] - Number of buttons inside the button group. Set to `auto` to generate CSS that will account for a variable number of buttons.
|
||||
/// @param {String} $selector [$buttongroup-child-selector] - Selector for the buttons inside a button group.
|
||||
@mixin button-group-expand(
|
||||
$selector: $buttongroup-child-selector,
|
||||
$count: null
|
||||
$selector: $buttongroup-child-selector
|
||||
) {
|
||||
@if not $global-flexbox {
|
||||
margin-#{$global-right}: -$buttongroup-spacing;
|
||||
display: table;
|
||||
table-layout: fixed;
|
||||
width: 100%;
|
||||
|
||||
&::before,
|
||||
&::after {
|
||||
display: none;
|
||||
}
|
||||
&::before,
|
||||
&::after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
// scss-lint:disable ZeroUnit
|
||||
#{$selector} {
|
||||
@if $global-flexbox {
|
||||
flex: 1 1 0px;
|
||||
}
|
||||
@else {
|
||||
@for $i from 2 through $buttongroup-expand-max {
|
||||
&:first-child:nth-last-child(#{$i}) {
|
||||
&, &:first-child:nth-last-child(#{$i}) ~ #{$selector} {
|
||||
display: inline-block;
|
||||
width: calc(#{percentage(1 / $i)} - #{$buttongroup-spacing});
|
||||
margin-#{$global-right}: $buttongroup-spacing;
|
||||
|
||||
&:last-child {
|
||||
margin-#{$global-right}: $buttongroup-spacing * -$buttongroup-expand-max;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
display: table-cell;
|
||||
float: none;
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,20 +68,11 @@ $buttongroup-expand-max: 6 !default;
|
||||
@mixin button-group-stack(
|
||||
$selector: $buttongroup-child-selector
|
||||
) {
|
||||
@if $global-flexbox {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
#{$selector} {
|
||||
@if $global-flexbox {
|
||||
flex: 0 0 100%;
|
||||
}
|
||||
@else {
|
||||
width: 100%;
|
||||
}
|
||||
width: 100%;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
&:not(:last-child) {
|
||||
border-#{$global-right}: $buttongroup-spacing solid;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -121,15 +82,12 @@ $buttongroup-expand-max: 6 !default;
|
||||
@mixin button-group-unstack(
|
||||
$selector: $buttongroup-child-selector
|
||||
) {
|
||||
// scss-lint:disable ZeroUnit
|
||||
#{$selector} {
|
||||
@if $global-flexbox {
|
||||
flex: 1 1 0px;
|
||||
width: auto;
|
||||
|
||||
&:not(:last-child) {
|
||||
border-#{$global-right}: $buttongroup-spacing solid $body-background;
|
||||
}
|
||||
@else {
|
||||
width: auto;
|
||||
}
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,17 +96,13 @@ $buttongroup-expand-max: 6 !default;
|
||||
@include button-group;
|
||||
|
||||
// Sizes
|
||||
@each $size, $value in map-remove($button-sizes, default) {
|
||||
&.#{$size} #{$buttongroup-child-selector} {
|
||||
font-size: $value;
|
||||
}
|
||||
}
|
||||
|
||||
// Even-width Group
|
||||
&.tiny { font-size: map-get($button-sizes, tiny); }
|
||||
&.small { font-size: map-get($button-sizes, small); }
|
||||
&.large { font-size: map-get($button-sizes, large); }
|
||||
&.expanded { @include button-group-expand; }
|
||||
|
||||
// Colors
|
||||
@each $name, $color in $foundation-palette {
|
||||
@each $name, $color in $foundation-colors {
|
||||
@if $button-fill != hollow {
|
||||
&.#{$name} #{$buttongroup-child-selector} {
|
||||
@include button-style($color, auto, auto);
|
||||
@ -163,8 +117,7 @@ $buttongroup-expand-max: 6 !default;
|
||||
}
|
||||
|
||||
&.stacked,
|
||||
&.stacked-for-small,
|
||||
&.stacked-for-medium {
|
||||
&.stacked-for-small {
|
||||
@include button-group-stack;
|
||||
}
|
||||
|
||||
@ -173,23 +126,5 @@ $buttongroup-expand-max: 6 !default;
|
||||
@include button-group-unstack;
|
||||
}
|
||||
}
|
||||
|
||||
&.stacked-for-medium {
|
||||
@include breakpoint(large) {
|
||||
@include button-group-unstack;
|
||||
}
|
||||
}
|
||||
|
||||
// scss-lint:disable MergeableSelector
|
||||
&.stacked-for-small.expanded {
|
||||
@include breakpoint(small only) {
|
||||
display: block;
|
||||
|
||||
#{$buttongroup-child-selector} {
|
||||
display: block;
|
||||
margin-#{$global-right}: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,11 +28,11 @@ $button-background-hover: scale-color($button-background, $lightness: -15%) !def
|
||||
|
||||
/// Font color for buttons.
|
||||
/// @type List
|
||||
$button-color: $white !default;
|
||||
$button-color: #fff !default;
|
||||
|
||||
/// Font color for buttons, if the background is light.
|
||||
/// @type List
|
||||
$button-color-alt: $black !default;
|
||||
$button-color-alt: #000 !default;
|
||||
|
||||
/// Border radius for buttons, defaulted to global-radius.
|
||||
/// @type Number
|
||||
@ -51,14 +51,6 @@ $button-sizes: (
|
||||
/// @type List
|
||||
$button-opacity-disabled: 0.25 !default;
|
||||
|
||||
/// Background color lightness on hover for buttons.
|
||||
/// @type Number
|
||||
$button-background-hover-lightness: -20% !default;
|
||||
|
||||
/// Color lightness on hover for hollow buttons.
|
||||
/// @type Number
|
||||
$button-hollow-hover-lightness: -50% !default;
|
||||
|
||||
// Internal: flip from margin-right to margin-left for defaults
|
||||
@if $global-text-direction == 'rtl' {
|
||||
$button-margin: 0 0 $global-margin $global-margin !default;
|
||||
@ -104,15 +96,21 @@ $button-hollow-hover-lightness: -50% !default;
|
||||
@mixin button-style(
|
||||
$background: $button-background,
|
||||
$background-hover: $button-background-hover,
|
||||
$color: $button-color,
|
||||
$background-hover-lightness: $button-background-hover-lightness
|
||||
$color: $button-color
|
||||
) {
|
||||
@if $color == auto {
|
||||
$color: foreground($background, $button-color-alt, $button-color);
|
||||
$color: isitlight($background);
|
||||
}
|
||||
|
||||
@if $background-hover == auto {
|
||||
$background-hover: scale-color($background, $lightness: $background-hover-lightness);
|
||||
$background-hover: scale-color($background, $lightness: -20%);
|
||||
}
|
||||
|
||||
@if lightness($background) >= 70% {
|
||||
$color: $button-color-alt;
|
||||
}
|
||||
@else {
|
||||
$color: $button-color;
|
||||
}
|
||||
|
||||
background-color: $background;
|
||||
@ -132,11 +130,8 @@ $button-hollow-hover-lightness: -50% !default;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin button-hollow-style(
|
||||
$color: $primary-color,
|
||||
$hover-lightness: $button-hollow-hover-lightness
|
||||
) {
|
||||
$color-hover: scale-color($color, $lightness: $hover-lightness);
|
||||
@mixin button-hollow-style($color: $primary-color) {
|
||||
$color-hover: scale-color($color, $lightness: -50%);
|
||||
|
||||
border: 1px solid $color;
|
||||
color: $color;
|
||||
@ -148,14 +143,10 @@ $button-hollow-hover-lightness: -50% !default;
|
||||
}
|
||||
|
||||
/// Adds disabled styles to a button by fading the element, reseting the cursor, and disabling pointer events.
|
||||
@mixin button-disabled($color: $primary-color) {
|
||||
@mixin button-disabled {
|
||||
opacity: $button-opacity-disabled;
|
||||
cursor: not-allowed;
|
||||
|
||||
&:hover, &:focus {
|
||||
background-color: $color;
|
||||
color: $button-color;
|
||||
}
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/// Adds a dropdown arrow to a button.
|
||||
@ -210,19 +201,16 @@ $button-hollow-hover-lightness: -50% !default;
|
||||
@include button;
|
||||
|
||||
// Sizes
|
||||
@each $size, $value in map-remove($button-sizes, default) {
|
||||
&.#{$size} {
|
||||
font-size: $value;
|
||||
}
|
||||
}
|
||||
|
||||
&.tiny { font-size: map-get($button-sizes, tiny); }
|
||||
&.small { font-size: map-get($button-sizes, small); }
|
||||
&.large { font-size: map-get($button-sizes, large); }
|
||||
&.expanded { @include button-expand; }
|
||||
|
||||
// Colors
|
||||
@each $name, $color in $foundation-palette {
|
||||
@each $name, $color in $foundation-colors {
|
||||
@if $button-fill != hollow {
|
||||
&.#{$name} {
|
||||
@include button-style($color, auto, auto);
|
||||
@include button-style($color, auto);
|
||||
}
|
||||
}
|
||||
@else {
|
||||
@ -242,7 +230,7 @@ $button-hollow-hover-lightness: -50% !default;
|
||||
@include button-hollow;
|
||||
@include button-hollow-style;
|
||||
|
||||
@each $name, $color in $foundation-palette {
|
||||
@each $name, $color in $foundation-colors {
|
||||
&.#{$name} {
|
||||
@include button-hollow-style($color);
|
||||
}
|
||||
@ -254,12 +242,6 @@ $button-hollow-hover-lightness: -50% !default;
|
||||
&.disabled,
|
||||
&[disabled] {
|
||||
@include button-disabled;
|
||||
|
||||
@each $name, $color in $foundation-palette {
|
||||
&.#{$name} {
|
||||
@include button-disabled($color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dropdown arrow
|
||||
@ -277,7 +259,7 @@ $button-hollow-hover-lightness: -50% !default;
|
||||
&.arrow-only::after {
|
||||
margin-#{$global-left}: 0;
|
||||
float: none;
|
||||
top: -0.1em;
|
||||
top: 0.2em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
/// @group callout
|
||||
////
|
||||
|
||||
/// Default background color.
|
||||
/// Defualt background color.
|
||||
/// @type Color
|
||||
$callout-background: $white !default;
|
||||
|
||||
@ -14,7 +14,7 @@ $callout-background: $white !default;
|
||||
/// @type Number
|
||||
$callout-background-fade: 85% !default;
|
||||
|
||||
/// Default border style for callouts.
|
||||
/// Defualt border style for callouts.
|
||||
/// @type List
|
||||
$callout-border: 1px solid rgba($black, 0.25) !default;
|
||||
|
||||
@ -88,7 +88,7 @@ $callout-link-tint: 30% !default;
|
||||
.callout {
|
||||
@include callout;
|
||||
|
||||
@each $name, $color in $foundation-palette {
|
||||
@each $name, $color in $foundation-colors {
|
||||
&.#{$name} {
|
||||
@include callout-style($color);
|
||||
}
|
||||
|
@ -27,10 +27,6 @@ $drilldown-background: $white !default;
|
||||
.is-drilldown {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
|
||||
li {
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
|
||||
// Applied to nested <ul>s
|
||||
@ -39,7 +35,7 @@ $drilldown-background: $white !default;
|
||||
top: 0;
|
||||
#{$global-left}: 100%;
|
||||
z-index: -1;
|
||||
// height: 100%;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background: $drilldown-background;
|
||||
transition: $drilldown-transition;
|
||||
@ -68,12 +64,12 @@ $drilldown-background: $white !default;
|
||||
}
|
||||
}
|
||||
|
||||
.js-drilldown-back > a::before {
|
||||
.js-drilldown-back::before {
|
||||
@include css-triangle(6px, $drilldown-arrow-color, $global-left);
|
||||
border-#{$global-left}-width: 0;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
float: $global-left;
|
||||
margin-#{$global-right}: 0.75rem; // Creates space between the arrow and the text
|
||||
margin-#{$global-left}: 0.6rem; // Lines the tip of the arrow with the items below
|
||||
margin-top: 14px; // Aligns the arrow with the text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,114 +31,101 @@ $dropdownmenu-border: 1px solid $medium-gray !default;
|
||||
// @type Length
|
||||
$dropdownmenu-border-width: nth($dropdownmenu-border, 1);
|
||||
|
||||
@mixin left-right-arrows {
|
||||
> a::after {
|
||||
#{$global-right}: 14px;
|
||||
margin-top: -3px;
|
||||
}
|
||||
|
||||
&.opens-left > a::after {
|
||||
@include css-triangle(5px, $dropdownmenu-arrow-color, left);
|
||||
}
|
||||
|
||||
&.opens-right > a::after {
|
||||
@include css-triangle(5px, $dropdownmenu-arrow-color, right);
|
||||
}
|
||||
}
|
||||
|
||||
@mixin dropdown-menu-direction($dir: horizontal) {
|
||||
@if $dir == horizontal {
|
||||
> li.opens-left {
|
||||
> .is-dropdown-submenu {
|
||||
left: auto;
|
||||
right: 0;
|
||||
top: 100%;
|
||||
}
|
||||
@mixin foundation-dropdown-menu {
|
||||
.dropdown.menu {
|
||||
a {
|
||||
@include disable-mouse-outline;
|
||||
}
|
||||
.is-dropdown-submenu-parent {
|
||||
position: relative;
|
||||
|
||||
> li.opens-right {
|
||||
> .is-dropdown-submenu {
|
||||
right: auto;
|
||||
left: 0;
|
||||
top: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@if $dropdownmenu-arrows {
|
||||
> li.is-dropdown-submenu-parent > a {
|
||||
padding-#{$global-right}: 1.5rem;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
> li.is-dropdown-submenu-parent > a::after {
|
||||
@include css-triangle(5px, $dropdownmenu-arrow-color, down);
|
||||
#{$global-right}: 5px;
|
||||
margin-top: -2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@else if $dir == vertical {
|
||||
> li {
|
||||
.is-dropdown-submenu {
|
||||
top: 0;
|
||||
}
|
||||
|
||||
&.opens-left {
|
||||
> .is-dropdown-submenu {
|
||||
left: auto;
|
||||
right: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
&.opens-right {
|
||||
> .is-dropdown-submenu {
|
||||
right: auto;
|
||||
left: 100%;
|
||||
}
|
||||
a::after {
|
||||
float: $global-right;
|
||||
margin-top: 3px;
|
||||
margin-#{$global-left}: 10px;
|
||||
}
|
||||
|
||||
@if $dropdownmenu-arrows {
|
||||
@include left-right-arrows;
|
||||
&.is-down-arrow a {
|
||||
padding-#{$global-right}: 1.5rem;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&.is-down-arrow > a::after {
|
||||
@include css-triangle(5px, $dropdownmenu-arrow-color, down);
|
||||
position: absolute;
|
||||
top: rem-calc(2px) + rem-calc(get-side($menu-item-padding, top));
|
||||
#{$global-right}: 5px;
|
||||
}
|
||||
|
||||
&.is-left-arrow > a::after {
|
||||
@include css-triangle(5px, $dropdownmenu-arrow-color, left);
|
||||
float: left;
|
||||
margin-left: 0;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
&.is-right-arrow > a::after {
|
||||
@include css-triangle(5px, $dropdownmenu-arrow-color, right);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@else {
|
||||
@warn 'The direction used for dropdown-menu-direction() must be horizontal or vertical.';
|
||||
}
|
||||
}
|
||||
|
||||
@mixin foundation-dropdown-menu {
|
||||
.dropdown.menu {
|
||||
@include dropdown-menu-direction(horizontal);
|
||||
&.is-left-arrow.opens-inner .submenu {
|
||||
right: 0;
|
||||
left: auto;
|
||||
}
|
||||
|
||||
a {
|
||||
@include disable-mouse-outline;
|
||||
&.is-right-arrow.opens-inner .submenu {
|
||||
left: 0;
|
||||
right: auto;
|
||||
}
|
||||
|
||||
&.opens-inner .submenu {
|
||||
top: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.no-js & ul {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.vertical {
|
||||
@include dropdown-menu-direction(vertical);
|
||||
}
|
||||
.submenu {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 100%;
|
||||
min-width: $dropdownmenu-min-width;
|
||||
z-index: 1;
|
||||
background: $dropdownmenu-background;
|
||||
border: $dropdownmenu-border;
|
||||
|
||||
@each $size in $breakpoint-classes {
|
||||
@if $size != $-zf-zero-breakpoint {
|
||||
@include breakpoint($size) {
|
||||
&.#{$size}-horizontal {
|
||||
@include dropdown-menu-direction(horizontal);
|
||||
}
|
||||
@if (type-of($dropdownmenu-border-width) == 'number') {
|
||||
margin-top: (-$dropdownmenu-border-width);
|
||||
}
|
||||
|
||||
&.#{$size}-vertical {
|
||||
@include dropdown-menu-direction(vertical);
|
||||
}
|
||||
}
|
||||
> li {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&.first-sub {
|
||||
top: 100%;
|
||||
left: 0;
|
||||
right: auto;
|
||||
}
|
||||
|
||||
&:not(.js-dropdown-nohover) > .is-dropdown-submenu-parent:hover > &,
|
||||
&.js-dropdown-active {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.is-dropdown-submenu-parent.opens-left .submenu {
|
||||
left: auto;
|
||||
right: 100%;
|
||||
}
|
||||
|
||||
&.align-right {
|
||||
.is-dropdown-submenu.first-sub {
|
||||
.submenu.first-sub {
|
||||
top: 100%;
|
||||
left: auto;
|
||||
right: 0;
|
||||
@ -152,70 +139,10 @@ $dropdownmenu-border-width: nth($dropdownmenu-border, 1);
|
||||
&.align-right {
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
|
||||
.is-dropdown-submenu-parent {
|
||||
position: relative;
|
||||
|
||||
a::after {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
#{$global-right}: 5px;
|
||||
margin-top: -2px;
|
||||
}
|
||||
|
||||
&.opens-inner > .is-dropdown-submenu {
|
||||
|
||||
top: 100%;
|
||||
@if $global-text-direction == 'rtl' {
|
||||
right: auto;
|
||||
} @else {
|
||||
left: auto;
|
||||
}
|
||||
}
|
||||
|
||||
&.opens-left > .is-dropdown-submenu {
|
||||
left: auto;
|
||||
right: 100%;
|
||||
}
|
||||
|
||||
&.opens-right > .is-dropdown-submenu {
|
||||
right: auto;
|
||||
> li .submenu {
|
||||
top: 0;
|
||||
left: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.is-dropdown-submenu {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
#{$global-left}: 100%;
|
||||
min-width: $dropdownmenu-min-width;
|
||||
z-index: 1;
|
||||
background: $dropdownmenu-background;
|
||||
border: $dropdownmenu-border;
|
||||
|
||||
.is-dropdown-submenu-parent {
|
||||
@if $dropdownmenu-arrows {
|
||||
@include left-right-arrows;
|
||||
}
|
||||
}
|
||||
|
||||
@if (type-of($dropdownmenu-border-width) == 'number') {
|
||||
.is-dropdown-submenu {
|
||||
margin-top: (-$dropdownmenu-border-width);
|
||||
}
|
||||
}
|
||||
|
||||
> li {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
// [TODO] Cut back specificity
|
||||
// scss-lint:disable SelectorDepth
|
||||
//&:not(.js-dropdown-nohover) > .is-dropdown-submenu-parent:hover > &, // why is this line needed? Opening is handled by JS and this causes some ugly flickering when the sub is re-positioned automatically...
|
||||
&.js-dropdown-active {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ $dropdown-border: 1px solid $medium-gray !default;
|
||||
|
||||
/// Font size for dropdown panes.
|
||||
/// @type List
|
||||
$dropdown-font-size: 1rem !default;
|
||||
$dropdown-font-size: 16rem !default;
|
||||
|
||||
/// Width for dropdown panes.
|
||||
/// @type Number
|
||||
@ -38,14 +38,13 @@ $dropdown-sizes: (
|
||||
@mixin dropdown-container {
|
||||
background-color: $body-background;
|
||||
border: $dropdown-border;
|
||||
border-radius: $dropdown-radius;
|
||||
display: block;
|
||||
font-size: $dropdown-font-size;
|
||||
padding: $dropdown-padding;
|
||||
position: absolute;
|
||||
visibility: hidden;
|
||||
width: $dropdown-width;
|
||||
z-index: 10;
|
||||
border-radius: $dropdown-radius;
|
||||
|
||||
&.is-open {
|
||||
visibility: visible;
|
||||
|
28
app/vendor/foundation/scss/components/_flex.scss
vendored
28
app/vendor/foundation/scss/components/_flex.scss
vendored
@ -1,28 +0,0 @@
|
||||
@mixin foundation-flex-classes {
|
||||
// Horizontal alignment using justify-content
|
||||
@each $hdir, $prop in map-remove($-zf-flex-justify, left) {
|
||||
.align-#{$hdir} {
|
||||
@include flex-align($x: $hdir);
|
||||
}
|
||||
}
|
||||
|
||||
// Vertical alignment using align-items and align-self
|
||||
@each $vdir, $prop in $-zf-flex-align {
|
||||
.align-#{$vdir} {
|
||||
@include flex-align($y: $vdir);
|
||||
}
|
||||
|
||||
.align-self-#{$vdir} {
|
||||
@include flex-align-self($y: $vdir);
|
||||
}
|
||||
}
|
||||
|
||||
// Source ordering
|
||||
@include -zf-each-breakpoint {
|
||||
@for $i from 1 through 6 {
|
||||
.#{$-zf-size}-order-#{$i} {
|
||||
@include flex-order($i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -44,7 +44,7 @@ $label-radius: $global-radius !default;
|
||||
background: $label-background;
|
||||
color: $label-color;
|
||||
|
||||
@each $name, $color in $foundation-palette {
|
||||
@each $name, $color in $foundation-colors {
|
||||
@if $name != primary {
|
||||
&.#{$name} {
|
||||
background: $color;
|
||||
|
@ -14,57 +14,37 @@ $mediaobject-margin-bottom: $global-margin !default;
|
||||
/// @type Number
|
||||
$mediaobject-section-padding: $global-padding !default;
|
||||
|
||||
/// Width of images within a media object, when the object is stacked vertically. Set to 'auto' to use the image's natural width.
|
||||
/// With of images within a media object, when the object is stacked vertically. Set to 'auto' to use the image's natural width.
|
||||
/// @type Number
|
||||
$mediaobject-image-width-stacked: 100% !default;
|
||||
|
||||
/// Adds styles for a media object container.
|
||||
@mixin media-object-container {
|
||||
margin-bottom: $mediaobject-margin-bottom;
|
||||
display: if($global-flexbox, flex, block);
|
||||
|
||||
@if $global-flexbox {
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
display: block;
|
||||
}
|
||||
|
||||
/// Adds styles for sections within a media object.
|
||||
/// @param {Number} $padding [$mediaobject-section-padding] - Padding between sections.
|
||||
@mixin media-object-section($padding: $mediaobject-section-padding) {
|
||||
@if $global-flexbox {
|
||||
flex: 0 1 auto;
|
||||
}
|
||||
@else {
|
||||
display: table-cell;
|
||||
vertical-align: top;
|
||||
}
|
||||
display: table-cell;
|
||||
vertical-align: top;
|
||||
|
||||
&:first-child {
|
||||
padding-#{$global-right}: $padding;
|
||||
}
|
||||
|
||||
&:last-child:not(:nth-child(2)) {
|
||||
&:last-child:not(+ #{&}:first-child) {
|
||||
padding-#{$global-left}: $padding;
|
||||
}
|
||||
|
||||
> :last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds styles to stack sections of a media object. Apply this to the section elements, not the container.
|
||||
@mixin media-object-stack {
|
||||
display: block;
|
||||
padding: 0;
|
||||
padding-bottom: $mediaobject-section-padding;
|
||||
|
||||
@if $global-flexbox {
|
||||
flex-basis: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
@else {
|
||||
display: block;
|
||||
}
|
||||
|
||||
img {
|
||||
width: $mediaobject-image-width-stacked;
|
||||
}
|
||||
@ -78,16 +58,8 @@ $mediaobject-image-width-stacked: 100% !default;
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
@if $global-flexbox {
|
||||
&.stack-for-#{$-zf-zero-breakpoint} {
|
||||
@include breakpoint($-zf-zero-breakpoint only) {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.stack-for-#{$-zf-zero-breakpoint} .media-object-section {
|
||||
@include breakpoint($-zf-zero-breakpoint only) {
|
||||
&.stack-for-small .media-object-section {
|
||||
@include breakpoint(small only) {
|
||||
@include media-object-stack;
|
||||
}
|
||||
}
|
||||
@ -96,20 +68,7 @@ $mediaobject-image-width-stacked: 100% !default;
|
||||
.media-object-section {
|
||||
@include media-object-section;
|
||||
|
||||
@if $global-flexbox {
|
||||
// scss-lint:disable ZeroUnit
|
||||
&.main-section {
|
||||
flex: 1 1 0px;
|
||||
}
|
||||
}
|
||||
@else {
|
||||
&.middle {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
&.bottom {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
}
|
||||
&.middle { vertical-align: middle; }
|
||||
&.bottom { vertical-align: bottom; }
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
@mixin foundation-menu-icon {
|
||||
.menu-icon {
|
||||
@include hamburger($color: $titlebar-icon-color, $color-hover: $titlebar-icon-color-hover);
|
||||
}
|
||||
|
||||
.menu-icon.dark {
|
||||
@include hamburger;
|
||||
}
|
||||
}
|
169
app/vendor/foundation/scss/components/_menu.scss
vendored
169
app/vendor/foundation/scss/components/_menu.scss
vendored
@ -18,45 +18,28 @@ $menu-margin-nested: 1rem !default;
|
||||
/// @type Number
|
||||
$menu-item-padding: 0.7rem 1rem !default;
|
||||
|
||||
/// Text color of an active menu item.
|
||||
/// @type Color
|
||||
$menu-item-color-active: $white !default;
|
||||
|
||||
/// Background color of an active menu item.
|
||||
/// @type Color
|
||||
$menu-item-background-active: map-get($foundation-palette, primary) !default;
|
||||
|
||||
/// Spacing between an icon and text in a menu item.
|
||||
/// @type Number
|
||||
$menu-icon-spacing: 0.25rem !default;
|
||||
|
||||
/// Maximum number of `expand-n` classes to include in the CSS.
|
||||
/// @type Number
|
||||
$menu-expand-max: 6 !default;
|
||||
|
||||
/// Creates the base styles for a Menu.
|
||||
@mixin menu-base {
|
||||
margin: $menu-margin;
|
||||
list-style-type: none;
|
||||
|
||||
@if $global-flexbox {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
// List items are table cell to allow for vertical alignment
|
||||
> li {
|
||||
@include disable-mouse-outline;
|
||||
|
||||
@if $global-flexbox {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
@else {
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
// Reset line height to make the height of the overall item easier to calculate
|
||||
> li > a {
|
||||
> li:not(.menu-text) > a {
|
||||
display: block;
|
||||
padding: $menu-item-padding;
|
||||
line-height: 1;
|
||||
@ -72,54 +55,22 @@ $menu-icon-spacing: 0.25rem !default;
|
||||
|
||||
/// Expands the items of a Menu, so each item is the same width.
|
||||
@mixin menu-expand {
|
||||
@if $global-flexbox {
|
||||
// scss-lint:disable ZeroUnit
|
||||
> li {
|
||||
flex: 1 1 0px;
|
||||
}
|
||||
}
|
||||
@else {
|
||||
width: 100%;
|
||||
display: table;
|
||||
table-layout: fixed;
|
||||
}
|
||||
display: table;
|
||||
table-layout: fixed;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/// Sets the direction of a Menu.
|
||||
/// @param {Keyword} $dir [horizontal] - Direction of the Menu. Can be `horizontal` or `vertical`.
|
||||
@mixin menu-direction($dir: horizontal) {
|
||||
@if $dir == horizontal {
|
||||
@if $global-flexbox {
|
||||
flex-wrap: nowrap;
|
||||
|
||||
> li {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
}
|
||||
@else {
|
||||
> li {
|
||||
display: table-cell;
|
||||
}
|
||||
> li {
|
||||
display: table-cell;
|
||||
}
|
||||
}
|
||||
@else if $dir == vertical {
|
||||
@if $global-flexbox {
|
||||
flex-wrap: wrap;
|
||||
|
||||
> li {
|
||||
flex: 0 0 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
> li > a {
|
||||
align-items: flex-start;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
}
|
||||
@else {
|
||||
> li {
|
||||
display: block;
|
||||
}
|
||||
> li {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
@else {
|
||||
@ -129,14 +80,9 @@ $menu-icon-spacing: 0.25rem !default;
|
||||
|
||||
/// Creates a simple Menu, which has no padding or hover state.
|
||||
@mixin menu-simple {
|
||||
li {
|
||||
line-height: 1;
|
||||
display: inline-block;
|
||||
margin-#{$global-right}: get-side($menu-item-padding, $global-right);
|
||||
}
|
||||
|
||||
a {
|
||||
padding: 0;
|
||||
margin-#{$global-right}: get-side($menu-item-padding, $global-right);
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,64 +97,35 @@ $menu-icon-spacing: 0.25rem !default;
|
||||
/// @param {Boolean} $base [true] - Set to `false` to prevent the shared CSS between side- and top-aligned icons from being printed. Set this to `false` if you're calling the mixin multiple times on the same element.
|
||||
@mixin menu-icons($position: side, $base: true) {
|
||||
@if $base {
|
||||
@if $global-flexbox {
|
||||
> li > a {
|
||||
display: flex;
|
||||
> li > a {
|
||||
> img,
|
||||
> i {
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
@else {
|
||||
> li > a {
|
||||
img,
|
||||
i,
|
||||
svg {
|
||||
vertical-align: middle;
|
||||
|
||||
+ span {
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
> span {
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@if $position == side {
|
||||
> li > a {
|
||||
@if $global-flexbox {
|
||||
flex-flow: row nowrap;
|
||||
}
|
||||
|
||||
img,
|
||||
i,
|
||||
svg {
|
||||
> img,
|
||||
> i {
|
||||
display: inline-block;
|
||||
margin-#{$global-right}: $menu-icon-spacing;
|
||||
|
||||
@if not $global-flexbox {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@else if $position == top {
|
||||
> li > a {
|
||||
@if $global-flexbox {
|
||||
flex-flow: column nowrap;
|
||||
}
|
||||
@else {
|
||||
text-align: center;
|
||||
}
|
||||
text-align: center;
|
||||
|
||||
img,
|
||||
i,
|
||||
svg {
|
||||
@if not $global-flexbox {
|
||||
display: block;
|
||||
margin: 0 auto $menu-icon-spacing;
|
||||
}
|
||||
@else {
|
||||
align-self: stretch;
|
||||
text-align: center;
|
||||
margin-bottom: $menu-icon-spacing;
|
||||
}
|
||||
> img,
|
||||
> i {
|
||||
display: block;
|
||||
margin: 0 auto $menu-icon-spacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -236,7 +153,7 @@ $menu-icon-spacing: 0.25rem !default;
|
||||
}
|
||||
|
||||
@each $size in $breakpoint-classes {
|
||||
@if $size != $-zf-zero-breakpoint {
|
||||
@if $size != small {
|
||||
@include breakpoint($size) {
|
||||
&.#{$size}-horizontal {
|
||||
@include menu-direction(horizontal);
|
||||
@ -256,15 +173,8 @@ $menu-icon-spacing: 0.25rem !default;
|
||||
|
||||
// Align right
|
||||
&.align-#{$global-right} {
|
||||
@if $global-flexbox {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
@else {
|
||||
@include clearfix;
|
||||
|
||||
> li {
|
||||
float: $global-right;
|
||||
}
|
||||
> li {
|
||||
float: $global-right;
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,27 +196,12 @@ $menu-icon-spacing: 0.25rem !default;
|
||||
&.nested {
|
||||
@include menu-nested;
|
||||
}
|
||||
|
||||
// Active state
|
||||
.active > a {
|
||||
color: $menu-item-color-active;
|
||||
background: $menu-item-background-active;
|
||||
}
|
||||
}
|
||||
|
||||
.menu-text {
|
||||
@include menu-text;
|
||||
}
|
||||
|
||||
// Align center
|
||||
.menu-centered {
|
||||
text-align: center;
|
||||
|
||||
> .menu {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
// Prevent FOUC when using the Responsive Menu plugin
|
||||
.no-js [data-responsive-menu] ul {
|
||||
display: none;
|
||||
|
@ -60,7 +60,6 @@ $maincontent-shadow: 0 0 10px rgba($black, 0.5) !default;
|
||||
@include clearfix;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
min-height: 100%;
|
||||
transition: transform $offcanvas-transition-length $offcanvas-transition-timing;
|
||||
}
|
||||
|
||||
@ -72,7 +71,6 @@ $maincontent-shadow: 0 0 10px rgba($black, 0.5) !default;
|
||||
transition: transform $offcanvas-transition-length $offcanvas-transition-timing;
|
||||
backface-visibility: hidden;
|
||||
z-index: 1;
|
||||
padding-bottom: 0.1px; // Prevents margin collapsing, which would reveal the box shadow of the wrapper
|
||||
|
||||
@if has-value($maincontent-shadow) {
|
||||
box-shadow: $maincontent-shadow;
|
||||
@ -90,6 +88,10 @@ $maincontent-shadow: 0 0 10px rgba($black, 0.5) !default;
|
||||
background: $offcanvas-exit-background;
|
||||
cursor: pointer;
|
||||
transition: background $offcanvas-transition-length $offcanvas-transition-timing;
|
||||
|
||||
.is-off-canvas-open & {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,7 +165,7 @@ $maincontent-shadow: 0 0 10px rgba($black, 0.5) !default;
|
||||
|
||||
// Reveal off-canvas menu on larger screens
|
||||
@each $name, $value in $breakpoint-classes {
|
||||
@if $name != $-zf-zero-breakpoint {
|
||||
@if $name != small {
|
||||
@include breakpoint($name) {
|
||||
.position-left.reveal-for-#{$name} {
|
||||
@include off-canvas-reveal(left);
|
||||
|
@ -67,7 +67,7 @@ $orbit-control-zindex: 10 !default;
|
||||
@mixin orbit-slide {
|
||||
width: 100%;
|
||||
max-height: 100%;
|
||||
|
||||
|
||||
&.no-motionui {
|
||||
&.is-active {
|
||||
top: 0;
|
||||
@ -80,7 +80,6 @@ $orbit-control-zindex: 10 !default;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/// Adds styles for a slide containing an image. These styles are used on the `.orbit-image` class.
|
||||
@mixin orbit-image {
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
|
@ -10,7 +10,7 @@
|
||||
/// @type Number
|
||||
$pagination-font-size: rem-calc(14) !default;
|
||||
|
||||
/// Default bottom margin of the pagination object.
|
||||
/// Default bottom margin of the media object.
|
||||
/// @type Number
|
||||
$pagination-margin-bottom: $global-margin !default;
|
||||
|
||||
@ -50,15 +50,10 @@ $pagination-item-color-disabled: $medium-gray !default;
|
||||
/// @type Color
|
||||
$pagination-ellipsis-color: $black !default;
|
||||
|
||||
/// If `false`, don't display page number links on mobile, only next/previous links
|
||||
/// and optionally current page number.
|
||||
/// If `false`, don't display page number links on mobile, only next/previous links.
|
||||
/// @type Boolean
|
||||
$pagination-mobile-items: false !default;
|
||||
|
||||
/// If `false`, don't display current page number on mobile.
|
||||
/// @type Boolean
|
||||
$pagination-mobile-current-item: false !default;
|
||||
|
||||
/// If `true`, arrows are added to the next and previous links of pagination.
|
||||
/// @type Boolean
|
||||
$pagination-arrows: true !default;
|
||||
@ -73,25 +68,15 @@ $pagination-arrows: true !default;
|
||||
li {
|
||||
font-size: $pagination-font-size;
|
||||
margin-#{$global-right}: $pagination-item-spacing;
|
||||
display: none;
|
||||
border-radius: $pagination-radius;
|
||||
|
||||
@if $pagination-mobile-items {
|
||||
display: inline-block;
|
||||
}
|
||||
@else {
|
||||
display: none;
|
||||
|
||||
@if not $pagination-mobile-items {
|
||||
&:last-child,
|
||||
&:first-child {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
@if $pagination-mobile-current-item {
|
||||
&.current {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
@include breakpoint(medium) {
|
||||
display: inline-block;
|
||||
}
|
||||
@ -124,7 +109,7 @@ $pagination-arrows: true !default;
|
||||
@mixin pagination-item-disabled {
|
||||
padding: $pagination-item-padding;
|
||||
color: $pagination-item-color-disabled;
|
||||
cursor: not-allowed;
|
||||
cursor: default;
|
||||
|
||||
&:hover {
|
||||
background: transparent;
|
||||
@ -133,7 +118,7 @@ $pagination-arrows: true !default;
|
||||
|
||||
/// Adds styles for an ellipsis for use in a pagination list.
|
||||
@mixin pagination-ellipsis {
|
||||
content: '\2026';
|
||||
content: '…';
|
||||
padding: $pagination-item-padding;
|
||||
color: $pagination-ellipsis-color;
|
||||
}
|
||||
@ -158,14 +143,14 @@ $pagination-arrows: true !default;
|
||||
@if $pagination-arrows {
|
||||
.pagination-previous a::before,
|
||||
.pagination-previous.disabled::before {
|
||||
content: '\00ab';
|
||||
content: '«';
|
||||
display: inline-block;
|
||||
margin-#{$global-right}: 0.5rem;
|
||||
}
|
||||
|
||||
.pagination-next a::after,
|
||||
.pagination-next.disabled::after {
|
||||
content: '\00bb';
|
||||
content: '»';
|
||||
display: inline-block;
|
||||
margin-#{$global-left}: 0.5rem;
|
||||
}
|
||||
|
@ -2,6 +2,30 @@
|
||||
// foundation.zurb.com
|
||||
// Licensed under MIT Open Source
|
||||
|
||||
////
|
||||
/// @group progress-bar
|
||||
////
|
||||
|
||||
/// Height of a progress bar.
|
||||
/// @type Number
|
||||
$progress-height: 1rem !default;
|
||||
|
||||
/// Background color of a progress bar.
|
||||
/// @type Color
|
||||
$progress-background: $medium-gray !default;
|
||||
|
||||
/// Bottom margin of a progress bar.
|
||||
/// @type Number
|
||||
$progress-margin-bottom: $global-margin !default;
|
||||
|
||||
/// Default color of a progress bar's meter.
|
||||
/// @type Color
|
||||
$progress-meter-background: $primary-color !default;
|
||||
|
||||
/// Default radius of a progress bar.
|
||||
/// @type Number
|
||||
$progress-radius: $global-radius !default;
|
||||
|
||||
/// Adds styles for a progress bar container.
|
||||
@mixin progress-container {
|
||||
background-color: $progress-background;
|
||||
@ -17,25 +41,20 @@
|
||||
width: 0%;
|
||||
height: 100%;
|
||||
background-color: $progress-meter-background;
|
||||
|
||||
@if has-value($progress-radius) {
|
||||
border-radius: $global-radius;
|
||||
}
|
||||
border-radius: $global-radius;
|
||||
}
|
||||
|
||||
/// Adds styles for text in the progress meter.
|
||||
@mixin progress-meter-text {
|
||||
@include absolute-center;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
#{$global-left}: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
margin: 0;
|
||||
font-size: 0.75rem;
|
||||
font-weight: bold;
|
||||
color: $white;
|
||||
white-space: nowrap;
|
||||
|
||||
@if has-value($progress-radius) {
|
||||
border-radius: $progress-radius;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin foundation-progress-bar {
|
||||
@ -43,7 +62,7 @@
|
||||
.progress {
|
||||
@include progress-container;
|
||||
|
||||
@each $name, $color in $foundation-palette {
|
||||
@each $name, $color in $foundation-colors {
|
||||
&.#{$name} {
|
||||
.progress-meter {
|
||||
background-color: $color;
|
||||
@ -52,13 +71,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Inner meter
|
||||
// Progress bar meter
|
||||
.progress-meter {
|
||||
@include progress-meter;
|
||||
}
|
||||
|
||||
// Inner meter text
|
||||
.progress-meter-text {
|
||||
@include progress-meter-text;
|
||||
// Progress bar meter text
|
||||
.progress-meter-text {
|
||||
@include progress-meter-text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,10 @@ $reveal-width: 600px !default;
|
||||
/// @type Number
|
||||
$reveal-max-width: $global-width !default;
|
||||
|
||||
/// Offset from the top of the window when a modal is added.
|
||||
/// @type Number
|
||||
$reveal-offset: rem-calc(100) !default;
|
||||
|
||||
/// Default padding inside a modal.
|
||||
/// @type Number
|
||||
$reveal-padding: $global-padding !default;
|
||||
@ -40,7 +44,7 @@ $reveal-overlay-background: rgba($black, 0.45) !default;
|
||||
|
||||
/// Adds styles for a modal overlay.
|
||||
/// @param {Color} $background [$reveal-overlay-background] - Background color of the overlay.
|
||||
@mixin reveal-overlay($background: $reveal-overlay-background) {
|
||||
@mixin reveal-overlay {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
@ -48,7 +52,7 @@ $reveal-overlay-background: rgba($black, 0.45) !default;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: $reveal-zindex;
|
||||
background-color: $background;
|
||||
background-color: $reveal-overlay-background;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
@ -59,6 +63,7 @@ $reveal-overlay-background: rgba($black, 0.45) !default;
|
||||
z-index: $reveal-zindex + 1;
|
||||
padding: $reveal-padding;
|
||||
border: $reveal-border;
|
||||
margin: 100px auto 0;
|
||||
background-color: $reveal-background;
|
||||
border-radius: $reveal-radius;
|
||||
|
||||
@ -104,22 +109,12 @@ $reveal-overlay-background: rgba($black, 0.45) !default;
|
||||
max-width: none;
|
||||
margin-left: 0;
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
@mixin foundation-reveal {
|
||||
// [TODO] Is this necessary?
|
||||
// scss-lint:disable QualifyingElement
|
||||
body.is-reveal-open {
|
||||
overflow: hidden;
|
||||
}
|
||||
// html gets this class only in iOS
|
||||
html.is-reveal-open,
|
||||
html.is-reveal-open body {
|
||||
min-height: 100%;
|
||||
overflow: hidden;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
// Overlay
|
||||
.reveal-overlay {
|
||||
@ -130,12 +125,14 @@ $reveal-overlay-background: rgba($black, 0.45) !default;
|
||||
.reveal {
|
||||
@include reveal-modal-base;
|
||||
@include reveal-modal-width($reveal-width);
|
||||
position: relative;
|
||||
top: 100px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
position: absolute;
|
||||
overflow-y: auto;
|
||||
|
||||
// Remove padding
|
||||
&.collapse {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
// Placeholder selector for medium-and-up modals
|
||||
// Prevents duplicate CSS when defining multiple Reveal sizes
|
||||
@include breakpoint(medium) {
|
||||
@ -146,11 +143,6 @@ $reveal-overlay-background: rgba($black, 0.45) !default;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove padding
|
||||
&.collapse {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
// Sizing classes
|
||||
&.tiny { @include reveal-modal-width(30%); }
|
||||
&.small { @include reveal-modal-width(50%); }
|
||||
@ -160,13 +152,5 @@ $reveal-overlay-background: rgba($black, 0.45) !default;
|
||||
&.full {
|
||||
@include reveal-modal-fullscreen;
|
||||
}
|
||||
|
||||
@include breakpoint($-zf-zero-breakpoint only) {
|
||||
@include reveal-modal-fullscreen;
|
||||
}
|
||||
|
||||
&.without-overlay {
|
||||
position: fixed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,11 +9,43 @@
|
||||
/// @group slider
|
||||
////
|
||||
|
||||
/// Default slider width of a vertical slider. (Doesn't apply to the native slider.)
|
||||
/// Default height of the slider.
|
||||
/// @type Number
|
||||
$slider-width-vertical: 0.5rem !default;
|
||||
$slider-height: 0.5rem !default;
|
||||
|
||||
/// Transition properties to apply to the slider handle and fill. (Doesn't apply to the native slider.)
|
||||
/// Default slider width of a vertical slider.
|
||||
/// @type Number
|
||||
$slider-width-vertical: $slider-height !default;
|
||||
|
||||
/// Default background color of the slider's track.
|
||||
/// @type Color
|
||||
$slider-background: $light-gray !default;
|
||||
|
||||
/// Default color of the active fill color of the slider.
|
||||
/// @type Color
|
||||
$slider-fill-background: $medium-gray !default;
|
||||
|
||||
/// Default height of the handle of the slider.
|
||||
/// @type Number
|
||||
$slider-handle-height: 1.4rem !default;
|
||||
|
||||
/// Default width of the handle of the slider.
|
||||
/// @type Number
|
||||
$slider-handle-width: 1.4rem !default;
|
||||
|
||||
/// Default color of the handle for the slider.
|
||||
/// @type Color
|
||||
$slider-handle-background: $primary-color !default;
|
||||
|
||||
/// Default fade amount of a disabled slider.
|
||||
/// @type Number
|
||||
$slider-opacity-disabled: 0.25 !default;
|
||||
|
||||
/// Default radius for slider.
|
||||
/// @type Number
|
||||
$slider-radius: $global-radius !default;
|
||||
|
||||
/// Transition properties to apply to the slider handle and fill.
|
||||
/// @type Transition
|
||||
$slider-transition: all 0.2s ease-in-out !default;
|
||||
|
||||
@ -123,11 +155,4 @@ $slider-transition: all 0.2s ease-in-out !default;
|
||||
.slider.vertical {
|
||||
@include slider-vertical;
|
||||
}
|
||||
|
||||
// RTL support
|
||||
@if $global-text-direction == rtl {
|
||||
.slider:not(.vertical) {
|
||||
transform: scale(-1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,6 @@ $switch-paddle-transition: all 0.25s ease-out !default;
|
||||
@mixin switch-input {
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/// Adds styles for the background and paddle of a switch. Apply this to a `<label>` within a switch.
|
||||
@ -169,8 +168,6 @@ $switch-paddle-transition: all 0.25s ease-out !default;
|
||||
$paddle-height: $height - ($paddle-offset * 2);
|
||||
$paddle-left-active: $width - $paddle-width - $paddle-offset;
|
||||
|
||||
height: $height;
|
||||
|
||||
.switch-paddle {
|
||||
width: $width;
|
||||
height: $height;
|
||||
@ -182,7 +179,7 @@ $switch-paddle-transition: all 0.25s ease-out !default;
|
||||
height: $paddle-height;
|
||||
}
|
||||
|
||||
input:checked ~ .switch-paddle::after {
|
||||
input:checked ~ .switch-paddle:after {
|
||||
#{$global-left}: $paddle-left-active;
|
||||
}
|
||||
}
|
||||
@ -190,7 +187,6 @@ $switch-paddle-transition: all 0.25s ease-out !default;
|
||||
@mixin foundation-switch {
|
||||
// Container class
|
||||
.switch {
|
||||
height: $switch-height;
|
||||
@include switch-container;
|
||||
}
|
||||
|
||||
|
206
app/vendor/foundation/scss/components/_table.scss
vendored
206
app/vendor/foundation/scss/components/_table.scss
vendored
@ -8,154 +8,120 @@
|
||||
/// @group table
|
||||
////
|
||||
|
||||
/// Default color for table background.
|
||||
/// Defualt color for table background.
|
||||
/// @type Color
|
||||
$table-background: $white !default;
|
||||
|
||||
/// Default scale for darkening the striped table rows and the table border.
|
||||
/// Defualt scale for darkening the striped table rows and the table border.
|
||||
/// @type Number
|
||||
$table-color-scale: 5% !default;
|
||||
|
||||
/// Default style for table border.
|
||||
/// Defualt style for table border.
|
||||
/// @type List
|
||||
$table-border: 1px solid smart-scale($table-background, $table-color-scale) !default;
|
||||
|
||||
/// Default padding for table.
|
||||
/// Defualt padding for table.
|
||||
/// @type Number
|
||||
$table-padding: rem-calc(8 10 10) !default;
|
||||
|
||||
/// Default scale for darkening the table rows on hover.
|
||||
/// Defualt scale for darkening the table rows on hover.
|
||||
/// @type Number
|
||||
$table-hover-scale: 2% !default;
|
||||
|
||||
/// Default color of standard rows on hover.
|
||||
/// Defualt color of standard rows on hover.
|
||||
/// @type List
|
||||
$table-row-hover: darken($table-background, $table-hover-scale) !default;
|
||||
|
||||
/// Default color of striped rows on hover.
|
||||
/// Defualt color of striped rows on hover.
|
||||
/// @type List
|
||||
$table-row-stripe-hover: darken($table-background, $table-color-scale + $table-hover-scale) !default;
|
||||
|
||||
/// Default background color for striped rows.
|
||||
/// Defualt background color for striped rows.
|
||||
/// @type Color
|
||||
$table-striped-background: smart-scale($table-background, $table-color-scale) !default;
|
||||
|
||||
/// Default value for showing the stripe on rows of the tables, excluding the header and footer. If even, the even rows will have a background color. If odd, the odd rows will have a background color. If empty, or any other value, the table rows will have no striping.
|
||||
/// @type Keyword
|
||||
/// Defualt value for showing the stripe on rows of the tables, excluding the header and footer If even, the even rows will have a background color. If odd, the odd rows will have a background color. If empty, or anyother value, the table rows will have no striping.
|
||||
/// @type Keyoword
|
||||
$table-stripe: even !default;
|
||||
|
||||
/// Default color for header background.
|
||||
/// Defualt color for header background.
|
||||
/// @type Color
|
||||
$table-head-background: smart-scale($table-background, $table-color-scale / 2) !default;
|
||||
|
||||
/// Default color of header rows on hover.
|
||||
/// @type List
|
||||
$table-head-row-hover: darken($table-head-background, $table-hover-scale) !default;
|
||||
|
||||
/// Default color for footer background.
|
||||
/// Defualt color for footer background.
|
||||
/// @type Color
|
||||
$table-foot-background: smart-scale($table-background, $table-color-scale) !default;
|
||||
|
||||
/// Default color of footer rows on hover.
|
||||
/// @type List
|
||||
$table-foot-row-hover: darken($table-foot-background, $table-hover-scale) !default;
|
||||
|
||||
/// Default font color for header.
|
||||
/// Defualt font color for header.
|
||||
/// @type Color
|
||||
$table-head-font-color: $body-font-color !default;
|
||||
|
||||
/// Default font color for footer.
|
||||
/// @type Color
|
||||
$table-foot-font-color: $body-font-color !default;
|
||||
|
||||
/// Default value for showing the header when using stacked tables.
|
||||
/// Defualt value for showing the header when using stacked tables.
|
||||
/// @type Boolean
|
||||
$show-header-for-stacked: false !default;
|
||||
|
||||
@mixin -zf-table-children-styles($stripe: $table-stripe) {
|
||||
thead,
|
||||
tbody,
|
||||
tfoot {
|
||||
border: $table-border;
|
||||
background-color: $table-background;
|
||||
}
|
||||
|
||||
// Caption
|
||||
caption {
|
||||
font-weight: $global-weight-bold;
|
||||
padding: $table-padding;
|
||||
}
|
||||
|
||||
// Table head
|
||||
thead {
|
||||
background: $table-head-background;
|
||||
color: $table-head-font-color;
|
||||
}
|
||||
|
||||
// Table foot
|
||||
tfoot {
|
||||
background: $table-foot-background;
|
||||
color: $table-foot-font-color;
|
||||
}
|
||||
|
||||
// Table head and foot
|
||||
thead,
|
||||
tfoot {
|
||||
// Rows within head and foot
|
||||
tr {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
// Cells within head and foot
|
||||
th,
|
||||
td {
|
||||
padding: $table-padding;
|
||||
font-weight: $global-weight-bold;
|
||||
text-align: #{$global-left};
|
||||
}
|
||||
}
|
||||
|
||||
// Table rows
|
||||
tbody {
|
||||
tr {
|
||||
// If stripe is set to even, darken the even rows.
|
||||
@if $stripe == even {
|
||||
&:nth-child(even) {
|
||||
background-color: $table-striped-background;
|
||||
}
|
||||
}
|
||||
|
||||
// If stripe is set to odd, darken the odd rows.
|
||||
@else if $stripe == odd {
|
||||
&:nth-child(odd) {
|
||||
background-color: $table-striped-background;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: $table-padding;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds the general styles for tables.
|
||||
/// @param {Keyword} $stripe [$table-stripe] - Uses keywords even, odd, or none to darken rows of the table. The default value is even.
|
||||
@mixin table(
|
||||
$stripe: $table-stripe,
|
||||
$nest: false
|
||||
) {
|
||||
width: 100%;
|
||||
/// @param {Keyword} $stripe [$table-stripe] - Uses kewords even, odd, or none to darken rows of the table. The defualt value is even.
|
||||
@mixin table($stripe: $table-stripe) {
|
||||
margin-bottom: $global-margin;
|
||||
border-radius: $global-radius;
|
||||
|
||||
@if $nest {
|
||||
@include -zf-table-children-styles($stripe);
|
||||
}
|
||||
@else {
|
||||
@at-root {
|
||||
@include -zf-table-children-styles($stripe);
|
||||
@at-root {
|
||||
thead,
|
||||
tbody,
|
||||
tfoot {
|
||||
border: $table-border;
|
||||
background-color: $table-background;
|
||||
}
|
||||
|
||||
// Caption
|
||||
caption {
|
||||
font-weight: $global-weight-bold;
|
||||
padding: $table-padding;
|
||||
}
|
||||
|
||||
// Table head and foot
|
||||
thead,
|
||||
tfoot {
|
||||
background: $table-head-background;
|
||||
color: $table-head-font-color;
|
||||
|
||||
// Rows within head and foot
|
||||
tr {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
// Cells within head and foot
|
||||
th,
|
||||
td {
|
||||
padding: $table-padding;
|
||||
font-weight: $global-weight-bold;
|
||||
text-align: #{$global-left};
|
||||
}
|
||||
}
|
||||
|
||||
// Table rows
|
||||
tbody {
|
||||
tr {
|
||||
// If stripe is set to even, darken the even rows.
|
||||
@if $stripe == even {
|
||||
&:nth-child(even) {
|
||||
background-color: $table-striped-background;
|
||||
}
|
||||
}
|
||||
|
||||
// If stripe is set to odd, darken the odd rows.
|
||||
@else if $stripe == odd {
|
||||
&:nth-child(odd) {
|
||||
background-color: $table-striped-background;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: $table-padding;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -169,21 +135,7 @@ $show-header-for-stacked: false !default;
|
||||
|
||||
/// Slightly darkens the table rows on hover.
|
||||
@mixin table-hover {
|
||||
thead tr {
|
||||
//Darkens the table header rows on hover.
|
||||
&:hover {
|
||||
background-color: $table-head-row-hover;
|
||||
}
|
||||
}
|
||||
|
||||
tfoot tr {
|
||||
//Darkens the table footer rows on hover.
|
||||
&:hover {
|
||||
background-color: $table-foot-row-hover;
|
||||
}
|
||||
}
|
||||
|
||||
tbody tr {
|
||||
tr {
|
||||
//Darkens the non-striped table rows on hover.
|
||||
&:hover {
|
||||
background-color: $table-row-hover;
|
||||
@ -240,9 +192,9 @@ $show-header-for-stacked: false !default;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin foundation-table($nest: false) {
|
||||
@mixin foundation-table {
|
||||
table {
|
||||
@include table($nest: $nest);
|
||||
@include table;
|
||||
}
|
||||
|
||||
table.stack {
|
||||
@ -258,12 +210,4 @@ $show-header-for-stacked: false !default;
|
||||
table.hover {
|
||||
@include table-hover;
|
||||
}
|
||||
|
||||
.table-scroll {
|
||||
overflow-x: auto;
|
||||
|
||||
table {
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
15
app/vendor/foundation/scss/components/_tabs.scss
vendored
15
app/vendor/foundation/scss/components/_tabs.scss
vendored
@ -18,14 +18,18 @@ $tab-background: $white !default;
|
||||
/// @type Color
|
||||
$tab-background-active: $light-gray !default;
|
||||
|
||||
/// Font size of tab items.
|
||||
/// @type Number
|
||||
$tab-item-font-size: rem-calc(12) !default;
|
||||
/// Default border color of tab content.
|
||||
/// @type Color
|
||||
$tab-border: $light-gray !default;
|
||||
|
||||
/// Default text color for items in a Menu.
|
||||
/// @type Color
|
||||
$tab-item-color: foreground($tab-background, $primary-color) !default;
|
||||
|
||||
/// Default background color on hover for items in a Menu.
|
||||
$tab-item-background-hover: $white !default;
|
||||
|
||||
/// Default padding of a tab item.
|
||||
/// Default padding of a a tab item.
|
||||
/// @type Number
|
||||
$tab-item-padding: 1.25rem 1.5rem !default;
|
||||
|
||||
@ -75,7 +79,8 @@ $tab-content-padding: 1rem !default;
|
||||
display: block;
|
||||
padding: $tab-item-padding;
|
||||
line-height: 1;
|
||||
font-size: $tab-item-font-size;
|
||||
font-size: 12px;
|
||||
color: $tab-item-color;
|
||||
|
||||
&:hover {
|
||||
background: $tab-item-background-hover;
|
||||
|
@ -36,45 +36,24 @@ $titlebar-icon-spacing: 0.25rem !default;
|
||||
|
||||
@mixin foundation-title-bar {
|
||||
.title-bar {
|
||||
@include clearfix;
|
||||
background: $titlebar-background;
|
||||
color: $titlebar-color;
|
||||
padding: $titlebar-padding;
|
||||
|
||||
@if $global-flexbox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
@else {
|
||||
@include clearfix;
|
||||
}
|
||||
|
||||
.menu-icon {
|
||||
margin-#{$global-left}: $titlebar-icon-spacing;
|
||||
margin-#{$global-right}: $titlebar-icon-spacing;
|
||||
margin-#{$global-right}: $titlebar-padding;
|
||||
}
|
||||
}
|
||||
|
||||
@if $global-flexbox {
|
||||
// scss-lint:disable ZeroUnit
|
||||
.title-bar-left,
|
||||
.title-bar-right {
|
||||
flex: 1 1 0px;
|
||||
}
|
||||
|
||||
.title-bar-right {
|
||||
text-align: right;
|
||||
}
|
||||
.title-bar-left {
|
||||
float: left;
|
||||
}
|
||||
@else {
|
||||
.title-bar-left {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.title-bar-right {
|
||||
float: right;
|
||||
text-align: right;
|
||||
}
|
||||
.title-bar-right {
|
||||
float: right;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.title-bar-title {
|
||||
@ -82,4 +61,8 @@ $titlebar-icon-spacing: 0.25rem !default;
|
||||
vertical-align: middle;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.menu-icon {
|
||||
@include hamburger($color: $titlebar-icon-color, $color-hover: $titlebar-icon-color-hover);
|
||||
}
|
||||
}
|
||||
|
@ -6,14 +6,6 @@
|
||||
/// @group tooltip
|
||||
////
|
||||
|
||||
/// Default font weight of the defined term.
|
||||
/// @type Keyword | Number
|
||||
$has-tip-font-weight: $global-weight-bold !default;
|
||||
|
||||
/// Default border bottom of the defined term.
|
||||
/// @type List
|
||||
$has-tip-border-bottom: dotted 1px $dark-gray !default;
|
||||
|
||||
/// Default color of the tooltip background.
|
||||
/// @type Color
|
||||
$tooltip-background-color: $black !default;
|
||||
@ -38,13 +30,17 @@ $tooltip-pip-width: 0.75rem !default;
|
||||
/// @type Number
|
||||
$tooltip-pip-height: $tooltip-pip-width * 0.866 !default;
|
||||
|
||||
/// Default pip offset for tooltips. This controls how far the pip is indented from the left edge of the tooltip.
|
||||
/// @type Number
|
||||
$tooltip-pip-offset: 1.25rem !default;
|
||||
|
||||
/// Default radius for tooltips.
|
||||
/// @type Number
|
||||
$tooltip-radius: $global-radius !default;
|
||||
|
||||
@mixin has-tip {
|
||||
border-bottom: $has-tip-border-bottom;
|
||||
font-weight: $has-tip-font-weight;
|
||||
border-bottom: dotted 1px $dark-gray;
|
||||
font-weight: bold;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
cursor: help;
|
||||
|
139
app/vendor/foundation/scss/components/_top-bar.scss
vendored
139
app/vendor/foundation/scss/components/_top-bar.scss
vendored
@ -14,34 +14,17 @@ $topbar-padding: 0.5rem !default;
|
||||
/// @type Color
|
||||
$topbar-background: $light-gray !default;
|
||||
|
||||
/// Background color submenus within the top bar. Usefull if $topbar-background is transparent.
|
||||
/// Color for links inside a top bar menu.
|
||||
/// @type Color
|
||||
$topbar-submenu-background: $topbar-background !default;
|
||||
$topbar-link-color: $primary-color !default;
|
||||
|
||||
/// Spacing for the top bar title.
|
||||
/// @type Number
|
||||
$topbar-title-spacing: 1rem !default;
|
||||
|
||||
/// Maximum width of `<input>` elements inside the top bar.
|
||||
/// Width of `<input>` elements inside the top bar.
|
||||
/// @type Number
|
||||
$topbar-input-width: 200px !default;
|
||||
|
||||
/// Breakpoint at which top bar switches from mobile to desktop view.
|
||||
/// @type Breakpoint
|
||||
$topbar-unstack-breakpoint: medium !default;
|
||||
|
||||
/// Adds styles for a top bar container.
|
||||
@mixin top-bar-container {
|
||||
@if $global-flexbox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
@else {
|
||||
@include clearfix;
|
||||
}
|
||||
|
||||
@include clearfix;
|
||||
padding: $topbar-padding;
|
||||
|
||||
&,
|
||||
@ -49,70 +32,29 @@ $topbar-unstack-breakpoint: medium !default;
|
||||
background-color: $topbar-background;
|
||||
}
|
||||
|
||||
// Check if $topbar-background is differnt from $topbar-background-submenu
|
||||
@if ($topbar-background != $topbar-submenu-background) {
|
||||
ul ul {
|
||||
background-color: $topbar-submenu-background;
|
||||
}
|
||||
a {
|
||||
color: $topbar-link-color;
|
||||
}
|
||||
|
||||
// Restrain width of inputs by default to make them easier to arrange
|
||||
input {
|
||||
max-width: $topbar-input-width;
|
||||
width: $topbar-input-width;
|
||||
margin-#{$global-right}: 1rem;
|
||||
}
|
||||
|
||||
// The above styles shouldn't apply to input group fields
|
||||
.input-group-field {
|
||||
width: 100%;
|
||||
margin-#{$global-right}: 0;
|
||||
}
|
||||
|
||||
// scss-lint:disable QualifyingElement
|
||||
input.button {
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
|
||||
/// Makes sections of a top bar stack on top of each other.
|
||||
/// makes sections stacked
|
||||
@mixin top-bar-stacked {
|
||||
@if $global-flexbox {
|
||||
flex-wrap: wrap;
|
||||
|
||||
// Sub-sections
|
||||
.top-bar-left,
|
||||
.top-bar-right {
|
||||
flex: 0 0 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
// Sub-sections
|
||||
.top-bar-right {
|
||||
width: 100%;
|
||||
}
|
||||
@else {
|
||||
// Sub-sections
|
||||
.top-bar-left,
|
||||
.top-bar-right {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Undoes the CSS applied by the `top-bar-stacked()` mixin.
|
||||
@mixin top-bar-unstack {
|
||||
@if $global-flexbox {
|
||||
flex-wrap: nowrap;
|
||||
|
||||
// scss-lint:disable ZeroUnit
|
||||
.top-bar-left {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
.top-bar-right {
|
||||
flex: 0 1 auto;
|
||||
}
|
||||
}
|
||||
@else {
|
||||
.top-bar-left,
|
||||
.top-bar-right {
|
||||
width: auto;
|
||||
}
|
||||
.top-bar-left {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,51 +62,28 @@ $topbar-unstack-breakpoint: medium !default;
|
||||
// Top bar container
|
||||
.top-bar {
|
||||
@include top-bar-container;
|
||||
}
|
||||
|
||||
// Stack on small screens by default
|
||||
@include top-bar-stacked;
|
||||
|
||||
@include breakpoint($topbar-unstack-breakpoint) {
|
||||
@include top-bar-unstack;
|
||||
}
|
||||
|
||||
// Generate classes for stacking on each screen size (defined in $breakpoint-classes)
|
||||
@each $size in $breakpoint-classes {
|
||||
@if $size != $-zf-zero-breakpoint {
|
||||
&.stacked-for-#{$size} {
|
||||
@include breakpoint($size down) {
|
||||
@include top-bar-stacked;
|
||||
}
|
||||
}
|
||||
// Generate classes for stacking on each screen size (defined in $breakpoint-classes)
|
||||
@each $size in $breakpoint-classes {
|
||||
.stacked-for-#{$size} {
|
||||
@include breakpoint($size down) {
|
||||
@include top-bar-stacked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sub-sections
|
||||
@if $global-flexbox {
|
||||
.top-bar-title {
|
||||
flex: 0 0 auto;
|
||||
margin-right: $topbar-title-spacing;
|
||||
}
|
||||
|
||||
.top-bar-left,
|
||||
.top-bar-right {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
// Stack on small screens as default
|
||||
@include breakpoint(small only) {
|
||||
@include top-bar-stacked;
|
||||
}
|
||||
@else {
|
||||
.top-bar-title {
|
||||
float: left;
|
||||
margin-right: $topbar-title-spacing;
|
||||
|
||||
}
|
||||
|
||||
.top-bar-left {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.top-bar-right {
|
||||
float: right;
|
||||
}
|
||||
// Sub-sections
|
||||
.top-bar-left {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.top-bar-right {
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
/// @param {Keyword} $size - Breakpoint to use. **Must be a breakpoint defined in `$breakpoints`.**
|
||||
@mixin show-for($size) {
|
||||
$size: map-get($breakpoints, $size);
|
||||
$size: -zf-bp-to-em($size) - (1 / 16);
|
||||
$size: -zf-bp-to-em($size) - (1/16);
|
||||
|
||||
@include breakpoint($size down) {
|
||||
display: none !important;
|
||||
@ -20,9 +20,9 @@
|
||||
$upper-bound-size: -zf-map-next($breakpoints, $size);
|
||||
|
||||
// more often than not this will be correct, just one time round the loop it won't so set in scope here
|
||||
$lower-bound: -zf-bp-to-em($lower-bound-size) - (1 / 16);
|
||||
$lower-bound: -zf-bp-to-em($lower-bound-size) - (1/16);
|
||||
// test actual lower-bound-size, if 0 set it to 0em
|
||||
@if strip-unit($lower-bound-size) == 0 {
|
||||
@if $lower-bound-size == 0 {
|
||||
$lower-bound: -zf-bp-to-em($lower-bound-size);
|
||||
}
|
||||
|
||||
@ -33,7 +33,6 @@
|
||||
}
|
||||
@else {
|
||||
$upper-bound: -zf-bp-to-em($upper-bound-size);
|
||||
|
||||
@media screen and (max-width: $lower-bound), screen and (min-width: $upper-bound) {
|
||||
display: none !important;
|
||||
}
|
||||
@ -69,7 +68,7 @@
|
||||
|
||||
// Responsive visibility classes
|
||||
@each $size in $breakpoint-classes {
|
||||
@if $size != $-zf-zero-breakpoint {
|
||||
@if $size != small {
|
||||
.hide-for-#{$size} {
|
||||
@include hide-for($size);
|
||||
}
|
||||
|
@ -21,15 +21,11 @@
|
||||
margin-#{$global-right}: $form-spacing;
|
||||
margin-bottom: 0;
|
||||
vertical-align: baseline;
|
||||
|
||||
&[for] {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
// Styles for inputs inside labels
|
||||
label > [type='checkbox'],
|
||||
label > [type='radio'] {
|
||||
label > [type='label'] {
|
||||
margin-#{$global-right}: $form-spacing * 0.5;
|
||||
}
|
||||
|
||||
|
12
app/vendor/foundation/scss/forms/_error.scss
vendored
12
app/vendor/foundation/scss/forms/_error.scss
vendored
@ -16,15 +16,15 @@ $abide-labels: true !default;
|
||||
|
||||
/// Background color to use for invalid text inputs.
|
||||
/// @type Color
|
||||
$input-background-invalid: map-get($foundation-palette, alert) !default;
|
||||
$input-background-invalid: $alert-color !default;
|
||||
|
||||
/// Color to use for labels of invalid inputs.
|
||||
/// @type Color
|
||||
$form-label-color-invalid: map-get($foundation-palette, alert) !default;
|
||||
$form-label-color-invalid: $alert-color !default;
|
||||
|
||||
/// Default font color for form error text.
|
||||
/// @type Color
|
||||
$input-error-color: map-get($foundation-palette, alert) !default;
|
||||
$input-error-color: $alert-color !default;
|
||||
|
||||
/// Default font size for form error text.
|
||||
/// @type Number
|
||||
@ -37,13 +37,11 @@ $input-error-font-weight: $global-weight-bold !default;
|
||||
/// Styles the background and border of an input field to have an error state.
|
||||
///
|
||||
/// @param {Color} $background [$alert-color] - Color to use for the background and border.
|
||||
/// @param {Number} $background-alpha [0.1] - Transparency level of the background color.
|
||||
@mixin form-input-error(
|
||||
$background: $input-background-invalid,
|
||||
$background-alpha: 0.1
|
||||
$background: $alert-color
|
||||
) {
|
||||
&:not(:focus) {
|
||||
background-color: rgba($background, $background-alpha);
|
||||
background-color: rgba($background, 0.1);
|
||||
border-color: $background;
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,6 @@ $legend-padding: rem-calc(0 3) !default;
|
||||
|
||||
legend {
|
||||
margin-bottom: $form-spacing * 0.5;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.fieldset {
|
||||
|
20
app/vendor/foundation/scss/forms/_forms.scss
vendored
20
app/vendor/foundation/scss/forms/_forms.scss
vendored
@ -10,17 +10,15 @@
|
||||
/// @type Number
|
||||
$form-spacing: rem-calc(16) !default;
|
||||
|
||||
@import 'text';
|
||||
@import 'checkbox';
|
||||
@import 'label';
|
||||
@import 'help-text';
|
||||
@import 'input-group';
|
||||
@import 'fieldset';
|
||||
@import 'select';
|
||||
@import 'range';
|
||||
@import 'progress';
|
||||
@import 'meter';
|
||||
@import 'error';
|
||||
@import
|
||||
'text',
|
||||
'checkbox',
|
||||
'label',
|
||||
'help-text',
|
||||
'input-group',
|
||||
'fieldset',
|
||||
'select',
|
||||
'error';
|
||||
|
||||
@mixin foundation-forms {
|
||||
@include foundation-form-text;
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
/// Default color for help text.
|
||||
/// @type Color
|
||||
$helptext-color: $black !default;
|
||||
$helptext-color: #333 !default;
|
||||
|
||||
/// Default font size for help text.
|
||||
/// @type Number
|
||||
|
@ -24,54 +24,38 @@ $input-prefix-padding: 1rem !default;
|
||||
@mixin foundation-form-prepostfix {
|
||||
$height: ($input-font-size + $form-spacing * 1.5);
|
||||
|
||||
|
||||
.input-group {
|
||||
display: if($global-flexbox, flex, table);
|
||||
display: table;
|
||||
width: 100%;
|
||||
margin-bottom: $form-spacing;
|
||||
|
||||
@if $global-flexbox {
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
> :first-child {
|
||||
border-radius: if($global-text-direction == rtl, 0 $global-radius $global-radius 0, $global-radius 0 0 $global-radius);
|
||||
border-radius: $global-radius 0 0 $global-radius;
|
||||
}
|
||||
|
||||
> :last-child {
|
||||
> * {
|
||||
border-radius: if($global-text-direction == rtl, $global-radius 0 0 $global-radius, 0 $global-radius $global-radius 0);
|
||||
border-radius: 0 $global-radius $global-radius 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%input-group-child {
|
||||
display: table-cell;
|
||||
margin: 0;
|
||||
white-space: nowrap;
|
||||
|
||||
@if not $global-flexbox {
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.input-group-label {
|
||||
@extend %input-group-child;
|
||||
text-align: center;
|
||||
width: 1%;
|
||||
height: 100%;
|
||||
padding: 0 $input-prefix-padding;
|
||||
background: $input-prefix-background;
|
||||
color: $input-prefix-color;
|
||||
border: $input-prefix-border;
|
||||
white-space: nowrap;
|
||||
|
||||
@if $global-flexbox {
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
@else {
|
||||
width: 1%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@if has-value($input-prefix-border) {
|
||||
&:first-child {
|
||||
@ -87,30 +71,16 @@ $input-prefix-padding: 1rem !default;
|
||||
.input-group-field {
|
||||
@extend %input-group-child;
|
||||
border-radius: 0;
|
||||
|
||||
// scss-lint:disable ZeroUnit
|
||||
@if $global-flexbox {
|
||||
flex: 1 1 0px;
|
||||
height: auto;
|
||||
}
|
||||
@else {
|
||||
height: $height;
|
||||
}
|
||||
height: $height;
|
||||
}
|
||||
|
||||
.input-group-button {
|
||||
@extend %input-group-child;
|
||||
height: 100%;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
text-align: center;
|
||||
|
||||
@if $global-flexbox {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
@else {
|
||||
height: 100%;
|
||||
width: 1%;
|
||||
}
|
||||
width: 1%;
|
||||
|
||||
a,
|
||||
input,
|
||||
@ -118,12 +88,4 @@ $input-prefix-padding: 1rem !default;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Specificity bump needed to prevent override by buttons
|
||||
// scss-lint:disable QualifyingSelector
|
||||
@if not $global-flexbox {
|
||||
.input-group .input-group-button {
|
||||
display: table-cell;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
111
app/vendor/foundation/scss/forms/_meter.scss
vendored
111
app/vendor/foundation/scss/forms/_meter.scss
vendored
@ -1,111 +0,0 @@
|
||||
// Foundation for Sites by ZURB
|
||||
// foundation.zurb.com
|
||||
// Licensed under MIT Open Source
|
||||
|
||||
////
|
||||
/// @group meter
|
||||
////
|
||||
|
||||
/// Height of a `<meter>` element.
|
||||
/// @type Length
|
||||
$meter-height: 1rem !default;
|
||||
|
||||
/// Border radius of a `<meter>` element.
|
||||
/// @type Length
|
||||
$meter-radius: $global-radius !default;
|
||||
|
||||
/// Background color of a `<meter>` element.
|
||||
/// @type Color
|
||||
$meter-background: $medium-gray !default;
|
||||
|
||||
/// Meter fill for an optimal value in a `<meter>` element.
|
||||
/// @type Color
|
||||
$meter-fill-good: $success-color !default;
|
||||
|
||||
/// Meter fill for an average value in a `<meter>` element.
|
||||
/// @type Color
|
||||
$meter-fill-medium: $warning-color !default;
|
||||
|
||||
/// Meter fill for a suboptimal value in a `<meter>` element.
|
||||
/// @type Color
|
||||
$meter-fill-bad: $alert-color !default;
|
||||
|
||||
@mixin foundation-meter-element {
|
||||
meter {
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: $meter-height;
|
||||
margin-bottom: 1rem;
|
||||
|
||||
@if has-value($meter-radius) {
|
||||
border-radius: $meter-radius;
|
||||
}
|
||||
|
||||
// For Firefox
|
||||
background: $meter-background;
|
||||
border: 0;
|
||||
|
||||
// Chrome/Safari/Edge
|
||||
&::-webkit-meter-bar {
|
||||
background: $meter-background;
|
||||
|
||||
@if has-value($meter-radius) {
|
||||
border-radius: $meter-radius;
|
||||
}
|
||||
|
||||
border: 0;
|
||||
}
|
||||
|
||||
&::-webkit-meter-inner-element {
|
||||
@if has-value($meter-radius) {
|
||||
border-radius: $meter-radius;
|
||||
}
|
||||
}
|
||||
|
||||
&::-webkit-meter-optimum-value {
|
||||
background: $meter-fill-good;
|
||||
|
||||
@if has-value($meter-radius) {
|
||||
border-radius: $meter-radius;
|
||||
}
|
||||
}
|
||||
|
||||
&::-webkit-meter-suboptimum-value {
|
||||
background: $meter-fill-medium;
|
||||
|
||||
@if has-value($meter-radius) {
|
||||
border-radius: $meter-radius;
|
||||
}
|
||||
}
|
||||
|
||||
&::-webkit-meter-even-less-good-value {
|
||||
background: $meter-fill-bad;
|
||||
|
||||
@if has-value($meter-radius) {
|
||||
border-radius: $meter-radius;
|
||||
}
|
||||
}
|
||||
|
||||
&::-moz-meter-bar {
|
||||
background: $primary-color;
|
||||
|
||||
@if has-value($meter-radius) {
|
||||
border-radius: $meter-radius;
|
||||
}
|
||||
}
|
||||
|
||||
&:-moz-meter-optimum::-moz-meter-bar {
|
||||
background: $meter-fill-good;
|
||||
}
|
||||
|
||||
&:-moz-meter-sub-optimum::-moz-meter-bar {
|
||||
background: $meter-fill-medium;
|
||||
}
|
||||
|
||||
&:-moz-meter-sub-sub-optimum::-moz-meter-bar {
|
||||
background: $meter-fill-bad;
|
||||
}
|
||||
}
|
||||
}
|
94
app/vendor/foundation/scss/forms/_progress.scss
vendored
94
app/vendor/foundation/scss/forms/_progress.scss
vendored
@ -1,94 +0,0 @@
|
||||
// Foundation for Sites by ZURB
|
||||
// foundation.zurb.com
|
||||
// Licensed under MIT Open Source
|
||||
|
||||
////
|
||||
/// @group progress-bar
|
||||
////
|
||||
|
||||
/// Height of a progress bar.
|
||||
/// @type Number
|
||||
$progress-height: 1rem !default;
|
||||
|
||||
/// Background color of a progress bar.
|
||||
/// @type Color
|
||||
$progress-background: $medium-gray !default;
|
||||
|
||||
/// Bottom margin of a progress bar.
|
||||
/// @type Number
|
||||
$progress-margin-bottom: $global-margin !default;
|
||||
|
||||
/// Default color of a progress bar's meter.
|
||||
/// @type Color
|
||||
$progress-meter-background: $primary-color !default;
|
||||
|
||||
/// Default radius of a progress bar.
|
||||
/// @type Number
|
||||
$progress-radius: $global-radius !default;
|
||||
|
||||
@mixin foundation-progress-element {
|
||||
progress {
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: $progress-height;
|
||||
margin-bottom: $progress-margin-bottom;
|
||||
|
||||
@if hasvalue($progress-radius) {
|
||||
border-radius: $progress-radius;
|
||||
}
|
||||
|
||||
// For Firefox
|
||||
background: $progress-background;
|
||||
border: 0;
|
||||
|
||||
&::-webkit-progress-bar {
|
||||
background: $progress-background;
|
||||
|
||||
@if hasvalue($progress-radius) {
|
||||
border-radius: $progress-radius;
|
||||
}
|
||||
}
|
||||
|
||||
&::-webkit-progress-value {
|
||||
background: $progress-meter-background;
|
||||
|
||||
@if hasvalue($progress-radius) {
|
||||
border-radius: $progress-radius;
|
||||
}
|
||||
}
|
||||
|
||||
&::-moz-progress-bar {
|
||||
background: $progress-meter-background;
|
||||
|
||||
@if hasvalue($progress-radius) {
|
||||
border-radius: $progress-radius;
|
||||
}
|
||||
}
|
||||
|
||||
@each $name, $color in $foundation-palette {
|
||||
&.#{$name} {
|
||||
// Internet Explorer sets the fill with color
|
||||
color: $color;
|
||||
|
||||
&::-webkit-progress-value {
|
||||
background: $color;
|
||||
}
|
||||
|
||||
&::-moz-progress-bar {
|
||||
background: $color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// For IE and Edge
|
||||
&::-ms-fill{
|
||||
@if hasvalue($progress-radius) {
|
||||
border-radius: $progress-radius;
|
||||
}
|
||||
|
||||
border: 0;
|
||||
}
|
||||
}
|
||||
}
|
144
app/vendor/foundation/scss/forms/_range.scss
vendored
144
app/vendor/foundation/scss/forms/_range.scss
vendored
@ -1,144 +0,0 @@
|
||||
// Foundation for Sites by ZURB
|
||||
// foundation.zurb.com
|
||||
// Licensed under MIT Open Source
|
||||
|
||||
////
|
||||
/// @group slider
|
||||
////
|
||||
|
||||
/// Default height of the slider.
|
||||
/// @type Number
|
||||
$slider-height: 0.5rem !default;
|
||||
|
||||
/// Default background color of the slider's track.
|
||||
/// @type Color
|
||||
$slider-background: $light-gray !default;
|
||||
|
||||
/// Default color of the active fill color of the slider.
|
||||
/// @type Color
|
||||
$slider-fill-background: $medium-gray !default;
|
||||
|
||||
/// Default height of the handle of the slider.
|
||||
/// @type Number
|
||||
$slider-handle-height: 1.4rem !default;
|
||||
|
||||
/// Default width of the handle of the slider.
|
||||
/// @type Number
|
||||
$slider-handle-width: 1.4rem !default;
|
||||
|
||||
/// Default color of the handle for the slider.
|
||||
/// @type Color
|
||||
$slider-handle-background: $primary-color !default;
|
||||
|
||||
/// Default fade amount of a disabled slider.
|
||||
/// @type Number
|
||||
$slider-opacity-disabled: 0.25 !default;
|
||||
|
||||
/// Default radius for slider.
|
||||
/// @type Number
|
||||
$slider-radius: $global-radius !default;
|
||||
|
||||
@mixin foundation-range-input {
|
||||
// scss-lint:disable QualifyingElement
|
||||
input[type="range"] {
|
||||
$margin: ($slider-handle-height - $slider-height) / 2;
|
||||
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
cursor: pointer;
|
||||
margin-top: $margin;
|
||||
margin-bottom: $margin;
|
||||
border: 0;
|
||||
line-height: 1;
|
||||
|
||||
@if has-value($slider-radius) {
|
||||
border-radius: $slider-radius;
|
||||
}
|
||||
|
||||
&:focus {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
&[disabled] {
|
||||
opacity: $slider-opacity-disabled;
|
||||
}
|
||||
|
||||
// Chrome/Safari
|
||||
&::-webkit-slider-runnable-track {
|
||||
height: $slider-height;
|
||||
background: $slider-background;
|
||||
}
|
||||
|
||||
&::-webkit-slider-handle {
|
||||
-webkit-appearance: none;
|
||||
background: $slider-handle-background;
|
||||
width: $slider-handle-width;
|
||||
height: $slider-handle-height;
|
||||
margin-top: -$margin;
|
||||
|
||||
@if has-value($slider-radius) {
|
||||
border-radius: $slider-radius;
|
||||
}
|
||||
}
|
||||
|
||||
// Firefox
|
||||
&::-moz-range-track {
|
||||
-moz-appearance: none;
|
||||
height: $slider-height;
|
||||
background: $slider-background;
|
||||
}
|
||||
|
||||
&::-moz-range-thumb {
|
||||
-moz-appearance: none;
|
||||
background: $slider-handle-background;
|
||||
width: $slider-handle-width;
|
||||
height: $slider-handle-height;
|
||||
margin-top: -$margin;
|
||||
|
||||
@if has-value($slider-radius) {
|
||||
border-radius: $slider-radius;
|
||||
}
|
||||
}
|
||||
|
||||
// Internet Explorer
|
||||
&::-ms-track {
|
||||
height: $slider-height;
|
||||
background: $slider-background;
|
||||
color: transparent;
|
||||
border: 0;
|
||||
overflow: visible;
|
||||
border-top: $margin solid $body-background;
|
||||
border-bottom: $margin solid $body-background;
|
||||
}
|
||||
|
||||
&::-ms-thumb {
|
||||
background: $slider-handle-background;
|
||||
width: $slider-handle-width;
|
||||
height: $slider-handle-height;
|
||||
border: 0;
|
||||
|
||||
@if has-value($slider-radius) {
|
||||
border-radius: $slider-radius;
|
||||
}
|
||||
}
|
||||
|
||||
&::-ms-fill-lower {
|
||||
background: $slider-fill-background;
|
||||
}
|
||||
|
||||
&::-ms-fill-upper {
|
||||
background: $slider-background;
|
||||
}
|
||||
|
||||
@at-root {
|
||||
output {
|
||||
line-height: $slider-handle-height;
|
||||
vertical-align: middle;
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@ $select-background: $white !default;
|
||||
|
||||
/// Color of the dropdown triangle inside select menus. Set to `transparent` to remove it entirely.
|
||||
/// @type Color
|
||||
$select-triangle-color: $dark-gray !default;
|
||||
$select-triangle-color: #333 !default;
|
||||
|
||||
/// Default radius for select menus.
|
||||
/// @type Color
|
||||
@ -37,12 +37,9 @@ $select-radius: $global-radius !default;
|
||||
@if $select-triangle-color != transparent {
|
||||
@include background-triangle($select-triangle-color);
|
||||
background-size: 9px 6px;
|
||||
background-position: $global-right (-$form-spacing) center;
|
||||
background-origin: content-box;
|
||||
background-position: $global-right ($form-spacing / 2) center;
|
||||
background-repeat: no-repeat;
|
||||
padding-#{$global-right}: ($form-spacing * 1.5);
|
||||
}
|
||||
|
||||
// Disabled state
|
||||
&:disabled {
|
||||
background-color: $input-background-disabled;
|
||||
@ -56,7 +53,6 @@ $select-radius: $global-radius !default;
|
||||
|
||||
&[multiple] {
|
||||
height: auto;
|
||||
background-image: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
23
app/vendor/foundation/scss/forms/_text.scss
vendored
23
app/vendor/foundation/scss/forms/_text.scss
vendored
@ -10,10 +10,6 @@
|
||||
/// @type Color
|
||||
$input-color: $black !default;
|
||||
|
||||
/// Font color of placeholder text within text inputs.
|
||||
/// @type Color
|
||||
$input-placeholder-color: $medium-gray !default;
|
||||
|
||||
/// Font family of text inputs.
|
||||
/// @type Font
|
||||
$input-font-family: inherit !default;
|
||||
@ -52,7 +48,7 @@ $input-shadow-focus: 0 0 5px $medium-gray !default;
|
||||
|
||||
/// Cursor to use when hovering over a disabled text input.
|
||||
/// @type Cursor
|
||||
$input-cursor-disabled: not-allowed !default;
|
||||
$input-cursor-disabled: default !default;
|
||||
|
||||
/// Properties to transition on text inputs.
|
||||
/// @type Transition
|
||||
@ -66,10 +62,6 @@ $input-number-spinners: true !default;
|
||||
/// @type Border
|
||||
$input-radius: $global-radius !default;
|
||||
|
||||
/// Border radius for buttons, defaulted to global-radius.
|
||||
/// @type Number
|
||||
$button-radius: $global-radius !default;
|
||||
|
||||
@mixin form-element {
|
||||
$height: ($input-font-size + ($form-spacing * 1.5) - rem-calc(1));
|
||||
|
||||
@ -123,14 +115,9 @@ $button-radius: $global-radius !default;
|
||||
}
|
||||
}
|
||||
|
||||
// Disabled/readonly state
|
||||
input,
|
||||
textarea {
|
||||
// Placeholder text
|
||||
&::placeholder {
|
||||
color: $input-placeholder-color;
|
||||
}
|
||||
|
||||
// Disabled/readonly state
|
||||
&:disabled,
|
||||
&[readonly] {
|
||||
background-color: $input-background-disabled;
|
||||
@ -141,7 +128,7 @@ $button-radius: $global-radius !default;
|
||||
// Reset styles on button-like inputs
|
||||
[type='submit'],
|
||||
[type='button'] {
|
||||
border-radius: $button-radius;
|
||||
border-radius: $global-radius;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
}
|
||||
@ -157,8 +144,8 @@ $button-radius: $global-radius !default;
|
||||
@if not $input-number-spinners {
|
||||
-moz-appearance: textfield;
|
||||
|
||||
&::-webkit-inner-spin-button,
|
||||
&::-webkit-outer-spin-button {
|
||||
[type='number']::-webkit-inner-spin-button,
|
||||
[type='number']::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
21
app/vendor/foundation/scss/foundation.scss
vendored
21
app/vendor/foundation/scss/foundation.scss
vendored
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Foundation for Sites by ZURB
|
||||
* Version 6.2.4
|
||||
* Version 6.1.1
|
||||
* foundation.zurb.com
|
||||
* Licensed under MIT Open Source
|
||||
*/
|
||||
@ -28,12 +28,10 @@
|
||||
@import 'components/drilldown';
|
||||
@import 'components/dropdown-menu';
|
||||
@import 'components/dropdown';
|
||||
@import 'components/flex';
|
||||
@import 'components/flex-video';
|
||||
@import 'components/label';
|
||||
@import 'components/media-object';
|
||||
@import 'components/menu';
|
||||
@import 'components/menu-icon';
|
||||
@import 'components/off-canvas';
|
||||
@import 'components/orbit';
|
||||
@import 'components/pagination';
|
||||
@ -50,10 +48,6 @@
|
||||
@import 'components/tooltip';
|
||||
|
||||
@mixin foundation-everything($flex: false) {
|
||||
@if $flex {
|
||||
$global-flexbox: true !global;
|
||||
}
|
||||
|
||||
@include foundation-global-styles;
|
||||
@if not $flex {
|
||||
@include foundation-grid;
|
||||
@ -62,8 +56,10 @@
|
||||
@include foundation-flex-grid;
|
||||
}
|
||||
@include foundation-typography;
|
||||
@include foundation-forms;
|
||||
@include foundation-button;
|
||||
@include foundation-forms;
|
||||
@include foundation-visibility-classes;
|
||||
@include foundation-float-classes;
|
||||
@include foundation-accordion;
|
||||
@include foundation-accordion-menu;
|
||||
@include foundation-badge;
|
||||
@ -71,14 +67,13 @@
|
||||
@include foundation-button-group;
|
||||
@include foundation-callout;
|
||||
@include foundation-close-button;
|
||||
@include foundation-menu;
|
||||
@include foundation-menu-icon;
|
||||
@include foundation-drilldown-menu;
|
||||
@include foundation-dropdown;
|
||||
@include foundation-dropdown-menu;
|
||||
@include foundation-flex-video;
|
||||
@include foundation-label;
|
||||
@include foundation-media-object;
|
||||
@include foundation-menu;
|
||||
@include foundation-off-canvas;
|
||||
@include foundation-orbit;
|
||||
@include foundation-pagination;
|
||||
@ -93,10 +88,4 @@
|
||||
@include foundation-title-bar;
|
||||
@include foundation-tooltip;
|
||||
@include foundation-top-bar;
|
||||
@include foundation-visibility-classes;
|
||||
@include foundation-float-classes;
|
||||
|
||||
@if $flex {
|
||||
@include foundation-flex-classes;
|
||||
}
|
||||
}
|
||||
|
58
app/vendor/foundation/scss/grid/_classes.scss
vendored
58
app/vendor/foundation/scss/grid/_classes.scss
vendored
@ -28,14 +28,21 @@
|
||||
|
||||
// Collapsing
|
||||
&.#{$collapse} {
|
||||
> .#{$column} {
|
||||
@include grid-col-collapse;
|
||||
}
|
||||
> .#{$column} { @include grid-col-collapse; }
|
||||
}
|
||||
|
||||
// Nesting
|
||||
& .#{$row} {
|
||||
@include grid-row-nest($grid-column-gutter);
|
||||
& & {
|
||||
@if $grid-column-gutter == null {
|
||||
@each $breakpoint, $gutter in $grid-column-responsive-gutter {
|
||||
@include breakpoint($breakpoint) {
|
||||
@include grid-row-nest($gutter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@else {
|
||||
@include grid-row-nest($grid-column-gutter);
|
||||
}
|
||||
|
||||
&.#{$collapse} {
|
||||
margin-left: 0;
|
||||
@ -46,11 +53,6 @@
|
||||
// Expanded (full-width) row
|
||||
&.#{$expanded} {
|
||||
max-width: none;
|
||||
|
||||
.#{$row} {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,14 +71,14 @@
|
||||
// The double .row class is needed to bump up the specificity
|
||||
.#{$column}.#{$row}.#{$row} {
|
||||
float: none;
|
||||
}
|
||||
|
||||
// To properly nest a column row, padding and margin is removed
|
||||
.#{$row} .#{$column}.#{$row}.#{$row} {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
// To properly nest a column row, padding and margin is removed
|
||||
.#{$row} & {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@include -zf-each-breakpoint {
|
||||
@ -108,28 +110,24 @@
|
||||
// Block grid
|
||||
@for $i from 1 through $block-grid-max {
|
||||
.#{$-zf-size}-up-#{$i} {
|
||||
@include grid-layout($i, ".#{$column}");
|
||||
@include grid-layout($i);
|
||||
}
|
||||
}
|
||||
|
||||
// Responsive collapsing
|
||||
.#{$-zf-size}-#{$collapse} {
|
||||
> .#{$column} { @include grid-col-collapse; }
|
||||
|
||||
.#{$row} {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.#{$expanded}.#{$row} .#{$-zf-size}-#{$collapse}.#{$row} {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.#{$-zf-size}-#{$uncollapse} {
|
||||
$gutter: -zf-get-bp-val($grid-column-gutter, $-zf-size);
|
||||
|
||||
$gutter: null;
|
||||
|
||||
@if $grid-column-gutter {
|
||||
$gutter: $grid-column-gutter;
|
||||
}
|
||||
@else {
|
||||
$gutter: -zf-get-bp-val($grid-column-responsive-gutter, $-zf-size);
|
||||
}
|
||||
> .#{$column} { @include grid-col-uncollapse($gutter); }
|
||||
}
|
||||
|
||||
|
26
app/vendor/foundation/scss/grid/_column.scss
vendored
26
app/vendor/foundation/scss/grid/_column.scss
vendored
@ -57,27 +57,25 @@
|
||||
$columns: $grid-column-count,
|
||||
$gutter: $grid-column-gutter
|
||||
) {
|
||||
@include grid-column-size($columns);
|
||||
float: $global-left;
|
||||
|
||||
// Gutters
|
||||
@if type-of($gutter) == 'map' {
|
||||
@each $breakpoint, $value in $gutter {
|
||||
$padding: rem-calc($value) / 2;
|
||||
|
||||
@if $gutter != null {
|
||||
$gutter: rem-calc($gutter) / 2;
|
||||
}
|
||||
@else {
|
||||
@each $breakpoint, $gutter in $grid-column-responsive-gutter {
|
||||
$padding: rem-calc($gutter) / 2;
|
||||
|
||||
@include breakpoint($breakpoint) {
|
||||
padding-left: $padding;
|
||||
padding-right: $padding;
|
||||
}
|
||||
}
|
||||
}
|
||||
@else if type-of($gutter) == 'number' and strip-unit($gutter) > 0 {
|
||||
$padding: rem-calc($gutter) / 2;
|
||||
padding-left: $padding;
|
||||
padding-right: $padding;
|
||||
}
|
||||
|
||||
// Last column alignment
|
||||
@include grid-column-size($columns);
|
||||
float: $global-left;
|
||||
padding-left: $gutter;
|
||||
padding-right: $gutter;
|
||||
|
||||
@if $grid-column-align-edge {
|
||||
&:last-child:not(:first-child) {
|
||||
float: $global-right;
|
||||
|
173
app/vendor/foundation/scss/grid/_flex-grid.scss
vendored
173
app/vendor/foundation/scss/grid/_flex-grid.scss
vendored
@ -6,6 +6,21 @@
|
||||
/// @group flex-grid
|
||||
////
|
||||
|
||||
$-zf-flex-justify: (
|
||||
'left': flex-start,
|
||||
'right': flex-end,
|
||||
'center': center,
|
||||
'justify': space-between,
|
||||
'spaced': space-around,
|
||||
);
|
||||
|
||||
$-zf-flex-align: (
|
||||
'top': flex-start,
|
||||
'bottom': flex-end,
|
||||
'middle': center,
|
||||
'stretch': stretch,
|
||||
);
|
||||
|
||||
/// Creates a container for a flex grid row.
|
||||
///
|
||||
/// @param {Keyword|List} $behavior [null]
|
||||
@ -21,12 +36,13 @@
|
||||
$base: true,
|
||||
$gutter: $grid-column-gutter
|
||||
) {
|
||||
$behavior: -zf-get-options($behavior, nest collapse);
|
||||
$margin: auto;
|
||||
|
||||
@if index($behavior, nest) != null {
|
||||
@if map-get($behavior, nest) {
|
||||
@include grid-row-nest($gutter);
|
||||
|
||||
@if index($behavior, collapse) != null {
|
||||
@if map-get($behavior, collapse) {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
@ -55,7 +71,6 @@
|
||||
///
|
||||
/// @param {Mixed} $columns [null] - Width of the column.
|
||||
@function flex-grid-column($columns: null) {
|
||||
// scss-lint:disable ZeroUnit
|
||||
$flex: 1 1 0px;
|
||||
|
||||
@if $columns == shrink {
|
||||
@ -76,60 +91,34 @@
|
||||
$columns: null,
|
||||
$gutter: $grid-column-gutter
|
||||
) {
|
||||
// Base properties
|
||||
flex: flex-grid-column($columns);
|
||||
|
||||
// Gutters
|
||||
@if type-of($gutter) == 'map' {
|
||||
@each $breakpoint, $value in $gutter {
|
||||
$padding: rem-calc($value) / 2;
|
||||
|
||||
@if $gutter != null {
|
||||
$gutter: rem-calc($gutter) / 2;
|
||||
}
|
||||
@else {
|
||||
@each $breakpoint, $gutter in $grid-column-responsive-gutter {
|
||||
$padding: rem-calc($gutter) / 2;
|
||||
|
||||
@include breakpoint($breakpoint) {
|
||||
padding-left: $padding;
|
||||
padding-right: $padding;
|
||||
}
|
||||
}
|
||||
}
|
||||
@else if type-of($gutter) == 'number' and strip-unit($gutter) > 0 {
|
||||
$padding: rem-calc($gutter) / 2;
|
||||
padding-left: $padding;
|
||||
padding-right: $padding;
|
||||
}
|
||||
|
||||
// fixes recent Chrome version not limiting child width
|
||||
// https://stackoverflow.com/questions/34934586/white-space-nowrap-and-flexbox-did-not-work-in-chrome
|
||||
@if $columns == null {
|
||||
min-width: initial;
|
||||
}
|
||||
flex: flex-grid-column($columns);
|
||||
padding-left: $gutter;
|
||||
padding-right: $gutter;
|
||||
|
||||
// max-width fixes IE 10/11 not respecting the flex-basis property
|
||||
@if $columns != null and $columns != shrink {
|
||||
max-width: grid-column($columns);
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a block grid for a flex grid row.
|
||||
///
|
||||
/// @param {Number} $n - Number of columns to display on each row.
|
||||
/// @param {String} $selector - Selector to use to target columns within the row.
|
||||
@mixin flex-grid-layout(
|
||||
$n,
|
||||
$selector: '.column'
|
||||
) {
|
||||
flex-wrap: wrap;
|
||||
|
||||
> #{$selector} {
|
||||
$pct: percentage(1/$n);
|
||||
|
||||
flex: 0 0 $pct;
|
||||
max-width: $pct;
|
||||
}
|
||||
}
|
||||
|
||||
/// Changes the source order of a flex grid column. Columns with lower numbers appear first in the layout.
|
||||
/// @param {Number} $order [0] - Order number to apply.
|
||||
@mixin flex-grid-order($order: 0) {
|
||||
@warn 'This mixin is being replaced by flex-order(). flex-grid-order() will be removed in Foundation 6.3.';
|
||||
@include flex-order($order);
|
||||
order: $order;
|
||||
}
|
||||
|
||||
/// Horizontally or vertically aligns the columns within a flex row. Apply this mixin to a flex row.
|
||||
@ -137,16 +126,42 @@
|
||||
/// @param {Keyword} $x [null] - Horizontal alignment to use. Can be `left`, `right`, `center`, `justify`, or `spaced`. Or, set it to `null` (the default) to not set horizontal alignment.
|
||||
/// @param {Keyword} $y [null] - Vertical alignment to use. Can be `top`, `bottom`, `middle`, or `stretch`. Or, set it to `null` (the default) to not set vertical alignment.
|
||||
@mixin flex-grid-row-align($x: null, $y: null) {
|
||||
@warn 'This mixin is being replaced by flex-align(). flex-grid-row-align() will be removed in Foundation 6.3.';
|
||||
@include flex-align($x, $y);
|
||||
@if $x {
|
||||
@if map-has-key($-zf-flex-justify, $x) {
|
||||
$x: map-get($-zf-flex-justify, $x);
|
||||
}
|
||||
@else {
|
||||
@warn 'flex-grid-row-align(): #{$x} is not a valid value for horizontal alignment. Use left, right, center, justify, or spaced.'
|
||||
}
|
||||
}
|
||||
|
||||
@if $y {
|
||||
@if map-has-key($-zf-flex-align, $y) {
|
||||
$y: map-get($-zf-flex-align, $y);
|
||||
}
|
||||
@else {
|
||||
@warn 'flex-grid-row-align(): #{$y} is not a valid value for vertical alignment. Use top, bottom, middle, or stretch.'
|
||||
}
|
||||
}
|
||||
|
||||
justify-content: $x;
|
||||
align-items: $y;
|
||||
}
|
||||
|
||||
/// Vertically align a single column within a flex row. Apply this mixin to a flex column.
|
||||
///
|
||||
/// @param {Keyword} $y [null] - Vertical alignment to use. Can be `top`, `bottom`, `middle`, or `stretch`. Or, set it to `null` (the default) to not set vertical alignment.
|
||||
@mixin flex-grid-column-align($y: null) {
|
||||
@warn 'This mixin is being replaced by flex-align-self(). flex-grid-column-align() will be removed in Foundation 6.3.';
|
||||
@include flex-align-self($y);
|
||||
@if $y {
|
||||
@if map-has-key($-zf-flex-align, $y) {
|
||||
$y: map-get($-zf-flex-align, $y);
|
||||
}
|
||||
@else {
|
||||
@warn 'flex-grid-column-align(): #{$y} is not a valid value for alignment. Use top, bottom, middle, or stretch.'
|
||||
}
|
||||
}
|
||||
|
||||
align-self: $y;
|
||||
}
|
||||
|
||||
@mixin foundation-flex-grid {
|
||||
@ -155,7 +170,8 @@
|
||||
@include flex-grid-row;
|
||||
|
||||
// Nesting behavior
|
||||
& .row {
|
||||
& &,
|
||||
.column-row & {
|
||||
@include flex-grid-row(nest, $base: false);
|
||||
}
|
||||
|
||||
@ -165,17 +181,7 @@
|
||||
}
|
||||
|
||||
&.collapse {
|
||||
> .column {
|
||||
@include grid-col-collapse;
|
||||
}
|
||||
}
|
||||
|
||||
// Undo negative margins
|
||||
// From collapsed child
|
||||
&.is-collapse-child,
|
||||
&.collapse > .column > .row {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
> .column { @include grid-col-collapse; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,21 +190,6 @@
|
||||
@include flex-grid-column;
|
||||
}
|
||||
|
||||
// Column row
|
||||
// The double .row class is needed to bump up the specificity
|
||||
.column.row.row {
|
||||
float: none;
|
||||
display: block;
|
||||
}
|
||||
|
||||
// To properly nest a column row, padding and margin is removed
|
||||
.row .column.row.row {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
@include -zf-each-breakpoint {
|
||||
@for $i from 1 through $grid-column-count {
|
||||
// Sizing (percentage)
|
||||
@ -215,21 +206,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Source ordering
|
||||
@for $i from 1 through 6 {
|
||||
// Source ordering
|
||||
.#{$-zf-size}-order-#{$i} {
|
||||
@include flex-order($i);
|
||||
@include flex-grid-order($i);
|
||||
}
|
||||
}
|
||||
|
||||
// Block grid
|
||||
@for $i from 1 through $block-grid-max {
|
||||
.#{$-zf-size}-up-#{$i} {
|
||||
@include flex-grid-layout($i);
|
||||
}
|
||||
}
|
||||
|
||||
@if $-zf-size != $-zf-zero-breakpoint {
|
||||
@if $-zf-size != small {
|
||||
// Sizing (expand)
|
||||
@include breakpoint($-zf-size) {
|
||||
.#{$-zf-size}-expand {
|
||||
@ -240,7 +224,7 @@
|
||||
// Auto-stacking/unstacking
|
||||
@at-root (without: media) {
|
||||
.row.#{$-zf-size}-unstack {
|
||||
> .column {
|
||||
.column {
|
||||
flex: flex-grid-column(100%);
|
||||
|
||||
@include breakpoint($-zf-size) {
|
||||
@ -257,8 +241,12 @@
|
||||
}
|
||||
|
||||
.#{$-zf-size}-uncollapse {
|
||||
$gutter: -zf-get-bp-val($grid-column-gutter, $-zf-size);
|
||||
|
||||
@if $grid-column-gutter {
|
||||
$gutter: $grid-column-gutter;
|
||||
}
|
||||
@else {
|
||||
$gutter: -zf-get-bp-val($grid-column-responsive-gutter, $-zf-size);
|
||||
}
|
||||
> .column { @include grid-col-uncollapse($gutter); }
|
||||
}
|
||||
}
|
||||
@ -266,14 +254,23 @@
|
||||
// Sizing (shrink)
|
||||
.shrink {
|
||||
flex: flex-grid-column(shrink);
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
// Horizontal alignment using justify-content
|
||||
@each $hdir, $prop in map-remove($-zf-flex-justify, left) {
|
||||
.row.align-#{$hdir} {
|
||||
@include flex-grid-row-align($x: $hdir);
|
||||
}
|
||||
}
|
||||
|
||||
// Vertical alignment using align-items and align-self
|
||||
// Remove these in 6.3
|
||||
@each $vdir, $prop in $-zf-flex-align {
|
||||
.row.align-#{$vdir} {
|
||||
@include flex-grid-row-align($y: $vdir);
|
||||
}
|
||||
|
||||
.column.align-#{$vdir} {
|
||||
@include flex-align-self($vdir);
|
||||
@include flex-grid-column-align($vdir);
|
||||
}
|
||||
}
|
||||
|
||||
|
32
app/vendor/foundation/scss/grid/_grid.scss
vendored
32
app/vendor/foundation/scss/grid/_grid.scss
vendored
@ -14,10 +14,14 @@ $grid-row-width: $global-width !default;
|
||||
/// @type Number
|
||||
$grid-column-count: 12 !default;
|
||||
|
||||
/// The amount of space between columns at different screen sizes. To use just one size, set the variable to a number instead of a map.
|
||||
/// @type Map | Length
|
||||
// The amount of space between columns. Remove this in 6.2.
|
||||
// @type Number
|
||||
$grid-column-gutter: null !default;
|
||||
|
||||
/// The amount of space between columns at different screen sizes.
|
||||
/// @type Map
|
||||
/// @since 6.1.0
|
||||
$grid-column-gutter: (
|
||||
$grid-column-responsive-gutter: (
|
||||
small: 20px,
|
||||
medium: 30px,
|
||||
) !default;
|
||||
@ -26,28 +30,12 @@ $grid-column-gutter: (
|
||||
/// @type Boolean
|
||||
$grid-column-align-edge: true !default;
|
||||
|
||||
/// The highest number of `.x-up` classes available when using the block grid CSS.
|
||||
/// @type Number
|
||||
$block-grid-max: 8 !default;
|
||||
|
||||
// Internal value to store the end column float direction
|
||||
$-zf-end-float: if($grid-column-align-edge, $global-right, $global-left);
|
||||
|
||||
// The last piece to transition the responsive gutter feature
|
||||
// Remove this in 6.3
|
||||
$grid-column-responsive-gutter: null !default;
|
||||
@if $grid-column-responsive-gutter {
|
||||
// scss-lint:disable DebugStatement
|
||||
@warn 'Rename $grid-column-responsive-gutter to $grid-column-gutter to remove this warning.';
|
||||
$grid-column-gutter: $grid-column-responsive-gutter;
|
||||
}
|
||||
|
||||
// If a single value is passed as a gutter, convert it to a map so the code knows what to do with it
|
||||
@if type-of($grid-column-gutter) == 'number' {
|
||||
$grid-column-gutter: (
|
||||
small: $grid-column-gutter,
|
||||
);
|
||||
}
|
||||
/// The highest number of `.x-up` classes available when using the block grid CSS.
|
||||
/// @type Number
|
||||
$block-grid-max: 8 !default;
|
||||
|
||||
@import 'row';
|
||||
@import 'column';
|
||||
|
2
app/vendor/foundation/scss/grid/_gutter.scss
vendored
2
app/vendor/foundation/scss/grid/_gutter.scss
vendored
@ -6,7 +6,7 @@
|
||||
/// @group grid
|
||||
////
|
||||
|
||||
/// Collapse the gutters on a column by removing the padding. **Note:** only use this mixin within a breakpoint. To collapse a column's gutters on all screen sizes, use the `$gutter` parameter of the `grid-column()` mixin instead.
|
||||
/// Collapse the gutters on a column by removing the padding.
|
||||
@mixin grid-column-collapse {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
|
47
app/vendor/foundation/scss/grid/_layout.scss
vendored
47
app/vendor/foundation/scss/grid/_layout.scss
vendored
@ -10,39 +10,14 @@
|
||||
///
|
||||
/// @param {Number} $n - Number of elements to display per row.
|
||||
/// @param {String} $selector ['.column'] - Selector(s) to use for child elements.
|
||||
/// @param {Number|List} $gutter
|
||||
/// The gutter to apply to child elements. Accepts multiple values:
|
||||
/// - $grid-column-gutter will use the values in the $grid-column-gutter map, including breakpoint sizes.
|
||||
/// - A fixed numeric value will apply this gutter to all breakpoints.
|
||||
@mixin grid-layout(
|
||||
$n,
|
||||
$selector: '.column',
|
||||
$gutter: null
|
||||
$selector: '.column'
|
||||
) {
|
||||
& > #{$selector} {
|
||||
width: percentage(1/$n);
|
||||
float: $global-left;
|
||||
|
||||
// If a $gutter value is passed
|
||||
@if($gutter) {
|
||||
// Gutters
|
||||
@if type-of($gutter) == 'map' {
|
||||
@each $breakpoint, $value in $gutter {
|
||||
$padding: rem-calc($value) / 2;
|
||||
|
||||
@include breakpoint($breakpoint) {
|
||||
padding-left: $padding;
|
||||
padding-right: $padding;
|
||||
}
|
||||
}
|
||||
}
|
||||
@else if type-of($gutter) == 'number' and strip-unit($gutter) > 0 {
|
||||
$padding: rem-calc($gutter) / 2;
|
||||
padding-left: $padding;
|
||||
padding-right: $padding;
|
||||
}
|
||||
}
|
||||
|
||||
&:nth-of-type(1n) {
|
||||
clear: none;
|
||||
}
|
||||
@ -52,25 +27,7 @@
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
float: $global-left;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds extra CSS to block grid children so the last items in the row center automatically. Apply this to the columns, not the row.
|
||||
///
|
||||
/// @param {Number} $n - Number of items that appear in each row.
|
||||
@mixin grid-layout-center-last($n) {
|
||||
@for $i from 1 to $n {
|
||||
@if $i == 1 {
|
||||
&:nth-child(#{$n}n+1):last-child {
|
||||
margin-left: (100 - 100/$n * $i) / 2 * 1%;
|
||||
}
|
||||
}
|
||||
@else {
|
||||
&:nth-child(#{$n}n+1):nth-last-child(#{$i}) {
|
||||
margin-left: (100 - 100/$n * $i) / 2 * 1%;
|
||||
}
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
/// Reposition a column.
|
||||
///
|
||||
/// @param {Number|Keyword} $position - Direction and amount to move. The column will move equal to the width of the column count specified. A positive number will push the column to the right, while a negative number will pull it to the left. Set to center to center the column.
|
||||
/// @param {Number} $position - Direction and amount to move. The column will move equal to the width of the column count specified. A positive number will push the column to the right, while a negative number will pull it to the left.
|
||||
@mixin grid-column-position($position) {
|
||||
@if type-of($position) == 'number' {
|
||||
$offset: percentage($position / $grid-column-count);
|
||||
@ -17,10 +17,7 @@
|
||||
#{$global-left}: $offset;
|
||||
}
|
||||
@else if $position == center {
|
||||
&, &:last-child:not(:first-child) {
|
||||
float: none;
|
||||
clear: both;
|
||||
}
|
||||
float: none;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
@ -34,7 +31,6 @@
|
||||
position: static;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
float: left;
|
||||
}
|
||||
|
||||
/// Offsets a column to the right by `$n` columns.
|
||||
|
29
app/vendor/foundation/scss/grid/_row.scss
vendored
29
app/vendor/foundation/scss/grid/_row.scss
vendored
@ -29,7 +29,7 @@
|
||||
}
|
||||
|
||||
// Restore the old column count
|
||||
$grid-column-count: $old-grid-column-count !global;
|
||||
$grid-column-count: $old-grid-column-count;
|
||||
}
|
||||
|
||||
/// Creates a grid row.
|
||||
@ -48,12 +48,13 @@
|
||||
$cf: true,
|
||||
$gutter: $grid-column-gutter
|
||||
) {
|
||||
$behavior: -zf-get-options($behavior, nest collapse);
|
||||
$margin: auto;
|
||||
|
||||
@if index($behavior, nest) != null {
|
||||
@if map-get($behavior, nest) {
|
||||
@include grid-row-nest($gutter);
|
||||
|
||||
@if index($behavior, collapse) != null {
|
||||
@if map-get($behavior, collapse) {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
@ -78,17 +79,19 @@
|
||||
/// Inverts the margins of a row to nest it inside of a column.
|
||||
///
|
||||
/// @param {Map|null} $gutter [null] - Gutter value to use when inverting the margins. Set to `null` to refer to the responsive gutter settings.
|
||||
@mixin grid-row-nest($gutter: $grid-column-gutter) {
|
||||
@if type-of($gutter) == 'number' {
|
||||
$gutter: ($-zf-zero-breakpoint: $gutter);
|
||||
@mixin grid-row-nest($gutter: null) {
|
||||
@if $gutter != null {
|
||||
$margin: rem-calc($gutter) / 2 * -1;
|
||||
margin-left: $margin;
|
||||
margin-right: $margin;
|
||||
}
|
||||
|
||||
@each $breakpoint, $value in $gutter {
|
||||
$margin: rem-calc($value) / 2 * -1;
|
||||
|
||||
@include breakpoint($breakpoint) {
|
||||
margin-left: $margin;
|
||||
margin-right: $margin;
|
||||
@else {
|
||||
@each $breakpoint, $value in $grid-column-responsive-gutter {
|
||||
$margin: rem-calc($value) / 2 * -1;
|
||||
@include breakpoint($breakpoint) {
|
||||
margin-left: $margin;
|
||||
margin-right: $margin;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
127
app/vendor/foundation/scss/settings/_settings.scss
vendored
127
app/vendor/foundation/scss/settings/_settings.scss
vendored
@ -25,20 +25,19 @@
|
||||
// 20. Label
|
||||
// 21. Media Object
|
||||
// 22. Menu
|
||||
// 23. Meter
|
||||
// 24. Off-canvas
|
||||
// 25. Orbit
|
||||
// 26. Pagination
|
||||
// 27. Progress Bar
|
||||
// 28. Reveal
|
||||
// 29. Slider
|
||||
// 30. Switch
|
||||
// 31. Table
|
||||
// 32. Tabs
|
||||
// 33. Thumbnail
|
||||
// 34. Title Bar
|
||||
// 35. Tooltip
|
||||
// 36. Top Bar
|
||||
// 23. Off-canvas
|
||||
// 24. Orbit
|
||||
// 25. Pagination
|
||||
// 26. Progress Bar
|
||||
// 27. Reveal
|
||||
// 28. Slider
|
||||
// 29. Switch
|
||||
// 30. Table
|
||||
// 31. Tabs
|
||||
// 32. Thumbnail
|
||||
// 33. Title Bar
|
||||
// 34. Tooltip
|
||||
// 35. Top Bar
|
||||
|
||||
@import 'util/util';
|
||||
|
||||
@ -48,13 +47,11 @@
|
||||
$global-font-size: 100%;
|
||||
$global-width: rem-calc(1200);
|
||||
$global-lineheight: 1.5;
|
||||
$foundation-palette: (
|
||||
primary: #2199e8,
|
||||
secondary: #777,
|
||||
success: #3adb76,
|
||||
warning: #ffae00,
|
||||
alert: #ec5840,
|
||||
);
|
||||
$primary-color: #2199e8;
|
||||
$secondary-color: #777;
|
||||
$success-color: #3adb76;
|
||||
$warning-color: #ffae00;
|
||||
$alert-color: #ec5840;
|
||||
$light-gray: #e6e6e6;
|
||||
$medium-gray: #cacaca;
|
||||
$dark-gray: #8a8a8a;
|
||||
@ -70,10 +67,6 @@ $global-weight-normal: normal;
|
||||
$global-weight-bold: bold;
|
||||
$global-radius: 0;
|
||||
$global-text-direction: ltr;
|
||||
$global-flexbox: false;
|
||||
$print-transparent-backgrounds: true;
|
||||
|
||||
@include add-foundation-colors;
|
||||
|
||||
// 2. Breakpoints
|
||||
// --------------
|
||||
@ -92,7 +85,7 @@ $breakpoint-classes: (small medium large);
|
||||
|
||||
$grid-row-width: $global-width;
|
||||
$grid-column-count: 12;
|
||||
$grid-column-gutter: (
|
||||
$grid-column-responsive-gutter: (
|
||||
small: 20px,
|
||||
medium: 30px,
|
||||
);
|
||||
@ -184,9 +177,9 @@ $stat-font-size: 2.5rem;
|
||||
|
||||
$abide-inputs: true;
|
||||
$abide-labels: true;
|
||||
$input-background-invalid: map-get($foundation-palette, alert);
|
||||
$form-label-color-invalid: map-get($foundation-palette, alert);
|
||||
$input-error-color: map-get($foundation-palette, alert);
|
||||
$input-background-invalid: $alert-color;
|
||||
$form-label-color-invalid: $alert-color;
|
||||
$input-error-color: $alert-color;
|
||||
$input-error-font-size: rem-calc(12);
|
||||
$input-error-font-weight: $global-weight-bold;
|
||||
|
||||
@ -200,7 +193,7 @@ $accordion-item-background-hover: $light-gray;
|
||||
$accordion-item-padding: 1.25rem 1rem;
|
||||
$accordion-content-background: $white;
|
||||
$accordion-content-border: 1px solid $light-gray;
|
||||
$accordion-content-color: foreground($accordion-content-background, $body-font-color);
|
||||
$accordion-content-color: foreground($accordion-background, $primary-color);
|
||||
$accordion-content-padding: 1rem;
|
||||
|
||||
// 8. Accordion Menu
|
||||
@ -238,8 +231,8 @@ $button-margin: 0 0 $global-margin 0;
|
||||
$button-fill: solid;
|
||||
$button-background: $primary-color;
|
||||
$button-background-hover: scale-color($button-background, $lightness: -15%);
|
||||
$button-color: $white;
|
||||
$button-color-alt: $black;
|
||||
$button-color: #fff;
|
||||
$button-color-alt: #000;
|
||||
$button-radius: $global-radius;
|
||||
$button-sizes: (
|
||||
tiny: 0.6rem,
|
||||
@ -248,8 +241,6 @@ $button-sizes: (
|
||||
large: 1.25rem,
|
||||
);
|
||||
$button-opacity-disabled: 0.25;
|
||||
$button-background-hover-lightness: -20%;
|
||||
$button-hollow-hover-lightness: -50%;
|
||||
|
||||
// 12. Button Group
|
||||
// ----------------
|
||||
@ -296,7 +287,7 @@ $drilldown-background: $white;
|
||||
|
||||
$dropdown-padding: 1rem;
|
||||
$dropdown-border: 1px solid $medium-gray;
|
||||
$dropdown-font-size: 1rem;
|
||||
$dropdown-font-size: 16rem;
|
||||
$dropdown-width: 300px;
|
||||
$dropdown-radius: $global-radius;
|
||||
$dropdown-sizes: (
|
||||
@ -329,7 +320,7 @@ $fieldset-padding: rem-calc(20);
|
||||
$fieldset-margin: rem-calc(18 0);
|
||||
$legend-padding: rem-calc(0 3);
|
||||
$form-spacing: rem-calc(16);
|
||||
$helptext-color: $black;
|
||||
$helptext-color: #333;
|
||||
$helptext-font-size: rem-calc(13);
|
||||
$helptext-font-style: italic;
|
||||
$input-prefix-color: $black;
|
||||
@ -341,10 +332,9 @@ $form-label-font-size: rem-calc(14);
|
||||
$form-label-font-weight: $global-weight-normal;
|
||||
$form-label-line-height: 1.8;
|
||||
$select-background: $white;
|
||||
$select-triangle-color: $dark-gray;
|
||||
$select-triangle-color: #333;
|
||||
$select-radius: $global-radius;
|
||||
$input-color: $black;
|
||||
$input-placeholder-color: $medium-gray;
|
||||
$input-font-family: inherit;
|
||||
$input-font-size: rem-calc(16);
|
||||
$input-background: $white;
|
||||
@ -354,11 +344,10 @@ $input-border: 1px solid $medium-gray;
|
||||
$input-border-focus: 1px solid $dark-gray;
|
||||
$input-shadow: inset 0 1px 2px rgba($black, 0.1);
|
||||
$input-shadow-focus: 0 0 5px $medium-gray;
|
||||
$input-cursor-disabled: not-allowed;
|
||||
$input-cursor-disabled: default;
|
||||
$input-transition: box-shadow 0.5s, border-color 0.25s ease-in-out;
|
||||
$input-number-spinners: true;
|
||||
$input-radius: $global-radius;
|
||||
$button-radius: $global-radius;
|
||||
|
||||
// 20. Label
|
||||
// ---------
|
||||
@ -382,21 +371,10 @@ $mediaobject-image-width-stacked: 100%;
|
||||
$menu-margin: 0;
|
||||
$menu-margin-nested: 1rem;
|
||||
$menu-item-padding: 0.7rem 1rem;
|
||||
$menu-item-color-active: $white;
|
||||
$menu-item-background-active: map-get($foundation-palette, primary);
|
||||
$menu-icon-spacing: 0.25rem;
|
||||
$menu-expand-max: 6;
|
||||
|
||||
// 23. Meter
|
||||
// ---------
|
||||
|
||||
$meter-height: 1rem;
|
||||
$meter-radius: $global-radius;
|
||||
$meter-background: $medium-gray;
|
||||
$meter-fill-good: $success-color;
|
||||
$meter-fill-medium: $warning-color;
|
||||
$meter-fill-bad: $alert-color;
|
||||
|
||||
// 24. Off-canvas
|
||||
// 23. Off-canvas
|
||||
// --------------
|
||||
|
||||
$offcanvas-size: 250px;
|
||||
@ -409,7 +387,7 @@ $offcanvas-exit-background: rgba($white, 0.25);
|
||||
$maincontent-class: 'off-canvas-content';
|
||||
$maincontent-shadow: 0 0 10px rgba($black, 0.5);
|
||||
|
||||
// 25. Orbit
|
||||
// 24. Orbit
|
||||
// ---------
|
||||
|
||||
$orbit-bullet-background: $medium-gray;
|
||||
@ -424,7 +402,7 @@ $orbit-control-background-hover: rgba($black, 0.5);
|
||||
$orbit-control-padding: 1rem;
|
||||
$orbit-control-zindex: 10;
|
||||
|
||||
// 26. Pagination
|
||||
// 25. Pagination
|
||||
// --------------
|
||||
|
||||
$pagination-font-size: rem-calc(14);
|
||||
@ -439,10 +417,9 @@ $pagination-item-color-current: foreground($pagination-item-background-current);
|
||||
$pagination-item-color-disabled: $medium-gray;
|
||||
$pagination-ellipsis-color: $black;
|
||||
$pagination-mobile-items: false;
|
||||
$pagination-mobile-current-item: false;
|
||||
$pagination-arrows: true;
|
||||
|
||||
// 27. Progress Bar
|
||||
// 26. Progress Bar
|
||||
// ----------------
|
||||
|
||||
$progress-height: 1rem;
|
||||
@ -451,24 +428,24 @@ $progress-margin-bottom: $global-margin;
|
||||
$progress-meter-background: $primary-color;
|
||||
$progress-radius: $global-radius;
|
||||
|
||||
// 28. Reveal
|
||||
// 27. Reveal
|
||||
// ----------
|
||||
|
||||
$reveal-background: $white;
|
||||
$reveal-width: 600px;
|
||||
$reveal-max-width: $global-width;
|
||||
$reveal-offset: rem-calc(100);
|
||||
$reveal-padding: $global-padding;
|
||||
$reveal-border: 1px solid $medium-gray;
|
||||
$reveal-radius: $global-radius;
|
||||
$reveal-zindex: 1005;
|
||||
$reveal-overlay-background: rgba($black, 0.45);
|
||||
|
||||
// 29. Slider
|
||||
// 28. Slider
|
||||
// ----------
|
||||
|
||||
$slider-width-vertical: 0.5rem;
|
||||
$slider-transition: all 0.2s ease-in-out;
|
||||
$slider-height: 0.5rem;
|
||||
$slider-width-vertical: $slider-height;
|
||||
$slider-background: $light-gray;
|
||||
$slider-fill-background: $medium-gray;
|
||||
$slider-handle-height: 1.4rem;
|
||||
@ -476,8 +453,9 @@ $slider-handle-width: 1.4rem;
|
||||
$slider-handle-background: $primary-color;
|
||||
$slider-opacity-disabled: 0.25;
|
||||
$slider-radius: $global-radius;
|
||||
$slider-transition: all 0.2s ease-in-out;
|
||||
|
||||
// 30. Switch
|
||||
// 29. Switch
|
||||
// ----------
|
||||
|
||||
$switch-background: $medium-gray;
|
||||
@ -493,7 +471,7 @@ $switch-paddle-offset: 0.25rem;
|
||||
$switch-paddle-radius: $global-radius;
|
||||
$switch-paddle-transition: all 0.25s ease-out;
|
||||
|
||||
// 31. Table
|
||||
// 30. Table
|
||||
// ---------
|
||||
|
||||
$table-background: $white;
|
||||
@ -506,20 +484,18 @@ $table-row-stripe-hover: darken($table-background, $table-color-scale + $table-h
|
||||
$table-striped-background: smart-scale($table-background, $table-color-scale);
|
||||
$table-stripe: even;
|
||||
$table-head-background: smart-scale($table-background, $table-color-scale / 2);
|
||||
$table-head-row-hover: darken($table-head-background, $table-hover-scale);
|
||||
$table-foot-background: smart-scale($table-background, $table-color-scale);
|
||||
$table-foot-row-hover: darken($table-foot-background, $table-hover-scale);
|
||||
$table-head-font-color: $body-font-color;
|
||||
$table-foot-font-color: $body-font-color;
|
||||
$show-header-for-stacked: false;
|
||||
|
||||
// 32. Tabs
|
||||
// 31. Tabs
|
||||
// --------
|
||||
|
||||
$tab-margin: 0;
|
||||
$tab-background: $white;
|
||||
$tab-background-active: $light-gray;
|
||||
$tab-item-font-size: rem-calc(12);
|
||||
$tab-border: $light-gray;
|
||||
$tab-item-color: foreground($tab-background, $primary-color);
|
||||
$tab-item-background-hover: $white;
|
||||
$tab-item-padding: 1.25rem 1.5rem;
|
||||
$tab-expand-max: 6;
|
||||
@ -528,7 +504,7 @@ $tab-content-border: $light-gray;
|
||||
$tab-content-color: foreground($tab-background, $primary-color);
|
||||
$tab-content-padding: 1rem;
|
||||
|
||||
// 33. Thumbnail
|
||||
// 32. Thumbnail
|
||||
// -------------
|
||||
|
||||
$thumbnail-border: solid 4px $white;
|
||||
@ -538,7 +514,7 @@ $thumbnail-shadow-hover: 0 0 6px 1px rgba($primary-color, 0.5);
|
||||
$thumbnail-transition: box-shadow 200ms ease-out;
|
||||
$thumbnail-radius: $global-radius;
|
||||
|
||||
// 34. Title Bar
|
||||
// 33. Title Bar
|
||||
// -------------
|
||||
|
||||
$titlebar-background: $black;
|
||||
@ -549,26 +525,23 @@ $titlebar-icon-color: $white;
|
||||
$titlebar-icon-color-hover: $medium-gray;
|
||||
$titlebar-icon-spacing: 0.25rem;
|
||||
|
||||
// 35. Tooltip
|
||||
// 34. Tooltip
|
||||
// -----------
|
||||
|
||||
$has-tip-font-weight: $global-weight-bold;
|
||||
$has-tip-border-bottom: dotted 1px $dark-gray;
|
||||
$tooltip-background-color: $black;
|
||||
$tooltip-color: $white;
|
||||
$tooltip-padding: 0.75rem;
|
||||
$tooltip-font-size: $small-font-size;
|
||||
$tooltip-pip-width: 0.75rem;
|
||||
$tooltip-pip-height: $tooltip-pip-width * 0.866;
|
||||
$tooltip-pip-offset: 1.25rem;
|
||||
$tooltip-radius: $global-radius;
|
||||
|
||||
// 36. Top Bar
|
||||
// 35. Top Bar
|
||||
// -----------
|
||||
|
||||
$topbar-padding: 0.5rem;
|
||||
$topbar-background: $light-gray;
|
||||
$topbar-submenu-background: $topbar-background;
|
||||
$topbar-title-spacing: 1rem;
|
||||
$topbar-link-color: $primary-color;
|
||||
$topbar-input-width: 200px;
|
||||
$topbar-unstack-breakpoint: medium;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
@each $size in $breakpoint-classes {
|
||||
@include breakpoint($size) {
|
||||
@each $align in (left, right, center, justify) {
|
||||
@if $size != $-zf-zero-breakpoint {
|
||||
@if $size != 'small' {
|
||||
.#{$size}-text-#{$align} {
|
||||
text-align: $align;
|
||||
}
|
||||
|
@ -435,9 +435,5 @@ $abbr-underline: 1px dotted $black !default;
|
||||
background-color: $keystroke-background;
|
||||
color: $keystroke-color;
|
||||
font-family: $keystroke-font;
|
||||
|
||||
@if has-value($keystroke-radius) {
|
||||
border-radius: $keystroke-radius;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,9 @@
|
||||
// foundation.zurb.com
|
||||
// Licensed under MIT Open Source
|
||||
|
||||
/// If `true`, all elements will have transparent backgrounds when printed, to save on ink.
|
||||
/// @type Boolean
|
||||
/// @group global
|
||||
$print-transparent-backgrounds: true !default;
|
||||
////
|
||||
/// @group typography
|
||||
////
|
||||
|
||||
// scss-lint:disable all
|
||||
|
||||
@ -14,10 +13,7 @@ $print-transparent-backgrounds: true !default;
|
||||
|
||||
@media print {
|
||||
* {
|
||||
@if $print-transparent-backgrounds {
|
||||
background: transparent !important;
|
||||
}
|
||||
|
||||
background: transparent !important;
|
||||
color: black !important; // Black prints faster: h5bp.com/s
|
||||
box-shadow: none !important;
|
||||
text-shadow: none !important;
|
||||
@ -49,7 +45,7 @@ $print-transparent-backgrounds: true !default;
|
||||
// Prevent page breaks in the middle of a blockquote or preformatted text block
|
||||
pre,
|
||||
blockquote {
|
||||
border: 1px solid $dark-gray;
|
||||
border: 1px solid #999;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
|
||||
|
104
app/vendor/foundation/scss/util/_breakpoint.scss
vendored
104
app/vendor/foundation/scss/util/_breakpoint.scss
vendored
@ -18,15 +18,6 @@ $breakpoints: (
|
||||
xxlarge: 1440px,
|
||||
) !default;
|
||||
|
||||
$-zf-zero-breakpoint: small !default;
|
||||
|
||||
@if nth(map-values($breakpoints), 1) != 0 {
|
||||
@error 'Your smallest breakpoint (defined in $breakpoints) must be set to "0".';
|
||||
}
|
||||
@else {
|
||||
$-zf-zero-breakpoint: nth(map-keys($breakpoints), 1);
|
||||
}
|
||||
|
||||
/// All of the names in this list will be output as classes in your CSS, like `.small-12`, `.medium-6`, and so on. Each value in this list must also be in the `$breakpoints` map.
|
||||
/// @type List
|
||||
$breakpoint-classes: (small medium large) !default;
|
||||
@ -34,7 +25,7 @@ $breakpoint-classes: (small medium large) !default;
|
||||
/// Generates a media query string matching the input value. Refer to the documentation for the `breakpoint()` mixin to see what the possible inputs are.
|
||||
///
|
||||
/// @param {Keyword|Number} $val [small] - Breakpoint name, or px, rem, or em value to process.
|
||||
@function breakpoint($val: $-zf-zero-breakpoint) {
|
||||
@function breakpoint($val: small) {
|
||||
// Size or keyword
|
||||
$bp: nth($val, 1);
|
||||
// Value for max-width media queries
|
||||
@ -58,7 +49,14 @@ $breakpoint-classes: (small medium large) !default;
|
||||
@if type-of($bp) == 'string' {
|
||||
@if map-has-key($breakpoints, $bp) {
|
||||
@if $dir == 'only' or $dir == 'down' {
|
||||
$bp-max: -zf-map-next($breakpoints, $bp);
|
||||
$next-bp: -zf-map-next($breakpoints, $bp);
|
||||
|
||||
@if $next-bp == null {
|
||||
$bp-max: null;
|
||||
}
|
||||
@else {
|
||||
$bp-max: $next-bp;
|
||||
}
|
||||
}
|
||||
|
||||
$bp: map-get($breakpoints, $bp);
|
||||
@ -66,7 +64,6 @@ $breakpoint-classes: (small medium large) !default;
|
||||
}
|
||||
@else {
|
||||
$bp: 0;
|
||||
@warn 'breakpoint(): "#{$val}" is not defined in your $breakpoints setting.';
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,44 +73,37 @@ $breakpoint-classes: (small medium large) !default;
|
||||
$bp-max: -zf-bp-to-em($bp-max) - (1/16);
|
||||
}
|
||||
|
||||
// Conditions to skip media query creation
|
||||
// - It's a named breakpoint that resolved to "0 down" or "0 up"
|
||||
// - It's a numeric breakpoint that resolved to "0 " + anything
|
||||
// Skip media query creation if the input is "0 up"
|
||||
@if $bp > 0em or $dir == 'only' or $dir == 'down' {
|
||||
// `only` ranges use the format `(min-width: n) and (max-width: n)`
|
||||
@if $dir == 'only' {
|
||||
// Only named media queries can have an "only" range
|
||||
@if $named == true {
|
||||
// Only use "min-width" if the floor is greater than 0
|
||||
@if $bp > 0em {
|
||||
$str: $str + '(min-width: #{$bp})';
|
||||
$str: $str + '(min-width: #{$bp})';
|
||||
|
||||
// Only add "and" to the media query if there's a ceiling
|
||||
@if $bp-max != null {
|
||||
$str: $str + ' and ';
|
||||
}
|
||||
}
|
||||
|
||||
// Only use "max-width" if there's a ceiling
|
||||
@if $bp-max != null {
|
||||
$str: $str + '(max-width: #{$bp-max})';
|
||||
$str: $str + ' and (max-width: #{$bp-max})';
|
||||
}
|
||||
}
|
||||
@else {
|
||||
@warn 'breakpoint(): Only named media queries can have an `only` range.';
|
||||
@warn 'Only named media queries can have an `only` range.';
|
||||
}
|
||||
}
|
||||
|
||||
// `down` ranges use the format `(max-width: n)`
|
||||
@else if $dir == 'down' {
|
||||
$max: if($named, $bp-max, $bp);
|
||||
$max: 0;
|
||||
|
||||
// Skip media query creation if input value is exactly "0 down",
|
||||
// unless the function was called as "small down", in which case it's just "small only"
|
||||
// For named breakpoints, subtract the breakpoint value by one "pixel", or 1/16em.
|
||||
@if $named {
|
||||
$max: $bp-max;
|
||||
}
|
||||
@else {
|
||||
$max: $bp;
|
||||
}
|
||||
|
||||
// Skip media query creation if input value is exactly "0 down" but don't "small down"
|
||||
@if $named or $bp > 0em {
|
||||
@if $max != null {
|
||||
$str: $str + '(max-width: #{$max})';
|
||||
}
|
||||
$str: $str + '(max-width: #{$max})';
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,7 +118,7 @@ $breakpoint-classes: (small medium large) !default;
|
||||
|
||||
/// Wraps a media query around the content you put inside the mixin. This mixin accepts a number of values:
|
||||
/// - If a string is passed, the mixin will look for it in the `$breakpoints` map, and use a media query there.
|
||||
/// - If a pixel value is passed, it will be converted to an em value using `$global-font-size` as the base.
|
||||
/// - If a pixel value is passed, it will be converted to an em value using `$rem-base`.
|
||||
/// - If a rem value is passed, the unit will be changed to em.
|
||||
/// - If an em value is passed, the value will be used as-is.
|
||||
///
|
||||
@ -175,26 +165,29 @@ $breakpoint-classes: (small medium large) !default;
|
||||
///
|
||||
/// @returns {Mixed} The value for the key after `$key`, if `$key` was found. If `$key` was not found, or `$key` was the last value in the map, returns `null`.
|
||||
@function -zf-map-next($map, $key) {
|
||||
// Store the values of the map as a list, so we can access them with nth
|
||||
$values: map-values($map);
|
||||
|
||||
// Store the keys of the map as a list
|
||||
$values: map-keys($map);
|
||||
|
||||
$i: 0;
|
||||
|
||||
// If the Key Exists, Get the index of the key within the map and add 1 to it for the next breakpoint in the map
|
||||
@if (map-has-key($map, $key)) {
|
||||
$i: index($values, $key) + 1;
|
||||
// Ghetto for loop
|
||||
$i: 1;
|
||||
$found: false;
|
||||
@each $val in map-keys($map) {
|
||||
@if $found == false {
|
||||
@if ($key == $val) {
|
||||
$found: true;
|
||||
}
|
||||
$i: $i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
// If the key doesn't exist, or it's the last key in the map, return null
|
||||
@if ($i > length($map) or $i == 0) {
|
||||
@if $i > length($map) {
|
||||
@return null;
|
||||
}
|
||||
// Otherwise, return the value
|
||||
@else {
|
||||
@return map-get($map, nth($values, $i));
|
||||
@return nth($values, $i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// Get a value for a breakpoint from a responsive config map. If the config map has the key `$value`, the exact breakpoint value is returned. If the config map does *not* have the breakpoint, the value matching the next lowest breakpoint in the config map is returned.
|
||||
@ -235,7 +228,7 @@ $breakpoint-classes: (small medium large) !default;
|
||||
}
|
||||
|
||||
// Legacy breakpoint variables
|
||||
// These will be removed in 6.3
|
||||
// These will be removed in 6.2
|
||||
$small-up: null;
|
||||
$small-only: null;
|
||||
$medium-up: null;
|
||||
@ -249,24 +242,25 @@ $xxlarge-only: null;
|
||||
|
||||
@if map-has-key($breakpoints, small) {
|
||||
$small-up: screen;
|
||||
$small-only: unquote('screen and #{breakpoint(small only)}');
|
||||
$small-only: screen and #{breakpoint(small only)};
|
||||
}
|
||||
|
||||
@if map-has-key($breakpoints, medium) {
|
||||
$medium-up: unquote('screen and #{breakpoint(medium)}');
|
||||
$medium-only: unquote('screen and #{breakpoint(medium only)}');
|
||||
$medium-up: screen and #{breakpoint(medium)};
|
||||
$medium-only: screen and #{breakpoint(medium only)};
|
||||
}
|
||||
|
||||
@if map-has-key($breakpoints, large) {
|
||||
$large-up: unquote('screen and #{breakpoint(large)}');
|
||||
$large-only: unquote('screen and #{breakpoint(large only)}');
|
||||
$large-up: screen and #{breakpoint(large)};
|
||||
$large-only: screen and #{breakpoint(large only)};
|
||||
}
|
||||
|
||||
@if map-has-key($breakpoints, xlarge) {
|
||||
$xlarge-up: unquote('screen and #{breakpoint(xlarge)}');
|
||||
$xlarge-only: unquote('screen and #{breakpoint(xlarge only)}');
|
||||
$xlarge-up: screen and #{breakpoint(xlarge)};
|
||||
$xlarge-only: screen and #{breakpoint(xlarge only)};
|
||||
}
|
||||
|
||||
@if map-has-key($breakpoints, xxlarge) {
|
||||
$xxlarge-up: unquote('screen and #{breakpoint(xxlarge)}');
|
||||
$xxlarge-up: screen and #{breakpoint(xxlarge)};
|
||||
$xxlarge-only: screen and #{breakpoint(xxlarge only)};
|
||||
}
|
||||
|
32
app/vendor/foundation/scss/util/_color.scss
vendored
32
app/vendor/foundation/scss/util/_color.scss
vendored
@ -39,35 +39,3 @@
|
||||
}
|
||||
@return scale-color($color, $lightness: $scale);
|
||||
}
|
||||
|
||||
/// Get color from foundation-palette
|
||||
///
|
||||
/// @param {key} color key from foundation-palette
|
||||
///
|
||||
/// @returns {Color} color from foundation-palette
|
||||
@function get-color($key) {
|
||||
@if map-has-key($foundation-palette, $key) {
|
||||
@return map-get($foundation-palette, $key);
|
||||
} @else {
|
||||
@error 'given $key is not available in $foundation-palette';
|
||||
}
|
||||
}
|
||||
|
||||
/// Transfers the colors in the `$foundation-palette` variable into the legacy color variables, such as `$primary-color` and `$secondary-color`. Call this mixin below the Global section of your settings file to properly migrate your codebase.
|
||||
@mixin add-foundation-colors() {
|
||||
@if map-has-key($foundation-palette, primary) {
|
||||
$primary-color: map-get($foundation-palette, primary) !global;
|
||||
}
|
||||
@if map-has-key($foundation-palette, secondary) {
|
||||
$secondary-color: map-get($foundation-palette, secondary) !global;
|
||||
}
|
||||
@if map-has-key($foundation-palette, success) {
|
||||
$success-color: map-get($foundation-palette, success) !global;
|
||||
}
|
||||
@if map-has-key($foundation-palette, warning) {
|
||||
$warning-color: map-get($foundation-palette, warning) !global;
|
||||
}
|
||||
@if map-has-key($foundation-palette, alert) {
|
||||
$alert-color: map-get($foundation-palette, alert) !global;
|
||||
}
|
||||
}
|
||||
|
68
app/vendor/foundation/scss/util/_flex.scss
vendored
68
app/vendor/foundation/scss/util/_flex.scss
vendored
@ -1,68 +0,0 @@
|
||||
$-zf-flex-justify: (
|
||||
'left': flex-start,
|
||||
'right': flex-end,
|
||||
'center': center,
|
||||
'justify': space-between,
|
||||
'spaced': space-around,
|
||||
);
|
||||
|
||||
$-zf-flex-align: (
|
||||
'top': flex-start,
|
||||
'bottom': flex-end,
|
||||
'middle': center,
|
||||
'stretch': stretch,
|
||||
);
|
||||
|
||||
/// Enables flexbox by adding `display: flex` to the element.
|
||||
@mixin flex {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
/// Horizontally or vertically aligns the items within a flex container.
|
||||
///
|
||||
/// @param {Keyword} $x [null] - Horizontal alignment to use. Can be `left`, `right`, `center`, `justify`, or `spaced`. Or, set it to `null` (the default) to not set horizontal alignment.
|
||||
/// @param {Keyword} $y [null] - Vertical alignment to use. Can be `top`, `bottom`, `middle`, or `stretch`. Or, set it to `null` (the default) to not set vertical alignment.
|
||||
@mixin flex-align($x: null, $y: null) {
|
||||
@if $x {
|
||||
@if map-has-key($-zf-flex-justify, $x) {
|
||||
$x: map-get($-zf-flex-justify, $x);
|
||||
}
|
||||
@else {
|
||||
@warn 'flex-grid-row-align(): #{$x} is not a valid value for horizontal alignment. Use left, right, center, justify, or spaced.'
|
||||
}
|
||||
}
|
||||
|
||||
@if $y {
|
||||
@if map-has-key($-zf-flex-align, $y) {
|
||||
$y: map-get($-zf-flex-align, $y);
|
||||
}
|
||||
@else {
|
||||
@warn 'flex-grid-row-align(): #{$y} is not a valid value for vertical alignment. Use top, bottom, middle, or stretch.'
|
||||
}
|
||||
}
|
||||
|
||||
justify-content: $x;
|
||||
align-items: $y;
|
||||
}
|
||||
|
||||
/// Vertically align a single column within a flex row. Apply this mixin to a flex column.
|
||||
///
|
||||
/// @param {Keyword} $y [null] - Vertical alignment to use. Can be `top`, `bottom`, `middle`, or `stretch`. Or, set it to `null` (the default) to not set vertical alignment.
|
||||
@mixin flex-align-self($y: null) {
|
||||
@if $y {
|
||||
@if map-has-key($-zf-flex-align, $y) {
|
||||
$y: map-get($-zf-flex-align, $y);
|
||||
}
|
||||
@else {
|
||||
@warn 'flex-grid-column-align(): #{$y} is not a valid value for alignment. Use top, bottom, middle, or stretch.'
|
||||
}
|
||||
}
|
||||
|
||||
align-self: $y;
|
||||
}
|
||||
|
||||
/// Changes the source order of a flex child. Children with lower numbers appear first in the layout.
|
||||
/// @param {Number} $order [0] - Order number to apply.
|
||||
@mixin flex-order($order: 0) {
|
||||
order: $order;
|
||||
}
|
42
app/vendor/foundation/scss/util/_mixins.scss
vendored
42
app/vendor/foundation/scss/util/_mixins.scss
vendored
@ -25,36 +25,32 @@
|
||||
@if ($triangle-direction == down) {
|
||||
border-color: $triangle-color transparent transparent;
|
||||
border-top-style: solid;
|
||||
border-bottom-width: 0;
|
||||
}
|
||||
@if ($triangle-direction == up) {
|
||||
border-color: transparent transparent $triangle-color;
|
||||
border-bottom-style: solid;
|
||||
border-top-width: 0;
|
||||
}
|
||||
@if ($triangle-direction == right) {
|
||||
border-color: transparent transparent transparent $triangle-color;
|
||||
border-left-style: solid;
|
||||
border-right-width: 0;
|
||||
}
|
||||
@if ($triangle-direction == left) {
|
||||
border-color: transparent $triangle-color transparent transparent;
|
||||
border-right-style: solid;
|
||||
border-left-width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a menu icon with a set width, height, number of bars, and colors. The mixin uses the height of the icon and the weight of the bars to determine spacing. <div class="docs-example-burger"></div>
|
||||
///
|
||||
/// @param {Color} $color [$black] - Color to use for the icon.
|
||||
/// @param {Color} $color-hover [$dark-gray] - Color to use when the icon is hovered over.
|
||||
/// @param {Number} $width [20px] - Width of the icon.
|
||||
/// @param {Number} $height [16px] - Height of the icon.
|
||||
/// @param {Number} $weight [2px] - Height of individual bars in the icon.
|
||||
/// @param {Number} $bars [3] - Number of bars in the icon.
|
||||
/// @param {Color} $color - Color to use for the icon.
|
||||
/// @param {Color} $color-hover - Color to use when the icon is hovered over.
|
||||
/// @param {Number} $width - Width of the icon.
|
||||
/// @param {Number} $height - Height of the icon.
|
||||
/// @param {Number} $weight - Height of individual bars in the icon.
|
||||
/// @param {Number} $bars - Number of bars in the icon.
|
||||
@mixin hamburger(
|
||||
$color: $black,
|
||||
$color-hover: $dark-gray,
|
||||
$color: #000,
|
||||
$color-hover: #666,
|
||||
$width: 20px,
|
||||
$height: 16px,
|
||||
$weight: 2px,
|
||||
@ -65,11 +61,7 @@
|
||||
$hover-shadow: ();
|
||||
|
||||
// Spacing between bars is calculated based on the total height of the icon and the weight of each bar
|
||||
$spacing: ($height - ($weight * $bars)) / ($bars - 1);
|
||||
|
||||
@if unit($spacing) == 'px' {
|
||||
$spacing: floor($spacing);
|
||||
}
|
||||
$spacing: floor(($height - ($weight * $bars)) / ($bars - 1));
|
||||
|
||||
// Icon container
|
||||
position: relative;
|
||||
@ -118,35 +110,27 @@
|
||||
///
|
||||
/// @param {Color} $color [$black] - Color to use for the triangle.
|
||||
@mixin background-triangle($color: $black) {
|
||||
$rgb: 'rgb%28#{round(red($color))}, #{round(green($color))}, #{round(blue($color))}%29';
|
||||
$rgb: 'rgb%28#{red($color)}, #{green($color)}, #{blue($color)}%29';
|
||||
|
||||
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' width='32' height='24' viewBox='0 0 32 24'><polygon points='0,0 32,0 16,24' style='fill: #{$rgb}'></polygon></svg>");
|
||||
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="32" height="24" viewBox="0 0 32 24"><polygon points="0,0 32,0 16,24" style="fill: #{$rgb}"></polygon></svg>');
|
||||
|
||||
@media screen and (min-width:0\0) {
|
||||
@if lightness($color) < 60% {
|
||||
// White triangle
|
||||
@if lightness($color) < 50% {
|
||||
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAYCAYAAACbU/80AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIpJREFUeNrEkckNgDAMBBfRkEt0ObRBBdsGXUDgmQfK4XhH2m8czQAAy27R3tsw4Qfe2x8uOO6oYLb6GlOor3GF+swURAOmUJ+RwtEJs9WvTGEYxBXqI1MQAZhCfUQKRzDMVj+TwrAIV6jvSUEkYAr1LSkcyTBb/V+KYfX7xAeusq3sLDtGH3kEGACPWIflNZfhRQAAAABJRU5ErkJggg==');
|
||||
}
|
||||
@else {
|
||||
// Black triangle
|
||||
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAYCAYAAACbU/80AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAMBJREFUeNrEllsOhCAMRVszC9IlzU7KCmVHTJsoMWYMUtpyv9BgbuXQB5ZSdgBYYY4ycgBivk8KYFsQMfMiTTBP4o3nUzCKzOabLJbLy2/g31evGkAginR4/ZegKH5qX3bJCscA3t0x3kgO5tQFyhhFf50xRqFLbyMUNJQzgyjGS/wgCpvKqkRBpuWrE4V9d+1E4dPUXqIg107SQOE/2DRQxMwTDygIInVDET9T3lCoj/6j/VCmGjZOl2lKpZ8AAwDQP7zIimDGFQAAAABJRU5ErkJggg==');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Applies the micro clearfix hack popularized by Nicolas Gallagher. Include this mixin on a container if its children are all floated, to give the container a proper height.
|
||||
/// The clearfix is augmented with specific styles to prevent borders in flexbox environments
|
||||
/// @link http://nicolasgallagher.com/micro-clearfix-hack/ Micro Clearfix Hack
|
||||
/// @link http://danisadesigner.com/blog/flexbox-clear-fix-pseudo-elements/ Flexbox fix
|
||||
@mixin clearfix {
|
||||
&::before,
|
||||
&::after {
|
||||
content: ' ';
|
||||
display: table;
|
||||
@if $global-flexbox {
|
||||
flex-basis: 0;
|
||||
order: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&::after {
|
||||
@ -226,7 +210,7 @@
|
||||
$map: $breakpoint-classes;
|
||||
|
||||
@if not $small {
|
||||
$map: map-remove($map, $-zf-zero-breakpoint);
|
||||
$map: map-remove($map, small);
|
||||
}
|
||||
|
||||
@each $size in $map {
|
||||
|
7
app/vendor/foundation/scss/util/_unit.scss
vendored
7
app/vendor/foundation/scss/util/_unit.scss
vendored
@ -39,11 +39,6 @@ $global-font-size: 100% !default;
|
||||
@if unit($base) == '%' {
|
||||
$base: ($base / 100%) * 16px;
|
||||
}
|
||||
|
||||
// Using rem as base allows correct scaling
|
||||
@if unit($base) == 'rem' {
|
||||
$base: strip-unit($base) * 16px;
|
||||
}
|
||||
|
||||
@if $count == 1 {
|
||||
@return -zf-to-rem($values, $base);
|
||||
@ -80,7 +75,7 @@ $global-font-size: 100% !default;
|
||||
@warn inspect($value) + ' was passed to rem-calc(), which is not a number.';
|
||||
@return $value;
|
||||
}
|
||||
|
||||
|
||||
// Calculate rem if units for $value is not rem
|
||||
@if unit($value) != 'rem' {
|
||||
$value: strip-unit($value) / strip-unit($base) * 1rem;
|
||||
|
6
app/vendor/foundation/scss/util/_util.scss
vendored
6
app/vendor/foundation/scss/util/_util.scss
vendored
@ -2,10 +2,14 @@
|
||||
// foundation.zurb.com
|
||||
// Licensed under MIT Open Source
|
||||
|
||||
// Utilities
|
||||
@import 'unit';
|
||||
@import 'value';
|
||||
@import 'color';
|
||||
@import 'selector';
|
||||
@import 'flex';
|
||||
|
||||
// Libraries
|
||||
@import 'breakpoint';
|
||||
|
||||
// Mixins
|
||||
@import 'mixins';
|
||||
|
37
app/vendor/foundation/scss/util/_value.scss
vendored
37
app/vendor/foundation/scss/util/_value.scss
vendored
@ -89,19 +89,38 @@
|
||||
style: solid,
|
||||
color: #000,
|
||||
);
|
||||
|
||||
@return map-get($defaults, $elem);
|
||||
}
|
||||
|
||||
/// Finds a value in a nested map.
|
||||
/// @link https://css-tricks.com/snippets/sass/deep-getset-maps/ Deep Get/Set in Maps
|
||||
/// Calculates x^y, where x is `$base` and y is `$power`.
|
||||
/// @access private
|
||||
///
|
||||
/// @param {Map} $map - Map to pull a value from.
|
||||
/// @param {String} $keys... - Keys to use when looking for a value.
|
||||
/// @returns {Mixed} The value found in the map.
|
||||
@function map-deep-get($map, $keys...) {
|
||||
@each $key in $keys {
|
||||
$map: map-get($map, $key);
|
||||
/// @param {Number} $base - Base number (x).
|
||||
/// @param {Number} $power - Exponent (y).
|
||||
@function pow($base, $power) {
|
||||
@if $power == 0 { @return 1; }
|
||||
@return $base * pow($base, $power - 1);
|
||||
}
|
||||
|
||||
// TODO: Remove this (it's used by the grid but is overkill)
|
||||
/// Given a user-defined list of keywords and a list of possible keywords, find the ones that were passed in.
|
||||
/// @access private
|
||||
///
|
||||
/// @param {List} $opts - List of values to find keywords in.
|
||||
/// @param {List} $seeking - List of all possible keywords.
|
||||
///
|
||||
/// @returns {Map} A map of all keywords in $seeking. If a keyword was found in $opts, its value is true, otherwise false.
|
||||
@function -zf-get-options($opts, $seeking) {
|
||||
@if type-of($opts) != 'list' {
|
||||
$opts: ($opts);
|
||||
}
|
||||
|
||||
$map: ();
|
||||
@each $keyword in $seeking {
|
||||
$val: if(index($opts, $keyword) != null, true, false);
|
||||
$item: ($keyword: $val);
|
||||
$map: map-merge($map, $item);
|
||||
}
|
||||
|
||||
@return $map;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ program.version(package.version)
|
||||
.option('-e, --embeddable', 'omit the HTML <body/> and generate the documentation content only (default: false)')
|
||||
.option('-d, --development-mode', 'start HTTP server with the file watcher and live reload (default: false)')
|
||||
.option('-s, --start-server', 'start the HTTP server without any development features')
|
||||
.option('-p, --port <dir>', 'the port number for the HTTP server to listen on (default: 4400)', Number, 4400)
|
||||
.option('-p, --port <dir>', 'the port number for the HTTP server to listen on (default: 4400)', Number, 4400)
|
||||
.option('-t, --target-dir <dir>', 'the target build directory (default: public)', String, path.resolve(cwd, 'public'))
|
||||
.option('-f, --target-file <file>', 'the target build HTML file (default: index.html)', String, 'index.html')
|
||||
.option('-a, --app-dir <dir>', 'the application source directory (default: app)', String, path.resolve(root, 'app'))
|
||||
@ -39,5 +39,11 @@ if (program.args.length < 1) { // && program.rawArgs.length < 1
|
||||
program.cacheDir = os.tmpdir() + '/.spectacle';
|
||||
program.specFile = program.args[0]; // || path.resolve(root, 'test/fixtures/cheese.json');
|
||||
|
||||
// Replace some absolute paths
|
||||
if (program.specFile && program.specFile.indexOf('test/fixtures') === 0)
|
||||
program.specFile = path.resolve(root, program.specFile);
|
||||
if (program.logoFile && program.logoFile.indexOf('test/fixtures') === 0)
|
||||
program.logoFile = path.resolve(root, program.logoFile);
|
||||
|
||||
// Run the main app with parsed options
|
||||
spectacle(program);
|
||||
|
16
index.js
16
index.js
@ -9,8 +9,8 @@ var fs = require('fs'),
|
||||
grunt = require('grunt'),
|
||||
package = require('./package'),
|
||||
_ = require('lodash');
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Run Spectacle and configured tasks
|
||||
**/
|
||||
@ -28,9 +28,13 @@ module.exports = function (options) {
|
||||
|
||||
grunt.initConfig(_.merge({ pkg: package }, config));
|
||||
|
||||
var cwd = process.cwd(); // change for loadNpmTasks
|
||||
process.chdir(__dirname);
|
||||
|
||||
var cwd = process.cwd(); // change CWD for loadNpmTasks global install
|
||||
var exists = grunt.file.exists(path.join(path.resolve('node_modules'),
|
||||
'grunt-contrib-concat',
|
||||
'package.json'));
|
||||
if (!exists)
|
||||
process.chdir(__dirname);
|
||||
|
||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
||||
@ -40,7 +44,7 @@ module.exports = function (options) {
|
||||
grunt.loadNpmTasks('grunt-contrib-connect');
|
||||
grunt.loadNpmTasks('grunt-compile-handlebars');
|
||||
grunt.loadNpmTasks('grunt-sass');
|
||||
|
||||
|
||||
process.chdir(cwd);
|
||||
|
||||
grunt.registerTask('predentation', 'Remove indentation from generated <pre> tags.', function() {
|
||||
|
File diff suppressed because it is too large
Load Diff
2997
public/stylesheets/foundation.css
vendored
2997
public/stylesheets/foundation.css
vendored
File diff suppressed because it is too large
Load Diff
2
public/stylesheets/foundation.min.css
vendored
2
public/stylesheets/foundation.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
2
public/stylesheets/spectacle.min.css
vendored
2
public/stylesheets/spectacle.min.css
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user