1$(function(){ 2 $(document).on('click', '.show-modal', function(){ 3 var self = $(this), 4 target = $(self.attr('data-target')), 5 ajax_url = self.attr('data-url') || self.attr('href'), 6 header = self.attr('data-header')||''; 7 var h4 = target.find('.modal-header').find('h4'); 8 if (h4.length === 0) { 9 $('<h4>'+header+'</h4>').appendTo(target.find('.modal-header')); 10 } else { 11 h4.text(header); 12 } 13 if (ajax_url) { 14 var body = target.modal('show').find('.modal-body').empty(); 15 $.ajax({ 16 url: ajax_url, 17 success: function (response) { 18 body.html(response); 19 }, 20 error: function (jqXHR) { 21 body.html('<div class="error-summary">'+jqXHR.responseText+'</div>'); 22 } 23 }); 24 return false; 25 } 26 }); 27 $(document).on('submit', 'form[data-ajax]', function(event) { 28 event.preventDefault(); 29 var formData = new FormData(this); 30 var form = $(this); 31 var body = form.closest('.modal-body').empty(); 32 // submit form 33 $.ajax({ 34 url: form.attr('action'), 35 type: 'post', 36 enctype: 'multipart/form-data', 37 processData: false, // tell jQuery not to process the data 38 contentType: false, // tell jQuery not to set contentType 39 data: formData, 40 success: function (response) { 41 body.html(response); 42 }, 43 error: function (jqXHR, textStatus, errorThrown) { 44 body.html('<div class="error-summary">'+jqXHR.responseText+'</div>'); 45 } 46 }); 47 return false; 48 }); 49 $('body').on('click', 'a[data-ajax]', function () { 50 var self = $(this), 51 modal_body = self.closest('.modal-body').empty(); 52 $.ajax({ 53 url: self.attr('href'), 54 success: function (response) { 55 modal_body.html(response); 56 }, 57 error: function (jqXHR) { 58 modal_body.html('<div class="error-summary">'+jqXHR.responseText+'</div>'); 59 } 60 }); 61 return false; 62 }); 63});
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.