1$(function() { 2 var $form = $('#home_registration'); 3 if ($form.length > 0) { 4 Mailcheck.domainThreshold = 1; 5 var emailSuggTmpl = '<div class="email_suggestion">' + gettext('Did you mean <a>{0}</a>?') + '</div>'; 6 $('.modal_box a').click(function(event) { 7 event.stopPropagation(); 8 }); 9 $('select:not("#lang-selector")').val(function(){ 10 return $(this).attr('data-selected'); 11 }); 12 $('select', $form).select2({ 13 width: '100%', 14 minimumResultsForSearch: 10 15 }); 16 $form.css('visibility', 'visible'); 17 if (otherSites) { 18 var $dialog = $('#redirect_dialog'); 19 $dialog.modal({ 20 backdrop: 'static', 21 keyboard: true, 22 show: false 23 }).off('click', 'a.close, #close_redirect_dialog') 24 .on('click', 'a.close, #close_redirect_dialog', function() { 25 $dialog.modal('hide'); 26 return false; 27 }).off('click', '#confirm_redirect_dialog') 28 .on('click', '#confirm_redirect_dialog', function() { 29 var redirectTo = $dialog.data('redirect-url'); 30 location.href = 'https://' + redirectTo; 31 }); 32 $('select', $form).on('change', function() { 33 var country = $(this).val(); 34 if (country in otherSites) { 35 $('h3', $dialog).html('Sign up in https://' + otherSites[country] + ' ?'); 36 $('.modal-body p', $dialog).html( 37 gettext("There's a BigML service that operates closer to your region.<br/> Please sign up here: <br/>") + 38 '<a href="https://' + otherSites[country] + '">https://' + otherSites[country] + '</a>' 39 ); 40 $dialog.data('redirect-url', otherSites[country]); 41 $dialog.modal('show'); 42 } 43 }); 44 } 45 $('body').on('bmlcc-init', function() { 46 if (bmlCc && bmlCc.options && bmlCc.options.country) { 47 var attrfilter = '[data-alternative-spellings^="' + bmlCc.options.country + '"]', 48 option = $('#id_country option', $form).filter(attrfilter); 49 50 if (option.length >= 1) { 51 $('#id_country', $form).select2('val', option.attr('value')); 52 } 53 } 54 }).on('click', '.email_suggestion a', function(){ 55 var $this = $(this), 56 suggestion = $this.text(); 57 58 $('#id_email').val(suggestion); 59 $this.parent().remove(); 60 return false; 61 }); 62 $('#id_email').on('blur', function(){ 63 $(this).mailcheck({ 64 suggested: function(element, suggestion) { 65 var emailParts = Mailcheck.splitEmail(suggestion.full); 66 if (Mailcheck.defaultDomains.indexOf(suggestion.domain) > -1 || 67 Mailcheck.defaultSecondLevelDomains.indexOf(emailParts.secondLevelDomain) > -1 || 68 Mailcheck.defaultTopLevelDomains.indexOf(emailParts.topLevelDomain) > -1) { 69 $('.email_suggestion', $form).remove(); 70 $('#div_id_email', $form).before(emailSuggTmpl.replace('{0}', suggestion.full)); 71 } else { 72 $('.email_suggestion', $form).remove(); 73 } 74 }, 75 empty: function(element) { 76 $('.email_suggestion', $form).remove(); 77 } 78 }); 79 }); 80 $form.submit(function () { 81 if ($('[type="submit"]', $form).attr('disabled')) { 82 return false; 83 } 84 $('[type="submit"]', $form).attr('disabled', 'disabled'); 85 }); 86 } 87 88 if ($('.announcement').length) { 89 $('#banners').slick({ 90 // arrows: false, 91 autoplay: true, 92 autoplaySpeed: 2500, 93 pauseOnHover: true, 94 //pauseOnFocus: true, 95 infinite: true, 96 swipe: true, 97 fade: true, 98 cssEase: 'linear' 99 // adaptiveHeight: true 100 }); 101 } 102 103 $('#relevant_info .item img').one('error', function() { 104 $(this).attr('src', STATIC_URL + 'cms/images/default-small.png'); 105 }); 106});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.