framous 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.mkdn +6 -0
- data/stylesheets/framous/base/_base.scss +3 -1
- data/stylesheets/framous/base/_typography.scss +3 -4
- data/templates/project/config.rb +28 -0
- data/templates/project/index.html +2 -0
- data/templates/project/javascripts/plugins/framous.collapse.js +336 -0
- data/templates/project/javascripts/plugins/framous.dropdown.js +212 -0
- data/templates/project/javascripts/plugins/framous.modal.js +163 -0
- data/templates/project/javascripts/plugins/framous.scrollspy.js +221 -0
- data/templates/project/javascripts/plugins/framous.sticky.js +75 -0
- data/templates/project/javascripts/plugins/framous.toggle.js +162 -0
- data/templates/project/javascripts/plugins/framous.tooltip.js +262 -0
- data/templates/project/javascripts/vendors/jquery-1.10.1.min.js +6 -0
- data/templates/project/manifest.rb +15 -1
- data/templates/project/screen.scss +7 -1
- data/templates/project/stylesheets/layout/_footer.scss +3 -0
- data/templates/project/stylesheets/layout/_header.scss +3 -0
- data/templates/project/stylesheets/layout/_main.scss +3 -0
- metadata +16 -5
- data/templates/project/_settings.scss +0 -91
@@ -0,0 +1,163 @@
|
|
1
|
+
/*
|
2
|
+
* Modal plugin for jQuery
|
3
|
+
* --
|
4
|
+
* source: http://github.com/borderlab/framous
|
5
|
+
* site:
|
6
|
+
*
|
7
|
+
* @author Thomas Hermant (http://hanami.be)
|
8
|
+
* Copyright 2013, Thomas Hermant
|
9
|
+
* Released under the MIT, BSD, and GPL Licenses.
|
10
|
+
*/
|
11
|
+
|
12
|
+
(function ( $ ) {
|
13
|
+
|
14
|
+
// global vars
|
15
|
+
var is_touch = !!('ontouchstart' in window) || !!('onmsgesturechange' in window),
|
16
|
+
modals,
|
17
|
+
btn_close_and_backgrounds,
|
18
|
+
links,
|
19
|
+
// add event depending of touch device or not
|
20
|
+
add_event = function(el, action)
|
21
|
+
{
|
22
|
+
if(is_touch)
|
23
|
+
{
|
24
|
+
var init_x, int_y, delta_x, delta_y;
|
25
|
+
|
26
|
+
el.on("touchstart.framous.modal", function(e){
|
27
|
+
init_x = (e && e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0].pageX) ? e.originalEvent.touches[0].pageX : 0;
|
28
|
+
init_y = (e && e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0].pageX) ? e.originalEvent.touches[0].pageY : 0;
|
29
|
+
delta_x = 0;
|
30
|
+
delta_y = 0;
|
31
|
+
});
|
32
|
+
|
33
|
+
el.on("touchmove.framous.modal", function(e){
|
34
|
+
delta_x = e.originalEvent.touches[0].pageX - init_x;
|
35
|
+
delta_y = e.originalEvent.touches[0].pageY - init_y;
|
36
|
+
});
|
37
|
+
|
38
|
+
el.on("touchend.framous.modal", function(e){
|
39
|
+
e.preventDefault();
|
40
|
+
|
41
|
+
// tap event -> no scroll
|
42
|
+
if(Math.abs(delta_x) < 2 && Math.abs(delta_y) < 2)
|
43
|
+
{
|
44
|
+
action(e);
|
45
|
+
}
|
46
|
+
});
|
47
|
+
}
|
48
|
+
else
|
49
|
+
{
|
50
|
+
el.on("click.framous.modal",function(e){
|
51
|
+
action(e);
|
52
|
+
});
|
53
|
+
}
|
54
|
+
};
|
55
|
+
|
56
|
+
var methods = {
|
57
|
+
|
58
|
+
init : function( options ) {
|
59
|
+
|
60
|
+
// default options
|
61
|
+
var settings = $.extend({
|
62
|
+
link_active_class: "is-active",
|
63
|
+
modal_class: "js-modal",
|
64
|
+
modal_bkg_class: "js-modal",
|
65
|
+
modal_content_class: "js-modal-content",
|
66
|
+
modal_close_class: "js-modal-close",
|
67
|
+
modal_active_class: "is-visible",
|
68
|
+
}, options );
|
69
|
+
|
70
|
+
// get modals
|
71
|
+
modals = $("." + settings.modal_class);
|
72
|
+
|
73
|
+
// get links
|
74
|
+
links = $(this.selector);
|
75
|
+
|
76
|
+
// get btn close and background model for closing event
|
77
|
+
btn_close_and_backgrounds = $("." + settings.modal_close_class + ", ." + settings.modal_bkg_class);
|
78
|
+
|
79
|
+
// action close modal
|
80
|
+
var close_all_modals = function(e)
|
81
|
+
{
|
82
|
+
e.preventDefault();
|
83
|
+
links.removeClass(settings.link_active_class);
|
84
|
+
modals.removeClass(settings.modal_active_class);
|
85
|
+
};
|
86
|
+
|
87
|
+
// create event on "click"/"tap" close button
|
88
|
+
btn_close_and_backgrounds.each(function(index){
|
89
|
+
var btn = $(this);
|
90
|
+
add_event(btn,close_all_modals);
|
91
|
+
});
|
92
|
+
|
93
|
+
// init height and position of each content
|
94
|
+
modals.each(function(index){
|
95
|
+
var modal = $(this);
|
96
|
+
var modal_content = modal.find("." + settings.modal_content_class);
|
97
|
+
modal_content.on(is_touch ? "touchstart.framous.modal" : "click.framous.modal",function(e){
|
98
|
+
// to avoid hide content modal
|
99
|
+
e.stopPropagation();
|
100
|
+
});
|
101
|
+
modal_content.css({height:"auto"});
|
102
|
+
var h = modal_content.innerHeight();
|
103
|
+
modal_content.css({marginTop:- Math.round(h/2) + "px"})
|
104
|
+
});
|
105
|
+
|
106
|
+
var active_link = function(index)
|
107
|
+
{
|
108
|
+
links.removeClass(settings.link_active_class).eq(index).addClass(settings.link_active_class);
|
109
|
+
};
|
110
|
+
|
111
|
+
var active_modal = function(index)
|
112
|
+
{
|
113
|
+
modals.removeClass(settings.modal_active_class).eq(index).addClass(settings.modal_active_class);
|
114
|
+
};
|
115
|
+
|
116
|
+
// chaining
|
117
|
+
return this.each(function(index){
|
118
|
+
|
119
|
+
var link = $(this);
|
120
|
+
|
121
|
+
var event_link_action = function(e)
|
122
|
+
{
|
123
|
+
e.preventDefault();
|
124
|
+
|
125
|
+
var href = link.attr("href");
|
126
|
+
var modal = modals.filter(href);
|
127
|
+
|
128
|
+
active_link(index);
|
129
|
+
active_modal(index);
|
130
|
+
}
|
131
|
+
|
132
|
+
add_event(link,event_link_action);
|
133
|
+
});
|
134
|
+
},
|
135
|
+
// display the modal with the id
|
136
|
+
display : function(id) {
|
137
|
+
var link = $(this.selector).filter("[href='#"+id+"']");
|
138
|
+
link.trigger(is_touch ? "touchstart.framous.modal" : "click.framous.modal");
|
139
|
+
if(is_touch)
|
140
|
+
{
|
141
|
+
link.trigger("touchend.framous.modal");
|
142
|
+
}
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
$.fn.modal = function(methodOrOptions)
|
147
|
+
{
|
148
|
+
if ( methods[methodOrOptions] )
|
149
|
+
{
|
150
|
+
return methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));
|
151
|
+
}
|
152
|
+
else if ( typeof methodOrOptions === 'object' || ! methodOrOptions )
|
153
|
+
{
|
154
|
+
// Default to "init"
|
155
|
+
return methods.init.apply( this, arguments );
|
156
|
+
}
|
157
|
+
else
|
158
|
+
{
|
159
|
+
$.error('Method ' + method + ' does not exist on jQuery.scrollspy');
|
160
|
+
}
|
161
|
+
};
|
162
|
+
|
163
|
+
}( jQuery ));
|
@@ -0,0 +1,221 @@
|
|
1
|
+
/*
|
2
|
+
* ScrollSpy plugin for jQuery
|
3
|
+
* --
|
4
|
+
* source: http://github.com/borderlab/framous
|
5
|
+
* site:
|
6
|
+
*
|
7
|
+
* @author Thomas Hermant (http://hanami.be)
|
8
|
+
* Copyright 2013, Thomas Hermant
|
9
|
+
* Released under the MIT, BSD, and GPL Licenses.
|
10
|
+
*/
|
11
|
+
|
12
|
+
(function ( $ ) {
|
13
|
+
// vars
|
14
|
+
var is_touch = !!('ontouchstart' in window) || !!('onmsgesturechange' in window),
|
15
|
+
win = $(window),
|
16
|
+
nav,
|
17
|
+
nav_links,
|
18
|
+
html_body,
|
19
|
+
targets,
|
20
|
+
targets_ids = [],
|
21
|
+
targets_offset_tops = [],
|
22
|
+
targets_count = 0,
|
23
|
+
time_out,
|
24
|
+
current_index = null,
|
25
|
+
after_scroll_func,
|
26
|
+
has_after_scroll = false,
|
27
|
+
// get window height
|
28
|
+
win_height = win.height(),
|
29
|
+
// add click or tap event depending if it's a touch device or not
|
30
|
+
add_event = function(el, action)
|
31
|
+
{
|
32
|
+
if(is_touch)
|
33
|
+
{
|
34
|
+
var init_x, int_y, delta_x, delta_y;
|
35
|
+
|
36
|
+
el.on("touchstart.framous.scrollspy", function(e){
|
37
|
+
init_x = (e && e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0].pageX) ? e.originalEvent.touches[0].pageX : 0;
|
38
|
+
init_y = (e && e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0].pageX) ? e.originalEvent.touches[0].pageY : 0;
|
39
|
+
delta_x = 0;
|
40
|
+
delta_y = 0;
|
41
|
+
});
|
42
|
+
|
43
|
+
el.on("touchmove.framous.scrollspy", function(e){
|
44
|
+
delta_x = e.originalEvent.touches[0].pageX - init_x;
|
45
|
+
delta_y = e.originalEvent.touches[0].pageY - init_y;
|
46
|
+
});
|
47
|
+
|
48
|
+
el.on("touchend.framous.scrollspy", function(e){
|
49
|
+
e.preventDefault();
|
50
|
+
|
51
|
+
// no scroll -> tap event
|
52
|
+
if(Math.abs(delta_x) < 2 && Math.abs(delta_y) < 2)
|
53
|
+
{
|
54
|
+
action(e);
|
55
|
+
}
|
56
|
+
});
|
57
|
+
}
|
58
|
+
else
|
59
|
+
{
|
60
|
+
el.on("click.framous.scrollspy",function(e){
|
61
|
+
action(e);
|
62
|
+
});
|
63
|
+
}
|
64
|
+
};
|
65
|
+
|
66
|
+
|
67
|
+
// listen to window resize event
|
68
|
+
win.on("resize.framous.scrollspy", function(e){
|
69
|
+
win_height = win.height();
|
70
|
+
});
|
71
|
+
|
72
|
+
var methods = {
|
73
|
+
|
74
|
+
init : function( options ) {
|
75
|
+
|
76
|
+
// default options
|
77
|
+
var settings = $.extend({
|
78
|
+
// time for scrolling animation
|
79
|
+
scroll_time: 700,
|
80
|
+
// link to spy in the navigation
|
81
|
+
link_class: null,
|
82
|
+
// active class for links of the navigation
|
83
|
+
active_link_class: "is-active",
|
84
|
+
// active class for targets
|
85
|
+
active_content_class: "is-target",
|
86
|
+
// delay for firing the after_scroll handler
|
87
|
+
after_scroll_delay: 100,
|
88
|
+
// after scroll handler
|
89
|
+
after_scroll: null, // function(index){...}
|
90
|
+
// activate or not the scroll when click/tap on link
|
91
|
+
link_scrolling: true,
|
92
|
+
// check the offset top of the target on each scroll event | when false check the offset top at launch plugin launch
|
93
|
+
live_target_offset_top: false
|
94
|
+
}, options );
|
95
|
+
|
96
|
+
// element for scroll animation
|
97
|
+
nav = this;
|
98
|
+
html_body = $("html, body");
|
99
|
+
nav_links = nav.find((settings.link_class == null ? "a" : "a." + settings.link_class));
|
100
|
+
targets_count = nav_links.length;
|
101
|
+
has_after_scroll = (settings.after_scroll != null && typeof settings.after_scroll == "function");
|
102
|
+
|
103
|
+
// init targets_ids array and targets_offset_tops array
|
104
|
+
nav_links.each(function(index){
|
105
|
+
var target_id = $(this).attr("href");
|
106
|
+
targets_ids.push(target_id);
|
107
|
+
var target = $(target_id);
|
108
|
+
targets_offset_tops.push(Math.ceil(target.offset().top));
|
109
|
+
});
|
110
|
+
|
111
|
+
targets = $(targets_ids.join(','));
|
112
|
+
|
113
|
+
// add events for links
|
114
|
+
if(settings.link_scrolling)
|
115
|
+
{
|
116
|
+
nav_links.each(function(index){
|
117
|
+
var nav_link = $(this);
|
118
|
+
|
119
|
+
// scrolling action when click/tap on link
|
120
|
+
var event_link_action = function(e)
|
121
|
+
{
|
122
|
+
e.preventDefault();
|
123
|
+
html_body.animate({scrollTop: targets_offset_tops[index]},{duration: settings.scroll_time});
|
124
|
+
};
|
125
|
+
|
126
|
+
add_event(nav_link,event_link_action);
|
127
|
+
});
|
128
|
+
}
|
129
|
+
|
130
|
+
// active the "index" target
|
131
|
+
var active_target = function(index)
|
132
|
+
{
|
133
|
+
targets.removeClass(settings.active_content_class).eq(index).addClass(settings.active_content_class);
|
134
|
+
};
|
135
|
+
|
136
|
+
// active the "index" link
|
137
|
+
var active_link = function(index)
|
138
|
+
{
|
139
|
+
nav_links.removeClass(settings.active_link_class).eq(index).addClass(settings.active_link_class);
|
140
|
+
};
|
141
|
+
|
142
|
+
// set current index from window scrollTop
|
143
|
+
var set_current_index = function(scroll_top)
|
144
|
+
{
|
145
|
+
// search for the current index
|
146
|
+
for(var i = 0 ; i < targets_count; i++)
|
147
|
+
{
|
148
|
+
var target_offset_top = (settings.live_target_offset_top) ? targets.eq(i).offset().top : targets_offset_tops[i];
|
149
|
+
if(target_offset_top - scroll_top <= 0)
|
150
|
+
{
|
151
|
+
current_index = i;
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
155
|
+
// check if we are at the end of the page scroll
|
156
|
+
if (scroll_top >= (html_body.prop("scrollHeight") - win_height))
|
157
|
+
{
|
158
|
+
current_index = targets_count - 1;
|
159
|
+
}
|
160
|
+
}
|
161
|
+
|
162
|
+
// after scroll
|
163
|
+
if(has_after_scroll)
|
164
|
+
{
|
165
|
+
after_scroll_func = function()
|
166
|
+
{
|
167
|
+
settings.after_scroll(current_index);
|
168
|
+
}
|
169
|
+
}
|
170
|
+
|
171
|
+
// listen the event scroll
|
172
|
+
win.on("scroll.framous.scrollspy", function(e){
|
173
|
+
set_current_index(win.scrollTop());
|
174
|
+
active_link(current_index);
|
175
|
+
active_target(current_index);
|
176
|
+
|
177
|
+
// after scroll action
|
178
|
+
if(has_after_scroll)
|
179
|
+
{
|
180
|
+
clearTimeout(time_out);
|
181
|
+
time_out = setTimeout(after_scroll_func,settings.after_scroll_delay);
|
182
|
+
}
|
183
|
+
});
|
184
|
+
|
185
|
+
// default event scroll
|
186
|
+
win.trigger("scroll.framous.scrollspy");
|
187
|
+
|
188
|
+
// chaining
|
189
|
+
return this;
|
190
|
+
},
|
191
|
+
|
192
|
+
// animate to id target
|
193
|
+
goto : function(id) {
|
194
|
+
var nav = $(this.selector);
|
195
|
+
var link = nav.find('a[href="#'+id + '"]');
|
196
|
+
link.trigger((is_touch ? "touchstart.framous.scrollspy" : "click.framous.scrollspy"));
|
197
|
+
if (is_touch)
|
198
|
+
{
|
199
|
+
link.trigger("touchend.framous.scrollspy");
|
200
|
+
}
|
201
|
+
}
|
202
|
+
}
|
203
|
+
|
204
|
+
$.fn.scrollspy = function(methodOrOptions)
|
205
|
+
{
|
206
|
+
if ( methods[methodOrOptions] )
|
207
|
+
{
|
208
|
+
return methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));
|
209
|
+
}
|
210
|
+
else if ( typeof methodOrOptions === 'object' || ! methodOrOptions )
|
211
|
+
{
|
212
|
+
// Default to "init"
|
213
|
+
return methods.init.apply( this, arguments );
|
214
|
+
}
|
215
|
+
else
|
216
|
+
{
|
217
|
+
$.error('Method ' + method + ' does not exist on jQuery.scrollspy');
|
218
|
+
}
|
219
|
+
};
|
220
|
+
|
221
|
+
}( jQuery ));
|
@@ -0,0 +1,75 @@
|
|
1
|
+
/*
|
2
|
+
* Sticky plugin for jQuery
|
3
|
+
* --
|
4
|
+
* source: http://github.com/borderlab/framous
|
5
|
+
* site:
|
6
|
+
*
|
7
|
+
* @author Thomas Hermant (http://hanami.be)
|
8
|
+
* Copyright 2013, Thomas Hermant
|
9
|
+
* Released under the MIT, BSD, and GPL Licenses.
|
10
|
+
*/
|
11
|
+
|
12
|
+
(function ( $ ) {
|
13
|
+
|
14
|
+
// global vars
|
15
|
+
var is_touch = !!('ontouchstart' in window) || !!('onmsgesturechange' in window),
|
16
|
+
win = $(window),
|
17
|
+
body,
|
18
|
+
sticky,
|
19
|
+
sticky_offset_top;
|
20
|
+
|
21
|
+
var methods = {
|
22
|
+
|
23
|
+
init : function( options ) {
|
24
|
+
|
25
|
+
// default options
|
26
|
+
var settings = $.extend({
|
27
|
+
sticky_class: "is-sticky",
|
28
|
+
body_class: "has-sticky",
|
29
|
+
offset_top: 0
|
30
|
+
}, options );
|
31
|
+
|
32
|
+
|
33
|
+
body = $("body");
|
34
|
+
sticky = this;
|
35
|
+
sticky_offset_top = sticky.offset().top - settings.offset_top;
|
36
|
+
|
37
|
+
win.on("scroll.framous.sticky", function(e){
|
38
|
+
var scroll_top = win.scrollTop();
|
39
|
+
if(sticky_offset_top < scroll_top)
|
40
|
+
{
|
41
|
+
sticky.addClass(settings.sticky_class);
|
42
|
+
body.addClass(settings.body_class);
|
43
|
+
}
|
44
|
+
else
|
45
|
+
{
|
46
|
+
sticky.removeClass(settings.sticky_class);
|
47
|
+
body.removeClass(settings.body_class);
|
48
|
+
}
|
49
|
+
});
|
50
|
+
|
51
|
+
win.trigger("scroll.framous.sticky");
|
52
|
+
|
53
|
+
// chaining
|
54
|
+
return this;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
$.fn.sticky = function(methodOrOptions)
|
59
|
+
{
|
60
|
+
if ( methods[methodOrOptions] )
|
61
|
+
{
|
62
|
+
return methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));
|
63
|
+
}
|
64
|
+
else if ( typeof methodOrOptions === 'object' || ! methodOrOptions )
|
65
|
+
{
|
66
|
+
// Default to "init"
|
67
|
+
return methods.init.apply( this, arguments );
|
68
|
+
}
|
69
|
+
else
|
70
|
+
{
|
71
|
+
$.error('Method ' + method + ' does not exist on jQuery.scrollspy');
|
72
|
+
}
|
73
|
+
};
|
74
|
+
|
75
|
+
}( jQuery ));
|
@@ -0,0 +1,162 @@
|
|
1
|
+
/*
|
2
|
+
* Toogle plugin for jQuery
|
3
|
+
* --
|
4
|
+
* source: http://github.com/borderlab/framous
|
5
|
+
* site:
|
6
|
+
*
|
7
|
+
* @author Thomas Hermant (http://hanami.be)
|
8
|
+
* Copyright 2013, Thomas Hermant
|
9
|
+
* Released under the MIT, BSD, and GPL Licenses.
|
10
|
+
*/
|
11
|
+
|
12
|
+
(function ( $ ) {
|
13
|
+
|
14
|
+
var is_touch = !!('ontouchstart' in window) || !!('onmsgesturechange' in window),
|
15
|
+
btns= {},
|
16
|
+
contents = {},
|
17
|
+
active_toggle = null,
|
18
|
+
update_checkbox = function(btn)
|
19
|
+
{
|
20
|
+
var checkbox = btn.find("input[type=checkbox]").eq(0);
|
21
|
+
if (btn.hasClass(btn.data("settings").active_btn_class))
|
22
|
+
{
|
23
|
+
checkbox[0].checked = true;
|
24
|
+
}
|
25
|
+
else
|
26
|
+
{
|
27
|
+
checkbox[0].checked = false;
|
28
|
+
}
|
29
|
+
},
|
30
|
+
// add event depending of touch device or not
|
31
|
+
add_event = function(el, action)
|
32
|
+
{
|
33
|
+
if(is_touch)
|
34
|
+
{
|
35
|
+
var init_x, int_y, delta_x, delta_y;
|
36
|
+
|
37
|
+
el.on("touchstart.framous.toggle", function(e){
|
38
|
+
init_x = (e && e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0].pageX) ? e.originalEvent.touches[0].pageX : 0;
|
39
|
+
init_y = (e && e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0].pageX) ? e.originalEvent.touches[0].pageY : 0;
|
40
|
+
delta_x = 0;
|
41
|
+
delta_y = 0;
|
42
|
+
});
|
43
|
+
|
44
|
+
el.on("touchmove.framous.toggle", function(e){
|
45
|
+
delta_x = e.originalEvent.touches[0].pageX - init_x;
|
46
|
+
delta_y = e.originalEvent.touches[0].pageY - init_y;
|
47
|
+
});
|
48
|
+
|
49
|
+
el.on("touchend.framous.toggle", function(e){
|
50
|
+
e.preventDefault();
|
51
|
+
|
52
|
+
// tap event -> no scroll
|
53
|
+
if(Math.abs(delta_x) < 2 && Math.abs(delta_y) < 2)
|
54
|
+
{
|
55
|
+
action(e);
|
56
|
+
}
|
57
|
+
});
|
58
|
+
}
|
59
|
+
else
|
60
|
+
{
|
61
|
+
el.on("click.framous.toggle",function(e){
|
62
|
+
action(e);
|
63
|
+
});
|
64
|
+
}
|
65
|
+
};
|
66
|
+
|
67
|
+
var methods = {
|
68
|
+
|
69
|
+
init : function( options ) {
|
70
|
+
|
71
|
+
// default options
|
72
|
+
var settings = $.extend({
|
73
|
+
active_btn_class: "is-active",
|
74
|
+
radio: false,
|
75
|
+
active_index : null
|
76
|
+
}, options );
|
77
|
+
|
78
|
+
var selector = this.selector;
|
79
|
+
|
80
|
+
// buttons
|
81
|
+
btns[selector] = this;
|
82
|
+
|
83
|
+
// chaining
|
84
|
+
this.each(function(index){
|
85
|
+
var btn = $(this);
|
86
|
+
btn.data("settings",settings);
|
87
|
+
|
88
|
+
var event_btn_action = function(e)
|
89
|
+
{
|
90
|
+
e.preventDefault();
|
91
|
+
// radio -> only one is active
|
92
|
+
if(settings.radio)
|
93
|
+
{
|
94
|
+
btns[selector].removeClass(settings.active_btn_class);
|
95
|
+
btns[selector].each(function(i){
|
96
|
+
var b = $(this);
|
97
|
+
update_checkbox(b);
|
98
|
+
});
|
99
|
+
}
|
100
|
+
|
101
|
+
btn.toggleClass(settings.active_btn_class);
|
102
|
+
update_checkbox(btn);
|
103
|
+
};
|
104
|
+
|
105
|
+
add_event(btn,event_btn_action);
|
106
|
+
|
107
|
+
// init default checkbox of button with the active_btn_class
|
108
|
+
if (btn.has(settings.active_btn_class))
|
109
|
+
{
|
110
|
+
update_checkbox(btn);
|
111
|
+
}
|
112
|
+
|
113
|
+
});
|
114
|
+
|
115
|
+
if (settings.active_index != null && settings.active_index != undefined && typeof settings.active_index == "object" && typeof settings.active_index.length == "number")
|
116
|
+
{
|
117
|
+
var l = settings.active_index.length;
|
118
|
+
var continue_bool = true;
|
119
|
+
for (var i = 0 ; (i < l) && continue_bool ; i++)
|
120
|
+
{
|
121
|
+
if(i < settings.active_index.length)
|
122
|
+
{
|
123
|
+
btns[selector].eq(settings.active_index[i]).click();
|
124
|
+
}
|
125
|
+
if (settings.radio)
|
126
|
+
{
|
127
|
+
continue_bool = false;
|
128
|
+
}
|
129
|
+
}
|
130
|
+
}
|
131
|
+
return this;
|
132
|
+
}
|
133
|
+
,
|
134
|
+
// select the indexed toggle
|
135
|
+
active : function(index) {
|
136
|
+
var btn = $(this.selector).eq(index);
|
137
|
+
btn.trigger(is_touch ? "touchstart.framous.toggle" : "click.framous.toggle");
|
138
|
+
if (is_touch)
|
139
|
+
{
|
140
|
+
btn.trigger("touchend.framous.toggle");
|
141
|
+
}
|
142
|
+
},
|
143
|
+
}
|
144
|
+
|
145
|
+
$.fn.toggle = function(methodOrOptions)
|
146
|
+
{
|
147
|
+
if ( methods[methodOrOptions] )
|
148
|
+
{
|
149
|
+
return methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));
|
150
|
+
}
|
151
|
+
else if ( typeof methodOrOptions === 'object' || ! methodOrOptions )
|
152
|
+
{
|
153
|
+
// Default to "init"
|
154
|
+
return methods.init.apply( this, arguments );
|
155
|
+
}
|
156
|
+
else
|
157
|
+
{
|
158
|
+
$.error( 'Method ' + method + ' does not exist on jQuery.tooltip' );
|
159
|
+
}
|
160
|
+
};
|
161
|
+
|
162
|
+
}( jQuery ));
|