Skip to content

Commit 0ddce76

Browse files
committed
minimizing mailchimp sign up so it doesn't load jquery
1 parent f396a41 commit 0ddce76

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+571
-9371
lines changed

about-author.html

Lines changed: 13 additions & 213 deletions
Original file line numberDiff line numberDiff line change
@@ -83,223 +83,23 @@ <h3>Where to now?</h3>
8383
</p>
8484
</div>
8585
</div>
86-
</div> <style type="text/css">
87-
#mc_embed_signup{background:#fff; clear:left; font:12px "Helvetica Neue",Arial,sans-serif; }
88-
/* Add your own MailChimp form style overrides in your site stylesheet or in this style block.
89-
We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */
90-
</style>
91-
<hr/>
92-
<div id="mc_embed_signup">
93-
<form action="http://mattmakai.us2.list-manage.com/subscribe/post?u=b7e774f0c4f05dcebbfee183d&amp;id=b22335388d" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
94-
<h4>Interested in a complete Full Stack Python book with detailed tutorials and example code? Sign up here and you'll get an alert email if a book is created. No other emails will be sent other than sign up confirmation.</h4>
95-
<div class="row">
96-
<div class="col-md-9">
97-
<label for="mce-EMAIL">Email Address</label>
98-
<input type="email" value="" name="EMAIL" class="required email form-control" id="mce-EMAIL">
86+
</div> <div id="mc_embed_signup">
87+
<form action="//mattmakai.us2.list-manage.com/subscribe/post?u=b7e774f0c4f05dcebbfee183d&amp;id=b22335388d" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
88+
<div id="mc_embed_signup_scroll">
89+
<h4>Interested in major updates to this site or an alert when a complete Full Stack Python book with detailed example code is released? Sign up here and you'll an occasional email only when there's big news to report.</h4>
90+
<div class="row">
91+
<div class="col-md-9">
92+
<input type="email" value="" name="EMAIL" class="email form-control" id="mce-EMAIL" placeholder="email address" required>
93+
<div style="position: absolute; left: -5000px;"><input type="text" name="b_b7e774f0c4f05dcebbfee183d_b22335388d" tabindex="-1" value=""></div>
94+
</div>
95+
<div class="col-md-3">
96+
<div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="btn btn-success" style="font-family: 'Helvetica Neue';"></div>
97+
</div>
9998
</div>
100-
<div class="col-md-3">
101-
<input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="btn btn-success" style="margin-top: 20px;">
10299
</div>
103-
<div id="mce-responses" class="clear">
104-
<div class="response" id="mce-error-response" style="display:none"></div>
105-
<div class="response" id="mce-success-response" style="display:none"></div>
106-
</div> <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
107-
<div style="position: absolute; left: -5000px;"><input type="text" name="b_b7e774f0c4f05dcebbfee183d_b22335388d" value=""></div>
108-
</div>
109100
</form>
110101
</div>
111-
<script type="text/javascript">
112-
var fnames = new Array();var ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='LNAME';ftypes[2]='text';
113-
try {
114-
var jqueryLoaded=jQuery;
115-
jqueryLoaded=true;
116-
} catch(err) {
117-
var jqueryLoaded=false;
118-
}
119-
var head= document.getElementsByTagName('head')[0];
120-
if (!jqueryLoaded) {
121-
var script = document.createElement('script');
122-
script.type = 'text/javascript';
123-
script.src = '//ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js';
124-
head.appendChild(script);
125-
if (script.readyState && script.onload!==null){
126-
script.onreadystatechange= function () {
127-
if (this.readyState == 'complete') mce_preload_check();
128-
}
129-
}
130-
}
131-
132-
var err_style = '';
133-
try{
134-
err_style = mc_custom_error_style;
135-
} catch(e){
136-
err_style = '#mc_embed_signup input.mce_inline_error{border-color:#6B0505;} #mc_embed_signup div.mce_inline_error{margin: 0 0 1em 0; padding: 5px 10px; background-color:#6B0505; font-weight: bold; z-index: 1; color:#fff;}';
137-
}
138-
var head= document.getElementsByTagName('head')[0];
139-
var style= document.createElement('style');
140-
style.type= 'text/css';
141-
if (style.styleSheet) {
142-
style.styleSheet.cssText = err_style;
143-
} else {
144-
style.appendChild(document.createTextNode(err_style));
145-
}
146-
head.appendChild(style);
147-
setTimeout('mce_preload_check();', 250);
148-
149-
var mce_preload_checks = 0;
150-
function mce_preload_check(){
151-
if (mce_preload_checks>40) return;
152-
mce_preload_checks++;
153-
try {
154-
var jqueryLoaded=jQuery;
155-
} catch(err) {
156-
setTimeout('mce_preload_check();', 250);
157-
return;
158-
}
159-
var script = document.createElement('script');
160-
script.type = 'text/javascript';
161-
script.src = 'http://downloads.mailchimp.com/js/jquery.form-n-validate.js';
162-
head.appendChild(script);
163-
try {
164-
var validatorLoaded=jQuery("#fake-form").validate({});
165-
} catch(err) {
166-
setTimeout('mce_preload_check();', 250);
167-
return;
168-
}
169-
mce_init_form();
170-
}
171-
function mce_init_form(){
172-
jQuery(document).ready( function($) {
173-
var options = { errorClass: 'mce_inline_error', errorElement: 'div', onkeyup: function(){}, onfocusout:function(){}, onblur:function(){} };
174-
var mce_validator = $("#mc-embedded-subscribe-form").validate(options);
175-
$("#mc-embedded-subscribe-form").unbind('submit');//remove the validator so we can get into beforeSubmit on the ajaxform, which then calls the validator
176-
options = { url: 'http://mattmakai.us2.list-manage.com/subscribe/post-json?u=b7e774f0c4f05dcebbfee183d&id=b22335388d&c=?', type: 'GET', dataType: 'json', contentType: "application/json; charset=utf-8",
177-
beforeSubmit: function(){
178-
$('#mce_tmp_error_msg').remove();
179-
$('.datefield','#mc_embed_signup').each(
180-
function(){
181-
var txt = 'filled';
182-
var fields = new Array();
183-
var i = 0;
184-
$(':text', this).each(
185-
function(){
186-
fields[i] = this;
187-
i++;
188-
});
189-
$(':hidden', this).each(
190-
function(){
191-
var bday = false;
192-
if (fields.length == 2){
193-
bday = true;
194-
fields[2] = {'value':1970};//trick birthdays into having years
195-
}
196-
if ( fields[0].value=='MM' && fields[1].value=='DD' && (fields[2].value=='YYYY' || (bday && fields[2].value==1970) ) ){
197-
this.value = '';
198-
} else if ( fields[0].value=='' && fields[1].value=='' && (fields[2].value=='' || (bday && fields[2].value==1970) ) ){
199-
this.value = '';
200-
} else {
201-
if (/\[day\]/.test(fields[0].name)){
202-
this.value = fields[1].value+'/'+fields[0].value+'/'+fields[2].value;
203-
} else {
204-
this.value = fields[0].value+'/'+fields[1].value+'/'+fields[2].value;
205-
}
206-
}
207-
});
208-
});
209-
$('.phonefield-us','#mc_embed_signup').each(
210-
function(){
211-
var fields = new Array();
212-
var i = 0;
213-
$(':text', this).each(
214-
function(){
215-
fields[i] = this;
216-
i++;
217-
});
218-
$(':hidden', this).each(
219-
function(){
220-
if ( fields[0].value.length != 3 || fields[1].value.length!=3 || fields[2].value.length!=4 ){
221-
this.value = '';
222-
} else {
223-
this.value = 'filled';
224-
}
225-
});
226-
});
227-
return mce_validator.form();
228-
},
229-
success: mce_success_cb
230-
};
231-
$('#mc-embedded-subscribe-form').ajaxForm(options);
232-
233-
234-
});
235-
}
236-
function mce_success_cb(resp){
237-
$('#mce-success-response').hide();
238-
$('#mce-error-response').hide();
239-
if (resp.result=="success"){
240-
$('#mce-'+resp.result+'-response').show();
241-
$('#mce-'+resp.result+'-response').html(resp.msg);
242-
$('#mc-embedded-subscribe-form').each(function(){
243-
this.reset();
244-
});
245-
} else {
246-
var index = -1;
247-
var msg;
248-
try {
249-
var parts = resp.msg.split(' - ',2);
250-
if (parts[1]==undefined){
251-
msg = resp.msg;
252-
} else {
253-
i = parseInt(parts[0]);
254-
if (i.toString() == parts[0]){
255-
index = parts[0];
256-
msg = parts[1];
257-
} else {
258-
index = -1;
259-
msg = resp.msg;
260-
}
261-
}
262-
} catch(e){
263-
index = -1;
264-
msg = resp.msg;
265-
}
266-
try{
267-
if (index== -1){
268-
$('#mce-'+resp.result+'-response').show();
269-
$('#mce-'+resp.result+'-response').html(msg);
270-
} else {
271-
err_id = 'mce_tmp_error_msg';
272-
html = '<div id="'+err_id+'" style="'+err_style+'"> '+msg+'</div>';
273-
274-
var input_id = '#mc_embed_signup';
275-
var f = $(input_id);
276-
if (ftypes[index]=='address'){
277-
input_id = '#mce-'+fnames[index]+'-addr1';
278-
f = $(input_id).parent().parent().get(0);
279-
} else if (ftypes[index]=='date'){
280-
input_id = '#mce-'+fnames[index]+'-month';
281-
f = $(input_id).parent().parent().get(0);
282-
} else {
283-
input_id = '#mce-'+fnames[index];
284-
f = $().parent(input_id).get(0);
285-
}
286-
if (f){
287-
$(f).append(html);
288-
$(input_id).focus();
289-
} else {
290-
$('#mce-'+resp.result+'-response').show();
291-
$('#mce-'+resp.result+'-response').html(msg);
292-
}
293-
}
294-
} catch(e){
295-
$('#mce-'+resp.result+'-response').show();
296-
$('#mce-'+resp.result+'-response').html(msg);
297-
}
298-
}
299-
}
300-
301-
</script>
302-
<!--End mc_embed_signup--> </div>
102+
</div>
303103
<div class="col-md-offset-1 col-md-3" id="sidebar">
304104
<div class="panel panel-success">
305105
<div class="panel-heading"><h3 class="panel-head">About the Author</h3></div>

0 commit comments

Comments
 (0)