zurb-foundation 2.1.5.1 → 2.2.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,9 +5,20 @@ module Foundation
5
5
  class InstallGenerator < Rails::Generators::Base
6
6
  source_root File.join(File.dirname(__FILE__), 'templates')
7
7
 
8
- def add_assets
9
- insert_into_file "app/assets/javascripts/application.js", "//= require foundation\n", :after => "jquery_ujs\n"
10
- insert_into_file "app/assets/stylesheets/application.css", " *= require foundation\n", :after => "require_self\n"
8
+ def add_assets
9
+ insert_into_file "app/assets/javascripts/application#{detect_js_format[0]}", "#{detect_js_format[1]} require foundation\n", :after => "jquery_ujs\n"
10
+ insert_into_file "app/assets/stylesheets/application#{detect_css_format[0]}", "#{detect_css_format[1]} require foundation\n", :after => "require_self\n"
11
+ end
12
+
13
+ def detect_js_format
14
+ return ['.js.coffee', '#='] if File.exist?('app/assets/javascripts/application.js.coffee')
15
+ return ['.js', '//='] if File.exist?('app/assets/javascripts/application.js')
16
+ end
17
+
18
+ def detect_css_format
19
+ return ['.css', ' *='] if File.exist?('app/assets/stylesheets/application.css')
20
+ return ['.css.sass', ' //='] if File.exist?('app/assets/stylesheets/application.css.sass')
21
+ return ['.css.scss', ' //='] if File.exist?('app/assets/stylesheets/application.css.scss')
11
22
  end
12
23
  end
13
24
  end
@@ -1,4 +1,4 @@
1
1
  module Foundation
2
- COMMIT = "bdd2174067a083abc2ab5937c1ad9c92d136a2f0"
3
- VERSION = "2.1.5.1"
2
+ COMMIT = "897984db68d9d4093e9b6e82f1ccb3e5d6c97cd6"
3
+ VERSION = "2.2.0.1"
4
4
  end
@@ -1,4 +1,4 @@
1
- $(document).ready(function () {
1
+ jQuery(document).ready(function ($) {
2
2
 
3
3
  /* Use this js doc for all application specific JS */
4
4
 
@@ -15,7 +15,7 @@ $(document).ready(function () {
15
15
 
16
16
  //Show Tab Content
17
17
  $(contentLocation).closest('.tabs-content').children('li').hide();
18
- $(contentLocation).show();
18
+ $(contentLocation).css('display', 'block');
19
19
  }
20
20
 
21
21
  $('dl.tabs').each(function () {
@@ -44,6 +44,9 @@ $(document).ready(function () {
44
44
 
45
45
  $('input, textarea').placeholder();
46
46
 
47
+ /* TOOLTIPS ------------ */
48
+ $(this).tooltips();
49
+
47
50
 
48
51
 
49
52
  /* UNCOMMENT THE LINE YOU WANT BELOW IF YOU WANT IE6/7/8 SUPPORT AND ARE USING .block-grids */
@@ -70,7 +73,7 @@ $(document).ready(function () {
70
73
  });
71
74
  if (Modernizr.touch) {
72
75
  $('.nav-bar>li.has-flyout>a.main').css({
73
- 'padding-right' : '75px',
76
+ 'padding-right' : '75px'
74
77
  });
75
78
  $('.nav-bar>li.has-flyout>a.flyout-toggle').css({
76
79
  'border-left' : '1px dashed #eee'
@@ -33,7 +33,17 @@ jQuery(document).ready(function ($) {
33
33
  $li;
34
34
 
35
35
  if ($customSelect.length === 0) {
36
- $customSelect = $('<div class="custom dropdown"><a href="#" class="selector"></a><ul></ul></div>"');
36
+ $customSelectSize = '';
37
+ if ($(sel).hasClass('small')) {
38
+ $customSelectSize = 'small';
39
+ } else if ($(sel).hasClass('medium')) {
40
+ $customSelectSize = 'medium';
41
+ } else if ($(sel).hasClass('large')) {
42
+ $customSelectSize = 'large';
43
+ } else if ($(sel).hasClass('expand')) {
44
+ $customSelectSize = 'expand';
45
+ }
46
+ $customSelect = $('<div class="custom dropdown ' + $customSelectSize + '"><a href="#" class="selector"></a><ul></ul></div>"');
37
47
  $options.each(function () {
38
48
  $li = $('<li>' + $(this).html() + '</li>');
39
49
  $customSelect.find('ul').append($li);
@@ -68,8 +78,11 @@ jQuery(document).ready(function ($) {
68
78
  }
69
79
  $customSelect.removeClass('open');
70
80
  });
71
- $customSelect.css('width', maxWidth + 18 + 'px');
72
- $customSelect.find('ul').css('width', maxWidth + 16 + 'px');
81
+
82
+ if (!$customSelect.is('.small, .medium, .large, .expand')) {
83
+ $customSelect.css('width', maxWidth + 18 + 'px');
84
+ $customSelect.find('ul').css('width', maxWidth + 16 + 'px');
85
+ }
73
86
 
74
87
  }
75
88
 
@@ -27,6 +27,8 @@
27
27
  startClockOnMouseOut: false, // if clock should start on MouseOut
28
28
  startClockOnMouseOutAfter: 1000, // how long after MouseOut should the timer start again
29
29
  directionalNav: true, // manual advancing directional navs
30
+ directionalNavRightText: 'Right', // text of right directional element for accessibility
31
+ directionalNavLeftText: 'Left', // text of left directional element for accessibility
30
32
  captions: true, // do you want captions?
31
33
  captionAnimation: 'fade', // fade, slideOpen, none
32
34
  captionAnimationSpeed: 600, // if so how quickly should they animate in
@@ -48,7 +50,7 @@
48
50
  wrapperHTML: '<div class="orbit-wrapper" />',
49
51
  timerHTML: '<div class="timer"><span class="mask"><span class="rotator"></span></span><span class="pause"></span></div>',
50
52
  captionHTML: '<div class="orbit-caption"></div>',
51
- directionalNavHTML: '<div class="slider-nav"><span class="right">Right</span><span class="left">Left</span></div>',
53
+ directionalNavHTML: '<div class="slider-nav"><span class="right"></span><span class="left"></span></div>',
52
54
  bulletHTML: '<ul class="orbit-bullets"></ul>',
53
55
 
54
56
  init: function (element, options) {
@@ -355,9 +357,13 @@
355
357
  },
356
358
 
357
359
  setupDirectionalNav: function () {
358
- var self = this;
360
+ var self = this,
361
+ $directionalNav = $(this.directionalNavHTML);
362
+
363
+ $directionalNav.find('.right').html(this.options.directionalNavRightText);
364
+ $directionalNav.find('.left').html(this.options.directionalNavLeftText);
359
365
 
360
- this.$wrapper.append(this.directionalNavHTML);
366
+ this.$wrapper.append($directionalNav);
361
367
 
362
368
  this.$wrapper.find('.left').click(function () {
363
369
  self.stopClock();
@@ -5,7 +5,7 @@
5
5
  * Free to use under the MIT license.
6
6
  * http://www.opensource.org/licenses/mit-license.php
7
7
  */
8
-
8
+ /*globals jQuery */
9
9
 
10
10
  (function ($) {
11
11
  $('a[data-reveal-id]').live('click', function (event) {
@@ -19,109 +19,136 @@
19
19
  animation: 'fadeAndPop', // fade, fadeAndPop, none
20
20
  animationSpeed: 300, // how fast animtions are
21
21
  closeOnBackgroundClick: true, // if you click background will modal close?
22
- dismissModalClass: 'close-reveal-modal' // the class of a button or element that will close an open modal
22
+ dismissModalClass: 'close-reveal-modal', // the class of a button or element that will close an open modal
23
+ open: $.noop,
24
+ opened: $.noop,
25
+ close: $.noop,
26
+ closed: $.noop
23
27
  };
24
- var options = $.extend({}, defaults, options);
28
+ options = $.extend({}, defaults, options);
25
29
 
26
30
  return this.each(function () {
27
31
  var modal = $(this),
28
- topMeasure = parseInt(modal.css('top')),
32
+ topMeasure = parseInt(modal.css('top'), 10),
29
33
  topOffset = modal.height() + topMeasure,
30
34
  locked = false,
31
- modalBg = $('.reveal-modal-bg');
35
+ modalBg = $('.reveal-modal-bg'),
36
+ closeButton;
32
37
 
33
- if (modalBg.length == 0) {
38
+ if (modalBg.length === 0) {
34
39
  modalBg = $('<div class="reveal-modal-bg" />').insertAfter(modal);
35
40
  modalBg.fadeTo('fast', 0.8);
36
41
  }
42
+
43
+ function unlockModal() {
44
+ locked = false;
45
+ }
46
+
47
+ function lockModal() {
48
+ locked = true;
49
+ }
37
50
 
38
51
  function openAnimation() {
39
- modalBg.unbind('click.modalEvent');
40
- $('.' + options.dismissModalClass).unbind('click.modalEvent');
41
52
  if (!locked) {
42
53
  lockModal();
43
- if (options.animation == "fadeAndPop") {
54
+ if (options.animation === "fadeAndPop") {
44
55
  modal.css({'top': $(document).scrollTop() - topOffset, 'opacity': 0, 'visibility': 'visible'});
45
56
  modalBg.fadeIn(options.animationSpeed / 2);
46
57
  modal.delay(options.animationSpeed / 2).animate({
47
58
  "top": $(document).scrollTop() + topMeasure + 'px',
48
59
  "opacity": 1
49
- }, options.animationSpeed, unlockModal);
60
+ }, options.animationSpeed, function () {
61
+ modal.trigger('reveal:opened');
62
+ });
63
+
50
64
  }
51
- if (options.animation == "fade") {
65
+ if (options.animation === "fade") {
52
66
  modal.css({'opacity': 0, 'visibility': 'visible', 'top': $(document).scrollTop() + topMeasure});
53
67
  modalBg.fadeIn(options.animationSpeed / 2);
54
68
  modal.delay(options.animationSpeed / 2).animate({
55
69
  "opacity": 1
56
- }, options.animationSpeed, unlockModal);
70
+ }, options.animationSpeed, function () {
71
+ modal.trigger('reveal:opened');
72
+ });
73
+
57
74
  }
58
- if (options.animation == "none") {
75
+ if (options.animation === "none") {
59
76
  modal.css({'visibility': 'visible', 'top': $(document).scrollTop() + topMeasure});
60
77
  modalBg.css({"display": "block"});
61
- unlockModal();
78
+ modal.trigger('reveal:opened');
62
79
  }
63
80
  }
64
- modal.unbind('reveal:open', openAnimation);
65
81
  }
66
- modal.bind('reveal:open', openAnimation);
82
+ modal.bind('reveal:open.reveal', openAnimation);
67
83
 
68
84
  function closeAnimation() {
69
85
  if (!locked) {
70
86
  lockModal();
71
- if (options.animation == "fadeAndPop") {
72
- modalBg.delay(options.animationSpeed).fadeOut(options.animationSpeed);
87
+ if (options.animation === "fadeAndPop") {
73
88
  modal.animate({
74
89
  "top": $(document).scrollTop() - topOffset + 'px',
75
90
  "opacity": 0
76
91
  }, options.animationSpeed / 2, function () {
77
92
  modal.css({'top': topMeasure, 'opacity': 1, 'visibility': 'hidden'});
78
- unlockModal();
93
+ });
94
+ modalBg.delay(options.animationSpeed).fadeOut(options.animationSpeed, function () {
95
+ modal.trigger('reveal:closed');
79
96
  });
80
97
  }
81
- if (options.animation == "fade") {
82
- modalBg.delay(options.animationSpeed).fadeOut(options.animationSpeed);
98
+ if (options.animation === "fade") {
83
99
  modal.animate({
84
100
  "opacity" : 0
85
101
  }, options.animationSpeed, function () {
86
102
  modal.css({'opacity': 1, 'visibility': 'hidden', 'top': topMeasure});
87
- unlockModal();
103
+ });
104
+ modalBg.delay(options.animationSpeed).fadeOut(options.animationSpeed, function () {
105
+ modal.trigger('reveal:closed');
88
106
  });
89
107
  }
90
- if (options.animation == "none") {
108
+ if (options.animation === "none") {
91
109
  modal.css({'visibility': 'hidden', 'top': topMeasure});
92
110
  modalBg.css({'display': 'none'});
111
+ modal.trigger('reveal:closed');
93
112
  }
94
113
  }
95
- modal.unbind('reveal:close', closeAnimation);
96
114
  }
97
- modal.bind('reveal:close', closeAnimation);
115
+
116
+ function destroy() {
117
+ modal.unbind('.reveal');
118
+ modalBg.unbind('.reveal');
119
+ $('.' + options.dismissModalClass).unbind('.reveal');
120
+ $('body').unbind('.reveal');
121
+ }
122
+
123
+ modal.bind('reveal:close.reveal', closeAnimation);
124
+ modal.bind('reveal:opened.reveal reveal:closed.reveal', unlockModal);
125
+ modal.bind('reveal:closed.reveal', destroy);
126
+
127
+ modal.bind('reveal:open.reveal', options.open);
128
+ modal.bind('reveal:opened.reveal', options.opened);
129
+ modal.bind('reveal:close.reveal', options.close);
130
+ modal.bind('reveal:closed.reveal', options.closed);
131
+
98
132
  modal.trigger('reveal:open');
99
133
 
100
- var closeButton = $('.' + options.dismissModalClass).bind('click.modalEvent', function () {
134
+ closeButton = $('.' + options.dismissModalClass).bind('click.reveal', function () {
101
135
  modal.trigger('reveal:close');
102
136
  });
103
137
 
104
138
  if (options.closeOnBackgroundClick) {
105
139
  modalBg.css({"cursor": "pointer"});
106
- modalBg.bind('click.modalEvent', function () {
140
+ modalBg.bind('click.reveal', function () {
107
141
  modal.trigger('reveal:close');
108
142
  });
109
143
  }
110
144
 
111
- $('body').keyup(function (event) {
145
+ $('body').bind('keyup.reveal', function (event) {
112
146
  if (event.which === 27) { // 27 is the keycode for the Escape key
113
147
  modal.trigger('reveal:close');
114
148
  }
115
149
  });
116
-
117
- function unlockModal() {
118
- locked = false;
119
- }
120
-
121
- function lockModal() {
122
- locked = true;
123
- }
124
150
  });
125
151
  };
126
- })(jQuery);
152
+ } (jQuery));
153
+
127
154
 
@@ -1,46 +1,87 @@
1
- $(document).ready(function () {
2
- /* TOOLTIPS ---------- */
3
- /* Positiong and options for adding tooltips */
1
+ /*
2
+ * jQuery Foundation Tooltip Plugin 1.0
3
+ * http://foundation.zurb.com
4
+ * Copyright 2012, ZURB
5
+ * Free to use under the MIT license.
6
+ * http://www.opensource.org/licenses/mit-license.php
7
+ */
8
+
9
+ ;(function($) {
10
+ var attributes = {
11
+ bodyHeight : 0,
12
+ pollInterval : 1000
13
+ };
14
+
15
+ var methods = {
16
+ init : function( options ) {
17
+
18
+ return this.each(function() {
19
+ var targets = $('.has-tip'),
20
+ tips = $('.tooltip'),
21
+ tipTemplate = function(target, content) {
22
+ return '<span data-id="' + target + '" class="tooltip">' + content + '<span class="nub"></span></span>';
23
+ },
24
+ poll = setInterval(methods.isDomResized, attributes.pollInterval);
25
+ if (tips.length < 1) {
26
+ targets.each(function(i){
27
+ var target = $(this),
28
+ id = 'foundationTooltip' + i,
29
+ content = target.attr('title'),
30
+ classes = target.attr('class');
31
+ target.data('id', id);
32
+ var tip = $(tipTemplate(id, content));
33
+ tip.addClass(classes).removeClass('has-tip').appendTo('body');
34
+ if (Modernizr.touch) {
35
+ tip.append('<span class="tap-to-close">tap to close </span>');
36
+ }
37
+ methods.reposition(target, tip, classes);
38
+ tip.fadeOut(150);
39
+ });
40
+ }
41
+ $(window).resize(function() {
42
+ var tips = $('.tooltip');
43
+ tips.each(function() {
44
+ var data = $(this).data();
45
+ target = targets = $('.has-tip'),
46
+ tip = $(this),
47
+ classes = tip.attr('class');
48
+ targets.each(function() {
49
+ ($(this).data().id == data.id) ? target = $(this) : target = target;
50
+ });
51
+ methods.reposition(target, tip, classes);
52
+ });
53
+
54
+ });
55
+
56
+ if (Modernizr.touch) {
57
+ $('.tooltip').live('click touchstart touchend', function(e) {
58
+ e.preventDefault();
59
+ $(this).fadeOut(150);
60
+ });
61
+ targets.live('click touchstart touchend', function(e){
62
+ e.preventDefault();
63
+ $('.tooltip').hide();
64
+ $('span[data-id=' + $(this).data('id') + '].tooltip').fadeIn(150);
65
+ targets.attr('title', "");
66
+ });
67
+
68
+ } else {
69
+ targets.hover(function() {
70
+ $('span[data-id=' + $(this).data('id') + '].tooltip').fadeIn(150);
71
+ targets.attr('title', "");
72
+ }, function() {
73
+ $('span[data-id=' + $(this).data('id') + '].tooltip').fadeOut(150);
74
+ });
75
+ }
4
76
 
5
- function foundationTooltipsInit() {
6
- var targets = $('.has-tip'),
7
- tipTemplate = function(target, content) {
8
- return '<span data-id="' + target + '" class="tooltip">' + content + '<span class="nub"></span></span>';
9
- };
10
- targets.each(function(){
11
- var target = $(this),
12
- content = target.attr('title'),
13
- classes = target.attr('class'),
14
- id = target.attr('id'),
15
- tip = $(tipTemplate(id, content));
16
- tip.addClass(classes).removeClass('has-tip').appendTo('body');
17
- reposition(target, tip, classes);
18
- tip.hide();
19
- if (Modernizr.touch) {
20
- tip.append('<span class="tap-to-close">tap to close </span>');
21
- }
22
- });
23
- $(window).resize(function() {
24
- var tips = $('.tooltip');
25
- tips.each(function() {
26
- var target = $('#' + $(this).data('id')),
27
- tip = $(this),
28
- classes = tip.attr('class');
29
- reposition(target, tip, classes);
30
77
  });
31
-
32
- });
33
-
34
- function reposition(target, tip, classes) {
78
+ },
79
+ reposition : function(target, tip, classes) {
35
80
  var width = target.data('width'),
36
81
  nub = tip.children('.nub'),
37
82
  nubHeight = nub.outerHeight(),
38
83
  nubWidth = nub.outerWidth();
39
- tip.css({
40
- 'top' : (target.offset().top + target.outerHeight() + 10),
41
- 'left' : target.offset().left,
42
- 'width' : width
43
- });
84
+
44
85
  function nubPos(nub, top, right, bottom, left) {
45
86
  nub.css({
46
87
  'top' : top,
@@ -49,54 +90,64 @@ $(document).ready(function () {
49
90
  'right' : right
50
91
  });
51
92
  }
93
+
94
+ tip.css({
95
+ 'top' : (target.offset().top + target.outerHeight() + 10),
96
+ 'left' : target.offset().left,
97
+ 'width' : width
98
+ });
52
99
  nubPos(nub, -nubHeight, 'auto', 'auto', 10);
100
+
53
101
  if ($(window).width() < 767) {
54
102
  var row = target.parents('.row');
55
- tip.width(row.outerWidth() - 20).css('left', row.offset().left);
103
+ tip.width(row.outerWidth() - 20).css('left', row.offset().left).addClass('tip-override');
56
104
  nubPos(nub, -nubHeight, 'auto', 'auto', target.offset().left);
57
105
  } else {
58
- if (classes.indexOf('top') > -1) {
59
- tip.css('top', target.offset().top - tip.outerHeight());
60
- nubPos(nub, 'auto', 'auto', -nubHeight, nubWidth);
61
- }
62
- if (classes.indexOf('left') > -1) {
106
+ if (classes.indexOf('tip-top') > -1) {
107
+ var top = target.offset().top - tip.outerHeight() - nubHeight;
108
+ tip.css({
109
+ 'top' : top,
110
+ 'left' : target.offset().left,
111
+ 'width' : width
112
+ }).removeClass('tip-override');
113
+ nubPos(nub, 'auto', 'auto', -nubHeight, 'auto');
114
+ } else if (classes.indexOf('tip-left') > -1) {
63
115
  tip.css({
64
- 'top' : target.offset().top - (target.outerHeight() / 2),
65
- 'left' : target.offset().left - tip.outerWidth() - 10
66
- }).children('.nub').css('top', (tip.outerHeight() / 2) - (nub.outerHeight() / 2));
67
- nubPos(nub, ((tip.outerHeight() / 2) - (nub.outerHeight / 2)), -nubHeight, 'auto', 'auto');
68
- } else if (classes.indexOf('right') > -1){
116
+ 'top' : target.offset().top - (target.outerHeight() / 2) - (nubHeight / 2),
117
+ 'left' : target.offset().left - tip.outerWidth() - 10,
118
+ 'width' : width
119
+ }).removeClass('tip-override');
120
+ nubPos(nub, (tip.outerHeight() / 2) - (nubHeight / 2), -nubHeight, 'auto', 'auto');
121
+ } else if (classes.indexOf('tip-right') > -1){
69
122
  tip.css({
70
- 'top' : target.offset().top - (target.outerHeight() / 2),
71
- 'left' : target.offset().left + target.outerWidth() + 10
72
- }).children('.nub').css('top', (tip.outerHeight() / 2) - (nub.outerHeight() / 2));
73
- nubPos(nub, ((tip.outerHeight() / 2) - (nub.outerHeight / 2)), 'auto', 'auto', -nubHeight);
74
- }
123
+ 'top' : target.offset().top - (target.outerHeight() / 2) - (nubHeight / 2),
124
+ 'left' : target.offset().left + target.outerWidth() + 10,
125
+ 'width' : width
126
+ }).removeClass('tip-override');
127
+ nubPos(nub, (tip.outerHeight() / 2) - (nubHeight / 2), 'auto', 'auto', -nubHeight);
128
+ }
129
+ }
130
+ },
131
+ isDomResized : function() {
132
+ $body = $('body');
133
+ if(attributes.bodyHeight != $body.height()) {
134
+ attributes.bodyHeight = $body.height();
135
+ $(window).trigger('resize');
75
136
  }
76
137
  }
77
- if (Modernizr.touch) {
78
- $('.tooltip').live('click', function(e) {
79
- e.preventDefault();
80
- $(this).hide();
81
- });
82
- targets.live('click', function(){
83
- targets.hover(function() {
84
- $('span[data-id=' + $(this).attr('id') + ']').show();
85
- targets.attr('title', "");
86
- }, function() {
87
- $('span[data-id=' + $(this).attr('id') + ']').hide();
88
- });
89
- });
138
+ };
90
139
 
140
+ $.fn.tooltips = function( method ) {
141
+
142
+ if ( methods[method] ) {
143
+ return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
144
+ } else if ( typeof method === 'object' || ! method ) {
145
+ return methods.init.apply( this, arguments );
91
146
  } else {
92
- targets.hover(function() {
93
- $('span[data-id=' + $(this).attr('id') + ']').show();
94
- targets.attr('title', "");
95
- }, function() {
96
- $('span[data-id=' + $(this).attr('id') + ']').hide();
97
- });
98
- }
99
- }
100
- foundationTooltipsInit();
101
- });
147
+ $.error( 'Method ' + method + ' does not exist on jQuery.tooltips' );
148
+ }
149
+
150
+ };
151
+ })(jQuery);;
152
+
102
153