uikit2-rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/README.md +66 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/uikit2/rails.rb +8 -0
- data/lib/uikit2/rails/version.rb +5 -0
- data/uikit2-rails.gemspec +25 -0
- data/vendor/assets/fonts/FontAwesome.otf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff2 +0 -0
- data/vendor/assets/javascripts/uikit.js +3537 -0
- data/vendor/assets/javascripts/uikit/components/accordion.js +172 -0
- data/vendor/assets/javascripts/uikit/components/accordion.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/autocomplete.js +334 -0
- data/vendor/assets/javascripts/uikit/components/autocomplete.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/datepicker.js +3166 -0
- data/vendor/assets/javascripts/uikit/components/datepicker.min.js +3 -0
- data/vendor/assets/javascripts/uikit/components/form-password.js +67 -0
- data/vendor/assets/javascripts/uikit/components/form-password.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/form-select.js +70 -0
- data/vendor/assets/javascripts/uikit/components/form-select.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/grid.js +523 -0
- data/vendor/assets/javascripts/uikit/components/grid.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/htmleditor.js +623 -0
- data/vendor/assets/javascripts/uikit/components/htmleditor.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/lightbox.js +555 -0
- data/vendor/assets/javascripts/uikit/components/lightbox.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/nestable.js +638 -0
- data/vendor/assets/javascripts/uikit/components/nestable.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/notify.js +189 -0
- data/vendor/assets/javascripts/uikit/components/notify.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/pagination.js +147 -0
- data/vendor/assets/javascripts/uikit/components/pagination.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/parallax.js +417 -0
- data/vendor/assets/javascripts/uikit/components/parallax.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/search.js +92 -0
- data/vendor/assets/javascripts/uikit/components/search.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/slider.js +520 -0
- data/vendor/assets/javascripts/uikit/components/slider.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/slideset.js +502 -0
- data/vendor/assets/javascripts/uikit/components/slideset.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/slideshow-fx.js +375 -0
- data/vendor/assets/javascripts/uikit/components/slideshow-fx.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/slideshow.js +545 -0
- data/vendor/assets/javascripts/uikit/components/slideshow.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/sortable.js +664 -0
- data/vendor/assets/javascripts/uikit/components/sortable.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/sticky.js +349 -0
- data/vendor/assets/javascripts/uikit/components/sticky.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/timepicker.js +192 -0
- data/vendor/assets/javascripts/uikit/components/timepicker.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/tooltip.js +234 -0
- data/vendor/assets/javascripts/uikit/components/tooltip.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/upload.js +260 -0
- data/vendor/assets/javascripts/uikit/components/upload.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/alert.js +66 -0
- data/vendor/assets/javascripts/uikit/core/alert.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/button.js +157 -0
- data/vendor/assets/javascripts/uikit/core/button.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/core.js +725 -0
- data/vendor/assets/javascripts/uikit/core/core.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/cover.js +95 -0
- data/vendor/assets/javascripts/uikit/core/cover.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/dropdown.js +421 -0
- data/vendor/assets/javascripts/uikit/core/dropdown.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/grid.js +114 -0
- data/vendor/assets/javascripts/uikit/core/grid.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/modal.js +372 -0
- data/vendor/assets/javascripts/uikit/core/modal.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/nav.js +136 -0
- data/vendor/assets/javascripts/uikit/core/nav.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/offcanvas.js +180 -0
- data/vendor/assets/javascripts/uikit/core/offcanvas.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/scrollspy.js +208 -0
- data/vendor/assets/javascripts/uikit/core/scrollspy.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/smooth-scroll.js +62 -0
- data/vendor/assets/javascripts/uikit/core/smooth-scroll.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/switcher.js +304 -0
- data/vendor/assets/javascripts/uikit/core/switcher.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/tab.js +165 -0
- data/vendor/assets/javascripts/uikit/core/tab.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/toggle.js +120 -0
- data/vendor/assets/javascripts/uikit/core/toggle.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/touch.js +173 -0
- data/vendor/assets/javascripts/uikit/core/touch.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/utility.js +239 -0
- data/vendor/assets/javascripts/uikit/core/utility.min.js +2 -0
- data/vendor/assets/stylesheets/uikit.almost-flat.css +8551 -0
- data/vendor/assets/stylesheets/uikit.css +8252 -0
- data/vendor/assets/stylesheets/uikit.gradient.css +8614 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.almost-flat.css +39 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.css +37 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.gradient.css +39 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.almost-flat.css +52 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.css +50 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.gradient.css +52 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.almost-flat.css +129 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.css +123 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.gradient.css +139 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.almost-flat.css +128 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.css +124 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.gradient.css +128 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.almost-flat.css +78 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.css +78 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.gradient.css +78 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.almost-flat.css +34 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.css +34 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.gradient.css +34 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.almost-flat.css +34 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.css +34 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.gradient.css +34 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.almost-flat.css +35 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.css +35 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.gradient.css +35 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.almost-flat.css +222 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.css +164 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.gradient.css +229 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.almost-flat.css +135 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.css +132 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.gradient.css +139 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/notify.almost-flat.css +98 -0
- data/vendor/assets/stylesheets/uikit/components/notify.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/notify.css +92 -0
- data/vendor/assets/stylesheets/uikit/components/notify.gradient.css +98 -0
- data/vendor/assets/stylesheets/uikit/components/notify.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/notify.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.almost-flat.css +29 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.css +29 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.gradient.css +29 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/progress.almost-flat.css +104 -0
- data/vendor/assets/stylesheets/uikit/components/progress.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/progress.css +94 -0
- data/vendor/assets/stylesheets/uikit/components/progress.gradient.css +112 -0
- data/vendor/assets/stylesheets/uikit/components/progress.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/progress.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/search.almost-flat.css +191 -0
- data/vendor/assets/stylesheets/uikit/components/search.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/search.css +189 -0
- data/vendor/assets/stylesheets/uikit/components/search.gradient.css +191 -0
- data/vendor/assets/stylesheets/uikit/components/search.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/search.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.almost-flat.css +98 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.css +98 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.gradient.css +98 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slider.almost-flat.css +85 -0
- data/vendor/assets/stylesheets/uikit/components/slider.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slider.css +85 -0
- data/vendor/assets/stylesheets/uikit/components/slider.gradient.css +85 -0
- data/vendor/assets/stylesheets/uikit/components/slider.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slider.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.almost-flat.css +140 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.css +140 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.gradient.css +140 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.almost-flat.css +62 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.css +62 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.gradient.css +62 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.almost-flat.css +31 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.css +31 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.gradient.css +31 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.almost-flat.css +118 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.css +116 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.gradient.css +118 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/upload.almost-flat.css +10 -0
- data/vendor/assets/stylesheets/uikit/components/upload.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/upload.css +10 -0
- data/vendor/assets/stylesheets/uikit/components/upload.gradient.css +10 -0
- data/vendor/assets/stylesheets/uikit/components/upload.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/upload.min.css +2 -0
- metadata +295 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5fe7f31d917543c2c681459172227bbd139f2e55
|
4
|
+
data.tar.gz: 1e0361041dc7971955530f6fdacecbd94d7b0dfe
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ab83c2b0961dee4e1f51e141961a2f5447593ca523dc495b1669fe39596e2fc0382767bfc68cdf8dad341782c01d9ef5d72165c1747a9448234ed8736aa4bac2
|
7
|
+
data.tar.gz: 0b37b5227d432f83da7225574dd7e72bb46767cf9adc91c5500a158e1e79b13007361a09ba3afb04bd589a8abf360b94a1f9cca11c99c7e9918281d86dc09d1f
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# uikit2-rails
|
2
|
+
|
3
|
+
UIkit 2.22.0
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'uikit2-rails', git: 'https://github.com/digaev/uikit2-rails.git'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ git clone https://github.com/digaev/uikit2-rails.git
|
20
|
+
$ cd uikit2-rails
|
21
|
+
$ gem build uikit2-rails.gemspec
|
22
|
+
$ gem install uikit2-rails-*.gem
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
|
27
|
+
In your application.css:
|
28
|
+
|
29
|
+
```css
|
30
|
+
/*
|
31
|
+
*= require uikit
|
32
|
+
* or
|
33
|
+
*= require uikit.gradient
|
34
|
+
* or
|
35
|
+
*= require uikit.almost-flat
|
36
|
+
*
|
37
|
+
* Example including components:
|
38
|
+
*
|
39
|
+
*= require uikit/components/accordion
|
40
|
+
* or
|
41
|
+
*= require uikit/components/accordion.gradient
|
42
|
+
* or
|
43
|
+
*= require uikit/components/accordion.almost-flat
|
44
|
+
*/
|
45
|
+
```
|
46
|
+
|
47
|
+
And in yor application js:
|
48
|
+
|
49
|
+
```js
|
50
|
+
//= require uikit
|
51
|
+
|
52
|
+
// Example including components:
|
53
|
+
//
|
54
|
+
//= require uikit/core/alert
|
55
|
+
```
|
56
|
+
|
57
|
+
## Development
|
58
|
+
|
59
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
60
|
+
|
61
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
62
|
+
|
63
|
+
## Contributing
|
64
|
+
|
65
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/digaev/uikit2-rails.
|
66
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "uikit2/rails"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/uikit2/rails.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'uikit2/rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "uikit2-rails"
|
8
|
+
spec.version = Uikit2::Rails::VERSION
|
9
|
+
spec.authors = ["Nikolay Digaev"]
|
10
|
+
spec.email = ["ffs.cmp@gmail.com"]
|
11
|
+
|
12
|
+
|
13
|
+
spec.summary = %q{uikit gem for Ruby on Rails.}
|
14
|
+
spec.description = %q{A simple gem which provides source files (assets) of UIkit 2.x front-end framework for using in your rails application.}
|
15
|
+
spec.homepage = "https://github.com/digaev/uikit2-rails"
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib", "vendor"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,3537 @@
|
|
1
|
+
/*! UIkit 2.22.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
(function(core) {
|
3
|
+
|
4
|
+
if (typeof define == "function" && define.amd) { // AMD
|
5
|
+
|
6
|
+
define("uikit", function(){
|
7
|
+
|
8
|
+
var uikit = window.UIkit || core(window, window.jQuery, window.document);
|
9
|
+
|
10
|
+
uikit.load = function(res, req, onload, config) {
|
11
|
+
|
12
|
+
var resources = res.split(','), load = [], i, base = (config.config && config.config.uikit && config.config.uikit.base ? config.config.uikit.base : "").replace(/\/+$/g, "");
|
13
|
+
|
14
|
+
if (!base) {
|
15
|
+
throw new Error( "Please define base path to UIkit in the requirejs config." );
|
16
|
+
}
|
17
|
+
|
18
|
+
for (i = 0; i < resources.length; i += 1) {
|
19
|
+
var resource = resources[i].replace(/\./g, '/');
|
20
|
+
load.push(base+'/components/'+resource);
|
21
|
+
}
|
22
|
+
|
23
|
+
req(load, function() {
|
24
|
+
onload(uikit);
|
25
|
+
});
|
26
|
+
};
|
27
|
+
|
28
|
+
return uikit;
|
29
|
+
});
|
30
|
+
}
|
31
|
+
|
32
|
+
if (!window.jQuery) {
|
33
|
+
throw new Error( "UIkit requires jQuery" );
|
34
|
+
}
|
35
|
+
|
36
|
+
if (window && window.jQuery) {
|
37
|
+
core(window, window.jQuery, window.document);
|
38
|
+
}
|
39
|
+
|
40
|
+
|
41
|
+
})(function(global, $, doc) {
|
42
|
+
|
43
|
+
"use strict";
|
44
|
+
|
45
|
+
var UI = {}, _UI = global.UIkit ? Object.create(global.UIkit) : undefined;
|
46
|
+
|
47
|
+
UI.version = '2.22.0';
|
48
|
+
|
49
|
+
UI.noConflict = function() {
|
50
|
+
// restore UIkit version
|
51
|
+
if (_UI) {
|
52
|
+
global.UIkit = _UI;
|
53
|
+
$.UIkit = _UI;
|
54
|
+
$.fn.uk = _UI.fn;
|
55
|
+
}
|
56
|
+
|
57
|
+
return UI;
|
58
|
+
};
|
59
|
+
|
60
|
+
UI.prefix = function(str) {
|
61
|
+
return str;
|
62
|
+
};
|
63
|
+
|
64
|
+
// cache jQuery
|
65
|
+
UI.$ = $;
|
66
|
+
|
67
|
+
UI.$doc = UI.$(document);
|
68
|
+
UI.$win = UI.$(window);
|
69
|
+
UI.$html = UI.$('html');
|
70
|
+
|
71
|
+
UI.support = {};
|
72
|
+
UI.support.transition = (function() {
|
73
|
+
|
74
|
+
var transitionEnd = (function() {
|
75
|
+
|
76
|
+
var element = doc.body || doc.documentElement,
|
77
|
+
transEndEventNames = {
|
78
|
+
WebkitTransition : 'webkitTransitionEnd',
|
79
|
+
MozTransition : 'transitionend',
|
80
|
+
OTransition : 'oTransitionEnd otransitionend',
|
81
|
+
transition : 'transitionend'
|
82
|
+
}, name;
|
83
|
+
|
84
|
+
for (name in transEndEventNames) {
|
85
|
+
if (element.style[name] !== undefined) return transEndEventNames[name];
|
86
|
+
}
|
87
|
+
}());
|
88
|
+
|
89
|
+
return transitionEnd && { end: transitionEnd };
|
90
|
+
})();
|
91
|
+
|
92
|
+
UI.support.animation = (function() {
|
93
|
+
|
94
|
+
var animationEnd = (function() {
|
95
|
+
|
96
|
+
var element = doc.body || doc.documentElement,
|
97
|
+
animEndEventNames = {
|
98
|
+
WebkitAnimation : 'webkitAnimationEnd',
|
99
|
+
MozAnimation : 'animationend',
|
100
|
+
OAnimation : 'oAnimationEnd oanimationend',
|
101
|
+
animation : 'animationend'
|
102
|
+
}, name;
|
103
|
+
|
104
|
+
for (name in animEndEventNames) {
|
105
|
+
if (element.style[name] !== undefined) return animEndEventNames[name];
|
106
|
+
}
|
107
|
+
}());
|
108
|
+
|
109
|
+
return animationEnd && { end: animationEnd };
|
110
|
+
})();
|
111
|
+
|
112
|
+
// requestAnimationFrame polyfill
|
113
|
+
// https://gist.github.com/paulirish/1579671
|
114
|
+
(function(){
|
115
|
+
|
116
|
+
var lastTime = 0;
|
117
|
+
|
118
|
+
global.requestAnimationFrame = global.requestAnimationFrame || global.webkitRequestAnimationFrame || function(callback, element) {
|
119
|
+
var currTime = new Date().getTime();
|
120
|
+
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
|
121
|
+
var id = global.setTimeout(function() { callback(currTime + timeToCall); }, timeToCall);
|
122
|
+
lastTime = currTime + timeToCall;
|
123
|
+
return id;
|
124
|
+
};
|
125
|
+
|
126
|
+
if (!global.cancelAnimationFrame) {
|
127
|
+
|
128
|
+
global.cancelAnimationFrame = function(id) {
|
129
|
+
clearTimeout(id);
|
130
|
+
};
|
131
|
+
}
|
132
|
+
|
133
|
+
})();
|
134
|
+
|
135
|
+
UI.support.touch = (
|
136
|
+
('ontouchstart' in document) ||
|
137
|
+
(global.DocumentTouch && document instanceof global.DocumentTouch) ||
|
138
|
+
(global.navigator.msPointerEnabled && global.navigator.msMaxTouchPoints > 0) || //IE 10
|
139
|
+
(global.navigator.pointerEnabled && global.navigator.maxTouchPoints > 0) || //IE >=11
|
140
|
+
false
|
141
|
+
);
|
142
|
+
|
143
|
+
UI.support.mutationobserver = (global.MutationObserver || global.WebKitMutationObserver || null);
|
144
|
+
|
145
|
+
UI.Utils = {};
|
146
|
+
|
147
|
+
UI.Utils.isFullscreen = function() {
|
148
|
+
return document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement || document.fullscreenElement || false;
|
149
|
+
};
|
150
|
+
|
151
|
+
UI.Utils.str2json = function(str, notevil) {
|
152
|
+
try {
|
153
|
+
if (notevil) {
|
154
|
+
return JSON.parse(str
|
155
|
+
// wrap keys without quote with valid double quote
|
156
|
+
.replace(/([\$\w]+)\s*:/g, function(_, $1){return '"'+$1+'":';})
|
157
|
+
// replacing single quote wrapped ones to double quote
|
158
|
+
.replace(/'([^']+)'/g, function(_, $1){return '"'+$1+'"';})
|
159
|
+
);
|
160
|
+
} else {
|
161
|
+
return (new Function("", "var json = " + str + "; return JSON.parse(JSON.stringify(json));"))();
|
162
|
+
}
|
163
|
+
} catch(e) { return false; }
|
164
|
+
};
|
165
|
+
|
166
|
+
UI.Utils.debounce = function(func, wait, immediate) {
|
167
|
+
var timeout;
|
168
|
+
return function() {
|
169
|
+
var context = this, args = arguments;
|
170
|
+
var later = function() {
|
171
|
+
timeout = null;
|
172
|
+
if (!immediate) func.apply(context, args);
|
173
|
+
};
|
174
|
+
var callNow = immediate && !timeout;
|
175
|
+
clearTimeout(timeout);
|
176
|
+
timeout = setTimeout(later, wait);
|
177
|
+
if (callNow) func.apply(context, args);
|
178
|
+
};
|
179
|
+
};
|
180
|
+
|
181
|
+
UI.Utils.removeCssRules = function(selectorRegEx) {
|
182
|
+
var idx, idxs, stylesheet, _i, _j, _k, _len, _len1, _len2, _ref;
|
183
|
+
|
184
|
+
if(!selectorRegEx) return;
|
185
|
+
|
186
|
+
setTimeout(function(){
|
187
|
+
try {
|
188
|
+
_ref = document.styleSheets;
|
189
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
190
|
+
stylesheet = _ref[_i];
|
191
|
+
idxs = [];
|
192
|
+
stylesheet.cssRules = stylesheet.cssRules;
|
193
|
+
for (idx = _j = 0, _len1 = stylesheet.cssRules.length; _j < _len1; idx = ++_j) {
|
194
|
+
if (stylesheet.cssRules[idx].type === CSSRule.STYLE_RULE && selectorRegEx.test(stylesheet.cssRules[idx].selectorText)) {
|
195
|
+
idxs.unshift(idx);
|
196
|
+
}
|
197
|
+
}
|
198
|
+
for (_k = 0, _len2 = idxs.length; _k < _len2; _k++) {
|
199
|
+
stylesheet.deleteRule(idxs[_k]);
|
200
|
+
}
|
201
|
+
}
|
202
|
+
} catch (_error) {}
|
203
|
+
}, 0);
|
204
|
+
};
|
205
|
+
|
206
|
+
UI.Utils.isInView = function(element, options) {
|
207
|
+
|
208
|
+
var $element = $(element);
|
209
|
+
|
210
|
+
if (!$element.is(':visible')) {
|
211
|
+
return false;
|
212
|
+
}
|
213
|
+
|
214
|
+
var window_left = UI.$win.scrollLeft(), window_top = UI.$win.scrollTop(), offset = $element.offset(), left = offset.left, top = offset.top;
|
215
|
+
|
216
|
+
options = $.extend({topoffset:0, leftoffset:0}, options);
|
217
|
+
|
218
|
+
if (top + $element.height() >= window_top && top - options.topoffset <= window_top + UI.$win.height() &&
|
219
|
+
left + $element.width() >= window_left && left - options.leftoffset <= window_left + UI.$win.width()) {
|
220
|
+
return true;
|
221
|
+
} else {
|
222
|
+
return false;
|
223
|
+
}
|
224
|
+
};
|
225
|
+
|
226
|
+
UI.Utils.checkDisplay = function(context, initanimation) {
|
227
|
+
|
228
|
+
var elements = UI.$('[data-uk-margin], [data-uk-grid-match], [data-uk-grid-margin], [data-uk-check-display]', context || document), animated;
|
229
|
+
|
230
|
+
if (context && !elements.length) {
|
231
|
+
elements = $(context);
|
232
|
+
}
|
233
|
+
|
234
|
+
elements.trigger('display.uk.check');
|
235
|
+
|
236
|
+
// fix firefox / IE animations
|
237
|
+
if (initanimation) {
|
238
|
+
|
239
|
+
if (typeof(initanimation)!='string') {
|
240
|
+
initanimation = '[class*="uk-animation-"]';
|
241
|
+
}
|
242
|
+
|
243
|
+
elements.find(initanimation).each(function(){
|
244
|
+
|
245
|
+
var ele = UI.$(this),
|
246
|
+
cls = ele.attr('class'),
|
247
|
+
anim = cls.match(/uk\-animation\-(.+)/);
|
248
|
+
|
249
|
+
ele.removeClass(anim[0]).width();
|
250
|
+
|
251
|
+
ele.addClass(anim[0]);
|
252
|
+
});
|
253
|
+
}
|
254
|
+
|
255
|
+
return elements;
|
256
|
+
};
|
257
|
+
|
258
|
+
UI.Utils.options = function(string) {
|
259
|
+
|
260
|
+
if ($.isPlainObject(string)) return string;
|
261
|
+
|
262
|
+
var start = (string ? string.indexOf("{") : -1), options = {};
|
263
|
+
|
264
|
+
if (start != -1) {
|
265
|
+
try {
|
266
|
+
options = UI.Utils.str2json(string.substr(start));
|
267
|
+
} catch (e) {}
|
268
|
+
}
|
269
|
+
|
270
|
+
return options;
|
271
|
+
};
|
272
|
+
|
273
|
+
UI.Utils.animate = function(element, cls) {
|
274
|
+
|
275
|
+
var d = $.Deferred();
|
276
|
+
|
277
|
+
element = UI.$(element);
|
278
|
+
cls = cls;
|
279
|
+
|
280
|
+
element.css('display', 'none').addClass(cls).one(UI.support.animation.end, function() {
|
281
|
+
element.removeClass(cls);
|
282
|
+
d.resolve();
|
283
|
+
}).width();
|
284
|
+
|
285
|
+
element.css('display', '');
|
286
|
+
|
287
|
+
return d.promise();
|
288
|
+
};
|
289
|
+
|
290
|
+
UI.Utils.uid = function(prefix) {
|
291
|
+
return (prefix || 'id') + (new Date().getTime())+"RAND"+(Math.ceil(Math.random() * 100000));
|
292
|
+
};
|
293
|
+
|
294
|
+
UI.Utils.template = function(str, data) {
|
295
|
+
|
296
|
+
var tokens = str.replace(/\n/g, '\\n').replace(/\{\{\{\s*(.+?)\s*\}\}\}/g, "{{!$1}}").split(/(\{\{\s*(.+?)\s*\}\})/g),
|
297
|
+
i=0, toc, cmd, prop, val, fn, output = [], openblocks = 0;
|
298
|
+
|
299
|
+
while(i < tokens.length) {
|
300
|
+
|
301
|
+
toc = tokens[i];
|
302
|
+
|
303
|
+
if(toc.match(/\{\{\s*(.+?)\s*\}\}/)) {
|
304
|
+
i = i + 1;
|
305
|
+
toc = tokens[i];
|
306
|
+
cmd = toc[0];
|
307
|
+
prop = toc.substring(toc.match(/^(\^|\#|\!|\~|\:)/) ? 1:0);
|
308
|
+
|
309
|
+
switch(cmd) {
|
310
|
+
case '~':
|
311
|
+
output.push("for(var $i=0;$i<"+prop+".length;$i++) { var $item = "+prop+"[$i];");
|
312
|
+
openblocks++;
|
313
|
+
break;
|
314
|
+
case ':':
|
315
|
+
output.push("for(var $key in "+prop+") { var $val = "+prop+"[$key];");
|
316
|
+
openblocks++;
|
317
|
+
break;
|
318
|
+
case '#':
|
319
|
+
output.push("if("+prop+") {");
|
320
|
+
openblocks++;
|
321
|
+
break;
|
322
|
+
case '^':
|
323
|
+
output.push("if(!"+prop+") {");
|
324
|
+
openblocks++;
|
325
|
+
break;
|
326
|
+
case '/':
|
327
|
+
output.push("}");
|
328
|
+
openblocks--;
|
329
|
+
break;
|
330
|
+
case '!':
|
331
|
+
output.push("__ret.push("+prop+");");
|
332
|
+
break;
|
333
|
+
default:
|
334
|
+
output.push("__ret.push(escape("+prop+"));");
|
335
|
+
break;
|
336
|
+
}
|
337
|
+
} else {
|
338
|
+
output.push("__ret.push('"+toc.replace(/\'/g, "\\'")+"');");
|
339
|
+
}
|
340
|
+
i = i + 1;
|
341
|
+
}
|
342
|
+
|
343
|
+
fn = new Function('$data', [
|
344
|
+
'var __ret = [];',
|
345
|
+
'try {',
|
346
|
+
'with($data){', (!openblocks ? output.join('') : '__ret = ["Not all blocks are closed correctly."]'), '};',
|
347
|
+
'}catch(e){__ret = [e.message];}',
|
348
|
+
'return __ret.join("").replace(/\\n\\n/g, "\\n");',
|
349
|
+
"function escape(html) { return String(html).replace(/&/g, '&').replace(/\"/g, '"').replace(/</g, '<').replace(/>/g, '>');}"
|
350
|
+
].join("\n"));
|
351
|
+
|
352
|
+
return data ? fn(data) : fn;
|
353
|
+
};
|
354
|
+
|
355
|
+
UI.Utils.events = {};
|
356
|
+
UI.Utils.events.click = UI.support.touch ? 'tap' : 'click';
|
357
|
+
|
358
|
+
global.UIkit = UI;
|
359
|
+
|
360
|
+
// deprecated
|
361
|
+
|
362
|
+
UI.fn = function(command, options) {
|
363
|
+
|
364
|
+
var args = arguments, cmd = command.match(/^([a-z\-]+)(?:\.([a-z]+))?/i), component = cmd[1], method = cmd[2];
|
365
|
+
|
366
|
+
if (!UI[component]) {
|
367
|
+
$.error("UIkit component [" + component + "] does not exist.");
|
368
|
+
return this;
|
369
|
+
}
|
370
|
+
|
371
|
+
return this.each(function() {
|
372
|
+
var $this = $(this), data = $this.data(component);
|
373
|
+
if (!data) $this.data(component, (data = UI[component](this, method ? undefined : options)));
|
374
|
+
if (method) data[method].apply(data, Array.prototype.slice.call(args, 1));
|
375
|
+
});
|
376
|
+
};
|
377
|
+
|
378
|
+
$.UIkit = UI;
|
379
|
+
$.fn.uk = UI.fn;
|
380
|
+
|
381
|
+
UI.langdirection = UI.$html.attr("dir") == "rtl" ? "right" : "left";
|
382
|
+
|
383
|
+
UI.components = {};
|
384
|
+
|
385
|
+
UI.component = function(name, def) {
|
386
|
+
|
387
|
+
var fn = function(element, options) {
|
388
|
+
|
389
|
+
var $this = this;
|
390
|
+
|
391
|
+
this.UIkit = UI;
|
392
|
+
this.element = element ? UI.$(element) : null;
|
393
|
+
this.options = $.extend(true, {}, this.defaults, options);
|
394
|
+
this.plugins = {};
|
395
|
+
|
396
|
+
if (this.element) {
|
397
|
+
this.element.data(name, this);
|
398
|
+
}
|
399
|
+
|
400
|
+
this.init();
|
401
|
+
|
402
|
+
(this.options.plugins.length ? this.options.plugins : Object.keys(fn.plugins)).forEach(function(plugin) {
|
403
|
+
|
404
|
+
if (fn.plugins[plugin].init) {
|
405
|
+
fn.plugins[plugin].init($this);
|
406
|
+
$this.plugins[plugin] = true;
|
407
|
+
}
|
408
|
+
|
409
|
+
});
|
410
|
+
|
411
|
+
this.trigger('init.uk.component', [name, this]);
|
412
|
+
|
413
|
+
return this;
|
414
|
+
};
|
415
|
+
|
416
|
+
fn.plugins = {};
|
417
|
+
|
418
|
+
$.extend(true, fn.prototype, {
|
419
|
+
|
420
|
+
defaults : {plugins: []},
|
421
|
+
|
422
|
+
boot: function(){},
|
423
|
+
init: function(){},
|
424
|
+
|
425
|
+
on: function(a1,a2,a3){
|
426
|
+
return UI.$(this.element || this).on(a1,a2,a3);
|
427
|
+
},
|
428
|
+
|
429
|
+
one: function(a1,a2,a3){
|
430
|
+
return UI.$(this.element || this).one(a1,a2,a3);
|
431
|
+
},
|
432
|
+
|
433
|
+
off: function(evt){
|
434
|
+
return UI.$(this.element || this).off(evt);
|
435
|
+
},
|
436
|
+
|
437
|
+
trigger: function(evt, params) {
|
438
|
+
return UI.$(this.element || this).trigger(evt, params);
|
439
|
+
},
|
440
|
+
|
441
|
+
find: function(selector) {
|
442
|
+
return UI.$(this.element ? this.element: []).find(selector);
|
443
|
+
},
|
444
|
+
|
445
|
+
proxy: function(obj, methods) {
|
446
|
+
|
447
|
+
var $this = this;
|
448
|
+
|
449
|
+
methods.split(' ').forEach(function(method) {
|
450
|
+
if (!$this[method]) $this[method] = function() { return obj[method].apply(obj, arguments); };
|
451
|
+
});
|
452
|
+
},
|
453
|
+
|
454
|
+
mixin: function(obj, methods) {
|
455
|
+
|
456
|
+
var $this = this;
|
457
|
+
|
458
|
+
methods.split(' ').forEach(function(method) {
|
459
|
+
if (!$this[method]) $this[method] = obj[method].bind($this);
|
460
|
+
});
|
461
|
+
},
|
462
|
+
|
463
|
+
option: function() {
|
464
|
+
|
465
|
+
if (arguments.length == 1) {
|
466
|
+
return this.options[arguments[0]] || undefined;
|
467
|
+
} else if (arguments.length == 2) {
|
468
|
+
this.options[arguments[0]] = arguments[1];
|
469
|
+
}
|
470
|
+
}
|
471
|
+
|
472
|
+
}, def);
|
473
|
+
|
474
|
+
this.components[name] = fn;
|
475
|
+
|
476
|
+
this[name] = function() {
|
477
|
+
|
478
|
+
var element, options;
|
479
|
+
|
480
|
+
if (arguments.length) {
|
481
|
+
|
482
|
+
switch(arguments.length) {
|
483
|
+
case 1:
|
484
|
+
|
485
|
+
if (typeof arguments[0] === "string" || arguments[0].nodeType || arguments[0] instanceof jQuery) {
|
486
|
+
element = $(arguments[0]);
|
487
|
+
} else {
|
488
|
+
options = arguments[0];
|
489
|
+
}
|
490
|
+
|
491
|
+
break;
|
492
|
+
case 2:
|
493
|
+
|
494
|
+
element = $(arguments[0]);
|
495
|
+
options = arguments[1];
|
496
|
+
break;
|
497
|
+
}
|
498
|
+
}
|
499
|
+
|
500
|
+
if (element && element.data(name)) {
|
501
|
+
return element.data(name);
|
502
|
+
}
|
503
|
+
|
504
|
+
return (new UI.components[name](element, options));
|
505
|
+
};
|
506
|
+
|
507
|
+
if (UI.domready) {
|
508
|
+
UI.component.boot(name);
|
509
|
+
}
|
510
|
+
|
511
|
+
return fn;
|
512
|
+
};
|
513
|
+
|
514
|
+
UI.plugin = function(component, name, def) {
|
515
|
+
this.components[component].plugins[name] = def;
|
516
|
+
};
|
517
|
+
|
518
|
+
UI.component.boot = function(name) {
|
519
|
+
|
520
|
+
if (UI.components[name].prototype && UI.components[name].prototype.boot && !UI.components[name].booted) {
|
521
|
+
UI.components[name].prototype.boot.apply(UI, []);
|
522
|
+
UI.components[name].booted = true;
|
523
|
+
}
|
524
|
+
};
|
525
|
+
|
526
|
+
UI.component.bootComponents = function() {
|
527
|
+
|
528
|
+
for (var component in UI.components) {
|
529
|
+
UI.component.boot(component);
|
530
|
+
}
|
531
|
+
};
|
532
|
+
|
533
|
+
|
534
|
+
// DOM mutation save ready helper function
|
535
|
+
|
536
|
+
UI.domObservers = [];
|
537
|
+
UI.domready = false;
|
538
|
+
|
539
|
+
UI.ready = function(fn) {
|
540
|
+
|
541
|
+
UI.domObservers.push(fn);
|
542
|
+
|
543
|
+
if (UI.domready) {
|
544
|
+
fn(document);
|
545
|
+
}
|
546
|
+
};
|
547
|
+
|
548
|
+
UI.on = function(a1,a2,a3){
|
549
|
+
|
550
|
+
if (a1 && a1.indexOf('ready.uk.dom') > -1 && UI.domready) {
|
551
|
+
a2.apply(UI.$doc);
|
552
|
+
}
|
553
|
+
|
554
|
+
return UI.$doc.on(a1,a2,a3);
|
555
|
+
};
|
556
|
+
|
557
|
+
UI.one = function(a1,a2,a3){
|
558
|
+
|
559
|
+
if (a1 && a1.indexOf('ready.uk.dom') > -1 && UI.domready) {
|
560
|
+
a2.apply(UI.$doc);
|
561
|
+
return UI.$doc;
|
562
|
+
}
|
563
|
+
|
564
|
+
return UI.$doc.one(a1,a2,a3);
|
565
|
+
};
|
566
|
+
|
567
|
+
UI.trigger = function(evt, params) {
|
568
|
+
return UI.$doc.trigger(evt, params);
|
569
|
+
};
|
570
|
+
|
571
|
+
UI.domObserve = function(selector, fn) {
|
572
|
+
|
573
|
+
if(!UI.support.mutationobserver) return;
|
574
|
+
|
575
|
+
fn = fn || function() {};
|
576
|
+
|
577
|
+
UI.$(selector).each(function() {
|
578
|
+
|
579
|
+
var element = this,
|
580
|
+
$element = UI.$(element);
|
581
|
+
|
582
|
+
if ($element.data('observer')) {
|
583
|
+
return;
|
584
|
+
}
|
585
|
+
|
586
|
+
try {
|
587
|
+
|
588
|
+
var observer = new UI.support.mutationobserver(UI.Utils.debounce(function(mutations) {
|
589
|
+
fn.apply(element, []);
|
590
|
+
$element.trigger('changed.uk.dom');
|
591
|
+
}, 50));
|
592
|
+
|
593
|
+
// pass in the target node, as well as the observer options
|
594
|
+
observer.observe(element, { childList: true, subtree: true });
|
595
|
+
|
596
|
+
$element.data('observer', observer);
|
597
|
+
|
598
|
+
} catch(e) {}
|
599
|
+
});
|
600
|
+
};
|
601
|
+
|
602
|
+
UI.init = function(root) {
|
603
|
+
|
604
|
+
root = root || document;
|
605
|
+
|
606
|
+
UI.domObservers.forEach(function(fn){
|
607
|
+
fn(root);
|
608
|
+
});
|
609
|
+
};
|
610
|
+
|
611
|
+
UI.on('domready.uk.dom', function(){
|
612
|
+
|
613
|
+
UI.init();
|
614
|
+
|
615
|
+
if (UI.domready) UI.Utils.checkDisplay();
|
616
|
+
});
|
617
|
+
|
618
|
+
$(function(){
|
619
|
+
|
620
|
+
UI.$body = UI.$('body');
|
621
|
+
|
622
|
+
UI.ready(function(context){
|
623
|
+
UI.domObserve('[data-uk-observe]');
|
624
|
+
});
|
625
|
+
|
626
|
+
UI.on('changed.uk.dom', function(e) {
|
627
|
+
UI.init(e.target);
|
628
|
+
UI.Utils.checkDisplay(e.target);
|
629
|
+
});
|
630
|
+
|
631
|
+
UI.trigger('beforeready.uk.dom');
|
632
|
+
|
633
|
+
UI.component.bootComponents();
|
634
|
+
|
635
|
+
// custom scroll observer
|
636
|
+
setInterval((function(){
|
637
|
+
|
638
|
+
var memory = {x: window.pageXOffset, y:window.pageYOffset}, dir;
|
639
|
+
|
640
|
+
var fn = function(){
|
641
|
+
|
642
|
+
if (memory.x != window.pageXOffset || memory.y != window.pageYOffset) {
|
643
|
+
|
644
|
+
dir = {x: 0 , y: 0};
|
645
|
+
|
646
|
+
if (window.pageXOffset != memory.x) dir.x = window.pageXOffset > memory.x ? 1:-1;
|
647
|
+
if (window.pageYOffset != memory.y) dir.y = window.pageYOffset > memory.y ? 1:-1;
|
648
|
+
|
649
|
+
memory = {
|
650
|
+
"dir": dir, "x": window.pageXOffset, "y": window.pageYOffset
|
651
|
+
};
|
652
|
+
|
653
|
+
UI.$doc.trigger('scrolling.uk.document', [memory]);
|
654
|
+
}
|
655
|
+
};
|
656
|
+
|
657
|
+
if (UI.support.touch) {
|
658
|
+
UI.$html.on('touchmove touchend MSPointerMove MSPointerUp pointermove pointerup', fn);
|
659
|
+
}
|
660
|
+
|
661
|
+
if (memory.x || memory.y) fn();
|
662
|
+
|
663
|
+
return fn;
|
664
|
+
|
665
|
+
})(), 15);
|
666
|
+
|
667
|
+
// run component init functions on dom
|
668
|
+
UI.trigger('domready.uk.dom');
|
669
|
+
|
670
|
+
if (UI.support.touch) {
|
671
|
+
|
672
|
+
// remove css hover rules for touch devices
|
673
|
+
// UI.Utils.removeCssRules(/\.uk-(?!navbar).*:hover/);
|
674
|
+
|
675
|
+
// viewport unit fix for uk-height-viewport - should be fixed in iOS 8
|
676
|
+
if (navigator.userAgent.match(/(iPad|iPhone|iPod)/g)) {
|
677
|
+
|
678
|
+
UI.$win.on('load orientationchange resize', UI.Utils.debounce((function(){
|
679
|
+
|
680
|
+
var fn = function() {
|
681
|
+
$('.uk-height-viewport').css('height', window.innerHeight);
|
682
|
+
return fn;
|
683
|
+
};
|
684
|
+
|
685
|
+
return fn();
|
686
|
+
|
687
|
+
})(), 100));
|
688
|
+
}
|
689
|
+
}
|
690
|
+
|
691
|
+
UI.trigger('afterready.uk.dom');
|
692
|
+
|
693
|
+
// mark that domready is left behind
|
694
|
+
UI.domready = true;
|
695
|
+
});
|
696
|
+
|
697
|
+
// add touch identifier class
|
698
|
+
UI.$html.addClass(UI.support.touch ? "uk-touch" : "uk-notouch");
|
699
|
+
|
700
|
+
// add uk-hover class on tap to support overlays on touch devices
|
701
|
+
if (UI.support.touch) {
|
702
|
+
|
703
|
+
var hoverset = false,
|
704
|
+
exclude,
|
705
|
+
hovercls = 'uk-hover',
|
706
|
+
selector = '.uk-overlay, .uk-overlay-hover, .uk-overlay-toggle, .uk-animation-hover, .uk-has-hover';
|
707
|
+
|
708
|
+
UI.$html.on('mouseenter touchstart MSPointerDown pointerdown', selector, function() {
|
709
|
+
|
710
|
+
if (hoverset) $('.'+hovercls).removeClass(hovercls);
|
711
|
+
|
712
|
+
hoverset = $(this).addClass(hovercls);
|
713
|
+
|
714
|
+
}).on('mouseleave touchend MSPointerUp pointerup', function(e) {
|
715
|
+
|
716
|
+
exclude = $(e.target).parents(selector);
|
717
|
+
|
718
|
+
if (hoverset) {
|
719
|
+
hoverset.not(exclude).removeClass(hovercls);
|
720
|
+
}
|
721
|
+
});
|
722
|
+
}
|
723
|
+
|
724
|
+
return UI;
|
725
|
+
});
|
726
|
+
|
727
|
+
// Based on Zeptos touch.js
|
728
|
+
// https://raw.github.com/madrobby/zepto/master/src/touch.js
|
729
|
+
// Zepto.js may be freely distributed under the MIT license.
|
730
|
+
|
731
|
+
;(function($){
|
732
|
+
|
733
|
+
if ($.fn.swipeLeft) {
|
734
|
+
return;
|
735
|
+
}
|
736
|
+
|
737
|
+
|
738
|
+
var touch = {}, touchTimeout, tapTimeout, swipeTimeout, longTapTimeout, longTapDelay = 750, gesture;
|
739
|
+
|
740
|
+
function swipeDirection(x1, x2, y1, y2) {
|
741
|
+
return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down');
|
742
|
+
}
|
743
|
+
|
744
|
+
function longTap() {
|
745
|
+
longTapTimeout = null;
|
746
|
+
if (touch.last) {
|
747
|
+
touch.el.trigger('longTap');
|
748
|
+
touch = {};
|
749
|
+
}
|
750
|
+
}
|
751
|
+
|
752
|
+
function cancelLongTap() {
|
753
|
+
if (longTapTimeout) clearTimeout(longTapTimeout);
|
754
|
+
longTapTimeout = null;
|
755
|
+
}
|
756
|
+
|
757
|
+
function cancelAll() {
|
758
|
+
if (touchTimeout) clearTimeout(touchTimeout);
|
759
|
+
if (tapTimeout) clearTimeout(tapTimeout);
|
760
|
+
if (swipeTimeout) clearTimeout(swipeTimeout);
|
761
|
+
if (longTapTimeout) clearTimeout(longTapTimeout);
|
762
|
+
touchTimeout = tapTimeout = swipeTimeout = longTapTimeout = null;
|
763
|
+
touch = {};
|
764
|
+
}
|
765
|
+
|
766
|
+
function isPrimaryTouch(event){
|
767
|
+
return event.pointerType == event.MSPOINTER_TYPE_TOUCH && event.isPrimary;
|
768
|
+
}
|
769
|
+
|
770
|
+
$(function(){
|
771
|
+
var now, delta, deltaX = 0, deltaY = 0, firstTouch;
|
772
|
+
|
773
|
+
if ('MSGesture' in window) {
|
774
|
+
gesture = new MSGesture();
|
775
|
+
gesture.target = document.body;
|
776
|
+
}
|
777
|
+
|
778
|
+
$(document)
|
779
|
+
.on('MSGestureEnd gestureend', function(e){
|
780
|
+
|
781
|
+
var swipeDirectionFromVelocity = e.originalEvent.velocityX > 1 ? 'Right' : e.originalEvent.velocityX < -1 ? 'Left' : e.originalEvent.velocityY > 1 ? 'Down' : e.originalEvent.velocityY < -1 ? 'Up' : null;
|
782
|
+
|
783
|
+
if (swipeDirectionFromVelocity) {
|
784
|
+
touch.el.trigger('swipe');
|
785
|
+
touch.el.trigger('swipe'+ swipeDirectionFromVelocity);
|
786
|
+
}
|
787
|
+
})
|
788
|
+
// MSPointerDown: for IE10
|
789
|
+
// pointerdown: for IE11
|
790
|
+
.on('touchstart MSPointerDown pointerdown', function(e){
|
791
|
+
|
792
|
+
if(e.type == 'MSPointerDown' && !isPrimaryTouch(e.originalEvent)) return;
|
793
|
+
|
794
|
+
firstTouch = (e.type == 'MSPointerDown' || e.type == 'pointerdown') ? e : e.originalEvent.touches[0];
|
795
|
+
|
796
|
+
now = Date.now();
|
797
|
+
delta = now - (touch.last || now);
|
798
|
+
touch.el = $('tagName' in firstTouch.target ? firstTouch.target : firstTouch.target.parentNode);
|
799
|
+
|
800
|
+
if(touchTimeout) clearTimeout(touchTimeout);
|
801
|
+
|
802
|
+
touch.x1 = firstTouch.pageX;
|
803
|
+
touch.y1 = firstTouch.pageY;
|
804
|
+
|
805
|
+
if (delta > 0 && delta <= 250) touch.isDoubleTap = true;
|
806
|
+
|
807
|
+
touch.last = now;
|
808
|
+
longTapTimeout = setTimeout(longTap, longTapDelay);
|
809
|
+
|
810
|
+
// adds the current touch contact for IE gesture recognition
|
811
|
+
if (gesture && ( e.type == 'MSPointerDown' || e.type == 'pointerdown' || e.type == 'touchstart' ) ) {
|
812
|
+
gesture.addPointer(e.originalEvent.pointerId);
|
813
|
+
}
|
814
|
+
|
815
|
+
})
|
816
|
+
// MSPointerMove: for IE10
|
817
|
+
// pointermove: for IE11
|
818
|
+
.on('touchmove MSPointerMove pointermove', function(e){
|
819
|
+
|
820
|
+
if (e.type == 'MSPointerMove' && !isPrimaryTouch(e.originalEvent)) return;
|
821
|
+
|
822
|
+
firstTouch = (e.type == 'MSPointerMove' || e.type == 'pointermove') ? e : e.originalEvent.touches[0];
|
823
|
+
|
824
|
+
cancelLongTap();
|
825
|
+
touch.x2 = firstTouch.pageX;
|
826
|
+
touch.y2 = firstTouch.pageY;
|
827
|
+
|
828
|
+
deltaX += Math.abs(touch.x1 - touch.x2);
|
829
|
+
deltaY += Math.abs(touch.y1 - touch.y2);
|
830
|
+
})
|
831
|
+
// MSPointerUp: for IE10
|
832
|
+
// pointerup: for IE11
|
833
|
+
.on('touchend MSPointerUp pointerup', function(e){
|
834
|
+
|
835
|
+
if (e.type == 'MSPointerUp' && !isPrimaryTouch(e.originalEvent)) return;
|
836
|
+
|
837
|
+
cancelLongTap();
|
838
|
+
|
839
|
+
// swipe
|
840
|
+
if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > 30) || (touch.y2 && Math.abs(touch.y1 - touch.y2) > 30)){
|
841
|
+
|
842
|
+
swipeTimeout = setTimeout(function() {
|
843
|
+
touch.el.trigger('swipe');
|
844
|
+
touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2)));
|
845
|
+
touch = {};
|
846
|
+
}, 0);
|
847
|
+
|
848
|
+
// normal tap
|
849
|
+
} else if ('last' in touch) {
|
850
|
+
|
851
|
+
// don't fire tap when delta position changed by more than 30 pixels,
|
852
|
+
// for instance when moving to a point and back to origin
|
853
|
+
if (isNaN(deltaX) || (deltaX < 30 && deltaY < 30)) {
|
854
|
+
// delay by one tick so we can cancel the 'tap' event if 'scroll' fires
|
855
|
+
// ('tap' fires before 'scroll')
|
856
|
+
tapTimeout = setTimeout(function() {
|
857
|
+
|
858
|
+
// trigger universal 'tap' with the option to cancelTouch()
|
859
|
+
// (cancelTouch cancels processing of single vs double taps for faster 'tap' response)
|
860
|
+
var event = $.Event('tap');
|
861
|
+
event.cancelTouch = cancelAll;
|
862
|
+
touch.el.trigger(event);
|
863
|
+
|
864
|
+
// trigger double tap immediately
|
865
|
+
if (touch.isDoubleTap) {
|
866
|
+
touch.el.trigger('doubleTap');
|
867
|
+
touch = {};
|
868
|
+
}
|
869
|
+
|
870
|
+
// trigger single tap after 250ms of inactivity
|
871
|
+
else {
|
872
|
+
touchTimeout = setTimeout(function(){
|
873
|
+
touchTimeout = null;
|
874
|
+
touch.el.trigger('singleTap');
|
875
|
+
touch = {};
|
876
|
+
}, 250);
|
877
|
+
}
|
878
|
+
}, 0);
|
879
|
+
} else {
|
880
|
+
touch = {};
|
881
|
+
}
|
882
|
+
deltaX = deltaY = 0;
|
883
|
+
}
|
884
|
+
})
|
885
|
+
// when the browser window loses focus,
|
886
|
+
// for example when a modal dialog is shown,
|
887
|
+
// cancel all ongoing events
|
888
|
+
.on('touchcancel MSPointerCancel', cancelAll);
|
889
|
+
|
890
|
+
// scrolling the window indicates intention of the user
|
891
|
+
// to scroll, not tap or swipe, so cancel all ongoing events
|
892
|
+
$(window).on('scroll', cancelAll);
|
893
|
+
});
|
894
|
+
|
895
|
+
['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown', 'doubleTap', 'tap', 'singleTap', 'longTap'].forEach(function(eventName){
|
896
|
+
$.fn[eventName] = function(callback){ return $(this).on(eventName, callback); };
|
897
|
+
});
|
898
|
+
})(jQuery);
|
899
|
+
|
900
|
+
(function(UI) {
|
901
|
+
|
902
|
+
"use strict";
|
903
|
+
|
904
|
+
var stacks = [];
|
905
|
+
|
906
|
+
UI.component('stackMargin', {
|
907
|
+
|
908
|
+
defaults: {
|
909
|
+
'cls': 'uk-margin-small-top'
|
910
|
+
},
|
911
|
+
|
912
|
+
boot: function() {
|
913
|
+
|
914
|
+
// init code
|
915
|
+
UI.ready(function(context) {
|
916
|
+
|
917
|
+
UI.$("[data-uk-margin]", context).each(function() {
|
918
|
+
|
919
|
+
var ele = UI.$(this), obj;
|
920
|
+
|
921
|
+
if (!ele.data("stackMargin")) {
|
922
|
+
obj = UI.stackMargin(ele, UI.Utils.options(ele.attr("data-uk-margin")));
|
923
|
+
}
|
924
|
+
});
|
925
|
+
});
|
926
|
+
},
|
927
|
+
|
928
|
+
init: function() {
|
929
|
+
|
930
|
+
var $this = this;
|
931
|
+
|
932
|
+
this.columns = [];
|
933
|
+
|
934
|
+
UI.$win.on('resize orientationchange', (function() {
|
935
|
+
|
936
|
+
var fn = function() {
|
937
|
+
$this.process();
|
938
|
+
};
|
939
|
+
|
940
|
+
UI.$(function() {
|
941
|
+
fn();
|
942
|
+
UI.$win.on("load", fn);
|
943
|
+
});
|
944
|
+
|
945
|
+
return UI.Utils.debounce(fn, 20);
|
946
|
+
})());
|
947
|
+
|
948
|
+
UI.$html.on("changed.uk.dom", function(e) {
|
949
|
+
$this.process();
|
950
|
+
});
|
951
|
+
|
952
|
+
this.on("display.uk.check", function(e) {
|
953
|
+
if (this.element.is(":visible")) this.process();
|
954
|
+
}.bind(this));
|
955
|
+
|
956
|
+
stacks.push(this);
|
957
|
+
},
|
958
|
+
|
959
|
+
process: function() {
|
960
|
+
|
961
|
+
this.columns = this.element.children();
|
962
|
+
|
963
|
+
UI.Utils.stackMargin(this.columns, this.options);
|
964
|
+
|
965
|
+
return this;
|
966
|
+
},
|
967
|
+
|
968
|
+
revert: function() {
|
969
|
+
this.columns.removeClass(this.options.cls);
|
970
|
+
return this;
|
971
|
+
}
|
972
|
+
});
|
973
|
+
|
974
|
+
|
975
|
+
// responsive element e.g. iframes
|
976
|
+
|
977
|
+
(function(){
|
978
|
+
|
979
|
+
var elements = [], check = function(ele) {
|
980
|
+
|
981
|
+
if (!ele.is(':visible')) return;
|
982
|
+
|
983
|
+
var width = ele.parent().width(),
|
984
|
+
iwidth = ele.data('width'),
|
985
|
+
ratio = (width / iwidth),
|
986
|
+
height = Math.floor(ratio * ele.data('height'));
|
987
|
+
|
988
|
+
ele.css({'height': (width < iwidth) ? height : ele.data('height')});
|
989
|
+
};
|
990
|
+
|
991
|
+
UI.component('responsiveElement', {
|
992
|
+
|
993
|
+
defaults: {},
|
994
|
+
|
995
|
+
boot: function() {
|
996
|
+
|
997
|
+
// init code
|
998
|
+
UI.ready(function(context) {
|
999
|
+
|
1000
|
+
UI.$("iframe.uk-responsive-width, [data-uk-responsive]", context).each(function() {
|
1001
|
+
|
1002
|
+
var ele = UI.$(this), obj;
|
1003
|
+
|
1004
|
+
if (!ele.data("responsiveIframe")) {
|
1005
|
+
obj = UI.responsiveElement(ele, {});
|
1006
|
+
}
|
1007
|
+
});
|
1008
|
+
});
|
1009
|
+
},
|
1010
|
+
|
1011
|
+
init: function() {
|
1012
|
+
|
1013
|
+
var ele = this.element;
|
1014
|
+
|
1015
|
+
if (ele.attr('width') && ele.attr('height')) {
|
1016
|
+
|
1017
|
+
ele.data({
|
1018
|
+
|
1019
|
+
'width' : ele.attr('width'),
|
1020
|
+
'height': ele.attr('height')
|
1021
|
+
|
1022
|
+
}).on('display.uk.check', function(){
|
1023
|
+
check(ele);
|
1024
|
+
});
|
1025
|
+
|
1026
|
+
check(ele);
|
1027
|
+
|
1028
|
+
elements.push(ele);
|
1029
|
+
}
|
1030
|
+
}
|
1031
|
+
});
|
1032
|
+
|
1033
|
+
UI.$win.on('resize load', UI.Utils.debounce(function(){
|
1034
|
+
|
1035
|
+
elements.forEach(function(ele){
|
1036
|
+
check(ele);
|
1037
|
+
});
|
1038
|
+
|
1039
|
+
}, 15));
|
1040
|
+
|
1041
|
+
})();
|
1042
|
+
|
1043
|
+
|
1044
|
+
|
1045
|
+
// helper
|
1046
|
+
|
1047
|
+
UI.Utils.stackMargin = function(elements, options) {
|
1048
|
+
|
1049
|
+
options = UI.$.extend({
|
1050
|
+
'cls': 'uk-margin-small-top'
|
1051
|
+
}, options);
|
1052
|
+
|
1053
|
+
options.cls = options.cls;
|
1054
|
+
|
1055
|
+
elements = UI.$(elements).removeClass(options.cls);
|
1056
|
+
|
1057
|
+
var skip = false,
|
1058
|
+
firstvisible = elements.filter(":visible:first"),
|
1059
|
+
offset = firstvisible.length ? (firstvisible.position().top + firstvisible.outerHeight()) - 1 : false; // (-1): weird firefox bug when parent container is display:flex
|
1060
|
+
|
1061
|
+
if (offset === false) return;
|
1062
|
+
|
1063
|
+
elements.each(function() {
|
1064
|
+
|
1065
|
+
var column = UI.$(this);
|
1066
|
+
|
1067
|
+
if (column.is(":visible")) {
|
1068
|
+
|
1069
|
+
if (skip) {
|
1070
|
+
column.addClass(options.cls);
|
1071
|
+
} else {
|
1072
|
+
|
1073
|
+
if (column.position().top >= offset) {
|
1074
|
+
skip = column.addClass(options.cls);
|
1075
|
+
}
|
1076
|
+
}
|
1077
|
+
}
|
1078
|
+
});
|
1079
|
+
};
|
1080
|
+
|
1081
|
+
UI.Utils.matchHeights = function(elements, options) {
|
1082
|
+
|
1083
|
+
elements = UI.$(elements).css('min-height', '');
|
1084
|
+
options = UI.$.extend({ row : true }, options);
|
1085
|
+
|
1086
|
+
var matchHeights = function(group){
|
1087
|
+
|
1088
|
+
if (group.length < 2) return;
|
1089
|
+
|
1090
|
+
var max = 0;
|
1091
|
+
|
1092
|
+
group.each(function() {
|
1093
|
+
max = Math.max(max, UI.$(this).outerHeight());
|
1094
|
+
}).each(function() {
|
1095
|
+
|
1096
|
+
var element = UI.$(this),
|
1097
|
+
height = max - (element.css('box-sizing') == 'border-box' ? 0 : (element.outerHeight() - element.height()));
|
1098
|
+
|
1099
|
+
element.css('min-height', height + 'px');
|
1100
|
+
});
|
1101
|
+
};
|
1102
|
+
|
1103
|
+
if (options.row) {
|
1104
|
+
|
1105
|
+
elements.first().width(); // force redraw
|
1106
|
+
|
1107
|
+
setTimeout(function(){
|
1108
|
+
|
1109
|
+
var lastoffset = false, group = [];
|
1110
|
+
|
1111
|
+
elements.each(function() {
|
1112
|
+
|
1113
|
+
var ele = UI.$(this), offset = ele.offset().top;
|
1114
|
+
|
1115
|
+
if (offset != lastoffset && group.length) {
|
1116
|
+
|
1117
|
+
matchHeights(UI.$(group));
|
1118
|
+
group = [];
|
1119
|
+
offset = ele.offset().top;
|
1120
|
+
}
|
1121
|
+
|
1122
|
+
group.push(ele);
|
1123
|
+
lastoffset = offset;
|
1124
|
+
});
|
1125
|
+
|
1126
|
+
if (group.length) {
|
1127
|
+
matchHeights(UI.$(group));
|
1128
|
+
}
|
1129
|
+
|
1130
|
+
}, 0);
|
1131
|
+
|
1132
|
+
} else {
|
1133
|
+
matchHeights(elements);
|
1134
|
+
}
|
1135
|
+
};
|
1136
|
+
|
1137
|
+
})(UIkit);
|
1138
|
+
|
1139
|
+
(function(UI) {
|
1140
|
+
|
1141
|
+
"use strict";
|
1142
|
+
|
1143
|
+
UI.component('smoothScroll', {
|
1144
|
+
|
1145
|
+
boot: function() {
|
1146
|
+
|
1147
|
+
// init code
|
1148
|
+
UI.$html.on("click.smooth-scroll.uikit", "[data-uk-smooth-scroll]", function(e) {
|
1149
|
+
var ele = UI.$(this);
|
1150
|
+
|
1151
|
+
if (!ele.data("smoothScroll")) {
|
1152
|
+
var obj = UI.smoothScroll(ele, UI.Utils.options(ele.attr("data-uk-smooth-scroll")));
|
1153
|
+
ele.trigger("click");
|
1154
|
+
}
|
1155
|
+
|
1156
|
+
return false;
|
1157
|
+
});
|
1158
|
+
},
|
1159
|
+
|
1160
|
+
init: function() {
|
1161
|
+
|
1162
|
+
var $this = this;
|
1163
|
+
|
1164
|
+
this.on("click", function(e) {
|
1165
|
+
e.preventDefault();
|
1166
|
+
scrollToElement(UI.$(this.hash).length ? UI.$(this.hash) : UI.$("body"), $this.options);
|
1167
|
+
});
|
1168
|
+
}
|
1169
|
+
});
|
1170
|
+
|
1171
|
+
function scrollToElement(ele, options) {
|
1172
|
+
|
1173
|
+
options = UI.$.extend({
|
1174
|
+
duration: 1000,
|
1175
|
+
transition: 'easeOutExpo',
|
1176
|
+
offset: 0,
|
1177
|
+
complete: function(){}
|
1178
|
+
}, options);
|
1179
|
+
|
1180
|
+
// get / set parameters
|
1181
|
+
var target = ele.offset().top - options.offset,
|
1182
|
+
docheight = UI.$doc.height(),
|
1183
|
+
winheight = window.innerHeight;
|
1184
|
+
|
1185
|
+
if ((target + winheight) > docheight) {
|
1186
|
+
target = docheight - winheight;
|
1187
|
+
}
|
1188
|
+
|
1189
|
+
// animate to target, fire callback when done
|
1190
|
+
UI.$("html,body").stop().animate({scrollTop: target}, options.duration, options.transition).promise().done(options.complete);
|
1191
|
+
}
|
1192
|
+
|
1193
|
+
UI.Utils.scrollToElement = scrollToElement;
|
1194
|
+
|
1195
|
+
if (!UI.$.easing.easeOutExpo) {
|
1196
|
+
UI.$.easing.easeOutExpo = function(x, t, b, c, d) { return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; };
|
1197
|
+
}
|
1198
|
+
|
1199
|
+
})(UIkit);
|
1200
|
+
|
1201
|
+
(function(UI) {
|
1202
|
+
|
1203
|
+
"use strict";
|
1204
|
+
|
1205
|
+
var $win = UI.$win,
|
1206
|
+
$doc = UI.$doc,
|
1207
|
+
scrollspies = [],
|
1208
|
+
checkScrollSpy = function() {
|
1209
|
+
for(var i=0; i < scrollspies.length; i++) {
|
1210
|
+
window.requestAnimationFrame.apply(window, [scrollspies[i].check]);
|
1211
|
+
}
|
1212
|
+
};
|
1213
|
+
|
1214
|
+
UI.component('scrollspy', {
|
1215
|
+
|
1216
|
+
defaults: {
|
1217
|
+
"target" : false,
|
1218
|
+
"cls" : "uk-scrollspy-inview",
|
1219
|
+
"initcls" : "uk-scrollspy-init-inview",
|
1220
|
+
"topoffset" : 0,
|
1221
|
+
"leftoffset" : 0,
|
1222
|
+
"repeat" : false,
|
1223
|
+
"delay" : 0
|
1224
|
+
},
|
1225
|
+
|
1226
|
+
boot: function() {
|
1227
|
+
|
1228
|
+
// listen to scroll and resize
|
1229
|
+
$doc.on("scrolling.uk.document", checkScrollSpy);
|
1230
|
+
$win.on("load resize orientationchange", UI.Utils.debounce(checkScrollSpy, 50));
|
1231
|
+
|
1232
|
+
// init code
|
1233
|
+
UI.ready(function(context) {
|
1234
|
+
|
1235
|
+
UI.$("[data-uk-scrollspy]", context).each(function() {
|
1236
|
+
|
1237
|
+
var element = UI.$(this);
|
1238
|
+
|
1239
|
+
if (!element.data("scrollspy")) {
|
1240
|
+
var obj = UI.scrollspy(element, UI.Utils.options(element.attr("data-uk-scrollspy")));
|
1241
|
+
}
|
1242
|
+
});
|
1243
|
+
});
|
1244
|
+
},
|
1245
|
+
|
1246
|
+
init: function() {
|
1247
|
+
|
1248
|
+
var $this = this, inviewstate, initinview, togglecls = this.options.cls.split(/,/), fn = function(){
|
1249
|
+
|
1250
|
+
var elements = $this.options.target ? $this.element.find($this.options.target) : $this.element,
|
1251
|
+
delayIdx = elements.length === 1 ? 1 : 0,
|
1252
|
+
toggleclsIdx = 0;
|
1253
|
+
|
1254
|
+
elements.each(function(idx){
|
1255
|
+
|
1256
|
+
var element = UI.$(this),
|
1257
|
+
inviewstate = element.data('inviewstate'),
|
1258
|
+
inview = UI.Utils.isInView(element, $this.options),
|
1259
|
+
toggle = element.data('ukScrollspyCls') || togglecls[toggleclsIdx].trim();
|
1260
|
+
|
1261
|
+
if (inview && !inviewstate && !element.data('scrollspy-idle')) {
|
1262
|
+
|
1263
|
+
if (!initinview) {
|
1264
|
+
element.addClass($this.options.initcls);
|
1265
|
+
$this.offset = element.offset();
|
1266
|
+
initinview = true;
|
1267
|
+
|
1268
|
+
element.trigger("init.uk.scrollspy");
|
1269
|
+
}
|
1270
|
+
|
1271
|
+
element.data('scrollspy-idle', setTimeout(function(){
|
1272
|
+
|
1273
|
+
element.addClass("uk-scrollspy-inview").toggleClass(toggle).width();
|
1274
|
+
element.trigger("inview.uk.scrollspy");
|
1275
|
+
|
1276
|
+
element.data('scrollspy-idle', false);
|
1277
|
+
element.data('inviewstate', true);
|
1278
|
+
|
1279
|
+
}, $this.options.delay * delayIdx));
|
1280
|
+
|
1281
|
+
delayIdx++;
|
1282
|
+
}
|
1283
|
+
|
1284
|
+
if (!inview && inviewstate && $this.options.repeat) {
|
1285
|
+
|
1286
|
+
if (element.data('scrollspy-idle')) {
|
1287
|
+
clearTimeout(element.data('scrollspy-idle'));
|
1288
|
+
}
|
1289
|
+
|
1290
|
+
element.removeClass("uk-scrollspy-inview").toggleClass(toggle);
|
1291
|
+
element.data('inviewstate', false);
|
1292
|
+
|
1293
|
+
element.trigger("outview.uk.scrollspy");
|
1294
|
+
}
|
1295
|
+
|
1296
|
+
toggleclsIdx = togglecls[toggleclsIdx + 1] ? (toggleclsIdx + 1) : 0;
|
1297
|
+
|
1298
|
+
});
|
1299
|
+
};
|
1300
|
+
|
1301
|
+
fn();
|
1302
|
+
|
1303
|
+
this.check = fn;
|
1304
|
+
|
1305
|
+
scrollspies.push(this);
|
1306
|
+
}
|
1307
|
+
});
|
1308
|
+
|
1309
|
+
|
1310
|
+
var scrollspynavs = [],
|
1311
|
+
checkScrollSpyNavs = function() {
|
1312
|
+
for(var i=0; i < scrollspynavs.length; i++) {
|
1313
|
+
window.requestAnimationFrame.apply(window, [scrollspynavs[i].check]);
|
1314
|
+
}
|
1315
|
+
};
|
1316
|
+
|
1317
|
+
UI.component('scrollspynav', {
|
1318
|
+
|
1319
|
+
defaults: {
|
1320
|
+
"cls" : 'uk-active',
|
1321
|
+
"closest" : false,
|
1322
|
+
"topoffset" : 0,
|
1323
|
+
"leftoffset" : 0,
|
1324
|
+
"smoothscroll" : false
|
1325
|
+
},
|
1326
|
+
|
1327
|
+
boot: function() {
|
1328
|
+
|
1329
|
+
// listen to scroll and resize
|
1330
|
+
$doc.on("scrolling.uk.document", checkScrollSpyNavs);
|
1331
|
+
$win.on("resize orientationchange", UI.Utils.debounce(checkScrollSpyNavs, 50));
|
1332
|
+
|
1333
|
+
// init code
|
1334
|
+
UI.ready(function(context) {
|
1335
|
+
|
1336
|
+
UI.$("[data-uk-scrollspy-nav]", context).each(function() {
|
1337
|
+
|
1338
|
+
var element = UI.$(this);
|
1339
|
+
|
1340
|
+
if (!element.data("scrollspynav")) {
|
1341
|
+
var obj = UI.scrollspynav(element, UI.Utils.options(element.attr("data-uk-scrollspy-nav")));
|
1342
|
+
}
|
1343
|
+
});
|
1344
|
+
});
|
1345
|
+
},
|
1346
|
+
|
1347
|
+
init: function() {
|
1348
|
+
|
1349
|
+
var ids = [],
|
1350
|
+
links = this.find("a[href^='#']").each(function(){ ids.push(UI.$(this).attr("href")); }),
|
1351
|
+
targets = UI.$(ids.join(",")),
|
1352
|
+
|
1353
|
+
clsActive = this.options.cls,
|
1354
|
+
clsClosest = this.options.closest || this.options.closest;
|
1355
|
+
|
1356
|
+
var $this = this, inviews, fn = function(){
|
1357
|
+
|
1358
|
+
inviews = [];
|
1359
|
+
|
1360
|
+
for (var i=0 ; i < targets.length ; i++) {
|
1361
|
+
if (UI.Utils.isInView(targets.eq(i), $this.options)) {
|
1362
|
+
inviews.push(targets.eq(i));
|
1363
|
+
}
|
1364
|
+
}
|
1365
|
+
|
1366
|
+
if (inviews.length) {
|
1367
|
+
|
1368
|
+
var navitems,
|
1369
|
+
scrollTop = $win.scrollTop(),
|
1370
|
+
target = (function(){
|
1371
|
+
for(var i=0; i< inviews.length;i++){
|
1372
|
+
if(inviews[i].offset().top >= scrollTop){
|
1373
|
+
return inviews[i];
|
1374
|
+
}
|
1375
|
+
}
|
1376
|
+
})();
|
1377
|
+
|
1378
|
+
if (!target) return;
|
1379
|
+
|
1380
|
+
if ($this.options.closest) {
|
1381
|
+
links.closest(clsClosest).removeClass(clsActive);
|
1382
|
+
navitems = links.filter("a[href='#"+target.attr("id")+"']").closest(clsClosest).addClass(clsActive);
|
1383
|
+
} else {
|
1384
|
+
navitems = links.removeClass(clsActive).filter("a[href='#"+target.attr("id")+"']").addClass(clsActive);
|
1385
|
+
}
|
1386
|
+
|
1387
|
+
$this.element.trigger("inview.uk.scrollspynav", [target, navitems]);
|
1388
|
+
}
|
1389
|
+
};
|
1390
|
+
|
1391
|
+
if (this.options.smoothscroll && UI.smoothScroll) {
|
1392
|
+
links.each(function(){
|
1393
|
+
UI.smoothScroll(this, $this.options.smoothscroll);
|
1394
|
+
});
|
1395
|
+
}
|
1396
|
+
|
1397
|
+
fn();
|
1398
|
+
|
1399
|
+
this.element.data("scrollspynav", this);
|
1400
|
+
|
1401
|
+
this.check = fn;
|
1402
|
+
scrollspynavs.push(this);
|
1403
|
+
|
1404
|
+
}
|
1405
|
+
});
|
1406
|
+
|
1407
|
+
})(UIkit);
|
1408
|
+
|
1409
|
+
(function(UI){
|
1410
|
+
|
1411
|
+
"use strict";
|
1412
|
+
|
1413
|
+
var toggles = [];
|
1414
|
+
|
1415
|
+
UI.component('toggle', {
|
1416
|
+
|
1417
|
+
defaults: {
|
1418
|
+
target : false,
|
1419
|
+
cls : 'uk-hidden',
|
1420
|
+
animation : false,
|
1421
|
+
duration : 200
|
1422
|
+
},
|
1423
|
+
|
1424
|
+
boot: function(){
|
1425
|
+
|
1426
|
+
// init code
|
1427
|
+
UI.ready(function(context) {
|
1428
|
+
|
1429
|
+
UI.$("[data-uk-toggle]", context).each(function() {
|
1430
|
+
var ele = UI.$(this);
|
1431
|
+
|
1432
|
+
if (!ele.data("toggle")) {
|
1433
|
+
var obj = UI.toggle(ele, UI.Utils.options(ele.attr("data-uk-toggle")));
|
1434
|
+
}
|
1435
|
+
});
|
1436
|
+
|
1437
|
+
setTimeout(function(){
|
1438
|
+
|
1439
|
+
toggles.forEach(function(toggle){
|
1440
|
+
toggle.getToggles();
|
1441
|
+
});
|
1442
|
+
|
1443
|
+
}, 0);
|
1444
|
+
});
|
1445
|
+
},
|
1446
|
+
|
1447
|
+
init: function() {
|
1448
|
+
|
1449
|
+
var $this = this;
|
1450
|
+
|
1451
|
+
this.aria = (this.options.cls.indexOf('uk-hidden') !== -1);
|
1452
|
+
|
1453
|
+
this.getToggles();
|
1454
|
+
|
1455
|
+
this.on("click", function(e) {
|
1456
|
+
if ($this.element.is('a[href="#"]')) e.preventDefault();
|
1457
|
+
$this.toggle();
|
1458
|
+
});
|
1459
|
+
|
1460
|
+
toggles.push(this);
|
1461
|
+
},
|
1462
|
+
|
1463
|
+
toggle: function() {
|
1464
|
+
|
1465
|
+
if(!this.totoggle.length) return;
|
1466
|
+
|
1467
|
+
if (this.options.animation && UI.support.animation) {
|
1468
|
+
|
1469
|
+
var $this = this, animations = this.options.animation.split(',');
|
1470
|
+
|
1471
|
+
if (animations.length == 1) {
|
1472
|
+
animations[1] = animations[0];
|
1473
|
+
}
|
1474
|
+
|
1475
|
+
animations[0] = animations[0].trim();
|
1476
|
+
animations[1] = animations[1].trim();
|
1477
|
+
|
1478
|
+
this.totoggle.css('animation-duration', this.options.duration+'ms');
|
1479
|
+
|
1480
|
+
this.totoggle.each(function(){
|
1481
|
+
|
1482
|
+
var ele = UI.$(this);
|
1483
|
+
|
1484
|
+
if (ele.hasClass($this.options.cls)) {
|
1485
|
+
|
1486
|
+
ele.toggleClass($this.options.cls);
|
1487
|
+
|
1488
|
+
UI.Utils.animate(ele, animations[0]).then(function(){
|
1489
|
+
ele.css('animation-duration', '');
|
1490
|
+
UI.Utils.checkDisplay(ele);
|
1491
|
+
});
|
1492
|
+
|
1493
|
+
} else {
|
1494
|
+
|
1495
|
+
UI.Utils.animate(this, animations[1]+' uk-animation-reverse').then(function(){
|
1496
|
+
ele.toggleClass($this.options.cls).css('animation-duration', '');
|
1497
|
+
UI.Utils.checkDisplay(ele);
|
1498
|
+
});
|
1499
|
+
|
1500
|
+
}
|
1501
|
+
|
1502
|
+
});
|
1503
|
+
|
1504
|
+
} else {
|
1505
|
+
this.totoggle.toggleClass(this.options.cls);
|
1506
|
+
UI.Utils.checkDisplay(this.totoggle);
|
1507
|
+
}
|
1508
|
+
|
1509
|
+
this.updateAria();
|
1510
|
+
|
1511
|
+
},
|
1512
|
+
|
1513
|
+
getToggles: function() {
|
1514
|
+
this.totoggle = this.options.target ? UI.$(this.options.target):[];
|
1515
|
+
this.updateAria();
|
1516
|
+
},
|
1517
|
+
|
1518
|
+
updateAria: function() {
|
1519
|
+
if (this.aria && this.totoggle.length) {
|
1520
|
+
this.totoggle.each(function(){
|
1521
|
+
UI.$(this).attr('aria-hidden', UI.$(this).hasClass('uk-hidden'));
|
1522
|
+
});
|
1523
|
+
}
|
1524
|
+
}
|
1525
|
+
});
|
1526
|
+
|
1527
|
+
})(UIkit);
|
1528
|
+
|
1529
|
+
(function(UI) {
|
1530
|
+
|
1531
|
+
"use strict";
|
1532
|
+
|
1533
|
+
UI.component('alert', {
|
1534
|
+
|
1535
|
+
defaults: {
|
1536
|
+
"fade": true,
|
1537
|
+
"duration": 200,
|
1538
|
+
"trigger": ".uk-alert-close"
|
1539
|
+
},
|
1540
|
+
|
1541
|
+
boot: function() {
|
1542
|
+
|
1543
|
+
// init code
|
1544
|
+
UI.$html.on("click.alert.uikit", "[data-uk-alert]", function(e) {
|
1545
|
+
|
1546
|
+
var ele = UI.$(this);
|
1547
|
+
|
1548
|
+
if (!ele.data("alert")) {
|
1549
|
+
|
1550
|
+
var alert = UI.alert(ele, UI.Utils.options(ele.attr("data-uk-alert")));
|
1551
|
+
|
1552
|
+
if (UI.$(e.target).is(alert.options.trigger)) {
|
1553
|
+
e.preventDefault();
|
1554
|
+
alert.close();
|
1555
|
+
}
|
1556
|
+
}
|
1557
|
+
});
|
1558
|
+
},
|
1559
|
+
|
1560
|
+
init: function() {
|
1561
|
+
|
1562
|
+
var $this = this;
|
1563
|
+
|
1564
|
+
this.on("click", this.options.trigger, function(e) {
|
1565
|
+
e.preventDefault();
|
1566
|
+
$this.close();
|
1567
|
+
});
|
1568
|
+
},
|
1569
|
+
|
1570
|
+
close: function() {
|
1571
|
+
|
1572
|
+
var element = this.trigger("close.uk.alert"),
|
1573
|
+
removeElement = function () {
|
1574
|
+
this.trigger("closed.uk.alert").remove();
|
1575
|
+
}.bind(this);
|
1576
|
+
|
1577
|
+
if (this.options.fade) {
|
1578
|
+
element.css("overflow", "hidden").css("max-height", element.height()).animate({
|
1579
|
+
"height" : 0,
|
1580
|
+
"opacity" : 0,
|
1581
|
+
"padding-top" : 0,
|
1582
|
+
"padding-bottom" : 0,
|
1583
|
+
"margin-top" : 0,
|
1584
|
+
"margin-bottom" : 0
|
1585
|
+
}, this.options.duration, removeElement);
|
1586
|
+
} else {
|
1587
|
+
removeElement();
|
1588
|
+
}
|
1589
|
+
}
|
1590
|
+
|
1591
|
+
});
|
1592
|
+
|
1593
|
+
})(UIkit);
|
1594
|
+
|
1595
|
+
(function(UI) {
|
1596
|
+
|
1597
|
+
"use strict";
|
1598
|
+
|
1599
|
+
UI.component('buttonRadio', {
|
1600
|
+
|
1601
|
+
defaults: {
|
1602
|
+
"activeClass": 'uk-active',
|
1603
|
+
"target": ".uk-button"
|
1604
|
+
},
|
1605
|
+
|
1606
|
+
boot: function() {
|
1607
|
+
|
1608
|
+
// init code
|
1609
|
+
UI.$html.on("click.buttonradio.uikit", "[data-uk-button-radio]", function(e) {
|
1610
|
+
|
1611
|
+
var ele = UI.$(this);
|
1612
|
+
|
1613
|
+
if (!ele.data("buttonRadio")) {
|
1614
|
+
|
1615
|
+
var obj = UI.buttonRadio(ele, UI.Utils.options(ele.attr("data-uk-button-radio"))),
|
1616
|
+
target = UI.$(e.target);
|
1617
|
+
|
1618
|
+
if (target.is(obj.options.target)) {
|
1619
|
+
target.trigger("click");
|
1620
|
+
}
|
1621
|
+
}
|
1622
|
+
});
|
1623
|
+
},
|
1624
|
+
|
1625
|
+
init: function() {
|
1626
|
+
|
1627
|
+
var $this = this;
|
1628
|
+
|
1629
|
+
// Init ARIA
|
1630
|
+
this.find($this.options.target).attr('aria-checked', 'false').filter('.' + $this.options.activeClass).attr('aria-checked', 'true');
|
1631
|
+
|
1632
|
+
this.on("click", this.options.target, function(e) {
|
1633
|
+
|
1634
|
+
var ele = UI.$(this);
|
1635
|
+
|
1636
|
+
if (ele.is('a[href="#"]')) e.preventDefault();
|
1637
|
+
|
1638
|
+
$this.find($this.options.target).not(ele).removeClass($this.options.activeClass).blur();
|
1639
|
+
ele.addClass($this.options.activeClass);
|
1640
|
+
|
1641
|
+
// Update ARIA
|
1642
|
+
$this.find($this.options.target).not(ele).attr('aria-checked', 'false');
|
1643
|
+
ele.attr('aria-checked', 'true');
|
1644
|
+
|
1645
|
+
$this.trigger("change.uk.button", [ele]);
|
1646
|
+
});
|
1647
|
+
|
1648
|
+
},
|
1649
|
+
|
1650
|
+
getSelected: function() {
|
1651
|
+
return this.find('.' + this.options.activeClass);
|
1652
|
+
}
|
1653
|
+
});
|
1654
|
+
|
1655
|
+
UI.component('buttonCheckbox', {
|
1656
|
+
|
1657
|
+
defaults: {
|
1658
|
+
"activeClass": 'uk-active',
|
1659
|
+
"target": ".uk-button"
|
1660
|
+
},
|
1661
|
+
|
1662
|
+
boot: function() {
|
1663
|
+
|
1664
|
+
UI.$html.on("click.buttoncheckbox.uikit", "[data-uk-button-checkbox]", function(e) {
|
1665
|
+
var ele = UI.$(this);
|
1666
|
+
|
1667
|
+
if (!ele.data("buttonCheckbox")) {
|
1668
|
+
|
1669
|
+
var obj = UI.buttonCheckbox(ele, UI.Utils.options(ele.attr("data-uk-button-checkbox"))),
|
1670
|
+
target = UI.$(e.target);
|
1671
|
+
|
1672
|
+
if (target.is(obj.options.target)) {
|
1673
|
+
target.trigger("click");
|
1674
|
+
}
|
1675
|
+
}
|
1676
|
+
});
|
1677
|
+
},
|
1678
|
+
|
1679
|
+
init: function() {
|
1680
|
+
|
1681
|
+
var $this = this;
|
1682
|
+
|
1683
|
+
// Init ARIA
|
1684
|
+
this.find($this.options.target).attr('aria-checked', 'false').filter('.' + $this.options.activeClass).attr('aria-checked', 'true');
|
1685
|
+
|
1686
|
+
this.on("click", this.options.target, function(e) {
|
1687
|
+
var ele = UI.$(this);
|
1688
|
+
|
1689
|
+
if (ele.is('a[href="#"]')) e.preventDefault();
|
1690
|
+
|
1691
|
+
ele.toggleClass($this.options.activeClass).blur();
|
1692
|
+
|
1693
|
+
// Update ARIA
|
1694
|
+
ele.attr('aria-checked', ele.hasClass($this.options.activeClass));
|
1695
|
+
|
1696
|
+
$this.trigger("change.uk.button", [ele]);
|
1697
|
+
});
|
1698
|
+
|
1699
|
+
},
|
1700
|
+
|
1701
|
+
getSelected: function() {
|
1702
|
+
return this.find('.' + this.options.activeClass);
|
1703
|
+
}
|
1704
|
+
});
|
1705
|
+
|
1706
|
+
|
1707
|
+
UI.component('button', {
|
1708
|
+
|
1709
|
+
defaults: {},
|
1710
|
+
|
1711
|
+
boot: function() {
|
1712
|
+
|
1713
|
+
UI.$html.on("click.button.uikit", "[data-uk-button]", function(e) {
|
1714
|
+
var ele = UI.$(this);
|
1715
|
+
|
1716
|
+
if (!ele.data("button")) {
|
1717
|
+
|
1718
|
+
var obj = UI.button(ele, UI.Utils.options(ele.attr("data-uk-button")));
|
1719
|
+
ele.trigger("click");
|
1720
|
+
}
|
1721
|
+
});
|
1722
|
+
},
|
1723
|
+
|
1724
|
+
init: function() {
|
1725
|
+
|
1726
|
+
var $this = this;
|
1727
|
+
|
1728
|
+
// Init ARIA
|
1729
|
+
this.element.attr('aria-pressed', this.element.hasClass("uk-active"));
|
1730
|
+
|
1731
|
+
this.on("click", function(e) {
|
1732
|
+
|
1733
|
+
if ($this.element.is('a[href="#"]')) e.preventDefault();
|
1734
|
+
|
1735
|
+
$this.toggle();
|
1736
|
+
$this.trigger("change.uk.button", [$this.element.blur().hasClass("uk-active")]);
|
1737
|
+
});
|
1738
|
+
|
1739
|
+
},
|
1740
|
+
|
1741
|
+
toggle: function() {
|
1742
|
+
this.element.toggleClass("uk-active");
|
1743
|
+
|
1744
|
+
// Update ARIA
|
1745
|
+
this.element.attr('aria-pressed', this.element.hasClass("uk-active"));
|
1746
|
+
}
|
1747
|
+
});
|
1748
|
+
|
1749
|
+
})(UIkit);
|
1750
|
+
|
1751
|
+
|
1752
|
+
(function(UI) {
|
1753
|
+
|
1754
|
+
"use strict";
|
1755
|
+
|
1756
|
+
var active = false, hoverIdle;
|
1757
|
+
|
1758
|
+
UI.component('dropdown', {
|
1759
|
+
|
1760
|
+
defaults: {
|
1761
|
+
'mode' : 'hover',
|
1762
|
+
'remaintime' : 800,
|
1763
|
+
'justify' : false,
|
1764
|
+
'boundary' : UI.$win,
|
1765
|
+
'delay' : 0,
|
1766
|
+
'hoverDelayIdle' : 250
|
1767
|
+
},
|
1768
|
+
|
1769
|
+
remainIdle: false,
|
1770
|
+
|
1771
|
+
boot: function() {
|
1772
|
+
|
1773
|
+
var triggerevent = UI.support.touch ? "click" : "mouseenter";
|
1774
|
+
|
1775
|
+
// init code
|
1776
|
+
UI.$html.on(triggerevent+".dropdown.uikit", "[data-uk-dropdown]", function(e) {
|
1777
|
+
|
1778
|
+
var ele = UI.$(this);
|
1779
|
+
|
1780
|
+
if (!ele.data("dropdown")) {
|
1781
|
+
|
1782
|
+
var dropdown = UI.dropdown(ele, UI.Utils.options(ele.attr("data-uk-dropdown")));
|
1783
|
+
|
1784
|
+
if (triggerevent=="click" || (triggerevent=="mouseenter" && dropdown.options.mode=="hover")) {
|
1785
|
+
dropdown.element.trigger(triggerevent);
|
1786
|
+
}
|
1787
|
+
|
1788
|
+
if (dropdown.element.find('.uk-dropdown').length) {
|
1789
|
+
e.preventDefault();
|
1790
|
+
}
|
1791
|
+
}
|
1792
|
+
});
|
1793
|
+
},
|
1794
|
+
|
1795
|
+
init: function() {
|
1796
|
+
|
1797
|
+
var $this = this;
|
1798
|
+
|
1799
|
+
this.dropdown = this.find('.uk-dropdown');
|
1800
|
+
|
1801
|
+
this.centered = this.dropdown.hasClass('uk-dropdown-center');
|
1802
|
+
this.justified = this.options.justify ? UI.$(this.options.justify) : false;
|
1803
|
+
|
1804
|
+
this.boundary = UI.$(this.options.boundary);
|
1805
|
+
this.flipped = this.dropdown.hasClass('uk-dropdown-flip');
|
1806
|
+
|
1807
|
+
if (!this.boundary.length) {
|
1808
|
+
this.boundary = UI.$win;
|
1809
|
+
}
|
1810
|
+
|
1811
|
+
// Init ARIA
|
1812
|
+
this.element.attr('aria-haspopup', 'true');
|
1813
|
+
this.element.attr('aria-expanded', this.element.hasClass("uk-open"));
|
1814
|
+
|
1815
|
+
if (this.options.mode == "click" || UI.support.touch) {
|
1816
|
+
|
1817
|
+
this.on("click.uikit.dropdown", function(e) {
|
1818
|
+
|
1819
|
+
var $target = UI.$(e.target);
|
1820
|
+
|
1821
|
+
if (!$target.parents(".uk-dropdown").length) {
|
1822
|
+
|
1823
|
+
if ($target.is("a[href='#']") || $target.parent().is("a[href='#']") || ($this.dropdown.length && !$this.dropdown.is(":visible")) ){
|
1824
|
+
e.preventDefault();
|
1825
|
+
}
|
1826
|
+
|
1827
|
+
$target.blur();
|
1828
|
+
}
|
1829
|
+
|
1830
|
+
if (!$this.element.hasClass('uk-open')) {
|
1831
|
+
|
1832
|
+
$this.show();
|
1833
|
+
|
1834
|
+
} else {
|
1835
|
+
|
1836
|
+
if (!$this.dropdown.find(e.target).length || $target.is(".uk-dropdown-close") || $target.parents(".uk-dropdown-close").length) {
|
1837
|
+
$this.hide();
|
1838
|
+
}
|
1839
|
+
}
|
1840
|
+
});
|
1841
|
+
|
1842
|
+
} else {
|
1843
|
+
|
1844
|
+
this.on("mouseenter", function(e) {
|
1845
|
+
|
1846
|
+
$this.trigger('pointerenter.uk.dropdown', [$this]);
|
1847
|
+
|
1848
|
+
if ($this.remainIdle) {
|
1849
|
+
clearTimeout($this.remainIdle);
|
1850
|
+
}
|
1851
|
+
|
1852
|
+
if (hoverIdle) {
|
1853
|
+
clearTimeout(hoverIdle);
|
1854
|
+
}
|
1855
|
+
|
1856
|
+
if (active && active == $this) {
|
1857
|
+
return;
|
1858
|
+
}
|
1859
|
+
|
1860
|
+
// pseudo manuAim
|
1861
|
+
if (active && active != $this) {
|
1862
|
+
|
1863
|
+
hoverIdle = setTimeout(function() {
|
1864
|
+
hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
|
1865
|
+
}, $this.options.hoverDelayIdle);
|
1866
|
+
|
1867
|
+
} else {
|
1868
|
+
|
1869
|
+
hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
|
1870
|
+
}
|
1871
|
+
|
1872
|
+
}).on("mouseleave", function() {
|
1873
|
+
|
1874
|
+
if (hoverIdle) {
|
1875
|
+
clearTimeout(hoverIdle);
|
1876
|
+
}
|
1877
|
+
|
1878
|
+
$this.remainIdle = setTimeout(function() {
|
1879
|
+
if (active && active == $this) $this.hide();
|
1880
|
+
}, $this.options.remaintime);
|
1881
|
+
|
1882
|
+
$this.trigger('pointerleave.uk.dropdown', [$this]);
|
1883
|
+
|
1884
|
+
}).on("click", function(e){
|
1885
|
+
|
1886
|
+
var $target = UI.$(e.target);
|
1887
|
+
|
1888
|
+
if ($this.remainIdle) {
|
1889
|
+
clearTimeout($this.remainIdle);
|
1890
|
+
}
|
1891
|
+
|
1892
|
+
if (active && active == $this) {
|
1893
|
+
return;
|
1894
|
+
}
|
1895
|
+
|
1896
|
+
if ($target.is("a[href='#']") || $target.parent().is("a[href='#']")){
|
1897
|
+
e.preventDefault();
|
1898
|
+
}
|
1899
|
+
|
1900
|
+
$this.show();
|
1901
|
+
});
|
1902
|
+
}
|
1903
|
+
},
|
1904
|
+
|
1905
|
+
show: function(){
|
1906
|
+
|
1907
|
+
UI.$html.off("click.outer.dropdown");
|
1908
|
+
|
1909
|
+
if (active && active != this) {
|
1910
|
+
active.hide(true);
|
1911
|
+
}
|
1912
|
+
|
1913
|
+
if (hoverIdle) {
|
1914
|
+
clearTimeout(hoverIdle);
|
1915
|
+
}
|
1916
|
+
|
1917
|
+
this.trigger('beforeshow.uk.dropdown', [this]);
|
1918
|
+
|
1919
|
+
this.checkDimensions();
|
1920
|
+
this.element.addClass('uk-open');
|
1921
|
+
|
1922
|
+
// Update ARIA
|
1923
|
+
this.element.attr('aria-expanded', 'true');
|
1924
|
+
|
1925
|
+
this.trigger('show.uk.dropdown', [this]);
|
1926
|
+
|
1927
|
+
UI.Utils.checkDisplay(this.dropdown, true);
|
1928
|
+
active = this;
|
1929
|
+
|
1930
|
+
this.registerOuterClick();
|
1931
|
+
},
|
1932
|
+
|
1933
|
+
hide: function(force) {
|
1934
|
+
|
1935
|
+
this.trigger('beforehide.uk.dropdown', [this, force]);
|
1936
|
+
|
1937
|
+
this.element.removeClass('uk-open');
|
1938
|
+
|
1939
|
+
if (this.remainIdle) {
|
1940
|
+
clearTimeout(this.remainIdle);
|
1941
|
+
}
|
1942
|
+
|
1943
|
+
this.remainIdle = false;
|
1944
|
+
|
1945
|
+
// Update ARIA
|
1946
|
+
this.element.attr('aria-expanded', 'false');
|
1947
|
+
|
1948
|
+
this.trigger('hide.uk.dropdown', [this, force]);
|
1949
|
+
|
1950
|
+
if (active == this) active = false;
|
1951
|
+
},
|
1952
|
+
|
1953
|
+
registerOuterClick: function(){
|
1954
|
+
|
1955
|
+
var $this = this;
|
1956
|
+
|
1957
|
+
UI.$html.off("click.outer.dropdown");
|
1958
|
+
|
1959
|
+
setTimeout(function() {
|
1960
|
+
|
1961
|
+
UI.$html.on("click.outer.dropdown", function(e) {
|
1962
|
+
|
1963
|
+
if (hoverIdle) {
|
1964
|
+
clearTimeout(hoverIdle);
|
1965
|
+
}
|
1966
|
+
|
1967
|
+
var $target = UI.$(e.target);
|
1968
|
+
|
1969
|
+
if (active == $this && !$this.element.find(e.target).length) {
|
1970
|
+
$this.hide(true);
|
1971
|
+
UI.$html.off("click.outer.dropdown");
|
1972
|
+
}
|
1973
|
+
});
|
1974
|
+
}, 10);
|
1975
|
+
},
|
1976
|
+
|
1977
|
+
checkDimensions: function() {
|
1978
|
+
|
1979
|
+
if (!this.dropdown.length) return;
|
1980
|
+
|
1981
|
+
if (this.justified && this.justified.length) {
|
1982
|
+
this.dropdown.css("min-width", "");
|
1983
|
+
}
|
1984
|
+
|
1985
|
+
var $this = this,
|
1986
|
+
dropdown = this.dropdown.css("margin-" + UI.langdirection, ""),
|
1987
|
+
offset = dropdown.show().offset(),
|
1988
|
+
width = dropdown.outerWidth(),
|
1989
|
+
boundarywidth = this.boundary.width(),
|
1990
|
+
boundaryoffset = this.boundary.offset() ? this.boundary.offset().left:0;
|
1991
|
+
|
1992
|
+
// centered dropdown
|
1993
|
+
if (this.centered) {
|
1994
|
+
dropdown.css("margin-" + UI.langdirection, (parseFloat(width) / 2 - dropdown.parent().width() / 2) * -1);
|
1995
|
+
offset = dropdown.offset();
|
1996
|
+
|
1997
|
+
// reset dropdown
|
1998
|
+
if ((width + offset.left) > boundarywidth || offset.left < 0) {
|
1999
|
+
dropdown.css("margin-" + UI.langdirection, "");
|
2000
|
+
offset = dropdown.offset();
|
2001
|
+
}
|
2002
|
+
}
|
2003
|
+
|
2004
|
+
// justify dropdown
|
2005
|
+
if (this.justified && this.justified.length) {
|
2006
|
+
justify(dropdown, this.justified, boundarywidth, offset);
|
2007
|
+
offset = dropdown.offset();
|
2008
|
+
}
|
2009
|
+
|
2010
|
+
if ((width + (offset.left-boundaryoffset)) > boundarywidth) {
|
2011
|
+
dropdown.addClass('uk-dropdown-flip');
|
2012
|
+
offset = dropdown.offset();
|
2013
|
+
}
|
2014
|
+
|
2015
|
+
if ((offset.left-boundaryoffset) < 0) {
|
2016
|
+
|
2017
|
+
dropdown.addClass("uk-dropdown-stack");
|
2018
|
+
|
2019
|
+
if (dropdown.hasClass('uk-dropdown-flip')) {
|
2020
|
+
|
2021
|
+
if (!this.flipped) {
|
2022
|
+
dropdown.removeClass('uk-dropdown-flip');
|
2023
|
+
offset = dropdown.offset();
|
2024
|
+
dropdown.addClass('uk-dropdown-flip');
|
2025
|
+
}
|
2026
|
+
|
2027
|
+
setTimeout(function(){
|
2028
|
+
|
2029
|
+
if ((dropdown.offset().left-boundaryoffset) < 0 || !$this.flipped && (dropdown.outerWidth() + (offset.left-boundaryoffset)) < boundarywidth) {
|
2030
|
+
dropdown.removeClass('uk-dropdown-flip');
|
2031
|
+
}
|
2032
|
+
}, 0);
|
2033
|
+
}
|
2034
|
+
|
2035
|
+
this.trigger('stack.uk.dropdown', [this]);
|
2036
|
+
}
|
2037
|
+
|
2038
|
+
dropdown.css("display", "");
|
2039
|
+
}
|
2040
|
+
|
2041
|
+
});
|
2042
|
+
|
2043
|
+
|
2044
|
+
UI.component('dropdownOverlay', {
|
2045
|
+
|
2046
|
+
defaults: {
|
2047
|
+
'justify' : false,
|
2048
|
+
'cls' : '',
|
2049
|
+
'duration': 200
|
2050
|
+
},
|
2051
|
+
|
2052
|
+
boot: function() {
|
2053
|
+
|
2054
|
+
// init code
|
2055
|
+
UI.ready(function(context) {
|
2056
|
+
|
2057
|
+
UI.$("[data-uk-dropdown-overlay]", context).each(function() {
|
2058
|
+
var ele = UI.$(this);
|
2059
|
+
|
2060
|
+
if (!ele.data("dropdownOverlay")) {
|
2061
|
+
UI.dropdownOverlay(ele, UI.Utils.options(ele.attr("data-uk-dropdown-overlay")));
|
2062
|
+
}
|
2063
|
+
});
|
2064
|
+
});
|
2065
|
+
},
|
2066
|
+
|
2067
|
+
init: function() {
|
2068
|
+
|
2069
|
+
var $this = this;
|
2070
|
+
|
2071
|
+
this.justified = this.options.justify ? UI.$(this.options.justify) : false;
|
2072
|
+
this.overlay = this.element.find('uk-dropdown-overlay');
|
2073
|
+
|
2074
|
+
if (!this.overlay.length) {
|
2075
|
+
this.overlay = UI.$('<div class="uk-dropdown-overlay"></div>').appendTo(this.element);
|
2076
|
+
}
|
2077
|
+
|
2078
|
+
this.overlay.addClass(this.options.cls);
|
2079
|
+
|
2080
|
+
this.on({
|
2081
|
+
|
2082
|
+
'beforeshow.uk.dropdown': function(e, dropdown) {
|
2083
|
+
$this.dropdown = dropdown;
|
2084
|
+
|
2085
|
+
if ($this.justified && $this.justified.length) {
|
2086
|
+
justify($this.overlay.css({'display':'block', 'margin-left':'','margin-right':''}), $this.justified, $this.justified.outerWidth());
|
2087
|
+
}
|
2088
|
+
},
|
2089
|
+
|
2090
|
+
'show.uk.dropdown': function(e, dropdown) {
|
2091
|
+
|
2092
|
+
var h = $this.dropdown.dropdown.outerHeight(true);
|
2093
|
+
|
2094
|
+
$this.dropdown.element.removeClass('uk-open');
|
2095
|
+
|
2096
|
+
$this.overlay.stop().css('display', 'block').animate({height: h}, $this.options.duration, function() {
|
2097
|
+
|
2098
|
+
$this.dropdown.dropdown.css('visibility', '');
|
2099
|
+
$this.dropdown.element.addClass('uk-open');
|
2100
|
+
|
2101
|
+
UI.Utils.checkDisplay($this.dropdown.dropdown, true);
|
2102
|
+
});
|
2103
|
+
|
2104
|
+
$this.pointerleave = false;
|
2105
|
+
},
|
2106
|
+
|
2107
|
+
'hide.uk.dropdown': function() {
|
2108
|
+
$this.overlay.stop().animate({height: 0}, $this.options.duration);
|
2109
|
+
},
|
2110
|
+
|
2111
|
+
'pointerenter.uk.dropdown': function(e, dropdown) {
|
2112
|
+
clearTimeout($this.remainIdle);
|
2113
|
+
},
|
2114
|
+
|
2115
|
+
'pointerleave.uk.dropdown': function(e, dropdown) {
|
2116
|
+
$this.pointerleave = true;
|
2117
|
+
}
|
2118
|
+
});
|
2119
|
+
|
2120
|
+
|
2121
|
+
this.overlay.on({
|
2122
|
+
|
2123
|
+
'mouseenter': function() {
|
2124
|
+
if ($this.remainIdle) {
|
2125
|
+
clearTimeout($this.dropdown.remainIdle);
|
2126
|
+
clearTimeout($this.remainIdle);
|
2127
|
+
}
|
2128
|
+
},
|
2129
|
+
|
2130
|
+
'mouseleave': function(){
|
2131
|
+
|
2132
|
+
if ($this.pointerleave && active) {
|
2133
|
+
|
2134
|
+
$this.remainIdle = setTimeout(function() {
|
2135
|
+
if(active) active.hide();
|
2136
|
+
}, active.options.remaintime);
|
2137
|
+
}
|
2138
|
+
}
|
2139
|
+
})
|
2140
|
+
}
|
2141
|
+
|
2142
|
+
});
|
2143
|
+
|
2144
|
+
|
2145
|
+
function justify(ele, justifyTo, boundarywidth, offset) {
|
2146
|
+
|
2147
|
+
ele = UI.$(ele);
|
2148
|
+
justifyTo = UI.$(justifyTo);
|
2149
|
+
boundarywidth = boundarywidth || window.innerWidth;
|
2150
|
+
offset = offset || ele.offset();
|
2151
|
+
|
2152
|
+
if (justifyTo.length) {
|
2153
|
+
|
2154
|
+
var jwidth = justifyTo.outerWidth();
|
2155
|
+
|
2156
|
+
ele.css("min-width", jwidth);
|
2157
|
+
|
2158
|
+
if (UI.langdirection == 'right') {
|
2159
|
+
|
2160
|
+
var right1 = boundarywidth - (justifyTo.offset().left + jwidth),
|
2161
|
+
right2 = boundarywidth - (ele.offset().left + ele.outerWidth());
|
2162
|
+
|
2163
|
+
ele.css("margin-right", right1 - right2);
|
2164
|
+
|
2165
|
+
} else {
|
2166
|
+
ele.css("margin-left", justifyTo.offset().left - offset.left);
|
2167
|
+
}
|
2168
|
+
}
|
2169
|
+
}
|
2170
|
+
|
2171
|
+
})(UIkit);
|
2172
|
+
|
2173
|
+
(function(UI) {
|
2174
|
+
|
2175
|
+
"use strict";
|
2176
|
+
|
2177
|
+
var grids = [];
|
2178
|
+
|
2179
|
+
UI.component('gridMatchHeight', {
|
2180
|
+
|
2181
|
+
defaults: {
|
2182
|
+
"target" : false,
|
2183
|
+
"row" : true,
|
2184
|
+
"ignorestacked" : false
|
2185
|
+
},
|
2186
|
+
|
2187
|
+
boot: function() {
|
2188
|
+
|
2189
|
+
// init code
|
2190
|
+
UI.ready(function(context) {
|
2191
|
+
|
2192
|
+
UI.$("[data-uk-grid-match]", context).each(function() {
|
2193
|
+
var grid = UI.$(this), obj;
|
2194
|
+
|
2195
|
+
if (!grid.data("gridMatchHeight")) {
|
2196
|
+
obj = UI.gridMatchHeight(grid, UI.Utils.options(grid.attr("data-uk-grid-match")));
|
2197
|
+
}
|
2198
|
+
});
|
2199
|
+
});
|
2200
|
+
},
|
2201
|
+
|
2202
|
+
init: function() {
|
2203
|
+
|
2204
|
+
var $this = this;
|
2205
|
+
|
2206
|
+
this.columns = this.element.children();
|
2207
|
+
this.elements = this.options.target ? this.find(this.options.target) : this.columns;
|
2208
|
+
|
2209
|
+
if (!this.columns.length) return;
|
2210
|
+
|
2211
|
+
UI.$win.on('load resize orientationchange', (function() {
|
2212
|
+
|
2213
|
+
var fn = function() {
|
2214
|
+
$this.match();
|
2215
|
+
};
|
2216
|
+
|
2217
|
+
UI.$(function() { fn(); });
|
2218
|
+
|
2219
|
+
return UI.Utils.debounce(fn, 50);
|
2220
|
+
})());
|
2221
|
+
|
2222
|
+
UI.$html.on("changed.uk.dom", function(e) {
|
2223
|
+
$this.columns = $this.element.children();
|
2224
|
+
$this.elements = $this.options.target ? $this.find($this.options.target) : $this.columns;
|
2225
|
+
$this.match();
|
2226
|
+
});
|
2227
|
+
|
2228
|
+
this.on("display.uk.check", function(e) {
|
2229
|
+
if(this.element.is(":visible")) this.match();
|
2230
|
+
}.bind(this));
|
2231
|
+
|
2232
|
+
grids.push(this);
|
2233
|
+
},
|
2234
|
+
|
2235
|
+
match: function() {
|
2236
|
+
|
2237
|
+
var firstvisible = this.columns.filter(":visible:first");
|
2238
|
+
|
2239
|
+
if (!firstvisible.length) return;
|
2240
|
+
|
2241
|
+
var stacked = Math.ceil(100 * parseFloat(firstvisible.css('width')) / parseFloat(firstvisible.parent().css('width'))) >= 100;
|
2242
|
+
|
2243
|
+
if (stacked && !this.options.ignorestacked) {
|
2244
|
+
this.revert();
|
2245
|
+
} else {
|
2246
|
+
UI.Utils.matchHeights(this.elements, this.options);
|
2247
|
+
}
|
2248
|
+
|
2249
|
+
return this;
|
2250
|
+
},
|
2251
|
+
|
2252
|
+
revert: function() {
|
2253
|
+
this.elements.css('min-height', '');
|
2254
|
+
return this;
|
2255
|
+
}
|
2256
|
+
});
|
2257
|
+
|
2258
|
+
UI.component('gridMargin', {
|
2259
|
+
|
2260
|
+
defaults: {
|
2261
|
+
"cls": "uk-grid-margin"
|
2262
|
+
},
|
2263
|
+
|
2264
|
+
boot: function() {
|
2265
|
+
|
2266
|
+
// init code
|
2267
|
+
UI.ready(function(context) {
|
2268
|
+
|
2269
|
+
UI.$("[data-uk-grid-margin]", context).each(function() {
|
2270
|
+
var grid = UI.$(this), obj;
|
2271
|
+
|
2272
|
+
if (!grid.data("gridMargin")) {
|
2273
|
+
obj = UI.gridMargin(grid, UI.Utils.options(grid.attr("data-uk-grid-margin")));
|
2274
|
+
}
|
2275
|
+
});
|
2276
|
+
});
|
2277
|
+
},
|
2278
|
+
|
2279
|
+
init: function() {
|
2280
|
+
|
2281
|
+
var stackMargin = UI.stackMargin(this.element, this.options);
|
2282
|
+
}
|
2283
|
+
});
|
2284
|
+
|
2285
|
+
})(UIkit);
|
2286
|
+
|
2287
|
+
(function(UI) {
|
2288
|
+
|
2289
|
+
"use strict";
|
2290
|
+
|
2291
|
+
var active = false, activeCount = 0, $html = UI.$html, body;
|
2292
|
+
|
2293
|
+
UI.component('modal', {
|
2294
|
+
|
2295
|
+
defaults: {
|
2296
|
+
keyboard: true,
|
2297
|
+
bgclose: true,
|
2298
|
+
minScrollHeight: 150,
|
2299
|
+
center: false,
|
2300
|
+
modal: true
|
2301
|
+
},
|
2302
|
+
|
2303
|
+
scrollable: false,
|
2304
|
+
transition: false,
|
2305
|
+
|
2306
|
+
init: function() {
|
2307
|
+
|
2308
|
+
if (!body) body = UI.$('body');
|
2309
|
+
|
2310
|
+
if (!this.element.length) return;
|
2311
|
+
|
2312
|
+
var $this = this;
|
2313
|
+
|
2314
|
+
this.paddingdir = "padding-" + (UI.langdirection == 'left' ? "right":"left");
|
2315
|
+
this.dialog = this.find(".uk-modal-dialog");
|
2316
|
+
|
2317
|
+
this.active = false;
|
2318
|
+
|
2319
|
+
// Update ARIA
|
2320
|
+
this.element.attr('aria-hidden', this.element.hasClass("uk-open"));
|
2321
|
+
|
2322
|
+
this.on("click", ".uk-modal-close", function(e) {
|
2323
|
+
e.preventDefault();
|
2324
|
+
$this.hide();
|
2325
|
+
}).on("click", function(e) {
|
2326
|
+
|
2327
|
+
var target = UI.$(e.target);
|
2328
|
+
|
2329
|
+
if (target[0] == $this.element[0] && $this.options.bgclose) {
|
2330
|
+
$this.hide();
|
2331
|
+
}
|
2332
|
+
});
|
2333
|
+
},
|
2334
|
+
|
2335
|
+
toggle: function() {
|
2336
|
+
return this[this.isActive() ? "hide" : "show"]();
|
2337
|
+
},
|
2338
|
+
|
2339
|
+
show: function() {
|
2340
|
+
|
2341
|
+
if (!this.element.length) return;
|
2342
|
+
|
2343
|
+
var $this = this;
|
2344
|
+
|
2345
|
+
if (this.isActive()) return;
|
2346
|
+
|
2347
|
+
if (this.options.modal && active) {
|
2348
|
+
active.hide(true);
|
2349
|
+
}
|
2350
|
+
|
2351
|
+
this.element.removeClass("uk-open").show();
|
2352
|
+
this.resize();
|
2353
|
+
|
2354
|
+
if (this.options.modal) {
|
2355
|
+
active = this;
|
2356
|
+
}
|
2357
|
+
|
2358
|
+
this.active = true;
|
2359
|
+
|
2360
|
+
activeCount++;
|
2361
|
+
|
2362
|
+
this.element.addClass("uk-open");
|
2363
|
+
|
2364
|
+
$html.addClass("uk-modal-page").height(); // force browser engine redraw
|
2365
|
+
|
2366
|
+
// Update ARIA
|
2367
|
+
this.element.attr('aria-hidden', 'false');
|
2368
|
+
|
2369
|
+
this.element.trigger("show.uk.modal");
|
2370
|
+
|
2371
|
+
UI.Utils.checkDisplay(this.dialog, true);
|
2372
|
+
|
2373
|
+
return this;
|
2374
|
+
},
|
2375
|
+
|
2376
|
+
hide: function(force) {
|
2377
|
+
|
2378
|
+
if (!force && UI.support.transition) {
|
2379
|
+
|
2380
|
+
var $this = this;
|
2381
|
+
|
2382
|
+
this.one(UI.support.transition.end, function() {
|
2383
|
+
$this._hide();
|
2384
|
+
}).removeClass("uk-open");
|
2385
|
+
|
2386
|
+
} else {
|
2387
|
+
|
2388
|
+
this._hide();
|
2389
|
+
}
|
2390
|
+
|
2391
|
+
return this;
|
2392
|
+
},
|
2393
|
+
|
2394
|
+
resize: function() {
|
2395
|
+
|
2396
|
+
var bodywidth = body.width();
|
2397
|
+
|
2398
|
+
this.scrollbarwidth = window.innerWidth - bodywidth;
|
2399
|
+
|
2400
|
+
body.css(this.paddingdir, this.scrollbarwidth);
|
2401
|
+
|
2402
|
+
this.element.css('overflow-y', this.scrollbarwidth ? 'scroll' : 'auto');
|
2403
|
+
|
2404
|
+
if (!this.updateScrollable() && this.options.center) {
|
2405
|
+
|
2406
|
+
var dh = this.dialog.outerHeight(),
|
2407
|
+
pad = parseInt(this.dialog.css('margin-top'), 10) + parseInt(this.dialog.css('margin-bottom'), 10);
|
2408
|
+
|
2409
|
+
if ((dh + pad) < window.innerHeight) {
|
2410
|
+
this.dialog.css({'top': (window.innerHeight/2 - dh/2) - pad });
|
2411
|
+
} else {
|
2412
|
+
this.dialog.css({'top': ''});
|
2413
|
+
}
|
2414
|
+
}
|
2415
|
+
},
|
2416
|
+
|
2417
|
+
updateScrollable: function() {
|
2418
|
+
|
2419
|
+
// has scrollable?
|
2420
|
+
var scrollable = this.dialog.find('.uk-overflow-container:visible:first');
|
2421
|
+
|
2422
|
+
if (scrollable.length) {
|
2423
|
+
|
2424
|
+
scrollable.css("height", 0);
|
2425
|
+
|
2426
|
+
var offset = Math.abs(parseInt(this.dialog.css("margin-top"), 10)),
|
2427
|
+
dh = this.dialog.outerHeight(),
|
2428
|
+
wh = window.innerHeight,
|
2429
|
+
h = wh - 2*(offset < 20 ? 20:offset) - dh;
|
2430
|
+
|
2431
|
+
scrollable.css("height", h < this.options.minScrollHeight ? "":h);
|
2432
|
+
|
2433
|
+
return true;
|
2434
|
+
}
|
2435
|
+
|
2436
|
+
return false;
|
2437
|
+
},
|
2438
|
+
|
2439
|
+
_hide: function() {
|
2440
|
+
|
2441
|
+
this.active = false;
|
2442
|
+
activeCount--;
|
2443
|
+
|
2444
|
+
this.element.hide().removeClass("uk-open");
|
2445
|
+
|
2446
|
+
// Update ARIA
|
2447
|
+
this.element.attr('aria-hidden', 'true');
|
2448
|
+
|
2449
|
+
if (!activeCount) {
|
2450
|
+
$html.removeClass("uk-modal-page");
|
2451
|
+
body.css(this.paddingdir, "");
|
2452
|
+
}
|
2453
|
+
|
2454
|
+
if(active===this) active = false;
|
2455
|
+
|
2456
|
+
this.trigger("hide.uk.modal");
|
2457
|
+
},
|
2458
|
+
|
2459
|
+
isActive: function() {
|
2460
|
+
return this.active;
|
2461
|
+
}
|
2462
|
+
|
2463
|
+
});
|
2464
|
+
|
2465
|
+
UI.component('modalTrigger', {
|
2466
|
+
|
2467
|
+
boot: function() {
|
2468
|
+
|
2469
|
+
// init code
|
2470
|
+
UI.$html.on("click.modal.uikit", "[data-uk-modal]", function(e) {
|
2471
|
+
|
2472
|
+
var ele = UI.$(this);
|
2473
|
+
|
2474
|
+
if (ele.is("a")) {
|
2475
|
+
e.preventDefault();
|
2476
|
+
}
|
2477
|
+
|
2478
|
+
if (!ele.data("modalTrigger")) {
|
2479
|
+
var modal = UI.modalTrigger(ele, UI.Utils.options(ele.attr("data-uk-modal")));
|
2480
|
+
modal.show();
|
2481
|
+
}
|
2482
|
+
|
2483
|
+
});
|
2484
|
+
|
2485
|
+
// close modal on esc button
|
2486
|
+
UI.$html.on('keydown.modal.uikit', function (e) {
|
2487
|
+
|
2488
|
+
if (active && e.keyCode === 27 && active.options.keyboard) { // ESC
|
2489
|
+
e.preventDefault();
|
2490
|
+
active.hide();
|
2491
|
+
}
|
2492
|
+
});
|
2493
|
+
|
2494
|
+
UI.$win.on("resize orientationchange", UI.Utils.debounce(function(){
|
2495
|
+
if (active) active.resize();
|
2496
|
+
}, 150));
|
2497
|
+
},
|
2498
|
+
|
2499
|
+
init: function() {
|
2500
|
+
|
2501
|
+
var $this = this;
|
2502
|
+
|
2503
|
+
this.options = UI.$.extend({
|
2504
|
+
"target": $this.element.is("a") ? $this.element.attr("href") : false
|
2505
|
+
}, this.options);
|
2506
|
+
|
2507
|
+
this.modal = UI.modal(this.options.target, this.options);
|
2508
|
+
|
2509
|
+
this.on("click", function(e) {
|
2510
|
+
e.preventDefault();
|
2511
|
+
$this.show();
|
2512
|
+
});
|
2513
|
+
|
2514
|
+
//methods
|
2515
|
+
this.proxy(this.modal, "show hide isActive");
|
2516
|
+
}
|
2517
|
+
});
|
2518
|
+
|
2519
|
+
UI.modal.dialog = function(content, options) {
|
2520
|
+
|
2521
|
+
var modal = UI.modal(UI.$(UI.modal.dialog.template).appendTo("body"), options);
|
2522
|
+
|
2523
|
+
modal.on("hide.uk.modal", function(){
|
2524
|
+
if (modal.persist) {
|
2525
|
+
modal.persist.appendTo(modal.persist.data("modalPersistParent"));
|
2526
|
+
modal.persist = false;
|
2527
|
+
}
|
2528
|
+
modal.element.remove();
|
2529
|
+
});
|
2530
|
+
|
2531
|
+
setContent(content, modal);
|
2532
|
+
|
2533
|
+
return modal;
|
2534
|
+
};
|
2535
|
+
|
2536
|
+
UI.modal.dialog.template = '<div class="uk-modal"><div class="uk-modal-dialog" style="min-height:0;"></div></div>';
|
2537
|
+
|
2538
|
+
UI.modal.alert = function(content, options) {
|
2539
|
+
|
2540
|
+
options = UI.$.extend(true, {bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}, options);
|
2541
|
+
|
2542
|
+
var modal = UI.modal.dialog(([
|
2543
|
+
'<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
|
2544
|
+
'<div class="uk-modal-footer uk-text-right"><button class="uk-button uk-button-primary uk-modal-close">'+options.labels.Ok+'</button></div>'
|
2545
|
+
]).join(""), options);
|
2546
|
+
|
2547
|
+
modal.on('show.uk.modal', function(){
|
2548
|
+
setTimeout(function(){
|
2549
|
+
modal.element.find('button:first').focus();
|
2550
|
+
}, 50);
|
2551
|
+
});
|
2552
|
+
|
2553
|
+
return modal.show();
|
2554
|
+
};
|
2555
|
+
|
2556
|
+
UI.modal.confirm = function(content, onconfirm, options) {
|
2557
|
+
|
2558
|
+
onconfirm = UI.$.isFunction(onconfirm) ? onconfirm : function(){};
|
2559
|
+
options = UI.$.extend(true, {bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}, options);
|
2560
|
+
|
2561
|
+
var modal = UI.modal.dialog(([
|
2562
|
+
'<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
|
2563
|
+
'<div class="uk-modal-footer uk-text-right"><button class="uk-button uk-modal-close">'+options.labels.Cancel+'</button> <button class="uk-button uk-button-primary js-modal-confirm">'+options.labels.Ok+'</button></div>'
|
2564
|
+
]).join(""), options);
|
2565
|
+
|
2566
|
+
modal.element.find(".js-modal-confirm").on("click", function(){
|
2567
|
+
onconfirm();
|
2568
|
+
modal.hide();
|
2569
|
+
});
|
2570
|
+
|
2571
|
+
modal.on('show.uk.modal', function(){
|
2572
|
+
setTimeout(function(){
|
2573
|
+
modal.element.find('.js-modal-confirm').focus();
|
2574
|
+
}, 50);
|
2575
|
+
});
|
2576
|
+
|
2577
|
+
return modal.show();
|
2578
|
+
};
|
2579
|
+
|
2580
|
+
UI.modal.prompt = function(text, value, onsubmit, options) {
|
2581
|
+
|
2582
|
+
onsubmit = UI.$.isFunction(onsubmit) ? onsubmit : function(value){};
|
2583
|
+
options = UI.$.extend(true, {bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}, options);
|
2584
|
+
|
2585
|
+
var modal = UI.modal.dialog(([
|
2586
|
+
text ? '<div class="uk-modal-content uk-form">'+String(text)+'</div>':'',
|
2587
|
+
'<div class="uk-margin-small-top uk-modal-content uk-form"><p><input type="text" class="uk-width-1-1"></p></div>',
|
2588
|
+
'<div class="uk-modal-footer uk-text-right"><button class="uk-button uk-modal-close">'+options.labels.Cancel+'</button> <button class="uk-button uk-button-primary js-modal-ok">'+options.labels.Ok+'</button></div>'
|
2589
|
+
]).join(""), options),
|
2590
|
+
|
2591
|
+
input = modal.element.find("input[type='text']").val(value || '').on('keyup', function(e){
|
2592
|
+
if (e.keyCode == 13) {
|
2593
|
+
modal.element.find(".js-modal-ok").trigger('click');
|
2594
|
+
}
|
2595
|
+
});
|
2596
|
+
|
2597
|
+
modal.element.find(".js-modal-ok").on("click", function(){
|
2598
|
+
if (onsubmit(input.val())!==false){
|
2599
|
+
modal.hide();
|
2600
|
+
}
|
2601
|
+
});
|
2602
|
+
|
2603
|
+
modal.on('show.uk.modal', function(){
|
2604
|
+
setTimeout(function(){
|
2605
|
+
input.focus();
|
2606
|
+
}, 50);
|
2607
|
+
});
|
2608
|
+
|
2609
|
+
return modal.show();
|
2610
|
+
};
|
2611
|
+
|
2612
|
+
UI.modal.blockUI = function(content, options) {
|
2613
|
+
|
2614
|
+
var modal = UI.modal.dialog(([
|
2615
|
+
'<div class="uk-margin uk-modal-content">'+String(content || '<div class="uk-text-center">...</div>')+'</div>'
|
2616
|
+
]).join(""), UI.$.extend({bgclose:false, keyboard:false, modal:false}, options));
|
2617
|
+
|
2618
|
+
modal.content = modal.element.find('.uk-modal-content:first');
|
2619
|
+
|
2620
|
+
return modal.show();
|
2621
|
+
};
|
2622
|
+
|
2623
|
+
|
2624
|
+
UI.modal.labels = {
|
2625
|
+
'Ok': 'Ok',
|
2626
|
+
'Cancel': 'Cancel'
|
2627
|
+
};
|
2628
|
+
|
2629
|
+
|
2630
|
+
// helper functions
|
2631
|
+
function setContent(content, modal){
|
2632
|
+
|
2633
|
+
if(!modal) return;
|
2634
|
+
|
2635
|
+
if (typeof content === 'object') {
|
2636
|
+
|
2637
|
+
// convert DOM object to a jQuery object
|
2638
|
+
content = content instanceof jQuery ? content : UI.$(content);
|
2639
|
+
|
2640
|
+
if(content.parent().length) {
|
2641
|
+
modal.persist = content;
|
2642
|
+
modal.persist.data("modalPersistParent", content.parent());
|
2643
|
+
}
|
2644
|
+
}else if (typeof content === 'string' || typeof content === 'number') {
|
2645
|
+
// just insert the data as innerHTML
|
2646
|
+
content = UI.$('<div></div>').html(content);
|
2647
|
+
}else {
|
2648
|
+
// unsupported data type!
|
2649
|
+
content = UI.$('<div></div>').html('UIkit.modal Error: Unsupported data type: ' + typeof content);
|
2650
|
+
}
|
2651
|
+
|
2652
|
+
content.appendTo(modal.element.find('.uk-modal-dialog'));
|
2653
|
+
|
2654
|
+
return modal;
|
2655
|
+
}
|
2656
|
+
|
2657
|
+
})(UIkit);
|
2658
|
+
|
2659
|
+
(function(UI) {
|
2660
|
+
|
2661
|
+
"use strict";
|
2662
|
+
|
2663
|
+
UI.component('nav', {
|
2664
|
+
|
2665
|
+
defaults: {
|
2666
|
+
"toggle": ">li.uk-parent > a[href='#']",
|
2667
|
+
"lists": ">li.uk-parent > ul",
|
2668
|
+
"multiple": false
|
2669
|
+
},
|
2670
|
+
|
2671
|
+
boot: function() {
|
2672
|
+
|
2673
|
+
// init code
|
2674
|
+
UI.ready(function(context) {
|
2675
|
+
|
2676
|
+
UI.$("[data-uk-nav]", context).each(function() {
|
2677
|
+
var nav = UI.$(this);
|
2678
|
+
|
2679
|
+
if (!nav.data("nav")) {
|
2680
|
+
var obj = UI.nav(nav, UI.Utils.options(nav.attr("data-uk-nav")));
|
2681
|
+
}
|
2682
|
+
});
|
2683
|
+
});
|
2684
|
+
},
|
2685
|
+
|
2686
|
+
init: function() {
|
2687
|
+
|
2688
|
+
var $this = this;
|
2689
|
+
|
2690
|
+
this.on("click.uikit.nav", this.options.toggle, function(e) {
|
2691
|
+
e.preventDefault();
|
2692
|
+
var ele = UI.$(this);
|
2693
|
+
$this.open(ele.parent()[0] == $this.element[0] ? ele : ele.parent("li"));
|
2694
|
+
});
|
2695
|
+
|
2696
|
+
this.find(this.options.lists).each(function() {
|
2697
|
+
var $ele = UI.$(this),
|
2698
|
+
parent = $ele.parent(),
|
2699
|
+
active = parent.hasClass("uk-active");
|
2700
|
+
|
2701
|
+
$ele.wrap('<div style="overflow:hidden;height:0;position:relative;"></div>');
|
2702
|
+
parent.data("list-container", $ele.parent()[active ? 'removeClass':'addClass']('uk-hidden'));
|
2703
|
+
|
2704
|
+
// Init ARIA
|
2705
|
+
parent.attr('aria-expanded', parent.hasClass("uk-open"));
|
2706
|
+
|
2707
|
+
if (active) $this.open(parent, true);
|
2708
|
+
});
|
2709
|
+
|
2710
|
+
},
|
2711
|
+
|
2712
|
+
open: function(li, noanimation) {
|
2713
|
+
|
2714
|
+
var $this = this, element = this.element, $li = UI.$(li), $container = $li.data('list-container');
|
2715
|
+
|
2716
|
+
if (!this.options.multiple) {
|
2717
|
+
|
2718
|
+
element.children('.uk-open').not(li).each(function() {
|
2719
|
+
|
2720
|
+
var ele = UI.$(this);
|
2721
|
+
|
2722
|
+
if (ele.data('list-container')) {
|
2723
|
+
ele.data('list-container').stop().animate({height: 0}, function() {
|
2724
|
+
UI.$(this).parent().removeClass('uk-open').end().addClass('uk-hidden');
|
2725
|
+
});
|
2726
|
+
}
|
2727
|
+
});
|
2728
|
+
}
|
2729
|
+
|
2730
|
+
$li.toggleClass('uk-open');
|
2731
|
+
|
2732
|
+
// Update ARIA
|
2733
|
+
$li.attr('aria-expanded', $li.hasClass('uk-open'));
|
2734
|
+
|
2735
|
+
if ($container) {
|
2736
|
+
|
2737
|
+
if ($li.hasClass('uk-open')) {
|
2738
|
+
$container.removeClass('uk-hidden');
|
2739
|
+
}
|
2740
|
+
|
2741
|
+
if (noanimation) {
|
2742
|
+
|
2743
|
+
$container.stop().height($li.hasClass('uk-open') ? 'auto' : 0);
|
2744
|
+
|
2745
|
+
if (!$li.hasClass('uk-open')) {
|
2746
|
+
$container.addClass('uk-hidden');
|
2747
|
+
}
|
2748
|
+
|
2749
|
+
this.trigger('display.uk.check');
|
2750
|
+
|
2751
|
+
} else {
|
2752
|
+
|
2753
|
+
$container.stop().animate({
|
2754
|
+
height: ($li.hasClass('uk-open') ? getHeight($container.find('ul:first')) : 0)
|
2755
|
+
}, function() {
|
2756
|
+
|
2757
|
+
if (!$li.hasClass('uk-open')) {
|
2758
|
+
$container.addClass('uk-hidden');
|
2759
|
+
} else {
|
2760
|
+
$container.css('height', '');
|
2761
|
+
}
|
2762
|
+
|
2763
|
+
$this.trigger('display.uk.check');
|
2764
|
+
});
|
2765
|
+
}
|
2766
|
+
}
|
2767
|
+
}
|
2768
|
+
});
|
2769
|
+
|
2770
|
+
|
2771
|
+
// helper
|
2772
|
+
|
2773
|
+
function getHeight(ele) {
|
2774
|
+
var $ele = UI.$(ele), height = "auto";
|
2775
|
+
|
2776
|
+
if ($ele.is(":visible")) {
|
2777
|
+
height = $ele.outerHeight();
|
2778
|
+
} else {
|
2779
|
+
var tmp = {
|
2780
|
+
position: $ele.css("position"),
|
2781
|
+
visibility: $ele.css("visibility"),
|
2782
|
+
display: $ele.css("display")
|
2783
|
+
};
|
2784
|
+
|
2785
|
+
height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
|
2786
|
+
|
2787
|
+
$ele.css(tmp); // reset element
|
2788
|
+
}
|
2789
|
+
|
2790
|
+
return height;
|
2791
|
+
}
|
2792
|
+
|
2793
|
+
})(UIkit);
|
2794
|
+
|
2795
|
+
(function(UI) {
|
2796
|
+
|
2797
|
+
"use strict";
|
2798
|
+
|
2799
|
+
var scrollpos = {x: window.scrollX, y: window.scrollY},
|
2800
|
+
$win = UI.$win,
|
2801
|
+
$doc = UI.$doc,
|
2802
|
+
$html = UI.$html,
|
2803
|
+
Offcanvas = {
|
2804
|
+
|
2805
|
+
show: function(element) {
|
2806
|
+
|
2807
|
+
element = UI.$(element);
|
2808
|
+
|
2809
|
+
if (!element.length) return;
|
2810
|
+
|
2811
|
+
var $body = UI.$('body'),
|
2812
|
+
bar = element.find(".uk-offcanvas-bar:first"),
|
2813
|
+
rtl = (UI.langdirection == "right"),
|
2814
|
+
flip = bar.hasClass("uk-offcanvas-bar-flip") ? -1:1,
|
2815
|
+
dir = flip * (rtl ? -1 : 1),
|
2816
|
+
|
2817
|
+
scrollbarwidth = window.innerWidth - $body.width();
|
2818
|
+
|
2819
|
+
scrollpos = {x: window.pageXOffset, y: window.pageYOffset};
|
2820
|
+
|
2821
|
+
element.addClass("uk-active");
|
2822
|
+
|
2823
|
+
$body.css({"width": window.innerWidth - scrollbarwidth, "height": window.innerHeight}).addClass("uk-offcanvas-page");
|
2824
|
+
$body.css((rtl ? "margin-right" : "margin-left"), (rtl ? -1 : 1) * (bar.outerWidth() * dir)).width(); // .width() - force redraw
|
2825
|
+
|
2826
|
+
$html.css('margin-top', scrollpos.y * -1);
|
2827
|
+
|
2828
|
+
bar.addClass("uk-offcanvas-bar-show");
|
2829
|
+
|
2830
|
+
this._initElement(element);
|
2831
|
+
|
2832
|
+
bar.trigger('show.uk.offcanvas', [element, bar]);
|
2833
|
+
|
2834
|
+
// Update ARIA
|
2835
|
+
element.attr('aria-hidden', 'false');
|
2836
|
+
},
|
2837
|
+
|
2838
|
+
hide: function(force) {
|
2839
|
+
|
2840
|
+
var $body = UI.$('body'),
|
2841
|
+
panel = UI.$(".uk-offcanvas.uk-active"),
|
2842
|
+
rtl = (UI.langdirection == "right"),
|
2843
|
+
bar = panel.find(".uk-offcanvas-bar:first"),
|
2844
|
+
finalize = function() {
|
2845
|
+
$body.removeClass("uk-offcanvas-page").css({"width": "", "height": "", "margin-left": "", "margin-right": ""});
|
2846
|
+
panel.removeClass("uk-active");
|
2847
|
+
|
2848
|
+
bar.removeClass("uk-offcanvas-bar-show");
|
2849
|
+
$html.css('margin-top', '');
|
2850
|
+
window.scrollTo(scrollpos.x, scrollpos.y);
|
2851
|
+
bar.trigger('hide.uk.offcanvas', [panel, bar]);
|
2852
|
+
|
2853
|
+
// Update ARIA
|
2854
|
+
panel.attr('aria-hidden', 'true');
|
2855
|
+
};
|
2856
|
+
|
2857
|
+
if (!panel.length) return;
|
2858
|
+
|
2859
|
+
if (UI.support.transition && !force) {
|
2860
|
+
|
2861
|
+
$body.one(UI.support.transition.end, function() {
|
2862
|
+
finalize();
|
2863
|
+
}).css((rtl ? "margin-right" : "margin-left"), "");
|
2864
|
+
|
2865
|
+
setTimeout(function(){
|
2866
|
+
bar.removeClass("uk-offcanvas-bar-show");
|
2867
|
+
}, 0);
|
2868
|
+
|
2869
|
+
} else {
|
2870
|
+
finalize();
|
2871
|
+
}
|
2872
|
+
},
|
2873
|
+
|
2874
|
+
_initElement: function(element) {
|
2875
|
+
|
2876
|
+
if (element.data("OffcanvasInit")) return;
|
2877
|
+
|
2878
|
+
element.on("click.uk.offcanvas swipeRight.uk.offcanvas swipeLeft.uk.offcanvas", function(e) {
|
2879
|
+
|
2880
|
+
var target = UI.$(e.target);
|
2881
|
+
|
2882
|
+
if (!e.type.match(/swipe/)) {
|
2883
|
+
|
2884
|
+
if (!target.hasClass("uk-offcanvas-close")) {
|
2885
|
+
if (target.hasClass("uk-offcanvas-bar")) return;
|
2886
|
+
if (target.parents(".uk-offcanvas-bar:first").length) return;
|
2887
|
+
}
|
2888
|
+
}
|
2889
|
+
|
2890
|
+
e.stopImmediatePropagation();
|
2891
|
+
Offcanvas.hide();
|
2892
|
+
});
|
2893
|
+
|
2894
|
+
element.on("click", "a[href^='#']", function(e){
|
2895
|
+
|
2896
|
+
var link = UI.$(this),
|
2897
|
+
href = link.attr("href");
|
2898
|
+
|
2899
|
+
if (href == "#") {
|
2900
|
+
return;
|
2901
|
+
}
|
2902
|
+
|
2903
|
+
UI.$doc.one('hide.uk.offcanvas', function() {
|
2904
|
+
|
2905
|
+
var target;
|
2906
|
+
|
2907
|
+
try {
|
2908
|
+
target = UI.$(href);
|
2909
|
+
} catch (e){
|
2910
|
+
target = ""
|
2911
|
+
}
|
2912
|
+
|
2913
|
+
if (!target.length) {
|
2914
|
+
target = UI.$('[name="'+href.replace('#','')+'"]');
|
2915
|
+
}
|
2916
|
+
|
2917
|
+
if (target.length && link.attr('data-uk-smooth-scroll') && UI.Utils.scrollToElement) {
|
2918
|
+
UI.Utils.scrollToElement(target, UI.Utils.options(link.attr('data-uk-smooth-scroll') || '{}'));
|
2919
|
+
} else {
|
2920
|
+
window.location.href = href;
|
2921
|
+
}
|
2922
|
+
});
|
2923
|
+
|
2924
|
+
Offcanvas.hide();
|
2925
|
+
});
|
2926
|
+
|
2927
|
+
element.data("OffcanvasInit", true);
|
2928
|
+
}
|
2929
|
+
};
|
2930
|
+
|
2931
|
+
UI.component('offcanvasTrigger', {
|
2932
|
+
|
2933
|
+
boot: function() {
|
2934
|
+
|
2935
|
+
// init code
|
2936
|
+
$html.on("click.offcanvas.uikit", "[data-uk-offcanvas]", function(e) {
|
2937
|
+
|
2938
|
+
e.preventDefault();
|
2939
|
+
|
2940
|
+
var ele = UI.$(this);
|
2941
|
+
|
2942
|
+
if (!ele.data("offcanvasTrigger")) {
|
2943
|
+
var obj = UI.offcanvasTrigger(ele, UI.Utils.options(ele.attr("data-uk-offcanvas")));
|
2944
|
+
ele.trigger("click");
|
2945
|
+
}
|
2946
|
+
});
|
2947
|
+
|
2948
|
+
$html.on('keydown.uk.offcanvas', function(e) {
|
2949
|
+
|
2950
|
+
if (e.keyCode === 27) { // ESC
|
2951
|
+
Offcanvas.hide();
|
2952
|
+
}
|
2953
|
+
});
|
2954
|
+
},
|
2955
|
+
|
2956
|
+
init: function() {
|
2957
|
+
|
2958
|
+
var $this = this;
|
2959
|
+
|
2960
|
+
this.options = UI.$.extend({
|
2961
|
+
"target": $this.element.is("a") ? $this.element.attr("href") : false
|
2962
|
+
}, this.options);
|
2963
|
+
|
2964
|
+
this.on("click", function(e) {
|
2965
|
+
e.preventDefault();
|
2966
|
+
Offcanvas.show($this.options.target);
|
2967
|
+
});
|
2968
|
+
}
|
2969
|
+
});
|
2970
|
+
|
2971
|
+
UI.offcanvas = Offcanvas;
|
2972
|
+
|
2973
|
+
})(UIkit);
|
2974
|
+
|
2975
|
+
(function(UI) {
|
2976
|
+
|
2977
|
+
"use strict";
|
2978
|
+
|
2979
|
+
var Animations;
|
2980
|
+
|
2981
|
+
UI.component('switcher', {
|
2982
|
+
|
2983
|
+
defaults: {
|
2984
|
+
connect : false,
|
2985
|
+
toggle : ">*",
|
2986
|
+
active : 0,
|
2987
|
+
animation : false,
|
2988
|
+
duration : 200,
|
2989
|
+
swiping : true
|
2990
|
+
},
|
2991
|
+
|
2992
|
+
animating: false,
|
2993
|
+
|
2994
|
+
boot: function() {
|
2995
|
+
|
2996
|
+
// init code
|
2997
|
+
UI.ready(function(context) {
|
2998
|
+
|
2999
|
+
UI.$("[data-uk-switcher]", context).each(function() {
|
3000
|
+
var switcher = UI.$(this);
|
3001
|
+
|
3002
|
+
if (!switcher.data("switcher")) {
|
3003
|
+
var obj = UI.switcher(switcher, UI.Utils.options(switcher.attr("data-uk-switcher")));
|
3004
|
+
}
|
3005
|
+
});
|
3006
|
+
});
|
3007
|
+
},
|
3008
|
+
|
3009
|
+
init: function() {
|
3010
|
+
|
3011
|
+
var $this = this;
|
3012
|
+
|
3013
|
+
this.on("click.uikit.switcher", this.options.toggle, function(e) {
|
3014
|
+
e.preventDefault();
|
3015
|
+
$this.show(this);
|
3016
|
+
});
|
3017
|
+
|
3018
|
+
if (this.options.connect) {
|
3019
|
+
|
3020
|
+
this.connect = UI.$(this.options.connect);
|
3021
|
+
|
3022
|
+
this.connect.find(".uk-active").removeClass(".uk-active");
|
3023
|
+
|
3024
|
+
// delegate switch commands within container content
|
3025
|
+
if (this.connect.length) {
|
3026
|
+
|
3027
|
+
// Init ARIA for connect
|
3028
|
+
this.connect.children().attr('aria-hidden', 'true');
|
3029
|
+
|
3030
|
+
this.connect.on("click", '[data-uk-switcher-item]', function(e) {
|
3031
|
+
|
3032
|
+
e.preventDefault();
|
3033
|
+
|
3034
|
+
var item = UI.$(this).attr('data-uk-switcher-item');
|
3035
|
+
|
3036
|
+
if ($this.index == item) return;
|
3037
|
+
|
3038
|
+
switch(item) {
|
3039
|
+
case 'next':
|
3040
|
+
case 'previous':
|
3041
|
+
$this.show($this.index + (item=='next' ? 1:-1));
|
3042
|
+
break;
|
3043
|
+
default:
|
3044
|
+
$this.show(parseInt(item, 10));
|
3045
|
+
}
|
3046
|
+
})
|
3047
|
+
|
3048
|
+
if (this.options.swiping) {
|
3049
|
+
|
3050
|
+
this.connect.on('swipeRight swipeLeft', function(e) {
|
3051
|
+
e.preventDefault();
|
3052
|
+
if(!window.getSelection().toString()) {
|
3053
|
+
$this.show($this.index + (e.type == 'swipeLeft' ? 1 : -1));
|
3054
|
+
}
|
3055
|
+
});
|
3056
|
+
}
|
3057
|
+
}
|
3058
|
+
|
3059
|
+
var toggles = this.find(this.options.toggle),
|
3060
|
+
active = toggles.filter(".uk-active");
|
3061
|
+
|
3062
|
+
if (active.length) {
|
3063
|
+
this.show(active, false);
|
3064
|
+
} else {
|
3065
|
+
|
3066
|
+
if (this.options.active===false) return;
|
3067
|
+
|
3068
|
+
active = toggles.eq(this.options.active);
|
3069
|
+
this.show(active.length ? active : toggles.eq(0), false);
|
3070
|
+
}
|
3071
|
+
|
3072
|
+
// Init ARIA for toggles
|
3073
|
+
toggles.not(active).attr('aria-expanded', 'false');
|
3074
|
+
active.attr('aria-expanded', 'true');
|
3075
|
+
|
3076
|
+
this.on('changed.uk.dom', function() {
|
3077
|
+
$this.connect = UI.$($this.options.connect);
|
3078
|
+
});
|
3079
|
+
}
|
3080
|
+
|
3081
|
+
},
|
3082
|
+
|
3083
|
+
show: function(tab, animate) {
|
3084
|
+
|
3085
|
+
if (this.animating) {
|
3086
|
+
return;
|
3087
|
+
}
|
3088
|
+
|
3089
|
+
if (isNaN(tab)) {
|
3090
|
+
tab = UI.$(tab);
|
3091
|
+
} else {
|
3092
|
+
|
3093
|
+
var toggles = this.find(this.options.toggle);
|
3094
|
+
|
3095
|
+
tab = tab < 0 ? toggles.length-1 : tab;
|
3096
|
+
tab = toggles.eq(toggles[tab] ? tab : 0);
|
3097
|
+
}
|
3098
|
+
|
3099
|
+
var $this = this,
|
3100
|
+
toggles = this.find(this.options.toggle),
|
3101
|
+
active = UI.$(tab),
|
3102
|
+
animation = Animations[this.options.animation] || function(current, next) {
|
3103
|
+
|
3104
|
+
if (!$this.options.animation) {
|
3105
|
+
return Animations.none.apply($this);
|
3106
|
+
}
|
3107
|
+
|
3108
|
+
var anim = $this.options.animation.split(',');
|
3109
|
+
|
3110
|
+
if (anim.length == 1) {
|
3111
|
+
anim[1] = anim[0];
|
3112
|
+
}
|
3113
|
+
|
3114
|
+
anim[0] = anim[0].trim();
|
3115
|
+
anim[1] = anim[1].trim();
|
3116
|
+
|
3117
|
+
return coreAnimation.apply($this, [anim, current, next]);
|
3118
|
+
};
|
3119
|
+
|
3120
|
+
if (animate===false || !UI.support.animation) {
|
3121
|
+
animation = Animations.none;
|
3122
|
+
}
|
3123
|
+
|
3124
|
+
if (active.hasClass("uk-disabled")) return;
|
3125
|
+
|
3126
|
+
// Update ARIA for Toggles
|
3127
|
+
toggles.attr('aria-expanded', 'false');
|
3128
|
+
active.attr('aria-expanded', 'true');
|
3129
|
+
|
3130
|
+
toggles.filter(".uk-active").removeClass("uk-active");
|
3131
|
+
active.addClass("uk-active");
|
3132
|
+
|
3133
|
+
if (this.options.connect && this.connect.length) {
|
3134
|
+
|
3135
|
+
this.index = this.find(this.options.toggle).index(active);
|
3136
|
+
|
3137
|
+
if (this.index == -1 ) {
|
3138
|
+
this.index = 0;
|
3139
|
+
}
|
3140
|
+
|
3141
|
+
this.connect.each(function() {
|
3142
|
+
|
3143
|
+
var container = UI.$(this),
|
3144
|
+
children = UI.$(container.children()),
|
3145
|
+
current = UI.$(children.filter('.uk-active')),
|
3146
|
+
next = UI.$(children.eq($this.index));
|
3147
|
+
|
3148
|
+
$this.animating = true;
|
3149
|
+
|
3150
|
+
animation.apply($this, [current, next]).then(function(){
|
3151
|
+
|
3152
|
+
current.removeClass("uk-active");
|
3153
|
+
next.addClass("uk-active");
|
3154
|
+
|
3155
|
+
// Update ARIA for connect
|
3156
|
+
current.attr('aria-hidden', 'true');
|
3157
|
+
next.attr('aria-hidden', 'false');
|
3158
|
+
|
3159
|
+
UI.Utils.checkDisplay(next, true);
|
3160
|
+
|
3161
|
+
$this.animating = false;
|
3162
|
+
});
|
3163
|
+
});
|
3164
|
+
}
|
3165
|
+
|
3166
|
+
this.trigger("show.uk.switcher", [active]);
|
3167
|
+
}
|
3168
|
+
});
|
3169
|
+
|
3170
|
+
Animations = {
|
3171
|
+
|
3172
|
+
'none': function() {
|
3173
|
+
var d = UI.$.Deferred();
|
3174
|
+
d.resolve();
|
3175
|
+
return d.promise();
|
3176
|
+
},
|
3177
|
+
|
3178
|
+
'fade': function(current, next) {
|
3179
|
+
return coreAnimation.apply(this, ['uk-animation-fade', current, next]);
|
3180
|
+
},
|
3181
|
+
|
3182
|
+
'slide-bottom': function(current, next) {
|
3183
|
+
return coreAnimation.apply(this, ['uk-animation-slide-bottom', current, next]);
|
3184
|
+
},
|
3185
|
+
|
3186
|
+
'slide-top': function(current, next) {
|
3187
|
+
return coreAnimation.apply(this, ['uk-animation-slide-top', current, next]);
|
3188
|
+
},
|
3189
|
+
|
3190
|
+
'slide-vertical': function(current, next, dir) {
|
3191
|
+
|
3192
|
+
var anim = ['uk-animation-slide-top', 'uk-animation-slide-bottom'];
|
3193
|
+
|
3194
|
+
if (current && current.index() > next.index()) {
|
3195
|
+
anim.reverse();
|
3196
|
+
}
|
3197
|
+
|
3198
|
+
return coreAnimation.apply(this, [anim, current, next]);
|
3199
|
+
},
|
3200
|
+
|
3201
|
+
'slide-left': function(current, next) {
|
3202
|
+
return coreAnimation.apply(this, ['uk-animation-slide-left', current, next]);
|
3203
|
+
},
|
3204
|
+
|
3205
|
+
'slide-right': function(current, next) {
|
3206
|
+
return coreAnimation.apply(this, ['uk-animation-slide-right', current, next]);
|
3207
|
+
},
|
3208
|
+
|
3209
|
+
'slide-horizontal': function(current, next, dir) {
|
3210
|
+
|
3211
|
+
var anim = ['uk-animation-slide-right', 'uk-animation-slide-left'];
|
3212
|
+
|
3213
|
+
if (current && current.index() > next.index()) {
|
3214
|
+
anim.reverse();
|
3215
|
+
}
|
3216
|
+
|
3217
|
+
return coreAnimation.apply(this, [anim, current, next]);
|
3218
|
+
},
|
3219
|
+
|
3220
|
+
'scale': function(current, next) {
|
3221
|
+
return coreAnimation.apply(this, ['uk-animation-scale-up', current, next]);
|
3222
|
+
}
|
3223
|
+
};
|
3224
|
+
|
3225
|
+
UI.switcher.animations = Animations;
|
3226
|
+
|
3227
|
+
|
3228
|
+
// helpers
|
3229
|
+
|
3230
|
+
function coreAnimation(cls, current, next) {
|
3231
|
+
|
3232
|
+
var d = UI.$.Deferred(), clsIn = cls, clsOut = cls, release;
|
3233
|
+
|
3234
|
+
if (next[0]===current[0]) {
|
3235
|
+
d.resolve();
|
3236
|
+
return d.promise();
|
3237
|
+
}
|
3238
|
+
|
3239
|
+
if (typeof(cls) == 'object') {
|
3240
|
+
clsIn = cls[0];
|
3241
|
+
clsOut = cls[1] || cls[0];
|
3242
|
+
}
|
3243
|
+
|
3244
|
+
release = function() {
|
3245
|
+
|
3246
|
+
if (current) current.hide().removeClass('uk-active '+clsOut+' uk-animation-reverse');
|
3247
|
+
|
3248
|
+
next.addClass(clsIn).one(UI.support.animation.end, function() {
|
3249
|
+
|
3250
|
+
next.removeClass(''+clsIn+'').css({opacity:'', display:''});
|
3251
|
+
|
3252
|
+
d.resolve();
|
3253
|
+
|
3254
|
+
if (current) current.css({opacity:'', display:''});
|
3255
|
+
|
3256
|
+
}.bind(this)).show();
|
3257
|
+
};
|
3258
|
+
|
3259
|
+
next.css('animation-duration', this.options.duration+'ms');
|
3260
|
+
|
3261
|
+
if (current && current.length) {
|
3262
|
+
|
3263
|
+
current.css('animation-duration', this.options.duration+'ms');
|
3264
|
+
|
3265
|
+
current.css('display', 'none').addClass(clsOut+' uk-animation-reverse').one(UI.support.animation.end, function() {
|
3266
|
+
release();
|
3267
|
+
}.bind(this)).css('display', '');
|
3268
|
+
|
3269
|
+
} else {
|
3270
|
+
next.addClass('uk-active');
|
3271
|
+
release();
|
3272
|
+
}
|
3273
|
+
|
3274
|
+
return d.promise();
|
3275
|
+
}
|
3276
|
+
|
3277
|
+
})(UIkit);
|
3278
|
+
|
3279
|
+
(function(UI) {
|
3280
|
+
|
3281
|
+
"use strict";
|
3282
|
+
|
3283
|
+
UI.component('tab', {
|
3284
|
+
|
3285
|
+
defaults: {
|
3286
|
+
'target' : '>li:not(.uk-tab-responsive, .uk-disabled)',
|
3287
|
+
'connect' : false,
|
3288
|
+
'active' : 0,
|
3289
|
+
'animation' : false,
|
3290
|
+
'duration' : 200
|
3291
|
+
},
|
3292
|
+
|
3293
|
+
boot: function() {
|
3294
|
+
|
3295
|
+
// init code
|
3296
|
+
UI.ready(function(context) {
|
3297
|
+
|
3298
|
+
UI.$("[data-uk-tab]", context).each(function() {
|
3299
|
+
|
3300
|
+
var tab = UI.$(this);
|
3301
|
+
|
3302
|
+
if (!tab.data("tab")) {
|
3303
|
+
var obj = UI.tab(tab, UI.Utils.options(tab.attr("data-uk-tab")));
|
3304
|
+
}
|
3305
|
+
});
|
3306
|
+
});
|
3307
|
+
},
|
3308
|
+
|
3309
|
+
init: function() {
|
3310
|
+
|
3311
|
+
var $this = this;
|
3312
|
+
|
3313
|
+
this.current = false;
|
3314
|
+
|
3315
|
+
this.on("click.uikit.tab", this.options.target, function(e) {
|
3316
|
+
|
3317
|
+
e.preventDefault();
|
3318
|
+
|
3319
|
+
if ($this.switcher && $this.switcher.animating) {
|
3320
|
+
return;
|
3321
|
+
}
|
3322
|
+
|
3323
|
+
var current = $this.find($this.options.target).not(this);
|
3324
|
+
|
3325
|
+
current.removeClass("uk-active").blur();
|
3326
|
+
|
3327
|
+
$this.trigger("change.uk.tab", [UI.$(this).addClass("uk-active"), $this.current]);
|
3328
|
+
|
3329
|
+
$this.current = UI.$(this);
|
3330
|
+
|
3331
|
+
// Update ARIA
|
3332
|
+
if (!$this.options.connect) {
|
3333
|
+
current.attr('aria-expanded', 'false');
|
3334
|
+
UI.$(this).attr('aria-expanded', 'true');
|
3335
|
+
}
|
3336
|
+
});
|
3337
|
+
|
3338
|
+
if (this.options.connect) {
|
3339
|
+
this.connect = UI.$(this.options.connect);
|
3340
|
+
}
|
3341
|
+
|
3342
|
+
// init responsive tab
|
3343
|
+
this.responsivetab = UI.$('<li class="uk-tab-responsive uk-active"><a></a></li>').append('<div class="uk-dropdown uk-dropdown-small"><ul class="uk-nav uk-nav-dropdown"></ul><div>');
|
3344
|
+
|
3345
|
+
this.responsivetab.dropdown = this.responsivetab.find('.uk-dropdown');
|
3346
|
+
this.responsivetab.lst = this.responsivetab.dropdown.find('ul');
|
3347
|
+
this.responsivetab.caption = this.responsivetab.find('a:first');
|
3348
|
+
|
3349
|
+
if (this.element.hasClass("uk-tab-bottom")) this.responsivetab.dropdown.addClass("uk-dropdown-up");
|
3350
|
+
|
3351
|
+
// handle click
|
3352
|
+
this.responsivetab.lst.on('click.uikit.tab', 'a', function(e) {
|
3353
|
+
|
3354
|
+
e.preventDefault();
|
3355
|
+
e.stopPropagation();
|
3356
|
+
|
3357
|
+
var link = UI.$(this);
|
3358
|
+
|
3359
|
+
$this.element.children('li:not(.uk-tab-responsive)').eq(link.data('index')).trigger('click');
|
3360
|
+
});
|
3361
|
+
|
3362
|
+
this.on('show.uk.switcher change.uk.tab', function(e, tab) {
|
3363
|
+
$this.responsivetab.caption.html(tab.text());
|
3364
|
+
});
|
3365
|
+
|
3366
|
+
this.element.append(this.responsivetab);
|
3367
|
+
|
3368
|
+
// init UIkit components
|
3369
|
+
if (this.options.connect) {
|
3370
|
+
this.switcher = UI.switcher(this.element, {
|
3371
|
+
"toggle" : ">li:not(.uk-tab-responsive)",
|
3372
|
+
"connect" : this.options.connect,
|
3373
|
+
"active" : this.options.active,
|
3374
|
+
"animation" : this.options.animation,
|
3375
|
+
"duration" : this.options.duration
|
3376
|
+
});
|
3377
|
+
}
|
3378
|
+
|
3379
|
+
UI.dropdown(this.responsivetab, {"mode": "click"});
|
3380
|
+
|
3381
|
+
// init
|
3382
|
+
$this.trigger("change.uk.tab", [this.element.find(this.options.target).not('.uk-tab-responsive').filter('.uk-active')]);
|
3383
|
+
|
3384
|
+
this.check();
|
3385
|
+
|
3386
|
+
UI.$win.on('resize orientationchange', UI.Utils.debounce(function(){
|
3387
|
+
if ($this.element.is(":visible")) $this.check();
|
3388
|
+
}, 100));
|
3389
|
+
|
3390
|
+
this.on('display.uk.check', function(){
|
3391
|
+
if ($this.element.is(":visible")) $this.check();
|
3392
|
+
});
|
3393
|
+
},
|
3394
|
+
|
3395
|
+
check: function() {
|
3396
|
+
|
3397
|
+
var children = this.element.children('li:not(.uk-tab-responsive)').removeClass('uk-hidden');
|
3398
|
+
|
3399
|
+
if (!children.length) {
|
3400
|
+
this.responsivetab.addClass('uk-hidden');
|
3401
|
+
return;
|
3402
|
+
}
|
3403
|
+
|
3404
|
+
var top = (children.eq(0).offset().top + Math.ceil(children.eq(0).height()/2)),
|
3405
|
+
doresponsive = false,
|
3406
|
+
item, link, clone;
|
3407
|
+
|
3408
|
+
this.responsivetab.lst.empty();
|
3409
|
+
|
3410
|
+
children.each(function(){
|
3411
|
+
|
3412
|
+
if (UI.$(this).offset().top > top) {
|
3413
|
+
doresponsive = true;
|
3414
|
+
}
|
3415
|
+
});
|
3416
|
+
|
3417
|
+
if (doresponsive) {
|
3418
|
+
|
3419
|
+
for (var i = 0; i < children.length; i++) {
|
3420
|
+
|
3421
|
+
item = UI.$(children.eq(i));
|
3422
|
+
link = item.find('a');
|
3423
|
+
|
3424
|
+
if (item.css('float') != 'none' && !item.attr('uk-dropdown')) {
|
3425
|
+
|
3426
|
+
if (!item.hasClass('uk-disabled')) {
|
3427
|
+
|
3428
|
+
clone = item[0].outerHTML.replace('<a ', '<a data-index="'+i+'" ');
|
3429
|
+
|
3430
|
+
this.responsivetab.lst.append(clone);
|
3431
|
+
}
|
3432
|
+
|
3433
|
+
item.addClass('uk-hidden');
|
3434
|
+
}
|
3435
|
+
}
|
3436
|
+
}
|
3437
|
+
|
3438
|
+
this.responsivetab[this.responsivetab.lst.children('li').length ? 'removeClass':'addClass']('uk-hidden');
|
3439
|
+
}
|
3440
|
+
});
|
3441
|
+
|
3442
|
+
})(UIkit);
|
3443
|
+
|
3444
|
+
(function(UI){
|
3445
|
+
|
3446
|
+
"use strict";
|
3447
|
+
|
3448
|
+
UI.component('cover', {
|
3449
|
+
|
3450
|
+
defaults: {
|
3451
|
+
automute : true
|
3452
|
+
},
|
3453
|
+
|
3454
|
+
boot: function() {
|
3455
|
+
|
3456
|
+
// auto init
|
3457
|
+
UI.ready(function(context) {
|
3458
|
+
|
3459
|
+
UI.$("[data-uk-cover]", context).each(function(){
|
3460
|
+
|
3461
|
+
var ele = UI.$(this);
|
3462
|
+
|
3463
|
+
if(!ele.data("cover")) {
|
3464
|
+
var plugin = UI.cover(ele, UI.Utils.options(ele.attr("data-uk-cover")));
|
3465
|
+
}
|
3466
|
+
});
|
3467
|
+
});
|
3468
|
+
},
|
3469
|
+
|
3470
|
+
init: function() {
|
3471
|
+
|
3472
|
+
this.parent = this.element.parent();
|
3473
|
+
|
3474
|
+
UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(){
|
3475
|
+
this.check();
|
3476
|
+
}.bind(this), 100));
|
3477
|
+
|
3478
|
+
this.on("display.uk.check", function(e) {
|
3479
|
+
if(this.element.is(":visible")) this.check();
|
3480
|
+
}.bind(this));
|
3481
|
+
|
3482
|
+
this.check();
|
3483
|
+
|
3484
|
+
if (this.element.is('iframe') && this.options.automute) {
|
3485
|
+
|
3486
|
+
var src = this.element.attr('src');
|
3487
|
+
|
3488
|
+
this.element.attr('src', '').on('load', function(){
|
3489
|
+
|
3490
|
+
this.contentWindow.postMessage('{ "event": "command", "func": "mute", "method":"setVolume", "value":0}', '*');
|
3491
|
+
|
3492
|
+
}).attr('src', [src, (src.indexOf('?') > -1 ? '&':'?'), 'enablejsapi=1&api=1'].join(''));
|
3493
|
+
}
|
3494
|
+
},
|
3495
|
+
|
3496
|
+
check: function() {
|
3497
|
+
|
3498
|
+
this.element.css({
|
3499
|
+
'width' : '',
|
3500
|
+
'height' : ''
|
3501
|
+
});
|
3502
|
+
|
3503
|
+
this.dimension = {w: this.element.width(), h: this.element.height()};
|
3504
|
+
|
3505
|
+
if (this.element.attr('width') && !isNaN(this.element.attr('width'))) {
|
3506
|
+
this.dimension.w = this.element.attr('width');
|
3507
|
+
}
|
3508
|
+
|
3509
|
+
if (this.element.attr('height') && !isNaN(this.element.attr('height'))) {
|
3510
|
+
this.dimension.h = this.element.attr('height');
|
3511
|
+
}
|
3512
|
+
|
3513
|
+
this.ratio = this.dimension.w / this.dimension.h;
|
3514
|
+
|
3515
|
+
var w = this.parent.width(), h = this.parent.height(), width, height;
|
3516
|
+
|
3517
|
+
// if element height < parent height (gap underneath)
|
3518
|
+
if ((w / this.ratio) < h) {
|
3519
|
+
|
3520
|
+
width = Math.ceil(h * this.ratio);
|
3521
|
+
height = h;
|
3522
|
+
|
3523
|
+
// element width < parent width (gap to right)
|
3524
|
+
} else {
|
3525
|
+
|
3526
|
+
width = w;
|
3527
|
+
height = Math.ceil(w / this.ratio);
|
3528
|
+
}
|
3529
|
+
|
3530
|
+
this.element.css({
|
3531
|
+
'width' : width,
|
3532
|
+
'height' : height
|
3533
|
+
});
|
3534
|
+
}
|
3535
|
+
});
|
3536
|
+
|
3537
|
+
})(UIkit);
|