1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
|
/*
Astral 2.5 by HTML5 UP
html5up.net | @n33co
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
*/
window._skel_config = {
prefix: 'css/style',
pollOnce: true,
resetCSS: true,
useOrientation: false,
breakpoints: {
'mobile': {
range: '-480',
lockViewport: true,
containers: 'fluid',
grid: {
collapse: true
}
},
'desktop': {
range: '481-',
containers: 1200
}
}
};
jQuery(window).load(function() {
jQuery.fn.n33_formerize=function(){var _fakes=new Array(),_form = jQuery(this);_form.find('input[type=text],textarea').each(function() { var e = jQuery(this); if (e.val() == '' || e.val() == e.attr('placeholder')) { e.addClass('formerize-placeholder'); e.val(e.attr('placeholder')); } }).blur(function() { var e = jQuery(this); if (e.attr('name').match(/_fakeformerizefield$/)) return; if (e.val() == '') { e.addClass('formerize-placeholder'); e.val(e.attr('placeholder')); } }).focus(function() { var e = jQuery(this); if (e.attr('name').match(/_fakeformerizefield$/)) return; if (e.val() == e.attr('placeholder')) { e.removeClass('formerize-placeholder'); e.val(''); } }); _form.find('input[type=password]').each(function() { var e = jQuery(this); var x = jQuery(jQuery('<div>').append(e.clone()).remove().html().replace(/type="password"/i, 'type="text"').replace(/type=password/i, 'type=text')); if (e.attr('id') != '') x.attr('id', e.attr('id') + '_fakeformerizefield'); if (e.attr('name') != '') x.attr('name', e.attr('name') + '_fakeformerizefield'); x.addClass('formerize-placeholder').val(x.attr('placeholder')).insertAfter(e); if (e.val() == '') e.hide(); else x.hide(); e.blur(function(event) { event.preventDefault(); var e = jQuery(this); var x = e.parent().find('input[name=' + e.attr('name') + '_fakeformerizefield]'); if (e.val() == '') { e.hide(); x.show(); } }); x.focus(function(event) { event.preventDefault(); var x = jQuery(this); var e = x.parent().find('input[name=' + x.attr('name').replace('_fakeformerizefield', '') + ']'); x.hide(); e.show().focus(); }); x.keypress(function(event) { event.preventDefault(); x.val(''); }); }); _form.submit(function() { jQuery(this).find('input[type=text],input[type=password],textarea').each(function(event) { var e = jQuery(this); if (e.attr('name').match(/_fakeformerizefield$/)) e.attr('name', ''); if (e.val() == e.attr('placeholder')) { e.removeClass('formerize-placeholder'); e.val(''); } }); }).bind("reset", function(event) { event.preventDefault(); jQuery(this).find('select').val(jQuery('option:first').val()); jQuery(this).find('input,textarea').each(function() { var e = jQuery(this); var x; e.removeClass('formerize-placeholder'); switch (this.type) { case 'submit': case 'reset': break; case 'password': e.val(e.attr('defaultValue')); x = e.parent().find('input[name=' + e.attr('name') + '_fakeformerizefield]'); if (e.val() == '') { e.hide(); x.show(); } else { e.show(); x.hide(); } break; case 'checkbox': case 'radio': e.attr('checked', e.attr('defaultValue')); break; case 'text': case 'textarea': e.val(e.attr('defaultValue')); if (e.val() == '') { e.addClass('formerize-placeholder'); e.val(e.attr('placeholder')); } break; default: e.val(e.attr('defaultValue')); break; } }); window.setTimeout(function() { for (x in _fakes) _fakes[x].trigger('formerize_sync'); }, 10); }); return _form; };
/*********************************************************************************/
/* Settings */
/*********************************************************************************/
var settings = {
resizeSpeed: 600, // Speed to resize panel
fadeSpeed: 300, // Speed to fade in/out
sizeFactor: 11.5, // Size factor
sizeMin: 15, // Minimum point size
sizeMax: 20 // Maximum point size
};
/*********************************************************************************/
/* Vars */
/*********************************************************************************/
var _window = jQuery(window),
_main = jQuery('#main'),
_panels = _main.find('.panel'),
_body = jQuery('body'),
_hbw = jQuery('html,body,window'),
_footer = jQuery('#footer'),
_wrapper = jQuery('#wrapper'),
_nav = jQuery('#nav'), _nav_links = _nav.find('a'),
_jumplinks = jQuery('.jumplink');
var panels = [],
activePanelId = null,
firstPanelId = null,
isLocked = false,
isTouch = !!('ontouchstart' in window),
isLegacyIE = (navigator.userAgent.match(/MSIE ([0-9]+)\./) && RegExp.$1 <= 9);
if (isTouch)
{
settings.fadeSpeed = 0;
settings.resizeSpeed = 0;
_nav_links.find('span').remove();
}
/*********************************************************************************/
/* Main (Desktop) */
/*********************************************************************************/
if (isLegacyIE || skel.isActive('desktop'))
{
// Body
_body.h5u_resize = function() {
var factor = (_window.width() * _window.height()) / (1440 * 900);
_body.css('font-size', Math.min(Math.max(Math.floor(factor * settings.sizeFactor), settings.sizeMin), settings.sizeMax) + 'pt');
_main.height(panels[activePanelId].outerHeight());
_body.h5u_reposition();
};
_body.h5u_reposition = function() {
if (isTouch && (window.orientation == 0 || window.orientation == 180))
_wrapper.css('padding-top', Math.max(((_window.height() - (panels[activePanelId].outerHeight() + _footer.outerHeight())) / 2) - _nav.height(), 30) + 'px');
else
_wrapper.css('padding-top', (((_window.height() - panels[firstPanelId].height()) / 2) - _nav.height()) + 'px');
};
// Panels
_panels.each(function(i) {
var t = jQuery(this), id = t.attr('id');
panels[id] = t;
if (i == 0)
{
firstPanelId = id;
activePanelId = id;
}
else
t.hide();
t.h5u_activate = function() {
// Check lock state and determine whether we're already at the target
if (isLocked
|| activePanelId == id)
return false;
// Lock
isLocked = true;
// Change nav link (if it exists)
_nav_links.removeClass('active');
_nav_links.filter('[href="#' + id + '"]').addClass('active');
// Add bottom padding
var x = parseInt(_wrapper.css('padding-top')) +
panels[id].outerHeight() +
_nav.outerHeight() +
_footer.outerHeight();
if (x > _window.height())
_wrapper.addClass('tall');
else
_wrapper.removeClass('tall');
// Fade out active panel
_footer.fadeTo(settings.fadeSpeed, 0.0001);
panels[activePanelId].fadeOut(settings.fadeSpeed, function() {
// Set new active
activePanelId = id;
// Force scroll to top
_hbw.animate({
scrollTop: 0
}, settings.resizeSpeed, 'swing');
// Reposition
_body.h5u_reposition();
// Resize main to height of new panel
_main.animate({
height: panels[activePanelId].outerHeight()
}, settings.resizeSpeed, 'swing', function() {
// Fade in new active panel
_footer.fadeTo(settings.fadeSpeed, 1.0);
panels[activePanelId].fadeIn(settings.fadeSpeed, function() {
// Unlock
isLocked = false;
});
});
});
};
});
// Nav + Jumplinks
_nav_links.add(_jumplinks).click(function(e) {
var t = jQuery(this), href = t.attr('href'), id;
if (href.substring(0,1) == '#')
{
e.preventDefault();
e.stopPropagation();
id = href.substring(1);
if (id in panels)
panels[id].h5u_activate();
}
});
// Window
_window
.resize(function() {
if (!isLocked)
_body.h5u_resize();
});
// Forms (IE <= 9 only)
if (isLegacyIE)
jQuery('form').n33_formerize();
// Init
_window
.trigger('resize');
_wrapper
.fadeTo(400, 1.0);
}
});
|