1$(function() { 2 var s3From = { 3 init: function() { 4 this.initForms(); 5 }, 6 initForms: function(parent) { 7 var self = this; 8 if (!parent) parent = document; 9 if ($(parent)[0] == document || !$(parent).is('[data-api-url][data-api-type=form]')) { 10 parent = $(parent).find('[data-api-url][data-api-type=form]'); 11 } 12 13 $(parent).each(function() { 14 var obj = $(this); 15 var form = obj.is("form") ? obj : obj.find("form"); 16 form.submit(function() { 17 $.post(obj.data('api-url'), form.serialize(), function(response) { 18 if (response.result.html) { 19 var uploaders_inits = ''; 20 var scripts = response.result.html.match(/<script[^>]*>[^<]*newSWFU[^<]*<\/script>/gm); 21 if (scripts) { 22 for (var i = 0; i < scripts.length; i++) { 23 uploaders_inits += scripts[i].replace(/<script[^>]*>([^<]+)<\/script>/, "$1"); 24 } 25 } 26 var replacement = $(response.result.html.replace(/[\r\n]/g, '').replace(/<script[^>]*>.*?<\/script>/g, '')); 27 if (!$(replacement).is('[data-api-url][data-api-type=form]')) { 28 replacement = $(replacement).find('[data-api-url][data-api-type=form]'); 29 } 30 obj.replaceWith(replacement); 31 32 var $captcha = replacement.find('input[name=_cn]'); 33 if ($captcha.length) { 34 $.getScript('http://captcha.oml.ru/static/captcha.js?2', function() { 35 var $d = replacement.find("[id^=s3_captcha_cn]"); 36 mgCaptcha.draw("/my/s3/captcha/get.php", ($d.length ? $d.get(0) : null)); 37 });
38 } 39 self.initForms(replacement); 40 if (uploaders_inits) { 41 eval(uploaders_inits); 42 } 43 } 44 }); 45 return false; 46 }); 47 var formCalendars = form.find('.init-calendar'); 48 var formCalendarsInterval = form.find('.type-calendar_interval'); 49 if (formCalendars.length || formCalendarsInterval.length) { 50 var uiStyle = $('<link href="/g/s3/anketa2/1.0.0/css/jquery-ui.css" rel="stylesheet" type="text/css"/>'); 51 uiStyle.appendTo($('head')); 52 53 formCalendars.each(function(){ 54 var thisInputCalendar = $(this); 55 thisInputCalendar.datepicker({ 56 changeMonth: true, 57 changeYear: true 58 }); 59 }); 60 61 formCalendarsInterval.each(function(){ 62 var thisCalendar_interval = $(this); 63 var inputInterval = thisCalendar_interval.find('[type="text"]'); 64 var hiddenInput = thisCalendar_interval.find('.init-calendar-interval'); 65 inputInterval.eq(0).datepicker({ 66 changeMonth: true, 67 changeYear: true, 68 onClose: function( selectedDate ) { 69 inputInterval.eq(1).datepicker( "option", "minDate", selectedDate ); 70 } 71 }); 72 inputInterval.eq(1).datepicker({ 73 changeMonth: true, 74 changeYear: true, 75 onClose: function( selectedDate ) { 76 inputInterval.eq(0).datepicker( "option", "maxDate", selectedDate ); 77 var selectedVal = inputInterval.eq(0).val() + ' - ' + inputInterval.eq(1).val(); 78 hiddenInput.val(selectedVal); 79 } 80 }); 81 }); 82 }; 83 if (form.find('.upload-button').size()) { 84 $('.tpl-anketa form').find('script:contains("newSWFU")').each(function() { 85 var scr = $(this).text(); 86 var matches = scr.match(/newSWFU\((\s*\d+\s*),/); 87 if (matches.length == 2) { 88 var field = matches[1]; 89 form.find('#fsUploadProgress' + field).attr('id', 'fsUploadProgress_' + field); 90 form.find('#spanButtonPlaceHolder' + field).attr('id', 'spanButtonPlaceHolder_' + field); 91 form.find('#hidUploadField' + field).attr('id', 'hidUploadField_' + field); 92 eval(scr.replace(/newSWFU\((\s*\d+\s*),/, 'newSWFU("_$1",')); 93 } 94 }); 95 }; 96 }) 97 } 98 }; 99 s3From.init(); 100});
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.