themepile-abstractio 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +28 -0
  3. data/.rbenv-version +1 -0
  4. data/CONTRIBUTING.md +53 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE +22 -0
  7. data/README.md +136 -0
  8. data/Rakefile +2 -0
  9. data/abstractio.gemspec +18 -0
  10. data/js/foundation/foundation.alerts.js +50 -0
  11. data/js/foundation/foundation.clearing.js +516 -0
  12. data/js/foundation/foundation.cookie.js +74 -0
  13. data/js/foundation/foundation.dropdown.js +159 -0
  14. data/js/foundation/foundation.forms.js +516 -0
  15. data/js/foundation/foundation.joyride.js +842 -0
  16. data/js/foundation/foundation.js +403 -0
  17. data/js/foundation/foundation.magellan.js +130 -0
  18. data/js/foundation/foundation.orbit.js +373 -0
  19. data/js/foundation/foundation.placeholder.js +159 -0
  20. data/js/foundation/foundation.reveal.js +276 -0
  21. data/js/foundation/foundation.section.js +409 -0
  22. data/js/foundation/foundation.tooltips.js +206 -0
  23. data/js/foundation/foundation.topbar.js +252 -0
  24. data/js/foundation/index.js +16 -0
  25. data/js/vendor/custom.modernizr.js +4 -0
  26. data/js/vendor/jquery.js +9597 -0
  27. data/js/vendor/zepto.js +1884 -0
  28. data/lib/abstractio.rb +17 -0
  29. data/lib/abstractio/engine.rb +20 -0
  30. data/lib/abstractio/generators/USAGE +15 -0
  31. data/lib/abstractio/generators/install_generator.rb +54 -0
  32. data/lib/abstractio/generators/templates/application.html.erb +46 -0
  33. data/lib/abstractio/generators/templates/application.html.haml +31 -0
  34. data/lib/abstractio/generators/templates/application.html.slim +28 -0
  35. data/lib/abstractio/version.rb +3 -0
  36. data/lib/themepile-abstractio.rb +17 -0
  37. data/scss/abstractio.scss +46 -0
  38. data/scss/abstractio/_variables.scss +1224 -0
  39. data/scss/abstractio/components/_alert-boxes.scss +107 -0
  40. data/scss/abstractio/components/_block-grid.scss +68 -0
  41. data/scss/abstractio/components/_breadcrumbs.scss +125 -0
  42. data/scss/abstractio/components/_button-groups.scss +89 -0
  43. data/scss/abstractio/components/_buttons.scss +227 -0
  44. data/scss/abstractio/components/_clearing.scss +224 -0
  45. data/scss/abstractio/components/_custom-forms.scss +263 -0
  46. data/scss/abstractio/components/_dropdown-buttons.scss +115 -0
  47. data/scss/abstractio/components/_dropdown.scss +150 -0
  48. data/scss/abstractio/components/_flex-video.scss +46 -0
  49. data/scss/abstractio/components/_forms.scss +362 -0
  50. data/scss/abstractio/components/_global.scss +280 -0
  51. data/scss/abstractio/components/_grid.scss +186 -0
  52. data/scss/abstractio/components/_inline-lists.scss +53 -0
  53. data/scss/abstractio/components/_joyride.scss +215 -0
  54. data/scss/abstractio/components/_keystrokes.scss +57 -0
  55. data/scss/abstractio/components/_labels.scss +85 -0
  56. data/scss/abstractio/components/_magellan.scss +23 -0
  57. data/scss/abstractio/components/_orbit.scss +213 -0
  58. data/scss/abstractio/components/_pagination.scss +100 -0
  59. data/scss/abstractio/components/_panels.scss +77 -0
  60. data/scss/abstractio/components/_pricing-tables.scss +131 -0
  61. data/scss/abstractio/components/_progress-bars.scss +71 -0
  62. data/scss/abstractio/components/_reveal.scss +132 -0
  63. data/scss/abstractio/components/_section.scss +318 -0
  64. data/scss/abstractio/components/_side-nav.scss +69 -0
  65. data/scss/abstractio/components/_split-buttons.scss +167 -0
  66. data/scss/abstractio/components/_sub-nav.scss +68 -0
  67. data/scss/abstractio/components/_switch.scss +251 -0
  68. data/scss/abstractio/components/_tables.scss +84 -0
  69. data/scss/abstractio/components/_thumbs.scss +48 -0
  70. data/scss/abstractio/components/_tooltips.scss +117 -0
  71. data/scss/abstractio/components/_top-bar.scss +495 -0
  72. data/scss/abstractio/components/_type.scss +426 -0
  73. data/scss/abstractio/components/_visibility.scss +322 -0
  74. data/scss/normalize.scss +402 -0
  75. data/templates/project/.gitignore +44 -0
  76. data/templates/project/MIT-LICENSE.txt +20 -0
  77. data/templates/project/config.rb +26 -0
  78. data/templates/project/humans.txt +8 -0
  79. data/templates/project/index.html +124 -0
  80. data/templates/project/manifest.rb +45 -0
  81. data/templates/project/robots.txt +4 -0
  82. data/templates/project/scss/app.scss +48 -0
  83. data/templates/upgrade/manifest.rb +34 -0
  84. metadata +153 -0
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MWRiZDU5YzRmOTA0NjNmMTRkZDk2ZWU3NjQ5ZjFjNTVjNDg1OGYyNA==
5
+ data.tar.gz: !binary |-
6
+ Y2QyY2NjZDk0M2E1MTYyNDllNGUwMDA4NmEzMmRmMzNhYzY2NjFiMg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MjZjNzNkMDc0M2Q3ZTYwYTEwZGZkYmExYjg3OTNlNWFkMmFmODVmNjUwMTgx
10
+ OGQzNWVlZjlhYzRiNmQ2NzIyODFkYTZiZjZlOGE1OGIyMjI2YWMyODBiNGI0
11
+ NzdmNTBlZjE1NzMyOWRkYmQ2NzQzZjU5ZDYzMDdhZWJlODZhN2U=
12
+ data.tar.gz: !binary |-
13
+ MzY2YTM4MDg2Y2E5Njg1OTZjMWEyMDMzMDM4NzZkYzYyODQ1MmQ2YWQxODQw
14
+ MGM1YmU3YjYxMThjM2Y5NTU1OTM4NjhkN2U4MzYzYzRmYzQ1ODJhMjAyYjJj
15
+ Mjc5MWVhMzI5MjBkYWI3NDhmYzhkYmUwNzI4ZjA0Nzg4MmYzN2U=
@@ -0,0 +1,28 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ InstalledFiles
7
+ _yardoc
8
+ coverage
9
+ doc/
10
+ lib/bundler/man
11
+ pkg
12
+ rdoc
13
+ spec/reports
14
+ test/
15
+ test/tmp
16
+ test/version_tmp
17
+ test/css
18
+ test/scss/output-test
19
+ tmp
20
+ *.DS_Store
21
+ marketing/.sass-cache/*
22
+ .sass-cache/*
23
+ test/.sass-cache/*
24
+ test/css/styles.css
25
+ *.orig
26
+ node_modules
27
+ docs/public/*
28
+ *.scssc
@@ -0,0 +1 @@
1
+ 1.9.3-p194
@@ -0,0 +1,53 @@
1
+ # Foundation
2
+
3
+ This is the Foundation project. We love making super awesome stuff, but even more we like to empower people to make changes on their own. Feel free to fork and improve Foundation.
4
+
5
+ <!-- ### JavaScript
6
+
7
+ The Foundation JS libraries are tested with qUnit. You can run the tests in your browser by opening up the respective `.html` files in `test/javascripts/tests/`.
8
+
9
+ For more convenient testing using the command line and watcher functionality, you can also run the tests through Grunt with PhantomJS.
10
+
11
+ **Setting up Grunt for command line testing.**
12
+
13
+ 1. Install [PhantomJS](http://phantomjs.org/)
14
+ 2. Install [Node.js](http://nodejs.org/)
15
+ 3. You may need to reboot your machine to make sure your PATH is up to date.
16
+ 4. From the root of the project, `npm install`. This will install the grunt tasks locally.
17
+ 5. Install the grunt command line interface with `npm install -g grunt-cli`.
18
+
19
+ Now you should have two new commands available. `grunt qunit` will execute all of the qUnit tests. `grunt watch` will watch for changes to the JS files and test files, and execute the tests when something changes. -->
20
+
21
+ ## Compass Project
22
+
23
+ If you have a compass project and would like updated assets you can run the following command at any given time from within your project directory:
24
+
25
+ compass create -r zurb-foundation --using foundation
26
+
27
+ ## Development
28
+
29
+ Want to test out the Compass templates. Don't recompile the gem every time, use `bundler` like so:
30
+
31
+ ```bash
32
+ mkdir demo1
33
+ cd demo1
34
+ echo -e 'source :rubygems\n
35
+ gem "zurb-foundation", :path => "/path/to/foundation/repo"\n
36
+ gem "compass"\n' > Gemfile
37
+ bundle exec compass create -r zurb-foundation --using foundation
38
+ ```
39
+
40
+ On subsequent template updates use:
41
+
42
+ ```bash
43
+ bundle exec compass create -r zurb-foundation --using foundation --force
44
+ ```
45
+
46
+ ## Contributing
47
+
48
+ 1. Fork it
49
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
50
+ 3. Test your changes to the best of your ability. We've provided a test/ folder, feel free to add to it as necessary.
51
+ 4. Commit your changes (`git commit -am 'Added some feature'`)
52
+ 5. Push to the branch (`git push origin my-new-feature`)
53
+ 6. Create new Pull Request
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in abstractio.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Mark Hayes
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,136 @@
1
+ Welcome to Foundation
2
+ =====================
3
+
4
+ Foundation is the most advanced responsive front-end framework in the world. You can quickly prototype and build sites or apps that work on any kind of device with Foundation, which includes layout constructs (like a fully responsive grid), elements and best practices.
5
+
6
+ Homepage: http://foundation.zurb.com<br />
7
+ Documentation: http://foundation.zurb.com/docs<br />
8
+ Download: http://foundation.zurb.com/download.php
9
+
10
+ Foundation is MIT-licensed and absolutely free to use. Foundation wouldn't be possible without the support of the entire ZURB team, our friends and colleagues who gave feedback, and some luminaries who did some heavy lifting that we took advantage of (thanks guys).
11
+
12
+ Repo Contents
13
+ =============
14
+
15
+ * Base Source and Compilation Files for SCSS
16
+ * Docs
17
+ * README
18
+
19
+ ZURB
20
+ ====
21
+
22
+ Foundation was made by [ZURB](http://www.zurb.com), a product design company in Campbell, CA.
23
+
24
+ If Foundation knocks your socks off the way we hope it does and you want more, why not check out [our jobs](http://www.zurb.com/talent)?
25
+
26
+ Community
27
+ =========
28
+
29
+ Many thanks to all the people working on Foundation either to improve the base code or to support specific frameworks. If you want to get on this readme send an email to foundation@zurb.com, and if you have questions you can join the Unofficial Foundation Google Group here: http://groups.google.com/group/foundation-framework-
30
+
31
+ WordPress (Versions marked 3/20/13)
32
+
33
+ * [Reactor](https://github.com/awtheme/reactor) by Anthony Wilhelm using Foundation version 4
34
+ * [Reverie](http://themefortress.com/reverie/) by Zhen using Foundation version 4
35
+ * [Corner Stone](https://github.com/thewirelessguy/cornerstone) by [Stephen Mullen](https://twitter.com/wirelessguyuk) using Foundation version v4.09
36
+ * [required+ Themes](http://themes.required.ch/) by required+ using Foundation version 3.25
37
+ * [Yeti](https://github.com/modlearning/Yeti) by Modular Learning using Foundation version 3.2
38
+ * [Starter Theme](https://github.com/drewsymo/Foundation) by Drew Morris using Foundation version 3
39
+ * [WP-Foundation](http://320press.com/wp-foundation/features/) by 320press using Foundation version 3
40
+ * [f415](https://github.com/javorszky/f415) by Gabor Javorszky
41
+
42
+ Joomla
43
+
44
+ * [Joomla Template](https://github.com/meridiansoftech/joomla_foundation_template) by Arnold Mwumva Ford, Meridian Softech
45
+ * [Joomla Template](https://github.com/antonydoyle/siegeengine) by Antony Doyle, Siege21
46
+
47
+ Drupal
48
+
49
+ * [Drupal Theme](https://github.com/drewkennelly/foundation7) by Drew Kennelly
50
+ * [Zurb Foundation](http://drupal.org/project/zurb-foundation) Supporting F3.2, F4 & Drupal 8 by [Ishmael Sanchez](http://ishmaelsanchez.com), [Chris Lee](http://hire.chrisjlee.net)
51
+ * [Zoundation Theme](http://drupal.org/project/zoundation) by [Andrea Burton](https://twitter.com/andreaburton) & [Jeff Graham](https://twitter.com/jgraham909), FunnyMonkey
52
+
53
+ Alfred
54
+ * [Foundation Alfred](https://github.com/joshmedeski/foundation-alfred) by Josh Medeski (@joshmedeski)
55
+
56
+ PyroCMS
57
+
58
+ * [PyroYeti - PyroCMS Theme](https://github.com/pyrosuit/PyroYeti) by [Arnold Mwumva Ford](https://twitter.com/fordarnold) , Meridian Softech
59
+
60
+ Django
61
+
62
+ * [A foundation theme for the Pinax](http://pypi.python.org/pypi/pinax-theme-foundation) by Christopher Clarke, Kwesi Aguillera & Lendl Smith
63
+
64
+ MODX
65
+
66
+ * [MODX Version](http://designfromwithin.com/blog/2012/02/07/foundation-modx/) by Menno Pietersen
67
+
68
+ .NET
69
+
70
+ * [NuGet Package for ASP.Net MVC](http://www.nuget.org/packages/Foundation3_MVC4) by Edward Charbeneau, @EdCharbeneau
71
+
72
+ Middleman
73
+
74
+ * [Middleman Skeleton](https://github.com/axyz/middleman-zurb-foundation) by [Andrea Moretti](https://twitter.com/axyz)
75
+
76
+ Magento
77
+ * [Magento & Foundation](https://github.com/nandroid/MagentoFoundation) by Nandroid
78
+
79
+ Python
80
+ * [Pyramid Scaffold](https://github.com/ppinette/pyramid_foundation) by Parker Pinette
81
+
82
+ CodeIgniter
83
+
84
+ * [Responsive CodeIgniter BoilerPlate](https://github.com/meridiansoftech/meridian_ci_codebase) by [Arnold Mwumva Ford](https://twitter.com/fordarnold) , Meridian Softech
85
+
86
+ Shopify
87
+
88
+ * [Foundationify Shopify Theme](https://github.com/lukebussey/foundationify) by Luke Bussey
89
+
90
+ Other Implementations
91
+
92
+ * [Mobile First](https://github.com/adamfairhead/mobile-first-foundation) by Adam Fairhead
93
+ * [Less Version](https://github.com/justinmarsan/FoundationLess) by Justin Marsan
94
+ * [Less with Color Scheme](https://github.com/matalin/FoundationLess) by Matalin Hatchard
95
+
96
+ Editors
97
+
98
+ * [Textmate/Sublime Text2 Bundle](https://github.com/liamr/Zurb-Foundation-Textmate-Bundle) by Liam R, @liamr
99
+
100
+ Templates
101
+
102
+ * [Desktop, Tablet and Phone Grid PSD Templates](http://foundation.zurb.com/files/foundation-psd-templates.zip ) by Bruce Abel at Portfolio Creative Services Group
103
+ * [HAML Web Templates](https://github.com/pbonnell/foundation_templates_haml) by Peter Bonnell
104
+
105
+ Grid Generator
106
+
107
+ * [Experimental Grid Generator](http://www.gridlover.net/foundation/) courtesy of [Ville Vanninen](http://foolproof.me)
108
+
109
+ Grid displayer
110
+
111
+ * [Grid displayer bookmarklet](http://alefeuvre.github.com/foundation-grid-displayer/) by [Antoine Lefeuvre](http://twitter.com/jiraisurfer)
112
+ * [Responsive Design Bookmarklet](http://responsive.victorcoulon.fr/) by [Victor Coulon](https://twitter.com/_victa)
113
+ * [Vertical Rhythm Grid Bookmarklet](http://gridwax.gs/) by [Kevin Altman](http://twitter.com/itg)
114
+
115
+ Modular Scale
116
+
117
+ * [Modular Scale](https://github.com/scottkellum/modular-scale) by Mason Wendell and Scott Kellum
118
+
119
+ Ruby on Rails Sass Gems
120
+
121
+ * [Foundation Icons 2](https://github.com/zaiste/foundation-icons-sass-rails) by J. P. Nowak
122
+
123
+ Yeoman Generator
124
+
125
+ * [Yeoman 1.0-Foundation 4](https://github.com/lkbgift/foundation4-yeoman) by [Leonard Bogdonoff](http://twitter.com/lkbcc)
126
+ * [Yeoman-Foundation](https://npmjs.org/package/yeoman-foundation) by Vincent Mac
127
+
128
+
129
+ MIT Open Source License
130
+ =======================
131
+
132
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
133
+
134
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
135
+
136
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,18 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/abstractio/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["ThemePile"]
6
+ gem.email = ["shaggysmile@gmail.com"]
7
+ gem.description = %q{Powerful, scalable, Sass-based, BEM, OOCSS framework}
8
+ gem.summary = %q{Powerful, scalable, Sass-based, BEM, OOCSS framework}
9
+ gem.homepage = "http://abstractio.themepile.co.uk"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.name = "themepile-abstractio"
13
+ gem.require_paths = ["lib"]
14
+ gem.version = Abstractio::VERSION
15
+
16
+ gem.add_dependency "sass", [">= 3.2.0"]
17
+ gem.add_development_dependency "rake"
18
+ end
@@ -0,0 +1,50 @@
1
+ /*jslint unparam: true, browser: true, indent: 2 */
2
+
3
+ ;(function ($, window, document, undefined) {
4
+ 'use strict';
5
+
6
+ Foundation.libs.alerts = {
7
+ name : 'alerts',
8
+
9
+ version : '4.0.0',
10
+
11
+ settings : {
12
+ speed: 300, // fade out speed
13
+ callback: function (){}
14
+ },
15
+
16
+ init : function (scope, method, options) {
17
+ this.scope = scope || this.scope;
18
+
19
+ if (typeof method === 'object') {
20
+ $.extend(true, this.settings, method);
21
+ }
22
+
23
+ if (typeof method != 'string') {
24
+ if (!this.settings.init) this.events();
25
+
26
+ return this.settings.init;
27
+ } else {
28
+ return this[method].call(this, options);
29
+ }
30
+ },
31
+
32
+ events : function () {
33
+ var self = this;
34
+
35
+ $(this.scope).on('click.fndtn.alerts', '[data-alert] a.close', function (e) {
36
+ e.preventDefault();
37
+ $(this).closest("[data-alert]").fadeOut(self.speed, function () {
38
+ $(this).remove();
39
+ self.settings.callback();
40
+ });
41
+ });
42
+
43
+ this.settings.init = true;
44
+ },
45
+
46
+ off : function () {
47
+ $(this.scope).off('.fndtn.alerts');
48
+ }
49
+ };
50
+ }(Foundation.zj, this, this.document));
@@ -0,0 +1,516 @@
1
+ /*jslint unparam: true, browser: true, indent: 2 */
2
+
3
+ ;(function ($, window, document, undefined) {
4
+ 'use strict';
5
+
6
+ Foundation.libs.clearing = {
7
+ name : 'clearing',
8
+
9
+ version : '4.1.3',
10
+
11
+ settings : {
12
+ templates : {
13
+ viewing : '<a href="#" class="clearing-close">&times;</a>' +
14
+ '<div class="visible-img" style="display: none"><img src="//:0">' +
15
+ '<p class="clearing-caption"></p><a href="#" class="clearing-main-prev"><span></span></a>' +
16
+ '<a href="#" class="clearing-main-next"><span></span></a></div>'
17
+ },
18
+
19
+ // comma delimited list of selectors that, on click, will close clearing,
20
+ // add 'div.clearing-blackout, div.visible-img' to close on background click
21
+ close_selectors : '.clearing-close',
22
+
23
+ // event initializers and locks
24
+ init : false,
25
+ locked : false
26
+ },
27
+
28
+ init : function (scope, method, options) {
29
+ var self = this;
30
+ Foundation.inherit(this, 'set_data get_data remove_data throttle data_options');
31
+
32
+ if (typeof method === 'object') {
33
+ options = $.extend(true, this.settings, method);
34
+ }
35
+
36
+ if (typeof method != 'string') {
37
+ $(this.scope).find('ul[data-clearing]').each(function () {
38
+ var $el = $(this),
39
+ options = options || {},
40
+ lis = $el.find('li'),
41
+ settings = self.get_data($el);
42
+
43
+ if (!settings && lis.length > 0) {
44
+ options.$parent = $el.parent();
45
+
46
+ self.set_data($el, $.extend({}, self.settings, options, self.data_options($el)));
47
+
48
+ self.assemble($el.find('li'));
49
+
50
+ if (!self.settings.init) {
51
+ self.events().swipe_events();
52
+ }
53
+ }
54
+ });
55
+
56
+ return this.settings.init;
57
+ } else {
58
+ // fire method
59
+ return this[method].call(this, options);
60
+ }
61
+ },
62
+
63
+ // event binding and initial setup
64
+
65
+ events : function () {
66
+ var self = this;
67
+
68
+ $(this.scope)
69
+ .on('click.fndtn.clearing', 'ul[data-clearing] li',
70
+ function (e, current, target) {
71
+ var current = current || $(this),
72
+ target = target || current,
73
+ next = current.next('li'),
74
+ settings = self.get_data(current.parent()),
75
+ image = $(e.target);
76
+
77
+ e.preventDefault();
78
+ if (!settings) self.init();
79
+
80
+ // if clearing is open and the current image is
81
+ // clicked, go to the next image in sequence
82
+ if (target.hasClass('visible')
83
+ && current[0] === target[0]
84
+ && next.length > 0 && self.is_open(current)) {
85
+ target = next;
86
+ image = target.find('img');
87
+ }
88
+
89
+ // set current and target to the clicked li if not otherwise defined.
90
+ self.open(image, current, target);
91
+ self.update_paddles(target);
92
+ })
93
+
94
+ .on('click.fndtn.clearing', '.clearing-main-next',
95
+ function (e) { this.nav(e, 'next') }.bind(this))
96
+ .on('click.fndtn.clearing', '.clearing-main-prev',
97
+ function (e) { this.nav(e, 'prev') }.bind(this))
98
+ .on('click.fndtn.clearing', this.settings.close_selectors,
99
+ function (e) { Foundation.libs.clearing.close(e, this) })
100
+ .on('keydown.fndtn.clearing',
101
+ function (e) { this.keydown(e) }.bind(this));
102
+
103
+ $(window).on('resize.fndtn.clearing',
104
+ function () { this.resize() }.bind(this));
105
+
106
+ this.settings.init = true;
107
+ return this;
108
+ },
109
+
110
+ swipe_events : function () {
111
+ var self = this;
112
+
113
+ $(this.scope)
114
+ .on('touchstart.fndtn.clearing', '.visible-img', function(e) {
115
+ if (!e.touches) { e = e.originalEvent; }
116
+ var data = {
117
+ start_page_x: e.touches[0].pageX,
118
+ start_page_y: e.touches[0].pageY,
119
+ start_time: (new Date()).getTime(),
120
+ delta_x: 0,
121
+ is_scrolling: undefined
122
+ };
123
+
124
+ $(this).data('swipe-transition', data);
125
+ e.stopPropagation();
126
+ })
127
+ .on('touchmove.fndtn.clearing', '.visible-img', function(e) {
128
+ if (!e.touches) { e = e.originalEvent; }
129
+ // Ignore pinch/zoom events
130
+ if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
131
+
132
+ var data = $(this).data('swipe-transition');
133
+
134
+ if (typeof data === 'undefined') {
135
+ data = {};
136
+ }
137
+
138
+ data.delta_x = e.touches[0].pageX - data.start_page_x;
139
+
140
+ if ( typeof data.is_scrolling === 'undefined') {
141
+ data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
142
+ }
143
+
144
+ if (!data.is_scrolling && !data.active) {
145
+ e.preventDefault();
146
+ var direction = (data.delta_x < 0) ? 'next' : 'prev';
147
+ data.active = true;
148
+ self.nav(e, direction);
149
+ }
150
+ })
151
+ .on('touchend.fndtn.clearing', '.visible-img', function(e) {
152
+ $(this).data('swipe-transition', {});
153
+ e.stopPropagation();
154
+ });
155
+ },
156
+
157
+ assemble : function ($li) {
158
+ var $el = $li.parent();
159
+ $el.after('<div id="foundationClearingHolder"></div>');
160
+
161
+ var holder = $('#foundationClearingHolder'),
162
+ settings = this.get_data($el),
163
+ grid = $el.detach(),
164
+ data = {
165
+ grid: '<div class="carousel">' + this.outerHTML(grid[0]) + '</div>',
166
+ viewing: settings.templates.viewing
167
+ },
168
+ wrapper = '<div class="clearing-assembled"><div>' + data.viewing +
169
+ data.grid + '</div></div>';
170
+
171
+ return holder.after(wrapper).remove();
172
+ },
173
+
174
+ // event callbacks
175
+
176
+ open : function ($image, current, target) {
177
+ var root = target.closest('.clearing-assembled'),
178
+ container = root.find('div').first(),
179
+ visible_image = container.find('.visible-img'),
180
+ image = visible_image.find('img').not($image);
181
+
182
+ if (!this.locked()) {
183
+ // set the image to the selected thumbnail
184
+ image
185
+ .attr('src', this.load($image))
186
+ .css('visibility', 'hidden');
187
+
188
+ this.loaded(image, function () {
189
+ image.css('visibility', 'visible');
190
+ // toggle the gallery
191
+ root.addClass('clearing-blackout');
192
+ container.addClass('clearing-container');
193
+ visible_image.show();
194
+ this.fix_height(target)
195
+ .caption(visible_image.find('.clearing-caption'), $image)
196
+ .center(image)
197
+ .shift(current, target, function () {
198
+ target.siblings().removeClass('visible');
199
+ target.addClass('visible');
200
+ });
201
+ }.bind(this));
202
+ }
203
+ },
204
+
205
+ close : function (e, el) {
206
+ e.preventDefault();
207
+
208
+ var root = (function (target) {
209
+ if (/blackout/.test(target.selector)) {
210
+ return target;
211
+ } else {
212
+ return target.closest('.clearing-blackout');
213
+ }
214
+ }($(el))), container, visible_image;
215
+
216
+ if (el === e.target && root) {
217
+ container = root.find('div').first();
218
+ visible_image = container.find('.visible-img');
219
+ this.settings.prev_index = 0;
220
+ root.find('ul[data-clearing]')
221
+ .attr('style', '').closest('.clearing-blackout')
222
+ .removeClass('clearing-blackout');
223
+ container.removeClass('clearing-container');
224
+ visible_image.hide();
225
+ }
226
+
227
+ return false;
228
+ },
229
+
230
+ is_open : function (current) {
231
+ return current.parent().attr('style').length > 0;
232
+ },
233
+
234
+ keydown : function (e) {
235
+ var clearing = $('.clearing-blackout').find('ul[data-clearing]');
236
+
237
+ if (e.which === 39) this.go(clearing, 'next');
238
+ if (e.which === 37) this.go(clearing, 'prev');
239
+ if (e.which === 27) $('a.clearing-close').trigger('click');
240
+ },
241
+
242
+ nav : function (e, direction) {
243
+ var clearing = $('.clearing-blackout').find('ul[data-clearing]');
244
+
245
+ e.preventDefault();
246
+ this.go(clearing, direction);
247
+ },
248
+
249
+ resize : function () {
250
+ var image = $('.clearing-blackout .visible-img').find('img');
251
+
252
+ if (image.length) {
253
+ this.center(image);
254
+ }
255
+ },
256
+
257
+ // visual adjustments
258
+ fix_height : function (target) {
259
+ var lis = target.parent().children(),
260
+ self = this;
261
+
262
+ lis.each(function () {
263
+ var li = $(this),
264
+ image = li.find('img');
265
+
266
+ if (li.height() > self.outerHeight(image)) {
267
+ li.addClass('fix-height');
268
+ }
269
+ })
270
+ .closest('ul')
271
+ .width(lis.length * 100 + '%');
272
+
273
+ return this;
274
+ },
275
+
276
+ update_paddles : function (target) {
277
+ var visible_image = target
278
+ .closest('.carousel')
279
+ .siblings('.visible-img');
280
+
281
+ if (target.next().length > 0) {
282
+ visible_image
283
+ .find('.clearing-main-next')
284
+ .removeClass('disabled');
285
+ } else {
286
+ visible_image
287
+ .find('.clearing-main-next')
288
+ .addClass('disabled');
289
+ }
290
+
291
+ if (target.prev().length > 0) {
292
+ visible_image
293
+ .find('.clearing-main-prev')
294
+ .removeClass('disabled');
295
+ } else {
296
+ visible_image
297
+ .find('.clearing-main-prev')
298
+ .addClass('disabled');
299
+ }
300
+ },
301
+
302
+ center : function (target) {
303
+ if (!this.rtl) {
304
+ target.css({
305
+ marginLeft : -(this.outerWidth(target) / 2),
306
+ marginTop : -(this.outerHeight(target) / 2)
307
+ });
308
+ } else {
309
+ target.css({
310
+ marginRight : -(this.outerWidth(target) / 2),
311
+ marginTop : -(this.outerHeight(target) / 2)
312
+ });
313
+ }
314
+ return this;
315
+ },
316
+
317
+ // image loading and preloading
318
+
319
+ load : function ($image) {
320
+ if ($image[0].nodeName === "A") {
321
+ var href = $image.attr('href');
322
+ } else {
323
+ var href = $image.parent().attr('href');
324
+ }
325
+
326
+ this.preload($image);
327
+
328
+ if (href) return href;
329
+ return $image.attr('src');
330
+ },
331
+
332
+ preload : function ($image) {
333
+ this
334
+ .img($image.closest('li').next())
335
+ .img($image.closest('li').prev());
336
+ },
337
+
338
+ loaded : function (image, callback) {
339
+ // based on jquery.imageready.js
340
+ // @weblinc, @jsantell, (c) 2012
341
+
342
+ function loaded () {
343
+ callback();
344
+ }
345
+
346
+ function bindLoad () {
347
+ this.one('load', loaded);
348
+
349
+ if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
350
+ var src = this.attr( 'src' ),
351
+ param = src.match( /\?/ ) ? '&' : '?';
352
+
353
+ param += 'random=' + (new Date()).getTime();
354
+ this.attr('src', src + param);
355
+ }
356
+ }
357
+
358
+ if (!image.attr('src')) {
359
+ loaded();
360
+ return;
361
+ }
362
+
363
+ if (image[0].complete || image[0].readyState === 4) {
364
+ loaded();
365
+ } else {
366
+ bindLoad.call(image);
367
+ }
368
+ },
369
+
370
+ img : function (img) {
371
+ if (img.length) {
372
+ var new_img = new Image(),
373
+ new_a = img.find('a');
374
+
375
+ if (new_a.length) {
376
+ new_img.src = new_a.attr('href');
377
+ } else {
378
+ new_img.src = img.find('img').attr('src');
379
+ }
380
+ }
381
+ return this;
382
+ },
383
+
384
+ // image caption
385
+
386
+ caption : function (container, $image) {
387
+ var caption = $image.data('caption');
388
+
389
+ if (caption) {
390
+ container
391
+ .text(caption)
392
+ .show();
393
+ } else {
394
+ container
395
+ .text('')
396
+ .hide();
397
+ }
398
+ return this;
399
+ },
400
+
401
+ // directional methods
402
+
403
+ go : function ($ul, direction) {
404
+ var current = $ul.find('.visible'),
405
+ target = current[direction]();
406
+
407
+ if (target.length) {
408
+ target
409
+ .find('img')
410
+ .trigger('click', [current, target]);
411
+ }
412
+ },
413
+
414
+ shift : function (current, target, callback) {
415
+ var clearing = target.parent(),
416
+ old_index = this.settings.prev_index || target.index(),
417
+ direction = this.direction(clearing, current, target),
418
+ left = parseInt(clearing.css('left'), 10),
419
+ width = this.outerWidth(target),
420
+ skip_shift;
421
+
422
+ // we use jQuery animate instead of CSS transitions because we
423
+ // need a callback to unlock the next animation
424
+ if (target.index() !== old_index && !/skip/.test(direction)){
425
+ if (/left/.test(direction)) {
426
+ this.lock();
427
+ clearing.animate({left : left + width}, 300, this.unlock());
428
+ } else if (/right/.test(direction)) {
429
+ this.lock();
430
+ clearing.animate({left : left - width}, 300, this.unlock());
431
+ }
432
+ } else if (/skip/.test(direction)) {
433
+ // the target image is not adjacent to the current image, so
434
+ // do we scroll right or not
435
+ skip_shift = target.index() - this.settings.up_count;
436
+ this.lock();
437
+
438
+ if (skip_shift > 0) {
439
+ clearing.animate({left : -(skip_shift * width)}, 300, this.unlock());
440
+ } else {
441
+ clearing.animate({left : 0}, 300, this.unlock());
442
+ }
443
+ }
444
+
445
+ callback();
446
+ },
447
+
448
+ direction : function ($el, current, target) {
449
+ var lis = $el.find('li'),
450
+ li_width = this.outerWidth(lis) + (this.outerWidth(lis) / 4),
451
+ up_count = Math.floor(this.outerWidth($('.clearing-container')) / li_width) - 1,
452
+ target_index = lis.index(target),
453
+ response;
454
+
455
+ this.settings.up_count = up_count;
456
+
457
+ if (this.adjacent(this.settings.prev_index, target_index)) {
458
+ if ((target_index > up_count)
459
+ && target_index > this.settings.prev_index) {
460
+ response = 'right';
461
+ } else if ((target_index > up_count - 1)
462
+ && target_index <= this.settings.prev_index) {
463
+ response = 'left';
464
+ } else {
465
+ response = false;
466
+ }
467
+ } else {
468
+ response = 'skip';
469
+ }
470
+
471
+ this.settings.prev_index = target_index;
472
+
473
+ return response;
474
+ },
475
+
476
+ adjacent : function (current_index, target_index) {
477
+ for (var i = target_index + 1; i >= target_index - 1; i--) {
478
+ if (i === current_index) return true;
479
+ }
480
+ return false;
481
+ },
482
+
483
+ // lock management
484
+
485
+ lock : function () {
486
+ this.settings.locked = true;
487
+ },
488
+
489
+ unlock : function () {
490
+ this.settings.locked = false;
491
+ },
492
+
493
+ locked : function () {
494
+ return this.settings.locked;
495
+ },
496
+
497
+ // plugin management/browser quirks
498
+
499
+ outerHTML : function (el) {
500
+ // support FireFox < 11
501
+ return el.outerHTML || new XMLSerializer().serializeToString(el);
502
+ },
503
+
504
+ off : function () {
505
+ $(this.scope).off('.fndtn.clearing');
506
+ $(window).off('.fndtn.clearing');
507
+ this.remove_data(); // empty settings cache
508
+ this.settings.init = false;
509
+ },
510
+
511
+ reflow : function () {
512
+ this.init();
513
+ }
514
+ };
515
+
516
+ }(Foundation.zj, this, this.document));