mirror of
https://github.com/documize/community.git
synced 2025-08-02 20:15:26 +02:00
initial commit
This commit is contained in:
commit
18933c6767
1841 changed files with 810642 additions and 0 deletions
1204
app/vendor/bootstrap.css
vendored
Executable file
1204
app/vendor/bootstrap.css
vendored
Executable file
File diff suppressed because it is too large
Load diff
390
app/vendor/bootstrap.json
vendored
Executable file
390
app/vendor/bootstrap.json
vendored
Executable file
|
@ -0,0 +1,390 @@
|
|||
{
|
||||
"vars": {
|
||||
"@gray-base": "#000",
|
||||
"@gray-darker": "lighten(@gray-base, 13.5%)",
|
||||
"@gray-dark": "lighten(@gray-base, 20%)",
|
||||
"@gray": "lighten(@gray-base, 33.5%)",
|
||||
"@gray-light": "lighten(@gray-base, 46.7%)",
|
||||
"@gray-lighter": "lighten(@gray-base, 93.5%)",
|
||||
"@brand-primary": "darken(#428bca, 6.5%)",
|
||||
"@brand-success": "#5cb85c",
|
||||
"@brand-info": "#5bc0de",
|
||||
"@brand-warning": "#f0ad4e",
|
||||
"@brand-danger": "#d9534f",
|
||||
"@body-bg": "#fff",
|
||||
"@text-color": "@gray-dark",
|
||||
"@link-color": "@brand-primary",
|
||||
"@link-hover-color": "darken(@link-color, 15%)",
|
||||
"@link-hover-decoration": "underline",
|
||||
"@font-family-sans-serif": "\"Helvetica Neue\", Helvetica, Arial, sans-serif",
|
||||
"@font-family-serif": "Georgia, \"Times New Roman\", Times, serif",
|
||||
"@font-family-monospace": "Menlo, Monaco, Consolas, \"Courier New\", monospace",
|
||||
"@font-family-base": "@font-family-sans-serif",
|
||||
"@font-size-base": "14px",
|
||||
"@font-size-large": "ceil((@font-size-base * 1.25))",
|
||||
"@font-size-small": "ceil((@font-size-base * 0.85))",
|
||||
"@font-size-h1": "floor((@font-size-base * 2.6))",
|
||||
"@font-size-h2": "floor((@font-size-base * 2.15))",
|
||||
"@font-size-h3": "ceil((@font-size-base * 1.7))",
|
||||
"@font-size-h4": "ceil((@font-size-base * 1.25))",
|
||||
"@font-size-h5": "@font-size-base",
|
||||
"@font-size-h6": "ceil((@font-size-base * 0.85))",
|
||||
"@line-height-base": "1.428571429",
|
||||
"@line-height-computed": "floor((@font-size-base * @line-height-base))",
|
||||
"@headings-font-family": "inherit",
|
||||
"@headings-font-weight": "500",
|
||||
"@headings-line-height": "1.1",
|
||||
"@headings-color": "inherit",
|
||||
"@icon-font-path": "\"../fonts/\"",
|
||||
"@icon-font-name": "\"glyphicons-halflings-regular\"",
|
||||
"@icon-font-svg-id": "\"glyphicons_halflingsregular\"",
|
||||
"@padding-base-vertical": "6px",
|
||||
"@padding-base-horizontal": "12px",
|
||||
"@padding-large-vertical": "10px",
|
||||
"@padding-large-horizontal": "16px",
|
||||
"@padding-small-vertical": "5px",
|
||||
"@padding-small-horizontal": "10px",
|
||||
"@padding-xs-vertical": "1px",
|
||||
"@padding-xs-horizontal": "5px",
|
||||
"@line-height-large": "1.3333333",
|
||||
"@line-height-small": "1.5",
|
||||
"@border-radius-base": "4px",
|
||||
"@border-radius-large": "6px",
|
||||
"@border-radius-small": "3px",
|
||||
"@component-active-color": "#fff",
|
||||
"@component-active-bg": "@brand-primary",
|
||||
"@caret-width-base": "4px",
|
||||
"@caret-width-large": "5px",
|
||||
"@table-cell-padding": "8px",
|
||||
"@table-condensed-cell-padding": "5px",
|
||||
"@table-bg": "transparent",
|
||||
"@table-bg-accent": "#f9f9f9",
|
||||
"@table-bg-hover": "#f5f5f5",
|
||||
"@table-bg-active": "@table-bg-hover",
|
||||
"@table-border-color": "#ddd",
|
||||
"@btn-font-weight": "normal",
|
||||
"@btn-default-color": "#333",
|
||||
"@btn-default-bg": "#fff",
|
||||
"@btn-default-border": "#ccc",
|
||||
"@btn-primary-color": "#fff",
|
||||
"@btn-primary-bg": "@brand-primary",
|
||||
"@btn-primary-border": "darken(@btn-primary-bg, 5%)",
|
||||
"@btn-success-color": "#fff",
|
||||
"@btn-success-bg": "@brand-success",
|
||||
"@btn-success-border": "darken(@btn-success-bg, 5%)",
|
||||
"@btn-info-color": "#fff",
|
||||
"@btn-info-bg": "@brand-info",
|
||||
"@btn-info-border": "darken(@btn-info-bg, 5%)",
|
||||
"@btn-warning-color": "#fff",
|
||||
"@btn-warning-bg": "@brand-warning",
|
||||
"@btn-warning-border": "darken(@btn-warning-bg, 5%)",
|
||||
"@btn-danger-color": "#fff",
|
||||
"@btn-danger-bg": "@brand-danger",
|
||||
"@btn-danger-border": "darken(@btn-danger-bg, 5%)",
|
||||
"@btn-link-disabled-color": "@gray-light",
|
||||
"@btn-border-radius-base": "@border-radius-base",
|
||||
"@btn-border-radius-large": "@border-radius-large",
|
||||
"@btn-border-radius-small": "@border-radius-small",
|
||||
"@input-bg": "#fff",
|
||||
"@input-bg-disabled": "@gray-lighter",
|
||||
"@input-color": "@gray",
|
||||
"@input-border": "#ccc",
|
||||
"@input-border-radius": "@border-radius-base",
|
||||
"@input-border-radius-large": "@border-radius-large",
|
||||
"@input-border-radius-small": "@border-radius-small",
|
||||
"@input-border-focus": "#66afe9",
|
||||
"@input-color-placeholder": "#999",
|
||||
"@input-height-base": "(@line-height-computed + (@padding-base-vertical * 2) + 2)",
|
||||
"@input-height-large": "(ceil(@font-size-large * @line-height-large) + (@padding-large-vertical * 2) + 2)",
|
||||
"@input-height-small": "(floor(@font-size-small * @line-height-small) + (@padding-small-vertical * 2) + 2)",
|
||||
"@form-group-margin-bottom": "15px",
|
||||
"@legend-color": "@gray-dark",
|
||||
"@legend-border-color": "#e5e5e5",
|
||||
"@input-group-addon-bg": "@gray-lighter",
|
||||
"@input-group-addon-border-color": "@input-border",
|
||||
"@cursor-disabled": "not-allowed",
|
||||
"@dropdown-bg": "#fff",
|
||||
"@dropdown-border": "rgba(0,0,0,.15)",
|
||||
"@dropdown-fallback-border": "#ccc",
|
||||
"@dropdown-divider-bg": "#e5e5e5",
|
||||
"@dropdown-link-color": "@gray-dark",
|
||||
"@dropdown-link-hover-color": "darken(@gray-dark, 5%)",
|
||||
"@dropdown-link-hover-bg": "#f5f5f5",
|
||||
"@dropdown-link-active-color": "@component-active-color",
|
||||
"@dropdown-link-active-bg": "@component-active-bg",
|
||||
"@dropdown-link-disabled-color": "@gray-light",
|
||||
"@dropdown-header-color": "@gray-light",
|
||||
"@dropdown-caret-color": "#000",
|
||||
"@screen-xs": "480px",
|
||||
"@screen-xs-min": "@screen-xs",
|
||||
"@screen-phone": "@screen-xs-min",
|
||||
"@screen-sm": "768px",
|
||||
"@screen-sm-min": "@screen-sm",
|
||||
"@screen-tablet": "@screen-sm-min",
|
||||
"@screen-md": "992px",
|
||||
"@screen-md-min": "@screen-md",
|
||||
"@screen-desktop": "@screen-md-min",
|
||||
"@screen-lg": "1200px",
|
||||
"@screen-lg-min": "@screen-lg",
|
||||
"@screen-lg-desktop": "@screen-lg-min",
|
||||
"@screen-xs-max": "(@screen-sm-min - 1)",
|
||||
"@screen-sm-max": "(@screen-md-min - 1)",
|
||||
"@screen-md-max": "(@screen-lg-min - 1)",
|
||||
"@grid-columns": "12",
|
||||
"@grid-gutter-width": "30px",
|
||||
"@grid-float-breakpoint": "@screen-sm-min",
|
||||
"@grid-float-breakpoint-max": "(@grid-float-breakpoint - 1)",
|
||||
"@container-tablet": "(720px + @grid-gutter-width)",
|
||||
"@container-sm": "@container-tablet",
|
||||
"@container-desktop": "(940px + @grid-gutter-width)",
|
||||
"@container-md": "@container-desktop",
|
||||
"@container-large-desktop": "(1140px + @grid-gutter-width)",
|
||||
"@container-lg": "@container-large-desktop",
|
||||
"@navbar-height": "50px",
|
||||
"@navbar-margin-bottom": "@line-height-computed",
|
||||
"@navbar-border-radius": "@border-radius-base",
|
||||
"@navbar-padding-horizontal": "floor((@grid-gutter-width / 2))",
|
||||
"@navbar-padding-vertical": "((@navbar-height - @line-height-computed) / 2)",
|
||||
"@navbar-collapse-max-height": "340px",
|
||||
"@navbar-default-color": "#777",
|
||||
"@navbar-default-bg": "#f8f8f8",
|
||||
"@navbar-default-border": "darken(@navbar-default-bg, 6.5%)",
|
||||
"@navbar-default-link-color": "#777",
|
||||
"@navbar-default-link-hover-color": "#333",
|
||||
"@navbar-default-link-hover-bg": "transparent",
|
||||
"@navbar-default-link-active-color": "#555",
|
||||
"@navbar-default-link-active-bg": "darken(@navbar-default-bg, 6.5%)",
|
||||
"@navbar-default-link-disabled-color": "#ccc",
|
||||
"@navbar-default-link-disabled-bg": "transparent",
|
||||
"@navbar-default-brand-color": "@navbar-default-link-color",
|
||||
"@navbar-default-brand-hover-color": "darken(@navbar-default-brand-color, 10%)",
|
||||
"@navbar-default-brand-hover-bg": "transparent",
|
||||
"@navbar-default-toggle-hover-bg": "#ddd",
|
||||
"@navbar-default-toggle-icon-bar-bg": "#888",
|
||||
"@navbar-default-toggle-border-color": "#ddd",
|
||||
"@navbar-inverse-color": "lighten(@gray-light, 15%)",
|
||||
"@navbar-inverse-bg": "#222",
|
||||
"@navbar-inverse-border": "darken(@navbar-inverse-bg, 10%)",
|
||||
"@navbar-inverse-link-color": "lighten(@gray-light, 15%)",
|
||||
"@navbar-inverse-link-hover-color": "#fff",
|
||||
"@navbar-inverse-link-hover-bg": "transparent",
|
||||
"@navbar-inverse-link-active-color": "@navbar-inverse-link-hover-color",
|
||||
"@navbar-inverse-link-active-bg": "darken(@navbar-inverse-bg, 10%)",
|
||||
"@navbar-inverse-link-disabled-color": "#444",
|
||||
"@navbar-inverse-link-disabled-bg": "transparent",
|
||||
"@navbar-inverse-brand-color": "@navbar-inverse-link-color",
|
||||
"@navbar-inverse-brand-hover-color": "#fff",
|
||||
"@navbar-inverse-brand-hover-bg": "transparent",
|
||||
"@navbar-inverse-toggle-hover-bg": "#333",
|
||||
"@navbar-inverse-toggle-icon-bar-bg": "#fff",
|
||||
"@navbar-inverse-toggle-border-color": "#333",
|
||||
"@nav-link-padding": "10px 15px",
|
||||
"@nav-link-hover-bg": "@gray-lighter",
|
||||
"@nav-disabled-link-color": "@gray-light",
|
||||
"@nav-disabled-link-hover-color": "@gray-light",
|
||||
"@nav-tabs-border-color": "#ddd",
|
||||
"@nav-tabs-link-hover-border-color": "@gray-lighter",
|
||||
"@nav-tabs-active-link-hover-bg": "@body-bg",
|
||||
"@nav-tabs-active-link-hover-color": "@gray",
|
||||
"@nav-tabs-active-link-hover-border-color": "#ddd",
|
||||
"@nav-tabs-justified-link-border-color": "#ddd",
|
||||
"@nav-tabs-justified-active-link-border-color": "@body-bg",
|
||||
"@nav-pills-border-radius": "@border-radius-base",
|
||||
"@nav-pills-active-link-hover-bg": "@component-active-bg",
|
||||
"@nav-pills-active-link-hover-color": "@component-active-color",
|
||||
"@pagination-color": "@link-color",
|
||||
"@pagination-bg": "#fff",
|
||||
"@pagination-border": "#ddd",
|
||||
"@pagination-hover-color": "@link-hover-color",
|
||||
"@pagination-hover-bg": "@gray-lighter",
|
||||
"@pagination-hover-border": "#ddd",
|
||||
"@pagination-active-color": "#fff",
|
||||
"@pagination-active-bg": "@brand-primary",
|
||||
"@pagination-active-border": "@brand-primary",
|
||||
"@pagination-disabled-color": "@gray-light",
|
||||
"@pagination-disabled-bg": "#fff",
|
||||
"@pagination-disabled-border": "#ddd",
|
||||
"@pager-bg": "@pagination-bg",
|
||||
"@pager-border": "@pagination-border",
|
||||
"@pager-border-radius": "15px",
|
||||
"@pager-hover-bg": "@pagination-hover-bg",
|
||||
"@pager-active-bg": "@pagination-active-bg",
|
||||
"@pager-active-color": "@pagination-active-color",
|
||||
"@pager-disabled-color": "@pagination-disabled-color",
|
||||
"@jumbotron-padding": "30px",
|
||||
"@jumbotron-color": "inherit",
|
||||
"@jumbotron-bg": "@gray-lighter",
|
||||
"@jumbotron-heading-color": "inherit",
|
||||
"@jumbotron-font-size": "ceil((@font-size-base * 1.5))",
|
||||
"@jumbotron-heading-font-size": "ceil((@font-size-base * 4.5))",
|
||||
"@state-success-text": "#3c763d",
|
||||
"@state-success-bg": "#dff0d8",
|
||||
"@state-success-border": "darken(spin(@state-success-bg, -10), 5%)",
|
||||
"@state-info-text": "#31708f",
|
||||
"@state-info-bg": "#d9edf7",
|
||||
"@state-info-border": "darken(spin(@state-info-bg, -10), 7%)",
|
||||
"@state-warning-text": "#8a6d3b",
|
||||
"@state-warning-bg": "#fcf8e3",
|
||||
"@state-warning-border": "darken(spin(@state-warning-bg, -10), 5%)",
|
||||
"@state-danger-text": "#a94442",
|
||||
"@state-danger-bg": "#f2dede",
|
||||
"@state-danger-border": "darken(spin(@state-danger-bg, -10), 5%)",
|
||||
"@tooltip-max-width": "200px",
|
||||
"@tooltip-color": "#fff",
|
||||
"@tooltip-bg": "#000",
|
||||
"@tooltip-opacity": ".9",
|
||||
"@tooltip-arrow-width": "5px",
|
||||
"@tooltip-arrow-color": "@tooltip-bg",
|
||||
"@popover-bg": "#fff",
|
||||
"@popover-max-width": "276px",
|
||||
"@popover-border-color": "rgba(0,0,0,.2)",
|
||||
"@popover-fallback-border-color": "#ccc",
|
||||
"@popover-title-bg": "darken(@popover-bg, 3%)",
|
||||
"@popover-arrow-width": "10px",
|
||||
"@popover-arrow-color": "@popover-bg",
|
||||
"@popover-arrow-outer-width": "(@popover-arrow-width + 1)",
|
||||
"@popover-arrow-outer-color": "fadein(@popover-border-color, 5%)",
|
||||
"@popover-arrow-outer-fallback-color": "darken(@popover-fallback-border-color, 20%)",
|
||||
"@label-default-bg": "@gray-light",
|
||||
"@label-primary-bg": "@brand-primary",
|
||||
"@label-success-bg": "@brand-success",
|
||||
"@label-info-bg": "@brand-info",
|
||||
"@label-warning-bg": "@brand-warning",
|
||||
"@label-danger-bg": "@brand-danger",
|
||||
"@label-color": "#fff",
|
||||
"@label-link-hover-color": "#fff",
|
||||
"@modal-inner-padding": "15px",
|
||||
"@modal-title-padding": "15px",
|
||||
"@modal-title-line-height": "@line-height-base",
|
||||
"@modal-content-bg": "#fff",
|
||||
"@modal-content-border-color": "rgba(0,0,0,.2)",
|
||||
"@modal-content-fallback-border-color": "#999",
|
||||
"@modal-backdrop-bg": "#000",
|
||||
"@modal-backdrop-opacity": ".5",
|
||||
"@modal-header-border-color": "#e5e5e5",
|
||||
"@modal-footer-border-color": "@modal-header-border-color",
|
||||
"@modal-lg": "900px",
|
||||
"@modal-md": "600px",
|
||||
"@modal-sm": "300px",
|
||||
"@alert-padding": "15px",
|
||||
"@alert-border-radius": "@border-radius-base",
|
||||
"@alert-link-font-weight": "bold",
|
||||
"@alert-success-bg": "@state-success-bg",
|
||||
"@alert-success-text": "@state-success-text",
|
||||
"@alert-success-border": "@state-success-border",
|
||||
"@alert-info-bg": "@state-info-bg",
|
||||
"@alert-info-text": "@state-info-text",
|
||||
"@alert-info-border": "@state-info-border",
|
||||
"@alert-warning-bg": "@state-warning-bg",
|
||||
"@alert-warning-text": "@state-warning-text",
|
||||
"@alert-warning-border": "@state-warning-border",
|
||||
"@alert-danger-bg": "@state-danger-bg",
|
||||
"@alert-danger-text": "@state-danger-text",
|
||||
"@alert-danger-border": "@state-danger-border",
|
||||
"@progress-bg": "#f5f5f5",
|
||||
"@progress-bar-color": "#fff",
|
||||
"@progress-border-radius": "@border-radius-base",
|
||||
"@progress-bar-bg": "@brand-primary",
|
||||
"@progress-bar-success-bg": "@brand-success",
|
||||
"@progress-bar-warning-bg": "@brand-warning",
|
||||
"@progress-bar-danger-bg": "@brand-danger",
|
||||
"@progress-bar-info-bg": "@brand-info",
|
||||
"@list-group-bg": "#fff",
|
||||
"@list-group-border": "#ddd",
|
||||
"@list-group-border-radius": "@border-radius-base",
|
||||
"@list-group-hover-bg": "#f5f5f5",
|
||||
"@list-group-active-color": "@component-active-color",
|
||||
"@list-group-active-bg": "@component-active-bg",
|
||||
"@list-group-active-border": "@list-group-active-bg",
|
||||
"@list-group-active-text-color": "lighten(@list-group-active-bg, 40%)",
|
||||
"@list-group-disabled-color": "@gray-light",
|
||||
"@list-group-disabled-bg": "@gray-lighter",
|
||||
"@list-group-disabled-text-color": "@list-group-disabled-color",
|
||||
"@list-group-link-color": "#555",
|
||||
"@list-group-link-hover-color": "@list-group-link-color",
|
||||
"@list-group-link-heading-color": "#333",
|
||||
"@panel-bg": "#fff",
|
||||
"@panel-body-padding": "15px",
|
||||
"@panel-heading-padding": "10px 15px",
|
||||
"@panel-footer-padding": "@panel-heading-padding",
|
||||
"@panel-border-radius": "@border-radius-base",
|
||||
"@panel-inner-border": "#ddd",
|
||||
"@panel-footer-bg": "#f5f5f5",
|
||||
"@panel-default-text": "@gray-dark",
|
||||
"@panel-default-border": "#ddd",
|
||||
"@panel-default-heading-bg": "#f5f5f5",
|
||||
"@panel-primary-text": "#fff",
|
||||
"@panel-primary-border": "@brand-primary",
|
||||
"@panel-primary-heading-bg": "@brand-primary",
|
||||
"@panel-success-text": "@state-success-text",
|
||||
"@panel-success-border": "@state-success-border",
|
||||
"@panel-success-heading-bg": "@state-success-bg",
|
||||
"@panel-info-text": "@state-info-text",
|
||||
"@panel-info-border": "@state-info-border",
|
||||
"@panel-info-heading-bg": "@state-info-bg",
|
||||
"@panel-warning-text": "@state-warning-text",
|
||||
"@panel-warning-border": "@state-warning-border",
|
||||
"@panel-warning-heading-bg": "@state-warning-bg",
|
||||
"@panel-danger-text": "@state-danger-text",
|
||||
"@panel-danger-border": "@state-danger-border",
|
||||
"@panel-danger-heading-bg": "@state-danger-bg",
|
||||
"@thumbnail-padding": "4px",
|
||||
"@thumbnail-bg": "@body-bg",
|
||||
"@thumbnail-border": "#ddd",
|
||||
"@thumbnail-border-radius": "@border-radius-base",
|
||||
"@thumbnail-caption-color": "@text-color",
|
||||
"@thumbnail-caption-padding": "9px",
|
||||
"@well-bg": "#f5f5f5",
|
||||
"@well-border": "darken(@well-bg, 7%)",
|
||||
"@badge-color": "#fff",
|
||||
"@badge-link-hover-color": "#fff",
|
||||
"@badge-bg": "@gray-light",
|
||||
"@badge-active-color": "@link-color",
|
||||
"@badge-active-bg": "#fff",
|
||||
"@badge-font-weight": "bold",
|
||||
"@badge-line-height": "1",
|
||||
"@badge-border-radius": "10px",
|
||||
"@breadcrumb-padding-vertical": "8px",
|
||||
"@breadcrumb-padding-horizontal": "15px",
|
||||
"@breadcrumb-bg": "#f5f5f5",
|
||||
"@breadcrumb-color": "#ccc",
|
||||
"@breadcrumb-active-color": "@gray-light",
|
||||
"@breadcrumb-separator": "\"/\"",
|
||||
"@carousel-text-shadow": "0 1px 2px rgba(0,0,0,.6)",
|
||||
"@carousel-control-color": "#fff",
|
||||
"@carousel-control-width": "15%",
|
||||
"@carousel-control-opacity": ".5",
|
||||
"@carousel-control-font-size": "20px",
|
||||
"@carousel-indicator-active-bg": "#fff",
|
||||
"@carousel-indicator-border-color": "#fff",
|
||||
"@carousel-caption-color": "#fff",
|
||||
"@close-font-weight": "bold",
|
||||
"@close-color": "#000",
|
||||
"@close-text-shadow": "0 1px 0 #fff",
|
||||
"@code-color": "#c7254e",
|
||||
"@code-bg": "#f9f2f4",
|
||||
"@kbd-color": "#fff",
|
||||
"@kbd-bg": "#333",
|
||||
"@pre-bg": "#f5f5f5",
|
||||
"@pre-color": "@gray-dark",
|
||||
"@pre-border-color": "#ccc",
|
||||
"@pre-scrollable-max-height": "340px",
|
||||
"@component-offset-horizontal": "180px",
|
||||
"@text-muted": "@gray-light",
|
||||
"@abbr-border-color": "@gray-light",
|
||||
"@headings-small-color": "@gray-light",
|
||||
"@blockquote-small-color": "@gray-light",
|
||||
"@blockquote-font-size": "(@font-size-base * 1.25)",
|
||||
"@blockquote-border-color": "@gray-lighter",
|
||||
"@page-header-border-color": "@gray-lighter",
|
||||
"@dl-horizontal-offset": "@component-offset-horizontal",
|
||||
"@dl-horizontal-breakpoint": "@grid-float-breakpoint",
|
||||
"@hr-border": "@gray-lighter"
|
||||
},
|
||||
"css": [
|
||||
"grid.less",
|
||||
"responsive-utilities.less"
|
||||
],
|
||||
"js": [],
|
||||
"customizerUrl": "http://getbootstrap.com/customize/?id=5d94a03518396aadcd15"
|
||||
}
|
8887
app/vendor/codemirror.js
vendored
Executable file
8887
app/vendor/codemirror.js
vendored
Executable file
File diff suppressed because it is too large
Load diff
2
app/vendor/datetimepicker.min.js
vendored
Normal file
2
app/vendor/datetimepicker.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
905
app/vendor/dragula.js
vendored
Normal file
905
app/vendor/dragula.js
vendored
Normal file
|
@ -0,0 +1,905 @@
|
|||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.dragula = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var cache = {};
|
||||
var start = '(?:^|\\s)';
|
||||
var end = '(?:\\s|$)';
|
||||
|
||||
function lookupClass (className) {
|
||||
var cached = cache[className];
|
||||
if (cached) {
|
||||
cached.lastIndex = 0;
|
||||
} else {
|
||||
cache[className] = cached = new RegExp(start + className + end, 'g');
|
||||
}
|
||||
return cached;
|
||||
}
|
||||
|
||||
function addClass (el, className) {
|
||||
var current = el.className;
|
||||
if (!current.length) {
|
||||
el.className = className;
|
||||
} else if (!lookupClass(className).test(current)) {
|
||||
el.className += ' ' + className;
|
||||
}
|
||||
}
|
||||
|
||||
function rmClass (el, className) {
|
||||
el.className = el.className.replace(lookupClass(className), ' ').trim();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
add: addClass,
|
||||
rm: rmClass
|
||||
};
|
||||
|
||||
},{}],2:[function(require,module,exports){
|
||||
(function (global){
|
||||
'use strict';
|
||||
|
||||
var emitter = require('contra/emitter');
|
||||
var crossvent = require('crossvent');
|
||||
var classes = require('./classes');
|
||||
var doc = document;
|
||||
var documentElement = doc.documentElement;
|
||||
|
||||
function dragula (initialContainers, options) {
|
||||
var len = arguments.length;
|
||||
if (len === 1 && Array.isArray(initialContainers) === false) {
|
||||
options = initialContainers;
|
||||
initialContainers = [];
|
||||
}
|
||||
var _mirror; // mirror image
|
||||
var _source; // source container
|
||||
var _item; // item being dragged
|
||||
var _offsetX; // reference x
|
||||
var _offsetY; // reference y
|
||||
var _moveX; // reference move x
|
||||
var _moveY; // reference move y
|
||||
var _initialSibling; // reference sibling when grabbed
|
||||
var _currentSibling; // reference sibling now
|
||||
var _copy; // item used for copying
|
||||
var _renderTimer; // timer for setTimeout renderMirrorImage
|
||||
var _lastDropTarget = null; // last container item was over
|
||||
var _grabbed; // holds mousedown context until first mousemove
|
||||
|
||||
var o = options || {};
|
||||
if (o.moves === void 0) { o.moves = always; }
|
||||
if (o.accepts === void 0) { o.accepts = always; }
|
||||
if (o.invalid === void 0) { o.invalid = invalidTarget; }
|
||||
if (o.containers === void 0) { o.containers = initialContainers || []; }
|
||||
if (o.isContainer === void 0) { o.isContainer = never; }
|
||||
if (o.copy === void 0) { o.copy = false; }
|
||||
if (o.copySortSource === void 0) { o.copySortSource = false; }
|
||||
if (o.revertOnSpill === void 0) { o.revertOnSpill = false; }
|
||||
if (o.removeOnSpill === void 0) { o.removeOnSpill = false; }
|
||||
if (o.direction === void 0) { o.direction = 'vertical'; }
|
||||
if (o.ignoreInputTextSelection === void 0) { o.ignoreInputTextSelection = true; }
|
||||
if (o.mirrorContainer === void 0) { o.mirrorContainer = doc.body; }
|
||||
|
||||
var drake = emitter({
|
||||
containers: o.containers,
|
||||
start: manualStart,
|
||||
end: end,
|
||||
cancel: cancel,
|
||||
remove: remove,
|
||||
destroy: destroy,
|
||||
canMove: canMove,
|
||||
dragging: false
|
||||
});
|
||||
|
||||
if (o.removeOnSpill === true) {
|
||||
drake.on('over', spillOver).on('out', spillOut);
|
||||
}
|
||||
|
||||
events();
|
||||
|
||||
return drake;
|
||||
|
||||
function isContainer (el) {
|
||||
return drake.containers.indexOf(el) !== -1 || o.isContainer(el);
|
||||
}
|
||||
|
||||
function events (remove) {
|
||||
var op = remove ? 'remove' : 'add';
|
||||
touchy(documentElement, op, 'mousedown', grab);
|
||||
touchy(documentElement, op, 'mouseup', release);
|
||||
}
|
||||
|
||||
function eventualMovements (remove) {
|
||||
var op = remove ? 'remove' : 'add';
|
||||
touchy(documentElement, op, 'mousemove', startBecauseMouseMoved);
|
||||
}
|
||||
|
||||
function movements (remove) {
|
||||
var op = remove ? 'remove' : 'add';
|
||||
crossvent[op](documentElement, 'selectstart', preventGrabbed); // IE8
|
||||
crossvent[op](documentElement, 'click', preventGrabbed);
|
||||
}
|
||||
|
||||
function destroy () {
|
||||
events(true);
|
||||
release({});
|
||||
}
|
||||
|
||||
function preventGrabbed (e) {
|
||||
if (_grabbed) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
function grab (e) {
|
||||
_moveX = e.clientX;
|
||||
_moveY = e.clientY;
|
||||
|
||||
var ignore = whichMouseButton(e) !== 1 || e.metaKey || e.ctrlKey;
|
||||
if (ignore) {
|
||||
return; // we only care about honest-to-god left clicks and touch events
|
||||
}
|
||||
var item = e.target;
|
||||
var context = canStart(item);
|
||||
if (!context) {
|
||||
return;
|
||||
}
|
||||
_grabbed = context;
|
||||
eventualMovements();
|
||||
if (e.type === 'mousedown') {
|
||||
if (isInput(item)) { // see also: https://github.com/bevacqua/dragula/issues/208
|
||||
item.focus(); // fixes https://github.com/bevacqua/dragula/issues/176
|
||||
} else {
|
||||
e.preventDefault(); // fixes https://github.com/bevacqua/dragula/issues/155
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function startBecauseMouseMoved (e) {
|
||||
if (!_grabbed) {
|
||||
return;
|
||||
}
|
||||
if (whichMouseButton(e) === 0) {
|
||||
release({});
|
||||
return; // when text is selected on an input and then dragged, mouseup doesn't fire. this is our only hope
|
||||
}
|
||||
// truthy check fixes #239, equality fixes #207
|
||||
if (e.clientX !== void 0 && e.clientX === _moveX && e.clientY !== void 0 && e.clientY === _moveY) {
|
||||
return;
|
||||
}
|
||||
if (o.ignoreInputTextSelection) {
|
||||
var clientX = getCoord('clientX', e);
|
||||
var clientY = getCoord('clientY', e);
|
||||
var elementBehindCursor = doc.elementFromPoint(clientX, clientY);
|
||||
if (isInput(elementBehindCursor)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var grabbed = _grabbed; // call to end() unsets _grabbed
|
||||
eventualMovements(true);
|
||||
movements();
|
||||
end();
|
||||
start(grabbed);
|
||||
|
||||
var offset = getOffset(_item);
|
||||
_offsetX = getCoord('pageX', e) - offset.left;
|
||||
_offsetY = getCoord('pageY', e) - offset.top;
|
||||
|
||||
classes.add(_copy || _item, 'gu-transit');
|
||||
renderMirrorImage();
|
||||
drag(e);
|
||||
}
|
||||
|
||||
function canStart (item) {
|
||||
if (drake.dragging && _mirror) {
|
||||
return;
|
||||
}
|
||||
if (isContainer(item)) {
|
||||
return; // don't drag container itself
|
||||
}
|
||||
var handle = item;
|
||||
while (getParent(item) && isContainer(getParent(item)) === false) {
|
||||
if (o.invalid(item, handle)) {
|
||||
return;
|
||||
}
|
||||
item = getParent(item); // drag target should be a top element
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
var source = getParent(item);
|
||||
if (!source) {
|
||||
return;
|
||||
}
|
||||
if (o.invalid(item, handle)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var movable = o.moves(item, source, handle, nextEl(item));
|
||||
if (!movable) {
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
item: item,
|
||||
source: source
|
||||
};
|
||||
}
|
||||
|
||||
function canMove (item) {
|
||||
return !!canStart(item);
|
||||
}
|
||||
|
||||
function manualStart (item) {
|
||||
var context = canStart(item);
|
||||
if (context) {
|
||||
start(context);
|
||||
}
|
||||
}
|
||||
|
||||
function start (context) {
|
||||
if (isCopy(context.item, context.source)) {
|
||||
_copy = context.item.cloneNode(true);
|
||||
drake.emit('cloned', _copy, context.item, 'copy');
|
||||
}
|
||||
|
||||
_source = context.source;
|
||||
_item = context.item;
|
||||
_initialSibling = _currentSibling = nextEl(context.item);
|
||||
|
||||
drake.dragging = true;
|
||||
drake.emit('drag', _item, _source);
|
||||
}
|
||||
|
||||
function invalidTarget () {
|
||||
return false;
|
||||
}
|
||||
|
||||
function end () {
|
||||
if (!drake.dragging) {
|
||||
return;
|
||||
}
|
||||
var item = _copy || _item;
|
||||
drop(item, getParent(item));
|
||||
}
|
||||
|
||||
function ungrab () {
|
||||
_grabbed = false;
|
||||
eventualMovements(true);
|
||||
movements(true);
|
||||
}
|
||||
|
||||
function release (e) {
|
||||
ungrab();
|
||||
|
||||
if (!drake.dragging) {
|
||||
return;
|
||||
}
|
||||
var item = _copy || _item;
|
||||
var clientX = getCoord('clientX', e);
|
||||
var clientY = getCoord('clientY', e);
|
||||
var elementBehindCursor = getElementBehindPoint(_mirror, clientX, clientY);
|
||||
var dropTarget = findDropTarget(elementBehindCursor, clientX, clientY);
|
||||
if (dropTarget && ((_copy && o.copySortSource) || (!_copy || dropTarget !== _source))) {
|
||||
drop(item, dropTarget);
|
||||
} else if (o.removeOnSpill) {
|
||||
remove();
|
||||
} else {
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
||||
function drop (item, target) {
|
||||
var parent = getParent(item);
|
||||
if (_copy && o.copySortSource && target === _source) {
|
||||
parent.removeChild(_item);
|
||||
}
|
||||
if (isInitialPlacement(target)) {
|
||||
drake.emit('cancel', item, _source, _source);
|
||||
} else {
|
||||
drake.emit('drop', item, target, _source, _currentSibling);
|
||||
}
|
||||
cleanup();
|
||||
}
|
||||
|
||||
function remove () {
|
||||
if (!drake.dragging) {
|
||||
return;
|
||||
}
|
||||
var item = _copy || _item;
|
||||
var parent = getParent(item);
|
||||
if (parent) {
|
||||
parent.removeChild(item);
|
||||
}
|
||||
drake.emit(_copy ? 'cancel' : 'remove', item, parent, _source);
|
||||
cleanup();
|
||||
}
|
||||
|
||||
function cancel (revert) {
|
||||
if (!drake.dragging) {
|
||||
return;
|
||||
}
|
||||
var reverts = arguments.length > 0 ? revert : o.revertOnSpill;
|
||||
var item = _copy || _item;
|
||||
var parent = getParent(item);
|
||||
var initial = isInitialPlacement(parent);
|
||||
if (initial === false && reverts) {
|
||||
if (_copy) {
|
||||
parent.removeChild(_copy);
|
||||
} else {
|
||||
_source.insertBefore(item, _initialSibling);
|
||||
}
|
||||
}
|
||||
if (initial || reverts) {
|
||||
drake.emit('cancel', item, _source, _source);
|
||||
} else {
|
||||
drake.emit('drop', item, parent, _source, _currentSibling);
|
||||
}
|
||||
cleanup();
|
||||
}
|
||||
|
||||
function cleanup () {
|
||||
var item = _copy || _item;
|
||||
ungrab();
|
||||
removeMirrorImage();
|
||||
if (item) {
|
||||
classes.rm(item, 'gu-transit');
|
||||
}
|
||||
if (_renderTimer) {
|
||||
clearTimeout(_renderTimer);
|
||||
}
|
||||
drake.dragging = false;
|
||||
if (_lastDropTarget) {
|
||||
drake.emit('out', item, _lastDropTarget, _source);
|
||||
}
|
||||
drake.emit('dragend', item);
|
||||
_source = _item = _copy = _initialSibling = _currentSibling = _renderTimer = _lastDropTarget = null;
|
||||
}
|
||||
|
||||
function isInitialPlacement (target, s) {
|
||||
var sibling;
|
||||
if (s !== void 0) {
|
||||
sibling = s;
|
||||
} else if (_mirror) {
|
||||
sibling = _currentSibling;
|
||||
} else {
|
||||
sibling = nextEl(_copy || _item);
|
||||
}
|
||||
return target === _source && sibling === _initialSibling;
|
||||
}
|
||||
|
||||
function findDropTarget (elementBehindCursor, clientX, clientY) {
|
||||
var target = elementBehindCursor;
|
||||
while (target && !accepted()) {
|
||||
target = getParent(target);
|
||||
}
|
||||
return target;
|
||||
|
||||
function accepted () {
|
||||
var droppable = isContainer(target);
|
||||
if (droppable === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var immediate = getImmediateChild(target, elementBehindCursor);
|
||||
var reference = getReference(target, immediate, clientX, clientY);
|
||||
var initial = isInitialPlacement(target, reference);
|
||||
if (initial) {
|
||||
return true; // should always be able to drop it right back where it was
|
||||
}
|
||||
return o.accepts(_item, target, _source, reference);
|
||||
}
|
||||
}
|
||||
|
||||
function drag (e) {
|
||||
if (!_mirror) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
|
||||
var clientX = getCoord('clientX', e);
|
||||
var clientY = getCoord('clientY', e);
|
||||
var x = clientX - _offsetX;
|
||||
var y = clientY - _offsetY;
|
||||
|
||||
_mirror.style.left = x + 'px';
|
||||
_mirror.style.top = y + 'px';
|
||||
|
||||
var item = _copy || _item;
|
||||
var elementBehindCursor = getElementBehindPoint(_mirror, clientX, clientY);
|
||||
var dropTarget = findDropTarget(elementBehindCursor, clientX, clientY);
|
||||
var changed = dropTarget !== null && dropTarget !== _lastDropTarget;
|
||||
if (changed || dropTarget === null) {
|
||||
out();
|
||||
_lastDropTarget = dropTarget;
|
||||
over();
|
||||
}
|
||||
var parent = getParent(item);
|
||||
if (dropTarget === _source && _copy && !o.copySortSource) {
|
||||
if (parent) {
|
||||
parent.removeChild(item);
|
||||
}
|
||||
return;
|
||||
}
|
||||
var reference;
|
||||
var immediate = getImmediateChild(dropTarget, elementBehindCursor);
|
||||
if (immediate !== null) {
|
||||
reference = getReference(dropTarget, immediate, clientX, clientY);
|
||||
} else if (o.revertOnSpill === true && !_copy) {
|
||||
reference = _initialSibling;
|
||||
dropTarget = _source;
|
||||
} else {
|
||||
if (_copy && parent) {
|
||||
parent.removeChild(item);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (
|
||||
(reference === null && changed) ||
|
||||
reference !== item &&
|
||||
reference !== nextEl(item)
|
||||
) {
|
||||
_currentSibling = reference;
|
||||
dropTarget.insertBefore(item, reference);
|
||||
drake.emit('shadow', item, dropTarget, _source);
|
||||
}
|
||||
function moved (type) { drake.emit(type, item, _lastDropTarget, _source); }
|
||||
function over () { if (changed) { moved('over'); } }
|
||||
function out () { if (_lastDropTarget) { moved('out'); } }
|
||||
}
|
||||
|
||||
function spillOver (el) {
|
||||
classes.rm(el, 'gu-hide');
|
||||
}
|
||||
|
||||
function spillOut (el) {
|
||||
if (drake.dragging) { classes.add(el, 'gu-hide'); }
|
||||
}
|
||||
|
||||
function renderMirrorImage () {
|
||||
if (_mirror) {
|
||||
return;
|
||||
}
|
||||
var rect = _item.getBoundingClientRect();
|
||||
_mirror = _item.cloneNode(true);
|
||||
_mirror.style.width = getRectWidth(rect) + 'px';
|
||||
_mirror.style.height = getRectHeight(rect) + 'px';
|
||||
classes.rm(_mirror, 'gu-transit');
|
||||
classes.add(_mirror, 'gu-mirror');
|
||||
o.mirrorContainer.appendChild(_mirror);
|
||||
touchy(documentElement, 'add', 'mousemove', drag);
|
||||
classes.add(o.mirrorContainer, 'gu-unselectable');
|
||||
drake.emit('cloned', _mirror, _item, 'mirror');
|
||||
}
|
||||
|
||||
function removeMirrorImage () {
|
||||
if (_mirror) {
|
||||
classes.rm(o.mirrorContainer, 'gu-unselectable');
|
||||
touchy(documentElement, 'remove', 'mousemove', drag);
|
||||
getParent(_mirror).removeChild(_mirror);
|
||||
_mirror = null;
|
||||
}
|
||||
}
|
||||
|
||||
function getImmediateChild (dropTarget, target) {
|
||||
var immediate = target;
|
||||
while (immediate !== dropTarget && getParent(immediate) !== dropTarget) {
|
||||
immediate = getParent(immediate);
|
||||
}
|
||||
if (immediate === documentElement) {
|
||||
return null;
|
||||
}
|
||||
return immediate;
|
||||
}
|
||||
|
||||
function getReference (dropTarget, target, x, y) {
|
||||
var horizontal = o.direction === 'horizontal';
|
||||
var reference = target !== dropTarget ? inside() : outside();
|
||||
return reference;
|
||||
|
||||
function outside () { // slower, but able to figure out any position
|
||||
var len = dropTarget.children.length;
|
||||
var i;
|
||||
var el;
|
||||
var rect;
|
||||
for (i = 0; i < len; i++) {
|
||||
el = dropTarget.children[i];
|
||||
rect = el.getBoundingClientRect();
|
||||
if (horizontal && (rect.left + rect.width / 2) > x) { return el; }
|
||||
if (!horizontal && (rect.top + rect.height / 2) > y) { return el; }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function inside () { // faster, but only available if dropped inside a child element
|
||||
var rect = target.getBoundingClientRect();
|
||||
if (horizontal) {
|
||||
return resolve(x > rect.left + getRectWidth(rect) / 2);
|
||||
}
|
||||
return resolve(y > rect.top + getRectHeight(rect) / 2);
|
||||
}
|
||||
|
||||
function resolve (after) {
|
||||
return after ? nextEl(target) : target;
|
||||
}
|
||||
}
|
||||
|
||||
function isCopy (item, container) {
|
||||
return typeof o.copy === 'boolean' ? o.copy : o.copy(item, container);
|
||||
}
|
||||
}
|
||||
|
||||
function touchy (el, op, type, fn) {
|
||||
var touch = {
|
||||
mouseup: 'touchend',
|
||||
mousedown: 'touchstart',
|
||||
mousemove: 'touchmove'
|
||||
};
|
||||
var pointers = {
|
||||
mouseup: 'pointerup',
|
||||
mousedown: 'pointerdown',
|
||||
mousemove: 'pointermove'
|
||||
};
|
||||
var microsoft = {
|
||||
mouseup: 'MSPointerUp',
|
||||
mousedown: 'MSPointerDown',
|
||||
mousemove: 'MSPointerMove'
|
||||
};
|
||||
if (global.navigator.pointerEnabled) {
|
||||
crossvent[op](el, pointers[type], fn);
|
||||
} else if (global.navigator.msPointerEnabled) {
|
||||
crossvent[op](el, microsoft[type], fn);
|
||||
} else {
|
||||
crossvent[op](el, touch[type], fn);
|
||||
crossvent[op](el, type, fn);
|
||||
}
|
||||
}
|
||||
|
||||
function whichMouseButton (e) {
|
||||
if (e.touches !== void 0) { return e.touches.length; }
|
||||
if (e.which !== void 0 && e.which !== 0) { return e.which; } // see https://github.com/bevacqua/dragula/issues/261
|
||||
if (e.buttons !== void 0) { return e.buttons; }
|
||||
var button = e.button;
|
||||
if (button !== void 0) { // see https://github.com/jquery/jquery/blob/99e8ff1baa7ae341e94bb89c3e84570c7c3ad9ea/src/event.js#L573-L575
|
||||
return button & 1 ? 1 : button & 2 ? 3 : (button & 4 ? 2 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
function getOffset (el) {
|
||||
var rect = el.getBoundingClientRect();
|
||||
return {
|
||||
left: rect.left + getScroll('scrollLeft', 'pageXOffset'),
|
||||
top: rect.top + getScroll('scrollTop', 'pageYOffset')
|
||||
};
|
||||
}
|
||||
|
||||
function getScroll (scrollProp, offsetProp) {
|
||||
if (typeof global[offsetProp] !== 'undefined') {
|
||||
return global[offsetProp];
|
||||
}
|
||||
if (documentElement.clientHeight) {
|
||||
return documentElement[scrollProp];
|
||||
}
|
||||
return doc.body[scrollProp];
|
||||
}
|
||||
|
||||
function getElementBehindPoint (point, x, y) {
|
||||
var p = point || {};
|
||||
var state = p.className;
|
||||
var el;
|
||||
p.className += ' gu-hide';
|
||||
el = doc.elementFromPoint(x, y);
|
||||
p.className = state;
|
||||
return el;
|
||||
}
|
||||
|
||||
function never () { return false; }
|
||||
function always () { return true; }
|
||||
function getRectWidth (rect) { return rect.width || (rect.right - rect.left); }
|
||||
function getRectHeight (rect) { return rect.height || (rect.bottom - rect.top); }
|
||||
function getParent (el) { return el.parentNode === doc ? null : el.parentNode; }
|
||||
function isInput (el) { return el.tagName === 'INPUT' || el.tagName === 'TEXTAREA' || el.tagName === 'SELECT' || isEditable(el); }
|
||||
function isEditable (el) {
|
||||
if (!el) { return false; } // no parents were editable
|
||||
if (el.contentEditable === 'false') { return false; } // stop the lookup
|
||||
if (el.contentEditable === 'true') { return true; } // found a contentEditable element in the chain
|
||||
return isEditable(getParent(el)); // contentEditable is set to 'inherit'
|
||||
}
|
||||
|
||||
function nextEl (el) {
|
||||
return el.nextElementSibling || manually();
|
||||
function manually () {
|
||||
var sibling = el;
|
||||
do {
|
||||
sibling = sibling.nextSibling;
|
||||
} while (sibling && sibling.nodeType !== 1);
|
||||
return sibling;
|
||||
}
|
||||
}
|
||||
|
||||
function getEventHost (e) {
|
||||
// on touchend event, we have to use `e.changedTouches`
|
||||
// see http://stackoverflow.com/questions/7192563/touchend-event-properties
|
||||
// see https://github.com/bevacqua/dragula/issues/34
|
||||
if (e.targetTouches && e.targetTouches.length) {
|
||||
return e.targetTouches[0];
|
||||
}
|
||||
if (e.changedTouches && e.changedTouches.length) {
|
||||
return e.changedTouches[0];
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
function getCoord (coord, e) {
|
||||
var host = getEventHost(e);
|
||||
var missMap = {
|
||||
pageX: 'clientX', // IE8
|
||||
pageY: 'clientY' // IE8
|
||||
};
|
||||
if (coord in missMap && !(coord in host) && missMap[coord] in host) {
|
||||
coord = missMap[coord];
|
||||
}
|
||||
return host[coord];
|
||||
}
|
||||
|
||||
module.exports = dragula;
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
|
||||
},{"./classes":1,"contra/emitter":4,"crossvent":8}],3:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var ticky = require('ticky');
|
||||
|
||||
module.exports = function debounce (fn, args, ctx) {
|
||||
if (!fn) { return; }
|
||||
ticky(function run () {
|
||||
fn.apply(ctx || null, args || []);
|
||||
});
|
||||
};
|
||||
|
||||
},{"ticky":6}],4:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var atoa = require('atoa');
|
||||
var debounce = require('./debounce');
|
||||
|
||||
module.exports = function emitter (thing, options) {
|
||||
var opts = options || {};
|
||||
var evt = {};
|
||||
if (thing === undefined) { thing = {}; }
|
||||
thing.on = function (type, fn) {
|
||||
if (!evt[type]) {
|
||||
evt[type] = [fn];
|
||||
} else {
|
||||
evt[type].push(fn);
|
||||
}
|
||||
return thing;
|
||||
};
|
||||
thing.once = function (type, fn) {
|
||||
fn._once = true; // thing.off(fn) still works!
|
||||
thing.on(type, fn);
|
||||
return thing;
|
||||
};
|
||||
thing.off = function (type, fn) {
|
||||
var c = arguments.length;
|
||||
if (c === 1) {
|
||||
delete evt[type];
|
||||
} else if (c === 0) {
|
||||
evt = {};
|
||||
} else {
|
||||
var et = evt[type];
|
||||
if (!et) { return thing; }
|
||||
et.splice(et.indexOf(fn), 1);
|
||||
}
|
||||
return thing;
|
||||
};
|
||||
thing.emit = function () {
|
||||
var args = atoa(arguments);
|
||||
return thing.emitterSnapshot(args.shift()).apply(this, args);
|
||||
};
|
||||
thing.emitterSnapshot = function (type) {
|
||||
var et = (evt[type] || []).slice(0);
|
||||
return function () {
|
||||
var args = atoa(arguments);
|
||||
var ctx = this || thing;
|
||||
if (type === 'error' && opts.throws !== false && !et.length) { throw args.length === 1 ? args[0] : args; }
|
||||
et.forEach(function emitter (listen) {
|
||||
if (opts.async) { debounce(listen, args, ctx); } else { listen.apply(ctx, args); }
|
||||
if (listen._once) { thing.off(type, listen); }
|
||||
});
|
||||
return thing;
|
||||
};
|
||||
};
|
||||
return thing;
|
||||
};
|
||||
|
||||
},{"./debounce":3,"atoa":5}],5:[function(require,module,exports){
|
||||
module.exports = function atoa (a, n) { return Array.prototype.slice.call(a, n); }
|
||||
|
||||
},{}],6:[function(require,module,exports){
|
||||
var si = typeof setImmediate === 'function', tick;
|
||||
if (si) {
|
||||
tick = function (fn) { setImmediate(fn); };
|
||||
} else {
|
||||
tick = function (fn) { setTimeout(fn, 0); };
|
||||
}
|
||||
|
||||
module.exports = tick;
|
||||
},{}],7:[function(require,module,exports){
|
||||
(function (global){
|
||||
|
||||
var NativeCustomEvent = global.CustomEvent;
|
||||
|
||||
function useNative () {
|
||||
try {
|
||||
var p = new NativeCustomEvent('cat', { detail: { foo: 'bar' } });
|
||||
return 'cat' === p.type && 'bar' === p.detail.foo;
|
||||
} catch (e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cross-browser `CustomEvent` constructor.
|
||||
*
|
||||
* https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent.CustomEvent
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = useNative() ? NativeCustomEvent :
|
||||
|
||||
// IE >= 9
|
||||
'function' === typeof document.createEvent ? function CustomEvent (type, params) {
|
||||
var e = document.createEvent('CustomEvent');
|
||||
if (params) {
|
||||
e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail);
|
||||
} else {
|
||||
e.initCustomEvent(type, false, false, void 0);
|
||||
}
|
||||
return e;
|
||||
} :
|
||||
|
||||
// IE <= 8
|
||||
function CustomEvent (type, params) {
|
||||
var e = document.createEventObject();
|
||||
e.type = type;
|
||||
if (params) {
|
||||
e.bubbles = Boolean(params.bubbles);
|
||||
e.cancelable = Boolean(params.cancelable);
|
||||
e.detail = params.detail;
|
||||
} else {
|
||||
e.bubbles = false;
|
||||
e.cancelable = false;
|
||||
e.detail = void 0;
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
|
||||
},{}],8:[function(require,module,exports){
|
||||
(function (global){
|
||||
'use strict';
|
||||
|
||||
var customEvent = require('custom-event');
|
||||
var eventmap = require('./eventmap');
|
||||
var doc = global.document;
|
||||
var addEvent = addEventEasy;
|
||||
var removeEvent = removeEventEasy;
|
||||
var hardCache = [];
|
||||
|
||||
if (!global.addEventListener) {
|
||||
addEvent = addEventHard;
|
||||
removeEvent = removeEventHard;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
add: addEvent,
|
||||
remove: removeEvent,
|
||||
fabricate: fabricateEvent
|
||||
};
|
||||
|
||||
function addEventEasy (el, type, fn, capturing) {
|
||||
return el.addEventListener(type, fn, capturing);
|
||||
}
|
||||
|
||||
function addEventHard (el, type, fn) {
|
||||
return el.attachEvent('on' + type, wrap(el, type, fn));
|
||||
}
|
||||
|
||||
function removeEventEasy (el, type, fn, capturing) {
|
||||
return el.removeEventListener(type, fn, capturing);
|
||||
}
|
||||
|
||||
function removeEventHard (el, type, fn) {
|
||||
var listener = unwrap(el, type, fn);
|
||||
if (listener) {
|
||||
return el.detachEvent('on' + type, listener);
|
||||
}
|
||||
}
|
||||
|
||||
function fabricateEvent (el, type, model) {
|
||||
var e = eventmap.indexOf(type) === -1 ? makeCustomEvent() : makeClassicEvent();
|
||||
if (el.dispatchEvent) {
|
||||
el.dispatchEvent(e);
|
||||
} else {
|
||||
el.fireEvent('on' + type, e);
|
||||
}
|
||||
function makeClassicEvent () {
|
||||
var e;
|
||||
if (doc.createEvent) {
|
||||
e = doc.createEvent('Event');
|
||||
e.initEvent(type, true, true);
|
||||
} else if (doc.createEventObject) {
|
||||
e = doc.createEventObject();
|
||||
}
|
||||
return e;
|
||||
}
|
||||
function makeCustomEvent () {
|
||||
return new customEvent(type, { detail: model });
|
||||
}
|
||||
}
|
||||
|
||||
function wrapperFactory (el, type, fn) {
|
||||
return function wrapper (originalEvent) {
|
||||
var e = originalEvent || global.event;
|
||||
e.target = e.target || e.srcElement;
|
||||
e.preventDefault = e.preventDefault || function preventDefault () { e.returnValue = false; };
|
||||
e.stopPropagation = e.stopPropagation || function stopPropagation () { e.cancelBubble = true; };
|
||||
e.which = e.which || e.keyCode;
|
||||
fn.call(el, e);
|
||||
};
|
||||
}
|
||||
|
||||
function wrap (el, type, fn) {
|
||||
var wrapper = unwrap(el, type, fn) || wrapperFactory(el, type, fn);
|
||||
hardCache.push({
|
||||
wrapper: wrapper,
|
||||
element: el,
|
||||
type: type,
|
||||
fn: fn
|
||||
});
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
function unwrap (el, type, fn) {
|
||||
var i = find(el, type, fn);
|
||||
if (i) {
|
||||
var wrapper = hardCache[i].wrapper;
|
||||
hardCache.splice(i, 1); // free up a tad of memory
|
||||
return wrapper;
|
||||
}
|
||||
}
|
||||
|
||||
function find (el, type, fn) {
|
||||
var i, item;
|
||||
for (i = 0; i < hardCache.length; i++) {
|
||||
item = hardCache[i];
|
||||
if (item.element === el && item.type === type && item.fn === fn) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
|
||||
},{"./eventmap":9,"custom-event":7}],9:[function(require,module,exports){
|
||||
(function (global){
|
||||
'use strict';
|
||||
|
||||
var eventmap = [];
|
||||
var eventname = '';
|
||||
var ron = /^on/;
|
||||
|
||||
for (eventname in global) {
|
||||
if (ron.test(eventname)) {
|
||||
eventmap.push(eventname.slice(2));
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = eventmap;
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
|
||||
},{}]},{},[2])(2)
|
||||
});
|
561
app/vendor/drop.js
vendored
Normal file
561
app/vendor/drop.js
vendored
Normal file
|
@ -0,0 +1,561 @@
|
|||
// https://github.com/HubSpot/drop
|
||||
/*! tether-drop 1.4.1 */
|
||||
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(["tether"], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
module.exports = factory(require('tether'));
|
||||
} else {
|
||||
root.Drop = factory(root.Tether);
|
||||
}
|
||||
}(this, function(Tether) {
|
||||
|
||||
/* global Tether */
|
||||
'use strict';
|
||||
|
||||
var _bind = Function.prototype.bind;
|
||||
|
||||
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
var _get = function get(_x2, _x3, _x4) { var _again = true; _function: while (_again) { var object = _x2, property = _x3, receiver = _x4; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x2 = parent; _x3 = property; _x4 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var _Tether$Utils = Tether.Utils;
|
||||
var extend = _Tether$Utils.extend;
|
||||
var addClass = _Tether$Utils.addClass;
|
||||
var removeClass = _Tether$Utils.removeClass;
|
||||
var hasClass = _Tether$Utils.hasClass;
|
||||
var Evented = _Tether$Utils.Evented;
|
||||
|
||||
function sortAttach(str) {
|
||||
var _str$split = str.split(' ');
|
||||
|
||||
var _str$split2 = _slicedToArray(_str$split, 2);
|
||||
|
||||
var first = _str$split2[0];
|
||||
var second = _str$split2[1];
|
||||
|
||||
if (['left', 'right'].indexOf(first) >= 0) {
|
||||
var _ref = [second, first];
|
||||
first = _ref[0];
|
||||
second = _ref[1];
|
||||
}
|
||||
return [first, second].join(' ');
|
||||
}
|
||||
|
||||
function removeFromArray(arr, item) {
|
||||
var index = undefined;
|
||||
var results = [];
|
||||
while ((index = arr.indexOf(item)) !== -1) {
|
||||
results.push(arr.splice(index, 1));
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
var clickEvents = ['click'];
|
||||
if ('ontouchstart' in document.documentElement) {
|
||||
clickEvents.push('touchstart');
|
||||
}
|
||||
|
||||
var transitionEndEvents = {
|
||||
'WebkitTransition': 'webkitTransitionEnd',
|
||||
'MozTransition': 'transitionend',
|
||||
'OTransition': 'otransitionend',
|
||||
'transition': 'transitionend'
|
||||
};
|
||||
|
||||
var transitionEndEvent = '';
|
||||
for (var _name in transitionEndEvents) {
|
||||
if (({}).hasOwnProperty.call(transitionEndEvents, _name)) {
|
||||
var tempEl = document.createElement('p');
|
||||
if (typeof tempEl.style[_name] !== 'undefined') {
|
||||
transitionEndEvent = transitionEndEvents[_name];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var MIRROR_ATTACH = {
|
||||
left: 'right',
|
||||
right: 'left',
|
||||
top: 'bottom',
|
||||
bottom: 'top',
|
||||
middle: 'middle',
|
||||
center: 'center'
|
||||
};
|
||||
|
||||
var allDrops = {};
|
||||
|
||||
// Drop can be included in external libraries. Calling createContext gives you a fresh
|
||||
// copy of drop which won't interact with other copies on the page (beyond calling the document events).
|
||||
|
||||
function createContext() {
|
||||
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
||||
|
||||
var drop = function drop() {
|
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return new (_bind.apply(DropInstance, [null].concat(args)))();
|
||||
};
|
||||
|
||||
extend(drop, {
|
||||
createContext: createContext,
|
||||
drops: [],
|
||||
defaults: {}
|
||||
});
|
||||
|
||||
var defaultOptions = {
|
||||
classPrefix: 'drop',
|
||||
defaults: {
|
||||
position: 'bottom left',
|
||||
openOn: 'click',
|
||||
beforeClose: null,
|
||||
constrainToScrollParent: true,
|
||||
constrainToWindow: true,
|
||||
classes: '',
|
||||
remove: false,
|
||||
openDelay: 0,
|
||||
closeDelay: 50,
|
||||
// inherited from openDelay and closeDelay if not explicitly defined
|
||||
focusDelay: null,
|
||||
blurDelay: null,
|
||||
hoverOpenDelay: null,
|
||||
hoverCloseDelay: null,
|
||||
tetherOptions: {}
|
||||
}
|
||||
};
|
||||
|
||||
extend(drop, defaultOptions, options);
|
||||
extend(drop.defaults, defaultOptions.defaults, options.defaults);
|
||||
|
||||
if (typeof allDrops[drop.classPrefix] === 'undefined') {
|
||||
allDrops[drop.classPrefix] = [];
|
||||
}
|
||||
|
||||
drop.updateBodyClasses = function () {
|
||||
// There is only one body, so despite the context concept, we still iterate through all
|
||||
// drops which share our classPrefix.
|
||||
|
||||
var anyOpen = false;
|
||||
var drops = allDrops[drop.classPrefix];
|
||||
var len = drops.length;
|
||||
for (var i = 0; i < len; ++i) {
|
||||
if (drops[i].isOpened()) {
|
||||
anyOpen = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (anyOpen) {
|
||||
addClass(document.body, drop.classPrefix + '-open');
|
||||
} else {
|
||||
removeClass(document.body, drop.classPrefix + '-open');
|
||||
}
|
||||
};
|
||||
|
||||
var DropInstance = (function (_Evented) {
|
||||
_inherits(DropInstance, _Evented);
|
||||
|
||||
function DropInstance(opts) {
|
||||
_classCallCheck(this, DropInstance);
|
||||
|
||||
_get(Object.getPrototypeOf(DropInstance.prototype), 'constructor', this).call(this);
|
||||
this.options = extend({}, drop.defaults, opts);
|
||||
this.target = this.options.target;
|
||||
|
||||
if (typeof this.target === 'undefined') {
|
||||
throw new Error('Drop Error: You must provide a target.');
|
||||
}
|
||||
|
||||
var dataPrefix = 'data-' + drop.classPrefix;
|
||||
|
||||
var contentAttr = this.target.getAttribute(dataPrefix);
|
||||
if (contentAttr && this.options.content == null) {
|
||||
this.options.content = contentAttr;
|
||||
}
|
||||
|
||||
var attrsOverride = ['position', 'openOn'];
|
||||
for (var i = 0; i < attrsOverride.length; ++i) {
|
||||
|
||||
var override = this.target.getAttribute(dataPrefix + '-' + attrsOverride[i]);
|
||||
if (override && this.options[attrsOverride[i]] == null) {
|
||||
this.options[attrsOverride[i]] = override;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.options.classes && this.options.addTargetClasses !== false) {
|
||||
addClass(this.target, this.options.classes);
|
||||
}
|
||||
|
||||
drop.drops.push(this);
|
||||
allDrops[drop.classPrefix].push(this);
|
||||
|
||||
this._boundEvents = [];
|
||||
this.bindMethods();
|
||||
this.setupElements();
|
||||
this.setupEvents();
|
||||
this.setupTether();
|
||||
}
|
||||
|
||||
_createClass(DropInstance, [{
|
||||
key: '_on',
|
||||
value: function _on(element, event, handler) {
|
||||
this._boundEvents.push({ element: element, event: event, handler: handler });
|
||||
element.addEventListener(event, handler);
|
||||
}
|
||||
}, {
|
||||
key: 'bindMethods',
|
||||
value: function bindMethods() {
|
||||
this.transitionEndHandler = this._transitionEndHandler.bind(this);
|
||||
}
|
||||
}, {
|
||||
key: 'setupElements',
|
||||
value: function setupElements() {
|
||||
var _this = this;
|
||||
|
||||
this.drop = document.createElement('div');
|
||||
addClass(this.drop, drop.classPrefix);
|
||||
|
||||
if (this.options.classes) {
|
||||
addClass(this.drop, this.options.classes);
|
||||
}
|
||||
|
||||
this.content = document.createElement('div');
|
||||
addClass(this.content, drop.classPrefix + '-content');
|
||||
|
||||
if (typeof this.options.content === 'function') {
|
||||
var generateAndSetContent = function generateAndSetContent() {
|
||||
// content function might return a string or an element
|
||||
var contentElementOrHTML = _this.options.content.call(_this, _this);
|
||||
|
||||
if (typeof contentElementOrHTML === 'string') {
|
||||
_this.content.innerHTML = contentElementOrHTML;
|
||||
} else if (typeof contentElementOrHTML === 'object') {
|
||||
_this.content.innerHTML = '';
|
||||
_this.content.appendChild(contentElementOrHTML);
|
||||
} else {
|
||||
throw new Error('Drop Error: Content function should return a string or HTMLElement.');
|
||||
}
|
||||
};
|
||||
|
||||
generateAndSetContent();
|
||||
this.on('open', generateAndSetContent.bind(this));
|
||||
} else if (typeof this.options.content === 'object') {
|
||||
this.content.appendChild(this.options.content);
|
||||
} else {
|
||||
this.content.innerHTML = this.options.content;
|
||||
}
|
||||
|
||||
this.drop.appendChild(this.content);
|
||||
}
|
||||
}, {
|
||||
key: 'setupTether',
|
||||
value: function setupTether() {
|
||||
// Tether expects two attachment points, one in the target element, one in the
|
||||
// drop. We use a single one, and use the order as well, to allow us to put
|
||||
// the drop on either side of any of the four corners. This magic converts between
|
||||
// the two:
|
||||
var dropAttach = this.options.position.split(' ');
|
||||
dropAttach[0] = MIRROR_ATTACH[dropAttach[0]];
|
||||
dropAttach = dropAttach.join(' ');
|
||||
|
||||
var constraints = [];
|
||||
if (this.options.constrainToScrollParent) {
|
||||
constraints.push({
|
||||
to: 'scrollParent',
|
||||
pin: 'top, bottom',
|
||||
attachment: 'together none'
|
||||
});
|
||||
} else {
|
||||
// To get 'out of bounds' classes
|
||||
constraints.push({
|
||||
to: 'scrollParent'
|
||||
});
|
||||
}
|
||||
|
||||
if (this.options.constrainToWindow !== false) {
|
||||
constraints.push({
|
||||
to: 'window',
|
||||
attachment: 'together'
|
||||
});
|
||||
} else {
|
||||
// To get 'out of bounds' classes
|
||||
constraints.push({
|
||||
to: 'window'
|
||||
});
|
||||
}
|
||||
|
||||
var opts = {
|
||||
element: this.drop,
|
||||
target: this.target,
|
||||
attachment: sortAttach(dropAttach),
|
||||
targetAttachment: sortAttach(this.options.position),
|
||||
classPrefix: drop.classPrefix,
|
||||
offset: '0 0',
|
||||
targetOffset: '0 0',
|
||||
enabled: false,
|
||||
constraints: constraints,
|
||||
addTargetClasses: this.options.addTargetClasses
|
||||
};
|
||||
|
||||
if (this.options.tetherOptions !== false) {
|
||||
this.tether = new Tether(extend({}, opts, this.options.tetherOptions));
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'setupEvents',
|
||||
value: function setupEvents() {
|
||||
var _this2 = this;
|
||||
|
||||
if (!this.options.openOn) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.options.openOn === 'always') {
|
||||
setTimeout(this.open.bind(this));
|
||||
return;
|
||||
}
|
||||
|
||||
var events = this.options.openOn.split(' ');
|
||||
|
||||
if (events.indexOf('click') >= 0) {
|
||||
var openHandler = function openHandler(event) {
|
||||
_this2.toggle(event);
|
||||
event.preventDefault();
|
||||
};
|
||||
|
||||
var closeHandler = function closeHandler(event) {
|
||||
if (!_this2.isOpened()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clicking inside dropdown
|
||||
if (event.target === _this2.drop || _this2.drop.contains(event.target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clicking target
|
||||
if (event.target === _this2.target || _this2.target.contains(event.target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
_this2.close(event);
|
||||
};
|
||||
|
||||
for (var i = 0; i < clickEvents.length; ++i) {
|
||||
var clickEvent = clickEvents[i];
|
||||
this._on(this.target, clickEvent, openHandler);
|
||||
this._on(document, clickEvent, closeHandler);
|
||||
}
|
||||
}
|
||||
|
||||
var inTimeout = null;
|
||||
var outTimeout = null;
|
||||
|
||||
var inHandler = function inHandler(event) {
|
||||
if (outTimeout !== null) {
|
||||
clearTimeout(outTimeout);
|
||||
} else {
|
||||
inTimeout = setTimeout(function () {
|
||||
_this2.open(event);
|
||||
inTimeout = null;
|
||||
}, (event.type === 'focus' ? _this2.options.focusDelay : _this2.options.hoverOpenDelay) || _this2.options.openDelay);
|
||||
}
|
||||
};
|
||||
|
||||
var outHandler = function outHandler(event) {
|
||||
if (inTimeout !== null) {
|
||||
clearTimeout(inTimeout);
|
||||
} else {
|
||||
outTimeout = setTimeout(function () {
|
||||
_this2.close(event);
|
||||
outTimeout = null;
|
||||
}, (event.type === 'blur' ? _this2.options.blurDelay : _this2.options.hoverCloseDelay) || _this2.options.closeDelay);
|
||||
}
|
||||
};
|
||||
|
||||
if (events.indexOf('hover') >= 0) {
|
||||
this._on(this.target, 'mouseover', inHandler);
|
||||
this._on(this.drop, 'mouseover', inHandler);
|
||||
this._on(this.target, 'mouseout', outHandler);
|
||||
this._on(this.drop, 'mouseout', outHandler);
|
||||
}
|
||||
|
||||
if (events.indexOf('focus') >= 0) {
|
||||
this._on(this.target, 'focus', inHandler);
|
||||
this._on(this.drop, 'focus', inHandler);
|
||||
this._on(this.target, 'blur', outHandler);
|
||||
this._on(this.drop, 'blur', outHandler);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'isOpened',
|
||||
value: function isOpened() {
|
||||
if (this.drop) {
|
||||
return hasClass(this.drop, drop.classPrefix + '-open');
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'toggle',
|
||||
value: function toggle(event) {
|
||||
if (this.isOpened()) {
|
||||
this.close(event);
|
||||
} else {
|
||||
this.open(event);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'open',
|
||||
value: function open(event) {
|
||||
var _this3 = this;
|
||||
|
||||
/* eslint no-unused-vars: 0 */
|
||||
if (this.isOpened()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.drop.parentNode) {
|
||||
document.body.appendChild(this.drop);
|
||||
}
|
||||
|
||||
if (typeof this.tether !== 'undefined') {
|
||||
this.tether.enable();
|
||||
}
|
||||
|
||||
addClass(this.drop, drop.classPrefix + '-open');
|
||||
addClass(this.drop, drop.classPrefix + '-open-transitionend');
|
||||
|
||||
setTimeout(function () {
|
||||
if (_this3.drop) {
|
||||
addClass(_this3.drop, drop.classPrefix + '-after-open');
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof this.tether !== 'undefined') {
|
||||
this.tether.position();
|
||||
}
|
||||
|
||||
this.trigger('open');
|
||||
|
||||
drop.updateBodyClasses();
|
||||
}
|
||||
}, {
|
||||
key: '_transitionEndHandler',
|
||||
value: function _transitionEndHandler(e) {
|
||||
if (e.target !== e.currentTarget) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hasClass(this.drop, drop.classPrefix + '-open')) {
|
||||
removeClass(this.drop, drop.classPrefix + '-open-transitionend');
|
||||
}
|
||||
this.drop.removeEventListener(transitionEndEvent, this.transitionEndHandler);
|
||||
}
|
||||
}, {
|
||||
key: 'beforeCloseHandler',
|
||||
value: function beforeCloseHandler(event) {
|
||||
var shouldClose = true;
|
||||
|
||||
if (!this.isClosing && typeof this.options.beforeClose === 'function') {
|
||||
this.isClosing = true;
|
||||
shouldClose = this.options.beforeClose(event, this) !== false;
|
||||
}
|
||||
|
||||
this.isClosing = false;
|
||||
|
||||
return shouldClose;
|
||||
}
|
||||
}, {
|
||||
key: 'close',
|
||||
value: function close(event) {
|
||||
if (!this.isOpened()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.beforeCloseHandler(event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
removeClass(this.drop, drop.classPrefix + '-open');
|
||||
removeClass(this.drop, drop.classPrefix + '-after-open');
|
||||
|
||||
this.drop.addEventListener(transitionEndEvent, this.transitionEndHandler);
|
||||
|
||||
this.trigger('close');
|
||||
|
||||
if (typeof this.tether !== 'undefined') {
|
||||
this.tether.disable();
|
||||
}
|
||||
|
||||
drop.updateBodyClasses();
|
||||
|
||||
if (this.options.remove) {
|
||||
this.remove(event);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'remove',
|
||||
value: function remove(event) {
|
||||
this.close(event);
|
||||
if (this.drop.parentNode) {
|
||||
this.drop.parentNode.removeChild(this.drop);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'position',
|
||||
value: function position() {
|
||||
if (this.isOpened() && typeof this.tether !== 'undefined') {
|
||||
this.tether.position();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'destroy',
|
||||
value: function destroy() {
|
||||
this.remove();
|
||||
|
||||
if (typeof this.tether !== 'undefined') {
|
||||
this.tether.destroy();
|
||||
}
|
||||
|
||||
for (var i = 0; i < this._boundEvents.length; ++i) {
|
||||
var _boundEvents$i = this._boundEvents[i];
|
||||
var element = _boundEvents$i.element;
|
||||
var _event = _boundEvents$i.event;
|
||||
var handler = _boundEvents$i.handler;
|
||||
|
||||
element.removeEventListener(_event, handler);
|
||||
}
|
||||
|
||||
this._boundEvents = [];
|
||||
|
||||
this.tether = null;
|
||||
this.drop = null;
|
||||
this.content = null;
|
||||
this.target = null;
|
||||
|
||||
removeFromArray(allDrops[drop.classPrefix], this);
|
||||
removeFromArray(drop.drops, this);
|
||||
}
|
||||
}]);
|
||||
|
||||
return DropInstance;
|
||||
})(Evented);
|
||||
|
||||
return drop;
|
||||
}
|
||||
|
||||
var Drop = createContext();
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
Drop.updateBodyClasses();
|
||||
});
|
||||
return Drop;
|
||||
|
||||
}));
|
1767
app/vendor/dropzone.js
vendored
Executable file
1767
app/vendor/dropzone.js
vendored
Executable file
File diff suppressed because it is too large
Load diff
825
app/vendor/is.js
vendored
Normal file
825
app/vendor/is.js
vendored
Normal file
|
@ -0,0 +1,825 @@
|
|||
// is.js 0.7.4
|
||||
// Author: Aras Atasaygin
|
||||
|
||||
// AMD with global, Node, or global
|
||||
;(function(root, factory) {
|
||||
if(typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['is'], function(is) {
|
||||
// Also create a global in case some scripts
|
||||
// that are loaded still are looking for
|
||||
// a global even when an AMD loader is in use.
|
||||
return (root.is = factory(is));
|
||||
});
|
||||
} else if(typeof exports === 'object') {
|
||||
// Node. Does not work with strict CommonJS, but
|
||||
// only CommonJS-like enviroments that support module.exports,
|
||||
// like Node.
|
||||
module.exports = factory(require('is_js'));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
root.is = factory(root.is);
|
||||
}
|
||||
} (this, function(is) {
|
||||
|
||||
// Baseline
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
var root = this || global;
|
||||
var previousIs = root.is;
|
||||
|
||||
// define 'is' object and current version
|
||||
is = {};
|
||||
is.VERSION = '0.7.4';
|
||||
|
||||
// define interfaces
|
||||
is.not = {};
|
||||
is.all = {};
|
||||
is.any = {};
|
||||
|
||||
// cache some methods to call later on
|
||||
var toString = Object.prototype.toString;
|
||||
var arraySlice = Array.prototype.slice;
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
// helper function which reverses the sense of predicate result
|
||||
function not(func) {
|
||||
return function() {
|
||||
return !func.apply(null, arraySlice.call(arguments));
|
||||
};
|
||||
}
|
||||
|
||||
// helper function which call predicate function per parameter and return true if all pass
|
||||
function all(func) {
|
||||
return function() {
|
||||
var parameters = arraySlice.call(arguments);
|
||||
var length = parameters.length;
|
||||
if(length === 1 && is.array(parameters[0])) { // support array
|
||||
parameters = parameters[0];
|
||||
length = parameters.length;
|
||||
}
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (!func.call(null, parameters[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
// helper function which call predicate function per parameter and return true if any pass
|
||||
function any(func) {
|
||||
return function() {
|
||||
var parameters = arraySlice.call(arguments);
|
||||
var length = parameters.length;
|
||||
if(length === 1 && is.array(parameters[0])) { // support array
|
||||
parameters = parameters[0];
|
||||
length = parameters.length;
|
||||
}
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (func.call(null, parameters[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
// Type checks
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
// is a given value Arguments?
|
||||
is.arguments = function(value) { // fallback check is for IE
|
||||
return is.not.null(value) && (toString.call(value) === '[object Arguments]' || (typeof value === 'object' && 'callee' in value));
|
||||
};
|
||||
|
||||
// is a given value Array?
|
||||
is.array = Array.isArray || function(value) { // check native isArray first
|
||||
return toString.call(value) === '[object Array]';
|
||||
};
|
||||
|
||||
// is a given value Boolean?
|
||||
is.boolean = function(value) {
|
||||
return value === true || value === false || toString.call(value) === '[object Boolean]';
|
||||
};
|
||||
|
||||
// is a given value Date Object?
|
||||
is.date = function(value) {
|
||||
return toString.call(value) === '[object Date]';
|
||||
};
|
||||
|
||||
// is a given value Error object?
|
||||
is.error = function(value) {
|
||||
return toString.call(value) === '[object Error]';
|
||||
};
|
||||
|
||||
// is a given value function?
|
||||
is.function = function(value) { // fallback check is for IE
|
||||
return toString.call(value) === '[object Function]' || typeof value === 'function';
|
||||
};
|
||||
|
||||
// is a given value NaN?
|
||||
is.nan = function(value) { // NaN is number :) Also it is the only value which does not equal itself
|
||||
return value !== value;
|
||||
};
|
||||
|
||||
// is a given value null?
|
||||
is.null = function(value) {
|
||||
return value === null;
|
||||
};
|
||||
|
||||
// is a given value number?
|
||||
is.number = function(value) {
|
||||
return is.not.nan(value) && toString.call(value) === '[object Number]';
|
||||
};
|
||||
|
||||
// is a given value object?
|
||||
is.object = function(value) {
|
||||
var type = typeof value;
|
||||
return type === 'function' || type === 'object' && !!value;
|
||||
};
|
||||
|
||||
// is given value a pure JSON object?
|
||||
is.json = function(value) {
|
||||
return toString.call(value) === '[object Object]';
|
||||
};
|
||||
|
||||
// is a given value RegExp?
|
||||
is.regexp = function(value) {
|
||||
return toString.call(value) === '[object RegExp]';
|
||||
};
|
||||
|
||||
// are given values same type?
|
||||
// prevent NaN, Number same type check
|
||||
is.sameType = function(value1, value2) {
|
||||
if(is.nan(value1) || is.nan(value2)) {
|
||||
return is.nan(value1) === is.nan(value2);
|
||||
}
|
||||
return toString.call(value1) === toString.call(value2);
|
||||
};
|
||||
// sameType method does not support 'all' and 'any' interfaces
|
||||
is.sameType.api = ['not'];
|
||||
|
||||
// is a given value String?
|
||||
is.string = function(value) {
|
||||
return toString.call(value) === '[object String]';
|
||||
};
|
||||
|
||||
// is a given value Char?
|
||||
is.char = function(value) {
|
||||
return is.string(value) && value.length === 1;
|
||||
};
|
||||
|
||||
// is a given value undefined?
|
||||
is.undefined = function(value) {
|
||||
return value === void 0;
|
||||
};
|
||||
|
||||
// Presence checks
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
//is a given value empty? Objects, arrays, strings
|
||||
is.empty = function(value) {
|
||||
if(is.object(value)){
|
||||
var num = Object.getOwnPropertyNames(value).length;
|
||||
if(num === 0 || (num === 1 && is.array(value)) || (num === 2 && is.arguments(value))){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return value === '';
|
||||
}
|
||||
};
|
||||
|
||||
// is a given value existy?
|
||||
is.existy = function(value) {
|
||||
return value !== null && value !== undefined;
|
||||
};
|
||||
|
||||
// is a given value truthy?
|
||||
is.truthy = function(value) {
|
||||
return is.existy(value) && value !== false && is.not.nan(value) && value !== "" && value !== 0;
|
||||
};
|
||||
|
||||
// is a given value falsy?
|
||||
is.falsy = not(is.truthy);
|
||||
|
||||
// is a given value space?
|
||||
// horizantal tab: 9, line feed: 10, vertical tab: 11, form feed: 12, carriage return: 13, space: 32
|
||||
is.space = function(value) {
|
||||
if(is.char(value)) {
|
||||
var characterCode = value.charCodeAt(0);
|
||||
return (characterCode > 8 && characterCode < 14) || characterCode === 32;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// Arithmetic checks
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
// are given values equal? supports numbers, strings, regexps, booleans
|
||||
// TODO: Add object and array support
|
||||
is.equal = function(value1, value2) {
|
||||
// check 0 and -0 equity with Infinity and -Infinity
|
||||
if(is.all.number(value1, value2)) {
|
||||
return value1 === value2 && 1 / value1 === 1 / value2;
|
||||
}
|
||||
// check regexps as strings too
|
||||
if(is.all.string(value1, value2) || is.all.regexp(value1, value2)) {
|
||||
return '' + value1 === '' + value2;
|
||||
}
|
||||
if(is.all.boolean(value1, value2)) {
|
||||
return value1 === value2;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
// equal method does not support 'all' and 'any' interfaces
|
||||
is.equal.api = ['not'];
|
||||
|
||||
// is a given number even?
|
||||
is.even = function(numb) {
|
||||
return is.number(numb) && numb % 2 === 0;
|
||||
};
|
||||
|
||||
// is a given number odd?
|
||||
is.odd = function(numb) {
|
||||
return is.number(numb) && numb % 2 !== 0;
|
||||
};
|
||||
|
||||
// is a given number positive?
|
||||
is.positive = function(numb) {
|
||||
return is.number(numb) && numb > 0;
|
||||
};
|
||||
|
||||
// is a given number negative?
|
||||
is.negative = function(numb) {
|
||||
return is.number(numb) && numb < 0;
|
||||
};
|
||||
|
||||
// is a given number above minimum parameter?
|
||||
is.above = function(numb, min) {
|
||||
return is.all.number(numb, min) && numb > min;
|
||||
};
|
||||
// above method does not support 'all' and 'any' interfaces
|
||||
is.above.api = ['not'];
|
||||
|
||||
// is a given number above maximum parameter?
|
||||
is.under = function(numb, max) {
|
||||
return is.all.number(numb, max) && numb < max;
|
||||
};
|
||||
// least method does not support 'all' and 'any' interfaces
|
||||
is.under.api = ['not'];
|
||||
|
||||
// is a given number within minimum and maximum parameters?
|
||||
is.within = function(numb, min, max) {
|
||||
return is.all.number(numb, min, max) && numb > min && numb < max;
|
||||
};
|
||||
// within method does not support 'all' and 'any' interfaces
|
||||
is.within.api = ['not'];
|
||||
|
||||
// is a given number decimal?
|
||||
is.decimal = function(numb) {
|
||||
return is.number(numb) && numb % 1 !== 0;
|
||||
};
|
||||
|
||||
// is a given number integer?
|
||||
is.integer = function(numb) {
|
||||
return is.number(numb) && numb % 1 === 0;
|
||||
};
|
||||
|
||||
// is a given number finite?
|
||||
is.finite = isFinite || function(numb) {
|
||||
return numb !== Infinity && numb !== -Infinity && is.not.nan(numb);
|
||||
};
|
||||
|
||||
// is a given number infinite?
|
||||
is.infinite = not(is.finite);
|
||||
|
||||
// Regexp checks
|
||||
/* -------------------------------------------------------------------------- */
|
||||
// Steven Levithan, Jan Goyvaerts: Regular Expressions Cookbook
|
||||
// Scott Gonzalez: Email address validation
|
||||
|
||||
// eppPhone match extensible provisioning protocol format
|
||||
// nanpPhone match north american number plan format
|
||||
// dateString match m/d/yy and mm/dd/yyyy, allowing any combination of one or two digits for the day and month, and two or four digits for the year
|
||||
// time match hours, minutes, and seconds, 24-hour clock
|
||||
var regexps = {
|
||||
url: /^(?:(?:https?|ftp):\/\/)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/i,
|
||||
email: /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i,
|
||||
creditCard: /^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/,
|
||||
alphaNumeric: /^[A-Za-z0-9]+$/,
|
||||
timeString: /^(2[0-3]|[01]?[0-9]):([0-5]?[0-9]):([0-5]?[0-9])$/,
|
||||
dateString: /^(1[0-2]|0?[1-9])\/(3[01]|[12][0-9]|0?[1-9])\/(?:[0-9]{2})?[0-9]{2}$/,
|
||||
usZipCode: /^[0-9]{5}(?:-[0-9]{4})?$/,
|
||||
caPostalCode: /^(?!.*[DFIOQU])[A-VXY][0-9][A-Z]\s?[0-9][A-Z][0-9]$/,
|
||||
ukPostCode: /^[A-Z]{1,2}[0-9RCHNQ][0-9A-Z]?\s?[0-9][ABD-HJLNP-UW-Z]{2}$|^[A-Z]{2}-?[0-9]{4}$/,
|
||||
nanpPhone: /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/,
|
||||
eppPhone: /^\+[0-9]{1,3}\.[0-9]{4,14}(?:x.+)?$/,
|
||||
socialSecurityNumber: /^(?!000|666)[0-8][0-9]{2}-(?!00)[0-9]{2}-(?!0000)[0-9]{4}$/,
|
||||
affirmative: /^(?:1|t(?:rue)?|y(?:es)?|ok(?:ay)?)$/,
|
||||
hexadecimal: /^[0-9a-fA-F]+$/,
|
||||
hexColor: /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,
|
||||
ipv4: /^(?:(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])$/,
|
||||
ipv6: /^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$|^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,
|
||||
ip: /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$|^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/
|
||||
};
|
||||
|
||||
// create regexp checks methods from 'regexp' object
|
||||
for(var regexp in regexps) {
|
||||
if(regexps.hasOwnProperty(regexp)) {
|
||||
regexpCheck(regexp, regexps);
|
||||
}
|
||||
}
|
||||
|
||||
function regexpCheck(regexp, regexps) {
|
||||
is[regexp] = function(value) {
|
||||
return regexps[regexp].test(value);
|
||||
};
|
||||
}
|
||||
|
||||
// String checks
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
// is a given string include parameter substring?
|
||||
is.include = function(str, substr) {
|
||||
return str.indexOf(substr) > -1;
|
||||
};
|
||||
// include method does not support 'all' and 'any' interfaces
|
||||
is.include.api = ['not'];
|
||||
|
||||
// is a given string all uppercase?
|
||||
is.upperCase = function(str) {
|
||||
return is.string(str) && str === str.toUpperCase();
|
||||
};
|
||||
|
||||
// is a given string all lowercase?
|
||||
is.lowerCase = function(str) {
|
||||
return is.string(str) && str === str.toLowerCase();
|
||||
};
|
||||
|
||||
// is string start with a given startWith parameter?
|
||||
is.startWith = function(str, startWith) {
|
||||
return is.string(str) && str.indexOf(startWith) === 0;
|
||||
};
|
||||
// startWith method does not support 'all' and 'any' interfaces
|
||||
is.startWith.api = ['not'];
|
||||
|
||||
// is string end with a given endWith parameter?
|
||||
is.endWith = function(str, endWith) {
|
||||
return is.string(str) && str.indexOf(endWith) > -1 && str.indexOf(endWith) === str.length - endWith.length;
|
||||
};
|
||||
// endWith method does not support 'all' and 'any' interfaces
|
||||
is.endWith.api = ['not'];
|
||||
|
||||
// is a given string or sentence capitalized?
|
||||
is.capitalized = function(str) {
|
||||
if(is.not.string(str)) {
|
||||
return false;
|
||||
}
|
||||
var words = str.split(' ');
|
||||
var capitalized = [];
|
||||
for(var i = 0; i < words.length; i++) {
|
||||
capitalized.push(words[i][0] === words[i][0].toUpperCase());
|
||||
}
|
||||
return is.all.truthy.apply(null, capitalized);
|
||||
};
|
||||
|
||||
// is a given string palindrome?
|
||||
is.palindrome = function(str) {
|
||||
return is.string(str) && str == str.split('').reverse().join('');
|
||||
};
|
||||
|
||||
// Time checks
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
var days = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];
|
||||
var months = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];
|
||||
|
||||
// is a given date indicate today?
|
||||
is.today = function(obj) {
|
||||
var now = new Date();
|
||||
var todayString = now.toDateString();
|
||||
return is.date(obj) && obj.toDateString() === todayString;
|
||||
};
|
||||
|
||||
// is a given date indicate yesterday?
|
||||
is.yesterday = function(obj) {
|
||||
var now = new Date();
|
||||
var yesterdayString = new Date(now.setDate(now.getDate() - 1)).toDateString();
|
||||
return is.date(obj) && obj.toDateString() === yesterdayString;
|
||||
};
|
||||
|
||||
// is a given date indicate tomorrow?
|
||||
is.tomorrow = function(obj) {
|
||||
var now = new Date();
|
||||
var tomorrowString = new Date(now.setDate(now.getDate() + 1)).toDateString();
|
||||
return is.date(obj) && obj.toDateString() === tomorrowString;
|
||||
};
|
||||
|
||||
// is a given date past?
|
||||
is.past = function(obj) {
|
||||
var now = new Date();
|
||||
return is.date(obj) && obj.getTime() < now.getTime();
|
||||
};
|
||||
|
||||
// is a given date future?
|
||||
is.future = not(is.past);
|
||||
|
||||
// is a given dates day equal given dayString parameter?
|
||||
is.day = function(obj, dayString) {
|
||||
return is.date(obj) && dayString.toLowerCase() === days[obj.getDay()];
|
||||
};
|
||||
// day method does not support 'all' and 'any' interfaces
|
||||
is.day.api = ['not'];
|
||||
|
||||
// is a given dates month equal given monthString parameter?
|
||||
is.month = function(obj, monthString) {
|
||||
return is.date(obj) && monthString.toLowerCase() === months[obj.getMonth()];
|
||||
};
|
||||
// month method does not support 'all' and 'any' interfaces
|
||||
is.month.api = ['not'];
|
||||
|
||||
// is a given dates year equal given year parameter?
|
||||
is.year = function(obj, year) {
|
||||
return is.date(obj) && is.number(year) && year === obj.getFullYear();
|
||||
};
|
||||
// year method does not support 'all' and 'any' interfaces
|
||||
is.year.api = ['not'];
|
||||
|
||||
// is the given year a leap year?
|
||||
is.leapYear = function(year) {
|
||||
return is.number(year) && ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0);
|
||||
};
|
||||
|
||||
// is a given date weekend?
|
||||
// 6: Saturday, 0: Sunday
|
||||
is.weekend = function(obj) {
|
||||
return is.date(obj) && (obj.getDay() === 6 || obj.getDay() === 0);
|
||||
};
|
||||
|
||||
// is a given date weekday?
|
||||
is.weekday = not(is.weekend);
|
||||
|
||||
// is date within given range?
|
||||
is.inDateRange = function(obj, startObj, endObj) {
|
||||
if(is.not.date(obj) || is.not.date(startObj) || is.not.date(endObj)) {
|
||||
return false;
|
||||
}
|
||||
var givenDate = obj.getTime();
|
||||
var start = startObj.getTime();
|
||||
var end = endObj.getTime();
|
||||
return givenDate > start && givenDate < end;
|
||||
};
|
||||
// inDateRange method does not support 'all' and 'any' interfaces
|
||||
is.inDateRange.api = ['not'];
|
||||
|
||||
// is a given date in last week range?
|
||||
is.inLastWeek = function(obj) {
|
||||
return is.inDateRange(obj, new Date(new Date().setDate(new Date().getDate() - 7)), new Date());
|
||||
};
|
||||
|
||||
// is a given date in last month range?
|
||||
is.inLastMonth = function(obj) {
|
||||
return is.inDateRange(obj, new Date(new Date().setMonth(new Date().getMonth() - 1)), new Date());
|
||||
};
|
||||
|
||||
// is a given date in last year range?
|
||||
is.inLastYear = function(obj) {
|
||||
return is.inDateRange(obj, new Date(new Date().setFullYear(new Date().getFullYear() - 1)), new Date());
|
||||
};
|
||||
|
||||
// is a given date in next week range?
|
||||
is.inNextWeek = function(obj) {
|
||||
return is.inDateRange(obj, new Date(), new Date(new Date().setDate(new Date().getDate() + 7)));
|
||||
};
|
||||
|
||||
// is a given date in next month range?
|
||||
is.inNextMonth = function(obj) {
|
||||
return is.inDateRange(obj, new Date(), new Date(new Date().setMonth(new Date().getMonth() + 1)));
|
||||
};
|
||||
|
||||
// is a given date in next year range?
|
||||
is.inNextYear = function(obj) {
|
||||
return is.inDateRange(obj, new Date(), new Date(new Date().setFullYear(new Date().getFullYear() + 1)));
|
||||
};
|
||||
|
||||
// is a given date in the parameter quarter?
|
||||
is.quarterOfYear = function(obj, quarterNumber) {
|
||||
return is.date(obj) && is.number(quarterNumber) && quarterNumber === Math.floor((obj.getMonth() + 3) / 3);
|
||||
};
|
||||
// quarterOfYear method does not support 'all' and 'any' interfaces
|
||||
is.quarterOfYear.api = ['not'];
|
||||
|
||||
// is a given date in daylight saving time?
|
||||
is.dayLightSavingTime = function(obj) {
|
||||
var january = new Date(obj.getFullYear(), 0, 1);
|
||||
var july = new Date(obj.getFullYear(), 6, 1);
|
||||
var stdTimezoneOffset = Math.max(january.getTimezoneOffset(), july.getTimezoneOffset());
|
||||
return obj.getTimezoneOffset() < stdTimezoneOffset;
|
||||
};
|
||||
|
||||
// Environment checks
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
// check if library is used as a Node.js module
|
||||
if(typeof window !== 'undefined') {
|
||||
|
||||
// store navigator properties to use later
|
||||
var userAgent = 'navigator' in window && 'userAgent' in navigator && navigator.userAgent.toLowerCase() || '';
|
||||
var vendor = 'navigator' in window && 'vendor' in navigator && navigator.vendor.toLowerCase() || '';
|
||||
var appVersion = 'navigator' in window && 'appVersion' in navigator && navigator.appVersion.toLowerCase() || '';
|
||||
|
||||
// is current browser chrome?
|
||||
is.chrome = function() {
|
||||
return /chrome|chromium/i.test(userAgent) && /google inc/.test(vendor);
|
||||
};
|
||||
// chrome method does not support 'all' and 'any' interfaces
|
||||
is.chrome.api = ['not'];
|
||||
|
||||
// is current browser firefox?
|
||||
is.firefox = function() {
|
||||
return /firefox/i.test(userAgent);
|
||||
};
|
||||
// firefox method does not support 'all' and 'any' interfaces
|
||||
is.firefox.api = ['not'];
|
||||
|
||||
// is current browser internet explorer?
|
||||
// parameter is optional
|
||||
is.ie = function(version) {
|
||||
if(!version) {
|
||||
return /msie/i.test(userAgent) || "ActiveXObject" in window;
|
||||
}
|
||||
if(version >= 11) {
|
||||
return "ActiveXObject" in window;
|
||||
}
|
||||
return new RegExp('msie ' + version).test(userAgent);
|
||||
};
|
||||
// ie method does not support 'all' and 'any' interfaces
|
||||
is.ie.api = ['not'];
|
||||
|
||||
// is current browser opera?
|
||||
is.opera = function() {
|
||||
return /^Opera\//.test(userAgent) || // Opera 12 and older versions
|
||||
/\x20OPR\//.test(userAgent); // Opera 15+
|
||||
};
|
||||
// opera method does not support 'all' and 'any' interfaces
|
||||
is.opera.api = ['not'];
|
||||
|
||||
// is current browser safari?
|
||||
is.safari = function() {
|
||||
return /safari/i.test(userAgent) && /apple computer/i.test(vendor);
|
||||
};
|
||||
// safari method does not support 'all' and 'any' interfaces
|
||||
is.safari.api = ['not'];
|
||||
|
||||
// is current device ios?
|
||||
is.ios = function() {
|
||||
return is.iphone() || is.ipad() || is.ipod();
|
||||
};
|
||||
// ios method does not support 'all' and 'any' interfaces
|
||||
is.ios.api = ['not'];
|
||||
|
||||
// is current device iphone?
|
||||
is.iphone = function() {
|
||||
return /iphone/i.test(userAgent);
|
||||
};
|
||||
// iphone method does not support 'all' and 'any' interfaces
|
||||
is.iphone.api = ['not'];
|
||||
|
||||
// is current device ipad?
|
||||
is.ipad = function() {
|
||||
return /ipad/i.test(userAgent);
|
||||
};
|
||||
// ipad method does not support 'all' and 'any' interfaces
|
||||
is.ipad.api = ['not'];
|
||||
|
||||
// is current device ipod?
|
||||
is.ipod = function() {
|
||||
return /ipod/i.test(userAgent);
|
||||
};
|
||||
// ipod method does not support 'all' and 'any' interfaces
|
||||
is.ipod.api = ['not'];
|
||||
|
||||
// is current device android?
|
||||
is.android = function() {
|
||||
return /android/i.test(userAgent);
|
||||
};
|
||||
// android method does not support 'all' and 'any' interfaces
|
||||
is.android.api = ['not'];
|
||||
|
||||
// is current device android phone?
|
||||
is.androidPhone = function() {
|
||||
return /android/i.test(userAgent) && /mobile/i.test(userAgent);
|
||||
};
|
||||
// androidPhone method does not support 'all' and 'any' interfaces
|
||||
is.androidPhone.api = ['not'];
|
||||
|
||||
// is current device android tablet?
|
||||
is.androidTablet = function() {
|
||||
return /android/i.test(userAgent) && !/mobile/i.test(userAgent);
|
||||
};
|
||||
// androidTablet method does not support 'all' and 'any' interfaces
|
||||
is.androidTablet.api = ['not'];
|
||||
|
||||
// is current device blackberry?
|
||||
is.blackberry = function() {
|
||||
return /blackberry/i.test(userAgent) || /BB10/i.test(userAgent);
|
||||
};
|
||||
// blackberry method does not support 'all' and 'any' interfaces
|
||||
is.blackberry.api = ['not'];
|
||||
|
||||
// is current device desktop?
|
||||
is.desktop = function() {
|
||||
return is.not.mobile() && is.not.tablet();
|
||||
};
|
||||
// desktop method does not support 'all' and 'any' interfaces
|
||||
is.desktop.api = ['not'];
|
||||
|
||||
// is current operating system linux?
|
||||
is.linux = function() {
|
||||
return /linux/i.test(appVersion);
|
||||
};
|
||||
// linux method does not support 'all' and 'any' interfaces
|
||||
is.linux.api = ['not'];
|
||||
|
||||
// is current operating system mac?
|
||||
is.mac = function() {
|
||||
return /mac/i.test(appVersion);
|
||||
};
|
||||
// mac method does not support 'all' and 'any' interfaces
|
||||
is.mac.api = ['not'];
|
||||
|
||||
// is current operating system windows?
|
||||
is.windows = function() {
|
||||
return /win/i.test(appVersion);
|
||||
};
|
||||
// windows method does not support 'all' and 'any' interfaces
|
||||
is.windows.api = ['not'];
|
||||
|
||||
// is current device windows phone?
|
||||
is.windowsPhone = function() {
|
||||
return is.windows() && /phone/i.test(userAgent);
|
||||
};
|
||||
// windowsPhone method does not support 'all' and 'any' interfaces
|
||||
is.windowsPhone.api = ['not'];
|
||||
|
||||
// is current device windows tablet?
|
||||
is.windowsTablet = function() {
|
||||
return is.windows() && is.not.windowsPhone() && /touch/i.test(userAgent);
|
||||
};
|
||||
// windowsTablet method does not support 'all' and 'any' interfaces
|
||||
is.windowsTablet.api = ['not'];
|
||||
|
||||
// is current device mobile?
|
||||
is.mobile = function() {
|
||||
return is.iphone() || is.ipod() || is.androidPhone() || is.blackberry() || is.windowsPhone();
|
||||
};
|
||||
// mobile method does not support 'all' and 'any' interfaces
|
||||
is.mobile.api = ['not'];
|
||||
|
||||
// is current device tablet?
|
||||
is.tablet = function() {
|
||||
return is.ipad() || is.androidTablet() || is.windowsTablet();
|
||||
};
|
||||
// tablet method does not support 'all' and 'any' interfaces
|
||||
is.tablet.api = ['not'];
|
||||
|
||||
// is current state online?
|
||||
is.online = function() {
|
||||
return navigator.onLine;
|
||||
};
|
||||
// online method does not support 'all' and 'any' interfaces
|
||||
is.online.api = ['not'];
|
||||
|
||||
// is current state offline?
|
||||
is.offline = not(is.online);
|
||||
// offline method does not support 'all' and 'any' interfaces
|
||||
is.offline.api = ['not'];
|
||||
|
||||
// is current device supports touch?
|
||||
is.touchDevice = function() {
|
||||
return 'ontouchstart' in window ||'DocumentTouch' in window && document instanceof DocumentTouch;
|
||||
};
|
||||
// touchDevice method does not support 'all' and 'any' interfaces
|
||||
is.touchDevice.api = ['not'];
|
||||
}
|
||||
|
||||
// Object checks
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
// has a given object got parameterized count property?
|
||||
is.propertyCount = function(obj, count) {
|
||||
if(!is.object(obj) || !is.number(count)) {
|
||||
return false;
|
||||
}
|
||||
if(Object.keys) {
|
||||
return Object.keys(obj).length === count;
|
||||
}
|
||||
var properties = [],
|
||||
property;
|
||||
for(property in obj) {
|
||||
if (hasOwnProperty.call(obj, property)) {
|
||||
properties.push(property);
|
||||
}
|
||||
}
|
||||
return properties.length === count;
|
||||
};
|
||||
// propertyCount method does not support 'all' and 'any' interfaces
|
||||
is.propertyCount.api = ['not'];
|
||||
|
||||
// is given object has parameterized property?
|
||||
is.propertyDefined = function(obj, property) {
|
||||
return is.object(obj) && is.string(property) && property in obj;
|
||||
};
|
||||
// propertyDefined method does not support 'all' and 'any' interfaces
|
||||
is.propertyDefined.api = ['not'];
|
||||
|
||||
// is a given object window?
|
||||
// setInterval method is only available for window object
|
||||
is.windowObject = function(obj) {
|
||||
return typeof obj === 'object' && 'setInterval' in obj;
|
||||
};
|
||||
|
||||
// is a given object a DOM node?
|
||||
is.domNode = function(obj) {
|
||||
return is.object(obj) && obj.nodeType > 0;
|
||||
};
|
||||
|
||||
// Array checks
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
// is a given item in an array?
|
||||
is.inArray = function(val, arr){
|
||||
if(is.not.array(arr)) {
|
||||
return false;
|
||||
}
|
||||
for(var i = 0; i < arr.length; i++) {
|
||||
if (arr[i] === val) return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
// inArray method does not support 'all' and 'any' interfaces
|
||||
is.inArray.api = ['not'];
|
||||
|
||||
// is a given array sorted?
|
||||
is.sorted = function(arr) {
|
||||
if(is.not.array(arr)) {
|
||||
return false;
|
||||
}
|
||||
for(var i = 0; i < arr.length; i++) {
|
||||
if(arr[i] > arr[i + 1]) return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
// API
|
||||
// Set 'not', 'all' and 'any' interfaces to methods based on their api property
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
function setInterfaces() {
|
||||
var options = is;
|
||||
for(var option in options) {
|
||||
if(hasOwnProperty.call(options, option) && is.function(options[option])) {
|
||||
var interfaces = options[option].api || ['not', 'all', 'any'];
|
||||
for (var i = 0; i < interfaces.length; i++) {
|
||||
if(interfaces[i] === 'not') {
|
||||
is.not[option] = not(is[option]);
|
||||
}
|
||||
if(interfaces[i] === 'all') {
|
||||
is.all[option] = all(is[option]);
|
||||
}
|
||||
if(interfaces[i] === 'any') {
|
||||
is.any[option] = any(is[option]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
setInterfaces();
|
||||
|
||||
// Configuration methods
|
||||
// Intentionally added after setInterfaces function
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
// set optional regexps to methods if you think they suck
|
||||
is.setRegexp = function(regexp, regexpName) {
|
||||
for(var r in regexps) {
|
||||
if(hasOwnProperty.call(regexps, r) && (regexpName === r)) {
|
||||
regexps[r] = regexp;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// change namespace of library to prevent name collisions
|
||||
// var preferredName = is.setNamespace();
|
||||
// preferredName.odd(3);
|
||||
// => true
|
||||
is.setNamespace = function() {
|
||||
root.is = previousIs;
|
||||
return this;
|
||||
};
|
||||
|
||||
return is;
|
||||
}));
|
5
app/vendor/markdown-it.min.js
vendored
Normal file
5
app/vendor/markdown-it.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
274
app/vendor/md5.js
vendored
Normal file
274
app/vendor/md5.js
vendored
Normal file
|
@ -0,0 +1,274 @@
|
|||
/*
|
||||
* JavaScript MD5 1.0.1
|
||||
* https://github.com/blueimp/JavaScript-MD5
|
||||
*
|
||||
* Copyright 2011, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*
|
||||
* Based on
|
||||
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
|
||||
* Digest Algorithm, as defined in RFC 1321.
|
||||
* Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
|
||||
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
|
||||
* Distributed under the BSD License
|
||||
* See http://pajhome.org.uk/crypt/md5 for more info.
|
||||
*/
|
||||
|
||||
/*jslint bitwise: true */
|
||||
/*global unescape, define */
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
|
||||
* to work around bugs in some JS interpreters.
|
||||
*/
|
||||
function safe_add(x, y) {
|
||||
var lsw = (x & 0xFFFF) + (y & 0xFFFF),
|
||||
msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
||||
return (msw << 16) | (lsw & 0xFFFF);
|
||||
}
|
||||
|
||||
/*
|
||||
* Bitwise rotate a 32-bit number to the left.
|
||||
*/
|
||||
function bit_rol(num, cnt) {
|
||||
return (num << cnt) | (num >>> (32 - cnt));
|
||||
}
|
||||
|
||||
/*
|
||||
* These functions implement the four basic operations the algorithm uses.
|
||||
*/
|
||||
function md5_cmn(q, a, b, x, s, t) {
|
||||
return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b);
|
||||
}
|
||||
function md5_ff(a, b, c, d, x, s, t) {
|
||||
return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
|
||||
}
|
||||
function md5_gg(a, b, c, d, x, s, t) {
|
||||
return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
|
||||
}
|
||||
function md5_hh(a, b, c, d, x, s, t) {
|
||||
return md5_cmn(b ^ c ^ d, a, b, x, s, t);
|
||||
}
|
||||
function md5_ii(a, b, c, d, x, s, t) {
|
||||
return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the MD5 of an array of little-endian words, and a bit length.
|
||||
*/
|
||||
function binl_md5(x, len) {
|
||||
/* append padding */
|
||||
x[len >> 5] |= 0x80 << (len % 32);
|
||||
x[(((len + 64) >>> 9) << 4) + 14] = len;
|
||||
|
||||
var i, olda, oldb, oldc, oldd,
|
||||
a = 1732584193,
|
||||
b = -271733879,
|
||||
c = -1732584194,
|
||||
d = 271733878;
|
||||
|
||||
for (i = 0; i < x.length; i += 16) {
|
||||
olda = a;
|
||||
oldb = b;
|
||||
oldc = c;
|
||||
oldd = d;
|
||||
|
||||
a = md5_ff(a, b, c, d, x[i], 7, -680876936);
|
||||
d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
|
||||
c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
|
||||
b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
|
||||
a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
|
||||
d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
|
||||
c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
|
||||
b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
|
||||
a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
|
||||
d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
|
||||
c = md5_ff(c, d, a, b, x[i + 10], 17, -42063);
|
||||
b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
|
||||
a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
|
||||
d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
|
||||
c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
|
||||
b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
|
||||
|
||||
a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
|
||||
d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
|
||||
c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
|
||||
b = md5_gg(b, c, d, a, x[i], 20, -373897302);
|
||||
a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
|
||||
d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
|
||||
c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
|
||||
b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
|
||||
a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
|
||||
d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
|
||||
c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
|
||||
b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
|
||||
a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
|
||||
d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
|
||||
c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
|
||||
b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
|
||||
|
||||
a = md5_hh(a, b, c, d, x[i + 5], 4, -378558);
|
||||
d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
|
||||
c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
|
||||
b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
|
||||
a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
|
||||
d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
|
||||
c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
|
||||
b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
|
||||
a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
|
||||
d = md5_hh(d, a, b, c, x[i], 11, -358537222);
|
||||
c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
|
||||
b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
|
||||
a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
|
||||
d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
|
||||
c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
|
||||
b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
|
||||
|
||||
a = md5_ii(a, b, c, d, x[i], 6, -198630844);
|
||||
d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
|
||||
c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
|
||||
b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
|
||||
a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
|
||||
d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
|
||||
c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
|
||||
b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
|
||||
a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
|
||||
d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
|
||||
c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
|
||||
b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
|
||||
a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
|
||||
d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
|
||||
c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
|
||||
b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
|
||||
|
||||
a = safe_add(a, olda);
|
||||
b = safe_add(b, oldb);
|
||||
c = safe_add(c, oldc);
|
||||
d = safe_add(d, oldd);
|
||||
}
|
||||
return [a, b, c, d];
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert an array of little-endian words to a string
|
||||
*/
|
||||
function binl2rstr(input) {
|
||||
var i,
|
||||
output = '';
|
||||
for (i = 0; i < input.length * 32; i += 8) {
|
||||
output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xFF);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a raw string to an array of little-endian words
|
||||
* Characters >255 have their high-byte silently ignored.
|
||||
*/
|
||||
function rstr2binl(input) {
|
||||
var i,
|
||||
output = [];
|
||||
output[(input.length >> 2) - 1] = undefined;
|
||||
for (i = 0; i < output.length; i += 1) {
|
||||
output[i] = 0;
|
||||
}
|
||||
for (i = 0; i < input.length * 8; i += 8) {
|
||||
output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (i % 32);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the MD5 of a raw string
|
||||
*/
|
||||
function rstr_md5(s) {
|
||||
return binl2rstr(binl_md5(rstr2binl(s), s.length * 8));
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the HMAC-MD5, of a key and some data (raw strings)
|
||||
*/
|
||||
function rstr_hmac_md5(key, data) {
|
||||
var i,
|
||||
bkey = rstr2binl(key),
|
||||
ipad = [],
|
||||
opad = [],
|
||||
hash;
|
||||
ipad[15] = opad[15] = undefined;
|
||||
if (bkey.length > 16) {
|
||||
bkey = binl_md5(bkey, key.length * 8);
|
||||
}
|
||||
for (i = 0; i < 16; i += 1) {
|
||||
ipad[i] = bkey[i] ^ 0x36363636;
|
||||
opad[i] = bkey[i] ^ 0x5C5C5C5C;
|
||||
}
|
||||
hash = binl_md5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
|
||||
return binl2rstr(binl_md5(opad.concat(hash), 512 + 128));
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a raw string to a hex string
|
||||
*/
|
||||
function rstr2hex(input) {
|
||||
var hex_tab = '0123456789abcdef',
|
||||
output = '',
|
||||
x,
|
||||
i;
|
||||
for (i = 0; i < input.length; i += 1) {
|
||||
x = input.charCodeAt(i);
|
||||
output += hex_tab.charAt((x >>> 4) & 0x0F) +
|
||||
hex_tab.charAt(x & 0x0F);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* Encode a string as utf-8
|
||||
*/
|
||||
function str2rstr_utf8(input) {
|
||||
return unescape(encodeURIComponent(input));
|
||||
}
|
||||
|
||||
/*
|
||||
* Take string arguments and return either raw or hex encoded strings
|
||||
*/
|
||||
function raw_md5(s) {
|
||||
return rstr_md5(str2rstr_utf8(s));
|
||||
}
|
||||
function hex_md5(s) {
|
||||
return rstr2hex(raw_md5(s));
|
||||
}
|
||||
function raw_hmac_md5(k, d) {
|
||||
return rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d));
|
||||
}
|
||||
function hex_hmac_md5(k, d) {
|
||||
return rstr2hex(raw_hmac_md5(k, d));
|
||||
}
|
||||
|
||||
function md5(string, key, raw) {
|
||||
if (!key) {
|
||||
if (!raw) {
|
||||
return hex_md5(string);
|
||||
}
|
||||
return raw_md5(string);
|
||||
}
|
||||
if (!raw) {
|
||||
return hex_hmac_md5(key, string);
|
||||
}
|
||||
return raw_hmac_md5(key, string);
|
||||
}
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(function () {
|
||||
return md5;
|
||||
});
|
||||
} else {
|
||||
$.md5 = md5;
|
||||
}
|
||||
}(this));
|
3195
app/vendor/moment.js
vendored
Normal file
3195
app/vendor/moment.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
1044
app/vendor/mousetrap.js
vendored
Normal file
1044
app/vendor/mousetrap.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
8
app/vendor/table-editor.min.js
vendored
Normal file
8
app/vendor/table-editor.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1756
app/vendor/tether.js
vendored
Normal file
1756
app/vendor/tether.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
140
app/vendor/tooltip.js
vendored
Normal file
140
app/vendor/tooltip.js
vendored
Normal file
|
@ -0,0 +1,140 @@
|
|||
// https://github.com/HubSpot/tooltip
|
||||
|
||||
/*! tether-tooltip 1.1.0 */
|
||||
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(["tether-drop","tether"], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
module.exports = factory(require('tether-drop'), require('tether'));
|
||||
} else {
|
||||
root.Tooltip = factory(root.Drop, root.Tether);
|
||||
}
|
||||
}(this, function(Drop, Tether) {
|
||||
|
||||
/* global Tether Drop */
|
||||
|
||||
'use strict';
|
||||
|
||||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
||||
|
||||
var extend = Tether.Utils.extend;
|
||||
|
||||
var _Drop = Drop.createContext({
|
||||
classPrefix: 'tooltip'
|
||||
});
|
||||
|
||||
var defaults = {
|
||||
position: 'top center',
|
||||
openOn: 'hover',
|
||||
classes: 'tooltip-theme-arrows',
|
||||
constrainToWindow: true,
|
||||
constrainToScrollParent: false
|
||||
};
|
||||
|
||||
var tooltipCount = 0;
|
||||
|
||||
var Tooltip = (function () {
|
||||
function Tooltip(options) {
|
||||
_classCallCheck(this, Tooltip);
|
||||
|
||||
this.options = options;
|
||||
|
||||
if (!this.options.target) {
|
||||
throw new Error('Tooltip Error: You must provide a target for Tooltip to attach to');
|
||||
}
|
||||
|
||||
var position = this.options.target.getAttribute('data-tooltip-position');
|
||||
if (position) {
|
||||
if (typeof this.options.position === 'undefined') {
|
||||
this.options.position = position;
|
||||
}
|
||||
}
|
||||
|
||||
var content = this.options.target.getAttribute('data-tooltip');
|
||||
|
||||
if (content) {
|
||||
if (typeof this.options.content === 'undefined') {
|
||||
var contentEl = document.createElement('div');
|
||||
contentEl.innerHTML = content;
|
||||
|
||||
// Add ARIA attributes (see #50)
|
||||
contentEl.setAttribute('role', 'tooltip');
|
||||
contentEl.id = 'drop-tooltip-' + tooltipCount;
|
||||
this.options.target.setAttribute('aria-describedby', contentEl.id);
|
||||
tooltipCount += 1;
|
||||
|
||||
this.options.content = contentEl;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.options.content) {
|
||||
throw new Error('Tooltip Error: You must provide content for Tooltip to display');
|
||||
}
|
||||
|
||||
this.options = extend({}, defaults, this.options);
|
||||
|
||||
this.drop = new _Drop(this.options);
|
||||
}
|
||||
|
||||
_createClass(Tooltip, [{
|
||||
key: 'close',
|
||||
value: function close() {
|
||||
this.drop.close();
|
||||
}
|
||||
}, {
|
||||
key: 'open',
|
||||
value: function open() {
|
||||
this.drop.open();
|
||||
}
|
||||
}, {
|
||||
key: 'toggle',
|
||||
value: function toggle() {
|
||||
this.drop.toggle();
|
||||
}
|
||||
}, {
|
||||
key: 'remove',
|
||||
value: function remove() {
|
||||
this.drop.remove();
|
||||
}
|
||||
}, {
|
||||
key: 'destroy',
|
||||
value: function destroy() {
|
||||
this.drop.destroy();
|
||||
}
|
||||
}, {
|
||||
key: 'position',
|
||||
value: function position() {
|
||||
this.drop.position();
|
||||
}
|
||||
}]);
|
||||
|
||||
return Tooltip;
|
||||
})();
|
||||
|
||||
var initialized = [];
|
||||
|
||||
Tooltip.init = function () {
|
||||
var tooltipElements = document.querySelectorAll('[data-tooltip]');
|
||||
var len = tooltipElements.length;
|
||||
for (var i = 0; i < len; ++i) {
|
||||
var el = tooltipElements[i];
|
||||
if (initialized.indexOf(el) === -1) {
|
||||
new Tooltip({
|
||||
target: el
|
||||
});
|
||||
initialized.push(el);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
if (Tooltip.autoinit !== false) {
|
||||
Tooltip.init();
|
||||
}
|
||||
});
|
||||
return Tooltip;
|
||||
|
||||
}));
|
1548
app/vendor/underscore.js
vendored
Normal file
1548
app/vendor/underscore.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue